diff --git a/.github/workflows/django-checks.yml b/.github/workflows/django-checks.yml new file mode 100644 index 000000000..76443d07f --- /dev/null +++ b/.github/workflows/django-checks.yml @@ -0,0 +1,66 @@ +name: "Django checks" + +on: + pull_request: + paths: + - "docker/web/**" + - "docker/ruff.toml" + - ".github/workflows/django-checks.yml" + push: + branches: + - "main" + - "devel" + - "beta" + paths: + - "docker/web/**" + - "docker/ruff.toml" + - ".github/workflows/django-checks.yml" + +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + # Pinned: ruff's default rules and its findings change between releases. + - name: Install ruff + run: pip install ruff==0.16.10 + + # Only undefined names and syntax errors fail the build for now. The rest of + # docker/ruff.toml's rules still report findings (unused imports and the like) + # that need a cleanup pass before they can be enforced. + - name: Check for undefined names and syntax errors + working-directory: docker + run: ruff check web/ --select F821,E9 --output-format github + + migrations: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" # Matches the python:3.12 base image in docker/Dockerfile + cache: pip + cache-dependency-path: docker/web/requirements.txt + + - name: Install dependencies + run: pip install -r docker/web/requirements.txt + + # settings.py keeps the secret key and database in /data, as in the container. + - name: Create the data directory + run: sudo install -d -o "$USER" /data + + - name: Run Django system checks + working-directory: docker/web/nspanelmanager + run: python manage.py check + + # Fails if a model change has no migration, which would leave existing installs + # with a database that doesn't match the code after upgrading. + - name: Check for missing migrations + working-directory: docker/web/nspanelmanager + run: python manage.py makemigrations --check --dry-run diff --git a/.github/workflows/django-tests.yml b/.github/workflows/django-tests.yml new file mode 100644 index 000000000..9409a9468 --- /dev/null +++ b/.github/workflows/django-tests.yml @@ -0,0 +1,113 @@ +name: "Django tests" + +on: + pull_request: + paths: + - "docker/web/**" + # web/tests/test_rest_v2_settings.py checks /rest/v2/settings against MQTTManager's setting keys. + - "docker/MQTTManager/include/mqtt_manager_config/mqtt_manager_config.hpp" + - ".github/workflows/django-tests.yml" + push: + branches: + - "main" + - "devel" + - "beta" + paths: + - "docker/web/**" + # web/tests/test_rest_v2_settings.py checks /rest/v2/settings against MQTTManager's setting keys. + - "docker/MQTTManager/include/mqtt_manager_config/mqtt_manager_config.hpp" + - ".github/workflows/django-tests.yml" + +# Fork pull requests already get a read-only token and no repository secrets; this keeps +# same-repo runs read-only too. Don't switch to pull_request_target or add a workflow_run +# follow-up without reviewing what code it checks out: those run with secrets. +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" # Matches the python:3.12 base image in docker/Dockerfile + cache: pip + cache-dependency-path: docker/web/requirements*.txt + + # requirements-dev.txt adds drf-spectacular, so test_openapi.py runs here. + - name: Install dependencies + run: pip install -r docker/web/requirements-dev.txt unittest-xml-reporting + + - name: Run tests + run: docker/web/run_tests.sh -v 2 + env: + NSPM_TEST_JUNIT_DIR: ${{ github.workspace }}/test-results + + # annotate_only writes the job summary and failure annotations without creating a + # check run, which needs checks: write and so fails on pull requests from forks. + - name: Report test results + if: ${{ !cancelled() }} + uses: mikepenz/action-junit-report@v6 + with: + report_paths: test-results/*.xml + annotate_only: true + detailed_summary: true + include_passed: true + require_tests: true + + # The release image installs only requirements.txt (docker/Dockerfile). drf-spectacular is dev-only + # because its rpds-py dependency has no wheel for every release architecture (armhf), so check the + # app and its tests work without it. + prod-deps: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" # Matches the python:3.12 base image in docker/Dockerfile + cache: pip + cache-dependency-path: docker/web/requirements.txt + + - name: Install the release image's dependencies only + run: pip install -r docker/web/requirements.txt + + - name: Check development-only packages are absent + run: | + for module in drf_spectacular jsonschema rpds; do + if python -c "import $module" 2>/dev/null; then + echo "::error::$module is importable with only docker/web/requirements.txt installed; it must stay in requirements-dev.txt" + exit 1 + fi + done + + - name: Run tests + run: docker/web/run_tests.sh + + # test_openapi.py checks openapi.yaml against the DRF views; this checks the UI's generated + # TypeScript types against openapi.yaml. Together they catch a contract change committed + # without running docker/web/generate_api.sh. + api-types: + runs-on: ubuntu-latest + defaults: + run: + working-directory: docker/web/nspanelmanager/web/react-components + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: "22" + + - name: Regenerate TypeScript types from openapi.yaml + run: npm run generate:api-types + + - name: Check the committed types are up to date + run: | + if [ -n "$(git status --porcelain -- src/api/schema.d.ts)" ]; then + git diff -- src/api/schema.d.ts + echo "::error file=docker/web/nspanelmanager/web/react-components/src/api/schema.d.ts::src/api/schema.d.ts is out of date with docker/web/openapi.yaml. Run docker/web/generate_api.sh and commit the result." + exit 1 + fi diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 000000000..7fce7a673 --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,91 @@ +name: "Docker build" + +# Builds the release image without pushing it, so a broken Dockerfile, dependency or cross-compile +# shows up on the pull request instead of when a release is published. Pull requests and pushes build +# amd64 and aarch64; the weekly run and manual runs also build the 32-bit platforms. + +on: + pull_request: + paths: + - "docker/**" + - ".github/workflows/docker-build.yml" + push: + branches: + - "main" + - "devel" + - "beta" + paths: + - "docker/**" + - ".github/workflows/docker-build.yml" + schedule: + - cron: "0 4 * * 1" + workflow_dispatch: + +# A new push to a pull request supersedes its running build, which can take an hour. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + build: + name: Build ${{ matrix.arch }} + runs-on: ubuntu-latest + # Building the Conan dependencies from source takes about an hour when the cache is cold. + timeout-minutes: 150 + strategy: + fail-fast: false + matrix: + # Same architectures as release.yml and docker/config.yaml. + arch: ${{ fromJSON((github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && '["amd64", "aarch64", "armv7", "armhf", "i386"]' || '["amd64", "aarch64"]') }} + steps: + - uses: actions/checkout@v4 + + - name: Map architecture to Docker platform + id: platform + run: | + case "${{ matrix.arch }}" in + amd64) echo "platform=linux/amd64" >> "$GITHUB_OUTPUT" ;; + aarch64) echo "platform=linux/arm64" >> "$GITHUB_OUTPUT" ;; + armv7) echo "platform=linux/arm/v7" >> "$GITHUB_OUTPUT" ;; + armhf) echo "platform=linux/arm/v6" >> "$GITHUB_OUTPUT" ;; + i386) echo "platform=linux/386" >> "$GITHUB_OUTPUT" ;; + *) echo "Unknown architecture ${{ matrix.arch }}"; exit 1 ;; + esac + + # MQTTManager is cross-compiled on the runner's platform, but the final stage runs the + # target platform's apt-get and pip, which needs emulation. + - uses: docker/setup-qemu-action@v3 + + - uses: docker/setup-buildx-action@v3 + id: buildx + + - name: Cache Conan packages + id: conan-cache + uses: actions/cache@v4 + with: + path: conan-cache + key: docker-conan-${{ matrix.arch }}-${{ hashFiles('docker/MQTTManager/conanfile.py', 'docker/build_scripts/install_build_tools.sh') }} + restore-keys: docker-conan-${{ matrix.arch }}- + + # Moves the cached directory into the Dockerfile's Conan cache mount before the build, + # and back out afterwards so actions/cache can save it. + - name: Restore Conan cache mount + uses: reproducible-containers/buildkit-cache-dance@v3 + with: + builder: ${{ steps.buildx.outputs.name }} + cache-map: | + { + "conan-cache": { + "target": "/MQTTManager/conan_cache", + "id": "nspm-conan", + "sharing": "locked" + } + } + skip-extraction: ${{ steps.conan-cache.outputs.cache-hit }} + + - name: Build image + uses: docker/build-push-action@v6 + with: + context: docker + platforms: ${{ steps.platform.outputs.platform }} + push: false diff --git a/.github/workflows/mqttmanager-tests.yml b/.github/workflows/mqttmanager-tests.yml new file mode 100644 index 000000000..36e94ae71 --- /dev/null +++ b/.github/workflows/mqttmanager-tests.yml @@ -0,0 +1,60 @@ +name: "MQTTManager tests" + +on: + pull_request: + paths: + - "docker/MQTTManager/**" + - ".github/workflows/mqttmanager-tests.yml" + push: + branches: + - "main" + - "devel" + paths: + - "docker/MQTTManager/**" + - ".github/workflows/mqttmanager-tests.yml" + +jobs: + test: + runs-on: ubuntu-latest + # Building the Conan dependencies from source takes about an hour when the cache is cold. + timeout-minutes: 120 + env: + # Host directory mounted as the container's Conan package cache (see run_tests.sh). + NSPM_TEST_CONAN_CACHE: ${{ github.workspace }}/.conan-cache + steps: + - uses: actions/checkout@v4 + + - name: Restore Conan packages + id: conan-cache + uses: actions/cache/restore@v4 + with: + path: ${{ env.NSPM_TEST_CONAN_CACHE }} + key: mqttmanager-conan-${{ hashFiles('docker/MQTTManager/conanfile.py', 'docker/MQTTManager/tests/docker/Dockerfile') }} + restore-keys: mqttmanager-conan- + + - name: Build and run tests + run: | + mkdir -p "$NSPM_TEST_CONAN_CACHE" + docker/MQTTManager/run_tests.sh + env: + NSPM_TEST_RESULTS_DIR: ${{ github.workspace }}/test-results + + # annotate_only writes the job summary and failure annotations without creating a + # check run, which needs checks: write and so fails on pull requests from forks. + - name: Report test results + if: ${{ !cancelled() }} + uses: mikepenz/action-junit-report@v6 + with: + report_paths: test-results/*.xml + annotate_only: true + detailed_summary: true + include_passed: true + require_tests: true + + # Saved even when the tests fail, so a failing test does not cost another dependency build. + - name: Save Conan packages + if: always() && steps.conan-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: ${{ env.NSPM_TEST_CONAN_CACHE }} + key: ${{ steps.conan-cache.outputs.cache-primary-key }} diff --git a/.github/workflows/protobuf.yml b/.github/workflows/protobuf.yml new file mode 100644 index 000000000..611131dfc --- /dev/null +++ b/.github/workflows/protobuf.yml @@ -0,0 +1,60 @@ +name: "Protobuf" + +# The code generated from docker/protobuf/*.proto is committed. Check that it matches the .proto +# files, and that protoc and both protobuf runtimes are on the same release: the generated C++ +# refuses to compile, and the generated Python refuses to import, against a different version. + +on: + pull_request: + paths: + - "docker/protobuf/**" + - "docker/MQTTManager/include/protobuf/**" + - "docker/MQTTManager/conanfile.py" + - "docker/web/nspanelmanager/web/protobuf/**" + - "docker/web/requirements.txt" + - "protobuf_firmware/**" + - ".github/workflows/protobuf.yml" + push: + branches: + - "main" + - "devel" + - "beta" + paths: + - "docker/protobuf/**" + - "docker/MQTTManager/include/protobuf/**" + - "docker/MQTTManager/conanfile.py" + - "docker/web/nspanelmanager/web/protobuf/**" + - "docker/web/requirements.txt" + - "protobuf_firmware/**" + - ".github/workflows/protobuf.yml" + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Check protobuf versions match + run: | + protoc_version=$(sed -nE 's/^REMOTE_FILE="protoc-([0-9.]+)-.*/\1/p' docker/protobuf/install_protobuf.sh) + conan_version=$(sed -nE 's/.*"protobuf\/([0-9.]+)".*/\1/p' docker/MQTTManager/conanfile.py) + python_version=$(sed -nE 's/^protobuf==([0-9.]+).*/\1/p' docker/web/requirements.txt) + echo "protoc $protoc_version, Conan protobuf $conan_version, Python protobuf $python_version" + # protoc 27.0 is the protoc of the 5.27.0 C++ and Python runtimes. + if [ -z "$protoc_version" ] || [ "5.$protoc_version" != "$conan_version" ] || [ "$conan_version" != "$python_version" ]; then + echo "::error::protoc ($protoc_version in install_protobuf.sh), Conan protobuf ($conan_version in conanfile.py) and Python protobuf ($python_version in requirements.txt) must be the same release" + exit 1 + fi + + # The same script contributors run, so a failure here is fixed by running it locally. + - name: Regenerate + run: bash docker/protobuf/regenerate.sh + + - name: Check generated code is up to date + run: | + git add --intent-to-add --all + if ! git diff --exit-code --stat; then + git diff + echo "::error::Generated protobuf code is out of date. Run docker/protobuf/regenerate.sh (needs only Docker) and commit the result." + exit 1 + fi diff --git a/.github/workflows/react-components.yml b/.github/workflows/react-components.yml new file mode 100644 index 000000000..dd154021d --- /dev/null +++ b/.github/workflows/react-components.yml @@ -0,0 +1,56 @@ +name: "React components" + +# The React components in docker/web/nspanelmanager/web/react-components are built into dist/ and +# templates/scripts.html, which are committed and served as-is: the Docker image does not rebuild +# them. Check that they type-check, build, and match what is committed. + +on: + pull_request: + paths: + - "docker/web/nspanelmanager/web/react-components/**" + - ".github/workflows/react-components.yml" + push: + branches: + - "main" + - "devel" + - "beta" + paths: + - "docker/web/nspanelmanager/web/react-components/**" + - ".github/workflows/react-components.yml" + +defaults: + run: + working-directory: docker/web/nspanelmanager/web/react-components + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: "22" + cache: npm + cache-dependency-path: docker/web/nspanelmanager/web/react-components/package-lock.json + + - name: Install dependencies + run: npm ci --no-audit --no-fund + + # "build" runs tsc -b before vite build, so this is also the type check. + - name: Type-check and build + run: npm run build + + - name: Check the committed build is up to date + run: | + git add --intent-to-add --all . + if ! git diff --exit-code --stat -- .; then + echo "::error::dist/ or templates/scripts.html is out of date. Run the build in react-components and commit the result." + exit 1 + fi + + # Reported but not enforced yet: the existing code has 30 errors, mostly no-explicit-any and + # react-refresh/only-export-components. + - name: Lint + continue-on-error: true + run: npx eslint . diff --git a/.github/workflows/react-tests.yml b/.github/workflows/react-tests.yml new file mode 100644 index 000000000..30a427cae --- /dev/null +++ b/.github/workflows/react-tests.yml @@ -0,0 +1,55 @@ +name: "React tests" + +on: + pull_request: + paths: + - "docker/web/nspanelmanager/web/react-components/**" + - ".github/workflows/react-tests.yml" + push: + branches: + - "main" + - "devel" + - "beta" + paths: + - "docker/web/nspanelmanager/web/react-components/**" + - ".github/workflows/react-tests.yml" + +# Fork pull requests already get a read-only token and no repository secrets; this keeps +# same-repo runs read-only too. Don't switch to pull_request_target or add a workflow_run +# follow-up without reviewing what code it checks out: those run with secrets. +permissions: + contents: read + +defaults: + run: + working-directory: docker/web/nspanelmanager/web/react-components + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: "22" # Vite, Vitest and jsdom all support ^22.12.0 + cache: npm + cache-dependency-path: docker/web/nspanelmanager/web/react-components/package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Type check + run: npx tsc -b + + - name: Run tests + run: npm test -- --reporter=default --reporter=junit --outputFile.junit=${{ github.workspace }}/test-results/react.xml + + # annotate_only writes the job summary and failure annotations without creating a + # check run, which needs checks: write and so fails on pull requests from forks. + - name: Report test results + if: ${{ !cancelled() }} + uses: mikepenz/action-junit-report@v6 + with: + report_paths: test-results/*.xml + annotate_only: true diff --git a/.github/workflows/tft-build.yml b/.github/workflows/tft-build.yml new file mode 100644 index 000000000..b1dd29b43 --- /dev/null +++ b/.github/workflows/tft-build.yml @@ -0,0 +1,78 @@ +name: "TFT build" + +on: + pull_request: + paths: + - "docker/HMI_files/**" + - ".github/workflows/tft-build.yml" + push: + branches: + - "main" + - "devel" + - "beta" + paths: + - "docker/HMI_files/**" + - ".github/workflows/tft-build.yml" + workflow_dispatch: + +# Fork pull requests already get a read-only token and no repository secrets; this keeps +# same-repo runs read-only too. +permissions: + contents: read + +defaults: + run: + working-directory: docker/HMI_files/tft_automation + +jobs: + check: + name: Check the committed HMIs, pictures and TFTs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install nextion-tools, numpy and Pillow + run: python -m pip install -r requirements.txt + + - name: Unit tests + run: python -m unittest discover -v -s tests -t . + + # Fails if a TFT wasn't compiled from its HMI, or isn't what make_tfts.sh builds, or a + # progress bar's pictures don't match the bar in the HMI. + - name: Check the committed build + run: python check_build.py + + render: + name: Render the pictures and rebuild the TFTs + needs: check + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install nextion-tools, numpy and Pillow + run: python -m pip install -r requirements.txt + + - name: Render the pictures + run: ./make_pictures.sh + + # Fails if GIMP's output differs from the committed pictures, for example after changing + # an .xcf or .scm without committing the pictures, or if the TFTs don't follow from them. + - name: Compare with the committed pictures and TFTs + run: python check_build.py --rendered + + - name: Upload the render log + if: ${{ !cancelled() }} + uses: actions/upload-artifact@v4 + with: + name: pictures-run-log + path: docker/HMI_files/tft_automation/last_pictures_run.log + if-no-files-found: ignore diff --git a/.gitignore b/.gitignore index a170b6c78..cc60659b3 100644 --- a/.gitignore +++ b/.gitignore @@ -41,8 +41,5 @@ firmware/NSPanelManagerFirmware/CMakeLists.txt # MacOS .DS_Store - -# Ignore only neccesary files from LaTeX manual -docs/tex/* -!docs/tex/*.pdf -!docs/tex/*.tex +docker/MQTTManager/tests/last_run.log +docker/HMI_files/tft_automation/last_pictures_run.log diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..29b082032 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,85 @@ +# Contributing + +## Changing the REST API + +The `/rest/v2/*` endpoints are Django REST Framework views in `docker/web/nspanelmanager/web/rest_v2/`, and the React UI calls them through a typed client. (The older `/rest/*` endpoints in `web/rest.py` are plain Django views and aren't covered.) The chain is: + +``` +serializers + views in web/rest_v2/ + │ drf-spectacular + ▼ +docker/web/openapi.yaml (committed) + │ openapi-typescript + ▼ +react-components/src/api/schema.d.ts (committed) + │ openapi-fetch + ▼ +api.GET / api.PATCH / … in react-components/src/api/client.ts +``` + +Rename or retype a serializer field and, once the files are regenerated, every UI caller that uses the old name stops compiling. + +### After changing a serializer or a view + +1. Install `docker/web/requirements-dev.txt` and run `docker/web/generate_api.sh`. It needs Node/npm, and rewrites `openapi.yaml` and `schema.d.ts`. +2. Fix whatever `npx tsc -b` in `docker/web/nspanelmanager/web/react-components/` now reports. +3. Commit both generated files with your change. + +CI fails if you skip step 1: + +- `web/tests/test_openapi.py` fails if `openapi.yaml` doesn't match the views, or if drf-spectacular warns about a view it can't describe (which would otherwise come out as a loose type). +- The `api-types` job in `.github/workflows/django-tests.yml` fails if `schema.d.ts` doesn't match `openapi.yaml`. + +### drf-spectacular is development-only + +drf-spectacular is in `requirements-dev.txt`, not `requirements.txt`, so it isn't in the release image. Its `jsonschema` → `rpds-py` dependency is built with Rust and has no wheel for every architecture the image is released for (armhf). So: + +- Import `extend_schema` from `web/rest_v2/schema.py`, never from `drf_spectacular` directly. Without drf-spectacular installed, it does nothing. +- drf-spectacular's settings live in `nspanelmanager/test_settings.py`, and only apply when it's installed. +- The `prod-deps` CI job installs only `requirements.txt` and runs the whole suite. + +### Conventions for v2 views + +- Field names on the wire are snake_case. +- Request fields accept only the matching JSON type (no `"5000"` for an integer, no `"true"` for a boolean); see the `Strict*` fields in `web/rest_v2/global_settings.py`. +- Unknown request fields are a 400. The UI is built with the server, so there's no older or newer UI to tolerate. +- Errors are DRF's own bodies: `{field: [messages]}` for validation (maps onto react-hook-form's `setError`), `{"detail": message}` otherwise. List each status a view can return in `@extend_schema(responses=...)` so it's in the UI's types. +- Unsafe methods need the CSRF token, as the plain views do (`web/rest_v2/auth.py`). `client.ts` sends it. + +### Calling the API from the UI + +Use `api` from `src/api/client.ts` rather than `fetch()`. Pass request bodies as typed values (e.g. form data from `useForm()`): openapi-fetch infers `body` generically, so an inline object literal isn't checked for extra keys. + +## Settings + +`/rest/v2/settings` reads and writes the same `Settings` rows as the settings page, the weather page, `/rest/settings` and MQTTManager, which deletes any key not in its `_setting_key_map` at startup. When adding a global setting: + +1. Add it to `_setting_key_map` in `docker/MQTTManager/include/mqtt_manager_config/mqtt_manager_config.hpp`. +2. Add a field to `SettingsUpdateSerializer` in `web/rest_v2/global_settings.py`. +3. Add it to `LEGACY_ROWS` (and `INTEGER_RANGES` / `CHOICES` / `BOOLEANS` as it applies) in `web/tests/test_rest_v2_settings.py`. + +`ManagerParityTests` fails if steps 1 and 2 disagree. + +## Changing the panel GUI (HMI / TFT) + +Each region (`eu`, `us`) has one HMI, `docker/HMI_files/tft_automation/REGION/gui.HMI`, and four themes. The themes are the same HMI with different pictures. You compile one TFT per region in the Nextion Editor, and the scripts build the other themes from it. Committing an HMI on its own builds nothing, and CI fails until the TFTs match it. + +``` +gimp_scripts/*.scm --make_pictures.sh--> pictures_tftN/all_numbered/*.bmp +gui.HMI --Nextion Editor (once)--> gui.tft +gui.tft + all_numbered --make_tfts.sh--> output_tft1..4/gui.tft (+ us_horizontal_mirrored) +``` + +### After changing an HMI + +All commands run in `docker/HMI_files/tft_automation/`. + +1. Save the HMI as `REGION/gui.HMI`. Add new pictures after the existing ones so no picture ID changes. +2. If you changed the pictures or the GIMP scripts, render them: `sudo ./make_pictures.sh [REGION]` (GIMP runs in Docker, no display needed). If you added an image progress bar, list it in `REGION/progress_bars.txt` and its pictures are generated for you. +3. Compile the HMI **once** in the Nextion Editor. The theme whose pictures the HMI holds doesn't matter. The display orientation must be 270 for `eu` and 180 for `us`. +4. Build every theme from that compile: `./make_tfts.sh REGION path/to/gui.tft` (`python3 -m pip install -r requirements.txt` first). It writes `REGION/output_tft1..4/gui.tft`, and building `eu` also writes `us_horizontal_mirrored`. If you only changed pictures, `./make_tfts.sh [REGION]` rebuilds from the committed TFTs and no Editor compile is needed. +5. Check: `./check_build.py`. Then commit the HMI, the pictures and every `output_tft*/gui.tft` together. + +The Editor is needed only in step 3 (and not at all for picture-only changes), because the page code in a TFT is encrypted. CI (`.github/workflows/tft-build.yml`) runs the same checks. It fails if the TFTs weren't built from the committed HMI and pictures, but it can't tell whether a TFT was compiled from the latest page or code changes when the pictures didn't change. + +See `docker/HMI_files/tft_automation/README.md` for each script, `progress_bars.txt`, and the limits (for example, `make_tfts.sh` asks for a new compile if the Editor compressed a picture that differs between themes). diff --git a/design/font/MaterialDesignSmartHome.ttf b/design/font/MaterialDesignSmartHome.ttf new file mode 100644 index 000000000..9e5aa1e36 Binary files /dev/null and b/design/font/MaterialDesignSmartHome.ttf differ diff --git a/design/font/MaterialDesignSmartHome_nspm_custom.sfd b/design/font/MaterialDesignSmartHome_nspm_custom.sfd index 157a43985..f28774bca 100644 --- a/design/font/MaterialDesignSmartHome_nspm_custom.sfd +++ b/design/font/MaterialDesignSmartHome_nspm_custom.sfd @@ -21,7 +21,7 @@ OS2Version: 4 OS2_WeightWidthSlopeOnly: 0 OS2_UseTypoMetrics: 1 CreationTime: -2082844800 -ModificationTime: 1767603227 +ModificationTime: 1794346042 PfmFamily: 17 TTFWeight: 400 TTFWidth: 5 @@ -88,8 +88,8 @@ NameList: AGL For New Fonts DisplaySize: -48 AntiAlias: 1 FitToEm: 0 -WinInfo: 0 27 9 -BeginChars: 65538 96 +WinInfo: 27 27 9 +BeginChars: 65538 100 StartChar: .notdef Encoding: 65536 -1 0 @@ -3919,599 +3919,399 @@ Encoding: 9 9 76 Width: 512 LayerCount: 2 Back -Image2: image/png 17661 0 448 1 1 -M,6r;%14!\!!!!.8Ou6I!!!'#!!!'##R18/!;(Ncq>^LA)REC]2gJ[JmT"EE92NJH,fq!!*?j!!3^^!!FDE -!=1pj!YBk^"<[[F#XA@k&:a``+92EJ5QCisJ,f]p!!*?j!!3^^!!FDE!=1pj!YBk^"<[[F#XA@k -&:a``+92EJ5QCisJ,f]p!!*?j!!3^^!!FDE!=1pj!YBk^"<[[F#XA@k&:a``+92EJ5QCisJ,f]p -!!*?j!!3^^!!FDE!=1pj!YBk^"=b&:[VadE'rt4A!YBk^"<[\q'F6,_T<3.Ab*j%B_$:62!!3^^ -!!HmF:r;*qAYVl.Csne9Ao,=S&:a``+92EJGUB(O^HD<:!^$]%gE?Ot#XA@ko*EQ2rhTmFVqs*@ -0FoG$6N@0!J,f_b&5ZhCX0PT6hI7[::G70*-NkOl!=1pj!`K@QTs%JLW)@b`QRX0\VXS+R"<[[F -#XBMY!_VNhn@%a7i)7N!!*?j!!3f>.-%L2fr3>@0bNo*#u.`5!YBk^"<[\q(^VU1Y>r,( -V&gI.PRI,ohJ9Bn#n/_WBJ,f]p!.fq3-rI0J$(:_Ah"Cm` -&5erP"Tf6c!!FFKK7MDB>*U_'s)nR=5OVW]-=@'uhEV&B&:a``"t$"]I".D6PJ5W4B_>ll;O]#:NX!=3d5 -!!1FMAoX!am2f<^NHBJKjoN -e.Tm<4\f12!!E?:5QCok8okOt![N98! -(0)LXJS5<3!29c'L3Ou:jF89)D>3i^mI)c[fF3=i#p94'%R.$#+`P(t+o)@/R;O5^MX/^`%aVd# -5QH%g*-Mif5WeYFA]0>>%DdRn$##hK+p5T[=2mk^Oil!0"@.Dja5`HgZm3>Hb1kGT47ngi;r:j? -j95:'Z-#fkBBoL1;th10r")*npk]`O7R4bP^W[Oo0^TrJ4CU4B8H*d\aNfL1GL>_IlVEDkDJ[LO -!!4:8=Q=*g![Rf3!&N>V6LleC^U)da#^AeKJl`3d70!?B'RBOt7A*3N>j^u0C;UlM,PdZ1h+;N# -&-4'e?AB_T!#USUrOO.+QMdB@`b5c$KKt7P?eT'8^h*XS=g$Zt!dt_I!;'!Ur`g$Xq7@!cTZ5PR -rhZ0/@A&I-=-Y:\Kg;75&-..,VCu!R8H,d/25mbhP(.37DsNC>J6/'fG_JCi":tQ]Oes4%"A&Np -_DS9s/WtTt\*\rF"P>RY/.h$)!!8fPe9'c*J9JlG-X1G#bW1/+5o[nj!6N!_I'qf^+9G.T]_4Vk -!RM'_qJ\fp8H'hO9_*B@[:'IQR/BS^9Ea!AJ/*FW!eF)Q+94IA9B2TLOSh71CKOe&8H.WZg$FoZ -!;=b!<-TLT!!=c3;B#0uJE6/RC;\]ZEUkcRZAScY"P?.p/.h#u!!8f,X>K4!5`tt)kO0j5"52C, -nh7\_gB1.Qf^48A&-u#2!>$5"%=03PQMcg6A2gsj:S?n3?TMj2$Y8poCh31-3EPSKNK?.KE)&r#Y#a& -6pNi]?"L41o4Qe7;r@ka23R$-H>YqlCa-ZDq0UmEDNOh+ajnf(eZ41+d:K=D?koR>(^(D#5h6(XP/$01lX-Y7g?F,F=U,W'CCrf3eA=Xc -#XBLY!f83&1*i\%\9kc<+r!.eYe -,b"YSGeHL`9Eb8g\Umlg9HnueQpcXN&:d$O";4N0A_cXTJ-A>+M1aDO":tQsW3?a5&4ht7&n6-e -TB?U]WlE%H_"4R,VI"]S&-2OF*028)-%Y'ss'e"WnQ*CO0tTakIB:PFCm,))"@+#J`_-SJ9qY&V -p,'i1Nr1K[QM_Ql>_()m%grLe&O6=iU;Aqs5TgpG,l_CAM'IQX+92HFV)\fH+Y8J=>h,TU3]K0Z"28H*nS*O"c@5QK"LVj:lHYKg -$'>'@%6SO;-@c)0NK=>e!.ggLOSjkX:VS=i5QISk7=9VNL'1'H)$V+JK+^EL"NEpCs24tr4+e,1!"=URNZeCR\cbS'Fbrs;!n.Gu!2d*]'*piG+p'%iLk:1, -8J",e,SD([m)%J,gF@42!r\!Yl$'r%!An)?adf5QK::7Weu%TK`K's8H-L;gni\ -!;XSRO!3G5!6O+eQnZrC!&-.8HdL67$d#J+J^E#PIL-T#G#_9M)W"/n7"=HJ*%uukY+Y]5_!amW).R3t8 ->nS:UG=e.0+Y]Ge!an&.5(N\:3[R,_mhdb'6XU*!"MbF*HisHUF@UlBh]5p)L-QIT#_4ChVum&+ -"=6>(%uQRj+OGoE!h^,`2M(o3RM$b=2^QLf&-to/!>(PEX[)pg1C0*?B>EIN#kUdj!RNWA\q<8N -"A&O&7NT_&g7"j)&KB+!!7[*!!*@I7Y'RW)-Rr5 -5\gE,JCY!?!!3_!7"F>_M$iPk&.a>_i\:U0+96sI!]T?A2(Ds0\Q3:$b(ir$/5#nsaO!jbEnSK\ -9tif0p$1)Z]*Js;69kZoq/R*a#fKEpkTh:r#\H" -O+1PHiDK`fHpO*Fc$p9AQ@L:Z:T8_0jVjEMPWWj4CF[NDWAmel&!DDG85tG0!!4:g\6r<_"Df"6 -P5Wr)We>k39c&#Q=eG!8'=^A7/99h/4_T0*L&_:J)m6OTJQme88&Db08ef#A9/6XmjM*\mO)Q@+ -!XO>C6B8r('=^g)ImE*&-2`kH@;Eo,dsQ9>2XSfoJ(8hhXf6)@//K>#n'%Z>Q)P=R!!48[8fGj> -J=Y0(<97uNJ_=!e9=b6ck8u[l7In2]boWVR&(>adfYCe>g_9eqJ14l.%=pMBCl86BQ&jY"G$7+t -;nq_?]q.,jWtG7,mDgSc\CZu2@>8)jHQm;)LG)$'k*B4u!=;$(*e -?Y.[cA>29Iek-!To&%+N,M"[p:aH('[XI;Dm;3'CFF]3uS!JKB^B"W`!!:$5WFQ=f`I$W8qqk-! -;]M8pJE/qO8rIgJP(20M9D#(q!B6>qGn!CH!>(PEXeePGI<+R-*Jo.t4kK2%!WeI6"\=DH7X;rPP;HO]MhV@*rXH\5W3g\i'LRr]VbP73q1"=N=IYf1m'0`c,H9PQ+./5[]NNaaX^gLpoMms3f+)oqiE(r6f1K -V8b"eTEZsI\g6cJ=`'"FUJ'o-\k<)Ms1i`'9`CmM-g=>S!cBMinlh"Q!h^GZCAB)nUJ*;;26!XOsm9c44 -SGLCBQ:jPNm6@Mh'd(1gCY#G'GJFPBdoUK)^iVJ^ifeokY4rYC9E#]`?$qAO3ihYhT<%nmL8?m# -[qfeH?gV4P9"R1CA/4Z=7<6TPDn&"&7F3V0Qe\r4k6>kgV9eirTdYb -.W$<7[bi+0XmX3>eOKW#(@a6[[G1R0n_64I/.e1:JE/qO8rIg(-NDM`=6khls&$=Yf?".,!0ast -edm_.6J+(Eg/FAi*aZhKKLm*>Ql%3a,VZ"A@\UrFu":tP`RBX[AJTGD&-3&Jf@ksAD9Ru1G -(q>4Z?[?N4?kjlY`3JkJ!O.^nCZ6^Lp\UPZEiQk/\_R(o2?'gJB-C@R#7cS'Wo]2G;+A[bU:-![d.Q[T*VjcaImE'eUisR]$s3>Xp$24U -h(B1J=[moZJ7V"@2eiEf<515SpofY18rO^XJ0k4aNK_US)j3hn7IlN(CB$>.m6Gk]51h^nVq0NT -ostEZe0CKDIijk)BBTa$R<2]NP7@k[qu];lbjcDKOCQf#pXsHO -ZS/1%s'+JA(CLHn5k5Eo5OmfAd^ldAPTo&0Eb0-lg]j-M`-qE-SeD((8cDA7[<9T@r*olPqtrC* -,7FT!Ilf'cqtrTan5g@E>u^>&q0Z#h%8s6^!(\]9rr"i_M4^F4>T(Rfd@%\eF^d+GJLB)9/YQW4YTC]JOcS,,@(u0WoOo,s1'o]31* -1APj3B6g9WO!XfN+uQV5Zc["^CnL2u'e09X.OjYj-#g#Ms(C%DidH1@O:RWfp=-MK^&&GpI]!&G -"4^M[rOXAnS==Es+bj"/'/uDc$kT2"#1P -cEr'GHMME2!6?hUIr%F2K3DKD*3Ia,= -`3b#HOifN]%A9st,m(:!QdWU<=Y/;&m\=fgSGe$Haa\K`3TiVr:[Lq8p=1# -Y.VMQ%:@afj"[sB*Uh:ZB73Vu&X.'og;5lM^k!qt^YN&03WHm2;f<-HcqT1;mA=#FX^7fus0'&> -[\9DKnZL9:2VnDb%@bFU1Rn*Idm?b*#E$16T^BYC:s!S.T4e$+(djep#QV,G6=7`<M>B0Wao't`i,l_VqB%k!SQ?kb:uZh:J]ETDO_pH#NeYL%h(;Tk#Q-]HSF(EKfiS!D$\^cc\=V:Zi=,/i&74icaI"3 -hHMk?;V?JA9g0RB@-@G0V_N2ifK.lt+J<^f#Ar8]f7G08hEc[-!:F5lqjkH[G0^,ig+`9^D`df* -'2JN[P(3L)ATnlTC'Nr5raW`2pWOs/!Bp55:q6rY=JljO=!*8H)7lc$qkicrb[g -]%j*Edob\$IuiWK)1[UK/buI48EIAs2p%cI,s(o&8Lf`M`r!mpH_fq6VW&8rkFkaaYRslk_!i=mTo'7I<`cc,JWY -rBpWZNf#+eP5f&N8R2%gSaI0Ph?fBOA1[r\+eWggqd?<"qnYu[b6W%o?jqi3q5Z4:5K76eg\4@G -IqmXtGQ0/4LWSb<<"Qk5U6gnV)M^6c=l2u2+YPqP**aMLPir:1L=bT/`'2\8_a?TJKqfa`P -)$#(&3V%)H<]=diIquAbLYYQW5?J]6GZZK[4\#Pnq<&T;T0=Ve"(95XTc'gLm5%._>5ajTHZ.QI -@W&sOpIl7NqnGcMVd',p=+u(JKjoNZk_d%l_1(s"9al#!$qSP,O3aHrr5Hlf(s1'P5g"0F[o4f'.=!]*Ggi8 -EukUII8Au>!6IIh.(hTSCHXMOq!Xtq3;W)p2-k%u$#uGO,5F#3>SBXp!0I,2Nklg<20[OLZItE@ -^-P?;(^)/si5gBL'NVaiONK#&j$]M\raCQ>pGDhu?'qMcBgk*o)okJ@di6!]9V<5 -s$R+*q\]B^+jX2*\Cs1&!<#AnVJ-%R99?R"ZS9E'_4TYMTVcB9"F[fSg%`naTH -<'3_N@0bmYKPdlYet1Db06E@/!UX[hSH$3#E_?>dlBh:%G:'.YOZND`D/VZ7b6!5i#SbCQ$iW2\9;=ieY]H_F(4@(h-\Lg08Fd95\M%Zsmg%g@mBf:q!%\]FKKt[t -7r%t+:-+3;;*4>Ue@skl36f@@:]t%J!0I+GKmd\thN%U0O=('bR`en>3g[hI,uZ5KKshC+[GT/JrrNm&Vs$7;c];1d6@iKFe-9%$U"74"jQr`nrZppdKl???66?V$dU?T!/gl>>&T5W=@3Y4ItG -g&EVn'%fk7j2]/Th@e"%B]'&m935"0QP!:/Rh!r -IolgHa['.tYVD-&O2mbVD#aPY!(fRE<3,ipemT@O%06`"TIGGeZp3BrFQ5QoMdclU47rEnBtO5- -C&^AlIn*l'\`7P^mke)5,n'I*gIeQ"!!FDU5CpX(![RS30hC(*!7A+5^M=P50EM:eJ:M,2K*hUA -Il&CjRfJ6K*/6]Y!YFin?n_UHnrIP,+98,C#KB"/!YFRe^`_5/'ZkhMpQ"Oq7=(=gi0X;qP5ojk -*.R`#!YBk^"=as"C'NTufgbP9&>1)ECss-"5O>)9em1g+m]8l!f"*"CJ,f]p!.e.`$330Y=1LlW -2o%Tq!`qm%aa?JT=B,Qn[@2"P2';l"#l#UjRfHjM5MC\IC&3=gBIRC-"<[[FB*Y>U=P[uo+e-5jaMqm$!YBlIc3/_,!'BaQfdNfSlK;YfrQ'VZ)H1jHSX]cN&1hXN!!HO<#V#g* -q9/)db'Fd<*sB6H!oOOg+6*YX+TMNj"G-p[P/!3:Y;F_O7=]SfBf^#P!!*?jTIGF7:K:?ahd$H= -ec+l7=F:]g#/FK&b%!X]r&@Ye/XRc]a!i8En;422lZ?WPrG?["<[[F#g=P* ->Q@lEg0*=7QQoKgWNa<8TT_+WOipriC6rNU!!*@98"d2Z5GnV=N$U-T!"A(8h,)'e#XA@kOV?qP -!1;Z"JB4L8]6OY^(Lb0O#XA@k@0q$*!6iqZ"E7(#fXQWOm=$2tlaX(#FPK()6N@0!aG)tC!l.?I -9gI4gl)mlf\(%pi9E4*<#XA@k&84\/(BIp`EB9b,LcXG]rgicpY(Q1tCPnE#!!*Ad9qXEG@$iqp -&ER;HA<^+h0M:BgF'!A,PI_<0L\D;1h]@\QAC(J8(@#% -hIF/-D&.X*!^R)7!eOgU&SD6@'`c5c&^]iWg0`<\;3-KD1i*BS43Q4F0*E1,-q(jA%<+A$0h""m -6m2=H4sHZ/iO#5'noPf.qm)PkJDQ#N*Z\sEo-JZC;F(HH&b<$:N*ZKdF:\JdNDVV9THNf^hT4&@ -2?XQlfn;D57pQB#M\75,Qa,gM!.7I>\0\AGToiD(Lk*.tSZB5;"FpX]&^^>-F`ek#`krmZ%5!Wo%$iBY:MTF_.t`'?]j6R!BL -X1`kS.;M"[]h3u#&.0)pDe`qZ^bALUdu)/\:?q(j._GE',JD;EE0SAhVE&d(I[o[%k#fUo*1$]D -ka;S/c2a)8Bjff!p\"\US'#ld[N][?mGo>AWeI$'eeknk?(TYh[rdr[JRX-#6Fi]:9Yf?8-]Beh -GOdAu(B>3oI4;Yh`MVfVWN``SE+a%eR!)14ZM!>EQ!4:p6(_5Vg>CP:JXd4k/*oiRRtLdGa<1P9 -NmBp!g0,#H.K3[U2^ST.+OE+L6pTpkl(A7_aTqlVKa7rB@NM9n^]+qJ[Jh("!H;=oh9f0H":>_p -&qc]L#:sgT+IuB%PQ7ql+9I-'cF^%jO0\gnQ/0Xc";q7t;MBYp2g3nhUk/lN!fT0;&P,Xs(u7L] -]LZtEM2J_p@h/0CmLF$Yd_"ghr5T`^FA/>=!RFS$3ULa$-=B3]BPG1j!_E_!A#:n*G6bJo4F?<# -rm5g_oY7fnI]IdCD>ucJA'P47rQP_g+K(V-mLF2"k`Z_]()MBJ\*/OX!t7Ztj`e+h]@-b6S"''H -\&E]#+OCJsm;Fs)cjOPK#t5tN!FV!#!Nh*6a4gVHju:HKGH1SBQ1o)'JXQ_]7)0%CDX+dDSIQK^ -Fs'l@P8=37fKo^[9gJYSr\T&.GH8L3n67='[KD!In^6Dk9 -ctmYBd;6-;[^n_)fX*1;"F;@jlu26ZJ=L3Q\0dm#;:`IfC]o9^d[,!4?C2$Q(tFtfd4E(.eZ6_h -;t9i7=`\aK(1Bd0">p*OHnl@s;p_*2R[!lWfG)Juh[ZSK;!eL2SmK*VF>Y_872r#.$A5W,;!`+f -$-4=Erg_2-!*G'LV;.d]mLCofeWtifrA6R\TWW@'l1E5 -cpRjA"9p#GLk(UKB-q#J#ghgV!a,m2K7O;14s[$)Iun7Cp71uYNt4na>iik&XA"b,p,??E?R$:R -5`,Sck#:sT^uA@M!:C>a4a?_Ka%r:4-14PDkASP\Q`/OgTe$`lKKp[^\3"(0qK+bn!!,pCd$KpY -"H8D#amYk#=b&S0rlE,``VF;ToYi:Ep0f[VVF[B4h`P8[jYRXdErmO)bQra(JETY:7K5+V0ZIYV -gHXAq)b8CGuZ?R,,SEC#+j"g>sHHcMm*rFj\g[etN -3F7]cmPG1`q\s,KdKla40+\*s6DcEt(9Q^Z!>F+!Ps#iFnAudJ=fWCs->Qtdnm4O]@qgf'1`"7B -"$_mAIoC_ud"0,Kb%IgDM*MDmAf\HGLhVsL,[rr[c -nOI;0Cl6E3poVY[Irh^2$8ZZ(%8UR9Aq8LKjMJ^SI.l1WoohW2[8o#r5o(Q=nhFL;@r5r`MZ&O* -%`i?2J-uGa*68D93Ul^fEM\mZ?r.QdQM_u:;FF`asEY8B\g6[b] -$D\>J&-*FHKa=%Ol1%sCr`Xj#1IOK"K%H\&+9I:X5X,,k!%Pu,&MOf]bl[5dnIp[.&HNAoQDho] -J4'JYR9KrI)?D9T!7(t]K@qLAf'[$CAgp,u>n_0_1/?ea9*0eQ=>/^Fmk80Yo[!mYO6b\TSH582r#V0n^qFXTHW6&kJe/;Ds)>#G#/E$ -6lGB(MQo;qaDT1IQ-)hK)B,5Vp=tUb2(%[5;3h1bMZ!u?!A5QCi3&h5)5 -#Jd8$?*[DjMY$Z7c[J=Pmris"Rs>-/&b*#M(&>K\!CT11:=Q:5J85.bELL*).Wor8>#8A*P3_Zj -3W:#cUct1r!6+bbo'HT1G&#r1WVRLbY:J,Z8E8]&J_SGX3K6D^c2e/R=LF>"Z$11ihJ51Sdr7m:m2rh=jS!( -Gqda+NQ_A*Ng'b3)Du4n0!g&cVEHg2,42&Ko42eR>8?J[[G<,YO)2+ML>,rXT=I$+@,QtA9l<0t -`n^ZH`Xjp+JO#OG..Q,ppRBA+1OX\SG"hUkTVNCCHA`bjP0.bop'c/2f`]I0".0C^c)L93`W!mF -%`i?2JEI&7*[.j?+ol6HiR;BA*idJJ]c_86M0?ZnWk:X`N`*,b%hjIEdg9tS?ojcHT4n..V[`%c -@nn4U5mJ:&7_mYi#6@R#lp)0NN<\N7[C/8(Mf)aFRW_Fdm?CX#p.nMlhP@HdgSjdT32Zi[F4T!M -duU"/#g>0fk*Q0?3P*-*G(Fg/]+8gLIhkTEHpYO"%*48T>Pma>>u,W)i2Ru8\MHE=K/N@=p?=gW -'3D^qFuj"u0$]4F'*/Z5..*!-fL>hQ6!r!Hj""&XY9!.M.VHn"]+3hc.blU03TqdkhPKbY2$&p: -e6Z@8JA9Zi3R,3V9gJ*.Er-%HJ;3"7X>5@A<6`1W>W\X:g)9otQ.+gBdoB_V@cqK/Q4gFlZ%**^ -$Dl!s)KT95p*5im7"C7?o9lEZ!NlI%!NTs8%7I?"=:*.l&9QmRebQ;o\?Hh_S$"S6AFE[h+M]i8 -GH_AD:?.=L!eQM-[h33PdZ&*[St2YtdZ\/sW_[seJ@;J:eE;91cW0e&at5(oX&a4$+Rgf+=L2cE -3#rQtCJ)hp!)e\dgqN+uo/9,B=RsX]d>n$L.Mo$G[;sSa4>gd9gS-FPHF;q0etlZa7;.9Z=.NGcZf$TBjAYJA@A0`sb3?;=rtf -!AaBp?RBu8XT[%R.[sE(2Qf2C%TReLaqn#t>KYCqg!:Ff$G=AYGrjm^U"XV8%X/0%#nf#oEr\)n -Ql1EHeEiUm2B0FeK7Lti:AWUlCZ$%p,A'nLnKVWI!_8NDJA=F@2oc>Wo)Lg0s,G_M*TG`N?;-\V -Z=aMH,5a\Z*QHV91BE'e_+[+%T['#o!&tL^A+LcfgJ=%>YUOK+#YZIN(C&Sh$$/.8)PNVc,m*GM -^dXNY:'W=`%#o"r9"m=f+ScR=mGK)-3YMOD'"*uA2`(P'5i;nj!WiIHg)L10C#BUZgQK<7,J_4t -$O!==5Qjb*dr7GoTHUgu2F@Hi'MQQMCqhbk,%*(E5%&^2"AAqLBUj$&+:r"!UnMtiL5:^C`9F<#d>Z\g-_cYR0cu[cW<#V -Q,#ipJ-:IkW!b8E?`.W$^+N:_E%;=t:'ZI2\>,\5S/ra3WYhJcL=!/=uZccldKWN3A5F#P93OQOft -g61V!e.7mO34_[kKPLYSZ^\IYP%aZ]!&$,/B?H>]3:`[Yc;b.#a]qs6K>;P=VEHWs079.FPlhT% -hj@M2"GA",bQN/M*FR!=;>0uESG-a*`'o2j`A:#&r_-)UW?(o.H9G>:p8m`Kc#E__nC^3[>o77s -J-uH0!1R%Y*::VYnf^%K?5RpQI'@kQ3mX._5A(0CkNJi(q]9e>*%T_l4WkcSn0B+WAc`%N[&-M" -k[gP&gZa7?aTB`]+p)($>:fU- -U0!X@":tQS!:dUU -o5R%r!PhN&Oap^lrrMNJm4NrS9#O$eM'WR]o'QKi!lFH6dfFW9^iNL.$e/_CAmVAEf#nOEnl(/\ -!h]`KWk'B^A)$Da\54C-`@?(SANe%V9u(?Bm'4B_J3]ogR/jiQY\t-CHM+hIrdQ!1Q#)mT!+Zc. -C`Tp1^u))"6K%Ce;S_fo":tTtW3fYcJ-^CPbdHMM1Cu)p#p94_!i*>2!f+s>'*0J[r+EKF@!H>d -Lk*9/HP?KnbB-DV2[+@JS)t7^fn:867DNdWZl]F]5U,,8&:m)4!"fce..eV`cB657r-oL7oW4KK -!+Zg^S1P$!P63J)#WP1_B.$Zg$_Z6>R0_a=J:NRd&TG+G]I%$mf$os7a/f02#&ZB3jq%OGKcGjU -!^#Z>"I7;*"M@E>pL8QP0AH`XI:TiL+>@:Ol-OVZf_%?sWa2e$%hL8G$*lf=B**Q*kH-jH,/C?f -^.^VT+63hUF5Lg]^`FFWdQ"`hEu%'s(WW_:BDL3]%*Op6Z;)!HEKcAcThbn31IdO-&sV -7IasC=hRYn?9,pEgijD4$Q9-&+rFu9Qj?MeD/Kr5PARLHIM0^IRLoQ'!5ed<9*s6-YjH6Z<<>-L -KrOgCHuf&O&35UR#T2qq"H:i@h<+p2Ven!\h\a][RM#W(!5ed.kL7?T+9DTL["\j2Zb!Ri -ru2$/5][)0"9:di!n@Q=7b(h?ne$_/o2M;`D)5oQ5QDB-3/A;;_"m8Yj<'cdo&^J`bDG^Q"D/>" ->p$gHj[t@0/'h-s4*qW)9n5JX!ZmMT02]55-3>f*B$acS^Ero0>IL,Q!u!p""9qJ>faq7;:S4Fl -7k3+_"Iu3l>DM'VlViRX.lM5gi2qn.RYpd;2MXO@!piFhb(g/RlcZ[77rpTMirB2n!!+4j7.pb, -'nKGdHs=_O_^atPm[65'1]c67,$-5-Lk%b\hjCNDSs6nEtl1_HrhETM:-+T.PtI4a)@<"BAR9ZFul:D@c1>am$PL0&;gGh+;@E$J\Z('2@E@,"FO."i!TG_&X@,X#&^!F -l1Ro`#+u$nSu\4afN#1eg:CqdF;KZ3VZ=SQU_O0b+g=_,?`NZgQ(+"'^8UTL't\Wsh`;38>1Xhh -P0:^"!P(TZ5sLb<82.!PjGJJ9#PTmoG/GU-ltHFj.bC]uA+?Q82p5@0oO03ggfW@Wcr(!#'@;aa ->PCek!RNWA\q<6O!kYDV'8f[g^S-&8iRKREP)qCs&HNpSL5f=Ki"SGB@E3);"RbO!AeP3N\bm=I -Drs!`f4G(:P47GuJ0sp@VKW(IJDQF;+U%?Z+;$;j[lK:qVodg"6pNqGgpY&kU)$'kjZ[cI:"B$Fo#Y6D5pu785!l/$YYSR@t&]doSfY`C0*Dn5OJ)q> -<+//t,WM)Q\V'tP'J4-T5f*X8!=8uIf:jO@!/NB](^5IQ#p9V6N@-@%!R#O!!K/15Qja] -_eKG[-@c(%%$]ls!.jhH&-;/9dK0R6&O6??,K/aVJA<911)9of$j)qoZQju#a=cO5$irQq1)0i` -gB!*15Ju!QV$I(1Tu1gTj?WbXO@Pi2Z@;o]JGttc,6T,cP5lf"-8;GeTE5,s5Qs\XJH,h--\)I> -4pG,N('+P'>4KNM#UE+E&Wh*ZENWpU#_8LtdiAQ6d#LAg,/>6=b_:W8L(7E@,Cfbr#)%IL!.jnO -A1.MNY,EHEiZFVl/49KJ$5^]K!!4GI6pO=q*&TF*=M[7C5F>nCV!RR>W>=&;kNX-=Ci#G66[l)](^bK[F@Jb-Q+99iL/Y56.!m:j?"<=IB -Mp#/!qX7YLfU8^"LL9ET+9:+OU]h#h^_),k:'Xnl?^.`YF;,Wem?mqUTP*2)#6>)=:EXWhE4uU= -8H-MfZe-ip!5op%m"59@3['T`#^E[`=n;Si-dZN`.09d*Ur%sE&:d"d!f;baoAmM0s*q)eJ@bOh -5QKjaHT[&`"@O@E&PshS)[InrWY3s`C.7F<,4Ka*r`$!OW8&\Mh:252/j#_ChZQUUkeT9o,;1r7 -o]-qDI%l"ufqIf#4=OIc^m2WU6BtO-:SK2i=Z\]7?=;f3q0@'rLUMR>ZrZqM3`a@V@+9;6b:4Im- --q(jASKe1?M1D3nSVR8mU7in5TD0RfV6LUt!5oWbm-0H/,+pa!aYb'K#dEC)-l]WB#9JYH-%H!Z -'fVZm9`PbZF9MO6+/oN*>6O?7TB,HR-q.o#![-4D?s$J5$5('2!F5_$W85N_^`.sXP5e;k6B!Ds -&jQF*#bS8T,G:Uk\(*Pa@(6cXkrB@gn9P,AjSq"pi%R!6!XO>?6\L"r&O6J@75hiR>Oo"QV: -Z?S2O!t7JOI<>"NZW$H,u&9OlFDX"G!+H@;/47&-3f&9sE7o,d*&b$]iYiPiUk^d-7>65'1\"U_/cia[f0N,N=JC&6KCTh4[ -E0bHGo)D-ffPi2n!XO=t!eNGM&jQR.bMQ7e*Jo;%q;:1g"h+7QJ,o'V2luG/!$\('\;<'`=9P-C -4Efe8CLWZM-W1!OJ4Kcp=i1k#7"@EJJC=P:L*HKN",VOaj=&,7qIld<+9E[fGiDF_!nspZX-uBY -"D!s9;_:GRl/H0os-K_U_65g)+9:D[$W]\_!"fc6+<6cr:^!:8f.?at])rj(0ei_8JA_MH45gJg -!l?`f[DeRYTM5@"8sKX1`D$=5&9iN+/eS4q,2hHO9Yu`Z#uhT>VojBKo"QbS2_Z`a!XO;bJrGUr -#S\IjUt-(X@?;hjarD"4MB"#>-Q@IuNZeE#`!T-^+Fj`R+:(_9Qm)T,QMHjEJ*k/`bY4B(![-I[ -i`\8D$5)cT[=1h/4j[pn":>`[:>sO\H9F^_IZoY=pu.\B!l0$XY^R\rg54RfZQ5ur#T+ro?HWeM -[f?C2X@YfG<4^U^3EER0WH,N*F3`Z9i%hMM!K]U/ENpGaKa;q#>3D?)D@e2EWlE2n8cHhb1Dr[o -!6Km,7tr.ZSU1+9+@O!V!ME3o5bKh4"@-I=C^>UH#tP2H9CM5(JVX:1"U#t+L&_:j9rKa&Acdd= -R%o:N&:hPA!XOJ<%A9s4"<]B8! -1kVqS!!*AL,_,l^M2)Tbd#:45!_1l^&^Uq0>:[`g;%KR(C&-*cGKT0jU -+9L>Q%`9HO495RMnfc#hTa>[4^sE[dIgA;I&ci-N,V#mJ5[XX+!T-k?p95[B#meb@jraYTAcrYF -c+("n"DST8"Ooo\"qZ;MLBJ.g*Q"Xe#V7?R#ZsiTruhAnTa2b@L*BF.fb,,8!Un,G!ffVJ!eV.O -!"9nM%*4Pr+Tb.(*>+Cn!5N4Q6pL_Q&4$j]+\r/qJ3;kPf+8f[DVZFq?&iJ3>91CBAZUi=,o4cm8\q5aQS,)Zhl&8-F<-eI_g> -Qr+S"&84f=!RR>W>='Gl!CT1lUbi>X#YZCl!13hBeIWRT!$Yf!o(3<@]EfV[nqoB_3[$1(!oE7] -AB]],"Ip&h!&t?'k2o%(&-4#$N!RKPm!&kgh?Y5(H:(Cs&?&A)&Q#);>+oI%hB)! -!!FDEJWpI/-ius=.1\CcK)c#s!.fA#6mMgbq3?jI?PaoA%H,/GN15QCisJ3Y.Y"qUe\s#c#O?:"Vn&:d%4"F:a_QZM40qe3c/ -#XA@k&BK`Z'(]EZ?(MP1jM,V6:iR6P&:a``+Q.f9LEb[T,_$=L!#m']!=1q5>65h$!0Vi?UC"sa -!!*?j^_MEN,/BBA6X2X4Yn2Ec"<[\qS-]lRi"E^]?/DIg8cC^\,(,.G"<[[FT*1ComD?Xc,/BBA -K7/'*eI[62"<[[F#cqb`!_E^L(+,&"=lJ=[e-PT' +8cIoL5MceBqsllH=aTUaX``OerdM$9\R+.km_/\9%]Ng,)(bmgoO#!%?6F`P;"7Zig@/:_7icR=*9dQ6E_a>!!"^)Jr5%*6GRG-\9%]Ng/MJMmgoO# +!#S&=`P6I8/HGhOAE)k;>_a-WT;>H5\13$5_1?_!/oTnc-jc:(+iG&HI>J +;#C?QM#[MiJDq)IC]j`G@d\]<[+4>8ZTiuf&-.4eV;`Rqr@%XF7R[:W-:75-0I6c#0EI%qJ>j+\ +J<<_,!L/*7!/r<@s&e?;5("?j%0n!2Uh=!!B"k""4`^!#Ug0s*.`. +LLu#973MX2"%gHr(AX[!""4W[!#P^T+$f&r!'k-1IfM>K!!!nak7=4$"99R.L#W,g9SWb$_%6Ts +$n2)TC-qt$2FR'?:a6#AYQ8tJYr'e!Aq'e\+TMM3H*Tj.a)^TsaRWsDj!+O(CNB0u,osb_bL$T> +5>oqMh4:/Q'SQMeX=0P9h>Ij5rn*4B5?6-I-!a$hWUBbmh-L2BK`D+S+SGQNo"OblA#WH*:R&4n +HK#H-g>hTs?i!)s,Qn+?-]1.bg8=XhY+%bn1V*gAW=T&[*Z4:*^6TK5c4@k;&U-PAVF:IbG-OmA ++1]QndC:7:^Cqb5\c\PW4TLG#!!"Q9nOHq:'`Uo:%#bbeXR6*s9EY?'#8D[[[79]TI")J(cgDhS +`^0Y*[R'FR?Q0^Z:Ac/nQ@P>W!/uX4!:7VZIl&bG9:nG7b#&!tQ3IO+!\bMo!3dR\s-VtFn]+NF +Mgm*@5dU[4=8Y!2-isC1;#J_m!6'FbZiWW$i:f#3`=Ee.;>ehr^r=&%K*!8#`#q?R&-MtiO$8'c +2,`u5`:UhN!ARjkaGp7NVC`M^j-oriYcEnEIjZ!=MH'`b!Q^9$J7_[VdFUe*^Cqb5=or1+5Th!I +!1H=G7pcoGs%[AO'HnSW'*>H^!2)@?IR'@b:U<9O.\ui`@N483!O8a\YV?1ZRZ`PXbk%b-A#[>& +J*1Mp"RO`'!3D(YJ7_XUd9!$\^[or30TZirN=Z*:"H#G?._PP#+p:;X^q]1V!*2Mg_!KJ3O1m(m +rghq<+lI\&"2HCR><2b.J%2;H)rT(F:CR*3kB\dM/):(o8LI/2rEal/UmN$=67^q@j?ina7MPl4 +L,h)@g_T>UC]'`J]XqMkXT<&-p"Z/Kk)1hl!)6ZGr\Y4dHW',=fY?Zh-<UQ'pig1J5jT[c#f)H+!!&Im +0\*Ah!IoMd#^B>+-_ig-!!#_aGQ+eJCnCYR/sQ"r9b)]!,6._2]geIh(IdjYailA?Hk9CJ!!"]g +'RsM;"98G.7I^V+7KBM./q"o#QOk)6h(C>7fWNc'oG5;#6=fi2(8Gh4p1ic@s./q#l#QOiO8+?i(7fWNC.>g>D%0?N[a\_ndkn!gp9S2779T&lN@!!*4@!VqU!2H:`"(`ST +!#Q0a+".?p!5L!2r]jTl!!!3nnH[3(!!"]$MEaoa!W[be;#Glb&HDe>K&R<*m5egN*mh"3-!`(d +_id23Bn&]mXl\#NpELuT/2d#\jqEn!AS.R-0[e]lN?[TR9d7G>42BJMgmD8I3]i\ +=RlD;MEbiC!!("T"olmp]d)@p?YX1SO+/(#\aNor/l19u;uBK=!WXp7BZ?)[rJTZ21V7,8\%UaX +cc>N-P]RO^rhpP4!#W^7(CP[AqVN@VXY>=/pg5emHNRC^!._^7Q1SZ[(Rene%ThdU9l,=\J!mio +e=m29ft!L]N?ni1^uh@es*RCf?tRg9O85Nr5I4>ec]`IH]AL`S:<<>KfDu!Q=ALdD^J!!:j%hK. +gj4b?NA1F^l^Id?lBd@>+!g*h./rIma1JrVg1+`%an.LD! +Ii;pVih'A7ino#j$3;m3Oq9;I!W]I<5>D=XUA04Nqkmia./oXFqn]8XJ)=ltYuoBEh*$>i2F%WM=q^/n +T.T;-X>5M62#CpOMLR2Jo8q1OmQ>Wc45aJX#I,0K!*Tr_pg03ms'N3R_s#G/8:ooW8T@o%>^[q)O&9)dd+Sm5]@'6Y7B^Uqt?,.YAIqB?.s3qi%3@hqnR`&cj1M(^[^i`n)C=jcT.RCh?#XmJ@&B`D'qCS4.7^jjuAhtn8SHo7%90eFZC*!BUV2O_fU\K>EoFo3>./oXZXS@"6k&hj*H/4+T+on9H0lf41 +5:cV>)2`oU1G/Ts+'8dLcgMok&HMkXMJ7P05@tW0DjGX"-jIXTZ^DX0c?0pi^o?.BX^N+j8p$qu +4e(HG(Y/Vs[Vh]:-.i,DXCG\1J'A)pqYJ%0"R!gr^R9MDKTe^,./oW3r7a[@^slgTh^JKjk_E^trg?X]5le]b +hNs+LD"%PnK]8UA`?0X2J>rHH.fLN[l3'oeMLT4PIrlM1Lag8/5L2$iAuFOf_VK,Ul*+/o1DAS, +s3K$PH7#!@q8WKFQDXLa+R*$gD'.UB!9.0 +qY?/%49*OQSc>;$Rf0egmstIhZ2BTW1X,47A%c=H:Wr6`Oq>uUZ(gHUmUir>ZFLTEdC +r0q!NY:fqW`q!"`HiI2d<[rbpcN-YE5 +UuHl1A'P"XaA6n"1!b=YMug^j?>*s@5A(YbrO2-CR\UHmr-(T%IqJ+tLd[k"<^R5pL2`9NZ\CGY +C#",$8]RX1]9IJf"es=-ZW-j4AdME7YS%#Q0Fer^Ygk_fbl4c6ZX&d,n"9IPIr!:r["^dEbYkeI +o,DN>B5RYWkQ8iHh%+K!Q`!8Y>4o0:VYn"%J!]dKM;mD+c2O-Ym#Olg!g#tfIq`]/c/UQ"Z:<7A +4mStpGJCDYa/6%Bd1V+KX>3>7NZcS1j,jAt)3ZZ8s&!cc>8I)[$Zb@W\qIRZG5NKa"J.8;a\;X'*bIUo$ZZ07'OaI++$b:XZR`p;bZ2rYQ;S!5"-iIl.&km8>`ee(tVc.1NS/%`KMg90\?\C[>[g[L?eY +T8CnrYQK+L0mAZZDTD58PZE38dPL$)na?BDP%(Fu9+.en5RdG*'PIO"7MPmP+3^;U[7/RE40SU% +Q(H3A:/!5Ss4GsOG*m(L)uC>"!3j-b$l&a/c!oV']AH!(;n'M0?lV$#@nLhD/>1[G=)Tk#5Mu-: +Klctn8iiFVr\10jkPshe\tE0[^EBl`m#=+,jo0)l5F4$?h0cN(S!JQ4Qn.V&;$'o$V"gRE!Iq`Y +he@eWC:X4mP%+1*6`Rg*<0'+jPbRshJ2H1;#2hVeUigLheFU\D)&jR*P@[K6F_$&Ur>dqf#Wpoia!B(h@P?;V8Xs63M\Dc"epTck,"Pc2\( +5k/2a[MA3-Torlo5@?=I +prBri8!!A@dplm[9$OpNJE">+bG70$J@&>SUBLW7%E0EsR)=>2$F#SFTe%2Su=bq,.aa37L%!2A0(h9VhjBD6&lO#Xe-%K@2W +=_dYCWZPiLaoIP"r+!:^hji5@@sVLHoTAB6UH`t;VmNkn0/*\.r%V:'N<+"mRn?m`D^bV\IDj>n +QiF:BM?!Vb+r1-ffm)EtDbqe3p2#8-6^_>r'+'_gps!7Q[i1C:D_c/k-UA,LS\FX@?s![m#bUsdpSMG0YR.g9t)%HgT,Mi11[]uf\ +D!]WLU0@UqZ[WD!@@Gg;C2)DZkQl\Q`BSeVT%mG?5AU.+95su_[J_Im +V3tUQaZH[Rf)A1MDWC0"=RPG@jY;`0s%c2^"%d]XpUr`rAFg*`qg>iI%EJ`9p.B#lT@DW>m+3RI +K,(onHR/RA'j^qA@l`,ac5l5q2GljMJ@j\iNP;7BIi=rJk&"2_mPgGRa44N'!*D)R+@(g6&ZQ-; +WV@Q3`2'q7#[;#H5K>6"X'ChU*S5k-K7!<<*<1W^Ja<;^6[^LJ5[]M%lKWN#r;LCug>!3".A +/H@.pr/9NGp4Zu$AdN\=:XYf"49Y`3e#39imeko>Ce;\A4?j8CU>auRS"GtCBse"m\JZt!d-P,@ +Rem$p/Gd*WT*1s#EdG +X2Yrk3)b%9JOC:S!9B;#!2O6,=Q/_9>UP?De^=W:$ig:K-sH\EpfFM^6%IRfp(IX\!bL$m^tfMn +U]%apY7E2b!77Bu>6$)NeKY%o5_Cs%!#5H9TF1`")ROYfT_Qh;/H>dtTX=k%AqQ]V!,0a5^\l@C +1.`ib3k)rOD,+i6?<9cm"TVM1m/R\'!OK"[-!*se=9S]'_F=PK&-Ak59)tUg!!"e.2uj(J5h-,? +!77Ai!?_pTW`;[lTF1`"1&F_YN(M>j+%-PXJ*BG8uql6I8o,SDC +g6Ol%">fqDU^&\EYR6$\$k+DYScSmI)!mSRh#Z')V$eDn\scD0!"(Ye!!n7..M)R[TL"27JA@P& +in_!:1]3i*IIBB$!1Off!!L:E'^^38TAAA,h#"8TJ9?ha!!:sW`O]3WB6J-N!<@XD7LK3ImXQM; +[E,].L7/"*UmPQl!8,Ys!?f`0:`agF\@f0%d>)rD(B?^=UBc<7G?cC23kFLE\o>!3"Q2!?_pT-] +f[+b!I!mmb!o,q^&NiJ0h6J%0;/P4X==+"Gi];E[re1Pf=??^9S0fNC'n +i>*(,6;.u5pXhq(6qPGcr:qPClals&c)d4rp6Z._[L\bY\RhDmGIdSsl1[n&JMM,Grm]0ceFFE[cdapS3#&28rU!e?\E##!6Ba'J//k=!!42Q^N7i+p=PJ` +/A.$E!"YK&R\\95oEnt..0Mc/Z/7LF:;HB=Hu(4H/-A.FG/2+8j6h-D +pa@@CZ`>@b@-"dcj3mCca"TRT248:]#]p;fj@"u!QIBK!,==U!"]D:)l[g<@!p;( +OS!9Z?eOZ.JJBbiJ@DWTd[IFWE2@.g!!6X3eolOe5B-!k:WUc>(\$`<49[PkKn+q6-30lX+ohbc +"K^uVCVOn9Y@MVq9OV@'5YE[0X;G'-Acb5j-"&=>S^uMuNg]jRUslA+EQeJ9!@V5P!?f`%Yd2nh +k5d*JWZ5r=FA=ioK9jjsJATn"pS,$aT)kX +!@t^i]2q!;+FUFXPX1mPG3D1NG +FTO6W!^OWhJ6q[*mapk!bX.`N-R:i]d_?KBMJ,9OIIl[B\cZ%^TJ-M!"geF!l;o80nug:gS=.@' +^f(S):!=S/!LOc+?lu`Ym-5F3[p>V+^,%(+;>t9=c=dO"PR%9D?sqnjYpduH9:o&^1V6i=$e[05 +;d1(Upu\R%AONU5:k1R]aUQ8GpJ7R(ml&gfeEIT;5Fm[Fe_L*mOtMo>B[mnsQ=J/j[UdAb)Z>)* +Jsk"!2\B3nQCp&"@O@,Q\D!5"mc?q3`!qb;83f8>sK +#GnQ!=pY4s<9asLAV41o!H\Q?KE0@$+^eM/)kd&4!$+B+8jN`u=9nmi&H]BUXT/TEq_&[."J?H^ +!/uI/Y_!Pj=>B;lmNQMMBJpeY"N6[X94r*%'Z#@J!jF"T!qpZ1]-"<0,;YG43Jd@^T-`a&1Us6c`4?hiFn_7UM@=/)^^pbO)dm(32%GGS +jKtl2XI.\Mbq/PtGcIQ8c0F;CF^Jj`5F2qCM4)>mPWb"K#;ASc5QlTH&H]+TT/eiqS(Z!5/qSRn +bnX_I>mRshDGNYbKE1)O(k><8rLg[\REGq_C\e9-O"dp7XnhhQ\biKS4\"/j)YemC:UgfL`gs/u +IADhNWF$Qg)m'.U;?,2=G*8942'WcC_AN`cCo"#?VT+Ll*]Z^+dCmOd[[P!1qmMp8#d*Pe%m9GV4F[+#`(3WYW[!&0'fb]uJ3+u?jJb[-f_'T?(R +Y:]`8Y(c:obYiXMC`q5*#bX7%"1eI:i9obb4rCMFIktm)QVr5"migri,TYTe#hTpK!L_=UJ5stu +J0DT]ooh>Pbhaje[=CA6dZr'^q!+S8i*E#=Nb9HO$X/!.Z6K:st9XrT6J]8SMW; +5r1T&g=e+BREQH!;1sJO0KUDL'EW`aZ0hV3"K[F[J>)qQUu*6i9hJr.s4>Jd/*R(tT$7atgPVVa +kg*gJ?m]LZZ*[tJ9AONF$!7:>!!^4UJ8N7,6"b'309'rFBG$*`ap:E*htS84"D#N>!:5FU!0$%( +mf%!3]ig39m)l\ufc;A%;USbqIC$k5SH.IHRF*%*h%0Q?Q@n5cf1sk5bQ%VPI7Zgm<8F>E29j?/ +@qMo$Zhm>*Q_`(UYtV=a%`jXt!%^JR^]YDP4TAY+"mNI#LISu1uDK$b#QONiL=UCkDX'\aGcDb/0Y(% +.^t`91j>!-DdXrt:-`VA9Qr`KBjb?8*RI].!:'c(K)gENrF?695 +&7GRk#pCEI63%8k.)FKY!-c1P#q(@7Fit!<*KURNTPXf3Pi=W"9>HUTE^D0P/=mRS\V,K,;@(pm +R"4lA!)Si6U_(=&q,i@_OI;O8T*Hub)SQ#Wm/DqL?&g?3-e%Bj7O@$b#Uoj;+ +=qRl.8$m",SGed6RYh#[>IFTQ%"WE*1(:,9/bkPGDJ63'9M*\Zcg +mX@^+-\rtn*KXDkh#Yia[amfZ('+C]Mrr+D\bhpj5"SG.&b7MZ7m$qaBS%!.Z!+El$-9^p:dY-:0sK)b^OYA;28c\Z,B(>GdI[C9c5) +:kMk)E;pdJD.]mY:r;KA"N7HeHd(iOX1oYOM@^>kB7-dpS*F0GnW0<#X)#D!gh6^R9n":o"<:Xp +8RlkL"D!g%!b)8*2eG8G=ItlIr$hUQ#QUetbR4,4G<`gM'AjAe!3@M6^roh-+J0>LI^?n6!\T;: +7Ek,Qq*'d`+98'(d<0TC]13FBI>o&I#1`fW>mq]9QSAO:/?BL]92!("Ord#ts7Q]uW7`C@`I^Cj +>4Y0j:pJ&/XS0ZL^e?6C%Z'*d;uOFql-a4"6%GoiJ!"g\GJAj-QaT)](YafY&-E$0(bdWtK/>89 +`WUsid[qgG/J\;d8iis"ciS_X3*=THn`B2JSAPLR4'D\@9.^0!4.rtKJD[3upHnqrSAb!7&H[Dm +:)AV#\e&g_[Nd]UbW_VA&M,42]H@shD`7Tsl%K+f\VZljhWXD%S_8]O$QtK9!AA)/5X$V"PV>0A +7f,F+beB5.lK4'+J2rK!o5@C1"Far0(W\.XI(Iu3Zijp&Ad:FrdMjq^E`FcWF:=rC=$lu'>fG$4 +bRunYh&l+Rf:2)[@P,t?&Bb7k!]!>!!AQ9Ilk&Z\eEm5.9UF09!W_@8VLQ9)"bC$Pqo*"jKRh8n +#QZSR`W'_A0;SsX!4:bL'EXlomf0PWMoMn*!L\oa!_uP1s/VP@Tc!t5Zm;LV`eGV>FSG[>FQ$>Z +&eYE_ES<5+6/f%9lU4[q*>_9>*pqM3M' +BF0K+K4Eg69,mjMZAFlt=GAgVn,XIJpnatCT@U5?BE8+IlRpW:LuLA'qd\I\`dBJbM@^=<#Veb% +P71q&IP2H904d0j8-Ap#+41K:^MM2>pZ(&"VY;th8I3BfKn.f;@+BB$c:l4WMS*R)=oa*?`L6h2 +83u09((t?p+WrQsqaB."TPk,"MZ:G%4r)EG!:9!c8NL)(45KkWmXDcR?\(3\"D"r-#l+@?kC7d> +;ap>jNhjkR4UOVo54nFahLb!JjbOIeN]Z%t\O=h(ZP+bdj'j<"?l7L^FO0Ro/'D3Dl'a7]p+EOR +F9cn<#(EZECI+^$!5LRg'qf=KpnYN/.-Vb85%nP0of*,p!0eit^]EjuZSeaN(B?/'6R4fddeb;< +e_U8Fh1%);*LOb8Za&.U.i8qMC=*(_9Ip)a]Q=bM["98FsBf#tZE@1m^49PWaUETg@ +AKUsQ(`ab"QlZ8.^a'0d^pF@I!%(&=!2`*`!&1BA6bnNe%)gX$!!"@t?jJ_AXVf+n5tm"5!2'UN +!+9%7!!'t\"9@I*!!"DS+TN>a!<>B)#Q_a1#QOj^e8P]'D3<]ebROXR5d;4:!O6hK+TR->!!"Dc ++TN>`!<>CT#Q[2>"98F%+9V[i&HDf1K+J%D6N@*_Pt",+llEmW5\*:`!)T3j6bifPh>r90A4$=s +:aJF.YSdKBJ8,YtJFsKS!*"ph!3CqU!2+Xk!+9pP!!'@PE!SFF(>hB9NW9&e2B!#*Z$-0k!%T8o +!14Kf!725W!5Rq4!eB)=!!(4U+TPW)!!$E8#Q_`d#QOj:XjI[kHNu5Y&5*T8!6ec%+lIocmf5ZS +G!l<1d"E)7c=l3H^FMXdE=H2,<^ZofcjV]l6./>a>k#o_S_D/m@LWG?!)71'4!9F\8S7[MVS9TC +#lt#kF(QHp?7'@s`?2]8!!$]\9LHVaVrI`q-GQN^#lt#kZXssSc:l4WT:>e6@O2-W!)8qS#j@0G +j\:4\Z'+FSoPF0mGEVshb ++X$4@#Q\&-Oq80T)TGak0.jjS?jQl7RR%3E?\O8c./pKmc]rp^#M9Le!)4U>TW^[L_!1+/TAkok +&HL/t`WVs<_Eu%r;t9m.ht%)=+TS0,B(f"/$q)1kKRal8ir>9-k7$uK!'mjr!U+=Y&C;0lYP(+d +TFV)(RRRQJ?PA-D(T'9D(AU7>"9:9>&:hJa%KS5UpgZht!'j]r!O(Ga_(m6hJDX)?s6IkR"kWqY +!(^!\5V*[=#f'=?LOdiOnc-VWP5mL/!!!cG!moOa+eU@bhs>\2^q'dO^ci#)kUU][3&TOf?e+oL +JP?[UJ8HhG%&>rb94\G2c_pPJC]j`G#A3[jBsAdI!1)=m"?\=Ps)0K;'-K(4!3cSL!.Cse!hPm= +s1e8U+!;@$!3cht!;]kR"E_W_gO5+nj?rtJH<:FRYO1k%1ot@!2pV5!8*C$ +rBjaCOP'X7W^-Ub1*?]"W!rb-aFk*)TI'dA+,A5P_oG@%#cnA!(oWZ!(L@.T1k.H0dZlc&I8BP8-f4r8jWLX7RRL^:^R7( +0X?BDn@Fb>)??p+!!"@-69qUc5R7?D#m()\&OHJJ.1lQ1#n[4=9SEHH9T0M_?j[#:TE$DDSA^cp +!+R/P!/3,5^JBak0ea0Si!9(!0EqRY:nWLRnG32^&&8Sb!.[D4&.ja'&HVrC +7fWMr7L/uJ'ES82\B7.RKp"&;r$)@FTH^LA)REC]2gJ[JmT"EE92NJH,fq!!*?j!!3^^!!FDE -!=1pj!YBk^"<[[F#XA@k&:a``+92EJ5QCisJ,f]p!!*?j!!3^^!!FDE!=1pj!YBk^"<[[F#XA@k -&:a``+92EJ5QCisJ,f]p!!*?j!!3^^!!FDE!=1pj!YBk^"<[[F#XA@k&:a``+92EJ5QCisJ,f]p -!!*?j!!3^^!!FDE!=1pj!YBk^"=b&:[VadE'rt4A!YBk^"<[\q'F6,_T<3.Ab*j%B_$:62!!3^^ -!!HmF:r;*qAYVl.Csne9Ao,=S&:a``+92EJGUB(O^HD<:!^$]%gE?Ot#XA@ko*EQ2rhTmFVqs*@ -0FoG$6N@0!J,f_b&5ZhCX0PT6hI7[::G70*-NkOl!=1pj!`K@QTs%JLW)@b`QRX0\VXS+R"<[[F -#XBMY!_VNhn@%a7i)7N!!*?j!!3f>.-%L2fr3>@0bNo*#u.`5!YBk^"<[\q(^VU1Y>r,( -V&gI.PRI,ohJ9Bn#n/_WBJ,f]p!.fq3-rI0J$(:_Ah"Cm` -&5erP"Tf6c!!FFKK7MDB>*U_'s)nR=5OVW]-=@'uhEV&B&:a``"t$"]I".D6PJ5W4B_>ll;O]#:NX!=3d5 -!!1FMAoX!am2f<^NHBJKjoN -e.Tm<4\f12!!E?:5QCok8okOt![N98! -(0)LXJS5<3!29c'L3Ou:jF89)D>3i^mI)c[fF3=i#p94'%R.$#+`P(t+o)@/R;O5^MX/^`%aVd# -5QH%g*-Mif5WeYFA]0>>%DdRn$##hK+p5T[=2mk^Oil!0"@.Dja5`HgZm3>Hb1kGT47ngi;r:j? -j95:'Z-#fkBBoL1;th10r")*npk]`O7R4bP^W[Oo0^TrJ4CU4B8H*d\aNfL1GL>_IlVEDkDJ[LO -!!4:8=Q=*g![Rf3!&N>V6LleC^U)da#^AeKJl`3d70!?B'RBOt7A*3N>j^u0C;UlM,PdZ1h+;N# -&-4'e?AB_T!#USUrOO.+QMdB@`b5c$KKt7P?eT'8^h*XS=g$Zt!dt_I!;'!Ur`g$Xq7@!cTZ5PR -rhZ0/@A&I-=-Y:\Kg;75&-..,VCu!R8H,d/25mbhP(.37DsNC>J6/'fG_JCi":tQ]Oes4%"A&Np -_DS9s/WtTt\*\rF"P>RY/.h$)!!8fPe9'c*J9JlG-X1G#bW1/+5o[nj!6N!_I'qf^+9G.T]_4Vk -!RM'_qJ\fp8H'hO9_*B@[:'IQR/BS^9Ea!AJ/*FW!eF)Q+94IA9B2TLOSh71CKOe&8H.WZg$FoZ -!;=b!<-TLT!!=c3;B#0uJE6/RC;\]ZEUkcRZAScY"P?.p/.h#u!!8f,X>K4!5`tt)kO0j5"52C, -nh7\_gB1.Qf^48A&-u#2!>$5"%=03PQMcg6A2gsj:S?n3?TMj2$Y8poCh31-3EPSKNK?.KE)&r#Y#a& -6pNi]?"L41o4Qe7;r@ka23R$-H>YqlCa-ZDq0UmEDNOh+ajnf(eZ41+d:K=D?koR>(^(D#5h6(XP/$01lX-Y7g?F,F=U,W'CCrf3eA=Xc -#XBLY!f83&1*i\%\9kc<+r!.eYe -,b"YSGeHL`9Eb8g\Umlg9HnueQpcXN&:d$O";4N0A_cXTJ-A>+M1aDO":tQsW3?a5&4ht7&n6-e -TB?U]WlE%H_"4R,VI"]S&-2OF*028)-%Y'ss'e"WnQ*CO0tTakIB:PFCm,))"@+#J`_-SJ9qY&V -p,'i1Nr1K[QM_Ql>_()m%grLe&O6=iU;Aqs5TgpG,l_CAM'IQX+92HFV)\fH+Y8J=>h,TU3]K0Z"28H*nS*O"c@5QK"LVj:lHYKg -$'>'@%6SO;-@c)0NK=>e!.ggLOSjkX:VS=i5QISk7=9VNL'1'H)$V+JK+^EL"NEpCs24tr4+e,1!"=URNZeCR\cbS'Fbrs;!n.Gu!2d*]'*piG+p'%iLk:1, -8J",e,SD([m)%J,gF@42!r\!Yl$'r%!An)?adf5QK::7Weu%TK`K's8H-L;gni\ -!;XSRO!3G5!6O+eQnZrC!&-.8HdL67$d#J+J^E#PIL-T#G#_9M)W"/n7"=HJ*%uukY+Y]5_!amW).R3t8 ->nS:UG=e.0+Y]Ge!an&.5(N\:3[R,_mhdb'6XU*!"MbF*HisHUF@UlBh]5p)L-QIT#_4ChVum&+ -"=6>(%uQRj+OGoE!h^,`2M(o3RM$b=2^QLf&-to/!>(PEX[)pg1C0*?B>EIN#kUdj!RNWA\q<8N -"A&O&7NT_&g7"j)&KB+!!7[*!!*@I7Y'RW)-Rr5 -5\gE,JCY!?!!3_!7"F>_M$iPk&.a>_i\:U0+96sI!]T?A2(Ds0\Q3:$b(ir$/5#nsaO!jbEnSK\ -9tif0p$1)Z]*Js;69kZoq/R*a#fKEpkTh:r#\H" -O+1PHiDK`fHpO*Fc$p9AQ@L:Z:T8_0jVjEMPWWj4CF[NDWAmel&!DDG85tG0!!4:g\6r<_"Df"6 -P5Wr)We>k39c&#Q=eG!8'=^A7/99h/4_T0*L&_:J)m6OTJQme88&Db08ef#A9/6XmjM*\mO)Q@+ -!XO>C6B8r('=^g)ImE*&-2`kH@;Eo,dsQ9>2XSfoJ(8hhXf6)@//K>#n'%Z>Q)P=R!!48[8fGj> -J=Y0(<97uNJ_=!e9=b6ck8u[l7In2]boWVR&(>adfYCe>g_9eqJ14l.%=pMBCl86BQ&jY"G$7+t -;nq_?]q.,jWtG7,mDgSc\CZu2@>8)jHQm;)LG)$'k*B4u!=;$(*e -?Y.[cA>29Iek-!To&%+N,M"[p:aH('[XI;Dm;3'CFF]3uS!JKB^B"W`!!:$5WFQ=f`I$W8qqk-! -;]M8pJE/qO8rIgJP(20M9D#(q!B6>qGn!CH!>(PEXeePGI<+R-*Jo.t4kK2%!WeI6"\=DH7X;rPP;HO]MhV@*rXH\5W3g\i'LRr]VbP73q1"=N=IYf1m'0`c,H9PQ+./5[]NNaaX^gLpoMms3f+)oqiE(r6f1K -V8b"eTEZsI\g6cJ=`'"FUJ'o-\k<)Ms1i`'9`CmM-g=>S!cBMinlh"Q!h^GZCAB)nUJ*;;26!XOsm9c44 -SGLCBQ:jPNm6@Mh'd(1gCY#G'GJFPBdoUK)^iVJ^ifeokY4rYC9E#]`?$qAO3ihYhT<%nmL8?m# -[qfeH?gV4P9"R1CA/4Z=7<6TPDn&"&7F3V0Qe\r4k6>kgV9eirTdYb -.W$<7[bi+0XmX3>eOKW#(@a6[[G1R0n_64I/.e1:JE/qO8rIg(-NDM`=6khls&$=Yf?".,!0ast -edm_.6J+(Eg/FAi*aZhKKLm*>Ql%3a,VZ"A@\UrFu":tP`RBX[AJTGD&-3&Jf@ksAD9Ru1G -(q>4Z?[?N4?kjlY`3JkJ!O.^nCZ6^Lp\UPZEiQk/\_R(o2?'gJB-C@R#7cS'Wo]2G;+A[bU:-![d.Q[T*VjcaImE'eUisR]$s3>Xp$24U -h(B1J=[moZJ7V"@2eiEf<515SpofY18rO^XJ0k4aNK_US)j3hn7IlN(CB$>.m6Gk]51h^nVq0NT -ostEZe0CKDIijk)BBTa$R<2]NP7@k[qu];lbjcDKOCQf#pXsHO -ZS/1%s'+JA(CLHn5k5Eo5OmfAd^ldAPTo&0Eb0-lg]j-M`-qE-SeD((8cDA7[<9T@r*olPqtrC* -,7FT!Ilf'cqtrTan5g@E>u^>&q0Z#h%8s6^!(\]9rr"i_M4^F4>T(Rfd@%\eF^d+GJLB)9/YQW4YTC]JOcS,,@(u0WoOo,s1'o]31* -1APj3B6g9WO!XfN+uQV5Zc["^CnL2u'e09X.OjYj-#g#Ms(C%DidH1@O:RWfp=-MK^&&GpI]!&G -"4^M[rOXAnS==Es+bj"/'/uDc$kT2"#1P -cEr'GHMME2!6?hUIr%F2K3DKD*3Ia,= -`3b#HOifN]%A9st,m(:!QdWU<=Y/;&m\=fgSGe$Haa\K`3TiVr:[Lq8p=1# -Y.VMQ%:@afj"[sB*Uh:ZB73Vu&X.'og;5lM^k!qt^YN&03WHm2;f<-HcqT1;mA=#FX^7fus0'&> -[\9DKnZL9:2VnDb%@bFU1Rn*Idm?b*#E$16T^BYC:s!S.T4e$+(djep#QV,G6=7`<M>B0Wao't`i,l_VqB%k!SQ?kb:uZh:J]ETDO_pH#NeYL%h(;Tk#Q-]HSF(EKfiS!D$\^cc\=V:Zi=,/i&74icaI"3 -hHMk?;V?JA9g0RB@-@G0V_N2ifK.lt+J<^f#Ar8]f7G08hEc[-!:F5lqjkH[G0^,ig+`9^D`df* -'2JN[P(3L)ATnlTC'Nr5raW`2pWOs/!Bp55:q6rY=JljO=!*8H)7lc$qkicrb[g -]%j*Edob\$IuiWK)1[UK/buI48EIAs2p%cI,s(o&8Lf`M`r!mpH_fq6VW&8rkFkaaYRslk_!i=mTo'7I<`cc,JWY -rBpWZNf#+eP5f&N8R2%gSaI0Ph?fBOA1[r\+eWggqd?<"qnYu[b6W%o?jqi3q5Z4:5K76eg\4@G -IqmXtGQ0/4LWSb<<"Qk5U6gnV)M^6c=l2u2+YPqP**aMLPir:1L=bT/`'2\8_a?TJKqfa`P -)$#(&3V%)H<]=diIquAbLYYQW5?J]6GZZK[4\#Pnq<&T;T0=Ve"(95XTc'gLm5%._>5ajTHZ.QI -@W&sOpIl7NqnGcMVd',p=+u(JKjoNZk_d%l_1(s"9al#!$qSP,O3aHrr5Hlf(s1'P5g"0F[o4f'.=!]*Ggi8 -EukUII8Au>!6IIh.(hTSCHXMOq!Xtq3;W)p2-k%u$#uGO,5F#3>SBXp!0I,2Nklg<20[OLZItE@ -^-P?;(^)/si5gBL'NVaiONK#&j$]M\raCQ>pGDhu?'qMcBgk*o)okJ@di6!]9V<5 -s$R+*q\]B^+jX2*\Cs1&!<#AnVJ-%R99?R"ZS9E'_4TYMTVcB9"F[fSg%`naTH -<'3_N@0bmYKPdlYet1Db06E@/!UX[hSH$3#E_?>dlBh:%G:'.YOZND`D/VZ7b6!5i#SbCQ$iW2\9;=ieY]H_F(4@(h-\Lg08Fd95\M%Zsmg%g@mBf:q!%\]FKKt[t -7r%t+:-+3;;*4>Ue@skl36f@@:]t%J!0I+GKmd\thN%U0O=('bR`en>3g[hI,uZ5KKshC+[GT/JrrNm&Vs$7;c];1d6@iKFe-9%$U"74"jQr`nrZppdKl???66?V$dU?T!/gl>>&T5W=@3Y4ItG -g&EVn'%fk7j2]/Th@e"%B]'&m935"0QP!:/Rh!r -IolgHa['.tYVD-&O2mbVD#aPY!(fRE<3,ipemT@O%06`"TIGGeZp3BrFQ5QoMdclU47rEnBtO5- -C&^AlIn*l'\`7P^mke)5,n'I*gIeQ"!!FDU5CpX(![RS30hC(*!7A+5^M=P50EM:eJ:M,2K*hUA -Il&CjRfJ6K*/6]Y!YFin?n_UHnrIP,+98,C#KB"/!YFRe^`_5/'ZkhMpQ"Oq7=(=gi0X;qP5ojk -*.R`#!YBk^"=as"C'NTufgbP9&>1)ECss-"5O>)9em1g+m]8l!f"*"CJ,f]p!.e.`$330Y=1LlW -2o%Tq!`qm%aa?JT=B,Qn[@2"P2';l"#l#UjRfHjM5MC\IC&3=gBIRC-"<[[FB*Y>U=P[uo+e-5jaMqm$!YBlIc3/_,!'BaQfdNfSlK;YfrQ'VZ)H1jHSX]cN&1hXN!!HO<#V#g* -q9/)db'Fd<*sB6H!oOOg+6*YX+TMNj"G-p[P/!3:Y;F_O7=]SfBf^#P!!*?jTIGF7:K:?ahd$H= -ec+l7=F:]g#/FK&b%!X]r&@Ye/XRc]a!i8En;422lZ?WPrG?["<[[F#g=P* ->Q@lEg0*=7QQoKgWNa<8TT_+WOipriC6rNU!!*@98"d2Z5GnV=N$U-T!"A(8h,)'e#XA@kOV?qP -!1;Z"JB4L8]6OY^(Lb0O#XA@k@0q$*!6iqZ"E7(#fXQWOm=$2tlaX(#FPK()6N@0!aG)tC!l.?I -9gI4gl)mlf\(%pi9E4*<#XA@k&84\/(BIp`EB9b,LcXG]rgicpY(Q1tCPnE#!!*Ad9qXEG@$iqp -&ER;HA<^+h0M:BgF'!A,PI_<0L\D;1h]@\QAC(J8(@#% -hIF/-D&.X*!^R)7!eOgU&SD6@'`c5c&^]iWg0`<\;3-KD1i*BS43Q4F0*E1,-q(jA%<+A$0h""m -6m2=H4sHZ/iO#5'noPf.qm)PkJDQ#N*Z\sEo-JZC;F(HH&b<$:N*ZKdF:\JdNDVV9THNf^hT4&@ -2?XQlfn;D57pQB#M\75,Qa,gM!.7I>\0\AGToiD(Lk*.tSZB5;"FpX]&^^>-F`ek#`krmZ%5!Wo%$iBY:MTF_.t`'?]j6R!BL -X1`kS.;M"[]h3u#&.0)pDe`qZ^bALUdu)/\:?q(j._GE',JD;EE0SAhVE&d(I[o[%k#fUo*1$]D -ka;S/c2a)8Bjff!p\"\US'#ld[N][?mGo>AWeI$'eeknk?(TYh[rdr[JRX-#6Fi]:9Yf?8-]Beh -GOdAu(B>3oI4;Yh`MVfVWN``SE+a%eR!)14ZM!>EQ!4:p6(_5Vg>CP:JXd4k/*oiRRtLdGa<1P9 -NmBp!g0,#H.K3[U2^ST.+OE+L6pTpkl(A7_aTqlVKa7rB@NM9n^]+qJ[Jh("!H;=oh9f0H":>_p -&qc]L#:sgT+IuB%PQ7ql+9I-'cF^%jO0\gnQ/0Xc";q7t;MBYp2g3nhUk/lN!fT0;&P,Xs(u7L] -]LZtEM2J_p@h/0CmLF$Yd_"ghr5T`^FA/>=!RFS$3ULa$-=B3]BPG1j!_E_!A#:n*G6bJo4F?<# -rm5g_oY7fnI]IdCD>ucJA'P47rQP_g+K(V-mLF2"k`Z_]()MBJ\*/OX!t7Ztj`e+h]@-b6S"''H -\&E]#+OCJsm;Fs)cjOPK#t5tN!FV!#!Nh*6a4gVHju:HKGH1SBQ1o)'JXQ_]7)0%CDX+dDSIQK^ -Fs'l@P8=37fKo^[9gJYSr\T&.GH8L3n67='[KD!In^6Dk9 -ctmYBd;6-;[^n_)fX*1;"F;@jlu26ZJ=L3Q\0dm#;:`IfC]o9^d[,!4?C2$Q(tFtfd4E(.eZ6_h -;t9i7=`\aK(1Bd0">p*OHnl@s;p_*2R[!lWfG)Juh[ZSK;!eL2SmK*VF>Y_872r#.$A5W,;!`+f -$-4=Erg_2-!*G'LV;.d]mLCofeWtifrA6R\TWW@'l1E5 -cpRjA"9p#GLk(UKB-q#J#ghgV!a,m2K7O;14s[$)Iun7Cp71uYNt4na>iik&XA"b,p,??E?R$:R -5`,Sck#:sT^uA@M!:C>a4a?_Ka%r:4-14PDkASP\Q`/OgTe$`lKKp[^\3"(0qK+bn!!,pCd$KpY -"H8D#amYk#=b&S0rlE,``VF;ToYi:Ep0f[VVF[B4h`P8[jYRXdErmO)bQra(JETY:7K5+V0ZIYV -gHXAq)b8CGuZ?R,,SEC#+j"g>sHHcMm*rFj\g[etN -3F7]cmPG1`q\s,KdKla40+\*s6DcEt(9Q^Z!>F+!Ps#iFnAudJ=fWCs->Qtdnm4O]@qgf'1`"7B -"$_mAIoC_ud"0,Kb%IgDM*MDmAf\HGLhVsL,[rr[c -nOI;0Cl6E3poVY[Irh^2$8ZZ(%8UR9Aq8LKjMJ^SI.l1WoohW2[8o#r5o(Q=nhFL;@r5r`MZ&O* -%`i?2J-uGa*68D93Ul^fEM\mZ?r.QdQM_u:;FF`asEY8B\g6[b] -$D\>J&-*FHKa=%Ol1%sCr`Xj#1IOK"K%H\&+9I:X5X,,k!%Pu,&MOf]bl[5dnIp[.&HNAoQDho] -J4'JYR9KrI)?D9T!7(t]K@qLAf'[$CAgp,u>n_0_1/?ea9*0eQ=>/^Fmk80Yo[!mYO6b\TSH582r#V0n^qFXTHW6&kJe/;Ds)>#G#/E$ -6lGB(MQo;qaDT1IQ-)hK)B,5Vp=tUb2(%[5;3h1bMZ!u?!A5QCi3&h5)5 -#Jd8$?*[DjMY$Z7c[J=Pmris"Rs>-/&b*#M(&>K\!CT11:=Q:5J85.bELL*).Wor8>#8A*P3_Zj -3W:#cUct1r!6+bbo'HT1G&#r1WVRLbY:J,Z8E8]&J_SGX3K6D^c2e/R=LF>"Z$11ihJ51Sdr7m:m2rh=jS!( -Gqda+NQ_A*Ng'b3)Du4n0!g&cVEHg2,42&Ko42eR>8?J[[G<,YO)2+ML>,rXT=I$+@,QtA9l<0t -`n^ZH`Xjp+JO#OG..Q,ppRBA+1OX\SG"hUkTVNCCHA`bjP0.bop'c/2f`]I0".0C^c)L93`W!mF -%`i?2JEI&7*[.j?+ol6HiR;BA*idJJ]c_86M0?ZnWk:X`N`*,b%hjIEdg9tS?ojcHT4n..V[`%c -@nn4U5mJ:&7_mYi#6@R#lp)0NN<\N7[C/8(Mf)aFRW_Fdm?CX#p.nMlhP@HdgSjdT32Zi[F4T!M -duU"/#g>0fk*Q0?3P*-*G(Fg/]+8gLIhkTEHpYO"%*48T>Pma>>u,W)i2Ru8\MHE=K/N@=p?=gW -'3D^qFuj"u0$]4F'*/Z5..*!-fL>hQ6!r!Hj""&XY9!.M.VHn"]+3hc.blU03TqdkhPKbY2$&p: -e6Z@8JA9Zi3R,3V9gJ*.Er-%HJ;3"7X>5@A<6`1W>W\X:g)9otQ.+gBdoB_V@cqK/Q4gFlZ%**^ -$Dl!s)KT95p*5im7"C7?o9lEZ!NlI%!NTs8%7I?"=:*.l&9QmRebQ;o\?Hh_S$"S6AFE[h+M]i8 -GH_AD:?.=L!eQM-[h33PdZ&*[St2YtdZ\/sW_[seJ@;J:eE;91cW0e&at5(oX&a4$+Rgf+=L2cE -3#rQtCJ)hp!)e\dgqN+uo/9,B=RsX]d>n$L.Mo$G[;sSa4>gd9gS-FPHF;q0etlZa7;.9Z=.NGcZf$TBjAYJA@A0`sb3?;=rtf -!AaBp?RBu8XT[%R.[sE(2Qf2C%TReLaqn#t>KYCqg!:Ff$G=AYGrjm^U"XV8%X/0%#nf#oEr\)n -Ql1EHeEiUm2B0FeK7Lti:AWUlCZ$%p,A'nLnKVWI!_8NDJA=F@2oc>Wo)Lg0s,G_M*TG`N?;-\V -Z=aMH,5a\Z*QHV91BE'e_+[+%T['#o!&tL^A+LcfgJ=%>YUOK+#YZIN(C&Sh$$/.8)PNVc,m*GM -^dXNY:'W=`%#o"r9"m=f+ScR=mGK)-3YMOD'"*uA2`(P'5i;nj!WiIHg)L10C#BUZgQK<7,J_4t -$O!==5Qjb*dr7GoTHUgu2F@Hi'MQQMCqhbk,%*(E5%&^2"AAqLBUj$&+:r"!UnMtiL5:^C`9F<#d>Z\g-_cYR0cu[cW<#V -Q,#ipJ-:IkW!b8E?`.W$^+N:_E%;=t:'ZI2\>,\5S/ra3WYhJcL=!/=uZccldKWN3A5F#P93OQOft -g61V!e.7mO34_[kKPLYSZ^\IYP%aZ]!&$,/B?H>]3:`[Yc;b.#a]qs6K>;P=VEHWs079.FPlhT% -hj@M2"GA",bQN/M*FR!=;>0uESG-a*`'o2j`A:#&r_-)UW?(o.H9G>:p8m`Kc#E__nC^3[>o77s -J-uH0!1R%Y*::VYnf^%K?5RpQI'@kQ3mX._5A(0CkNJi(q]9e>*%T_l4WkcSn0B+WAc`%N[&-M" -k[gP&gZa7?aTB`]+p)($>:fU- -U0!X@":tQS!:dUU -o5R%r!PhN&Oap^lrrMNJm4NrS9#O$eM'WR]o'QKi!lFH6dfFW9^iNL.$e/_CAmVAEf#nOEnl(/\ -!h]`KWk'B^A)$Da\54C-`@?(SANe%V9u(?Bm'4B_J3]ogR/jiQY\t-CHM+hIrdQ!1Q#)mT!+Zc. -C`Tp1^u))"6K%Ce;S_fo":tTtW3fYcJ-^CPbdHMM1Cu)p#p94_!i*>2!f+s>'*0J[r+EKF@!H>d -Lk*9/HP?KnbB-DV2[+@JS)t7^fn:867DNdWZl]F]5U,,8&:m)4!"fce..eV`cB657r-oL7oW4KK -!+Zg^S1P$!P63J)#WP1_B.$Zg$_Z6>R0_a=J:NRd&TG+G]I%$mf$os7a/f02#&ZB3jq%OGKcGjU -!^#Z>"I7;*"M@E>pL8QP0AH`XI:TiL+>@:Ol-OVZf_%?sWa2e$%hL8G$*lf=B**Q*kH-jH,/C?f -^.^VT+63hUF5Lg]^`FFWdQ"`hEu%'s(WW_:BDL3]%*Op6Z;)!HEKcAcThbn31IdO-&sV -7IasC=hRYn?9,pEgijD4$Q9-&+rFu9Qj?MeD/Kr5PARLHIM0^IRLoQ'!5ed<9*s6-YjH6Z<<>-L -KrOgCHuf&O&35UR#T2qq"H:i@h<+p2Ven!\h\a][RM#W(!5ed.kL7?T+9DTL["\j2Zb!Ri -ru2$/5][)0"9:di!n@Q=7b(h?ne$_/o2M;`D)5oQ5QDB-3/A;;_"m8Yj<'cdo&^J`bDG^Q"D/>" ->p$gHj[t@0/'h-s4*qW)9n5JX!ZmMT02]55-3>f*B$acS^Ero0>IL,Q!u!p""9qJ>faq7;:S4Fl -7k3+_"Iu3l>DM'VlViRX.lM5gi2qn.RYpd;2MXO@!piFhb(g/RlcZ[77rpTMirB2n!!+4j7.pb, -'nKGdHs=_O_^atPm[65'1]c67,$-5-Lk%b\hjCNDSs6nEtl1_HrhETM:-+T.PtI4a)@<"BAR9ZFul:D@c1>am$PL0&;gGh+;@E$J\Z('2@E@,"FO."i!TG_&X@,X#&^!F -l1Ro`#+u$nSu\4afN#1eg:CqdF;KZ3VZ=SQU_O0b+g=_,?`NZgQ(+"'^8UTL't\Wsh`;38>1Xhh -P0:^"!P(TZ5sLb<82.!PjGJJ9#PTmoG/GU-ltHFj.bC]uA+?Q82p5@0oO03ggfW@Wcr(!#'@;aa ->PCek!RNWA\q<6O!kYDV'8f[g^S-&8iRKREP)qCs&HNpSL5f=Ki"SGB@E3);"RbO!AeP3N\bm=I -Drs!`f4G(:P47GuJ0sp@VKW(IJDQF;+U%?Z+;$;j[lK:qVodg"6pNqGgpY&kU)$'kjZ[cI:"B$Fo#Y6D5pu785!l/$YYSR@t&]doSfY`C0*Dn5OJ)q> -<+//t,WM)Q\V'tP'J4-T5f*X8!=8uIf:jO@!/NB](^5IQ#p9V6N@-@%!R#O!!K/15Qja] -_eKG[-@c(%%$]ls!.jhH&-;/9dK0R6&O6??,K/aVJA<911)9of$j)qoZQju#a=cO5$irQq1)0i` -gB!*15Ju!QV$I(1Tu1gTj?WbXO@Pi2Z@;o]JGttc,6T,cP5lf"-8;GeTE5,s5Qs\XJH,h--\)I> -4pG,N('+P'>4KNM#UE+E&Wh*ZENWpU#_8LtdiAQ6d#LAg,/>6=b_:W8L(7E@,Cfbr#)%IL!.jnO -A1.MNY,EHEiZFVl/49KJ$5^]K!!4GI6pO=q*&TF*=M[7C5F>nCV!RR>W>=&;kNX-=Ci#G66[l)](^bK[F@Jb-Q+99iL/Y56.!m:j?"<=IB -Mp#/!qX7YLfU8^"LL9ET+9:+OU]h#h^_),k:'Xnl?^.`YF;,Wem?mqUTP*2)#6>)=:EXWhE4uU= -8H-MfZe-ip!5op%m"59@3['T`#^E[`=n;Si-dZN`.09d*Ur%sE&:d"d!f;baoAmM0s*q)eJ@bOh -5QKjaHT[&`"@O@E&PshS)[InrWY3s`C.7F<,4Ka*r`$!OW8&\Mh:252/j#_ChZQUUkeT9o,;1r7 -o]-qDI%l"ufqIf#4=OIc^m2WU6BtO-:SK2i=Z\]7?=;f3q0@'rLUMR>ZrZqM3`a@V@+9;6b:4Im- --q(jASKe1?M1D3nSVR8mU7in5TD0RfV6LUt!5oWbm-0H/,+pa!aYb'K#dEC)-l]WB#9JYH-%H!Z -'fVZm9`PbZF9MO6+/oN*>6O?7TB,HR-q.o#![-4D?s$J5$5('2!F5_$W85N_^`.sXP5e;k6B!Ds -&jQF*#bS8T,G:Uk\(*Pa@(6cXkrB@gn9P,AjSq"pi%R!6!XO>?6\L"r&O6J@75hiR>Oo"QV: -Z?S2O!t7JOI<>"NZW$H,u&9OlFDX"G!+H@;/47&-3f&9sE7o,d*&b$]iYiPiUk^d-7>65'1\"U_/cia[f0N,N=JC&6KCTh4[ -E0bHGo)D-ffPi2n!XO=t!eNGM&jQR.bMQ7e*Jo;%q;:1g"h+7QJ,o'V2luG/!$\('\;<'`=9P-C -4Efe8CLWZM-W1!OJ4Kcp=i1k#7"@EJJC=P:L*HKN",VOaj=&,7qIld<+9E[fGiDF_!nspZX-uBY -"D!s9;_:GRl/H0os-K_U_65g)+9:D[$W]\_!"fc6+<6cr:^!:8f.?at])rj(0ei_8JA_MH45gJg -!l?`f[DeRYTM5@"8sKX1`D$=5&9iN+/eS4q,2hHO9Yu`Z#uhT>VojBKo"QbS2_Z`a!XO;bJrGUr -#S\IjUt-(X@?;hjarD"4MB"#>-Q@IuNZeE#`!T-^+Fj`R+:(_9Qm)T,QMHjEJ*k/`bY4B(![-I[ -i`\8D$5)cT[=1h/4j[pn":>`[:>sO\H9F^_IZoY=pu.\B!l0$XY^R\rg54RfZQ5ur#T+ro?HWeM -[f?C2X@YfG<4^U^3EER0WH,N*F3`Z9i%hMM!K]U/ENpGaKa;q#>3D?)D@e2EWlE2n8cHhb1Dr[o -!6Km,7tr.ZSU1+9+@O!V!ME3o5bKh4"@-I=C^>UH#tP2H9CM5(JVX:1"U#t+L&_:j9rKa&Acdd= -R%o:N&:hPA!XOJ<%A9s4"<]B8! -1kVqS!!*AL,_,l^M2)Tbd#:45!_1l^&^Uq0>:[`g;%KR(C&-*cGKT0jU -+9L>Q%`9HO495RMnfc#hTa>[4^sE[dIgA;I&ci-N,V#mJ5[XX+!T-k?p95[B#meb@jraYTAcrYF -c+("n"DST8"Ooo\"qZ;MLBJ.g*Q"Xe#V7?R#ZsiTruhAnTa2b@L*BF.fb,,8!Un,G!ffVJ!eV.O -!"9nM%*4Pr+Tb.(*>+Cn!5N4Q6pL_Q&4$j]+\r/qJ3;kPf+8f[DVZFq?&iJ3>91CBAZUi=,o4cm8\q5aQS,)Zhl&8-F<-eI_g> -Qr+S"&84f=!RR>W>='Gl!CT1lUbi>X#YZCl!13hBeIWRT!$Yf!o(3<@]EfV[nqoB_3[$1(!oE7] -AB]],"Ip&h!&t?'k2o%(&-4#$N!RKPm!&kgh?Y5(H:(Cs&?&A)&Q#);>+oI%hB)! -!!FDEJWpI/-ius=.1\CcK)c#s!.fA#6mMgbq3?jI?PaoA%H,/GN15QCisJ3Y.Y"qUe\s#c#O?:"Vn&:d%4"F:a_QZM40qe3c/ -#XA@k&BK`Z'(]EZ?(MP1jM,V6:iR6P&:a``+Q.f9LEb[T,_$=L!#m']!=1q5>65h$!0Vi?UC"sa -!!*?j^_MEN,/BBA6X2X4Yn2Ec"<[\qS-]lRi"E^]?/DIg8cC^\,(,.G"<[[FT*1ComD?Xc,/BBA -K7/'*eI[62"<[[F#cqb`!_E^L(+,&"=lJ=[e-PT' +8cIoL5MceBqsllH=aTUaX``OerdM$9\R+.km_/\9%]Ng,)(bmgoO#!%?6F`P;"7Zig@/:_7icR=*9dQ6E_a>!!"^)Jr5%*6GRG-\9%]Ng/MJMmgoO# +!#S&=`P6I8/HGhOAE)k;>_a-WT;>H5\13$5_1?_!/oTnc-jc:(+iG&HI>J +;#C?QM#[MiJDq)IC]j`G@d\]<[+4>8ZTiuf&-.4eV;`Rqr@%XF7R[:W-:75-0I6c#0EI%qJ>j+\ +J<<_,!L/*7!/r<@s&e?;5("?j%0n!2Uh=!!B"k""4`^!#Ug0s*.`. +LLu#973MX2"%gHr(AX[!""4W[!#P^T+$f&r!'k-1IfM>K!!!nak7=4$"99R.L#W,g9SWb$_%6Ts +$n2)TC-qt$2FR'?:a6#AYQ8tJYr'e!Aq'e\+TMM3H*Tj.a)^TsaRWsDj!+O(CNB0u,osb_bL$T> +5>oqMh4:/Q'SQMeX=0P9h>Ij5rn*4B5?6-I-!a$hWUBbmh-L2BK`D+S+SGQNo"OblA#WH*:R&4n +HK#H-g>hTs?i!)s,Qn+?-]1.bg8=XhY+%bn1V*gAW=T&[*Z4:*^6TK5c4@k;&U-PAVF:IbG-OmA ++1]QndC:7:^Cqb5\c\PW4TLG#!!"Q9nOHq:'`Uo:%#bbeXR6*s9EY?'#8D[[[79]TI")J(cgDhS +`^0Y*[R'FR?Q0^Z:Ac/nQ@P>W!/uX4!:7VZIl&bG9:nG7b#&!tQ3IO+!\bMo!3dR\s-VtFn]+NF +Mgm*@5dU[4=8Y!2-isC1;#J_m!6'FbZiWW$i:f#3`=Ee.;>ehr^r=&%K*!8#`#q?R&-MtiO$8'c +2,`u5`:UhN!ARjkaGp7NVC`M^j-oriYcEnEIjZ!=MH'`b!Q^9$J7_[VdFUe*^Cqb5=or1+5Th!I +!1H=G7pcoGs%[AO'HnSW'*>H^!2)@?IR'@b:U<9O.\ui`@N483!O8a\YV?1ZRZ`PXbk%b-A#[>& +J*1Mp"RO`'!3D(YJ7_XUd9!$\^[or30TZirN=Z*:"H#G?._PP#+p:;X^q]1V!*2Mg_!KJ3O1m(m +rghq<+lI\&"2HCR><2b.J%2;H)rT(F:CR*3kB\dM/):(o8LI/2rEal/UmN$=67^q@j?ina7MPl4 +L,h)@g_T>UC]'`J]XqMkXT<&-p"Z/Kk)1hl!)6ZGr\Y4dHW',=fY?Zh-<UQ'pig1J5jT[c#f)H+!!&Im +0\*Ah!IoMd#^B>+-_ig-!!#_aGQ+eJCnCYR/sQ"r9b)]!,6._2]geIh(IdjYailA?Hk9CJ!!"]g +'RsM;"98G.7I^V+7KBM./q"o#QOk)6h(C>7fWNc'oG5;#6=fi2(8Gh4p1ic@s./q#l#QOiO8+?i(7fWNC.>g>D%0?N[a\_ndkn!gp9S2779T&lN@!!*4@!VqU!2H:`"(`ST +!#Q0a+".?p!5L!2r]jTl!!!3nnH[3(!!"]$MEaoa!W[be;#Glb&HDe>K&R<*m5egN*mh"3-!`(d +_id23Bn&]mXl\#NpELuT/2d#\jqEn!AS.R-0[e]lN?[TR9d7G>42BJMgmD8I3]i\ +=RlD;MEbiC!!("T"olmp]d)@p?YX1SO+/(#\aNor/l19u;uBK=!WXp7BZ?)[rJTZ21V7,8\%UaX +cc>N-P]RO^rhpP4!#W^7(CP[AqVN@VXY>=/pg5emHNRC^!._^7Q1SZ[(Rene%ThdU9l,=\J!mio +e=m29ft!L]N?ni1^uh@es*RCf?tRg9O85Nr5I4>ec]`IH]AL`S:<<>KfDu!Q=ALdD^J!!:j%hK. +gj4b?NA1F^l^Id?lBd@>+!g*h./rIma1JrVg1+`%an.LD! +Ii;pVih'A7ino#j$3;m3Oq9;I!W]I<5>D=XUA04Nqkmia./oXFqn]8XJ)=ltYuoBEh*$>i2F%WM=q^/n +T.T;-X>5M62#CpOMLR2Jo8q1OmQ>Wc45aJX#I,0K!*Tr_pg03ms'N3R_s#G/8:ooW8T@o%>^[q)O&9)dd+Sm5]@'6Y7B^Uqt?,.YAIqB?.s3qi%3@hqnR`&cj1M(^[^i`n)C=jcT.RCh?#XmJ@&B`D'qCS4.7^jjuAhtn8SHo7%90eFZC*!BUV2O_fU\K>EoFo3>./oXZXS@"6k&hj*H/4+T+on9H0lf41 +5:cV>)2`oU1G/Ts+'8dLcgMok&HMkXMJ7P05@tW0DjGX"-jIXTZ^DX0c?0pi^o?.BX^N+j8p$qu +4e(HG(Y/Vs[Vh]:-.i,DXCG\1J'A)pqYJ%0"R!gr^R9MDKTe^,./oW3r7a[@^slgTh^JKjk_E^trg?X]5le]b +hNs+LD"%PnK]8UA`?0X2J>rHH.fLN[l3'oeMLT4PIrlM1Lag8/5L2$iAuFOf_VK,Ul*+/o1DAS, +s3K$PH7#!@q8WKFQDXLa+R*$gD'.UB!9.0 +qY?/%49*OQSc>;$Rf0egmstIhZ2BTW1X,47A%c=H:Wr6`Oq>uUZ(gHUmUir>ZFLTEdC +r0q!NY:fqW`q!"`HiI2d<[rbpcN-YE5 +UuHl1A'P"XaA6n"1!b=YMug^j?>*s@5A(YbrO2-CR\UHmr-(T%IqJ+tLd[k"<^R5pL2`9NZ\CGY +C#",$8]RX1]9IJf"es=-ZW-j4AdME7YS%#Q0Fer^Ygk_fbl4c6ZX&d,n"9IPIr!:r["^dEbYkeI +o,DN>B5RYWkQ8iHh%+K!Q`!8Y>4o0:VYn"%J!]dKM;mD+c2O-Ym#Olg!g#tfIq`]/c/UQ"Z:<7A +4mStpGJCDYa/6%Bd1V+KX>3>7NZcS1j,jAt)3ZZ8s&!cc>8I)[$Zb@W\qIRZG5NKa"J.8;a\;X'*bIUo$ZZ07'OaI++$b:XZR`p;bZ2rYQ;S!5"-iIl.&km8>`ee(tVc.1NS/%`KMg90\?\C[>[g[L?eY +T8CnrYQK+L0mAZZDTD58PZE38dPL$)na?BDP%(Fu9+.en5RdG*'PIO"7MPmP+3^;U[7/RE40SU% +Q(H3A:/!5Ss4GsOG*m(L)uC>"!3j-b$l&a/c!oV']AH!(;n'M0?lV$#@nLhD/>1[G=)Tk#5Mu-: +Klctn8iiFVr\10jkPshe\tE0[^EBl`m#=+,jo0)l5F4$?h0cN(S!JQ4Qn.V&;$'o$V"gRE!Iq`Y +he@eWC:X4mP%+1*6`Rg*<0'+jPbRshJ2H1;#2hVeUigLheFU\D)&jR*P@[K6F_$&Ur>dqf#Wpoia!B(h@P?;V8Xs63M\Dc"epTck,"Pc2\( +5k/2a[MA3-Torlo5@?=I +prBri8!!A@dplm[9$OpNJE">+bG70$J@&>SUBLW7%E0EsR)=>2$F#SFTe%2Su=bq,.aa37L%!2A0(h9VhjBD6&lO#Xe-%K@2W +=_dYCWZPiLaoIP"r+!:^hji5@@sVLHoTAB6UH`t;VmNkn0/*\.r%V:'N<+"mRn?m`D^bV\IDj>n +QiF:BM?!Vb+r1-ffm)EtDbqe3p2#8-6^_>r'+'_gps!7Q[i1C:D_c/k-UA,LS\FX@?s![m#bUsdpSMG0YR.g9t)%HgT,Mi11[]uf\ +D!]WLU0@UqZ[WD!@@Gg;C2)DZkQl\Q`BSeVT%mG?5AU.+95su_[J_Im +V3tUQaZH[Rf)A1MDWC0"=RPG@jY;`0s%c2^"%d]XpUr`rAFg*`qg>iI%EJ`9p.B#lT@DW>m+3RI +K,(onHR/RA'j^qA@l`,ac5l5q2GljMJ@j\iNP;7BIi=rJk&"2_mPgGRa44N'!*D)R+@(g6&ZQ-; +WV@Q3`2'q7#[;#H5K>6"X'ChU*S5k-K7!<<*<1W^Ja<;^6[^LJ5[]M%lKWN#r;LCug>!3".A +/H@.pr/9NGp4Zu$AdN\=:XYf"49Y`3e#39imeko>Ce;\A4?j8CU>auRS"GtCBse"m\JZt!d-P,@ +Rem$p/Gd*WT*1s#EdG +X2Yrk3)b%9JOC:S!9B;#!2O6,=Q/_9>UP?De^=W:$ig:K-sH\EpfFM^6%IRfp(IX\!bL$m^tfMn +U]%apY7E2b!77Bu>6$)NeKY%o5_Cs%!#5H9TF1`")ROYfT_Qh;/H>dtTX=k%AqQ]V!,0a5^\l@C +1.`ib3k)rOD,+i6?<9cm"TVM1m/R\'!OK"[-!*se=9S]'_F=PK&-Ak59)tUg!!"e.2uj(J5h-,? +!77Ai!?_pTW`;[lTF1`"1&F_YN(M>j+%-PXJ*BG8uql6I8o,SDC +g6Ol%">fqDU^&\EYR6$\$k+DYScSmI)!mSRh#Z')V$eDn\scD0!"(Ye!!n7..M)R[TL"27JA@P& +in_!:1]3i*IIBB$!1Off!!L:E'^^38TAAA,h#"8TJ9?ha!!:sW`O]3WB6J-N!<@XD7LK3ImXQM; +[E,].L7/"*UmPQl!8,Ys!?f`0:`agF\@f0%d>)rD(B?^=UBc<7G?cC23kFLE\o>!3"Q2!?_pT-] +f[+b!I!mmb!o,q^&NiJ0h6J%0;/P4X==+"Gi];E[re1Pf=??^9S0fNC'n +i>*(,6;.u5pXhq(6qPGcr:qPClals&c)d4rp6Z._[L\bY\RhDmGIdSsl1[n&JMM,Grm]0ceFFE[cdapS3#&28rU!e?\E##!6Ba'J//k=!!42Q^N7i+p=PJ` +/A.$E!"YK&R\\95oEnt..0Mc/Z/7LF:;HB=Hu(4H/-A.FG/2+8j6h-D +pa@@CZ`>@b@-"dcj3mCca"TRT248:]#]p;fj@"u!QIBK!,==U!"]D:)l[g<@!p;( +OS!9Z?eOZ.JJBbiJ@DWTd[IFWE2@.g!!6X3eolOe5B-!k:WUc>(\$`<49[PkKn+q6-30lX+ohbc +"K^uVCVOn9Y@MVq9OV@'5YE[0X;G'-Acb5j-"&=>S^uMuNg]jRUslA+EQeJ9!@V5P!?f`%Yd2nh +k5d*JWZ5r=FA=ioK9jjsJATn"pS,$aT)kX +!@t^i]2q!;+FUFXPX1mPG3D1NG +FTO6W!^OWhJ6q[*mapk!bX.`N-R:i]d_?KBMJ,9OIIl[B\cZ%^TJ-M!"geF!l;o80nug:gS=.@' +^f(S):!=S/!LOc+?lu`Ym-5F3[p>V+^,%(+;>t9=c=dO"PR%9D?sqnjYpduH9:o&^1V6i=$e[05 +;d1(Upu\R%AONU5:k1R]aUQ8GpJ7R(ml&gfeEIT;5Fm[Fe_L*mOtMo>B[mnsQ=J/j[UdAb)Z>)* +Jsk"!2\B3nQCp&"@O@,Q\D!5"mc?q3`!qb;83f8>sK +#GnQ!=pY4s<9asLAV41o!H\Q?KE0@$+^eM/)kd&4!$+B+8jN`u=9nmi&H]BUXT/TEq_&[."J?H^ +!/uI/Y_!Pj=>B;lmNQMMBJpeY"N6[X94r*%'Z#@J!jF"T!qpZ1]-"<0,;YG43Jd@^T-`a&1Us6c`4?hiFn_7UM@=/)^^pbO)dm(32%GGS +jKtl2XI.\Mbq/PtGcIQ8c0F;CF^Jj`5F2qCM4)>mPWb"K#;ASc5QlTH&H]+TT/eiqS(Z!5/qSRn +bnX_I>mRshDGNYbKE1)O(k><8rLg[\REGq_C\e9-O"dp7XnhhQ\biKS4\"/j)YemC:UgfL`gs/u +IADhNWF$Qg)m'.U;?,2=G*8942'WcC_AN`cCo"#?VT+Ll*]Z^+dCmOd[[P!1qmMp8#d*Pe%m9GV4F[+#`(3WYW[!&0'fb]uJ3+u?jJb[-f_'T?(R +Y:]`8Y(c:obYiXMC`q5*#bX7%"1eI:i9obb4rCMFIktm)QVr5"migri,TYTe#hTpK!L_=UJ5stu +J0DT]ooh>Pbhaje[=CA6dZr'^q!+S8i*E#=Nb9HO$X/!.Z6K:st9XrT6J]8SMW; +5r1T&g=e+BREQH!;1sJO0KUDL'EW`aZ0hV3"K[F[J>)qQUu*6i9hJr.s4>Jd/*R(tT$7atgPVVa +kg*gJ?m]LZZ*[tJ9AONF$!7:>!!^4UJ8N7,6"b'309'rFBG$*`ap:E*htS84"D#N>!:5FU!0$%( +mf%!3]ig39m)l\ufc;A%;USbqIC$k5SH.IHRF*%*h%0Q?Q@n5cf1sk5bQ%VPI7Zgm<8F>E29j?/ +@qMo$Zhm>*Q_`(UYtV=a%`jXt!%^JR^]YDP4TAY+"mNI#LISu1uDK$b#QONiL=UCkDX'\aGcDb/0Y(% +.^t`91j>!-DdXrt:-`VA9Qr`KBjb?8*RI].!:'c(K)gENrF?695 +&7GRk#pCEI63%8k.)FKY!-c1P#q(@7Fit!<*KURNTPXf3Pi=W"9>HUTE^D0P/=mRS\V,K,;@(pm +R"4lA!)Si6U_(=&q,i@_OI;O8T*Hub)SQ#Wm/DqL?&g?3-e%Bj7O@$b#Uoj;+ +=qRl.8$m",SGed6RYh#[>IFTQ%"WE*1(:,9/bkPGDJ63'9M*\Zcg +mX@^+-\rtn*KXDkh#Yia[amfZ('+C]Mrr+D\bhpj5"SG.&b7MZ7m$qaBS%!.Z!+El$-9^p:dY-:0sK)b^OYA;28c\Z,B(>GdI[C9c5) +:kMk)E;pdJD.]mY:r;KA"N7HeHd(iOX1oYOM@^>kB7-dpS*F0GnW0<#X)#D!gh6^R9n":o"<:Xp +8RlkL"D!g%!b)8*2eG8G=ItlIr$hUQ#QUetbR4,4G<`gM'AjAe!3@M6^roh-+J0>LI^?n6!\T;: +7Ek,Qq*'d`+98'(d<0TC]13FBI>o&I#1`fW>mq]9QSAO:/?BL]92!("Ord#ts7Q]uW7`C@`I^Cj +>4Y0j:pJ&/XS0ZL^e?6C%Z'*d;uOFql-a4"6%GoiJ!"g\GJAj-QaT)](YafY&-E$0(bdWtK/>89 +`WUsid[qgG/J\;d8iis"ciS_X3*=THn`B2JSAPLR4'D\@9.^0!4.rtKJD[3upHnqrSAb!7&H[Dm +:)AV#\e&g_[Nd]UbW_VA&M,42]H@shD`7Tsl%K+f\VZljhWXD%S_8]O$QtK9!AA)/5X$V"PV>0A +7f,F+beB5.lK4'+J2rK!o5@C1"Far0(W\.XI(Iu3Zijp&Ad:FrdMjq^E`FcWF:=rC=$lu'>fG$4 +bRunYh&l+Rf:2)[@P,t?&Bb7k!]!>!!AQ9Ilk&Z\eEm5.9UF09!W_@8VLQ9)"bC$Pqo*"jKRh8n +#QZSR`W'_A0;SsX!4:bL'EXlomf0PWMoMn*!L\oa!_uP1s/VP@Tc!t5Zm;LV`eGV>FSG[>FQ$>Z +&eYE_ES<5+6/f%9lU4[q*>_9>*pqM3M' +BF0K+K4Eg69,mjMZAFlt=GAgVn,XIJpnatCT@U5?BE8+IlRpW:LuLA'qd\I\`dBJbM@^=<#Veb% +P71q&IP2H904d0j8-Ap#+41K:^MM2>pZ(&"VY;th8I3BfKn.f;@+BB$c:l4WMS*R)=oa*?`L6h2 +83u09((t?p+WrQsqaB."TPk,"MZ:G%4r)EG!:9!c8NL)(45KkWmXDcR?\(3\"D"r-#l+@?kC7d> +;ap>jNhjkR4UOVo54nFahLb!JjbOIeN]Z%t\O=h(ZP+bdj'j<"?l7L^FO0Ro/'D3Dl'a7]p+EOR +F9cn<#(EZECI+^$!5LRg'qf=KpnYN/.-Vb85%nP0of*,p!0eit^]EjuZSeaN(B?/'6R4fddeb;< +e_U8Fh1%);*LOb8Za&.U.i8qMC=*(_9Ip)a]Q=bM["98FsBf#tZE@1m^49PWaUETg@ +AKUsQ(`ab"QlZ8.^a'0d^pF@I!%(&=!2`*`!&1BA6bnNe%)gX$!!"@t?jJ_AXVf+n5tm"5!2'UN +!+9%7!!'t\"9@I*!!"DS+TN>a!<>B)#Q_a1#QOj^e8P]'D3<]ebROXR5d;4:!O6hK+TR->!!"Dc ++TN>`!<>CT#Q[2>"98F%+9V[i&HDf1K+J%D6N@*_Pt",+llEmW5\*:`!)T3j6bifPh>r90A4$=s +:aJF.YSdKBJ8,YtJFsKS!*"ph!3CqU!2+Xk!+9pP!!'@PE!SFF(>hB9NW9&e2B!#*Z$-0k!%T8o +!14Kf!725W!5Rq4!eB)=!!(4U+TPW)!!$E8#Q_`d#QOj:XjI[kHNu5Y&5*T8!6ec%+lIocmf5ZS +G!l<1d"E)7c=l3H^FMXdE=H2,<^ZofcjV]l6./>a>k#o_S_D/m@LWG?!)71'4!9F\8S7[MVS9TC +#lt#kF(QHp?7'@s`?2]8!!$]\9LHVaVrI`q-GQN^#lt#kZXssSc:l4WT:>e6@O2-W!)8qS#j@0G +j\:4\Z'+FSoPF0mGEVshb ++X$4@#Q\&-Oq80T)TGak0.jjS?jQl7RR%3E?\O8c./pKmc]rp^#M9Le!)4U>TW^[L_!1+/TAkok +&HL/t`WVs<_Eu%r;t9m.ht%)=+TS0,B(f"/$q)1kKRal8ir>9-k7$uK!'mjr!U+=Y&C;0lYP(+d +TFV)(RRRQJ?PA-D(T'9D(AU7>"9:9>&:hJa%KS5UpgZht!'j]r!O(Ga_(m6hJDX)?s6IkR"kWqY +!(^!\5V*[=#f'=?LOdiOnc-VWP5mL/!!!cG!moOa+eU@bhs>\2^q'dO^ci#)kUU][3&TOf?e+oL +JP?[UJ8HhG%&>rb94\G2c_pPJC]j`G#A3[jBsAdI!1)=m"?\=Ps)0K;'-K(4!3cSL!.Cse!hPm= +s1e8U+!;@$!3cht!;]kR"E_W_gO5+nj?rtJH<:FRYO1k%1ot@!2pV5!8*C$ +rBjaCOP'X7W^-Ub1*?]"W!rb-aFk*)TI'dA+,A5P_oG@%#cnA!(oWZ!(L@.T1k.H0dZlc&I8BP8-f4r8jWLX7RRL^:^R7( +0X?BDn@Fb>)??p+!!"@-69qUc5R7?D#m()\&OHJJ.1lQ1#n[4=9SEHH9T0M_?j[#:TE$DDSA^cp +!+R/P!/3,5^JBak0ea0Si!9(!0EqRY:nWLRnG32^&&8Sb!.[D4&.ja'&HVrC +7fWMr7L/uJ'ES82\B7.RKp"&;r$)@FTH^LA)REC]2gJ[JmT"EE92NJH,fq!!*?j!!3^^!!FDE -!=1pj!YBk^"<[[F#XA@k&:a``+92EJ5QCisJ,f]p!!*?j!!3^^!!FDE!=1pj!YBk^"<[[F#XA@k -&:a``+92EJ5QCisJ,f]p!!*?j!!3^^!!FDE!=1pj!YBk^"<[[F#XA@k&:a``+92EJ5QCisJ,f]p -!!*?j!!3^^!!FDE!=1pj!YBk^"=b&:[VadE'rt4A!YBk^"<[\q'F6,_T<3.Ab*j%B_$:62!!3^^ -!!HmF:r;*qAYVl.Csne9Ao,=S&:a``+92EJGUB(O^HD<:!^$]%gE?Ot#XA@ko*EQ2rhTmFVqs*@ -0FoG$6N@0!J,f_b&5ZhCX0PT6hI7[::G70*-NkOl!=1pj!`K@QTs%JLW)@b`QRX0\VXS+R"<[[F -#XBMY!_VNhn@%a7i)7N!!*?j!!3f>.-%L2fr3>@0bNo*#u.`5!YBk^"<[\q(^VU1Y>r,( -V&gI.PRI,ohJ9Bn#n/_WBJ,f]p!.fq3-rI0J$(:_Ah"Cm` -&5erP"Tf6c!!FFKK7MDB>*U_'s)nR=5OVW]-=@'uhEV&B&:a``"t$"]I".D6PJ5W4B_>ll;O]#:NX!=3d5 -!!1FMAoX!am2f<^NHBJKjoN -e.Tm<4\f12!!E?:5QCok8okOt![N98! -(0)LXJS5<3!29c'L3Ou:jF89)D>3i^mI)c[fF3=i#p94'%R.$#+`P(t+o)@/R;O5^MX/^`%aVd# -5QH%g*-Mif5WeYFA]0>>%DdRn$##hK+p5T[=2mk^Oil!0"@.Dja5`HgZm3>Hb1kGT47ngi;r:j? -j95:'Z-#fkBBoL1;th10r")*npk]`O7R4bP^W[Oo0^TrJ4CU4B8H*d\aNfL1GL>_IlVEDkDJ[LO -!!4:8=Q=*g![Rf3!&N>V6LleC^U)da#^AeKJl`3d70!?B'RBOt7A*3N>j^u0C;UlM,PdZ1h+;N# -&-4'e?AB_T!#USUrOO.+QMdB@`b5c$KKt7P?eT'8^h*XS=g$Zt!dt_I!;'!Ur`g$Xq7@!cTZ5PR -rhZ0/@A&I-=-Y:\Kg;75&-..,VCu!R8H,d/25mbhP(.37DsNC>J6/'fG_JCi":tQ]Oes4%"A&Np -_DS9s/WtTt\*\rF"P>RY/.h$)!!8fPe9'c*J9JlG-X1G#bW1/+5o[nj!6N!_I'qf^+9G.T]_4Vk -!RM'_qJ\fp8H'hO9_*B@[:'IQR/BS^9Ea!AJ/*FW!eF)Q+94IA9B2TLOSh71CKOe&8H.WZg$FoZ -!;=b!<-TLT!!=c3;B#0uJE6/RC;\]ZEUkcRZAScY"P?.p/.h#u!!8f,X>K4!5`tt)kO0j5"52C, -nh7\_gB1.Qf^48A&-u#2!>$5"%=03PQMcg6A2gsj:S?n3?TMj2$Y8poCh31-3EPSKNK?.KE)&r#Y#a& -6pNi]?"L41o4Qe7;r@ka23R$-H>YqlCa-ZDq0UmEDNOh+ajnf(eZ41+d:K=D?koR>(^(D#5h6(XP/$01lX-Y7g?F,F=U,W'CCrf3eA=Xc -#XBLY!f83&1*i\%\9kc<+r!.eYe -,b"YSGeHL`9Eb8g\Umlg9HnueQpcXN&:d$O";4N0A_cXTJ-A>+M1aDO":tQsW3?a5&4ht7&n6-e -TB?U]WlE%H_"4R,VI"]S&-2OF*028)-%Y'ss'e"WnQ*CO0tTakIB:PFCm,))"@+#J`_-SJ9qY&V -p,'i1Nr1K[QM_Ql>_()m%grLe&O6=iU;Aqs5TgpG,l_CAM'IQX+92HFV)\fH+Y8J=>h,TU3]K0Z"28H*nS*O"c@5QK"LVj:lHYKg -$'>'@%6SO;-@c)0NK=>e!.ggLOSjkX:VS=i5QISk7=9VNL'1'H)$V+JK+^EL"NEpCs24tr4+e,1!"=URNZeCR\cbS'Fbrs;!n.Gu!2d*]'*piG+p'%iLk:1, -8J",e,SD([m)%J,gF@42!r\!Yl$'r%!An)?adf5QK::7Weu%TK`K's8H-L;gni\ -!;XSRO!3G5!6O+eQnZrC!&-.8HdL67$d#J+J^E#PIL-T#G#_9M)W"/n7"=HJ*%uukY+Y]5_!amW).R3t8 ->nS:UG=e.0+Y]Ge!an&.5(N\:3[R,_mhdb'6XU*!"MbF*HisHUF@UlBh]5p)L-QIT#_4ChVum&+ -"=6>(%uQRj+OGoE!h^,`2M(o3RM$b=2^QLf&-to/!>(PEX[)pg1C0*?B>EIN#kUdj!RNWA\q<8N -"A&O&7NT_&g7"j)&KB+!!7[*!!*@I7Y'RW)-Rr5 -5\gE,JCY!?!!3_!7"F>_M$iPk&.a>_i\:U0+96sI!]T?A2(Ds0\Q3:$b(ir$/5#nsaO!jbEnSK\ -9tif0p$1)Z]*Js;69kZoq/R*a#fKEpkTh:r#\H" -O+1PHiDK`fHpO*Fc$p9AQ@L:Z:T8_0jVjEMPWWj4CF[NDWAmel&!DDG85tG0!!4:g\6r<_"Df"6 -P5Wr)We>k39c&#Q=eG!8'=^A7/99h/4_T0*L&_:J)m6OTJQme88&Db08ef#A9/6XmjM*\mO)Q@+ -!XO>C6B8r('=^g)ImE*&-2`kH@;Eo,dsQ9>2XSfoJ(8hhXf6)@//K>#n'%Z>Q)P=R!!48[8fGj> -J=Y0(<97uNJ_=!e9=b6ck8u[l7In2]boWVR&(>adfYCe>g_9eqJ14l.%=pMBCl86BQ&jY"G$7+t -;nq_?]q.,jWtG7,mDgSc\CZu2@>8)jHQm;)LG)$'k*B4u!=;$(*e -?Y.[cA>29Iek-!To&%+N,M"[p:aH('[XI;Dm;3'CFF]3uS!JKB^B"W`!!:$5WFQ=f`I$W8qqk-! -;]M8pJE/qO8rIgJP(20M9D#(q!B6>qGn!CH!>(PEXeePGI<+R-*Jo.t4kK2%!WeI6"\=DH7X;rPP;HO]MhV@*rXH\5W3g\i'LRr]VbP73q1"=N=IYf1m'0`c,H9PQ+./5[]NNaaX^gLpoMms3f+)oqiE(r6f1K -V8b"eTEZsI\g6cJ=`'"FUJ'o-\k<)Ms1i`'9`CmM-g=>S!cBMinlh"Q!h^GZCAB)nUJ*;;26!XOsm9c44 -SGLCBQ:jPNm6@Mh'd(1gCY#G'GJFPBdoUK)^iVJ^ifeokY4rYC9E#]`?$qAO3ihYhT<%nmL8?m# -[qfeH?gV4P9"R1CA/4Z=7<6TPDn&"&7F3V0Qe\r4k6>kgV9eirTdYb -.W$<7[bi+0XmX3>eOKW#(@a6[[G1R0n_64I/.e1:JE/qO8rIg(-NDM`=6khls&$=Yf?".,!0ast -edm_.6J+(Eg/FAi*aZhKKLm*>Ql%3a,VZ"A@\UrFu":tP`RBX[AJTGD&-3&Jf@ksAD9Ru1G -(q>4Z?[?N4?kjlY`3JkJ!O.^nCZ6^Lp\UPZEiQk/\_R(o2?'gJB-C@R#7cS'Wo]2G;+A[bU:-![d.Q[T*VjcaImE'eUisR]$s3>Xp$24U -h(B1J=[moZJ7V"@2eiEf<515SpofY18rO^XJ0k4aNK_US)j3hn7IlN(CB$>.m6Gk]51h^nVq0NT -ostEZe0CKDIijk)BBTa$R<2]NP7@k[qu];lbjcDKOCQf#pXsHO -ZS/1%s'+JA(CLHn5k5Eo5OmfAd^ldAPTo&0Eb0-lg]j-M`-qE-SeD((8cDA7[<9T@r*olPqtrC* -,7FT!Ilf'cqtrTan5g@E>u^>&q0Z#h%8s6^!(\]9rr"i_M4^F4>T(Rfd@%\eF^d+GJLB)9/YQW4YTC]JOcS,,@(u0WoOo,s1'o]31* -1APj3B6g9WO!XfN+uQV5Zc["^CnL2u'e09X.OjYj-#g#Ms(C%DidH1@O:RWfp=-MK^&&GpI]!&G -"4^M[rOXAnS==Es+bj"/'/uDc$kT2"#1P -cEr'GHMME2!6?hUIr%F2K3DKD*3Ia,= -`3b#HOifN]%A9st,m(:!QdWU<=Y/;&m\=fgSGe$Haa\K`3TiVr:[Lq8p=1# -Y.VMQ%:@afj"[sB*Uh:ZB73Vu&X.'og;5lM^k!qt^YN&03WHm2;f<-HcqT1;mA=#FX^7fus0'&> -[\9DKnZL9:2VnDb%@bFU1Rn*Idm?b*#E$16T^BYC:s!S.T4e$+(djep#QV,G6=7`<M>B0Wao't`i,l_VqB%k!SQ?kb:uZh:J]ETDO_pH#NeYL%h(;Tk#Q-]HSF(EKfiS!D$\^cc\=V:Zi=,/i&74icaI"3 -hHMk?;V?JA9g0RB@-@G0V_N2ifK.lt+J<^f#Ar8]f7G08hEc[-!:F5lqjkH[G0^,ig+`9^D`df* -'2JN[P(3L)ATnlTC'Nr5raW`2pWOs/!Bp55:q6rY=JljO=!*8H)7lc$qkicrb[g -]%j*Edob\$IuiWK)1[UK/buI48EIAs2p%cI,s(o&8Lf`M`r!mpH_fq6VW&8rkFkaaYRslk_!i=mTo'7I<`cc,JWY -rBpWZNf#+eP5f&N8R2%gSaI0Ph?fBOA1[r\+eWggqd?<"qnYu[b6W%o?jqi3q5Z4:5K76eg\4@G -IqmXtGQ0/4LWSb<<"Qk5U6gnV)M^6c=l2u2+YPqP**aMLPir:1L=bT/`'2\8_a?TJKqfa`P -)$#(&3V%)H<]=diIquAbLYYQW5?J]6GZZK[4\#Pnq<&T;T0=Ve"(95XTc'gLm5%._>5ajTHZ.QI -@W&sOpIl7NqnGcMVd',p=+u(JKjoNZk_d%l_1(s"9al#!$qSP,O3aHrr5Hlf(s1'P5g"0F[o4f'.=!]*Ggi8 -EukUII8Au>!6IIh.(hTSCHXMOq!Xtq3;W)p2-k%u$#uGO,5F#3>SBXp!0I,2Nklg<20[OLZItE@ -^-P?;(^)/si5gBL'NVaiONK#&j$]M\raCQ>pGDhu?'qMcBgk*o)okJ@di6!]9V<5 -s$R+*q\]B^+jX2*\Cs1&!<#AnVJ-%R99?R"ZS9E'_4TYMTVcB9"F[fSg%`naTH -<'3_N@0bmYKPdlYet1Db06E@/!UX[hSH$3#E_?>dlBh:%G:'.YOZND`D/VZ7b6!5i#SbCQ$iW2\9;=ieY]H_F(4@(h-\Lg08Fd95\M%Zsmg%g@mBf:q!%\]FKKt[t -7r%t+:-+3;;*4>Ue@skl36f@@:]t%J!0I+GKmd\thN%U0O=('bR`en>3g[hI,uZ5KKshC+[GT/JrrNm&Vs$7;c];1d6@iKFe-9%$U"74"jQr`nrZppdKl???66?V$dU?T!/gl>>&T5W=@3Y4ItG -g&EVn'%fk7j2]/Th@e"%B]'&m935"0QP!:/Rh!r -IolgHa['.tYVD-&O2mbVD#aPY!(fRE<3,ipemT@O%06`"TIGGeZp3BrFQ5QoMdclU47rEnBtO5- -C&^AlIn*l'\`7P^mke)5,n'I*gIeQ"!!FDU5CpX(![RS30hC(*!7A+5^M=P50EM:eJ:M,2K*hUA -Il&CjRfJ6K*/6]Y!YFin?n_UHnrIP,+98,C#KB"/!YFRe^`_5/'ZkhMpQ"Oq7=(=gi0X;qP5ojk -*.R`#!YBk^"=as"C'NTufgbP9&>1)ECss-"5O>)9em1g+m]8l!f"*"CJ,f]p!.e.`$330Y=1LlW -2o%Tq!`qm%aa?JT=B,Qn[@2"P2';l"#l#UjRfHjM5MC\IC&3=gBIRC-"<[[FB*Y>U=P[uo+e-5jaMqm$!YBlIc3/_,!'BaQfdNfSlK;YfrQ'VZ)H1jHSX]cN&1hXN!!HO<#V#g* -q9/)db'Fd<*sB6H!oOOg+6*YX+TMNj"G-p[P/!3:Y;F_O7=]SfBf^#P!!*?jTIGF7:K:?ahd$H= -ec+l7=F:]g#/FK&b%!X]r&@Ye/XRc]a!i8En;422lZ?WPrG?["<[[F#g=P* ->Q@lEg0*=7QQoKgWNa<8TT_+WOipriC6rNU!!*@98"d2Z5GnV=N$U-T!"A(8h,)'e#XA@kOV?qP -!1;Z"JB4L8]6OY^(Lb0O#XA@k@0q$*!6iqZ"E7(#fXQWOm=$2tlaX(#FPK()6N@0!aG)tC!l.?I -9gI4gl)mlf\(%pi9E4*<#XA@k&84\/(BIp`EB9b,LcXG]rgicpY(Q1tCPnE#!!*Ad9qXEG@$iqp -&ER;HA<^+h0M:BgF'!A,PI_<0L\D;1h]@\QAC(J8(@#% -hIF/-D&.X*!^R)7!eOgU&SD6@'`c5c&^]iWg0`<\;3-KD1i*BS43Q4F0*E1,-q(jA%<+A$0h""m -6m2=H4sHZ/iO#5'noPf.qm)PkJDQ#N*Z\sEo-JZC;F(HH&b<$:N*ZKdF:\JdNDVV9THNf^hT4&@ -2?XQlfn;D57pQB#M\75,Qa,gM!.7I>\0\AGToiD(Lk*.tSZB5;"FpX]&^^>-F`ek#`krmZ%5!Wo%$iBY:MTF_.t`'?]j6R!BL -X1`kS.;M"[]h3u#&.0)pDe`qZ^bALUdu)/\:?q(j._GE',JD;EE0SAhVE&d(I[o[%k#fUo*1$]D -ka;S/c2a)8Bjff!p\"\US'#ld[N][?mGo>AWeI$'eeknk?(TYh[rdr[JRX-#6Fi]:9Yf?8-]Beh -GOdAu(B>3oI4;Yh`MVfVWN``SE+a%eR!)14ZM!>EQ!4:p6(_5Vg>CP:JXd4k/*oiRRtLdGa<1P9 -NmBp!g0,#H.K3[U2^ST.+OE+L6pTpkl(A7_aTqlVKa7rB@NM9n^]+qJ[Jh("!H;=oh9f0H":>_p -&qc]L#:sgT+IuB%PQ7ql+9I-'cF^%jO0\gnQ/0Xc";q7t;MBYp2g3nhUk/lN!fT0;&P,Xs(u7L] -]LZtEM2J_p@h/0CmLF$Yd_"ghr5T`^FA/>=!RFS$3ULa$-=B3]BPG1j!_E_!A#:n*G6bJo4F?<# -rm5g_oY7fnI]IdCD>ucJA'P47rQP_g+K(V-mLF2"k`Z_]()MBJ\*/OX!t7Ztj`e+h]@-b6S"''H -\&E]#+OCJsm;Fs)cjOPK#t5tN!FV!#!Nh*6a4gVHju:HKGH1SBQ1o)'JXQ_]7)0%CDX+dDSIQK^ -Fs'l@P8=37fKo^[9gJYSr\T&.GH8L3n67='[KD!In^6Dk9 -ctmYBd;6-;[^n_)fX*1;"F;@jlu26ZJ=L3Q\0dm#;:`IfC]o9^d[,!4?C2$Q(tFtfd4E(.eZ6_h -;t9i7=`\aK(1Bd0">p*OHnl@s;p_*2R[!lWfG)Juh[ZSK;!eL2SmK*VF>Y_872r#.$A5W,;!`+f -$-4=Erg_2-!*G'LV;.d]mLCofeWtifrA6R\TWW@'l1E5 -cpRjA"9p#GLk(UKB-q#J#ghgV!a,m2K7O;14s[$)Iun7Cp71uYNt4na>iik&XA"b,p,??E?R$:R -5`,Sck#:sT^uA@M!:C>a4a?_Ka%r:4-14PDkASP\Q`/OgTe$`lKKp[^\3"(0qK+bn!!,pCd$KpY -"H8D#amYk#=b&S0rlE,``VF;ToYi:Ep0f[VVF[B4h`P8[jYRXdErmO)bQra(JETY:7K5+V0ZIYV -gHXAq)b8CGuZ?R,,SEC#+j"g>sHHcMm*rFj\g[etN -3F7]cmPG1`q\s,KdKla40+\*s6DcEt(9Q^Z!>F+!Ps#iFnAudJ=fWCs->Qtdnm4O]@qgf'1`"7B -"$_mAIoC_ud"0,Kb%IgDM*MDmAf\HGLhVsL,[rr[c -nOI;0Cl6E3poVY[Irh^2$8ZZ(%8UR9Aq8LKjMJ^SI.l1WoohW2[8o#r5o(Q=nhFL;@r5r`MZ&O* -%`i?2J-uGa*68D93Ul^fEM\mZ?r.QdQM_u:;FF`asEY8B\g6[b] -$D\>J&-*FHKa=%Ol1%sCr`Xj#1IOK"K%H\&+9I:X5X,,k!%Pu,&MOf]bl[5dnIp[.&HNAoQDho] -J4'JYR9KrI)?D9T!7(t]K@qLAf'[$CAgp,u>n_0_1/?ea9*0eQ=>/^Fmk80Yo[!mYO6b\TSH582r#V0n^qFXTHW6&kJe/;Ds)>#G#/E$ -6lGB(MQo;qaDT1IQ-)hK)B,5Vp=tUb2(%[5;3h1bMZ!u?!A5QCi3&h5)5 -#Jd8$?*[DjMY$Z7c[J=Pmris"Rs>-/&b*#M(&>K\!CT11:=Q:5J85.bELL*).Wor8>#8A*P3_Zj -3W:#cUct1r!6+bbo'HT1G&#r1WVRLbY:J,Z8E8]&J_SGX3K6D^c2e/R=LF>"Z$11ihJ51Sdr7m:m2rh=jS!( -Gqda+NQ_A*Ng'b3)Du4n0!g&cVEHg2,42&Ko42eR>8?J[[G<,YO)2+ML>,rXT=I$+@,QtA9l<0t -`n^ZH`Xjp+JO#OG..Q,ppRBA+1OX\SG"hUkTVNCCHA`bjP0.bop'c/2f`]I0".0C^c)L93`W!mF -%`i?2JEI&7*[.j?+ol6HiR;BA*idJJ]c_86M0?ZnWk:X`N`*,b%hjIEdg9tS?ojcHT4n..V[`%c -@nn4U5mJ:&7_mYi#6@R#lp)0NN<\N7[C/8(Mf)aFRW_Fdm?CX#p.nMlhP@HdgSjdT32Zi[F4T!M -duU"/#g>0fk*Q0?3P*-*G(Fg/]+8gLIhkTEHpYO"%*48T>Pma>>u,W)i2Ru8\MHE=K/N@=p?=gW -'3D^qFuj"u0$]4F'*/Z5..*!-fL>hQ6!r!Hj""&XY9!.M.VHn"]+3hc.blU03TqdkhPKbY2$&p: -e6Z@8JA9Zi3R,3V9gJ*.Er-%HJ;3"7X>5@A<6`1W>W\X:g)9otQ.+gBdoB_V@cqK/Q4gFlZ%**^ -$Dl!s)KT95p*5im7"C7?o9lEZ!NlI%!NTs8%7I?"=:*.l&9QmRebQ;o\?Hh_S$"S6AFE[h+M]i8 -GH_AD:?.=L!eQM-[h33PdZ&*[St2YtdZ\/sW_[seJ@;J:eE;91cW0e&at5(oX&a4$+Rgf+=L2cE -3#rQtCJ)hp!)e\dgqN+uo/9,B=RsX]d>n$L.Mo$G[;sSa4>gd9gS-FPHF;q0etlZa7;.9Z=.NGcZf$TBjAYJA@A0`sb3?;=rtf -!AaBp?RBu8XT[%R.[sE(2Qf2C%TReLaqn#t>KYCqg!:Ff$G=AYGrjm^U"XV8%X/0%#nf#oEr\)n -Ql1EHeEiUm2B0FeK7Lti:AWUlCZ$%p,A'nLnKVWI!_8NDJA=F@2oc>Wo)Lg0s,G_M*TG`N?;-\V -Z=aMH,5a\Z*QHV91BE'e_+[+%T['#o!&tL^A+LcfgJ=%>YUOK+#YZIN(C&Sh$$/.8)PNVc,m*GM -^dXNY:'W=`%#o"r9"m=f+ScR=mGK)-3YMOD'"*uA2`(P'5i;nj!WiIHg)L10C#BUZgQK<7,J_4t -$O!==5Qjb*dr7GoTHUgu2F@Hi'MQQMCqhbk,%*(E5%&^2"AAqLBUj$&+:r"!UnMtiL5:^C`9F<#d>Z\g-_cYR0cu[cW<#V -Q,#ipJ-:IkW!b8E?`.W$^+N:_E%;=t:'ZI2\>,\5S/ra3WYhJcL=!/=uZccldKWN3A5F#P93OQOft -g61V!e.7mO34_[kKPLYSZ^\IYP%aZ]!&$,/B?H>]3:`[Yc;b.#a]qs6K>;P=VEHWs079.FPlhT% -hj@M2"GA",bQN/M*FR!=;>0uESG-a*`'o2j`A:#&r_-)UW?(o.H9G>:p8m`Kc#E__nC^3[>o77s -J-uH0!1R%Y*::VYnf^%K?5RpQI'@kQ3mX._5A(0CkNJi(q]9e>*%T_l4WkcSn0B+WAc`%N[&-M" -k[gP&gZa7?aTB`]+p)($>:fU- -U0!X@":tQS!:dUU -o5R%r!PhN&Oap^lrrMNJm4NrS9#O$eM'WR]o'QKi!lFH6dfFW9^iNL.$e/_CAmVAEf#nOEnl(/\ -!h]`KWk'B^A)$Da\54C-`@?(SANe%V9u(?Bm'4B_J3]ogR/jiQY\t-CHM+hIrdQ!1Q#)mT!+Zc. -C`Tp1^u))"6K%Ce;S_fo":tTtW3fYcJ-^CPbdHMM1Cu)p#p94_!i*>2!f+s>'*0J[r+EKF@!H>d -Lk*9/HP?KnbB-DV2[+@JS)t7^fn:867DNdWZl]F]5U,,8&:m)4!"fce..eV`cB657r-oL7oW4KK -!+Zg^S1P$!P63J)#WP1_B.$Zg$_Z6>R0_a=J:NRd&TG+G]I%$mf$os7a/f02#&ZB3jq%OGKcGjU -!^#Z>"I7;*"M@E>pL8QP0AH`XI:TiL+>@:Ol-OVZf_%?sWa2e$%hL8G$*lf=B**Q*kH-jH,/C?f -^.^VT+63hUF5Lg]^`FFWdQ"`hEu%'s(WW_:BDL3]%*Op6Z;)!HEKcAcThbn31IdO-&sV -7IasC=hRYn?9,pEgijD4$Q9-&+rFu9Qj?MeD/Kr5PARLHIM0^IRLoQ'!5ed<9*s6-YjH6Z<<>-L -KrOgCHuf&O&35UR#T2qq"H:i@h<+p2Ven!\h\a][RM#W(!5ed.kL7?T+9DTL["\j2Zb!Ri -ru2$/5][)0"9:di!n@Q=7b(h?ne$_/o2M;`D)5oQ5QDB-3/A;;_"m8Yj<'cdo&^J`bDG^Q"D/>" ->p$gHj[t@0/'h-s4*qW)9n5JX!ZmMT02]55-3>f*B$acS^Ero0>IL,Q!u!p""9qJ>faq7;:S4Fl -7k3+_"Iu3l>DM'VlViRX.lM5gi2qn.RYpd;2MXO@!piFhb(g/RlcZ[77rpTMirB2n!!+4j7.pb, -'nKGdHs=_O_^atPm[65'1]c67,$-5-Lk%b\hjCNDSs6nEtl1_HrhETM:-+T.PtI4a)@<"BAR9ZFul:D@c1>am$PL0&;gGh+;@E$J\Z('2@E@,"FO."i!TG_&X@,X#&^!F -l1Ro`#+u$nSu\4afN#1eg:CqdF;KZ3VZ=SQU_O0b+g=_,?`NZgQ(+"'^8UTL't\Wsh`;38>1Xhh -P0:^"!P(TZ5sLb<82.!PjGJJ9#PTmoG/GU-ltHFj.bC]uA+?Q82p5@0oO03ggfW@Wcr(!#'@;aa ->PCek!RNWA\q<6O!kYDV'8f[g^S-&8iRKREP)qCs&HNpSL5f=Ki"SGB@E3);"RbO!AeP3N\bm=I -Drs!`f4G(:P47GuJ0sp@VKW(IJDQF;+U%?Z+;$;j[lK:qVodg"6pNqGgpY&kU)$'kjZ[cI:"B$Fo#Y6D5pu785!l/$YYSR@t&]doSfY`C0*Dn5OJ)q> -<+//t,WM)Q\V'tP'J4-T5f*X8!=8uIf:jO@!/NB](^5IQ#p9V6N@-@%!R#O!!K/15Qja] -_eKG[-@c(%%$]ls!.jhH&-;/9dK0R6&O6??,K/aVJA<911)9of$j)qoZQju#a=cO5$irQq1)0i` -gB!*15Ju!QV$I(1Tu1gTj?WbXO@Pi2Z@;o]JGttc,6T,cP5lf"-8;GeTE5,s5Qs\XJH,h--\)I> -4pG,N('+P'>4KNM#UE+E&Wh*ZENWpU#_8LtdiAQ6d#LAg,/>6=b_:W8L(7E@,Cfbr#)%IL!.jnO -A1.MNY,EHEiZFVl/49KJ$5^]K!!4GI6pO=q*&TF*=M[7C5F>nCV!RR>W>=&;kNX-=Ci#G66[l)](^bK[F@Jb-Q+99iL/Y56.!m:j?"<=IB -Mp#/!qX7YLfU8^"LL9ET+9:+OU]h#h^_),k:'Xnl?^.`YF;,Wem?mqUTP*2)#6>)=:EXWhE4uU= -8H-MfZe-ip!5op%m"59@3['T`#^E[`=n;Si-dZN`.09d*Ur%sE&:d"d!f;baoAmM0s*q)eJ@bOh -5QKjaHT[&`"@O@E&PshS)[InrWY3s`C.7F<,4Ka*r`$!OW8&\Mh:252/j#_ChZQUUkeT9o,;1r7 -o]-qDI%l"ufqIf#4=OIc^m2WU6BtO-:SK2i=Z\]7?=;f3q0@'rLUMR>ZrZqM3`a@V@+9;6b:4Im- --q(jASKe1?M1D3nSVR8mU7in5TD0RfV6LUt!5oWbm-0H/,+pa!aYb'K#dEC)-l]WB#9JYH-%H!Z -'fVZm9`PbZF9MO6+/oN*>6O?7TB,HR-q.o#![-4D?s$J5$5('2!F5_$W85N_^`.sXP5e;k6B!Ds -&jQF*#bS8T,G:Uk\(*Pa@(6cXkrB@gn9P,AjSq"pi%R!6!XO>?6\L"r&O6J@75hiR>Oo"QV: -Z?S2O!t7JOI<>"NZW$H,u&9OlFDX"G!+H@;/47&-3f&9sE7o,d*&b$]iYiPiUk^d-7>65'1\"U_/cia[f0N,N=JC&6KCTh4[ -E0bHGo)D-ffPi2n!XO=t!eNGM&jQR.bMQ7e*Jo;%q;:1g"h+7QJ,o'V2luG/!$\('\;<'`=9P-C -4Efe8CLWZM-W1!OJ4Kcp=i1k#7"@EJJC=P:L*HKN",VOaj=&,7qIld<+9E[fGiDF_!nspZX-uBY -"D!s9;_:GRl/H0os-K_U_65g)+9:D[$W]\_!"fc6+<6cr:^!:8f.?at])rj(0ei_8JA_MH45gJg -!l?`f[DeRYTM5@"8sKX1`D$=5&9iN+/eS4q,2hHO9Yu`Z#uhT>VojBKo"QbS2_Z`a!XO;bJrGUr -#S\IjUt-(X@?;hjarD"4MB"#>-Q@IuNZeE#`!T-^+Fj`R+:(_9Qm)T,QMHjEJ*k/`bY4B(![-I[ -i`\8D$5)cT[=1h/4j[pn":>`[:>sO\H9F^_IZoY=pu.\B!l0$XY^R\rg54RfZQ5ur#T+ro?HWeM -[f?C2X@YfG<4^U^3EER0WH,N*F3`Z9i%hMM!K]U/ENpGaKa;q#>3D?)D@e2EWlE2n8cHhb1Dr[o -!6Km,7tr.ZSU1+9+@O!V!ME3o5bKh4"@-I=C^>UH#tP2H9CM5(JVX:1"U#t+L&_:j9rKa&Acdd= -R%o:N&:hPA!XOJ<%A9s4"<]B8! -1kVqS!!*AL,_,l^M2)Tbd#:45!_1l^&^Uq0>:[`g;%KR(C&-*cGKT0jU -+9L>Q%`9HO495RMnfc#hTa>[4^sE[dIgA;I&ci-N,V#mJ5[XX+!T-k?p95[B#meb@jraYTAcrYF -c+("n"DST8"Ooo\"qZ;MLBJ.g*Q"Xe#V7?R#ZsiTruhAnTa2b@L*BF.fb,,8!Un,G!ffVJ!eV.O -!"9nM%*4Pr+Tb.(*>+Cn!5N4Q6pL_Q&4$j]+\r/qJ3;kPf+8f[DVZFq?&iJ3>91CBAZUi=,o4cm8\q5aQS,)Zhl&8-F<-eI_g> -Qr+S"&84f=!RR>W>='Gl!CT1lUbi>X#YZCl!13hBeIWRT!$Yf!o(3<@]EfV[nqoB_3[$1(!oE7] -AB]],"Ip&h!&t?'k2o%(&-4#$N!RKPm!&kgh?Y5(H:(Cs&?&A)&Q#);>+oI%hB)! -!!FDEJWpI/-ius=.1\CcK)c#s!.fA#6mMgbq3?jI?PaoA%H,/GN15QCisJ3Y.Y"qUe\s#c#O?:"Vn&:d%4"F:a_QZM40qe3c/ -#XA@k&BK`Z'(]EZ?(MP1jM,V6:iR6P&:a``+Q.f9LEb[T,_$=L!#m']!=1q5>65h$!0Vi?UC"sa -!!*?j^_MEN,/BBA6X2X4Yn2Ec"<[\qS-]lRi"E^]?/DIg8cC^\,(,.G"<[[FT*1ComD?Xc,/BBA -K7/'*eI[62"<[[F#cqb`!_E^L(+,&"=lJ=[e-PT' +8cIoL5MceBqsllH=aTUaX``OerdM$9\R+.km_/\9%]Ng,)(bmgoO#!%?6F`P;"7Zig@/:_7icR=*9dQ6E_a>!!"^)Jr5%*6GRG-\9%]Ng/MJMmgoO# +!#S&=`P6I8/HGhOAE)k;>_a-WT;>H5\13$5_1?_!/oTnc-jc:(+iG&HI>J +;#C?QM#[MiJDq)IC]j`G@d\]<[+4>8ZTiuf&-.4eV;`Rqr@%XF7R[:W-:75-0I6c#0EI%qJ>j+\ +J<<_,!L/*7!/r<@s&e?;5("?j%0n!2Uh=!!B"k""4`^!#Ug0s*.`. +LLu#973MX2"%gHr(AX[!""4W[!#P^T+$f&r!'k-1IfM>K!!!nak7=4$"99R.L#W,g9SWb$_%6Ts +$n2)TC-qt$2FR'?:a6#AYQ8tJYr'e!Aq'e\+TMM3H*Tj.a)^TsaRWsDj!+O(CNB0u,osb_bL$T> +5>oqMh4:/Q'SQMeX=0P9h>Ij5rn*4B5?6-I-!a$hWUBbmh-L2BK`D+S+SGQNo"OblA#WH*:R&4n +HK#H-g>hTs?i!)s,Qn+?-]1.bg8=XhY+%bn1V*gAW=T&[*Z4:*^6TK5c4@k;&U-PAVF:IbG-OmA ++1]QndC:7:^Cqb5\c\PW4TLG#!!"Q9nOHq:'`Uo:%#bbeXR6*s9EY?'#8D[[[79]TI")J(cgDhS +`^0Y*[R'FR?Q0^Z:Ac/nQ@P>W!/uX4!:7VZIl&bG9:nG7b#&!tQ3IO+!\bMo!3dR\s-VtFn]+NF +Mgm*@5dU[4=8Y!2-isC1;#J_m!6'FbZiWW$i:f#3`=Ee.;>ehr^r=&%K*!8#`#q?R&-MtiO$8'c +2,`u5`:UhN!ARjkaGp7NVC`M^j-oriYcEnEIjZ!=MH'`b!Q^9$J7_[VdFUe*^Cqb5=or1+5Th!I +!1H=G7pcoGs%[AO'HnSW'*>H^!2)@?IR'@b:U<9O.\ui`@N483!O8a\YV?1ZRZ`PXbk%b-A#[>& +J*1Mp"RO`'!3D(YJ7_XUd9!$\^[or30TZirN=Z*:"H#G?._PP#+p:;X^q]1V!*2Mg_!KJ3O1m(m +rghq<+lI\&"2HCR><2b.J%2;H)rT(F:CR*3kB\dM/):(o8LI/2rEal/UmN$=67^q@j?ina7MPl4 +L,h)@g_T>UC]'`J]XqMkXT<&-p"Z/Kk)1hl!)6ZGr\Y4dHW',=fY?Zh-<UQ'pig1J5jT[c#f)H+!!&Im +0\*Ah!IoMd#^B>+-_ig-!!#_aGQ+eJCnCYR/sQ"r9b)]!,6._2]geIh(IdjYailA?Hk9CJ!!"]g +'RsM;"98G.7I^V+7KBM./q"o#QOk)6h(C>7fWNc'oG5;#6=fi2(8Gh4p1ic@s./q#l#QOiO8+?i(7fWNC.>g>D%0?N[a\_ndkn!gp9S2779T&lN@!!*4@!VqU!2H:`"(`ST +!#Q0a+".?p!5L!2r]jTl!!!3nnH[3(!!"]$MEaoa!W[be;#Glb&HDe>K&R<*m5egN*mh"3-!`(d +_id23Bn&]mXl\#NpELuT/2d#\jqEn!AS.R-0[e]lN?[TR9d7G>42BJMgmD8I3]i\ +=RlD;MEbiC!!("T"olmp]d)@p?YX1SO+/(#\aNor/l19u;uBK=!WXp7BZ?)[rJTZ21V7,8\%UaX +cc>N-P]RO^rhpP4!#W^7(CP[AqVN@VXY>=/pg5emHNRC^!._^7Q1SZ[(Rene%ThdU9l,=\J!mio +e=m29ft!L]N?ni1^uh@es*RCf?tRg9O85Nr5I4>ec]`IH]AL`S:<<>KfDu!Q=ALdD^J!!:j%hK. +gj4b?NA1F^l^Id?lBd@>+!g*h./rIma1JrVg1+`%an.LD! +Ii;pVih'A7ino#j$3;m3Oq9;I!W]I<5>D=XUA04Nqkmia./oXFqn]8XJ)=ltYuoBEh*$>i2F%WM=q^/n +T.T;-X>5M62#CpOMLR2Jo8q1OmQ>Wc45aJX#I,0K!*Tr_pg03ms'N3R_s#G/8:ooW8T@o%>^[q)O&9)dd+Sm5]@'6Y7B^Uqt?,.YAIqB?.s3qi%3@hqnR`&cj1M(^[^i`n)C=jcT.RCh?#XmJ@&B`D'qCS4.7^jjuAhtn8SHo7%90eFZC*!BUV2O_fU\K>EoFo3>./oXZXS@"6k&hj*H/4+T+on9H0lf41 +5:cV>)2`oU1G/Ts+'8dLcgMok&HMkXMJ7P05@tW0DjGX"-jIXTZ^DX0c?0pi^o?.BX^N+j8p$qu +4e(HG(Y/Vs[Vh]:-.i,DXCG\1J'A)pqYJ%0"R!gr^R9MDKTe^,./oW3r7a[@^slgTh^JKjk_E^trg?X]5le]b +hNs+LD"%PnK]8UA`?0X2J>rHH.fLN[l3'oeMLT4PIrlM1Lag8/5L2$iAuFOf_VK,Ul*+/o1DAS, +s3K$PH7#!@q8WKFQDXLa+R*$gD'.UB!9.0 +qY?/%49*OQSc>;$Rf0egmstIhZ2BTW1X,47A%c=H:Wr6`Oq>uUZ(gHUmUir>ZFLTEdC +r0q!NY:fqW`q!"`HiI2d<[rbpcN-YE5 +UuHl1A'P"XaA6n"1!b=YMug^j?>*s@5A(YbrO2-CR\UHmr-(T%IqJ+tLd[k"<^R5pL2`9NZ\CGY +C#",$8]RX1]9IJf"es=-ZW-j4AdME7YS%#Q0Fer^Ygk_fbl4c6ZX&d,n"9IPIr!:r["^dEbYkeI +o,DN>B5RYWkQ8iHh%+K!Q`!8Y>4o0:VYn"%J!]dKM;mD+c2O-Ym#Olg!g#tfIq`]/c/UQ"Z:<7A +4mStpGJCDYa/6%Bd1V+KX>3>7NZcS1j,jAt)3ZZ8s&!cc>8I)[$Zb@W\qIRZG5NKa"J.8;a\;X'*bIUo$ZZ07'OaI++$b:XZR`p;bZ2rYQ;S!5"-iIl.&km8>`ee(tVc.1NS/%`KMg90\?\C[>[g[L?eY +T8CnrYQK+L0mAZZDTD58PZE38dPL$)na?BDP%(Fu9+.en5RdG*'PIO"7MPmP+3^;U[7/RE40SU% +Q(H3A:/!5Ss4GsOG*m(L)uC>"!3j-b$l&a/c!oV']AH!(;n'M0?lV$#@nLhD/>1[G=)Tk#5Mu-: +Klctn8iiFVr\10jkPshe\tE0[^EBl`m#=+,jo0)l5F4$?h0cN(S!JQ4Qn.V&;$'o$V"gRE!Iq`Y +he@eWC:X4mP%+1*6`Rg*<0'+jPbRshJ2H1;#2hVeUigLheFU\D)&jR*P@[K6F_$&Ur>dqf#Wpoia!B(h@P?;V8Xs63M\Dc"epTck,"Pc2\( +5k/2a[MA3-Torlo5@?=I +prBri8!!A@dplm[9$OpNJE">+bG70$J@&>SUBLW7%E0EsR)=>2$F#SFTe%2Su=bq,.aa37L%!2A0(h9VhjBD6&lO#Xe-%K@2W +=_dYCWZPiLaoIP"r+!:^hji5@@sVLHoTAB6UH`t;VmNkn0/*\.r%V:'N<+"mRn?m`D^bV\IDj>n +QiF:BM?!Vb+r1-ffm)EtDbqe3p2#8-6^_>r'+'_gps!7Q[i1C:D_c/k-UA,LS\FX@?s![m#bUsdpSMG0YR.g9t)%HgT,Mi11[]uf\ +D!]WLU0@UqZ[WD!@@Gg;C2)DZkQl\Q`BSeVT%mG?5AU.+95su_[J_Im +V3tUQaZH[Rf)A1MDWC0"=RPG@jY;`0s%c2^"%d]XpUr`rAFg*`qg>iI%EJ`9p.B#lT@DW>m+3RI +K,(onHR/RA'j^qA@l`,ac5l5q2GljMJ@j\iNP;7BIi=rJk&"2_mPgGRa44N'!*D)R+@(g6&ZQ-; +WV@Q3`2'q7#[;#H5K>6"X'ChU*S5k-K7!<<*<1W^Ja<;^6[^LJ5[]M%lKWN#r;LCug>!3".A +/H@.pr/9NGp4Zu$AdN\=:XYf"49Y`3e#39imeko>Ce;\A4?j8CU>auRS"GtCBse"m\JZt!d-P,@ +Rem$p/Gd*WT*1s#EdG +X2Yrk3)b%9JOC:S!9B;#!2O6,=Q/_9>UP?De^=W:$ig:K-sH\EpfFM^6%IRfp(IX\!bL$m^tfMn +U]%apY7E2b!77Bu>6$)NeKY%o5_Cs%!#5H9TF1`")ROYfT_Qh;/H>dtTX=k%AqQ]V!,0a5^\l@C +1.`ib3k)rOD,+i6?<9cm"TVM1m/R\'!OK"[-!*se=9S]'_F=PK&-Ak59)tUg!!"e.2uj(J5h-,? +!77Ai!?_pTW`;[lTF1`"1&F_YN(M>j+%-PXJ*BG8uql6I8o,SDC +g6Ol%">fqDU^&\EYR6$\$k+DYScSmI)!mSRh#Z')V$eDn\scD0!"(Ye!!n7..M)R[TL"27JA@P& +in_!:1]3i*IIBB$!1Off!!L:E'^^38TAAA,h#"8TJ9?ha!!:sW`O]3WB6J-N!<@XD7LK3ImXQM; +[E,].L7/"*UmPQl!8,Ys!?f`0:`agF\@f0%d>)rD(B?^=UBc<7G?cC23kFLE\o>!3"Q2!?_pT-] +f[+b!I!mmb!o,q^&NiJ0h6J%0;/P4X==+"Gi];E[re1Pf=??^9S0fNC'n +i>*(,6;.u5pXhq(6qPGcr:qPClals&c)d4rp6Z._[L\bY\RhDmGIdSsl1[n&JMM,Grm]0ceFFE[cdapS3#&28rU!e?\E##!6Ba'J//k=!!42Q^N7i+p=PJ` +/A.$E!"YK&R\\95oEnt..0Mc/Z/7LF:;HB=Hu(4H/-A.FG/2+8j6h-D +pa@@CZ`>@b@-"dcj3mCca"TRT248:]#]p;fj@"u!QIBK!,==U!"]D:)l[g<@!p;( +OS!9Z?eOZ.JJBbiJ@DWTd[IFWE2@.g!!6X3eolOe5B-!k:WUc>(\$`<49[PkKn+q6-30lX+ohbc +"K^uVCVOn9Y@MVq9OV@'5YE[0X;G'-Acb5j-"&=>S^uMuNg]jRUslA+EQeJ9!@V5P!?f`%Yd2nh +k5d*JWZ5r=FA=ioK9jjsJATn"pS,$aT)kX +!@t^i]2q!;+FUFXPX1mPG3D1NG +FTO6W!^OWhJ6q[*mapk!bX.`N-R:i]d_?KBMJ,9OIIl[B\cZ%^TJ-M!"geF!l;o80nug:gS=.@' +^f(S):!=S/!LOc+?lu`Ym-5F3[p>V+^,%(+;>t9=c=dO"PR%9D?sqnjYpduH9:o&^1V6i=$e[05 +;d1(Upu\R%AONU5:k1R]aUQ8GpJ7R(ml&gfeEIT;5Fm[Fe_L*mOtMo>B[mnsQ=J/j[UdAb)Z>)* +Jsk"!2\B3nQCp&"@O@,Q\D!5"mc?q3`!qb;83f8>sK +#GnQ!=pY4s<9asLAV41o!H\Q?KE0@$+^eM/)kd&4!$+B+8jN`u=9nmi&H]BUXT/TEq_&[."J?H^ +!/uI/Y_!Pj=>B;lmNQMMBJpeY"N6[X94r*%'Z#@J!jF"T!qpZ1]-"<0,;YG43Jd@^T-`a&1Us6c`4?hiFn_7UM@=/)^^pbO)dm(32%GGS +jKtl2XI.\Mbq/PtGcIQ8c0F;CF^Jj`5F2qCM4)>mPWb"K#;ASc5QlTH&H]+TT/eiqS(Z!5/qSRn +bnX_I>mRshDGNYbKE1)O(k><8rLg[\REGq_C\e9-O"dp7XnhhQ\biKS4\"/j)YemC:UgfL`gs/u +IADhNWF$Qg)m'.U;?,2=G*8942'WcC_AN`cCo"#?VT+Ll*]Z^+dCmOd[[P!1qmMp8#d*Pe%m9GV4F[+#`(3WYW[!&0'fb]uJ3+u?jJb[-f_'T?(R +Y:]`8Y(c:obYiXMC`q5*#bX7%"1eI:i9obb4rCMFIktm)QVr5"migri,TYTe#hTpK!L_=UJ5stu +J0DT]ooh>Pbhaje[=CA6dZr'^q!+S8i*E#=Nb9HO$X/!.Z6K:st9XrT6J]8SMW; +5r1T&g=e+BREQH!;1sJO0KUDL'EW`aZ0hV3"K[F[J>)qQUu*6i9hJr.s4>Jd/*R(tT$7atgPVVa +kg*gJ?m]LZZ*[tJ9AONF$!7:>!!^4UJ8N7,6"b'309'rFBG$*`ap:E*htS84"D#N>!:5FU!0$%( +mf%!3]ig39m)l\ufc;A%;USbqIC$k5SH.IHRF*%*h%0Q?Q@n5cf1sk5bQ%VPI7Zgm<8F>E29j?/ +@qMo$Zhm>*Q_`(UYtV=a%`jXt!%^JR^]YDP4TAY+"mNI#LISu1uDK$b#QONiL=UCkDX'\aGcDb/0Y(% +.^t`91j>!-DdXrt:-`VA9Qr`KBjb?8*RI].!:'c(K)gENrF?695 +&7GRk#pCEI63%8k.)FKY!-c1P#q(@7Fit!<*KURNTPXf3Pi=W"9>HUTE^D0P/=mRS\V,K,;@(pm +R"4lA!)Si6U_(=&q,i@_OI;O8T*Hub)SQ#Wm/DqL?&g?3-e%Bj7O@$b#Uoj;+ +=qRl.8$m",SGed6RYh#[>IFTQ%"WE*1(:,9/bkPGDJ63'9M*\Zcg +mX@^+-\rtn*KXDkh#Yia[amfZ('+C]Mrr+D\bhpj5"SG.&b7MZ7m$qaBS%!.Z!+El$-9^p:dY-:0sK)b^OYA;28c\Z,B(>GdI[C9c5) +:kMk)E;pdJD.]mY:r;KA"N7HeHd(iOX1oYOM@^>kB7-dpS*F0GnW0<#X)#D!gh6^R9n":o"<:Xp +8RlkL"D!g%!b)8*2eG8G=ItlIr$hUQ#QUetbR4,4G<`gM'AjAe!3@M6^roh-+J0>LI^?n6!\T;: +7Ek,Qq*'d`+98'(d<0TC]13FBI>o&I#1`fW>mq]9QSAO:/?BL]92!("Ord#ts7Q]uW7`C@`I^Cj +>4Y0j:pJ&/XS0ZL^e?6C%Z'*d;uOFql-a4"6%GoiJ!"g\GJAj-QaT)](YafY&-E$0(bdWtK/>89 +`WUsid[qgG/J\;d8iis"ciS_X3*=THn`B2JSAPLR4'D\@9.^0!4.rtKJD[3upHnqrSAb!7&H[Dm +:)AV#\e&g_[Nd]UbW_VA&M,42]H@shD`7Tsl%K+f\VZljhWXD%S_8]O$QtK9!AA)/5X$V"PV>0A +7f,F+beB5.lK4'+J2rK!o5@C1"Far0(W\.XI(Iu3Zijp&Ad:FrdMjq^E`FcWF:=rC=$lu'>fG$4 +bRunYh&l+Rf:2)[@P,t?&Bb7k!]!>!!AQ9Ilk&Z\eEm5.9UF09!W_@8VLQ9)"bC$Pqo*"jKRh8n +#QZSR`W'_A0;SsX!4:bL'EXlomf0PWMoMn*!L\oa!_uP1s/VP@Tc!t5Zm;LV`eGV>FSG[>FQ$>Z +&eYE_ES<5+6/f%9lU4[q*>_9>*pqM3M' +BF0K+K4Eg69,mjMZAFlt=GAgVn,XIJpnatCT@U5?BE8+IlRpW:LuLA'qd\I\`dBJbM@^=<#Veb% +P71q&IP2H904d0j8-Ap#+41K:^MM2>pZ(&"VY;th8I3BfKn.f;@+BB$c:l4WMS*R)=oa*?`L6h2 +83u09((t?p+WrQsqaB."TPk,"MZ:G%4r)EG!:9!c8NL)(45KkWmXDcR?\(3\"D"r-#l+@?kC7d> +;ap>jNhjkR4UOVo54nFahLb!JjbOIeN]Z%t\O=h(ZP+bdj'j<"?l7L^FO0Ro/'D3Dl'a7]p+EOR +F9cn<#(EZECI+^$!5LRg'qf=KpnYN/.-Vb85%nP0of*,p!0eit^]EjuZSeaN(B?/'6R4fddeb;< +e_U8Fh1%);*LOb8Za&.U.i8qMC=*(_9Ip)a]Q=bM["98FsBf#tZE@1m^49PWaUETg@ +AKUsQ(`ab"QlZ8.^a'0d^pF@I!%(&=!2`*`!&1BA6bnNe%)gX$!!"@t?jJ_AXVf+n5tm"5!2'UN +!+9%7!!'t\"9@I*!!"DS+TN>a!<>B)#Q_a1#QOj^e8P]'D3<]ebROXR5d;4:!O6hK+TR->!!"Dc ++TN>`!<>CT#Q[2>"98F%+9V[i&HDf1K+J%D6N@*_Pt",+llEmW5\*:`!)T3j6bifPh>r90A4$=s +:aJF.YSdKBJ8,YtJFsKS!*"ph!3CqU!2+Xk!+9pP!!'@PE!SFF(>hB9NW9&e2B!#*Z$-0k!%T8o +!14Kf!725W!5Rq4!eB)=!!(4U+TPW)!!$E8#Q_`d#QOj:XjI[kHNu5Y&5*T8!6ec%+lIocmf5ZS +G!l<1d"E)7c=l3H^FMXdE=H2,<^ZofcjV]l6./>a>k#o_S_D/m@LWG?!)71'4!9F\8S7[MVS9TC +#lt#kF(QHp?7'@s`?2]8!!$]\9LHVaVrI`q-GQN^#lt#kZXssSc:l4WT:>e6@O2-W!)8qS#j@0G +j\:4\Z'+FSoPF0mGEVshb ++X$4@#Q\&-Oq80T)TGak0.jjS?jQl7RR%3E?\O8c./pKmc]rp^#M9Le!)4U>TW^[L_!1+/TAkok +&HL/t`WVs<_Eu%r;t9m.ht%)=+TS0,B(f"/$q)1kKRal8ir>9-k7$uK!'mjr!U+=Y&C;0lYP(+d +TFV)(RRRQJ?PA-D(T'9D(AU7>"9:9>&:hJa%KS5UpgZht!'j]r!O(Ga_(m6hJDX)?s6IkR"kWqY +!(^!\5V*[=#f'=?LOdiOnc-VWP5mL/!!!cG!moOa+eU@bhs>\2^q'dO^ci#)kUU][3&TOf?e+oL +JP?[UJ8HhG%&>rb94\G2c_pPJC]j`G#A3[jBsAdI!1)=m"?\=Ps)0K;'-K(4!3cSL!.Cse!hPm= +s1e8U+!;@$!3cht!;]kR"E_W_gO5+nj?rtJH<:FRYO1k%1ot@!2pV5!8*C$ +rBjaCOP'X7W^-Ub1*?]"W!rb-aFk*)TI'dA+,A5P_oG@%#cnA!(oWZ!(L@.T1k.H0dZlc&I8BP8-f4r8jWLX7RRL^:^R7( +0X?BDn@Fb>)??p+!!"@-69qUc5R7?D#m()\&OHJJ.1lQ1#n[4=9SEHH9T0M_?j[#:TE$DDSA^cp +!+R/P!/3,5^JBak0ea0Si!9(!0EqRY:nWLRnG32^&&8Sb!.[D4&.ja'&HVrC +7fWMr7L/uJ'ES82\B7.RKp"&;r$)@FTH pictures_tftN/*.bmp --dither--> pictures_tftN/all_numbered/N.bmp +gui.HMI + progress_bars.txt --bar_pictures.py--> pictures_tftN/all_numbered/181.bmp ... +gui.HMI --Editor, once--> gui.tft; gui.tft + all_numbered --make_tfts.sh--> output_tft1..4/gui.tft +``` + +## After changing an HMI + +1. Save the HMI as `REGION/gui.HMI`. Add new pictures after the existing ones, so no picture ID + changes. +2. If you added an image progress bar (`sta=1`), list it with its colour in + `REGION/progress_bars.txt` (see below), so its pictures are generated instead of drawn by hand. A bar already listed there + needs nothing: moving or resizing it in the HMI is enough. +3. Render the pictures: `sudo ./make_pictures.sh` (or `sudo ./make_pictures.sh us`). See below. +4. Compile the HMI once in the Nextion Editor, wherever the Editor puts it. It doesn't matter + which theme's pictures the HMI holds, but the display orientation in the Editor's device + settings must be the region's: 270 for `eu`, 180 for `us`. +5. Build every theme from it: `./make_tfts.sh REGION path/to/gui.tft`. This writes + `REGION/output_tft1..4/gui.tft`, and building `eu` also writes `us_horizontal_mirrored`. + See below. +6. Check it: `./check_build.py` (see "Tests and checks"). + +The Editor is needed only in step 4. `REGION/tftautomation.ahk` is the older way to do steps 4 +and 5: it drives the Editor to delete every picture, import `all_numbered/` and compile, once per +theme. + +## make_pictures.sh + +Renders every theme's pictures in Docker, with no display. The image is `docker/Dockerfile`: +Ubuntu 24.04, for GIMP 2.10, which the Script-Fu in `gimp_scripts/` needs, and ImageMagick 6.9.12, +whose BMP headers match the committed pictures byte for byte. Output and a log go to +`last_pictures_run.log`. + +For each region it: + +1. runs `REGION/create_pictures_REGION.sh`: GIMP saves each theme's pictures, ImageMagick dithers + them, and they are numbered into `pictures_tftN/all_numbered/`; +2. checks that every picture the `.scm` scripts save was written by this run; +3. makes the progress bar pictures listed in `REGION/progress_bars.txt` (below); +4. runs `check_build.py --pictures`: each `all_numbered/` must run from 0 to N with no gaps, since + the Editor numbers pictures by import order and a gap would shift every later ID. + +`--xvfb` runs GIMP under a virtual X server instead of `gimp-console`, if that is ever needed. + +## progress_bars.txt + +An image progress bar (`sta=1`) needs two pictures, empty and full, each exactly the bar's size +and matching the page background in every theme. Drawn by hand, that is 8 pictures per bar per +region, all redrawn whenever the bar moves, changes size or the background changes, and easy to +get subtly wrong. Instead, list the bar here and its pictures are generated from the HMI on every +`make_pictures.sh` run. There is nothing to draw or maintain; `check_build.py` fails if the +committed pictures fall out of step with the HMI. + +For example, two bars on a `mediaplayer` page: + +``` +# PAGE OBJECT=#RRGGBB... +mediaplayer p_pos=#DEAA31 p_volume=#DEAA31 +``` + +Each bar is listed with the colour of its full part, which is required: there is no default, so +every bar's colour is chosen and visible here. Everything else comes from the HMI. For each bar, +`bar_pictures.py` reads its `x`, `y`, `w`, `h`, `bpic` and `ppic` from `gui.HMI`, and writes for +every theme: + +- `bpic`, the empty bar: the page's background picture (the page's `pic`) cropped to the bar, + from that theme's dithered `all_numbered/`. It blends into the page in every theme. +- `ppic`, the full bar: a solid fill in the bar's colour. It is the same in every theme, because + the Editor compresses flat pictures and `make_tfts.sh` can only swap pictures stored raw. + +The pictures always match the bar's size, which the Editor requires. To move or resize a bar, +change it in the HMI and run `make_pictures.sh` again. `bpic` and `ppic` must come after GIMP's +last picture; `bar_pictures.py` refuses to overwrite GIMP's pictures. A page not yet in `gui.HMI` +is skipped with a note. + +## make_tfts.sh + +Builds each theme's TFT from one TFT the Editor compiled (the template), without the Editor: + +``` +./make_tfts.sh REGION path/to/gui.tft # after changing REGION/gui.HMI: the Editor's compile of it +./make_tfts.sh [REGION] # only pictures changed: rebuild from the committed TFTs +``` + +Runs on +the host, no Docker or sudo needed, but with [nextion-tools](https://github.com/jamesmulcahy/nextion-tools), +numpy and Pillow (`python3 -m pip install -r requirements.txt`). The themes differ only in pictures, so +`build_tfts.py` puts each theme's pictures from `all_numbered/` into the template's picture slots +and recomputes the TFT's checksums. Each picture keeps its slot size, so nothing else in the file moves. + +It refuses, and asks for a new template, when: + +- the template has a different number of pictures from `all_numbered/`; +- a picture's size differs from its slot; +- a picture differs between themes, but the Editor compressed it in the template. The + compression format is unknown, so only pictures stored raw can change. + +It also refuses a template compiled for the wrong display orientation, and a compile whose +pictures differ from `gui.HMI`'s, which means it was compiled from another HMI or region. + +Without a path, the committed `output_tft1/gui.tft` is the template. That is enough when only the +pictures changed: the committed TFTs share the Editor's layout, and only the pictures are swapped. + +The theme whose pictures the HMI holds comes out byte-identical to the Editor's compile. The +other themes can differ from the Editor's own compile of them only where the Editor happened to +compress a picture, which this stores raw; both work on a panel. + +## hmi_tool.py + +Reads and edits Nextion `.HMI` files, for checking a layout or nudging it without the Editor: + +``` +./hmi_tool.py pages FILE # with each page's ID +./hmi_tool.py show FILE PAGE [--attrs type,x,y,w,h] +./hmi_tool.py events FILE PAGE [OBJECT] # event code (touch, timer, page load) +./hmi_tool.py fonts FILE [--out DIR] # with --out: each .zi, a PNG per glyph, metrics +./hmi_tool.py dump FILE # everything above as JSON +./hmi_tool.py set IN OUT PAGE.OBJECT.ATTR=VALUE... +``` + +IDs are what the display uses on the wire. A page's ID (`page N`, and the page byte of a touch +event) and a font's index (a component's `font` attribute) are both positions in `main.HMI`'s +resource list, not the numbers in the block names (`1.pa`, `3.zi`). A component's ID is its `id` +attribute, which is also its position on the page, and the page itself is component 0. + +`set` changes numeric attributes only (position, size, picture IDs, flags). It keeps `endx` and +`endy` in step with `x`/`y`/`w`/`h`, writes a new file, and checks it. The Editor has opened such +edits, including to files still holding stale blocks from earlier saves, but once rejected one for +a reason not yet known. If it reports "Version Mismatch", Save As in the Editor and edit that copy. +Text, code, names and pictures still need the Editor. + +## Tests and checks + +``` +python3 -m unittest discover -s tests -t . # the build, against the committed files +./check_build.py # the committed HMIs, pictures and TFTs agree +./check_build.py --rendered # after make_pictures.sh: the rendering matches git +``` + +`check_build.py` fails, for each region, if: + +- an `all_numbered/` has gaps, or the themes have different numbers of pictures; +- a progress bar's pictures are not what its bar in `gui.HMI` makes now; +- no theme's TFT holds exactly the HMI's pictures, which means the TFTs were not compiled from + this HMI, or a TFT has a different picture count or sizes from the HMI; +- a TFT has the wrong display orientation; +- a TFT is not what `make_tfts.sh` builds, including `us_horizontal_mirrored`. + +The HMI stores each picture exactly as the TFT does, so the third check covers every picture, +compressed or not. It cannot see changes to pages or code that leave the pictures alone. + +## Code + +The scripts here are thin command lines over two packages. The Nextion file formats are +[nextion-tools](https://github.com/jamesmulcahy/nextion-tools) (`nextion_tools`, pinned in +`requirements.txt`), which has its own tests and format notes: + +| Module | What it holds | +| --- | --- | +| `nextion_tools.crc` | the CRC behind TFT checksums and HMI page stamps (CRC-32/MPEG-2 over widened bytes) | +| `nextion_tools.hmi` | reading `.HMI` projects (pages, components, event code, page and font IDs), and editing numeric attributes | +| `nextion_tools.fonts` | decoding `.zi` fonts to per-glyph coverage | +| `nextion_tools.tft` | a `.tft`'s picture table, picture swaps, display orientation, and checksums | +| `nextion_tools.images` | reading and writing pictures, and RGB565 (numpy and Pillow) | + +What is particular to this project's build is `tft_build/`: + +| Module | What it holds | +| --- | --- | +| `region` | where a region's HMI, pictures, TFTs and `progress_bars.txt` live | +| `bars` | progress bar pictures | +| `themes` | building every theme's TFT from the template; each region's orientation, and the layouts made by turning another region's TFTs | + +The tests here check this project's files: the ids, fonts and code the firmware relies on, and +that the committed TFTs are what the build makes. + +`.github/workflows/tft-build.yml` runs the tests and `check_build.py` on every change under +`docker/HMI_files/`. A second job then renders everything with `make_pictures.sh` and runs +`check_build.py --rendered`. + +## us_horizontal_mirrored + +US panels mounted in landscape, the manager's "US Horizontal (Mirrored)". (For "US Horizontal", the +other landscape mounting, it serves the `eu` TFTs as they are.) This is the EU layout turned the +other way: the same TFT with display orientation 90 instead of 270. The +orientation is one byte in the TFT's first header, so `make_tfts.sh eu` writes these from the EU +TFTs, changing only that byte and the checksums. There is no HMI to compile; `ROTATED` in +`tft_build/themes.py` lists such layouts. + +Upstream compiled these in the Editor, and those TFTs differ from the EU ones in exactly that byte +and its checksums; `tests/test_tft.py` checks that. diff --git a/docker/HMI_files/tft_automation/bar_pictures.py b/docker/HMI_files/tft_automation/bar_pictures.py new file mode 100755 index 000000000..b99afa3d9 --- /dev/null +++ b/docker/HMI_files/tft_automation/bar_pictures.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +"""Make the pictures for the image progress bars a region lists in progress_bars.txt. + + bar_pictures.py REGION --numbered-after N + bar_pictures.py REGION --out DIR + +With --numbered-after, writes each theme's pictures into REGION/pictures_tftN/all_numbered/ +beside GIMP's, which end at picture N; with --out, into DIR/tftN/ instead. See tft_build/bars.py. +A page not yet in the HMI is skipped with a note. +""" +import argparse +import sys + +from nextion_tools import hmi +from tft_build import bars, region + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__.split('\n')[0]) + parser.add_argument('region', help='eu or us, or a directory holding gui.HMI and pictures_tft1..4') + where = parser.add_mutually_exclusive_group(required=True) + where.add_argument('--out', help='write DIR/tftN/.bmp') + where.add_argument('--numbered-after', type=int, metavar='N', + help="write into each theme's pictures_tftN/all_numbered/, whose GIMP pictures end at N") + args = parser.parse_args(argv) + region_dir = region.path(args.region) + project = hmi.Project.load(region.hmi(region_dir)) + try: + for page, listed in region.progress_bars(region_dir): + if project.find_page(page) is None: + print(f'gui.HMI has no page {page} yet; skipping its progress bars') + continue + bars.make(project, region_dir, page, listed, args.out, args.numbered_after) + print(f'progress bars on {page}: {" ".join(obj for obj, _ in listed)}') + except (KeyError, ValueError, OSError) as e: + sys.exit(str(e).strip('"\'')) + + +if __name__ == '__main__': + main() diff --git a/docker/HMI_files/tft_automation/build_tfts.py b/docker/HMI_files/tft_automation/build_tfts.py new file mode 100755 index 000000000..61ad99ba5 --- /dev/null +++ b/docker/HMI_files/tft_automation/build_tfts.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 +"""Build each theme's TFT from one TFT the Editor compiled, without the Editor. + + build_tfts.py REGION [--template TFT] [--themes 1,2,3,4] + +Writes REGION/output_tftN/gui.tft for each theme: the template with the theme's pictures from +REGION/pictures_tftN/all_numbered swapped in (see tft_build/themes.py). + +After changing the HMI, pass the TFT the Editor compiled from REGION/gui.HMI as --template; it is +refused unless it holds exactly the HMI's pictures. Without --template, the committed +REGION/output_tft1/gui.tft is the template, which is enough when only the pictures changed. + +Layouts made from this region's TFTs at another orientation (see ROTATED in tft_build/themes.py) +are written too: building eu also writes us_horizontal_mirrored. +""" +import argparse +import os +import sys + +from nextion_tools import hmi, tft +from tft_build import region, themes + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__.split('\n')[0]) + parser.add_argument('region', help='eu or us, or a directory holding pictures_tft1..4 and output_tft1..4') + parser.add_argument('--template', help='TFT the Editor compiled from REGION/gui.HMI ' + '(default: the committed REGION/output_tft1/gui.tft)') + parser.add_argument('--themes', default=','.join(map(str, region.THEMES))) + args = parser.parse_args(argv) + region_dir = region.path(args.region) + template_path = args.template or region.tft(region_dir, region.THEMES[0]) + with open(template_path, 'rb') as f: + template = f.read() + if not tft.checksums_ok(template): + sys.exit(f'{template_path}: checksums do not match; is it a TFT the Editor compiled for this panel?') + name = region.name(region_dir) + expected = themes.ORIENTATIONS.get(name) + if expected is not None and tft.orientation(template) != expected: + sys.exit(f'{template_path} is compiled for orientation {tft.orientation(template)}, but {name} panels need ' + f'{expected}: set it in the Editor\'s device settings and compile again') + if args.template: + records = hmi.Project.load(region.hmi(region_dir)).pictures() + if tft.records(template) != records: + sys.exit(f'{template_path} was not compiled from {region.hmi(region_dir)}: its pictures differ from the ' + 'HMI\'s; compile the HMI in the Editor again') + try: + built = themes.build(template, region_dir, [int(t) for t in args.themes.split(',')]) + except ValueError as e: + sys.exit(str(e)) + for theme, data in built.items(): + write(region.tft(region_dir, theme), data) + for layout, degrees in themes.rotated(name): + write(region.tft(region.path(layout), theme), tft.with_orientation(data, degrees)) + + +def write(path, data): + if os.path.exists(path): + with open(path, 'rb') as f: + if f.read() == data: + print(f'{path}: unchanged') + return + os.makedirs(os.path.dirname(path), exist_ok=True) + with open(path, 'wb') as f: + f.write(data) + print(f'{path}: written') + + +if __name__ == '__main__': + main() diff --git a/docker/HMI_files/tft_automation/check_build.py b/docker/HMI_files/tft_automation/check_build.py new file mode 100755 index 000000000..0e3fb6804 --- /dev/null +++ b/docker/HMI_files/tft_automation/check_build.py @@ -0,0 +1,143 @@ +#!/usr/bin/env python3 +"""Check that the committed HMIs, pictures and TFTs agree, without GIMP or the Editor. + + check_build.py [REGION...] check what is committed (eu and us by default) + check_build.py --pictures [REGION...] check only the pictures (after make_pictures.sh renders, + before the TFTs are rebuilt) + check_build.py --rendered [REGION...] also check that freshly rendered pictures (from + make_pictures.sh) match the committed ones + +For each region: +- every theme's all_numbered/ runs 0..N with no gaps, the same N in every theme; +- the progress bar pictures are what progress_bars.txt and gui.HMI make now; +- one theme's TFT holds exactly the HMI's pictures, so the TFTs were compiled from this HMI, and + every theme's TFT has the HMI's picture count and sizes; +- every TFT has the region's display orientation; +- make_tfts.sh rebuilds every theme's TFT byte for byte, including the layouts it makes from the + region's TFTs at another orientation (us_horizontal_mirrored from eu). + +--rendered compares pixels, not files: the BMP headers vary with the ImageMagick version. +""" +import argparse +import os +import subprocess +import sys + +import numpy as np + +from nextion_tools import hmi, images, tft +from tft_build import bars, region, themes + + +def check_pictures(region_dir, project): + problems = region.numbering_problems(region_dir) + for page, objects in region.progress_bars(region_dir): + if project.find_page(page) is None: + continue + for theme, made in bars.pictures(project, region_dir, page, objects).items(): + committed = region.numbered(region_dir, theme) + for pic, pixels in made.items(): + if pic not in committed or not np.array_equal(images.read(committed[pic]), pixels): + problems.append(f'pictures_tft{theme}/all_numbered/{pic}.bmp is not what {page}\'s bars ' + 'make now; run make_pictures.sh') + return problems + + +def check_tfts(name, region_dir, project): + """Problems, and the themes whose TFT holds exactly the HMI's pictures.""" + problems = [] + records = project.pictures() + tfts = {} + for theme in region.THEMES: + with open(region.tft(region_dir, theme), 'rb') as f: + tfts[theme] = f.read() + held = [] + for theme, data in tfts.items(): + if not tft.checksums_ok(data): + problems.append(f'output_tft{theme}/gui.tft: checksums do not match') + expected = themes.ORIENTATIONS.get(name) + if expected is not None and tft.orientation(data) != expected: + problems.append(f'output_tft{theme}/gui.tft is compiled for orientation {tft.orientation(data)}, ' + f'but {name} panels need {expected}') + theirs = tft.records(data) + if len(theirs) != len(records): + problems.append(f'output_tft{theme}/gui.tft has {len(theirs)} pictures but gui.HMI has {len(records)}') + elif theirs == records: + held.append(theme) + if not held: + problems.append('no theme\'s TFT holds the pictures in gui.HMI, so the TFTs were not compiled from it; ' + f'compile it in the Editor and run make_tfts.sh {name} path/to/gui.tft') + + try: + built = themes.build(tfts[region.THEMES[0]], region_dir) + except ValueError as e: + problems.append(f'make_tfts.sh would fail: {e}') + else: + for theme, data in built.items(): + if data != tfts[theme]: + problems.append(f'output_tft{theme}/gui.tft is not what make_tfts.sh builds; run make_tfts.sh') + for layout, degrees in themes.rotated(name): + for theme, data in tfts.items(): + path = region.tft(region.path(layout), theme) + with open(path, 'rb') as f: + if f.read() != tft.with_orientation(data, degrees): + problems.append(f'{os.path.relpath(path, region.ROOT)} is not output_tft{theme}/gui.tft at ' + f'orientation {degrees}; run make_tfts.sh') + return problems, held + + +def check_rendered(region_dir): + """Compare the rendered all_numbered/ pictures with the committed ones, by pixels.""" + problems = [] + repo = subprocess.run(['git', 'rev-parse', '--show-toplevel'], cwd=region_dir, capture_output=True, + text=True, check=True).stdout.strip() + for theme in region.THEMES: + for pic, path in sorted(region.numbered(region_dir, theme).items()): + name = os.path.relpath(path, region_dir) + committed = subprocess.run(['git', 'show', f'HEAD:{os.path.relpath(path, repo)}'], cwd=repo, + capture_output=True) + if committed.returncode != 0: + problems.append(f'{name} is rendered but not committed') + continue + if path.endswith('.bmp'): + same = np.array_equal(images.read(path), images.read(committed.stdout)) + else: + with open(path, 'rb') as f: + same = f.read() == committed.stdout + if not same: + problems.append(f'{name} renders differently from the committed picture') + return problems + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__.split('\n')[0]) + mode = parser.add_mutually_exclusive_group() + mode.add_argument('--pictures', action='store_true', help='check only the pictures') + mode.add_argument('--rendered', action='store_true', + help='also compare freshly rendered pictures with the committed ones') + parser.add_argument('regions', nargs='*', default=['eu', 'us']) + args = parser.parse_args(argv) + failed = False + for name in args.regions: + region_dir = region.path(name) + project = hmi.Project.load(region.hmi(region_dir)) + problems = check_pictures(region_dir, project) + held = [] + if not args.pictures: + tft_problems, held = check_tfts(region.name(region_dir), region_dir, project) + problems += tft_problems + if args.rendered: + problems += check_rendered(region_dir) + for problem in problems: + print(f'{name}: {problem}') + if problems: + failed = True + elif held: + print(f'{name}: OK (gui.HMI holds theme {", ".join(map(str, held))}\'s pictures)') + else: + print(f'{name}: OK') + sys.exit(1 if failed else 0) + + +if __name__ == '__main__': + main() diff --git a/docker/HMI_files/tft_automation/docker/Dockerfile b/docker/HMI_files/tft_automation/docker/Dockerfile new file mode 100644 index 000000000..165fb3106 --- /dev/null +++ b/docker/HMI_files/tft_automation/docker/Dockerfile @@ -0,0 +1,20 @@ +# Environment for rendering the panel pictures (create_pictures_{eu,us}.sh) without a display. +# Pinned to Ubuntu 24.04 for two versions: +# - GIMP 2.10: the Script-Fu in gimp_scripts/ uses 2.10 procedures (gimp-image-get-active-layer, +# the five-argument gimp-file-save) that GIMP 3 removed. +# - ImageMagick 6.9.12, which made the committed pictures. Their BMP headers carry colour space +# endpoints that differ between versions: 6.9.11 (Debian bookworm) copies GIMP's zero endpoints +# and writes 1.0 into three of them, so every picture would differ from git in three bytes. +FROM ubuntu:24.04 + +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends gimp imagemagick xvfb xauth \ + python3 python3-numpy python3-pil python3-pip git ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +# bar_pictures.py and check_build.py read the HMI with nextion-tools: make_pictures.sh passes the +# version pinned in requirements.txt. numpy and Pillow come from Ubuntu above. +ARG NEXTION_TOOLS +RUN test -n "$NEXTION_TOOLS" && python3 -m pip install --no-cache-dir --break-system-packages --no-deps "$NEXTION_TOOLS" + +COPY gimp /usr/local/bin/gimp diff --git a/docker/HMI_files/tft_automation/docker/gimp b/docker/HMI_files/tft_automation/docker/gimp new file mode 100755 index 000000000..a49807369 --- /dev/null +++ b/docker/HMI_files/tft_automation/docker/gimp @@ -0,0 +1,8 @@ +#!/bin/bash +# Stands in for `gimp` inside the picture container, so create_pictures_{eu,us}.sh run unchanged. +# gimp-console is GIMP built without GTK and needs no display. With NSPM_GIMP_XVFB=1 it runs +# under a virtual X server instead, as a fallback. +if [ "${NSPM_GIMP_XVFB:-0}" = 1 ]; then + exec xvfb-run -a gimp-console-2.10 "$@" +fi +exec gimp-console-2.10 "$@" diff --git a/docker/HMI_files/tft_automation/docker/run_in_container.sh b/docker/HMI_files/tft_automation/docker/run_in_container.sh new file mode 100755 index 000000000..47c76d6a0 --- /dev/null +++ b/docker/HMI_files/tft_automation/docker/run_in_container.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# Runs inside the picture container (see ../make_pictures.sh). tft_automation/ is mounted +# read-write at /work, so the rendered pictures land in the checkout like a local run. +set -euo pipefail + +regions=("$@") +[ ${#regions[@]} -gt 0 ] || regions=(eu us) + +export PYTHONDONTWRITEBYTECODE=1 + +# GIMP only finds functions registered with script-fu-register in its scripts folder. +export HOME=/tmp/home +# The profile is new every run; GIMP saves its built-in data here on quit and complains if +# the folders are missing. +for dir in brushes dynamics gradients palettes patterns tool-presets; do + mkdir -p "$HOME/.config/GIMP/2.10/$dir" +done +# Without a tag cache GIMP reports "Failed to parse tag cache" on start. +printf '\n\n\n' >"$HOME/.config/GIMP/2.10/tags.xml" +ln -sfn /work/gimp_scripts "$HOME/.config/GIMP/2.10/scripts" + +echo "--> $(gimp-console-2.10 --version), xvfb=${NSPM_GIMP_XVFB:-0}" + +status=0 +for region in "${regions[@]}"; do + cd "/work/$region" + # create_pictures_*.sh dithers into dithered_numbered/, which git can't keep while empty. + for t in 1 2 3 4; do mkdir -p "pictures_tft$t/dithered_numbered" "pictures_tft$t/all_numbered"; done + + marker=$(mktemp) + echo "--> Rendering $region" + bash "./create_pictures_$region.sh" + + # The script runs GIMP in the background and ignores its exit status, so check that every + # picture the Script-Fu saves was written by this run. + for t in 1 2 3 4; do + expected=$(grep -o "pictures_tft$t/[^\"]*\.bmp" "/work/gimp_scripts/nspanel-$region-tft$t.scm" | sort -u | wc -l) + written=$(find "pictures_tft$t" -maxdepth 1 -name '*.bmp' -newer "$marker" | wc -l) + numbered=$(find "pictures_tft$t/all_numbered" -maxdepth 1 -name '*.bmp' -newer "$marker" | wc -l) + echo " $region tft$t: GIMP wrote $written of $expected, $numbered dithered into all_numbered" + [ "$written" -eq "$expected" ] && [ "$numbered" -eq "$expected" ] || status=1 + done + gimp_last=$(find pictures_tft1/all_numbered -maxdepth 1 -name '*.bmp' -newer "$marker" -printf '%f\n' | + sed 's/\..*//' | sort -n | tail -1) + rm -f "$marker" + + # Progress bar pictures are cut from the backgrounds GIMP just rendered, so they come after. + python3 /work/bar_pictures.py "$region" --numbered-after "$gimp_last" | sed 's/^/ /' || status=1 + # The AHK script imports all_numbered/ in order, so a gap would shift every later picture ID. + python3 /work/check_build.py --pictures "$region" | sed 's/^/ /' || status=1 +done + +if [ "$status" -ne 0 ]; then + echo "--> FAILED: see the output above" +else + echo "--> Done. Compare with the committed pictures: git status docker/HMI_files/tft_automation" +fi +exit "$status" diff --git a/docker/HMI_files/tft_automation/eu/devicesettingreminder.txt b/docker/HMI_files/tft_automation/eu/devicesettingreminder.txt deleted file mode 100644 index d90deb653..000000000 --- a/docker/HMI_files/tft_automation/eu/devicesettingreminder.txt +++ /dev/null @@ -1,2 +0,0 @@ -Reminder that EU screen should have device setting orientation 270 -When created for us_horizontal_mirrored it should be changed to 90 \ No newline at end of file diff --git a/docker/HMI_files/tft_automation/eu/gui.HMI b/docker/HMI_files/tft_automation/eu/gui.HMI index ae04578dc..4c2f5698c 100644 Binary files a/docker/HMI_files/tft_automation/eu/gui.HMI and b/docker/HMI_files/tft_automation/eu/gui.HMI differ diff --git a/docker/HMI_files/tft_automation/eu/output_tft1/gui.tft b/docker/HMI_files/tft_automation/eu/output_tft1/gui.tft index b0a38bf02..f2a567c18 100644 Binary files a/docker/HMI_files/tft_automation/eu/output_tft1/gui.tft and b/docker/HMI_files/tft_automation/eu/output_tft1/gui.tft differ diff --git a/docker/HMI_files/tft_automation/eu/output_tft2/gui.tft b/docker/HMI_files/tft_automation/eu/output_tft2/gui.tft index 36dfd68b7..d7e284c05 100644 Binary files a/docker/HMI_files/tft_automation/eu/output_tft2/gui.tft and b/docker/HMI_files/tft_automation/eu/output_tft2/gui.tft differ diff --git a/docker/HMI_files/tft_automation/eu/output_tft3/gui.tft b/docker/HMI_files/tft_automation/eu/output_tft3/gui.tft index 0064f467d..8af57adcb 100644 Binary files a/docker/HMI_files/tft_automation/eu/output_tft3/gui.tft and b/docker/HMI_files/tft_automation/eu/output_tft3/gui.tft differ diff --git a/docker/HMI_files/tft_automation/eu/output_tft4/gui.tft b/docker/HMI_files/tft_automation/eu/output_tft4/gui.tft index f887b606c..f2a567c18 100644 Binary files a/docker/HMI_files/tft_automation/eu/output_tft4/gui.tft and b/docker/HMI_files/tft_automation/eu/output_tft4/gui.tft differ diff --git a/docker/HMI_files/tft_automation/eu/pictures_tft1/181_blinds_depress.bmp b/docker/HMI_files/tft_automation/eu/pictures_tft1/181_blinds_depress.bmp new file mode 100644 index 000000000..b84442335 Binary files /dev/null and b/docker/HMI_files/tft_automation/eu/pictures_tft1/181_blinds_depress.bmp differ diff --git a/docker/HMI_files/tft_automation/eu/pictures_tft1/182_blinds_press.bmp b/docker/HMI_files/tft_automation/eu/pictures_tft1/182_blinds_press.bmp new file mode 100644 index 000000000..3515fc3be Binary files /dev/null and b/docker/HMI_files/tft_automation/eu/pictures_tft1/182_blinds_press.bmp differ diff --git a/docker/HMI_files/tft_automation/eu/pictures_tft1/all_numbered/181.bmp b/docker/HMI_files/tft_automation/eu/pictures_tft1/all_numbered/181.bmp new file mode 100644 index 000000000..6a4959279 Binary files /dev/null and b/docker/HMI_files/tft_automation/eu/pictures_tft1/all_numbered/181.bmp differ diff --git a/docker/HMI_files/tft_automation/eu/pictures_tft1/all_numbered/182.bmp b/docker/HMI_files/tft_automation/eu/pictures_tft1/all_numbered/182.bmp new file mode 100644 index 000000000..896e0e953 Binary files /dev/null and b/docker/HMI_files/tft_automation/eu/pictures_tft1/all_numbered/182.bmp differ diff --git a/docker/HMI_files/tft_automation/eu/pictures_tft2/181_blinds_depress.bmp b/docker/HMI_files/tft_automation/eu/pictures_tft2/181_blinds_depress.bmp new file mode 100644 index 000000000..553ee1e17 Binary files /dev/null and b/docker/HMI_files/tft_automation/eu/pictures_tft2/181_blinds_depress.bmp differ diff --git a/docker/HMI_files/tft_automation/eu/pictures_tft2/182_blinds_press.bmp b/docker/HMI_files/tft_automation/eu/pictures_tft2/182_blinds_press.bmp new file mode 100644 index 000000000..2b3cea55a Binary files /dev/null and b/docker/HMI_files/tft_automation/eu/pictures_tft2/182_blinds_press.bmp differ diff --git a/docker/HMI_files/tft_automation/eu/pictures_tft2/all_numbered/181.bmp b/docker/HMI_files/tft_automation/eu/pictures_tft2/all_numbered/181.bmp new file mode 100644 index 000000000..f7230ee1f Binary files /dev/null and b/docker/HMI_files/tft_automation/eu/pictures_tft2/all_numbered/181.bmp differ diff --git a/docker/HMI_files/tft_automation/eu/pictures_tft2/all_numbered/182.bmp b/docker/HMI_files/tft_automation/eu/pictures_tft2/all_numbered/182.bmp new file mode 100644 index 000000000..0549c22ab Binary files /dev/null and b/docker/HMI_files/tft_automation/eu/pictures_tft2/all_numbered/182.bmp differ diff --git a/docker/HMI_files/tft_automation/eu/pictures_tft3/181_blinds_depress.bmp b/docker/HMI_files/tft_automation/eu/pictures_tft3/181_blinds_depress.bmp new file mode 100644 index 000000000..95cc5a698 Binary files /dev/null and b/docker/HMI_files/tft_automation/eu/pictures_tft3/181_blinds_depress.bmp differ diff --git a/docker/HMI_files/tft_automation/eu/pictures_tft3/182_blinds_press.bmp b/docker/HMI_files/tft_automation/eu/pictures_tft3/182_blinds_press.bmp new file mode 100644 index 000000000..9aba9a201 Binary files /dev/null and b/docker/HMI_files/tft_automation/eu/pictures_tft3/182_blinds_press.bmp differ diff --git a/docker/HMI_files/tft_automation/eu/pictures_tft3/all_numbered/181.bmp b/docker/HMI_files/tft_automation/eu/pictures_tft3/all_numbered/181.bmp new file mode 100644 index 000000000..fcd99d423 Binary files /dev/null and b/docker/HMI_files/tft_automation/eu/pictures_tft3/all_numbered/181.bmp differ diff --git a/docker/HMI_files/tft_automation/eu/pictures_tft3/all_numbered/182.bmp b/docker/HMI_files/tft_automation/eu/pictures_tft3/all_numbered/182.bmp new file mode 100644 index 000000000..2158000bb Binary files /dev/null and b/docker/HMI_files/tft_automation/eu/pictures_tft3/all_numbered/182.bmp differ diff --git a/docker/HMI_files/tft_automation/eu/pictures_tft4/181_blinds_depress.bmp b/docker/HMI_files/tft_automation/eu/pictures_tft4/181_blinds_depress.bmp new file mode 100644 index 000000000..3bed52331 Binary files /dev/null and b/docker/HMI_files/tft_automation/eu/pictures_tft4/181_blinds_depress.bmp differ diff --git a/docker/HMI_files/tft_automation/eu/pictures_tft4/182_blinds_press.bmp b/docker/HMI_files/tft_automation/eu/pictures_tft4/182_blinds_press.bmp new file mode 100644 index 000000000..228cb0dac Binary files /dev/null and b/docker/HMI_files/tft_automation/eu/pictures_tft4/182_blinds_press.bmp differ diff --git a/docker/HMI_files/tft_automation/eu/pictures_tft4/all_numbered/181.bmp b/docker/HMI_files/tft_automation/eu/pictures_tft4/all_numbered/181.bmp new file mode 100644 index 000000000..bde8c7db8 Binary files /dev/null and b/docker/HMI_files/tft_automation/eu/pictures_tft4/all_numbered/181.bmp differ diff --git a/docker/HMI_files/tft_automation/eu/pictures_tft4/all_numbered/182.bmp b/docker/HMI_files/tft_automation/eu/pictures_tft4/all_numbered/182.bmp new file mode 100644 index 000000000..43c8b7a18 Binary files /dev/null and b/docker/HMI_files/tft_automation/eu/pictures_tft4/all_numbered/182.bmp differ diff --git a/docker/HMI_files/tft_automation/eu/progress_bars.txt b/docker/HMI_files/tft_automation/eu/progress_bars.txt new file mode 100644 index 000000000..ee48d45d5 --- /dev/null +++ b/docker/HMI_files/tft_automation/eu/progress_bars.txt @@ -0,0 +1,5 @@ +# Image progress bars (sta=1) whose pictures make_pictures.sh generates from this region's +# gui.HMI: the empty part is cut from each theme's page background, the full part is the +# colour given here, the same in every theme. One page per line: PAGE OBJECT=#RRGGBB... +# For example: +# mediaplayer p_pos=#DEAA31 p_volume=#DEAA31 diff --git a/docker/HMI_files/tft_automation/eu/tft_EU.xcf b/docker/HMI_files/tft_automation/eu/tft_EU.xcf index 23aaa201f..243a1752a 100644 Binary files a/docker/HMI_files/tft_automation/eu/tft_EU.xcf and b/docker/HMI_files/tft_automation/eu/tft_EU.xcf differ diff --git a/docker/HMI_files/tft_automation/gimp_scripts/nspanel-eu-tft1.scm b/docker/HMI_files/tft_automation/gimp_scripts/nspanel-eu-tft1.scm index 947a56456..7a22eaa21 100644 --- a/docker/HMI_files/tft_automation/gimp_scripts/nspanel-eu-tft1.scm +++ b/docker/HMI_files/tft_automation/gimp_scripts/nspanel-eu-tft1.scm @@ -579,6 +579,44 @@ ;MAKE BACKGROUND PAGE INVISIBLE TO PREPARE FOR NEXT ROOM (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_THERMOSTAT")) 0) + +;;------------------------------------------------------------------------------------------------------------------------ +;; BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE + + ;MAKE BACKGROUND PAGE VISIBLE + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_BLINDS")) 1) + ;Prepare depress picture + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_back")) 1) + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_depress")) 1) + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_press")) 0) + + (let* + ((newImage (car (gimp-image-duplicate image)))) + (gimp-image-merge-visible-layers newImage 1) + (let* + ((activeLayer (car (gimp-image-get-active-layer newImage)))) + (gimp-file-save RUN-NONINTERACTIVE image activeLayer "pictures_tft1/181_blinds_depress.bmp" "pictures_tft1/181_blinds_depress.bmp") + ) + (gimp-image-delete newImage) + ) + + ;prepare press picture + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_press")) 1) + + (let* + ((newImage (car (gimp-image-duplicate image)))) + (gimp-image-merge-visible-layers newImage 1) + (let* + ((activeLayer (car (gimp-image-get-active-layer newImage)))) + (gimp-file-save RUN-NONINTERACTIVE image activeLayer "pictures_tft1/182_blinds_press.bmp" "pictures_tft1/182_blinds_press.bmp") + ) + (gimp-image-delete newImage) + ) + + + ;MAKE ENTITY_BLINDS INVISIBLE TO PREPARE FOR NEXT ROOM + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_BLINDS")) 0) + ;;--------------------------------------------------------------------------------------------------------- (gimp-image-delete image) ) diff --git a/docker/HMI_files/tft_automation/gimp_scripts/nspanel-eu-tft2.scm b/docker/HMI_files/tft_automation/gimp_scripts/nspanel-eu-tft2.scm index ac36724e3..e1a8dd24d 100644 --- a/docker/HMI_files/tft_automation/gimp_scripts/nspanel-eu-tft2.scm +++ b/docker/HMI_files/tft_automation/gimp_scripts/nspanel-eu-tft2.scm @@ -575,6 +575,43 @@ ;MAKE BACKGROUND PAGE INVISIBLE TO PREPARE FOR NEXT ROOM (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_THERMOSTAT")) 0) +;;------------------------------------------------------------------------------------------------------------------------ +;; BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE + + ;MAKE BACKGROUND PAGE VISIBLE + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_BLINDS")) 1) + ;Prepare depress picture + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_back")) 1) + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_depress")) 1) + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_press")) 0) + + (let* + ((newImage (car (gimp-image-duplicate image)))) + (gimp-image-merge-visible-layers newImage 1) + (let* + ((activeLayer (car (gimp-image-get-active-layer newImage)))) + (gimp-file-save RUN-NONINTERACTIVE image activeLayer "pictures_tft2/181_blinds_depress.bmp" "pictures_tft2/181_blinds_depress.bmp") + ) + (gimp-image-delete newImage) + ) + + ;prepare press picture + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_press")) 1) + + (let* + ((newImage (car (gimp-image-duplicate image)))) + (gimp-image-merge-visible-layers newImage 1) + (let* + ((activeLayer (car (gimp-image-get-active-layer newImage)))) + (gimp-file-save RUN-NONINTERACTIVE image activeLayer "pictures_tft2/182_blinds_press.bmp" "pictures_tft2/182_blinds_press.bmp") + ) + (gimp-image-delete newImage) + ) + + + ;MAKE ENTITY_BLINDS INVISIBLE TO PREPARE FOR NEXT ROOM + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_BLINDS")) 0) + ;;--------------------------------------------------------------------------------------------------------- (gimp-image-delete image) ) diff --git a/docker/HMI_files/tft_automation/gimp_scripts/nspanel-eu-tft3.scm b/docker/HMI_files/tft_automation/gimp_scripts/nspanel-eu-tft3.scm index a4d1a7e11..7e58710c5 100644 --- a/docker/HMI_files/tft_automation/gimp_scripts/nspanel-eu-tft3.scm +++ b/docker/HMI_files/tft_automation/gimp_scripts/nspanel-eu-tft3.scm @@ -575,6 +575,43 @@ ;MAKE BACKGROUND PAGE INVISIBLE TO PREPARE FOR NEXT ROOM (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_THERMOSTAT")) 0) +;;------------------------------------------------------------------------------------------------------------------------ +;; BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE + + ;MAKE BACKGROUND PAGE VISIBLE + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_BLINDS")) 1) + ;Prepare depress picture + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_back")) 1) + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_depress")) 1) + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_press")) 0) + + (let* + ((newImage (car (gimp-image-duplicate image)))) + (gimp-image-merge-visible-layers newImage 1) + (let* + ((activeLayer (car (gimp-image-get-active-layer newImage)))) + (gimp-file-save RUN-NONINTERACTIVE image activeLayer "pictures_tft3/181_blinds_depress.bmp" "pictures_tft3/181_blinds_depress.bmp") + ) + (gimp-image-delete newImage) + ) + + ;prepare press picture + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_press")) 1) + + (let* + ((newImage (car (gimp-image-duplicate image)))) + (gimp-image-merge-visible-layers newImage 1) + (let* + ((activeLayer (car (gimp-image-get-active-layer newImage)))) + (gimp-file-save RUN-NONINTERACTIVE image activeLayer "pictures_tft3/182_blinds_press.bmp" "pictures_tft3/182_blinds_press.bmp") + ) + (gimp-image-delete newImage) + ) + + + ;MAKE ENTITY_BLINDS INVISIBLE TO PREPARE FOR NEXT ROOM + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_BLINDS")) 0) + ;;--------------------------------------------------------------------------------------------------------- (gimp-image-delete image) ) diff --git a/docker/HMI_files/tft_automation/gimp_scripts/nspanel-eu-tft4.scm b/docker/HMI_files/tft_automation/gimp_scripts/nspanel-eu-tft4.scm index 1050be697..582310ffa 100644 --- a/docker/HMI_files/tft_automation/gimp_scripts/nspanel-eu-tft4.scm +++ b/docker/HMI_files/tft_automation/gimp_scripts/nspanel-eu-tft4.scm @@ -575,6 +575,43 @@ ;MAKE BACKGROUND PAGE INVISIBLE TO PREPARE FOR NEXT ROOM (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_THERMOSTAT")) 0) +;;------------------------------------------------------------------------------------------------------------------------ +;; BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE + + ;MAKE BACKGROUND PAGE VISIBLE + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_BLINDS")) 1) + ;Prepare depress picture + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_back")) 1) + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_depress")) 1) + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_press")) 0) + + (let* + ((newImage (car (gimp-image-duplicate image)))) + (gimp-image-merge-visible-layers newImage 1) + (let* + ((activeLayer (car (gimp-image-get-active-layer newImage)))) + (gimp-file-save RUN-NONINTERACTIVE image activeLayer "pictures_tft4/181_blinds_depress.bmp" "pictures_tft4/181_blinds_depress.bmp") + ) + (gimp-image-delete newImage) + ) + + ;prepare press picture + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_press")) 1) + + (let* + ((newImage (car (gimp-image-duplicate image)))) + (gimp-image-merge-visible-layers newImage 1) + (let* + ((activeLayer (car (gimp-image-get-active-layer newImage)))) + (gimp-file-save RUN-NONINTERACTIVE image activeLayer "pictures_tft4/182_blinds_press.bmp" "pictures_tft4/182_blinds_press.bmp") + ) + (gimp-image-delete newImage) + ) + + + ;MAKE ENTITY_BLINDS INVISIBLE TO PREPARE FOR NEXT ROOM + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_BLINDS")) 0) + ;;--------------------------------------------------------------------------------------------------------- (gimp-image-delete image) ) diff --git a/docker/HMI_files/tft_automation/gimp_scripts/nspanel-us-tft1.scm b/docker/HMI_files/tft_automation/gimp_scripts/nspanel-us-tft1.scm index 1d7568046..c01e4af51 100644 --- a/docker/HMI_files/tft_automation/gimp_scripts/nspanel-us-tft1.scm +++ b/docker/HMI_files/tft_automation/gimp_scripts/nspanel-us-tft1.scm @@ -576,6 +576,46 @@ ;MAKE BACKGROUND PAGE INVISIBLE TO PREPARE FOR NEXT ROOM (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_THERMOSTAT")) 0) ;;--------------------------------------------------------------------------------------------------------- + +;; BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE + + ;MAKE BACKGROUND PAGE VISIBLE + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_BLINDS")) 1) + ;Prepare depress picture + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_back")) 1) + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_depress")) 1) + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_press")) 0) + + (let* + ((newImage (car (gimp-image-duplicate image)))) + (gimp-image-merge-visible-layers newImage 1) + (let* + ((activeLayer (car (gimp-image-get-active-layer newImage)))) + (gimp-file-save RUN-NONINTERACTIVE image activeLayer "pictures_tft1/181_blinds_depress.bmp" "pictures_tft1/181_blinds_depress.bmp") + ) + (gimp-image-delete newImage) + ) + + ;prepare press picture + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_press")) 1) + + (let* + ((newImage (car (gimp-image-duplicate image)))) + (gimp-image-merge-visible-layers newImage 1) + (let* + ((activeLayer (car (gimp-image-get-active-layer newImage)))) + (gimp-file-save RUN-NONINTERACTIVE image activeLayer "pictures_tft1/182_blinds_press.bmp" "pictures_tft1/182_blinds_press.bmp") + ) + (gimp-image-delete newImage) + ) + + + ;MAKE ENTITY_BLINDS INVISIBLE TO PREPARE FOR NEXT ROOM + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_BLINDS")) 0) + +;;--------------------------------------------------------------------------------------------------------- + + (gimp-image-delete image) ) ) diff --git a/docker/HMI_files/tft_automation/gimp_scripts/nspanel-us-tft2.scm b/docker/HMI_files/tft_automation/gimp_scripts/nspanel-us-tft2.scm index 4c2586ee8..2c2d0b588 100644 --- a/docker/HMI_files/tft_automation/gimp_scripts/nspanel-us-tft2.scm +++ b/docker/HMI_files/tft_automation/gimp_scripts/nspanel-us-tft2.scm @@ -575,7 +575,47 @@ ;MAKE BACKGROUND PAGE INVISIBLE TO PREPARE FOR NEXT ROOM (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_THERMOSTAT")) 0) -;;--------------------------------------------------------------------------------------------------------- +;;--------------------------------------------------------------------------------------------------------- + +;; BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE + + ;MAKE BACKGROUND PAGE VISIBLE + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_BLINDS")) 1) + ;Prepare depress picture + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_back")) 1) + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_depress")) 1) + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_press")) 0) + + (let* + ((newImage (car (gimp-image-duplicate image)))) + (gimp-image-merge-visible-layers newImage 1) + (let* + ((activeLayer (car (gimp-image-get-active-layer newImage)))) + (gimp-file-save RUN-NONINTERACTIVE image activeLayer "pictures_tft2/181_blinds_depress.bmp" "pictures_tft2/181_blinds_depress.bmp") + ) + (gimp-image-delete newImage) + ) + + ;prepare press picture + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_press")) 1) + + (let* + ((newImage (car (gimp-image-duplicate image)))) + (gimp-image-merge-visible-layers newImage 1) + (let* + ((activeLayer (car (gimp-image-get-active-layer newImage)))) + (gimp-file-save RUN-NONINTERACTIVE image activeLayer "pictures_tft2/182_blinds_press.bmp" "pictures_tft2/182_blinds_press.bmp") + ) + (gimp-image-delete newImage) + ) + + + ;MAKE ENTITY_BLINDS INVISIBLE TO PREPARE FOR NEXT ROOM + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_BLINDS")) 0) + +;;--------------------------------------------------------------------------------------------------------- + + (gimp-image-delete image) ) ) diff --git a/docker/HMI_files/tft_automation/gimp_scripts/nspanel-us-tft3.scm b/docker/HMI_files/tft_automation/gimp_scripts/nspanel-us-tft3.scm index 04b54ea27..cb0e31b8b 100644 --- a/docker/HMI_files/tft_automation/gimp_scripts/nspanel-us-tft3.scm +++ b/docker/HMI_files/tft_automation/gimp_scripts/nspanel-us-tft3.scm @@ -576,6 +576,45 @@ ;MAKE BACKGROUND PAGE INVISIBLE TO PREPARE FOR NEXT ROOM (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_THERMOSTAT")) 0) ;;--------------------------------------------------------------------------------------------------------- + +;; BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE + + ;MAKE BACKGROUND PAGE VISIBLE + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_BLINDS")) 1) + ;Prepare depress picture + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_back")) 1) + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_depress")) 1) + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_press")) 0) + + (let* + ((newImage (car (gimp-image-duplicate image)))) + (gimp-image-merge-visible-layers newImage 1) + (let* + ((activeLayer (car (gimp-image-get-active-layer newImage)))) + (gimp-file-save RUN-NONINTERACTIVE image activeLayer "pictures_tft3/181_blinds_depress.bmp" "pictures_tft3/181_blinds_depress.bmp") + ) + (gimp-image-delete newImage) + ) + + ;prepare press picture + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_press")) 1) + + (let* + ((newImage (car (gimp-image-duplicate image)))) + (gimp-image-merge-visible-layers newImage 1) + (let* + ((activeLayer (car (gimp-image-get-active-layer newImage)))) + (gimp-file-save RUN-NONINTERACTIVE image activeLayer "pictures_tft3/182_blinds_press.bmp" "pictures_tft3/182_blinds_press.bmp") + ) + (gimp-image-delete newImage) + ) + + + ;MAKE ENTITY_BLINDS INVISIBLE TO PREPARE FOR NEXT ROOM + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_BLINDS")) 0) + +;;--------------------------------------------------------------------------------------------------------- + (gimp-image-delete image) ) ) diff --git a/docker/HMI_files/tft_automation/gimp_scripts/nspanel-us-tft4.scm b/docker/HMI_files/tft_automation/gimp_scripts/nspanel-us-tft4.scm index b4c3f5635..ce77599f4 100644 --- a/docker/HMI_files/tft_automation/gimp_scripts/nspanel-us-tft4.scm +++ b/docker/HMI_files/tft_automation/gimp_scripts/nspanel-us-tft4.scm @@ -576,6 +576,45 @@ ;MAKE BACKGROUND PAGE INVISIBLE TO PREPARE FOR NEXT ROOM (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_THERMOSTAT")) 0) ;;--------------------------------------------------------------------------------------------------------- + +;; BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE BLINDS_PAGE + + ;MAKE BACKGROUND PAGE VISIBLE + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_BLINDS")) 1) + ;Prepare depress picture + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_back")) 1) + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_depress")) 1) + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_press")) 0) + + (let* + ((newImage (car (gimp-image-duplicate image)))) + (gimp-image-merge-visible-layers newImage 1) + (let* + ((activeLayer (car (gimp-image-get-active-layer newImage)))) + (gimp-file-save RUN-NONINTERACTIVE image activeLayer "pictures_tft4/181_blinds_depress.bmp" "pictures_tft4/181_blinds_depress.bmp") + ) + (gimp-image-delete newImage) + ) + + ;prepare press picture + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "entity_blinds_buttons_press")) 1) + + (let* + ((newImage (car (gimp-image-duplicate image)))) + (gimp-image-merge-visible-layers newImage 1) + (let* + ((activeLayer (car (gimp-image-get-active-layer newImage)))) + (gimp-file-save RUN-NONINTERACTIVE image activeLayer "pictures_tft4/182_blinds_press.bmp" "pictures_tft4/182_blinds_press.bmp") + ) + (gimp-image-delete newImage) + ) + + + ;MAKE ENTITY_BLINDS INVISIBLE TO PREPARE FOR NEXT ROOM + (gimp-item-set-visible (car (gimp-image-get-layer-by-name image "ENTITY_BLINDS")) 0) + +;;--------------------------------------------------------------------------------------------------------- + (gimp-image-delete image) ) ) diff --git a/docker/HMI_files/tft_automation/hmi_tool.py b/docker/HMI_files/tft_automation/hmi_tool.py new file mode 100755 index 000000000..996b2d998 --- /dev/null +++ b/docker/HMI_files/tft_automation/hmi_tool.py @@ -0,0 +1,173 @@ +#!/usr/bin/env python3 +"""Read and edit component attributes in a Nextion Editor .HMI project, outside the Editor. + + hmi_tool.py pages FILE list pages, with their IDs + hmi_tool.py show FILE PAGE [--attrs x,y,w,h] list a page's components + hmi_tool.py events FILE PAGE [OBJECT] print event code + hmi_tool.py fonts FILE [--out DIR] list fonts; with --out, extract them + hmi_tool.py dump FILE pages, components, attributes and code as JSON + hmi_tool.py set IN OUT PAGE.OBJECT.ATTR=VALUE... + +`set` only changes numeric attributes, keeps endx/endy in step with x/y/w/h, and re-stamps each +edited page (see nextion_tools.hmi). It writes OUT, never IN, and re-reads OUT to check the result. +If the Editor rejects the result ("Version Mismatch", then "Loading Page Failed"), Save As in the +Editor and edit that copy (see nextion_tools.hmi). +""" +import argparse +import json +import os +import sys + +from PIL import Image + +from nextion_tools import hmi + + +def parse_edit(text): + target, _, value = text.partition('=') + parts = target.split('.') + if len(parts) != 3 or not value: + raise ValueError(f'expected PAGE.OBJECT.ATTR=VALUE, got {text!r}') + return parts[0], parts[1], parts[2], int(value, 0) + + +def cmd_pages(args): + project = hmi.Project.load(args.file) + for name, page in ((p.name, p) for p in project.pages): + print(f'{page.id:3} {name:20} {page.entry.name:8} {len(page.components):3} components') + if project.stale: + print(f'\n{len(project.stale)} stale blocks from earlier saves') + + +def cmd_show(args): + project = hmi.Project.load(args.file) + page = project.page(args.page) + attrs = args.attrs.split(',') + print(' '.join(f'{a:>8}' if a != 'objname' else f'{a:16}' for a in ['objname'] + attrs)) + for comp in page.components: + row = [f'{comp.name:16}'] + for a in attrs: + row.append(f'{comp.get(a) if a in comp.attrs else "-":>8}') + print(' '.join(row)) + + +def cmd_events(args): + project = hmi.Project.load(args.file) + page = project.page(args.page) + comps = [page.component(args.object)] if args.object else page.components + for comp in comps: + for event, code in comp.events.items(): + if code: + print(f'{page.name}.{comp.name} {event}:') + for line in code: + print(f' {line}') + + +def cmd_fonts(args): + project = hmi.Project.load(args.file) + blocks = project.font_blocks() + for index, ((member, block), font) in enumerate(zip(blocks, project.fonts())): + print(f'{index:3} {font.name:28} {member:7} height {font.height:3} {len(font.glyphs):4} glyphs') + if args.out: + _write_font(os.path.join(args.out, f'{index:02}_{font.name}'), font, block) + if args.out: + with open(os.path.join(args.out, 'fonts.json'), 'w') as f: + json.dump([_font_summary(i, m, font) for i, ((m, _), font) in enumerate(zip(blocks, project.fonts()))], + f, indent=1) + print(f'wrote {args.out}') + + +def _font_summary(index, member, font): + return {'index': index, 'member': member, 'name': font.name, 'encoding': font.encoding, + 'height': font.height, 'version': font.version, 'glyphs': len(font.glyphs)} + + +def _write_font(folder, font, block): + """The .zi as stored, one PNG per glyph (white ink, coverage as alpha, the whole box) and a + glyphs.json of each glyph's metrics.""" + os.makedirs(folder, exist_ok=True) + with open(os.path.join(folder, f'{font.name}.zi'), 'wb') as f: + f.write(block) + glyphs = [] + for g in font.glyphs.values(): + name = f'U+{g.code:04X}.png' + alpha = Image.fromarray(g.coverage, 'L') + Image.merge('LA', (Image.new('L', alpha.size, 255), alpha)).save(os.path.join(folder, name)) + glyphs.append({'code': g.code, 'char': g.char if g.code >= 0x20 else None, 'advance': g.advance, + 'left': g.left, 'right': g.right, 'file': name}) + with open(os.path.join(folder, 'glyphs.json'), 'w') as f: + json.dump(glyphs, f, indent=1) + + +def dump(project): + """The project as plain data: pages in ID order with their components, every attribute + decoded, and event code; and the font list.""" + pages = [] + for page in project.pages: + comps = [{'attrs': c.attrs, 'events': {e: code for e, code in c.events.items() if code}} + for c in page.components] + pages.append({'id': page.id, 'name': page.name, 'block': page.entry.name, 'components': comps}) + fonts = [_font_summary(i, m, font) for i, ((m, _), font) in enumerate(zip(project.font_blocks(), project.fonts()))] + return {'pages': pages, 'fonts': fonts} + + +def cmd_dump(args): + json.dump(dump(hmi.Project.load(args.file)), sys.stdout, indent=1, ensure_ascii=False) + print() + + +def cmd_set(args): + if os.path.exists(args.out) and os.path.samefile(args.file, args.out): + sys.exit('OUT must be a different file from IN') + project = hmi.Project.load(args.file) + try: + edits = [parse_edit(e) for e in args.edits] + data, changes = hmi.apply_edits(project, edits) + except (KeyError, ValueError) as e: + sys.exit(str(e).strip('"\'')) + with open(args.out, 'wb') as f: + f.write(data) + hmi.check_written(project, args.out, edits) + for page_name, obj, attr, old, new in changes: + print(f'{page_name}.{obj}.{attr}: {old} -> {new}') + print(f'wrote {args.out}') + if project.stale: + print(f'{args.file} holds {len(project.stale)} stale blocks from earlier saves. The Editor has ' + 'accepted edits to such files, but once rejected one for a reason not yet known: if it ' + 'reports "Version Mismatch", Save As in the Editor and edit that copy.') + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__.split('\n')[0]) + sub = parser.add_subparsers(dest='command', required=True) + p = sub.add_parser('pages', help='list pages') + p.add_argument('file') + p.set_defaults(func=cmd_pages) + p = sub.add_parser('show', help="list a page's components") + p.add_argument('file') + p.add_argument('page') + p.add_argument('--attrs', default='type,x,y,w,h') + p.set_defaults(func=cmd_show) + p = sub.add_parser('events', help='print event code') + p.add_argument('file') + p.add_argument('page') + p.add_argument('object', nargs='?') + p.set_defaults(func=cmd_events) + p = sub.add_parser('fonts', help='list fonts, or extract them with --out') + p.add_argument('file') + p.add_argument('--out', metavar='DIR', help='write each font\'s .zi, a PNG per glyph and its metrics here') + p.set_defaults(func=cmd_fonts) + p = sub.add_parser('dump', help='print pages, components, attributes and event code as JSON') + p.add_argument('file') + p.set_defaults(func=cmd_dump) + p = sub.add_parser('set', help='change numeric attributes, writing a new file') + p.add_argument('file') + p.add_argument('out') + p.add_argument('edits', nargs='+', metavar='PAGE.OBJECT.ATTR=VALUE') + p.set_defaults(func=cmd_set) + args = parser.parse_args(argv) + args.func(args) + + +if __name__ == '__main__': + main() diff --git a/docker/HMI_files/tft_automation/make_pictures.sh b/docker/HMI_files/tft_automation/make_pictures.sh new file mode 100755 index 000000000..89bea5bc6 --- /dev/null +++ b/docker/HMI_files/tft_automation/make_pictures.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Render the panel pictures (stages 1 and 2: GIMP, then dither and renumber, then the progress +# bar pictures listed in each region's progress_bars.txt) in Docker, with no X server needed. +# +# ./make_pictures.sh # eu and us +# ./make_pictures.sh us # one region +# ./make_pictures.sh --xvfb us # run GIMP under a virtual X server instead of gimp-console +# +# Pictures are written into the checkout (/pictures_tftN/ and all_numbered/), owned by +# the invoking user. Output is also written to last_pictures_run.log. +cd "$(dirname "$0")" || exit 1 + +IMAGE=nspm-tft-pictures +LOG=last_pictures_run.log + +XVFB=0 +if [ "${1:-}" = --xvfb ]; then + XVFB=1 + shift +fi + +{ + docker build -q -t "$IMAGE" \ + --build-arg NEXTION_TOOLS="$(grep -o '^nextion-tools[^ ]*' requirements.txt)" docker && + docker run --rm \ + --user "${SUDO_UID:-$(id -u)}:${SUDO_GID:-$(id -g)}" \ + -e NSPM_GIMP_XVFB="$XVFB" \ + -v "$PWD":/work \ + "$IMAGE" bash /work/docker/run_in_container.sh "$@" +} 2>&1 | tee "$LOG" +status=${PIPESTATUS[0]} + +# When run with sudo, hand the log back to the invoking user. +if [ -n "${SUDO_UID:-}" ]; then + chown "$SUDO_UID:$SUDO_GID" "$LOG" +fi +exit "$status" diff --git a/docker/HMI_files/tft_automation/make_tfts.sh b/docker/HMI_files/tft_automation/make_tfts.sh new file mode 100755 index 000000000..584d11c21 --- /dev/null +++ b/docker/HMI_files/tft_automation/make_tfts.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Build every theme's TFT without the Editor, from one TFT the Editor compiled. +# ./make_tfts.sh REGION path/to/gui.tft # after changing REGION/gui.HMI: the Editor's compile of it +# ./make_tfts.sh [REGION] # only pictures changed: rebuild from the committed TFTs +# Writes REGION/output_tft1..4/gui.tft, each the compile with that theme's pictures from +# make_pictures.sh swapped in. Building eu also writes us_horizontal_mirrored. +template=() +if [ $# -eq 2 ]; then + [ -f "$2" ] || { echo "$2: no such file"; exit 1; } + template=(--template "$(realpath "$2")") + set -- "$1" +elif [ $# -gt 2 ]; then + echo "usage: $0 REGION path/to/gui.tft | $0 [REGION]"; exit 1 +fi +cd "$(dirname "$0")" || exit 1 +regions=("$@") +[ ${#regions[@]} -gt 0 ] || regions=(eu us) +python3 -c 'import numpy, PIL, nextion_tools' 2>/dev/null || + { echo "make_tfts.sh needs nextion-tools, numpy and Pillow: python3 -m pip install -r requirements.txt"; exit 1; } +status=0 +for region in "${regions[@]}"; do + echo "--> $region" + PYTHONDONTWRITEBYTECODE=1 python3 build_tfts.py "$region" "${template[@]}" || status=1 +done +exit "$status" diff --git a/docker/HMI_files/tft_automation/requirements.txt b/docker/HMI_files/tft_automation/requirements.txt new file mode 100644 index 000000000..5c61f37b9 --- /dev/null +++ b/docker/HMI_files/tft_automation/requirements.txt @@ -0,0 +1,3 @@ +# The Nextion file formats (HMI, fonts, pictures, TFT checksums), with numpy and Pillow. +# Pinned to a release, so a change there cannot break this build until someone bumps it. +nextion-tools[images]==0.1.1 diff --git a/docs/static/.nojekyll b/docker/HMI_files/tft_automation/tests/__init__.py similarity index 100% rename from docs/static/.nojekyll rename to docker/HMI_files/tft_automation/tests/__init__.py diff --git a/docker/HMI_files/tft_automation/tests/test_bars.py b/docker/HMI_files/tft_automation/tests/test_bars.py new file mode 100644 index 000000000..4f70e60a1 --- /dev/null +++ b/docker/HMI_files/tft_automation/tests/test_bars.py @@ -0,0 +1,90 @@ +"""Tests for tft_build.bars, using upstream's own slider (items12.slider_save).""" +import os +import shutil +import tempfile +import unittest + +import numpy as np + +from nextion_tools import images +from tft_build import bars, region +from tests.test_hmi import load + +REGION = region.path('us') + + +class BarPicturesTest(unittest.TestCase): + def test_pictures_fit_the_bar_and_the_track_is_the_background(self): + project = load('us') + page = project.page('items12') + background = page.component('items12').get('pic') + (_, x, y, w, h, bpic, ppic), = bars.bars(project, 'items12', ['slider_save']) + with tempfile.TemporaryDirectory() as out: + bars.make(project, REGION, 'items12', [('slider_save', (1, 2, 3))], out) + for theme in region.THEMES: + track = images.read(os.path.join(out, f'tft{theme}', f'{bpic}.bmp')) + fill = images.read(os.path.join(out, f'tft{theme}', f'{ppic}.bmp')) + bg = images.read(os.path.join(region.numbered_dir(REGION, theme), f'{background}.bmp')) + np.testing.assert_array_equal(track, bg[y:y + h, x:x + w]) + np.testing.assert_array_equal(fill, np.full((h, w, 3), (1, 2, 3))) + + def test_numbered_writes_beside_the_theme_pictures_and_never_over_its_sources(self): + project = load('us') + page = project.page('items12') + background = page.component('items12').get('pic') + with tempfile.TemporaryDirectory() as out: + for theme in region.THEMES: + numbered = region.numbered_dir(out, theme) + os.makedirs(numbered) + shutil.copy(os.path.join(region.numbered_dir(REGION, theme), f'{background}.bmp'), numbered) + # slider_save's own pictures (73/74) are GIMP's, so writing them into all_numbered + # would replace them. + with self.assertRaises(ValueError): + bars.make(project, out, 'items12', [('slider_save', (1, 2, 3))], numbered_after=180) + # A bar whose pictures come after the background is written beside it. + original = bars.bars + bars.bars = lambda *a: [('bar', 0, 0, 4, 2, background + 1, background + 2)] + try: + written = bars.make(project, out, 'items12', [('bar', (1, 2, 3))], numbered_after=background) + finally: + bars.bars = original + self.assertEqual(sorted(path for _, path in written), + sorted(os.path.join(region.numbered_dir(out, t), f'{background + n}.bmp') + for t in region.THEMES for n in (1, 2))) + + def test_progress_bars_txt_gives_every_bar_a_colour(self): + with tempfile.TemporaryDirectory() as region_dir: + listed = os.path.join(region_dir, 'progress_bars.txt') + with open(listed, 'w') as f: + f.write('# comment\n\nmediaplayer p_pos=#DEAA31 p_volume=#00ff80\n') + self.assertEqual(region.progress_bars(region_dir), + [('mediaplayer', [('p_pos', (0xde, 0xaa, 0x31)), ('p_volume', (0x00, 0xff, 0x80))])]) + for line in ('mediaplayer p_pos', 'mediaplayer p_pos=DEAA31', 'mediaplayer p_pos=#DEA', 'mediaplayer'): + with open(listed, 'w') as f: + f.write(line + '\n') + with self.assertRaises(ValueError, msg=line): + region.progress_bars(region_dir) + + def test_refuses_objects_that_are_not_progress_bars(self): + with self.assertRaises(ValueError): + bars.bars(load('us'), 'items12', ['items12']) + with self.assertRaises(KeyError): + bars.bars(load('us'), 'items12', ['nonesuch']) + + def test_committed_bar_pictures_are_byte_identical_to_a_fresh_build(self): + # Including the BMP header, so a make_pictures.sh run leaves them unchanged in git. + for name in ('eu', 'us'): + region_dir = region.path(name) + project = load(name) + for page, listed in region.progress_bars(region_dir): + if project.find_page(page) is None: + continue + with tempfile.TemporaryDirectory() as out: + for theme, path in bars.make(project, region_dir, page, listed, out): + committed = os.path.join(region.numbered_dir(region_dir, theme), os.path.basename(path)) + with open(path, 'rb') as a, open(committed, 'rb') as b: + self.assertEqual(a.read(), b.read(), committed) + + +if __name__ == '__main__': + unittest.main() diff --git a/docker/HMI_files/tft_automation/tests/test_fonts.py b/docker/HMI_files/tft_automation/tests/test_fonts.py new file mode 100644 index 000000000..d8cd30925 --- /dev/null +++ b/docker/HMI_files/tft_automation/tests/test_fonts.py @@ -0,0 +1,76 @@ +"""The project's own fonts, read with nextion_tools.fonts (whose decoder nextion-tools tests).""" +import string +import unittest + +from tests.test_hmi import PROJECTS, load + + +# Text fields whose text the font they name cannot draw, because the text is a placeholder the +# firmware overwrites. Anything new here is worth a look: a font index may be stale. +UNDRAWABLE = {('eu', 'dropdown', 'i4_button')} + + +class ProjectFontsTest(unittest.TestCase): + def test_every_project_has_seventeen_fonts_in_main_hmi_order(self): + for region in PROJECTS: + project = load(region) + names = [f.name for f in project.fonts()] + self.assertEqual(len(names), 17, region) + self.assertEqual(names[:4], ['hamlin18_latA', 'replace_h23bold_id_1', 'timeandtemp', 'replace_h22_id_3']) + self.assertEqual([m for m, _ in project.font_blocks()], + [n for n in project.resources() if n.endswith('.zi')]) + + def test_both_regions_carry_the_same_fonts(self): + us = {f.name: b for (_, b), f in zip(load('us').font_blocks(), load('us').fonts())} + eu = {f.name: b for (_, b), f in zip(load('eu').font_blocks(), load('eu').fonts())} + self.assertEqual(us, eu) + + def test_known_icon_fonts_are_where_components_expect_them(self): + for region in PROJECTS: + fs = load(region).fonts() + self.assertEqual((fs[9].name, fs[9].height), ('newfont9', 50)) + self.assertEqual(fs[9].missing(string.ascii_lowercase[:18]), '') # a..r: GUI_ICONS + self.assertEqual((fs[11].name, fs[15].name, fs[16].name), ('stuvwxyz40', 'arrows40', 'thermostat30NEW')) + + def test_no_glyph_codes_more_than_its_box(self): + # The overhang columns are what make this hold: without them, five glyphs overrun. + for region in PROJECTS: + short = 0 + for font in load(region).fonts(): + for g in font.glyphs.values(): + self.assertEqual(g.coverage.shape, (font.height, g.left + g.advance + g.right)) + self.assertLessEqual(g.coded, g.coverage.size, f'{font.name} {g.char!r}') + short += g.coded < g.coverage.size + self.assertEqual(short, 13, region) + + def test_right_overhang_holds_the_caron_of_d(self): + g = load('us').fonts()[0].glyph('ď') # d with caron + self.assertEqual((g.left, g.advance, g.right), (0, 13, 1)) + self.assertTrue(g.coverage[:, -1].any(), 'the overhang column should hold ink') + + def test_text_font_draws_printable_ascii(self): + font = load('us').fonts()[0] + self.assertEqual(font.missing(string.printable.strip()), '') + self.assertFalse(font.glyph(' ').coverage.any()) + self.assertTrue(font.glyph('A').coverage.any()) + + def test_component_text_is_drawable_in_its_font(self): + for region in PROJECTS: + project = load(region) + fs = project.fonts() + for page in project.pages: + for comp in page.components: + if 'font' not in comp.attrs or 'txt' not in comp.attrs: + continue + index = comp.get('font') + self.assertLess(index, len(fs)) + text = comp.get('txt') + key = (region, page.name, comp.name) + if key in UNDRAWABLE: + self.assertTrue(fs[index].missing(text), f'{key} is drawable now; drop it from UNDRAWABLE') + else: + self.assertEqual(fs[index].missing(text), '', f'{key} font {index} {fs[index].name}') + + +if __name__ == '__main__': + unittest.main() diff --git a/docker/HMI_files/tft_automation/tests/test_hmi.py b/docker/HMI_files/tft_automation/tests/test_hmi.py new file mode 100644 index 000000000..6b5400cac --- /dev/null +++ b/docker/HMI_files/tft_automation/tests/test_hmi.py @@ -0,0 +1,282 @@ +"""nextion_tools.hmi and hmi_tool.py against the project's own HMIs: the ids, fonts and code the +firmware relies on. The reader itself is tested in nextion-tools.""" +import contextlib +import io +import json +import os +import struct +import tempfile +import unittest + +from PIL import Image + +import hmi_tool +from nextion_tools import hmi, tft +from tft_build import region + +PROJECTS = {name: region.hmi(region.path(name)) for name in ('us', 'eu')} + + +def load(region): + if region not in load.cache: + load.cache[region] = hmi.Project.load(PROJECTS[region]) + return load.cache[region] + + +load.cache = {} + + +class ParseTest(unittest.TestCase): + def test_every_component_has_a_name_and_consistent_ends(self): + for region in PROJECTS: + project = load(region) + self.assertGreater(len(project.pages), 10, region) + for page in project.pages: + for comp in page.components: + self.assertTrue(comp.name, f'{region} {page.name}') + for end, (start, size) in hmi.END_ATTRS.items(): + if end in comp.attrs: + self.assertEqual(comp.get(end), + comp.get(start) + comp.get(size) - 1, + f'{region} {page.name}.{comp.name}.{end}') + + def test_event_code_is_not_read_as_attributes(self): + # Code lines of 16 characters or more look like attribute records. + for region in PROJECTS: + for page in load(region).pages: + for comp in page.components: + for attr in comp.attrs: + self.assertRegex(attr, r'^[a-z_][a-z0-9_]*$', f'{region} {page.name}.{comp.name}') + + def test_stamp_constant_depends_only_on_length(self): + # The stamp is core ^ K(length); if the core were wrong, K would vary between + # same-length pages across the two projects. + constants = {} + pages_per_length = {} + for region in PROJECTS: + for page in load(region).pages: + k = struct.unpack_from(' bg.shape[0] or x + w > bg.shape[1]: + raise ValueError(f'{page_name}.{obj} ({x},{y} {w}x{h}) runs off background ' + f'{background} ({bg.shape[1]}x{bg.shape[0]})') + made[theme][bpic] = bg[y:y + h, x:x + w] + made[theme][ppic] = np.full((h, w, 3), fills[obj], dtype=np.uint8) + return made + + +def make(project, region_dir, page_name, listed, out=None, numbered_after=None): + """Write the pictures to out/tftN/, or if out is None to each theme's all_numbered/, where + they must come after picture numbered_after, the last one GIMP makes; return [(theme, path)].""" + if out is None and numbered_after is None: + raise ValueError('writing into all_numbered needs the last GIMP picture number') + made = pictures(project, region_dir, page_name, listed) + if out is None and min(made[region.THEMES[0]]) <= numbered_after: + raise ValueError(f'{page_name}\'s bars use pictures {sorted(made[region.THEMES[0]])}, which would ' + f'overwrite GIMP\'s pictures (0..{numbered_after})') + written = [] + for theme, by_id in made.items(): + target = region.numbered_dir(region_dir, theme) if out is None else os.path.join(out, f'tft{theme}') + os.makedirs(target, exist_ok=True) + for pic, pixels in by_id.items(): + path = os.path.join(target, f'{pic}.bmp') + images.write_bmp(path, pixels) + written.append((theme, path)) + return written diff --git a/docker/HMI_files/tft_automation/tft_build/region.py b/docker/HMI_files/tft_automation/tft_build/region.py new file mode 100644 index 000000000..3a6b7bd48 --- /dev/null +++ b/docker/HMI_files/tft_automation/tft_build/region.py @@ -0,0 +1,75 @@ +"""Where a region's files live. A region directory (eu, us) holds gui.HMI, progress_bars.txt, +and for each theme N its pictures in pictures_tftN/all_numbered/ and its TFT in +output_tftN/gui.tft.""" +import os +import re + +THEMES = (1, 2, 3, 4) +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +def path(region): + """A region's directory, from its name (eu, us) or a path.""" + return region if os.path.isdir(region) else os.path.join(ROOT, region) + + +def name(region_dir): + return os.path.basename(os.path.normpath(region_dir)) + + +def hmi(region_dir): + return os.path.join(region_dir, 'gui.HMI') + + +def tft(region_dir, theme): + return os.path.join(region_dir, f'output_tft{theme}', 'gui.tft') + + +def numbered_dir(region_dir, theme): + return os.path.join(region_dir, f'pictures_tft{theme}', 'all_numbered') + + +def numbered(region_dir, theme): + """{picture ID: path} of a theme's all_numbered/, which holds N.bmp or N.png.""" + folder = numbered_dir(region_dir, theme) + return {int(f.split('.')[0]): os.path.join(folder, f) + for f in os.listdir(folder) if f.endswith(('.bmp', '.png'))} + + +def numbering_problems(region_dir): + """The Editor numbers pictures by import order, so each theme's IDs must run 0..N with no + gaps, the same N in every theme.""" + problems = [] + counts = set() + for theme in THEMES: + ids = sorted(numbered(region_dir, theme)) + if ids != list(range(len(ids))): + problems.append(f'pictures_tft{theme}/all_numbered/ has gaps; IDs must run 0..N') + counts.add(len(ids)) + if len(counts) > 1: + problems.append(f'the themes have different numbers of pictures: {sorted(counts)}') + return problems + + +def progress_bars(region_dir): + """[(page, [(object, (r, g, b))...])] from progress_bars.txt, if there is one. Each line is + PAGE OBJECT=#RRGGBB..., and every bar must name its fill colour.""" + listed = os.path.join(region_dir, 'progress_bars.txt') + if not os.path.exists(listed): + return [] + found = [] + with open(listed) as f: + for number, line in enumerate(f, 1): + if not line.strip() or line.startswith('#'): + continue + page, *words = line.split() + if not words: + raise ValueError(f'{listed}:{number}: page {page} lists no bars') + bars = [] + for word in words: + obj, _, colour = word.partition('=') + if not re.fullmatch(r'#[0-9A-Fa-f]{6}', colour): + raise ValueError(f'{listed}:{number}: {word}: expected OBJECT=#RRGGBB, with the bar\'s fill colour') + bars.append((obj, tuple(int(colour[i:i + 2], 16) for i in (1, 3, 5)))) + found.append((page, bars)) + return found diff --git a/docker/HMI_files/tft_automation/tft_build/themes.py b/docker/HMI_files/tft_automation/tft_build/themes.py new file mode 100644 index 000000000..eeb35ab68 --- /dev/null +++ b/docker/HMI_files/tft_automation/tft_build/themes.py @@ -0,0 +1,64 @@ +"""Build every theme's TFT from one TFT the Editor compiled, without the Editor. + +The themes differ only in pictures, so each theme's TFT is the template with that theme's +pictures from all_numbered/ swapped in. Each picture keeps its slot: a picture the template +stores raw is replaced by the theme's picture in RGB565; a picture the Editor compressed must be +the same in every theme, since its codec is not known. + +A region's display orientation is set in the HMI's device settings, so the Editor compiles it +into the template; ORIENTATIONS holds what each region's TFTs must have. Layouts that are another +region's TFTs at another orientation are not compiled at all: ROTATED makes them from that +region's TFTs, changing only the orientation byte. +""" +from nextion_tools import images, tft + +from . import region + +ORIENTATIONS = {'eu': 270, 'us': 180} +# The manager's "US Horizontal (Mirrored)": the EU layout turned the other way. (For "US +# Horizontal" it serves the EU TFTs as they are.) +ROTATED = {'us_horizontal_mirrored': ('eu', 90)} + + +def rotated(source): + """[(layout, degrees)] built from the named region's TFTs.""" + return [(layout, degrees) for layout, (src, degrees) in ROTATED.items() if src == source] + + +def build(template, region_dir, themes=region.THEMES): + """{theme: TFT bytes}. Raises ValueError if a picture cannot be swapped into its slot.""" + slots = tft.pictures(template) + sources = {theme: region.numbered(region_dir, theme) for theme in region.THEMES} + first = sources[region.THEMES[0]] + if len(first) != len(slots): + raise ValueError(f'the template has {len(slots)} pictures but ' + f'{region.numbered_dir(region_dir, region.THEMES[0])} has {len(first)}; ' + 'compile a new template from the HMI') + swaps = {theme: {} for theme in themes} + for slot in slots: + paths = {theme: sources[theme].get(slot.index) for theme in region.THEMES} + missing = [theme for theme, path in paths.items() if path is None] + if missing: + raise ValueError(f'picture {slot.index} is missing from theme {missing[0]}') + if first[slot.index].endswith('.png'): + # Static pictures, which the Editor converts itself. + contents = set() + for path in paths.values(): + with open(path, 'rb') as f: + contents.add(f.read()) + if len(contents) > 1: + raise ValueError(f'picture {slot.index} differs between themes but is a PNG') + continue + pixels = {theme: images.read(path) for theme, path in paths.items()} + for theme, p in pixels.items(): + if p.shape[:2] != (slot.h, slot.w): + raise ValueError(f'picture {slot.index} is {p.shape[1]}x{p.shape[0]} in theme {theme} but ' + f'{slot.w}x{slot.h} in the template; compile a new template') + data = {theme: images.rgb565(p) for theme, p in pixels.items()} + if slot.raw: + for theme in themes: + swaps[theme][slot] = tft.raw_record(data[theme]) + elif len(set(data.values())) > 1: + raise ValueError(f'picture {slot.index} differs between themes, but the Editor compressed it ' + 'in the template, so it cannot be swapped') + return {theme: tft.replace_pictures(template, swaps[theme]) for theme in themes} diff --git a/docker/HMI_files/tft_automation/us/gui.HMI b/docker/HMI_files/tft_automation/us/gui.HMI index 974768513..96973ab6a 100644 Binary files a/docker/HMI_files/tft_automation/us/gui.HMI and b/docker/HMI_files/tft_automation/us/gui.HMI differ diff --git a/docker/HMI_files/tft_automation/us/output_tft1/gui.tft b/docker/HMI_files/tft_automation/us/output_tft1/gui.tft index 11465489a..f48be60af 100644 Binary files a/docker/HMI_files/tft_automation/us/output_tft1/gui.tft and b/docker/HMI_files/tft_automation/us/output_tft1/gui.tft differ diff --git a/docker/HMI_files/tft_automation/us/output_tft2/gui.tft b/docker/HMI_files/tft_automation/us/output_tft2/gui.tft index 79162f870..06a80b59a 100644 Binary files a/docker/HMI_files/tft_automation/us/output_tft2/gui.tft and b/docker/HMI_files/tft_automation/us/output_tft2/gui.tft differ diff --git a/docker/HMI_files/tft_automation/us/output_tft3/gui.tft b/docker/HMI_files/tft_automation/us/output_tft3/gui.tft index 70467d6c0..281191661 100644 Binary files a/docker/HMI_files/tft_automation/us/output_tft3/gui.tft and b/docker/HMI_files/tft_automation/us/output_tft3/gui.tft differ diff --git a/docker/HMI_files/tft_automation/us/output_tft4/gui.tft b/docker/HMI_files/tft_automation/us/output_tft4/gui.tft index f5a0f6a59..f48be60af 100644 Binary files a/docker/HMI_files/tft_automation/us/output_tft4/gui.tft and b/docker/HMI_files/tft_automation/us/output_tft4/gui.tft differ diff --git a/docker/HMI_files/tft_automation/us/pictures_tft1/181_blinds_depress.bmp b/docker/HMI_files/tft_automation/us/pictures_tft1/181_blinds_depress.bmp new file mode 100644 index 000000000..08cb9e68c Binary files /dev/null and b/docker/HMI_files/tft_automation/us/pictures_tft1/181_blinds_depress.bmp differ diff --git a/docker/HMI_files/tft_automation/us/pictures_tft1/182_blinds_press.bmp b/docker/HMI_files/tft_automation/us/pictures_tft1/182_blinds_press.bmp new file mode 100644 index 000000000..7e20c14de Binary files /dev/null and b/docker/HMI_files/tft_automation/us/pictures_tft1/182_blinds_press.bmp differ diff --git a/docker/HMI_files/tft_automation/us/pictures_tft1/all_numbered/181.bmp b/docker/HMI_files/tft_automation/us/pictures_tft1/all_numbered/181.bmp new file mode 100644 index 000000000..343095a9e Binary files /dev/null and b/docker/HMI_files/tft_automation/us/pictures_tft1/all_numbered/181.bmp differ diff --git a/docker/HMI_files/tft_automation/us/pictures_tft1/all_numbered/182.bmp b/docker/HMI_files/tft_automation/us/pictures_tft1/all_numbered/182.bmp new file mode 100644 index 000000000..adc8ca8fb Binary files /dev/null and b/docker/HMI_files/tft_automation/us/pictures_tft1/all_numbered/182.bmp differ diff --git a/docker/HMI_files/tft_automation/us/pictures_tft2/181_blinds_depress.bmp b/docker/HMI_files/tft_automation/us/pictures_tft2/181_blinds_depress.bmp new file mode 100644 index 000000000..370581bb9 Binary files /dev/null and b/docker/HMI_files/tft_automation/us/pictures_tft2/181_blinds_depress.bmp differ diff --git a/docker/HMI_files/tft_automation/us/pictures_tft2/182_blinds_press.bmp b/docker/HMI_files/tft_automation/us/pictures_tft2/182_blinds_press.bmp new file mode 100644 index 000000000..d1f210386 Binary files /dev/null and b/docker/HMI_files/tft_automation/us/pictures_tft2/182_blinds_press.bmp differ diff --git a/docker/HMI_files/tft_automation/us/pictures_tft2/all_numbered/181.bmp b/docker/HMI_files/tft_automation/us/pictures_tft2/all_numbered/181.bmp new file mode 100644 index 000000000..fd7c337f1 Binary files /dev/null and b/docker/HMI_files/tft_automation/us/pictures_tft2/all_numbered/181.bmp differ diff --git a/docker/HMI_files/tft_automation/us/pictures_tft2/all_numbered/182.bmp b/docker/HMI_files/tft_automation/us/pictures_tft2/all_numbered/182.bmp new file mode 100644 index 000000000..6ee42268a Binary files /dev/null and b/docker/HMI_files/tft_automation/us/pictures_tft2/all_numbered/182.bmp differ diff --git a/docker/HMI_files/tft_automation/us/pictures_tft3/181_blinds_depress.bmp b/docker/HMI_files/tft_automation/us/pictures_tft3/181_blinds_depress.bmp new file mode 100644 index 000000000..34c89baf2 Binary files /dev/null and b/docker/HMI_files/tft_automation/us/pictures_tft3/181_blinds_depress.bmp differ diff --git a/docker/HMI_files/tft_automation/us/pictures_tft3/182_blinds_press.bmp b/docker/HMI_files/tft_automation/us/pictures_tft3/182_blinds_press.bmp new file mode 100644 index 000000000..d3d47650f Binary files /dev/null and b/docker/HMI_files/tft_automation/us/pictures_tft3/182_blinds_press.bmp differ diff --git a/docker/HMI_files/tft_automation/us/pictures_tft3/all_numbered/181.bmp b/docker/HMI_files/tft_automation/us/pictures_tft3/all_numbered/181.bmp new file mode 100644 index 000000000..553b6a320 Binary files /dev/null and b/docker/HMI_files/tft_automation/us/pictures_tft3/all_numbered/181.bmp differ diff --git a/docker/HMI_files/tft_automation/us/pictures_tft3/all_numbered/182.bmp b/docker/HMI_files/tft_automation/us/pictures_tft3/all_numbered/182.bmp new file mode 100644 index 000000000..6275dec94 Binary files /dev/null and b/docker/HMI_files/tft_automation/us/pictures_tft3/all_numbered/182.bmp differ diff --git a/docker/HMI_files/tft_automation/us/pictures_tft4/181_blinds_depress.bmp b/docker/HMI_files/tft_automation/us/pictures_tft4/181_blinds_depress.bmp new file mode 100644 index 000000000..25492f220 Binary files /dev/null and b/docker/HMI_files/tft_automation/us/pictures_tft4/181_blinds_depress.bmp differ diff --git a/docker/HMI_files/tft_automation/us/pictures_tft4/182_blinds_press.bmp b/docker/HMI_files/tft_automation/us/pictures_tft4/182_blinds_press.bmp new file mode 100644 index 000000000..da39f19f3 Binary files /dev/null and b/docker/HMI_files/tft_automation/us/pictures_tft4/182_blinds_press.bmp differ diff --git a/docker/HMI_files/tft_automation/us/pictures_tft4/all_numbered/181.bmp b/docker/HMI_files/tft_automation/us/pictures_tft4/all_numbered/181.bmp new file mode 100644 index 000000000..7edae786f Binary files /dev/null and b/docker/HMI_files/tft_automation/us/pictures_tft4/all_numbered/181.bmp differ diff --git a/docker/HMI_files/tft_automation/us/pictures_tft4/all_numbered/182.bmp b/docker/HMI_files/tft_automation/us/pictures_tft4/all_numbered/182.bmp new file mode 100644 index 000000000..b5dee3c08 Binary files /dev/null and b/docker/HMI_files/tft_automation/us/pictures_tft4/all_numbered/182.bmp differ diff --git a/docker/HMI_files/tft_automation/us/progress_bars.txt b/docker/HMI_files/tft_automation/us/progress_bars.txt new file mode 100644 index 000000000..ee48d45d5 --- /dev/null +++ b/docker/HMI_files/tft_automation/us/progress_bars.txt @@ -0,0 +1,5 @@ +# Image progress bars (sta=1) whose pictures make_pictures.sh generates from this region's +# gui.HMI: the empty part is cut from each theme's page background, the full part is the +# colour given here, the same in every theme. One page per line: PAGE OBJECT=#RRGGBB... +# For example: +# mediaplayer p_pos=#DEAA31 p_volume=#DEAA31 diff --git a/docker/HMI_files/tft_automation/us/tft_US.xcf b/docker/HMI_files/tft_automation/us/tft_US.xcf index 7427273d7..753af0e7b 100644 Binary files a/docker/HMI_files/tft_automation/us/tft_US.xcf and b/docker/HMI_files/tft_automation/us/tft_US.xcf differ diff --git a/docker/HMI_files/tft_automation/us_horizontal_mirrored/output_tft1/gui.tft b/docker/HMI_files/tft_automation/us_horizontal_mirrored/output_tft1/gui.tft index 6bdcc3d8a..9ad210926 100644 Binary files a/docker/HMI_files/tft_automation/us_horizontal_mirrored/output_tft1/gui.tft and b/docker/HMI_files/tft_automation/us_horizontal_mirrored/output_tft1/gui.tft differ diff --git a/docker/HMI_files/tft_automation/us_horizontal_mirrored/output_tft2/gui.tft b/docker/HMI_files/tft_automation/us_horizontal_mirrored/output_tft2/gui.tft index 64f6500b0..b705c270e 100644 Binary files a/docker/HMI_files/tft_automation/us_horizontal_mirrored/output_tft2/gui.tft and b/docker/HMI_files/tft_automation/us_horizontal_mirrored/output_tft2/gui.tft differ diff --git a/docker/HMI_files/tft_automation/us_horizontal_mirrored/output_tft3/gui.tft b/docker/HMI_files/tft_automation/us_horizontal_mirrored/output_tft3/gui.tft index 029a16fe8..c124d1796 100644 Binary files a/docker/HMI_files/tft_automation/us_horizontal_mirrored/output_tft3/gui.tft and b/docker/HMI_files/tft_automation/us_horizontal_mirrored/output_tft3/gui.tft differ diff --git a/docker/HMI_files/tft_automation/us_horizontal_mirrored/output_tft4/gui.tft b/docker/HMI_files/tft_automation/us_horizontal_mirrored/output_tft4/gui.tft index 478e71a88..ca4adbf63 100644 Binary files a/docker/HMI_files/tft_automation/us_horizontal_mirrored/output_tft4/gui.tft and b/docker/HMI_files/tft_automation/us_horizontal_mirrored/output_tft4/gui.tft differ diff --git a/docker/HMI_files/tft_automation/us_horizontal_mirrored/tftautomation.ahk b/docker/HMI_files/tft_automation/us_horizontal_mirrored/tftautomation.ahk deleted file mode 100644 index 25eaf80f4..000000000 --- a/docker/HMI_files/tft_automation/us_horizontal_mirrored/tftautomation.ahk +++ /dev/null @@ -1,267 +0,0 @@ -#Requires AutoHotkey v2.0 -#SingleInstance Force -CoordMode("Mouse", "Window") - -; ── CONFIG ───────────────────────────── -hmiFile := "C:\Github\NSPanelManager\docker\HMI_files\tft_automation\eu\gui.HMI" -inputImageDir1 := "C:\Github\NSPanelManager\docker\HMI_files\tft_automation\eu\pictures_tft1\all_numbered" -inputImageDir2 := "C:\Github\NSPanelManager\docker\HMI_files\tft_automation\eu\pictures_tft2\all_numbered" -inputImageDir3 := "C:\Github\NSPanelManager\docker\HMI_files\tft_automation\eu\pictures_tft3\all_numbered" -inputImageDir4 := "C:\Github\NSPanelManager\docker\HMI_files\tft_automation\eu\pictures_tft4\all_numbered" -outputTftDir1 := "C:\Github\NSPanelManager\docker\HMI_files\tft_automation\us_horizontal_mirrored\output_tft1" -outputTftDir2 := "C:\Github\NSPanelManager\docker\HMI_files\tft_automation\us_horizontal_mirrored\output_tft2" -outputTftDir3 := "C:\Github\NSPanelManager\docker\HMI_files\tft_automation\us_horizontal_mirrored\output_tft3" -outputTftDir4 := "C:\Github\NSPanelManager\docker\HMI_files\tft_automation\us_horizontal_mirrored\output_tft4" - -; ── STEP 1: Open HMI file (starts editor too) ─ -Run(hmiFile) -WinWaitActive("Nextion Editor") ; Wait for the window title to show up -Sleep(5000) ; extra buffer to let it finish loading fully - -; ── STEP 2: Delete all images ──────────────── -Click(195, 444) ; Trash icon -Sleep(500) -Send("{Enter}") ; Confirm delete -Sleep(1000) - -; ── STEP 3: Add new pictures ───────────────── -Click(27, 444) ; Plus icon (Add) -;WinWaitActive("Add Pictures") - -WinWaitActive("ahk_class #32770") ; the file-chooser window - -Send("!d") ; focus the path field -Sleep(100) -SendText(inputImageDir1) -Send("{Enter}") ; navigate -Sleep(800) ; let the folder refresh - -;Shift focus into the file list -Send("{Tab 4}") ; 4x Tab to reach the file list -Sleep(100) -Send("^a") ; Select all files -Sleep(100) -Send("{Enter}") ; Import into Nextion - -WinWaitClose("ahk_class #32770", , 5) -Sleep(5000) -; wait for the success pop-up and dismiss it -;WinWaitActive("Nextion Editor", "Import successful", 5) ; title + text filter -;Sleep(100) ; give focus to OK -Send("{Enter}") ; press OK -Sleep(2000) - -; ── STEP 4: Build TFT Output ───────────────── -; Activate the editor window just in case -WinActivate("Nextion Editor") -Sleep(100) - -;Click the File menu — get coordinates using Window Spy -Click(23, 46) ; adjust this to your File menu position -Sleep(100) -Click(23, 46) ; adjust this to your File menu position -Sleep(2000) ; let the menu open - -;Navigate to “TFT Output” using arrow keys -Send("{Down 1}") ; move to first item — adjust if needed -Sleep(100) -Send("{Enter}") ; trigger TFT Output -Sleep(1000) - -;WinWaitActive("ahk_class #32770") -Send("{Tab 2}") -SendText(outputTftDir1) -Sleep(300) -Send("{Tab}{Tab}{Enter}") ; Go to output and confirm -; ── Save dialog handled, output created ── -Sleep(2000) ; small buffer while Explorer opens -WinWaitActive("ahk_class CabinetWClass", , 3) ; optional: wait for folder -Send("!{F4}") ; close the newly opened folder window -Sleep(2000) ; small buffer while Explorer opens - -;TFT2-------------------------------------------------------------------------------TFT2 - -; ── STEP 2: Delete all images ──────────────── -Click(195, 444) ; Trash icon -Sleep(500) -Send("{Enter}") ; Confirm delete -Sleep(1000) - -; ── STEP 3: Add new pictures ───────────────── -Click(27, 444) ; Plus icon (Add) -;WinWaitActive("Add Pictures") - -WinWaitActive("ahk_class #32770") ; the file-chooser window - -Send("!d") ; focus the path field -Sleep(100) -SendText(inputImageDir2) -Send("{Enter}") ; navigate -Sleep(800) ; let the folder refresh - -;Shift focus into the file list -Send("{Tab 4}") ; 4x Tab to reach the file list -Sleep(100) -Send("^a") ; Select all files -Sleep(100) -Send("{Enter}") ; Import into Nextion - -WinWaitClose("ahk_class #32770", , 5) -Sleep(5000) -; wait for the success pop-up and dismiss it -;WinWaitActive("Nextion Editor", "Import successful", 5) ; title + text filter -;Sleep(100) ; give focus to OK -Send("{Enter}") ; press OK -Sleep(2000) - -; ── STEP 4: Build TFT Output ───────────────── -; Activate the editor window just in case -WinActivate("Nextion Editor") -Sleep(100) - -;Click the File menu — get coordinates using Window Spy -Click(23, 46) ; adjust this to your File menu position -Sleep(100) -Click(23, 46) ; adjust this to your File menu position -Sleep(2000) ; let the menu open - -;Navigate to “TFT Output” using arrow keys -Send("{Down 1}") ; move to first item — adjust if needed -Sleep(100) -Send("{Enter}") ; trigger TFT Output -Sleep(1000) - -;WinWaitActive("ahk_class #32770") -Send("{Tab 2}") -SendText(outputTftDir2) -Sleep(300) -Send("{Tab}{Tab}{Enter}") ; Go to output and confirm -; ── Save dialog handled, output created ── -Sleep(2000) ; small buffer while Explorer opens -WinWaitActive("ahk_class CabinetWClass", , 3) ; optional: wait for folder -Send("!{F4}") ; close the newly opened folder window -Sleep(2000) ; small buffer while Explorer opens - -;TFT3---------------------------------------------------------------TFT3; ── STEP 2: Delete all images ──────────────── -Click(195, 444) ; Trash icon -Sleep(500) -Send("{Enter}") ; Confirm delete -Sleep(1000) - -; ── STEP 3: Add new pictures ───────────────── -Click(27, 444) ; Plus icon (Add) -;WinWaitActive("Add Pictures") - -WinWaitActive("ahk_class #32770") ; the file-chooser window - -Send("!d") ; focus the path field -Sleep(100) -SendText(inputImageDir3) -Send("{Enter}") ; navigate -Sleep(800) ; let the folder refresh - -;Shift focus into the file list -Send("{Tab 4}") ; 4x Tab to reach the file list -Sleep(100) -Send("^a") ; Select all files -Sleep(100) -Send("{Enter}") ; Import into Nextion - -WinWaitClose("ahk_class #32770", , 5) -Sleep(5000) -; wait for the success pop-up and dismiss it -;WinWaitActive("Nextion Editor", "Import successful", 5) ; title + text filter -;Sleep(100) ; give focus to OK -Send("{Enter}") ; press OK -Sleep(2000) - -; ── STEP 4: Build TFT Output ───────────────── -; Activate the editor window just in case -WinActivate("Nextion Editor") -Sleep(100) - -;Click the File menu — get coordinates using Window Spy -Click(23, 46) ; adjust this to your File menu position -Sleep(100) -Click(23, 46) ; adjust this to your File menu position -Sleep(2000) ; let the menu open - -;Navigate to “TFT Output” using arrow keys -Send("{Down 1}") ; move to first item — adjust if needed -Sleep(100) -Send("{Enter}") ; trigger TFT Output -Sleep(1000) - -;WinWaitActive("ahk_class #32770") -Send("{Tab 2}") -SendText(outputTftDir3) -Sleep(300) -Send("{Tab}{Tab}{Enter}") ; Go to output and confirm -; ── Save dialog handled, output created ── -Sleep(2000) ; small buffer while Explorer opens -WinWaitActive("ahk_class CabinetWClass", , 3) ; optional: wait for folder -Send("!{F4}") ; close the newly opened folder window -Sleep(2000) ; small buffer while Explorer opens - -;TFT4---------------------------------------------------------------TFT4; ── STEP 2: Delete all images ──────────────── -Click(195, 444) ; Trash icon -Sleep(500) -Send("{Enter}") ; Confirm delete -Sleep(1000) - -; ── STEP 3: Add new pictures ───────────────── -Click(27, 444) ; Plus icon (Add) -;WinWaitActive("Add Pictures") - -WinWaitActive("ahk_class #32770") ; the file-chooser window - -Send("!d") ; focus the path field -Sleep(100) -SendText(inputImageDir4) -Send("{Enter}") ; navigate -Sleep(800) ; let the folder refresh - -;Shift focus into the file list -Send("{Tab 4}") ; 4x Tab to reach the file list -Sleep(100) -Send("^a") ; Select all files -Sleep(100) -Send("{Enter}") ; Import into Nextion - -WinWaitClose("ahk_class #32770", , 5) -Sleep(5000) -; wait for the success pop-up and dismiss it -;WinWaitActive("Nextion Editor", "Import successful", 5) ; title + text filter -;Sleep(100) ; give focus to OK -Send("{Enter}") ; press OK -Sleep(2000) - -; ── STEP 4: Build TFT Output ───────────────── -; Activate the editor window just in case -WinActivate("Nextion Editor") -Sleep(100) - -;Click the File menu — get coordinates using Window Spy -Click(23, 46) ; adjust this to your File menu position -Sleep(100) -Click(23, 46) ; adjust this to your File menu position -Sleep(2000) ; let the menu open - -;Navigate to “TFT Output” using arrow keys -Send("{Down 1}") ; move to first item — adjust if needed -Sleep(100) -Send("{Enter}") ; trigger TFT Output -Sleep(1000) - -;WinWaitActive("ahk_class #32770") -Send("{Tab 2}") -SendText(outputTftDir4) -Sleep(300) -Send("{Tab}{Tab}{Enter}") ; Go to output and confirm -; ── Save dialog handled, output created ── -Sleep(2000) ; small buffer while Explorer opens -WinWaitActive("ahk_class CabinetWClass", , 3) ; optional: wait for folder -Send("!{F4}") ; close the newly opened folder window -Sleep(2000) ; small buffer while Explorer opens - -ExitApp diff --git a/docker/MQTTManager/CMakeLists.txt b/docker/MQTTManager/CMakeLists.txt index 288d1f8e8..e67712129 100644 --- a/docker/MQTTManager/CMakeLists.txt +++ b/docker/MQTTManager/CMakeLists.txt @@ -3,13 +3,19 @@ project(nspm_mqttmanager) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_STANDARD 23) -set(TEST_MODE 0) +# Build the unit tests (tests/) and compile the inline TEST_MODE tests into the libraries. +# Run them with ./run_tests.sh, or `ctest` in the build directory. +option(NSPM_BUILD_TESTS "Build the MQTTManager unit tests" OFF) set(CMAKE_INCLUDE_SRC_DIRECTORY /MQTTManager/include) set(PROTOBUF_SRC_DIRECTORY /MQTTManager/include/protobuf) add_compile_options(-rdynamic -g) add_compile_definitions(SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE BOOST_STACKTRACE_USE_BACKTRACE BOOST_BIND_GLOBAL_PLACEHOLDERS BOOST_STACKTRACE_LIBCXX_RUNTIME_MAY_CAUSE_MEMORY_LEAK) -add_compile_definitions(TEST_MODE=0) +if(NSPM_BUILD_TESTS) + add_compile_definitions(TEST_MODE=1) +else() + add_compile_definitions(TEST_MODE=0) +endif() # Statically link libraries IF(DEFINED ENV{STRIP}) @@ -27,8 +33,10 @@ find_package(CURL REQUIRED) find_package(nlohmann_json REQUIRED) find_package(ixwebsocket REQUIRED) find_package(tz REQUIRED) +find_package(date REQUIRED) find_package(protobuf REQUIRED) find_package(SqliteOrm REQUIRED) +find_package(stb REQUIRED) find_package(GTest REQUIRED) find_package(Boost REQUIRED COMPONENTS signals2 stacktrace_backtrace) @@ -82,6 +90,11 @@ set_target_properties(MQTTManager_OpenhabManager PROPERTIES PUBLIC_HEADER ${CMAK target_include_directories(MQTTManager_OpenhabManager PUBLIC ${CMAKE_INCLUDE_SRC_DIRECTORY}) target_link_libraries(MQTTManager_OpenhabManager Boost::stacktrace_backtrace spdlog::spdlog nlohmann_json::nlohmann_json ixwebsocket::ixwebsocket Boost::boost MQTTManager_Config MQTTManager_WebsocketServer gtest::gtest) +add_library(MQTTManager_ManagerClock STATIC ${CMAKE_INCLUDE_SRC_DIRECTORY}/manager_clock/manager_clock.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/manager_clock/manager_clock.hpp) +set_target_properties(MQTTManager_ManagerClock PROPERTIES PUBLIC_HEADER ${CMAKE_INCLUDE_SRC_DIRECTORY}/manager_clock/manager_clock.hpp) +target_include_directories(MQTTManager_ManagerClock PUBLIC ${CMAKE_INCLUDE_SRC_DIRECTORY}) +target_link_libraries(MQTTManager_ManagerClock MQTT_Manager MQTTManager_Config spdlog::spdlog gtest::gtest) + add_library(MQTTManager_Weather STATIC ${CMAKE_INCLUDE_SRC_DIRECTORY}/weather/weather.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/weather/weather.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/weather/weather_icons.hpp) set_target_properties(MQTTManager_Weather PROPERTIES PUBLIC_HEADER ${CMAKE_INCLUDE_SRC_DIRECTORY}/weather/weather.hpp) target_include_directories(MQTTManager_Weather PUBLIC ${CMAKE_INCLUDE_SRC_DIRECTORY}) @@ -102,6 +115,16 @@ set_target_properties(MQTTManager_Thermostat PROPERTIES PUBLIC_HEADER ${CMAKE_IN target_include_directories(MQTTManager_Thermostat PUBLIC ${CMAKE_INCLUDE_SRC_DIRECTORY}) target_link_libraries(MQTTManager_Thermostat MQTTManager_HomeAssistantManager MQTTManager_OpenhabManager spdlog::spdlog nlohmann_json::nlohmann_json MQTT_Manager Boost::boost MQTTManager_Entity Protobuf_MQTTManager MQTTManager_CommandManager gtest::gtest) +add_library(MQTTManager_MediaPlayer STATIC ${CMAKE_INCLUDE_SRC_DIRECTORY}/media_player/media_player.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/media_player/media_player.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/media_player/home_assistant_media_player.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/media_player/home_assistant_media_player.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/media_player/home_assistant_source_volume.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/media_player/home_assistant_source_volume.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/media_player/home_assistant_source_player.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/media_player/home_assistant_source_player.cpp) +set_target_properties(MQTTManager_MediaPlayer PROPERTIES PUBLIC_HEADER ${CMAKE_INCLUDE_SRC_DIRECTORY}/media_player/media_player.hpp) +target_include_directories(MQTTManager_MediaPlayer PUBLIC ${CMAKE_INCLUDE_SRC_DIRECTORY}) +target_link_libraries(MQTTManager_MediaPlayer MQTTManager_HomeAssistantManager MQTTManager_WebHelper spdlog::spdlog nlohmann_json::nlohmann_json MQTT_Manager date::date Boost::boost MQTTManager_Entity Protobuf_MQTTManager MQTTManager_CommandManager gtest::gtest) + +add_library(MQTTManager_Cover STATIC ${CMAKE_INCLUDE_SRC_DIRECTORY}/cover/cover.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/cover/cover.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/cover/home_assistant_cover.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/cover/home_assistant_cover.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/cover/openhab_cover.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/cover/openhab_cover.cpp) +set_target_properties(MQTTManager_Cover PROPERTIES PUBLIC_HEADER ${CMAKE_INCLUDE_SRC_DIRECTORY}/cover/cover.hpp) +target_include_directories(MQTTManager_Cover PUBLIC ${CMAKE_INCLUDE_SRC_DIRECTORY}) +target_link_libraries(MQTTManager_Cover MQTTManager_HomeAssistantManager MQTTManager_OpenhabManager spdlog::spdlog nlohmann_json::nlohmann_json MQTT_Manager Boost::boost MQTTManager_Entity Protobuf_MQTTManager MQTTManager_CommandManager gtest::gtest) + add_library(MQTTManager_Switch STATIC ${CMAKE_INCLUDE_SRC_DIRECTORY}/switch/switch.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/switch/switch.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/switch/home_assistant_switch.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/switch/home_assistant_switch.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/switch/openhab_switch.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/switch/openhab_switch.hpp) set_target_properties(MQTTManager_Switch PROPERTIES PUBLIC_HEADER ${CMAKE_INCLUDE_SRC_DIRECTORY}/switch/switch.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/switch/home_assistant_switch.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/switch/openhab_switch.hpp) target_include_directories(MQTTManager_Switch PUBLIC ${CMAKE_INCLUDE_SRC_DIRECTORY}) @@ -110,7 +133,7 @@ target_link_libraries(MQTTManager_Switch MQTTManager_HomeAssistantManager spdlog add_library(MQTTManager_NSPanel STATIC ${CMAKE_INCLUDE_SRC_DIRECTORY}/nspanel/nspanel.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/nspanel/nspanel.hpp) set_target_properties(MQTTManager_NSPanel PROPERTIES PUBLIC_HEADER ${CMAKE_INCLUDE_SRC_DIRECTORY}/nspanel/nspanel.hpp) target_include_directories(MQTTManager_NSPanel PUBLIC ${CMAKE_INCLUDE_SRC_DIRECTORY}) -target_link_libraries(MQTTManager_NSPanel spdlog::spdlog nlohmann_json::nlohmann_json MQTT_Manager MQTTManager_Room MQTTManager_WebsocketServer tz::tz Boost::boost MQTTManager_Config Protobuf_MQTTManager MQTTManager_DatabaseManager gtest::gtest) +target_link_libraries(MQTTManager_NSPanel spdlog::spdlog nlohmann_json::nlohmann_json MQTT_Manager MQTTManager_ManagerClock MQTTManager_Room MQTTManager_WebsocketServer tz::tz Boost::boost MQTTManager_Config Protobuf_MQTTManager MQTTManager_DatabaseManager gtest::gtest) add_library(MQTTManager_Scene STATIC ${CMAKE_INCLUDE_SRC_DIRECTORY}/scenes/scene.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/scenes/scene.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/scenes/nspm_scene.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/scenes/nspm_scene.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/scenes/home_assistant_scene.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/scenes/home_assistant_scene.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/scenes/openhab_scene.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/scenes/openhab_scene.cpp) # set_target_properties(MQTTManager_Scene PROPERTIES PUBLIC_HEADER ${CMAKE_INCLUDE_SRC_DIRECTORY}/scene/scene.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/scene/nspm_scene.hpp) @@ -119,7 +142,7 @@ target_link_libraries(MQTTManager_Scene spdlog::spdlog nlohmann_json::nlohmann_j add_library(MQTTManager_RoomEntitiesPage STATIC ${CMAKE_INCLUDE_SRC_DIRECTORY}/room/room_entities_page.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/room/room_entities_page.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/room/room_entities_page.cpp) target_include_directories(MQTTManager_RoomEntitiesPage PUBLIC ${CMAKE_INCLUDE_SRC_DIRECTORY}) -target_link_libraries(MQTTManager_RoomEntitiesPage Boost::boost spdlog::spdlog nlohmann_json::nlohmann_json Protobuf_MQTTManager MQTTManager_WebHelper MQTTManager_Light MQTTManager_Switch MQTTManager_Scene MQTTManager_DatabaseManager gtest::gtest) +target_link_libraries(MQTTManager_RoomEntitiesPage Boost::boost spdlog::spdlog nlohmann_json::nlohmann_json Protobuf_MQTTManager MQTTManager_WebHelper MQTTManager_Light MQTTManager_Switch MQTTManager_Scene MQTTManager_MediaPlayer MQTTManager_Cover MQTTManager_DatabaseManager gtest::gtest) add_library(MQTTManager_Room STATIC ${CMAKE_INCLUDE_SRC_DIRECTORY}/room/room.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/room/room.hpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/room/room.cpp) target_include_directories(MQTTManager_Room PUBLIC ${CMAKE_INCLUDE_SRC_DIRECTORY}) @@ -128,7 +151,7 @@ target_link_libraries(MQTTManager_Room MQTTManager_RoomEntitiesPage spdlog::spdl add_library(MQTTManager_EntityManager STATIC ${CMAKE_INCLUDE_SRC_DIRECTORY}/entity_manager/entity_manager.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/entity_manager/entity_manager.hpp) set_target_properties(MQTTManager_EntityManager PROPERTIES PUBLIC_HEADER ${CMAKE_INCLUDE_SRC_DIRECTORY}/entity_manager/entity_manager.hpp) target_include_directories(MQTTManager_EntityManager PUBLIC MQTTManager_WebHelper ${CMAKE_INCLUDE_SRC_DIRECTORY}) -target_link_libraries(MQTTManager_EntityManager MQTTManager_WebHelper spdlog::spdlog MQTT_Manager MQTTManager_NSPanel MQTTManager_Light MQTTManager_Button MQTTManager_Thermostat MQTTManager_Switch MQTTManager_WebsocketServer Boost::boost Boost::stacktrace_backtrace dl MQTTManager_Weather gtest::gtest) +target_link_libraries(MQTTManager_EntityManager MQTTManager_WebHelper spdlog::spdlog MQTT_Manager MQTTManager_NSPanel MQTTManager_Light MQTTManager_Button MQTTManager_Thermostat MQTTManager_MediaPlayer MQTTManager_Cover MQTTManager_Switch MQTTManager_WebsocketServer Boost::boost Boost::stacktrace_backtrace dl MQTTManager_Weather gtest::gtest) add_library(MQTTManager_Config STATIC ${CMAKE_INCLUDE_SRC_DIRECTORY}/mqtt_manager_config/mqtt_manager_config.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/mqtt_manager_config/mqtt_manager_config.hpp) # set_target_properties(MQTTManager_Config PROPERTIES PUBLIC_HEADER ${CMAKE_INCLUDE_SRC_DIRECTORY}/mqtt_manager_config/mqtt_manager_config.hpp) @@ -136,11 +159,16 @@ target_include_directories(MQTTManager_Config PUBLIC MQTTManager_WebHelper ${CMA target_link_libraries(MQTTManager_Config spdlog::spdlog MQTTManager_WebHelper nlohmann_json::nlohmann_json Boost::boost Protobuf_MQTTManager MQTTManager_DatabaseManager MQTTManager_WebsocketServer gtest::gtest) +add_library(MQTTManager_NextionImageServer STATIC ${CMAKE_INCLUDE_SRC_DIRECTORY}/nextion_image_server/nextion_image_server.cpp ${CMAKE_INCLUDE_SRC_DIRECTORY}/nextion_image_server/nextion_image_server.hpp) +target_include_directories(MQTTManager_NextionImageServer PUBLIC ${CMAKE_INCLUDE_SRC_DIRECTORY}) +target_link_libraries(MQTTManager_NextionImageServer ixwebsocket::ixwebsocket spdlog::spdlog stb::stb MQTTManager_EntityManager MQTTManager_MediaPlayer gtest::gtest) + + add_executable(${PROJECT_NAME} src/main.cpp) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_INCLUDE_SRC_DIRECTORY}) -target_link_libraries(${PROJECT_NAME} MQTT_Manager MQTTManager_Config MQTTManager_HomeAssistantManager MQTTManager_OpenhabManager MQTTManager_EntityManager MQTTManager_Scene MQTTManager_Room MQTTManager_WebsocketServer MQTTManager_CommandManager gtest::gtest) +target_link_libraries(${PROJECT_NAME} MQTT_Manager MQTTManager_ManagerClock MQTTManager_Config MQTTManager_HomeAssistantManager MQTTManager_OpenhabManager MQTTManager_EntityManager MQTTManager_NextionImageServer MQTTManager_Scene MQTTManager_Room MQTTManager_WebsocketServer MQTTManager_CommandManager gtest::gtest) -if (TEST_MODE==1) +if(NSPM_BUILD_TESTS) enable_testing() - gtest_discover_tests(${PROJECT_NAME}) + add_subdirectory(tests) endif() diff --git a/docker/MQTTManager/compile_mqttmanager.sh b/docker/MQTTManager/compile_mqttmanager.sh index 00fd19363..8ae1249ac 100755 --- a/docker/MQTTManager/compile_mqttmanager.sh +++ b/docker/MQTTManager/compile_mqttmanager.sh @@ -29,11 +29,9 @@ while true; do done if [ "$TEST_MODE" -eq 1 ]; then - sed -i 's/set(TEST_MODE.*/set(TEST_MODE 1)/g' /MQTTManager/CMakeLists.txt - sed -i 's/add_compile_definitions(TEST_MODE.*/add_compile_definitions(TEST_MODE=1)/g' /MQTTManager/CMakeLists.txt + NSPM_BUILD_TESTS=ON else - sed -i 's/set(TEST_MODE.*/set(TEST_MODE 0)/g' /MQTTManager/CMakeLists.txt - sed -i 's/add_compile_definitions(TEST_MODE.*/add_compile_definitions(TEST_MODE=0)/g' /MQTTManager/CMakeLists.txt + NSPM_BUILD_TESTS=OFF fi if [ -z "$TARGETPLATFORM" ]; then @@ -139,7 +137,7 @@ conan install . --build=missing -pr:b default -pr:h host echo "--> Conan install complete." cd build source $BUILD_TYPE/generators/conanbuild.sh -cmake .. -DCMAKE_TOOLCHAIN_FILE=$BUILD_TYPE/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} +cmake .. -DCMAKE_TOOLCHAIN_FILE=$BUILD_TYPE/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -DNSPM_BUILD_TESTS=${NSPM_BUILD_TESTS} cmake --build . --config $BUILD_TYPE -j $(nproc) if [ -f /MQTTManager/fix_compile_commands_path.sh ]; then source /MQTTManager/fix_compile_commands_path.sh diff --git a/docker/MQTTManager/conanfile.py b/docker/MQTTManager/conanfile.py index 2e78f1285..a84b10b89 100644 --- a/docker/MQTTManager/conanfile.py +++ b/docker/MQTTManager/conanfile.py @@ -15,10 +15,12 @@ def requirements(self): self.requires("nlohmann_json/3.12.0") self.requires("ixwebsocket/11.4.5") self.requires("tz/2023c") + self.requires("date/3.0.5") # Header-only, for parsing Home Assistant timestamps # self.requires("inja/3.4.0") self.requires("boost/1.84.0") self.requires("protobuf/5.27.0") self.requires("sqlite_orm/1.9.1") + self.requires("stb/cci.20240531") # Header-only image decoding/resizing for the Nextion image server # Testing tools: self.requires("gtest/1.16.0") @@ -26,6 +28,7 @@ def configure(self): self.options["boost"].without_stacktrace = False self.options["boost"].with_stacktrace_backtrace = True self.options["sqlite_orm"].SQLITE_ORM_ENABLE_CXX_17 = True + self.options["date"].header_only = True def layout(self): cmake_layout(self) diff --git a/docker/MQTTManager/include/button/nspm_button.cpp b/docker/MQTTManager/include/button/nspm_button.cpp index b50c71621..980b558be 100644 --- a/docker/MQTTManager/include/button/nspm_button.cpp +++ b/docker/MQTTManager/include/button/nspm_button.cpp @@ -18,8 +18,8 @@ NSPMButton::NSPMButton(uint32_t button_id) : ButtonEntity(button_id) { // Process Home Assistant specific details. General button data is loaded in the "Button" constructor. - if (this->_controller != MQTT_MANAGER_ENTITY_CONTROLLER::HOME_ASSISTANT) { - SPDLOG_ERROR("HomeAssistantSwitch has not been recognized as controlled by HOME_ASSISTANT. Will stop processing switch."); + if (this->_controller != MQTT_MANAGER_ENTITY_CONTROLLER::NSPM) { + SPDLOG_ERROR("NSPMButton has not been recognized as controlled by NSPM. Will stop processing button."); return; } diff --git a/docker/MQTTManager/include/command_manager/command_manager.hpp b/docker/MQTTManager/include/command_manager/command_manager.hpp index 5819ae86c..6bd0080c4 100644 --- a/docker/MQTTManager/include/command_manager/command_manager.hpp +++ b/docker/MQTTManager/include/command_manager/command_manager.hpp @@ -21,6 +21,13 @@ class CommandManager { CommandManager::_callbacks.disconnect(callback); } +#if defined(TEST_MODE) && TEST_MODE == 1 + // Number of attached command callbacks. + static size_t test_callback_count() { + return CommandManager::_callbacks.num_slots(); + } +#endif + private: static inline boost::signals2::signal _callbacks; }; diff --git a/docker/MQTTManager/include/cover/cover.cpp b/docker/MQTTManager/include/cover/cover.cpp new file mode 100644 index 000000000..c0373a034 --- /dev/null +++ b/docker/MQTTManager/include/cover/cover.cpp @@ -0,0 +1,298 @@ +#include "cover/cover.hpp" +#include "command_manager/command_manager.hpp" +#include "database_manager/database_manager.hpp" +#include "entity/entity_icons.hpp" +#include "mqtt_manager/mqtt_manager.hpp" +#include "mqtt_manager_config/mqtt_manager_config.hpp" +#include +#include +#include +#include +#include +#include +#include + +CoverEntity::CoverEntity(uint32_t cover_id) { + this->_id = cover_id; + this->_load_common_config(); + + CommandManager::attach_callback(boost::bind(&CoverEntity::command_callback, this, _1)); + + SPDLOG_DEBUG("Cover {}::{} base loaded.", this->_id, this->_name); +} + +void CoverEntity::_load_common_config() { + auto cover = database_manager::database.get(this->_id); + this->_name = cover.friendly_name; + this->_room_id = cover.room_id; + this->_entity_page_id = cover.entities_page_id; + this->_entity_page_slot = cover.room_view_position; + + nlohmann::json entity_data = cover.get_entity_data_json(); + if (entity_data.contains("invert_positions") && entity_data["invert_positions"].is_boolean()) { + this->_invert_positions = entity_data["invert_positions"]; + } + + if (entity_data.contains("position_preset1") && entity_data["position_preset1"].is_number()) { + this->_position_preset1 = entity_data["position_preset1"]; + } + if (entity_data.contains("position_preset2") && entity_data["position_preset2"].is_number()) { + this->_position_preset2 = entity_data["position_preset2"]; + } + if (entity_data.contains("position_preset3") && entity_data["position_preset3"].is_number()) { + this->_position_preset3 = entity_data["position_preset3"]; + } + + if (entity_data.contains("tilt_preset1") && entity_data["tilt_preset1"].is_number()) { + this->_tilt_preset1 = entity_data["tilt_preset1"]; + } + if (entity_data.contains("tilt_preset2") && entity_data["tilt_preset2"].is_number()) { + this->_tilt_preset2 = entity_data["tilt_preset2"]; + } + if (entity_data.contains("tilt_preset3") && entity_data["tilt_preset3"].is_number()) { + this->_tilt_preset3 = entity_data["tilt_preset3"]; + } + + if (entity_data.contains("controller") && entity_data["controller"].is_string()) { + std::string controller = entity_data["controller"]; + if (controller.compare("home_assistant") == 0) { + this->_controller = MQTT_MANAGER_ENTITY_CONTROLLER::HOME_ASSISTANT; + } else if (controller.compare("openhab") == 0) { + this->_controller = MQTT_MANAGER_ENTITY_CONTROLLER::OPENHAB; + } else { + SPDLOG_ERROR("Got unknown controller ({}) for cover {}::{}. Will default to HOME_ASSISTANT.", controller, this->_id, this->_name); + this->_controller = MQTT_MANAGER_ENTITY_CONTROLLER::HOME_ASSISTANT; + } + } else { + SPDLOG_ERROR("No controller defined for cover {}::{}. Will default to HOME_ASSISTANT.", this->_id, this->_name); + this->_controller = MQTT_MANAGER_ENTITY_CONTROLLER::HOME_ASSISTANT; + } +} + +void CoverEntity::reload_config() { + this->_load_common_config(); +} + +uint16_t CoverEntity::get_room_id() { + return this->_room_id; +} + +std::string CoverEntity::get_name() { + return this->_name; +} + +uint16_t CoverEntity::get_id() { + return this->_id; +} + +MQTT_MANAGER_ENTITY_TYPE CoverEntity::get_type() { + return MQTT_MANAGER_ENTITY_TYPE::COVER; +} + +MQTT_MANAGER_ENTITY_CONTROLLER CoverEntity::get_controller() { + return this->_controller; +} + +uint32_t CoverEntity::get_entity_page_id() { + return this->_entity_page_id; +} + +uint8_t CoverEntity::get_entity_page_slot() { + return this->_entity_page_slot; +} + +NSPanelEntityState_Cover_CoverState CoverEntity::get_state() { + return this->_state; +} + +bool CoverEntity::has_position() { + return this->_has_position; +} + +uint8_t CoverEntity::get_position() { + return this->_position; +} + +bool CoverEntity::has_tilt_position() { + return this->_has_tilt_position; +} + +uint8_t CoverEntity::get_tilt_position() { + return this->_tilt_position; +} + +bool CoverEntity::can_open() { + return this->_can_open; +} + +bool CoverEntity::can_close() { + return this->_can_close; +} + +bool CoverEntity::can_stop() { + return this->_can_stop; +} + +bool CoverEntity::can_set_position() { + return this->_can_set_position; +} + +std::string CoverEntity::get_device_class() { + return this->_device_class; +} + +void CoverEntity::send_state_update_to_nspanel() { + int position = this->_position; + if (this->_invert_positions) { + position = 100 - this->_position; + } + + int tilt_position = this->_tilt_position; + if (this->_invert_positions) { + tilt_position = 100 - this->_tilt_position; + } + + NSPanelEntityState state; + NSPanelEntityState_Cover *cover_state = state.mutable_cover(); + cover_state->set_cover_id(this->_id); + cover_state->set_name(this->_name); + cover_state->set_state(this->_state); + cover_state->set_has_position(this->_has_position); + cover_state->set_position(this->_has_position ? position : 0); + cover_state->set_has_tilt_position(this->_has_tilt_position); + cover_state->set_tilt_position(this->_has_tilt_position ? tilt_position : 0); + cover_state->set_can_open(this->_can_open); + cover_state->set_can_close(this->_can_close); + cover_state->set_can_stop(this->_can_stop); + cover_state->set_can_set_position(this->_can_set_position); + cover_state->set_can_open_tilt(this->_can_open_tilt); + cover_state->set_can_close_tilt(this->_can_close_tilt); + cover_state->set_can_stop_tilt(this->_can_stop_tilt); + cover_state->set_can_set_tilt_position(this->_can_set_tilt_position); + cover_state->set_device_class(this->_device_class); + + cover_state->set_position_preset1(this->_position_preset1); + cover_state->set_position_preset2(this->_position_preset2); + cover_state->set_position_preset3(this->_position_preset3); + + cover_state->set_tilt_preset1(this->_tilt_preset1); + cover_state->set_tilt_preset2(this->_tilt_preset2); + cover_state->set_tilt_preset3(this->_tilt_preset3); + + google::protobuf::util::MessageDifferencer differencer; + if (!differencer.Equals(this->_last_cover_state, state)) { + SPDLOG_DEBUG("Sending updated state for cover {}::{} over MQTT.", this->_id, this->_name); + this->_last_cover_state = state; + MQTT_Manager::publish_protobuf(this->get_mqtt_state_topic(), state, true); + } else { + SPDLOG_TRACE("Did not send state update for cover {}::{} as there were no changes.", this->_id, this->_name); + } +} + +void CoverEntity::command_callback(NSPanelMQTTManagerCommand &command) { + if (!command.has_cover_command() || static_cast(command.cover_command().cover_id()) != this->_id) { + return; + } + + auto cover_command = command.cover_command(); + SPDLOG_DEBUG("Received command from NSPanel for cover {}::{}.", this->_id, this->_name); + + switch (cover_command.action()) { + case NSPanelMQTTManagerCommand_CoverCommand_Action_OPEN: + this->open(); + break; + case NSPanelMQTTManagerCommand_CoverCommand_Action_CLOSE: + this->close(); + break; + case NSPanelMQTTManagerCommand_CoverCommand_Action_STOP: + this->stop(); + break; + case NSPanelMQTTManagerCommand_CoverCommand_Action_OPEN_TILT: + this->open_tilt(); + break; + case NSPanelMQTTManagerCommand_CoverCommand_Action_CLOSE_TILT: + this->close_tilt(); + break; + case NSPanelMQTTManagerCommand_CoverCommand_Action_STOP_TILT: + this->stop_tilt(); + break; + case NSPanelMQTTManagerCommand_CoverCommand_Action_NONE: + // The command only changes a position. + break; + default: + SPDLOG_WARN("Received unknown action {} for cover {}::{}.", static_cast(cover_command.action()), this->_id, this->_name); + break; + } + + if (cover_command.has_position()) { + int requested_pos = std::clamp(cover_command.position(), 0, 100); + if (this->_invert_positions) { + requested_pos = 100 - std::clamp(cover_command.position(), 0, 100); + } + + this->set_position(static_cast(requested_pos)); + } + if (cover_command.has_tilt_position()) { + int requested_pos = std::clamp(cover_command.tilt_position(), 0, 100); + if (this->_invert_positions) { + requested_pos = 100 - std::clamp(cover_command.tilt_position(), 0, 100); + } + + this->set_tilt_position(requested_pos); + } +} + +bool CoverEntity::can_toggle() { + // A dedicated cover page is the primary UI. Until that firmware page is installed, allow the + // generic entities-page icon to open/close blinds and shutters. Never quick-toggle a garage + // door, gate or door from a single tap. + if (this->_state == NSPanelEntityState_Cover_CoverState_UNKNOWN || this->_state == NSPanelEntityState_Cover_CoverState_UNAVAILABLE) { + return false; + } + if (this->_device_class.compare("garage") == 0 || this->_device_class.compare("gate") == 0 || this->_device_class.compare("door") == 0) { + return false; + } + if (this->_state == NSPanelEntityState_Cover_CoverState_OPENING || this->_state == NSPanelEntityState_Cover_CoverState_CLOSING) { + return this->_can_stop; + } + bool open = this->_has_position ? this->_position > 0 : this->_state == NSPanelEntityState_Cover_CoverState_OPEN; + return open ? this->_can_close : this->_can_open; +} + +void CoverEntity::toggle() { + if (!this->can_toggle()) { + return; + } + if (this->_state == NSPanelEntityState_Cover_CoverState_OPENING || this->_state == NSPanelEntityState_Cover_CoverState_CLOSING) { + this->stop(); + } else if (this->_has_position ? this->_position == 0 : this->_state == NSPanelEntityState_Cover_CoverState_CLOSED) { + this->open(); + } else { + this->close(); + } +} + +std::string_view CoverEntity::get_icon() { + return EntityIcons::entity_icon_blinds; +} + +uint16_t CoverEntity::get_icon_color() { + bool open = this->_state != NSPanelEntityState_Cover_CoverState_UNAVAILABLE && this->_state != NSPanelEntityState_Cover_CoverState_UNKNOWN && + (this->_has_position ? this->_position > 0 : this->_state == NSPanelEntityState_Cover_CoverState_OPEN); + return open ? GUI_Colors::icon_color_on : GUI_Colors::icon_color_off; +} + +uint16_t CoverEntity::get_icon_active_color() { + return this->get_icon_color(); +} + +std::string CoverEntity::get_mqtt_state_topic() { + std::string manager_address = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MANAGER_ADDRESS); + return fmt::format("nspanel/mqttmanager_{}/entities/covers/{}/state", manager_address, this->get_id()); +} + +CoverEntity::~CoverEntity() { + SPDLOG_DEBUG("Destructor for cover {}::{} called.", this->_id, this->_name); + this->_signal_entity_destroyed(); + CommandManager::detach_callback(boost::bind(&CoverEntity::command_callback, this, _1)); +} diff --git a/docker/MQTTManager/include/cover/cover.hpp b/docker/MQTTManager/include/cover/cover.hpp new file mode 100644 index 000000000..19ea5a6ef --- /dev/null +++ b/docker/MQTTManager/include/cover/cover.hpp @@ -0,0 +1,134 @@ +#ifndef MQTT_MANAGER_COVER_HPP +#define MQTT_MANAGER_COVER_HPP + +#include "protobuf_nspanel.pb.h" +#include +#include +#include +#include +#include + +class CoverEntity : public MqttManagerEntity { +public: + CoverEntity(uint32_t cover_id); + + /** + * Update the common config of the cover from the DB. + */ + virtual void reload_config(); + + /** + * Get the room ID of the cover. + */ + uint16_t get_room_id(); + + /** + * Get the friendly name of the cover. + */ + std::string get_name(); + + /** + * Send the current state to the NSPanels via MQTT as a retained protobuf message. + */ + void send_state_update_to_nspanel(); + + /** + * Callback for NSPanelMQTTManagerCommand protobuf received from MQTT. + */ + void command_callback(NSPanelMQTTManagerCommand &command); + + /** + * Open the cover. + */ + virtual void open() = 0; + + /** + * Close the cover. + */ + virtual void close() = 0; + + /** + * Stop the cover. + */ + virtual void stop() = 0; + + /** + * Move the cover to a position. + * @param position: 0 = closed, 100 = open. + */ + virtual void set_position(uint8_t position) = 0; + + virtual void open_tilt() = 0; + virtual void close_tilt() = 0; + virtual void stop_tilt() = 0; + virtual void set_tilt_position(uint8_t position) = 0; + + uint16_t get_id(); + MQTT_MANAGER_ENTITY_TYPE get_type(); + MQTT_MANAGER_ENTITY_CONTROLLER get_controller(); + uint32_t get_entity_page_id(); + uint8_t get_entity_page_slot(); + bool can_toggle(); + void toggle(); + std::string_view get_icon(); + uint16_t get_icon_color(); + uint16_t get_icon_active_color(); + std::string get_mqtt_state_topic(); + + // Current state, for tests and for the controller implementations. + NSPanelEntityState_Cover_CoverState get_state(); + bool has_position(); + uint8_t get_position(); + bool has_tilt_position(); + uint8_t get_tilt_position(); + bool can_open(); + bool can_close(); + bool can_stop(); + bool can_set_position(); + std::string get_device_class(); + + virtual ~CoverEntity(); + +protected: + /** + * Read the common fields from the database row. + */ + void _load_common_config(); + + uint32_t _id; + std::string _name; + uint16_t _room_id; + MQTT_MANAGER_ENTITY_CONTROLLER _controller; + uint32_t _entity_page_id; + uint8_t _entity_page_slot; + + NSPanelEntityState_Cover_CoverState _state = NSPanelEntityState_Cover_CoverState_UNKNOWN; + NSPanelEntityState_Cover_CoverState _tilt_state = NSPanelEntityState_Cover_CoverState_UNKNOWN; + bool _has_position = false; + uint8_t _position = 0; + bool _has_tilt_position = false; + uint8_t _tilt_position = 0; + + bool _can_open = false; + bool _can_close = false; + bool _can_stop = false; + bool _can_set_position = false; + bool _can_open_tilt = false; + bool _can_close_tilt = false; + bool _can_stop_tilt = false; + bool _can_set_tilt_position = false; + bool _invert_positions = false; + + int32_t _position_preset1 = 0; + int32_t _position_preset2 = 0; + int32_t _position_preset3 = 0; + int32_t _tilt_preset1 = 0; + int32_t _tilt_preset2 = 0; + int32_t _tilt_preset3 = 0; + + std::string _device_class; + + NSPanelEntityState _last_cover_state; +}; + +#endif // !MQTT_MANAGER_COVER_HPP diff --git a/docker/MQTTManager/include/cover/home_assistant_cover.cpp b/docker/MQTTManager/include/cover/home_assistant_cover.cpp new file mode 100644 index 000000000..6f24663f4 --- /dev/null +++ b/docker/MQTTManager/include/cover/home_assistant_cover.cpp @@ -0,0 +1,242 @@ +#include "cover/home_assistant_cover.hpp" +#include "database_manager/database_manager.hpp" +#include "entity/entity.hpp" +#include "home_assistant_manager/home_assistant_manager.hpp" +#include +#include +#include +#include +#include + +HomeAssistantCover::HomeAssistantCover(uint32_t cover_id) : CoverEntity(cover_id) { + if (this->_controller != MQTT_MANAGER_ENTITY_CONTROLLER::HOME_ASSISTANT) { + SPDLOG_ERROR("HomeAssistantCover {}::{} has not been recognized as controlled by HOME_ASSISTANT. Will stop processing cover.", this->_id, this->_name); + return; + } + + if (!this->_load_home_assistant_config()) { + return; + } + + SPDLOG_DEBUG("Loaded cover {}::{}, home assistant entity ID: {}", this->_id, this->_name, this->_home_assistant_name); + HomeAssistantManager::attach_event_observer(this->_home_assistant_name, boost::bind(&HomeAssistantCover::home_assistant_event_callback, this, _1)); + + this->send_state_update_to_nspanel(); +} + +HomeAssistantCover::~HomeAssistantCover() { + if (!this->_home_assistant_name.empty()) { + HomeAssistantManager::detach_event_observer(this->_home_assistant_name, boost::bind(&HomeAssistantCover::home_assistant_event_callback, this, _1)); + } +} + +bool HomeAssistantCover::_load_home_assistant_config() { + auto cover = database_manager::database.get(this->_id); + nlohmann::json entity_data = cover.get_entity_data_json(); + + if (entity_data.contains("home_assistant_name") && entity_data["home_assistant_name"].is_string()) { + this->_home_assistant_name = entity_data["home_assistant_name"]; + } else { + SPDLOG_ERROR("No Home Assistant name defined for cover {}::{}", this->_id, this->_name); + this->_home_assistant_name.clear(); + return false; + } + + if (this->_home_assistant_name.rfind("cover.", 0) != 0) { + SPDLOG_ERROR("Unknown type of Home Assistant entity '{}' for cover {}::{}. Expected cover.*.", this->_home_assistant_name, this->_id, this->_name); + this->_home_assistant_name.clear(); + return false; + } + + return true; +} + +void HomeAssistantCover::reload_config() { + CoverEntity::reload_config(); + + std::string previous_name = this->_home_assistant_name; + if (!this->_load_home_assistant_config()) { + if (!previous_name.empty()) { + HomeAssistantManager::detach_event_observer(previous_name, boost::bind(&HomeAssistantCover::home_assistant_event_callback, this, _1)); + } + this->send_state_update_to_nspanel(); + return; + } + + if (previous_name != this->_home_assistant_name) { + if (!previous_name.empty()) { + HomeAssistantManager::detach_event_observer(previous_name, boost::bind(&HomeAssistantCover::home_assistant_event_callback, this, _1)); + } + HomeAssistantManager::attach_event_observer(this->_home_assistant_name, boost::bind(&HomeAssistantCover::home_assistant_event_callback, this, _1)); + } + + this->send_state_update_to_nspanel(); +} + +void HomeAssistantCover::_call_service(const std::string &service, nlohmann::json service_data) { + nlohmann::json command = { + {"type", "call_service"}, + {"domain", "cover"}, + {"target", {{"entity_id", this->_home_assistant_name}}}, + {"service", service}, + }; + if (!service_data.empty()) { + command["service_data"] = service_data; + } + HomeAssistantManager::send_json(command); +} + +void HomeAssistantCover::open() { + if (!this->_can_open) { + SPDLOG_WARN("Asked to open cover {}::{} but Home Assistant does not report the open feature.", this->_id, this->_name); + return; + } + this->_call_service("open_cover"); +} + +void HomeAssistantCover::close() { + if (!this->_can_close) { + SPDLOG_WARN("Asked to close cover {}::{} but Home Assistant does not report the close feature.", this->_id, this->_name); + return; + } + this->_call_service("close_cover"); +} + +void HomeAssistantCover::stop() { + if (!this->_can_stop) { + SPDLOG_WARN("Asked to stop cover {}::{} but Home Assistant does not report the stop feature.", this->_id, this->_name); + return; + } + this->_call_service("stop_cover"); +} + +void HomeAssistantCover::set_position(uint8_t position) { + if (!this->_can_set_position) { + SPDLOG_WARN("Asked to set position of cover {}::{} but Home Assistant does not report the set position feature.", this->_id, this->_name); + return; + } + SPDLOG_DEBUG("Setting cover {}::{} to position {}%", this->_id, this->_name, position); + this->_call_service("set_cover_position", {{"position", position}}); +} + +void HomeAssistantCover::open_tilt() { + if (!this->_can_open_tilt) { + SPDLOG_WARN("Asked to open tilt of cover {}::{} but Home Assistant does not report the open tilt feature.", this->_id, this->_name); + return; + } + this->_call_service("open_cover_tilt"); +} + +void HomeAssistantCover::close_tilt() { + if (!this->_can_close_tilt) { + SPDLOG_WARN("Asked to close tilt of cover {}::{} but Home Assistant does not report the close tilt feature.", this->_id, this->_name); + return; + } + this->_call_service("close_cover_tilt"); +} + +void HomeAssistantCover::stop_tilt() { + if (!this->_can_stop_tilt) { + SPDLOG_WARN("Asked to stop tilt of cover {}::{} but Home Assistant does not report the stop tilt feature.", this->_id, this->_name); + return; + } + this->_call_service("stop_cover_tilt"); +} + +void HomeAssistantCover::set_tilt_position(uint8_t position) { + if (!this->_can_set_tilt_position) { + SPDLOG_WARN("Asked to set tilt position of cover {}::{} but Home Assistant does not report the set tilt position feature.", this->_id, this->_name); + return; + } + SPDLOG_DEBUG("Setting cover {}::{} to tilt {}%", this->_id, this->_name, position); + this->_call_service("set_cover_tilt_position", {{"tilt_position", position}}); +} + +void HomeAssistantCover::home_assistant_event_callback(nlohmann::json data) { + if (!data.contains("event") || !data["event"].contains("event_type") || !data["event"].contains("data") || !data["event"]["data"].contains("entity_id")) { + SPDLOG_ERROR("Cover {}::{} received malformed event data from Home Assistant.", this->_id, this->_name); + return; + } + if (std::string(data["event"]["event_type"]).compare("state_changed") != 0 || std::string(data["event"]["data"]["entity_id"]).compare(this->_home_assistant_name) != 0) { + return; + } + + uint16_t previous_icon_color = this->get_icon_color(); + + try { + nlohmann::json new_state_data = data["event"]["data"]["new_state"]; + if (new_state_data.is_null()) { + // Entity was removed from Home Assistant. + this->_state = NSPanelEntityState_Cover_CoverState_UNAVAILABLE; + this->_has_position = false; + this->_has_tilt_position = false; + this->_can_open = false; + this->_can_close = false; + this->_can_stop = false; + this->_can_set_position = false; + this->_can_open_tilt = false; + this->_can_close_tilt = false; + this->_can_stop_tilt = false; + this->_can_set_tilt_position = false; + this->_device_class.clear(); + } else { + std::string new_state = new_state_data.contains("state") && new_state_data["state"].is_string() ? new_state_data["state"].get() : ""; + if (new_state.compare("open") == 0) { + this->_state = NSPanelEntityState_Cover_CoverState_OPEN; + } else if (new_state.compare("closed") == 0) { + this->_state = NSPanelEntityState_Cover_CoverState_CLOSED; + } else if (new_state.compare("opening") == 0) { + this->_state = NSPanelEntityState_Cover_CoverState_OPENING; + } else if (new_state.compare("closing") == 0) { + this->_state = NSPanelEntityState_Cover_CoverState_CLOSING; + } else if (new_state.compare("unavailable") == 0) { + this->_state = NSPanelEntityState_Cover_CoverState_UNAVAILABLE; + } else { + this->_state = NSPanelEntityState_Cover_CoverState_UNKNOWN; + } + + if (new_state_data.contains("attributes") && new_state_data["attributes"].is_object()) { + nlohmann::json attributes = new_state_data["attributes"]; + + if (attributes.contains("current_position") && attributes["current_position"].is_number()) { + double position = attributes["current_position"].get(); + this->_position = static_cast(std::clamp(std::lround(position), 0, 100)); + this->_has_position = true; + } + if (attributes.contains("current_tilt_position") && attributes["current_tilt_position"].is_number()) { + double position = attributes["current_tilt_position"].get(); + this->_tilt_position = static_cast(std::clamp(std::lround(position), 0, 100)); + this->_has_tilt_position = true; + } + + uint32_t supported_features = 0; + if (attributes.contains("supported_features") && attributes["supported_features"].is_number()) { + int64_t value = attributes["supported_features"].get(); + supported_features = static_cast(std::max(value, 0)); + } + this->_can_open = supported_features & HomeAssistantCover::feature_open; + this->_can_close = supported_features & HomeAssistantCover::feature_close; + this->_can_stop = supported_features & HomeAssistantCover::feature_stop; + this->_can_set_position = supported_features & HomeAssistantCover::feature_set_position; + this->_can_open_tilt = supported_features & HomeAssistantCover::feature_open_tilt; + this->_can_close_tilt = supported_features & HomeAssistantCover::feature_close_tilt; + this->_can_stop_tilt = supported_features & HomeAssistantCover::feature_stop_tilt; + this->_can_set_tilt_position = supported_features & HomeAssistantCover::feature_set_tilt_position; + + if (attributes.contains("device_class") && attributes["device_class"].is_string()) { + this->_device_class = attributes["device_class"]; + } else { + this->_device_class.clear(); + } + } + } + } catch (std::exception &e) { + SPDLOG_ERROR("Caught exception while processing Home Assistant cover {}::{} event: {}", this->_id, this->_name, e.what()); + return; + } + + this->send_state_update_to_nspanel(); + if (previous_icon_color != this->get_icon_color()) { + this->_signal_entity_changed(); + } +} diff --git a/docker/MQTTManager/include/cover/home_assistant_cover.hpp b/docker/MQTTManager/include/cover/home_assistant_cover.hpp new file mode 100644 index 000000000..7cb36be5c --- /dev/null +++ b/docker/MQTTManager/include/cover/home_assistant_cover.hpp @@ -0,0 +1,49 @@ +#ifndef MQTT_MANAGER_HOME_ASSISTANT_COVER_HPP +#define MQTT_MANAGER_HOME_ASSISTANT_COVER_HPP + +#include "cover.hpp" +#include +#include + +class HomeAssistantCover : public CoverEntity { +public: + HomeAssistantCover(uint32_t cover_id); + ~HomeAssistantCover(); + void reload_config(); + void home_assistant_event_callback(nlohmann::json event_data); + + void open(); + void close(); + void stop(); + void set_position(uint8_t position); + void open_tilt(); + void close_tilt(); + void stop_tilt(); + void set_tilt_position(uint8_t position); + +private: + /** + * Load the Home Assistant entity id from entity_data. + * @return true on success. + */ + bool _load_home_assistant_config(); + + /** + * Call a "cover" domain service in Home Assistant. + */ + void _call_service(const std::string &service, nlohmann::json service_data = nlohmann::json::object()); + + std::string _home_assistant_name; + + // Home Assistant CoverEntityFeature bits. + static constexpr uint32_t feature_open = 1; + static constexpr uint32_t feature_close = 2; + static constexpr uint32_t feature_set_position = 4; + static constexpr uint32_t feature_stop = 8; + static constexpr uint32_t feature_open_tilt = 16; + static constexpr uint32_t feature_close_tilt = 32; + static constexpr uint32_t feature_stop_tilt = 64; + static constexpr uint32_t feature_set_tilt_position = 128; +}; + +#endif // !MQTT_MANAGER_HOME_ASSISTANT_COVER_HPP diff --git a/docker/MQTTManager/include/cover/openhab_cover.cpp b/docker/MQTTManager/include/cover/openhab_cover.cpp new file mode 100644 index 000000000..721291017 --- /dev/null +++ b/docker/MQTTManager/include/cover/openhab_cover.cpp @@ -0,0 +1,317 @@ +#include "cover/openhab_cover.hpp" +#include "database_manager/database_manager.hpp" +#include "entity/entity.hpp" +#include "openhab_manager/openhab_manager.hpp" +#include +#include +#include +#include +#include +#include +#include +#include + +OpenhabCover::OpenhabCover(uint32_t cover_id) : CoverEntity(cover_id) { + if (this->_controller != MQTT_MANAGER_ENTITY_CONTROLLER::OPENHAB) { + SPDLOG_ERROR("OpenhabCover {}::{} has not been recognized as controlled by OPENHAB. Will stop processing cover.", this->_id, this->_name); + return; + } + + if (!this->_load_openhab_config()) { + return; + } + + this->_can_open = !this->_openhab_item.empty(); + this->_can_close = !this->_openhab_item.empty(); + this->_can_stop = !this->_openhab_item.empty(); + this->_has_position = !this->_openhab_item.empty(); + + this->_can_open_tilt = !this->_openhab_tilt_item.empty(); + this->_can_close_tilt = !this->_openhab_tilt_item.empty(); + this->_can_stop_tilt = !this->_openhab_tilt_item.empty(); // + this->_has_tilt_position = !this->_openhab_tilt_item.empty(); // + + SPDLOG_DEBUG("Loaded cover {}::{}, OpenHAB item: {}", this->_id, this->_name, this->_openhab_item); + OpenhabManager::attach_event_observer(this->_openhab_item, boost::bind(&OpenhabCover::openhab_event_callback, this, _1)); + + this->send_state_update_to_nspanel(); +} + +OpenhabCover::~OpenhabCover() { + if (!this->_openhab_item.empty()) { + OpenhabManager::detach_event_observer(this->_openhab_item, boost::bind(&OpenhabCover::openhab_event_callback, this, _1)); + } +} + +bool OpenhabCover::_load_openhab_config() { + auto cover = database_manager::database.get(this->_id); + nlohmann::json entity_data = cover.get_entity_data_json(); + + if (entity_data.contains("openhab_item") && entity_data["openhab_item"].is_string()) { + this->_openhab_item = entity_data["openhab_item"]; + } else { + SPDLOG_ERROR("No OpenHAB item defined for cover {}::{}", this->_id, this->_name); + this->_openhab_item.clear(); + return false; + } + + if (this->_openhab_item.empty()) { + SPDLOG_ERROR("Empty OpenHAB item defined for cover {}::{}", this->_id, this->_name); + return false; + } + + return true; +} + +void OpenhabCover::reload_config() { + CoverEntity::reload_config(); + + std::string previous_item = this->_openhab_item; + std::string previous_tilt_item = this->_openhab_tilt_item; + if (!this->_load_openhab_config()) { + if (!previous_item.empty()) { + OpenhabManager::detach_event_observer(previous_item, boost::bind(&OpenhabCover::openhab_event_callback, this, _1)); + } + if (!previous_tilt_item.empty()) { + OpenhabManager::detach_event_observer(previous_tilt_item, boost::bind(&OpenhabCover::openhab_tilt_event_callback, this, _1)); + } + + this->send_state_update_to_nspanel(); + return; + } + + if (previous_item != this->_openhab_item) { + if (!previous_item.empty()) { + OpenhabManager::detach_event_observer(previous_item, boost::bind(&OpenhabCover::openhab_event_callback, this, _1)); + } + OpenhabManager::attach_event_observer(this->_openhab_item, boost::bind(&OpenhabCover::openhab_tilt_event_callback, this, _1)); + } + + if (previous_tilt_item != this->_openhab_tilt_item) { + if (!previous_tilt_item.empty()) { + OpenhabManager::detach_event_observer(previous_tilt_item, boost::bind(&OpenhabCover::openhab_event_callback, this, _1)); + } + OpenhabManager::attach_event_observer(this->_openhab_tilt_item, boost::bind(&OpenhabCover::openhab_tilt_event_callback, this, _1)); + } + + this->send_state_update_to_nspanel(); +} + +void OpenhabCover::_send_command(const std::string &type, const std::string &value) { + nlohmann::json event_data; + event_data["type"] = "ItemCommandEvent"; + event_data["topic"] = fmt::format("openhab/items/{}/command", this->_openhab_item); + nlohmann::json payload; + payload["type"] = type; + payload["value"] = value; + event_data["payload"] = payload.dump(); + OpenhabManager::send_json(event_data); +} + +void OpenhabCover::_send_tilt_command(const std::string &type, const std::string &value) { + nlohmann::json event_data; + event_data["type"] = "ItemCommandEvent"; + event_data["topic"] = fmt::format("openhab/items/{}/command", this->_openhab_tilt_item); + nlohmann::json payload; + payload["type"] = type; + payload["value"] = value; + event_data["payload"] = payload.dump(); + OpenhabManager::send_json(event_data); +} + +void OpenhabCover::open() { + this->_send_command("UpDown", "UP"); +} + +void OpenhabCover::close() { + this->_send_command("UpDown", "DOWN"); +} + +void OpenhabCover::stop() { + this->_send_command("StopMove", "STOP"); +} + +void OpenhabCover::set_position(uint8_t position) { + // The panel uses 0 = closed, 100 = open; OpenHAB uses the reverse. + this->_send_command("Percent", std::to_string(100 - position)); +} + +void OpenhabCover::open_tilt() { + this->_send_tilt_command("UpDown", "UP"); +} + +void OpenhabCover::close_tilt() { + this->_send_tilt_command("UpDown", "DOWN"); +} + +void OpenhabCover::stop_tilt() { + this->_send_tilt_command("StopMove", "STOP"); +} + +void OpenhabCover::set_tilt_position(uint8_t position) { + SPDLOG_WARN("OpenHAB cover {}::{} does not support tilt.", this->_id, this->_name); + this->_send_tilt_command("Percent", std::to_string(100 - position)); +} + +void OpenhabCover::_update_from_state(const nlohmann::json &state) { + uint16_t previous_icon_color = this->get_icon_color(); + + if (state.is_string()) { + std::string value = state; + if (value.compare("NULL") == 0 || value.compare("UNDEF") == 0) { + this->_state = NSPanelEntityState_Cover_CoverState_UNAVAILABLE; + this->_has_position = false; + this->send_state_update_to_nspanel(); + if (previous_icon_color != this->get_icon_color()) { + this->_signal_entity_changed(); + } + return; + } + + try { + double percentage = std::stod(value); + percentage = std::clamp(percentage, 0.0, 100.0); + uint8_t openness = static_cast(std::clamp(std::lround(100.0 - percentage), 0, 100)); + + this->_has_position = true; + this->_position = openness; + if (percentage <= 0.0) { + this->_state = NSPanelEntityState_Cover_CoverState_OPEN; + } else if (percentage >= 100.0) { + this->_state = NSPanelEntityState_Cover_CoverState_CLOSED; + } else { + this->_state = NSPanelEntityState_Cover_CoverState_OPEN; + } + this->_can_stop = true; + this->_can_set_position = true; + this->_device_class = "shutter"; + } catch (std::exception &e) { + SPDLOG_ERROR("Could not parse OpenHAB cover state '{}' for {}::{}: {}", value, this->_id, this->_name, e.what()); + return; + } + } else if (state.is_number()) { + this->_update_from_state(nlohmann::json(std::to_string(state.get()))); + return; + } else { + SPDLOG_WARN("Unsupported OpenHAB cover state for {}::{}: {}", this->_id, this->_name, state.dump()); + return; + } + + this->send_state_update_to_nspanel(); + if (previous_icon_color != this->get_icon_color()) { + this->_signal_entity_changed(); + } +} + +void OpenhabCover::_update_from_tilt_state(const nlohmann::json &state) { + + if (state.is_string()) { + std::string value = state; + if (value.compare("NULL") == 0 || value.compare("UNDEF") == 0) { + this->_state = NSPanelEntityState_Cover_CoverState_UNAVAILABLE; + this->_has_tilt_position = false; + this->send_state_update_to_nspanel(); + return; + } + + try { + double percentage = std::stod(value); + percentage = std::clamp(percentage, 0.0, 100.0); + uint8_t openness = static_cast(std::clamp(std::lround(100.0 - percentage), 0, 100)); + + this->_has_tilt_position = true; + this->_tilt_position = openness; + if (percentage <= 0.0) { + this->_tilt_state = NSPanelEntityState_Cover_CoverState_OPEN; + } else if (percentage >= 100.0) { + this->_tilt_state = NSPanelEntityState_Cover_CoverState_CLOSED; + } else { + this->_tilt_state = NSPanelEntityState_Cover_CoverState_OPEN; + } + this->_can_set_tilt_position = true; + } catch (std::exception &e) { + SPDLOG_ERROR("Could not parse OpenHAB cover state '{}' for {}::{}: {}", value, this->_id, this->_name, e.what()); + return; + } + } else if (state.is_number()) { + this->_update_from_tilt_state(nlohmann::json(std::to_string(state.get()))); + return; + } else { + SPDLOG_WARN("Unsupported OpenHAB cover state for {}::{}: {}", this->_id, this->_name, state.dump()); + return; + } + + this->send_state_update_to_nspanel(); +} + +void OpenhabCover::openhab_event_callback(nlohmann::json data) { + if (!data.contains("type")) { + return; + } + + std::string type = data["type"]; + if (type.compare("ItemStateChangedEvent") == 0) { + if (!data.contains("topic") || !data.contains("payload")) { + return; + } + std::string topic = data["topic"]; + std::vector topic_parts; + boost::split(topic_parts, topic, boost::is_any_of("/")); + if (topic_parts.size() < 3 || topic_parts[2].compare(this->_openhab_item) != 0) { + return; + } + + try { + nlohmann::json payload = nlohmann::json::parse(std::string(data["payload"])); + if (payload.contains("value")) { + this->_update_from_state(payload["value"]); + } + } catch (std::exception &e) { + SPDLOG_ERROR("Could not parse OpenHAB state event for cover {}::{}: {}", this->_id, this->_name, e.what()); + } + } else if (type.compare("ItemStateFetched") == 0) { + if (!data.contains("payload") || !data["payload"].contains("name") || !data["payload"].contains("state")) { + return; + } + if (std::string(data["payload"]["name"]).compare(this->_openhab_item) != 0) { + return; + } + this->_update_from_state(data["payload"]["state"]); + } +} + +void OpenhabCover::openhab_tilt_event_callback(nlohmann::json data) { + if (!data.contains("type")) { + return; + } + + std::string type = data["type"]; + if (type.compare("ItemStateChangedEvent") == 0) { + if (!data.contains("topic") || !data.contains("payload")) { + return; + } + std::string topic = data["topic"]; + std::vector topic_parts; + boost::split(topic_parts, topic, boost::is_any_of("/")); + if (topic_parts.size() < 3 || topic_parts[2].compare(this->_openhab_item) != 0) { + return; + } + + try { + nlohmann::json payload = nlohmann::json::parse(std::string(data["payload"])); + if (payload.contains("value")) { + this->_update_from_state(payload["value"]); + } + } catch (std::exception &e) { + SPDLOG_ERROR("Could not parse OpenHAB state event for cover {}::{}: {}", this->_id, this->_name, e.what()); + } + } else if (type.compare("ItemStateFetched") == 0) { + if (!data.contains("payload") || !data["payload"].contains("name") || !data["payload"].contains("state")) { + return; + } + if (std::string(data["payload"]["name"]).compare(this->_openhab_item) != 0) { + return; + } + this->_update_from_state(data["payload"]["state"]); + } +} diff --git a/docker/MQTTManager/include/cover/openhab_cover.hpp b/docker/MQTTManager/include/cover/openhab_cover.hpp new file mode 100644 index 000000000..57dd0f6f1 --- /dev/null +++ b/docker/MQTTManager/include/cover/openhab_cover.hpp @@ -0,0 +1,56 @@ +#ifndef MQTT_MANAGER_OPENHAB_COVER_HPP +#define MQTT_MANAGER_OPENHAB_COVER_HPP + +#include "cover.hpp" +#include +#include + +class OpenhabCover : public CoverEntity { +public: + OpenhabCover(uint32_t cover_id); + ~OpenhabCover(); + void reload_config(); + void openhab_event_callback(nlohmann::json event_data); + void openhab_tilt_event_callback(nlohmann::json event_data); + + void open(); + void close(); + void stop(); + void set_position(uint8_t position); + void open_tilt(); + void close_tilt(); + void stop_tilt(); + void set_tilt_position(uint8_t position); + +private: + /** + * Load the OpenHAB item name from entity_data. + * @return true on success. + */ + bool _load_openhab_config(); + + /** + * Send an ItemCommandEvent to OpenHAB. + */ + void _send_command(const std::string &type, const std::string &value); + + /** + * Send an ItemCommandEvent to OpenHAB. + */ + void _send_tilt_command(const std::string &type, const std::string &value); + + /** + * Update the panel state from a Rollershutter percentage state. + */ + void _update_from_state(const nlohmann::json &state); + + /** + * Update the panel state from a Rollershutter percentage state. + */ + void _update_from_tilt_state(const nlohmann::json &state); + + std::string _openhab_item; + std::string _openhab_tilt_item; +}; + +#endif // !MQTT_MANAGER_OPENHAB_COVER_HPP diff --git a/docker/MQTTManager/include/database_manager/database_manager.hpp b/docker/MQTTManager/include/database_manager/database_manager.hpp index 41b4a76dc..87a1a4206 100644 --- a/docker/MQTTManager/include/database_manager/database_manager.hpp +++ b/docker/MQTTManager/include/database_manager/database_manager.hpp @@ -103,10 +103,18 @@ struct Entity { void set_entity_data_json(const nlohmann::json &json); }; +// How long a query waits for the web interface to release its lock on the database before +// failing with "database is locked". Matches the "timeout" the web interface uses (settings.py). +static constexpr int DATABASE_BUSY_TIMEOUT_MS = 20000; + +// `database` below is static, so each translation unit that includes this header has its own +// storage, with its own connections. Anything that must apply to every connection is set +// here, where each of those copies is made. +static inline auto make_database() { #if defined(TEST_MODE) && TEST_MODE == 1 -static inline auto database = sqlite_orm::make_storage("/tmp/nspanelmanager_db_test.sqlite3", + auto storage = sqlite_orm::make_storage("/tmp/nspanelmanager_db_test.sqlite3", #else -static inline auto database = sqlite_orm::make_storage("/data/nspanelmanager_db.sqlite3", + auto storage = sqlite_orm::make_storage("/data/nspanelmanager_db.sqlite3", #endif sqlite_orm::make_table("web_roomentitiespage", sqlite_orm::make_column("id", &RoomEntitiesPage::id, sqlite_orm::primary_key().autoincrement()), @@ -175,6 +183,15 @@ static inline auto database = sqlite_orm::make_storage("/data/nspanelmanager_db. sqlite_orm::make_column("entities_page_id", &Entity::entities_page_id), sqlite_orm::make_column("entity_data", &Entity::entity_data), sqlite_orm::make_column("room_id", &Entity::room_id))); + // Without a busy timeout SQLite fails at once while the web interface is writing. A save + // in the web interface is also what triggers a reload, so a reload often reads while the + // write that triggered it is still committing. The failed reads used to return settings + // as empty strings, and std::stoi("") then aborted MQTTManager. + storage.on_open = [](sqlite3 *db) { sqlite3_busy_timeout(db, DATABASE_BUSY_TIMEOUT_MS); }; + return storage; +} + +static inline auto database = make_database(); static void init() { diff --git a/docker/MQTTManager/include/entity/entity.hpp b/docker/MQTTManager/include/entity/entity.hpp index 4ce991659..06a7511fb 100644 --- a/docker/MQTTManager/include/entity/entity.hpp +++ b/docker/MQTTManager/include/entity/entity.hpp @@ -12,6 +12,8 @@ enum MQTT_MANAGER_ENTITY_TYPE { BUTTON, THERMOSTAT, SCENE, + MEDIA_PLAYER, + COVER, }; enum MQTT_MANAGER_ENTITY_CONTROLLER { diff --git a/docker/MQTTManager/include/entity/entity_icons.hpp b/docker/MQTTManager/include/entity/entity_icons.hpp index 50d454b4b..e71ce4fad 100644 --- a/docker/MQTTManager/include/entity/entity_icons.hpp +++ b/docker/MQTTManager/include/entity/entity_icons.hpp @@ -6,6 +6,8 @@ class EntityIcons { static constexpr const char *entity_icon_switch_on = "s"; static constexpr const char *entity_icon_switch_off = "t"; static constexpr const char *entity_icon_button = "z"; + static constexpr const char *entity_icon_blinds = ";"; + static constexpr const char *media_player = "<"; // Misc Icons static constexpr const char *save_icon = "w"; diff --git a/docker/MQTTManager/include/entity_manager/entity_manager.cpp b/docker/MQTTManager/include/entity_manager/entity_manager.cpp index 875ad4ac5..51688f519 100644 --- a/docker/MQTTManager/include/entity_manager/entity_manager.cpp +++ b/docker/MQTTManager/include/entity_manager/entity_manager.cpp @@ -2,12 +2,16 @@ #include "button/home_assistant_button.hpp" #include "button/nspm_button.hpp" #include "command_manager/command_manager.hpp" +#include "cover/cover.hpp" +#include "cover/home_assistant_cover.hpp" +#include "cover/openhab_cover.hpp" #include "entity/entity.hpp" #include "light/home_assistant_light.hpp" #include "light/light.hpp" #include "light/openhab_light.hpp" +#include "media_player/home_assistant_media_player.hpp" +#include "media_player/media_player.hpp" #include "mqtt_manager/mqtt_manager.hpp" -#include "protobuf_general.pb.h" #include "protobuf_nspanel.pb.h" #include "room/room.hpp" #include "room/room_entities_page.hpp" @@ -27,14 +31,12 @@ #include #include #include -#include #include #include #include #include #include #include -#include #include #include #include @@ -88,6 +90,8 @@ void EntityManager::load_entities() { EntityManager::load_lights(); EntityManager::load_buttons(); EntityManager::load_thermostats(); + EntityManager::load_media_players(); + EntityManager::load_covers(); EntityManager::load_switches(); EntityManager::load_scenes(); EntityManager::load_global_room_entities_pages(); @@ -104,6 +108,7 @@ void EntityManager::load_entities() { // publish with an empty payload clears the retained message on the broker. // Without this call, panels would never receive the aggregate until the next // light-state change. + EntityManager::_send_websocket_state_update(); EntityManager::_room_updated_callback(nullptr); } @@ -120,10 +125,13 @@ void EntityManager::load_rooms() { SPDLOG_INFO("Loading {} rooms.", room_ids.size()); // Remove room if it does no longer exist - EntityManager::_rooms.erase(std::remove_if(EntityManager::_rooms.begin(), EntityManager::_rooms.end(), [&room_ids](auto room) { - return std::find_if(room_ids.begin(), room_ids.end(), [&room](auto id) { return id == room->get_id(); }) == room_ids.end(); - }), - EntityManager::_rooms.end()); + { + std::lock_guard mutex_guard(EntityManager::_rooms_mutex); + EntityManager::_rooms.erase(std::remove_if(EntityManager::_rooms.begin(), EntityManager::_rooms.end(), [&room_ids](auto room) { + return std::find_if(room_ids.begin(), room_ids.end(), [&room](auto id) { return id == room->get_id(); }) == room_ids.end(); + }), + EntityManager::_rooms.end()); + } // Cause existing room to reload config or add a new room if it does not exist. for (auto &room_id : room_ids) { @@ -141,6 +149,7 @@ void EntityManager::load_rooms() { } } + std::lock_guard mutex_guard(EntityManager::_rooms_mutex); std::sort(EntityManager::_rooms.begin(), EntityManager::_rooms.end(), [](const std::shared_ptr &a, const std::shared_ptr &b) { return a->get_display_order() < b->get_display_order(); }); @@ -161,7 +170,6 @@ void EntityManager::load_nspanels() { auto existing_nspanel = EntityManager::get_nspanel_by_id(nspanel_id); if (existing_nspanel) [[likely]] { (*existing_nspanel)->reload_config(); - (*existing_nspanel)->send_config(); } else { std::lock_guard mutex_guard(EntityManager::_nspanels_mutex); auto panel = std::shared_ptr(new NSPanel(nspanel_id)); @@ -312,6 +320,98 @@ void EntityManager::load_thermostats() { SPDLOG_DEBUG("Loaded {} thermostats", thermostat_ids.size()); } +void EntityManager::load_media_players() { + auto media_player_ids = database_manager::database.select(&database_manager::Entity::id, sqlite_orm::from(), + sqlite_orm::where(sqlite_orm::glob(&database_manager::Entity::entity_type, "media_player"))); + SPDLOG_INFO("Loading {} media players.", media_player_ids.size()); + + // Check if any existing media player has been removed. + EntityManager::_entities.erase(std::remove_if(EntityManager::_entities.begin(), EntityManager::_entities.end(), [&media_player_ids](auto entity) { + return entity->get_type() == MQTT_MANAGER_ENTITY_TYPE::MEDIA_PLAYER && std::find_if(media_player_ids.begin(), media_player_ids.end(), [&entity](auto id) { return id == entity->get_id(); }) == media_player_ids.end(); + }), + EntityManager::_entities.end()); + + // Cause existing media players to reload config or add a new media player if it does not exist. + for (auto &media_player_id : media_player_ids) { + auto existing_media_player = EntityManager::get_entity_by_id(MQTT_MANAGER_ENTITY_TYPE::MEDIA_PLAYER, media_player_id); + if (existing_media_player) [[likely]] { + (*existing_media_player)->reload_config(); + } else { + std::lock_guard mutex_guard(EntityManager::_entities_mutex); + + try { + auto media_player_settings = database_manager::database.get(media_player_id); + nlohmann::json entity_data = media_player_settings.get_entity_data_json(); + if (entity_data.contains("controller")) { + std::string controller = entity_data["controller"]; + if (controller.compare("home_assistant") == 0) { + std::shared_ptr media_player_entity = std::make_shared(media_player_settings.id); + SPDLOG_INFO("Media player {}::{} was found in database but not in config. Creating media player.", media_player_entity->get_id(), media_player_entity->get_name()); + EntityManager::_entities.push_back(media_player_entity); + } else if (controller.compare("openhab") == 0) { + SPDLOG_ERROR("Media player {}::{} is controlled by OpenHAB, which is not implemented for media players. Will ignore entity.", media_player_settings.id, media_player_settings.friendly_name); + } else { + SPDLOG_ERROR("Unknown media player type '{}'. Will ignore entity.", controller); + } + } else { + SPDLOG_ERROR("Media player {}::{} does not define a controller!", media_player_settings.id, media_player_settings.friendly_name); + } + } catch (std::exception &e) { + SPDLOG_ERROR("Caught exception: {}", e.what()); + SPDLOG_ERROR("Stacktrace: {}", boost::stacktrace::to_string(boost::stacktrace::stacktrace())); + } + } + } + SPDLOG_DEBUG("Loaded {} media players", media_player_ids.size()); +} + +void EntityManager::load_covers() { + auto cover_ids = database_manager::database.select(&database_manager::Entity::id, sqlite_orm::from(), + sqlite_orm::where(sqlite_orm::glob(&database_manager::Entity::entity_type, "cover"))); + SPDLOG_INFO("Loading {} covers.", cover_ids.size()); + + // Check if any existing cover has been removed. + EntityManager::_entities.erase(std::remove_if(EntityManager::_entities.begin(), EntityManager::_entities.end(), [&cover_ids](auto entity) { + return entity->get_type() == MQTT_MANAGER_ENTITY_TYPE::COVER && std::find_if(cover_ids.begin(), cover_ids.end(), [&entity](auto id) { return id == entity->get_id(); }) == cover_ids.end(); + }), + EntityManager::_entities.end()); + + // Cause existing covers to reload config or add a new cover if it does not exist. + for (auto &cover_id : cover_ids) { + auto existing_cover = EntityManager::get_entity_by_id(MQTT_MANAGER_ENTITY_TYPE::COVER, cover_id); + if (existing_cover) [[likely]] { + (*existing_cover)->reload_config(); + } else { + std::lock_guard mutex_guard(EntityManager::_entities_mutex); + + try { + auto cover_settings = database_manager::database.get(cover_id); + nlohmann::json entity_data = cover_settings.get_entity_data_json(); + if (entity_data.contains("controller")) { + std::string controller = entity_data["controller"]; + if (controller.compare("home_assistant") == 0) { + std::shared_ptr cover_entity = std::make_shared(cover_settings.id); + SPDLOG_INFO("Cover {}::{} was found in database but not in config. Creating cover.", cover_entity->get_id(), cover_entity->get_name()); + EntityManager::_entities.push_back(cover_entity); + } else if (controller.compare("openhab") == 0) { + std::shared_ptr cover_entity = std::make_shared(cover_settings.id); + SPDLOG_INFO("Cover {}::{} was found in database but not in config. Creating cover.", cover_entity->get_id(), cover_entity->get_name()); + EntityManager::_entities.push_back(cover_entity); + } else { + SPDLOG_ERROR("Unknown cover type '{}'. Will ignore entity.", controller); + } + } else { + SPDLOG_ERROR("Cover {}::{} does not define a controller!", cover_settings.id, cover_settings.friendly_name); + } + } catch (std::exception &e) { + SPDLOG_ERROR("Caught exception: {}", e.what()); + SPDLOG_ERROR("Stacktrace: {}", boost::stacktrace::to_string(boost::stacktrace::stacktrace())); + } + } + } + SPDLOG_DEBUG("Loaded {} covers", cover_ids.size()); +} + void EntityManager::load_switches() { auto switch_ids = database_manager::database.select(&database_manager::Entity::id, sqlite_orm::from(), sqlite_orm::where(sqlite_orm::glob(&database_manager::Entity::entity_type, "switch"))); @@ -388,7 +488,7 @@ void EntityManager::load_scenes() { SPDLOG_INFO("Scene {}::{} was found in database but not in config. Creating scene.", scene->get_id(), scene->get_name()); std::lock_guard mutex_guard(EntityManager::_entities_mutex); EntityManager::_entities.push_back(scene); - } else if (scene_settings.scene_type.compare("nspm_scene") == 0) { + } else if (scene_settings.scene_type.compare("nspm_scene") == 0 || scene_settings.scene_type.compare("nspm") == 0) { std::shared_ptr scene = std::shared_ptr(new NSPMScene(scene_settings.id)); SPDLOG_INFO("Scene {}::{} was found in database but not in config. Creating scene.", scene->get_id(), scene->get_name()); std::lock_guard mutex_guard(EntityManager::_entities_mutex); @@ -527,9 +627,16 @@ void EntityManager::update_all_rooms_status() { uint16_t num_kelvin_lights_ceiling = 0; // Total number of ceiling lights with color temperature uint16_t num_kelvin_lights_table = 0; // Total number of table lights with color temperature + // Work on a copy, as load_rooms() may change the list meanwhile. + std::vector> rooms; + { + std::lock_guard mutex_guard(EntityManager::_rooms_mutex); + rooms = EntityManager::_rooms; + } + // Determine if any light is on in any of the rooms bool any_light_on = false; - for (auto room : EntityManager::_rooms) { + for (auto room : rooms) { std::vector> entities = room->get_all_entities_by_type(MQTT_MANAGER_ENTITY_TYPE::LIGHT); for (auto light : entities) { if (light->get_state() && light->get_controlled_from_main_page()) { @@ -539,7 +646,7 @@ void EntityManager::update_all_rooms_status() { } } - for (auto room : EntityManager::_rooms) { + for (auto room : rooms) { for (auto &light : room->get_all_entities_by_type(MQTT_MANAGER_ENTITY_TYPE::LIGHT)) { // Light is not controlled from main page, exclude it from calculations. if (!light->get_controlled_from_main_page()) { @@ -915,12 +1022,9 @@ void EntityManager::_handle_register_request(const nlohmann::json &data) { if (new_panel != nullptr) { std::lock_guard lock_guard(EntityManager::_nspanels_mutex); EntityManager::_nspanels.push_back(new_panel); - nlohmann::json data = { - {"event_type", "register_request"}, - {"nspanel_id", new_panel->get_id()}}; - WebsocketServer::update_stomp_topic_value("mqttmanager/events", data); } } + EntityManager::_send_websocket_state_update(); } std::expected, EntityManager::EntityError> EntityManager::get_nspanel_by_id(uint id) { @@ -957,3 +1061,19 @@ std::expected, EntityManager::EntityError> EntityManage SPDLOG_TRACE("Did not find NSPanel by MAC {}", mac); return std::unexpected(EntityManager::EntityError::NOT_FOUND); } + +void EntityManager::_send_websocket_state_update() { + nlohmann::json data = { + {"nspanels", nlohmann::json::array()}}; + { + std::lock_guard mutex_guard(EntityManager::_nspanels_mutex); + for (auto nspanel : EntityManager::_nspanels) { + data["nspanels"].push_back({ + {"id", nspanel->get_id()}, + {"mac", nspanel->get_mac()}, + }); + } + } + WebsocketServer::set_stomp_topic_retained("entity_states", true); + WebsocketServer::update_stomp_topic_value("entity_states", data); +} diff --git a/docker/MQTTManager/include/entity_manager/entity_manager.hpp b/docker/MQTTManager/include/entity_manager/entity_manager.hpp index 19dbf67b5..ede7f9dd3 100644 --- a/docker/MQTTManager/include/entity_manager/entity_manager.hpp +++ b/docker/MQTTManager/include/entity_manager/entity_manager.hpp @@ -81,6 +81,16 @@ class EntityManager { */ static void load_thermostats(); + /* + * Load all media players from the DB and remove any existing media player that no longer exist. + */ + static void load_media_players(); + + /* + * Load all covers from the DB and remove any existing cover that no longer exist. + */ + static void load_covers(); + /* * Load all switches from the DB and remove any existing switch that no longer exist. */ @@ -208,6 +218,13 @@ class EntityManager { static std::expected, EntityError> get_nspanel_by_mac(std::string mac); static std::expected get_room_id_for_panel_id(uint32_t nspanel_id); +#if defined(TEST_MODE) && TEST_MODE == 1 + // Handles a panel command as if CommandManager had delivered it, without starting init()'s threads. + static void test_process_command(NSPanelMQTTManagerCommand &command) { + EntityManager::_command_callback(command); + } +#endif + private: static inline std::vector> _entities; static inline std::mutex _entities_mutex; @@ -218,6 +235,11 @@ class EntityManager { static inline std::vector> _nspanels; static inline std::mutex _nspanels_mutex; + /** + * Send a state update over STOMP regarding relevant entities. + */ + static void _send_websocket_state_update(); + static inline std::vector> _global_room_entities_pages; static inline std::mutex _global_room_entities_pages_mutex; diff --git a/docker/MQTTManager/include/home_assistant_manager/home_assistant_manager.cpp b/docker/MQTTManager/include/home_assistant_manager/home_assistant_manager.cpp index 03d49eb2c..dabd0f55b 100644 --- a/docker/MQTTManager/include/home_assistant_manager/home_assistant_manager.cpp +++ b/docker/MQTTManager/include/home_assistant_manager/home_assistant_manager.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -24,6 +25,7 @@ #include #include #include +#include #include void HomeAssistantManager::connect() { @@ -129,6 +131,7 @@ void HomeAssistantManager::_process_websocket_message(const std::string &message HomeAssistantManager::_send_auth(); } else if (type.compare("auth_ok") == 0) { WebsocketServer::remove_warning("Home Assistant not connected."); + WebsocketServer::remove_warning("Home Assistant authentication invalid."); SPDLOG_INFO("Successfully authenticated to Home Assistant websocket API."); HomeAssistantManager::_authenticated = true; @@ -139,6 +142,10 @@ void HomeAssistantManager::_process_websocket_message(const std::string &message HomeAssistantManager::send_json(subscribe_command); HomeAssistantManager::_request_all_states(); + } else if (type.compare("auth_invalid") == 0) { + WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "Home Assistant authentication invalid."); + SPDLOG_ERROR("Invalid authentication token when trying to connect to Home Assistant. Will try again in 5 seconds."); + std::this_thread::sleep_for(std::chrono::milliseconds(5000)); } else if (type.compare("result") == 0) { bool success = data["success"]; if (!success) { @@ -181,6 +188,12 @@ void HomeAssistantManager::_send_auth() { void HomeAssistantManager::send_json(nlohmann::json &data) { data["id"] = HomeAssistantManager::_next_message_id++; +#if defined(TEST_MODE) && TEST_MODE == 1 + { + std::lock_guard lock_guard(HomeAssistantManager::_test_sent_messages_mutex); + HomeAssistantManager::_test_sent_messages.push_back(data); + } +#endif std::string buffer = data.dump(); HomeAssistantManager::_send_string(buffer); } diff --git a/docker/MQTTManager/include/home_assistant_manager/home_assistant_manager.hpp b/docker/MQTTManager/include/home_assistant_manager/home_assistant_manager.hpp index c831d165c..8bb730cbf 100644 --- a/docker/MQTTManager/include/home_assistant_manager/home_assistant_manager.hpp +++ b/docker/MQTTManager/include/home_assistant_manager/home_assistant_manager.hpp @@ -10,6 +10,12 @@ #include #include +#if defined(TEST_MODE) && TEST_MODE == 1 +#include +#include +#include +#endif + class HomeAssistantManager { public: static void init(); // Start a new thread and connect to HA. @@ -41,7 +47,25 @@ class HomeAssistantManager { HomeAssistantManager::_home_assistant_observers[item].disconnect(callback); } +#if defined(TEST_MODE) && TEST_MODE == 1 + // Everything passed to send_json since the last call, whether or not Home Assistant is connected. + static std::vector test_take_sent_messages() { + std::lock_guard lock_guard(HomeAssistantManager::_test_sent_messages_mutex); + return std::exchange(HomeAssistantManager::_test_sent_messages, {}); + } + + // Deliver an event as if it had been received from Home Assistant. + static void test_process_event(nlohmann::json &event_data) { + HomeAssistantManager::_process_home_assistant_event(event_data); + } +#endif + private: +#if defined(TEST_MODE) && TEST_MODE == 1 + static inline std::mutex _test_sent_messages_mutex; + static inline std::vector _test_sent_messages; +#endif + // Request all states that Home Assistant has as there is no way to only request state of one object. static void _request_all_states(); diff --git a/docker/MQTTManager/include/light/home_assistant_light.cpp b/docker/MQTTManager/include/light/home_assistant_light.cpp index 4ff3d13eb..a581d74d2 100644 --- a/docker/MQTTManager/include/light/home_assistant_light.cpp +++ b/docker/MQTTManager/include/light/home_assistant_light.cpp @@ -83,6 +83,7 @@ void HomeAssistantLight::send_state_update_to_controller() { if (this->_home_assistant_light_type == MQTT_MANAGER_HOME_ASSISTANT_LIGHT_TYPE::TYPE_LIGHT) { service_data["domain"] = "light"; if (this->_requested_state) { + bool turning_on = !this->_current_state; service_data["service"] = "turn_on"; if (MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE)) { this->_current_state = true; @@ -95,22 +96,26 @@ void HomeAssistantLight::send_state_update_to_controller() { } } - // This is a turn on event and it currently off. Send kelvin if turn on behavior is to use color temp. - if (this->_requested_mode == MQTT_MANAGER_LIGHT_MODE::DEFAULT || (!this->_current_state && MqttManagerConfig::get_light_turn_on_behaviour() == LightTurnOnBehaviour::COLOR_TEMPERATURE)) { - service_data["service_data"]["color_temp_kelvin"] = this->_requested_color_temperature <= 0 ? MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::COLOR_TEMP_MIN) : this->_requested_color_temperature; + // Only send a kelvin the light supports and that is known. 0 means HA has not reported one yet (e.g. the light has only been seen off), + // in which case HA keeps the light's own last colour temperature. + bool can_send_kelvin = this->_can_color_temperature && this->_requested_color_temperature > 0; + bool new_colour_requested = this->_requested_mode == MQTT_MANAGER_LIGHT_MODE::RGB && (this->_requested_hue != this->_current_hue || this->_requested_saturation != this->_current_saturation); + + // This is a turn on event and it is currently off. Force colour temperature mode if turn on behavior is to use color temp, unless a new colour was asked for. + if (can_send_kelvin && turning_on && !new_colour_requested && MqttManagerConfig::get_light_turn_on_behaviour() == LightTurnOnBehaviour::COLOR_TEMPERATURE) { + this->_requested_mode = MQTT_MANAGER_LIGHT_MODE::DEFAULT; + service_data["service_data"]["color_temp_kelvin"] = this->_requested_color_temperature; if (MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE)) { this->_current_color_temperature = this->_requested_color_temperature; this->_current_mode = MQTT_MANAGER_LIGHT_MODE::DEFAULT; } - } - - if (this->_requested_mode == MQTT_MANAGER_LIGHT_MODE::DEFAULT && this->_requested_color_temperature != this->_current_color_temperature) { - service_data["service_data"]["color_temp_kelvin"] = this->_requested_color_temperature <= 0 ? MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::COLOR_TEMP_MIN) : this->_requested_color_temperature; + } else if (can_send_kelvin && this->_requested_mode == MQTT_MANAGER_LIGHT_MODE::DEFAULT && this->_requested_color_temperature != this->_current_color_temperature) { + service_data["service_data"]["color_temp_kelvin"] = this->_requested_color_temperature; if (MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE)) { this->_current_color_temperature = this->_requested_color_temperature; this->_current_mode = MQTT_MANAGER_LIGHT_MODE::DEFAULT; } - } else if (this->_requested_mode == MQTT_MANAGER_LIGHT_MODE::RGB && this->_requested_hue != this->_current_hue || this->_requested_saturation != this->_current_saturation) { + } else if (new_colour_requested) { service_data["service_data"]["hs_color"] = {this->_requested_hue, this->_requested_saturation}; if (MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE)) { this->_current_hue = this->_requested_hue; diff --git a/docker/MQTTManager/include/light/openhab_light.cpp b/docker/MQTTManager/include/light/openhab_light.cpp index 195854e30..d9662c9ba 100644 --- a/docker/MQTTManager/include/light/openhab_light.cpp +++ b/docker/MQTTManager/include/light/openhab_light.cpp @@ -1,10 +1,8 @@ #include "openhab_light.hpp" #include "database_manager/database_manager.hpp" #include "light/light.hpp" -#include "mqtt_manager/mqtt_manager.hpp" #include "mqtt_manager_config/mqtt_manager_config.hpp" #include "openhab_manager/openhab_manager.hpp" -#include "protobuf_general.pb.h" #include #include #include @@ -35,6 +33,12 @@ OpenhabLight::OpenhabLight(uint32_t light_id) : Light(light_id) { this->_last_on_off_change = 0; this->_last_brightness_change = 0; this->_last_color_temp_change = 0; + this->_last_group_brightness_item_state_changed_event_ms = 0; + this->_last_group_color_temp_item_state_changed_event_ms = 0; + this->_last_group_rgb_item_state_changed_event_ms = 0; + this->_openhab_group_brightness_item_state_changed_event_thread_running = false; + this->_openhab_group_color_temp_item_state_changed_event_thread_running = false; + this->_openhab_group_rgb_item_state_changed_event_thread_running = false; this->_current_mode = MQTT_MANAGER_LIGHT_MODE::DEFAULT; this->_current_brightness = 0; this->_current_color_temperature = 0; @@ -56,12 +60,6 @@ OpenhabLight::OpenhabLight(uint32_t light_id) : Light(light_id) { auto light = database_manager::database.get(this->_id); nlohmann::json entity_data = light.get_entity_data_json(); - if (entity_data.contains("openhab_name")) { - this->_openhab_name = entity_data["openhab_name"]; - } else { - SPDLOG_ERROR("No openhab_name defined for light {}::{}", this->_id, this->_name); - } - if (entity_data.contains("openhab_control_mode")) { std::string openhab_control_mode = entity_data["openhab_control_mode"]; if (openhab_control_mode.compare("dimmer") == 0) { @@ -75,6 +73,9 @@ OpenhabLight::OpenhabLight(uint32_t light_id) : Light(light_id) { this->_openhab_control_mode = MQTT_MANAGER_OPENHAB_CONTROL_MODE::SWITCH; if (entity_data.contains("openhab_item_switch")) { this->_openhab_on_off_item = entity_data["openhab_item_switch"]; + } else if (entity_data.contains("openhab_item_dimmer")) { + // Newer releases of NSPanelManager use "openhab_item_dimmer" regardless of light type/capabilities + this->_openhab_on_off_item = entity_data["openhab_item_dimmer"]; } else { SPDLOG_ERROR("No openhab on/off item defined for light {}::{}", this->_id, this->_name); } @@ -83,6 +84,9 @@ OpenhabLight::OpenhabLight(uint32_t light_id) : Light(light_id) { this->_openhab_control_mode = MQTT_MANAGER_OPENHAB_CONTROL_MODE::SWITCH; if (entity_data.contains("openhab_item_switch")) { this->_openhab_on_off_item = entity_data["openhab_item_switch"]; + } else if (entity_data.contains("openhab_item_dimmer")) { + // Newer releases of NSPanelManager use "openhab_item_dimmer" regardless of light type/capabilities + this->_openhab_on_off_item = entity_data["openhab_item_dimmer"]; } else { SPDLOG_ERROR("No openhab on/off item defined for light {}::{}", this->_id, this->_name); } @@ -92,6 +96,9 @@ OpenhabLight::OpenhabLight(uint32_t light_id) : Light(light_id) { this->_openhab_control_mode = MQTT_MANAGER_OPENHAB_CONTROL_MODE::SWITCH; if (entity_data.contains("openhab_item_switch")) { this->_openhab_on_off_item = entity_data["openhab_item_switch"]; + } else if (entity_data.contains("openhab_item_dimmer")) { + // Newer releases of NSPanelManager use "openhab_item_dimmer" regardless of light type/capabilities + this->_openhab_on_off_item = entity_data["openhab_item_dimmer"]; } else { SPDLOG_ERROR("No openhab on/off item defined for light {}::{}", this->_id, this->_name); } @@ -588,19 +595,20 @@ class OpenhabLightTest : public ::testing::Test { light_entity.friendly_name = "Unit test OH light (light)"; light_entity.room_id = 1; light_entity.room_view_position = 2; - light_entity.set_entity_data_json({{"can_color_temperature", true}, - {"can_dim", true}, - {"can_rgb", true}, - {"controlled_by_nspanel_main_page", true}, - {"controller", "openhab"}, - {"home_assistant_name", ""}, - {"is_ceiling_light", true}, - {"openhab_control_mode", "dimmer"}, - {"openhab_item_color_temp", "oh_item_color_temp"}, - {"openhab_item_dimmer", "oh_item_dimmer"}, - {"openhab_item_rgb", "oh_item_hsb"}, - {"openhab_item_switch", ""}, - {"openhab_name", "oh_name"}}); + light_entity.set_entity_data_json({ + {"can_color_temperature", true}, + {"can_dim", true}, + {"can_rgb", true}, + {"controlled_by_nspanel_main_page", true}, + {"controller", "openhab"}, + {"home_assistant_name", ""}, + {"is_ceiling_light", true}, + {"openhab_control_mode", "dimmer"}, + {"openhab_item_color_temp", "oh_item_color_temp"}, + {"openhab_item_dimmer", "oh_item_dimmer"}, + {"openhab_item_rgb", "oh_item_hsb"}, + {"openhab_item_switch", ""}, + }); oh_light_id = database_manager::database.insert(light_entity); // light_entity = database_manager::database.get(ha_light_id); diff --git a/docker/MQTTManager/include/light/openhab_light.hpp b/docker/MQTTManager/include/light/openhab_light.hpp index ff242eacf..00f2528a7 100644 --- a/docker/MQTTManager/include/light/openhab_light.hpp +++ b/docker/MQTTManager/include/light/openhab_light.hpp @@ -2,7 +2,6 @@ #define MQTT_MANAGER_OPENHAB_LIGHT #include "light.hpp" -#include "protobuf_general.pb.h" enum MQTT_MANAGER_OPENHAB_CONTROL_MODE { DIMMER, @@ -29,7 +28,6 @@ class OpenhabLight : public Light { private: // Mutex to only allow one thread to access the openhab items at a time std::mutex _openhab_items_mutex; - std::string _openhab_name; MQTT_MANAGER_OPENHAB_CONTROL_MODE _openhab_control_mode; std::string _openhab_on_off_item; // Controls the item for on/off functioanlity std::string _openhab_item_color_temperature; // Item for chaning color temp diff --git a/docker/MQTTManager/include/manager_clock/manager_clock.cpp b/docker/MQTTManager/include/manager_clock/manager_clock.cpp new file mode 100644 index 000000000..7827c7768 --- /dev/null +++ b/docker/MQTTManager/include/manager_clock/manager_clock.cpp @@ -0,0 +1,96 @@ +#include "manager_clock.hpp" +#include "mqtt_manager/mqtt_manager.hpp" +#include "mqtt_manager_config/mqtt_manager_config.hpp" +#include +#include +#include +#include + +void ManagerClock::start() { + ManagerClock::init(); + if (!ManagerClock::_instance.joinable()) { + ManagerClock::_instance = std::thread(ManagerClock::_run_clock_thread); + } +} + +void ManagerClock::init() { + MQTT_Manager::attach_connected_callback(&ManagerClock::publish_epoch); +} + +void ManagerClock::_run_clock_thread() { + // Set timezone + setenv("TZ", MqttManagerConfig::timezone.c_str(), 1); + tzset(); + + // Timezone loaded, proceed to update MQTT + for (;;) { + char time_buffer[20]; + char ampm_buffer[20]; + std::string time_str; + char date_buffer[100]; + std::string date_str; + + std::time_t time = std::time({}); + std::strftime(date_buffer, 100, MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::DATE_FORMAT).c_str(), std::localtime(&time)); + date_str = date_buffer; + + if (!MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::CLOCK_US_STYLE)) [[likely]] { + std::strftime(time_buffer, 20, "%H:%M", std::localtime(&time)); + time_str = time_buffer; + } else { + std::strftime(time_buffer, 20, "%I:%M", std::localtime(&time)); + std::strftime(ampm_buffer, 20, "%p", std::localtime(&time)); + time_str = time_buffer; + } + + MQTT_Manager::publish(fmt::format("nspanel/mqttmanager_{}/status/time", MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MANAGER_ADDRESS)), time_buffer, true); + if (!MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::CLOCK_US_STYLE)) [[likely]] { + MQTT_Manager::publish(fmt::format("nspanel/mqttmanager_{}/status/ampm", MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MANAGER_ADDRESS)), "", true); + } else { + MQTT_Manager::publish(fmt::format("nspanel/mqttmanager_{}/status/ampm", MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MANAGER_ADDRESS)), ampm_buffer, true); + } + + MQTT_Manager::publish(fmt::format("nspanel/mqttmanager_{}/status/date", MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MANAGER_ADDRESS)), date_buffer, true); + ManagerClock::publish_epoch(); + + // Sleep until next minute + auto t_now = std::chrono::system_clock::now(); + auto t_now_c = std::chrono::system_clock::to_time_t(t_now); + std::tm next_minute_tm = *std::localtime(&t_now_c); + next_minute_tm.tm_sec = 1; // Always wait to minute change over and not the exact same second + + next_minute_tm.tm_min++; + if (next_minute_tm.tm_min >= 60) { // We went over to next hour + next_minute_tm.tm_min = 0; + next_minute_tm.tm_hour++; + if (next_minute_tm.tm_hour >= 24) { // We went over to next day + next_minute_tm.tm_hour = 0; + next_minute_tm.tm_mday++; + // mktime (called below) normalises month/year overflow and handles + // varying month lengths and leap years, so no manual rollover needed. + } + } + + auto t_next_minute = std::chrono::system_clock::from_time_t(std::mktime(&next_minute_tm)); + std::this_thread::sleep_until(t_next_minute); + } +} + +void ManagerClock::publish_epoch() { + std::string topic = fmt::format("nspanel/mqttmanager_{}/status/epoch", MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MANAGER_ADDRESS)); + MQTT_Manager::publish_if_connected(topic, [] { + return ManagerClock::epoch_payload(std::chrono::system_clock::now()); + }); +} + +std::optional ManagerClock::epoch_payload(std::chrono::system_clock::time_point now) { + if (now < ManagerClock::_earliest_plausible_time) { + if (!ManagerClock::_warned_about_unset_clock.exchange(true)) { + SPDLOG_WARN("System clock reads {} ms since the Unix epoch, which is too early to be right. Will not send the time to NSPanels until the clock is set.", std::chrono::duration_cast(now.time_since_epoch()).count()); + } + return std::nullopt; + } + + ManagerClock::_warned_about_unset_clock = false; + return std::to_string(std::chrono::duration_cast(now.time_since_epoch()).count()); +} diff --git a/docker/MQTTManager/include/manager_clock/manager_clock.hpp b/docker/MQTTManager/include/manager_clock/manager_clock.hpp new file mode 100644 index 000000000..41cfa200a --- /dev/null +++ b/docker/MQTTManager/include/manager_clock/manager_clock.hpp @@ -0,0 +1,58 @@ +#ifndef MQTTMANAGER_MANAGER_CLOCK +#define MQTTMANAGER_MANAGER_CLOCK + +#include +#include +#include +#include +#include + +/** + * Tells NSPanels the current time. + * + * Every minute the time and date to display are sent, retained, on nspanel/mqttmanager_
/status/time, + * status/ampm and status/date, formatted as configured. + * + * The time is also sent as Unix time in milliseconds on nspanel/mqttmanager_
/status/epoch so that + * panels can set their own clock. It is never retained, so a panel only ever receives a time that was current + * when it was sent. It is sent every minute, whenever the manager connects to MQTT, and whenever a panel comes + * online. + */ +class ManagerClock { +public: + /** + * Start the thread that sends the time every minute, and send the time each time the manager connects + * to MQTT. Call before MQTT_Manager::init(). + */ + static void start(); + + /** + * Send the time each time the manager connects to MQTT. Called by start(). + */ + static void init(); + + /** + * Send the current time now, if connected to MQTT. + */ + static void publish_epoch(); + + /** + * The epoch payload for the given time: Unix time in milliseconds. Empty if the time is too early + * to be right, as when the host clock has not been set yet. + */ + static std::optional epoch_payload(std::chrono::system_clock::time_point now); + +private: + static inline std::thread _instance; + + // Send the time and date at the start of every minute. Never returns. + static void _run_clock_thread(); + + // 2025-01-01T00:00:00Z. Anything earlier means the host clock has not been set. + static constexpr std::chrono::system_clock::time_point _earliest_plausible_time{std::chrono::seconds(1735689600)}; + + // Warn once when the host clock is not set, not every minute. + static inline std::atomic _warned_about_unset_clock = false; +}; + +#endif // !MQTTMANAGER_MANAGER_CLOCK diff --git a/docker/MQTTManager/include/media_player/home_assistant_media_player.cpp b/docker/MQTTManager/include/media_player/home_assistant_media_player.cpp new file mode 100644 index 000000000..df5647dc6 --- /dev/null +++ b/docker/MQTTManager/include/media_player/home_assistant_media_player.cpp @@ -0,0 +1,369 @@ +#include "home_assistant_media_player.hpp" +#include "database_manager/database_manager.hpp" +#include "entity/entity.hpp" +#include "media_player/home_assistant_source_player.hpp" +#include "media_player/home_assistant_source_volume.hpp" +#include "media_player/media_player.hpp" +#include "protobuf_nspanel_entity.pb.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +HomeAssistantMediaPlayer::HomeAssistantMediaPlayer(uint32_t media_player_id) : MediaPlayerEntity(media_player_id) { + // Process Home Assistant specific details. General media player data is loaded in the "MediaPlayerEntity" constructor. + if (this->_controller != MQTT_MANAGER_ENTITY_CONTROLLER::HOME_ASSISTANT) { + SPDLOG_ERROR("HomeAssistantMediaPlayer has not been recognized as controlled by HOME_ASSISTANT. Will stop processing media player."); + return; + } + + auto entity_data = this->_load_home_assistant_config(); + // The source volume strategy is configured per media player, so it is created from the same entity_data. + // A failed load leaves the media player unusable, drop any source volume strategy with it. + this->_create_source_volume_strategy(entity_data.value_or(nlohmann::json::object())); + if (!entity_data.has_value()) { + return; + } + + SPDLOG_DEBUG("Loaded media player {}::{}, home assistant entity ID: {}", this->_id, this->_name, this->_home_assistant_name); + HomeAssistantManager::attach_event_observer(this->_home_assistant_name, boost::bind(&HomeAssistantMediaPlayer::home_assistant_event_callback, this, _1)); + + if (this->_home_assistant_name.rfind("media_player.", 0) != 0) { + SPDLOG_ERROR("Unknown type of home assistant entity '{}'. Expected media_player.", this->_home_assistant_name); + } + + this->send_state_update_to_nspanel(); // Send initial state to NSPanel +} + +HomeAssistantMediaPlayer::~HomeAssistantMediaPlayer() { + HomeAssistantManager::detach_event_observer(this->_home_assistant_name, boost::bind(&HomeAssistantMediaPlayer::home_assistant_event_callback, this, _1)); +} + +void HomeAssistantMediaPlayer::reload_config() { + MediaPlayerEntity::reload_config(); + + // Only reattach to Home Assistant and rebuild the source volume strategy when their settings have changed, + // so that state updates are not missed while the config is reloaded. + std::string previous_home_assistant_name = this->_home_assistant_name; + auto entity_data = this->_load_home_assistant_config(); + bool home_assistant_name_changed = this->_home_assistant_name.compare(previous_home_assistant_name) != 0; + + if (home_assistant_name_changed) { + if (!previous_home_assistant_name.empty()) { + HomeAssistantManager::detach_event_observer(previous_home_assistant_name, boost::bind(&HomeAssistantMediaPlayer::home_assistant_event_callback, this, _1)); + } + // The saved attributes belong to the previous Home Assistant entity. + std::lock_guard lock_guard(this->_source_volume_strategy_mutex); + this->_last_player_attributes = nlohmann::json::object(); + } + + this->_create_source_volume_strategy(entity_data.value_or(nlohmann::json::object())); + // The name or source volume might have changed, unchanged states are not sent again. + this->_update_source_player_and_send_state(); + + if (home_assistant_name_changed && !this->_home_assistant_name.empty()) { + // This will also request the current state from Home Assistant. + HomeAssistantManager::attach_event_observer(this->_home_assistant_name, boost::bind(&HomeAssistantMediaPlayer::home_assistant_event_callback, this, _1)); + } +} + +std::optional HomeAssistantMediaPlayer::_load_home_assistant_config() { + nlohmann::json entity_data; + try { + auto media_player = database_manager::database.get(this->_id); + entity_data = media_player.get_entity_data_json(); + } catch (const std::exception &e) { + SPDLOG_ERROR("Failed to load media player {}: {}", this->_id, e.what()); + this->_home_assistant_name.clear(); + return std::nullopt; + } + + if (entity_data.contains("home_assistant_name") && entity_data["home_assistant_name"].is_string()) { + this->_home_assistant_name = entity_data["home_assistant_name"]; + } else { + SPDLOG_ERROR("No home assistant name defined for media player {}::{}", this->_id, this->_name); + this->_home_assistant_name.clear(); + return std::nullopt; + } + + return entity_data; +} + +void HomeAssistantMediaPlayer::_create_source_volume_strategy(const nlohmann::json &entity_data) { + nlohmann::json source_volume_settings = nlohmann::json::object(); + for (const char *key : {"source_volume_strategy", "source_entity_attribute", "source_volume_attribute"}) { + if (entity_data.contains(key)) { + source_volume_settings[key] = entity_data[key]; + } + } + + { + std::lock_guard lock_guard(this->_source_volume_strategy_mutex); + if (this->_source_volume_strategy && this->_source_volume_settings == source_volume_settings) { + return; + } + } + + auto strategy = std::shared_ptr(HomeAssistantSourceVolumeStrategy::create(this->_id, entity_data, [this]() { + this->_update_source_player_and_send_state(); + })); + + nlohmann::json player_attributes; + { + std::lock_guard lock_guard(this->_source_volume_strategy_mutex); + this->_source_volume_strategy = strategy; + this->_source_volume_settings = source_volume_settings; + player_attributes = this->_last_player_attributes; + } + // Start the new strategy from the latest known player state instead of waiting for the next update from Home Assistant. + strategy->update_from_player_attributes(player_attributes); +} + +std::shared_ptr HomeAssistantMediaPlayer::_get_source_volume_strategy() { + std::lock_guard lock_guard(this->_source_volume_strategy_mutex); + return this->_source_volume_strategy; +} + +void HomeAssistantMediaPlayer::_update_source_player_and_send_state() { + auto strategy = this->_get_source_volume_strategy(); + std::optional source_volume = strategy ? strategy->get_source_volume() : std::nullopt; + this->_has_source_volume = source_volume.has_value(); + this->_source_volume = source_volume.value_or(0); + this->_set_source_player_sources(strategy ? strategy->get_source_player_sources() : std::nullopt); + this->send_state_update_to_nspanel(); +} + +void HomeAssistantMediaPlayer::home_assistant_event_callback(nlohmann::json data) { + if (!data.contains("event")) [[unlikely]] { + SPDLOG_ERROR("Media player {}::{} received malformed event data from HA. Data contains no 'event' key.", this->_id, this->_name); + return; + } else if (!data["event"].contains("event_type")) [[unlikely]] { + SPDLOG_ERROR("Media player {}::{} received malformed event data from HA. Data contains no 'event.event_type' key.", this->_id, this->_name); + return; + } else if (!data["event"].contains("data")) [[unlikely]] { + SPDLOG_ERROR("Media player {}::{} received malformed event data from HA. Data contains no 'event.data' key.", this->_id, this->_name); + return; + } else if (!data["event"]["data"].contains("entity_id")) [[unlikely]] { + SPDLOG_ERROR("Media player {}::{} received malformed event data from HA. Data contains no 'event.data.entity_id' key.", this->_id, this->_name); + return; + } + + if (std::string(data["event"]["event_type"]).compare("state_changed") != 0 || std::string(data["event"]["data"]["entity_id"]).compare(this->_home_assistant_name) != 0) { + return; + } + + SPDLOG_DEBUG("Got event update for HA media player {}::{}.", this->_id, this->_name); + uint16_t previous_icon_color = this->get_icon_color(); + + try { + nlohmann::json new_state_data = data["event"]["data"]["new_state"]; + nlohmann::json attributes = nlohmann::json::object(); + if (new_state_data.is_null()) { + // Entity was removed from Home Assistant. + this->_state = NSPanelEntityState_MediaPlayer_PlaybackState_UNKNOWN; + this->_set_album_art_source(""); + this->_set_player_sources(MediaPlayerSources()); + } else { + std::string new_state = new_state_data.contains("state") && new_state_data["state"].is_string() ? new_state_data["state"].get() : ""; + if (new_state.compare("playing") == 0) { + this->_state = NSPanelEntityState_MediaPlayer_PlaybackState_PLAYING; + } else if (new_state.compare("paused") == 0) { + this->_state = NSPanelEntityState_MediaPlayer_PlaybackState_PAUSED; + } else if (new_state.compare("buffering") == 0) { + this->_state = NSPanelEntityState_MediaPlayer_PlaybackState_BUFFERING; + } else if (new_state.compare("idle") == 0) { + this->_state = NSPanelEntityState_MediaPlayer_PlaybackState_IDLE; + } else if (new_state.compare("on") == 0) { + this->_state = NSPanelEntityState_MediaPlayer_PlaybackState_ON; + } else if (new_state.compare("off") == 0 || new_state.compare("standby") == 0) { + this->_state = NSPanelEntityState_MediaPlayer_PlaybackState_OFF; + } else { + this->_state = NSPanelEntityState_MediaPlayer_PlaybackState_UNKNOWN; + } + + if (new_state_data.contains("attributes") && new_state_data["attributes"].is_object()) { + attributes = new_state_data["attributes"]; + } + + this->_media_title = attributes.contains("media_title") && attributes["media_title"].is_string() ? attributes["media_title"].get() : ""; + this->_media_artist = attributes.contains("media_artist") && attributes["media_artist"].is_string() ? attributes["media_artist"].get() : ""; + this->_set_album_art_source(attributes.contains("entity_picture") && attributes["entity_picture"].is_string() ? attributes["entity_picture"].get() : ""); + + // Home Assistant does not report volume while a media player is off, keep the last known values in that case. + if (attributes.contains("volume_level") && attributes["volume_level"].is_number()) { + this->_volume = std::lround(std::clamp(attributes["volume_level"].get(), 0.0, 1.0) * 100); + } + if (attributes.contains("is_volume_muted") && attributes["is_volume_muted"].is_boolean()) { + this->_is_muted = attributes["is_volume_muted"]; + } + + uint32_t supported_features = 0; + if (attributes.contains("supported_features") && attributes["supported_features"].is_number_unsigned()) { + supported_features = attributes["supported_features"]; + } + this->_can_play = supported_features & HomeAssistantMediaPlayer::feature_play; + this->_can_pause = supported_features & HomeAssistantMediaPlayer::feature_pause; + this->_can_next_track = supported_features & HomeAssistantMediaPlayer::feature_next_track; + this->_can_previous_track = supported_features & HomeAssistantMediaPlayer::feature_previous_track; + this->_can_set_volume = supported_features & HomeAssistantMediaPlayer::feature_volume_set; + this->_can_mute = supported_features & HomeAssistantMediaPlayer::feature_volume_mute; + this->_set_player_sources(HomeAssistantSourcePlayer::sources_from_attributes(attributes)); + } + this->_update_media_position(attributes); + + std::shared_ptr strategy; + { + std::lock_guard lock_guard(this->_source_volume_strategy_mutex); + this->_last_player_attributes = attributes; + strategy = this->_source_volume_strategy; + } + if (strategy) { + strategy->update_from_player_attributes(attributes); + } + } catch (std::exception &e) { + SPDLOG_ERROR("Caught exception during processing of HA media player {}::{} event. Error: {}", this->_id, this->_name, e.what()); + return; + } + + this->_update_source_player_and_send_state(); + if (previous_icon_color != this->get_icon_color()) { + this->_signal_entity_changed(); + } +} + +void HomeAssistantMediaPlayer::_call_service(const std::string &service, nlohmann::json service_data) { + nlohmann::json command = { + {"type", "call_service"}, + {"domain", "media_player"}, + {"target", {{"entity_id", this->_home_assistant_name}}}, + {"service", service}}; + if (!service_data.empty()) { + command["service_data"] = service_data; + } + HomeAssistantManager::send_json(command); +} + +void HomeAssistantMediaPlayer::_update_media_position(const nlohmann::json &attributes) { + // Home Assistant only has a position for media that is playing or paused. The position is + // only meaningful together with the time it was taken at, so both are needed. + std::optional updated_at; + if (attributes.contains("media_position_updated_at") && attributes["media_position_updated_at"].is_string()) { + updated_at = HomeAssistantMediaPlayer::parse_timestamp(attributes["media_position_updated_at"].get()); + if (!updated_at.has_value()) { + SPDLOG_WARN("Could not parse media_position_updated_at '{}' for HA media player {}::{}.", attributes["media_position_updated_at"].get(), this->_id, this->_name); + } + } + if (updated_at.has_value() && attributes.contains("media_position") && attributes["media_position"].is_number()) { + this->_has_media_position = true; + this->_media_position = std::lround(std::max(attributes["media_position"].get(), 0.0)); + this->_media_position_updated_at = updated_at.value(); + } else { + this->_has_media_position = false; + this->_media_position = 0; + this->_media_position_updated_at = 0; + } + + if (attributes.contains("media_duration") && attributes["media_duration"].is_number()) { + this->_media_duration = std::lround(std::max(attributes["media_duration"].get(), 0.0)); + } else { + this->_media_duration = 0; + } +} + +std::optional HomeAssistantMediaPlayer::parse_timestamp(const std::string ×tamp) { + // ISO 8601 as Home Assistant writes it: "YYYY-MM-DDTHH:MM:SS", optional fraction, then "+HH:MM"/"-HH:MM". + date::sys_time time_point; + std::istringstream stream(timestamp); + stream >> date::parse("%FT%T%Ez", time_point); + if (stream.fail() || stream.peek() != std::char_traits::eof()) { + return std::nullopt; + } + return std::chrono::floor(time_point).time_since_epoch().count(); +} + +void HomeAssistantMediaPlayer::play() { + this->_call_service("media_play"); +} + +void HomeAssistantMediaPlayer::pause() { + this->_call_service("media_pause"); +} + +void HomeAssistantMediaPlayer::next_track() { + this->_call_service("media_next_track"); +} + +void HomeAssistantMediaPlayer::previous_track() { + this->_call_service("media_previous_track"); +} + +void HomeAssistantMediaPlayer::set_volume(uint8_t volume) { + this->_call_service("volume_set", {{"volume_level", volume / 100.0}}); +} + +void HomeAssistantMediaPlayer::set_source_volume(uint8_t volume) { + auto strategy = this->_get_source_volume_strategy(); + if (strategy) { + strategy->set_source_volume(volume); + } +} + +bool HomeAssistantMediaPlayer::_download_album_art(const std::string &source, std::string &image_data) { + std::string url; + std::string authorization_header; + std::list headers; + + if (boost::algorithm::starts_with(source, "http://") || boost::algorithm::starts_with(source, "https://")) { + // The integration serves the image from somewhere else. Do not send the Home Assistant token to it. + url = source; + } else { + // A path on Home Assistant, normally /api/media_player_proxy/?token=...&cache=... + url = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::HOME_ASSISTANT_ADDRESS); + if (url.empty()) { + SPDLOG_ERROR("No Home Assistant address configured. Cannot download album art for media player {}::{}.", this->_id, this->_name); + return false; + } + while (!url.empty() && url.back() == '/') { + url.pop_back(); + } + if (MqttManagerConfig::is_home_assistant_addon()) { + url.append("/core"); // The Home Assistant API is reached through the supervisor proxy when running as an add-on. + } + url.append(source); + + // The token in the proxy path is enough on its own, but the supervisor proxy requires an authorization header. + authorization_header = fmt::format("Authorization: Bearer {}", MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::HOME_ASSISTANT_TOKEN)); + headers.push_back(authorization_header.c_str()); + } + + SPDLOG_DEBUG("Downloading album art for media player {}::{}.", this->_id, this->_name); + // WebHelper treats an empty header list as an error, so only pass the list when there is something in it. + return WebHelper::perform_get_request(&url, &image_data, headers.empty() ? nullptr : &headers); +} + +void HomeAssistantMediaPlayer::set_muted(bool muted) { + this->_call_service("volume_mute", {{"is_volume_muted", muted}}); +} + +void HomeAssistantMediaPlayer::select_player_source(const std::string &source) { + this->_call_service("select_source", {{"source", source}}); +} + +void HomeAssistantMediaPlayer::select_source_player_source(const std::string &source) { + auto strategy = this->_get_source_volume_strategy(); + if (strategy) { + strategy->select_source_player_source(source); + } +} diff --git a/docker/MQTTManager/include/media_player/home_assistant_media_player.hpp b/docker/MQTTManager/include/media_player/home_assistant_media_player.hpp new file mode 100644 index 000000000..334854615 --- /dev/null +++ b/docker/MQTTManager/include/media_player/home_assistant_media_player.hpp @@ -0,0 +1,92 @@ +#ifndef MQTT_MANAGER_HOME_ASSISTANT_MEDIA_PLAYER_HPP +#define MQTT_MANAGER_HOME_ASSISTANT_MEDIA_PLAYER_HPP + +#include "media_player.hpp" +#include "media_player/home_assistant_source_volume.hpp" +#include +#include +#include +#include +#include + +class HomeAssistantMediaPlayer : public MediaPlayerEntity { +public: + HomeAssistantMediaPlayer(uint32_t media_player_id); + ~HomeAssistantMediaPlayer(); + void reload_config(); + void home_assistant_event_callback(nlohmann::json event_data); + + void play(); + void pause(); + void next_track(); + void previous_track(); + void set_volume(uint8_t volume); + void set_source_volume(uint8_t volume); + void set_muted(bool muted); + void select_player_source(const std::string &source); + void select_source_player_source(const std::string &source); + + /** + * Parse a timestamp from Home Assistant, for example "2026-10-17T01:59:45.666287+00:00". + * @return Unix time in seconds, or nothing if the timestamp could not be parsed. + */ + static std::optional parse_timestamp(const std::string ×tamp); + +protected: + /** + * Download album art from Home Assistant. The source is the "entity_picture" attribute from Home Assistant, + * either a path on Home Assistant (normally its media player image proxy) or an external URL. + */ + bool _download_album_art(const std::string &source, std::string &image_data); + +private: + /** + * Load Home Assistant specific settings from entity_data in the DB. + * @return The entity_data of the media player, or nothing if it could not be loaded. + */ + std::optional _load_home_assistant_config(); + + /** + * Create the source volume strategy selected for this media player, unless its settings are unchanged. + * @param entity_data: The media player's entity_data from the DB. + */ + void _create_source_volume_strategy(const nlohmann::json &entity_data); + + /** + * Get the current source volume strategy. + */ + std::shared_ptr _get_source_volume_strategy(); + + /** + * Update source volume and source player sources from the strategy and send the new state to the NSPanel. + */ + void _update_source_player_and_send_state(); + + /** + * Call a "media_player" domain service in Home Assistant. + */ + void _call_service(const std::string &service, nlohmann::json service_data = nlohmann::json::object()); + + /** + * Update the playback position and duration from the attributes of the media player in Home Assistant. + */ + void _update_media_position(const nlohmann::json &attributes); + + std::string _home_assistant_name; + + // Guards the source volume strategy, the settings it was created from and the last player attributes it was given. + std::mutex _source_volume_strategy_mutex; + std::shared_ptr _source_volume_strategy; + nlohmann::json _source_volume_settings; + nlohmann::json _last_player_attributes = nlohmann::json::object(); + + // Media player feature flags from Home Assistant (MediaPlayerEntityFeature). + static constexpr uint32_t feature_pause = 1; + static constexpr uint32_t feature_volume_set = 4; + static constexpr uint32_t feature_volume_mute = 8; + static constexpr uint32_t feature_previous_track = 16; + static constexpr uint32_t feature_next_track = 32; + static constexpr uint32_t feature_play = 16384; +}; + +#endif // !MQTT_MANAGER_HOME_ASSISTANT_MEDIA_PLAYER_HPP diff --git a/docker/MQTTManager/include/media_player/home_assistant_source_player.cpp b/docker/MQTTManager/include/media_player/home_assistant_source_player.cpp new file mode 100644 index 000000000..84c955b07 --- /dev/null +++ b/docker/MQTTManager/include/media_player/home_assistant_source_player.cpp @@ -0,0 +1,168 @@ +#include "media_player/home_assistant_source_player.hpp" +#include +#include +#include +#include +#include +#include +#include +#include + +HomeAssistantSourcePlayer::HomeAssistantSourcePlayer(std::string source_entity_attribute, std::function on_change) { + this->_source_entity_attribute = source_entity_attribute; + this->_on_change = on_change; +} + +HomeAssistantSourcePlayer::~HomeAssistantSourcePlayer() { + std::lock_guard lock_guard(this->_mutex); + if (!this->_entity_id.empty()) { + HomeAssistantManager::detach_event_observer(this->_entity_id, boost::bind(&HomeAssistantSourcePlayer::home_assistant_event_callback, this, _1)); + } +} + +void HomeAssistantSourcePlayer::update_from_player_attributes(const nlohmann::json &attributes) { + std::string new_entity_id; + if (attributes.contains(this->_source_entity_attribute) && attributes[this->_source_entity_attribute].is_string()) { + new_entity_id = attributes[this->_source_entity_attribute]; + } + + std::string old_entity_id; + { + std::lock_guard lock_guard(this->_mutex); + if (new_entity_id.compare(this->_entity_id) == 0) { + return; + } + old_entity_id = this->_entity_id; + this->_entity_id = new_entity_id; + // Forget the previous source player straight away, so its sources are never offered for the new one. + this->_volume.reset(); + this->_sources = MediaPlayerSources(); + } + + SPDLOG_DEBUG("Media player source changed from '{}' to '{}'.", old_entity_id, new_entity_id); + if (!old_entity_id.empty()) { + HomeAssistantManager::detach_event_observer(old_entity_id, boost::bind(&HomeAssistantSourcePlayer::home_assistant_event_callback, this, _1)); + } + if (!new_entity_id.empty()) { + // Attaching an observer requests all states from Home Assistant, the current state of the source player will arrive through the event callback. + HomeAssistantManager::attach_event_observer(new_entity_id, boost::bind(&HomeAssistantSourcePlayer::home_assistant_event_callback, this, _1)); + } +} + +std::string HomeAssistantSourcePlayer::get_entity_id() { + std::lock_guard lock_guard(this->_mutex); + return this->_entity_id; +} + +std::optional HomeAssistantSourcePlayer::get_volume() { + std::lock_guard lock_guard(this->_mutex); + return this->_volume; +} + +std::optional HomeAssistantSourcePlayer::get_sources() { + std::lock_guard lock_guard(this->_mutex); + if (this->_entity_id.empty()) { + return std::nullopt; + } + return this->_sources; +} + +void HomeAssistantSourcePlayer::set_volume(uint8_t volume) { + std::string entity_id = this->get_entity_id(); + if (entity_id.empty()) { + SPDLOG_WARN("Received command to set source volume but the media player does not report a source entity."); + return; + } + HomeAssistantSourcePlayer::call_service(entity_id, "volume_set", {{"volume_level", volume / 100.0}}); +} + +void HomeAssistantSourcePlayer::select_source(const std::string &source) { + std::string entity_id = this->get_entity_id(); + if (entity_id.empty()) { + SPDLOG_WARN("Received command to select a source player source but the media player does not report a source entity."); + return; + } + HomeAssistantSourcePlayer::call_service(entity_id, "select_source", {{"source", source}}); +} + +void HomeAssistantSourcePlayer::home_assistant_event_callback(nlohmann::json event_data) { + try { + if (!event_data.contains("event") || !event_data["event"].contains("data")) { + return; + } + nlohmann::json data = event_data["event"]["data"]; + if (!data.contains("entity_id") || !data["entity_id"].is_string()) { + return; + } + + bool changed = false; + { + std::lock_guard lock_guard(this->_mutex); + if (data["entity_id"].get().compare(this->_entity_id) != 0) { + return; // Event for a previous source. + } + + std::optional new_volume = this->_volume; + MediaPlayerSources new_sources; + if (!data.contains("new_state") || data["new_state"].is_null()) { + new_volume.reset(); + } else if (data["new_state"].contains("attributes") && data["new_state"]["attributes"].is_object()) { + const nlohmann::json &attributes = data["new_state"]["attributes"]; + // Home Assistant does not report volume while a media player is off, keep the last known value in that case. + if (attributes.contains("volume_level")) { + new_volume = HomeAssistantSourcePlayer::volume_from_json(attributes["volume_level"]); + } + new_sources = HomeAssistantSourcePlayer::sources_from_attributes(attributes); + } + + changed = new_volume != this->_volume || new_sources != this->_sources; + this->_volume = new_volume; + this->_sources = std::move(new_sources); + } + + if (changed && this->_on_change) { + this->_on_change(); + } + } catch (std::exception &e) { + SPDLOG_ERROR("Caught exception during processing of media player source event. Error: {}", e.what()); + } +} + +MediaPlayerSources HomeAssistantSourcePlayer::sources_from_attributes(const nlohmann::json &attributes) { + MediaPlayerSources sources; + if (attributes.contains("source_list") && attributes["source_list"].is_array()) { + for (const nlohmann::json &source : attributes["source_list"]) { + if (source.is_string()) { + sources.sources.push_back(source); + } + } + } + if (attributes.contains("source") && attributes["source"].is_string()) { + sources.current_source = attributes["source"]; + } + uint32_t supported_features = 0; + if (attributes.contains("supported_features") && attributes["supported_features"].is_number_unsigned()) { + supported_features = attributes["supported_features"]; + } + sources.can_select = (supported_features & HomeAssistantSourcePlayer::feature_select_source) && !sources.sources.empty(); + return sources; +} + +std::optional HomeAssistantSourcePlayer::volume_from_json(const nlohmann::json &volume_level) { + if (!volume_level.is_number()) { + return std::nullopt; + } + return std::lround(std::clamp(volume_level.get(), 0.0, 1.0) * 100); +} + +void HomeAssistantSourcePlayer::call_service(const std::string &entity_id, const std::string &service, nlohmann::json service_data) { + nlohmann::json command = { + {"type", "call_service"}, + {"domain", "media_player"}, + {"target", {{"entity_id", entity_id}}}, + {"service", service}}; + if (!service_data.empty()) { + command["service_data"] = service_data; + } + HomeAssistantManager::send_json(command); +} diff --git a/docker/MQTTManager/include/media_player/home_assistant_source_player.hpp b/docker/MQTTManager/include/media_player/home_assistant_source_player.hpp new file mode 100644 index 000000000..78e8d1c36 --- /dev/null +++ b/docker/MQTTManager/include/media_player/home_assistant_source_player.hpp @@ -0,0 +1,88 @@ +#ifndef MQTT_MANAGER_HOME_ASSISTANT_SOURCE_PLAYER_HPP +#define MQTT_MANAGER_HOME_ASSISTANT_SOURCE_PLAYER_HPP + +#include "media_player/media_player.hpp" +#include +#include +#include +#include +#include +#include + +/** + * Follows the source player feeding a media player in Home Assistant. The media player reports the + * entity ID of its current source player in a state attribute, the source player is itself a media + * player in Home Assistant. + */ +class HomeAssistantSourcePlayer { +public: + /** + * @param source_entity_attribute: Media player state attribute holding the entity ID of the source player. + * @param on_change: Called when the source player changes state without the media player itself changing. + */ + HomeAssistantSourcePlayer(std::string source_entity_attribute, std::function on_change); + ~HomeAssistantSourcePlayer(); + + /** + * Process new state attributes of the media player. Follows the source player when it changes. + */ + void update_from_player_attributes(const nlohmann::json &attributes); + + /** + * Get the entity ID of the current source player, or an empty string if there is none. + */ + std::string get_entity_id(); + + /** + * Get the volume of the source player in 0-100%, if known. + */ + std::optional get_volume(); + + /** + * Get the sources of the source player, or nothing if there is no source player. + */ + std::optional get_sources(); + + /** + * Set the volume of the source player. + * @param volume: Volume in 0-100% + */ + void set_volume(uint8_t volume); + + /** + * Select a source of the source player. + */ + void select_source(const std::string &source); + + void home_assistant_event_callback(nlohmann::json event_data); + + /** + * Read the sources of a media player from its Home Assistant state attributes. + */ + static MediaPlayerSources sources_from_attributes(const nlohmann::json &attributes); + + /** + * Convert a Home Assistant volume level (0.0-1.0) to 0-100%. + * Home Assistant always reports volume_level as 0.0-1.0, whatever the device uses. 0-100 is only used towards the NSPanel. + */ + static std::optional volume_from_json(const nlohmann::json &volume_level); + + /** + * Call a "media_player" domain service in Home Assistant on the given entity. + */ + static void call_service(const std::string &entity_id, const std::string &service, nlohmann::json service_data = nlohmann::json::object()); + + // Media player feature flag from Home Assistant (MediaPlayerEntityFeature). + static constexpr uint32_t feature_select_source = 2048; + +private: + std::string _source_entity_attribute; + std::function _on_change; + + std::mutex _mutex; + std::string _entity_id; + std::optional _volume; + MediaPlayerSources _sources; +}; + +#endif // !MQTT_MANAGER_HOME_ASSISTANT_SOURCE_PLAYER_HPP diff --git a/docker/MQTTManager/include/media_player/home_assistant_source_volume.cpp b/docker/MQTTManager/include/media_player/home_assistant_source_volume.cpp new file mode 100644 index 000000000..083b479ab --- /dev/null +++ b/docker/MQTTManager/include/media_player/home_assistant_source_volume.cpp @@ -0,0 +1,121 @@ +#include "media_player/home_assistant_source_volume.hpp" +#include "media_player/home_assistant_source_player.hpp" +#include +#include +#include +#include + +/** + * Read a string value from entity_data, or an empty string if it is missing or not a string. + */ +static std::string _string_from_entity_data(const nlohmann::json &entity_data, const std::string &key) { + if (entity_data.contains(key) && entity_data[key].is_string()) { + return entity_data[key]; + } + return ""; +} + +std::unique_ptr HomeAssistantSourceVolumeStrategy::create(uint32_t media_player_id, const nlohmann::json &entity_data, std::function on_change) { + std::string strategy = _string_from_entity_data(entity_data, "source_volume_strategy"); + std::string source_entity_attribute = _string_from_entity_data(entity_data, "source_entity_attribute"); + std::string source_volume_attribute = _string_from_entity_data(entity_data, "source_volume_attribute"); + + // The web interface rejects invalid combinations, so anything below is either a media player saved + // before source volume existed or a hand edited entity_data. + if (strategy.compare("player_attributes") == 0) { + if (source_entity_attribute.empty() || source_volume_attribute.empty()) { + SPDLOG_ERROR("Media player {}: source volume strategy 'player_attributes' requires both a source entity attribute and a source volume attribute. Source volume will not be available.", media_player_id); + } else { + return std::make_unique(source_entity_attribute, source_volume_attribute, on_change); + } + } else if (strategy.compare("source_entity") == 0) { + if (source_entity_attribute.empty()) { + SPDLOG_ERROR("Media player {}: source volume strategy 'source_entity' requires a source entity attribute. Source volume will not be available.", media_player_id); + } else { + return std::make_unique(source_entity_attribute, on_change); + } + } else if (!strategy.empty() && strategy.compare("none") != 0) { + SPDLOG_ERROR("Media player {}: unknown source volume strategy '{}'. Source volume will not be available.", media_player_id, strategy); + } + return std::make_unique(); +} + +// No source volume + +void NoSourceVolumeStrategy::update_from_player_attributes([[maybe_unused]] const nlohmann::json &attributes) { +} + +std::optional NoSourceVolumeStrategy::get_source_volume() { + return std::nullopt; +} + +void NoSourceVolumeStrategy::set_source_volume([[maybe_unused]] uint8_t volume) { + SPDLOG_WARN("Received command to set source volume but no source volume strategy is configured."); +} + +std::optional NoSourceVolumeStrategy::get_source_player_sources() { + return std::nullopt; +} + +void NoSourceVolumeStrategy::select_source_player_source([[maybe_unused]] const std::string &source) { + SPDLOG_WARN("Received command to select a source player source but no source volume strategy is configured."); +} + +// Player attributes + +PlayerAttributesSourceVolumeStrategy::PlayerAttributesSourceVolumeStrategy(std::string source_entity_attribute, std::string source_volume_attribute, std::function on_change) : _source_player(source_entity_attribute, on_change) { + this->_source_volume_attribute = source_volume_attribute; +} + +void PlayerAttributesSourceVolumeStrategy::update_from_player_attributes(const nlohmann::json &attributes) { + this->_source_player.update_from_player_attributes(attributes); + + std::lock_guard lock_guard(this->_mutex); + this->_source_volume.reset(); + // Only report a source volume if we also know where to send volume changes. + if (!this->_source_player.get_entity_id().empty() && attributes.contains(this->_source_volume_attribute)) { + this->_source_volume = HomeAssistantSourcePlayer::volume_from_json(attributes[this->_source_volume_attribute]); + } +} + +std::optional PlayerAttributesSourceVolumeStrategy::get_source_volume() { + std::lock_guard lock_guard(this->_mutex); + return this->_source_volume; +} + +void PlayerAttributesSourceVolumeStrategy::set_source_volume(uint8_t volume) { + this->_source_player.set_volume(volume); +} + +std::optional PlayerAttributesSourceVolumeStrategy::get_source_player_sources() { + return this->_source_player.get_sources(); +} + +void PlayerAttributesSourceVolumeStrategy::select_source_player_source(const std::string &source) { + this->_source_player.select_source(source); +} + +// Source entity + +SourceEntitySourceVolumeStrategy::SourceEntitySourceVolumeStrategy(std::string source_entity_attribute, std::function on_change) : _source_player(source_entity_attribute, on_change) { +} + +void SourceEntitySourceVolumeStrategy::update_from_player_attributes(const nlohmann::json &attributes) { + this->_source_player.update_from_player_attributes(attributes); +} + +std::optional SourceEntitySourceVolumeStrategy::get_source_volume() { + return this->_source_player.get_volume(); +} + +void SourceEntitySourceVolumeStrategy::set_source_volume(uint8_t volume) { + this->_source_player.set_volume(volume); +} + +std::optional SourceEntitySourceVolumeStrategy::get_source_player_sources() { + return this->_source_player.get_sources(); +} + +void SourceEntitySourceVolumeStrategy::select_source_player_source(const std::string &source) { + this->_source_player.select_source(source); +} diff --git a/docker/MQTTManager/include/media_player/home_assistant_source_volume.hpp b/docker/MQTTManager/include/media_player/home_assistant_source_volume.hpp new file mode 100644 index 000000000..538c02357 --- /dev/null +++ b/docker/MQTTManager/include/media_player/home_assistant_source_volume.hpp @@ -0,0 +1,109 @@ +#ifndef MQTT_MANAGER_HOME_ASSISTANT_SOURCE_VOLUME_HPP +#define MQTT_MANAGER_HOME_ASSISTANT_SOURCE_VOLUME_HPP + +#include "media_player/home_assistant_source_player.hpp" +#include "media_player/media_player.hpp" +#include +#include +#include +#include +#include +#include +#include + +/** + * Some setups (for example multi-room audio matrices) have a separate volume for the source + * feeding a media player. How that source and its volume are exposed in Home Assistant differs + * between integrations, a strategy selected per media player decides how to handle it. + * The strategy also gives access to the sources of the source player. + */ +class HomeAssistantSourceVolumeStrategy { +public: + virtual ~HomeAssistantSourceVolumeStrategy() = default; + + /** + * Process new state attributes of the media player. + */ + virtual void update_from_player_attributes(const nlohmann::json &attributes) = 0; + + /** + * Get the current source volume in 0-100%, if available. + */ + virtual std::optional get_source_volume() = 0; + + /** + * Set the volume of the source currently feeding the media player. + * @param volume: Volume in 0-100% + */ + virtual void set_source_volume(uint8_t volume) = 0; + + /** + * Get the sources of the source player currently feeding the media player, or nothing if there is no source player. + */ + virtual std::optional get_source_player_sources() = 0; + + /** + * Select a source of the source player currently feeding the media player. + */ + virtual void select_source_player_source(const std::string &source) = 0; + + /** + * Create the strategy selected for the media player. + * @param media_player_id: ID of the media player, used for logging. + * @param entity_data: The media player's entity_data from the DB. + * @param on_change: Called when the source volume or sources change without the media player itself changing. + */ + static std::unique_ptr create(uint32_t media_player_id, const nlohmann::json &entity_data, std::function on_change); +}; + +/** + * No source volume, the media player only has its own volume. + */ +class NoSourceVolumeStrategy : public HomeAssistantSourceVolumeStrategy { +public: + void update_from_player_attributes(const nlohmann::json &attributes); + std::optional get_source_volume(); + void set_source_volume(uint8_t volume); + std::optional get_source_player_sources(); + void select_source_player_source(const std::string &source); +}; + +/** + * The media player reports both the source volume and the entity ID of the source as state attributes. + * Source volume changes are sent to the source entity. + */ +class PlayerAttributesSourceVolumeStrategy : public HomeAssistantSourceVolumeStrategy { +public: + PlayerAttributesSourceVolumeStrategy(std::string source_entity_attribute, std::string source_volume_attribute, std::function on_change); + void update_from_player_attributes(const nlohmann::json &attributes); + std::optional get_source_volume(); + void set_source_volume(uint8_t volume); + std::optional get_source_player_sources(); + void select_source_player_source(const std::string &source); + +private: + std::string _source_volume_attribute; + HomeAssistantSourcePlayer _source_player; + + std::mutex _mutex; + std::optional _source_volume; +}; + +/** + * The media player reports the entity ID of the source as a state attribute. The source is itself a + * media player in Home Assistant and its own volume is used as the source volume. + */ +class SourceEntitySourceVolumeStrategy : public HomeAssistantSourceVolumeStrategy { +public: + SourceEntitySourceVolumeStrategy(std::string source_entity_attribute, std::function on_change); + void update_from_player_attributes(const nlohmann::json &attributes); + std::optional get_source_volume(); + void set_source_volume(uint8_t volume); + std::optional get_source_player_sources(); + void select_source_player_source(const std::string &source); + +private: + HomeAssistantSourcePlayer _source_player; +}; + +#endif // !MQTT_MANAGER_HOME_ASSISTANT_SOURCE_VOLUME_HPP diff --git a/docker/MQTTManager/include/media_player/media_player.cpp b/docker/MQTTManager/include/media_player/media_player.cpp new file mode 100644 index 000000000..9b5b61d67 --- /dev/null +++ b/docker/MQTTManager/include/media_player/media_player.cpp @@ -0,0 +1,359 @@ +#include "media_player/media_player.hpp" +#include "command_manager/command_manager.hpp" +#include "database_manager/database_manager.hpp" +#include "mqtt_manager_config/mqtt_manager_config.hpp" +#include "protobuf_nspanel.pb.h" +#include "protobuf_nspanel_entity.pb.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +MediaPlayerEntity::MediaPlayerEntity(uint32_t media_player_id) { + this->_id = media_player_id; + this->reload_config(); + + CommandManager::attach_callback(boost::bind(&MediaPlayerEntity::command_callback, this, _1)); + + SPDLOG_DEBUG("Media player {}::{} base loaded.", this->_id, this->_name); +} + +uint16_t MediaPlayerEntity::get_room_id() { + return this->_room_id; +} + +std::string MediaPlayerEntity::get_name() { + return this->_name; +} + +void MediaPlayerEntity::reload_config() { + auto media_player_entity = database_manager::database.get(this->_id); + this->_name = media_player_entity.friendly_name; + SPDLOG_DEBUG("Loading media player {}::{}.", this->_id, this->_name); + + this->_room_id = media_player_entity.room_id; + this->_entity_page_id = media_player_entity.entities_page_id; + this->_entity_page_slot = media_player_entity.room_view_position; + + nlohmann::json entity_data = media_player_entity.get_entity_data_json(); + if (entity_data.contains("controller")) { + std::string controller = entity_data["controller"]; + if (controller.compare("home_assistant") == 0) { + this->_controller = MQTT_MANAGER_ENTITY_CONTROLLER::HOME_ASSISTANT; + } else if (controller.compare("openhab") == 0) { + SPDLOG_ERROR("OpenHAB media players are not implemented, media player {}::{} will not be available.", this->_id, this->_name); + this->_controller = MQTT_MANAGER_ENTITY_CONTROLLER::OPENHAB; + } else { + SPDLOG_ERROR("Got unknown controller ({}) for media player {}::{}. Will default to HOME_ASSISTANT.", controller, this->_id, this->_name); + this->_controller = MQTT_MANAGER_ENTITY_CONTROLLER::HOME_ASSISTANT; + } + } else { + SPDLOG_ERROR("No controller defined for media player {}::{}. Will default to HOME_ASSISTANT.", this->_id, this->_name); + this->_controller = MQTT_MANAGER_ENTITY_CONTROLLER::HOME_ASSISTANT; + } + + this->_volume_step = 5; // Default when not set or invalid. + if (entity_data.contains("volume_step")) { + try { + int volume_step = entity_data.at("volume_step").is_string() ? std::stoi(entity_data.at("volume_step").get()) : entity_data.at("volume_step").get(); + if (volume_step >= 1 && volume_step <= 100) { + this->_volume_step = volume_step; + } else { + SPDLOG_ERROR("Volume step {} for media player {}::{} is not between 1 and 100. Will default to {}.", volume_step, this->_id, this->_name, this->_volume_step); + } + } catch (std::exception &ex) { + SPDLOG_ERROR("Caught exception while trying to set volume step for media player {}::{}. Will default to {}. Error: {}", this->_id, this->_name, this->_volume_step, ex.what()); + } + } +} + +void MediaPlayerEntity::send_state_update_to_nspanel() { + NSPanelEntityState state; + NSPanelEntityState_MediaPlayer *media_player_state = state.mutable_media_player(); + media_player_state->set_media_player_id(this->_id); + media_player_state->set_name(this->_name); + media_player_state->set_state(this->_state); + media_player_state->set_media_title(this->_media_title); + media_player_state->set_media_artist(this->_media_artist); + media_player_state->set_volume(this->_volume); + media_player_state->set_is_muted(this->_is_muted); + media_player_state->set_has_source_volume(this->_has_source_volume); + media_player_state->set_source_volume(this->_has_source_volume ? this->_source_volume : 0); + media_player_state->set_can_play(this->_can_play); + media_player_state->set_can_pause(this->_can_pause); + media_player_state->set_can_next_track(this->_can_next_track); + media_player_state->set_can_previous_track(this->_can_previous_track); + media_player_state->set_can_set_volume(this->_can_set_volume); + media_player_state->set_can_mute(this->_can_mute); + media_player_state->set_album_art_url(this->_get_album_art_url()); + media_player_state->set_volume_step(this->_volume_step); + media_player_state->set_has_media_position(this->_has_media_position); + if (this->_has_media_position) { + media_player_state->set_media_position(this->_media_position); + media_player_state->set_media_position_updated_at(this->_media_position_updated_at); + } + media_player_state->set_media_duration(this->_media_duration); + { + std::lock_guard lock_guard(this->_sources_mutex); + MediaPlayerEntity::_fill_source_selection(media_player_state->mutable_player_sources(), this->_player_sources); + if (this->_source_player_sources.has_value()) { + MediaPlayerEntity::_fill_source_selection(media_player_state->mutable_source_player_sources(), this->_source_player_sources.value()); + } + } + + google::protobuf::util::MessageDifferencer differencer; + if (!differencer.Compare(this->_last_media_player_state, state)) { + SPDLOG_DEBUG("Sending updated state for media player {}::{} over MQTT.", this->_id, this->_name); + this->_last_media_player_state = state; + + MQTT_Manager::publish_protobuf(this->get_mqtt_state_topic(), state, true); + } else { + SPDLOG_DEBUG("Did not send state update for media player {}::{} as there were no changes.", this->_id, this->_name); + } +} + +void MediaPlayerEntity::command_callback(NSPanelMQTTManagerCommand &command) { + if (!command.has_media_player_command() || static_cast(command.media_player_command().media_player_id()) != this->_id) { + return; + } + + auto media_player_command = command.media_player_command(); + SPDLOG_DEBUG("Received command from NSPanel for media player {}::{}.", this->_id, this->_name); + + switch (media_player_command.playback_action()) { + case NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_PLAY: + this->play(); + break; + case NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_PAUSE: + this->pause(); + break; + case NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_NEXT_TRACK: + this->next_track(); + break; + case NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_PREVIOUS_TRACK: + this->previous_track(); + break; + case NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_NONE: + // The command only changes volume, mute or source. + break; + default: + SPDLOG_WARN("Received unknown playback action {} for media player {}::{}.", static_cast(media_player_command.playback_action()), this->_id, this->_name); + break; + } + + if (media_player_command.has_volume()) { + this->set_volume(std::clamp(media_player_command.volume(), 0, 100)); + } + + if (media_player_command.has_source_volume()) { + this->set_source_volume(std::clamp(media_player_command.source_volume(), 0, 100)); + } + + if (media_player_command.has_muted()) { + this->set_muted(media_player_command.muted()); + } + + if (!media_player_command.select_player_source().empty()) { + std::optional source; + { + std::lock_guard lock_guard(this->_sources_mutex); + source = this->_find_source(this->_player_sources, media_player_command.select_player_source(), "source"); + } + if (source.has_value()) { + this->select_player_source(source.value()); + } + } + + if (!media_player_command.select_source_player_source().empty()) { + std::optional source; + { + std::lock_guard lock_guard(this->_sources_mutex); + source = this->_find_source(this->_source_player_sources, media_player_command.select_source_player_source(), "source player source"); + } + if (source.has_value()) { + this->select_source_player_source(source.value()); + } + } +} + +void MediaPlayerEntity::_set_player_sources(MediaPlayerSources sources) { + std::lock_guard lock_guard(this->_sources_mutex); + if (this->_player_sources != sources) { + this->_warn_if_sources_limited(sources, "sources"); + this->_player_sources = std::move(sources); + } +} + +void MediaPlayerEntity::_set_source_player_sources(std::optional sources) { + std::lock_guard lock_guard(this->_sources_mutex); + if (this->_source_player_sources != sources) { + if (sources.has_value()) { + this->_warn_if_sources_limited(sources.value(), "source player sources"); + } + this->_source_player_sources = std::move(sources); + } +} + +std::string MediaPlayerEntity::_limit_source_name(const std::string &name) { + if (name.size() <= MediaPlayerEntity::max_source_name_length) { + return name; + } + // Step back from the cut while it would land on a UTF-8 continuation byte (10xxxxxx). + size_t length = MediaPlayerEntity::max_source_name_length; + while (length > 0 && (static_cast(name[length]) & 0xC0) == 0x80) { + length--; + } + return name.substr(0, length); +} + +void MediaPlayerEntity::_fill_source_selection(NSPanelEntityState_MediaPlayer_SourceSelection *selection, const MediaPlayerSources &sources) { + for (size_t i = 0; i < sources.sources.size() && i < MediaPlayerEntity::max_sources; i++) { + selection->add_sources(MediaPlayerEntity::_limit_source_name(sources.sources[i])); + } + selection->set_current_source(MediaPlayerEntity::_limit_source_name(sources.current_source)); + selection->set_can_select(sources.can_select); +} + +std::optional MediaPlayerEntity::_find_source(const std::optional &sources, const std::string &name, std::string_view description) { + if (!sources.has_value()) { + SPDLOG_WARN("Received command to select {} '{}' for media player {}::{} but it has no source player.", description, name, this->_id, this->_name); + return std::nullopt; + } + if (!sources->can_select) { + SPDLOG_WARN("Received command to select {} '{}' for media player {}::{} but it can not select one.", description, name, this->_id, this->_name); + return std::nullopt; + } + // Only the sources sent to the NSPanel can be selected, compare with their names as sent. + for (size_t i = 0; i < sources->sources.size() && i < MediaPlayerEntity::max_sources; i++) { + if (MediaPlayerEntity::_limit_source_name(sources->sources[i]).compare(name) == 0) { + return sources->sources[i]; + } + } + SPDLOG_WARN("Received command to select {} '{}' for media player {}::{} but it is not one of its current sources.", description, name, this->_id, this->_name); + return std::nullopt; +} + +void MediaPlayerEntity::_warn_if_sources_limited(const MediaPlayerSources &sources, std::string_view description) { + if (sources.sources.size() > MediaPlayerEntity::max_sources) { + SPDLOG_WARN("Media player {}::{} has {} {}, only the first {} will be sent to the NSPanel.", this->_id, this->_name, sources.sources.size(), description, MediaPlayerEntity::max_sources); + } + for (size_t i = 0; i < sources.sources.size() && i < MediaPlayerEntity::max_sources; i++) { + if (sources.sources[i].size() > MediaPlayerEntity::max_source_name_length) { + SPDLOG_WARN("Media player {}::{} has {} with names longer than {} bytes, they will be shortened on the NSPanel.", this->_id, this->_name, description, MediaPlayerEntity::max_source_name_length); + break; + } + } +} + +void MediaPlayerEntity::_set_album_art_source(const std::string &source) { + std::lock_guard lock_guard(this->_album_art_source_mutex); + if (this->_album_art_source.compare(source) != 0) { + SPDLOG_DEBUG("Album art for media player {}::{} changed.", this->_id, this->_name); + this->_album_art_source = source; + } +} + +std::string MediaPlayerEntity::_get_album_art_url() { + std::string source; + { + std::lock_guard lock_guard(this->_album_art_source_mutex); + source = this->_album_art_source; + } + if (source.empty()) { + return ""; + } + + // The panel downloads from the Nextion image server via the same address and port it uses for everything else on the manager. + // The hash of the source makes the URL change whenever the album art does. + std::string manager_address = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MANAGER_ADDRESS); + uint16_t manager_port = static_cast(MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MANAGER_PORT)); + return fmt::format("http://{}:{}/nextion-img/media_player/{}/album_art?v={:016x}", manager_address, manager_port, this->_id, std::hash{}(source)); +} + +std::shared_ptr MediaPlayerEntity::get_album_art() { + std::string source; + { + std::lock_guard lock_guard(this->_album_art_source_mutex); + source = this->_album_art_source; + } + if (source.empty()) { + return nullptr; + } + + std::lock_guard lock_guard(this->_album_art_download_mutex); + if (this->_album_art_cache_source.compare(source) == 0) { + return this->_album_art_cache; + } + + std::string image_data; + if (!this->_download_album_art(source, image_data)) { + SPDLOG_ERROR("Failed to download album art for media player {}::{}.", this->_id, this->_name); + return nullptr; + } + + SPDLOG_DEBUG("Downloaded {} bytes of album art for media player {}::{}.", image_data.size(), this->_id, this->_name); + this->_album_art_cache_source = source; + this->_album_art_cache = std::make_shared(std::move(image_data)); + return this->_album_art_cache; +} + +MediaPlayerEntity::~MediaPlayerEntity() { + SPDLOG_DEBUG("Destructor for media player {}::{} called.", this->_id, this->_name); + this->_signal_entity_destroyed(); + CommandManager::detach_callback(boost::bind(&MediaPlayerEntity::command_callback, this, _1)); +} + +uint16_t MediaPlayerEntity::get_id() { + return this->_id; +} + +MQTT_MANAGER_ENTITY_TYPE MediaPlayerEntity::get_type() { + return MQTT_MANAGER_ENTITY_TYPE::MEDIA_PLAYER; +} + +MQTT_MANAGER_ENTITY_CONTROLLER MediaPlayerEntity::get_controller() { + return this->_controller; +} + +uint32_t MediaPlayerEntity::get_entity_page_id() { + return this->_entity_page_id; +} + +uint8_t MediaPlayerEntity::get_entity_page_slot() { + return this->_entity_page_slot; +} + +bool MediaPlayerEntity::can_toggle() { + // Media players are opened on the NSPanel entity page instead of being toggled. + return false; +} + +void MediaPlayerEntity::toggle() { +} + +std::string_view MediaPlayerEntity::get_icon() { + return EntityIcons::media_player; +} + +uint16_t MediaPlayerEntity::get_icon_color() { + if (this->_state == NSPanelEntityState_MediaPlayer_PlaybackState_PLAYING || this->_state == NSPanelEntityState_MediaPlayer_PlaybackState_BUFFERING) { + return GUI_Colors::icon_color_on; + } + return GUI_Colors::icon_color_off; +} + +uint16_t MediaPlayerEntity::get_icon_active_color() { + return this->get_icon_color(); +} + +std::string MediaPlayerEntity::get_mqtt_state_topic() { + std::string manager_address = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MANAGER_ADDRESS); + return fmt::format("nspanel/mqttmanager_{}/entities/media_players/{}/state", manager_address, this->get_id()); +} diff --git a/docker/MQTTManager/include/media_player/media_player.hpp b/docker/MQTTManager/include/media_player/media_player.hpp new file mode 100644 index 000000000..1f2d30ea8 --- /dev/null +++ b/docker/MQTTManager/include/media_player/media_player.hpp @@ -0,0 +1,229 @@ +#ifndef MQTT_MANAGER_MEDIA_PLAYER_HPP +#define MQTT_MANAGER_MEDIA_PLAYER_HPP + +#include "protobuf_nspanel.pb.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * Sources a media player (or the source player feeding it) can select, as reported by the controller. + */ +struct MediaPlayerSources { + std::vector sources; + std::string current_source; // Empty if unknown. + bool can_select = false; + + bool operator==(const MediaPlayerSources &other) const = default; +}; + +class MediaPlayerEntity : public MqttManagerEntity { +public: + MediaPlayerEntity(uint32_t media_player_id); + + /** + * Update the config of the media player from DB. + */ + virtual void reload_config(); + + /** + * Get the room ID of the media player. + */ + uint16_t get_room_id(); + + /** + * Get the friendly name for the media player. + */ + std::string get_name(); + + /** + * Send state update to NSPanel via MQTT as Protobuf object. + */ + void send_state_update_to_nspanel(); + + /** + * Callback for NSPanelMQTTManagerCommand protobuf received from MQTT + */ + void command_callback(NSPanelMQTTManagerCommand &command); + + /** + * Start or resume playback. + */ + virtual void play() = 0; + + /** + * Pause playback. + */ + virtual void pause() = 0; + + /** + * Skip to the next track. + */ + virtual void next_track() = 0; + + /** + * Go back to the previous track. + */ + virtual void previous_track() = 0; + + /** + * Set the volume of the media player. + * @param volume: Volume in 0-100% + */ + virtual void set_volume(uint8_t volume) = 0; + + /** + * Set the volume of the source currently feeding the media player. + * @param volume: Volume in 0-100% + */ + virtual void set_source_volume(uint8_t volume) = 0; + + /** + * Mute or unmute the media player. + */ + virtual void set_muted(bool muted) = 0; + + /** + * Select a source (input) of the media player. + * @param source: Name of the source as reported by the controller. + */ + virtual void select_player_source(const std::string &source) = 0; + + /** + * Select a source of the source player currently feeding the media player. + * @param source: Name of the source as reported by the controller. + */ + virtual void select_source_player_source(const std::string &source) = 0; + + // Limits on the source lists sent to the NSPanel, which can only receive 4 KB in one MQTT message. + // The NSPanel pages through longer lists than it can show at once. + static constexpr size_t max_sources = 32; + static constexpr size_t max_source_name_length = 64; // In bytes + + /** + * Get the current album art as the original image data (for example a JPEG) from the controller. + * The image is downloaded on first request and cached until the album art changes. The same pointer is + * returned for as long as the album art stays the same, so it can be used to tell when the art has changed. + * @return The image data or nullptr if there is no album art or it could not be downloaded. + */ + std::shared_ptr get_album_art(); + + uint16_t get_id(); + MQTT_MANAGER_ENTITY_TYPE get_type(); + MQTT_MANAGER_ENTITY_CONTROLLER get_controller(); + uint32_t get_entity_page_id(); + uint8_t get_entity_page_slot(); + bool can_toggle(); + void toggle(); + std::string_view get_icon(); + uint16_t get_icon_color(); + uint16_t get_icon_active_color(); + std::string get_mqtt_state_topic(); + + virtual ~MediaPlayerEntity(); + +protected: + /** + * Set where the album art is fetched from on the controller. An empty source means there is no album art. + * The album art URL sent to the NSPanel changes whenever the source changes. It is sent with the next state update. + */ + void _set_album_art_source(const std::string &source); + + /** + * Download album art from the controller. + * @param source: The album art source as given to _set_album_art_source. + * @param image_data: Where to store the downloaded image data. + * @return true on success. + */ + virtual bool _download_album_art(const std::string &source, std::string &image_data) = 0; + + /** + * Set the sources of the media player. They are sent with the next state update. + */ + void _set_player_sources(MediaPlayerSources sources); + + /** + * Set the sources of the source player feeding the media player, or nothing if there is no source player. + * They are sent with the next state update. + */ + void _set_source_player_sources(std::optional sources); + + uint32_t _id; + std::string _name; + uint16_t _room_id; + MQTT_MANAGER_ENTITY_CONTROLLER _controller; + uint32_t _entity_page_id; + uint8_t _entity_page_slot; + uint8_t _volume_step; // Volume in 1-100% that one volume up/down press on the NSPanel changes + + NSPanelEntityState_MediaPlayer_PlaybackState _state = NSPanelEntityState_MediaPlayer_PlaybackState_UNKNOWN; + std::string _media_title; + std::string _media_artist; + uint8_t _volume = 0; + bool _is_muted = false; + bool _has_source_volume = false; + uint8_t _source_volume = 0; + bool _has_media_position = false; + int32_t _media_position = 0; // In seconds, at _media_position_updated_at + int64_t _media_position_updated_at = 0; // Unix time in seconds + int32_t _media_duration = 0; // In seconds, 0 if unknown + + bool _can_play = false; + bool _can_pause = false; + bool _can_next_track = false; + bool _can_previous_track = false; + bool _can_set_volume = false; + bool _can_mute = false; + + NSPanelEntityState _last_media_player_state; + +private: + /** + * Get the URL the NSPanel should fetch album art from, or an empty string if there is none. + */ + std::string _get_album_art_url(); + + /** + * Shorten a source name to what is sent to the NSPanel, without splitting a UTF-8 character. + */ + static std::string _limit_source_name(const std::string &name); + + /** + * Fill in a source list for the NSPanel, limited to max_sources entries of max_source_name_length bytes. + */ + static void _fill_source_selection(NSPanelEntityState_MediaPlayer_SourceSelection *selection, const MediaPlayerSources &sources); + + /** + * Find the source a name sent by the NSPanel refers to. The NSPanel only knows the limited names. + * @return The source as reported by the controller, or nothing if the source can not be selected. + */ + std::optional _find_source(const std::optional &sources, const std::string &name, std::string_view description); + + /** + * Log a warning if sources will be cut short when sent to the NSPanel. + */ + void _warn_if_sources_limited(const MediaPlayerSources &sources, std::string_view description); + + // Guards the source lists. They are updated by the controller and read when the NSPanel selects a source. + std::mutex _sources_mutex; + MediaPlayerSources _player_sources; + std::optional _source_player_sources; + + // Guards _album_art_source. Only held briefly, never while downloading. + std::mutex _album_art_source_mutex; + std::string _album_art_source; + + // Held while checking the cache and downloading so that panels requesting the same art + // at the same time share one download instead of each fetching it. + std::mutex _album_art_download_mutex; + std::string _album_art_cache_source; + std::shared_ptr _album_art_cache; +}; + +#endif // !MQTT_MANAGER_MEDIA_PLAYER_HPP diff --git a/docker/MQTTManager/include/mqtt_manager/mqtt_manager.cpp b/docker/MQTTManager/include/mqtt_manager/mqtt_manager.cpp index 9af44851d..61370bf6e 100644 --- a/docker/MQTTManager/include/mqtt_manager/mqtt_manager.cpp +++ b/docker/MQTTManager/include/mqtt_manager/mqtt_manager.cpp @@ -67,7 +67,9 @@ void MQTT_Manager::connect() { MQTTMessage message_struct{ .topic = msg->get_topic(), .message = msg->get_payload_str()}; - MQTT_Manager::_mqtt_message_queue.push(message_struct); + if (MQTT_Manager::_mqtt_message_queue.push(message_struct)) { + MQTT_Manager::_notify_mqtt_message_queued(); + } } else if (!MQTT_Manager::_mqtt_client->is_connected()) { WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MQTT not connected."); MQTT_Manager::_reconnect_mqtt_client(); @@ -119,6 +121,15 @@ void MQTT_Manager::reload_config() { } bool MQTT_Manager::is_connected() { + return MQTT_Manager::_caught_up && MQTT_Manager::_broker_connected(); +} + +bool MQTT_Manager::_broker_connected() { +#if defined(TEST_MODE) && TEST_MODE == 1 + if (MQTT_Manager::_test_broker_connected) { + return true; + } +#endif if (MQTT_Manager::_mqtt_client != nullptr) { return MQTT_Manager::_mqtt_client->is_connected(); } else { @@ -126,6 +137,44 @@ bool MQTT_Manager::is_connected() { } } +void MQTT_Manager::_send(mqtt::const_message_ptr msg) { +#if defined(TEST_MODE) && TEST_MODE == 1 + if (MQTT_Manager::_test_broker_connected) { + std::lock_guard lock_guard(MQTT_Manager::_test_published_messages_mutex); + MQTT_Manager::_test_sent_messages.push_back({msg->get_topic(), msg->get_payload_str(), msg->is_retained()}); + return; + } +#endif + MQTT_Manager::_mqtt_client->publish(msg); +} + +void MQTT_Manager::_send_buffered_messages() { + std::lock_guard mutex_guard(MQTT_Manager::_mqtt_client_mutex); + try { + auto it = MQTT_Manager::_mqtt_messages_buffer.cbegin(); + while (it != MQTT_Manager::_mqtt_messages_buffer.cend()) { + MQTT_Manager::_send(*it); + MQTT_Manager::_mqtt_messages_buffer.erase(it++); + } + + // Then the latest value of every retained topic, as the server may have restarted and lost them. + // Sent last so that each topic ends on its newest value, whatever was buffered for it. + std::unordered_map retained_messages; + { + std::lock_guard retain_buffer_guard(MQTT_Manager::_mqtt_retain_buffer_mutex); + retained_messages = MQTT_Manager::_mqtt_retain_buffer; + } + for (const auto &[topic, payload] : retained_messages) { + MQTT_Manager::_send(mqtt::make_message(topic, payload, 0, true)); + } + } catch (std::exception &e) { + SPDLOG_ERROR("Caught exception when trying to publish message: {}", boost::diagnostic_information(e, true)); + } + // Even if a send failed: buffering everything from now on would be worse, and losing the + // connection again starts over. + MQTT_Manager::_caught_up = true; +} + void MQTT_Manager::_reconnect_mqtt_client() { WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MQTT not connected."); @@ -163,6 +212,8 @@ void MQTT_Manager::_reconnect_mqtt_client() { } MQTT_Manager::_stop_consuming = true; + // Buffer everything published from here until the buffered messages have been sent after connecting. + MQTT_Manager::_caught_up = false; while (true) { try { std::lock_guard lock_guard(MQTT_Manager::_mqtt_client_mutex); @@ -217,10 +268,9 @@ void MQTT_Manager::_reconnect_mqtt_client() { MQTT_Manager::publish(fmt::format("nspanel/mqttmanager_{}/status/status", MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MANAGER_ADDRESS)), "online", true); - // Loop over retained MQTT messages and send them again to the MQTT broker as it may have restarted and lost retained messages. - for (auto it = MQTT_Manager::_mqtt_retain_buffer.cbegin(); it != MQTT_Manager::_mqtt_retain_buffer.cend(); it++) { - MQTT_Manager::publish(it->first, it->second, true); - } + // Before subscribing, which takes a while: until this is done everything published is buffered + // behind what was buffered while disconnected. + MQTT_Manager::_send_buffered_messages(); try { SPDLOG_DEBUG("Subscribing to registered MQTT topics."); @@ -240,7 +290,10 @@ void MQTT_Manager::_reconnect_mqtt_client() { .topic = msg->get_topic(), .message = msg->get_payload_str()}; while (!MQTT_Manager::_mqtt_message_queue.push(message_struct)) { + // Queue full: the processing thread is awake draining it, give it the CPU. + std::this_thread::yield(); } + MQTT_Manager::_notify_mqtt_message_queued(); } } while (received_message); } @@ -248,22 +301,27 @@ void MQTT_Manager::_reconnect_mqtt_client() { SPDLOG_ERROR("Caught exception trying to subscribe to topics: {}", boost::diagnostic_information(e, true)); } - // Send buffered messages if any - try { - auto it = MQTT_Manager::_mqtt_messages_buffer.cbegin(); - while (it != MQTT_Manager::_mqtt_messages_buffer.cend()) { - MQTT_Manager::_mqtt_client->publish((*it)); - MQTT_Manager::_mqtt_messages_buffer.erase(it++); - } - } catch (std::exception &e) { - SPDLOG_ERROR("Caught exception when trying to publish message: {}", boost::diagnostic_information(e, true)); - } + MQTT_Manager::_connected_callbacks(); +} + +void MQTT_Manager::_notify_mqtt_message_queued() { + // Taking the mutex orders the push before the processing thread's emptiness check, so the + // notification can't land between that check and the thread starting to wait. + { std::lock_guard lock_guard(MQTT_Manager::_mqtt_message_queue_mutex); } + MQTT_Manager::_mqtt_message_queue_condition.notify_one(); } void MQTT_Manager::_process_mqtt_messages() { while (true) { - while (MQTT_Manager::_mqtt_message_queue.empty()) { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); + { + std::unique_lock lock(MQTT_Manager::_mqtt_message_queue_mutex); + // The timeout is only a safety net, every push notifies. + MQTT_Manager::_mqtt_message_queue_condition.wait_for(lock, std::chrono::seconds(1), [] { + return !MQTT_Manager::_mqtt_message_queue.empty() || MQTT_Manager::_stop_processing_messages; + }); + if (MQTT_Manager::_stop_processing_messages) { + return; + } } MQTT_Manager::_mqtt_message_queue.consume_all([](MQTTMessage message) { try { @@ -292,37 +350,33 @@ void MQTT_Manager::publish(const std::string &topic, const std::string &payload, return; // It's not allowed to publish to empty topic. } +#if defined(TEST_MODE) && TEST_MODE == 1 + { + std::lock_guard lock_guard(MQTT_Manager::_test_published_messages_mutex); + MQTT_Manager::_test_published_messages.push_back({topic, payload, retain}); + } +#endif + if (retain) { + std::lock_guard retain_buffer_guard(MQTT_Manager::_mqtt_retain_buffer_mutex); MQTT_Manager::_mqtt_retain_buffer[topic] = payload; } std::lock_guard mutex_guard(MQTT_Manager::_mqtt_client_mutex); mqtt::message_ptr msg = mqtt::make_message(topic.c_str(), payload.c_str(), payload.size(), 0, retain); + MQTT_Manager::_mirror_to_stomp(topic, payload, retain); if (MQTT_Manager::_mqtt_client != nullptr) { if (MQTT_Manager::is_connected()) { SPDLOG_TRACE("Publising '{}' -> '{}'", topic, payload); while (MQTT_Manager::is_connected()) { try { - MQTT_Manager::_mqtt_client->publish(msg); + MQTT_Manager::_send(msg); break; } catch (std::exception &ex) { SPDLOG_WARN("Caught exception while trying to publish '{}' -> '{}'. Retrying...", topic, payload); std::this_thread::sleep_for(std::chrono::seconds(1)); } } - - // Replicate messages into the websocket STOMP topics. - // Convert payload to base64 as to be able to send it over the websocket. - std::size_t encoded_size = (payload.size() + 2) / 3 * 4; - std::vector encoded_buffer(encoded_size); - // Encode the string - std::size_t written = boost::beast::detail::base64::encode( - encoded_buffer.data(), - payload.data(), - payload.size()); - encoded_buffer.resize(written); - WebsocketServer::set_stomp_topic_retained(fmt::format("mqtt/{}", topic), retain); - WebsocketServer::update_stomp_topic_value(fmt::format("mqtt/{}", topic), std::string(encoded_buffer.begin(), encoded_buffer.end())); } else { MQTT_Manager::_mqtt_messages_buffer.push_back(msg); } @@ -331,6 +385,64 @@ void MQTT_Manager::publish(const std::string &topic, const std::string &payload, } } +bool MQTT_Manager::publish_if_connected(const std::string &topic, std::function()> make_payload) { + if (topic.empty()) { + SPDLOG_ERROR("Tried to publish to empty topic."); + return false; + } + + std::lock_guard mutex_guard(MQTT_Manager::_mqtt_client_mutex); + // Create the payload only now that the lock is held, so it is current when it is sent. + std::optional payload = make_payload(); + if (!payload.has_value()) { + return false; + } + + // STOMP mirrors every message, whether or not MQTT is connected. + MQTT_Manager::_mirror_to_stomp(topic, payload.value(), false); + + // Also dropped while still sending what was buffered after reconnecting: the connected callbacks + // run once that is done. + if (!MQTT_Manager::is_connected()) { + SPDLOG_DEBUG("Not connected to MQTT, will not send message to '{}'.", topic); + return false; + } + + try { + SPDLOG_TRACE("Publising '{}' -> '{}'", topic, payload.value()); + MQTT_Manager::_send(mqtt::make_message(topic.c_str(), payload->c_str(), payload->size(), 2, false)); + } catch (std::exception &ex) { + SPDLOG_WARN("Caught exception while trying to publish '{}' -> '{}'. Will not retry.", topic, payload.value()); + return false; + } + return true; +} + +void MQTT_Manager::attach_connected_callback(std::function callback) { + MQTT_Manager::_connected_callbacks.connect(callback); +} + +void MQTT_Manager::_mirror_to_stomp(const std::string &topic, const std::string &payload, bool retain) { +#if defined(TEST_MODE) && TEST_MODE == 1 + { + std::lock_guard lock_guard(MQTT_Manager::_test_published_messages_mutex); + MQTT_Manager::_test_mirrored_messages.push_back({topic, payload, retain}); + } +#endif + + // Convert payload to base64 as to be able to send it over the websocket. + std::size_t encoded_size = (payload.size() + 2) / 3 * 4; + std::vector encoded_buffer(encoded_size); + // Encode the string + std::size_t written = boost::beast::detail::base64::encode( + encoded_buffer.data(), + payload.data(), + payload.size()); + encoded_buffer.resize(written); + WebsocketServer::set_stomp_topic_retained(fmt::format("mqtt/{}", topic), retain); + WebsocketServer::update_stomp_topic_value(fmt::format("mqtt/{}", topic), std::string(encoded_buffer.begin(), encoded_buffer.end())); +} + void MQTT_Manager::publish_protobuf(const std::string &topic, google::protobuf::Message &payload, bool retain) { std::string payload_string; if (payload.SerializeToString(&payload_string)) { @@ -346,14 +458,18 @@ void MQTT_Manager::clear_retain(const std::string &topic) { return; } - MQTT_Manager::_mqtt_retain_buffer.erase(topic); + { + std::lock_guard retain_buffer_guard(MQTT_Manager::_mqtt_retain_buffer_mutex); + MQTT_Manager::_mqtt_retain_buffer.erase(topic); + } std::lock_guard mutex_guard(MQTT_Manager::_mqtt_client_mutex); WebsocketServer::set_stomp_topic_retained(fmt::format("mqtt/{}", topic), false); if (topic.size() > 0) { mqtt::message_ptr msg = mqtt::make_message(topic.c_str(), "", 0, 0, true); - if (MQTT_Manager::_mqtt_client != nullptr && MQTT_Manager::_mqtt_client->is_connected()) { - MQTT_Manager::_mqtt_client->publish(msg); + // Through the same gate as publish(), so that the clear cannot overtake a buffered value for the topic. + if (MQTT_Manager::_mqtt_client != nullptr && MQTT_Manager::is_connected()) { + MQTT_Manager::_send(msg); } else { MQTT_Manager::_mqtt_messages_buffer.push_back(msg); } diff --git a/docker/MQTTManager/include/mqtt_manager/mqtt_manager.hpp b/docker/MQTTManager/include/mqtt_manager/mqtt_manager.hpp index 8f4238297..b9db491bc 100644 --- a/docker/MQTTManager/include/mqtt_manager/mqtt_manager.hpp +++ b/docker/MQTTManager/include/mqtt_manager/mqtt_manager.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -12,11 +13,17 @@ #include #include #include +#include #include #include #include #include +#if defined(TEST_MODE) && TEST_MODE == 1 +#include +#include +#endif + struct MQTTMessage { std::string topic; std::string message; @@ -32,6 +39,11 @@ class MQTT_Manager { */ static void reload_config(); + /* + * Whether messages are sent to the MQTT server as they are published. False from losing the + * connection until, after reconnecting, the messages buffered meanwhile have been sent: until then + * new messages are buffered behind them, so that nothing overtakes an older message. + */ static bool is_connected(); template @@ -100,27 +112,175 @@ class MQTT_Manager { */ static void publish_protobuf(const std::string &topic, google::protobuf::Message &payload, bool retain); + /** + * Will send a non-retained MQTT message with QoS 2, but only if connected right now. The message is + * never buffered while disconnected or retried on failure, so it suits payloads that are only valid at + * the moment they are sent, such as the current time. (The MQTT client itself may still resend it + * after reconnecting if the connection dropped before the server acknowledged it.) + * The message is mirrored to STOMP whether or not MQTT is connected. + * @param topic: The MQTT topic to send payload to. + * @param make_payload: Called with the MQTT client locked, immediately before sending. Must not call + * back into MQTT_Manager. Return std::nullopt to send nothing. + * @return true if the message was sent over MQTT. + */ + static bool publish_if_connected(const std::string &topic, std::function()> make_payload); + + /** + * Attach a callback that is called each time the connection to the MQTT server has been + * (re)established and every topic has been subscribed to again. + * @param callback: Function to call. + */ + static void attach_connected_callback(std::function callback); + /** * Will clear retain on a topic (not recursive) * @param topic: The MQTT topic to send payload to. */ static void clear_retain(const std::string &topic); +#if defined(TEST_MODE) && TEST_MODE == 1 + struct TestPublishedMessage { + std::string topic; + std::string payload; + bool retain; + }; + + // Everything passed to publish since the last call, whether or not the MQTT client is connected. + static std::vector test_take_published_messages() { + std::lock_guard lock_guard(MQTT_Manager::_test_published_messages_mutex); + return std::exchange(MQTT_Manager::_test_published_messages, {}); + } + + // Number of messages waiting to be sent once connected. + static size_t test_buffered_message_count() { + std::lock_guard mutex_guard(MQTT_Manager::_mqtt_client_mutex); + return MQTT_Manager::_mqtt_messages_buffer.size(); + } + + // Calls the connected callbacks as if a connection to the MQTT server had just been established. + static void test_notify_connected() { + MQTT_Manager::_connected_callbacks(); + } + + // Number of callbacks attached to a topic. + static size_t test_callback_count(const std::string &topic) { + std::lock_guard mutex_guard(MQTT_Manager::_mqtt_client_mutex); + return MQTT_Manager::_mqtt_callbacks.count(topic) > 0 ? MQTT_Manager::_mqtt_callbacks.at(topic).num_slots() : 0; + } + + // While set, behave as if connected to the MQTT server, but record what would have been sent to it + // rather than sending it. Clearing it behaves as losing the connection. + static void test_set_broker_connected(bool connected) { + MQTT_Manager::_test_broker_connected = connected; + if (!connected) { + MQTT_Manager::_caught_up = false; + } + } + + // Send what was buffered while disconnected, as after reconnecting. + static void test_send_buffered_messages() { + MQTT_Manager::_send_buffered_messages(); + } + + // Everything sent to the MQTT server since the last call, in order. Only recorded while + // test_set_broker_connected(true). + static std::vector test_take_sent_messages() { + std::lock_guard lock_guard(MQTT_Manager::_test_published_messages_mutex); + return std::exchange(MQTT_Manager::_test_sent_messages, {}); + } + + // Everything mirrored to STOMP since the last call, in order, with the MQTT topic (without the + // "mqtt/" prefix) and the payload before base64 encoding. + static std::vector test_take_mirrored_messages() { + std::lock_guard lock_guard(MQTT_Manager::_test_published_messages_mutex); + return std::exchange(MQTT_Manager::_test_mirrored_messages, {}); + } + + // Queue a message as if it had been received from the MQTT server. + static bool test_enqueue_message(const std::string &topic, const std::string &message) { + if (!MQTT_Manager::_mqtt_message_queue.push(MQTTMessage{.topic = topic, .message = message})) { + return false; + } + MQTT_Manager::_notify_mqtt_message_queued(); + return true; + } + + // Start the thread that processes queued messages, as connect() does. + static void test_start_processing_thread() { + if (!MQTT_Manager::_process_messages_thread.joinable()) { + MQTT_Manager::_stop_processing_messages = false; + MQTT_Manager::_process_messages_thread = std::thread(MQTT_Manager::_process_mqtt_messages); + } + } + + // Stop the thread that processes queued messages and wait for it to exit. + static void test_stop_processing_thread() { + if (MQTT_Manager::_process_messages_thread.joinable()) { + { + std::lock_guard lock_guard(MQTT_Manager::_mqtt_message_queue_mutex); + MQTT_Manager::_stop_processing_messages = true; + } + MQTT_Manager::_mqtt_message_queue_condition.notify_one(); + MQTT_Manager::_process_messages_thread.join(); + } + } +#endif + private: +#if defined(TEST_MODE) && TEST_MODE == 1 + static inline std::mutex _test_published_messages_mutex; + static inline std::vector _test_published_messages; + static inline std::vector _test_sent_messages; + static inline std::vector _test_mirrored_messages; + static inline std::atomic _test_broker_connected = false; +#endif static inline boost::lockfree::spsc_queue> _mqtt_message_queue; static inline std::thread _process_messages_thread; + // Wakes _process_mqtt_messages when a message is pushed to _mqtt_message_queue. The queue itself + // stays lock-free; the mutex only guards the wait so a notification can't be lost. + static inline std::mutex _mqtt_message_queue_mutex; + static inline std::condition_variable _mqtt_message_queue_condition; + static inline std::atomic _stop_processing_messages = false; static inline mqtt::client *_mqtt_client = nullptr; static inline std::mutex _mqtt_client_mutex; static inline std::mutex _mqtt_message_mutex; static inline std::list _mqtt_messages_buffer; static inline std::unordered_map _mqtt_retain_buffer; // Used so that when we reconnect to an MQTT server that has restarted we can repopulate the retained messages. + static inline std::mutex _mqtt_retain_buffer_mutex; static void _reconnect_mqtt_client(); + // Whether the MQTT client is connected to the server, regardless of _caught_up. + static bool _broker_connected(); + + // Set once the messages buffered while disconnected have been sent, see is_connected(). + static inline std::atomic _caught_up = false; + + /** + * Send the messages buffered while disconnected, in the order they were published, then the latest + * value of every retained topic in case the server restarted and lost them, and mark the client as + * caught up. Holds the client lock throughout, so nothing published meanwhile can overtake them. + */ + static void _send_buffered_messages(); + + // Hand a message to the MQTT client. Called with _mqtt_client_mutex held. + static void _send(mqtt::const_message_ptr msg); + static inline boost::ptr_map> _mqtt_callbacks; static inline std::unordered_map _subscribed_topics; + static inline boost::signals2::signal _connected_callbacks; + + /** + * Replicate a sent MQTT message into the websocket STOMP topic "mqtt/". + */ + static void _mirror_to_stomp(const std::string &topic, const std::string &payload, bool retain); static void _process_mqtt_messages(); + + /** + * Wake the message processing thread. Call after each successful push to _mqtt_message_queue. + */ + static void _notify_mqtt_message_queued(); static void _process_mqtt_command(nlohmann::json &data); static inline std::atomic _reconnect_on_disconnect = true; diff --git a/docker/MQTTManager/include/mqtt_manager_config/mqtt_manager_config.cpp b/docker/MQTTManager/include/mqtt_manager_config/mqtt_manager_config.cpp index edec0b9a3..bc65e2efe 100644 --- a/docker/MQTTManager/include/mqtt_manager_config/mqtt_manager_config.cpp +++ b/docker/MQTTManager/include/mqtt_manager_config/mqtt_manager_config.cpp @@ -2,6 +2,7 @@ #include "light/light.hpp" #include "openssl/evp.h" #include "web_helper/WebHelper.hpp" +#include #include #include #include @@ -15,8 +16,11 @@ #include #include #include +#include +#include #include #include +#include #include #include #include @@ -29,6 +33,7 @@ #include #include #include +#include #include void MqttManagerConfig::load() { @@ -42,6 +47,12 @@ void MqttManagerConfig::load() { boost::algorithm::trim(timezone_str); MqttManagerConfig::timezone = timezone_str; SPDLOG_INFO("Read timezone {} from /etc/timezone.", timezone_str); + MqttManagerConfig::timezone_posix_rule = MqttManagerConfig::read_posix_tz_rule(fmt::format("/usr/share/zoneinfo/{}", timezone_str)); + if (MqttManagerConfig::timezone_posix_rule.empty()) { + SPDLOG_WARN("Could not read a POSIX TZ rule for timezone {}. NSPanels will show the time sent by the manager.", timezone_str); + } else { + SPDLOG_INFO("Using POSIX TZ rule {} for timezone {}.", MqttManagerConfig::timezone_posix_rule, timezone_str); + } SPDLOG_DEBUG("Clearing config values cache."); MqttManagerConfig::_settings_values_cache.clear(); @@ -74,6 +85,7 @@ void MqttManagerConfig::load() { MqttManagerConfig::update_firmware_checksum(); MqttManagerConfig::update_tft_checksums(); + SPDLOG_DEBUG("Checksum calculation done."); MqttManagerConfig::populate_default_and_clean(); @@ -180,181 +192,107 @@ LightTurnOnBehaviour MqttManagerConfig::get_light_turn_on_behaviour() { } void MqttManagerConfig::update_firmware_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); SPDLOG_INFO("Updating/calculating MD5 checksums for all firmware files."); - // Update firmware checksum - auto firmware_checksum = MqttManagerConfig::_get_file_md5_checksum("/usr/src/app/nspanelmanager/firmware/sonoff/firmware.bin"); - if (firmware_checksum.has_value()) { - MqttManagerConfig::_md5_checksum_firmware_sonoff = firmware_checksum.value(); - WebsocketServer::remove_warning("MD5 checksum for sonoff firmware was not able to be calculated."); - SPDLOG_INFO("Firmware checksum: {}", firmware_checksum.value()); - } else { - WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MD5 checksum for sonoff firmware was not able to be calculated."); - SPDLOG_ERROR("Failed to calculate checksum for sonoff firmware!"); - } - - firmware_checksum = MqttManagerConfig::_get_file_md5_checksum("/usr/src/app/nspanelmanager/firmware/custom/firmware.bin"); - if (firmware_checksum.has_value()) { - MqttManagerConfig::_md5_checksum_firmware_custom = firmware_checksum.value(); - WebsocketServer::remove_warning("MD5 checksum for custom firmware was not able to be calculated."); - SPDLOG_INFO("Firmware checksum: {}", firmware_checksum.value()); - } else { - WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MD5 checksum for custom firmware was not able to be calculated."); - SPDLOG_ERROR("Failed to calculate checksum for custom firmware!"); - } - - // Update LittleFS checksum - auto littlefs_checksum = MqttManagerConfig::_get_file_md5_checksum("/usr/src/app/nspanelmanager/firmware/sonoff/data_file.bin"); - if (littlefs_checksum.has_value()) { - MqttManagerConfig::_md5_checksum_littlefs_sonoff = littlefs_checksum.value(); - WebsocketServer::remove_warning("MD5 checksum for sonoff littlefs/data file was not able to be calculated."); - SPDLOG_INFO("LittleFS checksum: {}", littlefs_checksum.value()); - } else { - WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MD5 checksum for sonoff littlefs/data file was not able to be calculated."); - SPDLOG_ERROR("Failed to calculate checksum for LittleFS!"); - } + std::vector files = { + "/usr/src/app/nspanelmanager/firmware/sonoff/firmware.bin", + "/usr/src/app/nspanelmanager/firmware/custom/firmware.bin", + "/usr/src/app/nspanelmanager/firmware/sonoff/data_file.bin", + "/usr/src/app/nspanelmanager/firmware/custom/data_file.bin", + }; + + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + bool recalculate_file = false; + for (auto &file : files) { + // Check if a cached key already exists for the file. + bool file_in_map = MqttManagerConfig::_checksums.find(file) != MqttManagerConfig::_checksums.end(); + std::expected file_mtime; + if (file_in_map) [[likely]] { + file_mtime = MqttManagerConfig::_get_file_mtime(file); + if (file_mtime.has_value()) [[likely]] { + if (MqttManagerConfig::_checksums[file].mtime != *file_mtime) { + recalculate_file = true; + } else [[likely]] { + recalculate_file = false; + } + } else { + SPDLOG_ERROR("Failed to check mtime for file '{}'. Will try to recalculate file checksum anyway.", file); + } + } else { + recalculate_file = true; + } - littlefs_checksum = MqttManagerConfig::_get_file_md5_checksum("/usr/src/app/nspanelmanager/firmware/custom/data_file.bin"); - if (littlefs_checksum.has_value()) { - MqttManagerConfig::_md5_checksum_littlefs_custom = littlefs_checksum.value(); - WebsocketServer::remove_warning("MD5 checksum for custom littlefs/data file was not able to be calculated."); - SPDLOG_INFO("LittleFS checksum: {}", littlefs_checksum.value()); - } else { - WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MD5 checksum for custom littlefs/data file was not able to be calculated."); - SPDLOG_ERROR("Failed to calculate checksum for LittleFS!"); + if (recalculate_file) [[unlikely]] { + auto checksum = MqttManagerConfig::_get_file_md5_checksum(file); + if (checksum.has_value()) [[likely]] { + MqttManagerConfig::_checksums[file] = { + .mtime = file_mtime.has_value() ? std::optional{*file_mtime} : std::nullopt, + .checksum = *checksum, + }; + } else { + SPDLOG_ERROR("Failed to calculate checksum for file '{}'. Error: {}", file, checksum.error()); + } + } } } void MqttManagerConfig::update_tft_checksums() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); SPDLOG_INFO("Updating/calculating MD5 checksums for all .tft GUI files."); - auto eu_tft1_checksum = MqttManagerConfig::_get_file_md5_checksum("/usr/src/app/nspanelmanager/HMI_files/tft_automation/eu/output_tft1/gui.tft"); - if (eu_tft1_checksum.has_value()) { - MqttManagerConfig::_md5_checksum_eu_tft1 = eu_tft1_checksum.value(); - WebsocketServer::remove_warning("MD5 checksum for EU tft1 was not able to be calculated."); - SPDLOG_INFO("EU TFT1 GUI file checksum: {}", eu_tft1_checksum.value()); - } else { - WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MD5 checksum for EU tft1 was not able to be calculated."); - SPDLOG_ERROR("Failed to calculate checksum for EU TFT1 Nextion GUI file!"); - } - - auto eu_tft2_checksum = MqttManagerConfig::_get_file_md5_checksum("/usr/src/app/nspanelmanager/HMI_files/tft_automation/eu/output_tft2/gui.tft"); - if (eu_tft2_checksum.has_value()) { - MqttManagerConfig::_md5_checksum_eu_tft2 = eu_tft2_checksum.value(); - WebsocketServer::remove_warning("MD5 checksum for EU tft2 was not able to be calculated."); - SPDLOG_INFO("EU TFT2 GUI file checksum: {}", eu_tft2_checksum.value()); - } else { - WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MD5 checksum for EU tft2 was not able to be calculated."); - SPDLOG_ERROR("Failed to calculate checksum for EU TFT2 Nextion GUI file!"); - } - - auto eu_tft3_checksum = MqttManagerConfig::_get_file_md5_checksum("/usr/src/app/nspanelmanager/HMI_files/tft_automation/eu/output_tft3/gui.tft"); - if (eu_tft3_checksum.has_value()) { - MqttManagerConfig::_md5_checksum_eu_tft3 = eu_tft3_checksum.value(); - WebsocketServer::remove_warning("MD5 checksum for EU tft3 was not able to be calculated."); - SPDLOG_INFO("EU TFT3 GUI file checksum: {}", eu_tft3_checksum.value()); - } else { - WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MD5 checksum for EU tft3 was not able to be calculated."); - SPDLOG_ERROR("Failed to calculate checksum for EU TFT3 Nextion GUI file!"); - } - - auto eu_tft4_checksum = MqttManagerConfig::_get_file_md5_checksum("/usr/src/app/nspanelmanager/HMI_files/tft_automation/eu/output_tft4/gui.tft"); - if (eu_tft4_checksum.has_value()) { - MqttManagerConfig::_md5_checksum_eu_tft4 = eu_tft4_checksum.value(); - WebsocketServer::remove_warning("MD5 checksum for EU tft4 was not able to be calculated."); - SPDLOG_INFO("EU TFT4 GUI file checksum: {}", eu_tft4_checksum.value()); - } else { - WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MD5 checksum for EU tft4 was not able to be calculated."); - SPDLOG_ERROR("Failed to calculate checksum for EU TFT4 Nextion GUI file!"); - } - - auto us_tft1_checksum = MqttManagerConfig::_get_file_md5_checksum("/usr/src/app/nspanelmanager/HMI_files/tft_automation/us/output_tft1/gui.tft"); - if (us_tft1_checksum.has_value()) { - MqttManagerConfig::_md5_checksum_us_tft1 = us_tft1_checksum.value(); - WebsocketServer::remove_warning("MD5 checksum for US tft1 was not able to be calculated."); - SPDLOG_INFO("US TFT1 GUI file checksum: {}", us_tft1_checksum.value()); - } else { - WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MD5 checksum for US tft1 was not able to be calculated."); - SPDLOG_ERROR("Failed to calculate checksum for US TFT1 Nextion GUI file!"); - } - - auto us_tft2_checksum = MqttManagerConfig::_get_file_md5_checksum("/usr/src/app/nspanelmanager/HMI_files/tft_automation/us/output_tft2/gui.tft"); - if (us_tft2_checksum.has_value()) { - MqttManagerConfig::_md5_checksum_us_tft2 = us_tft2_checksum.value(); - WebsocketServer::remove_warning("MD5 checksum for US tft2 was not able to be calculated."); - SPDLOG_INFO("US TFT2 GUI file checksum: {}", us_tft2_checksum.value()); - } else { - WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MD5 checksum for US tft2 was not able to be calculated."); - SPDLOG_ERROR("Failed to calculate checksum for US TFT2 Nextion GUI file!"); - } - - auto us_tft3_checksum = MqttManagerConfig::_get_file_md5_checksum("/usr/src/app/nspanelmanager/HMI_files/tft_automation/us/output_tft3/gui.tft"); - if (us_tft3_checksum.has_value()) { - MqttManagerConfig::_md5_checksum_us_tft3 = us_tft3_checksum.value(); - WebsocketServer::remove_warning("MD5 checksum for US tft3 was not able to be calculated."); - SPDLOG_INFO("US TFT3 GUI file checksum: {}", us_tft3_checksum.value()); - } else { - WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MD5 checksum for US tft3 was not able to be calculated."); - SPDLOG_ERROR("Failed to calculate checksum for US TFT3 Nextion GUI file!"); - } - - auto us_tft4_checksum = MqttManagerConfig::_get_file_md5_checksum("/usr/src/app/nspanelmanager/HMI_files/tft_automation/us/output_tft4/gui.tft"); - if (us_tft4_checksum.has_value()) { - MqttManagerConfig::_md5_checksum_us_tft4 = us_tft4_checksum.value(); - WebsocketServer::remove_warning("MD5 checksum for US tft4 was not able to be calculated."); - SPDLOG_INFO("US TFT4 GUI file checksum: {}", us_tft4_checksum.value()); - } else { - WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MD5 checksum for US tft4 was not able to be calculated."); - SPDLOG_ERROR("Failed to calculate checksum for US TFT4 Nextion GUI file!"); - } - - auto us_tft1_horizontal_mirrored_checksum = MqttManagerConfig::_get_file_md5_checksum("/usr/src/app/nspanelmanager/HMI_files/tft_automation/us_horizontal_mirrored/output_tft1/gui.tft"); - if (us_tft1_horizontal_mirrored_checksum.has_value()) { - MqttManagerConfig::_md5_checksum_us_horizontal_mirrored_tft1 = us_tft1_horizontal_mirrored_checksum.value(); - WebsocketServer::remove_warning("MD5 checksum for US tft1 (mirrored) was not able to be calculated."); - SPDLOG_INFO("US landscape mirrored TFT1 GUI file checksum: {}", us_tft1_horizontal_mirrored_checksum.value()); - } else { - WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MD5 checksum for US tft1 (mirrored) was not able to be calculated."); - SPDLOG_ERROR("Failed to calculate checksum for US landscape mirrored TFT1 Nextion GUI file!"); - } - - auto us_tft2_horizontal_mirrored_checksum = MqttManagerConfig::_get_file_md5_checksum("/usr/src/app/nspanelmanager/HMI_files/tft_automation/us_horizontal_mirrored/output_tft2/gui.tft"); - if (us_tft2_horizontal_mirrored_checksum.has_value()) { - MqttManagerConfig::_md5_checksum_us_horizontal_mirrored_tft2 = us_tft2_horizontal_mirrored_checksum.value(); - WebsocketServer::remove_warning("MD5 checksum for US tft2 (mirrored) was not able to be calculated."); - SPDLOG_INFO("US landscape mirrored TFT2 GUI file checksum: {}", us_tft2_horizontal_mirrored_checksum.value()); - } else { - WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MD5 checksum for US tft2 (mirrored) was not able to be calculated."); - SPDLOG_ERROR("Failed to calculate checksum for US landscape mirrored TFT2 Nextion GUI file!"); - } - - auto us_tft3_horizontal_mirrored_checksum = MqttManagerConfig::_get_file_md5_checksum("/usr/src/app/nspanelmanager/HMI_files/tft_automation/us_horizontal_mirrored/output_tft3/gui.tft"); - if (us_tft3_horizontal_mirrored_checksum.has_value()) { - MqttManagerConfig::_md5_checksum_us_horizontal_mirrored_tft3 = us_tft3_horizontal_mirrored_checksum.value(); - WebsocketServer::remove_warning("MD5 checksum for US tft3 (mirrored) was not able to be calculated."); - SPDLOG_INFO("US landscape mirrored TFT3 GUI file checksum: {}", us_tft3_horizontal_mirrored_checksum.value()); - } else { - WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MD5 checksum for US tft3 (mirrored) was not able to be calculated."); - SPDLOG_ERROR("Failed to calculate checksum for US landscape mirrored TFT3 Nextion GUI file!"); - } + std::vector files = { + "/usr/src/app/nspanelmanager/HMI_files/tft_automation/eu/output_tft1/gui.tft", + "/usr/src/app/nspanelmanager/HMI_files/tft_automation/eu/output_tft2/gui.tft", + "/usr/src/app/nspanelmanager/HMI_files/tft_automation/eu/output_tft3/gui.tft", + "/usr/src/app/nspanelmanager/HMI_files/tft_automation/eu/output_tft4/gui.tft", + "/usr/src/app/nspanelmanager/HMI_files/tft_automation/us/output_tft1/gui.tft", + "/usr/src/app/nspanelmanager/HMI_files/tft_automation/us/output_tft2/gui.tft", + "/usr/src/app/nspanelmanager/HMI_files/tft_automation/us/output_tft3/gui.tft", + "/usr/src/app/nspanelmanager/HMI_files/tft_automation/us/output_tft4/gui.tft", + "/usr/src/app/nspanelmanager/HMI_files/tft_automation/us_horizontal_mirrored/output_tft1/gui.tft", + "/usr/src/app/nspanelmanager/HMI_files/tft_automation/us_horizontal_mirrored/output_tft2/gui.tft", + "/usr/src/app/nspanelmanager/HMI_files/tft_automation/us_horizontal_mirrored/output_tft3/gui.tft", + "/usr/src/app/nspanelmanager/HMI_files/tft_automation/us_horizontal_mirrored/output_tft4/gui.tft", + }; + + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + bool recalculate_file = false; + for (auto &file : files) { + // Check if a cached key already exists for the file. + bool file_in_map = MqttManagerConfig::_checksums.find(file) != MqttManagerConfig::_checksums.end(); + std::expected file_mtime; + if (file_in_map) [[likely]] { + file_mtime = MqttManagerConfig::_get_file_mtime(file); + if (file_mtime.has_value()) [[likely]] { + if (MqttManagerConfig::_checksums[file].mtime != *file_mtime) { + recalculate_file = true; + } else [[likely]] { + recalculate_file = false; + } + } else { + SPDLOG_ERROR("Failed to check mtime for file '{}'. Will try to recalculate file checksum anyway.", file); + } + } else { + recalculate_file = true; + } - auto us_tft4_horizontal_mirrored_checksum = MqttManagerConfig::_get_file_md5_checksum("/usr/src/app/nspanelmanager/HMI_files/tft_automation/us_horizontal_mirrored/output_tft4/gui.tft"); - if (us_tft4_horizontal_mirrored_checksum.has_value()) { - MqttManagerConfig::_md5_checksum_us_horizontal_mirrored_tft4 = us_tft4_horizontal_mirrored_checksum.value(); - WebsocketServer::remove_warning("MD5 checksum for US tft4 (mirrored) was not able to be calculated."); - SPDLOG_INFO("US landscape mirrored TFT4 GUI file checksum: {}", us_tft4_horizontal_mirrored_checksum.value()); - } else { - WebsocketServer::register_warning(WebsocketServer::ActiveWarningLevel::ERROR, "MD5 checksum for US tft4 (mirrored) was not able to be calculated."); - SPDLOG_ERROR("Failed to calculate checksum for US landscape mirrored TFT4 Nextion GUI file!"); + if (recalculate_file) [[unlikely]] { + auto checksum = MqttManagerConfig::_get_file_md5_checksum(file); + if (checksum.has_value()) [[likely]] { + MqttManagerConfig::_checksums[file] = { + .mtime = file_mtime.has_value() ? std::optional{*file_mtime} : std::nullopt, + .checksum = *checksum, + }; + } else { + SPDLOG_ERROR("Failed to calculate checksum for file '{}'. Error: {}", file, checksum.error()); + } + } } } -std::optional MqttManagerConfig::_get_file_md5_checksum(std::string file_path) { +std::expected MqttManagerConfig::_get_file_md5_checksum(std::string file_path) { std::ifstream file(file_path, std::ifstream::binary); if (!file) { - return std::nullopt; + return std::unexpected("Failed to open file."); } EVP_MD_CTX *mdctx; @@ -365,17 +303,11 @@ std::optional MqttManagerConfig::_get_file_md5_checksum(std::string mdctx = EVP_MD_CTX_new(); EVP_DigestInit_ex(mdctx, EVP_md5(), NULL); - // MD5_Update - // char buffer[1024]; - // while (file.read(buffer, 1024)) { - // EVP_DigestUpdate(mdctx, buffer, file.gcount()); - // } - unsigned char buffer[8192]; while (file.read(reinterpret_cast(buffer), sizeof(buffer)) || file.gcount() > 0) { if (EVP_DigestUpdate(mdctx, buffer, file.gcount()) != 1) { EVP_MD_CTX_free(mdctx); - return ""; + return std::unexpected("Failed to update EVP digiest while processing file"); } } @@ -384,13 +316,6 @@ std::optional MqttManagerConfig::_get_file_md5_checksum(std::string EVP_DigestFinal_ex(mdctx, md5_digest, &md5_digest_len); EVP_MD_CTX_free(mdctx); - // char tmp[3] = {0}; - // std::string return_string; - // for (int i = 0; i < md5_digest_len; i++) { - // sprintf(tmp, "%02x", md5_digest[i]); - // return_string.append(tmp); - // } - std::stringstream ss; ss << std::hex << std::uppercase << std::setfill('0'); for (int i = 0; i < EVP_MD_size(EVP_md5()); i++) { @@ -401,132 +326,165 @@ std::optional MqttManagerConfig::_get_file_md5_checksum(std::string return boost::algorithm::to_lower_copy(ss.str()); // Convert to lowercase as the md5 checksum calculated in Django is calculated with lower case latters. } +std::expected MqttManagerConfig::_get_file_mtime(std::string file_path) { + std::error_code ec; + auto mtime = std::filesystem::last_write_time(file_path, ec); + if (ec) [[unlikely]] { + return std::unexpected(fmt::format("Failed to get last write time (mtime) file file '{}'. Error code: '{}', message: {}", file_path, ec.value(), ec.message())); + } + return mtime; +} + std::expected MqttManagerConfig::get_firmware_sonoff_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); - if (MqttManagerConfig::_md5_checksum_firmware_sonoff.empty()) { + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + if (MqttManagerConfig::_checksums.find("/usr/src/app/nspanelmanager/firmware/sonoff/firmware.bin") == MqttManagerConfig::_checksums.end()) { return std::unexpected(false); } - return MqttManagerConfig::_md5_checksum_firmware_sonoff; + return MqttManagerConfig::_checksums["/usr/src/app/nspanelmanager/firmware/sonoff/firmware.bin"].checksum; } std::expected MqttManagerConfig::get_firmware_custom_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); - if (MqttManagerConfig::_md5_checksum_firmware_custom.empty()) { + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + if (MqttManagerConfig::_checksums.find("/usr/src/app/nspanelmanager/firmware/custom/firmware.bin") == MqttManagerConfig::_checksums.end()) { return std::unexpected(false); } - return MqttManagerConfig::_md5_checksum_firmware_custom; + return MqttManagerConfig::_checksums["/usr/src/app/nspanelmanager/firmware/custom/firmware.bin"].checksum; } std::expected MqttManagerConfig::get_littlefs_sonoff_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); - if (MqttManagerConfig::_md5_checksum_littlefs_sonoff.empty()) { + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + if (MqttManagerConfig::_checksums.find("/usr/src/app/nspanelmanager/firmware/sonoff/data_file.bin") == MqttManagerConfig::_checksums.end()) { return std::unexpected(false); } - return MqttManagerConfig::_md5_checksum_littlefs_sonoff; + return MqttManagerConfig::_checksums["/usr/src/app/nspanelmanager/firmware/sonoff/data_file.bin"].checksum; } std::expected MqttManagerConfig::get_littlefs_custom_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); - if (MqttManagerConfig::_md5_checksum_littlefs_custom.empty()) { + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + if (MqttManagerConfig::_checksums.find("/usr/src/app/nspanelmanager/firmware/custom/data_file.bin") == MqttManagerConfig::_checksums.end()) { return std::unexpected(false); } - return MqttManagerConfig::_md5_checksum_littlefs_custom; + return MqttManagerConfig::_checksums["/usr/src/app/nspanelmanager/firmware/custom/data_file.bin"].checksum; } std::expected MqttManagerConfig::get_eu_tft1_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); - if (MqttManagerConfig::_md5_checksum_eu_tft1.empty()) { + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + if (MqttManagerConfig::_checksums.find("/usr/src/app/nspanelmanager/HMI_files/tft_automation/eu/output_tft1/gui.tft") == MqttManagerConfig::_checksums.end()) { return std::unexpected(false); } - return MqttManagerConfig::_md5_checksum_eu_tft1; + return MqttManagerConfig::_checksums["/usr/src/app/nspanelmanager/HMI_files/tft_automation/eu/output_tft1/gui.tft"].checksum; } std::expected MqttManagerConfig::get_eu_tft2_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); - if (MqttManagerConfig::_md5_checksum_eu_tft2.empty()) { + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + if (MqttManagerConfig::_checksums.find("/usr/src/app/nspanelmanager/HMI_files/tft_automation/eu/output_tft2/gui.tft") == MqttManagerConfig::_checksums.end()) { return std::unexpected(false); } - return MqttManagerConfig::_md5_checksum_eu_tft2; + return MqttManagerConfig::_checksums["/usr/src/app/nspanelmanager/HMI_files/tft_automation/eu/output_tft2/gui.tft"].checksum; } std::expected MqttManagerConfig::get_eu_tft3_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); - if (MqttManagerConfig::_md5_checksum_eu_tft3.empty()) { + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + if (MqttManagerConfig::_checksums.find("/usr/src/app/nspanelmanager/HMI_files/tft_automation/eu/output_tft3/gui.tft") == MqttManagerConfig::_checksums.end()) { return std::unexpected(false); } - return MqttManagerConfig::_md5_checksum_eu_tft3; + return MqttManagerConfig::_checksums["/usr/src/app/nspanelmanager/HMI_files/tft_automation/eu/output_tft3/gui.tft"].checksum; } std::expected MqttManagerConfig::get_eu_tft4_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); - if (MqttManagerConfig::_md5_checksum_eu_tft4.empty()) { + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + if (MqttManagerConfig::_checksums.find("/usr/src/app/nspanelmanager/HMI_files/tft_automation/eu/output_tft4/gui.tft") == MqttManagerConfig::_checksums.end()) { return std::unexpected(false); } - return MqttManagerConfig::_md5_checksum_eu_tft4; + return MqttManagerConfig::_checksums["/usr/src/app/nspanelmanager/HMI_files/tft_automation/eu/output_tft4/gui.tft"].checksum; } std::expected MqttManagerConfig::get_us_tft1_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); - if (MqttManagerConfig::_md5_checksum_us_tft1.empty()) { + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + if (MqttManagerConfig::_checksums.find("/usr/src/app/nspanelmanager/HMI_files/tft_automation/us/output_tft1/gui.tft") == MqttManagerConfig::_checksums.end()) { return std::unexpected(false); } - return MqttManagerConfig::_md5_checksum_us_tft1; + return MqttManagerConfig::_checksums["/usr/src/app/nspanelmanager/HMI_files/tft_automation/us/output_tft1/gui.tft"].checksum; } std::expected MqttManagerConfig::get_us_tft2_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); - if (MqttManagerConfig::_md5_checksum_us_tft2.empty()) { + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + if (MqttManagerConfig::_checksums.find("/usr/src/app/nspanelmanager/HMI_files/tft_automation/us/output_tft2/gui.tft") == MqttManagerConfig::_checksums.end()) { return std::unexpected(false); } - return MqttManagerConfig::_md5_checksum_us_tft2; + return MqttManagerConfig::_checksums["/usr/src/app/nspanelmanager/HMI_files/tft_automation/us/output_tft2/gui.tft"].checksum; } std::expected MqttManagerConfig::get_us_tft3_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); - if (MqttManagerConfig::_md5_checksum_us_tft3.empty()) { + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + if (MqttManagerConfig::_checksums.find("/usr/src/app/nspanelmanager/HMI_files/tft_automation/us/output_tft3/gui.tft") == MqttManagerConfig::_checksums.end()) { return std::unexpected(false); } - return MqttManagerConfig::_md5_checksum_us_tft3; + return MqttManagerConfig::_checksums["/usr/src/app/nspanelmanager/HMI_files/tft_automation/us/output_tft3/gui.tft"].checksum; } std::expected MqttManagerConfig::get_us_tft4_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); - if (MqttManagerConfig::_md5_checksum_us_tft4.empty()) { + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + if (MqttManagerConfig::_checksums.find("/usr/src/app/nspanelmanager/HMI_files/tft_automation/us/output_tft4/gui.tft") == MqttManagerConfig::_checksums.end()) { return std::unexpected(false); } - return MqttManagerConfig::_md5_checksum_us_tft4; + return MqttManagerConfig::_checksums["/usr/src/app/nspanelmanager/HMI_files/tft_automation/us/output_tft4/gui.tft"].checksum; } std::expected MqttManagerConfig::get_us_horizontal_mirrored_tft1_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); - if (MqttManagerConfig::_md5_checksum_us_horizontal_mirrored_tft1.empty()) { + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + if (MqttManagerConfig::_checksums.find("/usr/src/app/nspanelmanager/HMI_files/tft_automation/us_horizontal_mirrored/output_tft1/gui.tft") == MqttManagerConfig::_checksums.end()) { return std::unexpected(false); } - return MqttManagerConfig::_md5_checksum_us_horizontal_mirrored_tft1; + return MqttManagerConfig::_checksums["/usr/src/app/nspanelmanager/HMI_files/tft_automation/us_horizontal_mirrored/output_tft1/gui.tft"].checksum; } std::expected MqttManagerConfig::get_us_horizontal_mirrored_tft2_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); - if (MqttManagerConfig::_md5_checksum_us_horizontal_mirrored_tft2.empty()) { + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + if (MqttManagerConfig::_checksums.find("/usr/src/app/nspanelmanager/HMI_files/tft_automation/us_horizontal_mirrored/output_tft2/gui.tft") == MqttManagerConfig::_checksums.end()) { return std::unexpected(false); } - return MqttManagerConfig::_md5_checksum_us_horizontal_mirrored_tft2; + return MqttManagerConfig::_checksums["/usr/src/app/nspanelmanager/HMI_files/tft_automation/us_horizontal_mirrored/output_tft2/gui.tft"].checksum; } std::expected MqttManagerConfig::get_us_horizontal_mirrored_tft3_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); - if (MqttManagerConfig::_md5_checksum_us_horizontal_mirrored_tft3.empty()) { + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + if (MqttManagerConfig::_checksums.find("/usr/src/app/nspanelmanager/HMI_files/tft_automation/us_horizontal_mirrored/output_tft3/gui.tft") == MqttManagerConfig::_checksums.end()) { return std::unexpected(false); } - return MqttManagerConfig::_md5_checksum_us_horizontal_mirrored_tft3; + return MqttManagerConfig::_checksums["/usr/src/app/nspanelmanager/HMI_files/tft_automation/us_horizontal_mirrored/output_tft3/gui.tft"].checksum; } std::expected MqttManagerConfig::get_us_horizontal_mirrored_tft4_checksum() { - std::lock_guard lock_guard(MqttManagerConfig::_md5_checksum_files_mutex); - if (MqttManagerConfig::_md5_checksum_us_horizontal_mirrored_tft4.empty()) { + std::lock_guard lock_guard(MqttManagerConfig::_checksums_mutex); + if (MqttManagerConfig::_checksums.find("/usr/src/app/nspanelmanager/HMI_files/tft_automation/us_horizontal_mirrored/output_tft4/gui.tft") == MqttManagerConfig::_checksums.end()) { return std::unexpected(false); } - return MqttManagerConfig::_md5_checksum_us_horizontal_mirrored_tft4; + return MqttManagerConfig::_checksums["/usr/src/app/nspanelmanager/HMI_files/tft_automation/us_horizontal_mirrored/output_tft4/gui.tft"].checksum; +} + +std::string MqttManagerConfig::read_posix_tz_rule(const std::string &tzif_path) { + try { + std::ifstream file(tzif_path, std::ios::in | std::ios::binary); + if (!file) { + return ""; + } + std::string content((std::istreambuf_iterator(file)), std::istreambuf_iterator()); + + // Version 2 and later files end with the rule between two newlines (RFC 8536, section 3.3). + // Version 1 files have a zero version byte and no rule. + if (content.size() < 5 || content.compare(0, 4, "TZif") != 0 || content[4] < '2' || content.back() != '\n') { + return ""; + } + size_t rule_start = content.rfind('\n', content.size() - 2); + if (rule_start == std::string::npos) { + return ""; + } + return content.substr(rule_start + 1, content.size() - rule_start - 2); + } catch (std::exception &ex) { + SPDLOG_WARN("Caught exception while reading POSIX TZ rule from '{}': {}", tzif_path, ex.what()); + return ""; + } } // TESTING diff --git a/docker/MQTTManager/include/mqtt_manager_config/mqtt_manager_config.hpp b/docker/MQTTManager/include/mqtt_manager_config/mqtt_manager_config.hpp index 18c52ec19..46b331c3b 100644 --- a/docker/MQTTManager/include/mqtt_manager_config/mqtt_manager_config.hpp +++ b/docker/MQTTManager/include/mqtt_manager_config/mqtt_manager_config.hpp @@ -1,14 +1,17 @@ #ifndef MQTTMANAGER_CONFIG_HPP #define MQTTMANAGER_CONFIG_HPP -#include "light/light.hpp" +#include "filesystem" #include #include #include +#include #include #include +#include #include #include #include +#include #include #include #include @@ -47,9 +50,6 @@ enum MQTT_MANAGER_SETTING { MQTT_USERNAME, OPENHAB_ADDRESS, OPENHAB_TOKEN, - OPENHAB_BRIGHTNESS_CHANNEL_MAX, - OPENHAB_BRIGHTNESS_CHANNEL_MIN, - OPENHAB_RGB_CHANNEL_NAME, OUTSIDE_TEMP_SENSOR_ENTITY_ID, OUTSIDE_TEMP_SENSOR_PROVIDER, WEATHER_PRECIPITATION_FORMAT, @@ -73,6 +73,9 @@ enum MQTT_MANAGER_SETTING { OPTIMISTIC_MODE, LIGHT_TURN_ON_BRIGHTNESS, DEFAULT_NSPANEL_TYPE, + BUZZER_SOUND_TOUCH, + BUZZER_SOUND_SCENE_ACTIVATED, + BUZZER_SOUND_SCENE_SAVED, LAST, // Keep last as to be able to reference the last element in the list. }; @@ -86,6 +89,15 @@ class MqttManagerConfig { static void populate_default_and_clean(); static inline std::string timezone; + // POSIX TZ rule for timezone, read from its tzdata file. Empty if it could not be read. + static inline std::string timezone_posix_rule; + + /** + * Read the POSIX TZ rule from the end of a tzdata (TZif) file, ex. "CET-1CEST,M3.5.0,M10.5.0/3". + * @param tzif_path: Path of the file, ex. /usr/share/zoneinfo/Europe/Stockholm. + * @return The rule, or empty if the file is missing, not version 2 or later, or has no rule. + */ + static std::string read_posix_tz_rule(const std::string &tzif_path); template static T get_setting_with_default(MQTT_MANAGER_SETTING key); @@ -158,24 +170,24 @@ class MqttManagerConfig { static inline LightTurnOnBehaviour _light_turn_on_behaviour = LightTurnOnBehaviour::COLOR_TEMPERATURE; - static std::optional _get_file_md5_checksum(std::string file_path); - static inline std::mutex _md5_checksum_files_mutex; - static inline std::string _md5_checksum_firmware_sonoff; - static inline std::string _md5_checksum_firmware_custom; - static inline std::string _md5_checksum_littlefs_sonoff; - static inline std::string _md5_checksum_littlefs_custom; - static inline std::string _md5_checksum_eu_tft1; - static inline std::string _md5_checksum_eu_tft2; - static inline std::string _md5_checksum_eu_tft3; - static inline std::string _md5_checksum_eu_tft4; - static inline std::string _md5_checksum_us_tft1; - static inline std::string _md5_checksum_us_tft2; - static inline std::string _md5_checksum_us_tft3; - static inline std::string _md5_checksum_us_tft4; - static inline std::string _md5_checksum_us_horizontal_mirrored_tft1; - static inline std::string _md5_checksum_us_horizontal_mirrored_tft2; - static inline std::string _md5_checksum_us_horizontal_mirrored_tft3; - static inline std::string _md5_checksum_us_horizontal_mirrored_tft4; + // A struct of values needed to cache and hold checksums for files. Stored with an unordered map + // where the key of the map is the path to the file. + struct _CachedChecksum { + std::optional mtime; + std::string checksum; + }; + + // Map of cached checksums. Key = file path. + static inline std::unordered_map _checksums; + + // Mutex for _checksums map + static inline std::mutex _checksums_mutex; + + // Get a checksum for a given file. Return error string in case of failure. + static std::expected _get_file_md5_checksum(std::string file_path); + + // Get the mtime (modified time) from a given file. Return error string in case of failure. + static std::expected _get_file_mtime(std::string file_path); static inline std::unordered_map _settings_values_cache; @@ -204,8 +216,6 @@ class MqttManagerConfig { {MQTT_MANAGER_SETTING::MQTT_USERNAME, {"mqtt_username", ""}}, {MQTT_MANAGER_SETTING::OPENHAB_ADDRESS, {"openhab_address", ""}}, {MQTT_MANAGER_SETTING::OPENHAB_TOKEN, {"openhab_token", ""}}, - {MQTT_MANAGER_SETTING::OPENHAB_BRIGHTNESS_CHANNEL_MAX, {"openhab_brightness_channel_max", "255"}}, - {MQTT_MANAGER_SETTING::OPENHAB_BRIGHTNESS_CHANNEL_MIN, {"openhab_brightness_channel_min", "0"}}, {MQTT_MANAGER_SETTING::OUTSIDE_TEMP_SENSOR_ENTITY_ID, {"outside_temp_sensor_entity_id", ""}}, {MQTT_MANAGER_SETTING::OUTSIDE_TEMP_SENSOR_PROVIDER, {"outside_temp_sensor_provider", ""}}, {MQTT_MANAGER_SETTING::WEATHER_PRECIPITATION_FORMAT, {"weather_precipitation_format", "mm"}}, @@ -229,6 +239,9 @@ class MqttManagerConfig { {MQTT_MANAGER_SETTING::OPTIMISTIC_MODE, {"optimistic_mode", "True"}}, {MQTT_MANAGER_SETTING::LIGHT_TURN_ON_BRIGHTNESS, {"light_turn_on_brightness", "50"}}, {MQTT_MANAGER_SETTING::DEFAULT_NSPANEL_TYPE, {"default_nspanel_type", "eu"}}, + {MQTT_MANAGER_SETTING::BUZZER_SOUND_TOUCH, {"buzzer_sound_touch", ""}}, // RTTTL, empty for no sound + {MQTT_MANAGER_SETTING::BUZZER_SOUND_SCENE_ACTIVATED, {"buzzer_sound_scene_activated", ""}}, + {MQTT_MANAGER_SETTING::BUZZER_SOUND_SCENE_SAVED, {"buzzer_sound_scene_saved", ""}}, #if defined(TEST_MODE) && TEST_MODE == 1 {MQTT_MANAGER_SETTING::LAST, {"last", "last_value"}}, #endif diff --git a/docker/MQTTManager/include/nextion_image_server/nextion_image_server.cpp b/docker/MQTTManager/include/nextion_image_server/nextion_image_server.cpp index 8e4939b92..c36ea6fd3 100644 --- a/docker/MQTTManager/include/nextion_image_server/nextion_image_server.cpp +++ b/docker/MQTTManager/include/nextion_image_server/nextion_image_server.cpp @@ -1,39 +1,227 @@ -#include -#include +#include +#include +#include +#include +#include #include +#include +#include #include +#include #include +#include +#include + +// Album art comes from Home Assistant integrations, keep the decoders to the formats they serve and cap the size. +#define STBI_ONLY_JPEG +#define STBI_ONLY_PNG +#define STBI_MAX_DIMENSIONS 4096 +#define STB_IMAGE_IMPLEMENTATION +#include +#define STB_IMAGE_RESIZE_IMPLEMENTATION +#include +#define STB_IMAGE_WRITE_IMPLEMENTATION +#include void NextionImageServer::start() { if (NextionImageServer::_server == nullptr) { - SPDLOG_DEBUG("Creating new ix::HTTPServer."); + SPDLOG_DEBUG("Creating new ix::HttpServer for Nextion image server."); NextionImageServer::_server = new ix::HttpServer(8003, "0.0.0.0"); + NextionImageServer::_server->setOnConnectionCallback(&NextionImageServer::_handle_request); + } - NextionImageServer::_server->setOnConnectionCallback( - [](ix::HttpRequestPtr request, - std::shared_ptr connectionState) -> ix::HttpResponsePtr { - // Build a string for the response - std::stringstream ss; - ss << connectionState->getRemoteIp() - << " " - << request->method - << " " - << request->uri - << std::endl; - - std::string content = ss.str(); - - return std::make_shared(200, "OK", - ix::HttpErrorCode::Ok, - ix::WebSocketHttpHeaders(), - content); - }); - } - auto res = _server->listen(); + auto res = NextionImageServer::_server->listen(); if (!res.first) { - std::cerr << res.second << std::endl; + SPDLOG_ERROR("Failed to start Nextion image server: {}", res.second); return; } NextionImageServer::_server->start(); NextionImageServer::_server->wait(); } + +ix::HttpResponsePtr NextionImageServer::_handle_request(ix::HttpRequestPtr request, std::shared_ptr connection_state) { + // Requests come from anything on the network, never let a bad one take down the manager. + try { + return NextionImageServer::_route_request(request, connection_state); + } catch (const std::exception &e) { + SPDLOG_ERROR("Nextion image server failed to handle {} {}: {}", request->method, request->uri, e.what()); + } catch (...) { + SPDLOG_ERROR("Nextion image server failed to handle {} {}: unknown exception", request->method, request->uri); + } + return NextionImageServer::_text_response(500, "Internal Server Error", "Internal server error."); +} + +ix::HttpResponsePtr NextionImageServer::_route_request(ix::HttpRequestPtr request, std::shared_ptr connection_state) { + SPDLOG_DEBUG("Nextion image server request from {}: {} {}", connection_state->getRemoteIp(), request->method, request->uri); + if (request->method.compare("GET") != 0) { + return NextionImageServer::_text_response(405, "Method Not Allowed", "Only GET is supported."); + } + + std::string path = request->uri; + std::string query; + size_t query_start = path.find('?'); + if (query_start != std::string::npos) { + query = path.substr(query_start + 1); + path = path.substr(0, query_start); + } + + static const std::regex album_art_path(R"(^/nextion-img/media_player/(\d+)/album_art$)"); + std::smatch match; + if (std::regex_match(path, match, album_art_path)) { + uint32_t media_player_id = 0; + std::string id_string = match[1].str(); + auto [ptr, ec] = std::from_chars(id_string.data(), id_string.data() + id_string.size(), media_player_id); + if (ec != std::errc()) { + return NextionImageServer::_text_response(404, "Not Found", "Unknown media player."); + } + return NextionImageServer::_handle_album_art_request(media_player_id, NextionImageServer::_parse_query(query)); + } + + return NextionImageServer::_text_response(404, "Not Found", "Not found."); +} + +ix::HttpResponsePtr NextionImageServer::_handle_album_art_request(uint32_t media_player_id, const std::map &query) { + // Read and validate the requested size and format. + uint16_t size[2] = {NextionImageServer::default_image_dimension, NextionImageServer::default_image_dimension}; + const char *size_keys[2] = {"w", "h"}; + for (int i = 0; i < 2; i++) { + auto it = query.find(size_keys[i]); + if (it == query.end()) { + continue; + } + uint32_t value = 0; + auto [ptr, ec] = std::from_chars(it->second.data(), it->second.data() + it->second.size(), value); + if (ec != std::errc() || ptr != it->second.data() + it->second.size() || value < 1 || value > NextionImageServer::max_image_dimension) { + return NextionImageServer::_text_response(400, "Bad Request", fmt::format("{} must be between 1 and {}.", size_keys[i], NextionImageServer::max_image_dimension)); + } + size[i] = value; + } + + ImageFormat format = ImageFormat::RGB565; + auto format_it = query.find("format"); + if (format_it != query.end()) { + if (format_it->second.compare("rgb565") == 0) { + format = ImageFormat::RGB565; + } else if (format_it->second.compare("png") == 0) { + format = ImageFormat::PNG; + } else { + return NextionImageServer::_text_response(400, "Bad Request", "format must be rgb565 or png."); + } + } + + auto media_player = EntityManager::get_entity_by_id(MQTT_MANAGER_ENTITY_TYPE::MEDIA_PLAYER, media_player_id); + if (!media_player) { + return NextionImageServer::_text_response(404, "Not Found", "Unknown media player."); + } + + std::shared_ptr album_art = (*media_player)->get_album_art(); + if (!album_art) { + // Either the media player has no album art right now or it could not be downloaded, the log tells which. + return NextionImageServer::_text_response(404, "Not Found", "No album art available."); + } + + std::shared_ptr image; + { + // Held while converting so that panels requesting the same image at the same time share one conversion. + std::lock_guard lock_guard(NextionImageServer::_converted_images_mutex); + ConvertedImageKey key = {.media_player_id = media_player_id, .width = size[0], .height = size[1], .format = format}; + auto cached = NextionImageServer::_converted_images.find(key); + if (cached != NextionImageServer::_converted_images.end() && cached->second.source == album_art) { + image = cached->second.image; + } else { + std::optional converted = NextionImageServer::_convert_image(*album_art, size[0], size[1], format); + if (!converted) { + return NextionImageServer::_text_response(502, "Bad Gateway", "Failed to convert album art."); + } + image = std::make_shared(std::move(*converted)); + // Entries for album art that has since changed are only replaced when the same size is requested again, start over rather than grow without bound. + if (cached == NextionImageServer::_converted_images.end() && NextionImageServer::_converted_images.size() >= NextionImageServer::max_converted_images) { + NextionImageServer::_converted_images.clear(); + } + NextionImageServer::_converted_images[key] = {.source = album_art, .image = image}; + } + } + + ix::WebSocketHttpHeaders headers; + headers["Content-Type"] = format == ImageFormat::PNG ? "image/png" : "application/octet-stream"; + headers["X-Image-Width"] = std::to_string(image->width); + headers["X-Image-Height"] = std::to_string(image->height); + return std::make_shared(200, "OK", ix::HttpErrorCode::Ok, headers, image->data); +} + +std::optional NextionImageServer::_convert_image(const std::string &image_data, uint16_t width, uint16_t height, ImageFormat format) { + int source_width, source_height, source_channels; + std::unique_ptr source( + stbi_load_from_memory(reinterpret_cast(image_data.data()), image_data.size(), &source_width, &source_height, &source_channels, 3), + &stbi_image_free); + if (!source) { + SPDLOG_ERROR("Failed to decode image: {}", stbi_failure_reason()); + return std::nullopt; + } + + // Crop the largest centered area of the source with the same aspect ratio as the requested size, then scale it to fill the requested size. + int64_t crop_width = source_width; + int64_t crop_height = source_height; + if (static_cast(source_width) * height > static_cast(source_height) * width) { + crop_width = std::max(1, static_cast(source_height) * width / height); + } else { + crop_height = std::max(1, static_cast(source_width) * height / width); + } + int64_t crop_x = (source_width - crop_width) / 2; + int64_t crop_y = (source_height - crop_height) / 2; + const stbi_uc *crop_start = source.get() + (crop_y * source_width + crop_x) * 3; + + std::vector pixels(static_cast(width) * height * 3); + if (stbir_resize_uint8_srgb(crop_start, crop_width, crop_height, source_width * 3, pixels.data(), width, height, width * 3, STBIR_RGB) == nullptr) { + SPDLOG_ERROR("Failed to resize image from {}x{} to {}x{}.", crop_width, crop_height, width, height); + return std::nullopt; + } + + ConvertedImage image = {.width = width, .height = height, .data = ""}; + if (format == ImageFormat::PNG) { + auto append_to_string = [](void *context, void *data, int size) { + static_cast(context)->append(static_cast(data), size); + }; + if (stbi_write_png_to_func(append_to_string, &image.data, width, height, 3, pixels.data(), width * 3) == 0) { + SPDLOG_ERROR("Failed to encode image as PNG."); + return std::nullopt; + } + } else { + image.data.resize(static_cast(width) * height * 2); + for (size_t i = 0; i < static_cast(width) * height; i++) { + uint16_t red = (pixels[i * 3] * 31 + 127) / 255; + uint16_t green = (pixels[i * 3 + 1] * 63 + 127) / 255; + uint16_t blue = (pixels[i * 3 + 2] * 31 + 127) / 255; + uint16_t rgb565 = (red << 11) | (green << 5) | blue; + image.data[i * 2] = static_cast(rgb565 & 0xFF); + image.data[i * 2 + 1] = static_cast(rgb565 >> 8); + } + } + return image; +} + +std::map NextionImageServer::_parse_query(const std::string &query) { + std::map result; + size_t start = 0; + while (start < query.size()) { + size_t end = query.find('&', start); + if (end == std::string::npos) { + end = query.size(); + } + std::string pair = query.substr(start, end - start); + size_t equals = pair.find('='); + if (equals != std::string::npos) { + result[pair.substr(0, equals)] = pair.substr(equals + 1); + } else if (!pair.empty()) { + result[pair] = ""; + } + start = end + 1; + } + return result; +} + +ix::HttpResponsePtr NextionImageServer::_text_response(int status_code, const std::string &description, const std::string &body) { + ix::WebSocketHttpHeaders headers; + headers["Content-Type"] = "text/plain"; + return std::make_shared(status_code, description, ix::HttpErrorCode::Ok, headers, body); +} diff --git a/docker/MQTTManager/include/nextion_image_server/nextion_image_server.hpp b/docker/MQTTManager/include/nextion_image_server/nextion_image_server.hpp index 47b5e1307..eda063782 100644 --- a/docker/MQTTManager/include/nextion_image_server/nextion_image_server.hpp +++ b/docker/MQTTManager/include/nextion_image_server/nextion_image_server.hpp @@ -1,17 +1,104 @@ #ifndef MQTTMANAGER_NEXTION_IMAGE_SERVER_HPP #define MQTTMANAGER_NEXTION_IMAGE_SERVER_HPP +#include #include +#include +#include +#include +#include +#include +#include +/** + * HTTP server that serves images to the NSPanels, converted into a format the panel can draw. + * nginx forwards /nextion-img/ on the manager to this server. + * + * Endpoints: + * GET /nextion-img/media_player//album_art[?w=&h=&format=] + * Album art for the media player, scaled and center cropped to fill w x h (default 100 x 100). + * format=rgb565 (default): raw pixels, row by row from the top left, 2 bytes per pixel, + * little endian RGB565. The size is in the X-Image-Width/X-Image-Height headers. + * format=png: the same image as a PNG, to check the conversion in a browser. + */ class NextionImageServer { public: /** - * Start the websocket server and bind to 0.0.0.0:8003. + * Start the HTTP server on 0.0.0.0:8003 and block while it is running. */ static void start(); private: + enum class ImageFormat { + RGB565, + PNG, + }; + + struct ConvertedImage { + uint16_t width; + uint16_t height; + std::string data; + }; + + struct ConvertedImageKey { + uint32_t media_player_id; + uint16_t width; + uint16_t height; + ImageFormat format; + + bool operator<(const ConvertedImageKey &other) const { + return std::tie(media_player_id, width, height, format) < std::tie(other.media_player_id, other.width, other.height, other.format); + } + }; + + struct CachedConvertedImage { + // The album art the image was converted from, the entry is outdated once the media player returns different album art. + std::shared_ptr source; + std::shared_ptr image; + }; + + /** + * Handle an HTTP request to the server, responding with an error instead of letting an exception escape. + */ + static ix::HttpResponsePtr _handle_request(ix::HttpRequestPtr request, std::shared_ptr connection_state); + + /** + * Route an HTTP request to the handler for its path. + */ + static ix::HttpResponsePtr _route_request(ix::HttpRequestPtr request, std::shared_ptr connection_state); + + /** + * Handle a request for media player album art. + */ + static ix::HttpResponsePtr _handle_album_art_request(uint32_t media_player_id, const std::map &query); + + /** + * Decode an image (JPEG or PNG), scale and center crop it to fill width x height and encode it in the given format. + * @return The converted image or std::nullopt if the image could not be decoded or encoded. + */ + static std::optional _convert_image(const std::string &image_data, uint16_t width, uint16_t height, ImageFormat format); + + /** + * Parse the query string of a URI ("a=1&b=2") into a map. + */ + static std::map _parse_query(const std::string &query); + + /** + * Create a plain text HTTP response. + */ + static ix::HttpResponsePtr _text_response(int status_code, const std::string &description, const std::string &body); + static inline ix::HttpServer *_server; + + // Converted images, so that panels requesting the same album art do not each decode and scale it again. + static inline std::mutex _converted_images_mutex; + static inline std::map _converted_images; + static constexpr size_t max_converted_images = 32; + + // Largest image size that can be requested. The NSPanel display is 480x320, but format=png can also serve + // larger displays such as a phone showing the web interface. + static constexpr uint16_t max_image_dimension = 1024; + static constexpr uint16_t default_image_dimension = 100; }; #endif diff --git a/docker/MQTTManager/include/nspanel/nspanel.cpp b/docker/MQTTManager/include/nspanel/nspanel.cpp index 66b9061ff..8cf533f84 100644 --- a/docker/MQTTManager/include/nspanel/nspanel.cpp +++ b/docker/MQTTManager/include/nspanel/nspanel.cpp @@ -1,6 +1,8 @@ #include "nspanel.hpp" #include "database_manager/database_manager.hpp" #include "entity_manager/entity_manager.hpp" +#include "manager_clock/manager_clock.hpp" +#include "media_player/media_player.hpp" #include "mqtt_manager/mqtt_manager.hpp" #include "mqtt_manager_config/mqtt_manager_config.hpp" #include "protobuf_nspanel.pb.h" @@ -16,7 +18,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -27,9 +31,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -44,6 +50,7 @@ #include #include #include +#include #include #include @@ -120,7 +127,6 @@ void NSPanel::reload_config() { auto panel_settings = database_manager::database.get(this->_id); std::lock_guard lock_guard(this->_settings_mutex); - bool rebuilt_mqtt = false; // Wether or not to rebuild mqtt topics and subscribe to the new topics. bool name_changed = false; bool reregister_to_ha_mqtt_discovery = false; @@ -134,7 +140,7 @@ void NSPanel::reload_config() { } else if (panel_settings.model.compare("web") == 0) { this->_model = MQTT_MANAGER_NSPANEL_MODEL::WEB; } else { - SPDLOG_ERROR("Failed to prase panel model for NSPanel {}::{}. Got value '{}'. Will assume sonoff.", panel_settings.id, panel_settings.friendly_name, panel_settings.model); + SPDLOG_ERROR("Failed to parse panel model for NSPanel {}::{}. Got value '{}'. Will assume sonoff.", panel_settings.id, panel_settings.friendly_name, panel_settings.model); this->_model = MQTT_MANAGER_NSPANEL_MODEL::SONOFF; } @@ -153,22 +159,19 @@ void NSPanel::reload_config() { if (this->_name.compare(panel_settings.friendly_name) != 0) { this->_name = panel_settings.friendly_name; - rebuilt_mqtt = true; name_changed = true; } bool register_relay1_as_light = this->_get_nspanel_setting_with_default("relay1_is_light", "False").compare("True") == 0; SPDLOG_DEBUG("Will register NSPanel {}::{} relay 1 as {}", this->_id, this->_name, register_relay1_as_light ? "light" : "relay"); if (this->_register_relay1_as_light != register_relay1_as_light) { - rebuilt_mqtt = true; this->_register_relay1_as_light = register_relay1_as_light; reregister_to_ha_mqtt_discovery = true; } bool register_relay2_as_light = this->_get_nspanel_setting_with_default("relay2_is_light", "False").compare("True") == 0; - SPDLOG_DEBUG("Will register NSPanel {}::{} relay 2 as {}", this->_id, this->_name, register_relay1_as_light ? "light" : "relay"); + SPDLOG_DEBUG("Will register NSPanel {}::{} relay 2 as {}", this->_id, this->_name, register_relay2_as_light ? "light" : "relay"); if (this->_register_relay2_as_light != register_relay2_as_light) { - rebuilt_mqtt = true; this->_register_relay2_as_light = register_relay2_as_light; reregister_to_ha_mqtt_discovery = true; } @@ -178,6 +181,8 @@ void NSPanel::reload_config() { this->_heap_used_pct = 0; this->_nspanel_warnings.clear(); this->_temperature = 0; + this->_humidity = 0; + this->_pressure = 0; this->_update_progress = 0; } @@ -185,59 +190,59 @@ void NSPanel::reload_config() { if (panel_settings.denied) { SPDLOG_INFO("Loaded denied NSPanel {}::{}.", this->_id, this->_name); this->_state = MQTT_MANAGER_NSPANEL_STATE::DENIED; - rebuilt_mqtt = false; - } - - if (panel_settings.accepted) { - SPDLOG_INFO("Loaded accepted NSPanel {}::{}.", this->_id, this->_name); - this->_state = MQTT_MANAGER_NSPANEL_STATE::WAITING; - rebuilt_mqtt = true; + return; } if (!panel_settings.denied && !panel_settings.accepted) { // No decission has been made on wether ot accept or deny panel. It is therefore awaiting_accept this->_state = MQTT_MANAGER_NSPANEL_STATE::AWAITING_ACCEPT; - rebuilt_mqtt = true; + } else if (panel_settings.accepted && (this->_state == MQTT_MANAGER_NSPANEL_STATE::AWAITING_ACCEPT || this->_state == MQTT_MANAGER_NSPANEL_STATE::DENIED)) { + // The panel has just been accepted. Wait for it to register again. + this->_state = MQTT_MANAGER_NSPANEL_STATE::WAITING; } - if (rebuilt_mqtt) { - SPDLOG_DEBUG("Building MQTT topics for NSPanel {}::{}", this->_id, this->_name); - this->reset_mqtt_topics(); - // Convert stored MAC to MAC used in MQTT, ex. AA:AA:AA:BB:BB:BB to aa_aa_aa_bb_bb_bb - std::string mqtt_register_mac = this->_mac; - std::replace(mqtt_register_mac.begin(), mqtt_register_mac.end(), ':', '_'); - std::transform(mqtt_register_mac.begin(), mqtt_register_mac.end(), mqtt_register_mac.begin(), [](unsigned char c) { - return std::tolower(c); - }); - this->_mqtt_register_mac = mqtt_register_mac; - - this->_mqtt_config_topic = fmt::format("nspanel/{}/config", this->_mac); - this->_mqtt_log_topic = fmt::format("nspanel/{}/log", this->_name); // TODO: Remove as this is the old log topic. Use the new based on MAC-address instead. - this->_mqtt_command_topic = fmt::format("nspanel/{}/command", this->_mac); - this->_mqtt_sensor_temperature_topic = fmt::format("homeassistant/sensor/nspanelmanager/{}_temperature/config", mqtt_register_mac); - this->_mqtt_sensor_humidity_topic = fmt::format("homeassistant/sensor/nspanelmanager/{}_humidity/config", mqtt_register_mac); - this->_mqtt_sensor_pressure_topic = fmt::format("homeassistant/sensor/nspanelmanager/{}_pressure/config", mqtt_register_mac); - this->_mqtt_switch_relay1_topic = fmt::format("homeassistant/switch/nspanelmanager/{}_relay1/config", mqtt_register_mac); - this->_mqtt_light_relay1_topic = fmt::format("homeassistant/light/nspanelmanager/{}_relay1/config", mqtt_register_mac); - this->_mqtt_switch_relay2_topic = fmt::format("homeassistant/switch/nspanelmanager/{}_relay2/config", mqtt_register_mac); - this->_mqtt_light_relay2_topic = fmt::format("homeassistant/light/nspanelmanager/{}_relay2/config", mqtt_register_mac); - this->_mqtt_switch_screen_topic = fmt::format("homeassistant/switch/nspanelmanager/{}_screen/config", mqtt_register_mac); - this->_mqtt_number_screen_brightness_topic = fmt::format("homeassistant/number/nspanelmanager/{}_screen_brightness/config", mqtt_register_mac); - this->_mqtt_number_screensaver_brightness_topic = fmt::format("homeassistant/number/nspanelmanager/{}_screensaver_brightness/config", mqtt_register_mac); - this->_mqtt_select_screensaver_topic = fmt::format("homeassistant/select/nspanelmanager/{}_screensaver_select/config", mqtt_register_mac); - this->_mqtt_relay1_command_topic = fmt::format("nspanel/{}/relay1_cmd", this->_mac); - this->_mqtt_relay1_state_topic = fmt::format("nspanel/{}/relay1_state", this->_mac); - this->_mqtt_relay2_command_topic = fmt::format("nspanel/{}/relay2_cmd", this->_mac); - this->_mqtt_relay2_state_topic = fmt::format("nspanel/{}/relay2_state", this->_mac); - this->_mqtt_status_topic = fmt::format("nspanel/{}/status", this->_mac); - this->_mqtt_status_report_topic = fmt::format("nspanel/{}/status_report", this->_mac); - this->_mqtt_temperature_topic = fmt::format("nspanel/{}/temperature", this->_mac); - this->_mqtt_humidity_topic = fmt::format("nspanel/{}/humidity", this->_mac); - this->_mqtt_pressure_topic = fmt::format("nspanel/{}/pressure", this->_mac); - this->_mqtt_topic_home_page_status = fmt::format("nspanel/{}/home_page", this->_mac); - this->_mqtt_topic_home_page_all_rooms_status = fmt::format("nspanel/{}/home_page_all", this->_mac); - this->_mqtt_topic_room_entities_page_status = fmt::format("nspanel/{}/entities_page", this->_mac); - } + SPDLOG_DEBUG("Building MQTT topics for NSPanel {}::{}", this->_id, this->_name); + this->reset_mqtt_topics(); + // Convert stored MAC to MAC used in MQTT, ex. AA:AA:AA:BB:BB:BB to aa_aa_aa_bb_bb_bb + std::string mqtt_register_mac = this->_mac; + std::replace(mqtt_register_mac.begin(), mqtt_register_mac.end(), ':', '_'); + std::transform(mqtt_register_mac.begin(), mqtt_register_mac.end(), mqtt_register_mac.begin(), [](unsigned char c) { + return std::tolower(c); + }); + this->_mqtt_register_mac = mqtt_register_mac; + + this->_mqtt_config_topic = fmt::format("nspanel/{}/config", this->_mac); + this->_mqtt_log_topic = fmt::format("nspanel/{}/log", this->_name); // TODO: Remove as this is the old log topic. Use the new based on MAC-address instead. + this->_mqtt_command_topic = fmt::format("nspanel/{}/command", this->_mac); + this->_mqtt_sensor_temperature_topic = fmt::format("homeassistant/sensor/nspanelmanager/{}_temperature/config", mqtt_register_mac); + this->_mqtt_sensor_humidity_topic = fmt::format("homeassistant/sensor/nspanelmanager/{}_humidity/config", mqtt_register_mac); + this->_mqtt_sensor_pressure_topic = fmt::format("homeassistant/sensor/nspanelmanager/{}_pressure/config", mqtt_register_mac); + this->_mqtt_switch_relay1_topic = fmt::format("homeassistant/switch/nspanelmanager/{}_relay1/config", mqtt_register_mac); + this->_mqtt_light_relay1_topic = fmt::format("homeassistant/light/nspanelmanager/{}_relay1/config", mqtt_register_mac); + this->_mqtt_switch_relay2_topic = fmt::format("homeassistant/switch/nspanelmanager/{}_relay2/config", mqtt_register_mac); + this->_mqtt_light_relay2_topic = fmt::format("homeassistant/light/nspanelmanager/{}_relay2/config", mqtt_register_mac); + this->_mqtt_switch_screen_topic = fmt::format("homeassistant/switch/nspanelmanager/{}_screen/config", mqtt_register_mac); + this->_mqtt_number_screen_brightness_topic = fmt::format("homeassistant/number/nspanelmanager/{}_screen_brightness/config", mqtt_register_mac); + this->_mqtt_number_screensaver_brightness_topic = fmt::format("homeassistant/number/nspanelmanager/{}_screensaver_brightness/config", mqtt_register_mac); + this->_mqtt_select_screensaver_topic = fmt::format("homeassistant/select/nspanelmanager/{}_screensaver_select/config", mqtt_register_mac); + this->_mqtt_switch_buzzer_mute_topic = fmt::format("homeassistant/switch/nspanelmanager/{}_buzzer_mute/config", mqtt_register_mac); + this->_mqtt_relay1_command_topic = fmt::format("nspanel/{}/relay1_cmd", this->_mac); + this->_mqtt_relay1_state_topic = fmt::format("nspanel/{}/relay1_state", this->_mac); + this->_mqtt_relay2_command_topic = fmt::format("nspanel/{}/relay2_cmd", this->_mac); + this->_mqtt_relay2_state_topic = fmt::format("nspanel/{}/relay2_state", this->_mac); + this->_mqtt_buzzer_mute_command_topic = fmt::format("nspanel/{}/buzzer_mute_cmd", this->_mac); + this->_mqtt_buzzer_mute_state_topic = fmt::format("nspanel/{}/buzzer_mute_state", this->_mac); + this->_mqtt_status_topic = fmt::format("nspanel/{}/status", this->_mac); + this->_mqtt_status_report_topic = fmt::format("nspanel/{}/status_report", this->_mac); + this->_mqtt_mac_log_topic = fmt::format("nspanel/{}/log", this->_mac); + this->_mqtt_legacy_status_topic = fmt::format("nspanel/{}/status", this->_name); // TODO: Remove me and use only topic based on MAC-address instead + this->_mqtt_legacy_status_report_topic = fmt::format("nspanel/{}/status_report", this->_name); // TODO: Remove me and use only topic based on MAC-address instead + this->_mqtt_temperature_topic = fmt::format("nspanel/{}/temperature", this->_mac); + this->_mqtt_humidity_topic = fmt::format("nspanel/{}/humidity", this->_mac); + this->_mqtt_pressure_topic = fmt::format("nspanel/{}/pressure", this->_mac); + this->_mqtt_topic_home_page_status = fmt::format("nspanel/{}/home_page", this->_mac); + this->_mqtt_topic_home_page_all_rooms_status = fmt::format("nspanel/{}/home_page_all", this->_mac); + this->_mqtt_topic_room_entities_page_status = fmt::format("nspanel/{}/entities_page", this->_mac); if (this->_has_registered_to_manager && !panel_settings.denied && panel_settings.accepted) { WebsocketServer::set_stomp_topic_retained(this->_mqtt_status_topic, true); @@ -247,12 +252,13 @@ void NSPanel::reload_config() { SPDLOG_INFO("Subscribing to NSPanel MQTT topics."); MQTT_Manager::subscribe(this->_mqtt_relay1_state_topic, boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); MQTT_Manager::subscribe(this->_mqtt_relay2_state_topic, boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); - MQTT_Manager::subscribe(this->_mqtt_log_topic, boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); // TODO: Remove me and use only topic based on MAC-address instead - MQTT_Manager::subscribe(fmt::format("nspanel/{}/status", this->_name), boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); // TODO: Remove me and use only topic based on MAC-address instead - MQTT_Manager::subscribe(fmt::format("nspanel/{}/status_report", this->_name), boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); // TODO: Remove me and use only topic based on MAC-address instead - MQTT_Manager::subscribe(fmt::format("nspanel/{}/log", this->_mac), boost::bind(&NSPanel::mqtt_log_callback, this, _1, _2)); + MQTT_Manager::subscribe(this->_mqtt_log_topic, boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); // TODO: Remove me and use only topic based on MAC-address instead + MQTT_Manager::subscribe(this->_mqtt_legacy_status_topic, boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); + MQTT_Manager::subscribe(this->_mqtt_legacy_status_report_topic, boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); + MQTT_Manager::subscribe(this->_mqtt_mac_log_topic, boost::bind(&NSPanel::mqtt_log_callback, this, _1, _2)); MQTT_Manager::subscribe(this->_mqtt_status_topic, boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); MQTT_Manager::subscribe(this->_mqtt_status_report_topic, boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); + MQTT_Manager::subscribe(this->_mqtt_buzzer_mute_command_topic, boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); } if (name_changed || reregister_to_ha_mqtt_discovery) { @@ -296,6 +302,7 @@ void NSPanel::send_config() { config.set_screensaver_dim_level(std::stoi(this->_get_nspanel_setting_with_default("screensaver_dim_level", MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::SCREENSAVER_DIM_LEVEL)))); config.set_screensaver_activation_timeout(std::stoi(this->_get_nspanel_setting_with_default("screensaver_activation_timeout", MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::SCREENSAVER_ACTIVATION_TIMEOUT)))); config.set_clock_us_style(MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::CLOCK_US_STYLE)); + config.set_tz_posix(MqttManagerConfig::timezone_posix_rule); config.set_use_fahrenheit(MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::USE_FAHRENHEIT)); config.set_is_us_panel(this->_get_nspanel_setting_with_default("is_us_panel", "False").compare("True") == 0); config.set_reverse_relays(this->_get_nspanel_setting_with_default("reverse_relays", "False").compare("True") == 0); @@ -308,6 +315,9 @@ void NSPanel::send_config() { config.set_button1_upper_temperature(0); config.set_button2_lower_temperature(0); config.set_button2_upper_temperature(0); + if ((*default_room)->has_temperature_sensor()) { + config.set_inside_temperature_sensor_mqtt_topic((*default_room)->get_temperature_sensor_mqtt_topic()); + } ButtonMode b1_mode = static_cast(this->_settings.button1_mode); if (b1_mode == ButtonMode::DIRECT) { @@ -316,12 +326,21 @@ void NSPanel::send_config() { config.set_button1_mode(NSPanelConfig_NSPanelButtonMode_FOLLOW); } else if (b1_mode == ButtonMode::THERMOSTAT_HEATING) { config.set_button1_mode(NSPanelConfig_NSPanelButtonMode_THERMOSTAT_HEAT); - config.set_button1_lower_temperature(std::stoi(this->_get_nspanel_setting_with_default("button1_relay_lower_temperature", "0"))); - config.set_button1_upper_temperature(std::stoi(this->_get_nspanel_setting_with_default("button1_relay_upper_temperature", "0"))); + config.set_button1_lower_temperature(this->_get_nspanel_temperature_limit_setting("button1_relay_lower_temperature")); + config.set_button1_upper_temperature(this->_get_nspanel_temperature_limit_setting("button1_relay_upper_temperature")); } else if (b1_mode == ButtonMode::THERMOSTAT_COOLING) { config.set_button1_mode(NSPanelConfig_NSPanelButtonMode_THERMOSTAT_COOL); - config.set_button1_lower_temperature(std::stoi(this->_get_nspanel_setting_with_default("button1_relay_lower_temperature", "0"))); - config.set_button1_upper_temperature(std::stoi(this->_get_nspanel_setting_with_default("button1_relay_upper_temperature", "0"))); + config.set_button1_lower_temperature(this->_get_nspanel_temperature_limit_setting("button1_relay_lower_temperature")); + config.set_button1_upper_temperature(this->_get_nspanel_temperature_limit_setting("button1_relay_upper_temperature")); + } else if (b1_mode == ButtonMode::OPEN_MEDIA_PLAYER) { + auto media_players = (*default_room)->get_all_entities_by_type(MQTT_MANAGER_ENTITY_TYPE::MEDIA_PLAYER); + if (!media_players.empty()) { + config.set_button1_mode(NSPanelConfig_NSPanelButtonMode_OPEN_ENTITY_PAGE); + config.set_button1_entity_page_topic(media_players.front()->get_mqtt_state_topic()); + } else { + SPDLOG_WARN("Button 1 on NSPanel {}::{} opens the room's first media player, but room {} has no media player.", this->_id, this->_name, this->_settings.room_id); + config.set_button1_mode(NSPanelConfig_NSPanelButtonMode_NOTIFY_MANAGER); + } } else { config.set_button1_mode(NSPanelConfig_NSPanelButtonMode_NOTIFY_MANAGER); } @@ -333,12 +352,21 @@ void NSPanel::send_config() { config.set_button2_mode(NSPanelConfig_NSPanelButtonMode_FOLLOW); } else if (b2_mode == ButtonMode::THERMOSTAT_HEATING) { config.set_button2_mode(NSPanelConfig_NSPanelButtonMode_THERMOSTAT_HEAT); - config.set_button2_lower_temperature(std::stoi(this->_get_nspanel_setting_with_default("button2_relay_lower_temperature", "0"))); - config.set_button2_upper_temperature(std::stoi(this->_get_nspanel_setting_with_default("button2_relay_upper_temperature", "0"))); + config.set_button2_lower_temperature(this->_get_nspanel_temperature_limit_setting("button2_relay_lower_temperature")); + config.set_button2_upper_temperature(this->_get_nspanel_temperature_limit_setting("button2_relay_upper_temperature")); } else if (b2_mode == ButtonMode::THERMOSTAT_COOLING) { config.set_button2_mode(NSPanelConfig_NSPanelButtonMode_THERMOSTAT_COOL); - config.set_button2_lower_temperature(std::stoi(this->_get_nspanel_setting_with_default("button2_relay_lower_temperature", "0"))); - config.set_button2_upper_temperature(std::stoi(this->_get_nspanel_setting_with_default("button2_relay_upper_temperature", "0"))); + config.set_button2_lower_temperature(this->_get_nspanel_temperature_limit_setting("button2_relay_lower_temperature")); + config.set_button2_upper_temperature(this->_get_nspanel_temperature_limit_setting("button2_relay_upper_temperature")); + } else if (b2_mode == ButtonMode::OPEN_MEDIA_PLAYER) { + auto media_players = (*default_room)->get_all_entities_by_type(MQTT_MANAGER_ENTITY_TYPE::MEDIA_PLAYER); + if (!media_players.empty()) { + config.set_button2_mode(NSPanelConfig_NSPanelButtonMode_OPEN_ENTITY_PAGE); + config.set_button2_entity_page_topic(media_players.front()->get_mqtt_state_topic()); + } else { + SPDLOG_WARN("Button 2 on NSPanel {}::{} opens the room's first media player, but room {} has no media player.", this->_id, this->_name, this->_settings.room_id); + config.set_button2_mode(NSPanelConfig_NSPanelButtonMode_NOTIFY_MANAGER); + } } else { config.set_button2_mode(NSPanelConfig_NSPanelButtonMode_NOTIFY_MANAGER); } @@ -475,12 +503,34 @@ void NSPanel::send_config() { SPDLOG_WARN("No global entities pages were loaded while building config for NSPanel {}::{}", this->_id, this->_name); } - SPDLOG_DEBUG("Sending updated NSPanelConfig to panel {}::{} over MQTT.", this->_id, this->_name); - MQTT_Manager::publish_protobuf(this->_mqtt_config_topic, config, true); + // Load buzzer sounds. A panel setting overrides the global one, an empty value means no sound for that event. + // While the buzzer is muted no sounds are sent, which silences every event. + const std::vector> sound_settings = { + {NSPanelConfig_NSPanelSoundEvent_TOUCH, "buzzer_sound_touch", MQTT_MANAGER_SETTING::BUZZER_SOUND_TOUCH}, + {NSPanelConfig_NSPanelSoundEvent_SCENE_ACTIVATED, "buzzer_sound_scene_activated", MQTT_MANAGER_SETTING::BUZZER_SOUND_SCENE_ACTIVATED}, + {NSPanelConfig_NSPanelSoundEvent_SCENE_SAVED, "buzzer_sound_scene_saved", MQTT_MANAGER_SETTING::BUZZER_SOUND_SCENE_SAVED}, + }; + for (const auto &[event, nspanel_setting_key, global_setting] : sound_settings) { + std::string rtttl = this->_get_nspanel_setting_with_default(nspanel_setting_key, MqttManagerConfig::get_setting_with_default(global_setting)); + if (!rtttl.empty() && !this->_buzzer_muted) { + NSPanelConfig_Sound *sound = config.add_sounds(); + sound->set_event(event); + sound->set_rtttl(rtttl); + } + } + + google::protobuf::util::MessageDifferencer differencer; + if (!differencer.Equals(this->_last_send_config, config)) { + SPDLOG_DEBUG("Sending updated NSPanelConfig to panel {}::{} over MQTT.", this->_id, this->_name); + MQTT_Manager::publish_protobuf(this->_mqtt_config_topic, config, true); + } else { + SPDLOG_DEBUG("Not sending updated config for NSPanel {}::{} as no config change has occured from last sent config."); + } } NSPanel::~NSPanel() { SPDLOG_INFO("Destroying NSPanel {}::{}", this->_id, this->_name); + CommandManager::detach_callback(boost::bind(&NSPanel::command_callback, this, _1)); WebsocketServer::detach_stomp_callback(fmt::format("nspanel/{}/command", this->_mac), boost::bind(&NSPanel::handle_stomp_command_callback, this, _1)); this->reset_mqtt_topics(); @@ -493,6 +543,10 @@ void NSPanel::reset_mqtt_topics() { MQTT_Manager::detach_callback(this->_mqtt_log_topic, boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); MQTT_Manager::detach_callback(this->_mqtt_status_topic, boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); MQTT_Manager::detach_callback(this->_mqtt_status_report_topic, boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); + MQTT_Manager::detach_callback(this->_mqtt_mac_log_topic, boost::bind(&NSPanel::mqtt_log_callback, this, _1, _2)); + MQTT_Manager::detach_callback(this->_mqtt_legacy_status_topic, boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); + MQTT_Manager::detach_callback(this->_mqtt_legacy_status_report_topic, boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); + MQTT_Manager::detach_callback(this->_mqtt_buzzer_mute_command_topic, boost::bind(&NSPanel::mqtt_callback, this, _1, _2)); // This nspanel was removed. Clear any retain on any MQTT topic. MQTT_Manager::clear_retain(this->_mqtt_command_topic); @@ -510,12 +564,16 @@ void NSPanel::reset_ha_mqtt_topics() { MQTT_Manager::clear_retain(this->_mqtt_number_screen_brightness_topic); MQTT_Manager::clear_retain(this->_mqtt_number_screensaver_brightness_topic); MQTT_Manager::clear_retain(this->_mqtt_select_screensaver_topic); + MQTT_Manager::clear_retain(this->_mqtt_switch_buzzer_mute_topic); } void NSPanel::erase() { this->reboot(); this->reset_mqtt_topics(); this->reset_ha_mqtt_topics(); + // Not cleared in reset_mqtt_topics() as that runs on every config reload, and the retained command is what remembers the mute. + MQTT_Manager::clear_retain(this->_mqtt_buzzer_mute_command_topic); + MQTT_Manager::clear_retain(this->_mqtt_buzzer_mute_state_topic); } uint NSPanel::get_id() { @@ -535,12 +593,24 @@ MQTT_MANAGER_NSPANEL_MODEL NSPanel::get_model() { } void NSPanel::mqtt_callback(std::string topic, std::string payload) { - if (payload.empty()) { + if (payload.empty()) [[unlikely]] { return; } try { - if (topic.compare(this->_mqtt_log_topic) == 0) { + if (topic.compare(this->_mqtt_buzzer_mute_command_topic) == 0) { + if (payload.compare("1") != 0 && payload.compare("0") != 0) { + SPDLOG_ERROR("Received unknown buzzer mute command '{}' for NSPanel {}::{}. Expected '1' or '0'.", payload, this->_id, this->_name); + return; + } + bool muted = payload.compare("1") == 0; + bool changed = this->_buzzer_muted.exchange(muted) != muted; + MQTT_Manager::publish(this->_mqtt_buzzer_mute_state_topic, payload, true); + if (changed) { + SPDLOG_INFO("NSPanel {}::{} buzzer {}. Sending config.", this->_id, this->_name, muted ? "muted" : "unmuted"); + this->send_config(); + } + } else if (topic.compare(this->_mqtt_log_topic) == 0) { // Split log message by semicolon to extract MAC, log level and message. std::string message = payload; std::vector message_parts; @@ -555,7 +625,7 @@ void NSPanel::mqtt_callback(std::string topic, std::string payload) { } message_parts.push_back(message); - if (message_parts.size() == 3) { + if (message_parts.size() == 3) [[likely]] { std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); std::tm tm = *std::localtime(&now); std::stringstream buffer; @@ -568,19 +638,26 @@ void NSPanel::mqtt_callback(std::string topic, std::string payload) { std::string send_mac = message_parts[0]; send_mac.erase(std::remove(send_mac.begin(), send_mac.end(), ':'), send_mac.end()); + std::string message = message_parts[2]; + size_t pos = message.find(')'); + if (pos != std::string::npos) { + message.erase(0, pos + 1); + } else { + } + nlohmann::json log_data; log_data["type"] = "log"; log_data["time"] = buffer.str(); log_data["panel"] = this->_name; log_data["mac_address"] = message_parts[0]; log_data["level"] = message_parts[1]; - log_data["message"] = message_parts[2]; + log_data["message"] = message; WebsocketServer::update_stomp_topic_value(fmt::format("nspanel/{}/log", this->_mac), log_data); // Save log message in backtrace for when (if) the log interface requests it. this->_log_messages_backlog["logs"].insert(this->_log_messages_backlog["logs"].begin(), log_data); // Remove older messages from backtrace. - if (this->_log_messages_backlog["logs"].size() > MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MAX_LOG_BUFFER_SIZE)) { + if (this->_log_messages_backlog["logs"].size() > MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MAX_LOG_BUFFER_SIZE)) [[likely]] { this->_log_messages_backlog["logs"].erase(this->_log_messages_backlog["logs"].begin() + MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MAX_LOG_BUFFER_SIZE), this->_log_messages_backlog["logs"].end()); } WebsocketServer::update_stomp_topic_value(fmt::format("nspanel/{}/log_backlog", this->_mac), this->_log_messages_backlog); @@ -594,6 +671,8 @@ void NSPanel::mqtt_callback(std::string topic, std::string payload) { if (state.compare("online") == 0) { this->_state = MQTT_MANAGER_NSPANEL_STATE::ONLINE; SPDLOG_DEBUG("NSPanel {}::{} became ONLINE.", this->_id, this->_name); + // A panel that has just started or reconnected has no clock until it is told the time. + ManagerClock::publish_epoch(); } else if (state.compare("offline") == 0) { this->_state = MQTT_MANAGER_NSPANEL_STATE::OFFLINE; SPDLOG_DEBUG("NSPanel {}::{} became OFFLINE.", this->_id, this->_name); @@ -642,6 +721,9 @@ void NSPanel::mqtt_callback(std::string topic, std::string payload) { case NSPanelStatusReport_state_UPDATING_LITTLEFS: this->_state = MQTT_MANAGER_NSPANEL_STATE::UPDATING_DATA; break; + case NSPanelStatusReport_state_REBOOTING: + this->_state = MQTT_MANAGER_NSPANEL_STATE::REBOOTING; + break; case NSPanelStatusReport_state_NSPanelStatusReport_state_INT_MIN_SENTINEL_DO_NOT_USE_: case NSPanelStatusReport_state_NSPanelStatusReport_state_INT_MAX_SENTINEL_DO_NOT_USE_: break; @@ -759,6 +841,10 @@ void NSPanel::mqtt_callback(std::string topic, std::string payload) { } void NSPanel::mqtt_log_callback(std::string topic, std::string payload) { + if (payload.length() <= 0) [[unlikely]] { + return; // Message is empty. + } + size_t trim_start_pos = payload.find_first_not_of(" \n\r\t"); if (trim_start_pos == std::string::npos) { return; // Message contains no valid chars, only spaces @@ -770,13 +856,21 @@ void NSPanel::mqtt_log_callback(std::string topic, std::string payload) { } if (payload.length() <= 0) [[unlikely]] { - return; // Message is empty. + return; // Message is empty } - payload = payload.substr(trim_start_pos, trim_end_pos + 1 - 4); // Trim spaces and such but also the first 7 chars that is the color coding for the message - if (payload[0] == 0x1B) { // Message formated with color. Remove color - payload = payload.substr(7); - } + // Remove color and other ANSI formating options + boost::regex ansi_escape( + R"(\x1b(?:\[[0-9;]*[A-Za-z]|\][^\x07]*(?:\x07|\x1b\\)|[@-Z\\-_]))", + boost::regex::perl); + payload = boost::regex_replace(payload, ansi_escape, ""); + + // Trim spaces, tabs and other such chars from beginning and end of message + boost::regex start_pattern(R"(^[\t\r\n\f\v ]+)"); + payload = boost::regex_replace(payload, start_pattern, ""); + + boost::regex end_pattern(R"([\t\r\n\f\v ]+$)"); + payload = boost::regex_replace(payload, end_pattern, ""); std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); std::tm tm = *std::localtime(&now); @@ -806,6 +900,9 @@ void NSPanel::mqtt_log_callback(std::string topic, std::string payload) { return; } + // Remove first char that indicates log level. This is stored separately + payload = payload.substr(1); + // Convert payload strings non-printable characters to their hex representation std::string converted_payload; for (char c : payload) { @@ -816,9 +913,17 @@ void NSPanel::mqtt_log_callback(std::string topic, std::string payload) { } } - // Remove first char that indicates log level. This is stored separately - payload = payload.substr(1); - log_data["message"] = converted_payload; // TODO: Clean up message before sending it out + // Remove until ) as all that data has been processed and stored separately. + size_t pos = converted_payload.find(')'); + if (pos != std::string::npos) [[likely]] { + converted_payload.erase(0, pos + 1); + } + if (converted_payload.length() > 0 && converted_payload[0] == ' ') [[likely]] { + converted_payload.erase(0, 1); + } + + log_data["message"] = converted_payload; + WebsocketServer::update_stomp_topic_value(fmt::format("nspanel/{}/log", this->_mac), log_data.dump()); // Save log message in backtrace for when (if) the log interface requests it. @@ -835,14 +940,19 @@ void NSPanel::send_websocket_status_update() { SPDLOG_TRACE("Sending websocket status update for {}::{}", this->_id, this->_name); nlohmann::json status_data = { {"id", this->_id}, + {"mac", this->_mac}, {"name", this->_name}, {"ip_address", this->_ip_address}, {"rssi", this->_rssi}, {"temperature", this->_temperature}, + {"temperature_unit", MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::USE_FAHRENHEIT) ? "°F" : "°C"}, {"humidity", this->_humidity}, {"pressure", this->_pressure}, {"ram_usage", this->_heap_used_pct}, {"update_progress", this->_update_progress}, + {"accepted", this->_state != MQTT_MANAGER_NSPANEL_STATE::AWAITING_ACCEPT}, + {"denied", this->_state == MQTT_MANAGER_NSPANEL_STATE::DENIED}, + {"default_room_id", this->get_default_room_id()}, }; status_data["warnings"] = nlohmann::json::array({}); for (NSPanelWarningWebsocketRepresentation warning : this->_nspanel_warnings) { @@ -852,26 +962,36 @@ void NSPanel::send_websocket_status_update() { }); } + if (this->_model == MQTT_MANAGER_NSPANEL_MODEL::WEB) { + status_data["model"] = "web"; + } else if (this->_model == MQTT_MANAGER_NSPANEL_MODEL::SONOFF) { + status_data["model"] = "sonoff"; + } else if (this->_model == MQTT_MANAGER_NSPANEL_MODEL::CUSTOM) { + status_data["model"] = "custom"; + } else { + status_data["model"] = "unknown"; + } + // Check if NSPanel has firmware, littlefs or tft file updates available and set appropriate warning. // Only check for models that actually have firmware, littlefs and TFT. - if (this->_model != MQTT_MANAGER_NSPANEL_MODEL::WEB) { + if (this->_model == MQTT_MANAGER_NSPANEL_MODEL::SONOFF || this->_model == MQTT_MANAGER_NSPANEL_MODEL::CUSTOM) { if (this->_current_firmware_md5_checksum.empty() || this->_current_littlefs_md5_checksum.empty()) { status_data["warnings"].push_back(nlohmann::json{ {"level", "warning"}, - {"text", "Manager has no checksum for installed firmware on panel. If this doesn't go away within 5 minutes, try performing a firmware update from the manager."}}); + {"text", "Manager has no checksum for installed firmware on panel. If this doesn't go away within 5 minutes, try performing a firmware update."}}); } else if (this->has_firmware_update() || this->has_littlefs_update()) { status_data["warnings"].push_back(nlohmann::json{ - {"level", "warning"}, - {"text", "Firmware update available"}}); + {"level", "info"}, + {"text", "Firmware update available. Perform firmware update to ensure optimal compatibility with manager and latest features and bug fixes."}}); } if (this->_current_tft_md5_checksum.empty()) { status_data["warnings"].push_back(nlohmann::json{ {"level", "warning"}, - {"text", "Manager has no checksum for installed GUI on panel. If this doesn't go away within 5 minutes, try performing a GUI update from the manager."}}); + {"text", "Manager has no checksum for installed GUI on panel. If this doesn't go away within 5 minutes, try performing a GUI update."}}); } else if (this->has_tft_update()) { status_data["warnings"].push_back(nlohmann::json{ - {"level", "warning"}, - {"text", "GUI update available"}}); + {"level", "info"}, + {"text", "GUI update available. Perform GUI update to ensure optimal compatibility with new firmware."}}); } } @@ -900,10 +1020,14 @@ void NSPanel::send_websocket_status_update() { case MQTT_MANAGER_NSPANEL_STATE::AWAITING_ACCEPT: status_data["state"] = "awaiting_accept"; break; + case MQTT_MANAGER_NSPANEL_STATE::REBOOTING: + status_data["state"] = "rebooting"; + break; default: status_data["state"] = "unknown"; break; } + WebsocketServer::set_stomp_topic_retained(this->_mqtt_status_topic, true); WebsocketServer::update_stomp_topic_value(this->_mqtt_status_topic, status_data); } @@ -1099,6 +1223,9 @@ nlohmann::json NSPanel::get_websocket_json_representation() { case MQTT_MANAGER_NSPANEL_STATE::AWAITING_ACCEPT: data["state"] = "awaiting_accept"; break; + case MQTT_MANAGER_NSPANEL_STATE::REBOOTING: + data["state"] = "rebooting"; + break; default: data["state"] = "unknown"; break; @@ -1268,9 +1395,11 @@ bool NSPanel::register_to_manager(const nlohmann::json ®ister_request_payload database_manager::NSPanel panel_settings; if (panel_exists) { panel_settings = database_manager::database.get(this->_id); + } else { + // Panel does not yet exist, take name from register request + panel_settings.friendly_name = register_request_payload.at("friendly_name").get(); } panel_settings.mac_address = this->_mac; - panel_settings.friendly_name = register_request_payload.at("friendly_name").get(); switch (this->_model) { case MQTT_MANAGER_NSPANEL_MODEL::SONOFF: panel_settings.model = "sonoff"; @@ -1510,6 +1639,25 @@ void NSPanel::register_to_home_assistant() { std::string screensaver_select_data_str = screensaver_select_data.dump(); SPDLOG_DEBUG("Registring screensaver mode select for NSPanel {}::{} to Home Assistant.", this->_id, this->_name); MQTT_Manager::publish(this->_mqtt_select_screensaver_topic, screensaver_select_data_str, true); + + // Register buzzer mute switch. Only the Sonoff panel has a buzzer. + if (this->_model == MQTT_MANAGER_NSPANEL_MODEL::SONOFF) { + nlohmann::json buzzer_mute_data = nlohmann::json(base_json); + buzzer_mute_data["device_class"] = "switch"; + buzzer_mute_data["name"] = "Mute sounds"; + buzzer_mute_data["icon"] = "mdi:volume-off"; + buzzer_mute_data["state_topic"] = this->_mqtt_buzzer_mute_state_topic; + buzzer_mute_data["command_topic"] = this->_mqtt_buzzer_mute_command_topic; + buzzer_mute_data["state_on"] = "1"; + buzzer_mute_data["state_off"] = "0"; + buzzer_mute_data["payload_on"] = "1"; + buzzer_mute_data["payload_off"] = "0"; + buzzer_mute_data["retain"] = true; // The retained command is what remembers the mute across manager restarts. + buzzer_mute_data["unique_id"] = fmt::format("{}_buzzer_mute", this->_mqtt_register_mac); + std::string buzzer_mute_data_str = buzzer_mute_data.dump(); + SPDLOG_DEBUG("Registring buzzer mute switch for NSPanel {}::{} to Home Assistant.", this->_id, this->_name); + MQTT_Manager::publish(this->_mqtt_switch_buzzer_mute_topic, buzzer_mute_data_str, true); + } } void NSPanel::set_relay_state(uint8_t relay, bool state) { @@ -1555,6 +1703,11 @@ void NSPanel::command_callback(NSPanelMQTTManagerCommand &command) { break; } + case ButtonMode::OPEN_MEDIA_PLAYER: + // The panel opens the media player itself. It only notifies the manager when the room has no media player. + SPDLOG_WARN("Button 1 on NSPanel {}::{} was pressed, but there is no media player in its room to open.", this->_id, this->_name); + break; + default: SPDLOG_WARN("Unknown button mode triggered from panel."); break; @@ -1589,6 +1742,11 @@ void NSPanel::command_callback(NSPanelMQTTManagerCommand &command) { break; } + case ButtonMode::OPEN_MEDIA_PLAYER: + // The panel opens the media player itself. It only notifies the manager when the room has no media player. + SPDLOG_WARN("Button 2 on NSPanel {}::{} was pressed, but there is no media player in its room to open.", this->_id, this->_name); + break; + default: SPDLOG_WARN("Unknown button mode triggered from panel."); break; @@ -1634,3 +1792,30 @@ std::string NSPanel::_get_nspanel_setting_with_default(std::string key, std::str } return default_value; } + +int NSPanel::_get_nspanel_temperature_limit_setting(std::string key) { + // The limits are free text in the web interface, so a bad value must not stop the config being sent. + std::string value = this->_get_nspanel_setting_with_default(key, "0"); + double limit = 0; + size_t parsed = 0; + try { + limit = std::stod(value, &parsed); + } catch (std::exception &ex) { + parsed = 0; + } + if (parsed == 0 || value.find_first_not_of(" \t", parsed) != std::string::npos || !std::isfinite(limit)) { + SPDLOG_ERROR("NSPanel {}::{} setting {} is '{}', which is not a number. Will send 0.", this->_id, this->_name, key, value); + return 0; + } + if (std::fabs(limit) > std::numeric_limits::max()) { + SPDLOG_ERROR("NSPanel {}::{} setting {} is {}, which is out of range. Will send 0.", this->_id, this->_name, key, value); + return 0; + } + + // NSPanelConfig only holds whole degrees. + int rounded = static_cast(std::lround(limit)); + if (rounded != limit) { + SPDLOG_WARN("NSPanel {}::{} setting {} is {}, but panels only take whole degrees. Will send {}.", this->_id, this->_name, key, value, rounded); + } + return rounded; +} diff --git a/docker/MQTTManager/include/nspanel/nspanel.hpp b/docker/MQTTManager/include/nspanel/nspanel.hpp index 26ebe8859..4c440be88 100644 --- a/docker/MQTTManager/include/nspanel/nspanel.hpp +++ b/docker/MQTTManager/include/nspanel/nspanel.hpp @@ -2,6 +2,7 @@ #define MQTT_MANAGER_NSPANEL #include "protobuf_nspanel.pb.h" #include "websocket_server/websocket_server.hpp" +#include #include #include #include @@ -22,7 +23,8 @@ enum MQTT_MANAGER_NSPANEL_STATE { UPDATING_DATA, UPDATING_TFT, AWAITING_ACCEPT, - DENIED + DENIED, + REBOOTING, }; enum MQTT_MANAGER_NSPANEL_MODEL { @@ -175,6 +177,11 @@ class NSPanel { private: std::string _get_nspanel_setting_with_default(std::string key, std::string default_value); + // A thermostat temperature limit setting, or 0 if it is not a number. + int _get_nspanel_temperature_limit_setting(std::string key); + + // The last config sent to the panel that is currently retained in MQTT. + NSPanelConfig _last_send_config; // Vars: uint32_t _id; @@ -214,31 +221,43 @@ class NSPanel { FOLLOW, THERMOSTAT_HEATING, THERMOSTAT_COOLING, + OPEN_MEDIA_PLAYER, // Opens the first media player in the panel's room. Stored in the database: only append. }; // MQTT Stuff: // Wether or not relay1 should be registered to Home Assistant as a switch or light. - bool _register_relay1_as_light; + bool _register_relay1_as_light = false; // The topic to send commands to the relay1 std::string _mqtt_relay1_command_topic; // The topic where relay1 state is published std::string _mqtt_relay1_state_topic; // Wether or not relay1 is on - bool _relay1_state; + bool _relay1_state = false; // Wether or not relay2 should be registered to Home Assistant as a switch or light. - bool _register_relay2_as_light; + bool _register_relay2_as_light = false; // The topic to send commands to the relay2 std::string _mqtt_relay2_command_topic; // The topic where relay2 state is published std::string _mqtt_relay2_state_topic; // Wether or not relay2 is on - bool _relay2_state; + bool _relay2_state = false; + // The topic Home Assistant sends the buzzer mute command to + std::string _mqtt_buzzer_mute_command_topic; + // The topic where the buzzer mute state is published + std::string _mqtt_buzzer_mute_state_topic; + // Wether or not the buzzer is muted. While muted, no buzzer sounds are sent in the config. + std::atomic _buzzer_muted = false; // The topic to capture logs from MQTT std::string _mqtt_log_topic; // The topic to capture status (online/offline) from MQTT std::string _mqtt_status_topic; // The topic to capture status reports from MQTT std::string _mqtt_status_report_topic; + // The topic to capture logs from MQTT, based on MAC-address + std::string _mqtt_mac_log_topic; + // The old name based status and status report topics, still subscribed to for older firmware + std::string _mqtt_legacy_status_topic; + std::string _mqtt_legacy_status_report_topic; // The topic to send out temperature in raw format instead of encoded in protobuf status report std::string _mqtt_temperature_topic; // The topic to send out humidity in raw format instead of encoded in protobuf status report @@ -260,6 +279,7 @@ class NSPanel { std::string _mqtt_number_screen_brightness_topic; std::string _mqtt_number_screensaver_brightness_topic; std::string _mqtt_select_screensaver_topic; + std::string _mqtt_switch_buzzer_mute_topic; // Topic where to send the NSPanelHomePageStatus protobuf state updates std::string _mqtt_topic_home_page_status; diff --git a/docker/MQTTManager/include/openhab_manager/openhab_manager.cpp b/docker/MQTTManager/include/openhab_manager/openhab_manager.cpp index 82d083360..78edae2f2 100644 --- a/docker/MQTTManager/include/openhab_manager/openhab_manager.cpp +++ b/docker/MQTTManager/include/openhab_manager/openhab_manager.cpp @@ -242,6 +242,12 @@ std::string OpenhabManager::_fetch_item_state_via_rest(std::string item) { void OpenhabManager::send_json(nlohmann::json &data) { data["source"] = "NSPanelManager::MqttManager"; +#if defined(TEST_MODE) && TEST_MODE == 1 + { + std::lock_guard lock_guard(OpenhabManager::_test_sent_messages_mutex); + OpenhabManager::_test_sent_messages.push_back(data); + } +#endif std::string buffer = data.dump(); OpenhabManager::_send_string(buffer); } diff --git a/docker/MQTTManager/include/openhab_manager/openhab_manager.hpp b/docker/MQTTManager/include/openhab_manager/openhab_manager.hpp index 592319542..58f8ca8fa 100644 --- a/docker/MQTTManager/include/openhab_manager/openhab_manager.hpp +++ b/docker/MQTTManager/include/openhab_manager/openhab_manager.hpp @@ -16,6 +16,11 @@ #include #include +#if defined(TEST_MODE) && TEST_MODE == 1 +#include +#include +#endif + class OpenhabManager { public: static void connect(); @@ -75,7 +80,31 @@ class OpenhabManager { OpenhabManager::_openhab_item_observers[item].disconnect(callback); } +#if defined(TEST_MODE) && TEST_MODE == 1 + // Everything passed to send_json since the last call, whether or not OpenHAB is connected. + static std::vector test_take_sent_messages() { + std::lock_guard lock_guard(OpenhabManager::_test_sent_messages_mutex); + return std::exchange(OpenhabManager::_test_sent_messages, {}); + } + + // Deliver a message as if it had been received on the OpenHAB websocket. + static void test_process_websocket_message(const std::string &message) { + OpenhabManager::_process_websocket_message(message); + } + + // Set where REST requests go without (re)connecting the websocket. + static void test_set_rest_api(const std::string &address, const std::string &token) { + std::lock_guard lock_guard(OpenhabManager::_setting_values_mutex); + OpenhabManager::_openhab_address = address; + OpenhabManager::_openhab_token = token; + } +#endif + private: +#if defined(TEST_MODE) && TEST_MODE == 1 + static inline std::mutex _test_sent_messages_mutex; + static inline std::vector _test_sent_messages; +#endif static void _process_openhab_event(nlohmann::json &event_data); // Callback registration for items static inline boost::ptr_map> _openhab_item_observers; diff --git a/docker/MQTTManager/include/protobuf/protobuf_nspanel.pb.cc b/docker/MQTTManager/include/protobuf/protobuf_nspanel.pb.cc index f5d31075a..6beec92a6 100644 --- a/docker/MQTTManager/include/protobuf/protobuf_nspanel.pb.cc +++ b/docker/MQTTManager/include/protobuf/protobuf_nspanel.pb.cc @@ -128,6 +128,8 @@ inline constexpr NSPanelRoomEntitiesPage_EntitySlot::Impl_::Impl_( pco_{0}, pco2_{0}, can_save_scene_{false}, + type_{static_cast< ::NSPanelRoomEntitiesPage_EntitySlot_EntityType >(0)}, + id_{0}, _cached_size_{0} {} template @@ -229,6 +231,38 @@ struct NSPanelMQTTManagerCommand_SaveSceneCommandDefaultTypeInternal { PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NSPanelMQTTManagerCommand_SaveSceneCommandDefaultTypeInternal _NSPanelMQTTManagerCommand_SaveSceneCommand_default_instance_; +inline constexpr NSPanelMQTTManagerCommand_MediaPlayerCommand::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : select_player_source_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + select_source_player_source_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + media_player_id_{0}, + playback_action_{static_cast< ::NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction >(0)}, + volume_{0}, + has_volume_{false}, + has_source_volume_{false}, + has_muted_{false}, + muted_{false}, + source_volume_{0}, + _cached_size_{0} {} + +template +PROTOBUF_CONSTEXPR NSPanelMQTTManagerCommand_MediaPlayerCommand::NSPanelMQTTManagerCommand_MediaPlayerCommand(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} +struct NSPanelMQTTManagerCommand_MediaPlayerCommandDefaultTypeInternal { + PROTOBUF_CONSTEXPR NSPanelMQTTManagerCommand_MediaPlayerCommandDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~NSPanelMQTTManagerCommand_MediaPlayerCommandDefaultTypeInternal() {} + union { + NSPanelMQTTManagerCommand_MediaPlayerCommand _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NSPanelMQTTManagerCommand_MediaPlayerCommandDefaultTypeInternal _NSPanelMQTTManagerCommand_MediaPlayerCommand_default_instance_; + inline constexpr NSPanelMQTTManagerCommand_LightCommand::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept : light_ids_{}, @@ -302,6 +336,30 @@ struct NSPanelMQTTManagerCommand_FirstPageTurnLightOffDefaultTypeInternal { PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NSPanelMQTTManagerCommand_FirstPageTurnLightOffDefaultTypeInternal _NSPanelMQTTManagerCommand_FirstPageTurnLightOff_default_instance_; +inline constexpr NSPanelMQTTManagerCommand_CoverCommand::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : cover_id_{0}, + action_{static_cast< ::NSPanelMQTTManagerCommand_CoverCommand_Action >(0)}, + position_{0}, + has_position_{false}, + has_tilt_position_{false}, + tilt_position_{0}, + _cached_size_{0} {} + +template +PROTOBUF_CONSTEXPR NSPanelMQTTManagerCommand_CoverCommand::NSPanelMQTTManagerCommand_CoverCommand(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} +struct NSPanelMQTTManagerCommand_CoverCommandDefaultTypeInternal { + PROTOBUF_CONSTEXPR NSPanelMQTTManagerCommand_CoverCommandDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~NSPanelMQTTManagerCommand_CoverCommandDefaultTypeInternal() {} + union { + NSPanelMQTTManagerCommand_CoverCommand _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NSPanelMQTTManagerCommand_CoverCommandDefaultTypeInternal _NSPanelMQTTManagerCommand_CoverCommand_default_instance_; + inline constexpr NSPanelMQTTManagerCommand_ButtonPressed::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept : button_id_{0}, @@ -321,6 +379,28 @@ struct NSPanelMQTTManagerCommand_ButtonPressedDefaultTypeInternal { PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NSPanelMQTTManagerCommand_ButtonPressedDefaultTypeInternal _NSPanelMQTTManagerCommand_ButtonPressed_default_instance_; +inline constexpr NSPanelConfig_Sound::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : rtttl_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + event_{static_cast< ::NSPanelConfig_NSPanelSoundEvent >(0)}, + _cached_size_{0} {} + +template +PROTOBUF_CONSTEXPR NSPanelConfig_Sound::NSPanelConfig_Sound(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} +struct NSPanelConfig_SoundDefaultTypeInternal { + PROTOBUF_CONSTEXPR NSPanelConfig_SoundDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~NSPanelConfig_SoundDefaultTypeInternal() {} + union { + NSPanelConfig_Sound _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NSPanelConfig_SoundDefaultTypeInternal _NSPanelConfig_Sound_default_instance_; + inline constexpr NSPanelConfig_RoomInfo::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept : entity_page_ids_{}, @@ -481,12 +561,22 @@ inline constexpr NSPanelConfig::Impl_::Impl_( _relay1_relay_group_cached_byte_size_{0}, relay2_relay_group_{}, _relay2_relay_group_cached_byte_size_{0}, + sounds_{}, name_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), inside_temperature_sensor_mqtt_topic_( &::google::protobuf::internal::fixed_address_empty_string, ::_pbi::ConstantInitialized()), + tz_posix_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + button1_entity_page_topic_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + button2_entity_page_topic_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), default_room_{0}, default_page_{static_cast< ::NSPanelConfig_NSPanelDefaultPage >(0)}, screensaver_activation_timeout_{0}, @@ -532,7 +622,7 @@ struct NSPanelConfigDefaultTypeInternal { PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NSPanelConfigDefaultTypeInternal _NSPanelConfig_default_instance_; -static const ::_pb::EnumDescriptor* file_level_enum_descriptors_protobuf_5fnspanel_2eproto[6]; +static const ::_pb::EnumDescriptor* file_level_enum_descriptors_protobuf_5fnspanel_2eproto[10]; static constexpr const ::_pb::ServiceDescriptor** file_level_service_descriptors_protobuf_5fnspanel_2eproto = nullptr; const ::uint32_t @@ -550,6 +640,16 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::NSPanelConfig_RoomInfo, _impl_.entity_page_ids_), PROTOBUF_FIELD_OFFSET(::NSPanelConfig_RoomInfo, _impl_.scene_page_ids_), ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::NSPanelConfig_Sound, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::NSPanelConfig_Sound, _impl_.event_), + PROTOBUF_FIELD_OFFSET(::NSPanelConfig_Sound, _impl_.rtttl_), + ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::NSPanelConfig, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -593,6 +693,10 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::NSPanelConfig, _impl_.button1_upper_temperature_), PROTOBUF_FIELD_OFFSET(::NSPanelConfig, _impl_.button2_lower_temperature_), PROTOBUF_FIELD_OFFSET(::NSPanelConfig, _impl_.button2_upper_temperature_), + PROTOBUF_FIELD_OFFSET(::NSPanelConfig, _impl_.sounds_), + PROTOBUF_FIELD_OFFSET(::NSPanelConfig, _impl_.tz_posix_), + PROTOBUF_FIELD_OFFSET(::NSPanelConfig, _impl_.button1_entity_page_topic_), + PROTOBUF_FIELD_OFFSET(::NSPanelConfig, _impl_.button2_entity_page_topic_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::NSPanelWarning, _internal_metadata_), ~0u, // no _extensions_ @@ -641,6 +745,8 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::NSPanelRoomEntitiesPage_EntitySlot, _impl_.pco2_), PROTOBUF_FIELD_OFFSET(::NSPanelRoomEntitiesPage_EntitySlot, _impl_.can_save_scene_), PROTOBUF_FIELD_OFFSET(::NSPanelRoomEntitiesPage_EntitySlot, _impl_.mqtt_state_topic_), + PROTOBUF_FIELD_OFFSET(::NSPanelRoomEntitiesPage_EntitySlot, _impl_.type_), + PROTOBUF_FIELD_OFFSET(::NSPanelRoomEntitiesPage_EntitySlot, _impl_.id_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::NSPanelRoomEntitiesPage, _internal_metadata_), ~0u, // no _extensions_ @@ -796,6 +902,38 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_ThermostatCommand, _impl_.option_), PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_ThermostatCommand, _impl_.new_value_), ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_MediaPlayerCommand, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.media_player_id_), + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.playback_action_), + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.has_volume_), + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.volume_), + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.has_source_volume_), + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.source_volume_), + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.has_muted_), + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.muted_), + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.select_player_source_), + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.select_source_player_source_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_CoverCommand, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_CoverCommand, _impl_.cover_id_), + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_CoverCommand, _impl_.action_), + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_CoverCommand, _impl_.has_position_), + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_CoverCommand, _impl_.position_), + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_CoverCommand, _impl_.has_tilt_position_), + PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand_CoverCommand, _impl_.tilt_position_), + ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand, _internal_metadata_), ~0u, // no _extensions_ PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand, _impl_._oneof_case_[0]), @@ -811,6 +949,8 @@ const ::uint32_t ::_pbi::kInvalidFieldOffsetTag, ::_pbi::kInvalidFieldOffsetTag, ::_pbi::kInvalidFieldOffsetTag, + ::_pbi::kInvalidFieldOffsetTag, + ::_pbi::kInvalidFieldOffsetTag, PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand, _impl_.nspanel_id_), PROTOBUF_FIELD_OFFSET(::NSPanelMQTTManagerCommand, _impl_.CommandData_), }; @@ -818,26 +958,30 @@ const ::uint32_t static const ::_pbi::MigrationSchema schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { {0, -1, -1, sizeof(::NSPanelConfig_RoomInfo)}, - {11, -1, -1, sizeof(::NSPanelConfig)}, - {55, -1, -1, sizeof(::NSPanelWarning)}, - {65, -1, -1, sizeof(::NSPanelStatusReport)}, - {88, -1, -1, sizeof(::NSPanelRoomEntitiesPage_EntitySlot)}, - {103, -1, -1, sizeof(::NSPanelRoomEntitiesPage)}, - {115, -1, -1, sizeof(::NSPanelRoomStatus)}, - {136, -1, -1, sizeof(::NSPanelWeatherUpdate_ForecastItem)}, - {149, -1, -1, sizeof(::NSPanelWeatherUpdate)}, - {165, -1, -1, sizeof(::NSPanelMQTTManagerCommand_FirstPageTurnLightOn)}, - {180, -1, -1, sizeof(::NSPanelMQTTManagerCommand_FirstPageTurnLightOff)}, - {190, -1, -1, sizeof(::NSPanelMQTTManagerCommand_LightCommand)}, - {207, -1, -1, sizeof(::NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage)}, - {217, -1, -1, sizeof(::NSPanelMQTTManagerCommand_SaveSceneCommand)}, - {227, -1, -1, sizeof(::NSPanelMQTTManagerCommand_ButtonPressed)}, - {236, -1, -1, sizeof(::NSPanelMQTTManagerCommand_ThermostatTemperatureCommand)}, - {246, -1, -1, sizeof(::NSPanelMQTTManagerCommand_ThermostatCommand)}, - {257, -1, -1, sizeof(::NSPanelMQTTManagerCommand)}, + {11, -1, -1, sizeof(::NSPanelConfig_Sound)}, + {21, -1, -1, sizeof(::NSPanelConfig)}, + {69, -1, -1, sizeof(::NSPanelWarning)}, + {79, -1, -1, sizeof(::NSPanelStatusReport)}, + {102, -1, -1, sizeof(::NSPanelRoomEntitiesPage_EntitySlot)}, + {119, -1, -1, sizeof(::NSPanelRoomEntitiesPage)}, + {131, -1, -1, sizeof(::NSPanelRoomStatus)}, + {152, -1, -1, sizeof(::NSPanelWeatherUpdate_ForecastItem)}, + {165, -1, -1, sizeof(::NSPanelWeatherUpdate)}, + {181, -1, -1, sizeof(::NSPanelMQTTManagerCommand_FirstPageTurnLightOn)}, + {196, -1, -1, sizeof(::NSPanelMQTTManagerCommand_FirstPageTurnLightOff)}, + {206, -1, -1, sizeof(::NSPanelMQTTManagerCommand_LightCommand)}, + {223, -1, -1, sizeof(::NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage)}, + {233, -1, -1, sizeof(::NSPanelMQTTManagerCommand_SaveSceneCommand)}, + {243, -1, -1, sizeof(::NSPanelMQTTManagerCommand_ButtonPressed)}, + {252, -1, -1, sizeof(::NSPanelMQTTManagerCommand_ThermostatTemperatureCommand)}, + {262, -1, -1, sizeof(::NSPanelMQTTManagerCommand_ThermostatCommand)}, + {273, -1, -1, sizeof(::NSPanelMQTTManagerCommand_MediaPlayerCommand)}, + {291, -1, -1, sizeof(::NSPanelMQTTManagerCommand_CoverCommand)}, + {305, -1, -1, sizeof(::NSPanelMQTTManagerCommand)}, }; static const ::_pb::Message* const file_default_instances[] = { &::_NSPanelConfig_RoomInfo_default_instance_._instance, + &::_NSPanelConfig_Sound_default_instance_._instance, &::_NSPanelConfig_default_instance_._instance, &::_NSPanelWarning_default_instance_._instance, &::_NSPanelStatusReport_default_instance_._instance, @@ -854,11 +998,13 @@ static const ::_pb::Message* const file_default_instances[] = { &::_NSPanelMQTTManagerCommand_ButtonPressed_default_instance_._instance, &::_NSPanelMQTTManagerCommand_ThermostatTemperatureCommand_default_instance_._instance, &::_NSPanelMQTTManagerCommand_ThermostatCommand_default_instance_._instance, + &::_NSPanelMQTTManagerCommand_MediaPlayerCommand_default_instance_._instance, + &::_NSPanelMQTTManagerCommand_CoverCommand_default_instance_._instance, &::_NSPanelMQTTManagerCommand_default_instance_._instance, }; const char descriptor_table_protodef_protobuf_5fnspanel_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( protodesc_cold) = { - "\n\026protobuf_nspanel.proto\"\216\r\n\rNSPanelConf" + "\n\026protobuf_nspanel.proto\"\261\017\n\rNSPanelConf" "ig\022\014\n\004name\030\001 \001(\t\022\024\n\014default_room\030\002 \001(\005\0227" "\n\014default_page\030\003 \001(\0162!.NSPanelConfig.NSP" "anelDefaultPage\022&\n\036screensaver_activatio" @@ -890,116 +1036,152 @@ const char descriptor_table_protodef_protobuf_5fnspanel_2eproto[] ABSL_ATTRIBUTE "n1_lower_temperature\030) \001(\005\022!\n\031button1_up" "per_temperature\030* \001(\005\022!\n\031button2_lower_t" "emperature\030+ \001(\005\022!\n\031button2_upper_temper" - "ature\030, \001(\005\032L\n\010RoomInfo\022\017\n\007room_id\030\001 \001(\005" - "\022\027\n\017entity_page_ids\030\002 \003(\005\022\026\n\016scene_page_" - "ids\030\003 \003(\005\"8\n\022NSPanelDefaultPage\022\010\n\004HOME\020" - "\000\022\n\n\006SCENES\020\001\022\014\n\010ENTITIES\020\002\"\250\001\n\026NSPanelS" - "creensaverMode\022\033\n\027WEATHER_WITH_BACKGROUN" - "D\020\000\022\036\n\032WEATHER_WITHOUT_BACKGROUND\020\001\022\034\n\030D" - "ATETIME_WITH_BACKGROUND\020\003\022\037\n\033DATETIME_WI" - "THOUT_BACKGROUND\020\004\022\022\n\016NO_SCREENSAVER\020\005\"i" - "\n\021NSPanelButtonMode\022\n\n\006DIRECT\020\000\022\n\n\006FOLLO" - "W\020\001\022\022\n\016NOTIFY_MANAGER\020\002\022\023\n\017THERMOSTAT_HE" - "AT\020\003\022\023\n\017THERMOSTAT_COOL\020\004\"C\n\016NSPanelWarn" - "ing\022#\n\005level\030\001 \001(\0162\024.NSPanelWarningLevel" - "\022\014\n\004text\030\002 \001(\t\"\332\003\n\023NSPanelStatusReport\0221" - "\n\rnspanel_state\030\001 \001(\0162\032.NSPanelStatusRep" - "ort.state\022\027\n\017update_progress\030\002 \001(\005\022\014\n\004rs" - "si\030\003 \001(\005\022\025\n\rheap_used_pct\030\004 \001(\005\022\023\n\013mac_a" - "ddress\030\005 \001(\t\022\023\n\013temperature\030\006 \001(\002\022\022\n\nip_" - "address\030\007 \001(\t\022!\n\010warnings\030\010 \003(\0132\017.NSPane" - "lWarning\022\024\n\014md5_firmware\030\t \001(\t\022\024\n\014md5_li" - "ttlefs\030\n \001(\t\022\023\n\013md5_tft_gui\030\013 \001(\t\022\024\n\014has" - "_humidity\030\014 \001(\010\022\020\n\010humidity\030\r \001(\002\022\024\n\014has" - "_pressure\030\016 \001(\010\022\020\n\010pressure\030\017 \001(\002\"`\n\005sta" - "te\022\n\n\006ONLINE\020\000\022\013\n\007OFFLINE\020\001\022\020\n\014UPDATING_" - "TFT\020\002\022\025\n\021UPDATING_FIRMWARE\020\003\022\025\n\021UPDATING" - "_LITTLEFS\020\004\"\230\002\n\027NSPanelRoomEntitiesPage\022" - "\n\n\002id\030\001 \001(\005\022\021\n\tpage_type\030\002 \001(\005\022\023\n\013header" - "_text\030\003 \001(\t\0225\n\010entities\030\004 \003(\0132#.NSPanelR" - "oomEntitiesPage.EntitySlot\032\221\001\n\nEntitySlo" - "t\022\032\n\022room_view_position\030\001 \001(\005\022\014\n\004name\030\002 " - "\001(\t\022\014\n\004icon\030\003 \001(\t\022\013\n\003pco\030\004 \001(\005\022\014\n\004pco2\030\005" - " \001(\005\022\026\n\016can_save_scene\030\006 \001(\010\022\030\n\020mqtt_sta" - "te_topic\030\007 \001(\t\"\226\003\n\021NSPanelRoomStatus\022\n\n\002" - "id\030\001 \001(\005\022\014\n\004name\030\002 \001(\t\022\031\n\021average_dim_le" - "vel\030\003 \001(\005\022 \n\030ceiling_lights_dim_level\030\004 " - "\001(\005\022\036\n\026table_lights_dim_level\030\005 \001(\005\022!\n\031a" - "verage_color_temperature\030\006 \001(\005\022.\n&ceilin" - "g_lights_color_temperature_value\030\007 \001(\005\022," - "\n$table_lights_color_temperature_value\030\010" - " \001(\005\022\032\n\022num_ceiling_lights\030\t \001(\005\022\030\n\020num_" - "table_lights\030\n \001(\005\022\035\n\025num_ceiling_lights" - "_on\030\013 \001(\005\022\033\n\023num_table_lights_on\030\014 \001(\005\022\027" - "\n\017entity_page_ids\030\r \003(\005\"\277\003\n\024NSPanelWeath" - "erUpdate\022:\n\016forecast_items\030\001 \003(\0132\".NSPan" - "elWeatherUpdate.ForecastItem\022\034\n\024current_" - "weather_icon\030\002 \001(\t\022\"\n\032current_temperatur" - "e_string\030\003 \001(\t\022\"\n\032current_maxmin_tempera" - "ture\030\004 \001(\t\022\033\n\023current_wind_string\030\005 \001(\t\022" - "\026\n\016sunrise_string\030\006 \001(\t\022\025\n\rsunset_string" - "\030\007 \001(\t\022$\n\034current_precipitation_string\030\010" - " \001(\t\032\222\001\n\014ForecastItem\022\024\n\014weather_icon\030\001 " - "\001(\t\022\034\n\024precipitation_string\030\002 \001(\t\022!\n\031tem" - "perature_maxmin_string\030\003 \001(\t\022\023\n\013wind_str" - "ing\030\004 \001(\t\022\026\n\016display_string\030\005 \001(\t\"\227\r\n\031NS" - "PanelMQTTManagerCommand\022M\n\022first_page_tu" - "rn_on\030\001 \001(\0132/.NSPanelMQTTManagerCommand." - "FirstPageTurnLightOnH\000\022O\n\023first_page_tur" - "n_off\030\002 \001(\01320.NSPanelMQTTManagerCommand." - "FirstPageTurnLightOffH\000\022@\n\rlight_command" - "\030\003 \001(\0132\'.NSPanelMQTTManagerCommand.Light" - "CommandH\000\022c\n toggle_entity_from_entities" - "_page\030\004 \001(\01327.NSPanelMQTTManagerCommand." - "ToggleEntityFromEntitiesPageH\000\022I\n\022save_s" - "cene_command\030\005 \001(\0132+.NSPanelMQTTManagerC" - "ommand.SaveSceneCommandH\000\022B\n\016button_pres" - "sed\030\006 \001(\0132(.NSPanelMQTTManagerCommand.Bu" - "ttonPressedH\000\022a\n\036thermostat_temperature_" - "command\030\007 \001(\01327.NSPanelMQTTManagerComman" - "d.ThermostatTemperatureCommandH\000\022J\n\022ther" - "mostat_command\030\010 \001(\0132,.NSPanelMQTTManage" - "rCommand.ThermostatCommandH\000\022\022\n\nnspanel_" - "id\030d \001(\005\032\372\001\n\024FirstPageTurnLightOn\022E\n\raff" - "ect_lights\030\001 \001(\0162..NSPanelMQTTManagerCom" - "mand.AffectLightsOptions\022\037\n\027brightness_s" - "lider_value\030\002 \001(\005\022\033\n\023kelvin_slider_value" - "\030\003 \001(\005\022\025\n\rselected_room\030\004 \001(\005\022\016\n\006global\030" - "\005 \001(\010\022\034\n\024has_brightness_value\030\006 \001(\010\022\030\n\020h" - "as_kelvin_value\030\007 \001(\010\032n\n\025FirstPageTurnLi" - "ghtOff\022E\n\raffect_lights\030\001 \001(\0162..NSPanelM" - "QTTManagerCommand.AffectLightsOptions\022\016\n" - "\006global\030\002 \001(\010\032\321\001\n\014LightCommand\022\021\n\tlight_" - "ids\030\001 \003(\005\022\026\n\016has_brightness\030\002 \001(\010\022\022\n\nbri" - "ghtness\030\003 \001(\005\022\035\n\025has_color_temperature\030\004" - " \001(\010\022\031\n\021color_temperature\030\005 \001(\005\022\017\n\007has_h" - "ue\030\006 \001(\010\022\013\n\003hue\030\007 \001(\005\022\026\n\016has_saturation\030" - "\010 \001(\010\022\022\n\nsaturation\030\t \001(\005\032K\n\034ToggleEntit" - "yFromEntitiesPage\022\026\n\016entity_page_id\030\001 \001(" - "\005\022\023\n\013entity_slot\030\002 \001(\005\032\?\n\020SaveSceneComma" - "nd\022\026\n\016entity_page_id\030\001 \001(\005\022\023\n\013entity_slo" - "t\030\002 \001(\005\032\"\n\rButtonPressed\022\021\n\tbutton_id\030\002 " - "\001(\005\032J\n\034ThermostatTemperatureCommand\022\025\n\rt" - "hermostat_id\030\001 \001(\005\022\023\n\013temperature\030\002 \001(\002\032" - "M\n\021ThermostatCommand\022\025\n\rthermostat_id\030\001 " - "\001(\005\022\016\n\006option\030\002 \001(\t\022\021\n\tnew_value\030\003 \001(\t\"D" - "\n\023AffectLightsOptions\022\007\n\003ALL\020\000\022\020\n\014TABLE_" - "LIGHTS\020\001\022\022\n\016CEILING_LIGHTS\020\002B\r\n\013CommandD" - "ata*[\n\023NSPanelWarningLevel\022\014\n\010CRITICAL\020\000" - "\022\t\n\005ERROR\020\001\022\013\n\007WARNING\020\002\022\010\n\004INFO\020\003\022\t\n\005DE" - "BUG\020\004\022\t\n\005TRACE\020\005b\006proto3" + "ature\030, \001(\005\022$\n\006sounds\030- \003(\0132\024.NSPanelCon" + "fig.Sound\022\020\n\010tz_posix\030. \001(\t\022!\n\031button1_e" + "ntity_page_topic\030/ \001(\t\022!\n\031button2_entity" + "_page_topic\0300 \001(\t\032L\n\010RoomInfo\022\017\n\007room_id" + "\030\001 \001(\005\022\027\n\017entity_page_ids\030\002 \003(\005\022\026\n\016scene" + "_page_ids\030\003 \003(\005\032G\n\005Sound\022/\n\005event\030\001 \001(\0162" + " .NSPanelConfig.NSPanelSoundEvent\022\r\n\005rtt" + "tl\030\002 \001(\t\"8\n\022NSPanelDefaultPage\022\010\n\004HOME\020\000" + "\022\n\n\006SCENES\020\001\022\014\n\010ENTITIES\020\002\"\250\001\n\026NSPanelSc" + "reensaverMode\022\033\n\027WEATHER_WITH_BACKGROUND" + "\020\000\022\036\n\032WEATHER_WITHOUT_BACKGROUND\020\001\022\034\n\030DA" + "TETIME_WITH_BACKGROUND\020\003\022\037\n\033DATETIME_WIT" + "HOUT_BACKGROUND\020\004\022\022\n\016NO_SCREENSAVER\020\005\"\177\n" + "\021NSPanelButtonMode\022\n\n\006DIRECT\020\000\022\n\n\006FOLLOW" + "\020\001\022\022\n\016NOTIFY_MANAGER\020\002\022\023\n\017THERMOSTAT_HEA" + "T\020\003\022\023\n\017THERMOSTAT_COOL\020\004\022\024\n\020OPEN_ENTITY_" + "PAGE\020\005\"D\n\021NSPanelSoundEvent\022\t\n\005TOUCH\020\000\022\023" + "\n\017SCENE_ACTIVATED\020\001\022\017\n\013SCENE_SAVED\020\002\"C\n\016" + "NSPanelWarning\022#\n\005level\030\001 \001(\0162\024.NSPanelW" + "arningLevel\022\014\n\004text\030\002 \001(\t\"\351\003\n\023NSPanelSta" + "tusReport\0221\n\rnspanel_state\030\001 \001(\0162\032.NSPan" + "elStatusReport.state\022\027\n\017update_progress\030" + "\002 \001(\005\022\014\n\004rssi\030\003 \001(\005\022\025\n\rheap_used_pct\030\004 \001" + "(\005\022\023\n\013mac_address\030\005 \001(\t\022\023\n\013temperature\030\006" + " \001(\002\022\022\n\nip_address\030\007 \001(\t\022!\n\010warnings\030\010 \003" + "(\0132\017.NSPanelWarning\022\024\n\014md5_firmware\030\t \001(" + "\t\022\024\n\014md5_littlefs\030\n \001(\t\022\023\n\013md5_tft_gui\030\013" + " \001(\t\022\024\n\014has_humidity\030\014 \001(\010\022\020\n\010humidity\030\r" + " \001(\002\022\024\n\014has_pressure\030\016 \001(\010\022\020\n\010pressure\030\017" + " \001(\002\"o\n\005state\022\n\n\006ONLINE\020\000\022\013\n\007OFFLINE\020\001\022\020" + "\n\014UPDATING_TFT\020\002\022\025\n\021UPDATING_FIRMWARE\020\003\022" + "\025\n\021UPDATING_LITTLEFS\020\004\022\r\n\tREBOOTING\020\005\"\275\004" + "\n\027NSPanelRoomEntitiesPage\022\n\n\002id\030\001 \001(\005\022\021\n" + "\tpage_type\030\002 \001(\005\022\023\n\013header_text\030\003 \001(\t\0225\n" + "\010entities\030\004 \003(\0132#.NSPanelRoomEntitiesPag" + "e.EntitySlot\032\266\003\n\nEntitySlot\022\032\n\022room_view" + "_position\030\001 \001(\005\022\014\n\004name\030\002 \001(\t\022\014\n\004icon\030\003 " + "\001(\t\022\013\n\003pco\030\004 \001(\005\022\014\n\004pco2\030\005 \001(\005\022\026\n\016can_sa" + "ve_scene\030\006 \001(\010\022\030\n\020mqtt_state_topic\030\007 \001(\t" + "\022<\n\004type\030\010 \001(\0162..NSPanelRoomEntitiesPage" + ".EntitySlot.EntityType\022\n\n\002id\030\t \001(\005\"\330\001\n\nE" + "ntityType\022\033\n\027ENTITY_TYPE_UNSPECIFIED\020\000\022\025" + "\n\021ENTITY_TYPE_LIGHT\020\001\022\026\n\022ENTITY_TYPE_SWI" + "TCH\020\002\022\026\n\022ENTITY_TYPE_BUTTON\020\003\022\032\n\026ENTITY_" + "TYPE_THERMOSTAT\020\004\022\025\n\021ENTITY_TYPE_SCENE\020\005" + "\022\034\n\030ENTITY_TYPE_MEDIA_PLAYER\020\006\022\025\n\021ENTITY" + "_TYPE_COVER\020\007\"\226\003\n\021NSPanelRoomStatus\022\n\n\002i" + "d\030\001 \001(\005\022\014\n\004name\030\002 \001(\t\022\031\n\021average_dim_lev" + "el\030\003 \001(\005\022 \n\030ceiling_lights_dim_level\030\004 \001" + "(\005\022\036\n\026table_lights_dim_level\030\005 \001(\005\022!\n\031av" + "erage_color_temperature\030\006 \001(\005\022.\n&ceiling" + "_lights_color_temperature_value\030\007 \001(\005\022,\n" + "$table_lights_color_temperature_value\030\010 " + "\001(\005\022\032\n\022num_ceiling_lights\030\t \001(\005\022\030\n\020num_t" + "able_lights\030\n \001(\005\022\035\n\025num_ceiling_lights_" + "on\030\013 \001(\005\022\033\n\023num_table_lights_on\030\014 \001(\005\022\027\n" + "\017entity_page_ids\030\r \003(\005\"\277\003\n\024NSPanelWeathe" + "rUpdate\022:\n\016forecast_items\030\001 \003(\0132\".NSPane" + "lWeatherUpdate.ForecastItem\022\034\n\024current_w" + "eather_icon\030\002 \001(\t\022\"\n\032current_temperature" + "_string\030\003 \001(\t\022\"\n\032current_maxmin_temperat" + "ure\030\004 \001(\t\022\033\n\023current_wind_string\030\005 \001(\t\022\026" + "\n\016sunrise_string\030\006 \001(\t\022\025\n\rsunset_string\030" + "\007 \001(\t\022$\n\034current_precipitation_string\030\010 " + "\001(\t\032\222\001\n\014ForecastItem\022\024\n\014weather_icon\030\001 \001" + "(\t\022\034\n\024precipitation_string\030\002 \001(\t\022!\n\031temp" + "erature_maxmin_string\030\003 \001(\t\022\023\n\013wind_stri" + "ng\030\004 \001(\t\022\026\n\016display_string\030\005 \001(\t\"\335\023\n\031NSP" + "anelMQTTManagerCommand\022M\n\022first_page_tur" + "n_on\030\001 \001(\0132/.NSPanelMQTTManagerCommand.F" + "irstPageTurnLightOnH\000\022O\n\023first_page_turn" + "_off\030\002 \001(\01320.NSPanelMQTTManagerCommand.F" + "irstPageTurnLightOffH\000\022@\n\rlight_command\030" + "\003 \001(\0132\'.NSPanelMQTTManagerCommand.LightC" + "ommandH\000\022c\n toggle_entity_from_entities_" + "page\030\004 \001(\01327.NSPanelMQTTManagerCommand.T" + "oggleEntityFromEntitiesPageH\000\022I\n\022save_sc" + "ene_command\030\005 \001(\0132+.NSPanelMQTTManagerCo" + "mmand.SaveSceneCommandH\000\022B\n\016button_press" + "ed\030\006 \001(\0132(.NSPanelMQTTManagerCommand.But" + "tonPressedH\000\022a\n\036thermostat_temperature_c" + "ommand\030\007 \001(\01327.NSPanelMQTTManagerCommand" + ".ThermostatTemperatureCommandH\000\022J\n\022therm" + "ostat_command\030\010 \001(\0132,.NSPanelMQTTManager" + "Command.ThermostatCommandH\000\022M\n\024media_pla" + "yer_command\030\t \001(\0132-.NSPanelMQTTManagerCo" + "mmand.MediaPlayerCommandH\000\022@\n\rcover_comm" + "and\030\n \001(\0132\'.NSPanelMQTTManagerCommand.Co" + "verCommandH\000\022\022\n\nnspanel_id\030d \001(\005\032\372\001\n\024Fir" + "stPageTurnLightOn\022E\n\raffect_lights\030\001 \001(\016" + "2..NSPanelMQTTManagerCommand.AffectLight" + "sOptions\022\037\n\027brightness_slider_value\030\002 \001(" + "\005\022\033\n\023kelvin_slider_value\030\003 \001(\005\022\025\n\rselect" + "ed_room\030\004 \001(\005\022\016\n\006global\030\005 \001(\010\022\034\n\024has_bri" + "ghtness_value\030\006 \001(\010\022\030\n\020has_kelvin_value\030" + "\007 \001(\010\032n\n\025FirstPageTurnLightOff\022E\n\raffect" + "_lights\030\001 \001(\0162..NSPanelMQTTManagerComman" + "d.AffectLightsOptions\022\016\n\006global\030\002 \001(\010\032\321\001" + "\n\014LightCommand\022\021\n\tlight_ids\030\001 \003(\005\022\026\n\016has" + "_brightness\030\002 \001(\010\022\022\n\nbrightness\030\003 \001(\005\022\035\n" + "\025has_color_temperature\030\004 \001(\010\022\031\n\021color_te" + "mperature\030\005 \001(\005\022\017\n\007has_hue\030\006 \001(\010\022\013\n\003hue\030" + "\007 \001(\005\022\026\n\016has_saturation\030\010 \001(\010\022\022\n\nsaturat" + "ion\030\t \001(\005\032K\n\034ToggleEntityFromEntitiesPag" + "e\022\026\n\016entity_page_id\030\001 \001(\005\022\023\n\013entity_slot" + "\030\002 \001(\005\032\?\n\020SaveSceneCommand\022\026\n\016entity_pag" + "e_id\030\001 \001(\005\022\023\n\013entity_slot\030\002 \001(\005\032\"\n\rButto" + "nPressed\022\021\n\tbutton_id\030\002 \001(\005\032J\n\034Thermosta" + "tTemperatureCommand\022\025\n\rthermostat_id\030\001 \001" + "(\005\022\023\n\013temperature\030\002 \001(\002\032M\n\021ThermostatCom" + "mand\022\025\n\rthermostat_id\030\001 \001(\005\022\016\n\006option\030\002 " + "\001(\t\022\021\n\tnew_value\030\003 \001(\t\032\224\003\n\022MediaPlayerCo" + "mmand\022\027\n\017media_player_id\030\001 \001(\005\022U\n\017playba" + "ck_action\030\002 \001(\0162<.NSPanelMQTTManagerComm" + "and.MediaPlayerCommand.PlaybackAction\022\022\n" + "\nhas_volume\030\003 \001(\010\022\016\n\006volume\030\004 \001(\005\022\031\n\021has" + "_source_volume\030\005 \001(\010\022\025\n\rsource_volume\030\006 " + "\001(\005\022\021\n\thas_muted\030\007 \001(\010\022\r\n\005muted\030\010 \001(\010\022\034\n" + "\024select_player_source\030\t \001(\t\022#\n\033select_so" + "urce_player_source\030\n \001(\t\"S\n\016PlaybackActi" + "on\022\010\n\004NONE\020\000\022\010\n\004PLAY\020\001\022\t\n\005PAUSE\020\002\022\016\n\nNEX" + "T_TRACK\020\003\022\022\n\016PREVIOUS_TRACK\020\004\032\233\002\n\014CoverC" + "ommand\022\020\n\010cover_id\030\001 \001(\005\022>\n\006action\030\002 \001(\016" + "2..NSPanelMQTTManagerCommand.CoverComman" + "d.Action\022\024\n\014has_position\030\003 \001(\010\022\020\n\010positi" + "on\030\004 \001(\005\022\031\n\021has_tilt_position\030\005 \001(\010\022\025\n\rt" + "ilt_position\030\006 \001(\005\"_\n\006Action\022\010\n\004NONE\020\000\022\010" + "\n\004OPEN\020\001\022\t\n\005CLOSE\020\002\022\010\n\004STOP\020\003\022\r\n\tOPEN_TI" + "LT\020\004\022\016\n\nCLOSE_TILT\020\005\022\r\n\tSTOP_TILT\020\006\"D\n\023A" + "ffectLightsOptions\022\007\n\003ALL\020\000\022\020\n\014TABLE_LIG" + "HTS\020\001\022\022\n\016CEILING_LIGHTS\020\002B\r\n\013CommandData" + "*[\n\023NSPanelWarningLevel\022\014\n\010CRITICAL\020\000\022\t\n" + "\005ERROR\020\001\022\013\n\007WARNING\020\002\022\010\n\004INFO\020\003\022\t\n\005DEBUG" + "\020\004\022\t\n\005TRACE\020\005b\006proto3" }; static ::absl::once_flag descriptor_table_protobuf_5fnspanel_2eproto_once; PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_protobuf_5fnspanel_2eproto = { false, false, - 5184, + 6621, descriptor_table_protodef_protobuf_5fnspanel_2eproto, "protobuf_nspanel.proto", &descriptor_table_protobuf_5fnspanel_2eproto_once, nullptr, 0, - 18, + 21, schemas, file_default_instances, TableStruct_protobuf_5fnspanel_2eproto::offsets, @@ -1055,9 +1237,9 @@ const ::google::protobuf::EnumDescriptor* NSPanelConfig_NSPanelButtonMode_descri return file_level_enum_descriptors_protobuf_5fnspanel_2eproto[2]; } PROTOBUF_CONSTINIT const uint32_t NSPanelConfig_NSPanelButtonMode_internal_data_[] = { - 327680u, 0u, }; + 393216u, 0u, }; bool NSPanelConfig_NSPanelButtonMode_IsValid(int value) { - return 0 <= value && value <= 4; + return 0 <= value && value <= 5; } #if (__cplusplus < 201703) && \ (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) @@ -1067,20 +1249,42 @@ constexpr NSPanelConfig_NSPanelButtonMode NSPanelConfig::FOLLOW; constexpr NSPanelConfig_NSPanelButtonMode NSPanelConfig::NOTIFY_MANAGER; constexpr NSPanelConfig_NSPanelButtonMode NSPanelConfig::THERMOSTAT_HEAT; constexpr NSPanelConfig_NSPanelButtonMode NSPanelConfig::THERMOSTAT_COOL; +constexpr NSPanelConfig_NSPanelButtonMode NSPanelConfig::OPEN_ENTITY_PAGE; constexpr NSPanelConfig_NSPanelButtonMode NSPanelConfig::NSPanelButtonMode_MIN; constexpr NSPanelConfig_NSPanelButtonMode NSPanelConfig::NSPanelButtonMode_MAX; constexpr int NSPanelConfig::NSPanelButtonMode_ARRAYSIZE; #endif // (__cplusplus < 201703) && // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) -const ::google::protobuf::EnumDescriptor* NSPanelStatusReport_state_descriptor() { +const ::google::protobuf::EnumDescriptor* NSPanelConfig_NSPanelSoundEvent_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_protobuf_5fnspanel_2eproto); return file_level_enum_descriptors_protobuf_5fnspanel_2eproto[3]; } +PROTOBUF_CONSTINIT const uint32_t NSPanelConfig_NSPanelSoundEvent_internal_data_[] = { + 196608u, 0u, }; +bool NSPanelConfig_NSPanelSoundEvent_IsValid(int value) { + return 0 <= value && value <= 2; +} +#if (__cplusplus < 201703) && \ + (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) + +constexpr NSPanelConfig_NSPanelSoundEvent NSPanelConfig::TOUCH; +constexpr NSPanelConfig_NSPanelSoundEvent NSPanelConfig::SCENE_ACTIVATED; +constexpr NSPanelConfig_NSPanelSoundEvent NSPanelConfig::SCENE_SAVED; +constexpr NSPanelConfig_NSPanelSoundEvent NSPanelConfig::NSPanelSoundEvent_MIN; +constexpr NSPanelConfig_NSPanelSoundEvent NSPanelConfig::NSPanelSoundEvent_MAX; +constexpr int NSPanelConfig::NSPanelSoundEvent_ARRAYSIZE; + +#endif // (__cplusplus < 201703) && + // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +const ::google::protobuf::EnumDescriptor* NSPanelStatusReport_state_descriptor() { + ::google::protobuf::internal::AssignDescriptors(&descriptor_table_protobuf_5fnspanel_2eproto); + return file_level_enum_descriptors_protobuf_5fnspanel_2eproto[4]; +} PROTOBUF_CONSTINIT const uint32_t NSPanelStatusReport_state_internal_data_[] = { - 327680u, 0u, }; + 393216u, 0u, }; bool NSPanelStatusReport_state_IsValid(int value) { - return 0 <= value && value <= 4; + return 0 <= value && value <= 5; } #if (__cplusplus < 201703) && \ (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) @@ -1090,15 +1294,90 @@ constexpr NSPanelStatusReport_state NSPanelStatusReport::OFFLINE; constexpr NSPanelStatusReport_state NSPanelStatusReport::UPDATING_TFT; constexpr NSPanelStatusReport_state NSPanelStatusReport::UPDATING_FIRMWARE; constexpr NSPanelStatusReport_state NSPanelStatusReport::UPDATING_LITTLEFS; +constexpr NSPanelStatusReport_state NSPanelStatusReport::REBOOTING; constexpr NSPanelStatusReport_state NSPanelStatusReport::state_MIN; constexpr NSPanelStatusReport_state NSPanelStatusReport::state_MAX; constexpr int NSPanelStatusReport::state_ARRAYSIZE; +#endif // (__cplusplus < 201703) && + // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +const ::google::protobuf::EnumDescriptor* NSPanelRoomEntitiesPage_EntitySlot_EntityType_descriptor() { + ::google::protobuf::internal::AssignDescriptors(&descriptor_table_protobuf_5fnspanel_2eproto); + return file_level_enum_descriptors_protobuf_5fnspanel_2eproto[5]; +} +PROTOBUF_CONSTINIT const uint32_t NSPanelRoomEntitiesPage_EntitySlot_EntityType_internal_data_[] = { + 524288u, 0u, }; +bool NSPanelRoomEntitiesPage_EntitySlot_EntityType_IsValid(int value) { + return 0 <= value && value <= 7; +} +#if (__cplusplus < 201703) && \ + (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) + +constexpr NSPanelRoomEntitiesPage_EntitySlot_EntityType NSPanelRoomEntitiesPage_EntitySlot::ENTITY_TYPE_UNSPECIFIED; +constexpr NSPanelRoomEntitiesPage_EntitySlot_EntityType NSPanelRoomEntitiesPage_EntitySlot::ENTITY_TYPE_LIGHT; +constexpr NSPanelRoomEntitiesPage_EntitySlot_EntityType NSPanelRoomEntitiesPage_EntitySlot::ENTITY_TYPE_SWITCH; +constexpr NSPanelRoomEntitiesPage_EntitySlot_EntityType NSPanelRoomEntitiesPage_EntitySlot::ENTITY_TYPE_BUTTON; +constexpr NSPanelRoomEntitiesPage_EntitySlot_EntityType NSPanelRoomEntitiesPage_EntitySlot::ENTITY_TYPE_THERMOSTAT; +constexpr NSPanelRoomEntitiesPage_EntitySlot_EntityType NSPanelRoomEntitiesPage_EntitySlot::ENTITY_TYPE_SCENE; +constexpr NSPanelRoomEntitiesPage_EntitySlot_EntityType NSPanelRoomEntitiesPage_EntitySlot::ENTITY_TYPE_MEDIA_PLAYER; +constexpr NSPanelRoomEntitiesPage_EntitySlot_EntityType NSPanelRoomEntitiesPage_EntitySlot::ENTITY_TYPE_COVER; +constexpr NSPanelRoomEntitiesPage_EntitySlot_EntityType NSPanelRoomEntitiesPage_EntitySlot::EntityType_MIN; +constexpr NSPanelRoomEntitiesPage_EntitySlot_EntityType NSPanelRoomEntitiesPage_EntitySlot::EntityType_MAX; +constexpr int NSPanelRoomEntitiesPage_EntitySlot::EntityType_ARRAYSIZE; + +#endif // (__cplusplus < 201703) && + // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +const ::google::protobuf::EnumDescriptor* NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_descriptor() { + ::google::protobuf::internal::AssignDescriptors(&descriptor_table_protobuf_5fnspanel_2eproto); + return file_level_enum_descriptors_protobuf_5fnspanel_2eproto[6]; +} +PROTOBUF_CONSTINIT const uint32_t NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_internal_data_[] = { + 327680u, 0u, }; +bool NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_IsValid(int value) { + return 0 <= value && value <= 4; +} +#if (__cplusplus < 201703) && \ + (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) + +constexpr NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction NSPanelMQTTManagerCommand_MediaPlayerCommand::NONE; +constexpr NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction NSPanelMQTTManagerCommand_MediaPlayerCommand::PLAY; +constexpr NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction NSPanelMQTTManagerCommand_MediaPlayerCommand::PAUSE; +constexpr NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction NSPanelMQTTManagerCommand_MediaPlayerCommand::NEXT_TRACK; +constexpr NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction NSPanelMQTTManagerCommand_MediaPlayerCommand::PREVIOUS_TRACK; +constexpr NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction NSPanelMQTTManagerCommand_MediaPlayerCommand::PlaybackAction_MIN; +constexpr NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction NSPanelMQTTManagerCommand_MediaPlayerCommand::PlaybackAction_MAX; +constexpr int NSPanelMQTTManagerCommand_MediaPlayerCommand::PlaybackAction_ARRAYSIZE; + +#endif // (__cplusplus < 201703) && + // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +const ::google::protobuf::EnumDescriptor* NSPanelMQTTManagerCommand_CoverCommand_Action_descriptor() { + ::google::protobuf::internal::AssignDescriptors(&descriptor_table_protobuf_5fnspanel_2eproto); + return file_level_enum_descriptors_protobuf_5fnspanel_2eproto[7]; +} +PROTOBUF_CONSTINIT const uint32_t NSPanelMQTTManagerCommand_CoverCommand_Action_internal_data_[] = { + 458752u, 0u, }; +bool NSPanelMQTTManagerCommand_CoverCommand_Action_IsValid(int value) { + return 0 <= value && value <= 6; +} +#if (__cplusplus < 201703) && \ + (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) + +constexpr NSPanelMQTTManagerCommand_CoverCommand_Action NSPanelMQTTManagerCommand_CoverCommand::NONE; +constexpr NSPanelMQTTManagerCommand_CoverCommand_Action NSPanelMQTTManagerCommand_CoverCommand::OPEN; +constexpr NSPanelMQTTManagerCommand_CoverCommand_Action NSPanelMQTTManagerCommand_CoverCommand::CLOSE; +constexpr NSPanelMQTTManagerCommand_CoverCommand_Action NSPanelMQTTManagerCommand_CoverCommand::STOP; +constexpr NSPanelMQTTManagerCommand_CoverCommand_Action NSPanelMQTTManagerCommand_CoverCommand::OPEN_TILT; +constexpr NSPanelMQTTManagerCommand_CoverCommand_Action NSPanelMQTTManagerCommand_CoverCommand::CLOSE_TILT; +constexpr NSPanelMQTTManagerCommand_CoverCommand_Action NSPanelMQTTManagerCommand_CoverCommand::STOP_TILT; +constexpr NSPanelMQTTManagerCommand_CoverCommand_Action NSPanelMQTTManagerCommand_CoverCommand::Action_MIN; +constexpr NSPanelMQTTManagerCommand_CoverCommand_Action NSPanelMQTTManagerCommand_CoverCommand::Action_MAX; +constexpr int NSPanelMQTTManagerCommand_CoverCommand::Action_ARRAYSIZE; + #endif // (__cplusplus < 201703) && // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) const ::google::protobuf::EnumDescriptor* NSPanelMQTTManagerCommand_AffectLightsOptions_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_protobuf_5fnspanel_2eproto); - return file_level_enum_descriptors_protobuf_5fnspanel_2eproto[4]; + return file_level_enum_descriptors_protobuf_5fnspanel_2eproto[8]; } PROTOBUF_CONSTINIT const uint32_t NSPanelMQTTManagerCommand_AffectLightsOptions_internal_data_[] = { 196608u, 0u, }; @@ -1119,7 +1398,7 @@ constexpr int NSPanelMQTTManagerCommand::AffectLightsOptions_ARRAYSIZE; // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) const ::google::protobuf::EnumDescriptor* NSPanelWarningLevel_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_protobuf_5fnspanel_2eproto); - return file_level_enum_descriptors_protobuf_5fnspanel_2eproto[5]; + return file_level_enum_descriptors_protobuf_5fnspanel_2eproto[9]; } PROTOBUF_CONSTINIT const uint32_t NSPanelWarningLevel_internal_data_[] = { 393216u, 0u, }; @@ -1385,96 +1664,68 @@ ::google::protobuf::Metadata NSPanelConfig_RoomInfo::GetMetadata() const { } // =================================================================== -class NSPanelConfig::_Internal { +class NSPanelConfig_Sound::_Internal { public: }; -NSPanelConfig::NSPanelConfig(::google::protobuf::Arena* arena) +NSPanelConfig_Sound::NSPanelConfig_Sound(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelConfig) + // @@protoc_insertion_point(arena_constructor:NSPanelConfig.Sound) } -inline PROTOBUF_NDEBUG_INLINE NSPanelConfig::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelConfig_Sound::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::NSPanelConfig& from_msg) - : room_infos_{visibility, arena, from.room_infos_}, - global_scene_entity_page_ids_{visibility, arena, from.global_scene_entity_page_ids_}, - _global_scene_entity_page_ids_cached_byte_size_{0}, - relay1_relay_group_{visibility, arena, from.relay1_relay_group_}, - _relay1_relay_group_cached_byte_size_{0}, - relay2_relay_group_{visibility, arena, from.relay2_relay_group_}, - _relay2_relay_group_cached_byte_size_{0}, - name_(arena, from.name_), - inside_temperature_sensor_mqtt_topic_(arena, from.inside_temperature_sensor_mqtt_topic_), + const Impl_& from, const ::NSPanelConfig_Sound& from_msg) + : rtttl_(arena, from.rtttl_), _cached_size_{0} {} -NSPanelConfig::NSPanelConfig( +NSPanelConfig_Sound::NSPanelConfig_Sound( ::google::protobuf::Arena* arena, - const NSPanelConfig& from) + const NSPanelConfig_Sound& from) : ::google::protobuf::Message(arena) { - NSPanelConfig* const _this = this; + NSPanelConfig_Sound* const _this = this; (void)_this; _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - ::memcpy(reinterpret_cast(&_impl_) + - offsetof(Impl_, default_room_), - reinterpret_cast(&from._impl_) + - offsetof(Impl_, default_room_), - offsetof(Impl_, button2_upper_temperature_) - - offsetof(Impl_, default_room_) + - sizeof(Impl_::button2_upper_temperature_)); + _impl_.event_ = from._impl_.event_; - // @@protoc_insertion_point(copy_constructor:NSPanelConfig) + // @@protoc_insertion_point(copy_constructor:NSPanelConfig.Sound) } -inline PROTOBUF_NDEBUG_INLINE NSPanelConfig::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelConfig_Sound::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : room_infos_{visibility, arena}, - global_scene_entity_page_ids_{visibility, arena}, - _global_scene_entity_page_ids_cached_byte_size_{0}, - relay1_relay_group_{visibility, arena}, - _relay1_relay_group_cached_byte_size_{0}, - relay2_relay_group_{visibility, arena}, - _relay2_relay_group_cached_byte_size_{0}, - name_(arena), - inside_temperature_sensor_mqtt_topic_(arena), + : rtttl_(arena), _cached_size_{0} {} -inline void NSPanelConfig::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelConfig_Sound::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); - ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, default_room_), - 0, - offsetof(Impl_, button2_upper_temperature_) - - offsetof(Impl_, default_room_) + - sizeof(Impl_::button2_upper_temperature_)); + _impl_.event_ = {}; } -NSPanelConfig::~NSPanelConfig() { - // @@protoc_insertion_point(destructor:NSPanelConfig) +NSPanelConfig_Sound::~NSPanelConfig_Sound() { + // @@protoc_insertion_point(destructor:NSPanelConfig.Sound) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelConfig::SharedDtor() { +inline void NSPanelConfig_Sound::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); - _impl_.name_.Destroy(); - _impl_.inside_temperature_sensor_mqtt_topic_.Destroy(); + _impl_.rtttl_.Destroy(); _impl_.~Impl_(); } const ::google::protobuf::MessageLite::ClassData* -NSPanelConfig::GetClassData() const { +NSPanelConfig_Sound::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelConfig_Sound, _impl_._cached_size_), false, }, - &NSPanelConfig::MergeImpl, - &NSPanelConfig::kDescriptorMethods, + &NSPanelConfig_Sound::MergeImpl, + &NSPanelConfig_Sound::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_2eproto, nullptr, // tracker }; @@ -1483,983 +1734,2170 @@ NSPanelConfig::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<5, 36, 1, 94, 7> NSPanelConfig::_table_ = { +const ::_pbi::TcParseTable<1, 2, 0, 33, 2> NSPanelConfig_Sound::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 44, 248, // max_field_number, fast_idx_mask + 2, 8, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 515899392, // skipmap + 4294967292, // skipmap offsetof(decltype(_table_), field_entries), - 36, // num_field_entries - 1, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - &_NSPanelConfig_default_instance_._instance, + 2, // num_field_entries + 0, // num_aux_entries + offsetof(decltype(_table_), field_names), // no aux_entries + &_NSPanelConfig_Sound_default_instance_._instance, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelConfig>(), // to_prefetch + ::_pbi::TcParser::GetTable<::NSPanelConfig_Sound>(), // to_prefetch #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ - {::_pbi::TcParser::MiniParse, {}}, - // string name = 1; + // string rtttl = 2; {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.name_)}}, - // int32 default_room = 2; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.default_room_), 63>(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.default_room_)}}, - // .NSPanelConfig.NSPanelDefaultPage default_page = 3; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.default_page_), 63>(), - {24, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.default_page_)}}, - // int32 screensaver_activation_timeout = 4; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.screensaver_activation_timeout_), 63>(), - {32, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.screensaver_activation_timeout_)}}, - // int32 min_button_push_time = 5; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.min_button_push_time_), 63>(), - {40, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.min_button_push_time_)}}, - // int32 button_long_press_time = 6; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.button_long_press_time_), 63>(), - {48, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button_long_press_time_)}}, - // int32 special_mode_trigger_time = 7; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.special_mode_trigger_time_), 63>(), - {56, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.special_mode_trigger_time_)}}, - // int32 special_mode_release_time = 8; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.special_mode_release_time_), 63>(), - {64, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.special_mode_release_time_)}}, - // int32 screen_dim_level = 9; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.screen_dim_level_), 63>(), - {72, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.screen_dim_level_)}}, - // int32 screensaver_dim_level = 10; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.screensaver_dim_level_), 63>(), - {80, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.screensaver_dim_level_)}}, - // .NSPanelConfig.NSPanelScreensaverMode screensaver_mode = 11; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.screensaver_mode_), 63>(), - {88, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.screensaver_mode_)}}, - // bool show_screensaver_inside_temperature = 12; - {::_pbi::TcParser::SingularVarintNoZag1(), - {96, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.show_screensaver_inside_temperature_)}}, - // bool show_screensaver_outside_temperature = 13; - {::_pbi::TcParser::SingularVarintNoZag1(), - {104, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.show_screensaver_outside_temperature_)}}, - // bool clock_us_style = 14; - {::_pbi::TcParser::SingularVarintNoZag1(), - {112, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.clock_us_style_)}}, - // bool use_fahrenheit = 15; - {::_pbi::TcParser::SingularVarintNoZag1(), - {120, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.use_fahrenheit_)}}, - // bool is_us_panel = 16; - {::_pbi::TcParser::FastV8S2, - {384, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.is_us_panel_)}}, - // repeated .NSPanelConfig.RoomInfo room_infos = 17; - {::_pbi::TcParser::FastMtR2, - {394, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.room_infos_)}}, - // bool reverse_relays = 18; - {::_pbi::TcParser::FastV8S2, - {400, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.reverse_relays_)}}, - // bool relay1_default_mode = 19; - {::_pbi::TcParser::FastV8S2, - {408, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.relay1_default_mode_)}}, - // bool relay2_default_mode = 20; - {::_pbi::TcParser::FastV8S2, - {416, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.relay2_default_mode_)}}, - // int32 temperature_calibration = 21; - {::_pbi::TcParser::FastV32S2, - {424, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.temperature_calibration_)}}, - // .NSPanelConfig.NSPanelButtonMode button1_mode = 22; - {::_pbi::TcParser::FastV32S2, - {432, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button1_mode_)}}, - // bool locked_to_default_room = 39; - {::_pbi::TcParser::FastV8S2, - {696, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.locked_to_default_room_)}}, - // string inside_temperature_sensor_mqtt_topic = 40; - {::_pbi::TcParser::FastUS2, - {706, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.inside_temperature_sensor_mqtt_topic_)}}, - // .NSPanelConfig.NSPanelButtonMode button2_mode = 25; - {::_pbi::TcParser::FastV32S2, - {456, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button2_mode_)}}, - // int32 button1_upper_temperature = 42; - {::_pbi::TcParser::FastV32S2, - {720, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button1_upper_temperature_)}}, - // int32 button2_lower_temperature = 43; - {::_pbi::TcParser::FastV32S2, - {728, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button2_lower_temperature_)}}, - // int32 button2_upper_temperature = 44; - {::_pbi::TcParser::FastV32S2, - {736, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button2_upper_temperature_)}}, - {::_pbi::TcParser::MiniParse, {}}, - // repeated int32 global_scene_entity_page_ids = 30; - {::_pbi::TcParser::FastV32P2, - {498, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.global_scene_entity_page_ids_)}}, - // bool optimistic_mode = 31; - {::_pbi::TcParser::FastV8S2, - {504, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.optimistic_mode_)}}, + {18, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig_Sound, _impl_.rtttl_)}}, + // .NSPanelConfig.NSPanelSoundEvent event = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig_Sound, _impl_.event_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig_Sound, _impl_.event_)}}, }}, {{ - 33, 0, 1, - 61450, 26, 65535, 65535 }}, {{ - // string name = 1; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.name_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // int32 default_room = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.default_room_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // .NSPanelConfig.NSPanelDefaultPage default_page = 3; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.default_page_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, - // int32 screensaver_activation_timeout = 4; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.screensaver_activation_timeout_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 min_button_push_time = 5; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.min_button_push_time_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 button_long_press_time = 6; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button_long_press_time_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 special_mode_trigger_time = 7; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.special_mode_trigger_time_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 special_mode_release_time = 8; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.special_mode_release_time_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 screen_dim_level = 9; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.screen_dim_level_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 screensaver_dim_level = 10; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.screensaver_dim_level_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // .NSPanelConfig.NSPanelScreensaverMode screensaver_mode = 11; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.screensaver_mode_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, - // bool show_screensaver_inside_temperature = 12; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.show_screensaver_inside_temperature_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // bool show_screensaver_outside_temperature = 13; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.show_screensaver_outside_temperature_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // bool clock_us_style = 14; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.clock_us_style_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // bool use_fahrenheit = 15; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.use_fahrenheit_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // bool is_us_panel = 16; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.is_us_panel_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // repeated .NSPanelConfig.RoomInfo room_infos = 17; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.room_infos_), 0, 0, - (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - // bool reverse_relays = 18; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.reverse_relays_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // bool relay1_default_mode = 19; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.relay1_default_mode_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // bool relay2_default_mode = 20; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.relay2_default_mode_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // int32 temperature_calibration = 21; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.temperature_calibration_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // .NSPanelConfig.NSPanelButtonMode button1_mode = 22; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button1_mode_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, - // .NSPanelConfig.NSPanelButtonMode button2_mode = 25; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button2_mode_), 0, 0, + // .NSPanelConfig.NSPanelSoundEvent event = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig_Sound, _impl_.event_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, - // repeated int32 global_scene_entity_page_ids = 30; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.global_scene_entity_page_ids_), 0, 0, - (0 | ::_fl::kFcRepeated | ::_fl::kPackedInt32)}, - // bool optimistic_mode = 31; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.optimistic_mode_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // int32 raise_light_level_to_100_above = 32; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.raise_light_level_to_100_above_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 nspanel_id = 33; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.nspanel_id_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // repeated int32 relay1_relay_group = 35; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.relay1_relay_group_), 0, 0, - (0 | ::_fl::kFcRepeated | ::_fl::kPackedInt32)}, - // repeated int32 relay2_relay_group = 37; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.relay2_relay_group_), 0, 0, - (0 | ::_fl::kFcRepeated | ::_fl::kPackedInt32)}, - // int32 default_light_brightess = 38; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.default_light_brightess_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // bool locked_to_default_room = 39; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.locked_to_default_room_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // string inside_temperature_sensor_mqtt_topic = 40; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.inside_temperature_sensor_mqtt_topic_), 0, 0, + // string rtttl = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig_Sound, _impl_.rtttl_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // int32 button1_lower_temperature = 41; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button1_lower_temperature_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 button1_upper_temperature = 42; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button1_upper_temperature_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 button2_lower_temperature = 43; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button2_lower_temperature_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 button2_upper_temperature = 44; - {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button2_upper_temperature_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - }}, {{ - {::_pbi::TcParser::GetTable<::NSPanelConfig_RoomInfo>()}, - }}, {{ - "\15\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\44\0\0\0\0\0\0\0" - "NSPanelConfig" - "name" - "inside_temperature_sensor_mqtt_topic" + }}, + // no aux_entries + {{ + "\23\0\5\0\0\0\0\0" + "NSPanelConfig.Sound" + "rtttl" }}, }; -PROTOBUF_NOINLINE void NSPanelConfig::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelConfig) +PROTOBUF_NOINLINE void NSPanelConfig_Sound::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelConfig.Sound) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.room_infos_.Clear(); - _impl_.global_scene_entity_page_ids_.Clear(); - _impl_.relay1_relay_group_.Clear(); - _impl_.relay2_relay_group_.Clear(); - _impl_.name_.ClearToEmpty(); - _impl_.inside_temperature_sensor_mqtt_topic_.ClearToEmpty(); - ::memset(&_impl_.default_room_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.button2_upper_temperature_) - - reinterpret_cast(&_impl_.default_room_)) + sizeof(_impl_.button2_upper_temperature_)); + _impl_.rtttl_.ClearToEmpty(); + _impl_.event_ = 0; _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::uint8_t* NSPanelConfig::_InternalSerialize( +::uint8_t* NSPanelConfig_Sound::_InternalSerialize( ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelConfig) + // @@protoc_insertion_point(serialize_to_array_start:NSPanelConfig.Sound) ::uint32_t cached_has_bits = 0; (void)cached_has_bits; - // string name = 1; - if (!this->_internal_name().empty()) { - const std::string& _s = this->_internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelConfig.name"); - target = stream->WriteStringMaybeAliased(1, _s, target); - } - - // int32 default_room = 2; - if (this->_internal_default_room() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this->_internal_default_room(), target); - } - - // .NSPanelConfig.NSPanelDefaultPage default_page = 3; - if (this->_internal_default_page() != 0) { + // .NSPanelConfig.NSPanelSoundEvent event = 1; + if (this->_internal_event() != 0) { target = stream->EnsureSpace(target); target = ::_pbi::WireFormatLite::WriteEnumToArray( - 3, this->_internal_default_page(), target); - } - - // int32 screensaver_activation_timeout = 4; - if (this->_internal_screensaver_activation_timeout() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<4>( - stream, this->_internal_screensaver_activation_timeout(), target); + 1, this->_internal_event(), target); } - // int32 min_button_push_time = 5; - if (this->_internal_min_button_push_time() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<5>( - stream, this->_internal_min_button_push_time(), target); + // string rtttl = 2; + if (!this->_internal_rtttl().empty()) { + const std::string& _s = this->_internal_rtttl(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelConfig.Sound.rtttl"); + target = stream->WriteStringMaybeAliased(2, _s, target); } - // int32 button_long_press_time = 6; - if (this->_internal_button_long_press_time() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<6>( - stream, this->_internal_button_long_press_time(), target); + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } + // @@protoc_insertion_point(serialize_to_array_end:NSPanelConfig.Sound) + return target; +} - // int32 special_mode_trigger_time = 7; - if (this->_internal_special_mode_trigger_time() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<7>( - stream, this->_internal_special_mode_trigger_time(), target); - } +::size_t NSPanelConfig_Sound::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelConfig.Sound) + ::size_t total_size = 0; - // int32 special_mode_release_time = 8; - if (this->_internal_special_mode_release_time() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<8>( - stream, this->_internal_special_mode_release_time(), target); - } + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; - // int32 screen_dim_level = 9; - if (this->_internal_screen_dim_level() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<9>( - stream, this->_internal_screen_dim_level(), target); + ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); + // string rtttl = 2; + if (!this->_internal_rtttl().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_rtttl()); } - // int32 screensaver_dim_level = 10; - if (this->_internal_screensaver_dim_level() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<10>( - stream, this->_internal_screensaver_dim_level(), target); + // .NSPanelConfig.NSPanelSoundEvent event = 1; + if (this->_internal_event() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_event()); } - // .NSPanelConfig.NSPanelScreensaverMode screensaver_mode = 11; - if (this->_internal_screensaver_mode() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 11, this->_internal_screensaver_mode(), target); - } + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} - // bool show_screensaver_inside_temperature = 12; - if (this->_internal_show_screensaver_inside_temperature() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 12, this->_internal_show_screensaver_inside_temperature(), target); - } - // bool show_screensaver_outside_temperature = 13; - if (this->_internal_show_screensaver_outside_temperature() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 13, this->_internal_show_screensaver_outside_temperature(), target); - } +void NSPanelConfig_Sound::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelConfig.Sound) + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; + (void) cached_has_bits; - // bool clock_us_style = 14; - if (this->_internal_clock_us_style() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 14, this->_internal_clock_us_style(), target); + if (!from._internal_rtttl().empty()) { + _this->_internal_set_rtttl(from._internal_rtttl()); } - - // bool use_fahrenheit = 15; - if (this->_internal_use_fahrenheit() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 15, this->_internal_use_fahrenheit(), target); + if (from._internal_event() != 0) { + _this->_impl_.event_ = from._impl_.event_; } + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); +} - // bool is_us_panel = 16; - if (this->_internal_is_us_panel() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 16, this->_internal_is_us_panel(), target); - } - - // repeated .NSPanelConfig.RoomInfo room_infos = 17; - for (unsigned i = 0, n = static_cast( - this->_internal_room_infos_size()); - i < n; i++) { - const auto& repfield = this->_internal_room_infos().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 17, repfield, repfield.GetCachedSize(), - target, stream); - } - - // bool reverse_relays = 18; - if (this->_internal_reverse_relays() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 18, this->_internal_reverse_relays(), target); - } - - // bool relay1_default_mode = 19; - if (this->_internal_relay1_default_mode() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 19, this->_internal_relay1_default_mode(), target); - } - - // bool relay2_default_mode = 20; - if (this->_internal_relay2_default_mode() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 20, this->_internal_relay2_default_mode(), target); - } +void NSPanelConfig_Sound::CopyFrom(const NSPanelConfig_Sound& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelConfig.Sound) + if (&from == this) return; + Clear(); + MergeFrom(from); +} - // int32 temperature_calibration = 21; - if (this->_internal_temperature_calibration() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 21, this->_internal_temperature_calibration(), target); - } - // .NSPanelConfig.NSPanelButtonMode button1_mode = 22; - if (this->_internal_button1_mode() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 22, this->_internal_button1_mode(), target); - } +void NSPanelConfig_Sound::InternalSwap(NSPanelConfig_Sound* PROTOBUF_RESTRICT other) { + using std::swap; + auto* arena = GetArena(); + ABSL_DCHECK_EQ(arena, other->GetArena()); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.rtttl_, &other->_impl_.rtttl_, arena); + swap(_impl_.event_, other->_impl_.event_); +} - // .NSPanelConfig.NSPanelButtonMode button2_mode = 25; - if (this->_internal_button2_mode() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 25, this->_internal_button2_mode(), target); - } +::google::protobuf::Metadata NSPanelConfig_Sound::GetMetadata() const { + return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); +} +// =================================================================== - // repeated int32 global_scene_entity_page_ids = 30; - { - int byte_size = _impl_._global_scene_entity_page_ids_cached_byte_size_.Get(); - if (byte_size > 0) { - target = stream->WriteInt32Packed( - 30, _internal_global_scene_entity_page_ids(), byte_size, target); - } - } +class NSPanelConfig::_Internal { + public: +}; - // bool optimistic_mode = 31; - if (this->_internal_optimistic_mode() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 31, this->_internal_optimistic_mode(), target); - } +NSPanelConfig::NSPanelConfig(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); + // @@protoc_insertion_point(arena_constructor:NSPanelConfig) +} +inline PROTOBUF_NDEBUG_INLINE NSPanelConfig::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from, const ::NSPanelConfig& from_msg) + : room_infos_{visibility, arena, from.room_infos_}, + global_scene_entity_page_ids_{visibility, arena, from.global_scene_entity_page_ids_}, + _global_scene_entity_page_ids_cached_byte_size_{0}, + relay1_relay_group_{visibility, arena, from.relay1_relay_group_}, + _relay1_relay_group_cached_byte_size_{0}, + relay2_relay_group_{visibility, arena, from.relay2_relay_group_}, + _relay2_relay_group_cached_byte_size_{0}, + sounds_{visibility, arena, from.sounds_}, + name_(arena, from.name_), + inside_temperature_sensor_mqtt_topic_(arena, from.inside_temperature_sensor_mqtt_topic_), + tz_posix_(arena, from.tz_posix_), + button1_entity_page_topic_(arena, from.button1_entity_page_topic_), + button2_entity_page_topic_(arena, from.button2_entity_page_topic_), + _cached_size_{0} {} - // int32 raise_light_level_to_100_above = 32; - if (this->_internal_raise_light_level_to_100_above() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 32, this->_internal_raise_light_level_to_100_above(), target); - } +NSPanelConfig::NSPanelConfig( + ::google::protobuf::Arena* arena, + const NSPanelConfig& from) + : ::google::protobuf::Message(arena) { + NSPanelConfig* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); + ::memcpy(reinterpret_cast(&_impl_) + + offsetof(Impl_, default_room_), + reinterpret_cast(&from._impl_) + + offsetof(Impl_, default_room_), + offsetof(Impl_, button2_upper_temperature_) - + offsetof(Impl_, default_room_) + + sizeof(Impl_::button2_upper_temperature_)); - // int32 nspanel_id = 33; - if (this->_internal_nspanel_id() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 33, this->_internal_nspanel_id(), target); - } + // @@protoc_insertion_point(copy_constructor:NSPanelConfig) +} +inline PROTOBUF_NDEBUG_INLINE NSPanelConfig::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : room_infos_{visibility, arena}, + global_scene_entity_page_ids_{visibility, arena}, + _global_scene_entity_page_ids_cached_byte_size_{0}, + relay1_relay_group_{visibility, arena}, + _relay1_relay_group_cached_byte_size_{0}, + relay2_relay_group_{visibility, arena}, + _relay2_relay_group_cached_byte_size_{0}, + sounds_{visibility, arena}, + name_(arena), + inside_temperature_sensor_mqtt_topic_(arena), + tz_posix_(arena), + button1_entity_page_topic_(arena), + button2_entity_page_topic_(arena), + _cached_size_{0} {} - // repeated int32 relay1_relay_group = 35; - { - int byte_size = _impl_._relay1_relay_group_cached_byte_size_.Get(); - if (byte_size > 0) { - target = stream->WriteInt32Packed( - 35, _internal_relay1_relay_group(), byte_size, target); - } - } +inline void NSPanelConfig::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); + ::memset(reinterpret_cast(&_impl_) + + offsetof(Impl_, default_room_), + 0, + offsetof(Impl_, button2_upper_temperature_) - + offsetof(Impl_, default_room_) + + sizeof(Impl_::button2_upper_temperature_)); +} +NSPanelConfig::~NSPanelConfig() { + // @@protoc_insertion_point(destructor:NSPanelConfig) + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); + SharedDtor(); +} +inline void NSPanelConfig::SharedDtor() { + ABSL_DCHECK(GetArena() == nullptr); + _impl_.name_.Destroy(); + _impl_.inside_temperature_sensor_mqtt_topic_.Destroy(); + _impl_.tz_posix_.Destroy(); + _impl_.button1_entity_page_topic_.Destroy(); + _impl_.button2_entity_page_topic_.Destroy(); + _impl_.~Impl_(); +} - // repeated int32 relay2_relay_group = 37; +const ::google::protobuf::MessageLite::ClassData* +NSPanelConfig::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: + ClassDataFull _data_ = { + { + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_._cached_size_), + false, + }, + &NSPanelConfig::MergeImpl, + &NSPanelConfig::kDescriptorMethods, + &descriptor_table_protobuf_5fnspanel_2eproto, + nullptr, // tracker + }; + ::google::protobuf::internal::PrefetchToLocalCache(&_data_); + ::google::protobuf::internal::PrefetchToLocalCache(_data_.tc_table); + return _data_.base(); +} +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<5, 40, 2, 160, 7> NSPanelConfig::_table_ = { { - int byte_size = _impl_._relay2_relay_group_cached_byte_size_.Get(); - if (byte_size > 0) { - target = stream->WriteInt32Packed( - 37, _internal_relay2_relay_group(), byte_size, target); - } - } - - // int32 default_light_brightess = 38; - if (this->_internal_default_light_brightess() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 38, this->_internal_default_light_brightess(), target); - } - - // bool locked_to_default_room = 39; - if (this->_internal_locked_to_default_room() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 39, this->_internal_locked_to_default_room(), target); - } - - // string inside_temperature_sensor_mqtt_topic = 40; - if (!this->_internal_inside_temperature_sensor_mqtt_topic().empty()) { - const std::string& _s = this->_internal_inside_temperature_sensor_mqtt_topic(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelConfig.inside_temperature_sensor_mqtt_topic"); - target = stream->WriteStringMaybeAliased(40, _s, target); - } - - // int32 button1_lower_temperature = 41; - if (this->_internal_button1_lower_temperature() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 41, this->_internal_button1_lower_temperature(), target); - } - - // int32 button1_upper_temperature = 42; - if (this->_internal_button1_upper_temperature() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 42, this->_internal_button1_upper_temperature(), target); - } - - // int32 button2_lower_temperature = 43; - if (this->_internal_button2_lower_temperature() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 43, this->_internal_button2_lower_temperature(), target); - } + 0, // no _has_bits_ + 0, // no _extensions_ + 48, 248, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 515899392, // skipmap + offsetof(decltype(_table_), field_entries), + 40, // num_field_entries + 2, // num_aux_entries + offsetof(decltype(_table_), aux_entries), + &_NSPanelConfig_default_instance_._instance, + nullptr, // post_loop_handler + ::_pbi::TcParser::GenericFallback, // fallback + #ifdef PROTOBUF_PREFETCH_PARSE_TABLE + ::_pbi::TcParser::GetTable<::NSPanelConfig>(), // to_prefetch + #endif // PROTOBUF_PREFETCH_PARSE_TABLE + }, {{ + {::_pbi::TcParser::MiniParse, {}}, + // string name = 1; + {::_pbi::TcParser::FastUS1, + {10, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.name_)}}, + // int32 default_room = 2; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.default_room_), 63>(), + {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.default_room_)}}, + // .NSPanelConfig.NSPanelDefaultPage default_page = 3; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.default_page_), 63>(), + {24, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.default_page_)}}, + // int32 screensaver_activation_timeout = 4; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.screensaver_activation_timeout_), 63>(), + {32, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.screensaver_activation_timeout_)}}, + // int32 min_button_push_time = 5; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.min_button_push_time_), 63>(), + {40, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.min_button_push_time_)}}, + // int32 button_long_press_time = 6; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.button_long_press_time_), 63>(), + {48, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button_long_press_time_)}}, + // int32 special_mode_trigger_time = 7; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.special_mode_trigger_time_), 63>(), + {56, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.special_mode_trigger_time_)}}, + // int32 special_mode_release_time = 8; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.special_mode_release_time_), 63>(), + {64, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.special_mode_release_time_)}}, + // int32 screen_dim_level = 9; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.screen_dim_level_), 63>(), + {72, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.screen_dim_level_)}}, + // int32 screensaver_dim_level = 10; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.screensaver_dim_level_), 63>(), + {80, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.screensaver_dim_level_)}}, + // .NSPanelConfig.NSPanelScreensaverMode screensaver_mode = 11; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelConfig, _impl_.screensaver_mode_), 63>(), + {88, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.screensaver_mode_)}}, + // bool show_screensaver_inside_temperature = 12; + {::_pbi::TcParser::SingularVarintNoZag1(), + {96, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.show_screensaver_inside_temperature_)}}, + // bool show_screensaver_outside_temperature = 13; + {::_pbi::TcParser::SingularVarintNoZag1(), + {104, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.show_screensaver_outside_temperature_)}}, + // bool clock_us_style = 14; + {::_pbi::TcParser::SingularVarintNoZag1(), + {112, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.clock_us_style_)}}, + // bool use_fahrenheit = 15; + {::_pbi::TcParser::SingularVarintNoZag1(), + {120, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.use_fahrenheit_)}}, + // bool is_us_panel = 16; + {::_pbi::TcParser::FastV8S2, + {384, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.is_us_panel_)}}, + // repeated .NSPanelConfig.RoomInfo room_infos = 17; + {::_pbi::TcParser::FastMtR2, + {394, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.room_infos_)}}, + // bool reverse_relays = 18; + {::_pbi::TcParser::FastV8S2, + {400, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.reverse_relays_)}}, + // bool relay1_default_mode = 19; + {::_pbi::TcParser::FastV8S2, + {408, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.relay1_default_mode_)}}, + // bool relay2_default_mode = 20; + {::_pbi::TcParser::FastV8S2, + {416, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.relay2_default_mode_)}}, + // int32 temperature_calibration = 21; + {::_pbi::TcParser::FastV32S2, + {424, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.temperature_calibration_)}}, + // .NSPanelConfig.NSPanelButtonMode button1_mode = 22; + {::_pbi::TcParser::FastV32S2, + {432, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button1_mode_)}}, + // bool locked_to_default_room = 39; + {::_pbi::TcParser::FastV8S2, + {696, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.locked_to_default_room_)}}, + // string inside_temperature_sensor_mqtt_topic = 40; + {::_pbi::TcParser::FastUS2, + {706, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.inside_temperature_sensor_mqtt_topic_)}}, + // .NSPanelConfig.NSPanelButtonMode button2_mode = 25; + {::_pbi::TcParser::FastV32S2, + {456, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button2_mode_)}}, + // int32 button1_upper_temperature = 42; + {::_pbi::TcParser::FastV32S2, + {720, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button1_upper_temperature_)}}, + // int32 button2_lower_temperature = 43; + {::_pbi::TcParser::FastV32S2, + {728, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button2_lower_temperature_)}}, + // int32 button2_upper_temperature = 44; + {::_pbi::TcParser::FastV32S2, + {736, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button2_upper_temperature_)}}, + // repeated .NSPanelConfig.Sound sounds = 45; + {::_pbi::TcParser::FastMtR2, + {746, 63, 1, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.sounds_)}}, + // repeated int32 global_scene_entity_page_ids = 30; + {::_pbi::TcParser::FastV32P2, + {498, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.global_scene_entity_page_ids_)}}, + // bool optimistic_mode = 31; + {::_pbi::TcParser::FastV8S2, + {504, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.optimistic_mode_)}}, + }}, {{ + 33, 0, 1, + 10, 26, + 65535, 65535 + }}, {{ + // string name = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.name_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // int32 default_room = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.default_room_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // .NSPanelConfig.NSPanelDefaultPage default_page = 3; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.default_page_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + // int32 screensaver_activation_timeout = 4; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.screensaver_activation_timeout_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 min_button_push_time = 5; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.min_button_push_time_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 button_long_press_time = 6; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button_long_press_time_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 special_mode_trigger_time = 7; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.special_mode_trigger_time_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 special_mode_release_time = 8; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.special_mode_release_time_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 screen_dim_level = 9; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.screen_dim_level_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 screensaver_dim_level = 10; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.screensaver_dim_level_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // .NSPanelConfig.NSPanelScreensaverMode screensaver_mode = 11; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.screensaver_mode_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + // bool show_screensaver_inside_temperature = 12; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.show_screensaver_inside_temperature_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool show_screensaver_outside_temperature = 13; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.show_screensaver_outside_temperature_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool clock_us_style = 14; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.clock_us_style_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool use_fahrenheit = 15; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.use_fahrenheit_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool is_us_panel = 16; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.is_us_panel_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // repeated .NSPanelConfig.RoomInfo room_infos = 17; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.room_infos_), 0, 0, + (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, + // bool reverse_relays = 18; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.reverse_relays_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool relay1_default_mode = 19; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.relay1_default_mode_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool relay2_default_mode = 20; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.relay2_default_mode_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // int32 temperature_calibration = 21; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.temperature_calibration_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // .NSPanelConfig.NSPanelButtonMode button1_mode = 22; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button1_mode_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + // .NSPanelConfig.NSPanelButtonMode button2_mode = 25; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button2_mode_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + // repeated int32 global_scene_entity_page_ids = 30; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.global_scene_entity_page_ids_), 0, 0, + (0 | ::_fl::kFcRepeated | ::_fl::kPackedInt32)}, + // bool optimistic_mode = 31; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.optimistic_mode_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // int32 raise_light_level_to_100_above = 32; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.raise_light_level_to_100_above_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 nspanel_id = 33; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.nspanel_id_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // repeated int32 relay1_relay_group = 35; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.relay1_relay_group_), 0, 0, + (0 | ::_fl::kFcRepeated | ::_fl::kPackedInt32)}, + // repeated int32 relay2_relay_group = 37; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.relay2_relay_group_), 0, 0, + (0 | ::_fl::kFcRepeated | ::_fl::kPackedInt32)}, + // int32 default_light_brightess = 38; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.default_light_brightess_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // bool locked_to_default_room = 39; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.locked_to_default_room_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // string inside_temperature_sensor_mqtt_topic = 40; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.inside_temperature_sensor_mqtt_topic_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // int32 button1_lower_temperature = 41; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button1_lower_temperature_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 button1_upper_temperature = 42; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button1_upper_temperature_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 button2_lower_temperature = 43; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button2_lower_temperature_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 button2_upper_temperature = 44; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button2_upper_temperature_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // repeated .NSPanelConfig.Sound sounds = 45; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.sounds_), 0, 1, + (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, + // string tz_posix = 46; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.tz_posix_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // string button1_entity_page_topic = 47; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button1_entity_page_topic_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // string button2_entity_page_topic = 48; + {PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button2_entity_page_topic_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + }}, {{ + {::_pbi::TcParser::GetTable<::NSPanelConfig_RoomInfo>()}, + {::_pbi::TcParser::GetTable<::NSPanelConfig_Sound>()}, + }}, {{ + "\15\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\44\0\0\0\0\0\10\31\31\0\0\0\0\0\0\0" + "NSPanelConfig" + "name" + "inside_temperature_sensor_mqtt_topic" + "tz_posix" + "button1_entity_page_topic" + "button2_entity_page_topic" + }}, +}; + +PROTOBUF_NOINLINE void NSPanelConfig::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelConfig) + ::google::protobuf::internal::TSanWrite(&_impl_); + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.room_infos_.Clear(); + _impl_.global_scene_entity_page_ids_.Clear(); + _impl_.relay1_relay_group_.Clear(); + _impl_.relay2_relay_group_.Clear(); + _impl_.sounds_.Clear(); + _impl_.name_.ClearToEmpty(); + _impl_.inside_temperature_sensor_mqtt_topic_.ClearToEmpty(); + _impl_.tz_posix_.ClearToEmpty(); + _impl_.button1_entity_page_topic_.ClearToEmpty(); + _impl_.button2_entity_page_topic_.ClearToEmpty(); + ::memset(&_impl_.default_room_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.button2_upper_temperature_) - + reinterpret_cast(&_impl_.default_room_)) + sizeof(_impl_.button2_upper_temperature_)); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); +} + +::uint8_t* NSPanelConfig::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:NSPanelConfig) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + // string name = 1; + if (!this->_internal_name().empty()) { + const std::string& _s = this->_internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelConfig.name"); + target = stream->WriteStringMaybeAliased(1, _s, target); + } + + // int32 default_room = 2; + if (this->_internal_default_room() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<2>( + stream, this->_internal_default_room(), target); + } + + // .NSPanelConfig.NSPanelDefaultPage default_page = 3; + if (this->_internal_default_page() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 3, this->_internal_default_page(), target); + } + + // int32 screensaver_activation_timeout = 4; + if (this->_internal_screensaver_activation_timeout() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<4>( + stream, this->_internal_screensaver_activation_timeout(), target); + } + + // int32 min_button_push_time = 5; + if (this->_internal_min_button_push_time() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<5>( + stream, this->_internal_min_button_push_time(), target); + } + + // int32 button_long_press_time = 6; + if (this->_internal_button_long_press_time() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<6>( + stream, this->_internal_button_long_press_time(), target); + } + + // int32 special_mode_trigger_time = 7; + if (this->_internal_special_mode_trigger_time() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<7>( + stream, this->_internal_special_mode_trigger_time(), target); + } + + // int32 special_mode_release_time = 8; + if (this->_internal_special_mode_release_time() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<8>( + stream, this->_internal_special_mode_release_time(), target); + } + + // int32 screen_dim_level = 9; + if (this->_internal_screen_dim_level() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<9>( + stream, this->_internal_screen_dim_level(), target); + } + + // int32 screensaver_dim_level = 10; + if (this->_internal_screensaver_dim_level() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<10>( + stream, this->_internal_screensaver_dim_level(), target); + } + + // .NSPanelConfig.NSPanelScreensaverMode screensaver_mode = 11; + if (this->_internal_screensaver_mode() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 11, this->_internal_screensaver_mode(), target); + } + + // bool show_screensaver_inside_temperature = 12; + if (this->_internal_show_screensaver_inside_temperature() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 12, this->_internal_show_screensaver_inside_temperature(), target); + } + + // bool show_screensaver_outside_temperature = 13; + if (this->_internal_show_screensaver_outside_temperature() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 13, this->_internal_show_screensaver_outside_temperature(), target); + } + + // bool clock_us_style = 14; + if (this->_internal_clock_us_style() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 14, this->_internal_clock_us_style(), target); + } + + // bool use_fahrenheit = 15; + if (this->_internal_use_fahrenheit() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 15, this->_internal_use_fahrenheit(), target); + } + + // bool is_us_panel = 16; + if (this->_internal_is_us_panel() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 16, this->_internal_is_us_panel(), target); + } + + // repeated .NSPanelConfig.RoomInfo room_infos = 17; + for (unsigned i = 0, n = static_cast( + this->_internal_room_infos_size()); + i < n; i++) { + const auto& repfield = this->_internal_room_infos().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 17, repfield, repfield.GetCachedSize(), + target, stream); + } + + // bool reverse_relays = 18; + if (this->_internal_reverse_relays() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 18, this->_internal_reverse_relays(), target); + } + + // bool relay1_default_mode = 19; + if (this->_internal_relay1_default_mode() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 19, this->_internal_relay1_default_mode(), target); + } + + // bool relay2_default_mode = 20; + if (this->_internal_relay2_default_mode() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 20, this->_internal_relay2_default_mode(), target); + } + + // int32 temperature_calibration = 21; + if (this->_internal_temperature_calibration() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 21, this->_internal_temperature_calibration(), target); + } + + // .NSPanelConfig.NSPanelButtonMode button1_mode = 22; + if (this->_internal_button1_mode() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 22, this->_internal_button1_mode(), target); + } + + // .NSPanelConfig.NSPanelButtonMode button2_mode = 25; + if (this->_internal_button2_mode() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 25, this->_internal_button2_mode(), target); + } + + // repeated int32 global_scene_entity_page_ids = 30; + { + int byte_size = _impl_._global_scene_entity_page_ids_cached_byte_size_.Get(); + if (byte_size > 0) { + target = stream->WriteInt32Packed( + 30, _internal_global_scene_entity_page_ids(), byte_size, target); + } + } + + // bool optimistic_mode = 31; + if (this->_internal_optimistic_mode() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 31, this->_internal_optimistic_mode(), target); + } + + // int32 raise_light_level_to_100_above = 32; + if (this->_internal_raise_light_level_to_100_above() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 32, this->_internal_raise_light_level_to_100_above(), target); + } + + // int32 nspanel_id = 33; + if (this->_internal_nspanel_id() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 33, this->_internal_nspanel_id(), target); + } + + // repeated int32 relay1_relay_group = 35; + { + int byte_size = _impl_._relay1_relay_group_cached_byte_size_.Get(); + if (byte_size > 0) { + target = stream->WriteInt32Packed( + 35, _internal_relay1_relay_group(), byte_size, target); + } + } + + // repeated int32 relay2_relay_group = 37; + { + int byte_size = _impl_._relay2_relay_group_cached_byte_size_.Get(); + if (byte_size > 0) { + target = stream->WriteInt32Packed( + 37, _internal_relay2_relay_group(), byte_size, target); + } + } + + // int32 default_light_brightess = 38; + if (this->_internal_default_light_brightess() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 38, this->_internal_default_light_brightess(), target); + } + + // bool locked_to_default_room = 39; + if (this->_internal_locked_to_default_room() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 39, this->_internal_locked_to_default_room(), target); + } + + // string inside_temperature_sensor_mqtt_topic = 40; + if (!this->_internal_inside_temperature_sensor_mqtt_topic().empty()) { + const std::string& _s = this->_internal_inside_temperature_sensor_mqtt_topic(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelConfig.inside_temperature_sensor_mqtt_topic"); + target = stream->WriteStringMaybeAliased(40, _s, target); + } + + // int32 button1_lower_temperature = 41; + if (this->_internal_button1_lower_temperature() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 41, this->_internal_button1_lower_temperature(), target); + } + + // int32 button1_upper_temperature = 42; + if (this->_internal_button1_upper_temperature() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 42, this->_internal_button1_upper_temperature(), target); + } + + // int32 button2_lower_temperature = 43; + if (this->_internal_button2_lower_temperature() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 43, this->_internal_button2_lower_temperature(), target); + } + + // int32 button2_upper_temperature = 44; + if (this->_internal_button2_upper_temperature() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 44, this->_internal_button2_upper_temperature(), target); + } + + // repeated .NSPanelConfig.Sound sounds = 45; + for (unsigned i = 0, n = static_cast( + this->_internal_sounds_size()); + i < n; i++) { + const auto& repfield = this->_internal_sounds().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 45, repfield, repfield.GetCachedSize(), + target, stream); + } + + // string tz_posix = 46; + if (!this->_internal_tz_posix().empty()) { + const std::string& _s = this->_internal_tz_posix(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelConfig.tz_posix"); + target = stream->WriteStringMaybeAliased(46, _s, target); + } + + // string button1_entity_page_topic = 47; + if (!this->_internal_button1_entity_page_topic().empty()) { + const std::string& _s = this->_internal_button1_entity_page_topic(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelConfig.button1_entity_page_topic"); + target = stream->WriteStringMaybeAliased(47, _s, target); + } + + // string button2_entity_page_topic = 48; + if (!this->_internal_button2_entity_page_topic().empty()) { + const std::string& _s = this->_internal_button2_entity_page_topic(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelConfig.button2_entity_page_topic"); + target = stream->WriteStringMaybeAliased(48, _s, target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:NSPanelConfig) + return target; +} + +::size_t NSPanelConfig::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelConfig) + ::size_t total_size = 0; + + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); + // repeated .NSPanelConfig.RoomInfo room_infos = 17; + total_size += 2UL * this->_internal_room_infos_size(); + for (const auto& msg : this->_internal_room_infos()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + // repeated int32 global_scene_entity_page_ids = 30; + { + std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( + this->_internal_global_scene_entity_page_ids()) + ; + _impl_._global_scene_entity_page_ids_cached_byte_size_.Set(::_pbi::ToCachedSize(data_size)); + std::size_t tag_size = data_size == 0 + ? 0 + : 2 + ::_pbi::WireFormatLite::Int32Size( + static_cast(data_size)) + ; + total_size += tag_size + data_size; + } + // repeated int32 relay1_relay_group = 35; + { + std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( + this->_internal_relay1_relay_group()) + ; + _impl_._relay1_relay_group_cached_byte_size_.Set(::_pbi::ToCachedSize(data_size)); + std::size_t tag_size = data_size == 0 + ? 0 + : 2 + ::_pbi::WireFormatLite::Int32Size( + static_cast(data_size)) + ; + total_size += tag_size + data_size; + } + // repeated int32 relay2_relay_group = 37; + { + std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( + this->_internal_relay2_relay_group()) + ; + _impl_._relay2_relay_group_cached_byte_size_.Set(::_pbi::ToCachedSize(data_size)); + std::size_t tag_size = data_size == 0 + ? 0 + : 2 + ::_pbi::WireFormatLite::Int32Size( + static_cast(data_size)) + ; + total_size += tag_size + data_size; + } + // repeated .NSPanelConfig.Sound sounds = 45; + total_size += 2UL * this->_internal_sounds_size(); + for (const auto& msg : this->_internal_sounds()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + } + // string name = 1; + if (!this->_internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_name()); + } + + // string inside_temperature_sensor_mqtt_topic = 40; + if (!this->_internal_inside_temperature_sensor_mqtt_topic().empty()) { + total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_inside_temperature_sensor_mqtt_topic()); + } + + // string tz_posix = 46; + if (!this->_internal_tz_posix().empty()) { + total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_tz_posix()); + } + + // string button1_entity_page_topic = 47; + if (!this->_internal_button1_entity_page_topic().empty()) { + total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_button1_entity_page_topic()); + } + + // string button2_entity_page_topic = 48; + if (!this->_internal_button2_entity_page_topic().empty()) { + total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_button2_entity_page_topic()); + } + + // int32 default_room = 2; + if (this->_internal_default_room() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_default_room()); + } + + // .NSPanelConfig.NSPanelDefaultPage default_page = 3; + if (this->_internal_default_page() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_default_page()); + } + + // int32 screensaver_activation_timeout = 4; + if (this->_internal_screensaver_activation_timeout() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_screensaver_activation_timeout()); + } + + // int32 min_button_push_time = 5; + if (this->_internal_min_button_push_time() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_min_button_push_time()); + } + + // int32 button_long_press_time = 6; + if (this->_internal_button_long_press_time() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_button_long_press_time()); + } + + // int32 special_mode_trigger_time = 7; + if (this->_internal_special_mode_trigger_time() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_special_mode_trigger_time()); + } + + // int32 special_mode_release_time = 8; + if (this->_internal_special_mode_release_time() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_special_mode_release_time()); + } + + // int32 screen_dim_level = 9; + if (this->_internal_screen_dim_level() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_screen_dim_level()); + } + + // int32 screensaver_dim_level = 10; + if (this->_internal_screensaver_dim_level() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_screensaver_dim_level()); + } + + // .NSPanelConfig.NSPanelScreensaverMode screensaver_mode = 11; + if (this->_internal_screensaver_mode() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_screensaver_mode()); + } + + // bool show_screensaver_inside_temperature = 12; + if (this->_internal_show_screensaver_inside_temperature() != 0) { + total_size += 2; + } + + // bool show_screensaver_outside_temperature = 13; + if (this->_internal_show_screensaver_outside_temperature() != 0) { + total_size += 2; + } + + // bool clock_us_style = 14; + if (this->_internal_clock_us_style() != 0) { + total_size += 2; + } + + // bool use_fahrenheit = 15; + if (this->_internal_use_fahrenheit() != 0) { + total_size += 2; + } + + // bool is_us_panel = 16; + if (this->_internal_is_us_panel() != 0) { + total_size += 3; + } + + // bool reverse_relays = 18; + if (this->_internal_reverse_relays() != 0) { + total_size += 3; + } + + // bool relay1_default_mode = 19; + if (this->_internal_relay1_default_mode() != 0) { + total_size += 3; + } + + // bool relay2_default_mode = 20; + if (this->_internal_relay2_default_mode() != 0) { + total_size += 3; + } + + // int32 temperature_calibration = 21; + if (this->_internal_temperature_calibration() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_temperature_calibration()); + } + + // .NSPanelConfig.NSPanelButtonMode button1_mode = 22; + if (this->_internal_button1_mode() != 0) { + total_size += 2 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_button1_mode()); + } + + // .NSPanelConfig.NSPanelButtonMode button2_mode = 25; + if (this->_internal_button2_mode() != 0) { + total_size += 2 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_button2_mode()); + } + + // int32 raise_light_level_to_100_above = 32; + if (this->_internal_raise_light_level_to_100_above() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_raise_light_level_to_100_above()); + } + + // int32 nspanel_id = 33; + if (this->_internal_nspanel_id() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_nspanel_id()); + } + + // bool optimistic_mode = 31; + if (this->_internal_optimistic_mode() != 0) { + total_size += 3; + } + + // bool locked_to_default_room = 39; + if (this->_internal_locked_to_default_room() != 0) { + total_size += 3; + } + + // int32 default_light_brightess = 38; + if (this->_internal_default_light_brightess() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_default_light_brightess()); + } + + // int32 button1_lower_temperature = 41; + if (this->_internal_button1_lower_temperature() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_button1_lower_temperature()); + } + + // int32 button1_upper_temperature = 42; + if (this->_internal_button1_upper_temperature() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_button1_upper_temperature()); + } + + // int32 button2_lower_temperature = 43; + if (this->_internal_button2_lower_temperature() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_button2_lower_temperature()); + } + + // int32 button2_upper_temperature = 44; + if (this->_internal_button2_upper_temperature() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_button2_upper_temperature()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + + +void NSPanelConfig::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelConfig) + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _this->_internal_mutable_room_infos()->MergeFrom( + from._internal_room_infos()); + _this->_internal_mutable_global_scene_entity_page_ids()->MergeFrom(from._internal_global_scene_entity_page_ids()); + _this->_internal_mutable_relay1_relay_group()->MergeFrom(from._internal_relay1_relay_group()); + _this->_internal_mutable_relay2_relay_group()->MergeFrom(from._internal_relay2_relay_group()); + _this->_internal_mutable_sounds()->MergeFrom( + from._internal_sounds()); + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } + if (!from._internal_inside_temperature_sensor_mqtt_topic().empty()) { + _this->_internal_set_inside_temperature_sensor_mqtt_topic(from._internal_inside_temperature_sensor_mqtt_topic()); + } + if (!from._internal_tz_posix().empty()) { + _this->_internal_set_tz_posix(from._internal_tz_posix()); + } + if (!from._internal_button1_entity_page_topic().empty()) { + _this->_internal_set_button1_entity_page_topic(from._internal_button1_entity_page_topic()); + } + if (!from._internal_button2_entity_page_topic().empty()) { + _this->_internal_set_button2_entity_page_topic(from._internal_button2_entity_page_topic()); + } + if (from._internal_default_room() != 0) { + _this->_impl_.default_room_ = from._impl_.default_room_; + } + if (from._internal_default_page() != 0) { + _this->_impl_.default_page_ = from._impl_.default_page_; + } + if (from._internal_screensaver_activation_timeout() != 0) { + _this->_impl_.screensaver_activation_timeout_ = from._impl_.screensaver_activation_timeout_; + } + if (from._internal_min_button_push_time() != 0) { + _this->_impl_.min_button_push_time_ = from._impl_.min_button_push_time_; + } + if (from._internal_button_long_press_time() != 0) { + _this->_impl_.button_long_press_time_ = from._impl_.button_long_press_time_; + } + if (from._internal_special_mode_trigger_time() != 0) { + _this->_impl_.special_mode_trigger_time_ = from._impl_.special_mode_trigger_time_; + } + if (from._internal_special_mode_release_time() != 0) { + _this->_impl_.special_mode_release_time_ = from._impl_.special_mode_release_time_; + } + if (from._internal_screen_dim_level() != 0) { + _this->_impl_.screen_dim_level_ = from._impl_.screen_dim_level_; + } + if (from._internal_screensaver_dim_level() != 0) { + _this->_impl_.screensaver_dim_level_ = from._impl_.screensaver_dim_level_; + } + if (from._internal_screensaver_mode() != 0) { + _this->_impl_.screensaver_mode_ = from._impl_.screensaver_mode_; + } + if (from._internal_show_screensaver_inside_temperature() != 0) { + _this->_impl_.show_screensaver_inside_temperature_ = from._impl_.show_screensaver_inside_temperature_; + } + if (from._internal_show_screensaver_outside_temperature() != 0) { + _this->_impl_.show_screensaver_outside_temperature_ = from._impl_.show_screensaver_outside_temperature_; + } + if (from._internal_clock_us_style() != 0) { + _this->_impl_.clock_us_style_ = from._impl_.clock_us_style_; + } + if (from._internal_use_fahrenheit() != 0) { + _this->_impl_.use_fahrenheit_ = from._impl_.use_fahrenheit_; + } + if (from._internal_is_us_panel() != 0) { + _this->_impl_.is_us_panel_ = from._impl_.is_us_panel_; + } + if (from._internal_reverse_relays() != 0) { + _this->_impl_.reverse_relays_ = from._impl_.reverse_relays_; + } + if (from._internal_relay1_default_mode() != 0) { + _this->_impl_.relay1_default_mode_ = from._impl_.relay1_default_mode_; + } + if (from._internal_relay2_default_mode() != 0) { + _this->_impl_.relay2_default_mode_ = from._impl_.relay2_default_mode_; + } + if (from._internal_temperature_calibration() != 0) { + _this->_impl_.temperature_calibration_ = from._impl_.temperature_calibration_; + } + if (from._internal_button1_mode() != 0) { + _this->_impl_.button1_mode_ = from._impl_.button1_mode_; + } + if (from._internal_button2_mode() != 0) { + _this->_impl_.button2_mode_ = from._impl_.button2_mode_; + } + if (from._internal_raise_light_level_to_100_above() != 0) { + _this->_impl_.raise_light_level_to_100_above_ = from._impl_.raise_light_level_to_100_above_; + } + if (from._internal_nspanel_id() != 0) { + _this->_impl_.nspanel_id_ = from._impl_.nspanel_id_; + } + if (from._internal_optimistic_mode() != 0) { + _this->_impl_.optimistic_mode_ = from._impl_.optimistic_mode_; + } + if (from._internal_locked_to_default_room() != 0) { + _this->_impl_.locked_to_default_room_ = from._impl_.locked_to_default_room_; + } + if (from._internal_default_light_brightess() != 0) { + _this->_impl_.default_light_brightess_ = from._impl_.default_light_brightess_; + } + if (from._internal_button1_lower_temperature() != 0) { + _this->_impl_.button1_lower_temperature_ = from._impl_.button1_lower_temperature_; + } + if (from._internal_button1_upper_temperature() != 0) { + _this->_impl_.button1_upper_temperature_ = from._impl_.button1_upper_temperature_; + } + if (from._internal_button2_lower_temperature() != 0) { + _this->_impl_.button2_lower_temperature_ = from._impl_.button2_lower_temperature_; + } + if (from._internal_button2_upper_temperature() != 0) { + _this->_impl_.button2_upper_temperature_ = from._impl_.button2_upper_temperature_; + } + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); +} + +void NSPanelConfig::CopyFrom(const NSPanelConfig& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelConfig) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + + +void NSPanelConfig::InternalSwap(NSPanelConfig* PROTOBUF_RESTRICT other) { + using std::swap; + auto* arena = GetArena(); + ABSL_DCHECK_EQ(arena, other->GetArena()); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + _impl_.room_infos_.InternalSwap(&other->_impl_.room_infos_); + _impl_.global_scene_entity_page_ids_.InternalSwap(&other->_impl_.global_scene_entity_page_ids_); + _impl_.relay1_relay_group_.InternalSwap(&other->_impl_.relay1_relay_group_); + _impl_.relay2_relay_group_.InternalSwap(&other->_impl_.relay2_relay_group_); + _impl_.sounds_.InternalSwap(&other->_impl_.sounds_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.inside_temperature_sensor_mqtt_topic_, &other->_impl_.inside_temperature_sensor_mqtt_topic_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.tz_posix_, &other->_impl_.tz_posix_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.button1_entity_page_topic_, &other->_impl_.button1_entity_page_topic_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.button2_entity_page_topic_, &other->_impl_.button2_entity_page_topic_, arena); + ::google::protobuf::internal::memswap< + PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button2_upper_temperature_) + + sizeof(NSPanelConfig::_impl_.button2_upper_temperature_) + - PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.default_room_)>( + reinterpret_cast(&_impl_.default_room_), + reinterpret_cast(&other->_impl_.default_room_)); +} + +::google::protobuf::Metadata NSPanelConfig::GetMetadata() const { + return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); +} +// =================================================================== + +class NSPanelWarning::_Internal { + public: +}; + +NSPanelWarning::NSPanelWarning(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); + // @@protoc_insertion_point(arena_constructor:NSPanelWarning) +} +inline PROTOBUF_NDEBUG_INLINE NSPanelWarning::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from, const ::NSPanelWarning& from_msg) + : text_(arena, from.text_), + _cached_size_{0} {} + +NSPanelWarning::NSPanelWarning( + ::google::protobuf::Arena* arena, + const NSPanelWarning& from) + : ::google::protobuf::Message(arena) { + NSPanelWarning* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); + _impl_.level_ = from._impl_.level_; + + // @@protoc_insertion_point(copy_constructor:NSPanelWarning) +} +inline PROTOBUF_NDEBUG_INLINE NSPanelWarning::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : text_(arena), + _cached_size_{0} {} + +inline void NSPanelWarning::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); + _impl_.level_ = {}; +} +NSPanelWarning::~NSPanelWarning() { + // @@protoc_insertion_point(destructor:NSPanelWarning) + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); + SharedDtor(); +} +inline void NSPanelWarning::SharedDtor() { + ABSL_DCHECK(GetArena() == nullptr); + _impl_.text_.Destroy(); + _impl_.~Impl_(); +} + +const ::google::protobuf::MessageLite::ClassData* +NSPanelWarning::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: + ClassDataFull _data_ = { + { + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + PROTOBUF_FIELD_OFFSET(NSPanelWarning, _impl_._cached_size_), + false, + }, + &NSPanelWarning::MergeImpl, + &NSPanelWarning::kDescriptorMethods, + &descriptor_table_protobuf_5fnspanel_2eproto, + nullptr, // tracker + }; + ::google::protobuf::internal::PrefetchToLocalCache(&_data_); + ::google::protobuf::internal::PrefetchToLocalCache(_data_.tc_table); + return _data_.base(); +} +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<1, 2, 0, 27, 2> NSPanelWarning::_table_ = { + { + 0, // no _has_bits_ + 0, // no _extensions_ + 2, 8, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4294967292, // skipmap + offsetof(decltype(_table_), field_entries), + 2, // num_field_entries + 0, // num_aux_entries + offsetof(decltype(_table_), field_names), // no aux_entries + &_NSPanelWarning_default_instance_._instance, + nullptr, // post_loop_handler + ::_pbi::TcParser::GenericFallback, // fallback + #ifdef PROTOBUF_PREFETCH_PARSE_TABLE + ::_pbi::TcParser::GetTable<::NSPanelWarning>(), // to_prefetch + #endif // PROTOBUF_PREFETCH_PARSE_TABLE + }, {{ + // string text = 2; + {::_pbi::TcParser::FastUS1, + {18, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWarning, _impl_.text_)}}, + // .NSPanelWarningLevel level = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelWarning, _impl_.level_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWarning, _impl_.level_)}}, + }}, {{ + 65535, 65535 + }}, {{ + // .NSPanelWarningLevel level = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelWarning, _impl_.level_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + // string text = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelWarning, _impl_.text_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + }}, + // no aux_entries + {{ + "\16\0\4\0\0\0\0\0" + "NSPanelWarning" + "text" + }}, +}; + +PROTOBUF_NOINLINE void NSPanelWarning::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelWarning) + ::google::protobuf::internal::TSanWrite(&_impl_); + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.text_.ClearToEmpty(); + _impl_.level_ = 0; + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); +} + +::uint8_t* NSPanelWarning::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:NSPanelWarning) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + // .NSPanelWarningLevel level = 1; + if (this->_internal_level() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 1, this->_internal_level(), target); + } + + // string text = 2; + if (!this->_internal_text().empty()) { + const std::string& _s = this->_internal_text(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWarning.text"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:NSPanelWarning) + return target; +} + +::size_t NSPanelWarning::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelWarning) + ::size_t total_size = 0; + + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); + // string text = 2; + if (!this->_internal_text().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_text()); + } + + // .NSPanelWarningLevel level = 1; + if (this->_internal_level() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_level()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + + +void NSPanelWarning::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelWarning) + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_text().empty()) { + _this->_internal_set_text(from._internal_text()); + } + if (from._internal_level() != 0) { + _this->_impl_.level_ = from._impl_.level_; + } + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); +} + +void NSPanelWarning::CopyFrom(const NSPanelWarning& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelWarning) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + + +void NSPanelWarning::InternalSwap(NSPanelWarning* PROTOBUF_RESTRICT other) { + using std::swap; + auto* arena = GetArena(); + ABSL_DCHECK_EQ(arena, other->GetArena()); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.text_, &other->_impl_.text_, arena); + swap(_impl_.level_, other->_impl_.level_); +} + +::google::protobuf::Metadata NSPanelWarning::GetMetadata() const { + return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); +} +// =================================================================== + +class NSPanelStatusReport::_Internal { + public: +}; + +NSPanelStatusReport::NSPanelStatusReport(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); + // @@protoc_insertion_point(arena_constructor:NSPanelStatusReport) +} +inline PROTOBUF_NDEBUG_INLINE NSPanelStatusReport::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from, const ::NSPanelStatusReport& from_msg) + : warnings_{visibility, arena, from.warnings_}, + mac_address_(arena, from.mac_address_), + ip_address_(arena, from.ip_address_), + md5_firmware_(arena, from.md5_firmware_), + md5_littlefs_(arena, from.md5_littlefs_), + md5_tft_gui_(arena, from.md5_tft_gui_), + _cached_size_{0} {} + +NSPanelStatusReport::NSPanelStatusReport( + ::google::protobuf::Arena* arena, + const NSPanelStatusReport& from) + : ::google::protobuf::Message(arena) { + NSPanelStatusReport* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); + ::memcpy(reinterpret_cast(&_impl_) + + offsetof(Impl_, nspanel_state_), + reinterpret_cast(&from._impl_) + + offsetof(Impl_, nspanel_state_), + offsetof(Impl_, pressure_) - + offsetof(Impl_, nspanel_state_) + + sizeof(Impl_::pressure_)); + + // @@protoc_insertion_point(copy_constructor:NSPanelStatusReport) +} +inline PROTOBUF_NDEBUG_INLINE NSPanelStatusReport::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : warnings_{visibility, arena}, + mac_address_(arena), + ip_address_(arena), + md5_firmware_(arena), + md5_littlefs_(arena), + md5_tft_gui_(arena), + _cached_size_{0} {} + +inline void NSPanelStatusReport::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); + ::memset(reinterpret_cast(&_impl_) + + offsetof(Impl_, nspanel_state_), + 0, + offsetof(Impl_, pressure_) - + offsetof(Impl_, nspanel_state_) + + sizeof(Impl_::pressure_)); +} +NSPanelStatusReport::~NSPanelStatusReport() { + // @@protoc_insertion_point(destructor:NSPanelStatusReport) + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); + SharedDtor(); +} +inline void NSPanelStatusReport::SharedDtor() { + ABSL_DCHECK(GetArena() == nullptr); + _impl_.mac_address_.Destroy(); + _impl_.ip_address_.Destroy(); + _impl_.md5_firmware_.Destroy(); + _impl_.md5_littlefs_.Destroy(); + _impl_.md5_tft_gui_.Destroy(); + _impl_.~Impl_(); +} + +const ::google::protobuf::MessageLite::ClassData* +NSPanelStatusReport::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: + ClassDataFull _data_ = { + { + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_._cached_size_), + false, + }, + &NSPanelStatusReport::MergeImpl, + &NSPanelStatusReport::kDescriptorMethods, + &descriptor_table_protobuf_5fnspanel_2eproto, + nullptr, // tracker + }; + ::google::protobuf::internal::PrefetchToLocalCache(&_data_); + ::google::protobuf::internal::PrefetchToLocalCache(_data_.tc_table); + return _data_.base(); +} +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<4, 15, 1, 92, 2> NSPanelStatusReport::_table_ = { + { + 0, // no _has_bits_ + 0, // no _extensions_ + 15, 120, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4294934528, // skipmap + offsetof(decltype(_table_), field_entries), + 15, // num_field_entries + 1, // num_aux_entries + offsetof(decltype(_table_), aux_entries), + &_NSPanelStatusReport_default_instance_._instance, + nullptr, // post_loop_handler + ::_pbi::TcParser::GenericFallback, // fallback + #ifdef PROTOBUF_PREFETCH_PARSE_TABLE + ::_pbi::TcParser::GetTable<::NSPanelStatusReport>(), // to_prefetch + #endif // PROTOBUF_PREFETCH_PARSE_TABLE + }, {{ + {::_pbi::TcParser::MiniParse, {}}, + // .NSPanelStatusReport.state nspanel_state = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelStatusReport, _impl_.nspanel_state_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.nspanel_state_)}}, + // int32 update_progress = 2; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelStatusReport, _impl_.update_progress_), 63>(), + {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.update_progress_)}}, + // int32 rssi = 3; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelStatusReport, _impl_.rssi_), 63>(), + {24, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.rssi_)}}, + // int32 heap_used_pct = 4; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelStatusReport, _impl_.heap_used_pct_), 63>(), + {32, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.heap_used_pct_)}}, + // string mac_address = 5; + {::_pbi::TcParser::FastUS1, + {42, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.mac_address_)}}, + // float temperature = 6; + {::_pbi::TcParser::FastF32S1, + {53, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.temperature_)}}, + // string ip_address = 7; + {::_pbi::TcParser::FastUS1, + {58, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.ip_address_)}}, + // repeated .NSPanelWarning warnings = 8; + {::_pbi::TcParser::FastMtR1, + {66, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.warnings_)}}, + // string md5_firmware = 9; + {::_pbi::TcParser::FastUS1, + {74, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.md5_firmware_)}}, + // string md5_littlefs = 10; + {::_pbi::TcParser::FastUS1, + {82, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.md5_littlefs_)}}, + // string md5_tft_gui = 11; + {::_pbi::TcParser::FastUS1, + {90, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.md5_tft_gui_)}}, + // bool has_humidity = 12; + {::_pbi::TcParser::SingularVarintNoZag1(), + {96, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.has_humidity_)}}, + // float humidity = 13; + {::_pbi::TcParser::FastF32S1, + {109, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.humidity_)}}, + // bool has_pressure = 14; + {::_pbi::TcParser::SingularVarintNoZag1(), + {112, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.has_pressure_)}}, + // float pressure = 15; + {::_pbi::TcParser::FastF32S1, + {125, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.pressure_)}}, + }}, {{ + 65535, 65535 + }}, {{ + // .NSPanelStatusReport.state nspanel_state = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.nspanel_state_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + // int32 update_progress = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.update_progress_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 rssi = 3; + {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.rssi_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 heap_used_pct = 4; + {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.heap_used_pct_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // string mac_address = 5; + {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.mac_address_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // float temperature = 6; + {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.temperature_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kFloat)}, + // string ip_address = 7; + {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.ip_address_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // repeated .NSPanelWarning warnings = 8; + {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.warnings_), 0, 0, + (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, + // string md5_firmware = 9; + {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.md5_firmware_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // string md5_littlefs = 10; + {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.md5_littlefs_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // string md5_tft_gui = 11; + {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.md5_tft_gui_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // bool has_humidity = 12; + {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.has_humidity_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // float humidity = 13; + {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.humidity_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kFloat)}, + // bool has_pressure = 14; + {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.has_pressure_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // float pressure = 15; + {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.pressure_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kFloat)}, + }}, {{ + {::_pbi::TcParser::GetTable<::NSPanelWarning>()}, + }}, {{ + "\23\0\0\0\0\13\0\12\0\14\14\13\0\0\0\0" + "NSPanelStatusReport" + "mac_address" + "ip_address" + "md5_firmware" + "md5_littlefs" + "md5_tft_gui" + }}, +}; - // int32 button2_upper_temperature = 44; - if (this->_internal_button2_upper_temperature() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 44, this->_internal_button2_upper_temperature(), target); - } +PROTOBUF_NOINLINE void NSPanelStatusReport::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelStatusReport) + ::google::protobuf::internal::TSanWrite(&_impl_); + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelConfig) - return target; + _impl_.warnings_.Clear(); + _impl_.mac_address_.ClearToEmpty(); + _impl_.ip_address_.ClearToEmpty(); + _impl_.md5_firmware_.ClearToEmpty(); + _impl_.md5_littlefs_.ClearToEmpty(); + _impl_.md5_tft_gui_.ClearToEmpty(); + ::memset(&_impl_.nspanel_state_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.pressure_) - + reinterpret_cast(&_impl_.nspanel_state_)) + sizeof(_impl_.pressure_)); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::size_t NSPanelConfig::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelConfig) - ::size_t total_size = 0; - +::uint8_t* NSPanelStatusReport::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:NSPanelStatusReport) ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; + (void)cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); - // repeated .NSPanelConfig.RoomInfo room_infos = 17; - total_size += 2UL * this->_internal_room_infos_size(); - for (const auto& msg : this->_internal_room_infos()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - // repeated int32 global_scene_entity_page_ids = 30; - { - std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( - this->_internal_global_scene_entity_page_ids()) - ; - _impl_._global_scene_entity_page_ids_cached_byte_size_.Set(::_pbi::ToCachedSize(data_size)); - std::size_t tag_size = data_size == 0 - ? 0 - : 2 + ::_pbi::WireFormatLite::Int32Size( - static_cast(data_size)) - ; - total_size += tag_size + data_size; - } - // repeated int32 relay1_relay_group = 35; - { - std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( - this->_internal_relay1_relay_group()) - ; - _impl_._relay1_relay_group_cached_byte_size_.Set(::_pbi::ToCachedSize(data_size)); - std::size_t tag_size = data_size == 0 - ? 0 - : 2 + ::_pbi::WireFormatLite::Int32Size( - static_cast(data_size)) - ; - total_size += tag_size + data_size; - } - // repeated int32 relay2_relay_group = 37; - { - std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( - this->_internal_relay2_relay_group()) - ; - _impl_._relay2_relay_group_cached_byte_size_.Set(::_pbi::ToCachedSize(data_size)); - std::size_t tag_size = data_size == 0 - ? 0 - : 2 + ::_pbi::WireFormatLite::Int32Size( - static_cast(data_size)) - ; - total_size += tag_size + data_size; + // .NSPanelStatusReport.state nspanel_state = 1; + if (this->_internal_nspanel_state() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 1, this->_internal_nspanel_state(), target); } - // string name = 1; - if (!this->_internal_name().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_name()); + + // int32 update_progress = 2; + if (this->_internal_update_progress() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<2>( + stream, this->_internal_update_progress(), target); } - // string inside_temperature_sensor_mqtt_topic = 40; - if (!this->_internal_inside_temperature_sensor_mqtt_topic().empty()) { - total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_inside_temperature_sensor_mqtt_topic()); + // int32 rssi = 3; + if (this->_internal_rssi() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<3>( + stream, this->_internal_rssi(), target); } - // int32 default_room = 2; - if (this->_internal_default_room() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_default_room()); + // int32 heap_used_pct = 4; + if (this->_internal_heap_used_pct() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<4>( + stream, this->_internal_heap_used_pct(), target); } - // .NSPanelConfig.NSPanelDefaultPage default_page = 3; - if (this->_internal_default_page() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this->_internal_default_page()); + // string mac_address = 5; + if (!this->_internal_mac_address().empty()) { + const std::string& _s = this->_internal_mac_address(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelStatusReport.mac_address"); + target = stream->WriteStringMaybeAliased(5, _s, target); } - // int32 screensaver_activation_timeout = 4; - if (this->_internal_screensaver_activation_timeout() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_screensaver_activation_timeout()); + // float temperature = 6; + static_assert(sizeof(::uint32_t) == sizeof(float), + "Code assumes ::uint32_t and float are the same size."); + float tmp_temperature = this->_internal_temperature(); + ::uint32_t raw_temperature; + memcpy(&raw_temperature, &tmp_temperature, sizeof(tmp_temperature)); + if (raw_temperature != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteFloatToArray( + 6, this->_internal_temperature(), target); } - // int32 min_button_push_time = 5; - if (this->_internal_min_button_push_time() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_min_button_push_time()); + // string ip_address = 7; + if (!this->_internal_ip_address().empty()) { + const std::string& _s = this->_internal_ip_address(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelStatusReport.ip_address"); + target = stream->WriteStringMaybeAliased(7, _s, target); } - // int32 button_long_press_time = 6; - if (this->_internal_button_long_press_time() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_button_long_press_time()); + // repeated .NSPanelWarning warnings = 8; + for (unsigned i = 0, n = static_cast( + this->_internal_warnings_size()); + i < n; i++) { + const auto& repfield = this->_internal_warnings().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 8, repfield, repfield.GetCachedSize(), + target, stream); } - // int32 special_mode_trigger_time = 7; - if (this->_internal_special_mode_trigger_time() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_special_mode_trigger_time()); + // string md5_firmware = 9; + if (!this->_internal_md5_firmware().empty()) { + const std::string& _s = this->_internal_md5_firmware(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelStatusReport.md5_firmware"); + target = stream->WriteStringMaybeAliased(9, _s, target); } - // int32 special_mode_release_time = 8; - if (this->_internal_special_mode_release_time() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_special_mode_release_time()); + // string md5_littlefs = 10; + if (!this->_internal_md5_littlefs().empty()) { + const std::string& _s = this->_internal_md5_littlefs(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelStatusReport.md5_littlefs"); + target = stream->WriteStringMaybeAliased(10, _s, target); } - // int32 screen_dim_level = 9; - if (this->_internal_screen_dim_level() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_screen_dim_level()); + // string md5_tft_gui = 11; + if (!this->_internal_md5_tft_gui().empty()) { + const std::string& _s = this->_internal_md5_tft_gui(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelStatusReport.md5_tft_gui"); + target = stream->WriteStringMaybeAliased(11, _s, target); } - // int32 screensaver_dim_level = 10; - if (this->_internal_screensaver_dim_level() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_screensaver_dim_level()); + // bool has_humidity = 12; + if (this->_internal_has_humidity() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 12, this->_internal_has_humidity(), target); } - // .NSPanelConfig.NSPanelScreensaverMode screensaver_mode = 11; - if (this->_internal_screensaver_mode() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this->_internal_screensaver_mode()); + // float humidity = 13; + static_assert(sizeof(::uint32_t) == sizeof(float), + "Code assumes ::uint32_t and float are the same size."); + float tmp_humidity = this->_internal_humidity(); + ::uint32_t raw_humidity; + memcpy(&raw_humidity, &tmp_humidity, sizeof(tmp_humidity)); + if (raw_humidity != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteFloatToArray( + 13, this->_internal_humidity(), target); } - // bool show_screensaver_inside_temperature = 12; - if (this->_internal_show_screensaver_inside_temperature() != 0) { - total_size += 2; + // bool has_pressure = 14; + if (this->_internal_has_pressure() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 14, this->_internal_has_pressure(), target); } - // bool show_screensaver_outside_temperature = 13; - if (this->_internal_show_screensaver_outside_temperature() != 0) { - total_size += 2; + // float pressure = 15; + static_assert(sizeof(::uint32_t) == sizeof(float), + "Code assumes ::uint32_t and float are the same size."); + float tmp_pressure = this->_internal_pressure(); + ::uint32_t raw_pressure; + memcpy(&raw_pressure, &tmp_pressure, sizeof(tmp_pressure)); + if (raw_pressure != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteFloatToArray( + 15, this->_internal_pressure(), target); } - // bool clock_us_style = 14; - if (this->_internal_clock_us_style() != 0) { - total_size += 2; + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } + // @@protoc_insertion_point(serialize_to_array_end:NSPanelStatusReport) + return target; +} - // bool use_fahrenheit = 15; - if (this->_internal_use_fahrenheit() != 0) { - total_size += 2; - } +::size_t NSPanelStatusReport::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelStatusReport) + ::size_t total_size = 0; - // bool is_us_panel = 16; - if (this->_internal_is_us_panel() != 0) { - total_size += 3; - } + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; - // bool reverse_relays = 18; - if (this->_internal_reverse_relays() != 0) { - total_size += 3; + ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); + // repeated .NSPanelWarning warnings = 8; + total_size += 1UL * this->_internal_warnings_size(); + for (const auto& msg : this->_internal_warnings()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - - // bool relay1_default_mode = 19; - if (this->_internal_relay1_default_mode() != 0) { - total_size += 3; + // string mac_address = 5; + if (!this->_internal_mac_address().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_mac_address()); } - // bool relay2_default_mode = 20; - if (this->_internal_relay2_default_mode() != 0) { - total_size += 3; + // string ip_address = 7; + if (!this->_internal_ip_address().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_ip_address()); } - // int32 temperature_calibration = 21; - if (this->_internal_temperature_calibration() != 0) { - total_size += 2 + ::_pbi::WireFormatLite::Int32Size( - this->_internal_temperature_calibration()); + // string md5_firmware = 9; + if (!this->_internal_md5_firmware().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_md5_firmware()); } - // .NSPanelConfig.NSPanelButtonMode button1_mode = 22; - if (this->_internal_button1_mode() != 0) { - total_size += 2 + - ::_pbi::WireFormatLite::EnumSize(this->_internal_button1_mode()); + // string md5_littlefs = 10; + if (!this->_internal_md5_littlefs().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_md5_littlefs()); } - // .NSPanelConfig.NSPanelButtonMode button2_mode = 25; - if (this->_internal_button2_mode() != 0) { - total_size += 2 + - ::_pbi::WireFormatLite::EnumSize(this->_internal_button2_mode()); + // string md5_tft_gui = 11; + if (!this->_internal_md5_tft_gui().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_md5_tft_gui()); } - // int32 raise_light_level_to_100_above = 32; - if (this->_internal_raise_light_level_to_100_above() != 0) { - total_size += 2 + ::_pbi::WireFormatLite::Int32Size( - this->_internal_raise_light_level_to_100_above()); + // .NSPanelStatusReport.state nspanel_state = 1; + if (this->_internal_nspanel_state() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_nspanel_state()); } - // int32 nspanel_id = 33; - if (this->_internal_nspanel_id() != 0) { - total_size += 2 + ::_pbi::WireFormatLite::Int32Size( - this->_internal_nspanel_id()); + // int32 update_progress = 2; + if (this->_internal_update_progress() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_update_progress()); } - // bool optimistic_mode = 31; - if (this->_internal_optimistic_mode() != 0) { - total_size += 3; + // int32 rssi = 3; + if (this->_internal_rssi() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_rssi()); } - // bool locked_to_default_room = 39; - if (this->_internal_locked_to_default_room() != 0) { - total_size += 3; + // int32 heap_used_pct = 4; + if (this->_internal_heap_used_pct() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_heap_used_pct()); } - // int32 default_light_brightess = 38; - if (this->_internal_default_light_brightess() != 0) { - total_size += 2 + ::_pbi::WireFormatLite::Int32Size( - this->_internal_default_light_brightess()); + // float temperature = 6; + static_assert(sizeof(::uint32_t) == sizeof(float), + "Code assumes ::uint32_t and float are the same size."); + float tmp_temperature = this->_internal_temperature(); + ::uint32_t raw_temperature; + memcpy(&raw_temperature, &tmp_temperature, sizeof(tmp_temperature)); + if (raw_temperature != 0) { + total_size += 5; } - // int32 button1_lower_temperature = 41; - if (this->_internal_button1_lower_temperature() != 0) { - total_size += 2 + ::_pbi::WireFormatLite::Int32Size( - this->_internal_button1_lower_temperature()); + // float humidity = 13; + static_assert(sizeof(::uint32_t) == sizeof(float), + "Code assumes ::uint32_t and float are the same size."); + float tmp_humidity = this->_internal_humidity(); + ::uint32_t raw_humidity; + memcpy(&raw_humidity, &tmp_humidity, sizeof(tmp_humidity)); + if (raw_humidity != 0) { + total_size += 5; } - // int32 button1_upper_temperature = 42; - if (this->_internal_button1_upper_temperature() != 0) { - total_size += 2 + ::_pbi::WireFormatLite::Int32Size( - this->_internal_button1_upper_temperature()); + // bool has_humidity = 12; + if (this->_internal_has_humidity() != 0) { + total_size += 2; } - // int32 button2_lower_temperature = 43; - if (this->_internal_button2_lower_temperature() != 0) { - total_size += 2 + ::_pbi::WireFormatLite::Int32Size( - this->_internal_button2_lower_temperature()); + // bool has_pressure = 14; + if (this->_internal_has_pressure() != 0) { + total_size += 2; } - // int32 button2_upper_temperature = 44; - if (this->_internal_button2_upper_temperature() != 0) { - total_size += 2 + ::_pbi::WireFormatLite::Int32Size( - this->_internal_button2_upper_temperature()); + // float pressure = 15; + static_assert(sizeof(::uint32_t) == sizeof(float), + "Code assumes ::uint32_t and float are the same size."); + float tmp_pressure = this->_internal_pressure(); + ::uint32_t raw_pressure; + memcpy(&raw_pressure, &tmp_pressure, sizeof(tmp_pressure)); + if (raw_pressure != 0) { + total_size += 5; } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -void NSPanelConfig::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelConfig) +void NSPanelStatusReport::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelStatusReport) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - _this->_internal_mutable_room_infos()->MergeFrom( - from._internal_room_infos()); - _this->_internal_mutable_global_scene_entity_page_ids()->MergeFrom(from._internal_global_scene_entity_page_ids()); - _this->_internal_mutable_relay1_relay_group()->MergeFrom(from._internal_relay1_relay_group()); - _this->_internal_mutable_relay2_relay_group()->MergeFrom(from._internal_relay2_relay_group()); - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (!from._internal_inside_temperature_sensor_mqtt_topic().empty()) { - _this->_internal_set_inside_temperature_sensor_mqtt_topic(from._internal_inside_temperature_sensor_mqtt_topic()); - } - if (from._internal_default_room() != 0) { - _this->_impl_.default_room_ = from._impl_.default_room_; - } - if (from._internal_default_page() != 0) { - _this->_impl_.default_page_ = from._impl_.default_page_; - } - if (from._internal_screensaver_activation_timeout() != 0) { - _this->_impl_.screensaver_activation_timeout_ = from._impl_.screensaver_activation_timeout_; - } - if (from._internal_min_button_push_time() != 0) { - _this->_impl_.min_button_push_time_ = from._impl_.min_button_push_time_; - } - if (from._internal_button_long_press_time() != 0) { - _this->_impl_.button_long_press_time_ = from._impl_.button_long_press_time_; - } - if (from._internal_special_mode_trigger_time() != 0) { - _this->_impl_.special_mode_trigger_time_ = from._impl_.special_mode_trigger_time_; - } - if (from._internal_special_mode_release_time() != 0) { - _this->_impl_.special_mode_release_time_ = from._impl_.special_mode_release_time_; - } - if (from._internal_screen_dim_level() != 0) { - _this->_impl_.screen_dim_level_ = from._impl_.screen_dim_level_; - } - if (from._internal_screensaver_dim_level() != 0) { - _this->_impl_.screensaver_dim_level_ = from._impl_.screensaver_dim_level_; - } - if (from._internal_screensaver_mode() != 0) { - _this->_impl_.screensaver_mode_ = from._impl_.screensaver_mode_; - } - if (from._internal_show_screensaver_inside_temperature() != 0) { - _this->_impl_.show_screensaver_inside_temperature_ = from._impl_.show_screensaver_inside_temperature_; - } - if (from._internal_show_screensaver_outside_temperature() != 0) { - _this->_impl_.show_screensaver_outside_temperature_ = from._impl_.show_screensaver_outside_temperature_; - } - if (from._internal_clock_us_style() != 0) { - _this->_impl_.clock_us_style_ = from._impl_.clock_us_style_; - } - if (from._internal_use_fahrenheit() != 0) { - _this->_impl_.use_fahrenheit_ = from._impl_.use_fahrenheit_; - } - if (from._internal_is_us_panel() != 0) { - _this->_impl_.is_us_panel_ = from._impl_.is_us_panel_; - } - if (from._internal_reverse_relays() != 0) { - _this->_impl_.reverse_relays_ = from._impl_.reverse_relays_; - } - if (from._internal_relay1_default_mode() != 0) { - _this->_impl_.relay1_default_mode_ = from._impl_.relay1_default_mode_; + _this->_internal_mutable_warnings()->MergeFrom( + from._internal_warnings()); + if (!from._internal_mac_address().empty()) { + _this->_internal_set_mac_address(from._internal_mac_address()); } - if (from._internal_relay2_default_mode() != 0) { - _this->_impl_.relay2_default_mode_ = from._impl_.relay2_default_mode_; + if (!from._internal_ip_address().empty()) { + _this->_internal_set_ip_address(from._internal_ip_address()); } - if (from._internal_temperature_calibration() != 0) { - _this->_impl_.temperature_calibration_ = from._impl_.temperature_calibration_; + if (!from._internal_md5_firmware().empty()) { + _this->_internal_set_md5_firmware(from._internal_md5_firmware()); } - if (from._internal_button1_mode() != 0) { - _this->_impl_.button1_mode_ = from._impl_.button1_mode_; + if (!from._internal_md5_littlefs().empty()) { + _this->_internal_set_md5_littlefs(from._internal_md5_littlefs()); } - if (from._internal_button2_mode() != 0) { - _this->_impl_.button2_mode_ = from._impl_.button2_mode_; + if (!from._internal_md5_tft_gui().empty()) { + _this->_internal_set_md5_tft_gui(from._internal_md5_tft_gui()); } - if (from._internal_raise_light_level_to_100_above() != 0) { - _this->_impl_.raise_light_level_to_100_above_ = from._impl_.raise_light_level_to_100_above_; + if (from._internal_nspanel_state() != 0) { + _this->_impl_.nspanel_state_ = from._impl_.nspanel_state_; } - if (from._internal_nspanel_id() != 0) { - _this->_impl_.nspanel_id_ = from._impl_.nspanel_id_; + if (from._internal_update_progress() != 0) { + _this->_impl_.update_progress_ = from._impl_.update_progress_; } - if (from._internal_optimistic_mode() != 0) { - _this->_impl_.optimistic_mode_ = from._impl_.optimistic_mode_; + if (from._internal_rssi() != 0) { + _this->_impl_.rssi_ = from._impl_.rssi_; } - if (from._internal_locked_to_default_room() != 0) { - _this->_impl_.locked_to_default_room_ = from._impl_.locked_to_default_room_; + if (from._internal_heap_used_pct() != 0) { + _this->_impl_.heap_used_pct_ = from._impl_.heap_used_pct_; } - if (from._internal_default_light_brightess() != 0) { - _this->_impl_.default_light_brightess_ = from._impl_.default_light_brightess_; + static_assert(sizeof(::uint32_t) == sizeof(float), + "Code assumes ::uint32_t and float are the same size."); + float tmp_temperature = from._internal_temperature(); + ::uint32_t raw_temperature; + memcpy(&raw_temperature, &tmp_temperature, sizeof(tmp_temperature)); + if (raw_temperature != 0) { + _this->_impl_.temperature_ = from._impl_.temperature_; } - if (from._internal_button1_lower_temperature() != 0) { - _this->_impl_.button1_lower_temperature_ = from._impl_.button1_lower_temperature_; + static_assert(sizeof(::uint32_t) == sizeof(float), + "Code assumes ::uint32_t and float are the same size."); + float tmp_humidity = from._internal_humidity(); + ::uint32_t raw_humidity; + memcpy(&raw_humidity, &tmp_humidity, sizeof(tmp_humidity)); + if (raw_humidity != 0) { + _this->_impl_.humidity_ = from._impl_.humidity_; } - if (from._internal_button1_upper_temperature() != 0) { - _this->_impl_.button1_upper_temperature_ = from._impl_.button1_upper_temperature_; + if (from._internal_has_humidity() != 0) { + _this->_impl_.has_humidity_ = from._impl_.has_humidity_; } - if (from._internal_button2_lower_temperature() != 0) { - _this->_impl_.button2_lower_temperature_ = from._impl_.button2_lower_temperature_; + if (from._internal_has_pressure() != 0) { + _this->_impl_.has_pressure_ = from._impl_.has_pressure_; } - if (from._internal_button2_upper_temperature() != 0) { - _this->_impl_.button2_upper_temperature_ = from._impl_.button2_upper_temperature_; + static_assert(sizeof(::uint32_t) == sizeof(float), + "Code assumes ::uint32_t and float are the same size."); + float tmp_pressure = from._internal_pressure(); + ::uint32_t raw_pressure; + memcpy(&raw_pressure, &tmp_pressure, sizeof(tmp_pressure)); + if (raw_pressure != 0) { + _this->_impl_.pressure_ = from._impl_.pressure_; } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } -void NSPanelConfig::CopyFrom(const NSPanelConfig& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelConfig) +void NSPanelStatusReport::CopyFrom(const NSPanelStatusReport& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelStatusReport) if (&from == this) return; Clear(); MergeFrom(from); } -void NSPanelConfig::InternalSwap(NSPanelConfig* PROTOBUF_RESTRICT other) { +void NSPanelStatusReport::InternalSwap(NSPanelStatusReport* PROTOBUF_RESTRICT other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); - _impl_.room_infos_.InternalSwap(&other->_impl_.room_infos_); - _impl_.global_scene_entity_page_ids_.InternalSwap(&other->_impl_.global_scene_entity_page_ids_); - _impl_.relay1_relay_group_.InternalSwap(&other->_impl_.relay1_relay_group_); - _impl_.relay2_relay_group_.InternalSwap(&other->_impl_.relay2_relay_group_); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.inside_temperature_sensor_mqtt_topic_, &other->_impl_.inside_temperature_sensor_mqtt_topic_, arena); + _impl_.warnings_.InternalSwap(&other->_impl_.warnings_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.mac_address_, &other->_impl_.mac_address_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.ip_address_, &other->_impl_.ip_address_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.md5_firmware_, &other->_impl_.md5_firmware_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.md5_littlefs_, &other->_impl_.md5_littlefs_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.md5_tft_gui_, &other->_impl_.md5_tft_gui_, arena); ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.button2_upper_temperature_) - + sizeof(NSPanelConfig::_impl_.button2_upper_temperature_) - - PROTOBUF_FIELD_OFFSET(NSPanelConfig, _impl_.default_room_)>( - reinterpret_cast(&_impl_.default_room_), - reinterpret_cast(&other->_impl_.default_room_)); + PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.pressure_) + + sizeof(NSPanelStatusReport::_impl_.pressure_) + - PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.nspanel_state_)>( + reinterpret_cast(&_impl_.nspanel_state_), + reinterpret_cast(&other->_impl_.nspanel_state_)); } -::google::protobuf::Metadata NSPanelConfig::GetMetadata() const { +::google::protobuf::Metadata NSPanelStatusReport::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } // =================================================================== -class NSPanelWarning::_Internal { +class NSPanelRoomEntitiesPage_EntitySlot::_Internal { public: }; -NSPanelWarning::NSPanelWarning(::google::protobuf::Arena* arena) +NSPanelRoomEntitiesPage_EntitySlot::NSPanelRoomEntitiesPage_EntitySlot(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelWarning) + // @@protoc_insertion_point(arena_constructor:NSPanelRoomEntitiesPage.EntitySlot) } -inline PROTOBUF_NDEBUG_INLINE NSPanelWarning::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelRoomEntitiesPage_EntitySlot::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::NSPanelWarning& from_msg) - : text_(arena, from.text_), + const Impl_& from, const ::NSPanelRoomEntitiesPage_EntitySlot& from_msg) + : name_(arena, from.name_), + icon_(arena, from.icon_), + mqtt_state_topic_(arena, from.mqtt_state_topic_), _cached_size_{0} {} -NSPanelWarning::NSPanelWarning( +NSPanelRoomEntitiesPage_EntitySlot::NSPanelRoomEntitiesPage_EntitySlot( ::google::protobuf::Arena* arena, - const NSPanelWarning& from) + const NSPanelRoomEntitiesPage_EntitySlot& from) : ::google::protobuf::Message(arena) { - NSPanelWarning* const _this = this; + NSPanelRoomEntitiesPage_EntitySlot* const _this = this; (void)_this; _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_.level_ = from._impl_.level_; + ::memcpy(reinterpret_cast(&_impl_) + + offsetof(Impl_, room_view_position_), + reinterpret_cast(&from._impl_) + + offsetof(Impl_, room_view_position_), + offsetof(Impl_, id_) - + offsetof(Impl_, room_view_position_) + + sizeof(Impl_::id_)); - // @@protoc_insertion_point(copy_constructor:NSPanelWarning) + // @@protoc_insertion_point(copy_constructor:NSPanelRoomEntitiesPage.EntitySlot) } -inline PROTOBUF_NDEBUG_INLINE NSPanelWarning::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelRoomEntitiesPage_EntitySlot::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : text_(arena), + : name_(arena), + icon_(arena), + mqtt_state_topic_(arena), _cached_size_{0} {} -inline void NSPanelWarning::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelRoomEntitiesPage_EntitySlot::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.level_ = {}; + ::memset(reinterpret_cast(&_impl_) + + offsetof(Impl_, room_view_position_), + 0, + offsetof(Impl_, id_) - + offsetof(Impl_, room_view_position_) + + sizeof(Impl_::id_)); } -NSPanelWarning::~NSPanelWarning() { - // @@protoc_insertion_point(destructor:NSPanelWarning) +NSPanelRoomEntitiesPage_EntitySlot::~NSPanelRoomEntitiesPage_EntitySlot() { + // @@protoc_insertion_point(destructor:NSPanelRoomEntitiesPage.EntitySlot) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelWarning::SharedDtor() { +inline void NSPanelRoomEntitiesPage_EntitySlot::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); - _impl_.text_.Destroy(); + _impl_.name_.Destroy(); + _impl_.icon_.Destroy(); + _impl_.mqtt_state_topic_.Destroy(); _impl_.~Impl_(); } const ::google::protobuf::MessageLite::ClassData* -NSPanelWarning::GetClassData() const { +NSPanelRoomEntitiesPage_EntitySlot::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelWarning, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_._cached_size_), false, }, - &NSPanelWarning::MergeImpl, - &NSPanelWarning::kDescriptorMethods, + &NSPanelRoomEntitiesPage_EntitySlot::MergeImpl, + &NSPanelRoomEntitiesPage_EntitySlot::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_2eproto, nullptr, // tracker }; @@ -2468,80 +3906,186 @@ NSPanelWarning::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<1, 2, 0, 27, 2> NSPanelWarning::_table_ = { +const ::_pbi::TcParseTable<4, 9, 0, 75, 2> NSPanelRoomEntitiesPage_EntitySlot::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 2, 8, // max_field_number, fast_idx_mask + 9, 120, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967292, // skipmap + 4294966784, // skipmap offsetof(decltype(_table_), field_entries), - 2, // num_field_entries + 9, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - &_NSPanelWarning_default_instance_._instance, + &_NSPanelRoomEntitiesPage_EntitySlot_default_instance_._instance, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelWarning>(), // to_prefetch + ::_pbi::TcParser::GetTable<::NSPanelRoomEntitiesPage_EntitySlot>(), // to_prefetch #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ - // string text = 2; + {::_pbi::TcParser::MiniParse, {}}, + // int32 room_view_position = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomEntitiesPage_EntitySlot, _impl_.room_view_position_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.room_view_position_)}}, + // string name = 2; {::_pbi::TcParser::FastUS1, - {18, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWarning, _impl_.text_)}}, - // .NSPanelWarningLevel level = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelWarning, _impl_.level_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWarning, _impl_.level_)}}, + {18, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.name_)}}, + // string icon = 3; + {::_pbi::TcParser::FastUS1, + {26, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.icon_)}}, + // int32 pco = 4; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomEntitiesPage_EntitySlot, _impl_.pco_), 63>(), + {32, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.pco_)}}, + // int32 pco2 = 5; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomEntitiesPage_EntitySlot, _impl_.pco2_), 63>(), + {40, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.pco2_)}}, + // bool can_save_scene = 6; + {::_pbi::TcParser::SingularVarintNoZag1(), + {48, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.can_save_scene_)}}, + // string mqtt_state_topic = 7; + {::_pbi::TcParser::FastUS1, + {58, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.mqtt_state_topic_)}}, + // .NSPanelRoomEntitiesPage.EntitySlot.EntityType type = 8; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomEntitiesPage_EntitySlot, _impl_.type_), 63>(), + {64, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.type_)}}, + // int32 id = 9; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomEntitiesPage_EntitySlot, _impl_.id_), 63>(), + {72, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.id_)}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, }}, {{ 65535, 65535 }}, {{ - // .NSPanelWarningLevel level = 1; - {PROTOBUF_FIELD_OFFSET(NSPanelWarning, _impl_.level_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, - // string text = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelWarning, _impl_.text_), 0, 0, + // int32 room_view_position = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.room_view_position_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // string name = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.name_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // string icon = 3; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.icon_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // int32 pco = 4; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.pco_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 pco2 = 5; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.pco2_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // bool can_save_scene = 6; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.can_save_scene_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // string mqtt_state_topic = 7; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.mqtt_state_topic_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // .NSPanelRoomEntitiesPage.EntitySlot.EntityType type = 8; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.type_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + // int32 id = 9; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.id_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, }}, // no aux_entries {{ - "\16\0\4\0\0\0\0\0" - "NSPanelWarning" - "text" + "\42\0\4\4\0\0\0\20\0\0\0\0\0\0\0\0" + "NSPanelRoomEntitiesPage.EntitySlot" + "name" + "icon" + "mqtt_state_topic" }}, }; -PROTOBUF_NOINLINE void NSPanelWarning::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelWarning) +PROTOBUF_NOINLINE void NSPanelRoomEntitiesPage_EntitySlot::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelRoomEntitiesPage.EntitySlot) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.text_.ClearToEmpty(); - _impl_.level_ = 0; + _impl_.name_.ClearToEmpty(); + _impl_.icon_.ClearToEmpty(); + _impl_.mqtt_state_topic_.ClearToEmpty(); + ::memset(&_impl_.room_view_position_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.id_) - + reinterpret_cast(&_impl_.room_view_position_)) + sizeof(_impl_.id_)); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::uint8_t* NSPanelWarning::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelWarning) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; +::uint8_t* NSPanelRoomEntitiesPage_EntitySlot::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:NSPanelRoomEntitiesPage.EntitySlot) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + // int32 room_view_position = 1; + if (this->_internal_room_view_position() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<1>( + stream, this->_internal_room_view_position(), target); + } + + // string name = 2; + if (!this->_internal_name().empty()) { + const std::string& _s = this->_internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelRoomEntitiesPage.EntitySlot.name"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } + + // string icon = 3; + if (!this->_internal_icon().empty()) { + const std::string& _s = this->_internal_icon(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelRoomEntitiesPage.EntitySlot.icon"); + target = stream->WriteStringMaybeAliased(3, _s, target); + } + + // int32 pco = 4; + if (this->_internal_pco() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<4>( + stream, this->_internal_pco(), target); + } + + // int32 pco2 = 5; + if (this->_internal_pco2() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<5>( + stream, this->_internal_pco2(), target); + } + + // bool can_save_scene = 6; + if (this->_internal_can_save_scene() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 6, this->_internal_can_save_scene(), target); + } - // .NSPanelWarningLevel level = 1; - if (this->_internal_level() != 0) { + // string mqtt_state_topic = 7; + if (!this->_internal_mqtt_state_topic().empty()) { + const std::string& _s = this->_internal_mqtt_state_topic(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelRoomEntitiesPage.EntitySlot.mqtt_state_topic"); + target = stream->WriteStringMaybeAliased(7, _s, target); + } + + // .NSPanelRoomEntitiesPage.EntitySlot.EntityType type = 8; + if (this->_internal_type() != 0) { target = stream->EnsureSpace(target); target = ::_pbi::WireFormatLite::WriteEnumToArray( - 1, this->_internal_level(), target); + 8, this->_internal_type(), target); } - // string text = 2; - if (!this->_internal_text().empty()) { - const std::string& _s = this->_internal_text(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWarning.text"); - target = stream->WriteStringMaybeAliased(2, _s, target); + // int32 id = 9; + if (this->_internal_id() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<9>( + stream, this->_internal_id(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -2549,12 +4093,12 @@ ::uint8_t* NSPanelWarning::_InternalSerialize( ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelWarning) + // @@protoc_insertion_point(serialize_to_array_end:NSPanelRoomEntitiesPage.EntitySlot) return target; } -::size_t NSPanelWarning::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelWarning) +::size_t NSPanelRoomEntitiesPage_EntitySlot::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelRoomEntitiesPage.EntitySlot) ::size_t total_size = 0; ::uint32_t cached_has_bits = 0; @@ -2562,148 +4106,205 @@ ::size_t NSPanelWarning::ByteSizeLong() const { (void) cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); - // string text = 2; - if (!this->_internal_text().empty()) { + // string name = 2; + if (!this->_internal_name().empty()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_text()); + this->_internal_name()); } - // .NSPanelWarningLevel level = 1; - if (this->_internal_level() != 0) { + // string icon = 3; + if (!this->_internal_icon().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_icon()); + } + + // string mqtt_state_topic = 7; + if (!this->_internal_mqtt_state_topic().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_mqtt_state_topic()); + } + + // int32 room_view_position = 1; + if (this->_internal_room_view_position() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_room_view_position()); + } + + // int32 pco = 4; + if (this->_internal_pco() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_pco()); + } + + // int32 pco2 = 5; + if (this->_internal_pco2() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_pco2()); + } + + // bool can_save_scene = 6; + if (this->_internal_can_save_scene() != 0) { + total_size += 2; + } + + // .NSPanelRoomEntitiesPage.EntitySlot.EntityType type = 8; + if (this->_internal_type() != 0) { total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this->_internal_level()); + ::_pbi::WireFormatLite::EnumSize(this->_internal_type()); + } + + // int32 id = 9; + if (this->_internal_id() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_id()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -void NSPanelWarning::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelWarning) +void NSPanelRoomEntitiesPage_EntitySlot::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelRoomEntitiesPage.EntitySlot) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (!from._internal_text().empty()) { - _this->_internal_set_text(from._internal_text()); + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); } - if (from._internal_level() != 0) { - _this->_impl_.level_ = from._impl_.level_; + if (!from._internal_icon().empty()) { + _this->_internal_set_icon(from._internal_icon()); + } + if (!from._internal_mqtt_state_topic().empty()) { + _this->_internal_set_mqtt_state_topic(from._internal_mqtt_state_topic()); + } + if (from._internal_room_view_position() != 0) { + _this->_impl_.room_view_position_ = from._impl_.room_view_position_; + } + if (from._internal_pco() != 0) { + _this->_impl_.pco_ = from._impl_.pco_; + } + if (from._internal_pco2() != 0) { + _this->_impl_.pco2_ = from._impl_.pco2_; + } + if (from._internal_can_save_scene() != 0) { + _this->_impl_.can_save_scene_ = from._impl_.can_save_scene_; + } + if (from._internal_type() != 0) { + _this->_impl_.type_ = from._impl_.type_; + } + if (from._internal_id() != 0) { + _this->_impl_.id_ = from._impl_.id_; } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } -void NSPanelWarning::CopyFrom(const NSPanelWarning& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelWarning) +void NSPanelRoomEntitiesPage_EntitySlot::CopyFrom(const NSPanelRoomEntitiesPage_EntitySlot& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelRoomEntitiesPage.EntitySlot) if (&from == this) return; Clear(); MergeFrom(from); } -void NSPanelWarning::InternalSwap(NSPanelWarning* PROTOBUF_RESTRICT other) { +void NSPanelRoomEntitiesPage_EntitySlot::InternalSwap(NSPanelRoomEntitiesPage_EntitySlot* PROTOBUF_RESTRICT other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.text_, &other->_impl_.text_, arena); - swap(_impl_.level_, other->_impl_.level_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.icon_, &other->_impl_.icon_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.mqtt_state_topic_, &other->_impl_.mqtt_state_topic_, arena); + ::google::protobuf::internal::memswap< + PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.id_) + + sizeof(NSPanelRoomEntitiesPage_EntitySlot::_impl_.id_) + - PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.room_view_position_)>( + reinterpret_cast(&_impl_.room_view_position_), + reinterpret_cast(&other->_impl_.room_view_position_)); } -::google::protobuf::Metadata NSPanelWarning::GetMetadata() const { +::google::protobuf::Metadata NSPanelRoomEntitiesPage_EntitySlot::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } // =================================================================== -class NSPanelStatusReport::_Internal { +class NSPanelRoomEntitiesPage::_Internal { public: }; -NSPanelStatusReport::NSPanelStatusReport(::google::protobuf::Arena* arena) +NSPanelRoomEntitiesPage::NSPanelRoomEntitiesPage(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelStatusReport) + // @@protoc_insertion_point(arena_constructor:NSPanelRoomEntitiesPage) } -inline PROTOBUF_NDEBUG_INLINE NSPanelStatusReport::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelRoomEntitiesPage::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::NSPanelStatusReport& from_msg) - : warnings_{visibility, arena, from.warnings_}, - mac_address_(arena, from.mac_address_), - ip_address_(arena, from.ip_address_), - md5_firmware_(arena, from.md5_firmware_), - md5_littlefs_(arena, from.md5_littlefs_), - md5_tft_gui_(arena, from.md5_tft_gui_), + const Impl_& from, const ::NSPanelRoomEntitiesPage& from_msg) + : entities_{visibility, arena, from.entities_}, + header_text_(arena, from.header_text_), _cached_size_{0} {} -NSPanelStatusReport::NSPanelStatusReport( +NSPanelRoomEntitiesPage::NSPanelRoomEntitiesPage( ::google::protobuf::Arena* arena, - const NSPanelStatusReport& from) + const NSPanelRoomEntitiesPage& from) : ::google::protobuf::Message(arena) { - NSPanelStatusReport* const _this = this; + NSPanelRoomEntitiesPage* const _this = this; (void)_this; _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::memcpy(reinterpret_cast(&_impl_) + - offsetof(Impl_, nspanel_state_), + offsetof(Impl_, id_), reinterpret_cast(&from._impl_) + - offsetof(Impl_, nspanel_state_), - offsetof(Impl_, pressure_) - - offsetof(Impl_, nspanel_state_) + - sizeof(Impl_::pressure_)); + offsetof(Impl_, id_), + offsetof(Impl_, page_type_) - + offsetof(Impl_, id_) + + sizeof(Impl_::page_type_)); - // @@protoc_insertion_point(copy_constructor:NSPanelStatusReport) + // @@protoc_insertion_point(copy_constructor:NSPanelRoomEntitiesPage) } -inline PROTOBUF_NDEBUG_INLINE NSPanelStatusReport::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelRoomEntitiesPage::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : warnings_{visibility, arena}, - mac_address_(arena), - ip_address_(arena), - md5_firmware_(arena), - md5_littlefs_(arena), - md5_tft_gui_(arena), + : entities_{visibility, arena}, + header_text_(arena), _cached_size_{0} {} -inline void NSPanelStatusReport::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelRoomEntitiesPage::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, nspanel_state_), + offsetof(Impl_, id_), 0, - offsetof(Impl_, pressure_) - - offsetof(Impl_, nspanel_state_) + - sizeof(Impl_::pressure_)); + offsetof(Impl_, page_type_) - + offsetof(Impl_, id_) + + sizeof(Impl_::page_type_)); } -NSPanelStatusReport::~NSPanelStatusReport() { - // @@protoc_insertion_point(destructor:NSPanelStatusReport) +NSPanelRoomEntitiesPage::~NSPanelRoomEntitiesPage() { + // @@protoc_insertion_point(destructor:NSPanelRoomEntitiesPage) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelStatusReport::SharedDtor() { +inline void NSPanelRoomEntitiesPage::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); - _impl_.mac_address_.Destroy(); - _impl_.ip_address_.Destroy(); - _impl_.md5_firmware_.Destroy(); - _impl_.md5_littlefs_.Destroy(); - _impl_.md5_tft_gui_.Destroy(); + _impl_.header_text_.Destroy(); _impl_.~Impl_(); } const ::google::protobuf::MessageLite::ClassData* -NSPanelStatusReport::GetClassData() const { +NSPanelRoomEntitiesPage::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_._cached_size_), false, }, - &NSPanelStatusReport::MergeImpl, - &NSPanelStatusReport::kDescriptorMethods, + &NSPanelRoomEntitiesPage::MergeImpl, + &NSPanelRoomEntitiesPage::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_2eproto, nullptr, // tracker }; @@ -2712,284 +4313,113 @@ NSPanelStatusReport::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<4, 15, 1, 92, 2> NSPanelStatusReport::_table_ = { +const ::_pbi::TcParseTable<2, 4, 1, 43, 2> NSPanelRoomEntitiesPage::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 15, 120, // max_field_number, fast_idx_mask + 4, 24, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294934528, // skipmap + 4294967280, // skipmap offsetof(decltype(_table_), field_entries), - 15, // num_field_entries - 1, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - &_NSPanelStatusReport_default_instance_._instance, - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelStatusReport>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - {::_pbi::TcParser::MiniParse, {}}, - // .NSPanelStatusReport.state nspanel_state = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelStatusReport, _impl_.nspanel_state_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.nspanel_state_)}}, - // int32 update_progress = 2; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelStatusReport, _impl_.update_progress_), 63>(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.update_progress_)}}, - // int32 rssi = 3; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelStatusReport, _impl_.rssi_), 63>(), - {24, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.rssi_)}}, - // int32 heap_used_pct = 4; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelStatusReport, _impl_.heap_used_pct_), 63>(), - {32, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.heap_used_pct_)}}, - // string mac_address = 5; - {::_pbi::TcParser::FastUS1, - {42, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.mac_address_)}}, - // float temperature = 6; - {::_pbi::TcParser::FastF32S1, - {53, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.temperature_)}}, - // string ip_address = 7; - {::_pbi::TcParser::FastUS1, - {58, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.ip_address_)}}, - // repeated .NSPanelWarning warnings = 8; + 4, // num_field_entries + 1, // num_aux_entries + offsetof(decltype(_table_), aux_entries), + &_NSPanelRoomEntitiesPage_default_instance_._instance, + nullptr, // post_loop_handler + ::_pbi::TcParser::GenericFallback, // fallback + #ifdef PROTOBUF_PREFETCH_PARSE_TABLE + ::_pbi::TcParser::GetTable<::NSPanelRoomEntitiesPage>(), // to_prefetch + #endif // PROTOBUF_PREFETCH_PARSE_TABLE + }, {{ + // repeated .NSPanelRoomEntitiesPage.EntitySlot entities = 4; {::_pbi::TcParser::FastMtR1, - {66, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.warnings_)}}, - // string md5_firmware = 9; - {::_pbi::TcParser::FastUS1, - {74, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.md5_firmware_)}}, - // string md5_littlefs = 10; - {::_pbi::TcParser::FastUS1, - {82, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.md5_littlefs_)}}, - // string md5_tft_gui = 11; + {34, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.entities_)}}, + // int32 id = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomEntitiesPage, _impl_.id_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.id_)}}, + // int32 page_type = 2; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomEntitiesPage, _impl_.page_type_), 63>(), + {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.page_type_)}}, + // string header_text = 3; {::_pbi::TcParser::FastUS1, - {90, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.md5_tft_gui_)}}, - // bool has_humidity = 12; - {::_pbi::TcParser::SingularVarintNoZag1(), - {96, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.has_humidity_)}}, - // float humidity = 13; - {::_pbi::TcParser::FastF32S1, - {109, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.humidity_)}}, - // bool has_pressure = 14; - {::_pbi::TcParser::SingularVarintNoZag1(), - {112, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.has_pressure_)}}, - // float pressure = 15; - {::_pbi::TcParser::FastF32S1, - {125, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.pressure_)}}, + {26, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.header_text_)}}, }}, {{ 65535, 65535 }}, {{ - // .NSPanelStatusReport.state nspanel_state = 1; - {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.nspanel_state_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, - // int32 update_progress = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.update_progress_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 rssi = 3; - {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.rssi_), 0, 0, + // int32 id = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.id_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 heap_used_pct = 4; - {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.heap_used_pct_), 0, 0, + // int32 page_type = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.page_type_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // string mac_address = 5; - {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.mac_address_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // float temperature = 6; - {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.temperature_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kFloat)}, - // string ip_address = 7; - {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.ip_address_), 0, 0, + // string header_text = 3; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.header_text_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // repeated .NSPanelWarning warnings = 8; - {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.warnings_), 0, 0, + // repeated .NSPanelRoomEntitiesPage.EntitySlot entities = 4; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.entities_), 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - // string md5_firmware = 9; - {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.md5_firmware_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // string md5_littlefs = 10; - {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.md5_littlefs_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // string md5_tft_gui = 11; - {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.md5_tft_gui_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // bool has_humidity = 12; - {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.has_humidity_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // float humidity = 13; - {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.humidity_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kFloat)}, - // bool has_pressure = 14; - {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.has_pressure_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // float pressure = 15; - {PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.pressure_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kFloat)}, }}, {{ - {::_pbi::TcParser::GetTable<::NSPanelWarning>()}, + {::_pbi::TcParser::GetTable<::NSPanelRoomEntitiesPage_EntitySlot>()}, }}, {{ - "\23\0\0\0\0\13\0\12\0\14\14\13\0\0\0\0" - "NSPanelStatusReport" - "mac_address" - "ip_address" - "md5_firmware" - "md5_littlefs" - "md5_tft_gui" + "\27\0\0\13\0\0\0\0" + "NSPanelRoomEntitiesPage" + "header_text" }}, }; -PROTOBUF_NOINLINE void NSPanelStatusReport::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelStatusReport) +PROTOBUF_NOINLINE void NSPanelRoomEntitiesPage::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelRoomEntitiesPage) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.warnings_.Clear(); - _impl_.mac_address_.ClearToEmpty(); - _impl_.ip_address_.ClearToEmpty(); - _impl_.md5_firmware_.ClearToEmpty(); - _impl_.md5_littlefs_.ClearToEmpty(); - _impl_.md5_tft_gui_.ClearToEmpty(); - ::memset(&_impl_.nspanel_state_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.pressure_) - - reinterpret_cast(&_impl_.nspanel_state_)) + sizeof(_impl_.pressure_)); + _impl_.entities_.Clear(); + _impl_.header_text_.ClearToEmpty(); + ::memset(&_impl_.id_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.page_type_) - + reinterpret_cast(&_impl_.id_)) + sizeof(_impl_.page_type_)); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::uint8_t* NSPanelStatusReport::_InternalSerialize( +::uint8_t* NSPanelRoomEntitiesPage::_InternalSerialize( ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelStatusReport) + // @@protoc_insertion_point(serialize_to_array_start:NSPanelRoomEntitiesPage) ::uint32_t cached_has_bits = 0; (void)cached_has_bits; - // .NSPanelStatusReport.state nspanel_state = 1; - if (this->_internal_nspanel_state() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 1, this->_internal_nspanel_state(), target); - } - - // int32 update_progress = 2; - if (this->_internal_update_progress() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this->_internal_update_progress(), target); - } - - // int32 rssi = 3; - if (this->_internal_rssi() != 0) { + // int32 id = 1; + if (this->_internal_id() != 0) { target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<3>( - stream, this->_internal_rssi(), target); + WriteInt32ToArrayWithField<1>( + stream, this->_internal_id(), target); } - // int32 heap_used_pct = 4; - if (this->_internal_heap_used_pct() != 0) { + // int32 page_type = 2; + if (this->_internal_page_type() != 0) { target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<4>( - stream, this->_internal_heap_used_pct(), target); - } - - // string mac_address = 5; - if (!this->_internal_mac_address().empty()) { - const std::string& _s = this->_internal_mac_address(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelStatusReport.mac_address"); - target = stream->WriteStringMaybeAliased(5, _s, target); - } - - // float temperature = 6; - static_assert(sizeof(::uint32_t) == sizeof(float), - "Code assumes ::uint32_t and float are the same size."); - float tmp_temperature = this->_internal_temperature(); - ::uint32_t raw_temperature; - memcpy(&raw_temperature, &tmp_temperature, sizeof(tmp_temperature)); - if (raw_temperature != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFloatToArray( - 6, this->_internal_temperature(), target); - } - - // string ip_address = 7; - if (!this->_internal_ip_address().empty()) { - const std::string& _s = this->_internal_ip_address(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelStatusReport.ip_address"); - target = stream->WriteStringMaybeAliased(7, _s, target); - } - - // repeated .NSPanelWarning warnings = 8; - for (unsigned i = 0, n = static_cast( - this->_internal_warnings_size()); - i < n; i++) { - const auto& repfield = this->_internal_warnings().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 8, repfield, repfield.GetCachedSize(), - target, stream); - } - - // string md5_firmware = 9; - if (!this->_internal_md5_firmware().empty()) { - const std::string& _s = this->_internal_md5_firmware(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelStatusReport.md5_firmware"); - target = stream->WriteStringMaybeAliased(9, _s, target); - } - - // string md5_littlefs = 10; - if (!this->_internal_md5_littlefs().empty()) { - const std::string& _s = this->_internal_md5_littlefs(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelStatusReport.md5_littlefs"); - target = stream->WriteStringMaybeAliased(10, _s, target); + WriteInt32ToArrayWithField<2>( + stream, this->_internal_page_type(), target); } - // string md5_tft_gui = 11; - if (!this->_internal_md5_tft_gui().empty()) { - const std::string& _s = this->_internal_md5_tft_gui(); + // string header_text = 3; + if (!this->_internal_header_text().empty()) { + const std::string& _s = this->_internal_header_text(); ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelStatusReport.md5_tft_gui"); - target = stream->WriteStringMaybeAliased(11, _s, target); - } - - // bool has_humidity = 12; - if (this->_internal_has_humidity() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 12, this->_internal_has_humidity(), target); - } - - // float humidity = 13; - static_assert(sizeof(::uint32_t) == sizeof(float), - "Code assumes ::uint32_t and float are the same size."); - float tmp_humidity = this->_internal_humidity(); - ::uint32_t raw_humidity; - memcpy(&raw_humidity, &tmp_humidity, sizeof(tmp_humidity)); - if (raw_humidity != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFloatToArray( - 13, this->_internal_humidity(), target); - } - - // bool has_pressure = 14; - if (this->_internal_has_pressure() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 14, this->_internal_has_pressure(), target); - } - - // float pressure = 15; - static_assert(sizeof(::uint32_t) == sizeof(float), - "Code assumes ::uint32_t and float are the same size."); - float tmp_pressure = this->_internal_pressure(); - ::uint32_t raw_pressure; - memcpy(&raw_pressure, &tmp_pressure, sizeof(tmp_pressure)); - if (raw_pressure != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFloatToArray( - 15, this->_internal_pressure(), target); + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelRoomEntitiesPage.header_text"); + target = stream->WriteStringMaybeAliased(3, _s, target); + } + + // repeated .NSPanelRoomEntitiesPage.EntitySlot entities = 4; + for (unsigned i = 0, n = static_cast( + this->_internal_entities_size()); + i < n; i++) { + const auto& repfield = this->_internal_entities().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 4, repfield, repfield.GetCachedSize(), + target, stream); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -2997,12 +4427,12 @@ ::uint8_t* NSPanelStatusReport::_InternalSerialize( ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelStatusReport) + // @@protoc_insertion_point(serialize_to_array_end:NSPanelRoomEntitiesPage) return target; } -::size_t NSPanelStatusReport::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelStatusReport) +::size_t NSPanelRoomEntitiesPage::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelRoomEntitiesPage) ::size_t total_size = 0; ::uint32_t cached_has_bits = 0; @@ -3010,290 +4440,160 @@ ::size_t NSPanelStatusReport::ByteSizeLong() const { (void) cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); - // repeated .NSPanelWarning warnings = 8; - total_size += 1UL * this->_internal_warnings_size(); - for (const auto& msg : this->_internal_warnings()) { + // repeated .NSPanelRoomEntitiesPage.EntitySlot entities = 4; + total_size += 1UL * this->_internal_entities_size(); + for (const auto& msg : this->_internal_entities()) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // string mac_address = 5; - if (!this->_internal_mac_address().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_mac_address()); - } - - // string ip_address = 7; - if (!this->_internal_ip_address().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_ip_address()); - } - - // string md5_firmware = 9; - if (!this->_internal_md5_firmware().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_md5_firmware()); - } - - // string md5_littlefs = 10; - if (!this->_internal_md5_littlefs().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_md5_littlefs()); - } - - // string md5_tft_gui = 11; - if (!this->_internal_md5_tft_gui().empty()) { + // string header_text = 3; + if (!this->_internal_header_text().empty()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_md5_tft_gui()); - } - - // .NSPanelStatusReport.state nspanel_state = 1; - if (this->_internal_nspanel_state() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this->_internal_nspanel_state()); - } - - // int32 update_progress = 2; - if (this->_internal_update_progress() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_update_progress()); + this->_internal_header_text()); } - // int32 rssi = 3; - if (this->_internal_rssi() != 0) { + // int32 id = 1; + if (this->_internal_id() != 0) { total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_rssi()); + this->_internal_id()); } - // int32 heap_used_pct = 4; - if (this->_internal_heap_used_pct() != 0) { + // int32 page_type = 2; + if (this->_internal_page_type() != 0) { total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_heap_used_pct()); - } - - // float temperature = 6; - static_assert(sizeof(::uint32_t) == sizeof(float), - "Code assumes ::uint32_t and float are the same size."); - float tmp_temperature = this->_internal_temperature(); - ::uint32_t raw_temperature; - memcpy(&raw_temperature, &tmp_temperature, sizeof(tmp_temperature)); - if (raw_temperature != 0) { - total_size += 5; - } - - // float humidity = 13; - static_assert(sizeof(::uint32_t) == sizeof(float), - "Code assumes ::uint32_t and float are the same size."); - float tmp_humidity = this->_internal_humidity(); - ::uint32_t raw_humidity; - memcpy(&raw_humidity, &tmp_humidity, sizeof(tmp_humidity)); - if (raw_humidity != 0) { - total_size += 5; - } - - // bool has_humidity = 12; - if (this->_internal_has_humidity() != 0) { - total_size += 2; - } - - // bool has_pressure = 14; - if (this->_internal_has_pressure() != 0) { - total_size += 2; - } - - // float pressure = 15; - static_assert(sizeof(::uint32_t) == sizeof(float), - "Code assumes ::uint32_t and float are the same size."); - float tmp_pressure = this->_internal_pressure(); - ::uint32_t raw_pressure; - memcpy(&raw_pressure, &tmp_pressure, sizeof(tmp_pressure)); - if (raw_pressure != 0) { - total_size += 5; + this->_internal_page_type()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -void NSPanelStatusReport::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelStatusReport) +void NSPanelRoomEntitiesPage::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelRoomEntitiesPage) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - _this->_internal_mutable_warnings()->MergeFrom( - from._internal_warnings()); - if (!from._internal_mac_address().empty()) { - _this->_internal_set_mac_address(from._internal_mac_address()); - } - if (!from._internal_ip_address().empty()) { - _this->_internal_set_ip_address(from._internal_ip_address()); - } - if (!from._internal_md5_firmware().empty()) { - _this->_internal_set_md5_firmware(from._internal_md5_firmware()); - } - if (!from._internal_md5_littlefs().empty()) { - _this->_internal_set_md5_littlefs(from._internal_md5_littlefs()); - } - if (!from._internal_md5_tft_gui().empty()) { - _this->_internal_set_md5_tft_gui(from._internal_md5_tft_gui()); - } - if (from._internal_nspanel_state() != 0) { - _this->_impl_.nspanel_state_ = from._impl_.nspanel_state_; - } - if (from._internal_update_progress() != 0) { - _this->_impl_.update_progress_ = from._impl_.update_progress_; - } - if (from._internal_rssi() != 0) { - _this->_impl_.rssi_ = from._impl_.rssi_; - } - if (from._internal_heap_used_pct() != 0) { - _this->_impl_.heap_used_pct_ = from._impl_.heap_used_pct_; - } - static_assert(sizeof(::uint32_t) == sizeof(float), - "Code assumes ::uint32_t and float are the same size."); - float tmp_temperature = from._internal_temperature(); - ::uint32_t raw_temperature; - memcpy(&raw_temperature, &tmp_temperature, sizeof(tmp_temperature)); - if (raw_temperature != 0) { - _this->_impl_.temperature_ = from._impl_.temperature_; - } - static_assert(sizeof(::uint32_t) == sizeof(float), - "Code assumes ::uint32_t and float are the same size."); - float tmp_humidity = from._internal_humidity(); - ::uint32_t raw_humidity; - memcpy(&raw_humidity, &tmp_humidity, sizeof(tmp_humidity)); - if (raw_humidity != 0) { - _this->_impl_.humidity_ = from._impl_.humidity_; - } - if (from._internal_has_humidity() != 0) { - _this->_impl_.has_humidity_ = from._impl_.has_humidity_; + _this->_internal_mutable_entities()->MergeFrom( + from._internal_entities()); + if (!from._internal_header_text().empty()) { + _this->_internal_set_header_text(from._internal_header_text()); } - if (from._internal_has_pressure() != 0) { - _this->_impl_.has_pressure_ = from._impl_.has_pressure_; + if (from._internal_id() != 0) { + _this->_impl_.id_ = from._impl_.id_; } - static_assert(sizeof(::uint32_t) == sizeof(float), - "Code assumes ::uint32_t and float are the same size."); - float tmp_pressure = from._internal_pressure(); - ::uint32_t raw_pressure; - memcpy(&raw_pressure, &tmp_pressure, sizeof(tmp_pressure)); - if (raw_pressure != 0) { - _this->_impl_.pressure_ = from._impl_.pressure_; + if (from._internal_page_type() != 0) { + _this->_impl_.page_type_ = from._impl_.page_type_; } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } -void NSPanelStatusReport::CopyFrom(const NSPanelStatusReport& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelStatusReport) +void NSPanelRoomEntitiesPage::CopyFrom(const NSPanelRoomEntitiesPage& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelRoomEntitiesPage) if (&from == this) return; Clear(); MergeFrom(from); } -void NSPanelStatusReport::InternalSwap(NSPanelStatusReport* PROTOBUF_RESTRICT other) { +void NSPanelRoomEntitiesPage::InternalSwap(NSPanelRoomEntitiesPage* PROTOBUF_RESTRICT other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); - _impl_.warnings_.InternalSwap(&other->_impl_.warnings_); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.mac_address_, &other->_impl_.mac_address_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.ip_address_, &other->_impl_.ip_address_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.md5_firmware_, &other->_impl_.md5_firmware_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.md5_littlefs_, &other->_impl_.md5_littlefs_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.md5_tft_gui_, &other->_impl_.md5_tft_gui_, arena); + _impl_.entities_.InternalSwap(&other->_impl_.entities_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.header_text_, &other->_impl_.header_text_, arena); ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.pressure_) - + sizeof(NSPanelStatusReport::_impl_.pressure_) - - PROTOBUF_FIELD_OFFSET(NSPanelStatusReport, _impl_.nspanel_state_)>( - reinterpret_cast(&_impl_.nspanel_state_), - reinterpret_cast(&other->_impl_.nspanel_state_)); + PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.page_type_) + + sizeof(NSPanelRoomEntitiesPage::_impl_.page_type_) + - PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.id_)>( + reinterpret_cast(&_impl_.id_), + reinterpret_cast(&other->_impl_.id_)); } -::google::protobuf::Metadata NSPanelStatusReport::GetMetadata() const { +::google::protobuf::Metadata NSPanelRoomEntitiesPage::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } // =================================================================== -class NSPanelRoomEntitiesPage_EntitySlot::_Internal { +class NSPanelRoomStatus::_Internal { public: }; -NSPanelRoomEntitiesPage_EntitySlot::NSPanelRoomEntitiesPage_EntitySlot(::google::protobuf::Arena* arena) +NSPanelRoomStatus::NSPanelRoomStatus(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelRoomEntitiesPage.EntitySlot) + // @@protoc_insertion_point(arena_constructor:NSPanelRoomStatus) } -inline PROTOBUF_NDEBUG_INLINE NSPanelRoomEntitiesPage_EntitySlot::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelRoomStatus::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::NSPanelRoomEntitiesPage_EntitySlot& from_msg) - : name_(arena, from.name_), - icon_(arena, from.icon_), - mqtt_state_topic_(arena, from.mqtt_state_topic_), + const Impl_& from, const ::NSPanelRoomStatus& from_msg) + : entity_page_ids_{visibility, arena, from.entity_page_ids_}, + _entity_page_ids_cached_byte_size_{0}, + name_(arena, from.name_), _cached_size_{0} {} -NSPanelRoomEntitiesPage_EntitySlot::NSPanelRoomEntitiesPage_EntitySlot( +NSPanelRoomStatus::NSPanelRoomStatus( ::google::protobuf::Arena* arena, - const NSPanelRoomEntitiesPage_EntitySlot& from) + const NSPanelRoomStatus& from) : ::google::protobuf::Message(arena) { - NSPanelRoomEntitiesPage_EntitySlot* const _this = this; + NSPanelRoomStatus* const _this = this; (void)_this; _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::memcpy(reinterpret_cast(&_impl_) + - offsetof(Impl_, room_view_position_), + offsetof(Impl_, id_), reinterpret_cast(&from._impl_) + - offsetof(Impl_, room_view_position_), - offsetof(Impl_, can_save_scene_) - - offsetof(Impl_, room_view_position_) + - sizeof(Impl_::can_save_scene_)); + offsetof(Impl_, id_), + offsetof(Impl_, num_table_lights_on_) - + offsetof(Impl_, id_) + + sizeof(Impl_::num_table_lights_on_)); - // @@protoc_insertion_point(copy_constructor:NSPanelRoomEntitiesPage.EntitySlot) + // @@protoc_insertion_point(copy_constructor:NSPanelRoomStatus) } -inline PROTOBUF_NDEBUG_INLINE NSPanelRoomEntitiesPage_EntitySlot::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelRoomStatus::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : name_(arena), - icon_(arena), - mqtt_state_topic_(arena), + : entity_page_ids_{visibility, arena}, + _entity_page_ids_cached_byte_size_{0}, + name_(arena), _cached_size_{0} {} -inline void NSPanelRoomEntitiesPage_EntitySlot::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelRoomStatus::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, room_view_position_), + offsetof(Impl_, id_), 0, - offsetof(Impl_, can_save_scene_) - - offsetof(Impl_, room_view_position_) + - sizeof(Impl_::can_save_scene_)); + offsetof(Impl_, num_table_lights_on_) - + offsetof(Impl_, id_) + + sizeof(Impl_::num_table_lights_on_)); } -NSPanelRoomEntitiesPage_EntitySlot::~NSPanelRoomEntitiesPage_EntitySlot() { - // @@protoc_insertion_point(destructor:NSPanelRoomEntitiesPage.EntitySlot) +NSPanelRoomStatus::~NSPanelRoomStatus() { + // @@protoc_insertion_point(destructor:NSPanelRoomStatus) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelRoomEntitiesPage_EntitySlot::SharedDtor() { +inline void NSPanelRoomStatus::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); _impl_.name_.Destroy(); - _impl_.icon_.Destroy(); - _impl_.mqtt_state_topic_.Destroy(); _impl_.~Impl_(); } const ::google::protobuf::MessageLite::ClassData* -NSPanelRoomEntitiesPage_EntitySlot::GetClassData() const { +NSPanelRoomStatus::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_._cached_size_), false, }, - &NSPanelRoomEntitiesPage_EntitySlot::MergeImpl, - &NSPanelRoomEntitiesPage_EntitySlot::kDescriptorMethods, + &NSPanelRoomStatus::MergeImpl, + &NSPanelRoomStatus::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_2eproto, nullptr, // tracker }; @@ -3302,154 +4602,231 @@ NSPanelRoomEntitiesPage_EntitySlot::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<3, 7, 0, 67, 2> NSPanelRoomEntitiesPage_EntitySlot::_table_ = { +const ::_pbi::TcParseTable<4, 13, 0, 38, 2> NSPanelRoomStatus::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 7, 56, // max_field_number, fast_idx_mask + 13, 120, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967168, // skipmap + 4294959104, // skipmap offsetof(decltype(_table_), field_entries), - 7, // num_field_entries + 13, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - &_NSPanelRoomEntitiesPage_EntitySlot_default_instance_._instance, + &_NSPanelRoomStatus_default_instance_._instance, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelRoomEntitiesPage_EntitySlot>(), // to_prefetch + ::_pbi::TcParser::GetTable<::NSPanelRoomStatus>(), // to_prefetch #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, - // int32 room_view_position = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomEntitiesPage_EntitySlot, _impl_.room_view_position_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.room_view_position_)}}, + // int32 id = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.id_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.id_)}}, // string name = 2; {::_pbi::TcParser::FastUS1, - {18, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.name_)}}, - // string icon = 3; - {::_pbi::TcParser::FastUS1, - {26, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.icon_)}}, - // int32 pco = 4; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomEntitiesPage_EntitySlot, _impl_.pco_), 63>(), - {32, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.pco_)}}, - // int32 pco2 = 5; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomEntitiesPage_EntitySlot, _impl_.pco2_), 63>(), - {40, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.pco2_)}}, - // bool can_save_scene = 6; - {::_pbi::TcParser::SingularVarintNoZag1(), - {48, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.can_save_scene_)}}, - // string mqtt_state_topic = 7; - {::_pbi::TcParser::FastUS1, - {58, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.mqtt_state_topic_)}}, + {18, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.name_)}}, + // int32 average_dim_level = 3; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.average_dim_level_), 63>(), + {24, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.average_dim_level_)}}, + // int32 ceiling_lights_dim_level = 4; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.ceiling_lights_dim_level_), 63>(), + {32, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.ceiling_lights_dim_level_)}}, + // int32 table_lights_dim_level = 5; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.table_lights_dim_level_), 63>(), + {40, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.table_lights_dim_level_)}}, + // int32 average_color_temperature = 6; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.average_color_temperature_), 63>(), + {48, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.average_color_temperature_)}}, + // int32 ceiling_lights_color_temperature_value = 7; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.ceiling_lights_color_temperature_value_), 63>(), + {56, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.ceiling_lights_color_temperature_value_)}}, + // int32 table_lights_color_temperature_value = 8; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.table_lights_color_temperature_value_), 63>(), + {64, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.table_lights_color_temperature_value_)}}, + // int32 num_ceiling_lights = 9; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.num_ceiling_lights_), 63>(), + {72, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_ceiling_lights_)}}, + // int32 num_table_lights = 10; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.num_table_lights_), 63>(), + {80, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_table_lights_)}}, + // int32 num_ceiling_lights_on = 11; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.num_ceiling_lights_on_), 63>(), + {88, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_ceiling_lights_on_)}}, + // int32 num_table_lights_on = 12; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.num_table_lights_on_), 63>(), + {96, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_table_lights_on_)}}, + // repeated int32 entity_page_ids = 13; + {::_pbi::TcParser::FastV32P1, + {106, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.entity_page_ids_)}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, }}, {{ 65535, 65535 }}, {{ - // int32 room_view_position = 1; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.room_view_position_), 0, 0, + // int32 id = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.id_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, // string name = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.name_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // string icon = 3; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.icon_), 0, 0, + {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.name_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // int32 pco = 4; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.pco_), 0, 0, + // int32 average_dim_level = 3; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.average_dim_level_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 pco2 = 5; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.pco2_), 0, 0, + // int32 ceiling_lights_dim_level = 4; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.ceiling_lights_dim_level_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // bool can_save_scene = 6; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.can_save_scene_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // string mqtt_state_topic = 7; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.mqtt_state_topic_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // int32 table_lights_dim_level = 5; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.table_lights_dim_level_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 average_color_temperature = 6; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.average_color_temperature_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 ceiling_lights_color_temperature_value = 7; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.ceiling_lights_color_temperature_value_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 table_lights_color_temperature_value = 8; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.table_lights_color_temperature_value_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 num_ceiling_lights = 9; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_ceiling_lights_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 num_table_lights = 10; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_table_lights_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 num_ceiling_lights_on = 11; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_ceiling_lights_on_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 num_table_lights_on = 12; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_table_lights_on_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // repeated int32 entity_page_ids = 13; + {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.entity_page_ids_), 0, 0, + (0 | ::_fl::kFcRepeated | ::_fl::kPackedInt32)}, }}, // no aux_entries {{ - "\42\0\4\4\0\0\0\20" - "NSPanelRoomEntitiesPage.EntitySlot" + "\21\0\4\0\0\0\0\0\0\0\0\0\0\0\0\0" + "NSPanelRoomStatus" "name" - "icon" - "mqtt_state_topic" }}, }; -PROTOBUF_NOINLINE void NSPanelRoomEntitiesPage_EntitySlot::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelRoomEntitiesPage.EntitySlot) +PROTOBUF_NOINLINE void NSPanelRoomStatus::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelRoomStatus) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; + _impl_.entity_page_ids_.Clear(); _impl_.name_.ClearToEmpty(); - _impl_.icon_.ClearToEmpty(); - _impl_.mqtt_state_topic_.ClearToEmpty(); - ::memset(&_impl_.room_view_position_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.can_save_scene_) - - reinterpret_cast(&_impl_.room_view_position_)) + sizeof(_impl_.can_save_scene_)); + ::memset(&_impl_.id_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.num_table_lights_on_) - + reinterpret_cast(&_impl_.id_)) + sizeof(_impl_.num_table_lights_on_)); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::uint8_t* NSPanelRoomEntitiesPage_EntitySlot::_InternalSerialize( +::uint8_t* NSPanelRoomStatus::_InternalSerialize( ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelRoomEntitiesPage.EntitySlot) + // @@protoc_insertion_point(serialize_to_array_start:NSPanelRoomStatus) ::uint32_t cached_has_bits = 0; (void)cached_has_bits; - // int32 room_view_position = 1; - if (this->_internal_room_view_position() != 0) { + // int32 id = 1; + if (this->_internal_id() != 0) { target = ::google::protobuf::internal::WireFormatLite:: WriteInt32ToArrayWithField<1>( - stream, this->_internal_room_view_position(), target); + stream, this->_internal_id(), target); } // string name = 2; if (!this->_internal_name().empty()) { const std::string& _s = this->_internal_name(); ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelRoomEntitiesPage.EntitySlot.name"); + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelRoomStatus.name"); target = stream->WriteStringMaybeAliased(2, _s, target); } - // string icon = 3; - if (!this->_internal_icon().empty()) { - const std::string& _s = this->_internal_icon(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelRoomEntitiesPage.EntitySlot.icon"); - target = stream->WriteStringMaybeAliased(3, _s, target); + // int32 average_dim_level = 3; + if (this->_internal_average_dim_level() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<3>( + stream, this->_internal_average_dim_level(), target); } - // int32 pco = 4; - if (this->_internal_pco() != 0) { + // int32 ceiling_lights_dim_level = 4; + if (this->_internal_ceiling_lights_dim_level() != 0) { target = ::google::protobuf::internal::WireFormatLite:: WriteInt32ToArrayWithField<4>( - stream, this->_internal_pco(), target); + stream, this->_internal_ceiling_lights_dim_level(), target); } - // int32 pco2 = 5; - if (this->_internal_pco2() != 0) { + // int32 table_lights_dim_level = 5; + if (this->_internal_table_lights_dim_level() != 0) { target = ::google::protobuf::internal::WireFormatLite:: WriteInt32ToArrayWithField<5>( - stream, this->_internal_pco2(), target); + stream, this->_internal_table_lights_dim_level(), target); } - // bool can_save_scene = 6; - if (this->_internal_can_save_scene() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 6, this->_internal_can_save_scene(), target); + // int32 average_color_temperature = 6; + if (this->_internal_average_color_temperature() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<6>( + stream, this->_internal_average_color_temperature(), target); } - // string mqtt_state_topic = 7; - if (!this->_internal_mqtt_state_topic().empty()) { - const std::string& _s = this->_internal_mqtt_state_topic(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelRoomEntitiesPage.EntitySlot.mqtt_state_topic"); - target = stream->WriteStringMaybeAliased(7, _s, target); + // int32 ceiling_lights_color_temperature_value = 7; + if (this->_internal_ceiling_lights_color_temperature_value() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<7>( + stream, this->_internal_ceiling_lights_color_temperature_value(), target); + } + + // int32 table_lights_color_temperature_value = 8; + if (this->_internal_table_lights_color_temperature_value() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<8>( + stream, this->_internal_table_lights_color_temperature_value(), target); + } + + // int32 num_ceiling_lights = 9; + if (this->_internal_num_ceiling_lights() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<9>( + stream, this->_internal_num_ceiling_lights(), target); + } + + // int32 num_table_lights = 10; + if (this->_internal_num_table_lights() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<10>( + stream, this->_internal_num_table_lights(), target); + } + + // int32 num_ceiling_lights_on = 11; + if (this->_internal_num_ceiling_lights_on() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<11>( + stream, this->_internal_num_ceiling_lights_on(), target); + } + + // int32 num_table_lights_on = 12; + if (this->_internal_num_table_lights_on() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<12>( + stream, this->_internal_num_table_lights_on(), target); + } + + // repeated int32 entity_page_ids = 13; + { + int byte_size = _impl_._entity_page_ids_cached_byte_size_.Get(); + if (byte_size > 0) { + target = stream->WriteInt32Packed( + 13, _internal_entity_page_ids(), byte_size, target); + } } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -3457,12 +4834,12 @@ ::uint8_t* NSPanelRoomEntitiesPage_EntitySlot::_InternalSerialize( ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelRoomEntitiesPage.EntitySlot) + // @@protoc_insertion_point(serialize_to_array_end:NSPanelRoomStatus) return target; } -::size_t NSPanelRoomEntitiesPage_EntitySlot::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelRoomEntitiesPage.EntitySlot) +::size_t NSPanelRoomStatus::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelRoomStatus) ::size_t total_size = 0; ::uint32_t cached_has_bits = 0; @@ -3470,187 +4847,243 @@ ::size_t NSPanelRoomEntitiesPage_EntitySlot::ByteSizeLong() const { (void) cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); + // repeated int32 entity_page_ids = 13; + { + std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( + this->_internal_entity_page_ids()) + ; + _impl_._entity_page_ids_cached_byte_size_.Set(::_pbi::ToCachedSize(data_size)); + std::size_t tag_size = data_size == 0 + ? 0 + : 1 + ::_pbi::WireFormatLite::Int32Size( + static_cast(data_size)) + ; + total_size += tag_size + data_size; + } // string name = 2; if (!this->_internal_name().empty()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->_internal_name()); } - // string icon = 3; - if (!this->_internal_icon().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_icon()); + // int32 id = 1; + if (this->_internal_id() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_id()); } - // string mqtt_state_topic = 7; - if (!this->_internal_mqtt_state_topic().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_mqtt_state_topic()); + // int32 average_dim_level = 3; + if (this->_internal_average_dim_level() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_average_dim_level()); } - // int32 room_view_position = 1; - if (this->_internal_room_view_position() != 0) { + // int32 ceiling_lights_dim_level = 4; + if (this->_internal_ceiling_lights_dim_level() != 0) { total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_room_view_position()); + this->_internal_ceiling_lights_dim_level()); } - // int32 pco = 4; - if (this->_internal_pco() != 0) { + // int32 table_lights_dim_level = 5; + if (this->_internal_table_lights_dim_level() != 0) { total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_pco()); + this->_internal_table_lights_dim_level()); } - // int32 pco2 = 5; - if (this->_internal_pco2() != 0) { + // int32 average_color_temperature = 6; + if (this->_internal_average_color_temperature() != 0) { total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_pco2()); + this->_internal_average_color_temperature()); } - // bool can_save_scene = 6; - if (this->_internal_can_save_scene() != 0) { - total_size += 2; + // int32 ceiling_lights_color_temperature_value = 7; + if (this->_internal_ceiling_lights_color_temperature_value() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_ceiling_lights_color_temperature_value()); + } + + // int32 table_lights_color_temperature_value = 8; + if (this->_internal_table_lights_color_temperature_value() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_table_lights_color_temperature_value()); + } + + // int32 num_ceiling_lights = 9; + if (this->_internal_num_ceiling_lights() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_num_ceiling_lights()); + } + + // int32 num_table_lights = 10; + if (this->_internal_num_table_lights() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_num_table_lights()); + } + + // int32 num_ceiling_lights_on = 11; + if (this->_internal_num_ceiling_lights_on() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_num_ceiling_lights_on()); + } + + // int32 num_table_lights_on = 12; + if (this->_internal_num_table_lights_on() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_num_table_lights_on()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -void NSPanelRoomEntitiesPage_EntitySlot::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelRoomEntitiesPage.EntitySlot) +void NSPanelRoomStatus::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelRoomStatus) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; (void) cached_has_bits; + _this->_internal_mutable_entity_page_ids()->MergeFrom(from._internal_entity_page_ids()); if (!from._internal_name().empty()) { _this->_internal_set_name(from._internal_name()); } - if (!from._internal_icon().empty()) { - _this->_internal_set_icon(from._internal_icon()); + if (from._internal_id() != 0) { + _this->_impl_.id_ = from._impl_.id_; } - if (!from._internal_mqtt_state_topic().empty()) { - _this->_internal_set_mqtt_state_topic(from._internal_mqtt_state_topic()); + if (from._internal_average_dim_level() != 0) { + _this->_impl_.average_dim_level_ = from._impl_.average_dim_level_; } - if (from._internal_room_view_position() != 0) { - _this->_impl_.room_view_position_ = from._impl_.room_view_position_; + if (from._internal_ceiling_lights_dim_level() != 0) { + _this->_impl_.ceiling_lights_dim_level_ = from._impl_.ceiling_lights_dim_level_; } - if (from._internal_pco() != 0) { - _this->_impl_.pco_ = from._impl_.pco_; + if (from._internal_table_lights_dim_level() != 0) { + _this->_impl_.table_lights_dim_level_ = from._impl_.table_lights_dim_level_; } - if (from._internal_pco2() != 0) { - _this->_impl_.pco2_ = from._impl_.pco2_; + if (from._internal_average_color_temperature() != 0) { + _this->_impl_.average_color_temperature_ = from._impl_.average_color_temperature_; } - if (from._internal_can_save_scene() != 0) { - _this->_impl_.can_save_scene_ = from._impl_.can_save_scene_; + if (from._internal_ceiling_lights_color_temperature_value() != 0) { + _this->_impl_.ceiling_lights_color_temperature_value_ = from._impl_.ceiling_lights_color_temperature_value_; + } + if (from._internal_table_lights_color_temperature_value() != 0) { + _this->_impl_.table_lights_color_temperature_value_ = from._impl_.table_lights_color_temperature_value_; + } + if (from._internal_num_ceiling_lights() != 0) { + _this->_impl_.num_ceiling_lights_ = from._impl_.num_ceiling_lights_; + } + if (from._internal_num_table_lights() != 0) { + _this->_impl_.num_table_lights_ = from._impl_.num_table_lights_; + } + if (from._internal_num_ceiling_lights_on() != 0) { + _this->_impl_.num_ceiling_lights_on_ = from._impl_.num_ceiling_lights_on_; + } + if (from._internal_num_table_lights_on() != 0) { + _this->_impl_.num_table_lights_on_ = from._impl_.num_table_lights_on_; } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } -void NSPanelRoomEntitiesPage_EntitySlot::CopyFrom(const NSPanelRoomEntitiesPage_EntitySlot& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelRoomEntitiesPage.EntitySlot) +void NSPanelRoomStatus::CopyFrom(const NSPanelRoomStatus& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelRoomStatus) if (&from == this) return; Clear(); MergeFrom(from); } -void NSPanelRoomEntitiesPage_EntitySlot::InternalSwap(NSPanelRoomEntitiesPage_EntitySlot* PROTOBUF_RESTRICT other) { +void NSPanelRoomStatus::InternalSwap(NSPanelRoomStatus* PROTOBUF_RESTRICT other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + _impl_.entity_page_ids_.InternalSwap(&other->_impl_.entity_page_ids_); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.icon_, &other->_impl_.icon_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.mqtt_state_topic_, &other->_impl_.mqtt_state_topic_, arena); ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.can_save_scene_) - + sizeof(NSPanelRoomEntitiesPage_EntitySlot::_impl_.can_save_scene_) - - PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage_EntitySlot, _impl_.room_view_position_)>( - reinterpret_cast(&_impl_.room_view_position_), - reinterpret_cast(&other->_impl_.room_view_position_)); + PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_table_lights_on_) + + sizeof(NSPanelRoomStatus::_impl_.num_table_lights_on_) + - PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.id_)>( + reinterpret_cast(&_impl_.id_), + reinterpret_cast(&other->_impl_.id_)); } -::google::protobuf::Metadata NSPanelRoomEntitiesPage_EntitySlot::GetMetadata() const { +::google::protobuf::Metadata NSPanelRoomStatus::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } // =================================================================== -class NSPanelRoomEntitiesPage::_Internal { +class NSPanelWeatherUpdate_ForecastItem::_Internal { public: }; -NSPanelRoomEntitiesPage::NSPanelRoomEntitiesPage(::google::protobuf::Arena* arena) +NSPanelWeatherUpdate_ForecastItem::NSPanelWeatherUpdate_ForecastItem(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelRoomEntitiesPage) + // @@protoc_insertion_point(arena_constructor:NSPanelWeatherUpdate.ForecastItem) } -inline PROTOBUF_NDEBUG_INLINE NSPanelRoomEntitiesPage::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelWeatherUpdate_ForecastItem::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::NSPanelRoomEntitiesPage& from_msg) - : entities_{visibility, arena, from.entities_}, - header_text_(arena, from.header_text_), + const Impl_& from, const ::NSPanelWeatherUpdate_ForecastItem& from_msg) + : weather_icon_(arena, from.weather_icon_), + precipitation_string_(arena, from.precipitation_string_), + temperature_maxmin_string_(arena, from.temperature_maxmin_string_), + wind_string_(arena, from.wind_string_), + display_string_(arena, from.display_string_), _cached_size_{0} {} -NSPanelRoomEntitiesPage::NSPanelRoomEntitiesPage( +NSPanelWeatherUpdate_ForecastItem::NSPanelWeatherUpdate_ForecastItem( ::google::protobuf::Arena* arena, - const NSPanelRoomEntitiesPage& from) + const NSPanelWeatherUpdate_ForecastItem& from) : ::google::protobuf::Message(arena) { - NSPanelRoomEntitiesPage* const _this = this; + NSPanelWeatherUpdate_ForecastItem* const _this = this; (void)_this; _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - ::memcpy(reinterpret_cast(&_impl_) + - offsetof(Impl_, id_), - reinterpret_cast(&from._impl_) + - offsetof(Impl_, id_), - offsetof(Impl_, page_type_) - - offsetof(Impl_, id_) + - sizeof(Impl_::page_type_)); - // @@protoc_insertion_point(copy_constructor:NSPanelRoomEntitiesPage) + // @@protoc_insertion_point(copy_constructor:NSPanelWeatherUpdate.ForecastItem) } -inline PROTOBUF_NDEBUG_INLINE NSPanelRoomEntitiesPage::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelWeatherUpdate_ForecastItem::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : entities_{visibility, arena}, - header_text_(arena), + : weather_icon_(arena), + precipitation_string_(arena), + temperature_maxmin_string_(arena), + wind_string_(arena), + display_string_(arena), _cached_size_{0} {} -inline void NSPanelRoomEntitiesPage::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelWeatherUpdate_ForecastItem::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); - ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, id_), - 0, - offsetof(Impl_, page_type_) - - offsetof(Impl_, id_) + - sizeof(Impl_::page_type_)); } -NSPanelRoomEntitiesPage::~NSPanelRoomEntitiesPage() { - // @@protoc_insertion_point(destructor:NSPanelRoomEntitiesPage) +NSPanelWeatherUpdate_ForecastItem::~NSPanelWeatherUpdate_ForecastItem() { + // @@protoc_insertion_point(destructor:NSPanelWeatherUpdate.ForecastItem) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelRoomEntitiesPage::SharedDtor() { +inline void NSPanelWeatherUpdate_ForecastItem::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); - _impl_.header_text_.Destroy(); + _impl_.weather_icon_.Destroy(); + _impl_.precipitation_string_.Destroy(); + _impl_.temperature_maxmin_string_.Destroy(); + _impl_.wind_string_.Destroy(); + _impl_.display_string_.Destroy(); _impl_.~Impl_(); } const ::google::protobuf::MessageLite::ClassData* -NSPanelRoomEntitiesPage::GetClassData() const { +NSPanelWeatherUpdate_ForecastItem::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_._cached_size_), false, }, - &NSPanelRoomEntitiesPage::MergeImpl, - &NSPanelRoomEntitiesPage::kDescriptorMethods, + &NSPanelWeatherUpdate_ForecastItem::MergeImpl, + &NSPanelWeatherUpdate_ForecastItem::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_2eproto, nullptr, // tracker }; @@ -3659,113 +5092,133 @@ NSPanelRoomEntitiesPage::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 4, 1, 43, 2> NSPanelRoomEntitiesPage::_table_ = { +const ::_pbi::TcParseTable<3, 5, 0, 124, 2> NSPanelWeatherUpdate_ForecastItem::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 4, 24, // max_field_number, fast_idx_mask + 5, 56, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967280, // skipmap + 4294967264, // skipmap offsetof(decltype(_table_), field_entries), - 4, // num_field_entries - 1, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - &_NSPanelRoomEntitiesPage_default_instance_._instance, + 5, // num_field_entries + 0, // num_aux_entries + offsetof(decltype(_table_), field_names), // no aux_entries + &_NSPanelWeatherUpdate_ForecastItem_default_instance_._instance, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelRoomEntitiesPage>(), // to_prefetch + ::_pbi::TcParser::GetTable<::NSPanelWeatherUpdate_ForecastItem>(), // to_prefetch #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ - // repeated .NSPanelRoomEntitiesPage.EntitySlot entities = 4; - {::_pbi::TcParser::FastMtR1, - {34, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.entities_)}}, - // int32 id = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomEntitiesPage, _impl_.id_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.id_)}}, - // int32 page_type = 2; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomEntitiesPage, _impl_.page_type_), 63>(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.page_type_)}}, - // string header_text = 3; + {::_pbi::TcParser::MiniParse, {}}, + // string weather_icon = 1; {::_pbi::TcParser::FastUS1, - {26, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.header_text_)}}, + {10, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.weather_icon_)}}, + // string precipitation_string = 2; + {::_pbi::TcParser::FastUS1, + {18, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.precipitation_string_)}}, + // string temperature_maxmin_string = 3; + {::_pbi::TcParser::FastUS1, + {26, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.temperature_maxmin_string_)}}, + // string wind_string = 4; + {::_pbi::TcParser::FastUS1, + {34, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.wind_string_)}}, + // string display_string = 5; + {::_pbi::TcParser::FastUS1, + {42, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.display_string_)}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, }}, {{ 65535, 65535 }}, {{ - // int32 id = 1; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.id_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 page_type = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.page_type_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // string header_text = 3; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.header_text_), 0, 0, + // string weather_icon = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.weather_icon_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // repeated .NSPanelRoomEntitiesPage.EntitySlot entities = 4; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.entities_), 0, 0, - (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::NSPanelRoomEntitiesPage_EntitySlot>()}, - }}, {{ - "\27\0\0\13\0\0\0\0" - "NSPanelRoomEntitiesPage" - "header_text" + // string precipitation_string = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.precipitation_string_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // string temperature_maxmin_string = 3; + {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.temperature_maxmin_string_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // string wind_string = 4; + {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.wind_string_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // string display_string = 5; + {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.display_string_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + }}, + // no aux_entries + {{ + "\41\14\24\31\13\16\0\0" + "NSPanelWeatherUpdate.ForecastItem" + "weather_icon" + "precipitation_string" + "temperature_maxmin_string" + "wind_string" + "display_string" }}, }; -PROTOBUF_NOINLINE void NSPanelRoomEntitiesPage::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelRoomEntitiesPage) +PROTOBUF_NOINLINE void NSPanelWeatherUpdate_ForecastItem::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelWeatherUpdate.ForecastItem) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.entities_.Clear(); - _impl_.header_text_.ClearToEmpty(); - ::memset(&_impl_.id_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.page_type_) - - reinterpret_cast(&_impl_.id_)) + sizeof(_impl_.page_type_)); + _impl_.weather_icon_.ClearToEmpty(); + _impl_.precipitation_string_.ClearToEmpty(); + _impl_.temperature_maxmin_string_.ClearToEmpty(); + _impl_.wind_string_.ClearToEmpty(); + _impl_.display_string_.ClearToEmpty(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::uint8_t* NSPanelRoomEntitiesPage::_InternalSerialize( +::uint8_t* NSPanelWeatherUpdate_ForecastItem::_InternalSerialize( ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelRoomEntitiesPage) + // @@protoc_insertion_point(serialize_to_array_start:NSPanelWeatherUpdate.ForecastItem) ::uint32_t cached_has_bits = 0; (void)cached_has_bits; - // int32 id = 1; - if (this->_internal_id() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<1>( - stream, this->_internal_id(), target); + // string weather_icon = 1; + if (!this->_internal_weather_icon().empty()) { + const std::string& _s = this->_internal_weather_icon(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.ForecastItem.weather_icon"); + target = stream->WriteStringMaybeAliased(1, _s, target); } - // int32 page_type = 2; - if (this->_internal_page_type() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this->_internal_page_type(), target); + // string precipitation_string = 2; + if (!this->_internal_precipitation_string().empty()) { + const std::string& _s = this->_internal_precipitation_string(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.ForecastItem.precipitation_string"); + target = stream->WriteStringMaybeAliased(2, _s, target); } - // string header_text = 3; - if (!this->_internal_header_text().empty()) { - const std::string& _s = this->_internal_header_text(); + // string temperature_maxmin_string = 3; + if (!this->_internal_temperature_maxmin_string().empty()) { + const std::string& _s = this->_internal_temperature_maxmin_string(); ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelRoomEntitiesPage.header_text"); + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.ForecastItem.temperature_maxmin_string"); target = stream->WriteStringMaybeAliased(3, _s, target); } - // repeated .NSPanelRoomEntitiesPage.EntitySlot entities = 4; - for (unsigned i = 0, n = static_cast( - this->_internal_entities_size()); - i < n; i++) { - const auto& repfield = this->_internal_entities().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, repfield, repfield.GetCachedSize(), - target, stream); + // string wind_string = 4; + if (!this->_internal_wind_string().empty()) { + const std::string& _s = this->_internal_wind_string(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.ForecastItem.wind_string"); + target = stream->WriteStringMaybeAliased(4, _s, target); + } + + // string display_string = 5; + if (!this->_internal_display_string().empty()) { + const std::string& _s = this->_internal_display_string(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.ForecastItem.display_string"); + target = stream->WriteStringMaybeAliased(5, _s, target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -3773,12 +5226,12 @@ ::uint8_t* NSPanelRoomEntitiesPage::_InternalSerialize( ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelRoomEntitiesPage) + // @@protoc_insertion_point(serialize_to_array_end:NSPanelWeatherUpdate.ForecastItem) return target; } -::size_t NSPanelRoomEntitiesPage::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelRoomEntitiesPage) +::size_t NSPanelWeatherUpdate_ForecastItem::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelWeatherUpdate.ForecastItem) ::size_t total_size = 0; ::uint32_t cached_has_bits = 0; @@ -3786,160 +5239,171 @@ ::size_t NSPanelRoomEntitiesPage::ByteSizeLong() const { (void) cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); - // repeated .NSPanelRoomEntitiesPage.EntitySlot entities = 4; - total_size += 1UL * this->_internal_entities_size(); - for (const auto& msg : this->_internal_entities()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); + // string weather_icon = 1; + if (!this->_internal_weather_icon().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_weather_icon()); } - // string header_text = 3; - if (!this->_internal_header_text().empty()) { + + // string precipitation_string = 2; + if (!this->_internal_precipitation_string().empty()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_header_text()); + this->_internal_precipitation_string()); } - // int32 id = 1; - if (this->_internal_id() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_id()); + // string temperature_maxmin_string = 3; + if (!this->_internal_temperature_maxmin_string().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_temperature_maxmin_string()); } - // int32 page_type = 2; - if (this->_internal_page_type() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_page_type()); + // string wind_string = 4; + if (!this->_internal_wind_string().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_wind_string()); + } + + // string display_string = 5; + if (!this->_internal_display_string().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_display_string()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -void NSPanelRoomEntitiesPage::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelRoomEntitiesPage) +void NSPanelWeatherUpdate_ForecastItem::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelWeatherUpdate.ForecastItem) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - _this->_internal_mutable_entities()->MergeFrom( - from._internal_entities()); - if (!from._internal_header_text().empty()) { - _this->_internal_set_header_text(from._internal_header_text()); + if (!from._internal_weather_icon().empty()) { + _this->_internal_set_weather_icon(from._internal_weather_icon()); } - if (from._internal_id() != 0) { - _this->_impl_.id_ = from._impl_.id_; + if (!from._internal_precipitation_string().empty()) { + _this->_internal_set_precipitation_string(from._internal_precipitation_string()); } - if (from._internal_page_type() != 0) { - _this->_impl_.page_type_ = from._impl_.page_type_; + if (!from._internal_temperature_maxmin_string().empty()) { + _this->_internal_set_temperature_maxmin_string(from._internal_temperature_maxmin_string()); + } + if (!from._internal_wind_string().empty()) { + _this->_internal_set_wind_string(from._internal_wind_string()); + } + if (!from._internal_display_string().empty()) { + _this->_internal_set_display_string(from._internal_display_string()); } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } -void NSPanelRoomEntitiesPage::CopyFrom(const NSPanelRoomEntitiesPage& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelRoomEntitiesPage) +void NSPanelWeatherUpdate_ForecastItem::CopyFrom(const NSPanelWeatherUpdate_ForecastItem& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelWeatherUpdate.ForecastItem) if (&from == this) return; Clear(); MergeFrom(from); } -void NSPanelRoomEntitiesPage::InternalSwap(NSPanelRoomEntitiesPage* PROTOBUF_RESTRICT other) { +void NSPanelWeatherUpdate_ForecastItem::InternalSwap(NSPanelWeatherUpdate_ForecastItem* PROTOBUF_RESTRICT other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); - _impl_.entities_.InternalSwap(&other->_impl_.entities_); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.header_text_, &other->_impl_.header_text_, arena); - ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.page_type_) - + sizeof(NSPanelRoomEntitiesPage::_impl_.page_type_) - - PROTOBUF_FIELD_OFFSET(NSPanelRoomEntitiesPage, _impl_.id_)>( - reinterpret_cast(&_impl_.id_), - reinterpret_cast(&other->_impl_.id_)); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.weather_icon_, &other->_impl_.weather_icon_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.precipitation_string_, &other->_impl_.precipitation_string_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.temperature_maxmin_string_, &other->_impl_.temperature_maxmin_string_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.wind_string_, &other->_impl_.wind_string_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.display_string_, &other->_impl_.display_string_, arena); } -::google::protobuf::Metadata NSPanelRoomEntitiesPage::GetMetadata() const { +::google::protobuf::Metadata NSPanelWeatherUpdate_ForecastItem::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } // =================================================================== -class NSPanelRoomStatus::_Internal { +class NSPanelWeatherUpdate::_Internal { public: }; -NSPanelRoomStatus::NSPanelRoomStatus(::google::protobuf::Arena* arena) +NSPanelWeatherUpdate::NSPanelWeatherUpdate(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelRoomStatus) + // @@protoc_insertion_point(arena_constructor:NSPanelWeatherUpdate) } -inline PROTOBUF_NDEBUG_INLINE NSPanelRoomStatus::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelWeatherUpdate::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::NSPanelRoomStatus& from_msg) - : entity_page_ids_{visibility, arena, from.entity_page_ids_}, - _entity_page_ids_cached_byte_size_{0}, - name_(arena, from.name_), + const Impl_& from, const ::NSPanelWeatherUpdate& from_msg) + : forecast_items_{visibility, arena, from.forecast_items_}, + current_weather_icon_(arena, from.current_weather_icon_), + current_temperature_string_(arena, from.current_temperature_string_), + current_maxmin_temperature_(arena, from.current_maxmin_temperature_), + current_wind_string_(arena, from.current_wind_string_), + sunrise_string_(arena, from.sunrise_string_), + sunset_string_(arena, from.sunset_string_), + current_precipitation_string_(arena, from.current_precipitation_string_), _cached_size_{0} {} -NSPanelRoomStatus::NSPanelRoomStatus( +NSPanelWeatherUpdate::NSPanelWeatherUpdate( ::google::protobuf::Arena* arena, - const NSPanelRoomStatus& from) + const NSPanelWeatherUpdate& from) : ::google::protobuf::Message(arena) { - NSPanelRoomStatus* const _this = this; + NSPanelWeatherUpdate* const _this = this; (void)_this; _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - ::memcpy(reinterpret_cast(&_impl_) + - offsetof(Impl_, id_), - reinterpret_cast(&from._impl_) + - offsetof(Impl_, id_), - offsetof(Impl_, num_table_lights_on_) - - offsetof(Impl_, id_) + - sizeof(Impl_::num_table_lights_on_)); + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - // @@protoc_insertion_point(copy_constructor:NSPanelRoomStatus) + // @@protoc_insertion_point(copy_constructor:NSPanelWeatherUpdate) } -inline PROTOBUF_NDEBUG_INLINE NSPanelRoomStatus::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelWeatherUpdate::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : entity_page_ids_{visibility, arena}, - _entity_page_ids_cached_byte_size_{0}, - name_(arena), + : forecast_items_{visibility, arena}, + current_weather_icon_(arena), + current_temperature_string_(arena), + current_maxmin_temperature_(arena), + current_wind_string_(arena), + sunrise_string_(arena), + sunset_string_(arena), + current_precipitation_string_(arena), _cached_size_{0} {} -inline void NSPanelRoomStatus::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelWeatherUpdate::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); - ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, id_), - 0, - offsetof(Impl_, num_table_lights_on_) - - offsetof(Impl_, id_) + - sizeof(Impl_::num_table_lights_on_)); } -NSPanelRoomStatus::~NSPanelRoomStatus() { - // @@protoc_insertion_point(destructor:NSPanelRoomStatus) +NSPanelWeatherUpdate::~NSPanelWeatherUpdate() { + // @@protoc_insertion_point(destructor:NSPanelWeatherUpdate) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelRoomStatus::SharedDtor() { +inline void NSPanelWeatherUpdate::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); - _impl_.name_.Destroy(); + _impl_.current_weather_icon_.Destroy(); + _impl_.current_temperature_string_.Destroy(); + _impl_.current_maxmin_temperature_.Destroy(); + _impl_.current_wind_string_.Destroy(); + _impl_.sunrise_string_.Destroy(); + _impl_.sunset_string_.Destroy(); + _impl_.current_precipitation_string_.Destroy(); _impl_.~Impl_(); } const ::google::protobuf::MessageLite::ClassData* -NSPanelRoomStatus::GetClassData() const { +NSPanelWeatherUpdate::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_._cached_size_), false, }, - &NSPanelRoomStatus::MergeImpl, - &NSPanelRoomStatus::kDescriptorMethods, + &NSPanelWeatherUpdate::MergeImpl, + &NSPanelWeatherUpdate::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_2eproto, nullptr, // tracker }; @@ -3948,231 +5412,180 @@ NSPanelRoomStatus::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<4, 13, 0, 38, 2> NSPanelRoomStatus::_table_ = { +const ::_pbi::TcParseTable<3, 8, 1, 183, 2> NSPanelWeatherUpdate::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 13, 120, // max_field_number, fast_idx_mask + 8, 56, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294959104, // skipmap + 4294967040, // skipmap offsetof(decltype(_table_), field_entries), - 13, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - &_NSPanelRoomStatus_default_instance_._instance, + 8, // num_field_entries + 1, // num_aux_entries + offsetof(decltype(_table_), aux_entries), + &_NSPanelWeatherUpdate_default_instance_._instance, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelRoomStatus>(), // to_prefetch + ::_pbi::TcParser::GetTable<::NSPanelWeatherUpdate>(), // to_prefetch #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ - {::_pbi::TcParser::MiniParse, {}}, - // int32 id = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.id_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.id_)}}, - // string name = 2; + // string current_precipitation_string = 8; {::_pbi::TcParser::FastUS1, - {18, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.name_)}}, - // int32 average_dim_level = 3; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.average_dim_level_), 63>(), - {24, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.average_dim_level_)}}, - // int32 ceiling_lights_dim_level = 4; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.ceiling_lights_dim_level_), 63>(), - {32, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.ceiling_lights_dim_level_)}}, - // int32 table_lights_dim_level = 5; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.table_lights_dim_level_), 63>(), - {40, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.table_lights_dim_level_)}}, - // int32 average_color_temperature = 6; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.average_color_temperature_), 63>(), - {48, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.average_color_temperature_)}}, - // int32 ceiling_lights_color_temperature_value = 7; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.ceiling_lights_color_temperature_value_), 63>(), - {56, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.ceiling_lights_color_temperature_value_)}}, - // int32 table_lights_color_temperature_value = 8; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.table_lights_color_temperature_value_), 63>(), - {64, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.table_lights_color_temperature_value_)}}, - // int32 num_ceiling_lights = 9; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.num_ceiling_lights_), 63>(), - {72, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_ceiling_lights_)}}, - // int32 num_table_lights = 10; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.num_table_lights_), 63>(), - {80, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_table_lights_)}}, - // int32 num_ceiling_lights_on = 11; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.num_ceiling_lights_on_), 63>(), - {88, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_ceiling_lights_on_)}}, - // int32 num_table_lights_on = 12; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelRoomStatus, _impl_.num_table_lights_on_), 63>(), - {96, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_table_lights_on_)}}, - // repeated int32 entity_page_ids = 13; - {::_pbi::TcParser::FastV32P1, - {106, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.entity_page_ids_)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, + {66, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_precipitation_string_)}}, + // repeated .NSPanelWeatherUpdate.ForecastItem forecast_items = 1; + {::_pbi::TcParser::FastMtR1, + {10, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.forecast_items_)}}, + // string current_weather_icon = 2; + {::_pbi::TcParser::FastUS1, + {18, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_weather_icon_)}}, + // string current_temperature_string = 3; + {::_pbi::TcParser::FastUS1, + {26, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_temperature_string_)}}, + // string current_maxmin_temperature = 4; + {::_pbi::TcParser::FastUS1, + {34, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_maxmin_temperature_)}}, + // string current_wind_string = 5; + {::_pbi::TcParser::FastUS1, + {42, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_wind_string_)}}, + // string sunrise_string = 6; + {::_pbi::TcParser::FastUS1, + {50, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.sunrise_string_)}}, + // string sunset_string = 7; + {::_pbi::TcParser::FastUS1, + {58, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.sunset_string_)}}, }}, {{ 65535, 65535 }}, {{ - // int32 id = 1; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.id_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // string name = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.name_), 0, 0, + // repeated .NSPanelWeatherUpdate.ForecastItem forecast_items = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.forecast_items_), 0, 0, + (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, + // string current_weather_icon = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_weather_icon_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // int32 average_dim_level = 3; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.average_dim_level_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 ceiling_lights_dim_level = 4; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.ceiling_lights_dim_level_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 table_lights_dim_level = 5; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.table_lights_dim_level_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 average_color_temperature = 6; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.average_color_temperature_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 ceiling_lights_color_temperature_value = 7; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.ceiling_lights_color_temperature_value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 table_lights_color_temperature_value = 8; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.table_lights_color_temperature_value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 num_ceiling_lights = 9; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_ceiling_lights_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 num_table_lights = 10; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_table_lights_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 num_ceiling_lights_on = 11; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_ceiling_lights_on_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 num_table_lights_on = 12; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_table_lights_on_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // repeated int32 entity_page_ids = 13; - {PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.entity_page_ids_), 0, 0, - (0 | ::_fl::kFcRepeated | ::_fl::kPackedInt32)}, - }}, - // no aux_entries - {{ - "\21\0\4\0\0\0\0\0\0\0\0\0\0\0\0\0" - "NSPanelRoomStatus" - "name" + // string current_temperature_string = 3; + {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_temperature_string_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // string current_maxmin_temperature = 4; + {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_maxmin_temperature_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // string current_wind_string = 5; + {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_wind_string_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // string sunrise_string = 6; + {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.sunrise_string_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // string sunset_string = 7; + {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.sunset_string_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // string current_precipitation_string = 8; + {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_precipitation_string_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + }}, {{ + {::_pbi::TcParser::GetTable<::NSPanelWeatherUpdate_ForecastItem>()}, + }}, {{ + "\24\0\24\32\32\23\16\15\34\0\0\0\0\0\0\0" + "NSPanelWeatherUpdate" + "current_weather_icon" + "current_temperature_string" + "current_maxmin_temperature" + "current_wind_string" + "sunrise_string" + "sunset_string" + "current_precipitation_string" }}, }; -PROTOBUF_NOINLINE void NSPanelRoomStatus::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelRoomStatus) +PROTOBUF_NOINLINE void NSPanelWeatherUpdate::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelWeatherUpdate) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.entity_page_ids_.Clear(); - _impl_.name_.ClearToEmpty(); - ::memset(&_impl_.id_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.num_table_lights_on_) - - reinterpret_cast(&_impl_.id_)) + sizeof(_impl_.num_table_lights_on_)); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -::uint8_t* NSPanelRoomStatus::_InternalSerialize( - ::uint8_t* target, - ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelRoomStatus) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - // int32 id = 1; - if (this->_internal_id() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<1>( - stream, this->_internal_id(), target); - } - - // string name = 2; - if (!this->_internal_name().empty()) { - const std::string& _s = this->_internal_name(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelRoomStatus.name"); - target = stream->WriteStringMaybeAliased(2, _s, target); - } - - // int32 average_dim_level = 3; - if (this->_internal_average_dim_level() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<3>( - stream, this->_internal_average_dim_level(), target); - } - - // int32 ceiling_lights_dim_level = 4; - if (this->_internal_ceiling_lights_dim_level() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<4>( - stream, this->_internal_ceiling_lights_dim_level(), target); - } + _impl_.forecast_items_.Clear(); + _impl_.current_weather_icon_.ClearToEmpty(); + _impl_.current_temperature_string_.ClearToEmpty(); + _impl_.current_maxmin_temperature_.ClearToEmpty(); + _impl_.current_wind_string_.ClearToEmpty(); + _impl_.sunrise_string_.ClearToEmpty(); + _impl_.sunset_string_.ClearToEmpty(); + _impl_.current_precipitation_string_.ClearToEmpty(); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); +} - // int32 table_lights_dim_level = 5; - if (this->_internal_table_lights_dim_level() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<5>( - stream, this->_internal_table_lights_dim_level(), target); - } +::uint8_t* NSPanelWeatherUpdate::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:NSPanelWeatherUpdate) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; - // int32 average_color_temperature = 6; - if (this->_internal_average_color_temperature() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<6>( - stream, this->_internal_average_color_temperature(), target); + // repeated .NSPanelWeatherUpdate.ForecastItem forecast_items = 1; + for (unsigned i = 0, n = static_cast( + this->_internal_forecast_items_size()); + i < n; i++) { + const auto& repfield = this->_internal_forecast_items().Get(i); + target = + ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 1, repfield, repfield.GetCachedSize(), + target, stream); } - // int32 ceiling_lights_color_temperature_value = 7; - if (this->_internal_ceiling_lights_color_temperature_value() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<7>( - stream, this->_internal_ceiling_lights_color_temperature_value(), target); + // string current_weather_icon = 2; + if (!this->_internal_current_weather_icon().empty()) { + const std::string& _s = this->_internal_current_weather_icon(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.current_weather_icon"); + target = stream->WriteStringMaybeAliased(2, _s, target); } - // int32 table_lights_color_temperature_value = 8; - if (this->_internal_table_lights_color_temperature_value() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<8>( - stream, this->_internal_table_lights_color_temperature_value(), target); + // string current_temperature_string = 3; + if (!this->_internal_current_temperature_string().empty()) { + const std::string& _s = this->_internal_current_temperature_string(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.current_temperature_string"); + target = stream->WriteStringMaybeAliased(3, _s, target); } - // int32 num_ceiling_lights = 9; - if (this->_internal_num_ceiling_lights() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<9>( - stream, this->_internal_num_ceiling_lights(), target); + // string current_maxmin_temperature = 4; + if (!this->_internal_current_maxmin_temperature().empty()) { + const std::string& _s = this->_internal_current_maxmin_temperature(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.current_maxmin_temperature"); + target = stream->WriteStringMaybeAliased(4, _s, target); } - // int32 num_table_lights = 10; - if (this->_internal_num_table_lights() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<10>( - stream, this->_internal_num_table_lights(), target); + // string current_wind_string = 5; + if (!this->_internal_current_wind_string().empty()) { + const std::string& _s = this->_internal_current_wind_string(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.current_wind_string"); + target = stream->WriteStringMaybeAliased(5, _s, target); } - // int32 num_ceiling_lights_on = 11; - if (this->_internal_num_ceiling_lights_on() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<11>( - stream, this->_internal_num_ceiling_lights_on(), target); + // string sunrise_string = 6; + if (!this->_internal_sunrise_string().empty()) { + const std::string& _s = this->_internal_sunrise_string(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.sunrise_string"); + target = stream->WriteStringMaybeAliased(6, _s, target); } - // int32 num_table_lights_on = 12; - if (this->_internal_num_table_lights_on() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<12>( - stream, this->_internal_num_table_lights_on(), target); + // string sunset_string = 7; + if (!this->_internal_sunset_string().empty()) { + const std::string& _s = this->_internal_sunset_string(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.sunset_string"); + target = stream->WriteStringMaybeAliased(7, _s, target); } - // repeated int32 entity_page_ids = 13; - { - int byte_size = _impl_._entity_page_ids_cached_byte_size_.Get(); - if (byte_size > 0) { - target = stream->WriteInt32Packed( - 13, _internal_entity_page_ids(), byte_size, target); - } + // string current_precipitation_string = 8; + if (!this->_internal_current_precipitation_string().empty()) { + const std::string& _s = this->_internal_current_precipitation_string(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.current_precipitation_string"); + target = stream->WriteStringMaybeAliased(8, _s, target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -4180,12 +5593,12 @@ ::uint8_t* NSPanelRoomStatus::_InternalSerialize( ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelRoomStatus) + // @@protoc_insertion_point(serialize_to_array_end:NSPanelWeatherUpdate) return target; } -::size_t NSPanelRoomStatus::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelRoomStatus) +::size_t NSPanelWeatherUpdate::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelWeatherUpdate) ::size_t total_size = 0; ::uint32_t cached_has_bits = 0; @@ -4193,243 +5606,170 @@ ::size_t NSPanelRoomStatus::ByteSizeLong() const { (void) cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); - // repeated int32 entity_page_ids = 13; - { - std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( - this->_internal_entity_page_ids()) - ; - _impl_._entity_page_ids_cached_byte_size_.Set(::_pbi::ToCachedSize(data_size)); - std::size_t tag_size = data_size == 0 - ? 0 - : 1 + ::_pbi::WireFormatLite::Int32Size( - static_cast(data_size)) - ; - total_size += tag_size + data_size; + // repeated .NSPanelWeatherUpdate.ForecastItem forecast_items = 1; + total_size += 1UL * this->_internal_forecast_items_size(); + for (const auto& msg : this->_internal_forecast_items()) { + total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // string name = 2; - if (!this->_internal_name().empty()) { + // string current_weather_icon = 2; + if (!this->_internal_current_weather_icon().empty()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_name()); - } - - // int32 id = 1; - if (this->_internal_id() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_id()); - } - - // int32 average_dim_level = 3; - if (this->_internal_average_dim_level() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_average_dim_level()); - } - - // int32 ceiling_lights_dim_level = 4; - if (this->_internal_ceiling_lights_dim_level() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_ceiling_lights_dim_level()); - } - - // int32 table_lights_dim_level = 5; - if (this->_internal_table_lights_dim_level() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_table_lights_dim_level()); - } - - // int32 average_color_temperature = 6; - if (this->_internal_average_color_temperature() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_average_color_temperature()); + this->_internal_current_weather_icon()); } - // int32 ceiling_lights_color_temperature_value = 7; - if (this->_internal_ceiling_lights_color_temperature_value() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_ceiling_lights_color_temperature_value()); + // string current_temperature_string = 3; + if (!this->_internal_current_temperature_string().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_current_temperature_string()); } - // int32 table_lights_color_temperature_value = 8; - if (this->_internal_table_lights_color_temperature_value() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_table_lights_color_temperature_value()); + // string current_maxmin_temperature = 4; + if (!this->_internal_current_maxmin_temperature().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_current_maxmin_temperature()); } - // int32 num_ceiling_lights = 9; - if (this->_internal_num_ceiling_lights() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_num_ceiling_lights()); + // string current_wind_string = 5; + if (!this->_internal_current_wind_string().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_current_wind_string()); } - // int32 num_table_lights = 10; - if (this->_internal_num_table_lights() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_num_table_lights()); + // string sunrise_string = 6; + if (!this->_internal_sunrise_string().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_sunrise_string()); } - // int32 num_ceiling_lights_on = 11; - if (this->_internal_num_ceiling_lights_on() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_num_ceiling_lights_on()); + // string sunset_string = 7; + if (!this->_internal_sunset_string().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_sunset_string()); } - // int32 num_table_lights_on = 12; - if (this->_internal_num_table_lights_on() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_num_table_lights_on()); + // string current_precipitation_string = 8; + if (!this->_internal_current_precipitation_string().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_current_precipitation_string()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -void NSPanelRoomStatus::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelRoomStatus) +void NSPanelWeatherUpdate::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelWeatherUpdate) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - _this->_internal_mutable_entity_page_ids()->MergeFrom(from._internal_entity_page_ids()); - if (!from._internal_name().empty()) { - _this->_internal_set_name(from._internal_name()); - } - if (from._internal_id() != 0) { - _this->_impl_.id_ = from._impl_.id_; - } - if (from._internal_average_dim_level() != 0) { - _this->_impl_.average_dim_level_ = from._impl_.average_dim_level_; - } - if (from._internal_ceiling_lights_dim_level() != 0) { - _this->_impl_.ceiling_lights_dim_level_ = from._impl_.ceiling_lights_dim_level_; - } - if (from._internal_table_lights_dim_level() != 0) { - _this->_impl_.table_lights_dim_level_ = from._impl_.table_lights_dim_level_; - } - if (from._internal_average_color_temperature() != 0) { - _this->_impl_.average_color_temperature_ = from._impl_.average_color_temperature_; + _this->_internal_mutable_forecast_items()->MergeFrom( + from._internal_forecast_items()); + if (!from._internal_current_weather_icon().empty()) { + _this->_internal_set_current_weather_icon(from._internal_current_weather_icon()); } - if (from._internal_ceiling_lights_color_temperature_value() != 0) { - _this->_impl_.ceiling_lights_color_temperature_value_ = from._impl_.ceiling_lights_color_temperature_value_; + if (!from._internal_current_temperature_string().empty()) { + _this->_internal_set_current_temperature_string(from._internal_current_temperature_string()); } - if (from._internal_table_lights_color_temperature_value() != 0) { - _this->_impl_.table_lights_color_temperature_value_ = from._impl_.table_lights_color_temperature_value_; + if (!from._internal_current_maxmin_temperature().empty()) { + _this->_internal_set_current_maxmin_temperature(from._internal_current_maxmin_temperature()); } - if (from._internal_num_ceiling_lights() != 0) { - _this->_impl_.num_ceiling_lights_ = from._impl_.num_ceiling_lights_; + if (!from._internal_current_wind_string().empty()) { + _this->_internal_set_current_wind_string(from._internal_current_wind_string()); } - if (from._internal_num_table_lights() != 0) { - _this->_impl_.num_table_lights_ = from._impl_.num_table_lights_; + if (!from._internal_sunrise_string().empty()) { + _this->_internal_set_sunrise_string(from._internal_sunrise_string()); } - if (from._internal_num_ceiling_lights_on() != 0) { - _this->_impl_.num_ceiling_lights_on_ = from._impl_.num_ceiling_lights_on_; + if (!from._internal_sunset_string().empty()) { + _this->_internal_set_sunset_string(from._internal_sunset_string()); } - if (from._internal_num_table_lights_on() != 0) { - _this->_impl_.num_table_lights_on_ = from._impl_.num_table_lights_on_; + if (!from._internal_current_precipitation_string().empty()) { + _this->_internal_set_current_precipitation_string(from._internal_current_precipitation_string()); } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } -void NSPanelRoomStatus::CopyFrom(const NSPanelRoomStatus& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelRoomStatus) +void NSPanelWeatherUpdate::CopyFrom(const NSPanelWeatherUpdate& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelWeatherUpdate) if (&from == this) return; Clear(); MergeFrom(from); } -void NSPanelRoomStatus::InternalSwap(NSPanelRoomStatus* PROTOBUF_RESTRICT other) { +void NSPanelWeatherUpdate::InternalSwap(NSPanelWeatherUpdate* PROTOBUF_RESTRICT other) { using std::swap; auto* arena = GetArena(); ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); - _impl_.entity_page_ids_.InternalSwap(&other->_impl_.entity_page_ids_); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); - ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.num_table_lights_on_) - + sizeof(NSPanelRoomStatus::_impl_.num_table_lights_on_) - - PROTOBUF_FIELD_OFFSET(NSPanelRoomStatus, _impl_.id_)>( - reinterpret_cast(&_impl_.id_), - reinterpret_cast(&other->_impl_.id_)); + _impl_.forecast_items_.InternalSwap(&other->_impl_.forecast_items_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.current_weather_icon_, &other->_impl_.current_weather_icon_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.current_temperature_string_, &other->_impl_.current_temperature_string_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.current_maxmin_temperature_, &other->_impl_.current_maxmin_temperature_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.current_wind_string_, &other->_impl_.current_wind_string_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.sunrise_string_, &other->_impl_.sunrise_string_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.sunset_string_, &other->_impl_.sunset_string_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.current_precipitation_string_, &other->_impl_.current_precipitation_string_, arena); } -::google::protobuf::Metadata NSPanelRoomStatus::GetMetadata() const { +::google::protobuf::Metadata NSPanelWeatherUpdate::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } // =================================================================== -class NSPanelWeatherUpdate_ForecastItem::_Internal { +class NSPanelMQTTManagerCommand_FirstPageTurnLightOn::_Internal { public: }; -NSPanelWeatherUpdate_ForecastItem::NSPanelWeatherUpdate_ForecastItem(::google::protobuf::Arena* arena) +NSPanelMQTTManagerCommand_FirstPageTurnLightOn::NSPanelMQTTManagerCommand_FirstPageTurnLightOn(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelWeatherUpdate.ForecastItem) + // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) } -inline PROTOBUF_NDEBUG_INLINE NSPanelWeatherUpdate_ForecastItem::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::NSPanelWeatherUpdate_ForecastItem& from_msg) - : weather_icon_(arena, from.weather_icon_), - precipitation_string_(arena, from.precipitation_string_), - temperature_maxmin_string_(arena, from.temperature_maxmin_string_), - wind_string_(arena, from.wind_string_), - display_string_(arena, from.display_string_), - _cached_size_{0} {} - -NSPanelWeatherUpdate_ForecastItem::NSPanelWeatherUpdate_ForecastItem( - ::google::protobuf::Arena* arena, - const NSPanelWeatherUpdate_ForecastItem& from) - : ::google::protobuf::Message(arena) { - NSPanelWeatherUpdate_ForecastItem* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - - // @@protoc_insertion_point(copy_constructor:NSPanelWeatherUpdate.ForecastItem) +NSPanelMQTTManagerCommand_FirstPageTurnLightOn::NSPanelMQTTManagerCommand_FirstPageTurnLightOn( + ::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& from) + : NSPanelMQTTManagerCommand_FirstPageTurnLightOn(arena) { + MergeFrom(from); } -inline PROTOBUF_NDEBUG_INLINE NSPanelWeatherUpdate_ForecastItem::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_FirstPageTurnLightOn::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : weather_icon_(arena), - precipitation_string_(arena), - temperature_maxmin_string_(arena), - wind_string_(arena), - display_string_(arena), - _cached_size_{0} {} + : _cached_size_{0} {} -inline void NSPanelWeatherUpdate_ForecastItem::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelMQTTManagerCommand_FirstPageTurnLightOn::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); + ::memset(reinterpret_cast(&_impl_) + + offsetof(Impl_, affect_lights_), + 0, + offsetof(Impl_, has_kelvin_value_) - + offsetof(Impl_, affect_lights_) + + sizeof(Impl_::has_kelvin_value_)); } -NSPanelWeatherUpdate_ForecastItem::~NSPanelWeatherUpdate_ForecastItem() { - // @@protoc_insertion_point(destructor:NSPanelWeatherUpdate.ForecastItem) +NSPanelMQTTManagerCommand_FirstPageTurnLightOn::~NSPanelMQTTManagerCommand_FirstPageTurnLightOn() { + // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelWeatherUpdate_ForecastItem::SharedDtor() { +inline void NSPanelMQTTManagerCommand_FirstPageTurnLightOn::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); - _impl_.weather_icon_.Destroy(); - _impl_.precipitation_string_.Destroy(); - _impl_.temperature_maxmin_string_.Destroy(); - _impl_.wind_string_.Destroy(); - _impl_.display_string_.Destroy(); _impl_.~Impl_(); } const ::google::protobuf::MessageLite::ClassData* -NSPanelWeatherUpdate_ForecastItem::GetClassData() const { +NSPanelMQTTManagerCommand_FirstPageTurnLightOn::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_._cached_size_), false, }, - &NSPanelWeatherUpdate_ForecastItem::MergeImpl, - &NSPanelWeatherUpdate_ForecastItem::kDescriptorMethods, + &NSPanelMQTTManagerCommand_FirstPageTurnLightOn::MergeImpl, + &NSPanelMQTTManagerCommand_FirstPageTurnLightOn::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_2eproto, nullptr, // tracker }; @@ -4438,133 +5778,143 @@ NSPanelWeatherUpdate_ForecastItem::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<3, 5, 0, 124, 2> NSPanelWeatherUpdate_ForecastItem::_table_ = { +const ::_pbi::TcParseTable<3, 7, 0, 0, 2> NSPanelMQTTManagerCommand_FirstPageTurnLightOn::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 5, 56, // max_field_number, fast_idx_mask + 7, 56, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967264, // skipmap + 4294967168, // skipmap offsetof(decltype(_table_), field_entries), - 5, // num_field_entries + 7, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - &_NSPanelWeatherUpdate_ForecastItem_default_instance_._instance, + &_NSPanelMQTTManagerCommand_FirstPageTurnLightOn_default_instance_._instance, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelWeatherUpdate_ForecastItem>(), // to_prefetch + ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_FirstPageTurnLightOn>(), // to_prefetch #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, - // string weather_icon = 1; - {::_pbi::TcParser::FastUS1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.weather_icon_)}}, - // string precipitation_string = 2; - {::_pbi::TcParser::FastUS1, - {18, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.precipitation_string_)}}, - // string temperature_maxmin_string = 3; - {::_pbi::TcParser::FastUS1, - {26, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.temperature_maxmin_string_)}}, - // string wind_string = 4; - {::_pbi::TcParser::FastUS1, - {34, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.wind_string_)}}, - // string display_string = 5; - {::_pbi::TcParser::FastUS1, - {42, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.display_string_)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, + // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.affect_lights_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.affect_lights_)}}, + // int32 brightness_slider_value = 2; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.brightness_slider_value_), 63>(), + {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.brightness_slider_value_)}}, + // int32 kelvin_slider_value = 3; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.kelvin_slider_value_), 63>(), + {24, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.kelvin_slider_value_)}}, + // int32 selected_room = 4; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.selected_room_), 63>(), + {32, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.selected_room_)}}, + // bool global = 5; + {::_pbi::TcParser::SingularVarintNoZag1(), + {40, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.global_)}}, + // bool has_brightness_value = 6; + {::_pbi::TcParser::SingularVarintNoZag1(), + {48, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.has_brightness_value_)}}, + // bool has_kelvin_value = 7; + {::_pbi::TcParser::SingularVarintNoZag1(), + {56, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.has_kelvin_value_)}}, }}, {{ 65535, 65535 }}, {{ - // string weather_icon = 1; - {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.weather_icon_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // string precipitation_string = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.precipitation_string_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // string temperature_maxmin_string = 3; - {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.temperature_maxmin_string_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // string wind_string = 4; - {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.wind_string_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // string display_string = 5; - {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate_ForecastItem, _impl_.display_string_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.affect_lights_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + // int32 brightness_slider_value = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.brightness_slider_value_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 kelvin_slider_value = 3; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.kelvin_slider_value_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 selected_room = 4; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.selected_room_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // bool global = 5; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.global_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool has_brightness_value = 6; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.has_brightness_value_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool has_kelvin_value = 7; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.has_kelvin_value_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, }}, // no aux_entries {{ - "\41\14\24\31\13\16\0\0" - "NSPanelWeatherUpdate.ForecastItem" - "weather_icon" - "precipitation_string" - "temperature_maxmin_string" - "wind_string" - "display_string" }}, }; -PROTOBUF_NOINLINE void NSPanelWeatherUpdate_ForecastItem::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelWeatherUpdate.ForecastItem) +PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_FirstPageTurnLightOn::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.weather_icon_.ClearToEmpty(); - _impl_.precipitation_string_.ClearToEmpty(); - _impl_.temperature_maxmin_string_.ClearToEmpty(); - _impl_.wind_string_.ClearToEmpty(); - _impl_.display_string_.ClearToEmpty(); + ::memset(&_impl_.affect_lights_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.has_kelvin_value_) - + reinterpret_cast(&_impl_.affect_lights_)) + sizeof(_impl_.has_kelvin_value_)); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::uint8_t* NSPanelWeatherUpdate_ForecastItem::_InternalSerialize( +::uint8_t* NSPanelMQTTManagerCommand_FirstPageTurnLightOn::_InternalSerialize( ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelWeatherUpdate.ForecastItem) + // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) ::uint32_t cached_has_bits = 0; (void)cached_has_bits; - // string weather_icon = 1; - if (!this->_internal_weather_icon().empty()) { - const std::string& _s = this->_internal_weather_icon(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.ForecastItem.weather_icon"); - target = stream->WriteStringMaybeAliased(1, _s, target); + // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; + if (this->_internal_affect_lights() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 1, this->_internal_affect_lights(), target); } - // string precipitation_string = 2; - if (!this->_internal_precipitation_string().empty()) { - const std::string& _s = this->_internal_precipitation_string(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.ForecastItem.precipitation_string"); - target = stream->WriteStringMaybeAliased(2, _s, target); + // int32 brightness_slider_value = 2; + if (this->_internal_brightness_slider_value() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<2>( + stream, this->_internal_brightness_slider_value(), target); } - // string temperature_maxmin_string = 3; - if (!this->_internal_temperature_maxmin_string().empty()) { - const std::string& _s = this->_internal_temperature_maxmin_string(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.ForecastItem.temperature_maxmin_string"); - target = stream->WriteStringMaybeAliased(3, _s, target); + // int32 kelvin_slider_value = 3; + if (this->_internal_kelvin_slider_value() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<3>( + stream, this->_internal_kelvin_slider_value(), target); + } + + // int32 selected_room = 4; + if (this->_internal_selected_room() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<4>( + stream, this->_internal_selected_room(), target); } - // string wind_string = 4; - if (!this->_internal_wind_string().empty()) { - const std::string& _s = this->_internal_wind_string(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.ForecastItem.wind_string"); - target = stream->WriteStringMaybeAliased(4, _s, target); + // bool global = 5; + if (this->_internal_global() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 5, this->_internal_global(), target); } - // string display_string = 5; - if (!this->_internal_display_string().empty()) { - const std::string& _s = this->_internal_display_string(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.ForecastItem.display_string"); - target = stream->WriteStringMaybeAliased(5, _s, target); + // bool has_brightness_value = 6; + if (this->_internal_has_brightness_value() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 6, this->_internal_has_brightness_value(), target); + } + + // bool has_kelvin_value = 7; + if (this->_internal_has_kelvin_value() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 7, this->_internal_has_kelvin_value(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -4572,12 +5922,12 @@ ::uint8_t* NSPanelWeatherUpdate_ForecastItem::_InternalSerialize( ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelWeatherUpdate.ForecastItem) + // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) return target; } -::size_t NSPanelWeatherUpdate_ForecastItem::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelWeatherUpdate.ForecastItem) +::size_t NSPanelMQTTManagerCommand_FirstPageTurnLightOn::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) ::size_t total_size = 0; ::uint32_t cached_has_bits = 0; @@ -4585,171 +5935,156 @@ ::size_t NSPanelWeatherUpdate_ForecastItem::ByteSizeLong() const { (void) cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); - // string weather_icon = 1; - if (!this->_internal_weather_icon().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_weather_icon()); + // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; + if (this->_internal_affect_lights() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_affect_lights()); } - // string precipitation_string = 2; - if (!this->_internal_precipitation_string().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_precipitation_string()); + // int32 brightness_slider_value = 2; + if (this->_internal_brightness_slider_value() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_brightness_slider_value()); } - // string temperature_maxmin_string = 3; - if (!this->_internal_temperature_maxmin_string().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_temperature_maxmin_string()); + // int32 kelvin_slider_value = 3; + if (this->_internal_kelvin_slider_value() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_kelvin_slider_value()); } - // string wind_string = 4; - if (!this->_internal_wind_string().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_wind_string()); + // int32 selected_room = 4; + if (this->_internal_selected_room() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_selected_room()); } - // string display_string = 5; - if (!this->_internal_display_string().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_display_string()); + // bool global = 5; + if (this->_internal_global() != 0) { + total_size += 2; + } + + // bool has_brightness_value = 6; + if (this->_internal_has_brightness_value() != 0) { + total_size += 2; + } + + // bool has_kelvin_value = 7; + if (this->_internal_has_kelvin_value() != 0) { + total_size += 2; } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -void NSPanelWeatherUpdate_ForecastItem::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelWeatherUpdate.ForecastItem) +void NSPanelMQTTManagerCommand_FirstPageTurnLightOn::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (!from._internal_weather_icon().empty()) { - _this->_internal_set_weather_icon(from._internal_weather_icon()); + if (from._internal_affect_lights() != 0) { + _this->_impl_.affect_lights_ = from._impl_.affect_lights_; } - if (!from._internal_precipitation_string().empty()) { - _this->_internal_set_precipitation_string(from._internal_precipitation_string()); + if (from._internal_brightness_slider_value() != 0) { + _this->_impl_.brightness_slider_value_ = from._impl_.brightness_slider_value_; } - if (!from._internal_temperature_maxmin_string().empty()) { - _this->_internal_set_temperature_maxmin_string(from._internal_temperature_maxmin_string()); + if (from._internal_kelvin_slider_value() != 0) { + _this->_impl_.kelvin_slider_value_ = from._impl_.kelvin_slider_value_; } - if (!from._internal_wind_string().empty()) { - _this->_internal_set_wind_string(from._internal_wind_string()); + if (from._internal_selected_room() != 0) { + _this->_impl_.selected_room_ = from._impl_.selected_room_; } - if (!from._internal_display_string().empty()) { - _this->_internal_set_display_string(from._internal_display_string()); + if (from._internal_global() != 0) { + _this->_impl_.global_ = from._impl_.global_; + } + if (from._internal_has_brightness_value() != 0) { + _this->_impl_.has_brightness_value_ = from._impl_.has_brightness_value_; + } + if (from._internal_has_kelvin_value() != 0) { + _this->_impl_.has_kelvin_value_ = from._impl_.has_kelvin_value_; } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } -void NSPanelWeatherUpdate_ForecastItem::CopyFrom(const NSPanelWeatherUpdate_ForecastItem& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelWeatherUpdate.ForecastItem) +void NSPanelMQTTManagerCommand_FirstPageTurnLightOn::CopyFrom(const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) if (&from == this) return; Clear(); MergeFrom(from); } -void NSPanelWeatherUpdate_ForecastItem::InternalSwap(NSPanelWeatherUpdate_ForecastItem* PROTOBUF_RESTRICT other) { +void NSPanelMQTTManagerCommand_FirstPageTurnLightOn::InternalSwap(NSPanelMQTTManagerCommand_FirstPageTurnLightOn* PROTOBUF_RESTRICT other) { using std::swap; - auto* arena = GetArena(); - ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.weather_icon_, &other->_impl_.weather_icon_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.precipitation_string_, &other->_impl_.precipitation_string_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.temperature_maxmin_string_, &other->_impl_.temperature_maxmin_string_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.wind_string_, &other->_impl_.wind_string_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.display_string_, &other->_impl_.display_string_, arena); + ::google::protobuf::internal::memswap< + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.has_kelvin_value_) + + sizeof(NSPanelMQTTManagerCommand_FirstPageTurnLightOn::_impl_.has_kelvin_value_) + - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.affect_lights_)>( + reinterpret_cast(&_impl_.affect_lights_), + reinterpret_cast(&other->_impl_.affect_lights_)); } -::google::protobuf::Metadata NSPanelWeatherUpdate_ForecastItem::GetMetadata() const { +::google::protobuf::Metadata NSPanelMQTTManagerCommand_FirstPageTurnLightOn::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } // =================================================================== -class NSPanelWeatherUpdate::_Internal { +class NSPanelMQTTManagerCommand_FirstPageTurnLightOff::_Internal { public: }; -NSPanelWeatherUpdate::NSPanelWeatherUpdate(::google::protobuf::Arena* arena) +NSPanelMQTTManagerCommand_FirstPageTurnLightOff::NSPanelMQTTManagerCommand_FirstPageTurnLightOff(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelWeatherUpdate) + // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) } -inline PROTOBUF_NDEBUG_INLINE NSPanelWeatherUpdate::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::NSPanelWeatherUpdate& from_msg) - : forecast_items_{visibility, arena, from.forecast_items_}, - current_weather_icon_(arena, from.current_weather_icon_), - current_temperature_string_(arena, from.current_temperature_string_), - current_maxmin_temperature_(arena, from.current_maxmin_temperature_), - current_wind_string_(arena, from.current_wind_string_), - sunrise_string_(arena, from.sunrise_string_), - sunset_string_(arena, from.sunset_string_), - current_precipitation_string_(arena, from.current_precipitation_string_), - _cached_size_{0} {} - -NSPanelWeatherUpdate::NSPanelWeatherUpdate( - ::google::protobuf::Arena* arena, - const NSPanelWeatherUpdate& from) - : ::google::protobuf::Message(arena) { - NSPanelWeatherUpdate* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - - // @@protoc_insertion_point(copy_constructor:NSPanelWeatherUpdate) +NSPanelMQTTManagerCommand_FirstPageTurnLightOff::NSPanelMQTTManagerCommand_FirstPageTurnLightOff( + ::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& from) + : NSPanelMQTTManagerCommand_FirstPageTurnLightOff(arena) { + MergeFrom(from); } -inline PROTOBUF_NDEBUG_INLINE NSPanelWeatherUpdate::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_FirstPageTurnLightOff::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : forecast_items_{visibility, arena}, - current_weather_icon_(arena), - current_temperature_string_(arena), - current_maxmin_temperature_(arena), - current_wind_string_(arena), - sunrise_string_(arena), - sunset_string_(arena), - current_precipitation_string_(arena), - _cached_size_{0} {} + : _cached_size_{0} {} -inline void NSPanelWeatherUpdate::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelMQTTManagerCommand_FirstPageTurnLightOff::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); + ::memset(reinterpret_cast(&_impl_) + + offsetof(Impl_, affect_lights_), + 0, + offsetof(Impl_, global_) - + offsetof(Impl_, affect_lights_) + + sizeof(Impl_::global_)); } -NSPanelWeatherUpdate::~NSPanelWeatherUpdate() { - // @@protoc_insertion_point(destructor:NSPanelWeatherUpdate) +NSPanelMQTTManagerCommand_FirstPageTurnLightOff::~NSPanelMQTTManagerCommand_FirstPageTurnLightOff() { + // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelWeatherUpdate::SharedDtor() { +inline void NSPanelMQTTManagerCommand_FirstPageTurnLightOff::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); - _impl_.current_weather_icon_.Destroy(); - _impl_.current_temperature_string_.Destroy(); - _impl_.current_maxmin_temperature_.Destroy(); - _impl_.current_wind_string_.Destroy(); - _impl_.sunrise_string_.Destroy(); - _impl_.sunset_string_.Destroy(); - _impl_.current_precipitation_string_.Destroy(); _impl_.~Impl_(); } const ::google::protobuf::MessageLite::ClassData* -NSPanelWeatherUpdate::GetClassData() const { +NSPanelMQTTManagerCommand_FirstPageTurnLightOff::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOff, _impl_._cached_size_), false, }, - &NSPanelWeatherUpdate::MergeImpl, - &NSPanelWeatherUpdate::kDescriptorMethods, + &NSPanelMQTTManagerCommand_FirstPageTurnLightOff::MergeImpl, + &NSPanelMQTTManagerCommand_FirstPageTurnLightOff::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_2eproto, nullptr, // tracker }; @@ -4758,180 +6093,77 @@ NSPanelWeatherUpdate::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<3, 8, 1, 183, 2> NSPanelWeatherUpdate::_table_ = { +const ::_pbi::TcParseTable<1, 2, 0, 0, 2> NSPanelMQTTManagerCommand_FirstPageTurnLightOff::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 8, 56, // max_field_number, fast_idx_mask + 2, 8, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967040, // skipmap + 4294967292, // skipmap offsetof(decltype(_table_), field_entries), - 8, // num_field_entries - 1, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - &_NSPanelWeatherUpdate_default_instance_._instance, - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelWeatherUpdate>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // string current_precipitation_string = 8; - {::_pbi::TcParser::FastUS1, - {66, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_precipitation_string_)}}, - // repeated .NSPanelWeatherUpdate.ForecastItem forecast_items = 1; - {::_pbi::TcParser::FastMtR1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.forecast_items_)}}, - // string current_weather_icon = 2; - {::_pbi::TcParser::FastUS1, - {18, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_weather_icon_)}}, - // string current_temperature_string = 3; - {::_pbi::TcParser::FastUS1, - {26, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_temperature_string_)}}, - // string current_maxmin_temperature = 4; - {::_pbi::TcParser::FastUS1, - {34, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_maxmin_temperature_)}}, - // string current_wind_string = 5; - {::_pbi::TcParser::FastUS1, - {42, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_wind_string_)}}, - // string sunrise_string = 6; - {::_pbi::TcParser::FastUS1, - {50, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.sunrise_string_)}}, - // string sunset_string = 7; - {::_pbi::TcParser::FastUS1, - {58, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.sunset_string_)}}, + 2, // num_field_entries + 0, // num_aux_entries + offsetof(decltype(_table_), field_names), // no aux_entries + &_NSPanelMQTTManagerCommand_FirstPageTurnLightOff_default_instance_._instance, + nullptr, // post_loop_handler + ::_pbi::TcParser::GenericFallback, // fallback + #ifdef PROTOBUF_PREFETCH_PARSE_TABLE + ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_FirstPageTurnLightOff>(), // to_prefetch + #endif // PROTOBUF_PREFETCH_PARSE_TABLE + }, {{ + // bool global = 2; + {::_pbi::TcParser::SingularVarintNoZag1(), + {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOff, _impl_.global_)}}, + // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_FirstPageTurnLightOff, _impl_.affect_lights_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOff, _impl_.affect_lights_)}}, }}, {{ 65535, 65535 }}, {{ - // repeated .NSPanelWeatherUpdate.ForecastItem forecast_items = 1; - {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.forecast_items_), 0, 0, - (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - // string current_weather_icon = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_weather_icon_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // string current_temperature_string = 3; - {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_temperature_string_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // string current_maxmin_temperature = 4; - {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_maxmin_temperature_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // string current_wind_string = 5; - {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_wind_string_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // string sunrise_string = 6; - {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.sunrise_string_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // string sunset_string = 7; - {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.sunset_string_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // string current_precipitation_string = 8; - {PROTOBUF_FIELD_OFFSET(NSPanelWeatherUpdate, _impl_.current_precipitation_string_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - }}, {{ - {::_pbi::TcParser::GetTable<::NSPanelWeatherUpdate_ForecastItem>()}, - }}, {{ - "\24\0\24\32\32\23\16\15\34\0\0\0\0\0\0\0" - "NSPanelWeatherUpdate" - "current_weather_icon" - "current_temperature_string" - "current_maxmin_temperature" - "current_wind_string" - "sunrise_string" - "sunset_string" - "current_precipitation_string" + // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOff, _impl_.affect_lights_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + // bool global = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOff, _impl_.global_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + }}, + // no aux_entries + {{ }}, }; -PROTOBUF_NOINLINE void NSPanelWeatherUpdate::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelWeatherUpdate) +PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_FirstPageTurnLightOff::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.forecast_items_.Clear(); - _impl_.current_weather_icon_.ClearToEmpty(); - _impl_.current_temperature_string_.ClearToEmpty(); - _impl_.current_maxmin_temperature_.ClearToEmpty(); - _impl_.current_wind_string_.ClearToEmpty(); - _impl_.sunrise_string_.ClearToEmpty(); - _impl_.sunset_string_.ClearToEmpty(); - _impl_.current_precipitation_string_.ClearToEmpty(); + ::memset(&_impl_.affect_lights_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.global_) - + reinterpret_cast(&_impl_.affect_lights_)) + sizeof(_impl_.global_)); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::uint8_t* NSPanelWeatherUpdate::_InternalSerialize( +::uint8_t* NSPanelMQTTManagerCommand_FirstPageTurnLightOff::_InternalSerialize( ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelWeatherUpdate) + // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) ::uint32_t cached_has_bits = 0; (void)cached_has_bits; - // repeated .NSPanelWeatherUpdate.ForecastItem forecast_items = 1; - for (unsigned i = 0, n = static_cast( - this->_internal_forecast_items_size()); - i < n; i++) { - const auto& repfield = this->_internal_forecast_items().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 1, repfield, repfield.GetCachedSize(), - target, stream); - } - - // string current_weather_icon = 2; - if (!this->_internal_current_weather_icon().empty()) { - const std::string& _s = this->_internal_current_weather_icon(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.current_weather_icon"); - target = stream->WriteStringMaybeAliased(2, _s, target); - } - - // string current_temperature_string = 3; - if (!this->_internal_current_temperature_string().empty()) { - const std::string& _s = this->_internal_current_temperature_string(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.current_temperature_string"); - target = stream->WriteStringMaybeAliased(3, _s, target); - } - - // string current_maxmin_temperature = 4; - if (!this->_internal_current_maxmin_temperature().empty()) { - const std::string& _s = this->_internal_current_maxmin_temperature(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.current_maxmin_temperature"); - target = stream->WriteStringMaybeAliased(4, _s, target); - } - - // string current_wind_string = 5; - if (!this->_internal_current_wind_string().empty()) { - const std::string& _s = this->_internal_current_wind_string(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.current_wind_string"); - target = stream->WriteStringMaybeAliased(5, _s, target); - } - - // string sunrise_string = 6; - if (!this->_internal_sunrise_string().empty()) { - const std::string& _s = this->_internal_sunrise_string(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.sunrise_string"); - target = stream->WriteStringMaybeAliased(6, _s, target); - } - - // string sunset_string = 7; - if (!this->_internal_sunset_string().empty()) { - const std::string& _s = this->_internal_sunset_string(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.sunset_string"); - target = stream->WriteStringMaybeAliased(7, _s, target); + // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; + if (this->_internal_affect_lights() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 1, this->_internal_affect_lights(), target); } - // string current_precipitation_string = 8; - if (!this->_internal_current_precipitation_string().empty()) { - const std::string& _s = this->_internal_current_precipitation_string(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelWeatherUpdate.current_precipitation_string"); - target = stream->WriteStringMaybeAliased(8, _s, target); + // bool global = 2; + if (this->_internal_global() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 2, this->_internal_global(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -4939,12 +6171,12 @@ ::uint8_t* NSPanelWeatherUpdate::_InternalSerialize( ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelWeatherUpdate) + // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) return target; } -::size_t NSPanelWeatherUpdate::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelWeatherUpdate) +::size_t NSPanelMQTTManagerCommand_FirstPageTurnLightOff::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) ::size_t total_size = 0; ::uint32_t cached_has_bits = 0; @@ -4952,170 +6184,136 @@ ::size_t NSPanelWeatherUpdate::ByteSizeLong() const { (void) cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); - // repeated .NSPanelWeatherUpdate.ForecastItem forecast_items = 1; - total_size += 1UL * this->_internal_forecast_items_size(); - for (const auto& msg : this->_internal_forecast_items()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - // string current_weather_icon = 2; - if (!this->_internal_current_weather_icon().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_current_weather_icon()); - } - - // string current_temperature_string = 3; - if (!this->_internal_current_temperature_string().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_current_temperature_string()); - } - - // string current_maxmin_temperature = 4; - if (!this->_internal_current_maxmin_temperature().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_current_maxmin_temperature()); - } - - // string current_wind_string = 5; - if (!this->_internal_current_wind_string().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_current_wind_string()); - } - - // string sunrise_string = 6; - if (!this->_internal_sunrise_string().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_sunrise_string()); - } - - // string sunset_string = 7; - if (!this->_internal_sunset_string().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_sunset_string()); + // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; + if (this->_internal_affect_lights() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_affect_lights()); } - // string current_precipitation_string = 8; - if (!this->_internal_current_precipitation_string().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_current_precipitation_string()); + // bool global = 2; + if (this->_internal_global() != 0) { + total_size += 2; } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -void NSPanelWeatherUpdate::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelWeatherUpdate) +void NSPanelMQTTManagerCommand_FirstPageTurnLightOff::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - _this->_internal_mutable_forecast_items()->MergeFrom( - from._internal_forecast_items()); - if (!from._internal_current_weather_icon().empty()) { - _this->_internal_set_current_weather_icon(from._internal_current_weather_icon()); - } - if (!from._internal_current_temperature_string().empty()) { - _this->_internal_set_current_temperature_string(from._internal_current_temperature_string()); - } - if (!from._internal_current_maxmin_temperature().empty()) { - _this->_internal_set_current_maxmin_temperature(from._internal_current_maxmin_temperature()); - } - if (!from._internal_current_wind_string().empty()) { - _this->_internal_set_current_wind_string(from._internal_current_wind_string()); - } - if (!from._internal_sunrise_string().empty()) { - _this->_internal_set_sunrise_string(from._internal_sunrise_string()); - } - if (!from._internal_sunset_string().empty()) { - _this->_internal_set_sunset_string(from._internal_sunset_string()); + if (from._internal_affect_lights() != 0) { + _this->_impl_.affect_lights_ = from._impl_.affect_lights_; } - if (!from._internal_current_precipitation_string().empty()) { - _this->_internal_set_current_precipitation_string(from._internal_current_precipitation_string()); + if (from._internal_global() != 0) { + _this->_impl_.global_ = from._impl_.global_; } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } -void NSPanelWeatherUpdate::CopyFrom(const NSPanelWeatherUpdate& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelWeatherUpdate) +void NSPanelMQTTManagerCommand_FirstPageTurnLightOff::CopyFrom(const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) if (&from == this) return; Clear(); MergeFrom(from); } -void NSPanelWeatherUpdate::InternalSwap(NSPanelWeatherUpdate* PROTOBUF_RESTRICT other) { +void NSPanelMQTTManagerCommand_FirstPageTurnLightOff::InternalSwap(NSPanelMQTTManagerCommand_FirstPageTurnLightOff* PROTOBUF_RESTRICT other) { using std::swap; - auto* arena = GetArena(); - ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); - _impl_.forecast_items_.InternalSwap(&other->_impl_.forecast_items_); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.current_weather_icon_, &other->_impl_.current_weather_icon_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.current_temperature_string_, &other->_impl_.current_temperature_string_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.current_maxmin_temperature_, &other->_impl_.current_maxmin_temperature_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.current_wind_string_, &other->_impl_.current_wind_string_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.sunrise_string_, &other->_impl_.sunrise_string_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.sunset_string_, &other->_impl_.sunset_string_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.current_precipitation_string_, &other->_impl_.current_precipitation_string_, arena); + ::google::protobuf::internal::memswap< + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOff, _impl_.global_) + + sizeof(NSPanelMQTTManagerCommand_FirstPageTurnLightOff::_impl_.global_) + - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOff, _impl_.affect_lights_)>( + reinterpret_cast(&_impl_.affect_lights_), + reinterpret_cast(&other->_impl_.affect_lights_)); } -::google::protobuf::Metadata NSPanelWeatherUpdate::GetMetadata() const { +::google::protobuf::Metadata NSPanelMQTTManagerCommand_FirstPageTurnLightOff::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } // =================================================================== -class NSPanelMQTTManagerCommand_FirstPageTurnLightOn::_Internal { +class NSPanelMQTTManagerCommand_LightCommand::_Internal { public: }; -NSPanelMQTTManagerCommand_FirstPageTurnLightOn::NSPanelMQTTManagerCommand_FirstPageTurnLightOn(::google::protobuf::Arena* arena) +NSPanelMQTTManagerCommand_LightCommand::NSPanelMQTTManagerCommand_LightCommand(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) + // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.LightCommand) } -NSPanelMQTTManagerCommand_FirstPageTurnLightOn::NSPanelMQTTManagerCommand_FirstPageTurnLightOn( - ::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& from) - : NSPanelMQTTManagerCommand_FirstPageTurnLightOn(arena) { - MergeFrom(from); +inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_LightCommand::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from, const ::NSPanelMQTTManagerCommand_LightCommand& from_msg) + : light_ids_{visibility, arena, from.light_ids_}, + _light_ids_cached_byte_size_{0}, + _cached_size_{0} {} + +NSPanelMQTTManagerCommand_LightCommand::NSPanelMQTTManagerCommand_LightCommand( + ::google::protobuf::Arena* arena, + const NSPanelMQTTManagerCommand_LightCommand& from) + : ::google::protobuf::Message(arena) { + NSPanelMQTTManagerCommand_LightCommand* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); + ::memcpy(reinterpret_cast(&_impl_) + + offsetof(Impl_, brightness_), + reinterpret_cast(&from._impl_) + + offsetof(Impl_, brightness_), + offsetof(Impl_, saturation_) - + offsetof(Impl_, brightness_) + + sizeof(Impl_::saturation_)); + + // @@protoc_insertion_point(copy_constructor:NSPanelMQTTManagerCommand.LightCommand) } -inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_FirstPageTurnLightOn::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_LightCommand::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : _cached_size_{0} {} + : light_ids_{visibility, arena}, + _light_ids_cached_byte_size_{0}, + _cached_size_{0} {} -inline void NSPanelMQTTManagerCommand_FirstPageTurnLightOn::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelMQTTManagerCommand_LightCommand::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, affect_lights_), + offsetof(Impl_, brightness_), 0, - offsetof(Impl_, has_kelvin_value_) - - offsetof(Impl_, affect_lights_) + - sizeof(Impl_::has_kelvin_value_)); + offsetof(Impl_, saturation_) - + offsetof(Impl_, brightness_) + + sizeof(Impl_::saturation_)); } -NSPanelMQTTManagerCommand_FirstPageTurnLightOn::~NSPanelMQTTManagerCommand_FirstPageTurnLightOn() { - // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) +NSPanelMQTTManagerCommand_LightCommand::~NSPanelMQTTManagerCommand_LightCommand() { + // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.LightCommand) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelMQTTManagerCommand_FirstPageTurnLightOn::SharedDtor() { +inline void NSPanelMQTTManagerCommand_LightCommand::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); _impl_.~Impl_(); } const ::google::protobuf::MessageLite::ClassData* -NSPanelMQTTManagerCommand_FirstPageTurnLightOn::GetClassData() const { +NSPanelMQTTManagerCommand_LightCommand::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_._cached_size_), false, }, - &NSPanelMQTTManagerCommand_FirstPageTurnLightOn::MergeImpl, - &NSPanelMQTTManagerCommand_FirstPageTurnLightOn::kDescriptorMethods, + &NSPanelMQTTManagerCommand_LightCommand::MergeImpl, + &NSPanelMQTTManagerCommand_LightCommand::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_2eproto, nullptr, // tracker }; @@ -5124,143 +6322,178 @@ NSPanelMQTTManagerCommand_FirstPageTurnLightOn::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<3, 7, 0, 0, 2> NSPanelMQTTManagerCommand_FirstPageTurnLightOn::_table_ = { +const ::_pbi::TcParseTable<4, 9, 0, 0, 2> NSPanelMQTTManagerCommand_LightCommand::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 7, 56, // max_field_number, fast_idx_mask + 9, 120, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967168, // skipmap + 4294966784, // skipmap offsetof(decltype(_table_), field_entries), - 7, // num_field_entries + 9, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - &_NSPanelMQTTManagerCommand_FirstPageTurnLightOn_default_instance_._instance, + &_NSPanelMQTTManagerCommand_LightCommand_default_instance_._instance, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_FirstPageTurnLightOn>(), // to_prefetch + ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_LightCommand>(), // to_prefetch #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, - // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.affect_lights_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.affect_lights_)}}, - // int32 brightness_slider_value = 2; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.brightness_slider_value_), 63>(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.brightness_slider_value_)}}, - // int32 kelvin_slider_value = 3; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.kelvin_slider_value_), 63>(), - {24, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.kelvin_slider_value_)}}, - // int32 selected_room = 4; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.selected_room_), 63>(), - {32, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.selected_room_)}}, - // bool global = 5; - {::_pbi::TcParser::SingularVarintNoZag1(), - {40, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.global_)}}, - // bool has_brightness_value = 6; - {::_pbi::TcParser::SingularVarintNoZag1(), - {48, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.has_brightness_value_)}}, - // bool has_kelvin_value = 7; - {::_pbi::TcParser::SingularVarintNoZag1(), - {56, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.has_kelvin_value_)}}, + // repeated int32 light_ids = 1; + {::_pbi::TcParser::FastV32P1, + {10, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.light_ids_)}}, + // bool has_brightness = 2; + {::_pbi::TcParser::SingularVarintNoZag1(), + {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.has_brightness_)}}, + // int32 brightness = 3; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_LightCommand, _impl_.brightness_), 63>(), + {24, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.brightness_)}}, + // bool has_color_temperature = 4; + {::_pbi::TcParser::SingularVarintNoZag1(), + {32, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.has_color_temperature_)}}, + // int32 color_temperature = 5; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_LightCommand, _impl_.color_temperature_), 63>(), + {40, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.color_temperature_)}}, + // bool has_hue = 6; + {::_pbi::TcParser::SingularVarintNoZag1(), + {48, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.has_hue_)}}, + // int32 hue = 7; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_LightCommand, _impl_.hue_), 63>(), + {56, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.hue_)}}, + // bool has_saturation = 8; + {::_pbi::TcParser::SingularVarintNoZag1(), + {64, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.has_saturation_)}}, + // int32 saturation = 9; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_LightCommand, _impl_.saturation_), 63>(), + {72, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.saturation_)}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, }}, {{ 65535, 65535 }}, {{ - // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.affect_lights_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, - // int32 brightness_slider_value = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.brightness_slider_value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 kelvin_slider_value = 3; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.kelvin_slider_value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 selected_room = 4; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.selected_room_), 0, 0, + // repeated int32 light_ids = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.light_ids_), 0, 0, + (0 | ::_fl::kFcRepeated | ::_fl::kPackedInt32)}, + // bool has_brightness = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.has_brightness_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // int32 brightness = 3; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.brightness_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // bool global = 5; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.global_), 0, 0, + // bool has_color_temperature = 4; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.has_color_temperature_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // bool has_brightness_value = 6; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.has_brightness_value_), 0, 0, + // int32 color_temperature = 5; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.color_temperature_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // bool has_hue = 6; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.has_hue_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // bool has_kelvin_value = 7; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.has_kelvin_value_), 0, 0, + // int32 hue = 7; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.hue_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // bool has_saturation = 8; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.has_saturation_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // int32 saturation = 9; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.saturation_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, }}, // no aux_entries {{ }}, }; -PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_FirstPageTurnLightOn::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) +PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_LightCommand::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.LightCommand) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - ::memset(&_impl_.affect_lights_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.has_kelvin_value_) - - reinterpret_cast(&_impl_.affect_lights_)) + sizeof(_impl_.has_kelvin_value_)); + _impl_.light_ids_.Clear(); + ::memset(&_impl_.brightness_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.saturation_) - + reinterpret_cast(&_impl_.brightness_)) + sizeof(_impl_.saturation_)); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::uint8_t* NSPanelMQTTManagerCommand_FirstPageTurnLightOn::_InternalSerialize( +::uint8_t* NSPanelMQTTManagerCommand_LightCommand::_InternalSerialize( ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) + // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.LightCommand) ::uint32_t cached_has_bits = 0; (void)cached_has_bits; - // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; - if (this->_internal_affect_lights() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 1, this->_internal_affect_lights(), target); + // repeated int32 light_ids = 1; + { + int byte_size = _impl_._light_ids_cached_byte_size_.Get(); + if (byte_size > 0) { + target = stream->WriteInt32Packed( + 1, _internal_light_ids(), byte_size, target); + } } - // int32 brightness_slider_value = 2; - if (this->_internal_brightness_slider_value() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this->_internal_brightness_slider_value(), target); + // bool has_brightness = 2; + if (this->_internal_has_brightness() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 2, this->_internal_has_brightness(), target); } - // int32 kelvin_slider_value = 3; - if (this->_internal_kelvin_slider_value() != 0) { + // int32 brightness = 3; + if (this->_internal_brightness() != 0) { target = ::google::protobuf::internal::WireFormatLite:: WriteInt32ToArrayWithField<3>( - stream, this->_internal_kelvin_slider_value(), target); + stream, this->_internal_brightness(), target); } - // int32 selected_room = 4; - if (this->_internal_selected_room() != 0) { + // bool has_color_temperature = 4; + if (this->_internal_has_color_temperature() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 4, this->_internal_has_color_temperature(), target); + } + + // int32 color_temperature = 5; + if (this->_internal_color_temperature() != 0) { target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<4>( - stream, this->_internal_selected_room(), target); + WriteInt32ToArrayWithField<5>( + stream, this->_internal_color_temperature(), target); } - // bool global = 5; - if (this->_internal_global() != 0) { + // bool has_hue = 6; + if (this->_internal_has_hue() != 0) { target = stream->EnsureSpace(target); target = ::_pbi::WireFormatLite::WriteBoolToArray( - 5, this->_internal_global(), target); + 6, this->_internal_has_hue(), target); } - // bool has_brightness_value = 6; - if (this->_internal_has_brightness_value() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 6, this->_internal_has_brightness_value(), target); + // int32 hue = 7; + if (this->_internal_hue() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<7>( + stream, this->_internal_hue(), target); } - // bool has_kelvin_value = 7; - if (this->_internal_has_kelvin_value() != 0) { + // bool has_saturation = 8; + if (this->_internal_has_saturation() != 0) { target = stream->EnsureSpace(target); target = ::_pbi::WireFormatLite::WriteBoolToArray( - 7, this->_internal_has_kelvin_value(), target); + 8, this->_internal_has_saturation(), target); + } + + // int32 saturation = 9; + if (this->_internal_saturation() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<9>( + stream, this->_internal_saturation(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -5268,12 +6501,12 @@ ::uint8_t* NSPanelMQTTManagerCommand_FirstPageTurnLightOn::_InternalSerialize( ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) + // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.LightCommand) return target; } -::size_t NSPanelMQTTManagerCommand_FirstPageTurnLightOn::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) +::size_t NSPanelMQTTManagerCommand_LightCommand::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.LightCommand) ::size_t total_size = 0; ::uint32_t cached_has_bits = 0; @@ -5281,156 +6514,179 @@ ::size_t NSPanelMQTTManagerCommand_FirstPageTurnLightOn::ByteSizeLong() const { (void) cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); - // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; - if (this->_internal_affect_lights() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this->_internal_affect_lights()); + // repeated int32 light_ids = 1; + { + std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( + this->_internal_light_ids()) + ; + _impl_._light_ids_cached_byte_size_.Set(::_pbi::ToCachedSize(data_size)); + std::size_t tag_size = data_size == 0 + ? 0 + : 1 + ::_pbi::WireFormatLite::Int32Size( + static_cast(data_size)) + ; + total_size += tag_size + data_size; } - - // int32 brightness_slider_value = 2; - if (this->_internal_brightness_slider_value() != 0) { + // int32 brightness = 3; + if (this->_internal_brightness() != 0) { total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_brightness_slider_value()); + this->_internal_brightness()); } - // int32 kelvin_slider_value = 3; - if (this->_internal_kelvin_slider_value() != 0) { + // int32 color_temperature = 5; + if (this->_internal_color_temperature() != 0) { total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_kelvin_slider_value()); + this->_internal_color_temperature()); } - // int32 selected_room = 4; - if (this->_internal_selected_room() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_selected_room()); + // bool has_brightness = 2; + if (this->_internal_has_brightness() != 0) { + total_size += 2; } - // bool global = 5; - if (this->_internal_global() != 0) { + // bool has_color_temperature = 4; + if (this->_internal_has_color_temperature() != 0) { total_size += 2; } - // bool has_brightness_value = 6; - if (this->_internal_has_brightness_value() != 0) { + // bool has_hue = 6; + if (this->_internal_has_hue() != 0) { total_size += 2; } - // bool has_kelvin_value = 7; - if (this->_internal_has_kelvin_value() != 0) { + // bool has_saturation = 8; + if (this->_internal_has_saturation() != 0) { total_size += 2; } + // int32 hue = 7; + if (this->_internal_hue() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_hue()); + } + + // int32 saturation = 9; + if (this->_internal_saturation() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_saturation()); + } + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -void NSPanelMQTTManagerCommand_FirstPageTurnLightOn::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) +void NSPanelMQTTManagerCommand_LightCommand::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.LightCommand) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_affect_lights() != 0) { - _this->_impl_.affect_lights_ = from._impl_.affect_lights_; + _this->_internal_mutable_light_ids()->MergeFrom(from._internal_light_ids()); + if (from._internal_brightness() != 0) { + _this->_impl_.brightness_ = from._impl_.brightness_; } - if (from._internal_brightness_slider_value() != 0) { - _this->_impl_.brightness_slider_value_ = from._impl_.brightness_slider_value_; + if (from._internal_color_temperature() != 0) { + _this->_impl_.color_temperature_ = from._impl_.color_temperature_; } - if (from._internal_kelvin_slider_value() != 0) { - _this->_impl_.kelvin_slider_value_ = from._impl_.kelvin_slider_value_; + if (from._internal_has_brightness() != 0) { + _this->_impl_.has_brightness_ = from._impl_.has_brightness_; } - if (from._internal_selected_room() != 0) { - _this->_impl_.selected_room_ = from._impl_.selected_room_; + if (from._internal_has_color_temperature() != 0) { + _this->_impl_.has_color_temperature_ = from._impl_.has_color_temperature_; } - if (from._internal_global() != 0) { - _this->_impl_.global_ = from._impl_.global_; + if (from._internal_has_hue() != 0) { + _this->_impl_.has_hue_ = from._impl_.has_hue_; } - if (from._internal_has_brightness_value() != 0) { - _this->_impl_.has_brightness_value_ = from._impl_.has_brightness_value_; + if (from._internal_has_saturation() != 0) { + _this->_impl_.has_saturation_ = from._impl_.has_saturation_; } - if (from._internal_has_kelvin_value() != 0) { - _this->_impl_.has_kelvin_value_ = from._impl_.has_kelvin_value_; + if (from._internal_hue() != 0) { + _this->_impl_.hue_ = from._impl_.hue_; + } + if (from._internal_saturation() != 0) { + _this->_impl_.saturation_ = from._impl_.saturation_; } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } -void NSPanelMQTTManagerCommand_FirstPageTurnLightOn::CopyFrom(const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) +void NSPanelMQTTManagerCommand_LightCommand::CopyFrom(const NSPanelMQTTManagerCommand_LightCommand& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.LightCommand) if (&from == this) return; Clear(); MergeFrom(from); } -void NSPanelMQTTManagerCommand_FirstPageTurnLightOn::InternalSwap(NSPanelMQTTManagerCommand_FirstPageTurnLightOn* PROTOBUF_RESTRICT other) { +void NSPanelMQTTManagerCommand_LightCommand::InternalSwap(NSPanelMQTTManagerCommand_LightCommand* PROTOBUF_RESTRICT other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); + _impl_.light_ids_.InternalSwap(&other->_impl_.light_ids_); ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.has_kelvin_value_) - + sizeof(NSPanelMQTTManagerCommand_FirstPageTurnLightOn::_impl_.has_kelvin_value_) - - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOn, _impl_.affect_lights_)>( - reinterpret_cast(&_impl_.affect_lights_), - reinterpret_cast(&other->_impl_.affect_lights_)); + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.saturation_) + + sizeof(NSPanelMQTTManagerCommand_LightCommand::_impl_.saturation_) + - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.brightness_)>( + reinterpret_cast(&_impl_.brightness_), + reinterpret_cast(&other->_impl_.brightness_)); } -::google::protobuf::Metadata NSPanelMQTTManagerCommand_FirstPageTurnLightOn::GetMetadata() const { +::google::protobuf::Metadata NSPanelMQTTManagerCommand_LightCommand::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } // =================================================================== -class NSPanelMQTTManagerCommand_FirstPageTurnLightOff::_Internal { +class NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::_Internal { public: }; -NSPanelMQTTManagerCommand_FirstPageTurnLightOff::NSPanelMQTTManagerCommand_FirstPageTurnLightOff(::google::protobuf::Arena* arena) +NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) + // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.ToggleEntityFromEntitiesPage) } -NSPanelMQTTManagerCommand_FirstPageTurnLightOff::NSPanelMQTTManagerCommand_FirstPageTurnLightOff( - ::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& from) - : NSPanelMQTTManagerCommand_FirstPageTurnLightOff(arena) { +NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage( + ::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage& from) + : NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage(arena) { MergeFrom(from); } -inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_FirstPageTurnLightOff::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) : _cached_size_{0} {} -inline void NSPanelMQTTManagerCommand_FirstPageTurnLightOff::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, affect_lights_), + offsetof(Impl_, entity_page_id_), 0, - offsetof(Impl_, global_) - - offsetof(Impl_, affect_lights_) + - sizeof(Impl_::global_)); + offsetof(Impl_, entity_slot_) - + offsetof(Impl_, entity_page_id_) + + sizeof(Impl_::entity_slot_)); } -NSPanelMQTTManagerCommand_FirstPageTurnLightOff::~NSPanelMQTTManagerCommand_FirstPageTurnLightOff() { - // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) +NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::~NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage() { + // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.ToggleEntityFromEntitiesPage) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelMQTTManagerCommand_FirstPageTurnLightOff::SharedDtor() { +inline void NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); _impl_.~Impl_(); } const ::google::protobuf::MessageLite::ClassData* -NSPanelMQTTManagerCommand_FirstPageTurnLightOff::GetClassData() const { +NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOff, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_._cached_size_), false, }, - &NSPanelMQTTManagerCommand_FirstPageTurnLightOff::MergeImpl, - &NSPanelMQTTManagerCommand_FirstPageTurnLightOff::kDescriptorMethods, + &NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::MergeImpl, + &NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_2eproto, nullptr, // tracker }; @@ -5439,7 +6695,7 @@ NSPanelMQTTManagerCommand_FirstPageTurnLightOff::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<1, 2, 0, 0, 2> NSPanelMQTTManagerCommand_FirstPageTurnLightOff::_table_ = { +const ::_pbi::TcParseTable<1, 2, 0, 0, 2> NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ @@ -5450,66 +6706,66 @@ const ::_pbi::TcParseTable<1, 2, 0, 0, 2> NSPanelMQTTManagerCommand_FirstPageTur 2, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - &_NSPanelMQTTManagerCommand_FirstPageTurnLightOff_default_instance_._instance, + &_NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage_default_instance_._instance, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_FirstPageTurnLightOff>(), // to_prefetch + ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage>(), // to_prefetch #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ - // bool global = 2; - {::_pbi::TcParser::SingularVarintNoZag1(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOff, _impl_.global_)}}, - // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_FirstPageTurnLightOff, _impl_.affect_lights_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOff, _impl_.affect_lights_)}}, + // int32 entity_slot = 2; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_.entity_slot_), 63>(), + {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_.entity_slot_)}}, + // int32 entity_page_id = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_.entity_page_id_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_.entity_page_id_)}}, }}, {{ 65535, 65535 }}, {{ - // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOff, _impl_.affect_lights_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, - // bool global = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOff, _impl_.global_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // int32 entity_page_id = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_.entity_page_id_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 entity_slot = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_.entity_slot_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, }}, // no aux_entries {{ }}, }; -PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_FirstPageTurnLightOff::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) +PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.ToggleEntityFromEntitiesPage) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - ::memset(&_impl_.affect_lights_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.global_) - - reinterpret_cast(&_impl_.affect_lights_)) + sizeof(_impl_.global_)); + ::memset(&_impl_.entity_page_id_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.entity_slot_) - + reinterpret_cast(&_impl_.entity_page_id_)) + sizeof(_impl_.entity_slot_)); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::uint8_t* NSPanelMQTTManagerCommand_FirstPageTurnLightOff::_InternalSerialize( +::uint8_t* NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::_InternalSerialize( ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) + // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.ToggleEntityFromEntitiesPage) ::uint32_t cached_has_bits = 0; (void)cached_has_bits; - // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; - if (this->_internal_affect_lights() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 1, this->_internal_affect_lights(), target); + // int32 entity_page_id = 1; + if (this->_internal_entity_page_id() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<1>( + stream, this->_internal_entity_page_id(), target); } - // bool global = 2; - if (this->_internal_global() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 2, this->_internal_global(), target); + // int32 entity_slot = 2; + if (this->_internal_entity_slot() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<2>( + stream, this->_internal_entity_slot(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -5517,12 +6773,12 @@ ::uint8_t* NSPanelMQTTManagerCommand_FirstPageTurnLightOff::_InternalSerialize( ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) + // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.ToggleEntityFromEntitiesPage) return target; } -::size_t NSPanelMQTTManagerCommand_FirstPageTurnLightOff::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) +::size_t NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.ToggleEntityFromEntitiesPage) ::size_t total_size = 0; ::uint32_t cached_has_bits = 0; @@ -5530,136 +6786,114 @@ ::size_t NSPanelMQTTManagerCommand_FirstPageTurnLightOff::ByteSizeLong() const { (void) cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); - // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; - if (this->_internal_affect_lights() != 0) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this->_internal_affect_lights()); + // int32 entity_page_id = 1; + if (this->_internal_entity_page_id() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_entity_page_id()); } - // bool global = 2; - if (this->_internal_global() != 0) { - total_size += 2; + // int32 entity_slot = 2; + if (this->_internal_entity_slot() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_entity_slot()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -void NSPanelMQTTManagerCommand_FirstPageTurnLightOff::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) +void NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.ToggleEntityFromEntitiesPage) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_affect_lights() != 0) { - _this->_impl_.affect_lights_ = from._impl_.affect_lights_; + if (from._internal_entity_page_id() != 0) { + _this->_impl_.entity_page_id_ = from._impl_.entity_page_id_; } - if (from._internal_global() != 0) { - _this->_impl_.global_ = from._impl_.global_; + if (from._internal_entity_slot() != 0) { + _this->_impl_.entity_slot_ = from._impl_.entity_slot_; } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } -void NSPanelMQTTManagerCommand_FirstPageTurnLightOff::CopyFrom(const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) +void NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::CopyFrom(const NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.ToggleEntityFromEntitiesPage) if (&from == this) return; Clear(); MergeFrom(from); } -void NSPanelMQTTManagerCommand_FirstPageTurnLightOff::InternalSwap(NSPanelMQTTManagerCommand_FirstPageTurnLightOff* PROTOBUF_RESTRICT other) { +void NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::InternalSwap(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage* PROTOBUF_RESTRICT other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOff, _impl_.global_) - + sizeof(NSPanelMQTTManagerCommand_FirstPageTurnLightOff::_impl_.global_) - - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_FirstPageTurnLightOff, _impl_.affect_lights_)>( - reinterpret_cast(&_impl_.affect_lights_), - reinterpret_cast(&other->_impl_.affect_lights_)); + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_.entity_slot_) + + sizeof(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::_impl_.entity_slot_) + - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_.entity_page_id_)>( + reinterpret_cast(&_impl_.entity_page_id_), + reinterpret_cast(&other->_impl_.entity_page_id_)); } -::google::protobuf::Metadata NSPanelMQTTManagerCommand_FirstPageTurnLightOff::GetMetadata() const { +::google::protobuf::Metadata NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } // =================================================================== -class NSPanelMQTTManagerCommand_LightCommand::_Internal { +class NSPanelMQTTManagerCommand_SaveSceneCommand::_Internal { public: }; -NSPanelMQTTManagerCommand_LightCommand::NSPanelMQTTManagerCommand_LightCommand(::google::protobuf::Arena* arena) +NSPanelMQTTManagerCommand_SaveSceneCommand::NSPanelMQTTManagerCommand_SaveSceneCommand(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.LightCommand) + // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.SaveSceneCommand) } -inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_LightCommand::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::NSPanelMQTTManagerCommand_LightCommand& from_msg) - : light_ids_{visibility, arena, from.light_ids_}, - _light_ids_cached_byte_size_{0}, - _cached_size_{0} {} - -NSPanelMQTTManagerCommand_LightCommand::NSPanelMQTTManagerCommand_LightCommand( - ::google::protobuf::Arena* arena, - const NSPanelMQTTManagerCommand_LightCommand& from) - : ::google::protobuf::Message(arena) { - NSPanelMQTTManagerCommand_LightCommand* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - ::memcpy(reinterpret_cast(&_impl_) + - offsetof(Impl_, brightness_), - reinterpret_cast(&from._impl_) + - offsetof(Impl_, brightness_), - offsetof(Impl_, saturation_) - - offsetof(Impl_, brightness_) + - sizeof(Impl_::saturation_)); - - // @@protoc_insertion_point(copy_constructor:NSPanelMQTTManagerCommand.LightCommand) +NSPanelMQTTManagerCommand_SaveSceneCommand::NSPanelMQTTManagerCommand_SaveSceneCommand( + ::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_SaveSceneCommand& from) + : NSPanelMQTTManagerCommand_SaveSceneCommand(arena) { + MergeFrom(from); } -inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_LightCommand::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_SaveSceneCommand::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : light_ids_{visibility, arena}, - _light_ids_cached_byte_size_{0}, - _cached_size_{0} {} + : _cached_size_{0} {} -inline void NSPanelMQTTManagerCommand_LightCommand::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelMQTTManagerCommand_SaveSceneCommand::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, brightness_), + offsetof(Impl_, entity_page_id_), 0, - offsetof(Impl_, saturation_) - - offsetof(Impl_, brightness_) + - sizeof(Impl_::saturation_)); + offsetof(Impl_, entity_slot_) - + offsetof(Impl_, entity_page_id_) + + sizeof(Impl_::entity_slot_)); } -NSPanelMQTTManagerCommand_LightCommand::~NSPanelMQTTManagerCommand_LightCommand() { - // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.LightCommand) +NSPanelMQTTManagerCommand_SaveSceneCommand::~NSPanelMQTTManagerCommand_SaveSceneCommand() { + // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.SaveSceneCommand) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelMQTTManagerCommand_LightCommand::SharedDtor() { +inline void NSPanelMQTTManagerCommand_SaveSceneCommand::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); _impl_.~Impl_(); } const ::google::protobuf::MessageLite::ClassData* -NSPanelMQTTManagerCommand_LightCommand::GetClassData() const { +NSPanelMQTTManagerCommand_SaveSceneCommand::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_._cached_size_), false, }, - &NSPanelMQTTManagerCommand_LightCommand::MergeImpl, - &NSPanelMQTTManagerCommand_LightCommand::kDescriptorMethods, + &NSPanelMQTTManagerCommand_SaveSceneCommand::MergeImpl, + &NSPanelMQTTManagerCommand_SaveSceneCommand::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_2eproto, nullptr, // tracker }; @@ -5668,87 +6902,38 @@ NSPanelMQTTManagerCommand_LightCommand::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<4, 9, 0, 0, 2> NSPanelMQTTManagerCommand_LightCommand::_table_ = { +const ::_pbi::TcParseTable<1, 2, 0, 0, 2> NSPanelMQTTManagerCommand_SaveSceneCommand::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 9, 120, // max_field_number, fast_idx_mask + 2, 8, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294966784, // skipmap + 4294967292, // skipmap offsetof(decltype(_table_), field_entries), - 9, // num_field_entries + 2, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - &_NSPanelMQTTManagerCommand_LightCommand_default_instance_._instance, + &_NSPanelMQTTManagerCommand_SaveSceneCommand_default_instance_._instance, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_LightCommand>(), // to_prefetch + ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_SaveSceneCommand>(), // to_prefetch #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ - {::_pbi::TcParser::MiniParse, {}}, - // repeated int32 light_ids = 1; - {::_pbi::TcParser::FastV32P1, - {10, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.light_ids_)}}, - // bool has_brightness = 2; - {::_pbi::TcParser::SingularVarintNoZag1(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.has_brightness_)}}, - // int32 brightness = 3; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_LightCommand, _impl_.brightness_), 63>(), - {24, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.brightness_)}}, - // bool has_color_temperature = 4; - {::_pbi::TcParser::SingularVarintNoZag1(), - {32, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.has_color_temperature_)}}, - // int32 color_temperature = 5; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_LightCommand, _impl_.color_temperature_), 63>(), - {40, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.color_temperature_)}}, - // bool has_hue = 6; - {::_pbi::TcParser::SingularVarintNoZag1(), - {48, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.has_hue_)}}, - // int32 hue = 7; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_LightCommand, _impl_.hue_), 63>(), - {56, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.hue_)}}, - // bool has_saturation = 8; - {::_pbi::TcParser::SingularVarintNoZag1(), - {64, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.has_saturation_)}}, - // int32 saturation = 9; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_LightCommand, _impl_.saturation_), 63>(), - {72, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.saturation_)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, + // int32 entity_slot = 2; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_.entity_slot_), 63>(), + {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_.entity_slot_)}}, + // int32 entity_page_id = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_.entity_page_id_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_.entity_page_id_)}}, }}, {{ 65535, 65535 }}, {{ - // repeated int32 light_ids = 1; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.light_ids_), 0, 0, - (0 | ::_fl::kFcRepeated | ::_fl::kPackedInt32)}, - // bool has_brightness = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.has_brightness_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // int32 brightness = 3; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.brightness_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // bool has_color_temperature = 4; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.has_color_temperature_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // int32 color_temperature = 5; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.color_temperature_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // bool has_hue = 6; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.has_hue_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // int32 hue = 7; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.hue_), 0, 0, + // int32 entity_page_id = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_.entity_page_id_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // bool has_saturation = 8; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.has_saturation_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kBool)}, - // int32 saturation = 9; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.saturation_), 0, 0, + // int32 entity_slot = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_.entity_slot_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, }}, // no aux_entries @@ -5756,90 +6941,38 @@ const ::_pbi::TcParseTable<4, 9, 0, 0, 2> NSPanelMQTTManagerCommand_LightCommand }}, }; -PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_LightCommand::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.LightCommand) +PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_SaveSceneCommand::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.SaveSceneCommand) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.light_ids_.Clear(); - ::memset(&_impl_.brightness_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.saturation_) - - reinterpret_cast(&_impl_.brightness_)) + sizeof(_impl_.saturation_)); + ::memset(&_impl_.entity_page_id_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.entity_slot_) - + reinterpret_cast(&_impl_.entity_page_id_)) + sizeof(_impl_.entity_slot_)); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::uint8_t* NSPanelMQTTManagerCommand_LightCommand::_InternalSerialize( +::uint8_t* NSPanelMQTTManagerCommand_SaveSceneCommand::_InternalSerialize( ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.LightCommand) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - // repeated int32 light_ids = 1; - { - int byte_size = _impl_._light_ids_cached_byte_size_.Get(); - if (byte_size > 0) { - target = stream->WriteInt32Packed( - 1, _internal_light_ids(), byte_size, target); - } - } - - // bool has_brightness = 2; - if (this->_internal_has_brightness() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 2, this->_internal_has_brightness(), target); - } - - // int32 brightness = 3; - if (this->_internal_brightness() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<3>( - stream, this->_internal_brightness(), target); - } - - // bool has_color_temperature = 4; - if (this->_internal_has_color_temperature() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 4, this->_internal_has_color_temperature(), target); - } - - // int32 color_temperature = 5; - if (this->_internal_color_temperature() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<5>( - stream, this->_internal_color_temperature(), target); - } - - // bool has_hue = 6; - if (this->_internal_has_hue() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 6, this->_internal_has_hue(), target); - } - - // int32 hue = 7; - if (this->_internal_hue() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<7>( - stream, this->_internal_hue(), target); - } - - // bool has_saturation = 8; - if (this->_internal_has_saturation() != 0) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 8, this->_internal_has_saturation(), target); + // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.SaveSceneCommand) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + // int32 entity_page_id = 1; + if (this->_internal_entity_page_id() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<1>( + stream, this->_internal_entity_page_id(), target); } - // int32 saturation = 9; - if (this->_internal_saturation() != 0) { + // int32 entity_slot = 2; + if (this->_internal_entity_slot() != 0) { target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<9>( - stream, this->_internal_saturation(), target); + WriteInt32ToArrayWithField<2>( + stream, this->_internal_entity_slot(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -5847,12 +6980,12 @@ ::uint8_t* NSPanelMQTTManagerCommand_LightCommand::_InternalSerialize( ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.LightCommand) + // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.SaveSceneCommand) return target; } -::size_t NSPanelMQTTManagerCommand_LightCommand::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.LightCommand) +::size_t NSPanelMQTTManagerCommand_SaveSceneCommand::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.SaveSceneCommand) ::size_t total_size = 0; ::uint32_t cached_has_bits = 0; @@ -5860,179 +6993,109 @@ ::size_t NSPanelMQTTManagerCommand_LightCommand::ByteSizeLong() const { (void) cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); - // repeated int32 light_ids = 1; - { - std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( - this->_internal_light_ids()) - ; - _impl_._light_ids_cached_byte_size_.Set(::_pbi::ToCachedSize(data_size)); - std::size_t tag_size = data_size == 0 - ? 0 - : 1 + ::_pbi::WireFormatLite::Int32Size( - static_cast(data_size)) - ; - total_size += tag_size + data_size; - } - // int32 brightness = 3; - if (this->_internal_brightness() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_brightness()); - } - - // int32 color_temperature = 5; - if (this->_internal_color_temperature() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_color_temperature()); - } - - // bool has_brightness = 2; - if (this->_internal_has_brightness() != 0) { - total_size += 2; - } - - // bool has_color_temperature = 4; - if (this->_internal_has_color_temperature() != 0) { - total_size += 2; - } - - // bool has_hue = 6; - if (this->_internal_has_hue() != 0) { - total_size += 2; - } - - // bool has_saturation = 8; - if (this->_internal_has_saturation() != 0) { - total_size += 2; - } - - // int32 hue = 7; - if (this->_internal_hue() != 0) { + // int32 entity_page_id = 1; + if (this->_internal_entity_page_id() != 0) { total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_hue()); + this->_internal_entity_page_id()); } - // int32 saturation = 9; - if (this->_internal_saturation() != 0) { + // int32 entity_slot = 2; + if (this->_internal_entity_slot() != 0) { total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_saturation()); + this->_internal_entity_slot()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -void NSPanelMQTTManagerCommand_LightCommand::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.LightCommand) +void NSPanelMQTTManagerCommand_SaveSceneCommand::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.SaveSceneCommand) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - _this->_internal_mutable_light_ids()->MergeFrom(from._internal_light_ids()); - if (from._internal_brightness() != 0) { - _this->_impl_.brightness_ = from._impl_.brightness_; - } - if (from._internal_color_temperature() != 0) { - _this->_impl_.color_temperature_ = from._impl_.color_temperature_; - } - if (from._internal_has_brightness() != 0) { - _this->_impl_.has_brightness_ = from._impl_.has_brightness_; - } - if (from._internal_has_color_temperature() != 0) { - _this->_impl_.has_color_temperature_ = from._impl_.has_color_temperature_; - } - if (from._internal_has_hue() != 0) { - _this->_impl_.has_hue_ = from._impl_.has_hue_; - } - if (from._internal_has_saturation() != 0) { - _this->_impl_.has_saturation_ = from._impl_.has_saturation_; - } - if (from._internal_hue() != 0) { - _this->_impl_.hue_ = from._impl_.hue_; + if (from._internal_entity_page_id() != 0) { + _this->_impl_.entity_page_id_ = from._impl_.entity_page_id_; } - if (from._internal_saturation() != 0) { - _this->_impl_.saturation_ = from._impl_.saturation_; + if (from._internal_entity_slot() != 0) { + _this->_impl_.entity_slot_ = from._impl_.entity_slot_; } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } -void NSPanelMQTTManagerCommand_LightCommand::CopyFrom(const NSPanelMQTTManagerCommand_LightCommand& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.LightCommand) +void NSPanelMQTTManagerCommand_SaveSceneCommand::CopyFrom(const NSPanelMQTTManagerCommand_SaveSceneCommand& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.SaveSceneCommand) if (&from == this) return; Clear(); MergeFrom(from); } -void NSPanelMQTTManagerCommand_LightCommand::InternalSwap(NSPanelMQTTManagerCommand_LightCommand* PROTOBUF_RESTRICT other) { +void NSPanelMQTTManagerCommand_SaveSceneCommand::InternalSwap(NSPanelMQTTManagerCommand_SaveSceneCommand* PROTOBUF_RESTRICT other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); - _impl_.light_ids_.InternalSwap(&other->_impl_.light_ids_); ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.saturation_) - + sizeof(NSPanelMQTTManagerCommand_LightCommand::_impl_.saturation_) - - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_LightCommand, _impl_.brightness_)>( - reinterpret_cast(&_impl_.brightness_), - reinterpret_cast(&other->_impl_.brightness_)); + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_.entity_slot_) + + sizeof(NSPanelMQTTManagerCommand_SaveSceneCommand::_impl_.entity_slot_) + - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_.entity_page_id_)>( + reinterpret_cast(&_impl_.entity_page_id_), + reinterpret_cast(&other->_impl_.entity_page_id_)); } -::google::protobuf::Metadata NSPanelMQTTManagerCommand_LightCommand::GetMetadata() const { +::google::protobuf::Metadata NSPanelMQTTManagerCommand_SaveSceneCommand::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } // =================================================================== -class NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::_Internal { +class NSPanelMQTTManagerCommand_ButtonPressed::_Internal { public: }; -NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage(::google::protobuf::Arena* arena) +NSPanelMQTTManagerCommand_ButtonPressed::NSPanelMQTTManagerCommand_ButtonPressed(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.ToggleEntityFromEntitiesPage) + // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.ButtonPressed) } -NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage( - ::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage& from) - : NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage(arena) { +NSPanelMQTTManagerCommand_ButtonPressed::NSPanelMQTTManagerCommand_ButtonPressed( + ::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_ButtonPressed& from) + : NSPanelMQTTManagerCommand_ButtonPressed(arena) { MergeFrom(from); } -inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_ButtonPressed::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) : _cached_size_{0} {} -inline void NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelMQTTManagerCommand_ButtonPressed::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); - ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, entity_page_id_), - 0, - offsetof(Impl_, entity_slot_) - - offsetof(Impl_, entity_page_id_) + - sizeof(Impl_::entity_slot_)); + _impl_.button_id_ = {}; } -NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::~NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage() { - // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.ToggleEntityFromEntitiesPage) +NSPanelMQTTManagerCommand_ButtonPressed::~NSPanelMQTTManagerCommand_ButtonPressed() { + // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.ButtonPressed) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::SharedDtor() { +inline void NSPanelMQTTManagerCommand_ButtonPressed::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); _impl_.~Impl_(); } const ::google::protobuf::MessageLite::ClassData* -NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::GetClassData() const { +NSPanelMQTTManagerCommand_ButtonPressed::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ButtonPressed, _impl_._cached_size_), false, }, - &NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::MergeImpl, - &NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::kDescriptorMethods, + &NSPanelMQTTManagerCommand_ButtonPressed::MergeImpl, + &NSPanelMQTTManagerCommand_ButtonPressed::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_2eproto, nullptr, // tracker }; @@ -6041,38 +7104,32 @@ NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<1, 2, 0, 0, 2> NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::_table_ = { +const ::_pbi::TcParseTable<0, 1, 0, 0, 2> NSPanelMQTTManagerCommand_ButtonPressed::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 2, 8, // max_field_number, fast_idx_mask + 2, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967292, // skipmap + 4294967293, // skipmap offsetof(decltype(_table_), field_entries), - 2, // num_field_entries + 1, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - &_NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage_default_instance_._instance, + &_NSPanelMQTTManagerCommand_ButtonPressed_default_instance_._instance, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage>(), // to_prefetch + ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_ButtonPressed>(), // to_prefetch #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ - // int32 entity_slot = 2; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_.entity_slot_), 63>(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_.entity_slot_)}}, - // int32 entity_page_id = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_.entity_page_id_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_.entity_page_id_)}}, + // int32 button_id = 2; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_ButtonPressed, _impl_.button_id_), 63>(), + {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ButtonPressed, _impl_.button_id_)}}, }}, {{ 65535, 65535 }}, {{ - // int32 entity_page_id = 1; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_.entity_page_id_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 entity_slot = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_.entity_slot_), 0, 0, + // int32 button_id = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ButtonPressed, _impl_.button_id_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, }}, // no aux_entries @@ -6080,38 +7137,29 @@ const ::_pbi::TcParseTable<1, 2, 0, 0, 2> NSPanelMQTTManagerCommand_ToggleEntity }}, }; -PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.ToggleEntityFromEntitiesPage) +PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_ButtonPressed::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.ButtonPressed) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - ::memset(&_impl_.entity_page_id_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.entity_slot_) - - reinterpret_cast(&_impl_.entity_page_id_)) + sizeof(_impl_.entity_slot_)); + _impl_.button_id_ = 0; _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::uint8_t* NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::_InternalSerialize( +::uint8_t* NSPanelMQTTManagerCommand_ButtonPressed::_InternalSerialize( ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.ToggleEntityFromEntitiesPage) + // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.ButtonPressed) ::uint32_t cached_has_bits = 0; (void)cached_has_bits; - // int32 entity_page_id = 1; - if (this->_internal_entity_page_id() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<1>( - stream, this->_internal_entity_page_id(), target); - } - - // int32 entity_slot = 2; - if (this->_internal_entity_slot() != 0) { + // int32 button_id = 2; + if (this->_internal_button_id() != 0) { target = ::google::protobuf::internal::WireFormatLite:: WriteInt32ToArrayWithField<2>( - stream, this->_internal_entity_slot(), target); + stream, this->_internal_button_id(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -6119,127 +7167,112 @@ ::uint8_t* NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::_InternalSeri ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.ToggleEntityFromEntitiesPage) + // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.ButtonPressed) return target; } -::size_t NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.ToggleEntityFromEntitiesPage) +::size_t NSPanelMQTTManagerCommand_ButtonPressed::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.ButtonPressed) ::size_t total_size = 0; ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); - // int32 entity_page_id = 1; - if (this->_internal_entity_page_id() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_entity_page_id()); - } - - // int32 entity_slot = 2; - if (this->_internal_entity_slot() != 0) { + // int32 button_id = 2; + if (this->_internal_button_id() != 0) { total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_entity_slot()); + this->_internal_button_id()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -void NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.ToggleEntityFromEntitiesPage) +void NSPanelMQTTManagerCommand_ButtonPressed::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.ButtonPressed) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_entity_page_id() != 0) { - _this->_impl_.entity_page_id_ = from._impl_.entity_page_id_; - } - if (from._internal_entity_slot() != 0) { - _this->_impl_.entity_slot_ = from._impl_.entity_slot_; + if (from._internal_button_id() != 0) { + _this->_impl_.button_id_ = from._impl_.button_id_; } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } -void NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::CopyFrom(const NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.ToggleEntityFromEntitiesPage) +void NSPanelMQTTManagerCommand_ButtonPressed::CopyFrom(const NSPanelMQTTManagerCommand_ButtonPressed& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.ButtonPressed) if (&from == this) return; Clear(); MergeFrom(from); } -void NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::InternalSwap(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage* PROTOBUF_RESTRICT other) { +void NSPanelMQTTManagerCommand_ButtonPressed::InternalSwap(NSPanelMQTTManagerCommand_ButtonPressed* PROTOBUF_RESTRICT other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); - ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_.entity_slot_) - + sizeof(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::_impl_.entity_slot_) - - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage, _impl_.entity_page_id_)>( - reinterpret_cast(&_impl_.entity_page_id_), - reinterpret_cast(&other->_impl_.entity_page_id_)); + swap(_impl_.button_id_, other->_impl_.button_id_); } -::google::protobuf::Metadata NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage::GetMetadata() const { +::google::protobuf::Metadata NSPanelMQTTManagerCommand_ButtonPressed::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } // =================================================================== -class NSPanelMQTTManagerCommand_SaveSceneCommand::_Internal { +class NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_Internal { public: }; -NSPanelMQTTManagerCommand_SaveSceneCommand::NSPanelMQTTManagerCommand_SaveSceneCommand(::google::protobuf::Arena* arena) +NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::NSPanelMQTTManagerCommand_ThermostatTemperatureCommand(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.SaveSceneCommand) + // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand) } -NSPanelMQTTManagerCommand_SaveSceneCommand::NSPanelMQTTManagerCommand_SaveSceneCommand( - ::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_SaveSceneCommand& from) - : NSPanelMQTTManagerCommand_SaveSceneCommand(arena) { +NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::NSPanelMQTTManagerCommand_ThermostatTemperatureCommand( + ::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_ThermostatTemperatureCommand& from) + : NSPanelMQTTManagerCommand_ThermostatTemperatureCommand(arena) { MergeFrom(from); } -inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_SaveSceneCommand::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) : _cached_size_{0} {} -inline void NSPanelMQTTManagerCommand_SaveSceneCommand::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, entity_page_id_), + offsetof(Impl_, thermostat_id_), 0, - offsetof(Impl_, entity_slot_) - - offsetof(Impl_, entity_page_id_) + - sizeof(Impl_::entity_slot_)); + offsetof(Impl_, temperature_) - + offsetof(Impl_, thermostat_id_) + + sizeof(Impl_::temperature_)); } -NSPanelMQTTManagerCommand_SaveSceneCommand::~NSPanelMQTTManagerCommand_SaveSceneCommand() { - // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.SaveSceneCommand) +NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::~NSPanelMQTTManagerCommand_ThermostatTemperatureCommand() { + // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelMQTTManagerCommand_SaveSceneCommand::SharedDtor() { +inline void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); _impl_.~Impl_(); } const ::google::protobuf::MessageLite::ClassData* -NSPanelMQTTManagerCommand_SaveSceneCommand::GetClassData() const { +NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand, _impl_._cached_size_), false, }, - &NSPanelMQTTManagerCommand_SaveSceneCommand::MergeImpl, - &NSPanelMQTTManagerCommand_SaveSceneCommand::kDescriptorMethods, + &NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::MergeImpl, + &NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_2eproto, nullptr, // tracker }; @@ -6248,7 +7281,7 @@ NSPanelMQTTManagerCommand_SaveSceneCommand::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<1, 2, 0, 0, 2> NSPanelMQTTManagerCommand_SaveSceneCommand::_table_ = { +const ::_pbi::TcParseTable<1, 2, 0, 0, 2> NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ @@ -6259,66 +7292,71 @@ const ::_pbi::TcParseTable<1, 2, 0, 0, 2> NSPanelMQTTManagerCommand_SaveSceneCom 2, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - &_NSPanelMQTTManagerCommand_SaveSceneCommand_default_instance_._instance, + &_NSPanelMQTTManagerCommand_ThermostatTemperatureCommand_default_instance_._instance, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_SaveSceneCommand>(), // to_prefetch + ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_ThermostatTemperatureCommand>(), // to_prefetch #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ - // int32 entity_slot = 2; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_.entity_slot_), 63>(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_.entity_slot_)}}, - // int32 entity_page_id = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_.entity_page_id_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_.entity_page_id_)}}, + // float temperature = 2; + {::_pbi::TcParser::FastF32S1, + {21, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand, _impl_.temperature_)}}, + // int32 thermostat_id = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand, _impl_.thermostat_id_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand, _impl_.thermostat_id_)}}, }}, {{ 65535, 65535 }}, {{ - // int32 entity_page_id = 1; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_.entity_page_id_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // int32 entity_slot = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_.entity_slot_), 0, 0, + // int32 thermostat_id = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand, _impl_.thermostat_id_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // float temperature = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand, _impl_.temperature_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kFloat)}, }}, // no aux_entries {{ }}, }; -PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_SaveSceneCommand::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.SaveSceneCommand) +PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - ::memset(&_impl_.entity_page_id_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.entity_slot_) - - reinterpret_cast(&_impl_.entity_page_id_)) + sizeof(_impl_.entity_slot_)); + ::memset(&_impl_.thermostat_id_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.temperature_) - + reinterpret_cast(&_impl_.thermostat_id_)) + sizeof(_impl_.temperature_)); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::uint8_t* NSPanelMQTTManagerCommand_SaveSceneCommand::_InternalSerialize( +::uint8_t* NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_InternalSerialize( ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.SaveSceneCommand) + // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand) ::uint32_t cached_has_bits = 0; (void)cached_has_bits; - // int32 entity_page_id = 1; - if (this->_internal_entity_page_id() != 0) { + // int32 thermostat_id = 1; + if (this->_internal_thermostat_id() != 0) { target = ::google::protobuf::internal::WireFormatLite:: WriteInt32ToArrayWithField<1>( - stream, this->_internal_entity_page_id(), target); + stream, this->_internal_thermostat_id(), target); } - // int32 entity_slot = 2; - if (this->_internal_entity_slot() != 0) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this->_internal_entity_slot(), target); + // float temperature = 2; + static_assert(sizeof(::uint32_t) == sizeof(float), + "Code assumes ::uint32_t and float are the same size."); + float tmp_temperature = this->_internal_temperature(); + ::uint32_t raw_temperature; + memcpy(&raw_temperature, &tmp_temperature, sizeof(tmp_temperature)); + if (raw_temperature != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteFloatToArray( + 2, this->_internal_temperature(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -6326,12 +7364,12 @@ ::uint8_t* NSPanelMQTTManagerCommand_SaveSceneCommand::_InternalSerialize( ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.SaveSceneCommand) + // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand) return target; } -::size_t NSPanelMQTTManagerCommand_SaveSceneCommand::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.SaveSceneCommand) +::size_t NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand) ::size_t total_size = 0; ::uint32_t cached_has_bits = 0; @@ -6339,109 +7377,137 @@ ::size_t NSPanelMQTTManagerCommand_SaveSceneCommand::ByteSizeLong() const { (void) cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); - // int32 entity_page_id = 1; - if (this->_internal_entity_page_id() != 0) { + // int32 thermostat_id = 1; + if (this->_internal_thermostat_id() != 0) { total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_entity_page_id()); + this->_internal_thermostat_id()); } - // int32 entity_slot = 2; - if (this->_internal_entity_slot() != 0) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_entity_slot()); + // float temperature = 2; + static_assert(sizeof(::uint32_t) == sizeof(float), + "Code assumes ::uint32_t and float are the same size."); + float tmp_temperature = this->_internal_temperature(); + ::uint32_t raw_temperature; + memcpy(&raw_temperature, &tmp_temperature, sizeof(tmp_temperature)); + if (raw_temperature != 0) { + total_size += 5; } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -void NSPanelMQTTManagerCommand_SaveSceneCommand::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.SaveSceneCommand) +void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_entity_page_id() != 0) { - _this->_impl_.entity_page_id_ = from._impl_.entity_page_id_; + if (from._internal_thermostat_id() != 0) { + _this->_impl_.thermostat_id_ = from._impl_.thermostat_id_; } - if (from._internal_entity_slot() != 0) { - _this->_impl_.entity_slot_ = from._impl_.entity_slot_; + static_assert(sizeof(::uint32_t) == sizeof(float), + "Code assumes ::uint32_t and float are the same size."); + float tmp_temperature = from._internal_temperature(); + ::uint32_t raw_temperature; + memcpy(&raw_temperature, &tmp_temperature, sizeof(tmp_temperature)); + if (raw_temperature != 0) { + _this->_impl_.temperature_ = from._impl_.temperature_; } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } -void NSPanelMQTTManagerCommand_SaveSceneCommand::CopyFrom(const NSPanelMQTTManagerCommand_SaveSceneCommand& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.SaveSceneCommand) +void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::CopyFrom(const NSPanelMQTTManagerCommand_ThermostatTemperatureCommand& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand) if (&from == this) return; Clear(); MergeFrom(from); } -void NSPanelMQTTManagerCommand_SaveSceneCommand::InternalSwap(NSPanelMQTTManagerCommand_SaveSceneCommand* PROTOBUF_RESTRICT other) { +void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::InternalSwap(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand* PROTOBUF_RESTRICT other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_.entity_slot_) - + sizeof(NSPanelMQTTManagerCommand_SaveSceneCommand::_impl_.entity_slot_) - - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_SaveSceneCommand, _impl_.entity_page_id_)>( - reinterpret_cast(&_impl_.entity_page_id_), - reinterpret_cast(&other->_impl_.entity_page_id_)); + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand, _impl_.temperature_) + + sizeof(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_impl_.temperature_) + - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand, _impl_.thermostat_id_)>( + reinterpret_cast(&_impl_.thermostat_id_), + reinterpret_cast(&other->_impl_.thermostat_id_)); } -::google::protobuf::Metadata NSPanelMQTTManagerCommand_SaveSceneCommand::GetMetadata() const { +::google::protobuf::Metadata NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } // =================================================================== -class NSPanelMQTTManagerCommand_ButtonPressed::_Internal { +class NSPanelMQTTManagerCommand_ThermostatCommand::_Internal { public: }; -NSPanelMQTTManagerCommand_ButtonPressed::NSPanelMQTTManagerCommand_ButtonPressed(::google::protobuf::Arena* arena) +NSPanelMQTTManagerCommand_ThermostatCommand::NSPanelMQTTManagerCommand_ThermostatCommand(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.ButtonPressed) + // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.ThermostatCommand) } -NSPanelMQTTManagerCommand_ButtonPressed::NSPanelMQTTManagerCommand_ButtonPressed( - ::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_ButtonPressed& from) - : NSPanelMQTTManagerCommand_ButtonPressed(arena) { - MergeFrom(from); +inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_ThermostatCommand::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from, const ::NSPanelMQTTManagerCommand_ThermostatCommand& from_msg) + : option_(arena, from.option_), + new_value_(arena, from.new_value_), + _cached_size_{0} {} + +NSPanelMQTTManagerCommand_ThermostatCommand::NSPanelMQTTManagerCommand_ThermostatCommand( + ::google::protobuf::Arena* arena, + const NSPanelMQTTManagerCommand_ThermostatCommand& from) + : ::google::protobuf::Message(arena) { + NSPanelMQTTManagerCommand_ThermostatCommand* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); + _impl_.thermostat_id_ = from._impl_.thermostat_id_; + + // @@protoc_insertion_point(copy_constructor:NSPanelMQTTManagerCommand.ThermostatCommand) } -inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_ButtonPressed::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_ThermostatCommand::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : _cached_size_{0} {} + : option_(arena), + new_value_(arena), + _cached_size_{0} {} -inline void NSPanelMQTTManagerCommand_ButtonPressed::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelMQTTManagerCommand_ThermostatCommand::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.button_id_ = {}; + _impl_.thermostat_id_ = {}; } -NSPanelMQTTManagerCommand_ButtonPressed::~NSPanelMQTTManagerCommand_ButtonPressed() { - // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.ButtonPressed) +NSPanelMQTTManagerCommand_ThermostatCommand::~NSPanelMQTTManagerCommand_ThermostatCommand() { + // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.ThermostatCommand) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelMQTTManagerCommand_ButtonPressed::SharedDtor() { +inline void NSPanelMQTTManagerCommand_ThermostatCommand::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); + _impl_.option_.Destroy(); + _impl_.new_value_.Destroy(); _impl_.~Impl_(); } const ::google::protobuf::MessageLite::ClassData* -NSPanelMQTTManagerCommand_ButtonPressed::GetClassData() const { +NSPanelMQTTManagerCommand_ThermostatCommand::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ButtonPressed, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatCommand, _impl_._cached_size_), false, }, - &NSPanelMQTTManagerCommand_ButtonPressed::MergeImpl, - &NSPanelMQTTManagerCommand_ButtonPressed::kDescriptorMethods, + &NSPanelMQTTManagerCommand_ThermostatCommand::MergeImpl, + &NSPanelMQTTManagerCommand_ThermostatCommand::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_2eproto, nullptr, // tracker }; @@ -6450,62 +7516,97 @@ NSPanelMQTTManagerCommand_ButtonPressed::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 0, 0, 2> NSPanelMQTTManagerCommand_ButtonPressed::_table_ = { +const ::_pbi::TcParseTable<2, 3, 0, 67, 2> NSPanelMQTTManagerCommand_ThermostatCommand::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 2, 0, // max_field_number, fast_idx_mask + 3, 24, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967293, // skipmap + 4294967288, // skipmap offsetof(decltype(_table_), field_entries), - 1, // num_field_entries + 3, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - &_NSPanelMQTTManagerCommand_ButtonPressed_default_instance_._instance, + &_NSPanelMQTTManagerCommand_ThermostatCommand_default_instance_._instance, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_ButtonPressed>(), // to_prefetch + ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_ThermostatCommand>(), // to_prefetch #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ - // int32 button_id = 2; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_ButtonPressed, _impl_.button_id_), 63>(), - {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ButtonPressed, _impl_.button_id_)}}, + {::_pbi::TcParser::MiniParse, {}}, + // int32 thermostat_id = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_ThermostatCommand, _impl_.thermostat_id_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatCommand, _impl_.thermostat_id_)}}, + // string option = 2; + {::_pbi::TcParser::FastUS1, + {18, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatCommand, _impl_.option_)}}, + // string new_value = 3; + {::_pbi::TcParser::FastUS1, + {26, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatCommand, _impl_.new_value_)}}, }}, {{ 65535, 65535 }}, {{ - // int32 button_id = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ButtonPressed, _impl_.button_id_), 0, 0, + // int32 thermostat_id = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatCommand, _impl_.thermostat_id_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // string option = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatCommand, _impl_.option_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // string new_value = 3; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatCommand, _impl_.new_value_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, }}, // no aux_entries {{ + "\53\0\6\11\0\0\0\0" + "NSPanelMQTTManagerCommand.ThermostatCommand" + "option" + "new_value" }}, }; -PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_ButtonPressed::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.ButtonPressed) +PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_ThermostatCommand::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.ThermostatCommand) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.button_id_ = 0; + _impl_.option_.ClearToEmpty(); + _impl_.new_value_.ClearToEmpty(); + _impl_.thermostat_id_ = 0; _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::uint8_t* NSPanelMQTTManagerCommand_ButtonPressed::_InternalSerialize( +::uint8_t* NSPanelMQTTManagerCommand_ThermostatCommand::_InternalSerialize( ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.ButtonPressed) + // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.ThermostatCommand) ::uint32_t cached_has_bits = 0; (void)cached_has_bits; - // int32 button_id = 2; - if (this->_internal_button_id() != 0) { + // int32 thermostat_id = 1; + if (this->_internal_thermostat_id() != 0) { target = ::google::protobuf::internal::WireFormatLite:: - WriteInt32ToArrayWithField<2>( - stream, this->_internal_button_id(), target); + WriteInt32ToArrayWithField<1>( + stream, this->_internal_thermostat_id(), target); + } + + // string option = 2; + if (!this->_internal_option().empty()) { + const std::string& _s = this->_internal_option(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelMQTTManagerCommand.ThermostatCommand.option"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } + + // string new_value = 3; + if (!this->_internal_new_value().empty()) { + const std::string& _s = this->_internal_new_value(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelMQTTManagerCommand.ThermostatCommand.new_value"); + target = stream->WriteStringMaybeAliased(3, _s, target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -6513,112 +7614,160 @@ ::uint8_t* NSPanelMQTTManagerCommand_ButtonPressed::_InternalSerialize( ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.ButtonPressed) + // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.ThermostatCommand) return target; } -::size_t NSPanelMQTTManagerCommand_ButtonPressed::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.ButtonPressed) +::size_t NSPanelMQTTManagerCommand_ThermostatCommand::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.ThermostatCommand) ::size_t total_size = 0; ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - // int32 button_id = 2; - if (this->_internal_button_id() != 0) { + ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); + // string option = 2; + if (!this->_internal_option().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_option()); + } + + // string new_value = 3; + if (!this->_internal_new_value().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_new_value()); + } + + // int32 thermostat_id = 1; + if (this->_internal_thermostat_id() != 0) { total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_button_id()); + this->_internal_thermostat_id()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -void NSPanelMQTTManagerCommand_ButtonPressed::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.ButtonPressed) +void NSPanelMQTTManagerCommand_ThermostatCommand::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.ThermostatCommand) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_button_id() != 0) { - _this->_impl_.button_id_ = from._impl_.button_id_; + if (!from._internal_option().empty()) { + _this->_internal_set_option(from._internal_option()); + } + if (!from._internal_new_value().empty()) { + _this->_internal_set_new_value(from._internal_new_value()); + } + if (from._internal_thermostat_id() != 0) { + _this->_impl_.thermostat_id_ = from._impl_.thermostat_id_; } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } -void NSPanelMQTTManagerCommand_ButtonPressed::CopyFrom(const NSPanelMQTTManagerCommand_ButtonPressed& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.ButtonPressed) +void NSPanelMQTTManagerCommand_ThermostatCommand::CopyFrom(const NSPanelMQTTManagerCommand_ThermostatCommand& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.ThermostatCommand) if (&from == this) return; Clear(); MergeFrom(from); } -void NSPanelMQTTManagerCommand_ButtonPressed::InternalSwap(NSPanelMQTTManagerCommand_ButtonPressed* PROTOBUF_RESTRICT other) { +void NSPanelMQTTManagerCommand_ThermostatCommand::InternalSwap(NSPanelMQTTManagerCommand_ThermostatCommand* PROTOBUF_RESTRICT other) { using std::swap; + auto* arena = GetArena(); + ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_.button_id_, other->_impl_.button_id_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.option_, &other->_impl_.option_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.new_value_, &other->_impl_.new_value_, arena); + swap(_impl_.thermostat_id_, other->_impl_.thermostat_id_); } -::google::protobuf::Metadata NSPanelMQTTManagerCommand_ButtonPressed::GetMetadata() const { +::google::protobuf::Metadata NSPanelMQTTManagerCommand_ThermostatCommand::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } // =================================================================== -class NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_Internal { +class NSPanelMQTTManagerCommand_MediaPlayerCommand::_Internal { public: }; -NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::NSPanelMQTTManagerCommand_ThermostatTemperatureCommand(::google::protobuf::Arena* arena) +NSPanelMQTTManagerCommand_MediaPlayerCommand::NSPanelMQTTManagerCommand_MediaPlayerCommand(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand) + // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.MediaPlayerCommand) } -NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::NSPanelMQTTManagerCommand_ThermostatTemperatureCommand( - ::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_ThermostatTemperatureCommand& from) - : NSPanelMQTTManagerCommand_ThermostatTemperatureCommand(arena) { - MergeFrom(from); +inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_MediaPlayerCommand::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from, const ::NSPanelMQTTManagerCommand_MediaPlayerCommand& from_msg) + : select_player_source_(arena, from.select_player_source_), + select_source_player_source_(arena, from.select_source_player_source_), + _cached_size_{0} {} + +NSPanelMQTTManagerCommand_MediaPlayerCommand::NSPanelMQTTManagerCommand_MediaPlayerCommand( + ::google::protobuf::Arena* arena, + const NSPanelMQTTManagerCommand_MediaPlayerCommand& from) + : ::google::protobuf::Message(arena) { + NSPanelMQTTManagerCommand_MediaPlayerCommand* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); + ::memcpy(reinterpret_cast(&_impl_) + + offsetof(Impl_, media_player_id_), + reinterpret_cast(&from._impl_) + + offsetof(Impl_, media_player_id_), + offsetof(Impl_, source_volume_) - + offsetof(Impl_, media_player_id_) + + sizeof(Impl_::source_volume_)); + + // @@protoc_insertion_point(copy_constructor:NSPanelMQTTManagerCommand.MediaPlayerCommand) } -inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_MediaPlayerCommand::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : _cached_size_{0} {} + : select_player_source_(arena), + select_source_player_source_(arena), + _cached_size_{0} {} -inline void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, thermostat_id_), + offsetof(Impl_, media_player_id_), 0, - offsetof(Impl_, temperature_) - - offsetof(Impl_, thermostat_id_) + - sizeof(Impl_::temperature_)); + offsetof(Impl_, source_volume_) - + offsetof(Impl_, media_player_id_) + + sizeof(Impl_::source_volume_)); } -NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::~NSPanelMQTTManagerCommand_ThermostatTemperatureCommand() { - // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand) +NSPanelMQTTManagerCommand_MediaPlayerCommand::~NSPanelMQTTManagerCommand_MediaPlayerCommand() { + // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.MediaPlayerCommand) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::SharedDtor() { +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); + _impl_.select_player_source_.Destroy(); + _impl_.select_source_player_source_.Destroy(); _impl_.~Impl_(); } const ::google::protobuf::MessageLite::ClassData* -NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::GetClassData() const { +NSPanelMQTTManagerCommand_MediaPlayerCommand::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_._cached_size_), false, }, - &NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::MergeImpl, - &NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::kDescriptorMethods, + &NSPanelMQTTManagerCommand_MediaPlayerCommand::MergeImpl, + &NSPanelMQTTManagerCommand_MediaPlayerCommand::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_2eproto, nullptr, // tracker }; @@ -6627,82 +7776,195 @@ NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<1, 2, 0, 0, 2> NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_table_ = { +const ::_pbi::TcParseTable<4, 10, 0, 108, 2> NSPanelMQTTManagerCommand_MediaPlayerCommand::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 2, 8, // max_field_number, fast_idx_mask + 10, 120, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967292, // skipmap + 4294966272, // skipmap offsetof(decltype(_table_), field_entries), - 2, // num_field_entries + 10, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - &_NSPanelMQTTManagerCommand_ThermostatTemperatureCommand_default_instance_._instance, + &_NSPanelMQTTManagerCommand_MediaPlayerCommand_default_instance_._instance, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_ThermostatTemperatureCommand>(), // to_prefetch + ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_MediaPlayerCommand>(), // to_prefetch #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ - // float temperature = 2; - {::_pbi::TcParser::FastF32S1, - {21, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand, _impl_.temperature_)}}, - // int32 thermostat_id = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand, _impl_.thermostat_id_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand, _impl_.thermostat_id_)}}, + {::_pbi::TcParser::MiniParse, {}}, + // int32 media_player_id = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.media_player_id_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.media_player_id_)}}, + // .NSPanelMQTTManagerCommand.MediaPlayerCommand.PlaybackAction playback_action = 2; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.playback_action_), 63>(), + {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.playback_action_)}}, + // bool has_volume = 3; + {::_pbi::TcParser::SingularVarintNoZag1(), + {24, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.has_volume_)}}, + // int32 volume = 4; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.volume_), 63>(), + {32, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.volume_)}}, + // bool has_source_volume = 5; + {::_pbi::TcParser::SingularVarintNoZag1(), + {40, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.has_source_volume_)}}, + // int32 source_volume = 6; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.source_volume_), 63>(), + {48, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.source_volume_)}}, + // bool has_muted = 7; + {::_pbi::TcParser::SingularVarintNoZag1(), + {56, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.has_muted_)}}, + // bool muted = 8; + {::_pbi::TcParser::SingularVarintNoZag1(), + {64, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.muted_)}}, + // string select_player_source = 9; + {::_pbi::TcParser::FastUS1, + {74, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.select_player_source_)}}, + // string select_source_player_source = 10; + {::_pbi::TcParser::FastUS1, + {82, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.select_source_player_source_)}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, }}, {{ 65535, 65535 }}, {{ - // int32 thermostat_id = 1; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand, _impl_.thermostat_id_), 0, 0, + // int32 media_player_id = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.media_player_id_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // float temperature = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand, _impl_.temperature_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kFloat)}, + // .NSPanelMQTTManagerCommand.MediaPlayerCommand.PlaybackAction playback_action = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.playback_action_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + // bool has_volume = 3; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.has_volume_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // int32 volume = 4; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.volume_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // bool has_source_volume = 5; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.has_source_volume_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // int32 source_volume = 6; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.source_volume_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // bool has_muted = 7; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.has_muted_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool muted = 8; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.muted_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // string select_player_source = 9; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.select_player_source_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // string select_source_player_source = 10; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.select_source_player_source_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, }}, // no aux_entries {{ + "\54\0\0\0\0\0\0\0\0\24\33\0\0\0\0\0" + "NSPanelMQTTManagerCommand.MediaPlayerCommand" + "select_player_source" + "select_source_player_source" }}, }; -PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand) +PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_MediaPlayerCommand::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.MediaPlayerCommand) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - ::memset(&_impl_.thermostat_id_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.temperature_) - - reinterpret_cast(&_impl_.thermostat_id_)) + sizeof(_impl_.temperature_)); + _impl_.select_player_source_.ClearToEmpty(); + _impl_.select_source_player_source_.ClearToEmpty(); + ::memset(&_impl_.media_player_id_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.source_volume_) - + reinterpret_cast(&_impl_.media_player_id_)) + sizeof(_impl_.source_volume_)); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::uint8_t* NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_InternalSerialize( +::uint8_t* NSPanelMQTTManagerCommand_MediaPlayerCommand::_InternalSerialize( ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand) + // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.MediaPlayerCommand) ::uint32_t cached_has_bits = 0; (void)cached_has_bits; - // int32 thermostat_id = 1; - if (this->_internal_thermostat_id() != 0) { + // int32 media_player_id = 1; + if (this->_internal_media_player_id() != 0) { target = ::google::protobuf::internal::WireFormatLite:: WriteInt32ToArrayWithField<1>( - stream, this->_internal_thermostat_id(), target); + stream, this->_internal_media_player_id(), target); } - // float temperature = 2; - static_assert(sizeof(::uint32_t) == sizeof(float), - "Code assumes ::uint32_t and float are the same size."); - float tmp_temperature = this->_internal_temperature(); - ::uint32_t raw_temperature; - memcpy(&raw_temperature, &tmp_temperature, sizeof(tmp_temperature)); - if (raw_temperature != 0) { + // .NSPanelMQTTManagerCommand.MediaPlayerCommand.PlaybackAction playback_action = 2; + if (this->_internal_playback_action() != 0) { target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFloatToArray( - 2, this->_internal_temperature(), target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 2, this->_internal_playback_action(), target); + } + + // bool has_volume = 3; + if (this->_internal_has_volume() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 3, this->_internal_has_volume(), target); + } + + // int32 volume = 4; + if (this->_internal_volume() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<4>( + stream, this->_internal_volume(), target); + } + + // bool has_source_volume = 5; + if (this->_internal_has_source_volume() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 5, this->_internal_has_source_volume(), target); + } + + // int32 source_volume = 6; + if (this->_internal_source_volume() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<6>( + stream, this->_internal_source_volume(), target); + } + + // bool has_muted = 7; + if (this->_internal_has_muted() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 7, this->_internal_has_muted(), target); + } + + // bool muted = 8; + if (this->_internal_muted() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 8, this->_internal_muted(), target); + } + + // string select_player_source = 9; + if (!this->_internal_select_player_source().empty()) { + const std::string& _s = this->_internal_select_player_source(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelMQTTManagerCommand.MediaPlayerCommand.select_player_source"); + target = stream->WriteStringMaybeAliased(9, _s, target); + } + + // string select_source_player_source = 10; + if (!this->_internal_select_source_player_source().empty()) { + const std::string& _s = this->_internal_select_source_player_source(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelMQTTManagerCommand.MediaPlayerCommand.select_source_player_source"); + target = stream->WriteStringMaybeAliased(10, _s, target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -6710,12 +7972,12 @@ ::uint8_t* NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_InternalSeri ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand) + // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.MediaPlayerCommand) return target; } -::size_t NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand) +::size_t NSPanelMQTTManagerCommand_MediaPlayerCommand::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.MediaPlayerCommand) ::size_t total_size = 0; ::uint32_t cached_has_bits = 0; @@ -6723,137 +7985,186 @@ ::size_t NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::ByteSizeLong() (void) cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); - // int32 thermostat_id = 1; - if (this->_internal_thermostat_id() != 0) { + // string select_player_source = 9; + if (!this->_internal_select_player_source().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_select_player_source()); + } + + // string select_source_player_source = 10; + if (!this->_internal_select_source_player_source().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_select_source_player_source()); + } + + // int32 media_player_id = 1; + if (this->_internal_media_player_id() != 0) { total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_thermostat_id()); + this->_internal_media_player_id()); + } + + // .NSPanelMQTTManagerCommand.MediaPlayerCommand.PlaybackAction playback_action = 2; + if (this->_internal_playback_action() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_playback_action()); + } + + // int32 volume = 4; + if (this->_internal_volume() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_volume()); + } + + // bool has_volume = 3; + if (this->_internal_has_volume() != 0) { + total_size += 2; + } + + // bool has_source_volume = 5; + if (this->_internal_has_source_volume() != 0) { + total_size += 2; + } + + // bool has_muted = 7; + if (this->_internal_has_muted() != 0) { + total_size += 2; } - // float temperature = 2; - static_assert(sizeof(::uint32_t) == sizeof(float), - "Code assumes ::uint32_t and float are the same size."); - float tmp_temperature = this->_internal_temperature(); - ::uint32_t raw_temperature; - memcpy(&raw_temperature, &tmp_temperature, sizeof(tmp_temperature)); - if (raw_temperature != 0) { - total_size += 5; + // bool muted = 8; + if (this->_internal_muted() != 0) { + total_size += 2; + } + + // int32 source_volume = 6; + if (this->_internal_source_volume() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_source_volume()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand) +void NSPanelMQTTManagerCommand_MediaPlayerCommand::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.MediaPlayerCommand) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (from._internal_thermostat_id() != 0) { - _this->_impl_.thermostat_id_ = from._impl_.thermostat_id_; + if (!from._internal_select_player_source().empty()) { + _this->_internal_set_select_player_source(from._internal_select_player_source()); } - static_assert(sizeof(::uint32_t) == sizeof(float), - "Code assumes ::uint32_t and float are the same size."); - float tmp_temperature = from._internal_temperature(); - ::uint32_t raw_temperature; - memcpy(&raw_temperature, &tmp_temperature, sizeof(tmp_temperature)); - if (raw_temperature != 0) { - _this->_impl_.temperature_ = from._impl_.temperature_; + if (!from._internal_select_source_player_source().empty()) { + _this->_internal_set_select_source_player_source(from._internal_select_source_player_source()); + } + if (from._internal_media_player_id() != 0) { + _this->_impl_.media_player_id_ = from._impl_.media_player_id_; + } + if (from._internal_playback_action() != 0) { + _this->_impl_.playback_action_ = from._impl_.playback_action_; + } + if (from._internal_volume() != 0) { + _this->_impl_.volume_ = from._impl_.volume_; + } + if (from._internal_has_volume() != 0) { + _this->_impl_.has_volume_ = from._impl_.has_volume_; + } + if (from._internal_has_source_volume() != 0) { + _this->_impl_.has_source_volume_ = from._impl_.has_source_volume_; + } + if (from._internal_has_muted() != 0) { + _this->_impl_.has_muted_ = from._impl_.has_muted_; + } + if (from._internal_muted() != 0) { + _this->_impl_.muted_ = from._impl_.muted_; + } + if (from._internal_source_volume() != 0) { + _this->_impl_.source_volume_ = from._impl_.source_volume_; } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } -void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::CopyFrom(const NSPanelMQTTManagerCommand_ThermostatTemperatureCommand& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand) +void NSPanelMQTTManagerCommand_MediaPlayerCommand::CopyFrom(const NSPanelMQTTManagerCommand_MediaPlayerCommand& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.MediaPlayerCommand) if (&from == this) return; Clear(); MergeFrom(from); } -void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::InternalSwap(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand* PROTOBUF_RESTRICT other) { +void NSPanelMQTTManagerCommand_MediaPlayerCommand::InternalSwap(NSPanelMQTTManagerCommand_MediaPlayerCommand* PROTOBUF_RESTRICT other) { using std::swap; + auto* arena = GetArena(); + ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.select_player_source_, &other->_impl_.select_player_source_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.select_source_player_source_, &other->_impl_.select_source_player_source_, arena); ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand, _impl_.temperature_) - + sizeof(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_impl_.temperature_) - - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand, _impl_.thermostat_id_)>( - reinterpret_cast(&_impl_.thermostat_id_), - reinterpret_cast(&other->_impl_.thermostat_id_)); + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.source_volume_) + + sizeof(NSPanelMQTTManagerCommand_MediaPlayerCommand::_impl_.source_volume_) + - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_MediaPlayerCommand, _impl_.media_player_id_)>( + reinterpret_cast(&_impl_.media_player_id_), + reinterpret_cast(&other->_impl_.media_player_id_)); } -::google::protobuf::Metadata NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::GetMetadata() const { +::google::protobuf::Metadata NSPanelMQTTManagerCommand_MediaPlayerCommand::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } // =================================================================== -class NSPanelMQTTManagerCommand_ThermostatCommand::_Internal { +class NSPanelMQTTManagerCommand_CoverCommand::_Internal { public: }; -NSPanelMQTTManagerCommand_ThermostatCommand::NSPanelMQTTManagerCommand_ThermostatCommand(::google::protobuf::Arena* arena) +NSPanelMQTTManagerCommand_CoverCommand::NSPanelMQTTManagerCommand_CoverCommand(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.ThermostatCommand) + // @@protoc_insertion_point(arena_constructor:NSPanelMQTTManagerCommand.CoverCommand) } -inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_ThermostatCommand::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::NSPanelMQTTManagerCommand_ThermostatCommand& from_msg) - : option_(arena, from.option_), - new_value_(arena, from.new_value_), - _cached_size_{0} {} - -NSPanelMQTTManagerCommand_ThermostatCommand::NSPanelMQTTManagerCommand_ThermostatCommand( - ::google::protobuf::Arena* arena, - const NSPanelMQTTManagerCommand_ThermostatCommand& from) - : ::google::protobuf::Message(arena) { - NSPanelMQTTManagerCommand_ThermostatCommand* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_.thermostat_id_ = from._impl_.thermostat_id_; - - // @@protoc_insertion_point(copy_constructor:NSPanelMQTTManagerCommand.ThermostatCommand) +NSPanelMQTTManagerCommand_CoverCommand::NSPanelMQTTManagerCommand_CoverCommand( + ::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_CoverCommand& from) + : NSPanelMQTTManagerCommand_CoverCommand(arena) { + MergeFrom(from); } -inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_ThermostatCommand::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelMQTTManagerCommand_CoverCommand::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : option_(arena), - new_value_(arena), - _cached_size_{0} {} + : _cached_size_{0} {} -inline void NSPanelMQTTManagerCommand_ThermostatCommand::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelMQTTManagerCommand_CoverCommand::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.thermostat_id_ = {}; + ::memset(reinterpret_cast(&_impl_) + + offsetof(Impl_, cover_id_), + 0, + offsetof(Impl_, tilt_position_) - + offsetof(Impl_, cover_id_) + + sizeof(Impl_::tilt_position_)); } -NSPanelMQTTManagerCommand_ThermostatCommand::~NSPanelMQTTManagerCommand_ThermostatCommand() { - // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.ThermostatCommand) +NSPanelMQTTManagerCommand_CoverCommand::~NSPanelMQTTManagerCommand_CoverCommand() { + // @@protoc_insertion_point(destructor:NSPanelMQTTManagerCommand.CoverCommand) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelMQTTManagerCommand_ThermostatCommand::SharedDtor() { +inline void NSPanelMQTTManagerCommand_CoverCommand::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); - _impl_.option_.Destroy(); - _impl_.new_value_.Destroy(); _impl_.~Impl_(); } const ::google::protobuf::MessageLite::ClassData* -NSPanelMQTTManagerCommand_ThermostatCommand::GetClassData() const { +NSPanelMQTTManagerCommand_CoverCommand::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatCommand, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_CoverCommand, _impl_._cached_size_), false, }, - &NSPanelMQTTManagerCommand_ThermostatCommand::MergeImpl, - &NSPanelMQTTManagerCommand_ThermostatCommand::kDescriptorMethods, + &NSPanelMQTTManagerCommand_CoverCommand::MergeImpl, + &NSPanelMQTTManagerCommand_CoverCommand::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_2eproto, nullptr, // tracker }; @@ -6862,97 +8173,131 @@ NSPanelMQTTManagerCommand_ThermostatCommand::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 3, 0, 67, 2> NSPanelMQTTManagerCommand_ThermostatCommand::_table_ = { +const ::_pbi::TcParseTable<3, 6, 0, 0, 2> NSPanelMQTTManagerCommand_CoverCommand::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 3, 24, // max_field_number, fast_idx_mask + 6, 56, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967288, // skipmap + 4294967232, // skipmap offsetof(decltype(_table_), field_entries), - 3, // num_field_entries + 6, // num_field_entries 0, // num_aux_entries offsetof(decltype(_table_), field_names), // no aux_entries - &_NSPanelMQTTManagerCommand_ThermostatCommand_default_instance_._instance, + &_NSPanelMQTTManagerCommand_CoverCommand_default_instance_._instance, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_ThermostatCommand>(), // to_prefetch + ::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_CoverCommand>(), // to_prefetch #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, - // int32 thermostat_id = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_ThermostatCommand, _impl_.thermostat_id_), 63>(), - {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatCommand, _impl_.thermostat_id_)}}, - // string option = 2; - {::_pbi::TcParser::FastUS1, - {18, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatCommand, _impl_.option_)}}, - // string new_value = 3; - {::_pbi::TcParser::FastUS1, - {26, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatCommand, _impl_.new_value_)}}, + // int32 cover_id = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_CoverCommand, _impl_.cover_id_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_CoverCommand, _impl_.cover_id_)}}, + // .NSPanelMQTTManagerCommand.CoverCommand.Action action = 2; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_CoverCommand, _impl_.action_), 63>(), + {16, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_CoverCommand, _impl_.action_)}}, + // bool has_position = 3; + {::_pbi::TcParser::SingularVarintNoZag1(), + {24, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_CoverCommand, _impl_.has_position_)}}, + // int32 position = 4; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_CoverCommand, _impl_.position_), 63>(), + {32, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_CoverCommand, _impl_.position_)}}, + // bool has_tilt_position = 5; + {::_pbi::TcParser::SingularVarintNoZag1(), + {40, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_CoverCommand, _impl_.has_tilt_position_)}}, + // int32 tilt_position = 6; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelMQTTManagerCommand_CoverCommand, _impl_.tilt_position_), 63>(), + {48, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_CoverCommand, _impl_.tilt_position_)}}, + {::_pbi::TcParser::MiniParse, {}}, }}, {{ 65535, 65535 }}, {{ - // int32 thermostat_id = 1; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatCommand, _impl_.thermostat_id_), 0, 0, + // int32 cover_id = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_CoverCommand, _impl_.cover_id_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // .NSPanelMQTTManagerCommand.CoverCommand.Action action = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_CoverCommand, _impl_.action_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + // bool has_position = 3; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_CoverCommand, _impl_.has_position_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // int32 position = 4; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_CoverCommand, _impl_.position_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // bool has_tilt_position = 5; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_CoverCommand, _impl_.has_tilt_position_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // int32 tilt_position = 6; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_CoverCommand, _impl_.tilt_position_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, - // string option = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatCommand, _impl_.option_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, - // string new_value = 3; - {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_ThermostatCommand, _impl_.new_value_), 0, 0, - (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, }}, // no aux_entries {{ - "\53\0\6\11\0\0\0\0" - "NSPanelMQTTManagerCommand.ThermostatCommand" - "option" - "new_value" }}, }; -PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_ThermostatCommand::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.ThermostatCommand) +PROTOBUF_NOINLINE void NSPanelMQTTManagerCommand_CoverCommand::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelMQTTManagerCommand.CoverCommand) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - _impl_.option_.ClearToEmpty(); - _impl_.new_value_.ClearToEmpty(); - _impl_.thermostat_id_ = 0; + ::memset(&_impl_.cover_id_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.tilt_position_) - + reinterpret_cast(&_impl_.cover_id_)) + sizeof(_impl_.tilt_position_)); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::uint8_t* NSPanelMQTTManagerCommand_ThermostatCommand::_InternalSerialize( +::uint8_t* NSPanelMQTTManagerCommand_CoverCommand::_InternalSerialize( ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.ThermostatCommand) + // @@protoc_insertion_point(serialize_to_array_start:NSPanelMQTTManagerCommand.CoverCommand) ::uint32_t cached_has_bits = 0; (void)cached_has_bits; - // int32 thermostat_id = 1; - if (this->_internal_thermostat_id() != 0) { + // int32 cover_id = 1; + if (this->_internal_cover_id() != 0) { target = ::google::protobuf::internal::WireFormatLite:: WriteInt32ToArrayWithField<1>( - stream, this->_internal_thermostat_id(), target); + stream, this->_internal_cover_id(), target); } - // string option = 2; - if (!this->_internal_option().empty()) { - const std::string& _s = this->_internal_option(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelMQTTManagerCommand.ThermostatCommand.option"); - target = stream->WriteStringMaybeAliased(2, _s, target); + // .NSPanelMQTTManagerCommand.CoverCommand.Action action = 2; + if (this->_internal_action() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 2, this->_internal_action(), target); } - // string new_value = 3; - if (!this->_internal_new_value().empty()) { - const std::string& _s = this->_internal_new_value(); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelMQTTManagerCommand.ThermostatCommand.new_value"); - target = stream->WriteStringMaybeAliased(3, _s, target); + // bool has_position = 3; + if (this->_internal_has_position() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 3, this->_internal_has_position(), target); + } + + // int32 position = 4; + if (this->_internal_position() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<4>( + stream, this->_internal_position(), target); + } + + // bool has_tilt_position = 5; + if (this->_internal_has_tilt_position() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 5, this->_internal_has_tilt_position(), target); + } + + // int32 tilt_position = 6; + if (this->_internal_tilt_position() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<6>( + stream, this->_internal_tilt_position(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -6960,12 +8305,12 @@ ::uint8_t* NSPanelMQTTManagerCommand_ThermostatCommand::_InternalSerialize( ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.ThermostatCommand) + // @@protoc_insertion_point(serialize_to_array_end:NSPanelMQTTManagerCommand.CoverCommand) return target; } -::size_t NSPanelMQTTManagerCommand_ThermostatCommand::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.ThermostatCommand) +::size_t NSPanelMQTTManagerCommand_CoverCommand::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelMQTTManagerCommand.CoverCommand) ::size_t total_size = 0; ::uint32_t cached_has_bits = 0; @@ -6973,67 +8318,93 @@ ::size_t NSPanelMQTTManagerCommand_ThermostatCommand::ByteSizeLong() const { (void) cached_has_bits; ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); - // string option = 2; - if (!this->_internal_option().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_option()); + // int32 cover_id = 1; + if (this->_internal_cover_id() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_cover_id()); } - // string new_value = 3; - if (!this->_internal_new_value().empty()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->_internal_new_value()); + // .NSPanelMQTTManagerCommand.CoverCommand.Action action = 2; + if (this->_internal_action() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_action()); } - // int32 thermostat_id = 1; - if (this->_internal_thermostat_id() != 0) { + // int32 position = 4; + if (this->_internal_position() != 0) { total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this->_internal_thermostat_id()); + this->_internal_position()); + } + + // bool has_position = 3; + if (this->_internal_has_position() != 0) { + total_size += 2; + } + + // bool has_tilt_position = 5; + if (this->_internal_has_tilt_position() != 0) { + total_size += 2; + } + + // int32 tilt_position = 6; + if (this->_internal_tilt_position() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_tilt_position()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } -void NSPanelMQTTManagerCommand_ThermostatCommand::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.ThermostatCommand) +void NSPanelMQTTManagerCommand_CoverCommand::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelMQTTManagerCommand.CoverCommand) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; (void) cached_has_bits; - if (!from._internal_option().empty()) { - _this->_internal_set_option(from._internal_option()); + if (from._internal_cover_id() != 0) { + _this->_impl_.cover_id_ = from._impl_.cover_id_; } - if (!from._internal_new_value().empty()) { - _this->_internal_set_new_value(from._internal_new_value()); + if (from._internal_action() != 0) { + _this->_impl_.action_ = from._impl_.action_; } - if (from._internal_thermostat_id() != 0) { - _this->_impl_.thermostat_id_ = from._impl_.thermostat_id_; + if (from._internal_position() != 0) { + _this->_impl_.position_ = from._impl_.position_; + } + if (from._internal_has_position() != 0) { + _this->_impl_.has_position_ = from._impl_.has_position_; + } + if (from._internal_has_tilt_position() != 0) { + _this->_impl_.has_tilt_position_ = from._impl_.has_tilt_position_; + } + if (from._internal_tilt_position() != 0) { + _this->_impl_.tilt_position_ = from._impl_.tilt_position_; } _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); } -void NSPanelMQTTManagerCommand_ThermostatCommand::CopyFrom(const NSPanelMQTTManagerCommand_ThermostatCommand& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.ThermostatCommand) +void NSPanelMQTTManagerCommand_CoverCommand::CopyFrom(const NSPanelMQTTManagerCommand_CoverCommand& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelMQTTManagerCommand.CoverCommand) if (&from == this) return; Clear(); MergeFrom(from); } -void NSPanelMQTTManagerCommand_ThermostatCommand::InternalSwap(NSPanelMQTTManagerCommand_ThermostatCommand* PROTOBUF_RESTRICT other) { +void NSPanelMQTTManagerCommand_CoverCommand::InternalSwap(NSPanelMQTTManagerCommand_CoverCommand* PROTOBUF_RESTRICT other) { using std::swap; - auto* arena = GetArena(); - ABSL_DCHECK_EQ(arena, other->GetArena()); _internal_metadata_.InternalSwap(&other->_internal_metadata_); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.option_, &other->_impl_.option_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.new_value_, &other->_impl_.new_value_, arena); - swap(_impl_.thermostat_id_, other->_impl_.thermostat_id_); + ::google::protobuf::internal::memswap< + PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_CoverCommand, _impl_.tilt_position_) + + sizeof(NSPanelMQTTManagerCommand_CoverCommand::_impl_.tilt_position_) + - PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand_CoverCommand, _impl_.cover_id_)>( + reinterpret_cast(&_impl_.cover_id_), + reinterpret_cast(&other->_impl_.cover_id_)); } -::google::protobuf::Metadata NSPanelMQTTManagerCommand_ThermostatCommand::GetMetadata() const { +::google::protobuf::Metadata NSPanelMQTTManagerCommand_CoverCommand::GetMetadata() const { return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); } // =================================================================== @@ -7148,6 +8519,32 @@ void NSPanelMQTTManagerCommand::set_allocated_thermostat_command(::NSPanelMQTTMa } // @@protoc_insertion_point(field_set_allocated:NSPanelMQTTManagerCommand.thermostat_command) } +void NSPanelMQTTManagerCommand::set_allocated_media_player_command(::NSPanelMQTTManagerCommand_MediaPlayerCommand* media_player_command) { + ::google::protobuf::Arena* message_arena = GetArena(); + clear_CommandData(); + if (media_player_command) { + ::google::protobuf::Arena* submessage_arena = media_player_command->GetArena(); + if (message_arena != submessage_arena) { + media_player_command = ::google::protobuf::internal::GetOwnedMessage(message_arena, media_player_command, submessage_arena); + } + set_has_media_player_command(); + _impl_.CommandData_.media_player_command_ = media_player_command; + } + // @@protoc_insertion_point(field_set_allocated:NSPanelMQTTManagerCommand.media_player_command) +} +void NSPanelMQTTManagerCommand::set_allocated_cover_command(::NSPanelMQTTManagerCommand_CoverCommand* cover_command) { + ::google::protobuf::Arena* message_arena = GetArena(); + clear_CommandData(); + if (cover_command) { + ::google::protobuf::Arena* submessage_arena = cover_command->GetArena(); + if (message_arena != submessage_arena) { + cover_command = ::google::protobuf::internal::GetOwnedMessage(message_arena, cover_command, submessage_arena); + } + set_has_cover_command(); + _impl_.CommandData_.cover_command_ = cover_command; + } + // @@protoc_insertion_point(field_set_allocated:NSPanelMQTTManagerCommand.cover_command) +} NSPanelMQTTManagerCommand::NSPanelMQTTManagerCommand(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); @@ -7197,6 +8594,12 @@ NSPanelMQTTManagerCommand::NSPanelMQTTManagerCommand( case kThermostatCommand: _impl_.CommandData_.thermostat_command_ = ::google::protobuf::Message::CopyConstruct<::NSPanelMQTTManagerCommand_ThermostatCommand>(arena, *from._impl_.CommandData_.thermostat_command_); break; + case kMediaPlayerCommand: + _impl_.CommandData_.media_player_command_ = ::google::protobuf::Message::CopyConstruct<::NSPanelMQTTManagerCommand_MediaPlayerCommand>(arena, *from._impl_.CommandData_.media_player_command_); + break; + case kCoverCommand: + _impl_.CommandData_.cover_command_ = ::google::protobuf::Message::CopyConstruct<::NSPanelMQTTManagerCommand_CoverCommand>(arena, *from._impl_.CommandData_.cover_command_); + break; } // @@protoc_insertion_point(copy_constructor:NSPanelMQTTManagerCommand) @@ -7293,6 +8696,22 @@ void NSPanelMQTTManagerCommand::clear_CommandData() { } break; } + case kMediaPlayerCommand: { + if (GetArena() == nullptr) { + delete _impl_.CommandData_.media_player_command_; + } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { + ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.CommandData_.media_player_command_); + } + break; + } + case kCoverCommand: { + if (GetArena() == nullptr) { + delete _impl_.CommandData_.cover_command_; + } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { + ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.CommandData_.cover_command_); + } + break; + } case COMMANDDATA_NOT_SET: { break; } @@ -7322,16 +8741,16 @@ NSPanelMQTTManagerCommand::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 9, 8, 0, 7> NSPanelMQTTManagerCommand::_table_ = { +const ::_pbi::TcParseTable<0, 11, 10, 0, 7> NSPanelMQTTManagerCommand::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ 100, 0, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967040, // skipmap + 4294966272, // skipmap offsetof(decltype(_table_), field_entries), - 9, // num_field_entries - 8, // num_aux_entries + 11, // num_field_entries + 10, // num_aux_entries offsetof(decltype(_table_), aux_entries), &_NSPanelMQTTManagerCommand_default_instance_._instance, nullptr, // post_loop_handler @@ -7345,7 +8764,7 @@ const ::_pbi::TcParseTable<0, 9, 8, 0, 7> NSPanelMQTTManagerCommand::_table_ = { {1696, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand, _impl_.nspanel_id_)}}, }}, {{ 100, 0, 1, - 65534, 8, + 65534, 10, 65535, 65535 }}, {{ // .NSPanelMQTTManagerCommand.FirstPageTurnLightOn first_page_turn_on = 1; @@ -7372,6 +8791,12 @@ const ::_pbi::TcParseTable<0, 9, 8, 0, 7> NSPanelMQTTManagerCommand::_table_ = { // .NSPanelMQTTManagerCommand.ThermostatCommand thermostat_command = 8; {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand, _impl_.CommandData_.thermostat_command_), _Internal::kOneofCaseOffset + 0, 7, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, + // .NSPanelMQTTManagerCommand.MediaPlayerCommand media_player_command = 9; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand, _impl_.CommandData_.media_player_command_), _Internal::kOneofCaseOffset + 0, 8, + (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, + // .NSPanelMQTTManagerCommand.CoverCommand cover_command = 10; + {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand, _impl_.CommandData_.cover_command_), _Internal::kOneofCaseOffset + 0, 9, + (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, // int32 nspanel_id = 100; {PROTOBUF_FIELD_OFFSET(NSPanelMQTTManagerCommand, _impl_.nspanel_id_), 0, 0, (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, @@ -7384,6 +8809,8 @@ const ::_pbi::TcParseTable<0, 9, 8, 0, 7> NSPanelMQTTManagerCommand::_table_ = { {::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_ButtonPressed>()}, {::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_ThermostatTemperatureCommand>()}, {::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_ThermostatCommand>()}, + {::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_MediaPlayerCommand>()}, + {::_pbi::TcParser::GetTable<::NSPanelMQTTManagerCommand_CoverCommand>()}, }}, {{ }}, }; @@ -7448,6 +8875,16 @@ ::uint8_t* NSPanelMQTTManagerCommand::_InternalSerialize( 8, *_impl_.CommandData_.thermostat_command_, _impl_.CommandData_.thermostat_command_->GetCachedSize(), target, stream); break; } + case kMediaPlayerCommand: { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 9, *_impl_.CommandData_.media_player_command_, _impl_.CommandData_.media_player_command_->GetCachedSize(), target, stream); + break; + } + case kCoverCommand: { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 10, *_impl_.CommandData_.cover_command_, _impl_.CommandData_.cover_command_->GetCachedSize(), target, stream); + break; + } default: break; } @@ -7530,6 +8967,18 @@ ::size_t NSPanelMQTTManagerCommand::ByteSizeLong() const { 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.CommandData_.thermostat_command_); break; } + // .NSPanelMQTTManagerCommand.MediaPlayerCommand media_player_command = 9; + case kMediaPlayerCommand: { + total_size += + 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.CommandData_.media_player_command_); + break; + } + // .NSPanelMQTTManagerCommand.CoverCommand cover_command = 10; + case kCoverCommand: { + total_size += + 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.CommandData_.cover_command_); + break; + } case COMMANDDATA_NOT_SET: { break; } @@ -7633,6 +9082,24 @@ void NSPanelMQTTManagerCommand::MergeImpl(::google::protobuf::MessageLite& to_ms } break; } + case kMediaPlayerCommand: { + if (oneof_needs_init) { + _this->_impl_.CommandData_.media_player_command_ = + ::google::protobuf::Message::CopyConstruct<::NSPanelMQTTManagerCommand_MediaPlayerCommand>(arena, *from._impl_.CommandData_.media_player_command_); + } else { + _this->_impl_.CommandData_.media_player_command_->MergeFrom(from._internal_media_player_command()); + } + break; + } + case kCoverCommand: { + if (oneof_needs_init) { + _this->_impl_.CommandData_.cover_command_ = + ::google::protobuf::Message::CopyConstruct<::NSPanelMQTTManagerCommand_CoverCommand>(arena, *from._impl_.CommandData_.cover_command_); + } else { + _this->_impl_.CommandData_.cover_command_->MergeFrom(from._internal_cover_command()); + } + break; + } case COMMANDDATA_NOT_SET: break; } diff --git a/docker/MQTTManager/include/protobuf/protobuf_nspanel.pb.h b/docker/MQTTManager/include/protobuf/protobuf_nspanel.pb.h index 1ba66b9f8..f427a6ac4 100644 --- a/docker/MQTTManager/include/protobuf/protobuf_nspanel.pb.h +++ b/docker/MQTTManager/include/protobuf/protobuf_nspanel.pb.h @@ -56,12 +56,18 @@ extern NSPanelConfigDefaultTypeInternal _NSPanelConfig_default_instance_; class NSPanelConfig_RoomInfo; struct NSPanelConfig_RoomInfoDefaultTypeInternal; extern NSPanelConfig_RoomInfoDefaultTypeInternal _NSPanelConfig_RoomInfo_default_instance_; +class NSPanelConfig_Sound; +struct NSPanelConfig_SoundDefaultTypeInternal; +extern NSPanelConfig_SoundDefaultTypeInternal _NSPanelConfig_Sound_default_instance_; class NSPanelMQTTManagerCommand; struct NSPanelMQTTManagerCommandDefaultTypeInternal; extern NSPanelMQTTManagerCommandDefaultTypeInternal _NSPanelMQTTManagerCommand_default_instance_; class NSPanelMQTTManagerCommand_ButtonPressed; struct NSPanelMQTTManagerCommand_ButtonPressedDefaultTypeInternal; extern NSPanelMQTTManagerCommand_ButtonPressedDefaultTypeInternal _NSPanelMQTTManagerCommand_ButtonPressed_default_instance_; +class NSPanelMQTTManagerCommand_CoverCommand; +struct NSPanelMQTTManagerCommand_CoverCommandDefaultTypeInternal; +extern NSPanelMQTTManagerCommand_CoverCommandDefaultTypeInternal _NSPanelMQTTManagerCommand_CoverCommand_default_instance_; class NSPanelMQTTManagerCommand_FirstPageTurnLightOff; struct NSPanelMQTTManagerCommand_FirstPageTurnLightOffDefaultTypeInternal; extern NSPanelMQTTManagerCommand_FirstPageTurnLightOffDefaultTypeInternal _NSPanelMQTTManagerCommand_FirstPageTurnLightOff_default_instance_; @@ -71,6 +77,9 @@ extern NSPanelMQTTManagerCommand_FirstPageTurnLightOnDefaultTypeInternal _NSPane class NSPanelMQTTManagerCommand_LightCommand; struct NSPanelMQTTManagerCommand_LightCommandDefaultTypeInternal; extern NSPanelMQTTManagerCommand_LightCommandDefaultTypeInternal _NSPanelMQTTManagerCommand_LightCommand_default_instance_; +class NSPanelMQTTManagerCommand_MediaPlayerCommand; +struct NSPanelMQTTManagerCommand_MediaPlayerCommandDefaultTypeInternal; +extern NSPanelMQTTManagerCommand_MediaPlayerCommandDefaultTypeInternal _NSPanelMQTTManagerCommand_MediaPlayerCommand_default_instance_; class NSPanelMQTTManagerCommand_SaveSceneCommand; struct NSPanelMQTTManagerCommand_SaveSceneCommandDefaultTypeInternal; extern NSPanelMQTTManagerCommand_SaveSceneCommandDefaultTypeInternal _NSPanelMQTTManagerCommand_SaveSceneCommand_default_instance_; @@ -185,6 +194,7 @@ enum NSPanelConfig_NSPanelButtonMode : int { NSPanelConfig_NSPanelButtonMode_NOTIFY_MANAGER = 2, NSPanelConfig_NSPanelButtonMode_THERMOSTAT_HEAT = 3, NSPanelConfig_NSPanelButtonMode_THERMOSTAT_COOL = 4, + NSPanelConfig_NSPanelButtonMode_OPEN_ENTITY_PAGE = 5, NSPanelConfig_NSPanelButtonMode_NSPanelConfig_NSPanelButtonMode_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::int32_t>::min(), NSPanelConfig_NSPanelButtonMode_NSPanelConfig_NSPanelButtonMode_INT_MAX_SENTINEL_DO_NOT_USE_ = @@ -194,8 +204,8 @@ enum NSPanelConfig_NSPanelButtonMode : int { bool NSPanelConfig_NSPanelButtonMode_IsValid(int value); extern const uint32_t NSPanelConfig_NSPanelButtonMode_internal_data_[]; constexpr NSPanelConfig_NSPanelButtonMode NSPanelConfig_NSPanelButtonMode_NSPanelButtonMode_MIN = static_cast(0); -constexpr NSPanelConfig_NSPanelButtonMode NSPanelConfig_NSPanelButtonMode_NSPanelButtonMode_MAX = static_cast(4); -constexpr int NSPanelConfig_NSPanelButtonMode_NSPanelButtonMode_ARRAYSIZE = 4 + 1; +constexpr NSPanelConfig_NSPanelButtonMode NSPanelConfig_NSPanelButtonMode_NSPanelButtonMode_MAX = static_cast(5); +constexpr int NSPanelConfig_NSPanelButtonMode_NSPanelButtonMode_ARRAYSIZE = 5 + 1; const ::google::protobuf::EnumDescriptor* NSPanelConfig_NSPanelButtonMode_descriptor(); template @@ -208,19 +218,54 @@ const std::string& NSPanelConfig_NSPanelButtonMode_Name(T value) { template <> inline const std::string& NSPanelConfig_NSPanelButtonMode_Name(NSPanelConfig_NSPanelButtonMode value) { return ::google::protobuf::internal::NameOfDenseEnum( + 0, 5>( static_cast(value)); } inline bool NSPanelConfig_NSPanelButtonMode_Parse(absl::string_view name, NSPanelConfig_NSPanelButtonMode* value) { return ::google::protobuf::internal::ParseNamedEnum( NSPanelConfig_NSPanelButtonMode_descriptor(), name, value); } +enum NSPanelConfig_NSPanelSoundEvent : int { + NSPanelConfig_NSPanelSoundEvent_TOUCH = 0, + NSPanelConfig_NSPanelSoundEvent_SCENE_ACTIVATED = 1, + NSPanelConfig_NSPanelSoundEvent_SCENE_SAVED = 2, + NSPanelConfig_NSPanelSoundEvent_NSPanelConfig_NSPanelSoundEvent_INT_MIN_SENTINEL_DO_NOT_USE_ = + std::numeric_limits<::int32_t>::min(), + NSPanelConfig_NSPanelSoundEvent_NSPanelConfig_NSPanelSoundEvent_INT_MAX_SENTINEL_DO_NOT_USE_ = + std::numeric_limits<::int32_t>::max(), +}; + +bool NSPanelConfig_NSPanelSoundEvent_IsValid(int value); +extern const uint32_t NSPanelConfig_NSPanelSoundEvent_internal_data_[]; +constexpr NSPanelConfig_NSPanelSoundEvent NSPanelConfig_NSPanelSoundEvent_NSPanelSoundEvent_MIN = static_cast(0); +constexpr NSPanelConfig_NSPanelSoundEvent NSPanelConfig_NSPanelSoundEvent_NSPanelSoundEvent_MAX = static_cast(2); +constexpr int NSPanelConfig_NSPanelSoundEvent_NSPanelSoundEvent_ARRAYSIZE = 2 + 1; +const ::google::protobuf::EnumDescriptor* +NSPanelConfig_NSPanelSoundEvent_descriptor(); +template +const std::string& NSPanelConfig_NSPanelSoundEvent_Name(T value) { + static_assert(std::is_same::value || + std::is_integral::value, + "Incorrect type passed to NSPanelSoundEvent_Name()."); + return NSPanelConfig_NSPanelSoundEvent_Name(static_cast(value)); +} +template <> +inline const std::string& NSPanelConfig_NSPanelSoundEvent_Name(NSPanelConfig_NSPanelSoundEvent value) { + return ::google::protobuf::internal::NameOfDenseEnum( + static_cast(value)); +} +inline bool NSPanelConfig_NSPanelSoundEvent_Parse(absl::string_view name, NSPanelConfig_NSPanelSoundEvent* value) { + return ::google::protobuf::internal::ParseNamedEnum( + NSPanelConfig_NSPanelSoundEvent_descriptor(), name, value); +} enum NSPanelStatusReport_state : int { NSPanelStatusReport_state_ONLINE = 0, NSPanelStatusReport_state_OFFLINE = 1, NSPanelStatusReport_state_UPDATING_TFT = 2, NSPanelStatusReport_state_UPDATING_FIRMWARE = 3, NSPanelStatusReport_state_UPDATING_LITTLEFS = 4, + NSPanelStatusReport_state_REBOOTING = 5, NSPanelStatusReport_state_NSPanelStatusReport_state_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::int32_t>::min(), NSPanelStatusReport_state_NSPanelStatusReport_state_INT_MAX_SENTINEL_DO_NOT_USE_ = @@ -230,8 +275,8 @@ enum NSPanelStatusReport_state : int { bool NSPanelStatusReport_state_IsValid(int value); extern const uint32_t NSPanelStatusReport_state_internal_data_[]; constexpr NSPanelStatusReport_state NSPanelStatusReport_state_state_MIN = static_cast(0); -constexpr NSPanelStatusReport_state NSPanelStatusReport_state_state_MAX = static_cast(4); -constexpr int NSPanelStatusReport_state_state_ARRAYSIZE = 4 + 1; +constexpr NSPanelStatusReport_state NSPanelStatusReport_state_state_MAX = static_cast(5); +constexpr int NSPanelStatusReport_state_state_ARRAYSIZE = 5 + 1; const ::google::protobuf::EnumDescriptor* NSPanelStatusReport_state_descriptor(); template @@ -244,13 +289,126 @@ const std::string& NSPanelStatusReport_state_Name(T value) { template <> inline const std::string& NSPanelStatusReport_state_Name(NSPanelStatusReport_state value) { return ::google::protobuf::internal::NameOfDenseEnum( + 0, 5>( static_cast(value)); } inline bool NSPanelStatusReport_state_Parse(absl::string_view name, NSPanelStatusReport_state* value) { return ::google::protobuf::internal::ParseNamedEnum( NSPanelStatusReport_state_descriptor(), name, value); } +enum NSPanelRoomEntitiesPage_EntitySlot_EntityType : int { + NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_UNSPECIFIED = 0, + NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_LIGHT = 1, + NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_SWITCH = 2, + NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_BUTTON = 3, + NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_THERMOSTAT = 4, + NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_SCENE = 5, + NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_MEDIA_PLAYER = 6, + NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_COVER = 7, + NSPanelRoomEntitiesPage_EntitySlot_EntityType_NSPanelRoomEntitiesPage_EntitySlot_EntityType_INT_MIN_SENTINEL_DO_NOT_USE_ = + std::numeric_limits<::int32_t>::min(), + NSPanelRoomEntitiesPage_EntitySlot_EntityType_NSPanelRoomEntitiesPage_EntitySlot_EntityType_INT_MAX_SENTINEL_DO_NOT_USE_ = + std::numeric_limits<::int32_t>::max(), +}; + +bool NSPanelRoomEntitiesPage_EntitySlot_EntityType_IsValid(int value); +extern const uint32_t NSPanelRoomEntitiesPage_EntitySlot_EntityType_internal_data_[]; +constexpr NSPanelRoomEntitiesPage_EntitySlot_EntityType NSPanelRoomEntitiesPage_EntitySlot_EntityType_EntityType_MIN = static_cast(0); +constexpr NSPanelRoomEntitiesPage_EntitySlot_EntityType NSPanelRoomEntitiesPage_EntitySlot_EntityType_EntityType_MAX = static_cast(7); +constexpr int NSPanelRoomEntitiesPage_EntitySlot_EntityType_EntityType_ARRAYSIZE = 7 + 1; +const ::google::protobuf::EnumDescriptor* +NSPanelRoomEntitiesPage_EntitySlot_EntityType_descriptor(); +template +const std::string& NSPanelRoomEntitiesPage_EntitySlot_EntityType_Name(T value) { + static_assert(std::is_same::value || + std::is_integral::value, + "Incorrect type passed to EntityType_Name()."); + return NSPanelRoomEntitiesPage_EntitySlot_EntityType_Name(static_cast(value)); +} +template <> +inline const std::string& NSPanelRoomEntitiesPage_EntitySlot_EntityType_Name(NSPanelRoomEntitiesPage_EntitySlot_EntityType value) { + return ::google::protobuf::internal::NameOfDenseEnum( + static_cast(value)); +} +inline bool NSPanelRoomEntitiesPage_EntitySlot_EntityType_Parse(absl::string_view name, NSPanelRoomEntitiesPage_EntitySlot_EntityType* value) { + return ::google::protobuf::internal::ParseNamedEnum( + NSPanelRoomEntitiesPage_EntitySlot_EntityType_descriptor(), name, value); +} +enum NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction : int { + NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_NONE = 0, + NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_PLAY = 1, + NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_PAUSE = 2, + NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_NEXT_TRACK = 3, + NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_PREVIOUS_TRACK = 4, + NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_INT_MIN_SENTINEL_DO_NOT_USE_ = + std::numeric_limits<::int32_t>::min(), + NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_INT_MAX_SENTINEL_DO_NOT_USE_ = + std::numeric_limits<::int32_t>::max(), +}; + +bool NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_IsValid(int value); +extern const uint32_t NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_internal_data_[]; +constexpr NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_PlaybackAction_MIN = static_cast(0); +constexpr NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_PlaybackAction_MAX = static_cast(4); +constexpr int NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_PlaybackAction_ARRAYSIZE = 4 + 1; +const ::google::protobuf::EnumDescriptor* +NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_descriptor(); +template +const std::string& NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_Name(T value) { + static_assert(std::is_same::value || + std::is_integral::value, + "Incorrect type passed to PlaybackAction_Name()."); + return NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_Name(static_cast(value)); +} +template <> +inline const std::string& NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_Name(NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction value) { + return ::google::protobuf::internal::NameOfDenseEnum( + static_cast(value)); +} +inline bool NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_Parse(absl::string_view name, NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction* value) { + return ::google::protobuf::internal::ParseNamedEnum( + NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_descriptor(), name, value); +} +enum NSPanelMQTTManagerCommand_CoverCommand_Action : int { + NSPanelMQTTManagerCommand_CoverCommand_Action_NONE = 0, + NSPanelMQTTManagerCommand_CoverCommand_Action_OPEN = 1, + NSPanelMQTTManagerCommand_CoverCommand_Action_CLOSE = 2, + NSPanelMQTTManagerCommand_CoverCommand_Action_STOP = 3, + NSPanelMQTTManagerCommand_CoverCommand_Action_OPEN_TILT = 4, + NSPanelMQTTManagerCommand_CoverCommand_Action_CLOSE_TILT = 5, + NSPanelMQTTManagerCommand_CoverCommand_Action_STOP_TILT = 6, + NSPanelMQTTManagerCommand_CoverCommand_Action_NSPanelMQTTManagerCommand_CoverCommand_Action_INT_MIN_SENTINEL_DO_NOT_USE_ = + std::numeric_limits<::int32_t>::min(), + NSPanelMQTTManagerCommand_CoverCommand_Action_NSPanelMQTTManagerCommand_CoverCommand_Action_INT_MAX_SENTINEL_DO_NOT_USE_ = + std::numeric_limits<::int32_t>::max(), +}; + +bool NSPanelMQTTManagerCommand_CoverCommand_Action_IsValid(int value); +extern const uint32_t NSPanelMQTTManagerCommand_CoverCommand_Action_internal_data_[]; +constexpr NSPanelMQTTManagerCommand_CoverCommand_Action NSPanelMQTTManagerCommand_CoverCommand_Action_Action_MIN = static_cast(0); +constexpr NSPanelMQTTManagerCommand_CoverCommand_Action NSPanelMQTTManagerCommand_CoverCommand_Action_Action_MAX = static_cast(6); +constexpr int NSPanelMQTTManagerCommand_CoverCommand_Action_Action_ARRAYSIZE = 6 + 1; +const ::google::protobuf::EnumDescriptor* +NSPanelMQTTManagerCommand_CoverCommand_Action_descriptor(); +template +const std::string& NSPanelMQTTManagerCommand_CoverCommand_Action_Name(T value) { + static_assert(std::is_same::value || + std::is_integral::value, + "Incorrect type passed to Action_Name()."); + return NSPanelMQTTManagerCommand_CoverCommand_Action_Name(static_cast(value)); +} +template <> +inline const std::string& NSPanelMQTTManagerCommand_CoverCommand_Action_Name(NSPanelMQTTManagerCommand_CoverCommand_Action value) { + return ::google::protobuf::internal::NameOfDenseEnum( + static_cast(value)); +} +inline bool NSPanelMQTTManagerCommand_CoverCommand_Action_Parse(absl::string_view name, NSPanelMQTTManagerCommand_CoverCommand_Action* value) { + return ::google::protobuf::internal::ParseNamedEnum( + NSPanelMQTTManagerCommand_CoverCommand_Action_descriptor(), name, value); +} enum NSPanelMQTTManagerCommand_AffectLightsOptions : int { NSPanelMQTTManagerCommand_AffectLightsOptions_ALL = 0, NSPanelMQTTManagerCommand_AffectLightsOptions_TABLE_LIGHTS = 1, @@ -383,7 +541,7 @@ class NSPanelWeatherUpdate_ForecastItem final : public ::google::protobuf::Messa return reinterpret_cast( &_NSPanelWeatherUpdate_ForecastItem_default_instance_); } - static constexpr int kIndexInFileMessages = 7; + static constexpr int kIndexInFileMessages = 8; friend void swap(NSPanelWeatherUpdate_ForecastItem& a, NSPanelWeatherUpdate_ForecastItem& b) { a.Swap(&b); } inline void Swap(NSPanelWeatherUpdate_ForecastItem* other) { if (other == this) return; @@ -632,7 +790,7 @@ class NSPanelWarning final : public ::google::protobuf::Message return reinterpret_cast( &_NSPanelWarning_default_instance_); } - static constexpr int kIndexInFileMessages = 2; + static constexpr int kIndexInFileMessages = 3; friend void swap(NSPanelWarning& a, NSPanelWarning& b) { a.Swap(&b); } inline void Swap(NSPanelWarning* other) { if (other == this) return; @@ -821,7 +979,7 @@ class NSPanelRoomStatus final : public ::google::protobuf::Message return reinterpret_cast( &_NSPanelRoomStatus_default_instance_); } - static constexpr int kIndexInFileMessages = 6; + static constexpr int kIndexInFileMessages = 7; friend void swap(NSPanelRoomStatus& a, NSPanelRoomStatus& b) { a.Swap(&b); } inline void Swap(NSPanelRoomStatus* other) { if (other == this) return; @@ -1151,7 +1309,7 @@ class NSPanelRoomEntitiesPage_EntitySlot final : public ::google::protobuf::Mess return reinterpret_cast( &_NSPanelRoomEntitiesPage_EntitySlot_default_instance_); } - static constexpr int kIndexInFileMessages = 4; + static constexpr int kIndexInFileMessages = 5; friend void swap(NSPanelRoomEntitiesPage_EntitySlot& a, NSPanelRoomEntitiesPage_EntitySlot& b) { a.Swap(&b); } inline void Swap(NSPanelRoomEntitiesPage_EntitySlot* other) { if (other == this) return; @@ -1217,6 +1375,31 @@ class NSPanelRoomEntitiesPage_EntitySlot final : public ::google::protobuf::Mess public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- + using EntityType = NSPanelRoomEntitiesPage_EntitySlot_EntityType; + static constexpr EntityType ENTITY_TYPE_UNSPECIFIED = NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_UNSPECIFIED; + static constexpr EntityType ENTITY_TYPE_LIGHT = NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_LIGHT; + static constexpr EntityType ENTITY_TYPE_SWITCH = NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_SWITCH; + static constexpr EntityType ENTITY_TYPE_BUTTON = NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_BUTTON; + static constexpr EntityType ENTITY_TYPE_THERMOSTAT = NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_THERMOSTAT; + static constexpr EntityType ENTITY_TYPE_SCENE = NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_SCENE; + static constexpr EntityType ENTITY_TYPE_MEDIA_PLAYER = NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_MEDIA_PLAYER; + static constexpr EntityType ENTITY_TYPE_COVER = NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_COVER; + static inline bool EntityType_IsValid(int value) { + return NSPanelRoomEntitiesPage_EntitySlot_EntityType_IsValid(value); + } + static constexpr EntityType EntityType_MIN = NSPanelRoomEntitiesPage_EntitySlot_EntityType_EntityType_MIN; + static constexpr EntityType EntityType_MAX = NSPanelRoomEntitiesPage_EntitySlot_EntityType_EntityType_MAX; + static constexpr int EntityType_ARRAYSIZE = NSPanelRoomEntitiesPage_EntitySlot_EntityType_EntityType_ARRAYSIZE; + static inline const ::google::protobuf::EnumDescriptor* EntityType_descriptor() { + return NSPanelRoomEntitiesPage_EntitySlot_EntityType_descriptor(); + } + template + static inline const std::string& EntityType_Name(T value) { + return NSPanelRoomEntitiesPage_EntitySlot_EntityType_Name(value); + } + static inline bool EntityType_Parse(absl::string_view name, EntityType* value) { + return NSPanelRoomEntitiesPage_EntitySlot_EntityType_Parse(name, value); + } // accessors ------------------------------------------------------- enum : int { @@ -1227,6 +1410,8 @@ class NSPanelRoomEntitiesPage_EntitySlot final : public ::google::protobuf::Mess kPcoFieldNumber = 4, kPco2FieldNumber = 5, kCanSaveSceneFieldNumber = 6, + kTypeFieldNumber = 8, + kIdFieldNumber = 9, }; // string name = 2; void clear_name() ; @@ -1315,14 +1500,34 @@ class NSPanelRoomEntitiesPage_EntitySlot final : public ::google::protobuf::Mess bool _internal_can_save_scene() const; void _internal_set_can_save_scene(bool value); + public: + // .NSPanelRoomEntitiesPage.EntitySlot.EntityType type = 8; + void clear_type() ; + ::NSPanelRoomEntitiesPage_EntitySlot_EntityType type() const; + void set_type(::NSPanelRoomEntitiesPage_EntitySlot_EntityType value); + + private: + ::NSPanelRoomEntitiesPage_EntitySlot_EntityType _internal_type() const; + void _internal_set_type(::NSPanelRoomEntitiesPage_EntitySlot_EntityType value); + + public: + // int32 id = 9; + void clear_id() ; + ::int32_t id() const; + void set_id(::int32_t value); + + private: + ::int32_t _internal_id() const; + void _internal_set_id(::int32_t value); + public: // @@protoc_insertion_point(class_scope:NSPanelRoomEntitiesPage.EntitySlot) private: class _Internal; friend class ::google::protobuf::internal::TcParser; static const ::google::protobuf::internal::TcParseTable< - 3, 7, 0, - 67, 2> + 4, 9, 0, + 75, 2> _table_; static constexpr const void* _raw_default_instance_ = @@ -1349,6 +1554,8 @@ class NSPanelRoomEntitiesPage_EntitySlot final : public ::google::protobuf::Mess ::int32_t pco_; ::int32_t pco2_; bool can_save_scene_; + int type_; + ::int32_t id_; mutable ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; @@ -1412,7 +1619,7 @@ class NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage final : public ::go return reinterpret_cast( &_NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage_default_instance_); } - static constexpr int kIndexInFileMessages = 12; + static constexpr int kIndexInFileMessages = 13; friend void swap(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage& a, NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage& b) { a.Swap(&b); } inline void Swap(NSPanelMQTTManagerCommand_ToggleEntityFromEntitiesPage* other) { if (other == this) return; @@ -1595,7 +1802,7 @@ class NSPanelMQTTManagerCommand_ThermostatTemperatureCommand final : public ::go return reinterpret_cast( &_NSPanelMQTTManagerCommand_ThermostatTemperatureCommand_default_instance_); } - static constexpr int kIndexInFileMessages = 15; + static constexpr int kIndexInFileMessages = 16; friend void swap(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand& a, NSPanelMQTTManagerCommand_ThermostatTemperatureCommand& b) { a.Swap(&b); } inline void Swap(NSPanelMQTTManagerCommand_ThermostatTemperatureCommand* other) { if (other == this) return; @@ -1778,7 +1985,7 @@ class NSPanelMQTTManagerCommand_ThermostatCommand final : public ::google::proto return reinterpret_cast( &_NSPanelMQTTManagerCommand_ThermostatCommand_default_instance_); } - static constexpr int kIndexInFileMessages = 16; + static constexpr int kIndexInFileMessages = 17; friend void swap(NSPanelMQTTManagerCommand_ThermostatCommand& a, NSPanelMQTTManagerCommand_ThermostatCommand& b) { a.Swap(&b); } inline void Swap(NSPanelMQTTManagerCommand_ThermostatCommand* other) { if (other == this) return; @@ -1985,7 +2192,7 @@ class NSPanelMQTTManagerCommand_SaveSceneCommand final : public ::google::protob return reinterpret_cast( &_NSPanelMQTTManagerCommand_SaveSceneCommand_default_instance_); } - static constexpr int kIndexInFileMessages = 13; + static constexpr int kIndexInFileMessages = 14; friend void swap(NSPanelMQTTManagerCommand_SaveSceneCommand& a, NSPanelMQTTManagerCommand_SaveSceneCommand& b) { a.Swap(&b); } inline void Swap(NSPanelMQTTManagerCommand_SaveSceneCommand* other) { if (other == this) return; @@ -2113,23 +2320,23 @@ class NSPanelMQTTManagerCommand_SaveSceneCommand final : public ::google::protob }; // ------------------------------------------------------------------- -class NSPanelMQTTManagerCommand_LightCommand final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:NSPanelMQTTManagerCommand.LightCommand) */ { +class NSPanelMQTTManagerCommand_MediaPlayerCommand final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:NSPanelMQTTManagerCommand.MediaPlayerCommand) */ { public: - inline NSPanelMQTTManagerCommand_LightCommand() : NSPanelMQTTManagerCommand_LightCommand(nullptr) {} - ~NSPanelMQTTManagerCommand_LightCommand() override; + inline NSPanelMQTTManagerCommand_MediaPlayerCommand() : NSPanelMQTTManagerCommand_MediaPlayerCommand(nullptr) {} + ~NSPanelMQTTManagerCommand_MediaPlayerCommand() override; template - explicit PROTOBUF_CONSTEXPR NSPanelMQTTManagerCommand_LightCommand( + explicit PROTOBUF_CONSTEXPR NSPanelMQTTManagerCommand_MediaPlayerCommand( ::google::protobuf::internal::ConstantInitialized); - inline NSPanelMQTTManagerCommand_LightCommand(const NSPanelMQTTManagerCommand_LightCommand& from) : NSPanelMQTTManagerCommand_LightCommand(nullptr, from) {} - inline NSPanelMQTTManagerCommand_LightCommand(NSPanelMQTTManagerCommand_LightCommand&& from) noexcept - : NSPanelMQTTManagerCommand_LightCommand(nullptr, std::move(from)) {} - inline NSPanelMQTTManagerCommand_LightCommand& operator=(const NSPanelMQTTManagerCommand_LightCommand& from) { + inline NSPanelMQTTManagerCommand_MediaPlayerCommand(const NSPanelMQTTManagerCommand_MediaPlayerCommand& from) : NSPanelMQTTManagerCommand_MediaPlayerCommand(nullptr, from) {} + inline NSPanelMQTTManagerCommand_MediaPlayerCommand(NSPanelMQTTManagerCommand_MediaPlayerCommand&& from) noexcept + : NSPanelMQTTManagerCommand_MediaPlayerCommand(nullptr, std::move(from)) {} + inline NSPanelMQTTManagerCommand_MediaPlayerCommand& operator=(const NSPanelMQTTManagerCommand_MediaPlayerCommand& from) { CopyFrom(from); return *this; } - inline NSPanelMQTTManagerCommand_LightCommand& operator=(NSPanelMQTTManagerCommand_LightCommand&& from) noexcept { + inline NSPanelMQTTManagerCommand_MediaPlayerCommand& operator=(NSPanelMQTTManagerCommand_MediaPlayerCommand&& from) noexcept { if (this == &from) return *this; if (GetArena() == from.GetArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE @@ -2161,16 +2368,16 @@ class NSPanelMQTTManagerCommand_LightCommand final : public ::google::protobuf:: static const ::google::protobuf::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } - static const NSPanelMQTTManagerCommand_LightCommand& default_instance() { + static const NSPanelMQTTManagerCommand_MediaPlayerCommand& default_instance() { return *internal_default_instance(); } - static inline const NSPanelMQTTManagerCommand_LightCommand* internal_default_instance() { - return reinterpret_cast( - &_NSPanelMQTTManagerCommand_LightCommand_default_instance_); + static inline const NSPanelMQTTManagerCommand_MediaPlayerCommand* internal_default_instance() { + return reinterpret_cast( + &_NSPanelMQTTManagerCommand_MediaPlayerCommand_default_instance_); } - static constexpr int kIndexInFileMessages = 11; - friend void swap(NSPanelMQTTManagerCommand_LightCommand& a, NSPanelMQTTManagerCommand_LightCommand& b) { a.Swap(&b); } - inline void Swap(NSPanelMQTTManagerCommand_LightCommand* other) { + static constexpr int kIndexInFileMessages = 18; + friend void swap(NSPanelMQTTManagerCommand_MediaPlayerCommand& a, NSPanelMQTTManagerCommand_MediaPlayerCommand& b) { a.Swap(&b); } + inline void Swap(NSPanelMQTTManagerCommand_MediaPlayerCommand* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetArena() != nullptr && GetArena() == other->GetArena()) { @@ -2182,7 +2389,7 @@ class NSPanelMQTTManagerCommand_LightCommand final : public ::google::protobuf:: ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(NSPanelMQTTManagerCommand_LightCommand* other) { + void UnsafeArenaSwap(NSPanelMQTTManagerCommand_MediaPlayerCommand* other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -2190,13 +2397,13 @@ class NSPanelMQTTManagerCommand_LightCommand final : public ::google::protobuf:: // implements Message ---------------------------------------------- - NSPanelMQTTManagerCommand_LightCommand* New(::google::protobuf::Arena* arena = nullptr) const final { - return ::google::protobuf::Message::DefaultConstruct(arena); + NSPanelMQTTManagerCommand_MediaPlayerCommand* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const NSPanelMQTTManagerCommand_LightCommand& from); + void CopyFrom(const NSPanelMQTTManagerCommand_MediaPlayerCommand& from); using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const NSPanelMQTTManagerCommand_LightCommand& from) { NSPanelMQTTManagerCommand_LightCommand::MergeImpl(*this, from); } + void MergeFrom(const NSPanelMQTTManagerCommand_MediaPlayerCommand& from) { NSPanelMQTTManagerCommand_MediaPlayerCommand::MergeImpl(*this, from); } private: static void MergeImpl( @@ -2217,16 +2424,16 @@ class NSPanelMQTTManagerCommand_LightCommand final : public ::google::protobuf:: private: void SharedCtor(::google::protobuf::Arena* arena); void SharedDtor(); - void InternalSwap(NSPanelMQTTManagerCommand_LightCommand* other); + void InternalSwap(NSPanelMQTTManagerCommand_MediaPlayerCommand* other); private: friend class ::google::protobuf::internal::AnyMetadata; - static ::absl::string_view FullMessageName() { return "NSPanelMQTTManagerCommand.LightCommand"; } + static ::absl::string_view FullMessageName() { return "NSPanelMQTTManagerCommand.MediaPlayerCommand"; } protected: - explicit NSPanelMQTTManagerCommand_LightCommand(::google::protobuf::Arena* arena); - NSPanelMQTTManagerCommand_LightCommand(::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_LightCommand& from); - NSPanelMQTTManagerCommand_LightCommand(::google::protobuf::Arena* arena, NSPanelMQTTManagerCommand_LightCommand&& from) noexcept - : NSPanelMQTTManagerCommand_LightCommand(arena) { + explicit NSPanelMQTTManagerCommand_MediaPlayerCommand(::google::protobuf::Arena* arena); + NSPanelMQTTManagerCommand_MediaPlayerCommand(::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_MediaPlayerCommand& from); + NSPanelMQTTManagerCommand_MediaPlayerCommand(::google::protobuf::Arena* arena, NSPanelMQTTManagerCommand_MediaPlayerCommand&& from) noexcept + : NSPanelMQTTManagerCommand_MediaPlayerCommand(arena) { *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const final; @@ -2234,128 +2441,165 @@ class NSPanelMQTTManagerCommand_LightCommand final : public ::google::protobuf:: public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- + using PlaybackAction = NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction; + static constexpr PlaybackAction NONE = NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_NONE; + static constexpr PlaybackAction PLAY = NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_PLAY; + static constexpr PlaybackAction PAUSE = NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_PAUSE; + static constexpr PlaybackAction NEXT_TRACK = NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_NEXT_TRACK; + static constexpr PlaybackAction PREVIOUS_TRACK = NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_PREVIOUS_TRACK; + static inline bool PlaybackAction_IsValid(int value) { + return NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_IsValid(value); + } + static constexpr PlaybackAction PlaybackAction_MIN = NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_PlaybackAction_MIN; + static constexpr PlaybackAction PlaybackAction_MAX = NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_PlaybackAction_MAX; + static constexpr int PlaybackAction_ARRAYSIZE = NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_PlaybackAction_ARRAYSIZE; + static inline const ::google::protobuf::EnumDescriptor* PlaybackAction_descriptor() { + return NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_descriptor(); + } + template + static inline const std::string& PlaybackAction_Name(T value) { + return NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_Name(value); + } + static inline bool PlaybackAction_Parse(absl::string_view name, PlaybackAction* value) { + return NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_Parse(name, value); + } // accessors ------------------------------------------------------- enum : int { - kLightIdsFieldNumber = 1, - kBrightnessFieldNumber = 3, - kColorTemperatureFieldNumber = 5, - kHasBrightnessFieldNumber = 2, - kHasColorTemperatureFieldNumber = 4, - kHasHueFieldNumber = 6, - kHasSaturationFieldNumber = 8, - kHueFieldNumber = 7, - kSaturationFieldNumber = 9, + kSelectPlayerSourceFieldNumber = 9, + kSelectSourcePlayerSourceFieldNumber = 10, + kMediaPlayerIdFieldNumber = 1, + kPlaybackActionFieldNumber = 2, + kVolumeFieldNumber = 4, + kHasVolumeFieldNumber = 3, + kHasSourceVolumeFieldNumber = 5, + kHasMutedFieldNumber = 7, + kMutedFieldNumber = 8, + kSourceVolumeFieldNumber = 6, }; - // repeated int32 light_ids = 1; - int light_ids_size() const; + // string select_player_source = 9; + void clear_select_player_source() ; + const std::string& select_player_source() const; + template + void set_select_player_source(Arg_&& arg, Args_... args); + std::string* mutable_select_player_source(); + PROTOBUF_NODISCARD std::string* release_select_player_source(); + void set_allocated_select_player_source(std::string* value); + private: - int _internal_light_ids_size() const; + const std::string& _internal_select_player_source() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_select_player_source( + const std::string& value); + std::string* _internal_mutable_select_player_source(); public: - void clear_light_ids() ; - ::int32_t light_ids(int index) const; - void set_light_ids(int index, ::int32_t value); - void add_light_ids(::int32_t value); - const ::google::protobuf::RepeatedField<::int32_t>& light_ids() const; - ::google::protobuf::RepeatedField<::int32_t>* mutable_light_ids(); + // string select_source_player_source = 10; + void clear_select_source_player_source() ; + const std::string& select_source_player_source() const; + template + void set_select_source_player_source(Arg_&& arg, Args_... args); + std::string* mutable_select_source_player_source(); + PROTOBUF_NODISCARD std::string* release_select_source_player_source(); + void set_allocated_select_source_player_source(std::string* value); private: - const ::google::protobuf::RepeatedField<::int32_t>& _internal_light_ids() const; - ::google::protobuf::RepeatedField<::int32_t>* _internal_mutable_light_ids(); + const std::string& _internal_select_source_player_source() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_select_source_player_source( + const std::string& value); + std::string* _internal_mutable_select_source_player_source(); public: - // int32 brightness = 3; - void clear_brightness() ; - ::int32_t brightness() const; - void set_brightness(::int32_t value); + // int32 media_player_id = 1; + void clear_media_player_id() ; + ::int32_t media_player_id() const; + void set_media_player_id(::int32_t value); private: - ::int32_t _internal_brightness() const; - void _internal_set_brightness(::int32_t value); + ::int32_t _internal_media_player_id() const; + void _internal_set_media_player_id(::int32_t value); public: - // int32 color_temperature = 5; - void clear_color_temperature() ; - ::int32_t color_temperature() const; - void set_color_temperature(::int32_t value); + // .NSPanelMQTTManagerCommand.MediaPlayerCommand.PlaybackAction playback_action = 2; + void clear_playback_action() ; + ::NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction playback_action() const; + void set_playback_action(::NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction value); private: - ::int32_t _internal_color_temperature() const; - void _internal_set_color_temperature(::int32_t value); + ::NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction _internal_playback_action() const; + void _internal_set_playback_action(::NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction value); public: - // bool has_brightness = 2; - void clear_has_brightness() ; - bool has_brightness() const; - void set_has_brightness(bool value); + // int32 volume = 4; + void clear_volume() ; + ::int32_t volume() const; + void set_volume(::int32_t value); private: - bool _internal_has_brightness() const; - void _internal_set_has_brightness(bool value); + ::int32_t _internal_volume() const; + void _internal_set_volume(::int32_t value); public: - // bool has_color_temperature = 4; - void clear_has_color_temperature() ; - bool has_color_temperature() const; - void set_has_color_temperature(bool value); + // bool has_volume = 3; + void clear_has_volume() ; + bool has_volume() const; + void set_has_volume(bool value); private: - bool _internal_has_color_temperature() const; - void _internal_set_has_color_temperature(bool value); + bool _internal_has_volume() const; + void _internal_set_has_volume(bool value); public: - // bool has_hue = 6; - void clear_has_hue() ; - bool has_hue() const; - void set_has_hue(bool value); + // bool has_source_volume = 5; + void clear_has_source_volume() ; + bool has_source_volume() const; + void set_has_source_volume(bool value); private: - bool _internal_has_hue() const; - void _internal_set_has_hue(bool value); + bool _internal_has_source_volume() const; + void _internal_set_has_source_volume(bool value); public: - // bool has_saturation = 8; - void clear_has_saturation() ; - bool has_saturation() const; - void set_has_saturation(bool value); + // bool has_muted = 7; + void clear_has_muted() ; + bool has_muted() const; + void set_has_muted(bool value); private: - bool _internal_has_saturation() const; - void _internal_set_has_saturation(bool value); + bool _internal_has_muted() const; + void _internal_set_has_muted(bool value); public: - // int32 hue = 7; - void clear_hue() ; - ::int32_t hue() const; - void set_hue(::int32_t value); + // bool muted = 8; + void clear_muted() ; + bool muted() const; + void set_muted(bool value); private: - ::int32_t _internal_hue() const; - void _internal_set_hue(::int32_t value); + bool _internal_muted() const; + void _internal_set_muted(bool value); public: - // int32 saturation = 9; - void clear_saturation() ; - ::int32_t saturation() const; - void set_saturation(::int32_t value); + // int32 source_volume = 6; + void clear_source_volume() ; + ::int32_t source_volume() const; + void set_source_volume(::int32_t value); private: - ::int32_t _internal_saturation() const; - void _internal_set_saturation(::int32_t value); + ::int32_t _internal_source_volume() const; + void _internal_set_source_volume(::int32_t value); public: - // @@protoc_insertion_point(class_scope:NSPanelMQTTManagerCommand.LightCommand) + // @@protoc_insertion_point(class_scope:NSPanelMQTTManagerCommand.MediaPlayerCommand) private: class _Internal; friend class ::google::protobuf::internal::TcParser; static const ::google::protobuf::internal::TcParseTable< - 4, 9, 0, - 0, 2> + 4, 10, 0, + 108, 2> _table_; static constexpr const void* _raw_default_instance_ = - &_NSPanelMQTTManagerCommand_LightCommand_default_instance_; + &_NSPanelMQTTManagerCommand_MediaPlayerCommand_default_instance_; friend class ::google::protobuf::MessageLite; friend class ::google::protobuf::Arena; @@ -2370,17 +2614,17 @@ class NSPanelMQTTManagerCommand_LightCommand final : public ::google::protobuf:: ::google::protobuf::Arena* arena); inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, - const NSPanelMQTTManagerCommand_LightCommand& from_msg); - ::google::protobuf::RepeatedField<::int32_t> light_ids_; - mutable ::google::protobuf::internal::CachedSize _light_ids_cached_byte_size_; - ::int32_t brightness_; - ::int32_t color_temperature_; - bool has_brightness_; - bool has_color_temperature_; - bool has_hue_; - bool has_saturation_; - ::int32_t hue_; - ::int32_t saturation_; + const NSPanelMQTTManagerCommand_MediaPlayerCommand& from_msg); + ::google::protobuf::internal::ArenaStringPtr select_player_source_; + ::google::protobuf::internal::ArenaStringPtr select_source_player_source_; + ::int32_t media_player_id_; + int playback_action_; + ::int32_t volume_; + bool has_volume_; + bool has_source_volume_; + bool has_muted_; + bool muted_; + ::int32_t source_volume_; mutable ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; @@ -2389,23 +2633,23 @@ class NSPanelMQTTManagerCommand_LightCommand final : public ::google::protobuf:: }; // ------------------------------------------------------------------- -class NSPanelMQTTManagerCommand_FirstPageTurnLightOn final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) */ { +class NSPanelMQTTManagerCommand_LightCommand final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:NSPanelMQTTManagerCommand.LightCommand) */ { public: - inline NSPanelMQTTManagerCommand_FirstPageTurnLightOn() : NSPanelMQTTManagerCommand_FirstPageTurnLightOn(nullptr) {} - ~NSPanelMQTTManagerCommand_FirstPageTurnLightOn() override; + inline NSPanelMQTTManagerCommand_LightCommand() : NSPanelMQTTManagerCommand_LightCommand(nullptr) {} + ~NSPanelMQTTManagerCommand_LightCommand() override; template - explicit PROTOBUF_CONSTEXPR NSPanelMQTTManagerCommand_FirstPageTurnLightOn( + explicit PROTOBUF_CONSTEXPR NSPanelMQTTManagerCommand_LightCommand( ::google::protobuf::internal::ConstantInitialized); - inline NSPanelMQTTManagerCommand_FirstPageTurnLightOn(const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& from) : NSPanelMQTTManagerCommand_FirstPageTurnLightOn(nullptr, from) {} - inline NSPanelMQTTManagerCommand_FirstPageTurnLightOn(NSPanelMQTTManagerCommand_FirstPageTurnLightOn&& from) noexcept - : NSPanelMQTTManagerCommand_FirstPageTurnLightOn(nullptr, std::move(from)) {} - inline NSPanelMQTTManagerCommand_FirstPageTurnLightOn& operator=(const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& from) { + inline NSPanelMQTTManagerCommand_LightCommand(const NSPanelMQTTManagerCommand_LightCommand& from) : NSPanelMQTTManagerCommand_LightCommand(nullptr, from) {} + inline NSPanelMQTTManagerCommand_LightCommand(NSPanelMQTTManagerCommand_LightCommand&& from) noexcept + : NSPanelMQTTManagerCommand_LightCommand(nullptr, std::move(from)) {} + inline NSPanelMQTTManagerCommand_LightCommand& operator=(const NSPanelMQTTManagerCommand_LightCommand& from) { CopyFrom(from); return *this; } - inline NSPanelMQTTManagerCommand_FirstPageTurnLightOn& operator=(NSPanelMQTTManagerCommand_FirstPageTurnLightOn&& from) noexcept { + inline NSPanelMQTTManagerCommand_LightCommand& operator=(NSPanelMQTTManagerCommand_LightCommand&& from) noexcept { if (this == &from) return *this; if (GetArena() == from.GetArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE @@ -2437,16 +2681,16 @@ class NSPanelMQTTManagerCommand_FirstPageTurnLightOn final : public ::google::pr static const ::google::protobuf::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } - static const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& default_instance() { + static const NSPanelMQTTManagerCommand_LightCommand& default_instance() { return *internal_default_instance(); } - static inline const NSPanelMQTTManagerCommand_FirstPageTurnLightOn* internal_default_instance() { - return reinterpret_cast( - &_NSPanelMQTTManagerCommand_FirstPageTurnLightOn_default_instance_); + static inline const NSPanelMQTTManagerCommand_LightCommand* internal_default_instance() { + return reinterpret_cast( + &_NSPanelMQTTManagerCommand_LightCommand_default_instance_); } - static constexpr int kIndexInFileMessages = 9; - friend void swap(NSPanelMQTTManagerCommand_FirstPageTurnLightOn& a, NSPanelMQTTManagerCommand_FirstPageTurnLightOn& b) { a.Swap(&b); } - inline void Swap(NSPanelMQTTManagerCommand_FirstPageTurnLightOn* other) { + static constexpr int kIndexInFileMessages = 12; + friend void swap(NSPanelMQTTManagerCommand_LightCommand& a, NSPanelMQTTManagerCommand_LightCommand& b) { a.Swap(&b); } + inline void Swap(NSPanelMQTTManagerCommand_LightCommand* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetArena() != nullptr && GetArena() == other->GetArena()) { @@ -2458,7 +2702,7 @@ class NSPanelMQTTManagerCommand_FirstPageTurnLightOn final : public ::google::pr ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(NSPanelMQTTManagerCommand_FirstPageTurnLightOn* other) { + void UnsafeArenaSwap(NSPanelMQTTManagerCommand_LightCommand* other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -2466,13 +2710,13 @@ class NSPanelMQTTManagerCommand_FirstPageTurnLightOn final : public ::google::pr // implements Message ---------------------------------------------- - NSPanelMQTTManagerCommand_FirstPageTurnLightOn* New(::google::protobuf::Arena* arena = nullptr) const final { - return ::google::protobuf::Message::DefaultConstruct(arena); + NSPanelMQTTManagerCommand_LightCommand* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& from); + void CopyFrom(const NSPanelMQTTManagerCommand_LightCommand& from); using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& from) { NSPanelMQTTManagerCommand_FirstPageTurnLightOn::MergeImpl(*this, from); } + void MergeFrom(const NSPanelMQTTManagerCommand_LightCommand& from) { NSPanelMQTTManagerCommand_LightCommand::MergeImpl(*this, from); } private: static void MergeImpl( @@ -2493,16 +2737,16 @@ class NSPanelMQTTManagerCommand_FirstPageTurnLightOn final : public ::google::pr private: void SharedCtor(::google::protobuf::Arena* arena); void SharedDtor(); - void InternalSwap(NSPanelMQTTManagerCommand_FirstPageTurnLightOn* other); + void InternalSwap(NSPanelMQTTManagerCommand_LightCommand* other); private: friend class ::google::protobuf::internal::AnyMetadata; - static ::absl::string_view FullMessageName() { return "NSPanelMQTTManagerCommand.FirstPageTurnLightOn"; } + static ::absl::string_view FullMessageName() { return "NSPanelMQTTManagerCommand.LightCommand"; } protected: - explicit NSPanelMQTTManagerCommand_FirstPageTurnLightOn(::google::protobuf::Arena* arena); - NSPanelMQTTManagerCommand_FirstPageTurnLightOn(::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& from); - NSPanelMQTTManagerCommand_FirstPageTurnLightOn(::google::protobuf::Arena* arena, NSPanelMQTTManagerCommand_FirstPageTurnLightOn&& from) noexcept - : NSPanelMQTTManagerCommand_FirstPageTurnLightOn(arena) { + explicit NSPanelMQTTManagerCommand_LightCommand(::google::protobuf::Arena* arena); + NSPanelMQTTManagerCommand_LightCommand(::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_LightCommand& from); + NSPanelMQTTManagerCommand_LightCommand(::google::protobuf::Arena* arena, NSPanelMQTTManagerCommand_LightCommand&& from) noexcept + : NSPanelMQTTManagerCommand_LightCommand(arena) { *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const final; @@ -2513,95 +2757,125 @@ class NSPanelMQTTManagerCommand_FirstPageTurnLightOn final : public ::google::pr // accessors ------------------------------------------------------- enum : int { - kAffectLightsFieldNumber = 1, - kBrightnessSliderValueFieldNumber = 2, - kKelvinSliderValueFieldNumber = 3, - kSelectedRoomFieldNumber = 4, - kGlobalFieldNumber = 5, - kHasBrightnessValueFieldNumber = 6, - kHasKelvinValueFieldNumber = 7, + kLightIdsFieldNumber = 1, + kBrightnessFieldNumber = 3, + kColorTemperatureFieldNumber = 5, + kHasBrightnessFieldNumber = 2, + kHasColorTemperatureFieldNumber = 4, + kHasHueFieldNumber = 6, + kHasSaturationFieldNumber = 8, + kHueFieldNumber = 7, + kSaturationFieldNumber = 9, }; - // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; - void clear_affect_lights() ; - ::NSPanelMQTTManagerCommand_AffectLightsOptions affect_lights() const; - void set_affect_lights(::NSPanelMQTTManagerCommand_AffectLightsOptions value); + // repeated int32 light_ids = 1; + int light_ids_size() const; + private: + int _internal_light_ids_size() const; + + public: + void clear_light_ids() ; + ::int32_t light_ids(int index) const; + void set_light_ids(int index, ::int32_t value); + void add_light_ids(::int32_t value); + const ::google::protobuf::RepeatedField<::int32_t>& light_ids() const; + ::google::protobuf::RepeatedField<::int32_t>* mutable_light_ids(); private: - ::NSPanelMQTTManagerCommand_AffectLightsOptions _internal_affect_lights() const; - void _internal_set_affect_lights(::NSPanelMQTTManagerCommand_AffectLightsOptions value); + const ::google::protobuf::RepeatedField<::int32_t>& _internal_light_ids() const; + ::google::protobuf::RepeatedField<::int32_t>* _internal_mutable_light_ids(); public: - // int32 brightness_slider_value = 2; - void clear_brightness_slider_value() ; - ::int32_t brightness_slider_value() const; - void set_brightness_slider_value(::int32_t value); + // int32 brightness = 3; + void clear_brightness() ; + ::int32_t brightness() const; + void set_brightness(::int32_t value); private: - ::int32_t _internal_brightness_slider_value() const; - void _internal_set_brightness_slider_value(::int32_t value); + ::int32_t _internal_brightness() const; + void _internal_set_brightness(::int32_t value); public: - // int32 kelvin_slider_value = 3; - void clear_kelvin_slider_value() ; - ::int32_t kelvin_slider_value() const; - void set_kelvin_slider_value(::int32_t value); + // int32 color_temperature = 5; + void clear_color_temperature() ; + ::int32_t color_temperature() const; + void set_color_temperature(::int32_t value); private: - ::int32_t _internal_kelvin_slider_value() const; - void _internal_set_kelvin_slider_value(::int32_t value); + ::int32_t _internal_color_temperature() const; + void _internal_set_color_temperature(::int32_t value); public: - // int32 selected_room = 4; - void clear_selected_room() ; - ::int32_t selected_room() const; - void set_selected_room(::int32_t value); + // bool has_brightness = 2; + void clear_has_brightness() ; + bool has_brightness() const; + void set_has_brightness(bool value); private: - ::int32_t _internal_selected_room() const; - void _internal_set_selected_room(::int32_t value); + bool _internal_has_brightness() const; + void _internal_set_has_brightness(bool value); public: - // bool global = 5; - void clear_global() ; - bool global() const; - void set_global(bool value); + // bool has_color_temperature = 4; + void clear_has_color_temperature() ; + bool has_color_temperature() const; + void set_has_color_temperature(bool value); private: - bool _internal_global() const; - void _internal_set_global(bool value); + bool _internal_has_color_temperature() const; + void _internal_set_has_color_temperature(bool value); public: - // bool has_brightness_value = 6; - void clear_has_brightness_value() ; - bool has_brightness_value() const; - void set_has_brightness_value(bool value); + // bool has_hue = 6; + void clear_has_hue() ; + bool has_hue() const; + void set_has_hue(bool value); private: - bool _internal_has_brightness_value() const; - void _internal_set_has_brightness_value(bool value); + bool _internal_has_hue() const; + void _internal_set_has_hue(bool value); public: - // bool has_kelvin_value = 7; - void clear_has_kelvin_value() ; - bool has_kelvin_value() const; - void set_has_kelvin_value(bool value); + // bool has_saturation = 8; + void clear_has_saturation() ; + bool has_saturation() const; + void set_has_saturation(bool value); private: - bool _internal_has_kelvin_value() const; - void _internal_set_has_kelvin_value(bool value); + bool _internal_has_saturation() const; + void _internal_set_has_saturation(bool value); public: - // @@protoc_insertion_point(class_scope:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) + // int32 hue = 7; + void clear_hue() ; + ::int32_t hue() const; + void set_hue(::int32_t value); + + private: + ::int32_t _internal_hue() const; + void _internal_set_hue(::int32_t value); + + public: + // int32 saturation = 9; + void clear_saturation() ; + ::int32_t saturation() const; + void set_saturation(::int32_t value); + + private: + ::int32_t _internal_saturation() const; + void _internal_set_saturation(::int32_t value); + + public: + // @@protoc_insertion_point(class_scope:NSPanelMQTTManagerCommand.LightCommand) private: class _Internal; friend class ::google::protobuf::internal::TcParser; static const ::google::protobuf::internal::TcParseTable< - 3, 7, 0, + 4, 9, 0, 0, 2> _table_; static constexpr const void* _raw_default_instance_ = - &_NSPanelMQTTManagerCommand_FirstPageTurnLightOn_default_instance_; + &_NSPanelMQTTManagerCommand_LightCommand_default_instance_; friend class ::google::protobuf::MessageLite; friend class ::google::protobuf::Arena; @@ -2616,14 +2890,17 @@ class NSPanelMQTTManagerCommand_FirstPageTurnLightOn final : public ::google::pr ::google::protobuf::Arena* arena); inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, - const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& from_msg); - int affect_lights_; - ::int32_t brightness_slider_value_; - ::int32_t kelvin_slider_value_; - ::int32_t selected_room_; - bool global_; - bool has_brightness_value_; - bool has_kelvin_value_; + const NSPanelMQTTManagerCommand_LightCommand& from_msg); + ::google::protobuf::RepeatedField<::int32_t> light_ids_; + mutable ::google::protobuf::internal::CachedSize _light_ids_cached_byte_size_; + ::int32_t brightness_; + ::int32_t color_temperature_; + bool has_brightness_; + bool has_color_temperature_; + bool has_hue_; + bool has_saturation_; + ::int32_t hue_; + ::int32_t saturation_; mutable ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; @@ -2632,23 +2909,23 @@ class NSPanelMQTTManagerCommand_FirstPageTurnLightOn final : public ::google::pr }; // ------------------------------------------------------------------- -class NSPanelMQTTManagerCommand_FirstPageTurnLightOff final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) */ { +class NSPanelMQTTManagerCommand_FirstPageTurnLightOn final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) */ { public: - inline NSPanelMQTTManagerCommand_FirstPageTurnLightOff() : NSPanelMQTTManagerCommand_FirstPageTurnLightOff(nullptr) {} - ~NSPanelMQTTManagerCommand_FirstPageTurnLightOff() override; + inline NSPanelMQTTManagerCommand_FirstPageTurnLightOn() : NSPanelMQTTManagerCommand_FirstPageTurnLightOn(nullptr) {} + ~NSPanelMQTTManagerCommand_FirstPageTurnLightOn() override; template - explicit PROTOBUF_CONSTEXPR NSPanelMQTTManagerCommand_FirstPageTurnLightOff( + explicit PROTOBUF_CONSTEXPR NSPanelMQTTManagerCommand_FirstPageTurnLightOn( ::google::protobuf::internal::ConstantInitialized); - inline NSPanelMQTTManagerCommand_FirstPageTurnLightOff(const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& from) : NSPanelMQTTManagerCommand_FirstPageTurnLightOff(nullptr, from) {} - inline NSPanelMQTTManagerCommand_FirstPageTurnLightOff(NSPanelMQTTManagerCommand_FirstPageTurnLightOff&& from) noexcept - : NSPanelMQTTManagerCommand_FirstPageTurnLightOff(nullptr, std::move(from)) {} - inline NSPanelMQTTManagerCommand_FirstPageTurnLightOff& operator=(const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& from) { + inline NSPanelMQTTManagerCommand_FirstPageTurnLightOn(const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& from) : NSPanelMQTTManagerCommand_FirstPageTurnLightOn(nullptr, from) {} + inline NSPanelMQTTManagerCommand_FirstPageTurnLightOn(NSPanelMQTTManagerCommand_FirstPageTurnLightOn&& from) noexcept + : NSPanelMQTTManagerCommand_FirstPageTurnLightOn(nullptr, std::move(from)) {} + inline NSPanelMQTTManagerCommand_FirstPageTurnLightOn& operator=(const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& from) { CopyFrom(from); return *this; } - inline NSPanelMQTTManagerCommand_FirstPageTurnLightOff& operator=(NSPanelMQTTManagerCommand_FirstPageTurnLightOff&& from) noexcept { + inline NSPanelMQTTManagerCommand_FirstPageTurnLightOn& operator=(NSPanelMQTTManagerCommand_FirstPageTurnLightOn&& from) noexcept { if (this == &from) return *this; if (GetArena() == from.GetArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE @@ -2680,16 +2957,16 @@ class NSPanelMQTTManagerCommand_FirstPageTurnLightOff final : public ::google::p static const ::google::protobuf::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } - static const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& default_instance() { + static const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& default_instance() { return *internal_default_instance(); } - static inline const NSPanelMQTTManagerCommand_FirstPageTurnLightOff* internal_default_instance() { - return reinterpret_cast( - &_NSPanelMQTTManagerCommand_FirstPageTurnLightOff_default_instance_); + static inline const NSPanelMQTTManagerCommand_FirstPageTurnLightOn* internal_default_instance() { + return reinterpret_cast( + &_NSPanelMQTTManagerCommand_FirstPageTurnLightOn_default_instance_); } static constexpr int kIndexInFileMessages = 10; - friend void swap(NSPanelMQTTManagerCommand_FirstPageTurnLightOff& a, NSPanelMQTTManagerCommand_FirstPageTurnLightOff& b) { a.Swap(&b); } - inline void Swap(NSPanelMQTTManagerCommand_FirstPageTurnLightOff* other) { + friend void swap(NSPanelMQTTManagerCommand_FirstPageTurnLightOn& a, NSPanelMQTTManagerCommand_FirstPageTurnLightOn& b) { a.Swap(&b); } + inline void Swap(NSPanelMQTTManagerCommand_FirstPageTurnLightOn* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetArena() != nullptr && GetArena() == other->GetArena()) { @@ -2701,7 +2978,7 @@ class NSPanelMQTTManagerCommand_FirstPageTurnLightOff final : public ::google::p ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(NSPanelMQTTManagerCommand_FirstPageTurnLightOff* other) { + void UnsafeArenaSwap(NSPanelMQTTManagerCommand_FirstPageTurnLightOn* other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -2709,13 +2986,13 @@ class NSPanelMQTTManagerCommand_FirstPageTurnLightOff final : public ::google::p // implements Message ---------------------------------------------- - NSPanelMQTTManagerCommand_FirstPageTurnLightOff* New(::google::protobuf::Arena* arena = nullptr) const final { - return ::google::protobuf::Message::DefaultConstruct(arena); + NSPanelMQTTManagerCommand_FirstPageTurnLightOn* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& from); + void CopyFrom(const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& from); using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& from) { NSPanelMQTTManagerCommand_FirstPageTurnLightOff::MergeImpl(*this, from); } + void MergeFrom(const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& from) { NSPanelMQTTManagerCommand_FirstPageTurnLightOn::MergeImpl(*this, from); } private: static void MergeImpl( @@ -2736,16 +3013,16 @@ class NSPanelMQTTManagerCommand_FirstPageTurnLightOff final : public ::google::p private: void SharedCtor(::google::protobuf::Arena* arena); void SharedDtor(); - void InternalSwap(NSPanelMQTTManagerCommand_FirstPageTurnLightOff* other); + void InternalSwap(NSPanelMQTTManagerCommand_FirstPageTurnLightOn* other); private: friend class ::google::protobuf::internal::AnyMetadata; - static ::absl::string_view FullMessageName() { return "NSPanelMQTTManagerCommand.FirstPageTurnLightOff"; } + static ::absl::string_view FullMessageName() { return "NSPanelMQTTManagerCommand.FirstPageTurnLightOn"; } protected: - explicit NSPanelMQTTManagerCommand_FirstPageTurnLightOff(::google::protobuf::Arena* arena); - NSPanelMQTTManagerCommand_FirstPageTurnLightOff(::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& from); - NSPanelMQTTManagerCommand_FirstPageTurnLightOff(::google::protobuf::Arena* arena, NSPanelMQTTManagerCommand_FirstPageTurnLightOff&& from) noexcept - : NSPanelMQTTManagerCommand_FirstPageTurnLightOff(arena) { + explicit NSPanelMQTTManagerCommand_FirstPageTurnLightOn(::google::protobuf::Arena* arena); + NSPanelMQTTManagerCommand_FirstPageTurnLightOn(::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& from); + NSPanelMQTTManagerCommand_FirstPageTurnLightOn(::google::protobuf::Arena* arena, NSPanelMQTTManagerCommand_FirstPageTurnLightOn&& from) noexcept + : NSPanelMQTTManagerCommand_FirstPageTurnLightOn(arena) { *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const final; @@ -2757,7 +3034,12 @@ class NSPanelMQTTManagerCommand_FirstPageTurnLightOff final : public ::google::p // accessors ------------------------------------------------------- enum : int { kAffectLightsFieldNumber = 1, - kGlobalFieldNumber = 2, + kBrightnessSliderValueFieldNumber = 2, + kKelvinSliderValueFieldNumber = 3, + kSelectedRoomFieldNumber = 4, + kGlobalFieldNumber = 5, + kHasBrightnessValueFieldNumber = 6, + kHasKelvinValueFieldNumber = 7, }; // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; void clear_affect_lights() ; @@ -2769,27 +3051,692 @@ class NSPanelMQTTManagerCommand_FirstPageTurnLightOff final : public ::google::p void _internal_set_affect_lights(::NSPanelMQTTManagerCommand_AffectLightsOptions value); public: - // bool global = 2; + // int32 brightness_slider_value = 2; + void clear_brightness_slider_value() ; + ::int32_t brightness_slider_value() const; + void set_brightness_slider_value(::int32_t value); + + private: + ::int32_t _internal_brightness_slider_value() const; + void _internal_set_brightness_slider_value(::int32_t value); + + public: + // int32 kelvin_slider_value = 3; + void clear_kelvin_slider_value() ; + ::int32_t kelvin_slider_value() const; + void set_kelvin_slider_value(::int32_t value); + + private: + ::int32_t _internal_kelvin_slider_value() const; + void _internal_set_kelvin_slider_value(::int32_t value); + + public: + // int32 selected_room = 4; + void clear_selected_room() ; + ::int32_t selected_room() const; + void set_selected_room(::int32_t value); + + private: + ::int32_t _internal_selected_room() const; + void _internal_set_selected_room(::int32_t value); + + public: + // bool global = 5; void clear_global() ; bool global() const; void set_global(bool value); private: - bool _internal_global() const; - void _internal_set_global(bool value); + bool _internal_global() const; + void _internal_set_global(bool value); + + public: + // bool has_brightness_value = 6; + void clear_has_brightness_value() ; + bool has_brightness_value() const; + void set_has_brightness_value(bool value); + + private: + bool _internal_has_brightness_value() const; + void _internal_set_has_brightness_value(bool value); + + public: + // bool has_kelvin_value = 7; + void clear_has_kelvin_value() ; + bool has_kelvin_value() const; + void set_has_kelvin_value(bool value); + + private: + bool _internal_has_kelvin_value() const; + void _internal_set_has_kelvin_value(bool value); + + public: + // @@protoc_insertion_point(class_scope:NSPanelMQTTManagerCommand.FirstPageTurnLightOn) + private: + class _Internal; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 3, 7, 0, + 0, 2> + _table_; + + static constexpr const void* _raw_default_instance_ = + &_NSPanelMQTTManagerCommand_FirstPageTurnLightOn_default_instance_; + + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; + struct Impl_ { + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from, + const NSPanelMQTTManagerCommand_FirstPageTurnLightOn& from_msg); + int affect_lights_; + ::int32_t brightness_slider_value_; + ::int32_t kelvin_slider_value_; + ::int32_t selected_room_; + bool global_; + bool has_brightness_value_; + bool has_kelvin_value_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + PROTOBUF_TSAN_DECLARE_MEMBER + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_protobuf_5fnspanel_2eproto; +}; +// ------------------------------------------------------------------- + +class NSPanelMQTTManagerCommand_FirstPageTurnLightOff final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) */ { + public: + inline NSPanelMQTTManagerCommand_FirstPageTurnLightOff() : NSPanelMQTTManagerCommand_FirstPageTurnLightOff(nullptr) {} + ~NSPanelMQTTManagerCommand_FirstPageTurnLightOff() override; + template + explicit PROTOBUF_CONSTEXPR NSPanelMQTTManagerCommand_FirstPageTurnLightOff( + ::google::protobuf::internal::ConstantInitialized); + + inline NSPanelMQTTManagerCommand_FirstPageTurnLightOff(const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& from) : NSPanelMQTTManagerCommand_FirstPageTurnLightOff(nullptr, from) {} + inline NSPanelMQTTManagerCommand_FirstPageTurnLightOff(NSPanelMQTTManagerCommand_FirstPageTurnLightOff&& from) noexcept + : NSPanelMQTTManagerCommand_FirstPageTurnLightOff(nullptr, std::move(from)) {} + inline NSPanelMQTTManagerCommand_FirstPageTurnLightOff& operator=(const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& from) { + CopyFrom(from); + return *this; + } + inline NSPanelMQTTManagerCommand_FirstPageTurnLightOff& operator=(NSPanelMQTTManagerCommand_FirstPageTurnLightOff&& from) noexcept { + if (this == &from) return *this; + if (GetArena() == from.GetArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetArena() != nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::google::protobuf::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::google::protobuf::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& default_instance() { + return *internal_default_instance(); + } + static inline const NSPanelMQTTManagerCommand_FirstPageTurnLightOff* internal_default_instance() { + return reinterpret_cast( + &_NSPanelMQTTManagerCommand_FirstPageTurnLightOff_default_instance_); + } + static constexpr int kIndexInFileMessages = 11; + friend void swap(NSPanelMQTTManagerCommand_FirstPageTurnLightOff& a, NSPanelMQTTManagerCommand_FirstPageTurnLightOff& b) { a.Swap(&b); } + inline void Swap(NSPanelMQTTManagerCommand_FirstPageTurnLightOff* other) { + if (other == this) return; +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() != nullptr && GetArena() == other->GetArena()) { +#else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() == other->GetArena()) { +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::google::protobuf::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(NSPanelMQTTManagerCommand_FirstPageTurnLightOff* other) { + if (other == this) return; + ABSL_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + NSPanelMQTTManagerCommand_FirstPageTurnLightOff* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); + } + using ::google::protobuf::Message::CopyFrom; + void CopyFrom(const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& from); + using ::google::protobuf::Message::MergeFrom; + void MergeFrom(const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& from) { NSPanelMQTTManagerCommand_FirstPageTurnLightOff::MergeImpl(*this, from); } + + private: + static void MergeImpl( + ::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); + + public: + bool IsInitialized() const { + return true; + } + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; + ::size_t ByteSizeLong() const final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::google::protobuf::Arena* arena); + void SharedDtor(); + void InternalSwap(NSPanelMQTTManagerCommand_FirstPageTurnLightOff* other); + private: + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "NSPanelMQTTManagerCommand.FirstPageTurnLightOff"; } + + protected: + explicit NSPanelMQTTManagerCommand_FirstPageTurnLightOff(::google::protobuf::Arena* arena); + NSPanelMQTTManagerCommand_FirstPageTurnLightOff(::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& from); + NSPanelMQTTManagerCommand_FirstPageTurnLightOff(::google::protobuf::Arena* arena, NSPanelMQTTManagerCommand_FirstPageTurnLightOff&& from) noexcept + : NSPanelMQTTManagerCommand_FirstPageTurnLightOff(arena) { + *this = ::std::move(from); + } + const ::google::protobuf::Message::ClassData* GetClassData() const final; + + public: + ::google::protobuf::Metadata GetMetadata() const; + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + enum : int { + kAffectLightsFieldNumber = 1, + kGlobalFieldNumber = 2, + }; + // .NSPanelMQTTManagerCommand.AffectLightsOptions affect_lights = 1; + void clear_affect_lights() ; + ::NSPanelMQTTManagerCommand_AffectLightsOptions affect_lights() const; + void set_affect_lights(::NSPanelMQTTManagerCommand_AffectLightsOptions value); + + private: + ::NSPanelMQTTManagerCommand_AffectLightsOptions _internal_affect_lights() const; + void _internal_set_affect_lights(::NSPanelMQTTManagerCommand_AffectLightsOptions value); + + public: + // bool global = 2; + void clear_global() ; + bool global() const; + void set_global(bool value); + + private: + bool _internal_global() const; + void _internal_set_global(bool value); + + public: + // @@protoc_insertion_point(class_scope:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) + private: + class _Internal; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 1, 2, 0, + 0, 2> + _table_; + + static constexpr const void* _raw_default_instance_ = + &_NSPanelMQTTManagerCommand_FirstPageTurnLightOff_default_instance_; + + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; + struct Impl_ { + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from, + const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& from_msg); + int affect_lights_; + bool global_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + PROTOBUF_TSAN_DECLARE_MEMBER + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_protobuf_5fnspanel_2eproto; +}; +// ------------------------------------------------------------------- + +class NSPanelMQTTManagerCommand_CoverCommand final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:NSPanelMQTTManagerCommand.CoverCommand) */ { + public: + inline NSPanelMQTTManagerCommand_CoverCommand() : NSPanelMQTTManagerCommand_CoverCommand(nullptr) {} + ~NSPanelMQTTManagerCommand_CoverCommand() override; + template + explicit PROTOBUF_CONSTEXPR NSPanelMQTTManagerCommand_CoverCommand( + ::google::protobuf::internal::ConstantInitialized); + + inline NSPanelMQTTManagerCommand_CoverCommand(const NSPanelMQTTManagerCommand_CoverCommand& from) : NSPanelMQTTManagerCommand_CoverCommand(nullptr, from) {} + inline NSPanelMQTTManagerCommand_CoverCommand(NSPanelMQTTManagerCommand_CoverCommand&& from) noexcept + : NSPanelMQTTManagerCommand_CoverCommand(nullptr, std::move(from)) {} + inline NSPanelMQTTManagerCommand_CoverCommand& operator=(const NSPanelMQTTManagerCommand_CoverCommand& from) { + CopyFrom(from); + return *this; + } + inline NSPanelMQTTManagerCommand_CoverCommand& operator=(NSPanelMQTTManagerCommand_CoverCommand&& from) noexcept { + if (this == &from) return *this; + if (GetArena() == from.GetArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetArena() != nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::google::protobuf::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::google::protobuf::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const NSPanelMQTTManagerCommand_CoverCommand& default_instance() { + return *internal_default_instance(); + } + static inline const NSPanelMQTTManagerCommand_CoverCommand* internal_default_instance() { + return reinterpret_cast( + &_NSPanelMQTTManagerCommand_CoverCommand_default_instance_); + } + static constexpr int kIndexInFileMessages = 19; + friend void swap(NSPanelMQTTManagerCommand_CoverCommand& a, NSPanelMQTTManagerCommand_CoverCommand& b) { a.Swap(&b); } + inline void Swap(NSPanelMQTTManagerCommand_CoverCommand* other) { + if (other == this) return; +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() != nullptr && GetArena() == other->GetArena()) { +#else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() == other->GetArena()) { +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::google::protobuf::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(NSPanelMQTTManagerCommand_CoverCommand* other) { + if (other == this) return; + ABSL_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + NSPanelMQTTManagerCommand_CoverCommand* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); + } + using ::google::protobuf::Message::CopyFrom; + void CopyFrom(const NSPanelMQTTManagerCommand_CoverCommand& from); + using ::google::protobuf::Message::MergeFrom; + void MergeFrom(const NSPanelMQTTManagerCommand_CoverCommand& from) { NSPanelMQTTManagerCommand_CoverCommand::MergeImpl(*this, from); } + + private: + static void MergeImpl( + ::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); + + public: + bool IsInitialized() const { + return true; + } + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; + ::size_t ByteSizeLong() const final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::google::protobuf::Arena* arena); + void SharedDtor(); + void InternalSwap(NSPanelMQTTManagerCommand_CoverCommand* other); + private: + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "NSPanelMQTTManagerCommand.CoverCommand"; } + + protected: + explicit NSPanelMQTTManagerCommand_CoverCommand(::google::protobuf::Arena* arena); + NSPanelMQTTManagerCommand_CoverCommand(::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_CoverCommand& from); + NSPanelMQTTManagerCommand_CoverCommand(::google::protobuf::Arena* arena, NSPanelMQTTManagerCommand_CoverCommand&& from) noexcept + : NSPanelMQTTManagerCommand_CoverCommand(arena) { + *this = ::std::move(from); + } + const ::google::protobuf::Message::ClassData* GetClassData() const final; + + public: + ::google::protobuf::Metadata GetMetadata() const; + // nested types ---------------------------------------------------- + using Action = NSPanelMQTTManagerCommand_CoverCommand_Action; + static constexpr Action NONE = NSPanelMQTTManagerCommand_CoverCommand_Action_NONE; + static constexpr Action OPEN = NSPanelMQTTManagerCommand_CoverCommand_Action_OPEN; + static constexpr Action CLOSE = NSPanelMQTTManagerCommand_CoverCommand_Action_CLOSE; + static constexpr Action STOP = NSPanelMQTTManagerCommand_CoverCommand_Action_STOP; + static constexpr Action OPEN_TILT = NSPanelMQTTManagerCommand_CoverCommand_Action_OPEN_TILT; + static constexpr Action CLOSE_TILT = NSPanelMQTTManagerCommand_CoverCommand_Action_CLOSE_TILT; + static constexpr Action STOP_TILT = NSPanelMQTTManagerCommand_CoverCommand_Action_STOP_TILT; + static inline bool Action_IsValid(int value) { + return NSPanelMQTTManagerCommand_CoverCommand_Action_IsValid(value); + } + static constexpr Action Action_MIN = NSPanelMQTTManagerCommand_CoverCommand_Action_Action_MIN; + static constexpr Action Action_MAX = NSPanelMQTTManagerCommand_CoverCommand_Action_Action_MAX; + static constexpr int Action_ARRAYSIZE = NSPanelMQTTManagerCommand_CoverCommand_Action_Action_ARRAYSIZE; + static inline const ::google::protobuf::EnumDescriptor* Action_descriptor() { + return NSPanelMQTTManagerCommand_CoverCommand_Action_descriptor(); + } + template + static inline const std::string& Action_Name(T value) { + return NSPanelMQTTManagerCommand_CoverCommand_Action_Name(value); + } + static inline bool Action_Parse(absl::string_view name, Action* value) { + return NSPanelMQTTManagerCommand_CoverCommand_Action_Parse(name, value); + } + + // accessors ------------------------------------------------------- + enum : int { + kCoverIdFieldNumber = 1, + kActionFieldNumber = 2, + kPositionFieldNumber = 4, + kHasPositionFieldNumber = 3, + kHasTiltPositionFieldNumber = 5, + kTiltPositionFieldNumber = 6, + }; + // int32 cover_id = 1; + void clear_cover_id() ; + ::int32_t cover_id() const; + void set_cover_id(::int32_t value); + + private: + ::int32_t _internal_cover_id() const; + void _internal_set_cover_id(::int32_t value); + + public: + // .NSPanelMQTTManagerCommand.CoverCommand.Action action = 2; + void clear_action() ; + ::NSPanelMQTTManagerCommand_CoverCommand_Action action() const; + void set_action(::NSPanelMQTTManagerCommand_CoverCommand_Action value); + + private: + ::NSPanelMQTTManagerCommand_CoverCommand_Action _internal_action() const; + void _internal_set_action(::NSPanelMQTTManagerCommand_CoverCommand_Action value); + + public: + // int32 position = 4; + void clear_position() ; + ::int32_t position() const; + void set_position(::int32_t value); + + private: + ::int32_t _internal_position() const; + void _internal_set_position(::int32_t value); + + public: + // bool has_position = 3; + void clear_has_position() ; + bool has_position() const; + void set_has_position(bool value); + + private: + bool _internal_has_position() const; + void _internal_set_has_position(bool value); + + public: + // bool has_tilt_position = 5; + void clear_has_tilt_position() ; + bool has_tilt_position() const; + void set_has_tilt_position(bool value); + + private: + bool _internal_has_tilt_position() const; + void _internal_set_has_tilt_position(bool value); + + public: + // int32 tilt_position = 6; + void clear_tilt_position() ; + ::int32_t tilt_position() const; + void set_tilt_position(::int32_t value); + + private: + ::int32_t _internal_tilt_position() const; + void _internal_set_tilt_position(::int32_t value); + + public: + // @@protoc_insertion_point(class_scope:NSPanelMQTTManagerCommand.CoverCommand) + private: + class _Internal; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 3, 6, 0, + 0, 2> + _table_; + + static constexpr const void* _raw_default_instance_ = + &_NSPanelMQTTManagerCommand_CoverCommand_default_instance_; + + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; + struct Impl_ { + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from, + const NSPanelMQTTManagerCommand_CoverCommand& from_msg); + ::int32_t cover_id_; + int action_; + ::int32_t position_; + bool has_position_; + bool has_tilt_position_; + ::int32_t tilt_position_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + PROTOBUF_TSAN_DECLARE_MEMBER + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_protobuf_5fnspanel_2eproto; +}; +// ------------------------------------------------------------------- + +class NSPanelMQTTManagerCommand_ButtonPressed final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:NSPanelMQTTManagerCommand.ButtonPressed) */ { + public: + inline NSPanelMQTTManagerCommand_ButtonPressed() : NSPanelMQTTManagerCommand_ButtonPressed(nullptr) {} + ~NSPanelMQTTManagerCommand_ButtonPressed() override; + template + explicit PROTOBUF_CONSTEXPR NSPanelMQTTManagerCommand_ButtonPressed( + ::google::protobuf::internal::ConstantInitialized); + + inline NSPanelMQTTManagerCommand_ButtonPressed(const NSPanelMQTTManagerCommand_ButtonPressed& from) : NSPanelMQTTManagerCommand_ButtonPressed(nullptr, from) {} + inline NSPanelMQTTManagerCommand_ButtonPressed(NSPanelMQTTManagerCommand_ButtonPressed&& from) noexcept + : NSPanelMQTTManagerCommand_ButtonPressed(nullptr, std::move(from)) {} + inline NSPanelMQTTManagerCommand_ButtonPressed& operator=(const NSPanelMQTTManagerCommand_ButtonPressed& from) { + CopyFrom(from); + return *this; + } + inline NSPanelMQTTManagerCommand_ButtonPressed& operator=(NSPanelMQTTManagerCommand_ButtonPressed&& from) noexcept { + if (this == &from) return *this; + if (GetArena() == from.GetArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetArena() != nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::google::protobuf::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::google::protobuf::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const NSPanelMQTTManagerCommand_ButtonPressed& default_instance() { + return *internal_default_instance(); + } + static inline const NSPanelMQTTManagerCommand_ButtonPressed* internal_default_instance() { + return reinterpret_cast( + &_NSPanelMQTTManagerCommand_ButtonPressed_default_instance_); + } + static constexpr int kIndexInFileMessages = 15; + friend void swap(NSPanelMQTTManagerCommand_ButtonPressed& a, NSPanelMQTTManagerCommand_ButtonPressed& b) { a.Swap(&b); } + inline void Swap(NSPanelMQTTManagerCommand_ButtonPressed* other) { + if (other == this) return; +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() != nullptr && GetArena() == other->GetArena()) { +#else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() == other->GetArena()) { +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::google::protobuf::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(NSPanelMQTTManagerCommand_ButtonPressed* other) { + if (other == this) return; + ABSL_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + NSPanelMQTTManagerCommand_ButtonPressed* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); + } + using ::google::protobuf::Message::CopyFrom; + void CopyFrom(const NSPanelMQTTManagerCommand_ButtonPressed& from); + using ::google::protobuf::Message::MergeFrom; + void MergeFrom(const NSPanelMQTTManagerCommand_ButtonPressed& from) { NSPanelMQTTManagerCommand_ButtonPressed::MergeImpl(*this, from); } + + private: + static void MergeImpl( + ::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); + + public: + bool IsInitialized() const { + return true; + } + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; + ::size_t ByteSizeLong() const final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::google::protobuf::Arena* arena); + void SharedDtor(); + void InternalSwap(NSPanelMQTTManagerCommand_ButtonPressed* other); + private: + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "NSPanelMQTTManagerCommand.ButtonPressed"; } + + protected: + explicit NSPanelMQTTManagerCommand_ButtonPressed(::google::protobuf::Arena* arena); + NSPanelMQTTManagerCommand_ButtonPressed(::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_ButtonPressed& from); + NSPanelMQTTManagerCommand_ButtonPressed(::google::protobuf::Arena* arena, NSPanelMQTTManagerCommand_ButtonPressed&& from) noexcept + : NSPanelMQTTManagerCommand_ButtonPressed(arena) { + *this = ::std::move(from); + } + const ::google::protobuf::Message::ClassData* GetClassData() const final; + + public: + ::google::protobuf::Metadata GetMetadata() const; + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + enum : int { + kButtonIdFieldNumber = 2, + }; + // int32 button_id = 2; + void clear_button_id() ; + ::int32_t button_id() const; + void set_button_id(::int32_t value); + + private: + ::int32_t _internal_button_id() const; + void _internal_set_button_id(::int32_t value); public: - // @@protoc_insertion_point(class_scope:NSPanelMQTTManagerCommand.FirstPageTurnLightOff) + // @@protoc_insertion_point(class_scope:NSPanelMQTTManagerCommand.ButtonPressed) private: class _Internal; friend class ::google::protobuf::internal::TcParser; static const ::google::protobuf::internal::TcParseTable< - 1, 2, 0, + 0, 1, 0, 0, 2> _table_; static constexpr const void* _raw_default_instance_ = - &_NSPanelMQTTManagerCommand_FirstPageTurnLightOff_default_instance_; + &_NSPanelMQTTManagerCommand_ButtonPressed_default_instance_; friend class ::google::protobuf::MessageLite; friend class ::google::protobuf::Arena; @@ -2804,9 +3751,8 @@ class NSPanelMQTTManagerCommand_FirstPageTurnLightOff final : public ::google::p ::google::protobuf::Arena* arena); inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, - const NSPanelMQTTManagerCommand_FirstPageTurnLightOff& from_msg); - int affect_lights_; - bool global_; + const NSPanelMQTTManagerCommand_ButtonPressed& from_msg); + ::int32_t button_id_; mutable ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; @@ -2815,23 +3761,23 @@ class NSPanelMQTTManagerCommand_FirstPageTurnLightOff final : public ::google::p }; // ------------------------------------------------------------------- -class NSPanelMQTTManagerCommand_ButtonPressed final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:NSPanelMQTTManagerCommand.ButtonPressed) */ { +class NSPanelConfig_Sound final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:NSPanelConfig.Sound) */ { public: - inline NSPanelMQTTManagerCommand_ButtonPressed() : NSPanelMQTTManagerCommand_ButtonPressed(nullptr) {} - ~NSPanelMQTTManagerCommand_ButtonPressed() override; + inline NSPanelConfig_Sound() : NSPanelConfig_Sound(nullptr) {} + ~NSPanelConfig_Sound() override; template - explicit PROTOBUF_CONSTEXPR NSPanelMQTTManagerCommand_ButtonPressed( + explicit PROTOBUF_CONSTEXPR NSPanelConfig_Sound( ::google::protobuf::internal::ConstantInitialized); - inline NSPanelMQTTManagerCommand_ButtonPressed(const NSPanelMQTTManagerCommand_ButtonPressed& from) : NSPanelMQTTManagerCommand_ButtonPressed(nullptr, from) {} - inline NSPanelMQTTManagerCommand_ButtonPressed(NSPanelMQTTManagerCommand_ButtonPressed&& from) noexcept - : NSPanelMQTTManagerCommand_ButtonPressed(nullptr, std::move(from)) {} - inline NSPanelMQTTManagerCommand_ButtonPressed& operator=(const NSPanelMQTTManagerCommand_ButtonPressed& from) { + inline NSPanelConfig_Sound(const NSPanelConfig_Sound& from) : NSPanelConfig_Sound(nullptr, from) {} + inline NSPanelConfig_Sound(NSPanelConfig_Sound&& from) noexcept + : NSPanelConfig_Sound(nullptr, std::move(from)) {} + inline NSPanelConfig_Sound& operator=(const NSPanelConfig_Sound& from) { CopyFrom(from); return *this; } - inline NSPanelMQTTManagerCommand_ButtonPressed& operator=(NSPanelMQTTManagerCommand_ButtonPressed&& from) noexcept { + inline NSPanelConfig_Sound& operator=(NSPanelConfig_Sound&& from) noexcept { if (this == &from) return *this; if (GetArena() == from.GetArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE @@ -2863,16 +3809,16 @@ class NSPanelMQTTManagerCommand_ButtonPressed final : public ::google::protobuf: static const ::google::protobuf::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } - static const NSPanelMQTTManagerCommand_ButtonPressed& default_instance() { + static const NSPanelConfig_Sound& default_instance() { return *internal_default_instance(); } - static inline const NSPanelMQTTManagerCommand_ButtonPressed* internal_default_instance() { - return reinterpret_cast( - &_NSPanelMQTTManagerCommand_ButtonPressed_default_instance_); + static inline const NSPanelConfig_Sound* internal_default_instance() { + return reinterpret_cast( + &_NSPanelConfig_Sound_default_instance_); } - static constexpr int kIndexInFileMessages = 14; - friend void swap(NSPanelMQTTManagerCommand_ButtonPressed& a, NSPanelMQTTManagerCommand_ButtonPressed& b) { a.Swap(&b); } - inline void Swap(NSPanelMQTTManagerCommand_ButtonPressed* other) { + static constexpr int kIndexInFileMessages = 1; + friend void swap(NSPanelConfig_Sound& a, NSPanelConfig_Sound& b) { a.Swap(&b); } + inline void Swap(NSPanelConfig_Sound* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetArena() != nullptr && GetArena() == other->GetArena()) { @@ -2884,7 +3830,7 @@ class NSPanelMQTTManagerCommand_ButtonPressed final : public ::google::protobuf: ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(NSPanelMQTTManagerCommand_ButtonPressed* other) { + void UnsafeArenaSwap(NSPanelConfig_Sound* other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -2892,13 +3838,13 @@ class NSPanelMQTTManagerCommand_ButtonPressed final : public ::google::protobuf: // implements Message ---------------------------------------------- - NSPanelMQTTManagerCommand_ButtonPressed* New(::google::protobuf::Arena* arena = nullptr) const final { - return ::google::protobuf::Message::DefaultConstruct(arena); + NSPanelConfig_Sound* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const NSPanelMQTTManagerCommand_ButtonPressed& from); + void CopyFrom(const NSPanelConfig_Sound& from); using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const NSPanelMQTTManagerCommand_ButtonPressed& from) { NSPanelMQTTManagerCommand_ButtonPressed::MergeImpl(*this, from); } + void MergeFrom(const NSPanelConfig_Sound& from) { NSPanelConfig_Sound::MergeImpl(*this, from); } private: static void MergeImpl( @@ -2919,16 +3865,16 @@ class NSPanelMQTTManagerCommand_ButtonPressed final : public ::google::protobuf: private: void SharedCtor(::google::protobuf::Arena* arena); void SharedDtor(); - void InternalSwap(NSPanelMQTTManagerCommand_ButtonPressed* other); + void InternalSwap(NSPanelConfig_Sound* other); private: friend class ::google::protobuf::internal::AnyMetadata; - static ::absl::string_view FullMessageName() { return "NSPanelMQTTManagerCommand.ButtonPressed"; } + static ::absl::string_view FullMessageName() { return "NSPanelConfig.Sound"; } protected: - explicit NSPanelMQTTManagerCommand_ButtonPressed(::google::protobuf::Arena* arena); - NSPanelMQTTManagerCommand_ButtonPressed(::google::protobuf::Arena* arena, const NSPanelMQTTManagerCommand_ButtonPressed& from); - NSPanelMQTTManagerCommand_ButtonPressed(::google::protobuf::Arena* arena, NSPanelMQTTManagerCommand_ButtonPressed&& from) noexcept - : NSPanelMQTTManagerCommand_ButtonPressed(arena) { + explicit NSPanelConfig_Sound(::google::protobuf::Arena* arena); + NSPanelConfig_Sound(::google::protobuf::Arena* arena, const NSPanelConfig_Sound& from); + NSPanelConfig_Sound(::google::protobuf::Arena* arena, NSPanelConfig_Sound&& from) noexcept + : NSPanelConfig_Sound(arena) { *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const final; @@ -2939,29 +3885,46 @@ class NSPanelMQTTManagerCommand_ButtonPressed final : public ::google::protobuf: // accessors ------------------------------------------------------- enum : int { - kButtonIdFieldNumber = 2, + kRtttlFieldNumber = 2, + kEventFieldNumber = 1, }; - // int32 button_id = 2; - void clear_button_id() ; - ::int32_t button_id() const; - void set_button_id(::int32_t value); + // string rtttl = 2; + void clear_rtttl() ; + const std::string& rtttl() const; + template + void set_rtttl(Arg_&& arg, Args_... args); + std::string* mutable_rtttl(); + PROTOBUF_NODISCARD std::string* release_rtttl(); + void set_allocated_rtttl(std::string* value); private: - ::int32_t _internal_button_id() const; - void _internal_set_button_id(::int32_t value); + const std::string& _internal_rtttl() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_rtttl( + const std::string& value); + std::string* _internal_mutable_rtttl(); public: - // @@protoc_insertion_point(class_scope:NSPanelMQTTManagerCommand.ButtonPressed) + // .NSPanelConfig.NSPanelSoundEvent event = 1; + void clear_event() ; + ::NSPanelConfig_NSPanelSoundEvent event() const; + void set_event(::NSPanelConfig_NSPanelSoundEvent value); + + private: + ::NSPanelConfig_NSPanelSoundEvent _internal_event() const; + void _internal_set_event(::NSPanelConfig_NSPanelSoundEvent value); + + public: + // @@protoc_insertion_point(class_scope:NSPanelConfig.Sound) private: class _Internal; friend class ::google::protobuf::internal::TcParser; static const ::google::protobuf::internal::TcParseTable< - 0, 1, 0, - 0, 2> + 1, 2, 0, + 33, 2> _table_; static constexpr const void* _raw_default_instance_ = - &_NSPanelMQTTManagerCommand_ButtonPressed_default_instance_; + &_NSPanelConfig_Sound_default_instance_; friend class ::google::protobuf::MessageLite; friend class ::google::protobuf::Arena; @@ -2976,8 +3939,9 @@ class NSPanelMQTTManagerCommand_ButtonPressed final : public ::google::protobuf: ::google::protobuf::Arena* arena); inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, - const NSPanelMQTTManagerCommand_ButtonPressed& from_msg); - ::int32_t button_id_; + const NSPanelConfig_Sound& from_msg); + ::google::protobuf::internal::ArenaStringPtr rtttl_; + int event_; mutable ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; @@ -3254,7 +4218,7 @@ class NSPanelWeatherUpdate final : public ::google::protobuf::Message return reinterpret_cast( &_NSPanelWeatherUpdate_default_instance_); } - static constexpr int kIndexInFileMessages = 8; + static constexpr int kIndexInFileMessages = 9; friend void swap(NSPanelWeatherUpdate& a, NSPanelWeatherUpdate& b) { a.Swap(&b); } inline void Swap(NSPanelWeatherUpdate* other) { if (other == this) return; @@ -3559,7 +4523,7 @@ class NSPanelStatusReport final : public ::google::protobuf::Message return reinterpret_cast( &_NSPanelStatusReport_default_instance_); } - static constexpr int kIndexInFileMessages = 3; + static constexpr int kIndexInFileMessages = 4; friend void swap(NSPanelStatusReport& a, NSPanelStatusReport& b) { a.Swap(&b); } inline void Swap(NSPanelStatusReport* other) { if (other == this) return; @@ -3631,6 +4595,7 @@ class NSPanelStatusReport final : public ::google::protobuf::Message static constexpr state UPDATING_TFT = NSPanelStatusReport_state_UPDATING_TFT; static constexpr state UPDATING_FIRMWARE = NSPanelStatusReport_state_UPDATING_FIRMWARE; static constexpr state UPDATING_LITTLEFS = NSPanelStatusReport_state_UPDATING_LITTLEFS; + static constexpr state REBOOTING = NSPanelStatusReport_state_REBOOTING; static inline bool state_IsValid(int value) { return NSPanelStatusReport_state_IsValid(value); } @@ -3957,7 +4922,7 @@ class NSPanelRoomEntitiesPage final : public ::google::protobuf::Message return reinterpret_cast( &_NSPanelRoomEntitiesPage_default_instance_); } - static constexpr int kIndexInFileMessages = 5; + static constexpr int kIndexInFileMessages = 6; friend void swap(NSPanelRoomEntitiesPage& a, NSPanelRoomEntitiesPage& b) { a.Swap(&b); } inline void Swap(NSPanelRoomEntitiesPage* other) { if (other == this) return; @@ -4183,13 +5148,15 @@ class NSPanelMQTTManagerCommand final : public ::google::protobuf::Message kButtonPressed = 6, kThermostatTemperatureCommand = 7, kThermostatCommand = 8, + kMediaPlayerCommand = 9, + kCoverCommand = 10, COMMANDDATA_NOT_SET = 0, }; static inline const NSPanelMQTTManagerCommand* internal_default_instance() { return reinterpret_cast( &_NSPanelMQTTManagerCommand_default_instance_); } - static constexpr int kIndexInFileMessages = 17; + static constexpr int kIndexInFileMessages = 20; friend void swap(NSPanelMQTTManagerCommand& a, NSPanelMQTTManagerCommand& b) { a.Swap(&b); } inline void Swap(NSPanelMQTTManagerCommand* other) { if (other == this) return; @@ -4263,6 +5230,8 @@ class NSPanelMQTTManagerCommand final : public ::google::protobuf::Message using ButtonPressed = NSPanelMQTTManagerCommand_ButtonPressed; using ThermostatTemperatureCommand = NSPanelMQTTManagerCommand_ThermostatTemperatureCommand; using ThermostatCommand = NSPanelMQTTManagerCommand_ThermostatCommand; + using MediaPlayerCommand = NSPanelMQTTManagerCommand_MediaPlayerCommand; + using CoverCommand = NSPanelMQTTManagerCommand_CoverCommand; using AffectLightsOptions = NSPanelMQTTManagerCommand_AffectLightsOptions; static constexpr AffectLightsOptions ALL = NSPanelMQTTManagerCommand_AffectLightsOptions_ALL; static constexpr AffectLightsOptions TABLE_LIGHTS = NSPanelMQTTManagerCommand_AffectLightsOptions_TABLE_LIGHTS; @@ -4295,6 +5264,8 @@ class NSPanelMQTTManagerCommand final : public ::google::protobuf::Message kButtonPressedFieldNumber = 6, kThermostatTemperatureCommandFieldNumber = 7, kThermostatCommandFieldNumber = 8, + kMediaPlayerCommandFieldNumber = 9, + kCoverCommandFieldNumber = 10, }; // int32 nspanel_id = 100; void clear_nspanel_id() ; @@ -4457,6 +5428,44 @@ class NSPanelMQTTManagerCommand final : public ::google::protobuf::Message const ::NSPanelMQTTManagerCommand_ThermostatCommand& _internal_thermostat_command() const; ::NSPanelMQTTManagerCommand_ThermostatCommand* _internal_mutable_thermostat_command(); + public: + // .NSPanelMQTTManagerCommand.MediaPlayerCommand media_player_command = 9; + bool has_media_player_command() const; + private: + bool _internal_has_media_player_command() const; + + public: + void clear_media_player_command() ; + const ::NSPanelMQTTManagerCommand_MediaPlayerCommand& media_player_command() const; + PROTOBUF_NODISCARD ::NSPanelMQTTManagerCommand_MediaPlayerCommand* release_media_player_command(); + ::NSPanelMQTTManagerCommand_MediaPlayerCommand* mutable_media_player_command(); + void set_allocated_media_player_command(::NSPanelMQTTManagerCommand_MediaPlayerCommand* value); + void unsafe_arena_set_allocated_media_player_command(::NSPanelMQTTManagerCommand_MediaPlayerCommand* value); + ::NSPanelMQTTManagerCommand_MediaPlayerCommand* unsafe_arena_release_media_player_command(); + + private: + const ::NSPanelMQTTManagerCommand_MediaPlayerCommand& _internal_media_player_command() const; + ::NSPanelMQTTManagerCommand_MediaPlayerCommand* _internal_mutable_media_player_command(); + + public: + // .NSPanelMQTTManagerCommand.CoverCommand cover_command = 10; + bool has_cover_command() const; + private: + bool _internal_has_cover_command() const; + + public: + void clear_cover_command() ; + const ::NSPanelMQTTManagerCommand_CoverCommand& cover_command() const; + PROTOBUF_NODISCARD ::NSPanelMQTTManagerCommand_CoverCommand* release_cover_command(); + ::NSPanelMQTTManagerCommand_CoverCommand* mutable_cover_command(); + void set_allocated_cover_command(::NSPanelMQTTManagerCommand_CoverCommand* value); + void unsafe_arena_set_allocated_cover_command(::NSPanelMQTTManagerCommand_CoverCommand* value); + ::NSPanelMQTTManagerCommand_CoverCommand* unsafe_arena_release_cover_command(); + + private: + const ::NSPanelMQTTManagerCommand_CoverCommand& _internal_cover_command() const; + ::NSPanelMQTTManagerCommand_CoverCommand* _internal_mutable_cover_command(); + public: void clear_CommandData(); CommandDataCase CommandData_case() const; @@ -4471,11 +5480,13 @@ class NSPanelMQTTManagerCommand final : public ::google::protobuf::Message void set_has_button_pressed(); void set_has_thermostat_temperature_command(); void set_has_thermostat_command(); + void set_has_media_player_command(); + void set_has_cover_command(); inline bool has_CommandData() const; inline void clear_has_CommandData(); friend class ::google::protobuf::internal::TcParser; static const ::google::protobuf::internal::TcParseTable< - 0, 9, 8, + 0, 11, 10, 0, 7> _table_; @@ -4508,6 +5519,8 @@ class NSPanelMQTTManagerCommand final : public ::google::protobuf::Message ::NSPanelMQTTManagerCommand_ButtonPressed* button_pressed_; ::NSPanelMQTTManagerCommand_ThermostatTemperatureCommand* thermostat_temperature_command_; ::NSPanelMQTTManagerCommand_ThermostatCommand* thermostat_command_; + ::NSPanelMQTTManagerCommand_MediaPlayerCommand* media_player_command_; + ::NSPanelMQTTManagerCommand_CoverCommand* cover_command_; } CommandData_; mutable ::google::protobuf::internal::CachedSize _cached_size_; ::uint32_t _oneof_case_[1]; @@ -4573,7 +5586,7 @@ class NSPanelConfig final : public ::google::protobuf::Message return reinterpret_cast( &_NSPanelConfig_default_instance_); } - static constexpr int kIndexInFileMessages = 1; + static constexpr int kIndexInFileMessages = 2; friend void swap(NSPanelConfig& a, NSPanelConfig& b) { a.Swap(&b); } inline void Swap(NSPanelConfig* other) { if (other == this) return; @@ -4640,6 +5653,7 @@ class NSPanelConfig final : public ::google::protobuf::Message ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- using RoomInfo = NSPanelConfig_RoomInfo; + using Sound = NSPanelConfig_Sound; using NSPanelDefaultPage = NSPanelConfig_NSPanelDefaultPage; static constexpr NSPanelDefaultPage HOME = NSPanelConfig_NSPanelDefaultPage_HOME; static constexpr NSPanelDefaultPage SCENES = NSPanelConfig_NSPanelDefaultPage_SCENES; @@ -4688,6 +5702,7 @@ class NSPanelConfig final : public ::google::protobuf::Message static constexpr NSPanelButtonMode NOTIFY_MANAGER = NSPanelConfig_NSPanelButtonMode_NOTIFY_MANAGER; static constexpr NSPanelButtonMode THERMOSTAT_HEAT = NSPanelConfig_NSPanelButtonMode_THERMOSTAT_HEAT; static constexpr NSPanelButtonMode THERMOSTAT_COOL = NSPanelConfig_NSPanelButtonMode_THERMOSTAT_COOL; + static constexpr NSPanelButtonMode OPEN_ENTITY_PAGE = NSPanelConfig_NSPanelButtonMode_OPEN_ENTITY_PAGE; static inline bool NSPanelButtonMode_IsValid(int value) { return NSPanelConfig_NSPanelButtonMode_IsValid(value); } @@ -4704,6 +5719,26 @@ class NSPanelConfig final : public ::google::protobuf::Message static inline bool NSPanelButtonMode_Parse(absl::string_view name, NSPanelButtonMode* value) { return NSPanelConfig_NSPanelButtonMode_Parse(name, value); } + using NSPanelSoundEvent = NSPanelConfig_NSPanelSoundEvent; + static constexpr NSPanelSoundEvent TOUCH = NSPanelConfig_NSPanelSoundEvent_TOUCH; + static constexpr NSPanelSoundEvent SCENE_ACTIVATED = NSPanelConfig_NSPanelSoundEvent_SCENE_ACTIVATED; + static constexpr NSPanelSoundEvent SCENE_SAVED = NSPanelConfig_NSPanelSoundEvent_SCENE_SAVED; + static inline bool NSPanelSoundEvent_IsValid(int value) { + return NSPanelConfig_NSPanelSoundEvent_IsValid(value); + } + static constexpr NSPanelSoundEvent NSPanelSoundEvent_MIN = NSPanelConfig_NSPanelSoundEvent_NSPanelSoundEvent_MIN; + static constexpr NSPanelSoundEvent NSPanelSoundEvent_MAX = NSPanelConfig_NSPanelSoundEvent_NSPanelSoundEvent_MAX; + static constexpr int NSPanelSoundEvent_ARRAYSIZE = NSPanelConfig_NSPanelSoundEvent_NSPanelSoundEvent_ARRAYSIZE; + static inline const ::google::protobuf::EnumDescriptor* NSPanelSoundEvent_descriptor() { + return NSPanelConfig_NSPanelSoundEvent_descriptor(); + } + template + static inline const std::string& NSPanelSoundEvent_Name(T value) { + return NSPanelConfig_NSPanelSoundEvent_Name(value); + } + static inline bool NSPanelSoundEvent_Parse(absl::string_view name, NSPanelSoundEvent* value) { + return NSPanelConfig_NSPanelSoundEvent_Parse(name, value); + } // accessors ------------------------------------------------------- enum : int { @@ -4711,8 +5746,12 @@ class NSPanelConfig final : public ::google::protobuf::Message kGlobalSceneEntityPageIdsFieldNumber = 30, kRelay1RelayGroupFieldNumber = 35, kRelay2RelayGroupFieldNumber = 37, + kSoundsFieldNumber = 45, kNameFieldNumber = 1, kInsideTemperatureSensorMqttTopicFieldNumber = 40, + kTzPosixFieldNumber = 46, + kButton1EntityPageTopicFieldNumber = 47, + kButton2EntityPageTopicFieldNumber = 48, kDefaultRoomFieldNumber = 2, kDefaultPageFieldNumber = 3, kScreensaverActivationTimeoutFieldNumber = 4, @@ -4815,6 +5854,23 @@ class NSPanelConfig final : public ::google::protobuf::Message ::google::protobuf::RepeatedField<::int32_t>* _internal_mutable_relay2_relay_group(); public: + // repeated .NSPanelConfig.Sound sounds = 45; + int sounds_size() const; + private: + int _internal_sounds_size() const; + + public: + void clear_sounds() ; + ::NSPanelConfig_Sound* mutable_sounds(int index); + ::google::protobuf::RepeatedPtrField<::NSPanelConfig_Sound>* mutable_sounds(); + + private: + const ::google::protobuf::RepeatedPtrField<::NSPanelConfig_Sound>& _internal_sounds() const; + ::google::protobuf::RepeatedPtrField<::NSPanelConfig_Sound>* _internal_mutable_sounds(); + public: + const ::NSPanelConfig_Sound& sounds(int index) const; + ::NSPanelConfig_Sound* add_sounds(); + const ::google::protobuf::RepeatedPtrField<::NSPanelConfig_Sound>& sounds() const; // string name = 1; void clear_name() ; const std::string& name() const; @@ -4846,6 +5902,54 @@ class NSPanelConfig final : public ::google::protobuf::Message const std::string& value); std::string* _internal_mutable_inside_temperature_sensor_mqtt_topic(); + public: + // string tz_posix = 46; + void clear_tz_posix() ; + const std::string& tz_posix() const; + template + void set_tz_posix(Arg_&& arg, Args_... args); + std::string* mutable_tz_posix(); + PROTOBUF_NODISCARD std::string* release_tz_posix(); + void set_allocated_tz_posix(std::string* value); + + private: + const std::string& _internal_tz_posix() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_tz_posix( + const std::string& value); + std::string* _internal_mutable_tz_posix(); + + public: + // string button1_entity_page_topic = 47; + void clear_button1_entity_page_topic() ; + const std::string& button1_entity_page_topic() const; + template + void set_button1_entity_page_topic(Arg_&& arg, Args_... args); + std::string* mutable_button1_entity_page_topic(); + PROTOBUF_NODISCARD std::string* release_button1_entity_page_topic(); + void set_allocated_button1_entity_page_topic(std::string* value); + + private: + const std::string& _internal_button1_entity_page_topic() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_button1_entity_page_topic( + const std::string& value); + std::string* _internal_mutable_button1_entity_page_topic(); + + public: + // string button2_entity_page_topic = 48; + void clear_button2_entity_page_topic() ; + const std::string& button2_entity_page_topic() const; + template + void set_button2_entity_page_topic(Arg_&& arg, Args_... args); + std::string* mutable_button2_entity_page_topic(); + PROTOBUF_NODISCARD std::string* release_button2_entity_page_topic(); + void set_allocated_button2_entity_page_topic(std::string* value); + + private: + const std::string& _internal_button2_entity_page_topic() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_button2_entity_page_topic( + const std::string& value); + std::string* _internal_mutable_button2_entity_page_topic(); + public: // int32 default_room = 2; void clear_default_room() ; @@ -5152,8 +6256,8 @@ class NSPanelConfig final : public ::google::protobuf::Message class _Internal; friend class ::google::protobuf::internal::TcParser; static const ::google::protobuf::internal::TcParseTable< - 5, 36, 1, - 94, 7> + 5, 40, 2, + 160, 7> _table_; static constexpr const void* _raw_default_instance_ = @@ -5180,8 +6284,12 @@ class NSPanelConfig final : public ::google::protobuf::Message mutable ::google::protobuf::internal::CachedSize _relay1_relay_group_cached_byte_size_; ::google::protobuf::RepeatedField<::int32_t> relay2_relay_group_; mutable ::google::protobuf::internal::CachedSize _relay2_relay_group_cached_byte_size_; + ::google::protobuf::RepeatedPtrField< ::NSPanelConfig_Sound > sounds_; ::google::protobuf::internal::ArenaStringPtr name_; ::google::protobuf::internal::ArenaStringPtr inside_temperature_sensor_mqtt_topic_; + ::google::protobuf::internal::ArenaStringPtr tz_posix_; + ::google::protobuf::internal::ArenaStringPtr button1_entity_page_topic_; + ::google::protobuf::internal::ArenaStringPtr button2_entity_page_topic_; ::int32_t default_room_; int default_page_; ::int32_t screensaver_activation_timeout_; @@ -5349,6 +6457,82 @@ inline ::google::protobuf::RepeatedField<::int32_t>* NSPanelConfig_RoomInfo::_in // ------------------------------------------------------------------- +// NSPanelConfig_Sound + +// .NSPanelConfig.NSPanelSoundEvent event = 1; +inline void NSPanelConfig_Sound::clear_event() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.event_ = 0; +} +inline ::NSPanelConfig_NSPanelSoundEvent NSPanelConfig_Sound::event() const { + // @@protoc_insertion_point(field_get:NSPanelConfig.Sound.event) + return _internal_event(); +} +inline void NSPanelConfig_Sound::set_event(::NSPanelConfig_NSPanelSoundEvent value) { + _internal_set_event(value); + // @@protoc_insertion_point(field_set:NSPanelConfig.Sound.event) +} +inline ::NSPanelConfig_NSPanelSoundEvent NSPanelConfig_Sound::_internal_event() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return static_cast<::NSPanelConfig_NSPanelSoundEvent>(_impl_.event_); +} +inline void NSPanelConfig_Sound::_internal_set_event(::NSPanelConfig_NSPanelSoundEvent value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.event_ = value; +} + +// string rtttl = 2; +inline void NSPanelConfig_Sound::clear_rtttl() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.rtttl_.ClearToEmpty(); +} +inline const std::string& NSPanelConfig_Sound::rtttl() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelConfig.Sound.rtttl) + return _internal_rtttl(); +} +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelConfig_Sound::set_rtttl(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.rtttl_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelConfig.Sound.rtttl) +} +inline std::string* NSPanelConfig_Sound::mutable_rtttl() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_rtttl(); + // @@protoc_insertion_point(field_mutable:NSPanelConfig.Sound.rtttl) + return _s; +} +inline const std::string& NSPanelConfig_Sound::_internal_rtttl() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.rtttl_.Get(); +} +inline void NSPanelConfig_Sound::_internal_set_rtttl(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.rtttl_.Set(value, GetArena()); +} +inline std::string* NSPanelConfig_Sound::_internal_mutable_rtttl() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.rtttl_.Mutable( GetArena()); +} +inline std::string* NSPanelConfig_Sound::release_rtttl() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelConfig.Sound.rtttl) + return _impl_.rtttl_.Release(); +} +inline void NSPanelConfig_Sound::set_allocated_rtttl(std::string* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.rtttl_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.rtttl_.IsDefault()) { + _impl_.rtttl_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelConfig.Sound.rtttl) +} + +// ------------------------------------------------------------------- + // NSPanelConfig // string name = 1; @@ -6290,9 +7474,208 @@ inline ::int32_t NSPanelConfig::_internal_button2_upper_temperature() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.button2_upper_temperature_; } -inline void NSPanelConfig::_internal_set_button2_upper_temperature(::int32_t value) { +inline void NSPanelConfig::_internal_set_button2_upper_temperature(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.button2_upper_temperature_ = value; +} + +// repeated .NSPanelConfig.Sound sounds = 45; +inline int NSPanelConfig::_internal_sounds_size() const { + return _internal_sounds().size(); +} +inline int NSPanelConfig::sounds_size() const { + return _internal_sounds_size(); +} +inline void NSPanelConfig::clear_sounds() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.sounds_.Clear(); +} +inline ::NSPanelConfig_Sound* NSPanelConfig::mutable_sounds(int index) + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_mutable:NSPanelConfig.sounds) + return _internal_mutable_sounds()->Mutable(index); +} +inline ::google::protobuf::RepeatedPtrField<::NSPanelConfig_Sound>* NSPanelConfig::mutable_sounds() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_mutable_list:NSPanelConfig.sounds) + ::google::protobuf::internal::TSanWrite(&_impl_); + return _internal_mutable_sounds(); +} +inline const ::NSPanelConfig_Sound& NSPanelConfig::sounds(int index) const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelConfig.sounds) + return _internal_sounds().Get(index); +} +inline ::NSPanelConfig_Sound* NSPanelConfig::add_sounds() ABSL_ATTRIBUTE_LIFETIME_BOUND { + ::google::protobuf::internal::TSanWrite(&_impl_); + ::NSPanelConfig_Sound* _add = _internal_mutable_sounds()->Add(); + // @@protoc_insertion_point(field_add:NSPanelConfig.sounds) + return _add; +} +inline const ::google::protobuf::RepeatedPtrField<::NSPanelConfig_Sound>& NSPanelConfig::sounds() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_list:NSPanelConfig.sounds) + return _internal_sounds(); +} +inline const ::google::protobuf::RepeatedPtrField<::NSPanelConfig_Sound>& +NSPanelConfig::_internal_sounds() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.sounds_; +} +inline ::google::protobuf::RepeatedPtrField<::NSPanelConfig_Sound>* +NSPanelConfig::_internal_mutable_sounds() { + ::google::protobuf::internal::TSanRead(&_impl_); + return &_impl_.sounds_; +} + +// string tz_posix = 46; +inline void NSPanelConfig::clear_tz_posix() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.tz_posix_.ClearToEmpty(); +} +inline const std::string& NSPanelConfig::tz_posix() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelConfig.tz_posix) + return _internal_tz_posix(); +} +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelConfig::set_tz_posix(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.tz_posix_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelConfig.tz_posix) +} +inline std::string* NSPanelConfig::mutable_tz_posix() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_tz_posix(); + // @@protoc_insertion_point(field_mutable:NSPanelConfig.tz_posix) + return _s; +} +inline const std::string& NSPanelConfig::_internal_tz_posix() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.tz_posix_.Get(); +} +inline void NSPanelConfig::_internal_set_tz_posix(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.tz_posix_.Set(value, GetArena()); +} +inline std::string* NSPanelConfig::_internal_mutable_tz_posix() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.tz_posix_.Mutable( GetArena()); +} +inline std::string* NSPanelConfig::release_tz_posix() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelConfig.tz_posix) + return _impl_.tz_posix_.Release(); +} +inline void NSPanelConfig::set_allocated_tz_posix(std::string* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.tz_posix_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.tz_posix_.IsDefault()) { + _impl_.tz_posix_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelConfig.tz_posix) +} + +// string button1_entity_page_topic = 47; +inline void NSPanelConfig::clear_button1_entity_page_topic() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.button1_entity_page_topic_.ClearToEmpty(); +} +inline const std::string& NSPanelConfig::button1_entity_page_topic() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelConfig.button1_entity_page_topic) + return _internal_button1_entity_page_topic(); +} +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelConfig::set_button1_entity_page_topic(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.button1_entity_page_topic_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelConfig.button1_entity_page_topic) +} +inline std::string* NSPanelConfig::mutable_button1_entity_page_topic() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_button1_entity_page_topic(); + // @@protoc_insertion_point(field_mutable:NSPanelConfig.button1_entity_page_topic) + return _s; +} +inline const std::string& NSPanelConfig::_internal_button1_entity_page_topic() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.button1_entity_page_topic_.Get(); +} +inline void NSPanelConfig::_internal_set_button1_entity_page_topic(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.button1_entity_page_topic_.Set(value, GetArena()); +} +inline std::string* NSPanelConfig::_internal_mutable_button1_entity_page_topic() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.button1_entity_page_topic_.Mutable( GetArena()); +} +inline std::string* NSPanelConfig::release_button1_entity_page_topic() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelConfig.button1_entity_page_topic) + return _impl_.button1_entity_page_topic_.Release(); +} +inline void NSPanelConfig::set_allocated_button1_entity_page_topic(std::string* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.button1_entity_page_topic_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.button1_entity_page_topic_.IsDefault()) { + _impl_.button1_entity_page_topic_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelConfig.button1_entity_page_topic) +} + +// string button2_entity_page_topic = 48; +inline void NSPanelConfig::clear_button2_entity_page_topic() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.button2_entity_page_topic_.ClearToEmpty(); +} +inline const std::string& NSPanelConfig::button2_entity_page_topic() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelConfig.button2_entity_page_topic) + return _internal_button2_entity_page_topic(); +} +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelConfig::set_button2_entity_page_topic(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.button2_entity_page_topic_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelConfig.button2_entity_page_topic) +} +inline std::string* NSPanelConfig::mutable_button2_entity_page_topic() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_button2_entity_page_topic(); + // @@protoc_insertion_point(field_mutable:NSPanelConfig.button2_entity_page_topic) + return _s; +} +inline const std::string& NSPanelConfig::_internal_button2_entity_page_topic() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.button2_entity_page_topic_.Get(); +} +inline void NSPanelConfig::_internal_set_button2_entity_page_topic(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.button2_entity_page_topic_.Set(value, GetArena()); +} +inline std::string* NSPanelConfig::_internal_mutable_button2_entity_page_topic() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.button2_entity_page_topic_.Mutable( GetArena()); +} +inline std::string* NSPanelConfig::release_button2_entity_page_topic() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelConfig.button2_entity_page_topic) + return _impl_.button2_entity_page_topic_.Release(); +} +inline void NSPanelConfig::set_allocated_button2_entity_page_topic(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.button2_upper_temperature_ = value; + _impl_.button2_entity_page_topic_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.button2_entity_page_topic_.IsDefault()) { + _impl_.button2_entity_page_topic_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelConfig.button2_entity_page_topic) } // ------------------------------------------------------------------- @@ -7114,6 +8497,50 @@ inline void NSPanelRoomEntitiesPage_EntitySlot::set_allocated_mqtt_state_topic(s // @@protoc_insertion_point(field_set_allocated:NSPanelRoomEntitiesPage.EntitySlot.mqtt_state_topic) } +// .NSPanelRoomEntitiesPage.EntitySlot.EntityType type = 8; +inline void NSPanelRoomEntitiesPage_EntitySlot::clear_type() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.type_ = 0; +} +inline ::NSPanelRoomEntitiesPage_EntitySlot_EntityType NSPanelRoomEntitiesPage_EntitySlot::type() const { + // @@protoc_insertion_point(field_get:NSPanelRoomEntitiesPage.EntitySlot.type) + return _internal_type(); +} +inline void NSPanelRoomEntitiesPage_EntitySlot::set_type(::NSPanelRoomEntitiesPage_EntitySlot_EntityType value) { + _internal_set_type(value); + // @@protoc_insertion_point(field_set:NSPanelRoomEntitiesPage.EntitySlot.type) +} +inline ::NSPanelRoomEntitiesPage_EntitySlot_EntityType NSPanelRoomEntitiesPage_EntitySlot::_internal_type() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return static_cast<::NSPanelRoomEntitiesPage_EntitySlot_EntityType>(_impl_.type_); +} +inline void NSPanelRoomEntitiesPage_EntitySlot::_internal_set_type(::NSPanelRoomEntitiesPage_EntitySlot_EntityType value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.type_ = value; +} + +// int32 id = 9; +inline void NSPanelRoomEntitiesPage_EntitySlot::clear_id() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.id_ = 0; +} +inline ::int32_t NSPanelRoomEntitiesPage_EntitySlot::id() const { + // @@protoc_insertion_point(field_get:NSPanelRoomEntitiesPage.EntitySlot.id) + return _internal_id(); +} +inline void NSPanelRoomEntitiesPage_EntitySlot::set_id(::int32_t value) { + _internal_set_id(value); + // @@protoc_insertion_point(field_set:NSPanelRoomEntitiesPage.EntitySlot.id) +} +inline ::int32_t NSPanelRoomEntitiesPage_EntitySlot::_internal_id() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.id_; +} +inline void NSPanelRoomEntitiesPage_EntitySlot::_internal_set_id(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.id_ = value; +} + // ------------------------------------------------------------------- // NSPanelRoomEntitiesPage @@ -8799,191 +10226,607 @@ inline ::int32_t NSPanelMQTTManagerCommand_ButtonPressed::button_id() const { // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.ButtonPressed.button_id) return _internal_button_id(); } -inline void NSPanelMQTTManagerCommand_ButtonPressed::set_button_id(::int32_t value) { - _internal_set_button_id(value); - // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.ButtonPressed.button_id) +inline void NSPanelMQTTManagerCommand_ButtonPressed::set_button_id(::int32_t value) { + _internal_set_button_id(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.ButtonPressed.button_id) +} +inline ::int32_t NSPanelMQTTManagerCommand_ButtonPressed::_internal_button_id() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.button_id_; +} +inline void NSPanelMQTTManagerCommand_ButtonPressed::_internal_set_button_id(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.button_id_ = value; +} + +// ------------------------------------------------------------------- + +// NSPanelMQTTManagerCommand_ThermostatTemperatureCommand + +// int32 thermostat_id = 1; +inline void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::clear_thermostat_id() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.thermostat_id_ = 0; +} +inline ::int32_t NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::thermostat_id() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand.thermostat_id) + return _internal_thermostat_id(); +} +inline void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::set_thermostat_id(::int32_t value) { + _internal_set_thermostat_id(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand.thermostat_id) +} +inline ::int32_t NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_internal_thermostat_id() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.thermostat_id_; +} +inline void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_internal_set_thermostat_id(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.thermostat_id_ = value; +} + +// float temperature = 2; +inline void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::clear_temperature() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.temperature_ = 0; +} +inline float NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::temperature() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand.temperature) + return _internal_temperature(); +} +inline void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::set_temperature(float value) { + _internal_set_temperature(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand.temperature) +} +inline float NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_internal_temperature() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.temperature_; +} +inline void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_internal_set_temperature(float value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.temperature_ = value; +} + +// ------------------------------------------------------------------- + +// NSPanelMQTTManagerCommand_ThermostatCommand + +// int32 thermostat_id = 1; +inline void NSPanelMQTTManagerCommand_ThermostatCommand::clear_thermostat_id() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.thermostat_id_ = 0; +} +inline ::int32_t NSPanelMQTTManagerCommand_ThermostatCommand::thermostat_id() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.ThermostatCommand.thermostat_id) + return _internal_thermostat_id(); +} +inline void NSPanelMQTTManagerCommand_ThermostatCommand::set_thermostat_id(::int32_t value) { + _internal_set_thermostat_id(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.ThermostatCommand.thermostat_id) +} +inline ::int32_t NSPanelMQTTManagerCommand_ThermostatCommand::_internal_thermostat_id() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.thermostat_id_; +} +inline void NSPanelMQTTManagerCommand_ThermostatCommand::_internal_set_thermostat_id(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.thermostat_id_ = value; +} + +// string option = 2; +inline void NSPanelMQTTManagerCommand_ThermostatCommand::clear_option() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.option_.ClearToEmpty(); +} +inline const std::string& NSPanelMQTTManagerCommand_ThermostatCommand::option() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.ThermostatCommand.option) + return _internal_option(); +} +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelMQTTManagerCommand_ThermostatCommand::set_option(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.option_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.ThermostatCommand.option) +} +inline std::string* NSPanelMQTTManagerCommand_ThermostatCommand::mutable_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_option(); + // @@protoc_insertion_point(field_mutable:NSPanelMQTTManagerCommand.ThermostatCommand.option) + return _s; +} +inline const std::string& NSPanelMQTTManagerCommand_ThermostatCommand::_internal_option() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.option_.Get(); +} +inline void NSPanelMQTTManagerCommand_ThermostatCommand::_internal_set_option(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.option_.Set(value, GetArena()); +} +inline std::string* NSPanelMQTTManagerCommand_ThermostatCommand::_internal_mutable_option() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.option_.Mutable( GetArena()); +} +inline std::string* NSPanelMQTTManagerCommand_ThermostatCommand::release_option() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelMQTTManagerCommand.ThermostatCommand.option) + return _impl_.option_.Release(); +} +inline void NSPanelMQTTManagerCommand_ThermostatCommand::set_allocated_option(std::string* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.option_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.option_.IsDefault()) { + _impl_.option_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelMQTTManagerCommand.ThermostatCommand.option) +} + +// string new_value = 3; +inline void NSPanelMQTTManagerCommand_ThermostatCommand::clear_new_value() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.new_value_.ClearToEmpty(); +} +inline const std::string& NSPanelMQTTManagerCommand_ThermostatCommand::new_value() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.ThermostatCommand.new_value) + return _internal_new_value(); +} +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelMQTTManagerCommand_ThermostatCommand::set_new_value(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.new_value_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.ThermostatCommand.new_value) +} +inline std::string* NSPanelMQTTManagerCommand_ThermostatCommand::mutable_new_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_new_value(); + // @@protoc_insertion_point(field_mutable:NSPanelMQTTManagerCommand.ThermostatCommand.new_value) + return _s; +} +inline const std::string& NSPanelMQTTManagerCommand_ThermostatCommand::_internal_new_value() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.new_value_.Get(); +} +inline void NSPanelMQTTManagerCommand_ThermostatCommand::_internal_set_new_value(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.new_value_.Set(value, GetArena()); +} +inline std::string* NSPanelMQTTManagerCommand_ThermostatCommand::_internal_mutable_new_value() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.new_value_.Mutable( GetArena()); +} +inline std::string* NSPanelMQTTManagerCommand_ThermostatCommand::release_new_value() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelMQTTManagerCommand.ThermostatCommand.new_value) + return _impl_.new_value_.Release(); +} +inline void NSPanelMQTTManagerCommand_ThermostatCommand::set_allocated_new_value(std::string* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.new_value_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.new_value_.IsDefault()) { + _impl_.new_value_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelMQTTManagerCommand.ThermostatCommand.new_value) +} + +// ------------------------------------------------------------------- + +// NSPanelMQTTManagerCommand_MediaPlayerCommand + +// int32 media_player_id = 1; +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::clear_media_player_id() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.media_player_id_ = 0; +} +inline ::int32_t NSPanelMQTTManagerCommand_MediaPlayerCommand::media_player_id() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.MediaPlayerCommand.media_player_id) + return _internal_media_player_id(); +} +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::set_media_player_id(::int32_t value) { + _internal_set_media_player_id(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.MediaPlayerCommand.media_player_id) +} +inline ::int32_t NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_media_player_id() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.media_player_id_; +} +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_set_media_player_id(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.media_player_id_ = value; +} + +// .NSPanelMQTTManagerCommand.MediaPlayerCommand.PlaybackAction playback_action = 2; +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::clear_playback_action() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.playback_action_ = 0; +} +inline ::NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction NSPanelMQTTManagerCommand_MediaPlayerCommand::playback_action() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.MediaPlayerCommand.playback_action) + return _internal_playback_action(); +} +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::set_playback_action(::NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction value) { + _internal_set_playback_action(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.MediaPlayerCommand.playback_action) +} +inline ::NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_playback_action() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return static_cast<::NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction>(_impl_.playback_action_); +} +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_set_playback_action(::NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.playback_action_ = value; +} + +// bool has_volume = 3; +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::clear_has_volume() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.has_volume_ = false; +} +inline bool NSPanelMQTTManagerCommand_MediaPlayerCommand::has_volume() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.MediaPlayerCommand.has_volume) + return _internal_has_volume(); +} +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::set_has_volume(bool value) { + _internal_set_has_volume(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.MediaPlayerCommand.has_volume) +} +inline bool NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_has_volume() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.has_volume_; +} +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_set_has_volume(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.has_volume_ = value; +} + +// int32 volume = 4; +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::clear_volume() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.volume_ = 0; +} +inline ::int32_t NSPanelMQTTManagerCommand_MediaPlayerCommand::volume() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.MediaPlayerCommand.volume) + return _internal_volume(); +} +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::set_volume(::int32_t value) { + _internal_set_volume(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.MediaPlayerCommand.volume) +} +inline ::int32_t NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_volume() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.volume_; +} +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_set_volume(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.volume_ = value; +} + +// bool has_source_volume = 5; +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::clear_has_source_volume() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.has_source_volume_ = false; +} +inline bool NSPanelMQTTManagerCommand_MediaPlayerCommand::has_source_volume() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.MediaPlayerCommand.has_source_volume) + return _internal_has_source_volume(); } -inline ::int32_t NSPanelMQTTManagerCommand_ButtonPressed::_internal_button_id() const { +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::set_has_source_volume(bool value) { + _internal_set_has_source_volume(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.MediaPlayerCommand.has_source_volume) +} +inline bool NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_has_source_volume() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.button_id_; + return _impl_.has_source_volume_; } -inline void NSPanelMQTTManagerCommand_ButtonPressed::_internal_set_button_id(::int32_t value) { +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_set_has_source_volume(bool value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.button_id_ = value; + _impl_.has_source_volume_ = value; } -// ------------------------------------------------------------------- - -// NSPanelMQTTManagerCommand_ThermostatTemperatureCommand - -// int32 thermostat_id = 1; -inline void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::clear_thermostat_id() { +// int32 source_volume = 6; +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::clear_source_volume() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.thermostat_id_ = 0; + _impl_.source_volume_ = 0; } -inline ::int32_t NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::thermostat_id() const { - // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand.thermostat_id) - return _internal_thermostat_id(); +inline ::int32_t NSPanelMQTTManagerCommand_MediaPlayerCommand::source_volume() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.MediaPlayerCommand.source_volume) + return _internal_source_volume(); } -inline void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::set_thermostat_id(::int32_t value) { - _internal_set_thermostat_id(value); - // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand.thermostat_id) +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::set_source_volume(::int32_t value) { + _internal_set_source_volume(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.MediaPlayerCommand.source_volume) } -inline ::int32_t NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_internal_thermostat_id() const { +inline ::int32_t NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_source_volume() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.thermostat_id_; + return _impl_.source_volume_; } -inline void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_internal_set_thermostat_id(::int32_t value) { +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_set_source_volume(::int32_t value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.thermostat_id_ = value; + _impl_.source_volume_ = value; } -// float temperature = 2; -inline void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::clear_temperature() { +// bool has_muted = 7; +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::clear_has_muted() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.temperature_ = 0; + _impl_.has_muted_ = false; } -inline float NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::temperature() const { - // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand.temperature) - return _internal_temperature(); +inline bool NSPanelMQTTManagerCommand_MediaPlayerCommand::has_muted() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.MediaPlayerCommand.has_muted) + return _internal_has_muted(); } -inline void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::set_temperature(float value) { - _internal_set_temperature(value); - // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.ThermostatTemperatureCommand.temperature) +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::set_has_muted(bool value) { + _internal_set_has_muted(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.MediaPlayerCommand.has_muted) } -inline float NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_internal_temperature() const { +inline bool NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_has_muted() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.temperature_; + return _impl_.has_muted_; } -inline void NSPanelMQTTManagerCommand_ThermostatTemperatureCommand::_internal_set_temperature(float value) { +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_set_has_muted(bool value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.temperature_ = value; + _impl_.has_muted_ = value; } -// ------------------------------------------------------------------- - -// NSPanelMQTTManagerCommand_ThermostatCommand - -// int32 thermostat_id = 1; -inline void NSPanelMQTTManagerCommand_ThermostatCommand::clear_thermostat_id() { +// bool muted = 8; +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::clear_muted() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.thermostat_id_ = 0; + _impl_.muted_ = false; } -inline ::int32_t NSPanelMQTTManagerCommand_ThermostatCommand::thermostat_id() const { - // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.ThermostatCommand.thermostat_id) - return _internal_thermostat_id(); +inline bool NSPanelMQTTManagerCommand_MediaPlayerCommand::muted() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.MediaPlayerCommand.muted) + return _internal_muted(); } -inline void NSPanelMQTTManagerCommand_ThermostatCommand::set_thermostat_id(::int32_t value) { - _internal_set_thermostat_id(value); - // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.ThermostatCommand.thermostat_id) +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::set_muted(bool value) { + _internal_set_muted(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.MediaPlayerCommand.muted) } -inline ::int32_t NSPanelMQTTManagerCommand_ThermostatCommand::_internal_thermostat_id() const { +inline bool NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_muted() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.thermostat_id_; + return _impl_.muted_; } -inline void NSPanelMQTTManagerCommand_ThermostatCommand::_internal_set_thermostat_id(::int32_t value) { +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_set_muted(bool value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.thermostat_id_ = value; + _impl_.muted_ = value; } -// string option = 2; -inline void NSPanelMQTTManagerCommand_ThermostatCommand::clear_option() { +// string select_player_source = 9; +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::clear_select_player_source() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.option_.ClearToEmpty(); + _impl_.select_player_source_.ClearToEmpty(); } -inline const std::string& NSPanelMQTTManagerCommand_ThermostatCommand::option() const +inline const std::string& NSPanelMQTTManagerCommand_MediaPlayerCommand::select_player_source() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.ThermostatCommand.option) - return _internal_option(); + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.MediaPlayerCommand.select_player_source) + return _internal_select_player_source(); } template -inline PROTOBUF_ALWAYS_INLINE void NSPanelMQTTManagerCommand_ThermostatCommand::set_option(Arg_&& arg, +inline PROTOBUF_ALWAYS_INLINE void NSPanelMQTTManagerCommand_MediaPlayerCommand::set_select_player_source(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.option_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.ThermostatCommand.option) + _impl_.select_player_source_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.MediaPlayerCommand.select_player_source) } -inline std::string* NSPanelMQTTManagerCommand_ThermostatCommand::mutable_option() ABSL_ATTRIBUTE_LIFETIME_BOUND { - std::string* _s = _internal_mutable_option(); - // @@protoc_insertion_point(field_mutable:NSPanelMQTTManagerCommand.ThermostatCommand.option) +inline std::string* NSPanelMQTTManagerCommand_MediaPlayerCommand::mutable_select_player_source() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_select_player_source(); + // @@protoc_insertion_point(field_mutable:NSPanelMQTTManagerCommand.MediaPlayerCommand.select_player_source) return _s; } -inline const std::string& NSPanelMQTTManagerCommand_ThermostatCommand::_internal_option() const { +inline const std::string& NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_select_player_source() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.option_.Get(); + return _impl_.select_player_source_.Get(); } -inline void NSPanelMQTTManagerCommand_ThermostatCommand::_internal_set_option(const std::string& value) { +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_set_select_player_source(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.option_.Set(value, GetArena()); + _impl_.select_player_source_.Set(value, GetArena()); } -inline std::string* NSPanelMQTTManagerCommand_ThermostatCommand::_internal_mutable_option() { +inline std::string* NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_mutable_select_player_source() { ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.option_.Mutable( GetArena()); + return _impl_.select_player_source_.Mutable( GetArena()); } -inline std::string* NSPanelMQTTManagerCommand_ThermostatCommand::release_option() { +inline std::string* NSPanelMQTTManagerCommand_MediaPlayerCommand::release_select_player_source() { ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:NSPanelMQTTManagerCommand.ThermostatCommand.option) - return _impl_.option_.Release(); + // @@protoc_insertion_point(field_release:NSPanelMQTTManagerCommand.MediaPlayerCommand.select_player_source) + return _impl_.select_player_source_.Release(); } -inline void NSPanelMQTTManagerCommand_ThermostatCommand::set_allocated_option(std::string* value) { +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::set_allocated_select_player_source(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.option_.SetAllocated(value, GetArena()); + _impl_.select_player_source_.SetAllocated(value, GetArena()); #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.option_.IsDefault()) { - _impl_.option_.Set("", GetArena()); + if (_impl_.select_player_source_.IsDefault()) { + _impl_.select_player_source_.Set("", GetArena()); } #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:NSPanelMQTTManagerCommand.ThermostatCommand.option) + // @@protoc_insertion_point(field_set_allocated:NSPanelMQTTManagerCommand.MediaPlayerCommand.select_player_source) } -// string new_value = 3; -inline void NSPanelMQTTManagerCommand_ThermostatCommand::clear_new_value() { +// string select_source_player_source = 10; +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::clear_select_source_player_source() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.new_value_.ClearToEmpty(); + _impl_.select_source_player_source_.ClearToEmpty(); } -inline const std::string& NSPanelMQTTManagerCommand_ThermostatCommand::new_value() const +inline const std::string& NSPanelMQTTManagerCommand_MediaPlayerCommand::select_source_player_source() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.ThermostatCommand.new_value) - return _internal_new_value(); + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.MediaPlayerCommand.select_source_player_source) + return _internal_select_source_player_source(); } template -inline PROTOBUF_ALWAYS_INLINE void NSPanelMQTTManagerCommand_ThermostatCommand::set_new_value(Arg_&& arg, +inline PROTOBUF_ALWAYS_INLINE void NSPanelMQTTManagerCommand_MediaPlayerCommand::set_select_source_player_source(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.new_value_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.ThermostatCommand.new_value) + _impl_.select_source_player_source_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.MediaPlayerCommand.select_source_player_source) } -inline std::string* NSPanelMQTTManagerCommand_ThermostatCommand::mutable_new_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { - std::string* _s = _internal_mutable_new_value(); - // @@protoc_insertion_point(field_mutable:NSPanelMQTTManagerCommand.ThermostatCommand.new_value) +inline std::string* NSPanelMQTTManagerCommand_MediaPlayerCommand::mutable_select_source_player_source() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_select_source_player_source(); + // @@protoc_insertion_point(field_mutable:NSPanelMQTTManagerCommand.MediaPlayerCommand.select_source_player_source) return _s; } -inline const std::string& NSPanelMQTTManagerCommand_ThermostatCommand::_internal_new_value() const { +inline const std::string& NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_select_source_player_source() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.new_value_.Get(); + return _impl_.select_source_player_source_.Get(); } -inline void NSPanelMQTTManagerCommand_ThermostatCommand::_internal_set_new_value(const std::string& value) { +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_set_select_source_player_source(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.new_value_.Set(value, GetArena()); + _impl_.select_source_player_source_.Set(value, GetArena()); } -inline std::string* NSPanelMQTTManagerCommand_ThermostatCommand::_internal_mutable_new_value() { +inline std::string* NSPanelMQTTManagerCommand_MediaPlayerCommand::_internal_mutable_select_source_player_source() { ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.new_value_.Mutable( GetArena()); + return _impl_.select_source_player_source_.Mutable( GetArena()); } -inline std::string* NSPanelMQTTManagerCommand_ThermostatCommand::release_new_value() { +inline std::string* NSPanelMQTTManagerCommand_MediaPlayerCommand::release_select_source_player_source() { ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:NSPanelMQTTManagerCommand.ThermostatCommand.new_value) - return _impl_.new_value_.Release(); + // @@protoc_insertion_point(field_release:NSPanelMQTTManagerCommand.MediaPlayerCommand.select_source_player_source) + return _impl_.select_source_player_source_.Release(); } -inline void NSPanelMQTTManagerCommand_ThermostatCommand::set_allocated_new_value(std::string* value) { +inline void NSPanelMQTTManagerCommand_MediaPlayerCommand::set_allocated_select_source_player_source(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.new_value_.SetAllocated(value, GetArena()); + _impl_.select_source_player_source_.SetAllocated(value, GetArena()); #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.new_value_.IsDefault()) { - _impl_.new_value_.Set("", GetArena()); + if (_impl_.select_source_player_source_.IsDefault()) { + _impl_.select_source_player_source_.Set("", GetArena()); } #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:NSPanelMQTTManagerCommand.ThermostatCommand.new_value) + // @@protoc_insertion_point(field_set_allocated:NSPanelMQTTManagerCommand.MediaPlayerCommand.select_source_player_source) +} + +// ------------------------------------------------------------------- + +// NSPanelMQTTManagerCommand_CoverCommand + +// int32 cover_id = 1; +inline void NSPanelMQTTManagerCommand_CoverCommand::clear_cover_id() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.cover_id_ = 0; +} +inline ::int32_t NSPanelMQTTManagerCommand_CoverCommand::cover_id() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.CoverCommand.cover_id) + return _internal_cover_id(); +} +inline void NSPanelMQTTManagerCommand_CoverCommand::set_cover_id(::int32_t value) { + _internal_set_cover_id(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.CoverCommand.cover_id) +} +inline ::int32_t NSPanelMQTTManagerCommand_CoverCommand::_internal_cover_id() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.cover_id_; +} +inline void NSPanelMQTTManagerCommand_CoverCommand::_internal_set_cover_id(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.cover_id_ = value; +} + +// .NSPanelMQTTManagerCommand.CoverCommand.Action action = 2; +inline void NSPanelMQTTManagerCommand_CoverCommand::clear_action() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.action_ = 0; +} +inline ::NSPanelMQTTManagerCommand_CoverCommand_Action NSPanelMQTTManagerCommand_CoverCommand::action() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.CoverCommand.action) + return _internal_action(); +} +inline void NSPanelMQTTManagerCommand_CoverCommand::set_action(::NSPanelMQTTManagerCommand_CoverCommand_Action value) { + _internal_set_action(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.CoverCommand.action) +} +inline ::NSPanelMQTTManagerCommand_CoverCommand_Action NSPanelMQTTManagerCommand_CoverCommand::_internal_action() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return static_cast<::NSPanelMQTTManagerCommand_CoverCommand_Action>(_impl_.action_); +} +inline void NSPanelMQTTManagerCommand_CoverCommand::_internal_set_action(::NSPanelMQTTManagerCommand_CoverCommand_Action value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.action_ = value; +} + +// bool has_position = 3; +inline void NSPanelMQTTManagerCommand_CoverCommand::clear_has_position() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.has_position_ = false; +} +inline bool NSPanelMQTTManagerCommand_CoverCommand::has_position() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.CoverCommand.has_position) + return _internal_has_position(); +} +inline void NSPanelMQTTManagerCommand_CoverCommand::set_has_position(bool value) { + _internal_set_has_position(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.CoverCommand.has_position) +} +inline bool NSPanelMQTTManagerCommand_CoverCommand::_internal_has_position() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.has_position_; +} +inline void NSPanelMQTTManagerCommand_CoverCommand::_internal_set_has_position(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.has_position_ = value; +} + +// int32 position = 4; +inline void NSPanelMQTTManagerCommand_CoverCommand::clear_position() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.position_ = 0; +} +inline ::int32_t NSPanelMQTTManagerCommand_CoverCommand::position() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.CoverCommand.position) + return _internal_position(); +} +inline void NSPanelMQTTManagerCommand_CoverCommand::set_position(::int32_t value) { + _internal_set_position(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.CoverCommand.position) +} +inline ::int32_t NSPanelMQTTManagerCommand_CoverCommand::_internal_position() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.position_; +} +inline void NSPanelMQTTManagerCommand_CoverCommand::_internal_set_position(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.position_ = value; +} + +// bool has_tilt_position = 5; +inline void NSPanelMQTTManagerCommand_CoverCommand::clear_has_tilt_position() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.has_tilt_position_ = false; +} +inline bool NSPanelMQTTManagerCommand_CoverCommand::has_tilt_position() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.CoverCommand.has_tilt_position) + return _internal_has_tilt_position(); +} +inline void NSPanelMQTTManagerCommand_CoverCommand::set_has_tilt_position(bool value) { + _internal_set_has_tilt_position(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.CoverCommand.has_tilt_position) +} +inline bool NSPanelMQTTManagerCommand_CoverCommand::_internal_has_tilt_position() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.has_tilt_position_; +} +inline void NSPanelMQTTManagerCommand_CoverCommand::_internal_set_has_tilt_position(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.has_tilt_position_ = value; +} + +// int32 tilt_position = 6; +inline void NSPanelMQTTManagerCommand_CoverCommand::clear_tilt_position() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.tilt_position_ = 0; +} +inline ::int32_t NSPanelMQTTManagerCommand_CoverCommand::tilt_position() const { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.CoverCommand.tilt_position) + return _internal_tilt_position(); +} +inline void NSPanelMQTTManagerCommand_CoverCommand::set_tilt_position(::int32_t value) { + _internal_set_tilt_position(value); + // @@protoc_insertion_point(field_set:NSPanelMQTTManagerCommand.CoverCommand.tilt_position) +} +inline ::int32_t NSPanelMQTTManagerCommand_CoverCommand::_internal_tilt_position() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.tilt_position_; +} +inline void NSPanelMQTTManagerCommand_CoverCommand::_internal_set_tilt_position(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.tilt_position_ = value; } // ------------------------------------------------------------------- @@ -9622,6 +11465,164 @@ inline ::NSPanelMQTTManagerCommand_ThermostatCommand* NSPanelMQTTManagerCommand: return _msg; } +// .NSPanelMQTTManagerCommand.MediaPlayerCommand media_player_command = 9; +inline bool NSPanelMQTTManagerCommand::has_media_player_command() const { + return CommandData_case() == kMediaPlayerCommand; +} +inline bool NSPanelMQTTManagerCommand::_internal_has_media_player_command() const { + return CommandData_case() == kMediaPlayerCommand; +} +inline void NSPanelMQTTManagerCommand::set_has_media_player_command() { + _impl_._oneof_case_[0] = kMediaPlayerCommand; +} +inline void NSPanelMQTTManagerCommand::clear_media_player_command() { + ::google::protobuf::internal::TSanWrite(&_impl_); + if (CommandData_case() == kMediaPlayerCommand) { + if (GetArena() == nullptr) { + delete _impl_.CommandData_.media_player_command_; + } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { + ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.CommandData_.media_player_command_); + } + clear_has_CommandData(); + } +} +inline ::NSPanelMQTTManagerCommand_MediaPlayerCommand* NSPanelMQTTManagerCommand::release_media_player_command() { + // @@protoc_insertion_point(field_release:NSPanelMQTTManagerCommand.media_player_command) + if (CommandData_case() == kMediaPlayerCommand) { + clear_has_CommandData(); + auto* temp = _impl_.CommandData_.media_player_command_; + if (GetArena() != nullptr) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); + } + _impl_.CommandData_.media_player_command_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::NSPanelMQTTManagerCommand_MediaPlayerCommand& NSPanelMQTTManagerCommand::_internal_media_player_command() const { + return CommandData_case() == kMediaPlayerCommand ? *_impl_.CommandData_.media_player_command_ : reinterpret_cast<::NSPanelMQTTManagerCommand_MediaPlayerCommand&>(::_NSPanelMQTTManagerCommand_MediaPlayerCommand_default_instance_); +} +inline const ::NSPanelMQTTManagerCommand_MediaPlayerCommand& NSPanelMQTTManagerCommand::media_player_command() const ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.media_player_command) + return _internal_media_player_command(); +} +inline ::NSPanelMQTTManagerCommand_MediaPlayerCommand* NSPanelMQTTManagerCommand::unsafe_arena_release_media_player_command() { + // @@protoc_insertion_point(field_unsafe_arena_release:NSPanelMQTTManagerCommand.media_player_command) + if (CommandData_case() == kMediaPlayerCommand) { + clear_has_CommandData(); + auto* temp = _impl_.CommandData_.media_player_command_; + _impl_.CommandData_.media_player_command_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void NSPanelMQTTManagerCommand::unsafe_arena_set_allocated_media_player_command(::NSPanelMQTTManagerCommand_MediaPlayerCommand* value) { + // We rely on the oneof clear method to free the earlier contents + // of this oneof. We can directly use the pointer we're given to + // set the new value. + clear_CommandData(); + if (value) { + set_has_media_player_command(); + _impl_.CommandData_.media_player_command_ = value; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:NSPanelMQTTManagerCommand.media_player_command) +} +inline ::NSPanelMQTTManagerCommand_MediaPlayerCommand* NSPanelMQTTManagerCommand::_internal_mutable_media_player_command() { + if (CommandData_case() != kMediaPlayerCommand) { + clear_CommandData(); + set_has_media_player_command(); + _impl_.CommandData_.media_player_command_ = + ::google::protobuf::Message::DefaultConstruct<::NSPanelMQTTManagerCommand_MediaPlayerCommand>(GetArena()); + } + return _impl_.CommandData_.media_player_command_; +} +inline ::NSPanelMQTTManagerCommand_MediaPlayerCommand* NSPanelMQTTManagerCommand::mutable_media_player_command() ABSL_ATTRIBUTE_LIFETIME_BOUND { + ::NSPanelMQTTManagerCommand_MediaPlayerCommand* _msg = _internal_mutable_media_player_command(); + // @@protoc_insertion_point(field_mutable:NSPanelMQTTManagerCommand.media_player_command) + return _msg; +} + +// .NSPanelMQTTManagerCommand.CoverCommand cover_command = 10; +inline bool NSPanelMQTTManagerCommand::has_cover_command() const { + return CommandData_case() == kCoverCommand; +} +inline bool NSPanelMQTTManagerCommand::_internal_has_cover_command() const { + return CommandData_case() == kCoverCommand; +} +inline void NSPanelMQTTManagerCommand::set_has_cover_command() { + _impl_._oneof_case_[0] = kCoverCommand; +} +inline void NSPanelMQTTManagerCommand::clear_cover_command() { + ::google::protobuf::internal::TSanWrite(&_impl_); + if (CommandData_case() == kCoverCommand) { + if (GetArena() == nullptr) { + delete _impl_.CommandData_.cover_command_; + } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { + ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.CommandData_.cover_command_); + } + clear_has_CommandData(); + } +} +inline ::NSPanelMQTTManagerCommand_CoverCommand* NSPanelMQTTManagerCommand::release_cover_command() { + // @@protoc_insertion_point(field_release:NSPanelMQTTManagerCommand.cover_command) + if (CommandData_case() == kCoverCommand) { + clear_has_CommandData(); + auto* temp = _impl_.CommandData_.cover_command_; + if (GetArena() != nullptr) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); + } + _impl_.CommandData_.cover_command_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::NSPanelMQTTManagerCommand_CoverCommand& NSPanelMQTTManagerCommand::_internal_cover_command() const { + return CommandData_case() == kCoverCommand ? *_impl_.CommandData_.cover_command_ : reinterpret_cast<::NSPanelMQTTManagerCommand_CoverCommand&>(::_NSPanelMQTTManagerCommand_CoverCommand_default_instance_); +} +inline const ::NSPanelMQTTManagerCommand_CoverCommand& NSPanelMQTTManagerCommand::cover_command() const ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelMQTTManagerCommand.cover_command) + return _internal_cover_command(); +} +inline ::NSPanelMQTTManagerCommand_CoverCommand* NSPanelMQTTManagerCommand::unsafe_arena_release_cover_command() { + // @@protoc_insertion_point(field_unsafe_arena_release:NSPanelMQTTManagerCommand.cover_command) + if (CommandData_case() == kCoverCommand) { + clear_has_CommandData(); + auto* temp = _impl_.CommandData_.cover_command_; + _impl_.CommandData_.cover_command_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void NSPanelMQTTManagerCommand::unsafe_arena_set_allocated_cover_command(::NSPanelMQTTManagerCommand_CoverCommand* value) { + // We rely on the oneof clear method to free the earlier contents + // of this oneof. We can directly use the pointer we're given to + // set the new value. + clear_CommandData(); + if (value) { + set_has_cover_command(); + _impl_.CommandData_.cover_command_ = value; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:NSPanelMQTTManagerCommand.cover_command) +} +inline ::NSPanelMQTTManagerCommand_CoverCommand* NSPanelMQTTManagerCommand::_internal_mutable_cover_command() { + if (CommandData_case() != kCoverCommand) { + clear_CommandData(); + set_has_cover_command(); + _impl_.CommandData_.cover_command_ = + ::google::protobuf::Message::DefaultConstruct<::NSPanelMQTTManagerCommand_CoverCommand>(GetArena()); + } + return _impl_.CommandData_.cover_command_; +} +inline ::NSPanelMQTTManagerCommand_CoverCommand* NSPanelMQTTManagerCommand::mutable_cover_command() ABSL_ATTRIBUTE_LIFETIME_BOUND { + ::NSPanelMQTTManagerCommand_CoverCommand* _msg = _internal_mutable_cover_command(); + // @@protoc_insertion_point(field_mutable:NSPanelMQTTManagerCommand.cover_command) + return _msg; +} + // int32 nspanel_id = 100; inline void NSPanelMQTTManagerCommand::clear_nspanel_id() { ::google::protobuf::internal::TSanWrite(&_impl_); @@ -9682,12 +11683,36 @@ inline const EnumDescriptor* GetEnumDescriptor<::NSPanelConfig_NSPanelButtonMode return ::NSPanelConfig_NSPanelButtonMode_descriptor(); } template <> +struct is_proto_enum<::NSPanelConfig_NSPanelSoundEvent> : std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor<::NSPanelConfig_NSPanelSoundEvent>() { + return ::NSPanelConfig_NSPanelSoundEvent_descriptor(); +} +template <> struct is_proto_enum<::NSPanelStatusReport_state> : std::true_type {}; template <> inline const EnumDescriptor* GetEnumDescriptor<::NSPanelStatusReport_state>() { return ::NSPanelStatusReport_state_descriptor(); } template <> +struct is_proto_enum<::NSPanelRoomEntitiesPage_EntitySlot_EntityType> : std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor<::NSPanelRoomEntitiesPage_EntitySlot_EntityType>() { + return ::NSPanelRoomEntitiesPage_EntitySlot_EntityType_descriptor(); +} +template <> +struct is_proto_enum<::NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction> : std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor<::NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction>() { + return ::NSPanelMQTTManagerCommand_MediaPlayerCommand_PlaybackAction_descriptor(); +} +template <> +struct is_proto_enum<::NSPanelMQTTManagerCommand_CoverCommand_Action> : std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor<::NSPanelMQTTManagerCommand_CoverCommand_Action>() { + return ::NSPanelMQTTManagerCommand_CoverCommand_Action_descriptor(); +} +template <> struct is_proto_enum<::NSPanelMQTTManagerCommand_AffectLightsOptions> : std::true_type {}; template <> inline const EnumDescriptor* GetEnumDescriptor<::NSPanelMQTTManagerCommand_AffectLightsOptions>() { diff --git a/docker/MQTTManager/include/protobuf/protobuf_nspanel_entity.pb.cc b/docker/MQTTManager/include/protobuf/protobuf_nspanel_entity.pb.cc index 184546773..0eed186fa 100644 --- a/docker/MQTTManager/include/protobuf/protobuf_nspanel_entity.pb.cc +++ b/docker/MQTTManager/include/protobuf/protobuf_nspanel_entity.pb.cc @@ -48,6 +48,29 @@ struct NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValueDefau PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValueDefaultTypeInternal _NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue_default_instance_; +inline constexpr NSPanelEntityState_MediaPlayer_SourceSelection::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : sources_{}, + current_source_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + can_select_{false}, + _cached_size_{0} {} + +template +PROTOBUF_CONSTEXPR NSPanelEntityState_MediaPlayer_SourceSelection::NSPanelEntityState_MediaPlayer_SourceSelection(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} +struct NSPanelEntityState_MediaPlayer_SourceSelectionDefaultTypeInternal { + PROTOBUF_CONSTEXPR NSPanelEntityState_MediaPlayer_SourceSelectionDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~NSPanelEntityState_MediaPlayer_SourceSelectionDefaultTypeInternal() {} + union { + NSPanelEntityState_MediaPlayer_SourceSelection _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NSPanelEntityState_MediaPlayer_SourceSelectionDefaultTypeInternal _NSPanelEntityState_MediaPlayer_SourceSelection_default_instance_; + inline constexpr NSPanelEntityState_Light::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept : name_( @@ -78,6 +101,50 @@ struct NSPanelEntityState_LightDefaultTypeInternal { PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NSPanelEntityState_LightDefaultTypeInternal _NSPanelEntityState_Light_default_instance_; +inline constexpr NSPanelEntityState_Cover::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : name_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + device_class_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + cover_id_{0}, + state_{static_cast< ::NSPanelEntityState_Cover_CoverState >(0)}, + position_{0}, + has_position_{false}, + has_tilt_position_{false}, + can_open_{false}, + can_close_{false}, + tilt_position_{0}, + can_stop_{false}, + can_set_position_{false}, + can_open_tilt_{false}, + can_close_tilt_{false}, + can_stop_tilt_{false}, + can_set_tilt_position_{false}, + position_preset1_{0}, + position_preset2_{0}, + position_preset3_{0}, + tilt_preset1_{0}, + tilt_preset2_{0}, + tilt_preset3_{0}, + _cached_size_{0} {} + +template +PROTOBUF_CONSTEXPR NSPanelEntityState_Cover::NSPanelEntityState_Cover(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} +struct NSPanelEntityState_CoverDefaultTypeInternal { + PROTOBUF_CONSTEXPR NSPanelEntityState_CoverDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~NSPanelEntityState_CoverDefaultTypeInternal() {} + union { + NSPanelEntityState_Cover _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NSPanelEntityState_CoverDefaultTypeInternal _NSPanelEntityState_Cover_default_instance_; + inline constexpr NSPanelEntityState_Thermostat_ThermostatOption::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept : options_{}, @@ -106,6 +173,55 @@ struct NSPanelEntityState_Thermostat_ThermostatOptionDefaultTypeInternal { PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NSPanelEntityState_Thermostat_ThermostatOptionDefaultTypeInternal _NSPanelEntityState_Thermostat_ThermostatOption_default_instance_; +inline constexpr NSPanelEntityState_MediaPlayer::Impl_::Impl_( + ::_pbi::ConstantInitialized) noexcept + : _cached_size_{0}, + name_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + media_title_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + media_artist_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + album_art_url_( + &::google::protobuf::internal::fixed_address_empty_string, + ::_pbi::ConstantInitialized()), + player_sources_{nullptr}, + source_player_sources_{nullptr}, + media_player_id_{0}, + state_{static_cast< ::NSPanelEntityState_MediaPlayer_PlaybackState >(0)}, + volume_{0}, + source_volume_{0}, + is_muted_{false}, + has_source_volume_{false}, + can_play_{false}, + can_pause_{false}, + can_next_track_{false}, + can_previous_track_{false}, + can_set_volume_{false}, + can_mute_{false}, + volume_step_{0}, + has_media_position_{false}, + media_position_updated_at_{::int64_t{0}}, + media_position_{0}, + media_duration_{0} {} + +template +PROTOBUF_CONSTEXPR NSPanelEntityState_MediaPlayer::NSPanelEntityState_MediaPlayer(::_pbi::ConstantInitialized) + : _impl_(::_pbi::ConstantInitialized()) {} +struct NSPanelEntityState_MediaPlayerDefaultTypeInternal { + PROTOBUF_CONSTEXPR NSPanelEntityState_MediaPlayerDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} + ~NSPanelEntityState_MediaPlayerDefaultTypeInternal() {} + union { + NSPanelEntityState_MediaPlayer _instance; + }; +}; + +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT + PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NSPanelEntityState_MediaPlayerDefaultTypeInternal _NSPanelEntityState_MediaPlayer_default_instance_; + inline constexpr NSPanelEntityState_Thermostat::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept : options_{}, @@ -152,7 +268,7 @@ struct NSPanelEntityStateDefaultTypeInternal { PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NSPanelEntityStateDefaultTypeInternal _NSPanelEntityState_default_instance_; -static const ::_pb::EnumDescriptor* file_level_enum_descriptors_protobuf_5fnspanel_5fentity_2eproto[1]; +static const ::_pb::EnumDescriptor* file_level_enum_descriptors_protobuf_5fnspanel_5fentity_2eproto[3]; static constexpr const ::_pb::ServiceDescriptor** file_level_service_descriptors_protobuf_5fnspanel_5fentity_2eproto = nullptr; const ::uint32_t @@ -214,6 +330,101 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Thermostat, _impl_.step_size_), PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Thermostat, _impl_.options_), ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer_SourceSelection, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer_SourceSelection, _impl_.sources_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer_SourceSelection, _impl_.current_source_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer_SourceSelection, _impl_.can_select_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_._has_bits_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.media_player_id_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.name_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.state_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.media_title_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.media_artist_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.volume_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.is_muted_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.has_source_volume_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.source_volume_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.can_play_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.can_pause_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.can_next_track_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.can_previous_track_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.can_set_volume_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.can_mute_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.album_art_url_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.volume_step_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.player_sources_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.source_player_sources_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.has_media_position_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.media_position_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.media_position_updated_at_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_MediaPlayer, _impl_.media_duration_), + ~0u, + ~0u, + ~0u, + ~0u, + ~0u, + ~0u, + ~0u, + ~0u, + ~0u, + ~0u, + ~0u, + ~0u, + ~0u, + ~0u, + ~0u, + ~0u, + ~0u, + 0, + 1, + ~0u, + ~0u, + ~0u, + ~0u, + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ~0u, // no _split_ + ~0u, // no sizeof(Split) + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.cover_id_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.name_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.state_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.has_position_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.position_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.has_tilt_position_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.tilt_position_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.can_open_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.can_close_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.can_stop_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.can_set_position_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.can_open_tilt_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.can_close_tilt_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.can_stop_tilt_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.can_set_tilt_position_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.device_class_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.position_preset1_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.position_preset2_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.position_preset3_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.tilt_preset1_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.tilt_preset2_), + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState_Cover, _impl_.tilt_preset3_), + ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::NSPanelEntityState, _internal_metadata_), ~0u, // no _extensions_ PROTOBUF_FIELD_OFFSET(::NSPanelEntityState, _impl_._oneof_case_[0]), @@ -223,6 +434,8 @@ const ::uint32_t ~0u, // no sizeof(Split) ::_pbi::kInvalidFieldOffsetTag, ::_pbi::kInvalidFieldOffsetTag, + ::_pbi::kInvalidFieldOffsetTag, + ::_pbi::kInvalidFieldOffsetTag, PROTOBUF_FIELD_OFFSET(::NSPanelEntityState, _impl_.entity_), }; @@ -232,52 +445,97 @@ static const ::_pbi::MigrationSchema {18, -1, -1, sizeof(::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue)}, {28, -1, -1, sizeof(::NSPanelEntityState_Thermostat_ThermostatOption)}, {40, -1, -1, sizeof(::NSPanelEntityState_Thermostat)}, - {55, -1, -1, sizeof(::NSPanelEntityState)}, + {55, -1, -1, sizeof(::NSPanelEntityState_MediaPlayer_SourceSelection)}, + {66, 97, -1, sizeof(::NSPanelEntityState_MediaPlayer)}, + {120, -1, -1, sizeof(::NSPanelEntityState_Cover)}, + {150, -1, -1, sizeof(::NSPanelEntityState)}, }; static const ::_pb::Message* const file_default_instances[] = { &::_NSPanelEntityState_Light_default_instance_._instance, &::_NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue_default_instance_._instance, &::_NSPanelEntityState_Thermostat_ThermostatOption_default_instance_._instance, &::_NSPanelEntityState_Thermostat_default_instance_._instance, + &::_NSPanelEntityState_MediaPlayer_SourceSelection_default_instance_._instance, + &::_NSPanelEntityState_MediaPlayer_default_instance_._instance, + &::_NSPanelEntityState_Cover_default_instance_._instance, &::_NSPanelEntityState_default_instance_._instance, }; const char descriptor_table_protodef_protobuf_5fnspanel_5fentity_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( protodesc_cold) = { - "\n\035protobuf_nspanel_entity.proto\"\322\006\n\022NSPa" + "\n\035protobuf_nspanel_entity.proto\"\204\023\n\022NSPa" "nelEntityState\022*\n\005light\030\001 \001(\0132\031.NSPanelE" "ntityState.LightH\000\0224\n\nthermostat\030\002 \001(\0132\036" - ".NSPanelEntityState.ThermostatH\000\032\221\002\n\005Lig" - "ht\022\020\n\010light_id\030\001 \001(\005\022\014\n\004name\030\002 \001(\t\022\022\n\nbr" - "ightness\030\003 \001(\005\022\022\n\ncolor_temp\030\004 \001(\005\022\013\n\003hu" - "e\030\005 \001(\005\022\022\n\nsaturation\030\006 \001(\005\022\026\n\016can_color" - "_temp\030\007 \001(\010\022\021\n\tcan_color\030\010 \001(\010\022\?\n\022curren" - "t_light_mode\030\t \001(\0162#.NSPanelEntityState." - "Light.LightMode\022\r\n\005state\030\n \001(\010\"$\n\tLightM" - "ode\022\016\n\nCOLOR_TEMP\020\000\022\007\n\003RGB\020\001\032\273\003\n\nThermos" - "tat\022\025\n\rthermostat_id\030\001 \001(\005\022\014\n\004name\030\002 \001(\t" - "\022\033\n\023current_temperature\030\003 \001(\002\022\037\n\027has_cur" - "rent_temperature\030\004 \001(\010\022\027\n\017set_temperatur" - "e\030\005 \001(\002\022\021\n\tstep_size\030\006 \001(\002\022@\n\007options\030\007 " - "\003(\0132/.NSPanelEntityState.Thermostat.Ther" - "mostatOption\032\333\001\n\020ThermostatOption\022\014\n\004nam" - "e\030\001 \001(\t\022\025\n\rcurrent_value\030\002 \001(\t\022\024\n\014curren" - "t_icon\030\003 \001(\t\022V\n\007options\030\004 \003(\0132E.NSPanelE" - "ntityState.Thermostat.ThermostatOption.T" - "hermostatOptionValue\0324\n\025ThermostatOption" - "Value\022\r\n\005value\030\001 \001(\t\022\014\n\004icon\030\002 \001(\tB\010\n\006en" - "tityb\006proto3" + ".NSPanelEntityState.ThermostatH\000\0227\n\014medi" + "a_player\030\003 \001(\0132\037.NSPanelEntityState.Medi" + "aPlayerH\000\022*\n\005cover\030\004 \001(\0132\031.NSPanelEntity" + "State.CoverH\000\032\221\002\n\005Light\022\020\n\010light_id\030\001 \001(" + "\005\022\014\n\004name\030\002 \001(\t\022\022\n\nbrightness\030\003 \001(\005\022\022\n\nc" + "olor_temp\030\004 \001(\005\022\013\n\003hue\030\005 \001(\005\022\022\n\nsaturati" + "on\030\006 \001(\005\022\026\n\016can_color_temp\030\007 \001(\010\022\021\n\tcan_" + "color\030\010 \001(\010\022\?\n\022current_light_mode\030\t \001(\0162" + "#.NSPanelEntityState.Light.LightMode\022\r\n\005" + "state\030\n \001(\010\"$\n\tLightMode\022\016\n\nCOLOR_TEMP\020\000" + "\022\007\n\003RGB\020\001\032\273\003\n\nThermostat\022\025\n\rthermostat_i" + "d\030\001 \001(\005\022\014\n\004name\030\002 \001(\t\022\033\n\023current_tempera" + "ture\030\003 \001(\002\022\037\n\027has_current_temperature\030\004 " + "\001(\010\022\027\n\017set_temperature\030\005 \001(\002\022\021\n\tstep_siz" + "e\030\006 \001(\002\022@\n\007options\030\007 \003(\0132/.NSPanelEntity" + "State.Thermostat.ThermostatOption\032\333\001\n\020Th" + "ermostatOption\022\014\n\004name\030\001 \001(\t\022\025\n\rcurrent_" + "value\030\002 \001(\t\022\024\n\014current_icon\030\003 \001(\t\022V\n\007opt" + "ions\030\004 \003(\0132E.NSPanelEntityState.Thermost" + "at.ThermostatOption.ThermostatOptionValu" + "e\0324\n\025ThermostatOptionValue\022\r\n\005value\030\001 \001(" + "\t\022\014\n\004icon\030\002 \001(\t\032\331\006\n\013MediaPlayer\022\027\n\017media" + "_player_id\030\001 \001(\005\022\014\n\004name\030\002 \001(\t\022<\n\005state\030" + "\003 \001(\0162-.NSPanelEntityState.MediaPlayer.P" + "laybackState\022\023\n\013media_title\030\004 \001(\t\022\024\n\014med" + "ia_artist\030\005 \001(\t\022\016\n\006volume\030\006 \001(\005\022\020\n\010is_mu" + "ted\030\007 \001(\010\022\031\n\021has_source_volume\030\010 \001(\010\022\025\n\r" + "source_volume\030\t \001(\005\022\020\n\010can_play\030\n \001(\010\022\021\n" + "\tcan_pause\030\013 \001(\010\022\026\n\016can_next_track\030\014 \001(\010" + "\022\032\n\022can_previous_track\030\r \001(\010\022\026\n\016can_set_" + "volume\030\016 \001(\010\022\020\n\010can_mute\030\017 \001(\010\022\025\n\ralbum_" + "art_url\030\020 \001(\t\022\023\n\013volume_step\030\021 \001(\005\022G\n\016pl" + "ayer_sources\030\022 \001(\0132/.NSPanelEntityState." + "MediaPlayer.SourceSelection\022N\n\025source_pl" + "ayer_sources\030\023 \001(\0132/.NSPanelEntityState." + "MediaPlayer.SourceSelection\022\032\n\022has_media" + "_position\030\024 \001(\010\022\026\n\016media_position\030\025 \001(\005\022" + "!\n\031media_position_updated_at\030\026 \001(\003\022\026\n\016me" + "dia_duration\030\027 \001(\005\032N\n\017SourceSelection\022\017\n" + "\007sources\030\001 \003(\t\022\026\n\016current_source\030\002 \001(\t\022\022" + "\n\ncan_select\030\003 \001(\010\"_\n\rPlaybackState\022\013\n\007U" + "NKNOWN\020\000\022\007\n\003OFF\020\001\022\006\n\002ON\020\002\022\010\n\004IDLE\020\003\022\013\n\007P" + "LAYING\020\004\022\n\n\006PAUSED\020\005\022\r\n\tBUFFERING\020\006\032\356\004\n\005" + "Cover\022\020\n\010cover_id\030\001 \001(\005\022\014\n\004name\030\002 \001(\t\0223\n" + "\005state\030\003 \001(\0162$.NSPanelEntityState.Cover." + "CoverState\022\024\n\014has_position\030\004 \001(\010\022\020\n\010posi" + "tion\030\005 \001(\005\022\031\n\021has_tilt_position\030\006 \001(\010\022\025\n" + "\rtilt_position\030\007 \001(\005\022\020\n\010can_open\030\010 \001(\010\022\021" + "\n\tcan_close\030\t \001(\010\022\020\n\010can_stop\030\n \001(\010\022\030\n\020c" + "an_set_position\030\013 \001(\010\022\025\n\rcan_open_tilt\030\014" + " \001(\010\022\026\n\016can_close_tilt\030\r \001(\010\022\025\n\rcan_stop" + "_tilt\030\016 \001(\010\022\035\n\025can_set_tilt_position\030\017 \001" + "(\010\022\024\n\014device_class\030\020 \001(\t\022\030\n\020position_pre" + "set1\030\021 \001(\005\022\030\n\020position_preset2\030\022 \001(\005\022\030\n\020" + "position_preset3\030\023 \001(\005\022\024\n\014tilt_preset1\030\024" + " \001(\005\022\024\n\014tilt_preset2\030\025 \001(\005\022\024\n\014tilt_prese" + "t3\030\026 \001(\005\"Z\n\nCoverState\022\013\n\007UNKNOWN\020\000\022\010\n\004O" + "PEN\020\001\022\n\n\006CLOSED\020\002\022\013\n\007OPENING\020\003\022\013\n\007CLOSIN" + "G\020\004\022\017\n\013UNAVAILABLE\020\005B\010\n\006entityb\006proto3" }; static ::absl::once_flag descriptor_table_protobuf_5fnspanel_5fentity_2eproto_once; PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_protobuf_5fnspanel_5fentity_2eproto = { false, false, - 892, + 2478, descriptor_table_protodef_protobuf_5fnspanel_5fentity_2eproto, "protobuf_nspanel_entity.proto", &descriptor_table_protobuf_5fnspanel_5fentity_2eproto_once, nullptr, 0, - 5, + 8, schemas, file_default_instances, TableStruct_protobuf_5fnspanel_5fentity_2eproto::offsets, @@ -302,6 +560,55 @@ constexpr NSPanelEntityState_Light_LightMode NSPanelEntityState_Light::LightMode constexpr NSPanelEntityState_Light_LightMode NSPanelEntityState_Light::LightMode_MAX; constexpr int NSPanelEntityState_Light::LightMode_ARRAYSIZE; +#endif // (__cplusplus < 201703) && + // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +const ::google::protobuf::EnumDescriptor* NSPanelEntityState_MediaPlayer_PlaybackState_descriptor() { + ::google::protobuf::internal::AssignDescriptors(&descriptor_table_protobuf_5fnspanel_5fentity_2eproto); + return file_level_enum_descriptors_protobuf_5fnspanel_5fentity_2eproto[1]; +} +PROTOBUF_CONSTINIT const uint32_t NSPanelEntityState_MediaPlayer_PlaybackState_internal_data_[] = { + 458752u, 0u, }; +bool NSPanelEntityState_MediaPlayer_PlaybackState_IsValid(int value) { + return 0 <= value && value <= 6; +} +#if (__cplusplus < 201703) && \ + (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) + +constexpr NSPanelEntityState_MediaPlayer_PlaybackState NSPanelEntityState_MediaPlayer::UNKNOWN; +constexpr NSPanelEntityState_MediaPlayer_PlaybackState NSPanelEntityState_MediaPlayer::OFF; +constexpr NSPanelEntityState_MediaPlayer_PlaybackState NSPanelEntityState_MediaPlayer::ON; +constexpr NSPanelEntityState_MediaPlayer_PlaybackState NSPanelEntityState_MediaPlayer::IDLE; +constexpr NSPanelEntityState_MediaPlayer_PlaybackState NSPanelEntityState_MediaPlayer::PLAYING; +constexpr NSPanelEntityState_MediaPlayer_PlaybackState NSPanelEntityState_MediaPlayer::PAUSED; +constexpr NSPanelEntityState_MediaPlayer_PlaybackState NSPanelEntityState_MediaPlayer::BUFFERING; +constexpr NSPanelEntityState_MediaPlayer_PlaybackState NSPanelEntityState_MediaPlayer::PlaybackState_MIN; +constexpr NSPanelEntityState_MediaPlayer_PlaybackState NSPanelEntityState_MediaPlayer::PlaybackState_MAX; +constexpr int NSPanelEntityState_MediaPlayer::PlaybackState_ARRAYSIZE; + +#endif // (__cplusplus < 201703) && + // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +const ::google::protobuf::EnumDescriptor* NSPanelEntityState_Cover_CoverState_descriptor() { + ::google::protobuf::internal::AssignDescriptors(&descriptor_table_protobuf_5fnspanel_5fentity_2eproto); + return file_level_enum_descriptors_protobuf_5fnspanel_5fentity_2eproto[2]; +} +PROTOBUF_CONSTINIT const uint32_t NSPanelEntityState_Cover_CoverState_internal_data_[] = { + 393216u, 0u, }; +bool NSPanelEntityState_Cover_CoverState_IsValid(int value) { + return 0 <= value && value <= 5; +} +#if (__cplusplus < 201703) && \ + (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) + +constexpr NSPanelEntityState_Cover_CoverState NSPanelEntityState_Cover::UNKNOWN; +constexpr NSPanelEntityState_Cover_CoverState NSPanelEntityState_Cover::OPEN; +constexpr NSPanelEntityState_Cover_CoverState NSPanelEntityState_Cover::CLOSED; +constexpr NSPanelEntityState_Cover_CoverState NSPanelEntityState_Cover::OPENING; +constexpr NSPanelEntityState_Cover_CoverState NSPanelEntityState_Cover::CLOSING; +constexpr NSPanelEntityState_Cover_CoverState NSPanelEntityState_Cover::UNAVAILABLE; +constexpr NSPanelEntityState_Cover_CoverState NSPanelEntityState_Cover::CoverState_MIN; +constexpr NSPanelEntityState_Cover_CoverState NSPanelEntityState_Cover::CoverState_MAX; +constexpr int NSPanelEntityState_Cover::CoverState_ARRAYSIZE; + #endif // (__cplusplus < 201703) && // (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) // =================================================================== @@ -1618,136 +1925,70 @@ ::google::protobuf::Metadata NSPanelEntityState_Thermostat::GetMetadata() const } // =================================================================== -class NSPanelEntityState::_Internal { +class NSPanelEntityState_MediaPlayer_SourceSelection::_Internal { public: - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::NSPanelEntityState, _impl_._oneof_case_); }; -void NSPanelEntityState::set_allocated_light(::NSPanelEntityState_Light* light) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_entity(); - if (light) { - ::google::protobuf::Arena* submessage_arena = light->GetArena(); - if (message_arena != submessage_arena) { - light = ::google::protobuf::internal::GetOwnedMessage(message_arena, light, submessage_arena); - } - set_has_light(); - _impl_.entity_.light_ = light; - } - // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.light) -} -void NSPanelEntityState::set_allocated_thermostat(::NSPanelEntityState_Thermostat* thermostat) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_entity(); - if (thermostat) { - ::google::protobuf::Arena* submessage_arena = thermostat->GetArena(); - if (message_arena != submessage_arena) { - thermostat = ::google::protobuf::internal::GetOwnedMessage(message_arena, thermostat, submessage_arena); - } - set_has_thermostat(); - _impl_.entity_.thermostat_ = thermostat; - } - // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.thermostat) -} -NSPanelEntityState::NSPanelEntityState(::google::protobuf::Arena* arena) +NSPanelEntityState_MediaPlayer_SourceSelection::NSPanelEntityState_MediaPlayer_SourceSelection(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:NSPanelEntityState) + // @@protoc_insertion_point(arena_constructor:NSPanelEntityState.MediaPlayer.SourceSelection) } -inline PROTOBUF_NDEBUG_INLINE NSPanelEntityState::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelEntityState_MediaPlayer_SourceSelection::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, - const Impl_& from, const ::NSPanelEntityState& from_msg) - : entity_{}, - _cached_size_{0}, - _oneof_case_{from._oneof_case_[0]} {} + const Impl_& from, const ::NSPanelEntityState_MediaPlayer_SourceSelection& from_msg) + : sources_{visibility, arena, from.sources_}, + current_source_(arena, from.current_source_), + _cached_size_{0} {} -NSPanelEntityState::NSPanelEntityState( +NSPanelEntityState_MediaPlayer_SourceSelection::NSPanelEntityState_MediaPlayer_SourceSelection( ::google::protobuf::Arena* arena, - const NSPanelEntityState& from) + const NSPanelEntityState_MediaPlayer_SourceSelection& from) : ::google::protobuf::Message(arena) { - NSPanelEntityState* const _this = this; + NSPanelEntityState_MediaPlayer_SourceSelection* const _this = this; (void)_this; _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - switch (entity_case()) { - case ENTITY_NOT_SET: - break; - case kLight: - _impl_.entity_.light_ = ::google::protobuf::Message::CopyConstruct<::NSPanelEntityState_Light>(arena, *from._impl_.entity_.light_); - break; - case kThermostat: - _impl_.entity_.thermostat_ = ::google::protobuf::Message::CopyConstruct<::NSPanelEntityState_Thermostat>(arena, *from._impl_.entity_.thermostat_); - break; - } + _impl_.can_select_ = from._impl_.can_select_; - // @@protoc_insertion_point(copy_constructor:NSPanelEntityState) + // @@protoc_insertion_point(copy_constructor:NSPanelEntityState.MediaPlayer.SourceSelection) } -inline PROTOBUF_NDEBUG_INLINE NSPanelEntityState::Impl_::Impl_( +inline PROTOBUF_NDEBUG_INLINE NSPanelEntityState_MediaPlayer_SourceSelection::Impl_::Impl_( ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena) - : entity_{}, - _cached_size_{0}, - _oneof_case_{} {} + : sources_{visibility, arena}, + current_source_(arena), + _cached_size_{0} {} -inline void NSPanelEntityState::SharedCtor(::_pb::Arena* arena) { +inline void NSPanelEntityState_MediaPlayer_SourceSelection::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); + _impl_.can_select_ = {}; } -NSPanelEntityState::~NSPanelEntityState() { - // @@protoc_insertion_point(destructor:NSPanelEntityState) +NSPanelEntityState_MediaPlayer_SourceSelection::~NSPanelEntityState_MediaPlayer_SourceSelection() { + // @@protoc_insertion_point(destructor:NSPanelEntityState.MediaPlayer.SourceSelection) _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); SharedDtor(); } -inline void NSPanelEntityState::SharedDtor() { +inline void NSPanelEntityState_MediaPlayer_SourceSelection::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); - if (has_entity()) { - clear_entity(); - } + _impl_.current_source_.Destroy(); _impl_.~Impl_(); } -void NSPanelEntityState::clear_entity() { -// @@protoc_insertion_point(one_of_clear_start:NSPanelEntityState) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (entity_case()) { - case kLight: { - if (GetArena() == nullptr) { - delete _impl_.entity_.light_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.entity_.light_); - } - break; - } - case kThermostat: { - if (GetArena() == nullptr) { - delete _impl_.entity_.thermostat_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.entity_.thermostat_); - } - break; - } - case ENTITY_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = ENTITY_NOT_SET; -} - - const ::google::protobuf::MessageLite::ClassData* -NSPanelEntityState::GetClassData() const { +NSPanelEntityState_MediaPlayer_SourceSelection::GetClassData() const { PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: ClassDataFull _data_ = { { &_table_.header, nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized - PROTOBUF_FIELD_OFFSET(NSPanelEntityState, _impl_._cached_size_), + PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer_SourceSelection, _impl_._cached_size_), false, }, - &NSPanelEntityState::MergeImpl, - &NSPanelEntityState::kDescriptorMethods, + &NSPanelEntityState_MediaPlayer_SourceSelection::MergeImpl, + &NSPanelEntityState_MediaPlayer_SourceSelection::kDescriptorMethods, &descriptor_table_protobuf_5fnspanel_5fentity_2eproto, nullptr, // tracker }; @@ -1756,106 +1997,1946 @@ NSPanelEntityState::GetClassData() const { return _data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 2, 2, 0, 2> NSPanelEntityState::_table_ = { +const ::_pbi::TcParseTable<2, 3, 0, 76, 2> NSPanelEntityState_MediaPlayer_SourceSelection::_table_ = { { 0, // no _has_bits_ 0, // no _extensions_ - 2, 0, // max_field_number, fast_idx_mask + 3, 24, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967292, // skipmap + 4294967288, // skipmap offsetof(decltype(_table_), field_entries), - 2, // num_field_entries - 2, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - &_NSPanelEntityState_default_instance_._instance, + 3, // num_field_entries + 0, // num_aux_entries + offsetof(decltype(_table_), field_names), // no aux_entries + &_NSPanelEntityState_MediaPlayer_SourceSelection_default_instance_._instance, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::NSPanelEntityState>(), // to_prefetch + ::_pbi::TcParser::GetTable<::NSPanelEntityState_MediaPlayer_SourceSelection>(), // to_prefetch #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, + // repeated string sources = 1; + {::_pbi::TcParser::FastUR1, + {10, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer_SourceSelection, _impl_.sources_)}}, + // string current_source = 2; + {::_pbi::TcParser::FastUS1, + {18, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer_SourceSelection, _impl_.current_source_)}}, + // bool can_select = 3; + {::_pbi::TcParser::SingularVarintNoZag1(), + {24, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer_SourceSelection, _impl_.can_select_)}}, }}, {{ 65535, 65535 }}, {{ - // .NSPanelEntityState.Light light = 1; - {PROTOBUF_FIELD_OFFSET(NSPanelEntityState, _impl_.entity_.light_), _Internal::kOneofCaseOffset + 0, 0, - (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .NSPanelEntityState.Thermostat thermostat = 2; - {PROTOBUF_FIELD_OFFSET(NSPanelEntityState, _impl_.entity_.thermostat_), _Internal::kOneofCaseOffset + 0, 1, - (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, {{ - {::_pbi::TcParser::GetTable<::NSPanelEntityState_Light>()}, - {::_pbi::TcParser::GetTable<::NSPanelEntityState_Thermostat>()}, - }}, {{ + // repeated string sources = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer_SourceSelection, _impl_.sources_), 0, 0, + (0 | ::_fl::kFcRepeated | ::_fl::kUtf8String | ::_fl::kRepSString)}, + // string current_source = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer_SourceSelection, _impl_.current_source_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // bool can_select = 3; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer_SourceSelection, _impl_.can_select_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + }}, + // no aux_entries + {{ + "\56\7\16\0\0\0\0\0" + "NSPanelEntityState.MediaPlayer.SourceSelection" + "sources" + "current_source" }}, }; -PROTOBUF_NOINLINE void NSPanelEntityState::Clear() { -// @@protoc_insertion_point(message_clear_start:NSPanelEntityState) +PROTOBUF_NOINLINE void NSPanelEntityState_MediaPlayer_SourceSelection::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelEntityState.MediaPlayer.SourceSelection) ::google::protobuf::internal::TSanWrite(&_impl_); ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - clear_entity(); + _impl_.sources_.Clear(); + _impl_.current_source_.ClearToEmpty(); + _impl_.can_select_ = false; _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); } -::uint8_t* NSPanelEntityState::_InternalSerialize( +::uint8_t* NSPanelEntityState_MediaPlayer_SourceSelection::_InternalSerialize( ::uint8_t* target, ::google::protobuf::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:NSPanelEntityState) + // @@protoc_insertion_point(serialize_to_array_start:NSPanelEntityState.MediaPlayer.SourceSelection) ::uint32_t cached_has_bits = 0; (void)cached_has_bits; - switch (entity_case()) { - case kLight: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 1, *_impl_.entity_.light_, _impl_.entity_.light_->GetCachedSize(), target, stream); - break; - } - case kThermostat: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 2, *_impl_.entity_.thermostat_, _impl_.entity_.thermostat_->GetCachedSize(), target, stream); - break; - } - default: - break; + // repeated string sources = 1; + for (int i = 0, n = this->_internal_sources_size(); i < n; ++i) { + const auto& s = this->_internal_sources().Get(i); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + s.data(), static_cast(s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelEntityState.MediaPlayer.SourceSelection.sources"); + target = stream->WriteString(1, s, target); + } + + // string current_source = 2; + if (!this->_internal_current_source().empty()) { + const std::string& _s = this->_internal_current_source(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelEntityState.MediaPlayer.SourceSelection.current_source"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } + + // bool can_select = 3; + if (this->_internal_can_select() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 3, this->_internal_can_select(), target); } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); } - // @@protoc_insertion_point(serialize_to_array_end:NSPanelEntityState) + // @@protoc_insertion_point(serialize_to_array_end:NSPanelEntityState.MediaPlayer.SourceSelection) return target; } -::size_t NSPanelEntityState::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:NSPanelEntityState) +::size_t NSPanelEntityState_MediaPlayer_SourceSelection::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelEntityState.MediaPlayer.SourceSelection) ::size_t total_size = 0; ::uint32_t cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - switch (entity_case()) { - // .NSPanelEntityState.Light light = 1; - case kLight: { - total_size += - 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.entity_.light_); - break; - } - // .NSPanelEntityState.Thermostat thermostat = 2; - case kThermostat: { - total_size += - 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.entity_.thermostat_); - break; - } - case ENTITY_NOT_SET: { - break; - } + ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); + // repeated string sources = 1; + total_size += 1 * ::google::protobuf::internal::FromIntSize(_internal_sources().size()); + for (int i = 0, n = _internal_sources().size(); i < n; ++i) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + _internal_sources().Get(i)); + } + // string current_source = 2; + if (!this->_internal_current_source().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_current_source()); + } + + // bool can_select = 3; + if (this->_internal_can_select() != 0) { + total_size += 2; + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + + +void NSPanelEntityState_MediaPlayer_SourceSelection::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelEntityState.MediaPlayer.SourceSelection) + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _this->_internal_mutable_sources()->MergeFrom(from._internal_sources()); + if (!from._internal_current_source().empty()) { + _this->_internal_set_current_source(from._internal_current_source()); + } + if (from._internal_can_select() != 0) { + _this->_impl_.can_select_ = from._impl_.can_select_; + } + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); +} + +void NSPanelEntityState_MediaPlayer_SourceSelection::CopyFrom(const NSPanelEntityState_MediaPlayer_SourceSelection& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelEntityState.MediaPlayer.SourceSelection) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + + +void NSPanelEntityState_MediaPlayer_SourceSelection::InternalSwap(NSPanelEntityState_MediaPlayer_SourceSelection* PROTOBUF_RESTRICT other) { + using std::swap; + auto* arena = GetArena(); + ABSL_DCHECK_EQ(arena, other->GetArena()); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + _impl_.sources_.InternalSwap(&other->_impl_.sources_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.current_source_, &other->_impl_.current_source_, arena); + swap(_impl_.can_select_, other->_impl_.can_select_); +} + +::google::protobuf::Metadata NSPanelEntityState_MediaPlayer_SourceSelection::GetMetadata() const { + return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); +} +// =================================================================== + +class NSPanelEntityState_MediaPlayer::_Internal { + public: + using HasBits = + decltype(std::declval()._impl_._has_bits_); + static constexpr ::int32_t kHasBitsOffset = + 8 * PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_._has_bits_); +}; + +NSPanelEntityState_MediaPlayer::NSPanelEntityState_MediaPlayer(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); + // @@protoc_insertion_point(arena_constructor:NSPanelEntityState.MediaPlayer) +} +inline PROTOBUF_NDEBUG_INLINE NSPanelEntityState_MediaPlayer::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from, const ::NSPanelEntityState_MediaPlayer& from_msg) + : _has_bits_{from._has_bits_}, + _cached_size_{0}, + name_(arena, from.name_), + media_title_(arena, from.media_title_), + media_artist_(arena, from.media_artist_), + album_art_url_(arena, from.album_art_url_) {} + +NSPanelEntityState_MediaPlayer::NSPanelEntityState_MediaPlayer( + ::google::protobuf::Arena* arena, + const NSPanelEntityState_MediaPlayer& from) + : ::google::protobuf::Message(arena) { + NSPanelEntityState_MediaPlayer* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); + ::uint32_t cached_has_bits = _impl_._has_bits_[0]; + _impl_.player_sources_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::NSPanelEntityState_MediaPlayer_SourceSelection>( + arena, *from._impl_.player_sources_) + : nullptr; + _impl_.source_player_sources_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::NSPanelEntityState_MediaPlayer_SourceSelection>( + arena, *from._impl_.source_player_sources_) + : nullptr; + ::memcpy(reinterpret_cast(&_impl_) + + offsetof(Impl_, media_player_id_), + reinterpret_cast(&from._impl_) + + offsetof(Impl_, media_player_id_), + offsetof(Impl_, media_duration_) - + offsetof(Impl_, media_player_id_) + + sizeof(Impl_::media_duration_)); + + // @@protoc_insertion_point(copy_constructor:NSPanelEntityState.MediaPlayer) +} +inline PROTOBUF_NDEBUG_INLINE NSPanelEntityState_MediaPlayer::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : _cached_size_{0}, + name_(arena), + media_title_(arena), + media_artist_(arena), + album_art_url_(arena) {} + +inline void NSPanelEntityState_MediaPlayer::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); + ::memset(reinterpret_cast(&_impl_) + + offsetof(Impl_, player_sources_), + 0, + offsetof(Impl_, media_duration_) - + offsetof(Impl_, player_sources_) + + sizeof(Impl_::media_duration_)); +} +NSPanelEntityState_MediaPlayer::~NSPanelEntityState_MediaPlayer() { + // @@protoc_insertion_point(destructor:NSPanelEntityState.MediaPlayer) + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); + SharedDtor(); +} +inline void NSPanelEntityState_MediaPlayer::SharedDtor() { + ABSL_DCHECK(GetArena() == nullptr); + _impl_.name_.Destroy(); + _impl_.media_title_.Destroy(); + _impl_.media_artist_.Destroy(); + _impl_.album_art_url_.Destroy(); + delete _impl_.player_sources_; + delete _impl_.source_player_sources_; + _impl_.~Impl_(); +} + +const ::google::protobuf::MessageLite::ClassData* +NSPanelEntityState_MediaPlayer::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: + ClassDataFull _data_ = { + { + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_._cached_size_), + false, + }, + &NSPanelEntityState_MediaPlayer::MergeImpl, + &NSPanelEntityState_MediaPlayer::kDescriptorMethods, + &descriptor_table_protobuf_5fnspanel_5fentity_2eproto, + nullptr, // tracker + }; + ::google::protobuf::internal::PrefetchToLocalCache(&_data_); + ::google::protobuf::internal::PrefetchToLocalCache(_data_.tc_table); + return _data_.base(); +} +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<5, 23, 2, 95, 2> NSPanelEntityState_MediaPlayer::_table_ = { + { + PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_._has_bits_), + 0, // no _extensions_ + 23, 248, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4286578688, // skipmap + offsetof(decltype(_table_), field_entries), + 23, // num_field_entries + 2, // num_aux_entries + offsetof(decltype(_table_), aux_entries), + &_NSPanelEntityState_MediaPlayer_default_instance_._instance, + nullptr, // post_loop_handler + ::_pbi::TcParser::GenericFallback, // fallback + #ifdef PROTOBUF_PREFETCH_PARSE_TABLE + ::_pbi::TcParser::GetTable<::NSPanelEntityState_MediaPlayer>(), // to_prefetch + #endif // PROTOBUF_PREFETCH_PARSE_TABLE + }, {{ + {::_pbi::TcParser::MiniParse, {}}, + // int32 media_player_id = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelEntityState_MediaPlayer, _impl_.media_player_id_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.media_player_id_)}}, + // string name = 2; + {::_pbi::TcParser::FastUS1, + {18, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.name_)}}, + // .NSPanelEntityState.MediaPlayer.PlaybackState state = 3; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelEntityState_MediaPlayer, _impl_.state_), 63>(), + {24, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.state_)}}, + // string media_title = 4; + {::_pbi::TcParser::FastUS1, + {34, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.media_title_)}}, + // string media_artist = 5; + {::_pbi::TcParser::FastUS1, + {42, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.media_artist_)}}, + // int32 volume = 6; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelEntityState_MediaPlayer, _impl_.volume_), 63>(), + {48, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.volume_)}}, + // bool is_muted = 7; + {::_pbi::TcParser::SingularVarintNoZag1(), + {56, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.is_muted_)}}, + // bool has_source_volume = 8; + {::_pbi::TcParser::SingularVarintNoZag1(), + {64, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.has_source_volume_)}}, + // int32 source_volume = 9; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelEntityState_MediaPlayer, _impl_.source_volume_), 63>(), + {72, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.source_volume_)}}, + // bool can_play = 10; + {::_pbi::TcParser::SingularVarintNoZag1(), + {80, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.can_play_)}}, + // bool can_pause = 11; + {::_pbi::TcParser::SingularVarintNoZag1(), + {88, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.can_pause_)}}, + // bool can_next_track = 12; + {::_pbi::TcParser::SingularVarintNoZag1(), + {96, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.can_next_track_)}}, + // bool can_previous_track = 13; + {::_pbi::TcParser::SingularVarintNoZag1(), + {104, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.can_previous_track_)}}, + // bool can_set_volume = 14; + {::_pbi::TcParser::SingularVarintNoZag1(), + {112, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.can_set_volume_)}}, + // bool can_mute = 15; + {::_pbi::TcParser::SingularVarintNoZag1(), + {120, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.can_mute_)}}, + // string album_art_url = 16; + {::_pbi::TcParser::FastUS2, + {386, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.album_art_url_)}}, + // int32 volume_step = 17; + {::_pbi::TcParser::FastV32S2, + {392, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.volume_step_)}}, + // .NSPanelEntityState.MediaPlayer.SourceSelection player_sources = 18; + {::_pbi::TcParser::FastMtS2, + {402, 0, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.player_sources_)}}, + // .NSPanelEntityState.MediaPlayer.SourceSelection source_player_sources = 19; + {::_pbi::TcParser::FastMtS2, + {410, 1, 1, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.source_player_sources_)}}, + // bool has_media_position = 20; + {::_pbi::TcParser::FastV8S2, + {416, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.has_media_position_)}}, + // int32 media_position = 21; + {::_pbi::TcParser::FastV32S2, + {424, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.media_position_)}}, + // int64 media_position_updated_at = 22; + {::_pbi::TcParser::FastV64S2, + {432, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.media_position_updated_at_)}}, + // int32 media_duration = 23; + {::_pbi::TcParser::FastV32S2, + {440, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.media_duration_)}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + }}, {{ + 65535, 65535 + }}, {{ + // int32 media_player_id = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.media_player_id_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // string name = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.name_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // .NSPanelEntityState.MediaPlayer.PlaybackState state = 3; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.state_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + // string media_title = 4; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.media_title_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // string media_artist = 5; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.media_artist_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // int32 volume = 6; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.volume_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // bool is_muted = 7; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.is_muted_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool has_source_volume = 8; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.has_source_volume_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // int32 source_volume = 9; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.source_volume_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // bool can_play = 10; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.can_play_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool can_pause = 11; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.can_pause_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool can_next_track = 12; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.can_next_track_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool can_previous_track = 13; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.can_previous_track_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool can_set_volume = 14; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.can_set_volume_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool can_mute = 15; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.can_mute_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // string album_art_url = 16; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.album_art_url_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // int32 volume_step = 17; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.volume_step_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // .NSPanelEntityState.MediaPlayer.SourceSelection player_sources = 18; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.player_sources_), _Internal::kHasBitsOffset + 0, 0, + (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, + // .NSPanelEntityState.MediaPlayer.SourceSelection source_player_sources = 19; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.source_player_sources_), _Internal::kHasBitsOffset + 1, 1, + (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, + // bool has_media_position = 20; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.has_media_position_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // int32 media_position = 21; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.media_position_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int64 media_position_updated_at = 22; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.media_position_updated_at_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt64)}, + // int32 media_duration = 23; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.media_duration_), -1, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + }}, {{ + {::_pbi::TcParser::GetTable<::NSPanelEntityState_MediaPlayer_SourceSelection>()}, + {::_pbi::TcParser::GetTable<::NSPanelEntityState_MediaPlayer_SourceSelection>()}, + }}, {{ + "\36\0\4\0\13\14\0\0\0\0\0\0\0\0\0\0\15\0\0\0\0\0\0\0" + "NSPanelEntityState.MediaPlayer" + "name" + "media_title" + "media_artist" + "album_art_url" + }}, +}; + +PROTOBUF_NOINLINE void NSPanelEntityState_MediaPlayer::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelEntityState.MediaPlayer) + ::google::protobuf::internal::TSanWrite(&_impl_); + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.name_.ClearToEmpty(); + _impl_.media_title_.ClearToEmpty(); + _impl_.media_artist_.ClearToEmpty(); + _impl_.album_art_url_.ClearToEmpty(); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + ABSL_DCHECK(_impl_.player_sources_ != nullptr); + _impl_.player_sources_->Clear(); + } + if (cached_has_bits & 0x00000002u) { + ABSL_DCHECK(_impl_.source_player_sources_ != nullptr); + _impl_.source_player_sources_->Clear(); + } + } + ::memset(&_impl_.media_player_id_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.media_duration_) - + reinterpret_cast(&_impl_.media_player_id_)) + sizeof(_impl_.media_duration_)); + _impl_._has_bits_.Clear(); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); +} + +::uint8_t* NSPanelEntityState_MediaPlayer::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:NSPanelEntityState.MediaPlayer) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + // int32 media_player_id = 1; + if (this->_internal_media_player_id() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<1>( + stream, this->_internal_media_player_id(), target); + } + + // string name = 2; + if (!this->_internal_name().empty()) { + const std::string& _s = this->_internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelEntityState.MediaPlayer.name"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } + + // .NSPanelEntityState.MediaPlayer.PlaybackState state = 3; + if (this->_internal_state() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 3, this->_internal_state(), target); + } + + // string media_title = 4; + if (!this->_internal_media_title().empty()) { + const std::string& _s = this->_internal_media_title(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelEntityState.MediaPlayer.media_title"); + target = stream->WriteStringMaybeAliased(4, _s, target); + } + + // string media_artist = 5; + if (!this->_internal_media_artist().empty()) { + const std::string& _s = this->_internal_media_artist(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelEntityState.MediaPlayer.media_artist"); + target = stream->WriteStringMaybeAliased(5, _s, target); + } + + // int32 volume = 6; + if (this->_internal_volume() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<6>( + stream, this->_internal_volume(), target); + } + + // bool is_muted = 7; + if (this->_internal_is_muted() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 7, this->_internal_is_muted(), target); + } + + // bool has_source_volume = 8; + if (this->_internal_has_source_volume() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 8, this->_internal_has_source_volume(), target); + } + + // int32 source_volume = 9; + if (this->_internal_source_volume() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<9>( + stream, this->_internal_source_volume(), target); + } + + // bool can_play = 10; + if (this->_internal_can_play() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 10, this->_internal_can_play(), target); + } + + // bool can_pause = 11; + if (this->_internal_can_pause() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 11, this->_internal_can_pause(), target); + } + + // bool can_next_track = 12; + if (this->_internal_can_next_track() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 12, this->_internal_can_next_track(), target); + } + + // bool can_previous_track = 13; + if (this->_internal_can_previous_track() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 13, this->_internal_can_previous_track(), target); + } + + // bool can_set_volume = 14; + if (this->_internal_can_set_volume() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 14, this->_internal_can_set_volume(), target); + } + + // bool can_mute = 15; + if (this->_internal_can_mute() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 15, this->_internal_can_mute(), target); + } + + // string album_art_url = 16; + if (!this->_internal_album_art_url().empty()) { + const std::string& _s = this->_internal_album_art_url(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelEntityState.MediaPlayer.album_art_url"); + target = stream->WriteStringMaybeAliased(16, _s, target); + } + + // int32 volume_step = 17; + if (this->_internal_volume_step() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 17, this->_internal_volume_step(), target); + } + + cached_has_bits = _impl_._has_bits_[0]; + // .NSPanelEntityState.MediaPlayer.SourceSelection player_sources = 18; + if (cached_has_bits & 0x00000001u) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 18, *_impl_.player_sources_, _impl_.player_sources_->GetCachedSize(), target, stream); + } + + // .NSPanelEntityState.MediaPlayer.SourceSelection source_player_sources = 19; + if (cached_has_bits & 0x00000002u) { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 19, *_impl_.source_player_sources_, _impl_.source_player_sources_->GetCachedSize(), target, stream); + } + + // bool has_media_position = 20; + if (this->_internal_has_media_position() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 20, this->_internal_has_media_position(), target); + } + + // int32 media_position = 21; + if (this->_internal_media_position() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 21, this->_internal_media_position(), target); + } + + // int64 media_position_updated_at = 22; + if (this->_internal_media_position_updated_at() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt64ToArray( + 22, this->_internal_media_position_updated_at(), target); + } + + // int32 media_duration = 23; + if (this->_internal_media_duration() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 23, this->_internal_media_duration(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:NSPanelEntityState.MediaPlayer) + return target; +} + +::size_t NSPanelEntityState_MediaPlayer::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelEntityState.MediaPlayer) + ::size_t total_size = 0; + + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); + // string name = 2; + if (!this->_internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_name()); + } + + // string media_title = 4; + if (!this->_internal_media_title().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_media_title()); + } + + // string media_artist = 5; + if (!this->_internal_media_artist().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_media_artist()); + } + + // string album_art_url = 16; + if (!this->_internal_album_art_url().empty()) { + total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_album_art_url()); + } + + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // .NSPanelEntityState.MediaPlayer.SourceSelection player_sources = 18; + if (cached_has_bits & 0x00000001u) { + total_size += + 2 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.player_sources_); + } + + // .NSPanelEntityState.MediaPlayer.SourceSelection source_player_sources = 19; + if (cached_has_bits & 0x00000002u) { + total_size += + 2 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.source_player_sources_); + } + + } + // int32 media_player_id = 1; + if (this->_internal_media_player_id() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_media_player_id()); + } + + // .NSPanelEntityState.MediaPlayer.PlaybackState state = 3; + if (this->_internal_state() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_state()); + } + + // int32 volume = 6; + if (this->_internal_volume() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_volume()); + } + + // int32 source_volume = 9; + if (this->_internal_source_volume() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_source_volume()); + } + + // bool is_muted = 7; + if (this->_internal_is_muted() != 0) { + total_size += 2; + } + + // bool has_source_volume = 8; + if (this->_internal_has_source_volume() != 0) { + total_size += 2; + } + + // bool can_play = 10; + if (this->_internal_can_play() != 0) { + total_size += 2; + } + + // bool can_pause = 11; + if (this->_internal_can_pause() != 0) { + total_size += 2; + } + + // bool can_next_track = 12; + if (this->_internal_can_next_track() != 0) { + total_size += 2; + } + + // bool can_previous_track = 13; + if (this->_internal_can_previous_track() != 0) { + total_size += 2; + } + + // bool can_set_volume = 14; + if (this->_internal_can_set_volume() != 0) { + total_size += 2; + } + + // bool can_mute = 15; + if (this->_internal_can_mute() != 0) { + total_size += 2; + } + + // int32 volume_step = 17; + if (this->_internal_volume_step() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_volume_step()); + } + + // bool has_media_position = 20; + if (this->_internal_has_media_position() != 0) { + total_size += 3; + } + + // int64 media_position_updated_at = 22; + if (this->_internal_media_position_updated_at() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int64Size( + this->_internal_media_position_updated_at()); + } + + // int32 media_position = 21; + if (this->_internal_media_position() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_media_position()); + } + + // int32 media_duration = 23; + if (this->_internal_media_duration() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_media_duration()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + + +void NSPanelEntityState_MediaPlayer::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + ::google::protobuf::Arena* arena = _this->GetArena(); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelEntityState.MediaPlayer) + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } + if (!from._internal_media_title().empty()) { + _this->_internal_set_media_title(from._internal_media_title()); + } + if (!from._internal_media_artist().empty()) { + _this->_internal_set_media_artist(from._internal_media_artist()); + } + if (!from._internal_album_art_url().empty()) { + _this->_internal_set_album_art_url(from._internal_album_art_url()); + } + cached_has_bits = from._impl_._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + ABSL_DCHECK(from._impl_.player_sources_ != nullptr); + if (_this->_impl_.player_sources_ == nullptr) { + _this->_impl_.player_sources_ = + ::google::protobuf::Message::CopyConstruct<::NSPanelEntityState_MediaPlayer_SourceSelection>(arena, *from._impl_.player_sources_); + } else { + _this->_impl_.player_sources_->MergeFrom(*from._impl_.player_sources_); + } + } + if (cached_has_bits & 0x00000002u) { + ABSL_DCHECK(from._impl_.source_player_sources_ != nullptr); + if (_this->_impl_.source_player_sources_ == nullptr) { + _this->_impl_.source_player_sources_ = + ::google::protobuf::Message::CopyConstruct<::NSPanelEntityState_MediaPlayer_SourceSelection>(arena, *from._impl_.source_player_sources_); + } else { + _this->_impl_.source_player_sources_->MergeFrom(*from._impl_.source_player_sources_); + } + } + } + if (from._internal_media_player_id() != 0) { + _this->_impl_.media_player_id_ = from._impl_.media_player_id_; + } + if (from._internal_state() != 0) { + _this->_impl_.state_ = from._impl_.state_; + } + if (from._internal_volume() != 0) { + _this->_impl_.volume_ = from._impl_.volume_; + } + if (from._internal_source_volume() != 0) { + _this->_impl_.source_volume_ = from._impl_.source_volume_; + } + if (from._internal_is_muted() != 0) { + _this->_impl_.is_muted_ = from._impl_.is_muted_; + } + if (from._internal_has_source_volume() != 0) { + _this->_impl_.has_source_volume_ = from._impl_.has_source_volume_; + } + if (from._internal_can_play() != 0) { + _this->_impl_.can_play_ = from._impl_.can_play_; + } + if (from._internal_can_pause() != 0) { + _this->_impl_.can_pause_ = from._impl_.can_pause_; + } + if (from._internal_can_next_track() != 0) { + _this->_impl_.can_next_track_ = from._impl_.can_next_track_; + } + if (from._internal_can_previous_track() != 0) { + _this->_impl_.can_previous_track_ = from._impl_.can_previous_track_; + } + if (from._internal_can_set_volume() != 0) { + _this->_impl_.can_set_volume_ = from._impl_.can_set_volume_; + } + if (from._internal_can_mute() != 0) { + _this->_impl_.can_mute_ = from._impl_.can_mute_; + } + if (from._internal_volume_step() != 0) { + _this->_impl_.volume_step_ = from._impl_.volume_step_; + } + if (from._internal_has_media_position() != 0) { + _this->_impl_.has_media_position_ = from._impl_.has_media_position_; + } + if (from._internal_media_position_updated_at() != 0) { + _this->_impl_.media_position_updated_at_ = from._impl_.media_position_updated_at_; + } + if (from._internal_media_position() != 0) { + _this->_impl_.media_position_ = from._impl_.media_position_; + } + if (from._internal_media_duration() != 0) { + _this->_impl_.media_duration_ = from._impl_.media_duration_; + } + _this->_impl_._has_bits_[0] |= cached_has_bits; + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); +} + +void NSPanelEntityState_MediaPlayer::CopyFrom(const NSPanelEntityState_MediaPlayer& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelEntityState.MediaPlayer) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + + +void NSPanelEntityState_MediaPlayer::InternalSwap(NSPanelEntityState_MediaPlayer* PROTOBUF_RESTRICT other) { + using std::swap; + auto* arena = GetArena(); + ABSL_DCHECK_EQ(arena, other->GetArena()); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.media_title_, &other->_impl_.media_title_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.media_artist_, &other->_impl_.media_artist_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.album_art_url_, &other->_impl_.album_art_url_, arena); + ::google::protobuf::internal::memswap< + PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.media_duration_) + + sizeof(NSPanelEntityState_MediaPlayer::_impl_.media_duration_) + - PROTOBUF_FIELD_OFFSET(NSPanelEntityState_MediaPlayer, _impl_.player_sources_)>( + reinterpret_cast(&_impl_.player_sources_), + reinterpret_cast(&other->_impl_.player_sources_)); +} + +::google::protobuf::Metadata NSPanelEntityState_MediaPlayer::GetMetadata() const { + return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); +} +// =================================================================== + +class NSPanelEntityState_Cover::_Internal { + public: +}; + +NSPanelEntityState_Cover::NSPanelEntityState_Cover(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); + // @@protoc_insertion_point(arena_constructor:NSPanelEntityState.Cover) +} +inline PROTOBUF_NDEBUG_INLINE NSPanelEntityState_Cover::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from, const ::NSPanelEntityState_Cover& from_msg) + : name_(arena, from.name_), + device_class_(arena, from.device_class_), + _cached_size_{0} {} + +NSPanelEntityState_Cover::NSPanelEntityState_Cover( + ::google::protobuf::Arena* arena, + const NSPanelEntityState_Cover& from) + : ::google::protobuf::Message(arena) { + NSPanelEntityState_Cover* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); + ::memcpy(reinterpret_cast(&_impl_) + + offsetof(Impl_, cover_id_), + reinterpret_cast(&from._impl_) + + offsetof(Impl_, cover_id_), + offsetof(Impl_, tilt_preset3_) - + offsetof(Impl_, cover_id_) + + sizeof(Impl_::tilt_preset3_)); + + // @@protoc_insertion_point(copy_constructor:NSPanelEntityState.Cover) +} +inline PROTOBUF_NDEBUG_INLINE NSPanelEntityState_Cover::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : name_(arena), + device_class_(arena), + _cached_size_{0} {} + +inline void NSPanelEntityState_Cover::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); + ::memset(reinterpret_cast(&_impl_) + + offsetof(Impl_, cover_id_), + 0, + offsetof(Impl_, tilt_preset3_) - + offsetof(Impl_, cover_id_) + + sizeof(Impl_::tilt_preset3_)); +} +NSPanelEntityState_Cover::~NSPanelEntityState_Cover() { + // @@protoc_insertion_point(destructor:NSPanelEntityState.Cover) + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); + SharedDtor(); +} +inline void NSPanelEntityState_Cover::SharedDtor() { + ABSL_DCHECK(GetArena() == nullptr); + _impl_.name_.Destroy(); + _impl_.device_class_.Destroy(); + _impl_.~Impl_(); +} + +const ::google::protobuf::MessageLite::ClassData* +NSPanelEntityState_Cover::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: + ClassDataFull _data_ = { + { + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_._cached_size_), + false, + }, + &NSPanelEntityState_Cover::MergeImpl, + &NSPanelEntityState_Cover::kDescriptorMethods, + &descriptor_table_protobuf_5fnspanel_5fentity_2eproto, + nullptr, // tracker + }; + ::google::protobuf::internal::PrefetchToLocalCache(&_data_); + ::google::protobuf::internal::PrefetchToLocalCache(_data_.tc_table); + return _data_.base(); +} +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<5, 22, 0, 65, 2> NSPanelEntityState_Cover::_table_ = { + { + 0, // no _has_bits_ + 0, // no _extensions_ + 22, 248, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4290772992, // skipmap + offsetof(decltype(_table_), field_entries), + 22, // num_field_entries + 0, // num_aux_entries + offsetof(decltype(_table_), field_names), // no aux_entries + &_NSPanelEntityState_Cover_default_instance_._instance, + nullptr, // post_loop_handler + ::_pbi::TcParser::GenericFallback, // fallback + #ifdef PROTOBUF_PREFETCH_PARSE_TABLE + ::_pbi::TcParser::GetTable<::NSPanelEntityState_Cover>(), // to_prefetch + #endif // PROTOBUF_PREFETCH_PARSE_TABLE + }, {{ + {::_pbi::TcParser::MiniParse, {}}, + // int32 cover_id = 1; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelEntityState_Cover, _impl_.cover_id_), 63>(), + {8, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.cover_id_)}}, + // string name = 2; + {::_pbi::TcParser::FastUS1, + {18, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.name_)}}, + // .NSPanelEntityState.Cover.CoverState state = 3; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelEntityState_Cover, _impl_.state_), 63>(), + {24, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.state_)}}, + // bool has_position = 4; + {::_pbi::TcParser::SingularVarintNoZag1(), + {32, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.has_position_)}}, + // int32 position = 5; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelEntityState_Cover, _impl_.position_), 63>(), + {40, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.position_)}}, + // bool has_tilt_position = 6; + {::_pbi::TcParser::SingularVarintNoZag1(), + {48, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.has_tilt_position_)}}, + // int32 tilt_position = 7; + {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(NSPanelEntityState_Cover, _impl_.tilt_position_), 63>(), + {56, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.tilt_position_)}}, + // bool can_open = 8; + {::_pbi::TcParser::SingularVarintNoZag1(), + {64, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.can_open_)}}, + // bool can_close = 9; + {::_pbi::TcParser::SingularVarintNoZag1(), + {72, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.can_close_)}}, + // bool can_stop = 10; + {::_pbi::TcParser::SingularVarintNoZag1(), + {80, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.can_stop_)}}, + // bool can_set_position = 11; + {::_pbi::TcParser::SingularVarintNoZag1(), + {88, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.can_set_position_)}}, + // bool can_open_tilt = 12; + {::_pbi::TcParser::SingularVarintNoZag1(), + {96, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.can_open_tilt_)}}, + // bool can_close_tilt = 13; + {::_pbi::TcParser::SingularVarintNoZag1(), + {104, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.can_close_tilt_)}}, + // bool can_stop_tilt = 14; + {::_pbi::TcParser::SingularVarintNoZag1(), + {112, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.can_stop_tilt_)}}, + // bool can_set_tilt_position = 15; + {::_pbi::TcParser::SingularVarintNoZag1(), + {120, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.can_set_tilt_position_)}}, + // string device_class = 16; + {::_pbi::TcParser::FastUS2, + {386, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.device_class_)}}, + // int32 position_preset1 = 17; + {::_pbi::TcParser::FastV32S2, + {392, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.position_preset1_)}}, + // int32 position_preset2 = 18; + {::_pbi::TcParser::FastV32S2, + {400, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.position_preset2_)}}, + // int32 position_preset3 = 19; + {::_pbi::TcParser::FastV32S2, + {408, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.position_preset3_)}}, + // int32 tilt_preset1 = 20; + {::_pbi::TcParser::FastV32S2, + {416, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.tilt_preset1_)}}, + // int32 tilt_preset2 = 21; + {::_pbi::TcParser::FastV32S2, + {424, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.tilt_preset2_)}}, + // int32 tilt_preset3 = 22; + {::_pbi::TcParser::FastV32S2, + {432, 63, 0, PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.tilt_preset3_)}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + {::_pbi::TcParser::MiniParse, {}}, + }}, {{ + 65535, 65535 + }}, {{ + // int32 cover_id = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.cover_id_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // string name = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.name_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // .NSPanelEntityState.Cover.CoverState state = 3; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.state_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kOpenEnum)}, + // bool has_position = 4; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.has_position_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // int32 position = 5; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.position_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // bool has_tilt_position = 6; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.has_tilt_position_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // int32 tilt_position = 7; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.tilt_position_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // bool can_open = 8; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.can_open_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool can_close = 9; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.can_close_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool can_stop = 10; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.can_stop_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool can_set_position = 11; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.can_set_position_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool can_open_tilt = 12; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.can_open_tilt_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool can_close_tilt = 13; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.can_close_tilt_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool can_stop_tilt = 14; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.can_stop_tilt_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // bool can_set_tilt_position = 15; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.can_set_tilt_position_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kBool)}, + // string device_class = 16; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.device_class_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kUtf8String | ::_fl::kRepAString)}, + // int32 position_preset1 = 17; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.position_preset1_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 position_preset2 = 18; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.position_preset2_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 position_preset3 = 19; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.position_preset3_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 tilt_preset1 = 20; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.tilt_preset1_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 tilt_preset2 = 21; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.tilt_preset2_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + // int32 tilt_preset3 = 22; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.tilt_preset3_), 0, 0, + (0 | ::_fl::kFcSingular | ::_fl::kInt32)}, + }}, + // no aux_entries + {{ + "\30\0\4\0\0\0\0\0\0\0\0\0\0\0\0\0\14\0\0\0\0\0\0\0" + "NSPanelEntityState.Cover" + "name" + "device_class" + }}, +}; + +PROTOBUF_NOINLINE void NSPanelEntityState_Cover::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelEntityState.Cover) + ::google::protobuf::internal::TSanWrite(&_impl_); + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.name_.ClearToEmpty(); + _impl_.device_class_.ClearToEmpty(); + ::memset(&_impl_.cover_id_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.tilt_preset3_) - + reinterpret_cast(&_impl_.cover_id_)) + sizeof(_impl_.tilt_preset3_)); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); +} + +::uint8_t* NSPanelEntityState_Cover::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:NSPanelEntityState.Cover) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + // int32 cover_id = 1; + if (this->_internal_cover_id() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<1>( + stream, this->_internal_cover_id(), target); + } + + // string name = 2; + if (!this->_internal_name().empty()) { + const std::string& _s = this->_internal_name(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelEntityState.Cover.name"); + target = stream->WriteStringMaybeAliased(2, _s, target); + } + + // .NSPanelEntityState.Cover.CoverState state = 3; + if (this->_internal_state() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 3, this->_internal_state(), target); + } + + // bool has_position = 4; + if (this->_internal_has_position() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 4, this->_internal_has_position(), target); + } + + // int32 position = 5; + if (this->_internal_position() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<5>( + stream, this->_internal_position(), target); + } + + // bool has_tilt_position = 6; + if (this->_internal_has_tilt_position() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 6, this->_internal_has_tilt_position(), target); + } + + // int32 tilt_position = 7; + if (this->_internal_tilt_position() != 0) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32ToArrayWithField<7>( + stream, this->_internal_tilt_position(), target); + } + + // bool can_open = 8; + if (this->_internal_can_open() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 8, this->_internal_can_open(), target); + } + + // bool can_close = 9; + if (this->_internal_can_close() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 9, this->_internal_can_close(), target); + } + + // bool can_stop = 10; + if (this->_internal_can_stop() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 10, this->_internal_can_stop(), target); + } + + // bool can_set_position = 11; + if (this->_internal_can_set_position() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 11, this->_internal_can_set_position(), target); + } + + // bool can_open_tilt = 12; + if (this->_internal_can_open_tilt() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 12, this->_internal_can_open_tilt(), target); + } + + // bool can_close_tilt = 13; + if (this->_internal_can_close_tilt() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 13, this->_internal_can_close_tilt(), target); + } + + // bool can_stop_tilt = 14; + if (this->_internal_can_stop_tilt() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 14, this->_internal_can_stop_tilt(), target); + } + + // bool can_set_tilt_position = 15; + if (this->_internal_can_set_tilt_position() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray( + 15, this->_internal_can_set_tilt_position(), target); + } + + // string device_class = 16; + if (!this->_internal_device_class().empty()) { + const std::string& _s = this->_internal_device_class(); + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + _s.data(), static_cast(_s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "NSPanelEntityState.Cover.device_class"); + target = stream->WriteStringMaybeAliased(16, _s, target); + } + + // int32 position_preset1 = 17; + if (this->_internal_position_preset1() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 17, this->_internal_position_preset1(), target); + } + + // int32 position_preset2 = 18; + if (this->_internal_position_preset2() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 18, this->_internal_position_preset2(), target); + } + + // int32 position_preset3 = 19; + if (this->_internal_position_preset3() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 19, this->_internal_position_preset3(), target); + } + + // int32 tilt_preset1 = 20; + if (this->_internal_tilt_preset1() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 20, this->_internal_tilt_preset1(), target); + } + + // int32 tilt_preset2 = 21; + if (this->_internal_tilt_preset2() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 21, this->_internal_tilt_preset2(), target); + } + + // int32 tilt_preset3 = 22; + if (this->_internal_tilt_preset3() != 0) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray( + 22, this->_internal_tilt_preset3(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:NSPanelEntityState.Cover) + return target; +} + +::size_t NSPanelEntityState_Cover::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelEntityState.Cover) + ::size_t total_size = 0; + + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); + // string name = 2; + if (!this->_internal_name().empty()) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_name()); + } + + // string device_class = 16; + if (!this->_internal_device_class().empty()) { + total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->_internal_device_class()); + } + + // int32 cover_id = 1; + if (this->_internal_cover_id() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_cover_id()); + } + + // .NSPanelEntityState.Cover.CoverState state = 3; + if (this->_internal_state() != 0) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_state()); + } + + // int32 position = 5; + if (this->_internal_position() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_position()); + } + + // bool has_position = 4; + if (this->_internal_has_position() != 0) { + total_size += 2; + } + + // bool has_tilt_position = 6; + if (this->_internal_has_tilt_position() != 0) { + total_size += 2; + } + + // bool can_open = 8; + if (this->_internal_can_open() != 0) { + total_size += 2; + } + + // bool can_close = 9; + if (this->_internal_can_close() != 0) { + total_size += 2; + } + + // int32 tilt_position = 7; + if (this->_internal_tilt_position() != 0) { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( + this->_internal_tilt_position()); + } + + // bool can_stop = 10; + if (this->_internal_can_stop() != 0) { + total_size += 2; + } + + // bool can_set_position = 11; + if (this->_internal_can_set_position() != 0) { + total_size += 2; + } + + // bool can_open_tilt = 12; + if (this->_internal_can_open_tilt() != 0) { + total_size += 2; + } + + // bool can_close_tilt = 13; + if (this->_internal_can_close_tilt() != 0) { + total_size += 2; + } + + // bool can_stop_tilt = 14; + if (this->_internal_can_stop_tilt() != 0) { + total_size += 2; + } + + // bool can_set_tilt_position = 15; + if (this->_internal_can_set_tilt_position() != 0) { + total_size += 2; + } + + // int32 position_preset1 = 17; + if (this->_internal_position_preset1() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_position_preset1()); + } + + // int32 position_preset2 = 18; + if (this->_internal_position_preset2() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_position_preset2()); + } + + // int32 position_preset3 = 19; + if (this->_internal_position_preset3() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_position_preset3()); + } + + // int32 tilt_preset1 = 20; + if (this->_internal_tilt_preset1() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_tilt_preset1()); + } + + // int32 tilt_preset2 = 21; + if (this->_internal_tilt_preset2() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_tilt_preset2()); + } + + // int32 tilt_preset3 = 22; + if (this->_internal_tilt_preset3() != 0) { + total_size += 2 + ::_pbi::WireFormatLite::Int32Size( + this->_internal_tilt_preset3()); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + + +void NSPanelEntityState_Cover::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:NSPanelEntityState.Cover) + ABSL_DCHECK_NE(&from, _this); + ::uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_name().empty()) { + _this->_internal_set_name(from._internal_name()); + } + if (!from._internal_device_class().empty()) { + _this->_internal_set_device_class(from._internal_device_class()); + } + if (from._internal_cover_id() != 0) { + _this->_impl_.cover_id_ = from._impl_.cover_id_; + } + if (from._internal_state() != 0) { + _this->_impl_.state_ = from._impl_.state_; + } + if (from._internal_position() != 0) { + _this->_impl_.position_ = from._impl_.position_; + } + if (from._internal_has_position() != 0) { + _this->_impl_.has_position_ = from._impl_.has_position_; + } + if (from._internal_has_tilt_position() != 0) { + _this->_impl_.has_tilt_position_ = from._impl_.has_tilt_position_; + } + if (from._internal_can_open() != 0) { + _this->_impl_.can_open_ = from._impl_.can_open_; + } + if (from._internal_can_close() != 0) { + _this->_impl_.can_close_ = from._impl_.can_close_; + } + if (from._internal_tilt_position() != 0) { + _this->_impl_.tilt_position_ = from._impl_.tilt_position_; + } + if (from._internal_can_stop() != 0) { + _this->_impl_.can_stop_ = from._impl_.can_stop_; + } + if (from._internal_can_set_position() != 0) { + _this->_impl_.can_set_position_ = from._impl_.can_set_position_; + } + if (from._internal_can_open_tilt() != 0) { + _this->_impl_.can_open_tilt_ = from._impl_.can_open_tilt_; + } + if (from._internal_can_close_tilt() != 0) { + _this->_impl_.can_close_tilt_ = from._impl_.can_close_tilt_; + } + if (from._internal_can_stop_tilt() != 0) { + _this->_impl_.can_stop_tilt_ = from._impl_.can_stop_tilt_; + } + if (from._internal_can_set_tilt_position() != 0) { + _this->_impl_.can_set_tilt_position_ = from._impl_.can_set_tilt_position_; + } + if (from._internal_position_preset1() != 0) { + _this->_impl_.position_preset1_ = from._impl_.position_preset1_; + } + if (from._internal_position_preset2() != 0) { + _this->_impl_.position_preset2_ = from._impl_.position_preset2_; + } + if (from._internal_position_preset3() != 0) { + _this->_impl_.position_preset3_ = from._impl_.position_preset3_; + } + if (from._internal_tilt_preset1() != 0) { + _this->_impl_.tilt_preset1_ = from._impl_.tilt_preset1_; + } + if (from._internal_tilt_preset2() != 0) { + _this->_impl_.tilt_preset2_ = from._impl_.tilt_preset2_; + } + if (from._internal_tilt_preset3() != 0) { + _this->_impl_.tilt_preset3_ = from._impl_.tilt_preset3_; + } + _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); +} + +void NSPanelEntityState_Cover::CopyFrom(const NSPanelEntityState_Cover& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:NSPanelEntityState.Cover) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + + +void NSPanelEntityState_Cover::InternalSwap(NSPanelEntityState_Cover* PROTOBUF_RESTRICT other) { + using std::swap; + auto* arena = GetArena(); + ABSL_DCHECK_EQ(arena, other->GetArena()); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.name_, &other->_impl_.name_, arena); + ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.device_class_, &other->_impl_.device_class_, arena); + ::google::protobuf::internal::memswap< + PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.tilt_preset3_) + + sizeof(NSPanelEntityState_Cover::_impl_.tilt_preset3_) + - PROTOBUF_FIELD_OFFSET(NSPanelEntityState_Cover, _impl_.cover_id_)>( + reinterpret_cast(&_impl_.cover_id_), + reinterpret_cast(&other->_impl_.cover_id_)); +} + +::google::protobuf::Metadata NSPanelEntityState_Cover::GetMetadata() const { + return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); +} +// =================================================================== + +class NSPanelEntityState::_Internal { + public: + static constexpr ::int32_t kOneofCaseOffset = + PROTOBUF_FIELD_OFFSET(::NSPanelEntityState, _impl_._oneof_case_); +}; + +void NSPanelEntityState::set_allocated_light(::NSPanelEntityState_Light* light) { + ::google::protobuf::Arena* message_arena = GetArena(); + clear_entity(); + if (light) { + ::google::protobuf::Arena* submessage_arena = light->GetArena(); + if (message_arena != submessage_arena) { + light = ::google::protobuf::internal::GetOwnedMessage(message_arena, light, submessage_arena); + } + set_has_light(); + _impl_.entity_.light_ = light; + } + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.light) +} +void NSPanelEntityState::set_allocated_thermostat(::NSPanelEntityState_Thermostat* thermostat) { + ::google::protobuf::Arena* message_arena = GetArena(); + clear_entity(); + if (thermostat) { + ::google::protobuf::Arena* submessage_arena = thermostat->GetArena(); + if (message_arena != submessage_arena) { + thermostat = ::google::protobuf::internal::GetOwnedMessage(message_arena, thermostat, submessage_arena); + } + set_has_thermostat(); + _impl_.entity_.thermostat_ = thermostat; + } + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.thermostat) +} +void NSPanelEntityState::set_allocated_media_player(::NSPanelEntityState_MediaPlayer* media_player) { + ::google::protobuf::Arena* message_arena = GetArena(); + clear_entity(); + if (media_player) { + ::google::protobuf::Arena* submessage_arena = media_player->GetArena(); + if (message_arena != submessage_arena) { + media_player = ::google::protobuf::internal::GetOwnedMessage(message_arena, media_player, submessage_arena); + } + set_has_media_player(); + _impl_.entity_.media_player_ = media_player; + } + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.media_player) +} +void NSPanelEntityState::set_allocated_cover(::NSPanelEntityState_Cover* cover) { + ::google::protobuf::Arena* message_arena = GetArena(); + clear_entity(); + if (cover) { + ::google::protobuf::Arena* submessage_arena = cover->GetArena(); + if (message_arena != submessage_arena) { + cover = ::google::protobuf::internal::GetOwnedMessage(message_arena, cover, submessage_arena); + } + set_has_cover(); + _impl_.entity_.cover_ = cover; + } + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.cover) +} +NSPanelEntityState::NSPanelEntityState(::google::protobuf::Arena* arena) + : ::google::protobuf::Message(arena) { + SharedCtor(arena); + // @@protoc_insertion_point(arena_constructor:NSPanelEntityState) +} +inline PROTOBUF_NDEBUG_INLINE NSPanelEntityState::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, + const Impl_& from, const ::NSPanelEntityState& from_msg) + : entity_{}, + _cached_size_{0}, + _oneof_case_{from._oneof_case_[0]} {} + +NSPanelEntityState::NSPanelEntityState( + ::google::protobuf::Arena* arena, + const NSPanelEntityState& from) + : ::google::protobuf::Message(arena) { + NSPanelEntityState* const _this = this; + (void)_this; + _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( + from._internal_metadata_); + new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); + switch (entity_case()) { + case ENTITY_NOT_SET: + break; + case kLight: + _impl_.entity_.light_ = ::google::protobuf::Message::CopyConstruct<::NSPanelEntityState_Light>(arena, *from._impl_.entity_.light_); + break; + case kThermostat: + _impl_.entity_.thermostat_ = ::google::protobuf::Message::CopyConstruct<::NSPanelEntityState_Thermostat>(arena, *from._impl_.entity_.thermostat_); + break; + case kMediaPlayer: + _impl_.entity_.media_player_ = ::google::protobuf::Message::CopyConstruct<::NSPanelEntityState_MediaPlayer>(arena, *from._impl_.entity_.media_player_); + break; + case kCover: + _impl_.entity_.cover_ = ::google::protobuf::Message::CopyConstruct<::NSPanelEntityState_Cover>(arena, *from._impl_.entity_.cover_); + break; + } + + // @@protoc_insertion_point(copy_constructor:NSPanelEntityState) +} +inline PROTOBUF_NDEBUG_INLINE NSPanelEntityState::Impl_::Impl_( + ::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena) + : entity_{}, + _cached_size_{0}, + _oneof_case_{} {} + +inline void NSPanelEntityState::SharedCtor(::_pb::Arena* arena) { + new (&_impl_) Impl_(internal_visibility(), arena); +} +NSPanelEntityState::~NSPanelEntityState() { + // @@protoc_insertion_point(destructor:NSPanelEntityState) + _internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); + SharedDtor(); +} +inline void NSPanelEntityState::SharedDtor() { + ABSL_DCHECK(GetArena() == nullptr); + if (has_entity()) { + clear_entity(); + } + _impl_.~Impl_(); +} + +void NSPanelEntityState::clear_entity() { +// @@protoc_insertion_point(one_of_clear_start:NSPanelEntityState) + ::google::protobuf::internal::TSanWrite(&_impl_); + switch (entity_case()) { + case kLight: { + if (GetArena() == nullptr) { + delete _impl_.entity_.light_; + } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { + ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.entity_.light_); + } + break; + } + case kThermostat: { + if (GetArena() == nullptr) { + delete _impl_.entity_.thermostat_; + } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { + ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.entity_.thermostat_); + } + break; + } + case kMediaPlayer: { + if (GetArena() == nullptr) { + delete _impl_.entity_.media_player_; + } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { + ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.entity_.media_player_); + } + break; + } + case kCover: { + if (GetArena() == nullptr) { + delete _impl_.entity_.cover_; + } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { + ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.entity_.cover_); + } + break; + } + case ENTITY_NOT_SET: { + break; + } + } + _impl_._oneof_case_[0] = ENTITY_NOT_SET; +} + + +const ::google::protobuf::MessageLite::ClassData* +NSPanelEntityState::GetClassData() const { + PROTOBUF_CONSTINIT static const ::google::protobuf::MessageLite:: + ClassDataFull _data_ = { + { + &_table_.header, + nullptr, // OnDemandRegisterArenaDtor + nullptr, // IsInitialized + PROTOBUF_FIELD_OFFSET(NSPanelEntityState, _impl_._cached_size_), + false, + }, + &NSPanelEntityState::MergeImpl, + &NSPanelEntityState::kDescriptorMethods, + &descriptor_table_protobuf_5fnspanel_5fentity_2eproto, + nullptr, // tracker + }; + ::google::protobuf::internal::PrefetchToLocalCache(&_data_); + ::google::protobuf::internal::PrefetchToLocalCache(_data_.tc_table); + return _data_.base(); +} +PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 +const ::_pbi::TcParseTable<0, 4, 4, 0, 2> NSPanelEntityState::_table_ = { + { + 0, // no _has_bits_ + 0, // no _extensions_ + 4, 0, // max_field_number, fast_idx_mask + offsetof(decltype(_table_), field_lookup_table), + 4294967280, // skipmap + offsetof(decltype(_table_), field_entries), + 4, // num_field_entries + 4, // num_aux_entries + offsetof(decltype(_table_), aux_entries), + &_NSPanelEntityState_default_instance_._instance, + nullptr, // post_loop_handler + ::_pbi::TcParser::GenericFallback, // fallback + #ifdef PROTOBUF_PREFETCH_PARSE_TABLE + ::_pbi::TcParser::GetTable<::NSPanelEntityState>(), // to_prefetch + #endif // PROTOBUF_PREFETCH_PARSE_TABLE + }, {{ + {::_pbi::TcParser::MiniParse, {}}, + }}, {{ + 65535, 65535 + }}, {{ + // .NSPanelEntityState.Light light = 1; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState, _impl_.entity_.light_), _Internal::kOneofCaseOffset + 0, 0, + (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, + // .NSPanelEntityState.Thermostat thermostat = 2; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState, _impl_.entity_.thermostat_), _Internal::kOneofCaseOffset + 0, 1, + (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, + // .NSPanelEntityState.MediaPlayer media_player = 3; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState, _impl_.entity_.media_player_), _Internal::kOneofCaseOffset + 0, 2, + (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, + // .NSPanelEntityState.Cover cover = 4; + {PROTOBUF_FIELD_OFFSET(NSPanelEntityState, _impl_.entity_.cover_), _Internal::kOneofCaseOffset + 0, 3, + (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, + }}, {{ + {::_pbi::TcParser::GetTable<::NSPanelEntityState_Light>()}, + {::_pbi::TcParser::GetTable<::NSPanelEntityState_Thermostat>()}, + {::_pbi::TcParser::GetTable<::NSPanelEntityState_MediaPlayer>()}, + {::_pbi::TcParser::GetTable<::NSPanelEntityState_Cover>()}, + }}, {{ + }}, +}; + +PROTOBUF_NOINLINE void NSPanelEntityState::Clear() { +// @@protoc_insertion_point(message_clear_start:NSPanelEntityState) + ::google::protobuf::internal::TSanWrite(&_impl_); + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + clear_entity(); + _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); +} + +::uint8_t* NSPanelEntityState::_InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:NSPanelEntityState) + ::uint32_t cached_has_bits = 0; + (void)cached_has_bits; + + switch (entity_case()) { + case kLight: { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 1, *_impl_.entity_.light_, _impl_.entity_.light_->GetCachedSize(), target, stream); + break; + } + case kThermostat: { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 2, *_impl_.entity_.thermostat_, _impl_.entity_.thermostat_->GetCachedSize(), target, stream); + break; + } + case kMediaPlayer: { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 3, *_impl_.entity_.media_player_, _impl_.entity_.media_player_->GetCachedSize(), target, stream); + break; + } + case kCover: { + target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( + 4, *_impl_.entity_.cover_, _impl_.entity_.cover_->GetCachedSize(), target, stream); + break; + } + default: + break; + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = + ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:NSPanelEntityState) + return target; +} + +::size_t NSPanelEntityState::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:NSPanelEntityState) + ::size_t total_size = 0; + + ::uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + switch (entity_case()) { + // .NSPanelEntityState.Light light = 1; + case kLight: { + total_size += + 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.entity_.light_); + break; + } + // .NSPanelEntityState.Thermostat thermostat = 2; + case kThermostat: { + total_size += + 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.entity_.thermostat_); + break; + } + // .NSPanelEntityState.MediaPlayer media_player = 3; + case kMediaPlayer: { + total_size += + 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.entity_.media_player_); + break; + } + // .NSPanelEntityState.Cover cover = 4; + case kCover: { + total_size += + 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.entity_.cover_); + break; + } + case ENTITY_NOT_SET: { + break; + } } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } @@ -1899,6 +3980,24 @@ void NSPanelEntityState::MergeImpl(::google::protobuf::MessageLite& to_msg, cons } break; } + case kMediaPlayer: { + if (oneof_needs_init) { + _this->_impl_.entity_.media_player_ = + ::google::protobuf::Message::CopyConstruct<::NSPanelEntityState_MediaPlayer>(arena, *from._impl_.entity_.media_player_); + } else { + _this->_impl_.entity_.media_player_->MergeFrom(from._internal_media_player()); + } + break; + } + case kCover: { + if (oneof_needs_init) { + _this->_impl_.entity_.cover_ = + ::google::protobuf::Message::CopyConstruct<::NSPanelEntityState_Cover>(arena, *from._impl_.entity_.cover_); + } else { + _this->_impl_.entity_.cover_->MergeFrom(from._internal_cover()); + } + break; + } case ENTITY_NOT_SET: break; } diff --git a/docker/MQTTManager/include/protobuf/protobuf_nspanel_entity.pb.h b/docker/MQTTManager/include/protobuf/protobuf_nspanel_entity.pb.h index a4eecf543..2978062c8 100644 --- a/docker/MQTTManager/include/protobuf/protobuf_nspanel_entity.pb.h +++ b/docker/MQTTManager/include/protobuf/protobuf_nspanel_entity.pb.h @@ -53,9 +53,18 @@ extern const ::google::protobuf::internal::DescriptorTable class NSPanelEntityState; struct NSPanelEntityStateDefaultTypeInternal; extern NSPanelEntityStateDefaultTypeInternal _NSPanelEntityState_default_instance_; +class NSPanelEntityState_Cover; +struct NSPanelEntityState_CoverDefaultTypeInternal; +extern NSPanelEntityState_CoverDefaultTypeInternal _NSPanelEntityState_Cover_default_instance_; class NSPanelEntityState_Light; struct NSPanelEntityState_LightDefaultTypeInternal; extern NSPanelEntityState_LightDefaultTypeInternal _NSPanelEntityState_Light_default_instance_; +class NSPanelEntityState_MediaPlayer; +struct NSPanelEntityState_MediaPlayerDefaultTypeInternal; +extern NSPanelEntityState_MediaPlayerDefaultTypeInternal _NSPanelEntityState_MediaPlayer_default_instance_; +class NSPanelEntityState_MediaPlayer_SourceSelection; +struct NSPanelEntityState_MediaPlayer_SourceSelectionDefaultTypeInternal; +extern NSPanelEntityState_MediaPlayer_SourceSelectionDefaultTypeInternal _NSPanelEntityState_MediaPlayer_SourceSelection_default_instance_; class NSPanelEntityState_Thermostat; struct NSPanelEntityState_ThermostatDefaultTypeInternal; extern NSPanelEntityState_ThermostatDefaultTypeInternal _NSPanelEntityState_Thermostat_default_instance_; @@ -103,6 +112,81 @@ inline bool NSPanelEntityState_Light_LightMode_Parse(absl::string_view name, NSP return ::google::protobuf::internal::ParseNamedEnum( NSPanelEntityState_Light_LightMode_descriptor(), name, value); } +enum NSPanelEntityState_MediaPlayer_PlaybackState : int { + NSPanelEntityState_MediaPlayer_PlaybackState_UNKNOWN = 0, + NSPanelEntityState_MediaPlayer_PlaybackState_OFF = 1, + NSPanelEntityState_MediaPlayer_PlaybackState_ON = 2, + NSPanelEntityState_MediaPlayer_PlaybackState_IDLE = 3, + NSPanelEntityState_MediaPlayer_PlaybackState_PLAYING = 4, + NSPanelEntityState_MediaPlayer_PlaybackState_PAUSED = 5, + NSPanelEntityState_MediaPlayer_PlaybackState_BUFFERING = 6, + NSPanelEntityState_MediaPlayer_PlaybackState_NSPanelEntityState_MediaPlayer_PlaybackState_INT_MIN_SENTINEL_DO_NOT_USE_ = + std::numeric_limits<::int32_t>::min(), + NSPanelEntityState_MediaPlayer_PlaybackState_NSPanelEntityState_MediaPlayer_PlaybackState_INT_MAX_SENTINEL_DO_NOT_USE_ = + std::numeric_limits<::int32_t>::max(), +}; + +bool NSPanelEntityState_MediaPlayer_PlaybackState_IsValid(int value); +extern const uint32_t NSPanelEntityState_MediaPlayer_PlaybackState_internal_data_[]; +constexpr NSPanelEntityState_MediaPlayer_PlaybackState NSPanelEntityState_MediaPlayer_PlaybackState_PlaybackState_MIN = static_cast(0); +constexpr NSPanelEntityState_MediaPlayer_PlaybackState NSPanelEntityState_MediaPlayer_PlaybackState_PlaybackState_MAX = static_cast(6); +constexpr int NSPanelEntityState_MediaPlayer_PlaybackState_PlaybackState_ARRAYSIZE = 6 + 1; +const ::google::protobuf::EnumDescriptor* +NSPanelEntityState_MediaPlayer_PlaybackState_descriptor(); +template +const std::string& NSPanelEntityState_MediaPlayer_PlaybackState_Name(T value) { + static_assert(std::is_same::value || + std::is_integral::value, + "Incorrect type passed to PlaybackState_Name()."); + return NSPanelEntityState_MediaPlayer_PlaybackState_Name(static_cast(value)); +} +template <> +inline const std::string& NSPanelEntityState_MediaPlayer_PlaybackState_Name(NSPanelEntityState_MediaPlayer_PlaybackState value) { + return ::google::protobuf::internal::NameOfDenseEnum( + static_cast(value)); +} +inline bool NSPanelEntityState_MediaPlayer_PlaybackState_Parse(absl::string_view name, NSPanelEntityState_MediaPlayer_PlaybackState* value) { + return ::google::protobuf::internal::ParseNamedEnum( + NSPanelEntityState_MediaPlayer_PlaybackState_descriptor(), name, value); +} +enum NSPanelEntityState_Cover_CoverState : int { + NSPanelEntityState_Cover_CoverState_UNKNOWN = 0, + NSPanelEntityState_Cover_CoverState_OPEN = 1, + NSPanelEntityState_Cover_CoverState_CLOSED = 2, + NSPanelEntityState_Cover_CoverState_OPENING = 3, + NSPanelEntityState_Cover_CoverState_CLOSING = 4, + NSPanelEntityState_Cover_CoverState_UNAVAILABLE = 5, + NSPanelEntityState_Cover_CoverState_NSPanelEntityState_Cover_CoverState_INT_MIN_SENTINEL_DO_NOT_USE_ = + std::numeric_limits<::int32_t>::min(), + NSPanelEntityState_Cover_CoverState_NSPanelEntityState_Cover_CoverState_INT_MAX_SENTINEL_DO_NOT_USE_ = + std::numeric_limits<::int32_t>::max(), +}; + +bool NSPanelEntityState_Cover_CoverState_IsValid(int value); +extern const uint32_t NSPanelEntityState_Cover_CoverState_internal_data_[]; +constexpr NSPanelEntityState_Cover_CoverState NSPanelEntityState_Cover_CoverState_CoverState_MIN = static_cast(0); +constexpr NSPanelEntityState_Cover_CoverState NSPanelEntityState_Cover_CoverState_CoverState_MAX = static_cast(5); +constexpr int NSPanelEntityState_Cover_CoverState_CoverState_ARRAYSIZE = 5 + 1; +const ::google::protobuf::EnumDescriptor* +NSPanelEntityState_Cover_CoverState_descriptor(); +template +const std::string& NSPanelEntityState_Cover_CoverState_Name(T value) { + static_assert(std::is_same::value || + std::is_integral::value, + "Incorrect type passed to CoverState_Name()."); + return NSPanelEntityState_Cover_CoverState_Name(static_cast(value)); +} +template <> +inline const std::string& NSPanelEntityState_Cover_CoverState_Name(NSPanelEntityState_Cover_CoverState value) { + return ::google::protobuf::internal::NameOfDenseEnum( + static_cast(value)); +} +inline bool NSPanelEntityState_Cover_CoverState_Parse(absl::string_view name, NSPanelEntityState_Cover_CoverState* value) { + return ::google::protobuf::internal::ParseNamedEnum( + NSPanelEntityState_Cover_CoverState_descriptor(), name, value); +} // =================================================================== @@ -304,6 +388,225 @@ class NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue final }; // ------------------------------------------------------------------- +class NSPanelEntityState_MediaPlayer_SourceSelection final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:NSPanelEntityState.MediaPlayer.SourceSelection) */ { + public: + inline NSPanelEntityState_MediaPlayer_SourceSelection() : NSPanelEntityState_MediaPlayer_SourceSelection(nullptr) {} + ~NSPanelEntityState_MediaPlayer_SourceSelection() override; + template + explicit PROTOBUF_CONSTEXPR NSPanelEntityState_MediaPlayer_SourceSelection( + ::google::protobuf::internal::ConstantInitialized); + + inline NSPanelEntityState_MediaPlayer_SourceSelection(const NSPanelEntityState_MediaPlayer_SourceSelection& from) : NSPanelEntityState_MediaPlayer_SourceSelection(nullptr, from) {} + inline NSPanelEntityState_MediaPlayer_SourceSelection(NSPanelEntityState_MediaPlayer_SourceSelection&& from) noexcept + : NSPanelEntityState_MediaPlayer_SourceSelection(nullptr, std::move(from)) {} + inline NSPanelEntityState_MediaPlayer_SourceSelection& operator=(const NSPanelEntityState_MediaPlayer_SourceSelection& from) { + CopyFrom(from); + return *this; + } + inline NSPanelEntityState_MediaPlayer_SourceSelection& operator=(NSPanelEntityState_MediaPlayer_SourceSelection&& from) noexcept { + if (this == &from) return *this; + if (GetArena() == from.GetArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetArena() != nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::google::protobuf::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::google::protobuf::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const NSPanelEntityState_MediaPlayer_SourceSelection& default_instance() { + return *internal_default_instance(); + } + static inline const NSPanelEntityState_MediaPlayer_SourceSelection* internal_default_instance() { + return reinterpret_cast( + &_NSPanelEntityState_MediaPlayer_SourceSelection_default_instance_); + } + static constexpr int kIndexInFileMessages = 4; + friend void swap(NSPanelEntityState_MediaPlayer_SourceSelection& a, NSPanelEntityState_MediaPlayer_SourceSelection& b) { a.Swap(&b); } + inline void Swap(NSPanelEntityState_MediaPlayer_SourceSelection* other) { + if (other == this) return; +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() != nullptr && GetArena() == other->GetArena()) { +#else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() == other->GetArena()) { +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::google::protobuf::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(NSPanelEntityState_MediaPlayer_SourceSelection* other) { + if (other == this) return; + ABSL_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + NSPanelEntityState_MediaPlayer_SourceSelection* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); + } + using ::google::protobuf::Message::CopyFrom; + void CopyFrom(const NSPanelEntityState_MediaPlayer_SourceSelection& from); + using ::google::protobuf::Message::MergeFrom; + void MergeFrom(const NSPanelEntityState_MediaPlayer_SourceSelection& from) { NSPanelEntityState_MediaPlayer_SourceSelection::MergeImpl(*this, from); } + + private: + static void MergeImpl( + ::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); + + public: + bool IsInitialized() const { + return true; + } + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; + ::size_t ByteSizeLong() const final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::google::protobuf::Arena* arena); + void SharedDtor(); + void InternalSwap(NSPanelEntityState_MediaPlayer_SourceSelection* other); + private: + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "NSPanelEntityState.MediaPlayer.SourceSelection"; } + + protected: + explicit NSPanelEntityState_MediaPlayer_SourceSelection(::google::protobuf::Arena* arena); + NSPanelEntityState_MediaPlayer_SourceSelection(::google::protobuf::Arena* arena, const NSPanelEntityState_MediaPlayer_SourceSelection& from); + NSPanelEntityState_MediaPlayer_SourceSelection(::google::protobuf::Arena* arena, NSPanelEntityState_MediaPlayer_SourceSelection&& from) noexcept + : NSPanelEntityState_MediaPlayer_SourceSelection(arena) { + *this = ::std::move(from); + } + const ::google::protobuf::Message::ClassData* GetClassData() const final; + + public: + ::google::protobuf::Metadata GetMetadata() const; + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + enum : int { + kSourcesFieldNumber = 1, + kCurrentSourceFieldNumber = 2, + kCanSelectFieldNumber = 3, + }; + // repeated string sources = 1; + int sources_size() const; + private: + int _internal_sources_size() const; + + public: + void clear_sources() ; + const std::string& sources(int index) const; + std::string* mutable_sources(int index); + void set_sources(int index, const std::string& value); + void set_sources(int index, std::string&& value); + void set_sources(int index, const char* value); + void set_sources(int index, const char* value, std::size_t size); + void set_sources(int index, absl::string_view value); + std::string* add_sources(); + void add_sources(const std::string& value); + void add_sources(std::string&& value); + void add_sources(const char* value); + void add_sources(const char* value, std::size_t size); + void add_sources(absl::string_view value); + const ::google::protobuf::RepeatedPtrField& sources() const; + ::google::protobuf::RepeatedPtrField* mutable_sources(); + + private: + const ::google::protobuf::RepeatedPtrField& _internal_sources() const; + ::google::protobuf::RepeatedPtrField* _internal_mutable_sources(); + + public: + // string current_source = 2; + void clear_current_source() ; + const std::string& current_source() const; + template + void set_current_source(Arg_&& arg, Args_... args); + std::string* mutable_current_source(); + PROTOBUF_NODISCARD std::string* release_current_source(); + void set_allocated_current_source(std::string* value); + + private: + const std::string& _internal_current_source() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_current_source( + const std::string& value); + std::string* _internal_mutable_current_source(); + + public: + // bool can_select = 3; + void clear_can_select() ; + bool can_select() const; + void set_can_select(bool value); + + private: + bool _internal_can_select() const; + void _internal_set_can_select(bool value); + + public: + // @@protoc_insertion_point(class_scope:NSPanelEntityState.MediaPlayer.SourceSelection) + private: + class _Internal; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 2, 3, 0, + 76, 2> + _table_; + + static constexpr const void* _raw_default_instance_ = + &_NSPanelEntityState_MediaPlayer_SourceSelection_default_instance_; + + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; + struct Impl_ { + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from, + const NSPanelEntityState_MediaPlayer_SourceSelection& from_msg); + ::google::protobuf::RepeatedPtrField sources_; + ::google::protobuf::internal::ArenaStringPtr current_source_; + bool can_select_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + PROTOBUF_TSAN_DECLARE_MEMBER + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_protobuf_5fnspanel_5fentity_2eproto; +}; +// ------------------------------------------------------------------- + class NSPanelEntityState_Light final : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:NSPanelEntityState.Light) */ { public: @@ -608,23 +911,23 @@ class NSPanelEntityState_Light final : public ::google::protobuf::Message }; // ------------------------------------------------------------------- -class NSPanelEntityState_Thermostat_ThermostatOption final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:NSPanelEntityState.Thermostat.ThermostatOption) */ { +class NSPanelEntityState_Cover final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:NSPanelEntityState.Cover) */ { public: - inline NSPanelEntityState_Thermostat_ThermostatOption() : NSPanelEntityState_Thermostat_ThermostatOption(nullptr) {} - ~NSPanelEntityState_Thermostat_ThermostatOption() override; + inline NSPanelEntityState_Cover() : NSPanelEntityState_Cover(nullptr) {} + ~NSPanelEntityState_Cover() override; template - explicit PROTOBUF_CONSTEXPR NSPanelEntityState_Thermostat_ThermostatOption( + explicit PROTOBUF_CONSTEXPR NSPanelEntityState_Cover( ::google::protobuf::internal::ConstantInitialized); - inline NSPanelEntityState_Thermostat_ThermostatOption(const NSPanelEntityState_Thermostat_ThermostatOption& from) : NSPanelEntityState_Thermostat_ThermostatOption(nullptr, from) {} - inline NSPanelEntityState_Thermostat_ThermostatOption(NSPanelEntityState_Thermostat_ThermostatOption&& from) noexcept - : NSPanelEntityState_Thermostat_ThermostatOption(nullptr, std::move(from)) {} - inline NSPanelEntityState_Thermostat_ThermostatOption& operator=(const NSPanelEntityState_Thermostat_ThermostatOption& from) { + inline NSPanelEntityState_Cover(const NSPanelEntityState_Cover& from) : NSPanelEntityState_Cover(nullptr, from) {} + inline NSPanelEntityState_Cover(NSPanelEntityState_Cover&& from) noexcept + : NSPanelEntityState_Cover(nullptr, std::move(from)) {} + inline NSPanelEntityState_Cover& operator=(const NSPanelEntityState_Cover& from) { CopyFrom(from); return *this; } - inline NSPanelEntityState_Thermostat_ThermostatOption& operator=(NSPanelEntityState_Thermostat_ThermostatOption&& from) noexcept { + inline NSPanelEntityState_Cover& operator=(NSPanelEntityState_Cover&& from) noexcept { if (this == &from) return *this; if (GetArena() == from.GetArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE @@ -656,16 +959,16 @@ class NSPanelEntityState_Thermostat_ThermostatOption final : public ::google::pr static const ::google::protobuf::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } - static const NSPanelEntityState_Thermostat_ThermostatOption& default_instance() { + static const NSPanelEntityState_Cover& default_instance() { return *internal_default_instance(); } - static inline const NSPanelEntityState_Thermostat_ThermostatOption* internal_default_instance() { - return reinterpret_cast( - &_NSPanelEntityState_Thermostat_ThermostatOption_default_instance_); + static inline const NSPanelEntityState_Cover* internal_default_instance() { + return reinterpret_cast( + &_NSPanelEntityState_Cover_default_instance_); } - static constexpr int kIndexInFileMessages = 2; - friend void swap(NSPanelEntityState_Thermostat_ThermostatOption& a, NSPanelEntityState_Thermostat_ThermostatOption& b) { a.Swap(&b); } - inline void Swap(NSPanelEntityState_Thermostat_ThermostatOption* other) { + static constexpr int kIndexInFileMessages = 6; + friend void swap(NSPanelEntityState_Cover& a, NSPanelEntityState_Cover& b) { a.Swap(&b); } + inline void Swap(NSPanelEntityState_Cover* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetArena() != nullptr && GetArena() == other->GetArena()) { @@ -677,7 +980,7 @@ class NSPanelEntityState_Thermostat_ThermostatOption final : public ::google::pr ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(NSPanelEntityState_Thermostat_ThermostatOption* other) { + void UnsafeArenaSwap(NSPanelEntityState_Cover* other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -685,13 +988,13 @@ class NSPanelEntityState_Thermostat_ThermostatOption final : public ::google::pr // implements Message ---------------------------------------------- - NSPanelEntityState_Thermostat_ThermostatOption* New(::google::protobuf::Arena* arena = nullptr) const final { - return ::google::protobuf::Message::DefaultConstruct(arena); + NSPanelEntityState_Cover* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const NSPanelEntityState_Thermostat_ThermostatOption& from); + void CopyFrom(const NSPanelEntityState_Cover& from); using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const NSPanelEntityState_Thermostat_ThermostatOption& from) { NSPanelEntityState_Thermostat_ThermostatOption::MergeImpl(*this, from); } + void MergeFrom(const NSPanelEntityState_Cover& from) { NSPanelEntityState_Cover::MergeImpl(*this, from); } private: static void MergeImpl( @@ -712,16 +1015,16 @@ class NSPanelEntityState_Thermostat_ThermostatOption final : public ::google::pr private: void SharedCtor(::google::protobuf::Arena* arena); void SharedDtor(); - void InternalSwap(NSPanelEntityState_Thermostat_ThermostatOption* other); + void InternalSwap(NSPanelEntityState_Cover* other); private: friend class ::google::protobuf::internal::AnyMetadata; - static ::absl::string_view FullMessageName() { return "NSPanelEntityState.Thermostat.ThermostatOption"; } + static ::absl::string_view FullMessageName() { return "NSPanelEntityState.Cover"; } protected: - explicit NSPanelEntityState_Thermostat_ThermostatOption(::google::protobuf::Arena* arena); - NSPanelEntityState_Thermostat_ThermostatOption(::google::protobuf::Arena* arena, const NSPanelEntityState_Thermostat_ThermostatOption& from); - NSPanelEntityState_Thermostat_ThermostatOption(::google::protobuf::Arena* arena, NSPanelEntityState_Thermostat_ThermostatOption&& from) noexcept - : NSPanelEntityState_Thermostat_ThermostatOption(arena) { + explicit NSPanelEntityState_Cover(::google::protobuf::Arena* arena); + NSPanelEntityState_Cover(::google::protobuf::Arena* arena, const NSPanelEntityState_Cover& from); + NSPanelEntityState_Cover(::google::protobuf::Arena* arena, NSPanelEntityState_Cover&& from) noexcept + : NSPanelEntityState_Cover(arena) { *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const final; @@ -729,33 +1032,56 @@ class NSPanelEntityState_Thermostat_ThermostatOption final : public ::google::pr public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- - using ThermostatOptionValue = NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue; + using CoverState = NSPanelEntityState_Cover_CoverState; + static constexpr CoverState UNKNOWN = NSPanelEntityState_Cover_CoverState_UNKNOWN; + static constexpr CoverState OPEN = NSPanelEntityState_Cover_CoverState_OPEN; + static constexpr CoverState CLOSED = NSPanelEntityState_Cover_CoverState_CLOSED; + static constexpr CoverState OPENING = NSPanelEntityState_Cover_CoverState_OPENING; + static constexpr CoverState CLOSING = NSPanelEntityState_Cover_CoverState_CLOSING; + static constexpr CoverState UNAVAILABLE = NSPanelEntityState_Cover_CoverState_UNAVAILABLE; + static inline bool CoverState_IsValid(int value) { + return NSPanelEntityState_Cover_CoverState_IsValid(value); + } + static constexpr CoverState CoverState_MIN = NSPanelEntityState_Cover_CoverState_CoverState_MIN; + static constexpr CoverState CoverState_MAX = NSPanelEntityState_Cover_CoverState_CoverState_MAX; + static constexpr int CoverState_ARRAYSIZE = NSPanelEntityState_Cover_CoverState_CoverState_ARRAYSIZE; + static inline const ::google::protobuf::EnumDescriptor* CoverState_descriptor() { + return NSPanelEntityState_Cover_CoverState_descriptor(); + } + template + static inline const std::string& CoverState_Name(T value) { + return NSPanelEntityState_Cover_CoverState_Name(value); + } + static inline bool CoverState_Parse(absl::string_view name, CoverState* value) { + return NSPanelEntityState_Cover_CoverState_Parse(name, value); + } // accessors ------------------------------------------------------- enum : int { - kOptionsFieldNumber = 4, - kNameFieldNumber = 1, - kCurrentValueFieldNumber = 2, - kCurrentIconFieldNumber = 3, + kNameFieldNumber = 2, + kDeviceClassFieldNumber = 16, + kCoverIdFieldNumber = 1, + kStateFieldNumber = 3, + kPositionFieldNumber = 5, + kHasPositionFieldNumber = 4, + kHasTiltPositionFieldNumber = 6, + kCanOpenFieldNumber = 8, + kCanCloseFieldNumber = 9, + kTiltPositionFieldNumber = 7, + kCanStopFieldNumber = 10, + kCanSetPositionFieldNumber = 11, + kCanOpenTiltFieldNumber = 12, + kCanCloseTiltFieldNumber = 13, + kCanStopTiltFieldNumber = 14, + kCanSetTiltPositionFieldNumber = 15, + kPositionPreset1FieldNumber = 17, + kPositionPreset2FieldNumber = 18, + kPositionPreset3FieldNumber = 19, + kTiltPreset1FieldNumber = 20, + kTiltPreset2FieldNumber = 21, + kTiltPreset3FieldNumber = 22, }; - // repeated .NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue options = 4; - int options_size() const; - private: - int _internal_options_size() const; - - public: - void clear_options() ; - ::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue* mutable_options(int index); - ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue>* mutable_options(); - - private: - const ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue>& _internal_options() const; - ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue>* _internal_mutable_options(); - public: - const ::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue& options(int index) const; - ::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue* add_options(); - const ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue>& options() const; - // string name = 1; + // string name = 2; void clear_name() ; const std::string& name() const; template @@ -771,49 +1097,233 @@ class NSPanelEntityState_Thermostat_ThermostatOption final : public ::google::pr std::string* _internal_mutable_name(); public: - // string current_value = 2; - void clear_current_value() ; - const std::string& current_value() const; + // string device_class = 16; + void clear_device_class() ; + const std::string& device_class() const; template - void set_current_value(Arg_&& arg, Args_... args); - std::string* mutable_current_value(); - PROTOBUF_NODISCARD std::string* release_current_value(); - void set_allocated_current_value(std::string* value); + void set_device_class(Arg_&& arg, Args_... args); + std::string* mutable_device_class(); + PROTOBUF_NODISCARD std::string* release_device_class(); + void set_allocated_device_class(std::string* value); private: - const std::string& _internal_current_value() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_current_value( + const std::string& _internal_device_class() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_device_class( const std::string& value); - std::string* _internal_mutable_current_value(); + std::string* _internal_mutable_device_class(); public: - // string current_icon = 3; - void clear_current_icon() ; - const std::string& current_icon() const; - template - void set_current_icon(Arg_&& arg, Args_... args); - std::string* mutable_current_icon(); - PROTOBUF_NODISCARD std::string* release_current_icon(); - void set_allocated_current_icon(std::string* value); + // int32 cover_id = 1; + void clear_cover_id() ; + ::int32_t cover_id() const; + void set_cover_id(::int32_t value); private: - const std::string& _internal_current_icon() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_current_icon( - const std::string& value); - std::string* _internal_mutable_current_icon(); + ::int32_t _internal_cover_id() const; + void _internal_set_cover_id(::int32_t value); public: - // @@protoc_insertion_point(class_scope:NSPanelEntityState.Thermostat.ThermostatOption) - private: - class _Internal; - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable< - 2, 4, 1, - 84, 2> - _table_; + // .NSPanelEntityState.Cover.CoverState state = 3; + void clear_state() ; + ::NSPanelEntityState_Cover_CoverState state() const; + void set_state(::NSPanelEntityState_Cover_CoverState value); + + private: + ::NSPanelEntityState_Cover_CoverState _internal_state() const; + void _internal_set_state(::NSPanelEntityState_Cover_CoverState value); + + public: + // int32 position = 5; + void clear_position() ; + ::int32_t position() const; + void set_position(::int32_t value); + + private: + ::int32_t _internal_position() const; + void _internal_set_position(::int32_t value); + + public: + // bool has_position = 4; + void clear_has_position() ; + bool has_position() const; + void set_has_position(bool value); + + private: + bool _internal_has_position() const; + void _internal_set_has_position(bool value); + + public: + // bool has_tilt_position = 6; + void clear_has_tilt_position() ; + bool has_tilt_position() const; + void set_has_tilt_position(bool value); + + private: + bool _internal_has_tilt_position() const; + void _internal_set_has_tilt_position(bool value); + + public: + // bool can_open = 8; + void clear_can_open() ; + bool can_open() const; + void set_can_open(bool value); + + private: + bool _internal_can_open() const; + void _internal_set_can_open(bool value); + + public: + // bool can_close = 9; + void clear_can_close() ; + bool can_close() const; + void set_can_close(bool value); + + private: + bool _internal_can_close() const; + void _internal_set_can_close(bool value); + + public: + // int32 tilt_position = 7; + void clear_tilt_position() ; + ::int32_t tilt_position() const; + void set_tilt_position(::int32_t value); + + private: + ::int32_t _internal_tilt_position() const; + void _internal_set_tilt_position(::int32_t value); + + public: + // bool can_stop = 10; + void clear_can_stop() ; + bool can_stop() const; + void set_can_stop(bool value); + + private: + bool _internal_can_stop() const; + void _internal_set_can_stop(bool value); + + public: + // bool can_set_position = 11; + void clear_can_set_position() ; + bool can_set_position() const; + void set_can_set_position(bool value); + + private: + bool _internal_can_set_position() const; + void _internal_set_can_set_position(bool value); + + public: + // bool can_open_tilt = 12; + void clear_can_open_tilt() ; + bool can_open_tilt() const; + void set_can_open_tilt(bool value); + + private: + bool _internal_can_open_tilt() const; + void _internal_set_can_open_tilt(bool value); + + public: + // bool can_close_tilt = 13; + void clear_can_close_tilt() ; + bool can_close_tilt() const; + void set_can_close_tilt(bool value); + + private: + bool _internal_can_close_tilt() const; + void _internal_set_can_close_tilt(bool value); + + public: + // bool can_stop_tilt = 14; + void clear_can_stop_tilt() ; + bool can_stop_tilt() const; + void set_can_stop_tilt(bool value); + + private: + bool _internal_can_stop_tilt() const; + void _internal_set_can_stop_tilt(bool value); + + public: + // bool can_set_tilt_position = 15; + void clear_can_set_tilt_position() ; + bool can_set_tilt_position() const; + void set_can_set_tilt_position(bool value); + + private: + bool _internal_can_set_tilt_position() const; + void _internal_set_can_set_tilt_position(bool value); + + public: + // int32 position_preset1 = 17; + void clear_position_preset1() ; + ::int32_t position_preset1() const; + void set_position_preset1(::int32_t value); + + private: + ::int32_t _internal_position_preset1() const; + void _internal_set_position_preset1(::int32_t value); + + public: + // int32 position_preset2 = 18; + void clear_position_preset2() ; + ::int32_t position_preset2() const; + void set_position_preset2(::int32_t value); + + private: + ::int32_t _internal_position_preset2() const; + void _internal_set_position_preset2(::int32_t value); + + public: + // int32 position_preset3 = 19; + void clear_position_preset3() ; + ::int32_t position_preset3() const; + void set_position_preset3(::int32_t value); + + private: + ::int32_t _internal_position_preset3() const; + void _internal_set_position_preset3(::int32_t value); + + public: + // int32 tilt_preset1 = 20; + void clear_tilt_preset1() ; + ::int32_t tilt_preset1() const; + void set_tilt_preset1(::int32_t value); + + private: + ::int32_t _internal_tilt_preset1() const; + void _internal_set_tilt_preset1(::int32_t value); + + public: + // int32 tilt_preset2 = 21; + void clear_tilt_preset2() ; + ::int32_t tilt_preset2() const; + void set_tilt_preset2(::int32_t value); + + private: + ::int32_t _internal_tilt_preset2() const; + void _internal_set_tilt_preset2(::int32_t value); + + public: + // int32 tilt_preset3 = 22; + void clear_tilt_preset3() ; + ::int32_t tilt_preset3() const; + void set_tilt_preset3(::int32_t value); + + private: + ::int32_t _internal_tilt_preset3() const; + void _internal_set_tilt_preset3(::int32_t value); + + public: + // @@protoc_insertion_point(class_scope:NSPanelEntityState.Cover) + private: + class _Internal; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 5, 22, 0, + 65, 2> + _table_; static constexpr const void* _raw_default_instance_ = - &_NSPanelEntityState_Thermostat_ThermostatOption_default_instance_; + &_NSPanelEntityState_Cover_default_instance_; friend class ::google::protobuf::MessageLite; friend class ::google::protobuf::Arena; @@ -828,11 +1338,29 @@ class NSPanelEntityState_Thermostat_ThermostatOption final : public ::google::pr ::google::protobuf::Arena* arena); inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, - const NSPanelEntityState_Thermostat_ThermostatOption& from_msg); - ::google::protobuf::RepeatedPtrField< ::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue > options_; + const NSPanelEntityState_Cover& from_msg); ::google::protobuf::internal::ArenaStringPtr name_; - ::google::protobuf::internal::ArenaStringPtr current_value_; - ::google::protobuf::internal::ArenaStringPtr current_icon_; + ::google::protobuf::internal::ArenaStringPtr device_class_; + ::int32_t cover_id_; + int state_; + ::int32_t position_; + bool has_position_; + bool has_tilt_position_; + bool can_open_; + bool can_close_; + ::int32_t tilt_position_; + bool can_stop_; + bool can_set_position_; + bool can_open_tilt_; + bool can_close_tilt_; + bool can_stop_tilt_; + bool can_set_tilt_position_; + ::int32_t position_preset1_; + ::int32_t position_preset2_; + ::int32_t position_preset3_; + ::int32_t tilt_preset1_; + ::int32_t tilt_preset2_; + ::int32_t tilt_preset3_; mutable ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; @@ -841,23 +1369,23 @@ class NSPanelEntityState_Thermostat_ThermostatOption final : public ::google::pr }; // ------------------------------------------------------------------- -class NSPanelEntityState_Thermostat final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:NSPanelEntityState.Thermostat) */ { +class NSPanelEntityState_Thermostat_ThermostatOption final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:NSPanelEntityState.Thermostat.ThermostatOption) */ { public: - inline NSPanelEntityState_Thermostat() : NSPanelEntityState_Thermostat(nullptr) {} - ~NSPanelEntityState_Thermostat() override; + inline NSPanelEntityState_Thermostat_ThermostatOption() : NSPanelEntityState_Thermostat_ThermostatOption(nullptr) {} + ~NSPanelEntityState_Thermostat_ThermostatOption() override; template - explicit PROTOBUF_CONSTEXPR NSPanelEntityState_Thermostat( + explicit PROTOBUF_CONSTEXPR NSPanelEntityState_Thermostat_ThermostatOption( ::google::protobuf::internal::ConstantInitialized); - inline NSPanelEntityState_Thermostat(const NSPanelEntityState_Thermostat& from) : NSPanelEntityState_Thermostat(nullptr, from) {} - inline NSPanelEntityState_Thermostat(NSPanelEntityState_Thermostat&& from) noexcept - : NSPanelEntityState_Thermostat(nullptr, std::move(from)) {} - inline NSPanelEntityState_Thermostat& operator=(const NSPanelEntityState_Thermostat& from) { + inline NSPanelEntityState_Thermostat_ThermostatOption(const NSPanelEntityState_Thermostat_ThermostatOption& from) : NSPanelEntityState_Thermostat_ThermostatOption(nullptr, from) {} + inline NSPanelEntityState_Thermostat_ThermostatOption(NSPanelEntityState_Thermostat_ThermostatOption&& from) noexcept + : NSPanelEntityState_Thermostat_ThermostatOption(nullptr, std::move(from)) {} + inline NSPanelEntityState_Thermostat_ThermostatOption& operator=(const NSPanelEntityState_Thermostat_ThermostatOption& from) { CopyFrom(from); return *this; } - inline NSPanelEntityState_Thermostat& operator=(NSPanelEntityState_Thermostat&& from) noexcept { + inline NSPanelEntityState_Thermostat_ThermostatOption& operator=(NSPanelEntityState_Thermostat_ThermostatOption&& from) noexcept { if (this == &from) return *this; if (GetArena() == from.GetArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE @@ -889,16 +1417,16 @@ class NSPanelEntityState_Thermostat final : public ::google::protobuf::Message static const ::google::protobuf::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } - static const NSPanelEntityState_Thermostat& default_instance() { + static const NSPanelEntityState_Thermostat_ThermostatOption& default_instance() { return *internal_default_instance(); } - static inline const NSPanelEntityState_Thermostat* internal_default_instance() { - return reinterpret_cast( - &_NSPanelEntityState_Thermostat_default_instance_); + static inline const NSPanelEntityState_Thermostat_ThermostatOption* internal_default_instance() { + return reinterpret_cast( + &_NSPanelEntityState_Thermostat_ThermostatOption_default_instance_); } - static constexpr int kIndexInFileMessages = 3; - friend void swap(NSPanelEntityState_Thermostat& a, NSPanelEntityState_Thermostat& b) { a.Swap(&b); } - inline void Swap(NSPanelEntityState_Thermostat* other) { + static constexpr int kIndexInFileMessages = 2; + friend void swap(NSPanelEntityState_Thermostat_ThermostatOption& a, NSPanelEntityState_Thermostat_ThermostatOption& b) { a.Swap(&b); } + inline void Swap(NSPanelEntityState_Thermostat_ThermostatOption* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetArena() != nullptr && GetArena() == other->GetArena()) { @@ -910,7 +1438,7 @@ class NSPanelEntityState_Thermostat final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(NSPanelEntityState_Thermostat* other) { + void UnsafeArenaSwap(NSPanelEntityState_Thermostat_ThermostatOption* other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -918,13 +1446,13 @@ class NSPanelEntityState_Thermostat final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - NSPanelEntityState_Thermostat* New(::google::protobuf::Arena* arena = nullptr) const final { - return ::google::protobuf::Message::DefaultConstruct(arena); + NSPanelEntityState_Thermostat_ThermostatOption* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const NSPanelEntityState_Thermostat& from); + void CopyFrom(const NSPanelEntityState_Thermostat_ThermostatOption& from); using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const NSPanelEntityState_Thermostat& from) { NSPanelEntityState_Thermostat::MergeImpl(*this, from); } + void MergeFrom(const NSPanelEntityState_Thermostat_ThermostatOption& from) { NSPanelEntityState_Thermostat_ThermostatOption::MergeImpl(*this, from); } private: static void MergeImpl( @@ -945,16 +1473,16 @@ class NSPanelEntityState_Thermostat final : public ::google::protobuf::Message private: void SharedCtor(::google::protobuf::Arena* arena); void SharedDtor(); - void InternalSwap(NSPanelEntityState_Thermostat* other); + void InternalSwap(NSPanelEntityState_Thermostat_ThermostatOption* other); private: friend class ::google::protobuf::internal::AnyMetadata; - static ::absl::string_view FullMessageName() { return "NSPanelEntityState.Thermostat"; } + static ::absl::string_view FullMessageName() { return "NSPanelEntityState.Thermostat.ThermostatOption"; } protected: - explicit NSPanelEntityState_Thermostat(::google::protobuf::Arena* arena); - NSPanelEntityState_Thermostat(::google::protobuf::Arena* arena, const NSPanelEntityState_Thermostat& from); - NSPanelEntityState_Thermostat(::google::protobuf::Arena* arena, NSPanelEntityState_Thermostat&& from) noexcept - : NSPanelEntityState_Thermostat(arena) { + explicit NSPanelEntityState_Thermostat_ThermostatOption(::google::protobuf::Arena* arena); + NSPanelEntityState_Thermostat_ThermostatOption(::google::protobuf::Arena* arena, const NSPanelEntityState_Thermostat_ThermostatOption& from); + NSPanelEntityState_Thermostat_ThermostatOption(::google::protobuf::Arena* arena, NSPanelEntityState_Thermostat_ThermostatOption&& from) noexcept + : NSPanelEntityState_Thermostat_ThermostatOption(arena) { *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const final; @@ -962,36 +1490,33 @@ class NSPanelEntityState_Thermostat final : public ::google::protobuf::Message public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- - using ThermostatOption = NSPanelEntityState_Thermostat_ThermostatOption; + using ThermostatOptionValue = NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue; // accessors ------------------------------------------------------- enum : int { - kOptionsFieldNumber = 7, - kNameFieldNumber = 2, - kThermostatIdFieldNumber = 1, - kCurrentTemperatureFieldNumber = 3, - kHasCurrentTemperatureFieldNumber = 4, - kSetTemperatureFieldNumber = 5, - kStepSizeFieldNumber = 6, + kOptionsFieldNumber = 4, + kNameFieldNumber = 1, + kCurrentValueFieldNumber = 2, + kCurrentIconFieldNumber = 3, }; - // repeated .NSPanelEntityState.Thermostat.ThermostatOption options = 7; + // repeated .NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue options = 4; int options_size() const; private: int _internal_options_size() const; public: void clear_options() ; - ::NSPanelEntityState_Thermostat_ThermostatOption* mutable_options(int index); - ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption>* mutable_options(); + ::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue* mutable_options(int index); + ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue>* mutable_options(); private: - const ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption>& _internal_options() const; - ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption>* _internal_mutable_options(); + const ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue>& _internal_options() const; + ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue>* _internal_mutable_options(); public: - const ::NSPanelEntityState_Thermostat_ThermostatOption& options(int index) const; - ::NSPanelEntityState_Thermostat_ThermostatOption* add_options(); - const ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption>& options() const; - // string name = 2; + const ::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue& options(int index) const; + ::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue* add_options(); + const ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue>& options() const; + // string name = 1; void clear_name() ; const std::string& name() const; template @@ -1007,67 +1532,49 @@ class NSPanelEntityState_Thermostat final : public ::google::protobuf::Message std::string* _internal_mutable_name(); public: - // int32 thermostat_id = 1; - void clear_thermostat_id() ; - ::int32_t thermostat_id() const; - void set_thermostat_id(::int32_t value); - - private: - ::int32_t _internal_thermostat_id() const; - void _internal_set_thermostat_id(::int32_t value); - - public: - // float current_temperature = 3; - void clear_current_temperature() ; - float current_temperature() const; - void set_current_temperature(float value); - - private: - float _internal_current_temperature() const; - void _internal_set_current_temperature(float value); - - public: - // bool has_current_temperature = 4; - void clear_has_current_temperature() ; - bool has_current_temperature() const; - void set_has_current_temperature(bool value); - - private: - bool _internal_has_current_temperature() const; - void _internal_set_has_current_temperature(bool value); - - public: - // float set_temperature = 5; - void clear_set_temperature() ; - float set_temperature() const; - void set_set_temperature(float value); + // string current_value = 2; + void clear_current_value() ; + const std::string& current_value() const; + template + void set_current_value(Arg_&& arg, Args_... args); + std::string* mutable_current_value(); + PROTOBUF_NODISCARD std::string* release_current_value(); + void set_allocated_current_value(std::string* value); private: - float _internal_set_temperature() const; - void _internal_set_set_temperature(float value); + const std::string& _internal_current_value() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_current_value( + const std::string& value); + std::string* _internal_mutable_current_value(); public: - // float step_size = 6; - void clear_step_size() ; - float step_size() const; - void set_step_size(float value); + // string current_icon = 3; + void clear_current_icon() ; + const std::string& current_icon() const; + template + void set_current_icon(Arg_&& arg, Args_... args); + std::string* mutable_current_icon(); + PROTOBUF_NODISCARD std::string* release_current_icon(); + void set_allocated_current_icon(std::string* value); private: - float _internal_step_size() const; - void _internal_set_step_size(float value); + const std::string& _internal_current_icon() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_current_icon( + const std::string& value); + std::string* _internal_mutable_current_icon(); public: - // @@protoc_insertion_point(class_scope:NSPanelEntityState.Thermostat) + // @@protoc_insertion_point(class_scope:NSPanelEntityState.Thermostat.ThermostatOption) private: class _Internal; friend class ::google::protobuf::internal::TcParser; static const ::google::protobuf::internal::TcParseTable< - 3, 7, 1, - 42, 2> + 2, 4, 1, + 84, 2> _table_; static constexpr const void* _raw_default_instance_ = - &_NSPanelEntityState_Thermostat_default_instance_; + &_NSPanelEntityState_Thermostat_ThermostatOption_default_instance_; friend class ::google::protobuf::MessageLite; friend class ::google::protobuf::Arena; @@ -1082,14 +1589,11 @@ class NSPanelEntityState_Thermostat final : public ::google::protobuf::Message ::google::protobuf::Arena* arena); inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, - const NSPanelEntityState_Thermostat& from_msg); - ::google::protobuf::RepeatedPtrField< ::NSPanelEntityState_Thermostat_ThermostatOption > options_; + const NSPanelEntityState_Thermostat_ThermostatOption& from_msg); + ::google::protobuf::RepeatedPtrField< ::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue > options_; ::google::protobuf::internal::ArenaStringPtr name_; - ::int32_t thermostat_id_; - float current_temperature_; - bool has_current_temperature_; - float set_temperature_; - float step_size_; + ::google::protobuf::internal::ArenaStringPtr current_value_; + ::google::protobuf::internal::ArenaStringPtr current_icon_; mutable ::google::protobuf::internal::CachedSize _cached_size_; PROTOBUF_TSAN_DECLARE_MEMBER }; @@ -1098,23 +1602,23 @@ class NSPanelEntityState_Thermostat final : public ::google::protobuf::Message }; // ------------------------------------------------------------------- -class NSPanelEntityState final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:NSPanelEntityState) */ { +class NSPanelEntityState_MediaPlayer final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:NSPanelEntityState.MediaPlayer) */ { public: - inline NSPanelEntityState() : NSPanelEntityState(nullptr) {} - ~NSPanelEntityState() override; + inline NSPanelEntityState_MediaPlayer() : NSPanelEntityState_MediaPlayer(nullptr) {} + ~NSPanelEntityState_MediaPlayer() override; template - explicit PROTOBUF_CONSTEXPR NSPanelEntityState( + explicit PROTOBUF_CONSTEXPR NSPanelEntityState_MediaPlayer( ::google::protobuf::internal::ConstantInitialized); - inline NSPanelEntityState(const NSPanelEntityState& from) : NSPanelEntityState(nullptr, from) {} - inline NSPanelEntityState(NSPanelEntityState&& from) noexcept - : NSPanelEntityState(nullptr, std::move(from)) {} - inline NSPanelEntityState& operator=(const NSPanelEntityState& from) { + inline NSPanelEntityState_MediaPlayer(const NSPanelEntityState_MediaPlayer& from) : NSPanelEntityState_MediaPlayer(nullptr, from) {} + inline NSPanelEntityState_MediaPlayer(NSPanelEntityState_MediaPlayer&& from) noexcept + : NSPanelEntityState_MediaPlayer(nullptr, std::move(from)) {} + inline NSPanelEntityState_MediaPlayer& operator=(const NSPanelEntityState_MediaPlayer& from) { CopyFrom(from); return *this; } - inline NSPanelEntityState& operator=(NSPanelEntityState&& from) noexcept { + inline NSPanelEntityState_MediaPlayer& operator=(NSPanelEntityState_MediaPlayer&& from) noexcept { if (this == &from) return *this; if (GetArena() == from.GetArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE @@ -1146,21 +1650,16 @@ class NSPanelEntityState final : public ::google::protobuf::Message static const ::google::protobuf::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } - static const NSPanelEntityState& default_instance() { + static const NSPanelEntityState_MediaPlayer& default_instance() { return *internal_default_instance(); } - enum EntityCase { - kLight = 1, - kThermostat = 2, - ENTITY_NOT_SET = 0, - }; - static inline const NSPanelEntityState* internal_default_instance() { - return reinterpret_cast( - &_NSPanelEntityState_default_instance_); + static inline const NSPanelEntityState_MediaPlayer* internal_default_instance() { + return reinterpret_cast( + &_NSPanelEntityState_MediaPlayer_default_instance_); } - static constexpr int kIndexInFileMessages = 4; - friend void swap(NSPanelEntityState& a, NSPanelEntityState& b) { a.Swap(&b); } - inline void Swap(NSPanelEntityState* other) { + static constexpr int kIndexInFileMessages = 5; + friend void swap(NSPanelEntityState_MediaPlayer& a, NSPanelEntityState_MediaPlayer& b) { a.Swap(&b); } + inline void Swap(NSPanelEntityState_MediaPlayer* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetArena() != nullptr && GetArena() == other->GetArena()) { @@ -1172,7 +1671,7 @@ class NSPanelEntityState final : public ::google::protobuf::Message ::google::protobuf::internal::GenericSwap(this, other); } } - void UnsafeArenaSwap(NSPanelEntityState* other) { + void UnsafeArenaSwap(NSPanelEntityState_MediaPlayer* other) { if (other == this) return; ABSL_DCHECK(GetArena() == other->GetArena()); InternalSwap(other); @@ -1180,13 +1679,13 @@ class NSPanelEntityState final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - NSPanelEntityState* New(::google::protobuf::Arena* arena = nullptr) const final { - return ::google::protobuf::Message::DefaultConstruct(arena); + NSPanelEntityState_MediaPlayer* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const NSPanelEntityState& from); + void CopyFrom(const NSPanelEntityState_MediaPlayer& from); using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const NSPanelEntityState& from) { NSPanelEntityState::MergeImpl(*this, from); } + void MergeFrom(const NSPanelEntityState_MediaPlayer& from) { NSPanelEntityState_MediaPlayer::MergeImpl(*this, from); } private: static void MergeImpl( @@ -1207,16 +1706,16 @@ class NSPanelEntityState final : public ::google::protobuf::Message private: void SharedCtor(::google::protobuf::Arena* arena); void SharedDtor(); - void InternalSwap(NSPanelEntityState* other); + void InternalSwap(NSPanelEntityState_MediaPlayer* other); private: friend class ::google::protobuf::internal::AnyMetadata; - static ::absl::string_view FullMessageName() { return "NSPanelEntityState"; } + static ::absl::string_view FullMessageName() { return "NSPanelEntityState.MediaPlayer"; } protected: - explicit NSPanelEntityState(::google::protobuf::Arena* arena); - NSPanelEntityState(::google::protobuf::Arena* arena, const NSPanelEntityState& from); - NSPanelEntityState(::google::protobuf::Arena* arena, NSPanelEntityState&& from) noexcept - : NSPanelEntityState(arena) { + explicit NSPanelEntityState_MediaPlayer(::google::protobuf::Arena* arena); + NSPanelEntityState_MediaPlayer(::google::protobuf::Arena* arena, const NSPanelEntityState_MediaPlayer& from); + NSPanelEntityState_MediaPlayer(::google::protobuf::Arena* arena, NSPanelEntityState_MediaPlayer&& from) noexcept + : NSPanelEntityState_MediaPlayer(arena) { *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const final; @@ -1224,69 +1723,333 @@ class NSPanelEntityState final : public ::google::protobuf::Message public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- - using Light = NSPanelEntityState_Light; - using Thermostat = NSPanelEntityState_Thermostat; + using SourceSelection = NSPanelEntityState_MediaPlayer_SourceSelection; + using PlaybackState = NSPanelEntityState_MediaPlayer_PlaybackState; + static constexpr PlaybackState UNKNOWN = NSPanelEntityState_MediaPlayer_PlaybackState_UNKNOWN; + static constexpr PlaybackState OFF = NSPanelEntityState_MediaPlayer_PlaybackState_OFF; + static constexpr PlaybackState ON = NSPanelEntityState_MediaPlayer_PlaybackState_ON; + static constexpr PlaybackState IDLE = NSPanelEntityState_MediaPlayer_PlaybackState_IDLE; + static constexpr PlaybackState PLAYING = NSPanelEntityState_MediaPlayer_PlaybackState_PLAYING; + static constexpr PlaybackState PAUSED = NSPanelEntityState_MediaPlayer_PlaybackState_PAUSED; + static constexpr PlaybackState BUFFERING = NSPanelEntityState_MediaPlayer_PlaybackState_BUFFERING; + static inline bool PlaybackState_IsValid(int value) { + return NSPanelEntityState_MediaPlayer_PlaybackState_IsValid(value); + } + static constexpr PlaybackState PlaybackState_MIN = NSPanelEntityState_MediaPlayer_PlaybackState_PlaybackState_MIN; + static constexpr PlaybackState PlaybackState_MAX = NSPanelEntityState_MediaPlayer_PlaybackState_PlaybackState_MAX; + static constexpr int PlaybackState_ARRAYSIZE = NSPanelEntityState_MediaPlayer_PlaybackState_PlaybackState_ARRAYSIZE; + static inline const ::google::protobuf::EnumDescriptor* PlaybackState_descriptor() { + return NSPanelEntityState_MediaPlayer_PlaybackState_descriptor(); + } + template + static inline const std::string& PlaybackState_Name(T value) { + return NSPanelEntityState_MediaPlayer_PlaybackState_Name(value); + } + static inline bool PlaybackState_Parse(absl::string_view name, PlaybackState* value) { + return NSPanelEntityState_MediaPlayer_PlaybackState_Parse(name, value); + } // accessors ------------------------------------------------------- enum : int { - kLightFieldNumber = 1, - kThermostatFieldNumber = 2, + kNameFieldNumber = 2, + kMediaTitleFieldNumber = 4, + kMediaArtistFieldNumber = 5, + kAlbumArtUrlFieldNumber = 16, + kPlayerSourcesFieldNumber = 18, + kSourcePlayerSourcesFieldNumber = 19, + kMediaPlayerIdFieldNumber = 1, + kStateFieldNumber = 3, + kVolumeFieldNumber = 6, + kSourceVolumeFieldNumber = 9, + kIsMutedFieldNumber = 7, + kHasSourceVolumeFieldNumber = 8, + kCanPlayFieldNumber = 10, + kCanPauseFieldNumber = 11, + kCanNextTrackFieldNumber = 12, + kCanPreviousTrackFieldNumber = 13, + kCanSetVolumeFieldNumber = 14, + kCanMuteFieldNumber = 15, + kVolumeStepFieldNumber = 17, + kHasMediaPositionFieldNumber = 20, + kMediaPositionUpdatedAtFieldNumber = 22, + kMediaPositionFieldNumber = 21, + kMediaDurationFieldNumber = 23, }; - // .NSPanelEntityState.Light light = 1; - bool has_light() const; + // string name = 2; + void clear_name() ; + const std::string& name() const; + template + void set_name(Arg_&& arg, Args_... args); + std::string* mutable_name(); + PROTOBUF_NODISCARD std::string* release_name(); + void set_allocated_name(std::string* value); + private: - bool _internal_has_light() const; + const std::string& _internal_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( + const std::string& value); + std::string* _internal_mutable_name(); public: - void clear_light() ; - const ::NSPanelEntityState_Light& light() const; - PROTOBUF_NODISCARD ::NSPanelEntityState_Light* release_light(); - ::NSPanelEntityState_Light* mutable_light(); - void set_allocated_light(::NSPanelEntityState_Light* value); - void unsafe_arena_set_allocated_light(::NSPanelEntityState_Light* value); - ::NSPanelEntityState_Light* unsafe_arena_release_light(); + // string media_title = 4; + void clear_media_title() ; + const std::string& media_title() const; + template + void set_media_title(Arg_&& arg, Args_... args); + std::string* mutable_media_title(); + PROTOBUF_NODISCARD std::string* release_media_title(); + void set_allocated_media_title(std::string* value); private: - const ::NSPanelEntityState_Light& _internal_light() const; - ::NSPanelEntityState_Light* _internal_mutable_light(); + const std::string& _internal_media_title() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_media_title( + const std::string& value); + std::string* _internal_mutable_media_title(); public: - // .NSPanelEntityState.Thermostat thermostat = 2; - bool has_thermostat() const; + // string media_artist = 5; + void clear_media_artist() ; + const std::string& media_artist() const; + template + void set_media_artist(Arg_&& arg, Args_... args); + std::string* mutable_media_artist(); + PROTOBUF_NODISCARD std::string* release_media_artist(); + void set_allocated_media_artist(std::string* value); + private: - bool _internal_has_thermostat() const; + const std::string& _internal_media_artist() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_media_artist( + const std::string& value); + std::string* _internal_mutable_media_artist(); public: - void clear_thermostat() ; - const ::NSPanelEntityState_Thermostat& thermostat() const; - PROTOBUF_NODISCARD ::NSPanelEntityState_Thermostat* release_thermostat(); - ::NSPanelEntityState_Thermostat* mutable_thermostat(); - void set_allocated_thermostat(::NSPanelEntityState_Thermostat* value); - void unsafe_arena_set_allocated_thermostat(::NSPanelEntityState_Thermostat* value); - ::NSPanelEntityState_Thermostat* unsafe_arena_release_thermostat(); + // string album_art_url = 16; + void clear_album_art_url() ; + const std::string& album_art_url() const; + template + void set_album_art_url(Arg_&& arg, Args_... args); + std::string* mutable_album_art_url(); + PROTOBUF_NODISCARD std::string* release_album_art_url(); + void set_allocated_album_art_url(std::string* value); private: - const ::NSPanelEntityState_Thermostat& _internal_thermostat() const; - ::NSPanelEntityState_Thermostat* _internal_mutable_thermostat(); + const std::string& _internal_album_art_url() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_album_art_url( + const std::string& value); + std::string* _internal_mutable_album_art_url(); public: - void clear_entity(); - EntityCase entity_case() const; - // @@protoc_insertion_point(class_scope:NSPanelEntityState) + // .NSPanelEntityState.MediaPlayer.SourceSelection player_sources = 18; + bool has_player_sources() const; + void clear_player_sources() ; + const ::NSPanelEntityState_MediaPlayer_SourceSelection& player_sources() const; + PROTOBUF_NODISCARD ::NSPanelEntityState_MediaPlayer_SourceSelection* release_player_sources(); + ::NSPanelEntityState_MediaPlayer_SourceSelection* mutable_player_sources(); + void set_allocated_player_sources(::NSPanelEntityState_MediaPlayer_SourceSelection* value); + void unsafe_arena_set_allocated_player_sources(::NSPanelEntityState_MediaPlayer_SourceSelection* value); + ::NSPanelEntityState_MediaPlayer_SourceSelection* unsafe_arena_release_player_sources(); + + private: + const ::NSPanelEntityState_MediaPlayer_SourceSelection& _internal_player_sources() const; + ::NSPanelEntityState_MediaPlayer_SourceSelection* _internal_mutable_player_sources(); + + public: + // .NSPanelEntityState.MediaPlayer.SourceSelection source_player_sources = 19; + bool has_source_player_sources() const; + void clear_source_player_sources() ; + const ::NSPanelEntityState_MediaPlayer_SourceSelection& source_player_sources() const; + PROTOBUF_NODISCARD ::NSPanelEntityState_MediaPlayer_SourceSelection* release_source_player_sources(); + ::NSPanelEntityState_MediaPlayer_SourceSelection* mutable_source_player_sources(); + void set_allocated_source_player_sources(::NSPanelEntityState_MediaPlayer_SourceSelection* value); + void unsafe_arena_set_allocated_source_player_sources(::NSPanelEntityState_MediaPlayer_SourceSelection* value); + ::NSPanelEntityState_MediaPlayer_SourceSelection* unsafe_arena_release_source_player_sources(); + + private: + const ::NSPanelEntityState_MediaPlayer_SourceSelection& _internal_source_player_sources() const; + ::NSPanelEntityState_MediaPlayer_SourceSelection* _internal_mutable_source_player_sources(); + + public: + // int32 media_player_id = 1; + void clear_media_player_id() ; + ::int32_t media_player_id() const; + void set_media_player_id(::int32_t value); + + private: + ::int32_t _internal_media_player_id() const; + void _internal_set_media_player_id(::int32_t value); + + public: + // .NSPanelEntityState.MediaPlayer.PlaybackState state = 3; + void clear_state() ; + ::NSPanelEntityState_MediaPlayer_PlaybackState state() const; + void set_state(::NSPanelEntityState_MediaPlayer_PlaybackState value); + + private: + ::NSPanelEntityState_MediaPlayer_PlaybackState _internal_state() const; + void _internal_set_state(::NSPanelEntityState_MediaPlayer_PlaybackState value); + + public: + // int32 volume = 6; + void clear_volume() ; + ::int32_t volume() const; + void set_volume(::int32_t value); + + private: + ::int32_t _internal_volume() const; + void _internal_set_volume(::int32_t value); + + public: + // int32 source_volume = 9; + void clear_source_volume() ; + ::int32_t source_volume() const; + void set_source_volume(::int32_t value); + + private: + ::int32_t _internal_source_volume() const; + void _internal_set_source_volume(::int32_t value); + + public: + // bool is_muted = 7; + void clear_is_muted() ; + bool is_muted() const; + void set_is_muted(bool value); + + private: + bool _internal_is_muted() const; + void _internal_set_is_muted(bool value); + + public: + // bool has_source_volume = 8; + void clear_has_source_volume() ; + bool has_source_volume() const; + void set_has_source_volume(bool value); + + private: + bool _internal_has_source_volume() const; + void _internal_set_has_source_volume(bool value); + + public: + // bool can_play = 10; + void clear_can_play() ; + bool can_play() const; + void set_can_play(bool value); + + private: + bool _internal_can_play() const; + void _internal_set_can_play(bool value); + + public: + // bool can_pause = 11; + void clear_can_pause() ; + bool can_pause() const; + void set_can_pause(bool value); + + private: + bool _internal_can_pause() const; + void _internal_set_can_pause(bool value); + + public: + // bool can_next_track = 12; + void clear_can_next_track() ; + bool can_next_track() const; + void set_can_next_track(bool value); + + private: + bool _internal_can_next_track() const; + void _internal_set_can_next_track(bool value); + + public: + // bool can_previous_track = 13; + void clear_can_previous_track() ; + bool can_previous_track() const; + void set_can_previous_track(bool value); + + private: + bool _internal_can_previous_track() const; + void _internal_set_can_previous_track(bool value); + + public: + // bool can_set_volume = 14; + void clear_can_set_volume() ; + bool can_set_volume() const; + void set_can_set_volume(bool value); + + private: + bool _internal_can_set_volume() const; + void _internal_set_can_set_volume(bool value); + + public: + // bool can_mute = 15; + void clear_can_mute() ; + bool can_mute() const; + void set_can_mute(bool value); + + private: + bool _internal_can_mute() const; + void _internal_set_can_mute(bool value); + + public: + // int32 volume_step = 17; + void clear_volume_step() ; + ::int32_t volume_step() const; + void set_volume_step(::int32_t value); + + private: + ::int32_t _internal_volume_step() const; + void _internal_set_volume_step(::int32_t value); + + public: + // bool has_media_position = 20; + void clear_has_media_position() ; + bool has_media_position() const; + void set_has_media_position(bool value); + + private: + bool _internal_has_media_position() const; + void _internal_set_has_media_position(bool value); + + public: + // int64 media_position_updated_at = 22; + void clear_media_position_updated_at() ; + ::int64_t media_position_updated_at() const; + void set_media_position_updated_at(::int64_t value); + + private: + ::int64_t _internal_media_position_updated_at() const; + void _internal_set_media_position_updated_at(::int64_t value); + + public: + // int32 media_position = 21; + void clear_media_position() ; + ::int32_t media_position() const; + void set_media_position(::int32_t value); + + private: + ::int32_t _internal_media_position() const; + void _internal_set_media_position(::int32_t value); + + public: + // int32 media_duration = 23; + void clear_media_duration() ; + ::int32_t media_duration() const; + void set_media_duration(::int32_t value); + + private: + ::int32_t _internal_media_duration() const; + void _internal_set_media_duration(::int32_t value); + + public: + // @@protoc_insertion_point(class_scope:NSPanelEntityState.MediaPlayer) private: class _Internal; - void set_has_light(); - void set_has_thermostat(); - inline bool has_entity() const; - inline void clear_has_entity(); friend class ::google::protobuf::internal::TcParser; static const ::google::protobuf::internal::TcParseTable< - 0, 2, 2, - 0, 2> + 5, 23, 2, + 95, 2> _table_; static constexpr const void* _raw_default_instance_ = - &_NSPanelEntityState_default_instance_; + &_NSPanelEntityState_MediaPlayer_default_instance_; friend class ::google::protobuf::MessageLite; friend class ::google::protobuf::Arena; @@ -1301,433 +2064,2360 @@ class NSPanelEntityState final : public ::google::protobuf::Message ::google::protobuf::Arena* arena); inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, ::google::protobuf::Arena* arena, const Impl_& from, - const NSPanelEntityState& from_msg); - union EntityUnion { - constexpr EntityUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::NSPanelEntityState_Light* light_; - ::NSPanelEntityState_Thermostat* thermostat_; - } entity_; + const NSPanelEntityState_MediaPlayer& from_msg); + ::google::protobuf::internal::HasBits<1> _has_bits_; mutable ::google::protobuf::internal::CachedSize _cached_size_; - ::uint32_t _oneof_case_[1]; + ::google::protobuf::internal::ArenaStringPtr name_; + ::google::protobuf::internal::ArenaStringPtr media_title_; + ::google::protobuf::internal::ArenaStringPtr media_artist_; + ::google::protobuf::internal::ArenaStringPtr album_art_url_; + ::NSPanelEntityState_MediaPlayer_SourceSelection* player_sources_; + ::NSPanelEntityState_MediaPlayer_SourceSelection* source_player_sources_; + ::int32_t media_player_id_; + int state_; + ::int32_t volume_; + ::int32_t source_volume_; + bool is_muted_; + bool has_source_volume_; + bool can_play_; + bool can_pause_; + bool can_next_track_; + bool can_previous_track_; + bool can_set_volume_; + bool can_mute_; + ::int32_t volume_step_; + bool has_media_position_; + ::int64_t media_position_updated_at_; + ::int32_t media_position_; + ::int32_t media_duration_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; friend struct ::TableStruct_protobuf_5fnspanel_5fentity_2eproto; }; - -// =================================================================== - - - - -// =================================================================== - - -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstrict-aliasing" -#endif // __GNUC__ // ------------------------------------------------------------------- -// NSPanelEntityState_Light +class NSPanelEntityState_Thermostat final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:NSPanelEntityState.Thermostat) */ { + public: + inline NSPanelEntityState_Thermostat() : NSPanelEntityState_Thermostat(nullptr) {} + ~NSPanelEntityState_Thermostat() override; + template + explicit PROTOBUF_CONSTEXPR NSPanelEntityState_Thermostat( + ::google::protobuf::internal::ConstantInitialized); -// int32 light_id = 1; -inline void NSPanelEntityState_Light::clear_light_id() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.light_id_ = 0; -} -inline ::int32_t NSPanelEntityState_Light::light_id() const { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.light_id) - return _internal_light_id(); -} -inline void NSPanelEntityState_Light::set_light_id(::int32_t value) { - _internal_set_light_id(value); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.light_id) -} -inline ::int32_t NSPanelEntityState_Light::_internal_light_id() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.light_id_; -} -inline void NSPanelEntityState_Light::_internal_set_light_id(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.light_id_ = value; -} + inline NSPanelEntityState_Thermostat(const NSPanelEntityState_Thermostat& from) : NSPanelEntityState_Thermostat(nullptr, from) {} + inline NSPanelEntityState_Thermostat(NSPanelEntityState_Thermostat&& from) noexcept + : NSPanelEntityState_Thermostat(nullptr, std::move(from)) {} + inline NSPanelEntityState_Thermostat& operator=(const NSPanelEntityState_Thermostat& from) { + CopyFrom(from); + return *this; + } + inline NSPanelEntityState_Thermostat& operator=(NSPanelEntityState_Thermostat&& from) noexcept { + if (this == &from) return *this; + if (GetArena() == from.GetArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetArena() != nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } -// string name = 2; -inline void NSPanelEntityState_Light::clear_name() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.name_.ClearToEmpty(); -} -inline const std::string& NSPanelEntityState_Light::name() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.name) - return _internal_name(); + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::google::protobuf::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::google::protobuf::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const NSPanelEntityState_Thermostat& default_instance() { + return *internal_default_instance(); + } + static inline const NSPanelEntityState_Thermostat* internal_default_instance() { + return reinterpret_cast( + &_NSPanelEntityState_Thermostat_default_instance_); + } + static constexpr int kIndexInFileMessages = 3; + friend void swap(NSPanelEntityState_Thermostat& a, NSPanelEntityState_Thermostat& b) { a.Swap(&b); } + inline void Swap(NSPanelEntityState_Thermostat* other) { + if (other == this) return; +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() != nullptr && GetArena() == other->GetArena()) { +#else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() == other->GetArena()) { +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::google::protobuf::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(NSPanelEntityState_Thermostat* other) { + if (other == this) return; + ABSL_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + NSPanelEntityState_Thermostat* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); + } + using ::google::protobuf::Message::CopyFrom; + void CopyFrom(const NSPanelEntityState_Thermostat& from); + using ::google::protobuf::Message::MergeFrom; + void MergeFrom(const NSPanelEntityState_Thermostat& from) { NSPanelEntityState_Thermostat::MergeImpl(*this, from); } + + private: + static void MergeImpl( + ::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); + + public: + bool IsInitialized() const { + return true; + } + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; + ::size_t ByteSizeLong() const final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::google::protobuf::Arena* arena); + void SharedDtor(); + void InternalSwap(NSPanelEntityState_Thermostat* other); + private: + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "NSPanelEntityState.Thermostat"; } + + protected: + explicit NSPanelEntityState_Thermostat(::google::protobuf::Arena* arena); + NSPanelEntityState_Thermostat(::google::protobuf::Arena* arena, const NSPanelEntityState_Thermostat& from); + NSPanelEntityState_Thermostat(::google::protobuf::Arena* arena, NSPanelEntityState_Thermostat&& from) noexcept + : NSPanelEntityState_Thermostat(arena) { + *this = ::std::move(from); + } + const ::google::protobuf::Message::ClassData* GetClassData() const final; + + public: + ::google::protobuf::Metadata GetMetadata() const; + // nested types ---------------------------------------------------- + using ThermostatOption = NSPanelEntityState_Thermostat_ThermostatOption; + + // accessors ------------------------------------------------------- + enum : int { + kOptionsFieldNumber = 7, + kNameFieldNumber = 2, + kThermostatIdFieldNumber = 1, + kCurrentTemperatureFieldNumber = 3, + kHasCurrentTemperatureFieldNumber = 4, + kSetTemperatureFieldNumber = 5, + kStepSizeFieldNumber = 6, + }; + // repeated .NSPanelEntityState.Thermostat.ThermostatOption options = 7; + int options_size() const; + private: + int _internal_options_size() const; + + public: + void clear_options() ; + ::NSPanelEntityState_Thermostat_ThermostatOption* mutable_options(int index); + ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption>* mutable_options(); + + private: + const ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption>& _internal_options() const; + ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption>* _internal_mutable_options(); + public: + const ::NSPanelEntityState_Thermostat_ThermostatOption& options(int index) const; + ::NSPanelEntityState_Thermostat_ThermostatOption* add_options(); + const ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption>& options() const; + // string name = 2; + void clear_name() ; + const std::string& name() const; + template + void set_name(Arg_&& arg, Args_... args); + std::string* mutable_name(); + PROTOBUF_NODISCARD std::string* release_name(); + void set_allocated_name(std::string* value); + + private: + const std::string& _internal_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_name( + const std::string& value); + std::string* _internal_mutable_name(); + + public: + // int32 thermostat_id = 1; + void clear_thermostat_id() ; + ::int32_t thermostat_id() const; + void set_thermostat_id(::int32_t value); + + private: + ::int32_t _internal_thermostat_id() const; + void _internal_set_thermostat_id(::int32_t value); + + public: + // float current_temperature = 3; + void clear_current_temperature() ; + float current_temperature() const; + void set_current_temperature(float value); + + private: + float _internal_current_temperature() const; + void _internal_set_current_temperature(float value); + + public: + // bool has_current_temperature = 4; + void clear_has_current_temperature() ; + bool has_current_temperature() const; + void set_has_current_temperature(bool value); + + private: + bool _internal_has_current_temperature() const; + void _internal_set_has_current_temperature(bool value); + + public: + // float set_temperature = 5; + void clear_set_temperature() ; + float set_temperature() const; + void set_set_temperature(float value); + + private: + float _internal_set_temperature() const; + void _internal_set_set_temperature(float value); + + public: + // float step_size = 6; + void clear_step_size() ; + float step_size() const; + void set_step_size(float value); + + private: + float _internal_step_size() const; + void _internal_set_step_size(float value); + + public: + // @@protoc_insertion_point(class_scope:NSPanelEntityState.Thermostat) + private: + class _Internal; + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 3, 7, 1, + 42, 2> + _table_; + + static constexpr const void* _raw_default_instance_ = + &_NSPanelEntityState_Thermostat_default_instance_; + + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; + struct Impl_ { + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from, + const NSPanelEntityState_Thermostat& from_msg); + ::google::protobuf::RepeatedPtrField< ::NSPanelEntityState_Thermostat_ThermostatOption > options_; + ::google::protobuf::internal::ArenaStringPtr name_; + ::int32_t thermostat_id_; + float current_temperature_; + bool has_current_temperature_; + float set_temperature_; + float step_size_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + PROTOBUF_TSAN_DECLARE_MEMBER + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_protobuf_5fnspanel_5fentity_2eproto; +}; +// ------------------------------------------------------------------- + +class NSPanelEntityState final : public ::google::protobuf::Message +/* @@protoc_insertion_point(class_definition:NSPanelEntityState) */ { + public: + inline NSPanelEntityState() : NSPanelEntityState(nullptr) {} + ~NSPanelEntityState() override; + template + explicit PROTOBUF_CONSTEXPR NSPanelEntityState( + ::google::protobuf::internal::ConstantInitialized); + + inline NSPanelEntityState(const NSPanelEntityState& from) : NSPanelEntityState(nullptr, from) {} + inline NSPanelEntityState(NSPanelEntityState&& from) noexcept + : NSPanelEntityState(nullptr, std::move(from)) {} + inline NSPanelEntityState& operator=(const NSPanelEntityState& from) { + CopyFrom(from); + return *this; + } + inline NSPanelEntityState& operator=(NSPanelEntityState&& from) noexcept { + if (this == &from) return *this; + if (GetArena() == from.GetArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetArena() != nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); + } + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); + } + + static const ::google::protobuf::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::google::protobuf::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::google::protobuf::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const NSPanelEntityState& default_instance() { + return *internal_default_instance(); + } + enum EntityCase { + kLight = 1, + kThermostat = 2, + kMediaPlayer = 3, + kCover = 4, + ENTITY_NOT_SET = 0, + }; + static inline const NSPanelEntityState* internal_default_instance() { + return reinterpret_cast( + &_NSPanelEntityState_default_instance_); + } + static constexpr int kIndexInFileMessages = 7; + friend void swap(NSPanelEntityState& a, NSPanelEntityState& b) { a.Swap(&b); } + inline void Swap(NSPanelEntityState* other) { + if (other == this) return; +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() != nullptr && GetArena() == other->GetArena()) { +#else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() == other->GetArena()) { +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::google::protobuf::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(NSPanelEntityState* other) { + if (other == this) return; + ABSL_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + NSPanelEntityState* New(::google::protobuf::Arena* arena = nullptr) const final { + return ::google::protobuf::Message::DefaultConstruct(arena); + } + using ::google::protobuf::Message::CopyFrom; + void CopyFrom(const NSPanelEntityState& from); + using ::google::protobuf::Message::MergeFrom; + void MergeFrom(const NSPanelEntityState& from) { NSPanelEntityState::MergeImpl(*this, from); } + + private: + static void MergeImpl( + ::google::protobuf::MessageLite& to_msg, + const ::google::protobuf::MessageLite& from_msg); + + public: + bool IsInitialized() const { + return true; + } + ABSL_ATTRIBUTE_REINITIALIZES void Clear() final; + ::size_t ByteSizeLong() const final; + ::uint8_t* _InternalSerialize( + ::uint8_t* target, + ::google::protobuf::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::google::protobuf::Arena* arena); + void SharedDtor(); + void InternalSwap(NSPanelEntityState* other); + private: + friend class ::google::protobuf::internal::AnyMetadata; + static ::absl::string_view FullMessageName() { return "NSPanelEntityState"; } + + protected: + explicit NSPanelEntityState(::google::protobuf::Arena* arena); + NSPanelEntityState(::google::protobuf::Arena* arena, const NSPanelEntityState& from); + NSPanelEntityState(::google::protobuf::Arena* arena, NSPanelEntityState&& from) noexcept + : NSPanelEntityState(arena) { + *this = ::std::move(from); + } + const ::google::protobuf::Message::ClassData* GetClassData() const final; + + public: + ::google::protobuf::Metadata GetMetadata() const; + // nested types ---------------------------------------------------- + using Light = NSPanelEntityState_Light; + using Thermostat = NSPanelEntityState_Thermostat; + using MediaPlayer = NSPanelEntityState_MediaPlayer; + using Cover = NSPanelEntityState_Cover; + + // accessors ------------------------------------------------------- + enum : int { + kLightFieldNumber = 1, + kThermostatFieldNumber = 2, + kMediaPlayerFieldNumber = 3, + kCoverFieldNumber = 4, + }; + // .NSPanelEntityState.Light light = 1; + bool has_light() const; + private: + bool _internal_has_light() const; + + public: + void clear_light() ; + const ::NSPanelEntityState_Light& light() const; + PROTOBUF_NODISCARD ::NSPanelEntityState_Light* release_light(); + ::NSPanelEntityState_Light* mutable_light(); + void set_allocated_light(::NSPanelEntityState_Light* value); + void unsafe_arena_set_allocated_light(::NSPanelEntityState_Light* value); + ::NSPanelEntityState_Light* unsafe_arena_release_light(); + + private: + const ::NSPanelEntityState_Light& _internal_light() const; + ::NSPanelEntityState_Light* _internal_mutable_light(); + + public: + // .NSPanelEntityState.Thermostat thermostat = 2; + bool has_thermostat() const; + private: + bool _internal_has_thermostat() const; + + public: + void clear_thermostat() ; + const ::NSPanelEntityState_Thermostat& thermostat() const; + PROTOBUF_NODISCARD ::NSPanelEntityState_Thermostat* release_thermostat(); + ::NSPanelEntityState_Thermostat* mutable_thermostat(); + void set_allocated_thermostat(::NSPanelEntityState_Thermostat* value); + void unsafe_arena_set_allocated_thermostat(::NSPanelEntityState_Thermostat* value); + ::NSPanelEntityState_Thermostat* unsafe_arena_release_thermostat(); + + private: + const ::NSPanelEntityState_Thermostat& _internal_thermostat() const; + ::NSPanelEntityState_Thermostat* _internal_mutable_thermostat(); + + public: + // .NSPanelEntityState.MediaPlayer media_player = 3; + bool has_media_player() const; + private: + bool _internal_has_media_player() const; + + public: + void clear_media_player() ; + const ::NSPanelEntityState_MediaPlayer& media_player() const; + PROTOBUF_NODISCARD ::NSPanelEntityState_MediaPlayer* release_media_player(); + ::NSPanelEntityState_MediaPlayer* mutable_media_player(); + void set_allocated_media_player(::NSPanelEntityState_MediaPlayer* value); + void unsafe_arena_set_allocated_media_player(::NSPanelEntityState_MediaPlayer* value); + ::NSPanelEntityState_MediaPlayer* unsafe_arena_release_media_player(); + + private: + const ::NSPanelEntityState_MediaPlayer& _internal_media_player() const; + ::NSPanelEntityState_MediaPlayer* _internal_mutable_media_player(); + + public: + // .NSPanelEntityState.Cover cover = 4; + bool has_cover() const; + private: + bool _internal_has_cover() const; + + public: + void clear_cover() ; + const ::NSPanelEntityState_Cover& cover() const; + PROTOBUF_NODISCARD ::NSPanelEntityState_Cover* release_cover(); + ::NSPanelEntityState_Cover* mutable_cover(); + void set_allocated_cover(::NSPanelEntityState_Cover* value); + void unsafe_arena_set_allocated_cover(::NSPanelEntityState_Cover* value); + ::NSPanelEntityState_Cover* unsafe_arena_release_cover(); + + private: + const ::NSPanelEntityState_Cover& _internal_cover() const; + ::NSPanelEntityState_Cover* _internal_mutable_cover(); + + public: + void clear_entity(); + EntityCase entity_case() const; + // @@protoc_insertion_point(class_scope:NSPanelEntityState) + private: + class _Internal; + void set_has_light(); + void set_has_thermostat(); + void set_has_media_player(); + void set_has_cover(); + inline bool has_entity() const; + inline void clear_has_entity(); + friend class ::google::protobuf::internal::TcParser; + static const ::google::protobuf::internal::TcParseTable< + 0, 4, 4, + 0, 2> + _table_; + + static constexpr const void* _raw_default_instance_ = + &_NSPanelEntityState_default_instance_; + + friend class ::google::protobuf::MessageLite; + friend class ::google::protobuf::Arena; + template + friend class ::google::protobuf::Arena::InternalHelper; + using InternalArenaConstructable_ = void; + using DestructorSkippable_ = void; + struct Impl_ { + inline explicit constexpr Impl_( + ::google::protobuf::internal::ConstantInitialized) noexcept; + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena); + inline explicit Impl_(::google::protobuf::internal::InternalVisibility visibility, + ::google::protobuf::Arena* arena, const Impl_& from, + const NSPanelEntityState& from_msg); + union EntityUnion { + constexpr EntityUnion() : _constinit_{} {} + ::google::protobuf::internal::ConstantInitialized _constinit_; + ::NSPanelEntityState_Light* light_; + ::NSPanelEntityState_Thermostat* thermostat_; + ::NSPanelEntityState_MediaPlayer* media_player_; + ::NSPanelEntityState_Cover* cover_; + } entity_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + ::uint32_t _oneof_case_[1]; + PROTOBUF_TSAN_DECLARE_MEMBER + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_protobuf_5fnspanel_5fentity_2eproto; +}; + +// =================================================================== + + + + +// =================================================================== + + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// NSPanelEntityState_Light + +// int32 light_id = 1; +inline void NSPanelEntityState_Light::clear_light_id() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.light_id_ = 0; +} +inline ::int32_t NSPanelEntityState_Light::light_id() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.light_id) + return _internal_light_id(); +} +inline void NSPanelEntityState_Light::set_light_id(::int32_t value) { + _internal_set_light_id(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.light_id) +} +inline ::int32_t NSPanelEntityState_Light::_internal_light_id() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.light_id_; +} +inline void NSPanelEntityState_Light::_internal_set_light_id(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.light_id_ = value; +} + +// string name = 2; +inline void NSPanelEntityState_Light::clear_name() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.name_.ClearToEmpty(); +} +inline const std::string& NSPanelEntityState_Light::name() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.name) + return _internal_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_Light::set_name(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.name_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.name) +} +inline std::string* NSPanelEntityState_Light::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_name(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Light.name) + return _s; +} +inline const std::string& NSPanelEntityState_Light::_internal_name() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.name_.Get(); +} +inline void NSPanelEntityState_Light::_internal_set_name(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.name_.Set(value, GetArena()); +} +inline std::string* NSPanelEntityState_Light::_internal_mutable_name() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.name_.Mutable( GetArena()); +} +inline std::string* NSPanelEntityState_Light::release_name() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelEntityState.Light.name) + return _impl_.name_.Release(); +} +inline void NSPanelEntityState_Light::set_allocated_name(std::string* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.name_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.name_.IsDefault()) { + _impl_.name_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.Light.name) +} + +// int32 brightness = 3; +inline void NSPanelEntityState_Light::clear_brightness() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.brightness_ = 0; +} +inline ::int32_t NSPanelEntityState_Light::brightness() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.brightness) + return _internal_brightness(); +} +inline void NSPanelEntityState_Light::set_brightness(::int32_t value) { + _internal_set_brightness(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.brightness) +} +inline ::int32_t NSPanelEntityState_Light::_internal_brightness() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.brightness_; +} +inline void NSPanelEntityState_Light::_internal_set_brightness(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.brightness_ = value; +} + +// int32 color_temp = 4; +inline void NSPanelEntityState_Light::clear_color_temp() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.color_temp_ = 0; +} +inline ::int32_t NSPanelEntityState_Light::color_temp() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.color_temp) + return _internal_color_temp(); +} +inline void NSPanelEntityState_Light::set_color_temp(::int32_t value) { + _internal_set_color_temp(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.color_temp) +} +inline ::int32_t NSPanelEntityState_Light::_internal_color_temp() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.color_temp_; +} +inline void NSPanelEntityState_Light::_internal_set_color_temp(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.color_temp_ = value; +} + +// int32 hue = 5; +inline void NSPanelEntityState_Light::clear_hue() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.hue_ = 0; +} +inline ::int32_t NSPanelEntityState_Light::hue() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.hue) + return _internal_hue(); +} +inline void NSPanelEntityState_Light::set_hue(::int32_t value) { + _internal_set_hue(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.hue) +} +inline ::int32_t NSPanelEntityState_Light::_internal_hue() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.hue_; +} +inline void NSPanelEntityState_Light::_internal_set_hue(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.hue_ = value; +} + +// int32 saturation = 6; +inline void NSPanelEntityState_Light::clear_saturation() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.saturation_ = 0; +} +inline ::int32_t NSPanelEntityState_Light::saturation() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.saturation) + return _internal_saturation(); +} +inline void NSPanelEntityState_Light::set_saturation(::int32_t value) { + _internal_set_saturation(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.saturation) +} +inline ::int32_t NSPanelEntityState_Light::_internal_saturation() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.saturation_; +} +inline void NSPanelEntityState_Light::_internal_set_saturation(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.saturation_ = value; +} + +// bool can_color_temp = 7; +inline void NSPanelEntityState_Light::clear_can_color_temp() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_color_temp_ = false; +} +inline bool NSPanelEntityState_Light::can_color_temp() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.can_color_temp) + return _internal_can_color_temp(); +} +inline void NSPanelEntityState_Light::set_can_color_temp(bool value) { + _internal_set_can_color_temp(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.can_color_temp) +} +inline bool NSPanelEntityState_Light::_internal_can_color_temp() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.can_color_temp_; +} +inline void NSPanelEntityState_Light::_internal_set_can_color_temp(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_color_temp_ = value; +} + +// bool can_color = 8; +inline void NSPanelEntityState_Light::clear_can_color() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_color_ = false; +} +inline bool NSPanelEntityState_Light::can_color() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.can_color) + return _internal_can_color(); +} +inline void NSPanelEntityState_Light::set_can_color(bool value) { + _internal_set_can_color(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.can_color) +} +inline bool NSPanelEntityState_Light::_internal_can_color() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.can_color_; +} +inline void NSPanelEntityState_Light::_internal_set_can_color(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_color_ = value; +} + +// .NSPanelEntityState.Light.LightMode current_light_mode = 9; +inline void NSPanelEntityState_Light::clear_current_light_mode() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.current_light_mode_ = 0; +} +inline ::NSPanelEntityState_Light_LightMode NSPanelEntityState_Light::current_light_mode() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.current_light_mode) + return _internal_current_light_mode(); +} +inline void NSPanelEntityState_Light::set_current_light_mode(::NSPanelEntityState_Light_LightMode value) { + _internal_set_current_light_mode(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.current_light_mode) +} +inline ::NSPanelEntityState_Light_LightMode NSPanelEntityState_Light::_internal_current_light_mode() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return static_cast<::NSPanelEntityState_Light_LightMode>(_impl_.current_light_mode_); +} +inline void NSPanelEntityState_Light::_internal_set_current_light_mode(::NSPanelEntityState_Light_LightMode value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.current_light_mode_ = value; +} + +// bool state = 10; +inline void NSPanelEntityState_Light::clear_state() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.state_ = false; +} +inline bool NSPanelEntityState_Light::state() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.state) + return _internal_state(); +} +inline void NSPanelEntityState_Light::set_state(bool value) { + _internal_set_state(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.state) +} +inline bool NSPanelEntityState_Light::_internal_state() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.state_; +} +inline void NSPanelEntityState_Light::_internal_set_state(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.state_ = value; +} + +// ------------------------------------------------------------------- + +// NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue + +// string value = 1; +inline void NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::clear_value() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.value_.ClearToEmpty(); +} +inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::value() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.value) + return _internal_value(); +} +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::set_value(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.value_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.value) +} +inline std::string* NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::mutable_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_value(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.value) + return _s; +} +inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::_internal_value() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.value_.Get(); +} +inline void NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::_internal_set_value(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.value_.Set(value, GetArena()); +} +inline std::string* NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::_internal_mutable_value() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.value_.Mutable( GetArena()); +} +inline std::string* NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::release_value() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.value) + return _impl_.value_.Release(); +} +inline void NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::set_allocated_value(std::string* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.value_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.value_.IsDefault()) { + _impl_.value_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.value) +} + +// string icon = 2; +inline void NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::clear_icon() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.icon_.ClearToEmpty(); +} +inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::icon() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.icon) + return _internal_icon(); +} +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::set_icon(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.icon_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.icon) +} +inline std::string* NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::mutable_icon() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_icon(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.icon) + return _s; +} +inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::_internal_icon() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.icon_.Get(); +} +inline void NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::_internal_set_icon(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.icon_.Set(value, GetArena()); +} +inline std::string* NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::_internal_mutable_icon() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.icon_.Mutable( GetArena()); +} +inline std::string* NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::release_icon() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.icon) + return _impl_.icon_.Release(); +} +inline void NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::set_allocated_icon(std::string* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.icon_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.icon_.IsDefault()) { + _impl_.icon_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.icon) +} + +// ------------------------------------------------------------------- + +// NSPanelEntityState_Thermostat_ThermostatOption + +// string name = 1; +inline void NSPanelEntityState_Thermostat_ThermostatOption::clear_name() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.name_.ClearToEmpty(); +} +inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption::name() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.ThermostatOption.name) + return _internal_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_Thermostat_ThermostatOption::set_name(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.name_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.ThermostatOption.name) +} +inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_name(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Thermostat.ThermostatOption.name) + return _s; +} +inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption::_internal_name() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.name_.Get(); +} +inline void NSPanelEntityState_Thermostat_ThermostatOption::_internal_set_name(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.name_.Set(value, GetArena()); +} +inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::_internal_mutable_name() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.name_.Mutable( GetArena()); +} +inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::release_name() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelEntityState.Thermostat.ThermostatOption.name) + return _impl_.name_.Release(); +} +inline void NSPanelEntityState_Thermostat_ThermostatOption::set_allocated_name(std::string* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.name_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.name_.IsDefault()) { + _impl_.name_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.Thermostat.ThermostatOption.name) +} + +// string current_value = 2; +inline void NSPanelEntityState_Thermostat_ThermostatOption::clear_current_value() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.current_value_.ClearToEmpty(); +} +inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption::current_value() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.ThermostatOption.current_value) + return _internal_current_value(); +} +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_Thermostat_ThermostatOption::set_current_value(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.current_value_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.ThermostatOption.current_value) +} +inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::mutable_current_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_current_value(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Thermostat.ThermostatOption.current_value) + return _s; +} +inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption::_internal_current_value() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.current_value_.Get(); +} +inline void NSPanelEntityState_Thermostat_ThermostatOption::_internal_set_current_value(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.current_value_.Set(value, GetArena()); +} +inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::_internal_mutable_current_value() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.current_value_.Mutable( GetArena()); +} +inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::release_current_value() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelEntityState.Thermostat.ThermostatOption.current_value) + return _impl_.current_value_.Release(); +} +inline void NSPanelEntityState_Thermostat_ThermostatOption::set_allocated_current_value(std::string* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.current_value_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.current_value_.IsDefault()) { + _impl_.current_value_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.Thermostat.ThermostatOption.current_value) +} + +// string current_icon = 3; +inline void NSPanelEntityState_Thermostat_ThermostatOption::clear_current_icon() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.current_icon_.ClearToEmpty(); +} +inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption::current_icon() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.ThermostatOption.current_icon) + return _internal_current_icon(); +} +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_Thermostat_ThermostatOption::set_current_icon(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.current_icon_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.ThermostatOption.current_icon) +} +inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::mutable_current_icon() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_current_icon(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Thermostat.ThermostatOption.current_icon) + return _s; +} +inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption::_internal_current_icon() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.current_icon_.Get(); +} +inline void NSPanelEntityState_Thermostat_ThermostatOption::_internal_set_current_icon(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.current_icon_.Set(value, GetArena()); +} +inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::_internal_mutable_current_icon() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.current_icon_.Mutable( GetArena()); +} +inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::release_current_icon() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelEntityState.Thermostat.ThermostatOption.current_icon) + return _impl_.current_icon_.Release(); +} +inline void NSPanelEntityState_Thermostat_ThermostatOption::set_allocated_current_icon(std::string* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.current_icon_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.current_icon_.IsDefault()) { + _impl_.current_icon_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.Thermostat.ThermostatOption.current_icon) +} + +// repeated .NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue options = 4; +inline int NSPanelEntityState_Thermostat_ThermostatOption::_internal_options_size() const { + return _internal_options().size(); +} +inline int NSPanelEntityState_Thermostat_ThermostatOption::options_size() const { + return _internal_options_size(); +} +inline void NSPanelEntityState_Thermostat_ThermostatOption::clear_options() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.options_.Clear(); +} +inline ::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue* NSPanelEntityState_Thermostat_ThermostatOption::mutable_options(int index) + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Thermostat.ThermostatOption.options) + return _internal_mutable_options()->Mutable(index); +} +inline ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue>* NSPanelEntityState_Thermostat_ThermostatOption::mutable_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_mutable_list:NSPanelEntityState.Thermostat.ThermostatOption.options) + ::google::protobuf::internal::TSanWrite(&_impl_); + return _internal_mutable_options(); +} +inline const ::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue& NSPanelEntityState_Thermostat_ThermostatOption::options(int index) const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.ThermostatOption.options) + return _internal_options().Get(index); +} +inline ::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue* NSPanelEntityState_Thermostat_ThermostatOption::add_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { + ::google::protobuf::internal::TSanWrite(&_impl_); + ::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue* _add = _internal_mutable_options()->Add(); + // @@protoc_insertion_point(field_add:NSPanelEntityState.Thermostat.ThermostatOption.options) + return _add; +} +inline const ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue>& NSPanelEntityState_Thermostat_ThermostatOption::options() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_list:NSPanelEntityState.Thermostat.ThermostatOption.options) + return _internal_options(); +} +inline const ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue>& +NSPanelEntityState_Thermostat_ThermostatOption::_internal_options() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.options_; +} +inline ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue>* +NSPanelEntityState_Thermostat_ThermostatOption::_internal_mutable_options() { + ::google::protobuf::internal::TSanRead(&_impl_); + return &_impl_.options_; +} + +// ------------------------------------------------------------------- + +// NSPanelEntityState_Thermostat + +// int32 thermostat_id = 1; +inline void NSPanelEntityState_Thermostat::clear_thermostat_id() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.thermostat_id_ = 0; +} +inline ::int32_t NSPanelEntityState_Thermostat::thermostat_id() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.thermostat_id) + return _internal_thermostat_id(); +} +inline void NSPanelEntityState_Thermostat::set_thermostat_id(::int32_t value) { + _internal_set_thermostat_id(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.thermostat_id) +} +inline ::int32_t NSPanelEntityState_Thermostat::_internal_thermostat_id() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.thermostat_id_; +} +inline void NSPanelEntityState_Thermostat::_internal_set_thermostat_id(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.thermostat_id_ = value; +} + +// string name = 2; +inline void NSPanelEntityState_Thermostat::clear_name() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.name_.ClearToEmpty(); +} +inline const std::string& NSPanelEntityState_Thermostat::name() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.name) + return _internal_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_Thermostat::set_name(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.name_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.name) +} +inline std::string* NSPanelEntityState_Thermostat::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_name(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Thermostat.name) + return _s; +} +inline const std::string& NSPanelEntityState_Thermostat::_internal_name() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.name_.Get(); +} +inline void NSPanelEntityState_Thermostat::_internal_set_name(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.name_.Set(value, GetArena()); +} +inline std::string* NSPanelEntityState_Thermostat::_internal_mutable_name() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.name_.Mutable( GetArena()); +} +inline std::string* NSPanelEntityState_Thermostat::release_name() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelEntityState.Thermostat.name) + return _impl_.name_.Release(); +} +inline void NSPanelEntityState_Thermostat::set_allocated_name(std::string* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.name_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.name_.IsDefault()) { + _impl_.name_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.Thermostat.name) +} + +// float current_temperature = 3; +inline void NSPanelEntityState_Thermostat::clear_current_temperature() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.current_temperature_ = 0; +} +inline float NSPanelEntityState_Thermostat::current_temperature() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.current_temperature) + return _internal_current_temperature(); +} +inline void NSPanelEntityState_Thermostat::set_current_temperature(float value) { + _internal_set_current_temperature(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.current_temperature) +} +inline float NSPanelEntityState_Thermostat::_internal_current_temperature() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.current_temperature_; +} +inline void NSPanelEntityState_Thermostat::_internal_set_current_temperature(float value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.current_temperature_ = value; +} + +// bool has_current_temperature = 4; +inline void NSPanelEntityState_Thermostat::clear_has_current_temperature() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.has_current_temperature_ = false; +} +inline bool NSPanelEntityState_Thermostat::has_current_temperature() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.has_current_temperature) + return _internal_has_current_temperature(); +} +inline void NSPanelEntityState_Thermostat::set_has_current_temperature(bool value) { + _internal_set_has_current_temperature(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.has_current_temperature) +} +inline bool NSPanelEntityState_Thermostat::_internal_has_current_temperature() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.has_current_temperature_; +} +inline void NSPanelEntityState_Thermostat::_internal_set_has_current_temperature(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.has_current_temperature_ = value; +} + +// float set_temperature = 5; +inline void NSPanelEntityState_Thermostat::clear_set_temperature() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.set_temperature_ = 0; +} +inline float NSPanelEntityState_Thermostat::set_temperature() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.set_temperature) + return _internal_set_temperature(); +} +inline void NSPanelEntityState_Thermostat::set_set_temperature(float value) { + _internal_set_set_temperature(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.set_temperature) +} +inline float NSPanelEntityState_Thermostat::_internal_set_temperature() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.set_temperature_; +} +inline void NSPanelEntityState_Thermostat::_internal_set_set_temperature(float value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.set_temperature_ = value; +} + +// float step_size = 6; +inline void NSPanelEntityState_Thermostat::clear_step_size() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.step_size_ = 0; +} +inline float NSPanelEntityState_Thermostat::step_size() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.step_size) + return _internal_step_size(); +} +inline void NSPanelEntityState_Thermostat::set_step_size(float value) { + _internal_set_step_size(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.step_size) +} +inline float NSPanelEntityState_Thermostat::_internal_step_size() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.step_size_; +} +inline void NSPanelEntityState_Thermostat::_internal_set_step_size(float value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.step_size_ = value; +} + +// repeated .NSPanelEntityState.Thermostat.ThermostatOption options = 7; +inline int NSPanelEntityState_Thermostat::_internal_options_size() const { + return _internal_options().size(); +} +inline int NSPanelEntityState_Thermostat::options_size() const { + return _internal_options_size(); +} +inline void NSPanelEntityState_Thermostat::clear_options() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.options_.Clear(); +} +inline ::NSPanelEntityState_Thermostat_ThermostatOption* NSPanelEntityState_Thermostat::mutable_options(int index) + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Thermostat.options) + return _internal_mutable_options()->Mutable(index); +} +inline ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption>* NSPanelEntityState_Thermostat::mutable_options() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_mutable_list:NSPanelEntityState.Thermostat.options) + ::google::protobuf::internal::TSanWrite(&_impl_); + return _internal_mutable_options(); +} +inline const ::NSPanelEntityState_Thermostat_ThermostatOption& NSPanelEntityState_Thermostat::options(int index) const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.options) + return _internal_options().Get(index); +} +inline ::NSPanelEntityState_Thermostat_ThermostatOption* NSPanelEntityState_Thermostat::add_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { + ::google::protobuf::internal::TSanWrite(&_impl_); + ::NSPanelEntityState_Thermostat_ThermostatOption* _add = _internal_mutable_options()->Add(); + // @@protoc_insertion_point(field_add:NSPanelEntityState.Thermostat.options) + return _add; +} +inline const ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption>& NSPanelEntityState_Thermostat::options() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_list:NSPanelEntityState.Thermostat.options) + return _internal_options(); +} +inline const ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption>& +NSPanelEntityState_Thermostat::_internal_options() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.options_; +} +inline ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption>* +NSPanelEntityState_Thermostat::_internal_mutable_options() { + ::google::protobuf::internal::TSanRead(&_impl_); + return &_impl_.options_; +} + +// ------------------------------------------------------------------- + +// NSPanelEntityState_MediaPlayer_SourceSelection + +// repeated string sources = 1; +inline int NSPanelEntityState_MediaPlayer_SourceSelection::_internal_sources_size() const { + return _internal_sources().size(); +} +inline int NSPanelEntityState_MediaPlayer_SourceSelection::sources_size() const { + return _internal_sources_size(); +} +inline void NSPanelEntityState_MediaPlayer_SourceSelection::clear_sources() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.sources_.Clear(); +} +inline std::string* NSPanelEntityState_MediaPlayer_SourceSelection::add_sources() + ABSL_ATTRIBUTE_LIFETIME_BOUND { + ::google::protobuf::internal::TSanWrite(&_impl_); + std::string* _s = _internal_mutable_sources()->Add(); + // @@protoc_insertion_point(field_add_mutable:NSPanelEntityState.MediaPlayer.SourceSelection.sources) + return _s; +} +inline const std::string& NSPanelEntityState_MediaPlayer_SourceSelection::sources(int index) const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.SourceSelection.sources) + return _internal_sources().Get(index); +} +inline std::string* NSPanelEntityState_MediaPlayer_SourceSelection::mutable_sources(int index) + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.MediaPlayer.SourceSelection.sources) + return _internal_mutable_sources()->Mutable(index); +} +inline void NSPanelEntityState_MediaPlayer_SourceSelection::set_sources(int index, const std::string& value) { + _internal_mutable_sources()->Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.SourceSelection.sources) +} +inline void NSPanelEntityState_MediaPlayer_SourceSelection::set_sources(int index, std::string&& value) { + _internal_mutable_sources()->Mutable(index)->assign(std::move(value)); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.SourceSelection.sources) +} +inline void NSPanelEntityState_MediaPlayer_SourceSelection::set_sources(int index, const char* value) { + ABSL_DCHECK(value != nullptr); + _internal_mutable_sources()->Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:NSPanelEntityState.MediaPlayer.SourceSelection.sources) +} +inline void NSPanelEntityState_MediaPlayer_SourceSelection::set_sources(int index, const char* value, + std::size_t size) { + _internal_mutable_sources()->Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:NSPanelEntityState.MediaPlayer.SourceSelection.sources) +} +inline void NSPanelEntityState_MediaPlayer_SourceSelection::set_sources(int index, absl::string_view value) { + _internal_mutable_sources()->Mutable(index)->assign( + value.data(), value.size()); + // @@protoc_insertion_point(field_set_string_piece:NSPanelEntityState.MediaPlayer.SourceSelection.sources) +} +inline void NSPanelEntityState_MediaPlayer_SourceSelection::add_sources(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _internal_mutable_sources()->Add()->assign(value); + // @@protoc_insertion_point(field_add:NSPanelEntityState.MediaPlayer.SourceSelection.sources) +} +inline void NSPanelEntityState_MediaPlayer_SourceSelection::add_sources(std::string&& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _internal_mutable_sources()->Add(std::move(value)); + // @@protoc_insertion_point(field_add:NSPanelEntityState.MediaPlayer.SourceSelection.sources) +} +inline void NSPanelEntityState_MediaPlayer_SourceSelection::add_sources(const char* value) { + ABSL_DCHECK(value != nullptr); + ::google::protobuf::internal::TSanWrite(&_impl_); + _internal_mutable_sources()->Add()->assign(value); + // @@protoc_insertion_point(field_add_char:NSPanelEntityState.MediaPlayer.SourceSelection.sources) +} +inline void NSPanelEntityState_MediaPlayer_SourceSelection::add_sources(const char* value, std::size_t size) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _internal_mutable_sources()->Add()->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:NSPanelEntityState.MediaPlayer.SourceSelection.sources) +} +inline void NSPanelEntityState_MediaPlayer_SourceSelection::add_sources(absl::string_view value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _internal_mutable_sources()->Add()->assign(value.data(), + value.size()); + // @@protoc_insertion_point(field_add_string_piece:NSPanelEntityState.MediaPlayer.SourceSelection.sources) +} +inline const ::google::protobuf::RepeatedPtrField& +NSPanelEntityState_MediaPlayer_SourceSelection::sources() const ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_list:NSPanelEntityState.MediaPlayer.SourceSelection.sources) + return _internal_sources(); +} +inline ::google::protobuf::RepeatedPtrField* +NSPanelEntityState_MediaPlayer_SourceSelection::mutable_sources() ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_mutable_list:NSPanelEntityState.MediaPlayer.SourceSelection.sources) + ::google::protobuf::internal::TSanWrite(&_impl_); + return _internal_mutable_sources(); +} +inline const ::google::protobuf::RepeatedPtrField& +NSPanelEntityState_MediaPlayer_SourceSelection::_internal_sources() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.sources_; +} +inline ::google::protobuf::RepeatedPtrField* +NSPanelEntityState_MediaPlayer_SourceSelection::_internal_mutable_sources() { + ::google::protobuf::internal::TSanRead(&_impl_); + return &_impl_.sources_; +} + +// string current_source = 2; +inline void NSPanelEntityState_MediaPlayer_SourceSelection::clear_current_source() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.current_source_.ClearToEmpty(); +} +inline const std::string& NSPanelEntityState_MediaPlayer_SourceSelection::current_source() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.SourceSelection.current_source) + return _internal_current_source(); +} +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_MediaPlayer_SourceSelection::set_current_source(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.current_source_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.SourceSelection.current_source) +} +inline std::string* NSPanelEntityState_MediaPlayer_SourceSelection::mutable_current_source() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_current_source(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.MediaPlayer.SourceSelection.current_source) + return _s; +} +inline const std::string& NSPanelEntityState_MediaPlayer_SourceSelection::_internal_current_source() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.current_source_.Get(); +} +inline void NSPanelEntityState_MediaPlayer_SourceSelection::_internal_set_current_source(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.current_source_.Set(value, GetArena()); +} +inline std::string* NSPanelEntityState_MediaPlayer_SourceSelection::_internal_mutable_current_source() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.current_source_.Mutable( GetArena()); +} +inline std::string* NSPanelEntityState_MediaPlayer_SourceSelection::release_current_source() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelEntityState.MediaPlayer.SourceSelection.current_source) + return _impl_.current_source_.Release(); +} +inline void NSPanelEntityState_MediaPlayer_SourceSelection::set_allocated_current_source(std::string* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.current_source_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.current_source_.IsDefault()) { + _impl_.current_source_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.MediaPlayer.SourceSelection.current_source) +} + +// bool can_select = 3; +inline void NSPanelEntityState_MediaPlayer_SourceSelection::clear_can_select() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_select_ = false; +} +inline bool NSPanelEntityState_MediaPlayer_SourceSelection::can_select() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.SourceSelection.can_select) + return _internal_can_select(); +} +inline void NSPanelEntityState_MediaPlayer_SourceSelection::set_can_select(bool value) { + _internal_set_can_select(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.SourceSelection.can_select) +} +inline bool NSPanelEntityState_MediaPlayer_SourceSelection::_internal_can_select() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.can_select_; +} +inline void NSPanelEntityState_MediaPlayer_SourceSelection::_internal_set_can_select(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_select_ = value; +} + +// ------------------------------------------------------------------- + +// NSPanelEntityState_MediaPlayer + +// int32 media_player_id = 1; +inline void NSPanelEntityState_MediaPlayer::clear_media_player_id() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.media_player_id_ = 0; +} +inline ::int32_t NSPanelEntityState_MediaPlayer::media_player_id() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.media_player_id) + return _internal_media_player_id(); +} +inline void NSPanelEntityState_MediaPlayer::set_media_player_id(::int32_t value) { + _internal_set_media_player_id(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.media_player_id) +} +inline ::int32_t NSPanelEntityState_MediaPlayer::_internal_media_player_id() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.media_player_id_; +} +inline void NSPanelEntityState_MediaPlayer::_internal_set_media_player_id(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.media_player_id_ = value; +} + +// string name = 2; +inline void NSPanelEntityState_MediaPlayer::clear_name() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.name_.ClearToEmpty(); +} +inline const std::string& NSPanelEntityState_MediaPlayer::name() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.name) + return _internal_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_MediaPlayer::set_name(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.name_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.name) +} +inline std::string* NSPanelEntityState_MediaPlayer::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_name(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.MediaPlayer.name) + return _s; +} +inline const std::string& NSPanelEntityState_MediaPlayer::_internal_name() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.name_.Get(); +} +inline void NSPanelEntityState_MediaPlayer::_internal_set_name(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.name_.Set(value, GetArena()); +} +inline std::string* NSPanelEntityState_MediaPlayer::_internal_mutable_name() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.name_.Mutable( GetArena()); +} +inline std::string* NSPanelEntityState_MediaPlayer::release_name() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelEntityState.MediaPlayer.name) + return _impl_.name_.Release(); +} +inline void NSPanelEntityState_MediaPlayer::set_allocated_name(std::string* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.name_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.name_.IsDefault()) { + _impl_.name_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.MediaPlayer.name) +} + +// .NSPanelEntityState.MediaPlayer.PlaybackState state = 3; +inline void NSPanelEntityState_MediaPlayer::clear_state() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.state_ = 0; +} +inline ::NSPanelEntityState_MediaPlayer_PlaybackState NSPanelEntityState_MediaPlayer::state() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.state) + return _internal_state(); +} +inline void NSPanelEntityState_MediaPlayer::set_state(::NSPanelEntityState_MediaPlayer_PlaybackState value) { + _internal_set_state(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.state) +} +inline ::NSPanelEntityState_MediaPlayer_PlaybackState NSPanelEntityState_MediaPlayer::_internal_state() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return static_cast<::NSPanelEntityState_MediaPlayer_PlaybackState>(_impl_.state_); +} +inline void NSPanelEntityState_MediaPlayer::_internal_set_state(::NSPanelEntityState_MediaPlayer_PlaybackState value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.state_ = value; +} + +// string media_title = 4; +inline void NSPanelEntityState_MediaPlayer::clear_media_title() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.media_title_.ClearToEmpty(); +} +inline const std::string& NSPanelEntityState_MediaPlayer::media_title() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.media_title) + return _internal_media_title(); } template -inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_Light::set_name(Arg_&& arg, +inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_MediaPlayer::set_media_title(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.name_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.name) + _impl_.media_title_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.media_title) } -inline std::string* NSPanelEntityState_Light::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { - std::string* _s = _internal_mutable_name(); - // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Light.name) +inline std::string* NSPanelEntityState_MediaPlayer::mutable_media_title() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_media_title(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.MediaPlayer.media_title) return _s; } -inline const std::string& NSPanelEntityState_Light::_internal_name() const { +inline const std::string& NSPanelEntityState_MediaPlayer::_internal_media_title() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.name_.Get(); + return _impl_.media_title_.Get(); } -inline void NSPanelEntityState_Light::_internal_set_name(const std::string& value) { +inline void NSPanelEntityState_MediaPlayer::_internal_set_media_title(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.name_.Set(value, GetArena()); + _impl_.media_title_.Set(value, GetArena()); } -inline std::string* NSPanelEntityState_Light::_internal_mutable_name() { +inline std::string* NSPanelEntityState_MediaPlayer::_internal_mutable_media_title() { ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.name_.Mutable( GetArena()); + return _impl_.media_title_.Mutable( GetArena()); } -inline std::string* NSPanelEntityState_Light::release_name() { +inline std::string* NSPanelEntityState_MediaPlayer::release_media_title() { ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:NSPanelEntityState.Light.name) - return _impl_.name_.Release(); + // @@protoc_insertion_point(field_release:NSPanelEntityState.MediaPlayer.media_title) + return _impl_.media_title_.Release(); } -inline void NSPanelEntityState_Light::set_allocated_name(std::string* value) { +inline void NSPanelEntityState_MediaPlayer::set_allocated_media_title(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.name_.SetAllocated(value, GetArena()); + _impl_.media_title_.SetAllocated(value, GetArena()); #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.name_.IsDefault()) { - _impl_.name_.Set("", GetArena()); + if (_impl_.media_title_.IsDefault()) { + _impl_.media_title_.Set("", GetArena()); } #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.Light.name) + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.MediaPlayer.media_title) } -// int32 brightness = 3; -inline void NSPanelEntityState_Light::clear_brightness() { +// string media_artist = 5; +inline void NSPanelEntityState_MediaPlayer::clear_media_artist() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.brightness_ = 0; + _impl_.media_artist_.ClearToEmpty(); } -inline ::int32_t NSPanelEntityState_Light::brightness() const { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.brightness) - return _internal_brightness(); +inline const std::string& NSPanelEntityState_MediaPlayer::media_artist() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.media_artist) + return _internal_media_artist(); } -inline void NSPanelEntityState_Light::set_brightness(::int32_t value) { - _internal_set_brightness(value); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.brightness) +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_MediaPlayer::set_media_artist(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.media_artist_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.media_artist) } -inline ::int32_t NSPanelEntityState_Light::_internal_brightness() const { +inline std::string* NSPanelEntityState_MediaPlayer::mutable_media_artist() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_media_artist(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.MediaPlayer.media_artist) + return _s; +} +inline const std::string& NSPanelEntityState_MediaPlayer::_internal_media_artist() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.brightness_; + return _impl_.media_artist_.Get(); } -inline void NSPanelEntityState_Light::_internal_set_brightness(::int32_t value) { +inline void NSPanelEntityState_MediaPlayer::_internal_set_media_artist(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.brightness_ = value; + _impl_.media_artist_.Set(value, GetArena()); +} +inline std::string* NSPanelEntityState_MediaPlayer::_internal_mutable_media_artist() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.media_artist_.Mutable( GetArena()); +} +inline std::string* NSPanelEntityState_MediaPlayer::release_media_artist() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelEntityState.MediaPlayer.media_artist) + return _impl_.media_artist_.Release(); +} +inline void NSPanelEntityState_MediaPlayer::set_allocated_media_artist(std::string* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.media_artist_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.media_artist_.IsDefault()) { + _impl_.media_artist_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.MediaPlayer.media_artist) } -// int32 color_temp = 4; -inline void NSPanelEntityState_Light::clear_color_temp() { +// int32 volume = 6; +inline void NSPanelEntityState_MediaPlayer::clear_volume() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.color_temp_ = 0; + _impl_.volume_ = 0; } -inline ::int32_t NSPanelEntityState_Light::color_temp() const { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.color_temp) - return _internal_color_temp(); +inline ::int32_t NSPanelEntityState_MediaPlayer::volume() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.volume) + return _internal_volume(); } -inline void NSPanelEntityState_Light::set_color_temp(::int32_t value) { - _internal_set_color_temp(value); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.color_temp) +inline void NSPanelEntityState_MediaPlayer::set_volume(::int32_t value) { + _internal_set_volume(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.volume) } -inline ::int32_t NSPanelEntityState_Light::_internal_color_temp() const { +inline ::int32_t NSPanelEntityState_MediaPlayer::_internal_volume() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.color_temp_; + return _impl_.volume_; } -inline void NSPanelEntityState_Light::_internal_set_color_temp(::int32_t value) { +inline void NSPanelEntityState_MediaPlayer::_internal_set_volume(::int32_t value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.color_temp_ = value; + _impl_.volume_ = value; } -// int32 hue = 5; -inline void NSPanelEntityState_Light::clear_hue() { +// bool is_muted = 7; +inline void NSPanelEntityState_MediaPlayer::clear_is_muted() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.hue_ = 0; + _impl_.is_muted_ = false; } -inline ::int32_t NSPanelEntityState_Light::hue() const { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.hue) - return _internal_hue(); +inline bool NSPanelEntityState_MediaPlayer::is_muted() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.is_muted) + return _internal_is_muted(); } -inline void NSPanelEntityState_Light::set_hue(::int32_t value) { - _internal_set_hue(value); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.hue) +inline void NSPanelEntityState_MediaPlayer::set_is_muted(bool value) { + _internal_set_is_muted(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.is_muted) } -inline ::int32_t NSPanelEntityState_Light::_internal_hue() const { +inline bool NSPanelEntityState_MediaPlayer::_internal_is_muted() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.hue_; + return _impl_.is_muted_; } -inline void NSPanelEntityState_Light::_internal_set_hue(::int32_t value) { +inline void NSPanelEntityState_MediaPlayer::_internal_set_is_muted(bool value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.hue_ = value; + _impl_.is_muted_ = value; } -// int32 saturation = 6; -inline void NSPanelEntityState_Light::clear_saturation() { +// bool has_source_volume = 8; +inline void NSPanelEntityState_MediaPlayer::clear_has_source_volume() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.saturation_ = 0; + _impl_.has_source_volume_ = false; } -inline ::int32_t NSPanelEntityState_Light::saturation() const { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.saturation) - return _internal_saturation(); +inline bool NSPanelEntityState_MediaPlayer::has_source_volume() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.has_source_volume) + return _internal_has_source_volume(); } -inline void NSPanelEntityState_Light::set_saturation(::int32_t value) { - _internal_set_saturation(value); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.saturation) +inline void NSPanelEntityState_MediaPlayer::set_has_source_volume(bool value) { + _internal_set_has_source_volume(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.has_source_volume) } -inline ::int32_t NSPanelEntityState_Light::_internal_saturation() const { +inline bool NSPanelEntityState_MediaPlayer::_internal_has_source_volume() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.saturation_; + return _impl_.has_source_volume_; } -inline void NSPanelEntityState_Light::_internal_set_saturation(::int32_t value) { +inline void NSPanelEntityState_MediaPlayer::_internal_set_has_source_volume(bool value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.saturation_ = value; + _impl_.has_source_volume_ = value; } -// bool can_color_temp = 7; -inline void NSPanelEntityState_Light::clear_can_color_temp() { +// int32 source_volume = 9; +inline void NSPanelEntityState_MediaPlayer::clear_source_volume() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.can_color_temp_ = false; + _impl_.source_volume_ = 0; } -inline bool NSPanelEntityState_Light::can_color_temp() const { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.can_color_temp) - return _internal_can_color_temp(); +inline ::int32_t NSPanelEntityState_MediaPlayer::source_volume() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.source_volume) + return _internal_source_volume(); } -inline void NSPanelEntityState_Light::set_can_color_temp(bool value) { - _internal_set_can_color_temp(value); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.can_color_temp) +inline void NSPanelEntityState_MediaPlayer::set_source_volume(::int32_t value) { + _internal_set_source_volume(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.source_volume) } -inline bool NSPanelEntityState_Light::_internal_can_color_temp() const { +inline ::int32_t NSPanelEntityState_MediaPlayer::_internal_source_volume() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.can_color_temp_; + return _impl_.source_volume_; } -inline void NSPanelEntityState_Light::_internal_set_can_color_temp(bool value) { +inline void NSPanelEntityState_MediaPlayer::_internal_set_source_volume(::int32_t value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.can_color_temp_ = value; + _impl_.source_volume_ = value; } -// bool can_color = 8; -inline void NSPanelEntityState_Light::clear_can_color() { +// bool can_play = 10; +inline void NSPanelEntityState_MediaPlayer::clear_can_play() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.can_color_ = false; + _impl_.can_play_ = false; } -inline bool NSPanelEntityState_Light::can_color() const { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.can_color) - return _internal_can_color(); +inline bool NSPanelEntityState_MediaPlayer::can_play() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.can_play) + return _internal_can_play(); } -inline void NSPanelEntityState_Light::set_can_color(bool value) { - _internal_set_can_color(value); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.can_color) +inline void NSPanelEntityState_MediaPlayer::set_can_play(bool value) { + _internal_set_can_play(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.can_play) } -inline bool NSPanelEntityState_Light::_internal_can_color() const { +inline bool NSPanelEntityState_MediaPlayer::_internal_can_play() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.can_color_; + return _impl_.can_play_; } -inline void NSPanelEntityState_Light::_internal_set_can_color(bool value) { +inline void NSPanelEntityState_MediaPlayer::_internal_set_can_play(bool value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.can_color_ = value; + _impl_.can_play_ = value; } -// .NSPanelEntityState.Light.LightMode current_light_mode = 9; -inline void NSPanelEntityState_Light::clear_current_light_mode() { +// bool can_pause = 11; +inline void NSPanelEntityState_MediaPlayer::clear_can_pause() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.current_light_mode_ = 0; + _impl_.can_pause_ = false; } -inline ::NSPanelEntityState_Light_LightMode NSPanelEntityState_Light::current_light_mode() const { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.current_light_mode) - return _internal_current_light_mode(); +inline bool NSPanelEntityState_MediaPlayer::can_pause() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.can_pause) + return _internal_can_pause(); } -inline void NSPanelEntityState_Light::set_current_light_mode(::NSPanelEntityState_Light_LightMode value) { - _internal_set_current_light_mode(value); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.current_light_mode) +inline void NSPanelEntityState_MediaPlayer::set_can_pause(bool value) { + _internal_set_can_pause(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.can_pause) } -inline ::NSPanelEntityState_Light_LightMode NSPanelEntityState_Light::_internal_current_light_mode() const { +inline bool NSPanelEntityState_MediaPlayer::_internal_can_pause() const { ::google::protobuf::internal::TSanRead(&_impl_); - return static_cast<::NSPanelEntityState_Light_LightMode>(_impl_.current_light_mode_); + return _impl_.can_pause_; +} +inline void NSPanelEntityState_MediaPlayer::_internal_set_can_pause(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_pause_ = value; +} + +// bool can_next_track = 12; +inline void NSPanelEntityState_MediaPlayer::clear_can_next_track() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_next_track_ = false; +} +inline bool NSPanelEntityState_MediaPlayer::can_next_track() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.can_next_track) + return _internal_can_next_track(); +} +inline void NSPanelEntityState_MediaPlayer::set_can_next_track(bool value) { + _internal_set_can_next_track(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.can_next_track) +} +inline bool NSPanelEntityState_MediaPlayer::_internal_can_next_track() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.can_next_track_; +} +inline void NSPanelEntityState_MediaPlayer::_internal_set_can_next_track(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_next_track_ = value; +} + +// bool can_previous_track = 13; +inline void NSPanelEntityState_MediaPlayer::clear_can_previous_track() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_previous_track_ = false; +} +inline bool NSPanelEntityState_MediaPlayer::can_previous_track() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.can_previous_track) + return _internal_can_previous_track(); +} +inline void NSPanelEntityState_MediaPlayer::set_can_previous_track(bool value) { + _internal_set_can_previous_track(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.can_previous_track) +} +inline bool NSPanelEntityState_MediaPlayer::_internal_can_previous_track() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.can_previous_track_; +} +inline void NSPanelEntityState_MediaPlayer::_internal_set_can_previous_track(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_previous_track_ = value; +} + +// bool can_set_volume = 14; +inline void NSPanelEntityState_MediaPlayer::clear_can_set_volume() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_set_volume_ = false; +} +inline bool NSPanelEntityState_MediaPlayer::can_set_volume() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.can_set_volume) + return _internal_can_set_volume(); +} +inline void NSPanelEntityState_MediaPlayer::set_can_set_volume(bool value) { + _internal_set_can_set_volume(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.can_set_volume) +} +inline bool NSPanelEntityState_MediaPlayer::_internal_can_set_volume() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.can_set_volume_; +} +inline void NSPanelEntityState_MediaPlayer::_internal_set_can_set_volume(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_set_volume_ = value; +} + +// bool can_mute = 15; +inline void NSPanelEntityState_MediaPlayer::clear_can_mute() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_mute_ = false; +} +inline bool NSPanelEntityState_MediaPlayer::can_mute() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.can_mute) + return _internal_can_mute(); +} +inline void NSPanelEntityState_MediaPlayer::set_can_mute(bool value) { + _internal_set_can_mute(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.can_mute) +} +inline bool NSPanelEntityState_MediaPlayer::_internal_can_mute() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.can_mute_; +} +inline void NSPanelEntityState_MediaPlayer::_internal_set_can_mute(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_mute_ = value; +} + +// string album_art_url = 16; +inline void NSPanelEntityState_MediaPlayer::clear_album_art_url() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.album_art_url_.ClearToEmpty(); +} +inline const std::string& NSPanelEntityState_MediaPlayer::album_art_url() const + ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.album_art_url) + return _internal_album_art_url(); +} +template +inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_MediaPlayer::set_album_art_url(Arg_&& arg, + Args_... args) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.album_art_url_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.album_art_url) +} +inline std::string* NSPanelEntityState_MediaPlayer::mutable_album_art_url() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_album_art_url(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.MediaPlayer.album_art_url) + return _s; +} +inline const std::string& NSPanelEntityState_MediaPlayer::_internal_album_art_url() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.album_art_url_.Get(); +} +inline void NSPanelEntityState_MediaPlayer::_internal_set_album_art_url(const std::string& value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.album_art_url_.Set(value, GetArena()); +} +inline std::string* NSPanelEntityState_MediaPlayer::_internal_mutable_album_art_url() { + ::google::protobuf::internal::TSanWrite(&_impl_); + return _impl_.album_art_url_.Mutable( GetArena()); +} +inline std::string* NSPanelEntityState_MediaPlayer::release_album_art_url() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelEntityState.MediaPlayer.album_art_url) + return _impl_.album_art_url_.Release(); +} +inline void NSPanelEntityState_MediaPlayer::set_allocated_album_art_url(std::string* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.album_art_url_.SetAllocated(value, GetArena()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.album_art_url_.IsDefault()) { + _impl_.album_art_url_.Set("", GetArena()); + } + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.MediaPlayer.album_art_url) +} + +// int32 volume_step = 17; +inline void NSPanelEntityState_MediaPlayer::clear_volume_step() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.volume_step_ = 0; +} +inline ::int32_t NSPanelEntityState_MediaPlayer::volume_step() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.volume_step) + return _internal_volume_step(); +} +inline void NSPanelEntityState_MediaPlayer::set_volume_step(::int32_t value) { + _internal_set_volume_step(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.volume_step) +} +inline ::int32_t NSPanelEntityState_MediaPlayer::_internal_volume_step() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.volume_step_; +} +inline void NSPanelEntityState_MediaPlayer::_internal_set_volume_step(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.volume_step_ = value; +} + +// .NSPanelEntityState.MediaPlayer.SourceSelection player_sources = 18; +inline bool NSPanelEntityState_MediaPlayer::has_player_sources() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || _impl_.player_sources_ != nullptr); + return value; +} +inline void NSPanelEntityState_MediaPlayer::clear_player_sources() { + ::google::protobuf::internal::TSanWrite(&_impl_); + if (_impl_.player_sources_ != nullptr) _impl_.player_sources_->Clear(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const ::NSPanelEntityState_MediaPlayer_SourceSelection& NSPanelEntityState_MediaPlayer::_internal_player_sources() const { + ::google::protobuf::internal::TSanRead(&_impl_); + const ::NSPanelEntityState_MediaPlayer_SourceSelection* p = _impl_.player_sources_; + return p != nullptr ? *p : reinterpret_cast(::_NSPanelEntityState_MediaPlayer_SourceSelection_default_instance_); +} +inline const ::NSPanelEntityState_MediaPlayer_SourceSelection& NSPanelEntityState_MediaPlayer::player_sources() const ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.player_sources) + return _internal_player_sources(); +} +inline void NSPanelEntityState_MediaPlayer::unsafe_arena_set_allocated_player_sources(::NSPanelEntityState_MediaPlayer_SourceSelection* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + if (GetArena() == nullptr) { + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.player_sources_); + } + _impl_.player_sources_ = reinterpret_cast<::NSPanelEntityState_MediaPlayer_SourceSelection*>(value); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:NSPanelEntityState.MediaPlayer.player_sources) +} +inline ::NSPanelEntityState_MediaPlayer_SourceSelection* NSPanelEntityState_MediaPlayer::release_player_sources() { + ::google::protobuf::internal::TSanWrite(&_impl_); + + _impl_._has_bits_[0] &= ~0x00000001u; + ::NSPanelEntityState_MediaPlayer_SourceSelection* released = _impl_.player_sources_; + _impl_.player_sources_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released); + released = ::google::protobuf::internal::DuplicateIfNonNull(released); + if (GetArena() == nullptr) { + delete old; + } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArena() != nullptr) { + released = ::google::protobuf::internal::DuplicateIfNonNull(released); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return released; +} +inline ::NSPanelEntityState_MediaPlayer_SourceSelection* NSPanelEntityState_MediaPlayer::unsafe_arena_release_player_sources() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelEntityState.MediaPlayer.player_sources) + + _impl_._has_bits_[0] &= ~0x00000001u; + ::NSPanelEntityState_MediaPlayer_SourceSelection* temp = _impl_.player_sources_; + _impl_.player_sources_ = nullptr; + return temp; +} +inline ::NSPanelEntityState_MediaPlayer_SourceSelection* NSPanelEntityState_MediaPlayer::_internal_mutable_player_sources() { + ::google::protobuf::internal::TSanWrite(&_impl_); + if (_impl_.player_sources_ == nullptr) { + auto* p = ::google::protobuf::Message::DefaultConstruct<::NSPanelEntityState_MediaPlayer_SourceSelection>(GetArena()); + _impl_.player_sources_ = reinterpret_cast<::NSPanelEntityState_MediaPlayer_SourceSelection*>(p); + } + return _impl_.player_sources_; +} +inline ::NSPanelEntityState_MediaPlayer_SourceSelection* NSPanelEntityState_MediaPlayer::mutable_player_sources() ABSL_ATTRIBUTE_LIFETIME_BOUND { + _impl_._has_bits_[0] |= 0x00000001u; + ::NSPanelEntityState_MediaPlayer_SourceSelection* _msg = _internal_mutable_player_sources(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.MediaPlayer.player_sources) + return _msg; +} +inline void NSPanelEntityState_MediaPlayer::set_allocated_player_sources(::NSPanelEntityState_MediaPlayer_SourceSelection* value) { + ::google::protobuf::Arena* message_arena = GetArena(); + ::google::protobuf::internal::TSanWrite(&_impl_); + if (message_arena == nullptr) { + delete (_impl_.player_sources_); + } + + if (value != nullptr) { + ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + if (message_arena != submessage_arena) { + value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + + _impl_.player_sources_ = reinterpret_cast<::NSPanelEntityState_MediaPlayer_SourceSelection*>(value); + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.MediaPlayer.player_sources) +} + +// .NSPanelEntityState.MediaPlayer.SourceSelection source_player_sources = 19; +inline bool NSPanelEntityState_MediaPlayer::has_source_player_sources() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || _impl_.source_player_sources_ != nullptr); + return value; +} +inline void NSPanelEntityState_MediaPlayer::clear_source_player_sources() { + ::google::protobuf::internal::TSanWrite(&_impl_); + if (_impl_.source_player_sources_ != nullptr) _impl_.source_player_sources_->Clear(); + _impl_._has_bits_[0] &= ~0x00000002u; +} +inline const ::NSPanelEntityState_MediaPlayer_SourceSelection& NSPanelEntityState_MediaPlayer::_internal_source_player_sources() const { + ::google::protobuf::internal::TSanRead(&_impl_); + const ::NSPanelEntityState_MediaPlayer_SourceSelection* p = _impl_.source_player_sources_; + return p != nullptr ? *p : reinterpret_cast(::_NSPanelEntityState_MediaPlayer_SourceSelection_default_instance_); +} +inline const ::NSPanelEntityState_MediaPlayer_SourceSelection& NSPanelEntityState_MediaPlayer::source_player_sources() const ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.source_player_sources) + return _internal_source_player_sources(); +} +inline void NSPanelEntityState_MediaPlayer::unsafe_arena_set_allocated_source_player_sources(::NSPanelEntityState_MediaPlayer_SourceSelection* value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + if (GetArena() == nullptr) { + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.source_player_sources_); + } + _impl_.source_player_sources_ = reinterpret_cast<::NSPanelEntityState_MediaPlayer_SourceSelection*>(value); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:NSPanelEntityState.MediaPlayer.source_player_sources) +} +inline ::NSPanelEntityState_MediaPlayer_SourceSelection* NSPanelEntityState_MediaPlayer::release_source_player_sources() { + ::google::protobuf::internal::TSanWrite(&_impl_); + + _impl_._has_bits_[0] &= ~0x00000002u; + ::NSPanelEntityState_MediaPlayer_SourceSelection* released = _impl_.source_player_sources_; + _impl_.source_player_sources_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released); + released = ::google::protobuf::internal::DuplicateIfNonNull(released); + if (GetArena() == nullptr) { + delete old; + } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArena() != nullptr) { + released = ::google::protobuf::internal::DuplicateIfNonNull(released); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return released; +} +inline ::NSPanelEntityState_MediaPlayer_SourceSelection* NSPanelEntityState_MediaPlayer::unsafe_arena_release_source_player_sources() { + ::google::protobuf::internal::TSanWrite(&_impl_); + // @@protoc_insertion_point(field_release:NSPanelEntityState.MediaPlayer.source_player_sources) + + _impl_._has_bits_[0] &= ~0x00000002u; + ::NSPanelEntityState_MediaPlayer_SourceSelection* temp = _impl_.source_player_sources_; + _impl_.source_player_sources_ = nullptr; + return temp; +} +inline ::NSPanelEntityState_MediaPlayer_SourceSelection* NSPanelEntityState_MediaPlayer::_internal_mutable_source_player_sources() { + ::google::protobuf::internal::TSanWrite(&_impl_); + if (_impl_.source_player_sources_ == nullptr) { + auto* p = ::google::protobuf::Message::DefaultConstruct<::NSPanelEntityState_MediaPlayer_SourceSelection>(GetArena()); + _impl_.source_player_sources_ = reinterpret_cast<::NSPanelEntityState_MediaPlayer_SourceSelection*>(p); + } + return _impl_.source_player_sources_; +} +inline ::NSPanelEntityState_MediaPlayer_SourceSelection* NSPanelEntityState_MediaPlayer::mutable_source_player_sources() ABSL_ATTRIBUTE_LIFETIME_BOUND { + _impl_._has_bits_[0] |= 0x00000002u; + ::NSPanelEntityState_MediaPlayer_SourceSelection* _msg = _internal_mutable_source_player_sources(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.MediaPlayer.source_player_sources) + return _msg; } -inline void NSPanelEntityState_Light::_internal_set_current_light_mode(::NSPanelEntityState_Light_LightMode value) { +inline void NSPanelEntityState_MediaPlayer::set_allocated_source_player_sources(::NSPanelEntityState_MediaPlayer_SourceSelection* value) { + ::google::protobuf::Arena* message_arena = GetArena(); ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.current_light_mode_ = value; + if (message_arena == nullptr) { + delete (_impl_.source_player_sources_); + } + + if (value != nullptr) { + ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); + if (message_arena != submessage_arena) { + value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } + + _impl_.source_player_sources_ = reinterpret_cast<::NSPanelEntityState_MediaPlayer_SourceSelection*>(value); + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.MediaPlayer.source_player_sources) } -// bool state = 10; -inline void NSPanelEntityState_Light::clear_state() { +// bool has_media_position = 20; +inline void NSPanelEntityState_MediaPlayer::clear_has_media_position() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.state_ = false; + _impl_.has_media_position_ = false; } -inline bool NSPanelEntityState_Light::state() const { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Light.state) - return _internal_state(); +inline bool NSPanelEntityState_MediaPlayer::has_media_position() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.has_media_position) + return _internal_has_media_position(); } -inline void NSPanelEntityState_Light::set_state(bool value) { - _internal_set_state(value); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Light.state) +inline void NSPanelEntityState_MediaPlayer::set_has_media_position(bool value) { + _internal_set_has_media_position(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.has_media_position) } -inline bool NSPanelEntityState_Light::_internal_state() const { +inline bool NSPanelEntityState_MediaPlayer::_internal_has_media_position() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.state_; + return _impl_.has_media_position_; } -inline void NSPanelEntityState_Light::_internal_set_state(bool value) { +inline void NSPanelEntityState_MediaPlayer::_internal_set_has_media_position(bool value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.state_ = value; + _impl_.has_media_position_ = value; } -// ------------------------------------------------------------------- - -// NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue - -// string value = 1; -inline void NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::clear_value() { +// int32 media_position = 21; +inline void NSPanelEntityState_MediaPlayer::clear_media_position() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.value_.ClearToEmpty(); -} -inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::value() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.value) - return _internal_value(); + _impl_.media_position_ = 0; } -template -inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::set_value(Arg_&& arg, - Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.value_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.value) +inline ::int32_t NSPanelEntityState_MediaPlayer::media_position() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.media_position) + return _internal_media_position(); } -inline std::string* NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::mutable_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { - std::string* _s = _internal_mutable_value(); - // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.value) - return _s; +inline void NSPanelEntityState_MediaPlayer::set_media_position(::int32_t value) { + _internal_set_media_position(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.media_position) } -inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::_internal_value() const { +inline ::int32_t NSPanelEntityState_MediaPlayer::_internal_media_position() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.value_.Get(); + return _impl_.media_position_; } -inline void NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::_internal_set_value(const std::string& value) { +inline void NSPanelEntityState_MediaPlayer::_internal_set_media_position(::int32_t value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.value_.Set(value, GetArena()); + _impl_.media_position_ = value; } -inline std::string* NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::_internal_mutable_value() { + +// int64 media_position_updated_at = 22; +inline void NSPanelEntityState_MediaPlayer::clear_media_position_updated_at() { ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.value_.Mutable( GetArena()); + _impl_.media_position_updated_at_ = ::int64_t{0}; } -inline std::string* NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::release_value() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.value) - return _impl_.value_.Release(); +inline ::int64_t NSPanelEntityState_MediaPlayer::media_position_updated_at() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.media_position_updated_at) + return _internal_media_position_updated_at(); } -inline void NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::set_allocated_value(std::string* value) { +inline void NSPanelEntityState_MediaPlayer::set_media_position_updated_at(::int64_t value) { + _internal_set_media_position_updated_at(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.media_position_updated_at) +} +inline ::int64_t NSPanelEntityState_MediaPlayer::_internal_media_position_updated_at() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.media_position_updated_at_; +} +inline void NSPanelEntityState_MediaPlayer::_internal_set_media_position_updated_at(::int64_t value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.value_.SetAllocated(value, GetArena()); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.value_.IsDefault()) { - _impl_.value_.Set("", GetArena()); - } - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.value) + _impl_.media_position_updated_at_ = value; } -// string icon = 2; -inline void NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::clear_icon() { +// int32 media_duration = 23; +inline void NSPanelEntityState_MediaPlayer::clear_media_duration() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.icon_.ClearToEmpty(); -} -inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::icon() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.icon) - return _internal_icon(); + _impl_.media_duration_ = 0; } -template -inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::set_icon(Arg_&& arg, - Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.icon_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.icon) +inline ::int32_t NSPanelEntityState_MediaPlayer::media_duration() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.MediaPlayer.media_duration) + return _internal_media_duration(); } -inline std::string* NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::mutable_icon() ABSL_ATTRIBUTE_LIFETIME_BOUND { - std::string* _s = _internal_mutable_icon(); - // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.icon) - return _s; +inline void NSPanelEntityState_MediaPlayer::set_media_duration(::int32_t value) { + _internal_set_media_duration(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.MediaPlayer.media_duration) } -inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::_internal_icon() const { +inline ::int32_t NSPanelEntityState_MediaPlayer::_internal_media_duration() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.icon_.Get(); + return _impl_.media_duration_; } -inline void NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::_internal_set_icon(const std::string& value) { +inline void NSPanelEntityState_MediaPlayer::_internal_set_media_duration(::int32_t value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.icon_.Set(value, GetArena()); + _impl_.media_duration_ = value; } -inline std::string* NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::_internal_mutable_icon() { + +// ------------------------------------------------------------------- + +// NSPanelEntityState_Cover + +// int32 cover_id = 1; +inline void NSPanelEntityState_Cover::clear_cover_id() { ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.icon_.Mutable( GetArena()); + _impl_.cover_id_ = 0; } -inline std::string* NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::release_icon() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.icon) - return _impl_.icon_.Release(); +inline ::int32_t NSPanelEntityState_Cover::cover_id() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.cover_id) + return _internal_cover_id(); } -inline void NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue::set_allocated_icon(std::string* value) { +inline void NSPanelEntityState_Cover::set_cover_id(::int32_t value) { + _internal_set_cover_id(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.cover_id) +} +inline ::int32_t NSPanelEntityState_Cover::_internal_cover_id() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.cover_id_; +} +inline void NSPanelEntityState_Cover::_internal_set_cover_id(::int32_t value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.icon_.SetAllocated(value, GetArena()); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.icon_.IsDefault()) { - _impl_.icon_.Set("", GetArena()); - } - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue.icon) + _impl_.cover_id_ = value; } -// ------------------------------------------------------------------- - -// NSPanelEntityState_Thermostat_ThermostatOption - -// string name = 1; -inline void NSPanelEntityState_Thermostat_ThermostatOption::clear_name() { +// string name = 2; +inline void NSPanelEntityState_Cover::clear_name() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.ClearToEmpty(); } -inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption::name() const +inline const std::string& NSPanelEntityState_Cover::name() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.ThermostatOption.name) + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.name) return _internal_name(); } template -inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_Thermostat_ThermostatOption::set_name(Arg_&& arg, +inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_Cover::set_name(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.ThermostatOption.name) + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.name) } -inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { +inline std::string* NSPanelEntityState_Cover::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { std::string* _s = _internal_mutable_name(); - // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Thermostat.ThermostatOption.name) + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Cover.name) return _s; } -inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption::_internal_name() const { +inline const std::string& NSPanelEntityState_Cover::_internal_name() const { ::google::protobuf::internal::TSanRead(&_impl_); return _impl_.name_.Get(); } -inline void NSPanelEntityState_Thermostat_ThermostatOption::_internal_set_name(const std::string& value) { +inline void NSPanelEntityState_Cover::_internal_set_name(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.Set(value, GetArena()); } -inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::_internal_mutable_name() { +inline std::string* NSPanelEntityState_Cover::_internal_mutable_name() { ::google::protobuf::internal::TSanWrite(&_impl_); return _impl_.name_.Mutable( GetArena()); } -inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::release_name() { +inline std::string* NSPanelEntityState_Cover::release_name() { ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:NSPanelEntityState.Thermostat.ThermostatOption.name) + // @@protoc_insertion_point(field_release:NSPanelEntityState.Cover.name) return _impl_.name_.Release(); } -inline void NSPanelEntityState_Thermostat_ThermostatOption::set_allocated_name(std::string* value) { +inline void NSPanelEntityState_Cover::set_allocated_name(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.name_.SetAllocated(value, GetArena()); #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING @@ -1735,369 +4425,475 @@ inline void NSPanelEntityState_Thermostat_ThermostatOption::set_allocated_name(s _impl_.name_.Set("", GetArena()); } #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.Thermostat.ThermostatOption.name) + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.Cover.name) } -// string current_value = 2; -inline void NSPanelEntityState_Thermostat_ThermostatOption::clear_current_value() { +// .NSPanelEntityState.Cover.CoverState state = 3; +inline void NSPanelEntityState_Cover::clear_state() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.current_value_.ClearToEmpty(); + _impl_.state_ = 0; } -inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption::current_value() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.ThermostatOption.current_value) - return _internal_current_value(); +inline ::NSPanelEntityState_Cover_CoverState NSPanelEntityState_Cover::state() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.state) + return _internal_state(); } -template -inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_Thermostat_ThermostatOption::set_current_value(Arg_&& arg, - Args_... args) { +inline void NSPanelEntityState_Cover::set_state(::NSPanelEntityState_Cover_CoverState value) { + _internal_set_state(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.state) +} +inline ::NSPanelEntityState_Cover_CoverState NSPanelEntityState_Cover::_internal_state() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return static_cast<::NSPanelEntityState_Cover_CoverState>(_impl_.state_); +} +inline void NSPanelEntityState_Cover::_internal_set_state(::NSPanelEntityState_Cover_CoverState value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.current_value_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.ThermostatOption.current_value) + _impl_.state_ = value; } -inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::mutable_current_value() ABSL_ATTRIBUTE_LIFETIME_BOUND { - std::string* _s = _internal_mutable_current_value(); - // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Thermostat.ThermostatOption.current_value) - return _s; + +// bool has_position = 4; +inline void NSPanelEntityState_Cover::clear_has_position() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.has_position_ = false; } -inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption::_internal_current_value() const { +inline bool NSPanelEntityState_Cover::has_position() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.has_position) + return _internal_has_position(); +} +inline void NSPanelEntityState_Cover::set_has_position(bool value) { + _internal_set_has_position(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.has_position) +} +inline bool NSPanelEntityState_Cover::_internal_has_position() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.current_value_.Get(); + return _impl_.has_position_; } -inline void NSPanelEntityState_Thermostat_ThermostatOption::_internal_set_current_value(const std::string& value) { +inline void NSPanelEntityState_Cover::_internal_set_has_position(bool value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.current_value_.Set(value, GetArena()); + _impl_.has_position_ = value; } -inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::_internal_mutable_current_value() { + +// int32 position = 5; +inline void NSPanelEntityState_Cover::clear_position() { ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.current_value_.Mutable( GetArena()); + _impl_.position_ = 0; } -inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::release_current_value() { +inline ::int32_t NSPanelEntityState_Cover::position() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.position) + return _internal_position(); +} +inline void NSPanelEntityState_Cover::set_position(::int32_t value) { + _internal_set_position(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.position) +} +inline ::int32_t NSPanelEntityState_Cover::_internal_position() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.position_; +} +inline void NSPanelEntityState_Cover::_internal_set_position(::int32_t value) { ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:NSPanelEntityState.Thermostat.ThermostatOption.current_value) - return _impl_.current_value_.Release(); + _impl_.position_ = value; } -inline void NSPanelEntityState_Thermostat_ThermostatOption::set_allocated_current_value(std::string* value) { + +// bool has_tilt_position = 6; +inline void NSPanelEntityState_Cover::clear_has_tilt_position() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.current_value_.SetAllocated(value, GetArena()); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.current_value_.IsDefault()) { - _impl_.current_value_.Set("", GetArena()); - } - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.Thermostat.ThermostatOption.current_value) + _impl_.has_tilt_position_ = false; +} +inline bool NSPanelEntityState_Cover::has_tilt_position() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.has_tilt_position) + return _internal_has_tilt_position(); +} +inline void NSPanelEntityState_Cover::set_has_tilt_position(bool value) { + _internal_set_has_tilt_position(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.has_tilt_position) +} +inline bool NSPanelEntityState_Cover::_internal_has_tilt_position() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.has_tilt_position_; +} +inline void NSPanelEntityState_Cover::_internal_set_has_tilt_position(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.has_tilt_position_ = value; } -// string current_icon = 3; -inline void NSPanelEntityState_Thermostat_ThermostatOption::clear_current_icon() { +// int32 tilt_position = 7; +inline void NSPanelEntityState_Cover::clear_tilt_position() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.current_icon_.ClearToEmpty(); + _impl_.tilt_position_ = 0; } -inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption::current_icon() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.ThermostatOption.current_icon) - return _internal_current_icon(); +inline ::int32_t NSPanelEntityState_Cover::tilt_position() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.tilt_position) + return _internal_tilt_position(); } -template -inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_Thermostat_ThermostatOption::set_current_icon(Arg_&& arg, - Args_... args) { +inline void NSPanelEntityState_Cover::set_tilt_position(::int32_t value) { + _internal_set_tilt_position(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.tilt_position) +} +inline ::int32_t NSPanelEntityState_Cover::_internal_tilt_position() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.tilt_position_; +} +inline void NSPanelEntityState_Cover::_internal_set_tilt_position(::int32_t value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.current_icon_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.ThermostatOption.current_icon) + _impl_.tilt_position_ = value; } -inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::mutable_current_icon() ABSL_ATTRIBUTE_LIFETIME_BOUND { - std::string* _s = _internal_mutable_current_icon(); - // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Thermostat.ThermostatOption.current_icon) - return _s; + +// bool can_open = 8; +inline void NSPanelEntityState_Cover::clear_can_open() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_open_ = false; } -inline const std::string& NSPanelEntityState_Thermostat_ThermostatOption::_internal_current_icon() const { +inline bool NSPanelEntityState_Cover::can_open() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.can_open) + return _internal_can_open(); +} +inline void NSPanelEntityState_Cover::set_can_open(bool value) { + _internal_set_can_open(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.can_open) +} +inline bool NSPanelEntityState_Cover::_internal_can_open() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.current_icon_.Get(); + return _impl_.can_open_; } -inline void NSPanelEntityState_Thermostat_ThermostatOption::_internal_set_current_icon(const std::string& value) { +inline void NSPanelEntityState_Cover::_internal_set_can_open(bool value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.current_icon_.Set(value, GetArena()); + _impl_.can_open_ = value; } -inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::_internal_mutable_current_icon() { + +// bool can_close = 9; +inline void NSPanelEntityState_Cover::clear_can_close() { ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.current_icon_.Mutable( GetArena()); + _impl_.can_close_ = false; } -inline std::string* NSPanelEntityState_Thermostat_ThermostatOption::release_current_icon() { +inline bool NSPanelEntityState_Cover::can_close() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.can_close) + return _internal_can_close(); +} +inline void NSPanelEntityState_Cover::set_can_close(bool value) { + _internal_set_can_close(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.can_close) +} +inline bool NSPanelEntityState_Cover::_internal_can_close() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.can_close_; +} +inline void NSPanelEntityState_Cover::_internal_set_can_close(bool value) { ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:NSPanelEntityState.Thermostat.ThermostatOption.current_icon) - return _impl_.current_icon_.Release(); + _impl_.can_close_ = value; } -inline void NSPanelEntityState_Thermostat_ThermostatOption::set_allocated_current_icon(std::string* value) { + +// bool can_stop = 10; +inline void NSPanelEntityState_Cover::clear_can_stop() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.current_icon_.SetAllocated(value, GetArena()); - #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.current_icon_.IsDefault()) { - _impl_.current_icon_.Set("", GetArena()); - } - #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.Thermostat.ThermostatOption.current_icon) + _impl_.can_stop_ = false; +} +inline bool NSPanelEntityState_Cover::can_stop() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.can_stop) + return _internal_can_stop(); +} +inline void NSPanelEntityState_Cover::set_can_stop(bool value) { + _internal_set_can_stop(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.can_stop) +} +inline bool NSPanelEntityState_Cover::_internal_can_stop() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.can_stop_; +} +inline void NSPanelEntityState_Cover::_internal_set_can_stop(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_stop_ = value; } -// repeated .NSPanelEntityState.Thermostat.ThermostatOption.ThermostatOptionValue options = 4; -inline int NSPanelEntityState_Thermostat_ThermostatOption::_internal_options_size() const { - return _internal_options().size(); +// bool can_set_position = 11; +inline void NSPanelEntityState_Cover::clear_can_set_position() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_set_position_ = false; } -inline int NSPanelEntityState_Thermostat_ThermostatOption::options_size() const { - return _internal_options_size(); +inline bool NSPanelEntityState_Cover::can_set_position() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.can_set_position) + return _internal_can_set_position(); } -inline void NSPanelEntityState_Thermostat_ThermostatOption::clear_options() { +inline void NSPanelEntityState_Cover::set_can_set_position(bool value) { + _internal_set_can_set_position(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.can_set_position) +} +inline bool NSPanelEntityState_Cover::_internal_can_set_position() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.can_set_position_; +} +inline void NSPanelEntityState_Cover::_internal_set_can_set_position(bool value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.options_.Clear(); + _impl_.can_set_position_ = value; } -inline ::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue* NSPanelEntityState_Thermostat_ThermostatOption::mutable_options(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Thermostat.ThermostatOption.options) - return _internal_mutable_options()->Mutable(index); + +// bool can_open_tilt = 12; +inline void NSPanelEntityState_Cover::clear_can_open_tilt() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_open_tilt_ = false; +} +inline bool NSPanelEntityState_Cover::can_open_tilt() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.can_open_tilt) + return _internal_can_open_tilt(); +} +inline void NSPanelEntityState_Cover::set_can_open_tilt(bool value) { + _internal_set_can_open_tilt(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.can_open_tilt) +} +inline bool NSPanelEntityState_Cover::_internal_can_open_tilt() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.can_open_tilt_; } -inline ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue>* NSPanelEntityState_Thermostat_ThermostatOption::mutable_options() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable_list:NSPanelEntityState.Thermostat.ThermostatOption.options) +inline void NSPanelEntityState_Cover::_internal_set_can_open_tilt(bool value) { ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_options(); -} -inline const ::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue& NSPanelEntityState_Thermostat_ThermostatOption::options(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.ThermostatOption.options) - return _internal_options().Get(index); + _impl_.can_open_tilt_ = value; } -inline ::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue* NSPanelEntityState_Thermostat_ThermostatOption::add_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { + +// bool can_close_tilt = 13; +inline void NSPanelEntityState_Cover::clear_can_close_tilt() { ::google::protobuf::internal::TSanWrite(&_impl_); - ::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue* _add = _internal_mutable_options()->Add(); - // @@protoc_insertion_point(field_add:NSPanelEntityState.Thermostat.ThermostatOption.options) - return _add; + _impl_.can_close_tilt_ = false; } -inline const ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue>& NSPanelEntityState_Thermostat_ThermostatOption::options() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:NSPanelEntityState.Thermostat.ThermostatOption.options) - return _internal_options(); +inline bool NSPanelEntityState_Cover::can_close_tilt() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.can_close_tilt) + return _internal_can_close_tilt(); } -inline const ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue>& -NSPanelEntityState_Thermostat_ThermostatOption::_internal_options() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.options_; +inline void NSPanelEntityState_Cover::set_can_close_tilt(bool value) { + _internal_set_can_close_tilt(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.can_close_tilt) } -inline ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption_ThermostatOptionValue>* -NSPanelEntityState_Thermostat_ThermostatOption::_internal_mutable_options() { +inline bool NSPanelEntityState_Cover::_internal_can_close_tilt() const { ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.options_; + return _impl_.can_close_tilt_; +} +inline void NSPanelEntityState_Cover::_internal_set_can_close_tilt(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_close_tilt_ = value; } -// ------------------------------------------------------------------- - -// NSPanelEntityState_Thermostat +// bool can_stop_tilt = 14; +inline void NSPanelEntityState_Cover::clear_can_stop_tilt() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_stop_tilt_ = false; +} +inline bool NSPanelEntityState_Cover::can_stop_tilt() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.can_stop_tilt) + return _internal_can_stop_tilt(); +} +inline void NSPanelEntityState_Cover::set_can_stop_tilt(bool value) { + _internal_set_can_stop_tilt(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.can_stop_tilt) +} +inline bool NSPanelEntityState_Cover::_internal_can_stop_tilt() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.can_stop_tilt_; +} +inline void NSPanelEntityState_Cover::_internal_set_can_stop_tilt(bool value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.can_stop_tilt_ = value; +} -// int32 thermostat_id = 1; -inline void NSPanelEntityState_Thermostat::clear_thermostat_id() { +// bool can_set_tilt_position = 15; +inline void NSPanelEntityState_Cover::clear_can_set_tilt_position() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.thermostat_id_ = 0; + _impl_.can_set_tilt_position_ = false; } -inline ::int32_t NSPanelEntityState_Thermostat::thermostat_id() const { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.thermostat_id) - return _internal_thermostat_id(); +inline bool NSPanelEntityState_Cover::can_set_tilt_position() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.can_set_tilt_position) + return _internal_can_set_tilt_position(); } -inline void NSPanelEntityState_Thermostat::set_thermostat_id(::int32_t value) { - _internal_set_thermostat_id(value); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.thermostat_id) +inline void NSPanelEntityState_Cover::set_can_set_tilt_position(bool value) { + _internal_set_can_set_tilt_position(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.can_set_tilt_position) } -inline ::int32_t NSPanelEntityState_Thermostat::_internal_thermostat_id() const { +inline bool NSPanelEntityState_Cover::_internal_can_set_tilt_position() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.thermostat_id_; + return _impl_.can_set_tilt_position_; } -inline void NSPanelEntityState_Thermostat::_internal_set_thermostat_id(::int32_t value) { +inline void NSPanelEntityState_Cover::_internal_set_can_set_tilt_position(bool value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.thermostat_id_ = value; + _impl_.can_set_tilt_position_ = value; } -// string name = 2; -inline void NSPanelEntityState_Thermostat::clear_name() { +// string device_class = 16; +inline void NSPanelEntityState_Cover::clear_device_class() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.name_.ClearToEmpty(); + _impl_.device_class_.ClearToEmpty(); } -inline const std::string& NSPanelEntityState_Thermostat::name() const +inline const std::string& NSPanelEntityState_Cover::device_class() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.name) - return _internal_name(); + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.device_class) + return _internal_device_class(); } template -inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_Thermostat::set_name(Arg_&& arg, +inline PROTOBUF_ALWAYS_INLINE void NSPanelEntityState_Cover::set_device_class(Arg_&& arg, Args_... args) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.name_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.name) + _impl_.device_class_.Set(static_cast(arg), args..., GetArena()); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.device_class) } -inline std::string* NSPanelEntityState_Thermostat::mutable_name() ABSL_ATTRIBUTE_LIFETIME_BOUND { - std::string* _s = _internal_mutable_name(); - // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Thermostat.name) +inline std::string* NSPanelEntityState_Cover::mutable_device_class() ABSL_ATTRIBUTE_LIFETIME_BOUND { + std::string* _s = _internal_mutable_device_class(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Cover.device_class) return _s; } -inline const std::string& NSPanelEntityState_Thermostat::_internal_name() const { +inline const std::string& NSPanelEntityState_Cover::_internal_device_class() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.name_.Get(); + return _impl_.device_class_.Get(); } -inline void NSPanelEntityState_Thermostat::_internal_set_name(const std::string& value) { +inline void NSPanelEntityState_Cover::_internal_set_device_class(const std::string& value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.name_.Set(value, GetArena()); + _impl_.device_class_.Set(value, GetArena()); } -inline std::string* NSPanelEntityState_Thermostat::_internal_mutable_name() { +inline std::string* NSPanelEntityState_Cover::_internal_mutable_device_class() { ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.name_.Mutable( GetArena()); + return _impl_.device_class_.Mutable( GetArena()); } -inline std::string* NSPanelEntityState_Thermostat::release_name() { +inline std::string* NSPanelEntityState_Cover::release_device_class() { ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:NSPanelEntityState.Thermostat.name) - return _impl_.name_.Release(); + // @@protoc_insertion_point(field_release:NSPanelEntityState.Cover.device_class) + return _impl_.device_class_.Release(); } -inline void NSPanelEntityState_Thermostat::set_allocated_name(std::string* value) { +inline void NSPanelEntityState_Cover::set_allocated_device_class(std::string* value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.name_.SetAllocated(value, GetArena()); + _impl_.device_class_.SetAllocated(value, GetArena()); #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.name_.IsDefault()) { - _impl_.name_.Set("", GetArena()); + if (_impl_.device_class_.IsDefault()) { + _impl_.device_class_.Set("", GetArena()); } #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.Thermostat.name) + // @@protoc_insertion_point(field_set_allocated:NSPanelEntityState.Cover.device_class) } -// float current_temperature = 3; -inline void NSPanelEntityState_Thermostat::clear_current_temperature() { +// int32 position_preset1 = 17; +inline void NSPanelEntityState_Cover::clear_position_preset1() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.current_temperature_ = 0; + _impl_.position_preset1_ = 0; } -inline float NSPanelEntityState_Thermostat::current_temperature() const { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.current_temperature) - return _internal_current_temperature(); +inline ::int32_t NSPanelEntityState_Cover::position_preset1() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.position_preset1) + return _internal_position_preset1(); } -inline void NSPanelEntityState_Thermostat::set_current_temperature(float value) { - _internal_set_current_temperature(value); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.current_temperature) +inline void NSPanelEntityState_Cover::set_position_preset1(::int32_t value) { + _internal_set_position_preset1(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.position_preset1) } -inline float NSPanelEntityState_Thermostat::_internal_current_temperature() const { +inline ::int32_t NSPanelEntityState_Cover::_internal_position_preset1() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.current_temperature_; + return _impl_.position_preset1_; } -inline void NSPanelEntityState_Thermostat::_internal_set_current_temperature(float value) { +inline void NSPanelEntityState_Cover::_internal_set_position_preset1(::int32_t value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.current_temperature_ = value; + _impl_.position_preset1_ = value; } -// bool has_current_temperature = 4; -inline void NSPanelEntityState_Thermostat::clear_has_current_temperature() { +// int32 position_preset2 = 18; +inline void NSPanelEntityState_Cover::clear_position_preset2() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.has_current_temperature_ = false; + _impl_.position_preset2_ = 0; } -inline bool NSPanelEntityState_Thermostat::has_current_temperature() const { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.has_current_temperature) - return _internal_has_current_temperature(); +inline ::int32_t NSPanelEntityState_Cover::position_preset2() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.position_preset2) + return _internal_position_preset2(); } -inline void NSPanelEntityState_Thermostat::set_has_current_temperature(bool value) { - _internal_set_has_current_temperature(value); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.has_current_temperature) +inline void NSPanelEntityState_Cover::set_position_preset2(::int32_t value) { + _internal_set_position_preset2(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.position_preset2) } -inline bool NSPanelEntityState_Thermostat::_internal_has_current_temperature() const { +inline ::int32_t NSPanelEntityState_Cover::_internal_position_preset2() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.has_current_temperature_; + return _impl_.position_preset2_; } -inline void NSPanelEntityState_Thermostat::_internal_set_has_current_temperature(bool value) { +inline void NSPanelEntityState_Cover::_internal_set_position_preset2(::int32_t value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.has_current_temperature_ = value; + _impl_.position_preset2_ = value; } -// float set_temperature = 5; -inline void NSPanelEntityState_Thermostat::clear_set_temperature() { +// int32 position_preset3 = 19; +inline void NSPanelEntityState_Cover::clear_position_preset3() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.set_temperature_ = 0; + _impl_.position_preset3_ = 0; } -inline float NSPanelEntityState_Thermostat::set_temperature() const { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.set_temperature) - return _internal_set_temperature(); +inline ::int32_t NSPanelEntityState_Cover::position_preset3() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.position_preset3) + return _internal_position_preset3(); } -inline void NSPanelEntityState_Thermostat::set_set_temperature(float value) { - _internal_set_set_temperature(value); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.set_temperature) +inline void NSPanelEntityState_Cover::set_position_preset3(::int32_t value) { + _internal_set_position_preset3(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.position_preset3) } -inline float NSPanelEntityState_Thermostat::_internal_set_temperature() const { +inline ::int32_t NSPanelEntityState_Cover::_internal_position_preset3() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.set_temperature_; + return _impl_.position_preset3_; } -inline void NSPanelEntityState_Thermostat::_internal_set_set_temperature(float value) { +inline void NSPanelEntityState_Cover::_internal_set_position_preset3(::int32_t value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.set_temperature_ = value; + _impl_.position_preset3_ = value; } -// float step_size = 6; -inline void NSPanelEntityState_Thermostat::clear_step_size() { +// int32 tilt_preset1 = 20; +inline void NSPanelEntityState_Cover::clear_tilt_preset1() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.step_size_ = 0; + _impl_.tilt_preset1_ = 0; } -inline float NSPanelEntityState_Thermostat::step_size() const { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.step_size) - return _internal_step_size(); +inline ::int32_t NSPanelEntityState_Cover::tilt_preset1() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.tilt_preset1) + return _internal_tilt_preset1(); } -inline void NSPanelEntityState_Thermostat::set_step_size(float value) { - _internal_set_step_size(value); - // @@protoc_insertion_point(field_set:NSPanelEntityState.Thermostat.step_size) +inline void NSPanelEntityState_Cover::set_tilt_preset1(::int32_t value) { + _internal_set_tilt_preset1(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.tilt_preset1) } -inline float NSPanelEntityState_Thermostat::_internal_step_size() const { +inline ::int32_t NSPanelEntityState_Cover::_internal_tilt_preset1() const { ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.step_size_; + return _impl_.tilt_preset1_; } -inline void NSPanelEntityState_Thermostat::_internal_set_step_size(float value) { +inline void NSPanelEntityState_Cover::_internal_set_tilt_preset1(::int32_t value) { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.step_size_ = value; + _impl_.tilt_preset1_ = value; } -// repeated .NSPanelEntityState.Thermostat.ThermostatOption options = 7; -inline int NSPanelEntityState_Thermostat::_internal_options_size() const { - return _internal_options().size(); +// int32 tilt_preset2 = 21; +inline void NSPanelEntityState_Cover::clear_tilt_preset2() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.tilt_preset2_ = 0; } -inline int NSPanelEntityState_Thermostat::options_size() const { - return _internal_options_size(); +inline ::int32_t NSPanelEntityState_Cover::tilt_preset2() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.tilt_preset2) + return _internal_tilt_preset2(); } -inline void NSPanelEntityState_Thermostat::clear_options() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.options_.Clear(); +inline void NSPanelEntityState_Cover::set_tilt_preset2(::int32_t value) { + _internal_set_tilt_preset2(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.tilt_preset2) } -inline ::NSPanelEntityState_Thermostat_ThermostatOption* NSPanelEntityState_Thermostat::mutable_options(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:NSPanelEntityState.Thermostat.options) - return _internal_mutable_options()->Mutable(index); +inline ::int32_t NSPanelEntityState_Cover::_internal_tilt_preset2() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return _impl_.tilt_preset2_; } -inline ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption>* NSPanelEntityState_Thermostat::mutable_options() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable_list:NSPanelEntityState.Thermostat.options) +inline void NSPanelEntityState_Cover::_internal_set_tilt_preset2(::int32_t value) { ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_options(); -} -inline const ::NSPanelEntityState_Thermostat_ThermostatOption& NSPanelEntityState_Thermostat::options(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:NSPanelEntityState.Thermostat.options) - return _internal_options().Get(index); + _impl_.tilt_preset2_ = value; } -inline ::NSPanelEntityState_Thermostat_ThermostatOption* NSPanelEntityState_Thermostat::add_options() ABSL_ATTRIBUTE_LIFETIME_BOUND { + +// int32 tilt_preset3 = 22; +inline void NSPanelEntityState_Cover::clear_tilt_preset3() { ::google::protobuf::internal::TSanWrite(&_impl_); - ::NSPanelEntityState_Thermostat_ThermostatOption* _add = _internal_mutable_options()->Add(); - // @@protoc_insertion_point(field_add:NSPanelEntityState.Thermostat.options) - return _add; + _impl_.tilt_preset3_ = 0; } -inline const ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption>& NSPanelEntityState_Thermostat::options() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:NSPanelEntityState.Thermostat.options) - return _internal_options(); +inline ::int32_t NSPanelEntityState_Cover::tilt_preset3() const { + // @@protoc_insertion_point(field_get:NSPanelEntityState.Cover.tilt_preset3) + return _internal_tilt_preset3(); } -inline const ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption>& -NSPanelEntityState_Thermostat::_internal_options() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.options_; +inline void NSPanelEntityState_Cover::set_tilt_preset3(::int32_t value) { + _internal_set_tilt_preset3(value); + // @@protoc_insertion_point(field_set:NSPanelEntityState.Cover.tilt_preset3) } -inline ::google::protobuf::RepeatedPtrField<::NSPanelEntityState_Thermostat_ThermostatOption>* -NSPanelEntityState_Thermostat::_internal_mutable_options() { +inline ::int32_t NSPanelEntityState_Cover::_internal_tilt_preset3() const { ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.options_; + return _impl_.tilt_preset3_; +} +inline void NSPanelEntityState_Cover::_internal_set_tilt_preset3(::int32_t value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.tilt_preset3_ = value; } // ------------------------------------------------------------------- @@ -2262,6 +5058,164 @@ inline ::NSPanelEntityState_Thermostat* NSPanelEntityState::mutable_thermostat() return _msg; } +// .NSPanelEntityState.MediaPlayer media_player = 3; +inline bool NSPanelEntityState::has_media_player() const { + return entity_case() == kMediaPlayer; +} +inline bool NSPanelEntityState::_internal_has_media_player() const { + return entity_case() == kMediaPlayer; +} +inline void NSPanelEntityState::set_has_media_player() { + _impl_._oneof_case_[0] = kMediaPlayer; +} +inline void NSPanelEntityState::clear_media_player() { + ::google::protobuf::internal::TSanWrite(&_impl_); + if (entity_case() == kMediaPlayer) { + if (GetArena() == nullptr) { + delete _impl_.entity_.media_player_; + } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { + ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.entity_.media_player_); + } + clear_has_entity(); + } +} +inline ::NSPanelEntityState_MediaPlayer* NSPanelEntityState::release_media_player() { + // @@protoc_insertion_point(field_release:NSPanelEntityState.media_player) + if (entity_case() == kMediaPlayer) { + clear_has_entity(); + auto* temp = _impl_.entity_.media_player_; + if (GetArena() != nullptr) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); + } + _impl_.entity_.media_player_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::NSPanelEntityState_MediaPlayer& NSPanelEntityState::_internal_media_player() const { + return entity_case() == kMediaPlayer ? *_impl_.entity_.media_player_ : reinterpret_cast<::NSPanelEntityState_MediaPlayer&>(::_NSPanelEntityState_MediaPlayer_default_instance_); +} +inline const ::NSPanelEntityState_MediaPlayer& NSPanelEntityState::media_player() const ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.media_player) + return _internal_media_player(); +} +inline ::NSPanelEntityState_MediaPlayer* NSPanelEntityState::unsafe_arena_release_media_player() { + // @@protoc_insertion_point(field_unsafe_arena_release:NSPanelEntityState.media_player) + if (entity_case() == kMediaPlayer) { + clear_has_entity(); + auto* temp = _impl_.entity_.media_player_; + _impl_.entity_.media_player_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void NSPanelEntityState::unsafe_arena_set_allocated_media_player(::NSPanelEntityState_MediaPlayer* value) { + // We rely on the oneof clear method to free the earlier contents + // of this oneof. We can directly use the pointer we're given to + // set the new value. + clear_entity(); + if (value) { + set_has_media_player(); + _impl_.entity_.media_player_ = value; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:NSPanelEntityState.media_player) +} +inline ::NSPanelEntityState_MediaPlayer* NSPanelEntityState::_internal_mutable_media_player() { + if (entity_case() != kMediaPlayer) { + clear_entity(); + set_has_media_player(); + _impl_.entity_.media_player_ = + ::google::protobuf::Message::DefaultConstruct<::NSPanelEntityState_MediaPlayer>(GetArena()); + } + return _impl_.entity_.media_player_; +} +inline ::NSPanelEntityState_MediaPlayer* NSPanelEntityState::mutable_media_player() ABSL_ATTRIBUTE_LIFETIME_BOUND { + ::NSPanelEntityState_MediaPlayer* _msg = _internal_mutable_media_player(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.media_player) + return _msg; +} + +// .NSPanelEntityState.Cover cover = 4; +inline bool NSPanelEntityState::has_cover() const { + return entity_case() == kCover; +} +inline bool NSPanelEntityState::_internal_has_cover() const { + return entity_case() == kCover; +} +inline void NSPanelEntityState::set_has_cover() { + _impl_._oneof_case_[0] = kCover; +} +inline void NSPanelEntityState::clear_cover() { + ::google::protobuf::internal::TSanWrite(&_impl_); + if (entity_case() == kCover) { + if (GetArena() == nullptr) { + delete _impl_.entity_.cover_; + } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { + ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.entity_.cover_); + } + clear_has_entity(); + } +} +inline ::NSPanelEntityState_Cover* NSPanelEntityState::release_cover() { + // @@protoc_insertion_point(field_release:NSPanelEntityState.cover) + if (entity_case() == kCover) { + clear_has_entity(); + auto* temp = _impl_.entity_.cover_; + if (GetArena() != nullptr) { + temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); + } + _impl_.entity_.cover_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::NSPanelEntityState_Cover& NSPanelEntityState::_internal_cover() const { + return entity_case() == kCover ? *_impl_.entity_.cover_ : reinterpret_cast<::NSPanelEntityState_Cover&>(::_NSPanelEntityState_Cover_default_instance_); +} +inline const ::NSPanelEntityState_Cover& NSPanelEntityState::cover() const ABSL_ATTRIBUTE_LIFETIME_BOUND { + // @@protoc_insertion_point(field_get:NSPanelEntityState.cover) + return _internal_cover(); +} +inline ::NSPanelEntityState_Cover* NSPanelEntityState::unsafe_arena_release_cover() { + // @@protoc_insertion_point(field_unsafe_arena_release:NSPanelEntityState.cover) + if (entity_case() == kCover) { + clear_has_entity(); + auto* temp = _impl_.entity_.cover_; + _impl_.entity_.cover_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void NSPanelEntityState::unsafe_arena_set_allocated_cover(::NSPanelEntityState_Cover* value) { + // We rely on the oneof clear method to free the earlier contents + // of this oneof. We can directly use the pointer we're given to + // set the new value. + clear_entity(); + if (value) { + set_has_cover(); + _impl_.entity_.cover_ = value; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:NSPanelEntityState.cover) +} +inline ::NSPanelEntityState_Cover* NSPanelEntityState::_internal_mutable_cover() { + if (entity_case() != kCover) { + clear_entity(); + set_has_cover(); + _impl_.entity_.cover_ = + ::google::protobuf::Message::DefaultConstruct<::NSPanelEntityState_Cover>(GetArena()); + } + return _impl_.entity_.cover_; +} +inline ::NSPanelEntityState_Cover* NSPanelEntityState::mutable_cover() ABSL_ATTRIBUTE_LIFETIME_BOUND { + ::NSPanelEntityState_Cover* _msg = _internal_mutable_cover(); + // @@protoc_insertion_point(field_mutable:NSPanelEntityState.cover) + return _msg; +} + inline bool NSPanelEntityState::has_entity() const { return entity_case() != ENTITY_NOT_SET; } @@ -2287,6 +5241,18 @@ template <> inline const EnumDescriptor* GetEnumDescriptor<::NSPanelEntityState_Light_LightMode>() { return ::NSPanelEntityState_Light_LightMode_descriptor(); } +template <> +struct is_proto_enum<::NSPanelEntityState_MediaPlayer_PlaybackState> : std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor<::NSPanelEntityState_MediaPlayer_PlaybackState>() { + return ::NSPanelEntityState_MediaPlayer_PlaybackState_descriptor(); +} +template <> +struct is_proto_enum<::NSPanelEntityState_Cover_CoverState> : std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor<::NSPanelEntityState_Cover_CoverState>() { + return ::NSPanelEntityState_Cover_CoverState_descriptor(); +} } // namespace protobuf } // namespace google diff --git a/docker/MQTTManager/include/room/room.cpp b/docker/MQTTManager/include/room/room.cpp index 6eeb168d7..83c33e323 100644 --- a/docker/MQTTManager/include/room/room.cpp +++ b/docker/MQTTManager/include/room/room.cpp @@ -36,14 +36,26 @@ Room::Room(uint32_t room_id) { this->_send_status_updates = true; CommandManager::attach_callback(boost::bind(&Room::command_callback, this, _1)); - if (!this->_update_room_state_thread.joinable()) { - SPDLOG_INFO("No thread to handle room status updates for room {}::{} starting...", this->_id, this->_name); - this->_update_room_state_thread = std::thread(&Room::_update_room_state, this); - this->_update_room_state_thread.detach(); - } + SPDLOG_INFO("No thread to handle room status updates for room {}::{} starting...", this->_id, this->_name); + // Through a lambda: std::jthread only passes its stop_token to a callable that takes it first. + this->_update_room_state_thread = std::jthread([this](std::stop_token stop_token) { + this->_update_room_state(stop_token); + }); } Room::~Room() { + // Stop the status update thread first, while everything it uses still exists. Stopping wakes it + // from either of its waits, so this only waits for an update already being sent. + this->_update_room_state_thread.request_stop(); + if (this->_update_room_state_thread.get_id() == std::this_thread::get_id()) { + // Nothing on the thread holds a reference to its own Room, so this should not happen. Joining + // would throw, so leave the thread to finish by itself. + SPDLOG_ERROR("Room {}::{} destroyed from its own status update thread, cannot wait for the thread to stop.", this->_id, this->_name); + this->_update_room_state_thread.detach(); + } else if (this->_update_room_state_thread.joinable()) { + this->_update_room_state_thread.join(); + } + CommandManager::detach_callback(boost::bind(&Room::command_callback, this, _1)); MQTT_Manager::clear_retain(this->_mqtt_state_topic); // Clear old state topic. SPDLOG_INFO("Room {}::{} destroyed.", this->_id, this->_name); @@ -280,7 +292,9 @@ void Room::page_changed_callback(RoomEntitiesPage *page) { { std::lock_guard mutex_guard(this->_status_update_mutex); this->_room_status_updated = false; + this->_room_update_count++; } + SPDLOG_DEBUG("Sending notify of state update in room {}::{}", this->_id, this->_name); this->_room_update_condition_variable.notify_all(); } } @@ -359,20 +373,32 @@ void Room::command_callback(NSPanelMQTTManagerCommand &command) { } } -void Room::_update_room_state() { +void Room::_update_room_state(std::stop_token stop_token) { SPDLOG_INFO("Started thread to handle room status updates for room {}::{}", this->_id, this->_name); std::unique_lock lock(this->_status_update_mutex); for (;;) { // Wait for notification that a room has been updated - this->_room_update_condition_variable.wait(lock, [this]() { + this->_room_update_condition_variable.wait(lock, stop_token, [this]() { return !this->_room_status_updated; }); + if (stop_token.stop_requested()) { + return; + } // Wait until changes has settled as when a user changes light states in "All rooms" mode a burst of changes will occur from all rooms. uint32_t backoff_time = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::ROOM_STATUS_BACKOFF_TIME); - while (this->_room_update_condition_variable.wait_for(lock, std::chrono::milliseconds(backoff_time)) == std::cv_status::no_timeout) { - // If we woke up via notify, we just loop and wait again. - // This is where the "debounce" happens. + for (;;) { + uint64_t seen_update_count = this->_room_update_count; + bool changed = this->_room_update_condition_variable.wait_for(lock, stop_token, std::chrono::milliseconds(backoff_time), [this, seen_update_count]() { + return this->_room_update_count != seen_update_count; + }); + if (stop_token.stop_requested()) { + return; + } + if (!changed) { + break; // A whole backoff time without changes. + } + // Another change arrived, wait a whole backoff time again. This is where the "debounce" happens. } SPDLOG_DEBUG("Room status backoff time reaced, sending update for room {}::{}.", this->_id, this->_name); this->_room_status_updated = true; diff --git a/docker/MQTTManager/include/room/room.hpp b/docker/MQTTManager/include/room/room.hpp index 3078d340c..883c26793 100644 --- a/docker/MQTTManager/include/room/room.hpp +++ b/docker/MQTTManager/include/room/room.hpp @@ -4,13 +4,17 @@ #include "entity/entity.hpp" #include "protobuf_nspanel.pb.h" #include "room/room_entities_page.hpp" +#include #include +#include #include #include #include #include #include +#include #include +#include #include class Room { @@ -131,13 +135,17 @@ class Room { private: /* * Run this in seperate thread to send room state updates with a backoff time to wait for changes to settle in order to minimise flickering. + * Returns once stop_token is stopped, which the destructor does before anything the thread uses is torn down. */ - void _update_room_state(); + void _update_room_state(std::stop_token stop_token); - std::thread _update_room_state_thread; + std::jthread _update_room_state_thread; std::mutex _status_update_mutex; - std::condition_variable _room_update_condition_variable; - bool _room_status_updated = false; + std::condition_variable_any _room_update_condition_variable; + std::atomic _room_status_updated = false; + // Counts change notifications, so that the backoff can tell a new change from the backoff time + // running out. Guarded by _status_update_mutex. + uint64_t _room_update_count = 0; /* * Create a protobuf room state object and send out to _mqtt_state_topic. @@ -185,7 +193,7 @@ class Room { boost::signals2::signal _room_changed_callbacks; // Room temperature sensor provider - MQTT_MANAGER_ENTITY_CONTROLLER _room_temp_provider; + MQTT_MANAGER_ENTITY_CONTROLLER _room_temp_provider = MQTT_MANAGER_ENTITY_CONTROLLER::NONE; // Room temperature sensor item name/home assistant entity id std::string _room_temp_sensor; diff --git a/docker/MQTTManager/include/room/room_entities_page.cpp b/docker/MQTTManager/include/room/room_entities_page.cpp index eb0f0f794..999a6792b 100644 --- a/docker/MQTTManager/include/room/room_entities_page.cpp +++ b/docker/MQTTManager/include/room/room_entities_page.cpp @@ -1,7 +1,9 @@ #include "button/button.hpp" +#include "cover/cover.hpp" #include "entity/entity.hpp" #include "entity_manager/entity_manager.hpp" #include "light/light.hpp" +#include "media_player/media_player.hpp" #include "mqtt_manager/mqtt_manager.hpp" #include "mqtt_manager_config/mqtt_manager_config.hpp" #include "protobuf_nspanel.pb.h" @@ -161,11 +163,11 @@ void RoomEntitiesPage::_send_mqtt_state_update() { for (int i = 0; i < this->_page_settings.page_type; i++) { auto entity_result = EntityManager::get_entity_by_page_id_and_slot(this->_id, i); if (!entity_result) { - SPDLOG_DEBUG("No entity assigned to slot {}", i); + SPDLOG_TRACE("No entity assigned to slot {}", i); continue; // No entity assigned in slot, move to next slot. } auto entity = entity_result.value(); - SPDLOG_DEBUG("Got shared ptr for entity with ID {}", entity->get_id()); + SPDLOG_TRACE("Got shared ptr for entity with ID {}", entity->get_id()); if (entity->get_type() == MQTT_MANAGER_ENTITY_TYPE::LIGHT) { std::shared_ptr light = std::static_pointer_cast(entity); @@ -175,8 +177,10 @@ void RoomEntitiesPage::_send_mqtt_state_update() { entity_slot->set_icon(light->get_icon()); entity_slot->set_pco(light->get_icon_color()); entity_slot->set_pco2(light->get_icon_active_color()); - entity_slot->set_can_save_scene(false); // Entity is not a scene. + entity_slot->set_type(NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_LIGHT); + entity_slot->set_id(light->get_id()); entity_slot->set_mqtt_state_topic(light->get_mqtt_state_topic()); + entity_slot->set_can_save_scene(false); // Entity is not a scene. } else if (entity->get_type() == MQTT_MANAGER_ENTITY_TYPE::SWITCH_ENTITY) { std::shared_ptr switch_entity = std::static_pointer_cast(entity); NSPanelRoomEntitiesPage_EntitySlot *entity_slot = proto_state.add_entities(); @@ -186,6 +190,8 @@ void RoomEntitiesPage::_send_mqtt_state_update() { entity_slot->set_pco(switch_entity->get_icon_color()); entity_slot->set_pco2(switch_entity->get_icon_active_color()); entity_slot->set_mqtt_state_topic(switch_entity->get_mqtt_state_topic()); + entity_slot->set_type(NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_SWITCH); + entity_slot->set_id(switch_entity->get_id()); } else if (entity->get_type() == MQTT_MANAGER_ENTITY_TYPE::BUTTON) { std::shared_ptr button_entity = std::static_pointer_cast(entity); NSPanelRoomEntitiesPage_EntitySlot *entity_slot = proto_state.add_entities(); @@ -195,6 +201,8 @@ void RoomEntitiesPage::_send_mqtt_state_update() { entity_slot->set_pco(button_entity->get_icon_color()); entity_slot->set_pco2(button_entity->get_icon_active_color()); entity_slot->set_mqtt_state_topic(button_entity->get_mqtt_state_topic()); + entity_slot->set_type(NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_BUTTON); + entity_slot->set_id(button_entity->get_id()); } else if (entity->get_type() == MQTT_MANAGER_ENTITY_TYPE::SCENE) { std::shared_ptr scene = std::static_pointer_cast(entity); NSPanelRoomEntitiesPage_EntitySlot *entity_slot = proto_state.add_entities(); @@ -204,6 +212,8 @@ void RoomEntitiesPage::_send_mqtt_state_update() { entity_slot->set_pco(scene->get_icon_color()); entity_slot->set_pco2(scene->get_icon_active_color()); entity_slot->set_mqtt_state_topic(scene->get_mqtt_state_topic()); + entity_slot->set_type(NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_SCENE); + entity_slot->set_id(scene->get_id()); if (scene->get_controller() == MQTT_MANAGER_ENTITY_CONTROLLER::NSPM) { entity_slot->set_can_save_scene(true); } else { @@ -219,8 +229,34 @@ void RoomEntitiesPage::_send_mqtt_state_update() { entity_slot->set_pco2(thermostat->get_icon_active_color()); entity_slot->set_can_save_scene(false); // Entity is not a scene. entity_slot->set_mqtt_state_topic(thermostat->get_mqtt_state_topic()); + entity_slot->set_type(NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_THERMOSTAT); + entity_slot->set_id(thermostat->get_id()); SPDLOG_DEBUG("Thermostat icon: {} (0x{:X})", entity_slot->icon(), entity_slot->icon()[0]); + } else if (entity->get_type() == MQTT_MANAGER_ENTITY_TYPE::COVER) { + std::shared_ptr cover = std::static_pointer_cast(entity); + NSPanelRoomEntitiesPage_EntitySlot *entity_slot = proto_state.add_entities(); + entity_slot->set_name(cover->get_name()); + entity_slot->set_room_view_position(i); + entity_slot->set_icon(cover->get_icon()); + entity_slot->set_pco(cover->get_icon_color()); + entity_slot->set_pco2(cover->get_icon_active_color()); + entity_slot->set_can_save_scene(false); // Entity is not a scene. + entity_slot->set_mqtt_state_topic(cover->get_mqtt_state_topic()); + entity_slot->set_type(NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_COVER); + entity_slot->set_id(cover->get_id()); + } else if (entity->get_type() == MQTT_MANAGER_ENTITY_TYPE::MEDIA_PLAYER) { + std::shared_ptr media_player = std::static_pointer_cast(entity); + NSPanelRoomEntitiesPage_EntitySlot *entity_slot = proto_state.add_entities(); + entity_slot->set_name(media_player->get_name()); + entity_slot->set_room_view_position(i); + entity_slot->set_icon(media_player->get_icon()); + entity_slot->set_pco(media_player->get_icon_color()); + entity_slot->set_pco2(media_player->get_icon_active_color()); + entity_slot->set_can_save_scene(false); // Entity is not a scene. + entity_slot->set_mqtt_state_topic(media_player->get_mqtt_state_topic()); + entity_slot->set_type(NSPanelRoomEntitiesPage_EntitySlot_EntityType_ENTITY_TYPE_MEDIA_PLAYER); + entity_slot->set_id(media_player->get_id()); } else { SPDLOG_ERROR("Unknown entity type {} while processing EntityWrapper while building NSPanelRoomEntitiesPage protobuf object.", (int)entity->get_type()); } @@ -236,7 +272,5 @@ void RoomEntitiesPage::_send_mqtt_state_update() { } else { SPDLOG_ERROR("Failed to serialize protobuf for entity page {} state.", this->_id); } - } else { - SPDLOG_DEBUG("Did not send update, no difference."); } } diff --git a/docker/MQTTManager/include/scenes/openhab_scene.cpp b/docker/MQTTManager/include/scenes/openhab_scene.cpp index bc7e5e768..0952b6466 100644 --- a/docker/MQTTManager/include/scenes/openhab_scene.cpp +++ b/docker/MQTTManager/include/scenes/openhab_scene.cpp @@ -41,8 +41,10 @@ void OpenhabScene::activate(std::expected t std::string openhab_trigger_scene_url = fmt::format("{}/rest/rules/{}/runnow", MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::OPENHAB_ADDRESS), this->_entity_id); std::string openhab_token = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::OPENHAB_TOKEN); + // The header list only holds pointers, so the formatted header must outlive the request. + std::string authorization_header = fmt::format("Authorization: Bearer {}", openhab_token); std::list headers = { - fmt::format("Authorization: Bearer {}", openhab_token).c_str(), + authorization_header.c_str(), "Content-type: application/json"}; std::string response_data; std::string post_data = ""; diff --git a/docker/MQTTManager/include/thermostat/home_assistant_thermostat.cpp b/docker/MQTTManager/include/thermostat/home_assistant_thermostat.cpp index 53df1baf6..ff74e209b 100644 --- a/docker/MQTTManager/include/thermostat/home_assistant_thermostat.cpp +++ b/docker/MQTTManager/include/thermostat/home_assistant_thermostat.cpp @@ -6,6 +6,7 @@ #include "thermostat/thermostat.hpp" #include #include +#include #include #include #include @@ -157,6 +158,7 @@ void HomeAssistantThermostat::home_assistant_event_callback(nlohmann::json data) nlohmann::json new_state_data = data["event"]["data"]["new_state"]; nlohmann::json new_state_attributes = new_state_data["attributes"]; bool changed_attribute = false; + // SPDLOG_DEBUG("Event data new_state: {}", new_state_data.dump(4)); try { if (new_state_data.contains("state") && !new_state_data["state"].is_null()) { @@ -244,17 +246,27 @@ void HomeAssistantThermostat::home_assistant_event_callback(nlohmann::json data) } } + if (this->_use_current_temperature && new_state_attributes.contains("current_temperature") && !new_state_attributes["current_temperature"].is_null()) { + float temperature = new_state_attributes.at("current_temperature").get(); + if (temperature != this->_current_temperature_sensor) { + this->_current_temperature_sensor = temperature; + this->_current_temperature_sensor_available = true; + changed_attribute = true; + SPDLOG_DEBUG("Thermostat {}::{} got new temperature sensor reading: {}", this->_id, this->_name, temperature); + } + } + if (new_state_attributes.contains("temperature") && !new_state_attributes["temperature"].is_null()) { float temperature = new_state_attributes.at("temperature").get(); if (temperature != this->_current_temperature) { this->_current_temperature = temperature; + this->_requested_temperature = temperature; changed_attribute = true; - SPDLOG_DEBUG("Thermostat {}::{} got new temperature: {}", this->_id, this->_name, temperature); + SPDLOG_DEBUG("Thermostat {}::{} got new target temperature: {}", this->_id, this->_name, temperature); } } else { SPDLOG_WARN("Received state update for {}::{} but update has no valid set temperature.", this->_id, this->_name); } - } catch (std::exception &e) { SPDLOG_ERROR("Caught exception when trying to update state for light {}::{} message: {}. Working data: {}", this->_id, this->_name, boost::diagnostic_information(e, true), new_state_attributes.dump()); } @@ -267,405 +279,3 @@ void HomeAssistantThermostat::home_assistant_event_callback(nlohmann::json data) } } } - -// TESTING -#if defined(TEST_MODE) && TEST_MODE == 1 -#include - -class HomeAssistantLightTest : public ::testing::Test { -protected: - HomeAssistantLightTest() { - // Initialize any necessary resources or setup for the tests - } - - void SetUp() override { - - // Initialize any necessary resources or setup for the tests - database_manager::Entity light_entity; - light_entity.entity_type = "light"; - light_entity.friendly_name = "Unit test HA light (light)"; - light_entity.room_id = 1; - light_entity.room_view_position = 2; - light_entity.set_entity_data_json({{"can_color_temperature", true}, - {"can_dim", true}, - {"can_rgb", true}, - {"controlled_by_nspanel_main_page", true}, - {"controller", "home_assistant"}, - {"home_assistant_name", "light.office_ceiling_light"}, - {"is_ceiling_light", true}, - {"openhab_control_mode", "dimmer"}, - {"openhab_item_color_temp", ""}, - {"openhab_item_dimmer", ""}, - {"openhab_item_rgb", ""}, - {"openhab_item_switch", ""}, - {"openhab_name", ""}}); - ha_light_id = database_manager::database.insert(light_entity); - // light_entity = database_manager::database.get(ha_light_id); - - SPDLOG_INFO("HA Light created in DB. Creating instance of light object."); - light = new HomeAssistantLight(ha_light_id); - } - - void TearDown() override { - // Clean up any resources or teardown after the tests - - database_manager::database.remove(ha_light_id); - // database_manager::database.remove(ha_light_switch_id); - } - - HomeAssistantLight *light = nullptr; - - int32_t ha_light_id; - int32_t ha_light_switch_id; -}; - -TEST_F(HomeAssistantLightTest, is_off_by_default) { - EXPECT_EQ(light->get_state(), false); - EXPECT_EQ(light->get_brightness(), 0); -} - -TEST_F(HomeAssistantLightTest, is_not_on_after_turn_on_in_nonoptimistic_mode) { - MqttManagerConfig::set_setting_value(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE, "false"); - light->turn_on(false); - light->set_brightness(50, true); - EXPECT_EQ(light->get_state(), false); - EXPECT_EQ(light->get_brightness(), 0); -} - -TEST_F(HomeAssistantLightTest, is_on_after_turn_on_in_optimistic_mode) { - MqttManagerConfig::set_setting_value(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE, "true"); - light->turn_on(false); - light->set_brightness(50, true); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 50); -} - -TEST_F(HomeAssistantLightTest, light_reacts_to_state_changes_from_home_assistant) { - // Enable optimistic mode for this test - MqttManagerConfig::set_setting_value(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE, "true"); - - nlohmann::json event_data = nlohmann::json::parse(R"( - { - - "event":{ - "context":{ - "id":"01K2WNR8WT8VS6B5HTQ7ZEKSAP", - "parent_id":null, - "user_id":"d28bd745ad714c108c27c31a90406189" - }, - "data":{ - "entity_id":"light.office_ceiling_light", - "new_state":{ - "attributes":{ - "brightness":204, - "color_mode":"color_temp", - "color_temp":443, - "color_temp_kelvin":2257, - "effect":null, - "effect_list":[ - "blink", - "breathe", - "okay", - "channel_change", - "finish_effect", - "stop_effect" - ], - "friendly_name":"office_ceiling_light", - "hs_color":[ - 20, - 80 - ], - "max_color_temp_kelvin":4000, - "max_mireds":454, - "min_color_temp_kelvin":2202, - "min_mireds":250, - "rgb_color":[ - 255, - 149, - 46 - ], - "supported_color_modes":[ - "color_temp" - ], - "supported_features":44, - "xy_color":[ - 0.572, - 0.389 - ] - }, - "context":{ - "id":"01K2WNR8WT8VS6B5HTQ7ZEKSAP", - "parent_id":null, - "user_id":"d28bd745ad714c108c27c31a90406189" - }, - "entity_id":"light.office_ceiling_light", - "last_changed":"2025-08-17T18:45:35.203504+00:00", - "last_reported":"2025-08-17T18:48:00.253850+00:00", - "last_updated":"2025-08-17T18:48:00.253850+00:00", - "state":"on" - }, - "old_state": "removed_as_it_is_not_used" - }, - "event_type":"state_changed", - "origin":"LOCAL", - "time_fired":"2025-08-17T18:48:00.253850+00:00" - }, - "id":3, - "type":"event" - - } )"); - - light->home_assistant_event_callback(event_data); - - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 80); // We sent brightness 204, ie. 80% - EXPECT_EQ(light->get_color_temperature(), 2257); - EXPECT_EQ(light->get_color_temperature(), 2257); - - event_data["event"]["data"]["new_state"]["attributes"]["brightness"] = 153; - event_data["event"]["data"]["new_state"]["attributes"]["color_temp_kelvin"] = 5000; - light->home_assistant_event_callback(event_data); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 60); // We sent brightness 153, ie. 60% - EXPECT_EQ(light->get_color_temperature(), 5000); - - event_data["event"]["data"]["new_state"]["state"] = "off"; - event_data["event"]["data"]["new_state"]["attributes"]["brightness"] = 0; - light->home_assistant_event_callback(event_data); - EXPECT_EQ(light->get_state(), false); - EXPECT_EQ(light->get_brightness(), 60); // Remember last brightness value - - // Change to RGB mode - event_data["event"]["data"]["new_state"]["state"] = "on"; - event_data["event"]["data"]["new_state"]["attributes"]["brightness"] = 153; // 60% - event_data["event"]["data"]["new_state"]["attributes"]["color_mode"] = "xy"; // TODO: Update with correct color mode as sent from HA. - light->home_assistant_event_callback(event_data); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 60); - EXPECT_EQ(light->get_hue(), 20); - EXPECT_EQ(light->get_saturation(), 80); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::RGB); - - // Verify that changes to RGB/HSB values as correctly interpreted - event_data["event"]["data"]["new_state"]["attributes"]["hs_color"][0] = 30; - event_data["event"]["data"]["new_state"]["attributes"]["hs_color"][1] = 60; - light->home_assistant_event_callback(event_data); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 60); - EXPECT_EQ(light->get_hue(), 30); - EXPECT_EQ(light->get_saturation(), 60); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::RGB); - - // Verify that we can revert back to color temp mode - event_data["event"]["data"]["new_state"]["state"] = "on"; - event_data["event"]["data"]["new_state"]["attributes"]["brightness"] = 153; // 60% - event_data["event"]["data"]["new_state"]["attributes"]["color_mode"] = "color_temp"; - event_data["event"]["data"]["new_state"]["attributes"]["color_temp_kelvin"] = 4000; - light->home_assistant_event_callback(event_data); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 60); - EXPECT_EQ(light->get_color_temperature(), 4000); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::DEFAULT); -} - -#define COLOR_TEMP_PERCENT_TO_KELVIN(min, max, kelvin_pct) (((max - min) / 100) * kelvin_pct + min) -TEST_F(HomeAssistantLightTest, verify_nspanel_command_compliance) { - // Enable optimistic mode for this test - MqttManagerConfig::set_setting_value(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE, "true"); - uint32_t color_temp_min = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::COLOR_TEMP_MIN); - uint32_t color_temp_max = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::COLOR_TEMP_MAX); - // spdlog::set_level(spdlog::level::trace); - - NSPanelMQTTManagerCommand cmd; - cmd.set_nspanel_id(0); - NSPanelMQTTManagerCommand_LightCommand *light_cmd = cmd.mutable_light_command(); - std::vector light_ids = {light->get_id()}; - light_cmd->add_light_ids(light->get_id()); - light_cmd->set_brightness(50); - light_cmd->set_has_brightness(true); - light_cmd->set_color_temperature(50); - light_cmd->set_has_color_temperature(true); - light_cmd->set_has_hue(false); - light_cmd->set_has_saturation(false); - - light->command_callback(cmd); - - // Check that light turns on, sets correct brightness and color temperature. - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 50); - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 50)); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::DEFAULT); - - // Verify that only color temperature can be change. - light_cmd->set_has_brightness(false); - light_cmd->set_color_temperature(70); - light_cmd->set_has_color_temperature(true); - light->command_callback(cmd); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 50); - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 70)); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::DEFAULT); - - // Verify that only brightness can be change. - light_cmd->set_has_color_temperature(false); - light_cmd->set_has_brightness(true); - light_cmd->set_brightness(70); - light->command_callback(cmd); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 70); - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 70)); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::DEFAULT); - - // Verify that hue and saturation can be changed and the lights goes into RGB mode. - light_cmd->set_has_color_temperature(false); - light_cmd->set_has_brightness(false); - light_cmd->set_hue(30); - light_cmd->set_has_hue(true); - light_cmd->set_saturation(60); - light_cmd->set_has_saturation(true); - light->command_callback(cmd); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 70); // Verify that value is unchanged. - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 70)); // Verify that value is unchanged. - EXPECT_EQ(light->get_hue(), 30); - EXPECT_EQ(light->get_saturation(), 60); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::RGB); - - // Verify that only hue can be changed. - light_cmd->set_has_color_temperature(false); - light_cmd->set_has_brightness(false); - light_cmd->set_hue(40); - light_cmd->set_has_hue(true); - light_cmd->set_saturation(60); - light_cmd->set_has_saturation(false); - light->command_callback(cmd); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 70); // Verify that value is unchanged. - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 70)); // Verify that value is unchanged. - EXPECT_EQ(light->get_hue(), 40); - EXPECT_EQ(light->get_saturation(), 60); // Verify that value is unchanged. - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::RGB); - - // Verify that only saturation can be changed. - light_cmd->set_has_color_temperature(false); - light_cmd->set_has_brightness(false); - light_cmd->set_hue(40); - light_cmd->set_has_hue(false); - light_cmd->set_saturation(70); - light_cmd->set_has_saturation(true); - light->command_callback(cmd); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 70); // Verify that value is unchanged. - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 70)); // Verify that value is unchanged. - EXPECT_EQ(light->get_hue(), 40); // Verify that value is unchanged. - EXPECT_EQ(light->get_saturation(), 70); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::RGB); - - // Verify that brightness can be changed and RGB is kept. - light_cmd->set_has_color_temperature(false); - light_cmd->set_brightness(100); - light_cmd->set_has_brightness(true); - light_cmd->set_hue(40); - light_cmd->set_has_hue(false); - light_cmd->set_saturation(70); - light_cmd->set_has_saturation(false); - light->command_callback(cmd); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 100); // Verify that value is unchanged. - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 70)); // Verify that value is unchanged. - EXPECT_EQ(light->get_hue(), 40); // Verify that value is unchanged. - EXPECT_EQ(light->get_saturation(), 70); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::RGB); - - MqttManagerConfig::set_setting_value(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE, "true"); -} - -TEST_F(HomeAssistantLightTest, verify_optimistic_mode_compliance) { - // Enable optimistic mode for this test - MqttManagerConfig::set_setting_value(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE, "true"); - uint32_t color_temp_min = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::COLOR_TEMP_MIN); - uint32_t color_temp_max = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::COLOR_TEMP_MAX); - // spdlog::set_level(spdlog::level::trace); - - NSPanelMQTTManagerCommand cmd; - cmd.set_nspanel_id(0); - NSPanelMQTTManagerCommand_LightCommand *light_cmd = cmd.mutable_light_command(); - std::vector light_ids = {light->get_id()}; - light_cmd->add_light_ids(light->get_id()); - light_cmd->set_brightness(50); - light_cmd->set_has_brightness(true); - light_cmd->set_color_temperature(50); - light_cmd->set_has_color_temperature(true); - light_cmd->set_has_hue(false); - light_cmd->set_has_saturation(false); - - light->command_callback(cmd); - - // Check that light turns on, sets correct brightness and color temperature. - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 50); - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 50)); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::DEFAULT); - - light_cmd->set_has_brightness(false); - light_cmd->set_has_color_temperature(false); - light_cmd->set_hue(30); - light_cmd->set_has_hue(true); - light_cmd->set_saturation(50); - light_cmd->set_has_saturation(true); - light->command_callback(cmd); - - EXPECT_EQ(light->get_state(), true); // Verify light is still on - EXPECT_EQ(light->get_brightness(), 50); // Verify light is still set to 50% brightness - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 50)); // Verify color temp has not changed. - EXPECT_EQ(light->get_hue(), 30); - EXPECT_EQ(light->get_saturation(), 50); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::RGB); // Light should have switched to RGB mode. -} - -TEST_F(HomeAssistantLightTest, verify_non_optimistic_mode_compliance) { - // Turn off optimistic mode and verify that no values change. - MqttManagerConfig::set_setting_value(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE, "false"); - uint32_t color_temp_min = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::COLOR_TEMP_MIN); - uint32_t color_temp_max = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::COLOR_TEMP_MAX); - // spdlog::set_level(spdlog::level::trace); - - NSPanelMQTTManagerCommand cmd; - cmd.set_nspanel_id(0); - NSPanelMQTTManagerCommand_LightCommand *light_cmd = cmd.mutable_light_command(); - std::vector light_ids = {light->get_id()}; - light_cmd->add_light_ids(light->get_id()); - light_cmd->set_brightness(50); - light_cmd->set_has_brightness(true); - light_cmd->set_color_temperature(50); - light_cmd->set_has_color_temperature(true); - light_cmd->set_has_hue(false); - light_cmd->set_has_saturation(false); - light->command_callback(cmd); - - // Verify light is still off, brightness is still 0 and hue and saturation did not change. - EXPECT_EQ(light->get_state(), false); - EXPECT_EQ(light->get_brightness(), 0); - EXPECT_EQ(light->get_color_temperature(), 0); - EXPECT_EQ(light->get_hue(), 0); - EXPECT_EQ(light->get_saturation(), 0); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::DEFAULT); // Light should have switched to RGB mode. - - light_cmd->set_has_brightness(false); - light_cmd->set_has_color_temperature(false); - light_cmd->set_hue(30); - light_cmd->set_has_hue(true); - light_cmd->set_saturation(30); - light_cmd->set_has_saturation(true); - light->command_callback(cmd); - - // Verify light is still off, brightness is still 0 and hue and saturation did not change. - EXPECT_EQ(light->get_state(), false); - EXPECT_EQ(light->get_brightness(), 0); - EXPECT_EQ(light->get_color_temperature(), 0); - EXPECT_EQ(light->get_hue(), 0); - EXPECT_EQ(light->get_saturation(), 0); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::DEFAULT); // Light should have switched to RGB mode. -} - -#endif // !MQTT_MANAGER_HOME_ASSISTANT_LIGHT_TEST diff --git a/docker/MQTTManager/include/thermostat/openhab_thermostat.cpp b/docker/MQTTManager/include/thermostat/openhab_thermostat.cpp index e9db769a5..6569769db 100644 --- a/docker/MQTTManager/include/thermostat/openhab_thermostat.cpp +++ b/docker/MQTTManager/include/thermostat/openhab_thermostat.cpp @@ -3,8 +3,10 @@ #include "entity/entity.hpp" #include "mqtt_manager_config/mqtt_manager_config.hpp" #include "thermostat/thermostat.hpp" +#include #include #include +#include #include #include #include @@ -18,6 +20,13 @@ uint64_t CurrentTimeMilliseconds() { } OpenhabThermostat::OpenhabThermostat(uint32_t thermostat_id) : ThermostatEntity(thermostat_id) { + this->_last_target_temperature_change = 0; + this->_last_fan_mode_change = 0; + this->_last_mode_change = 0; + this->_last_preset_change = 0; + this->_last_swing_change = 0; + this->_last_swingh_change = 0; + // Process Home Assistant specific details. General thermostat data is loaded in the "ThermostatEntity" constructor. if (this->_controller != MQTT_MANAGER_ENTITY_CONTROLLER::OPENHAB) { SPDLOG_ERROR("OpenhabThermostat has not been recognized as controlled by OPENHAB. Will stop processing thermostat."); @@ -31,6 +40,7 @@ OpenhabThermostat::OpenhabThermostat(uint32_t thermostat_id) : ThermostatEntity( OpenhabThermostat::~OpenhabThermostat() { OpenhabManager::detach_event_observer(this->_openhab_target_temperature_item, boost::bind(&OpenhabThermostat::openhab_target_temperature_event_callback, this, _1)); + OpenhabManager::detach_event_observer(this->_openhab_current_temperature_item, boost::bind(&OpenhabThermostat::openhab_current_temperature_event_callback, this, _1)); OpenhabManager::detach_event_observer(this->_openhab_fan_mode_item, boost::bind(&OpenhabThermostat::openhab_fan_mode_event_callback, this, _1)); OpenhabManager::detach_event_observer(this->_openhab_mode_item, boost::bind(&OpenhabThermostat::openhab_mode_event_callback, this, _1)); OpenhabManager::detach_event_observer(this->_openhab_preset_item, boost::bind(&OpenhabThermostat::openhab_preset_event_callback, this, _1)); @@ -43,6 +53,7 @@ void OpenhabThermostat::reload_config() { // Detach existing event observers OpenhabManager::detach_event_observer(this->_openhab_target_temperature_item, boost::bind(&OpenhabThermostat::openhab_target_temperature_event_callback, this, _1)); + OpenhabManager::detach_event_observer(this->_openhab_current_temperature_item, boost::bind(&OpenhabThermostat::openhab_current_temperature_event_callback, this, _1)); OpenhabManager::detach_event_observer(this->_openhab_fan_mode_item, boost::bind(&OpenhabThermostat::openhab_fan_mode_event_callback, this, _1)); OpenhabManager::detach_event_observer(this->_openhab_mode_item, boost::bind(&OpenhabThermostat::openhab_mode_event_callback, this, _1)); OpenhabManager::detach_event_observer(this->_openhab_preset_item, boost::bind(&OpenhabThermostat::openhab_preset_event_callback, this, _1)); @@ -64,6 +75,14 @@ void OpenhabThermostat::reload_config() { SPDLOG_ERROR("No openhab_temperature_item name defined for Thermostat {}::{}", this->_id, this->_name); } + if (!this->_use_current_temperature) { + SPDLOG_INFO("Thermostat {}::{} is configured to not use temperature current temperature item."); + } else if (entity_data.contains("openhab_current_temperature_item")) { + this->_openhab_current_temperature_item = entity_data["openhab_current_temperature_item"]; + } else { + SPDLOG_ERROR("No openhab_current_temperature_item name defined for Thermostat {}::{}", this->_id, this->_name); + } + if (entity_data.contains("openhab_fan_mode_item")) { this->_openhab_fan_mode_item = entity_data["openhab_fan_mode_item"]; } else { @@ -76,28 +95,37 @@ void OpenhabThermostat::reload_config() { SPDLOG_WARN("No openhab_hvac_mode_item name defined for Thermostat {}::{}", this->_id, this->_name); } - if (entity_data.contains("openhab_preset_item")) { + if (entity_data.contains("openhab_preset_mode_item") && !std::string(entity_data["openhab_preset_mode_item"]).empty()) { + this->_openhab_preset_item = entity_data["openhab_preset_mode_item"]; + } else if (entity_data.contains("openhab_preset_item")) { // Thermostats saved by the older settings form. this->_openhab_preset_item = entity_data["openhab_preset_item"]; } else { - SPDLOG_WARN("No openhab_preset_item name defined for Thermostat {}::{}", this->_id, this->_name); + SPDLOG_WARN("No openhab_preset_mode_item name defined for Thermostat {}::{}", this->_id, this->_name); } - if (entity_data.contains("openhab_swing_item")) { + if (entity_data.contains("openhab_swing_mode_item") && !std::string(entity_data["openhab_swing_mode_item"]).empty()) { + this->_openhab_swing_item = entity_data["openhab_swing_mode_item"]; + } else if (entity_data.contains("openhab_swing_item")) { // Thermostats saved by the older settings form. this->_openhab_swing_item = entity_data["openhab_swing_item"]; } else { - SPDLOG_WARN("No openhab_swing_item name defined for Thermostat {}::{}", this->_id, this->_name); + SPDLOG_WARN("No openhab_swing_mode_item name defined for Thermostat {}::{}", this->_id, this->_name); } - if (entity_data.contains("openhab_swingh_item")) { + if (entity_data.contains("openhab_swingh_mode_item") && !std::string(entity_data["openhab_swingh_mode_item"]).empty()) { + this->_openhab_swingh_item = entity_data["openhab_swingh_mode_item"]; + } else if (entity_data.contains("openhab_swingh_item")) { // Thermostats saved by the older settings form. this->_openhab_swingh_item = entity_data["openhab_swingh_item"]; } else { - SPDLOG_WARN("No openhab_swingh_item name defined for Thermostat {}::{}", this->_id, this->_name); + SPDLOG_WARN("No openhab_swingh_mode_item name defined for Thermostat {}::{}", this->_id, this->_name); } SPDLOG_DEBUG("Thermostat {}::{} Attaching openhab target temp item: {}", this->_id, this->_name, this->_openhab_target_temperature_item); // Attach new event observers OpenhabManager::attach_event_observer(this->_openhab_target_temperature_item, boost::bind(&OpenhabThermostat::openhab_target_temperature_event_callback, this, _1)); + if (this->_use_current_temperature) { + OpenhabManager::attach_event_observer(this->_openhab_current_temperature_item, boost::bind(&OpenhabThermostat::openhab_current_temperature_event_callback, this, _1)); + } OpenhabManager::attach_event_observer(this->_openhab_fan_mode_item, boost::bind(&OpenhabThermostat::openhab_fan_mode_event_callback, this, _1)); OpenhabManager::attach_event_observer(this->_openhab_mode_item, boost::bind(&OpenhabThermostat::openhab_mode_event_callback, this, _1)); OpenhabManager::attach_event_observer(this->_openhab_preset_item, boost::bind(&OpenhabThermostat::openhab_preset_event_callback, this, _1)); @@ -213,12 +241,11 @@ void OpenhabThermostat::openhab_target_temperature_event_callback(nlohmann::json std::string topic = data["topic"]; std::vector topic_parts; boost::split(topic_parts, topic, boost::is_any_of("/")); - std::string topic_item = topic_parts[2]; - if (topic_parts.size() < 3) { SPDLOG_ERROR("Received ItemStateChangedEvent with a topic with not enough parts, topic: {}", std::string(data["topic"])); return; } + std::string topic_item = topic_parts[2]; nlohmann::json payload = nlohmann::json::parse(std::string(data["payload"])); if (topic_item.compare(this->_openhab_target_temperature_item) == 0) { @@ -233,7 +260,14 @@ void OpenhabThermostat::openhab_target_temperature_event_callback(nlohmann::json return; } - float target_temperature = std::round(atof(std::string(payload["value"]).c_str())); + std::string payload_string = payload["value"].get(); + float target_temperature = 0; + if (!payload_string.empty()) { + auto [ptr, ec] = std::from_chars(payload_string.data(), payload_string.data() + payload_string.size(), target_temperature); + if (ec == std::errc()) { + target_temperature = std::round(target_temperature * 10) / 10; // Round to 1 decimal + } + } SPDLOG_DEBUG("Thermostat {}::{} got new temperature {}, current temperature: {}.", this->_id, this->_name, target_temperature, this->_current_temperature); if (target_temperature != this->_current_temperature) { this->_current_temperature = target_temperature; @@ -256,7 +290,7 @@ void OpenhabThermostat::openhab_target_temperature_event_callback(nlohmann::json return; } - float target_temperature = std::round(atof(std::string(payload["state"]).c_str())); + float target_temperature = std::round(atof(std::string(payload["state"]).c_str()) * 10) / 10; // Round to 1 decimal SPDLOG_DEBUG("Thermostat {}::{} got new temperature {}, current temperature: {}.", this->_id, this->_name, target_temperature, this->_current_temperature); if (target_temperature != this->_current_temperature) { @@ -270,18 +304,92 @@ void OpenhabThermostat::openhab_target_temperature_event_callback(nlohmann::json } } -void OpenhabThermostat::openhab_fan_mode_event_callback(nlohmann::json data) { +void OpenhabThermostat::openhab_current_temperature_event_callback(nlohmann::json data) { + SPDLOG_DEBUG("Thermostat {}::{} get current temperature callback!", this->_id, this->_name); + if (std::string(data["type"]).compare("ItemStateChangedEvent") == 0) { // Extract topic into multiple parts std::string topic = data["topic"]; std::vector topic_parts; boost::split(topic_parts, topic, boost::is_any_of("/")); + if (topic_parts.size() < 3) { + SPDLOG_ERROR("Received ItemStateChangedEvent with a topic with not enough parts, topic: {}", std::string(data["topic"])); + return; + } std::string topic_item = topic_parts[2]; + nlohmann::json payload = nlohmann::json::parse(std::string(data["payload"])); + if (topic_item.compare(this->_openhab_current_temperature_item) == 0) { + // We only care about the first event from Openhab, ignore the rest but still indicate that event was handled so the manager stops looping over all entities. + if (CurrentTimeMilliseconds() >= this->_last_target_temperature_change + 1000) { + SPDLOG_DEBUG("Thermostat {}::{}, payload: {}", this->_id, this->_name, payload.dump()); + if (payload["value"].is_null()) { // Got state but state is NULL, ignore. + return; + } else if (payload["value"].is_string() && std::string(payload["value"]).compare("NULL") == 0) { + return; + } else if (payload["value"].is_object()) { + return; + } + + std::string payload_string = payload["value"].get(); + float current_temperature = 0; + if (!payload_string.empty()) { + auto [ptr, ec] = std::from_chars(payload_string.data(), payload_string.data() + payload_string.size(), current_temperature); + if (ec == std::errc()) { + current_temperature = std::round(current_temperature * 10) / 10; // Round to 1 decimal + } + } + SPDLOG_DEBUG("Thermostat {}::{} got new temperature sensor value {}, current temperature: {}.", this->_id, this->_name, current_temperature, this->_current_temperature_sensor); + if (current_temperature != this->_current_temperature_sensor || !this->_current_temperature_sensor_available) { + this->_current_temperature_sensor = current_temperature; + this->_current_temperature_sensor_available = true; + this->send_state_update_to_nspanel(); + this->_signal_entity_changed(); + } + } + } + } else if (std::string(data["type"]).compare("ItemStateFetched") == 0) { + SPDLOG_TRACE("OpenHAB thermostat {}::{} Got initial data from OpenHAB via custom ItemStateFetched event.", this->_id, this->_name); + if (this->_openhab_current_temperature_item.compare(data["payload"]["name"]) == 0) { + nlohmann::json payload = data["payload"]; + if (payload["state"].is_null()) { // Got state but state is NULL, ignore. + return; + } else if (payload["state"].is_string() && std::string(payload["state"]).compare("NULL") == 0) { + return; + } else if (payload["state"].is_object()) { + return; + } + + std::string payload_string = payload["state"].get(); + float current_temperature = 0; + if (!payload_string.empty()) { + auto [ptr, ec] = std::from_chars(payload_string.data(), payload_string.data() + payload_string.size(), current_temperature); + if (ec == std::errc()) { + current_temperature = std::round(current_temperature * 10) / 10; // Round to 1 decimal + } + } + SPDLOG_DEBUG("Thermostat {}::{} got new temperature {}, current temperature: {}.", this->_id, this->_name, current_temperature, this->_current_temperature_sensor); + if (current_temperature != this->_current_temperature_sensor || !this->_current_temperature_sensor_available) { + this->_current_temperature_sensor = current_temperature; + this->_current_temperature_sensor_available = true; + this->send_state_update_to_nspanel(); + this->_signal_entity_changed(); + } + } + } +} + +void OpenhabThermostat::openhab_fan_mode_event_callback(nlohmann::json data) { + if (std::string(data["type"]).compare("ItemStateChangedEvent") == 0) { + // Extract topic into multiple parts + std::string topic = data["topic"]; + std::vector topic_parts; + boost::split(topic_parts, topic, boost::is_any_of("/")); if (topic_parts.size() < 3) { SPDLOG_ERROR("Received ItemStateChangedEvent with a topic with not enough parts, topic: {}", std::string(data["topic"])); return; } + std::string topic_item = topic_parts[2]; nlohmann::json payload = nlohmann::json::parse(std::string(data["payload"])); if (topic_item.compare(this->_openhab_fan_mode_item) == 0) { @@ -353,12 +461,11 @@ void OpenhabThermostat::openhab_mode_event_callback(nlohmann::json data) { std::string topic = data["topic"]; std::vector topic_parts; boost::split(topic_parts, topic, boost::is_any_of("/")); - std::string topic_item = topic_parts[2]; - if (topic_parts.size() < 3) { SPDLOG_ERROR("Received ItemStateChangedEvent with a topic with not enough parts, topic: {}", std::string(data["topic"])); return; } + std::string topic_item = topic_parts[2]; nlohmann::json payload = nlohmann::json::parse(std::string(data["payload"])); if (topic_item.compare(this->_openhab_mode_item) == 0) { @@ -430,12 +537,11 @@ void OpenhabThermostat::openhab_preset_event_callback(nlohmann::json data) { std::string topic = data["topic"]; std::vector topic_parts; boost::split(topic_parts, topic, boost::is_any_of("/")); - std::string topic_item = topic_parts[2]; - if (topic_parts.size() < 3) { SPDLOG_ERROR("Received ItemStateChangedEvent with a topic with not enough parts, topic: {}", std::string(data["topic"])); return; } + std::string topic_item = topic_parts[2]; nlohmann::json payload = nlohmann::json::parse(std::string(data["payload"])); if (topic_item.compare(this->_openhab_preset_item) == 0) { @@ -481,8 +587,8 @@ void OpenhabThermostat::openhab_preset_event_callback(nlohmann::json data) { } std::string mode = std::string(payload["state"]); - SPDLOG_DEBUG("Thermostat {}::{} got new mode {}, current mode: {}.", this->_id, this->_name, mode, this->_current_mode.value); - if (this->_current_mode.value.compare(mode) != 0) { + SPDLOG_DEBUG("Thermostat {}::{} got new preset {}, current preset: {}.", this->_id, this->_name, mode, this->_current_preset.value); + if (this->_current_preset.value.compare(mode) != 0) { auto new_preset = std::find_if(this->_supported_presets.begin(), this->_supported_presets.end(), [&](const ThermostatOptionHolder &option) { return option.value.compare(mode) == 0; }); @@ -507,12 +613,11 @@ void OpenhabThermostat::openhab_swing_event_callback(nlohmann::json data) { std::string topic = data["topic"]; std::vector topic_parts; boost::split(topic_parts, topic, boost::is_any_of("/")); - std::string topic_item = topic_parts[2]; - if (topic_parts.size() < 3) { SPDLOG_ERROR("Received ItemStateChangedEvent with a topic with not enough parts, topic: {}", std::string(data["topic"])); return; } + std::string topic_item = topic_parts[2]; nlohmann::json payload = nlohmann::json::parse(std::string(data["payload"])); if (topic_item.compare(this->_openhab_swing_item) == 0) { @@ -584,12 +689,11 @@ void OpenhabThermostat::openhab_swingh_event_callback(nlohmann::json data) { std::string topic = data["topic"]; std::vector topic_parts; boost::split(topic_parts, topic, boost::is_any_of("/")); - std::string topic_item = topic_parts[2]; - if (topic_parts.size() < 3) { SPDLOG_ERROR("Received ItemStateChangedEvent with a topic with not enough parts, topic: {}", std::string(data["topic"])); return; } + std::string topic_item = topic_parts[2]; nlohmann::json payload = nlohmann::json::parse(std::string(data["payload"])); if (topic_item.compare(this->_openhab_swingh_item) == 0) { @@ -624,7 +728,7 @@ void OpenhabThermostat::openhab_swingh_event_callback(nlohmann::json data) { } } else if (std::string(data["type"]).compare("ItemStateFetched") == 0) { SPDLOG_TRACE("OpenHAB thermostat {}::{} Got initial data from OpenHAB via custom ItemStateFetched event.", this->_id, this->_name); - if (data.contains("payload") && data.at("payload").contains("name") && this->_openhab_swing_item.compare(data["payload"]["name"]) == 0) { + if (data.contains("payload") && data.at("payload").contains("name") && this->_openhab_swingh_item.compare(data["payload"]["name"]) == 0) { nlohmann::json payload = data["payload"]; if (payload["state"].is_null()) { // Got state but state is NULL, ignore. return; @@ -654,405 +758,3 @@ void OpenhabThermostat::openhab_swingh_event_callback(nlohmann::json data) { } } } - -// TESTING -#if defined(TEST_MODE) && TEST_MODE == 1 -#include - -class HomeAssistantLightTest : public ::testing::Test { -protected: - HomeAssistantLightTest() { - // Initialize any necessary resources or setup for the tests - } - - void SetUp() override { - - // Initialize any necessary resources or setup for the tests - database_manager::Entity light_entity; - light_entity.entity_type = "light"; - light_entity.friendly_name = "Unit test HA light (light)"; - light_entity.room_id = 1; - light_entity.room_view_position = 2; - light_entity.set_entity_data_json({{"can_color_temperature", true}, - {"can_dim", true}, - {"can_rgb", true}, - {"controlled_by_nspanel_main_page", true}, - {"controller", "home_assistant"}, - {"home_assistant_name", "light.office_ceiling_light"}, - {"is_ceiling_light", true}, - {"openhab_control_mode", "dimmer"}, - {"openhab_item_color_temp", ""}, - {"openhab_item_dimmer", ""}, - {"openhab_item_rgb", ""}, - {"openhab_item_switch", ""}, - {"openhab_name", ""}}); - ha_light_id = database_manager::database.insert(light_entity); - // light_entity = database_manager::database.get(ha_light_id); - - SPDLOG_INFO("HA Light created in DB. Creating instance of light object."); - light = new HomeAssistantLight(ha_light_id); - } - - void TearDown() override { - // Clean up any resources or teardown after the tests - - database_manager::database.remove(ha_light_id); - // database_manager::database.remove(ha_light_switch_id); - } - - HomeAssistantLight *light = nullptr; - - int32_t ha_light_id; - int32_t ha_light_switch_id; -}; - -TEST_F(HomeAssistantLightTest, is_off_by_default) { - EXPECT_EQ(light->get_state(), false); - EXPECT_EQ(light->get_brightness(), 0); -} - -TEST_F(HomeAssistantLightTest, is_not_on_after_turn_on_in_nonoptimistic_mode) { - MqttManagerConfig::set_setting_value(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE, "false"); - light->turn_on(false); - light->set_brightness(50, true); - EXPECT_EQ(light->get_state(), false); - EXPECT_EQ(light->get_brightness(), 0); -} - -TEST_F(HomeAssistantLightTest, is_on_after_turn_on_in_optimistic_mode) { - MqttManagerConfig::set_setting_value(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE, "true"); - light->turn_on(false); - light->set_brightness(50, true); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 50); -} - -TEST_F(HomeAssistantLightTest, light_reacts_to_state_changes_from_home_assistant) { - // Enable optimistic mode for this test - MqttManagerConfig::set_setting_value(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE, "true"); - - nlohmann::json event_data = nlohmann::json::parse(R"( - { - - "event":{ - "context":{ - "id":"01K2WNR8WT8VS6B5HTQ7ZEKSAP", - "parent_id":null, - "user_id":"d28bd745ad714c108c27c31a90406189" - }, - "data":{ - "entity_id":"light.office_ceiling_light", - "new_state":{ - "attributes":{ - "brightness":204, - "color_mode":"color_temp", - "color_temp":443, - "color_temp_kelvin":2257, - "effect":null, - "effect_list":[ - "blink", - "breathe", - "okay", - "channel_change", - "finish_effect", - "stop_effect" - ], - "friendly_name":"office_ceiling_light", - "hs_color":[ - 20, - 80 - ], - "max_color_temp_kelvin":4000, - "max_mireds":454, - "min_color_temp_kelvin":2202, - "min_mireds":250, - "rgb_color":[ - 255, - 149, - 46 - ], - "supported_color_modes":[ - "color_temp" - ], - "supported_features":44, - "xy_color":[ - 0.572, - 0.389 - ] - }, - "context":{ - "id":"01K2WNR8WT8VS6B5HTQ7ZEKSAP", - "parent_id":null, - "user_id":"d28bd745ad714c108c27c31a90406189" - }, - "entity_id":"light.office_ceiling_light", - "last_changed":"2025-08-17T18:45:35.203504+00:00", - "last_reported":"2025-08-17T18:48:00.253850+00:00", - "last_updated":"2025-08-17T18:48:00.253850+00:00", - "state":"on" - }, - "old_state": "removed_as_it_is_not_used" - }, - "event_type":"state_changed", - "origin":"LOCAL", - "time_fired":"2025-08-17T18:48:00.253850+00:00" - }, - "id":3, - "type":"event" - - } )"); - - light->home_assistant_event_callback(event_data); - - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 80); // We sent brightness 204, ie. 80% - EXPECT_EQ(light->get_color_temperature(), 2257); - EXPECT_EQ(light->get_color_temperature(), 2257); - - event_data["event"]["data"]["new_state"]["attributes"]["brightness"] = 153; - event_data["event"]["data"]["new_state"]["attributes"]["color_temp_kelvin"] = 5000; - light->home_assistant_event_callback(event_data); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 60); // We sent brightness 153, ie. 60% - EXPECT_EQ(light->get_color_temperature(), 5000); - - event_data["event"]["data"]["new_state"]["state"] = "off"; - event_data["event"]["data"]["new_state"]["attributes"]["brightness"] = 0; - light->home_assistant_event_callback(event_data); - EXPECT_EQ(light->get_state(), false); - EXPECT_EQ(light->get_brightness(), 60); // Remember last brightness value - - // Change to RGB mode - event_data["event"]["data"]["new_state"]["state"] = "on"; - event_data["event"]["data"]["new_state"]["attributes"]["brightness"] = 153; // 60% - event_data["event"]["data"]["new_state"]["attributes"]["color_mode"] = "xy"; // TODO: Update with correct color mode as sent from HA. - light->home_assistant_event_callback(event_data); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 60); - EXPECT_EQ(light->get_hue(), 20); - EXPECT_EQ(light->get_saturation(), 80); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::RGB); - - // Verify that changes to RGB/HSB values as correctly interpreted - event_data["event"]["data"]["new_state"]["attributes"]["hs_color"][0] = 30; - event_data["event"]["data"]["new_state"]["attributes"]["hs_color"][1] = 60; - light->home_assistant_event_callback(event_data); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 60); - EXPECT_EQ(light->get_hue(), 30); - EXPECT_EQ(light->get_saturation(), 60); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::RGB); - - // Verify that we can revert back to color temp mode - event_data["event"]["data"]["new_state"]["state"] = "on"; - event_data["event"]["data"]["new_state"]["attributes"]["brightness"] = 153; // 60% - event_data["event"]["data"]["new_state"]["attributes"]["color_mode"] = "color_temp"; - event_data["event"]["data"]["new_state"]["attributes"]["color_temp_kelvin"] = 4000; - light->home_assistant_event_callback(event_data); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 60); - EXPECT_EQ(light->get_color_temperature(), 4000); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::DEFAULT); -} - -#define COLOR_TEMP_PERCENT_TO_KELVIN(min, max, kelvin_pct) (((max - min) / 100) * kelvin_pct + min) -TEST_F(HomeAssistantLightTest, verify_nspanel_command_compliance) { - // Enable optimistic mode for this test - MqttManagerConfig::set_setting_value(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE, "true"); - uint32_t color_temp_min = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::COLOR_TEMP_MIN); - uint32_t color_temp_max = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::COLOR_TEMP_MAX); - // spdlog::set_level(spdlog::level::trace); - - NSPanelMQTTManagerCommand cmd; - cmd.set_nspanel_id(0); - NSPanelMQTTManagerCommand_LightCommand *light_cmd = cmd.mutable_light_command(); - std::vector light_ids = {light->get_id()}; - light_cmd->add_light_ids(light->get_id()); - light_cmd->set_brightness(50); - light_cmd->set_has_brightness(true); - light_cmd->set_color_temperature(50); - light_cmd->set_has_color_temperature(true); - light_cmd->set_has_hue(false); - light_cmd->set_has_saturation(false); - - light->command_callback(cmd); - - // Check that light turns on, sets correct brightness and color temperature. - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 50); - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 50)); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::DEFAULT); - - // Verify that only color temperature can be change. - light_cmd->set_has_brightness(false); - light_cmd->set_color_temperature(70); - light_cmd->set_has_color_temperature(true); - light->command_callback(cmd); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 50); - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 70)); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::DEFAULT); - - // Verify that only brightness can be change. - light_cmd->set_has_color_temperature(false); - light_cmd->set_has_brightness(true); - light_cmd->set_brightness(70); - light->command_callback(cmd); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 70); - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 70)); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::DEFAULT); - - // Verify that hue and saturation can be changed and the lights goes into RGB mode. - light_cmd->set_has_color_temperature(false); - light_cmd->set_has_brightness(false); - light_cmd->set_hue(30); - light_cmd->set_has_hue(true); - light_cmd->set_saturation(60); - light_cmd->set_has_saturation(true); - light->command_callback(cmd); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 70); // Verify that value is unchanged. - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 70)); // Verify that value is unchanged. - EXPECT_EQ(light->get_hue(), 30); - EXPECT_EQ(light->get_saturation(), 60); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::RGB); - - // Verify that only hue can be changed. - light_cmd->set_has_color_temperature(false); - light_cmd->set_has_brightness(false); - light_cmd->set_hue(40); - light_cmd->set_has_hue(true); - light_cmd->set_saturation(60); - light_cmd->set_has_saturation(false); - light->command_callback(cmd); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 70); // Verify that value is unchanged. - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 70)); // Verify that value is unchanged. - EXPECT_EQ(light->get_hue(), 40); - EXPECT_EQ(light->get_saturation(), 60); // Verify that value is unchanged. - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::RGB); - - // Verify that only saturation can be changed. - light_cmd->set_has_color_temperature(false); - light_cmd->set_has_brightness(false); - light_cmd->set_hue(40); - light_cmd->set_has_hue(false); - light_cmd->set_saturation(70); - light_cmd->set_has_saturation(true); - light->command_callback(cmd); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 70); // Verify that value is unchanged. - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 70)); // Verify that value is unchanged. - EXPECT_EQ(light->get_hue(), 40); // Verify that value is unchanged. - EXPECT_EQ(light->get_saturation(), 70); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::RGB); - - // Verify that brightness can be changed and RGB is kept. - light_cmd->set_has_color_temperature(false); - light_cmd->set_brightness(100); - light_cmd->set_has_brightness(true); - light_cmd->set_hue(40); - light_cmd->set_has_hue(false); - light_cmd->set_saturation(70); - light_cmd->set_has_saturation(false); - light->command_callback(cmd); - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 100); // Verify that value is unchanged. - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 70)); // Verify that value is unchanged. - EXPECT_EQ(light->get_hue(), 40); // Verify that value is unchanged. - EXPECT_EQ(light->get_saturation(), 70); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::RGB); - - MqttManagerConfig::set_setting_value(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE, "true"); -} - -TEST_F(HomeAssistantLightTest, verify_optimistic_mode_compliance) { - // Enable optimistic mode for this test - MqttManagerConfig::set_setting_value(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE, "true"); - uint32_t color_temp_min = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::COLOR_TEMP_MIN); - uint32_t color_temp_max = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::COLOR_TEMP_MAX); - // spdlog::set_level(spdlog::level::trace); - - NSPanelMQTTManagerCommand cmd; - cmd.set_nspanel_id(0); - NSPanelMQTTManagerCommand_LightCommand *light_cmd = cmd.mutable_light_command(); - std::vector light_ids = {light->get_id()}; - light_cmd->add_light_ids(light->get_id()); - light_cmd->set_brightness(50); - light_cmd->set_has_brightness(true); - light_cmd->set_color_temperature(50); - light_cmd->set_has_color_temperature(true); - light_cmd->set_has_hue(false); - light_cmd->set_has_saturation(false); - - light->command_callback(cmd); - - // Check that light turns on, sets correct brightness and color temperature. - EXPECT_EQ(light->get_state(), true); - EXPECT_EQ(light->get_brightness(), 50); - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 50)); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::DEFAULT); - - light_cmd->set_has_brightness(false); - light_cmd->set_has_color_temperature(false); - light_cmd->set_hue(30); - light_cmd->set_has_hue(true); - light_cmd->set_saturation(50); - light_cmd->set_has_saturation(true); - light->command_callback(cmd); - - EXPECT_EQ(light->get_state(), true); // Verify light is still on - EXPECT_EQ(light->get_brightness(), 50); // Verify light is still set to 50% brightness - EXPECT_EQ(light->get_color_temperature(), COLOR_TEMP_PERCENT_TO_KELVIN(color_temp_min, color_temp_max, 50)); // Verify color temp has not changed. - EXPECT_EQ(light->get_hue(), 30); - EXPECT_EQ(light->get_saturation(), 50); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::RGB); // Light should have switched to RGB mode. -} - -TEST_F(HomeAssistantLightTest, verify_non_optimistic_mode_compliance) { - // Turn off optimistic mode and verify that no values change. - MqttManagerConfig::set_setting_value(MQTT_MANAGER_SETTING::OPTIMISTIC_MODE, "false"); - uint32_t color_temp_min = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::COLOR_TEMP_MIN); - uint32_t color_temp_max = MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::COLOR_TEMP_MAX); - // spdlog::set_level(spdlog::level::trace); - - NSPanelMQTTManagerCommand cmd; - cmd.set_nspanel_id(0); - NSPanelMQTTManagerCommand_LightCommand *light_cmd = cmd.mutable_light_command(); - std::vector light_ids = {light->get_id()}; - light_cmd->add_light_ids(light->get_id()); - light_cmd->set_brightness(50); - light_cmd->set_has_brightness(true); - light_cmd->set_color_temperature(50); - light_cmd->set_has_color_temperature(true); - light_cmd->set_has_hue(false); - light_cmd->set_has_saturation(false); - light->command_callback(cmd); - - // Verify light is still off, brightness is still 0 and hue and saturation did not change. - EXPECT_EQ(light->get_state(), false); - EXPECT_EQ(light->get_brightness(), 0); - EXPECT_EQ(light->get_color_temperature(), 0); - EXPECT_EQ(light->get_hue(), 0); - EXPECT_EQ(light->get_saturation(), 0); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::DEFAULT); // Light should have switched to RGB mode. - - light_cmd->set_has_brightness(false); - light_cmd->set_has_color_temperature(false); - light_cmd->set_hue(30); - light_cmd->set_has_hue(true); - light_cmd->set_saturation(30); - light_cmd->set_has_saturation(true); - light->command_callback(cmd); - - // Verify light is still off, brightness is still 0 and hue and saturation did not change. - EXPECT_EQ(light->get_state(), false); - EXPECT_EQ(light->get_brightness(), 0); - EXPECT_EQ(light->get_color_temperature(), 0); - EXPECT_EQ(light->get_hue(), 0); - EXPECT_EQ(light->get_saturation(), 0); - EXPECT_EQ(light->get_mode(), MQTT_MANAGER_LIGHT_MODE::DEFAULT); // Light should have switched to RGB mode. -} - -#endif // !MQTT_MANAGER_HOME_ASSISTANT_LIGHT_TEST diff --git a/docker/MQTTManager/include/thermostat/openhab_thermostat.hpp b/docker/MQTTManager/include/thermostat/openhab_thermostat.hpp index cc13e0aa5..413967761 100644 --- a/docker/MQTTManager/include/thermostat/openhab_thermostat.hpp +++ b/docker/MQTTManager/include/thermostat/openhab_thermostat.hpp @@ -9,16 +9,18 @@ class OpenhabThermostat : public ThermostatEntity { ~OpenhabThermostat(); void reload_config(); void send_state_update_to_controller(); - void openhab_target_temperature_event_callback(nlohmann::json event_data); // When target temperature changes - void openhab_fan_mode_event_callback(nlohmann::json event_data); // When fan mode changes - void openhab_mode_event_callback(nlohmann::json event_data); // When mode changes - void openhab_preset_event_callback(nlohmann::json event_data); // When preset changes - void openhab_swing_event_callback(nlohmann::json event_data); // When swing changes - void openhab_swingh_event_callback(nlohmann::json event_data); // When horizontal swing changes + void openhab_target_temperature_event_callback(nlohmann::json event_data); // When target temperature changes + void openhab_current_temperature_event_callback(nlohmann::json event_data); // When current temperature changes + void openhab_fan_mode_event_callback(nlohmann::json event_data); // When fan mode changes + void openhab_mode_event_callback(nlohmann::json event_data); // When mode changes + void openhab_preset_event_callback(nlohmann::json event_data); // When preset changes + void openhab_swing_event_callback(nlohmann::json event_data); // When swing changes + void openhab_swingh_event_callback(nlohmann::json event_data); // When horizontal swing changes void command_callback(NSPanelMQTTManagerCommand &command); private: std::string _openhab_target_temperature_item; + std::string _openhab_current_temperature_item; std::string _openhab_fan_mode_item; std::string _openhab_mode_item; std::string _openhab_preset_item; diff --git a/docker/MQTTManager/include/thermostat/thermostat.cpp b/docker/MQTTManager/include/thermostat/thermostat.cpp index f45b05275..f88948288 100644 --- a/docker/MQTTManager/include/thermostat/thermostat.cpp +++ b/docker/MQTTManager/include/thermostat/thermostat.cpp @@ -43,15 +43,15 @@ uint16_t ThermostatEntity::get_room_id() { } void ThermostatEntity::reload_config() { - auto switch_entity = database_manager::database.get(this->_id); - this->_name = switch_entity.friendly_name; + auto thermostat_entity = database_manager::database.get(this->_id); + this->_name = thermostat_entity.friendly_name; SPDLOG_DEBUG("Loading thermostat {}::{}.", this->_id, this->_name); - this->_room_id = switch_entity.room_id; - this->_entity_page_id = switch_entity.entities_page_id; - this->_entity_page_slot = switch_entity.room_view_position; + this->_room_id = thermostat_entity.room_id; + this->_entity_page_id = thermostat_entity.entities_page_id; + this->_entity_page_slot = thermostat_entity.room_view_position; - nlohmann::json entity_data = switch_entity.get_entity_data_json(); + nlohmann::json entity_data = thermostat_entity.get_entity_data_json(); if (entity_data.contains("controller")) { std::string controller = entity_data["controller"]; if (controller.compare("home_assistant") == 0) { @@ -79,6 +79,10 @@ void ThermostatEntity::reload_config() { } } + if (entity_data.contains("use_current_temperature") && entity_data.at("use_current_temperature").is_boolean()) { + this->_use_current_temperature = entity_data.at("use_current_temperature").get(); + } + this->_supported_fan_modes.clear(); this->_supported_modes.clear(); this->_supported_swing_modes.clear(); @@ -319,12 +323,17 @@ void ThermostatEntity::send_state_update_to_nspanel() { th_status->set_step_size(this->_step_size); th_status->set_has_current_temperature(false); - auto room = EntityManager::get_room(this->_room_id); - if (room && (*room)->has_temperature_sensor()) { - auto room_temp = (*room)->get_temperature(); - if (room_temp) { - th_status->set_current_temperature(*room_temp); - th_status->set_has_current_temperature(true); + if (this->_use_current_temperature && this->_current_temperature_sensor_available) { + th_status->set_current_temperature(this->_current_temperature_sensor); + th_status->set_has_current_temperature(true); + } else { + auto room = EntityManager::get_room(this->_room_id); + if (room && (*room)->has_temperature_sensor()) { + auto room_temp = (*room)->get_temperature(); + if (room_temp) { + th_status->set_current_temperature(*room_temp); + th_status->set_has_current_temperature(true); + } } } diff --git a/docker/MQTTManager/include/thermostat/thermostat.hpp b/docker/MQTTManager/include/thermostat/thermostat.hpp index 1ed2234f9..cdbe01f98 100644 --- a/docker/MQTTManager/include/thermostat/thermostat.hpp +++ b/docker/MQTTManager/include/thermostat/thermostat.hpp @@ -190,6 +190,16 @@ class ThermostatEntity : public MqttManagerEntity { uint8_t _entity_page_slot; float _step_size; + // The last read temperature value from the thermostat or selected temperature item + float _current_temperature_sensor = 0; + + // Is the _current_temperature value available or should we fallback to room temperature + bool _current_temperature_sensor_available = false; + + // Use the current temperature from the thermostat or openhab item + // Otherwise, fallback to room temperature or internal thermistor if no room temperature is available + bool _use_current_temperature = false; + static constexpr const char *mode_label = "Mode"; static constexpr const char *fan_label = "Fan"; static constexpr const char *preset_label = "Presets"; diff --git a/docker/MQTTManager/include/weather/weather.cpp b/docker/MQTTManager/include/weather/weather.cpp index 19c629818..9a94c854b 100644 --- a/docker/MQTTManager/include/weather/weather.cpp +++ b/docker/MQTTManager/include/weather/weather.cpp @@ -76,7 +76,7 @@ void MQTTManagerWeather::_pull_new_weather_data() { } std::lock_guard lock_guard(MQTTManagerWeather::_weater_data_mutex); - std::string pull_weather_url = fmt::format("https://api.open-meteo.com/v1/forecast?latitude={}&longitude={}¤t=temperature_2m,relative_humidity_2m,precipitation,weather_code,wind_speed_10m,wind_gusts_10m&daily=weather_code,temperature_2m_max,temperature_2m_min,sunrise,sunset,precipitation_sum,precipitation_probability_max,wind_speed_10m_max,wind_gusts_10m_max&timeformat=unixtime&wind_speed_unit={}&timezone={}&precipitation_unit={}&temperature_unit={}", + std::string pull_weather_url = fmt::format("https://api.open-meteo.com/v1/forecast?latitude={}&longitude={}¤t=temperature_2m,relative_humidity_2m,precipitation,precipitation_probability,weather_code,wind_speed_10m,wind_gusts_10m&daily=weather_code,temperature_2m_max,temperature_2m_min,sunrise,sunset,precipitation_sum,precipitation_probability_max,wind_speed_10m_max,wind_gusts_10m_max&timeformat=unixtime&wind_speed_unit={}&timezone={}&precipitation_unit={}&temperature_unit={}", MQTTManagerWeather::_location_latitude, MQTTManagerWeather::_location_longitude, MQTTManagerWeather::_wind_speed_format, @@ -178,6 +178,8 @@ void MQTTManagerWeather::_process_weather_data(std::string &weather_string) { } MQTTManagerWeather::_current_condition = std::to_string(int(data["current"]["weather_code"])); MQTTManagerWeather::_current_wind_speed = data["current"]["wind_speed_10m"]; + // Not every weather model provides a probability, so a null here must not stop the rest of the update. + MQTTManagerWeather::_current_precipitation_probability = data["current"]["precipitation_probability"].is_number() ? float(data["current"]["precipitation_probability"]) : 0; MQTTManagerWeather::_current_min_temperature = MQTTManagerWeather::_forecast_weather_info[0].temperature_low; MQTTManagerWeather::_current_max_temperature = MQTTManagerWeather::_forecast_weather_info[0].temperature_high; @@ -253,7 +255,7 @@ void MQTTManagerWeather::send_state_update() { NSPanelWeatherUpdate_ForecastItem *forecast_item = weather_protbuf.add_forecast_items(); forecast_item->set_weather_icon(MQTTManagerWeather::_get_icon_from_mapping(info.condition, info.time.tm_hour, false)); // TODO: Implement ability for users to select precipitation volume instead of probability. - forecast_item->set_precipitation_string(fmt::format("{:.0f}%", info.precipitation)); + forecast_item->set_precipitation_string(fmt::format("{:.0f}%", info.precipitation_probability)); forecast_item->set_temperature_maxmin_string(fmt::format("{:.0f}°/{:.0f}°", info.temperature_high, info.temperature_low)); forecast_item->set_wind_string(fmt::format("{:.0f}{}", info.wind_speed, MQTTManagerWeather::_windspeed_unit)); // TODO: Implement ability for users to display comming 5 hours instead of 5 days. diff --git a/docker/MQTTManager/include/weather/weather.hpp b/docker/MQTTManager/include/weather/weather.hpp index 737661950..705d91471 100644 --- a/docker/MQTTManager/include/weather/weather.hpp +++ b/docker/MQTTManager/include/weather/weather.hpp @@ -5,6 +5,7 @@ #include #include #ifndef MQTT_MANAGER_WEATHER +#define MQTT_MANAGER_WEATHER class MQTTManagerWeather { public: @@ -33,6 +34,14 @@ class MQTTManagerWeather { */ static void send_state_update(); +#if defined(TEST_MODE) && TEST_MODE == 1 + // Process an Open-Meteo response as if it had just been fetched, and send the result even if it is unchanged. + static void test_process_weather_data(std::string data) { + MQTTManagerWeather::_last_weather_update.clear(); + MQTTManagerWeather::_process_weather_data(data); + } +#endif + private: static inline std::thread _instance; diff --git a/docker/MQTTManager/include/websocket_server/websocket_server.cpp b/docker/MQTTManager/include/websocket_server/websocket_server.cpp index 46c8882fc..fdd3cd642 100644 --- a/docker/MQTTManager/include/websocket_server/websocket_server.cpp +++ b/docker/MQTTManager/include/websocket_server/websocket_server.cpp @@ -40,6 +40,7 @@ void StompTopic::subscribe(ix::WebSocket &webSocket, std::string subscription_id _subscribers.push_back(std::make_pair(&webSocket, subscription_id)); if (this->_retained) { + SPDLOG_DEBUG("Subscribed to retained topic. Will send message."); StompFrame frame; frame.type = StompFrame::MessageType::MESSAGE; frame.headers["message-id"] = boost::uuids::to_string(this->_uuid_generator()); @@ -97,6 +98,7 @@ void StompTopic::update_value(nlohmann::json &data) { } void StompTopic::set_retained(bool retained) { + SPDLOG_TRACE("Setting topic '{}' to retained? {}", this->_topic_name, retained ? "Yes" : "No"); this->_retained = retained; } @@ -300,6 +302,7 @@ void WebsocketServer::_websocket_message_callback(std::shared_ptrheaders["destination"]); WebsocketServer::_stomp_topics.push_back(std::make_shared(frame->headers["destination"], "")); WebsocketServer::_stomp_topics.back()->subscribe(webSocket, frame->headers["id"]); } else if (frame->type == StompFrame::UNSUBSCRIBE) { @@ -603,7 +606,22 @@ void WebsocketServer::_send_active_warnings() { base["warnings"] = nlohmann::json::array(); for (auto &warning : WebsocketServer::_active_warnings) { SPDLOG_DEBUG("Sending warnings, found warning: {}", warning.warning_text); - base["warnings"].push_back({{"level", warning.level}, {"text", warning.warning_text}}); + std::string warning_level_str = "unknown"; + switch (warning.level) { + case WebsocketServer::ActiveWarningLevel::ERROR: + warning_level_str = "error"; + break; + case WebsocketServer::ActiveWarningLevel::WARNING: + warning_level_str = "warning"; + break; + case WebsocketServer::ActiveWarningLevel::INFO: + warning_level_str = "info"; + break; + case WebsocketServer::ActiveWarningLevel::DEBUG: + warning_level_str = "debug"; + break; + } + base["warnings"].push_back({{"level", warning_level_str}, {"text", warning.warning_text}}); } WebsocketServer::update_stomp_topic_value("mqttmanager/warnings", base); } diff --git a/docker/MQTTManager/run_tests.sh b/docker/MQTTManager/run_tests.sh new file mode 100755 index 000000000..c43326551 --- /dev/null +++ b/docker/MQTTManager/run_tests.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Build and run the MQTTManager unit tests in Docker. +# +# ./run_tests.sh # everything +# ./run_tests.sh --gtest_filter='LightConfig.*' # extra arguments go to the test binary +# +# Output is also written to tests/last_run.log. The first run builds all Conan dependencies +# and takes a while; later runs reuse the nspm-mqttmanager-conan and -build Docker volumes. +# To start from scratch: docker volume rm nspm-mqttmanager-conan nspm-mqttmanager-build +# +# NSPM_TEST_CONAN_CACHE and NSPM_TEST_BUILD_DIR override those volumes with another volume name +# or an absolute host path (CI uses a host directory so it can cache it between runs). +# NSPM_TEST_RESULTS_DIR, an absolute host path, also writes JUnit XML results there. +cd "$(dirname "$0")" || exit 1 + +IMAGE=nspm-mqttmanager-tests +LOG=tests/last_run.log +CONAN_CACHE=${NSPM_TEST_CONAN_CACHE:-nspm-mqttmanager-conan} +BUILD_DIR=${NSPM_TEST_BUILD_DIR:-nspm-mqttmanager-build} + +RESULTS_MOUNT=() +if [ -n "${NSPM_TEST_RESULTS_DIR:-}" ]; then + mkdir -p "$NSPM_TEST_RESULTS_DIR" + RESULTS_MOUNT=(-v "$NSPM_TEST_RESULTS_DIR":/results) + set -- --gtest_output=xml:/results/mqttmanager-tests.xml "$@" +fi + +{ + docker build -q -t "$IMAGE" tests/docker && + docker run --rm \ + -v "$PWD":/src:ro \ + -v "$CONAN_CACHE":/root/.conan2/p \ + -v "$BUILD_DIR":/MQTTManager/build \ + "${RESULTS_MOUNT[@]}" \ + "$IMAGE" bash /src/tests/docker/run_in_container.sh "$@" +} 2>&1 | tee "$LOG" +status=${PIPESTATUS[0]} + +# When run with sudo, hand the log back to the invoking user. +if [ -n "${SUDO_UID:-}" ]; then + chown "$SUDO_UID:$SUDO_GID" "$LOG" +fi +exit "$status" diff --git a/docker/MQTTManager/src/main.cpp b/docker/MQTTManager/src/main.cpp index 396227bb7..54dde9281 100644 --- a/docker/MQTTManager/src/main.cpp +++ b/docker/MQTTManager/src/main.cpp @@ -1,6 +1,7 @@ #include "command_manager/command_manager.hpp" #include "database_manager/database_manager.hpp" #include "entity/entity.hpp" +#include "manager_clock/manager_clock.hpp" #include "openhab_manager/openhab_manager.hpp" #include "spdlog/sinks/ansicolor_sink.h" #include "spdlog/sinks/rotating_file_sink.h" @@ -18,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -37,8 +39,8 @@ void sigusr1_handler(int signal) { if (signal == SIGUSR1) { - SPDLOG_INFO("Reloading config from manager. Will wait 50ms for other processing to complete before proceeding with config reload."); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + SPDLOG_INFO("Reloading config from manager."); + // std::this_thread::sleep_for(std::chrono::milliseconds(50)); MqttManagerConfig::load(); MQTT_Manager::reload_config(); @@ -51,64 +53,6 @@ void sigusr1_handler(int signal) { } } -void publish_time_and_date() { - // Set timezone - setenv("TZ", MqttManagerConfig::timezone.c_str(), 1); - tzset(); - - // Timezone loaded, proceed to update MQTT - for (;;) { - char time_buffer[20]; - char ampm_buffer[20]; - std::string time_str; - char date_buffer[100]; - std::string date_str; - - std::time_t time = std::time({}); - std::strftime(date_buffer, 100, MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::DATE_FORMAT).c_str(), std::localtime(&time)); - date_str = date_buffer; - - if (!MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::CLOCK_US_STYLE)) [[likely]] { - std::strftime(time_buffer, 20, "%H:%M", std::localtime(&time)); - time_str = time_buffer; - } else { - std::strftime(time_buffer, 20, "%I:%M", std::localtime(&time)); - std::strftime(ampm_buffer, 20, "%p", std::localtime(&time)); - time_str = time_buffer; - } - - MQTT_Manager::publish(fmt::format("nspanel/mqttmanager_{}/status/time", MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MANAGER_ADDRESS)), time_buffer, true); - if (!MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::CLOCK_US_STYLE)) [[likely]] { - MQTT_Manager::publish(fmt::format("nspanel/mqttmanager_{}/status/ampm", MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MANAGER_ADDRESS)), "", true); - } else { - MQTT_Manager::publish(fmt::format("nspanel/mqttmanager_{}/status/ampm", MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MANAGER_ADDRESS)), ampm_buffer, true); - } - - MQTT_Manager::publish(fmt::format("nspanel/mqttmanager_{}/status/date", MqttManagerConfig::get_setting_with_default(MQTT_MANAGER_SETTING::MANAGER_ADDRESS)), date_buffer, true); - - // Sleep until next minute - auto t_now = std::chrono::system_clock::now(); - auto t_now_c = std::chrono::system_clock::to_time_t(t_now); - std::tm next_minute_tm = *std::localtime(&t_now_c); - next_minute_tm.tm_sec = 1; // Always wait to minute change over and not the exact same second - - next_minute_tm.tm_min++; - if (next_minute_tm.tm_min >= 60) { // We went over to next hour - next_minute_tm.tm_min = 0; - next_minute_tm.tm_hour++; - if (next_minute_tm.tm_hour >= 24) { // We went over to next day - next_minute_tm.tm_hour = 0; - next_minute_tm.tm_mday++; - // mktime (called below) normalises month/year overflow and handles - // varying month lengths and leap years, so no manual rollover needed. - } - } - - auto t_next_minute = std::chrono::system_clock::from_time_t(std::mktime(&next_minute_tm)); - std::this_thread::sleep_until(t_next_minute); - } -} - int main(int argc, char *argv[]) { // If we are in test mode, don't start the MQTTManager. Simply run all test then exit. #if defined(TEST_MODE) && TEST_MODE == 1 @@ -195,14 +139,17 @@ int main(int argc, char *argv[]) { std::thread home_assistant_manager_thread; std::thread openhab_manager_thread; std::thread websocket_server_thread; - std::thread time_and_date_thread; + std::thread nextion_image_server_thread; SPDLOG_INFO("Starting Websocket Server on port 8002."); websocket_server_thread = std::thread(WebsocketServer::start); + SPDLOG_INFO("Starting Nextion image server on port 8003."); + nextion_image_server_thread = std::thread(NextionImageServer::start); + SPDLOG_INFO("Config loaded. Starting components."); - time_and_date_thread = std::thread(publish_time_and_date); + ManagerClock::start(); // Send the time and date to NSPanels every minute and each time MQTT connects home_assistant_manager_thread = std::thread(HomeAssistantManager::connect); openhab_manager_thread = std::thread(OpenhabManager::connect); diff --git a/docker/MQTTManager/tests/CMakeLists.txt b/docker/MQTTManager/tests/CMakeLists.txt new file mode 100644 index 000000000..7b3d7339c --- /dev/null +++ b/docker/MQTTManager/tests/CMakeLists.txt @@ -0,0 +1,42 @@ +# Unit tests for MQTTManager. Built when NSPM_BUILD_TESTS is ON. +# +# Tests live in this directory (*_test.cpp). The older inline tests inside the library +# sources (wrapped in `#if TEST_MODE == 1`) are linked in too, so this one executable +# runs everything. + +file(GLOB NSPM_TEST_SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*_test.cpp) + +add_executable(nspm_mqttmanager_tests main.cpp ${NSPM_TEST_SOURCES}) +target_include_directories(nspm_mqttmanager_tests PRIVATE ${CMAKE_INCLUDE_SRC_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR}) +# Recorded data some tests load at runtime (see fixtures/). +target_compile_definitions(nspm_mqttmanager_tests PRIVATE NSPM_TEST_FIXTURES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/fixtures") + +# Libraries containing inline tests. They are static libraries, and the linker only pulls in +# object files something references, so they are linked whole to make sure every inline test +# registers with GoogleTest. (CMake's WHOLE_ARCHIVE link feature cannot be used because the +# same libraries are also linked transitively. This is a single call because +# target_link_options drops repeated options, which would unwrap every library after the first.) +set(NSPM_LIBRARIES_WITH_INLINE_TESTS + MQTTManager_Config + MQTTManager_Light +) +set(NSPM_INLINE_TEST_ARCHIVES) +foreach(library ${NSPM_LIBRARIES_WITH_INLINE_TESTS}) + list(APPEND NSPM_INLINE_TEST_ARCHIVES "$") +endforeach() +target_link_options(nspm_mqttmanager_tests PRIVATE "LINKER:--whole-archive" ${NSPM_INLINE_TEST_ARCHIVES} "LINKER:--no-whole-archive") + +# Export the executable's symbols so the crash handler in main.cpp can name the functions in a backtrace. +target_link_options(nspm_mqttmanager_tests PRIVATE -rdynamic) + +target_link_libraries(nspm_mqttmanager_tests PRIVATE + ${NSPM_LIBRARIES_WITH_INLINE_TESTS} + MQTTManager_DatabaseManager MQTTManager_Entity + MQTT_Manager MQTTManager_ManagerClock MQTTManager_HomeAssistantManager MQTTManager_OpenhabManager MQTTManager_EntityManager + MQTTManager_Scene MQTTManager_Room MQTTManager_WebsocketServer MQTTManager_CommandManager + MQTTManager_Switch MQTTManager_Button MQTTManager_Thermostat MQTTManager_MediaPlayer + MQTTManager_Cover MQTTManager_Weather MQTTManager_NSPanel + ixwebsocket::ixwebsocket gtest::gtest +) + +gtest_discover_tests(nspm_mqttmanager_tests DISCOVERY_TIMEOUT 60) diff --git a/docker/MQTTManager/tests/button_test.cpp b/docker/MQTTManager/tests/button_test.cpp new file mode 100644 index 000000000..956103c8d --- /dev/null +++ b/docker/MQTTManager/tests/button_test.cpp @@ -0,0 +1,111 @@ +#include "test_helpers.hpp" +#include - - - - {% if entity.controller == "home_assistant" %} -
- {% elif entity.controller == "openhab" %} -
- {% elif entity.controller == "nspm_scene" or entity.controller == "nspm" %} -
- {% else %} -
- {% endif %} - - {{ entity.friendly_name }} - - {% endwith %} - {% else %} -
- {% if page.is_scenes_page %} - No scene set - {% else %} - No entitiy set - {% endif %} - - {% if page.room %} - {% concat_all '{"page_id": ' page.id ', "page_slot": ' i ', "room_id": ' page.room.id ', "is_scenes_page": "' is_scenes_page '", "is_global_scenes_page": "' is_global_scenes_page '"}' as action_args %} - {% else %} - {% concat_all '{"page_id": ' page.id ', "page_slot": ' i ', "is_scenes_page": "' is_scenes_page '", "is_global_scenes_page": "' is_global_scenes_page '"}' as action_args %} - {% endif %} - {% if page.is_scenes_page %} - - {% else %} - - {% endif %} -
- {% endif %} - - {% endfor %} - - - - {% if total_num_entity_pages > 1 %}{% endif %} - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_name/nspanel_name.py b/docker/web/nspanelmanager/web/components/nspanel_name/nspanel_name.py deleted file mode 100644 index e1a927a04..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_name/nspanel_name.py +++ /dev/null @@ -1,23 +0,0 @@ -from django_components import component -from django.template.context import Context - -@component.register("nspanel_name") -class NSPanelName(component.Component): - template_view = None - - def get_context_data(self, id, name): - return { - "id": id, - "name": name, - } - - def get_template_name(self, context: Context): - if self.template_view: - url_name = self.template_view - else: - url_name = context.request.resolver_match.url_name - if url_name == "htmx_partial_index_nspanels_section" or url_name == "index": - return "nspanel_name/nspanel_name_index.html" - - class Media: - css = "css/main.css" diff --git a/docker/web/nspanelmanager/web/components/nspanel_name/nspanel_name_index.html b/docker/web/nspanelmanager/web/components/nspanel_name/nspanel_name_index.html deleted file mode 100644 index e391e74a7..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_name/nspanel_name_index.html +++ /dev/null @@ -1 +0,0 @@ -{{ name }} diff --git a/docker/web/nspanelmanager/web/components/nspanel_reboot_button/nspanel_reboot_button.py b/docker/web/nspanelmanager/web/components/nspanel_reboot_button/nspanel_reboot_button.py deleted file mode 100644 index 120fda564..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_reboot_button/nspanel_reboot_button.py +++ /dev/null @@ -1,34 +0,0 @@ -from django_components import component -from django.template.context import Context - -from web.models import NSPanel - -@component.register("nspanel_reboot_button") -class NSPanelRebootButton(component.Component): - template_view = None - - def get_context_data(self, id): - nspanel = NSPanel.objects.get(id=id) - return { - "nspanel": nspanel, - } - - def get_template_name(self, context: Context): - if self.template_view: - url_name = self.template_view - else: - url_name = context.request.resolver_match.url_name - if url_name == "htmx_partial_index_nspanels_section" or url_name == "index": - return "nspanel_reboot_button/nspanel_reboot_button_index.html" - elif url_name == "edit_nspanel": - return "nspanel_reboot_button/nspanel_reboot_button_edit_nspanel.html" - - def get(self, request, view, nspanel_id): - self.template_view = view - args = { - "id": nspanel_id, - } - return self.render_to_response(kwargs=args) - - class Media: - css = "css/main.css" diff --git a/docker/web/nspanelmanager/web/components/nspanel_reboot_button/nspanel_reboot_button_edit_nspanel.html b/docker/web/nspanelmanager/web/components/nspanel_reboot_button/nspanel_reboot_button_edit_nspanel.html deleted file mode 100644 index bc9e09f18..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_reboot_button/nspanel_reboot_button_edit_nspanel.html +++ /dev/null @@ -1,3 +0,0 @@ -
- Reboot -
diff --git a/docker/web/nspanelmanager/web/components/nspanel_reboot_button/nspanel_reboot_button_index.html b/docker/web/nspanelmanager/web/components/nspanel_reboot_button/nspanel_reboot_button_index.html deleted file mode 100644 index 8291cc252..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_reboot_button/nspanel_reboot_button_index.html +++ /dev/null @@ -1,4 +0,0 @@ -
- Reboot -
diff --git a/docker/web/nspanelmanager/web/components/nspanel_room_entities_pages/nspanel_room_entities_pages.py b/docker/web/nspanelmanager/web/components/nspanel_room_entities_pages/nspanel_room_entities_pages.py deleted file mode 100644 index c3fc082f0..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_room_entities_pages/nspanel_room_entities_pages.py +++ /dev/null @@ -1,39 +0,0 @@ -from django_components import component -from django.template.context import Context -from django.template import RequestContext -from web.models import RoomEntitiesPage, Room - -@component.register("nspanel_room_entities_pages") -class NSPanelRoomEntitiesPages(component.Component): - template_view = None - - def get_context_data(self, room_id, is_scenes_pages, is_global_scenes_page): - if is_global_scenes_page: - room = None - else: - room = Room.objects.get(id=room_id) - - pages = RoomEntitiesPage.objects.filter(room=room, is_scenes_page=is_scenes_pages).order_by('display_order') - data = { - "room": room, - "is_scenes_pages": is_scenes_pages, - "entity_pages": pages, - "num_entity_pages": len(pages), - } - return data - - def get_template_name(self, context: Context): - return "nspanel_room_entities_pages/nspanel_room_entities_pages_edit_room.html" - - def get(self, request, view, room_id, is_scenes_pages, is_global_scenes_page): - self.template_view = view - args = { - "room_id": room_id, - "is_scenes_pages": is_scenes_pages, - "is_global_scenes_page": is_global_scenes_page, - } - context = RequestContext(request, {"view": view}) - return self.render_to_response(context=context, kwargs=args) - - class Media: - css = "css/main.css" diff --git a/docker/web/nspanelmanager/web/components/nspanel_room_entities_pages/nspanel_room_entities_pages_edit_room.html b/docker/web/nspanelmanager/web/components/nspanel_room_entities_pages/nspanel_room_entities_pages_edit_room.html deleted file mode 100644 index 3320c66d4..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_room_entities_pages/nspanel_room_entities_pages_edit_room.html +++ /dev/null @@ -1,37 +0,0 @@ -
- {% if entity_pages|length > 0 %} - -
- -
-
    - {% for entity_page in entity_pages %} - {% component "nspanel_entities_page" id=entity_page.id page=entity_page total_num_entity_pages=num_entity_pages %}{% endcomponent %} - {% endfor %} -
- {% else %} - No entity pages added yet. - {% endif %} - - -
diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_header/nspanel_status_header.py b/docker/web/nspanelmanager/web/components/nspanel_status_header/nspanel_status_header.py deleted file mode 100644 index ed847279c..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_header/nspanel_status_header.py +++ /dev/null @@ -1,32 +0,0 @@ -from django_components import component -from django.template.context import Context - -from web.models import NSPanel - -@component.register("nspanel_status_header") -class NSPanelHeader(component.Component): - template_view = None - - def get_context_data(self, id): - nspanel = NSPanel.objects.get(id=id) - return { - "nspanel": nspanel, - } - - def get_template_name(self, context: Context): - if self.template_view: - url_name = self.template_view - else: - url_name = context.request.resolver_match.url_name - if url_name == "htmx_partial_index_nspanels_section" or url_name == "index": - return "nspanel_status_header/nspanel_status_header_index.html" - - def get(self, request, view, nspanel_id): - self.template_view = view - args = { - "id": nspanel_id, - } - return self.render_to_response(kwargs=args) - - class Media: - css = "css/main.css" diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_header/nspanel_status_header_index.html b/docker/web/nspanelmanager/web/components/nspanel_status_header/nspanel_status_header_index.html deleted file mode 100644 index 16321ddb6..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_header/nspanel_status_header_index.html +++ /dev/null @@ -1,43 +0,0 @@ - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_humidity/nspanel_status_humidity.py b/docker/web/nspanelmanager/web/components/nspanel_status_humidity/nspanel_status_humidity.py deleted file mode 100644 index 7a0afd288..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_humidity/nspanel_status_humidity.py +++ /dev/null @@ -1,34 +0,0 @@ -from django.template.context import Context -from django_components import component -from web.models import NSPanel -from web.settings_helper import get_setting_with_default - - -@component.register("nspanel_status_humidity") -class NSPanelStatusHumidity(component.Component): - template_view = None - - def get_context_data(self, id): - nspanel = NSPanel.objects.get(id=id) - return { - "nspanel": nspanel, - } - - def get_template_name(self, context: Context): - if self.template_view: - url_name = self.template_view - else: - url_name = context.request.resolver_match.url_name - - if url_name == "edit_nspanel": - return "nspanel_status_humidity/nspanel_status_humidity_edit_nspanel.html" - - def get(self, request, view, nspanel_id): - self.template_view = view - args = { - "id": nspanel_id, - } - return self.render_to_response(kwargs=args) - - class Media: - css = "css/main.css" diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_humidity/nspanel_status_humidity_edit_nspanel.html b/docker/web/nspanelmanager/web/components/nspanel_status_humidity/nspanel_status_humidity_edit_nspanel.html deleted file mode 100644 index a4f9865f1..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_humidity/nspanel_status_humidity_edit_nspanel.html +++ /dev/null @@ -1,40 +0,0 @@ - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_light/nspanel_status_light.py b/docker/web/nspanelmanager/web/components/nspanel_status_light/nspanel_status_light.py deleted file mode 100644 index 6cc853bdc..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_light/nspanel_status_light.py +++ /dev/null @@ -1,34 +0,0 @@ -from django.template.context import Context -from django_components import component -from web.models import NSPanel -from web.settings_helper import get_setting_with_default - - -@component.register("nspanel_status_light") -class NSPanelStatusLight(component.Component): - template_view = None - - def get_context_data(self, id): - nspanel = NSPanel.objects.get(id=id) - return { - "nspanel": nspanel, - } - - def get_template_name(self, context: Context): - if self.template_view: - url_name = self.template_view - else: - url_name = context.request.resolver_match.url_name - - if url_name == "edit_nspanel": - return "nspanel_status_light/nspanel_status_light_edit_nspanel.html" - - def get(self, request, view, nspanel_id): - self.template_view = view - args = { - "id": nspanel_id, - } - return self.render_to_response(kwargs=args) - - class Media: - css = "css/main.css" diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_light/nspanel_status_light_edit_nspanel.html b/docker/web/nspanelmanager/web/components/nspanel_status_light/nspanel_status_light_edit_nspanel.html deleted file mode 100644 index 6ef04ea42..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_light/nspanel_status_light_edit_nspanel.html +++ /dev/null @@ -1,40 +0,0 @@ - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_pressure/nspanel_status_pressure.py b/docker/web/nspanelmanager/web/components/nspanel_status_pressure/nspanel_status_pressure.py deleted file mode 100644 index 5dec46c1c..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_pressure/nspanel_status_pressure.py +++ /dev/null @@ -1,34 +0,0 @@ -from django.template.context import Context -from django_components import component -from web.models import NSPanel -from web.settings_helper import get_setting_with_default - - -@component.register("nspanel_status_pressure") -class NSPanelStatusPressure(component.Component): - template_view = None - - def get_context_data(self, id): - nspanel = NSPanel.objects.get(id=id) - return { - "nspanel": nspanel, - } - - def get_template_name(self, context: Context): - if self.template_view: - url_name = self.template_view - else: - url_name = context.request.resolver_match.url_name - - if url_name == "edit_nspanel": - return "nspanel_status_pressure/nspanel_status_pressure_edit_nspanel.html" - - def get(self, request, view, nspanel_id): - self.template_view = view - args = { - "id": nspanel_id, - } - return self.render_to_response(kwargs=args) - - class Media: - css = "css/main.css" diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_pressure/nspanel_status_pressure_edit_nspanel.html b/docker/web/nspanelmanager/web/components/nspanel_status_pressure/nspanel_status_pressure_edit_nspanel.html deleted file mode 100644 index ed5027a92..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_pressure/nspanel_status_pressure_edit_nspanel.html +++ /dev/null @@ -1,40 +0,0 @@ - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_ram_usage/nspanel_status_ram_usage.py b/docker/web/nspanelmanager/web/components/nspanel_status_ram_usage/nspanel_status_ram_usage.py deleted file mode 100644 index 572fda2aa..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_ram_usage/nspanel_status_ram_usage.py +++ /dev/null @@ -1,34 +0,0 @@ -from django_components import component -from django.template.context import Context - -from web.models import NSPanel - -@component.register("nspanel_status_ram_usage") -class NSPanelStatusRamUsage(component.Component): - template_view = None - - def get_context_data(self, id): - nspanel = NSPanel.objects.get(id=id) - return { - "nspanel": nspanel, - } - - def get_template_name(self, context: Context): - if self.template_view: - url_name = self.template_view - else: - url_name = context.request.resolver_match.url_name - if url_name == "htmx_partial_index_nspanels_section" or url_name == "index": - return "nspanel_status_ram_usage/nspanel_status_ram_usage_index.html" - elif url_name == "edit_nspanel": - return "nspanel_status_ram_usage/nspanel_status_ram_usage_edit_nspanel.html" - - def get(self, request, view, nspanel_id): - self.template_view = view - args = { - "id": nspanel_id, - } - return self.render_to_response(kwargs=args) - - class Media: - css = "css/main.css" diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_ram_usage/nspanel_status_ram_usage_edit_nspanel.html b/docker/web/nspanelmanager/web/components/nspanel_status_ram_usage/nspanel_status_ram_usage_edit_nspanel.html deleted file mode 100644 index 707efa0ee..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_ram_usage/nspanel_status_ram_usage_edit_nspanel.html +++ /dev/null @@ -1,40 +0,0 @@ - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_ram_usage/nspanel_status_ram_usage_index.html b/docker/web/nspanelmanager/web/components/nspanel_status_ram_usage/nspanel_status_ram_usage_index.html deleted file mode 100644 index ae4a8a263..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_ram_usage/nspanel_status_ram_usage_index.html +++ /dev/null @@ -1,40 +0,0 @@ - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_temperature/nspanel_status_temperature.py b/docker/web/nspanelmanager/web/components/nspanel_status_temperature/nspanel_status_temperature.py deleted file mode 100644 index b0c51127a..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_temperature/nspanel_status_temperature.py +++ /dev/null @@ -1,36 +0,0 @@ -from django_components import component -from django.template.context import Context - -from web.models import NSPanel -from web.settings_helper import get_setting_with_default - -@component.register("nspanel_status_temperature") -class NSPanelStatusTemperature(component.Component): - template_view = None - - def get_context_data(self, id): - nspanel = NSPanel.objects.get(id=id) - return { - "nspanel": nspanel, - "temperature_unit": "°F" if get_setting_with_default("use_fahrenheit") == "True" else "°C" - } - - def get_template_name(self, context: Context): - if self.template_view: - url_name = self.template_view - else: - url_name = context.request.resolver_match.url_name - if url_name == "htmx_partial_index_nspanels_section" or url_name == "index": - return "nspanel_status_temperature/nspanel_status_temperature_index.html" - elif url_name == "edit_nspanel": - return "nspanel_status_temperature/nspanel_status_temperature_edit_nspanel.html" - - def get(self, request, view, nspanel_id): - self.template_view = view - args = { - "id": nspanel_id, - } - return self.render_to_response(kwargs=args) - - class Media: - css = "css/main.css" diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_temperature/nspanel_status_temperature_edit_nspanel.html b/docker/web/nspanelmanager/web/components/nspanel_status_temperature/nspanel_status_temperature_edit_nspanel.html deleted file mode 100644 index 4ac176e32..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_temperature/nspanel_status_temperature_edit_nspanel.html +++ /dev/null @@ -1,41 +0,0 @@ - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_temperature/nspanel_status_temperature_index.html b/docker/web/nspanelmanager/web/components/nspanel_status_temperature/nspanel_status_temperature_index.html deleted file mode 100644 index 6d407347e..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_temperature/nspanel_status_temperature_index.html +++ /dev/null @@ -1,41 +0,0 @@ - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_text/nspanel_status_text.py b/docker/web/nspanelmanager/web/components/nspanel_status_text/nspanel_status_text.py deleted file mode 100644 index 326816126..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_text/nspanel_status_text.py +++ /dev/null @@ -1,34 +0,0 @@ -from django_components import component -from django.template.context import Context - -from web.models import NSPanel - -@component.register("nspanel_status_text") -class NSPanelStatusText(component.Component): - template_view = None - - def get_context_data(self, id): - nspanel = NSPanel.objects.get(id=id) - return { - "nspanel": nspanel, - } - - def get_template_name(self, context: Context): - if self.template_view: - url_name = self.template_view - else: - url_name = context.request.resolver_match.url_name - if url_name == "htmx_partial_index_nspanels_section" or url_name == "index": - return "nspanel_status_text/nspanel_status_text_index.html" - elif url_name == "edit_nspanel": - return "nspanel_status_text/nspanel_status_text_edit_nspanel.html" - - def get(self, request, view, nspanel_id): - self.template_view = view - args = { - "id": nspanel_id, - } - return self.render_to_response(kwargs=args) - - class Media: - css = "css/main.css" diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_text/nspanel_status_text_edit_nspanel.html b/docker/web/nspanelmanager/web/components/nspanel_status_text/nspanel_status_text_edit_nspanel.html deleted file mode 100644 index f5a47b38e..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_text/nspanel_status_text_edit_nspanel.html +++ /dev/null @@ -1,65 +0,0 @@ - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_text/nspanel_status_text_index.html b/docker/web/nspanelmanager/web/components/nspanel_status_text/nspanel_status_text_index.html deleted file mode 100644 index 597b94f94..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_text/nspanel_status_text_index.html +++ /dev/null @@ -1,60 +0,0 @@ - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_wifi_signal_strength/nspanel_status_wifi_signal_strength.py b/docker/web/nspanelmanager/web/components/nspanel_status_wifi_signal_strength/nspanel_status_wifi_signal_strength.py deleted file mode 100644 index afa9e4874..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_wifi_signal_strength/nspanel_status_wifi_signal_strength.py +++ /dev/null @@ -1,34 +0,0 @@ -from django_components import component -from django.template.context import Context - -from web.models import NSPanel - -@component.register("nspanel_status_wifi_signal_strength") -class NSPanelStatusWifiSignalStrength(component.Component): - template_view = None - - def get_context_data(self, id): - nspanel = NSPanel.objects.get(id=id) - return { - "nspanel": nspanel, - } - - def get_template_name(self, context: Context): - if self.template_view: - url_name = self.template_view - else: - url_name = context.request.resolver_match.url_name - if url_name == "htmx_partial_index_nspanels_section" or url_name == "index": - return "nspanel_status_wifi_signal_strength/nspanel_status_wifi_signal_strength_index.html" - elif url_name == "edit_nspanel": - return "nspanel_status_wifi_signal_strength/nspanel_status_wifi_signal_strength_edit_nspanel.html" - - def get(self, request, view, nspanel_id): - self.template_view = view - args = { - "id": nspanel_id, - } - return self.render_to_response(kwargs=args) - - class Media: - css = "css/main.css" diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_wifi_signal_strength/nspanel_status_wifi_signal_strength_edit_nspanel.html b/docker/web/nspanelmanager/web/components/nspanel_status_wifi_signal_strength/nspanel_status_wifi_signal_strength_edit_nspanel.html deleted file mode 100644 index 030d8423a..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_wifi_signal_strength/nspanel_status_wifi_signal_strength_edit_nspanel.html +++ /dev/null @@ -1,67 +0,0 @@ - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_status_wifi_signal_strength/nspanel_status_wifi_signal_strength_index.html b/docker/web/nspanelmanager/web/components/nspanel_status_wifi_signal_strength/nspanel_status_wifi_signal_strength_index.html deleted file mode 100644 index 5a2d91d74..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_status_wifi_signal_strength/nspanel_status_wifi_signal_strength_index.html +++ /dev/null @@ -1,67 +0,0 @@ - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_update_progress/nspanel_update_progress.py b/docker/web/nspanelmanager/web/components/nspanel_update_progress/nspanel_update_progress.py deleted file mode 100644 index 590488831..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_update_progress/nspanel_update_progress.py +++ /dev/null @@ -1,32 +0,0 @@ -from django_components import component -from django.template.context import Context - -from web.models import NSPanel - -@component.register("nspanel_update_progress") -class NSPanelUpdateProgress(component.Component): - template_view = None - - def get_context_data(self, id): - nspanel = NSPanel.objects.get(id=id) - return { - "nspanel": nspanel, - } - - def get_template_name(self, context: Context): - if self.template_view: - url_name = self.template_view - else: - url_name = context.request.resolver_match.url_name - if url_name == "edit_nspanel": - return "nspanel_update_progress/nspanel_update_progress_edit_nspanel.html" - - def get(self, request, view, nspanel_id): - self.template_view = view - args = { - "id": nspanel_id, - } - return self.render_to_response(kwargs=args) - - class Media: - css = "css/main.css" diff --git a/docker/web/nspanelmanager/web/components/nspanel_update_progress/nspanel_update_progress_edit_nspanel.html b/docker/web/nspanelmanager/web/components/nspanel_update_progress/nspanel_update_progress_edit_nspanel.html deleted file mode 100644 index 4226280d0..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_update_progress/nspanel_update_progress_edit_nspanel.html +++ /dev/null @@ -1,33 +0,0 @@ - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_visit_link/nspanel_visit_link.py b/docker/web/nspanelmanager/web/components/nspanel_visit_link/nspanel_visit_link.py deleted file mode 100644 index 41ed8a5e7..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_visit_link/nspanel_visit_link.py +++ /dev/null @@ -1,34 +0,0 @@ -from django_components import component -from django.template.context import Context - -from web.models import NSPanel - -@component.register("nspanel_visit_link") -class NSPanelVisitLink(component.Component): - template_view = None - - def get_context_data(self, id): - nspanel = NSPanel.objects.get(id=id) - return { - "nspanel": nspanel, - } - - def get_template_name(self, context: Context): - if self.template_view: - url_name = self.template_view - else: - url_name = context.request.resolver_match.url_name - if url_name == "htmx_partial_index_nspanels_section" or url_name == "index": - return "nspanel_visit_link/nspanel_visit_link_index.html" - elif url_name == "edit_nspanel": - return "nspanel_visit_link/nspanel_visit_link_edit_nspanel.html" - - def get(self, request, view, nspanel_id): - self.template_view = view - args = { - "id": nspanel_id, - } - return self.render_to_response(kwargs=args) - - class Media: - css = "css/main.css" diff --git a/docker/web/nspanelmanager/web/components/nspanel_visit_link/nspanel_visit_link_edit_nspanel.html b/docker/web/nspanelmanager/web/components/nspanel_visit_link/nspanel_visit_link_edit_nspanel.html deleted file mode 100644 index db8ef74ad..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_visit_link/nspanel_visit_link_edit_nspanel.html +++ /dev/null @@ -1,38 +0,0 @@ - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_visit_link/nspanel_visit_link_index.html b/docker/web/nspanelmanager/web/components/nspanel_visit_link/nspanel_visit_link_index.html deleted file mode 100644 index c2bbdec52..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_visit_link/nspanel_visit_link_index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_warnings/nspanel_warnings.py b/docker/web/nspanelmanager/web/components/nspanel_warnings/nspanel_warnings.py deleted file mode 100644 index f7dcf34f6..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_warnings/nspanel_warnings.py +++ /dev/null @@ -1,46 +0,0 @@ -from django_components import component -from django.template.context import Context -from django.core.files.storage import FileSystemStorage -import hashlib - -from web.models import NSPanel -from web.settings_helper import get_nspanel_setting_with_default - -@component.register("nspanel_warnings") -class NSPanelWarnings(component.Component): - template_view = None - - def get_context_data(self, id): - nspanel = NSPanel.objects.get(id=id) - return { - "nspanel": nspanel, - } - - def get_template_name(self, context: Context): - if self.template_view: - url_name = self.template_view - else: - url_name = context.request.resolver_match.url_name - if url_name == "htmx_partial_index_nspanels_section" or url_name == "index": - return "nspanel_warnings/nspanel_warnings_index.html" - elif url_name == "edit_nspanel": - return "nspanel_warnings/nspanel_warnings_edit_nspanel.html" - - - # TODO: Move md5 checksum to DB instead of always calculating them on reqest. - def get_file_md5sum(self, filename): - fs = FileSystemStorage() - if fs.exists(filename): - return hashlib.md5(fs.open(filename).read()).hexdigest() - else: - return None - - def get(self, request, view, nspanel_id): - self.template_view = view - args = { - "id": nspanel_id, - } - return self.render_to_response(kwargs=args) - - class Media: - css = "css/main.css" diff --git a/docker/web/nspanelmanager/web/components/nspanel_warnings/nspanel_warnings_edit_nspanel.html b/docker/web/nspanelmanager/web/components/nspanel_warnings/nspanel_warnings_edit_nspanel.html deleted file mode 100644 index 44956d906..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_warnings/nspanel_warnings_edit_nspanel.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - diff --git a/docker/web/nspanelmanager/web/components/nspanel_warnings/nspanel_warnings_index.html b/docker/web/nspanelmanager/web/components/nspanel_warnings/nspanel_warnings_index.html deleted file mode 100644 index d53502600..000000000 --- a/docker/web/nspanelmanager/web/components/nspanel_warnings/nspanel_warnings_index.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - diff --git a/docker/web/nspanelmanager/web/components/rooms_list/rooms_list.html b/docker/web/nspanelmanager/web/components/rooms_list/rooms_list.html deleted file mode 100644 index 6890cd4c1..000000000 --- a/docker/web/nspanelmanager/web/components/rooms_list/rooms_list.html +++ /dev/null @@ -1,60 +0,0 @@ -
- - - - - - - - - - {% for room in rooms %} - - - - - - {% endfor %} - -
NameNSPanels
- - - {{ room.room.friendly_name }} - - {% for nspanel in room.nspanels %} - - {{ nspanel.status }} - {% component "nspanel_status_badge" id=nspanel.id %}{% endcomponent %} - - {% endfor %} -
- - - -
- -
- - -
diff --git a/docker/web/nspanelmanager/web/components/rooms_list/rooms_list.py b/docker/web/nspanelmanager/web/components/rooms_list/rooms_list.py deleted file mode 100644 index 974ed0a95..000000000 --- a/docker/web/nspanelmanager/web/components/rooms_list/rooms_list.py +++ /dev/null @@ -1,31 +0,0 @@ -from django_components import component -from django.template.context import Context -from django.core.files.storage import FileSystemStorage -from django.template import RequestContext -import hashlib - -from web.models import Room - -@component.register("rooms_list") -class RoomsList(component.Component): - template_name = "rooms_list.html" - template_view = None - - def get_context_data(self): - data = { - "rooms": [] - } - # Build dict of online and accepted NSPanels for each room - for room in Room.objects.all().order_by("displayOrder"): - data["rooms"].append({ - "room": room, - "nspanels": room.nspanel_set.filter(accepted=True, denied=False), - }) - return data - - def get(self, request): - context = RequestContext(request, {}) - return self.render_to_response(context=context, kwargs={}) - - class Media: - css = "css/main.css" diff --git a/docker/web/nspanelmanager/web/htmx.py b/docker/web/nspanelmanager/web/htmx.py index 8b21dbf04..2de62d8b5 100644 --- a/docker/web/nspanelmanager/web/htmx.py +++ b/docker/web/nspanelmanager/web/htmx.py @@ -20,10 +20,6 @@ import web.home_assistant_api import web.openhab_api -from web.components.nspanel_room_entities_pages.nspanel_room_entities_pages import ( - NSPanelRoomEntitiesPages, -) -from web.components.rooms_list.rooms_list import RoomsList from web.settings_helper import ( delete_nspanel_setting, get_nspanel_setting_with_default, @@ -48,40 +44,6 @@ ) -def partial_index_nspanels_section(request): - if get_setting_with_default("use_fahrenheit") == "True": - temperature_unit = "°F" - else: - temperature_unit = "°C" - - nspanels = [] - for nspanel in NSPanel.objects.filter(denied=False): - panel_info = {} - panel_info["data"] = nspanel - nspanels.append(panel_info) - - data = { - "nspanels": nspanels, - "temperature_unit": temperature_unit, - } - - return render(request, "index_htmx_nspanels_section.html", data) - - -def partial_nspanel_index_view(request, nspanel_id): - try: - if request.method == "GET": - data = { - "nspanel": {"data": NSPanel.objects.get(id=nspanel_id)}, - } - return render(request, "partial/nspanel_index_view_htmx.html", data) - else: - return JsonResponse({"status": "error"}, status=405) - except Exception as ex: - logging.exception(ex) - return JsonResponse({"status": "error"}, status=500) - - @csrf_exempt def unblock_nspanel(request, nspanel_id): if request.method == "DELETE": @@ -95,62 +57,6 @@ def unblock_nspanel(request, nspanel_id): return response -@csrf_exempt -def nspanel_accept_register_request(request, nspanel_id): - try: - if request.method == "POST": - nspanel = NSPanel.objects.get(id=nspanel_id) - nspanel.denied = False - nspanel.accepted = True - nspanel.save() - send_mqttmanager_reload_command() - - response = HttpResponse("", status=200) - response["HX-Refresh"] = "true" - return response - else: - return JsonResponse({"status": "error"}, status=405) - except Exception as ex: - logging.exception(ex) - return JsonResponse({"status": "error"}, status=500) - - -@csrf_exempt -def nspanel_deny_register_request(request, nspanel_id): - try: - if request.method == "POST": - nspanel = NSPanel.objects.get(id=nspanel_id) - nspanel.denied = True - nspanel.save() - - send_mqttmanager_reload_command() - - response = HttpResponse("", status=200) - response["HX-Refresh"] = "true" - return response - else: - return JsonResponse({"status": "error"}, status=405) - except Exception as ex: - logging.exception(ex) - return JsonResponse({"status": "error"}, status=500) - - -@csrf_exempt -def nspanel_delete(request, nspanel_id): - try: - if request.method == "DELETE": - nspanel = NSPanel.objects.get(id=nspanel_id) - nspanel.delete() - response = HttpResponse("", status=200) - response["HX-Redirect"] = "/" - return response - else: - return JsonResponse({"status": "error"}, status=405) - except Exception as ex: - logging.exception(ex) - return JsonResponse({"status": "error"}, status=500) - - def select_room_temperature_sensor_provider(request, room_id): if (get_setting_with_default("home_assistant_address") == "" or get_setting_with_default("home_assistant_token") == "") and get_setting_with_default("openhab_address") != "" and get_setting_with_default("openhab_token") != "": # OpenHAB connection configured but not Home Assistant. Skip selecting source: @@ -303,6 +209,7 @@ def relay_group_save(request): rg = RelayGroup() rg.friendly_name = request.POST["name"] rg.save() + send_mqttmanager_reload_command() response = HttpResponse() response["HX-Refresh"] = "true" @@ -314,6 +221,7 @@ def relay_group_delete(request, relay_group_id): if request.method == "DELETE": rg = RelayGroup.objects.get(id=relay_group_id) rg.delete() + send_mqttmanager_reload_command() response = HttpResponse() response["HX-Refresh"] = "true" @@ -361,20 +269,6 @@ def relay_group_remove_relay(request, relay_binding_id): return response -@csrf_exempt -def handle_entity_modal_result(request): - if request.session["action"] == "ADD_SCENE_TO_NSPANEL_ENTITY_PAGE": - return create_or_update_scene_entity(request) - else: - return JsonResponse( - { - "status": "error", - "text": "Unknown action! Action: " + request.session["action"], - }, - status=500, - ) - - def partial_select_new_entity_item_list(request, action, action_args): # This is used in the last step of adding an entity to call the correct # "add function" so that it get added to the correct room, page and so on. @@ -545,61 +439,6 @@ def partial_entity_add_scene_entity(request): return render(request, "partial/select_entity/entity_add_or_edit_scene.html", data) -@csrf_exempt -def partial_remove_entity_from_page_slot(request, page_id, slot_id): - page = RoomEntitiesPage.objects.get(id=page_id) - - # Check for light in given slot - entities = page.entity_set.filter(room_view_position=slot_id).all() - if entities.count() > 0: - entities.delete() - send_mqttmanager_reload_command() - - entities = page.scene_set.filter(room_view_position=slot_id).all() - if entities.count() > 0: - entities.delete() - send_mqttmanager_reload_command() - - room_id = 0 - if page.room: - room_id = page.room.id - - entities_pages = NSPanelRoomEntitiesPages() - return entities_pages.get( - request=request, - view="edit_room", - room_id=room_id, - is_scenes_pages=page.is_scenes_page, - is_global_scenes_page=(page.room is None), - ) - - -def partial_edit_entities_page(request, page_id): - data = { - "page_id": page_id, - } - return render(request, "partial/edit_entities_page.html", data) - - -def partial_save_edit_entities_page(request, page_id, page_type): - page = RoomEntitiesPage.objects.get(id=page_id) - page.page_type = page_type - page.save() - - room_id = 0 - if page.room: - room_id = page.room.id - send_mqttmanager_reload_command() - entities_pages = NSPanelRoomEntitiesPages() - return entities_pages.get( - request=request, - view="edit_room", - room_id=room_id, - is_scenes_pages=page.is_scenes_page, - is_global_scenes_page=(page.room is None), - ) - - def get_entity_in_page_slot(page_id, slot_id): page = RoomEntitiesPage.objects.get(id=page_id) entities = Entity.objects.filter(entities_page=page, room_view_position=slot_id) @@ -613,98 +452,6 @@ def get_entity_in_page_slot(page_id, slot_id): return None -@csrf_exempt -def partial_move_entity(request): - existing_entity_in_slot = get_entity_in_page_slot(request.POST["page_id"], request.POST["slot_id"]) - new_entity_in_slot = None - if request.POST["new_entity_type"] == "scene": - new_entity_in_slot = Scene.objects.get(id=request.POST["new_entity_id"]) - else: - try: - new_entity_in_slot = Entity.objects.get(id=request.POST["new_entity_id"]) - except Exception as e: - return JsonResponse({"status": "error", "text": "Did not find existing entity to move!"}) - - if existing_entity_in_slot: - # Swap the existing entity place with the new entity to be put on that slot - existing_entity_in_slot.entities_page = new_entity_in_slot.entities_page - existing_entity_in_slot.room_view_position = new_entity_in_slot.room_view_position - existing_entity_in_slot.save() - - new_entity_in_slot.entities_page = RoomEntitiesPage.objects.get(id=request.POST["page_id"]) - new_entity_in_slot.room_view_position = request.POST["slot_id"] - new_entity_in_slot.save() - send_mqttmanager_reload_command() - - if new_entity_in_slot.room is None: - room_id = 0 - is_global_scenes_page = True - else: - room_id = new_entity_in_slot.room.id - is_global_scenes_page = False - - entities_pages = NSPanelRoomEntitiesPages() - return entities_pages.get( - request, - view="edit_room", - room_id=room_id, - is_scenes_pages=new_entity_in_slot.entities_page.is_scenes_page, - is_global_scenes_page=is_global_scenes_page, - ) - - -@csrf_exempt -def partial_move_entities_pages(request): - if "htmx_form_save_entities_pages_order_field" in request.POST: - json_data = json.loads(request.POST["htmx_form_save_entities_pages_order_field"]) - if "pages" in json_data: - if len(json_data["pages"]) > 0: - entity_page = RoomEntitiesPage.objects.get(id=json_data["pages"][0]) - is_global_scenes_pages = False - if entity_page.room is None: - room_id = 0 - is_global_scenes_pages = True - else: - room_id = entity_page.room.id - for index, page_id in enumerate(json_data["pages"]): - page = RoomEntitiesPage.objects.get(id=page_id) - page.display_order = index - page.save() - send_mqttmanager_reload_command() - entities_pages = NSPanelRoomEntitiesPages() - return entities_pages.get( - request, - view="edit_room", - room_id=room_id, - is_scenes_pages=entity_page.is_scenes_page, - is_global_scenes_page=is_global_scenes_pages, - ) - else: - return JsonResponse( - { - "status": "error", - "text": "'pages' field empty in request POST-data.", - }, - status=500, - ) - else: - return JsonResponse( - { - "status": "error", - "text": "'pages' field not available in JSON-data.", - }, - status=500, - ) - else: - return JsonResponse( - { - "status": "error", - "text": "'htmx_form_save_entities_pages_order_field' field not available in request POST-data.", - }, - status=500, - ) - - @csrf_exempt def partial_add_entity_to_entities_page_select_entity_type_react(request, entities_page_id, room_view_position): entities_page = RoomEntitiesPage.objects.get(id=entities_page_id) @@ -769,74 +516,6 @@ def partial_add_entity_to_entities_page_config_modal(request, entity_source): ) -@csrf_exempt -def partial_delete_entities_page(request, page_id): - page = RoomEntitiesPage.objects.get(id=page_id) - if page.room is None: - is_global_scenes_page = True - room_id = 0 - else: - is_global_scenes_page = False - room_id = page.room.id - page.delete() - - # Recalculate entity page order - for index, entity_page in enumerate( - RoomEntitiesPage.objects.filter(room=page.room, is_scenes_page=page.is_scenes_page).order_by("display_order"), - start=0, - ): - entity_page.display_order = index - entity_page.save() - - send_mqttmanager_reload_command() - - entities_pages = NSPanelRoomEntitiesPages() - return entities_pages.get( - request=request, - view="edit_room", - room_id=room_id, - is_scenes_pages=page.is_scenes_page, - is_global_scenes_page=is_global_scenes_page, - ) - - -def create_entities_page_in_room(request, room_id, page_type, is_scenes_page, is_global_scenes_page): - entity_page = RoomEntitiesPage() - entity_page.is_scenes_page = is_scenes_page == "True" - entity_page.is_global_scenes_page = is_global_scenes_page == "True" - if entity_page.is_global_scenes_page: - entity_page.room = None - entity_page.display_order = RoomEntitiesPage.objects.filter(room=None, is_scenes_page=is_scenes_page).count() - else: - room = Room.objects.get(id=room_id) - entity_page.room = room - entity_page.display_order = RoomEntitiesPage.objects.filter(room=room, is_scenes_page=is_scenes_page).count() - - if page_type == 4: - entity_page.page_type = 4 - entity_page.save() - send_mqttmanager_reload_command() - elif page_type == 8: - entity_page.page_type = 8 - entity_page.save() - send_mqttmanager_reload_command() - elif page_type == 12: - entity_page.page_type = 12 - entity_page.save() - send_mqttmanager_reload_command() - else: - print(f"ERROR! Unknown page type {page_type}") - # Return new partial HTMX update of all entities pages in this room - entities_pages = NSPanelRoomEntitiesPages() - return entities_pages.get( - request=request, - view="edit_room", - room_id=room_id, - is_scenes_pages=entity_page.is_scenes_page, - is_global_scenes_page=(entity_page.room == None), - ) - - @csrf_exempt def partial_reorder_rooms(request): if "htmx_form_save_rooms_order_field" in request.POST: @@ -889,308 +568,6 @@ def partial_select_new_outside_temperature_sensor(request): # When creating a new or updating an existing light entity this will take care of the actual creation/updating of the model # in the database. -def create_or_update_light_entity(request): - action_args = json.loads(request.session["action_args"]) # Loads arguments set when first starting process of adding/updating entity - - entity_data = { - "controller": request.session["entity_source"], - "home_assistant_name": "", - "openhab_name": "", - "openhab_control_mode": "", - "openhab_item_switch": "", - "openhab_item_dimmer": "", - "openhab_item_color_temp": "", - "openhab_item_rgb": "", - "can_dim": False, - "can_color_temperature": False, - "can_rgb": False, - "is_ceiling_light": False, - "controlled_by_nspanel_main_page": True, - } - if "entity_id" in action_args and int(action_args["entity_id"]) >= 0: - new_light = Entity.objects.get(id=int(action_args["entity_id"])) - entity_data = new_light.entity_data - else: - new_light = Entity() - new_light.entity_type = Entity.EntityType.LIGHT - - if entity_data["controller"] == "home_assistant": - entity_data["home_assistant_name"] = request.POST["home_assistant_item"] - new_light.friendly_name = request.POST["add_new_light_name"] - new_light.room = Room.objects.get(id=int(action_args["room_id"])) - new_light.entities_page = RoomEntitiesPage.objects.get(id=int(action_args["page_id"])) - new_light.room_view_position = int(action_args["page_slot"]) - - entity_data["controlled_by_nspanel_main_page"] = "controlled_by_nspanel_main_page" in request.POST - entity_data["is_ceiling_light"] = request.POST["light_type"] == "ceiling" - - if request.POST["light_control_mode"] == "dimmer": - entity_data["can_dim"] = True - entity_data["openhab_control_mode"] = "dimmer" - if entity_data["controller"] == "openhab": - entity_data["openhab_item_dimmer"] = request.POST["openhab_dimming_item"] - else: - entity_data["openhab_control_mode"] = "switch" - entity_data["can_dim"] = False - if entity_data["controller"] == "openhab": - entity_data["openhab_item_switch"] = request.POST["openhab_dimming_item"] - - if "color_temperature" in request.POST: - entity_data["can_color_temperature"] = True - if entity_data["controller"] == "openhab": - entity_data["openhab_item_color_temp"] = request.POST["openhab_color_temperature_item"] - else: - entity_data["can_color_temperature"] = False - entity_data["openhab_item_color_temp"] = "" - - if "rgb" in request.POST: - entity_data["can_rgb"] = True - if entity_data["controller"] == "openhab": - entity_data["openhab_item_rgb"] = request.POST["openhab_rgb_item"] - else: - entity_data["can_rgb"] = False - entity_data["openhab_item_rgb"] = "" - - new_light.entity_data = entity_data - new_light.save() - send_mqttmanager_reload_command() - - entities_pages = NSPanelRoomEntitiesPages() - return entities_pages.get( - request=request, - view="edit_room", - room_id=new_light.room.id, - is_scenes_pages=False, - is_global_scenes_page=False, - ) - - -def create_or_update_switch_entity(request): - action_args = json.loads(request.session["action_args"]) # Loads arguments set when first starting process of adding/updating entity - - entity_data = { - "controller": request.session["entity_source"], - "home_assistant_name": "", - "openhab_name": "", - "openhab_item_switch": "", - } - if "entity_id" in action_args and int(action_args["entity_id"]) >= 0: - new_switch = Entity.objects.get(id=int(action_args["entity_id"])) - entity_data = new_switch.entity_data - else: - new_switch = Entity() - new_switch.entity_type = Entity.EntityType.SWITCH - # Only set once, during initial creation: - new_switch.room = Room.objects.get(id=int(action_args["room_id"])) - new_switch.entities_page = RoomEntitiesPage.objects.get(id=int(action_args["page_id"])) - new_switch.room_view_position = int(action_args["page_slot"]) - if entity_data["controller"] == "home_assistant": - entity_data["home_assistant_name"] = request.POST["backend_name"] - elif entity_data["controller"] == "openhab": - entity_data["openhab_item_switch"] = request.POST["backend_name"] - - new_switch.friendly_name = request.POST["light_name"] - new_switch.entity_data = entity_data - new_switch.save() - send_mqttmanager_reload_command() - - entities_pages = NSPanelRoomEntitiesPages() - return entities_pages.get( - request=request, - view="edit_room", - room_id=new_switch.room.id, - is_scenes_pages=False, - is_global_scenes_page=False, - ) - - -def create_or_update_button_entity(request): - action_args = json.loads(request.session["action_args"]) # Loads arguments set when first starting process of adding/updating entity - - entity_data = { - "controller": request.session["entity_source"], - "home_assistant_name": "", - "mqtt_topic": "", # Used in case of controller = manual - "mqtt_payload": "", # Used in case of controller = manual - } - if "entity_id" in action_args and int(action_args["entity_id"]): - new_button = Entity.objects.get(id=int(action_args["entity_id"])) - entity_data = new_button.entity_data - else: - new_button = Entity() - new_button.entity_type = Entity.EntityType.BUTTON - # Only set once, during initial creation: - new_button.room = Room.objects.get(id=int(action_args["room_id"])) - new_button.entities_page = RoomEntitiesPage.objects.get(id=int(action_args["page_id"])) - new_button.room_view_position = int(action_args["page_slot"]) - - if entity_data["controller"] == "home_assistant": - entity_data["home_assistant_name"] = request.POST["backend_name"] - elif entity_data["controller"] == "nspm": - entity_data["mqtt_topic"] = request.POST["mqtt_topic"] - entity_data["mqtt_payload"] = request.POST["mqtt_payload"] - new_button.friendly_name = request.POST["light_name"] - new_button.entity_data = entity_data - new_button.save() - send_mqttmanager_reload_command() - - entities_pages = NSPanelRoomEntitiesPages() - return entities_pages.get( - request=request, - view="edit_room", - room_id=new_button.room.id, - is_scenes_pages=False, - is_global_scenes_page=False, - ) - - -def create_or_update_scene_entity(request): - action_args = json.loads(request.session["action_args"]) # Loads arguments set when first starting process of adding/updating entity - - if "entity_id" in action_args and int(action_args["entity_id"]) >= 0: - new_scene = Scene.objects.get(id=int(action_args["entity_id"])) - else: - new_scene = Scene() - if "room_id" in action_args: - new_scene.room = Room.objects.get(id=int(action_args["room_id"])) - else: - new_scene.room = None - new_scene.entities_page = RoomEntitiesPage.objects.get(id=int(action_args["page_id"])) - new_scene.room_view_position = int(action_args["page_slot"]) - new_scene.scene_type = request.session["entity_source"] - if new_scene.scene_type == "nspanelmanager": - pass # Do nothing, this is one of our own scenes. - elif new_scene.scene_type == "home_assistant": - new_scene.backend_name = request.POST["backend_name"] - elif new_scene.scene_type == "openhab": - new_scene.backend_name = request.POST["backend_name"] - - new_scene.friendly_name = request.POST["scene_name"] - new_scene.save() - send_mqttmanager_reload_command() - - room_id = 0 - if new_scene.room: - room_id = new_scene.room.id - - entities_pages = NSPanelRoomEntitiesPages() - return entities_pages.get( - request=request, - view="edit_room", - room_id=room_id, - is_scenes_pages=True, - is_global_scenes_page=(new_scene.room == None), - ) - - -def initial_setup_welcome(request): - return render(request, "modals/initial_setup/welcome.html") - - -@csrf_exempt -def initial_setup_manager_settings(request): - if request.method == "POST": - if "manager_address" in request.POST: - set_setting_value("manager_address", request.POST["manager_address"]) - if "manager_port" in request.POST: - set_setting_value("manager_port", request.POST["manager_port"]) - send_mqttmanager_reload_command() - - # Save settings succesfully, return the next view in the setup guide. MQTT: - data = { - "mqtt_server": get_setting_with_default("mqtt_server"), - "mqtt_port": get_setting_with_default("mqtt_port"), - "mqtt_username": get_setting_with_default("mqtt_username"), - "mqtt_password": get_setting_with_default("mqtt_password"), - } - return render(request, "modals/initial_setup/mqtt.html", data) - elif request.method == "GET": - data = { - "manager_address": get_setting_with_default("manager_address"), - "manager_port": get_setting_with_default("manager_port"), - } - return render(request, "modals/initial_setup/manager_settings.html", data) - - -@csrf_exempt -def initial_setup_mqtt_settings(request): - if request.method == "POST": - if "mqtt_server" in request.POST: - set_setting_value("mqtt_server", request.POST["mqtt_server"]) - if "mqtt_port" in request.POST: - set_setting_value("mqtt_port", request.POST["mqtt_port"]) - if "mqtt_username" in request.POST: - set_setting_value("mqtt_username", request.POST["mqtt_username"]) - if "mqtt_password" in request.POST: - set_setting_value("mqtt_password", request.POST["mqtt_password"]) - send_mqttmanager_reload_command() - - # Save settings succesfully, return the next view in the setup guide. Home Assistant: - environment = environ.Env() - data = { - "home_assistant_address": get_setting_with_default("home_assistant_address"), - "home_assistant_token": get_setting_with_default("home_assistant_token"), - "is_home_assistant_addon": ("IS_HOME_ASSISTANT_ADDON" in environment and environment("IS_HOME_ASSISTANT_ADDON") == "true"), - } - return render(request, "modals/initial_setup/home_assistant.html", data) - elif request.method == "GET": - data = { - "mqtt_server": get_setting_with_default("mqtt_server"), - "mqtt_port": get_setting_with_default("mqtt_port"), - "mqtt_username": get_setting_with_default("mqtt_username"), - "mqtt_password": get_setting_with_default("mqtt_password"), - } - return render(request, "modals/initial_setup/mqtt.html", data) - - -@csrf_exempt -def initial_setup_home_assistant_settings(request): - if request.method == "POST": - if "home_assistant_address" in request.POST: - set_setting_value("home_assistant_address", request.POST["home_assistant_address"]) - if "home_assistant_token" in request.POST: - set_setting_value("home_assistant_token", request.POST["home_assistant_token"]) - send_mqttmanager_reload_command() - - # Save settings succesfully, return the next view in the setup guide. OpenHAB: - data = { - "openhab_address": get_setting_with_default("openhab_address"), - "openhab_token": get_setting_with_default("openhab_token"), - } - return render(request, "modals/initial_setup/openhab.html", data) - elif request.method == "GET": - environment = environ.Env() - data = { - "home_assistant_address": get_setting_with_default("home_assistant_address"), - "home_assistant_token": get_setting_with_default("home_assistant_token"), - "is_home_assistant_addon": ("IS_HOME_ASSISTANT_ADDON" in environment and environment("IS_HOME_ASSISTANT_ADDON") == "true"), - } - return render(request, "modals/initial_setup/home_assistant.html", data) - - -@csrf_exempt -def initial_setup_openhab_settings(request): - if request.method == "POST": - if "openhab_address" in request.POST: - set_setting_value("openhab_address", request.POST["openhab_address"]) - if "openhab_token" in request.POST: - set_setting_value("openhab_token", request.POST["openhab_token"]) - send_mqttmanager_reload_command() - - # Save settings succesfully, return the next view in the setup guide. Finished: - return render(request, "modals/initial_setup/finished.html") - elif request.method == "GET": - data = { - "openhab_address": get_setting_with_default("openhab_address"), - "openhab_token": get_setting_with_default("openhab_token"), - } - return render(request, "modals/initial_setup/openhab.html", data) - - -def initial_setup_finished(request): - return render(request, "modals/initial_setup/finished.html") - - def show_messages(request): data = get_base_data(request) data["messages"] = Message.objects.all() diff --git a/docker/web/nspanelmanager/web/migrations/0069_alter_entity_entity_type.py b/docker/web/nspanelmanager/web/migrations/0069_alter_entity_entity_type.py new file mode 100644 index 000000000..382e1a115 --- /dev/null +++ b/docker/web/nspanelmanager/web/migrations/0069_alter_entity_entity_type.py @@ -0,0 +1,18 @@ +# Generated by Django 5.1.1 on 2026-09-14 12:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('web', '0068_auto_20260322_1119'), + ] + + operations = [ + migrations.AlterField( + model_name='entity', + name='entity_type', + field=models.CharField(choices=[('light', 'Light'), ('switch', 'Switch'), ('button', 'Button'), ('thermostat', 'Thermostat'), ('media_player', 'Media Player')], max_length=64), + ), + ] diff --git a/docker/web/nspanelmanager/web/migrations/0070_alter_entity_entity_type.py b/docker/web/nspanelmanager/web/migrations/0070_alter_entity_entity_type.py new file mode 100644 index 000000000..5443f6ff7 --- /dev/null +++ b/docker/web/nspanelmanager/web/migrations/0070_alter_entity_entity_type.py @@ -0,0 +1,18 @@ +# Generated by Django 5.1.1 on 2026-10-25 18:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('web', '0069_alter_entity_entity_type'), + ] + + operations = [ + migrations.AlterField( + model_name='entity', + name='entity_type', + field=models.CharField(choices=[('light', 'Light'), ('switch', 'Switch'), ('button', 'Button'), ('thermostat', 'Thermostat'), ('media_player', 'Media Player'), ('cover', 'Cover')], max_length=64), + ), + ] diff --git a/docker/web/nspanelmanager/web/migrations/0071_inform_mqtt_nagle.py b/docker/web/nspanelmanager/web/migrations/0071_inform_mqtt_nagle.py new file mode 100644 index 000000000..5fcb1d647 --- /dev/null +++ b/docker/web/nspanelmanager/web/migrations/0071_inform_mqtt_nagle.py @@ -0,0 +1,21 @@ +# Generated by Django 5.1.1 on 2026-11-08 11:22 + +from django.db import migrations + +def add_message(apps, schema_editor): + Message = apps.get_model("web", "Message") + Message.objects.create( + title="TCP Nagle's algorithm on MQTT broker", + message="If you want to squece more speed out of NSPanelManager, try disabling TCP Nagle's algorithm on your MQTT broker. For more inforation, please see docs", + read=False, # optional, False is the default + ) + +class Migration(migrations.Migration): + + dependencies = [ + ('web', '0070_alter_entity_entity_type'), + ] + + operations = [ + migrations.RunPython(add_message), + ] diff --git a/docker/web/nspanelmanager/web/migrations/0072_make_settings_unique.py b/docker/web/nspanelmanager/web/migrations/0072_make_settings_unique.py new file mode 100644 index 000000000..6131f56ef --- /dev/null +++ b/docker/web/nspanelmanager/web/migrations/0072_make_settings_unique.py @@ -0,0 +1,32 @@ +# Generated by Django 5.1.1 on 2026-11-08 11:34 + +from django.db import migrations, models +from django.db.models import Min + +def remove_duplicate_settings(apps, schema_editor): + Settings = apps.get_model("web", "Settings") + + # For each name, find the lowest id (the "first" instance) + keep_ids = ( + Settings.objects + .values("name") + .annotate(first_id=Min("id")) + .values_list("first_id", flat=True) + ) + + # Delete everything else + Settings.objects.exclude(id__in=list(keep_ids)).delete() + +class Migration(migrations.Migration): + dependencies = [ + ('web', '0071_inform_mqtt_nagle'), + ] + + operations = [ + migrations.RunPython(remove_duplicate_settings, migrations.RunPython.noop), + migrations.AlterField( + model_name="settings", + name="name", + field=models.CharField(max_length=255, unique=True), + ), + ] diff --git a/docker/web/nspanelmanager/web/models.py b/docker/web/nspanelmanager/web/models.py index a7c1bae86..018a1c7bd 100755 --- a/docker/web/nspanelmanager/web/models.py +++ b/docker/web/nspanelmanager/web/models.py @@ -7,7 +7,7 @@ class Settings(models.Model): - name = models.CharField(max_length=255) + name = models.CharField(max_length=255, unique=True) value = models.CharField(max_length=255) def __str__(self) -> str: @@ -94,6 +94,8 @@ class EntityType(models.TextChoices): SWITCH = "switch" BUTTON = "button" THERMOSTAT = "thermostat" + MEDIA_PLAYER = "media_player" + COVER = "cover" room = models.ForeignKey(Room, on_delete=models.CASCADE) friendly_name = models.CharField(max_length=255, default="") diff --git a/docker/web/nspanelmanager/web/react-components/.vitest/junit/output.xml b/docker/web/nspanelmanager/web/react-components/.vitest/junit/output.xml new file mode 100644 index 000000000..21c0158e0 --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/.vitest/junit/output.xml @@ -0,0 +1,780 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<ref *1> HTMLInputElement { + '__reactFiber$7o0o9phk2i': <ref *2> FiberNode { + tag: 5, + key: null, + elementType: 'input', + type: 'input', + stateNode: [Circular *1], + return: FiberNode { + tag: 5, + key: null, + elementType: 'div', + type: 'div', + stateNode: [HTMLDivElement], + return: [FiberNode], + child: [Circular *2], + sibling: null, + index: 1, + ref: null, + refCleanup: null, + pendingProps: [Object], + memoizedProps: [Object], + updateQueue: null, + memoizedState: null, + dependencies: null, + mode: 3, + flags: 4, + subtreeFlags: 4194308, + deletions: null, + lanes: 0, + childLanes: 0, + alternate: [FiberNode], + actualDuration: 0.0033670000002530287, + actualStartTime: 989.866452, + selfBaseDuration: 0.0015030000000706423, + treeBaseDuration: 0.002736000000140848, + _debugInfo: null, + _debugOwner: [FiberNode], + _debugStack: Error: react-stack-top-frame + at Object.process.env.NODE_ENV.exports.createElement (/usr/src/app/nspanelmanager/web/react-components/node_modules/react/cjs/react.development.js:1053:20) + at /usr/src/app/nspanelmanager/web/react-components/node_modules/@emotion/react/dist/emotion-element-e8f4cc37.development.cjs.js:298:37 + at EmotionCssPropInternal (/usr/src/app/nspanelmanager/web/react-components/node_modules/@emotion/react/dist/emotion-element-e8f4cc37.development.cjs.js:61:12) + at Object.react_stack_bottom_frame (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:25904:20) + at renderWithHooks (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:7662:22) + at updateForwardRef (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:9724:19) + at beginWork (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:12117:18) + at runWithFiberInDEV (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:874:13) + at performUnitOfWork (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:17641:22) + at workLoopSync (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:17469:41), + _debugTask: null, + _debugNeedsRemount: false, + _debugHookTypes: null + }, + child: null, + sibling: null, + index: 0, + ref: [Function (anonymous)], + refCleanup: undefined, + pendingProps: { + className: '', + ref: [Function (anonymous)], + style: [Object], + disabled: false, + autoCapitalize: 'none', + autoComplete: 'off', + autoCorrect: 'off', + id: 'react-select-7-input', + onBlur: [Function (anonymous)], + onChange: [Function (anonymous)], + onFocus: [Function (anonymous)], + spellCheck: 'false', + tabIndex: 0, + form: undefined, + type: 'text', + value: '', + 'aria-autocomplete': 'list', + 'aria-expanded': false, + 'aria-haspopup': true, + 'aria-errormessage': undefined, + 'aria-invalid': undefined, + 'aria-label': undefined, + 'aria-labelledby': undefined, + 'aria-required': undefined, + role: 'combobox', + 'aria-activedescendant': '', + 'aria-describedby': 'react-select-7-placeholder' + }, + memoizedProps: { + className: '', + ref: [Function (anonymous)], + style: [Object], + disabled: false, + autoCapitalize: 'none', + autoComplete: 'off', + autoCorrect: 'off', + id: 'react-select-7-input', + onBlur: [Function (anonymous)], + onChange: [Function (anonymous)], + onFocus: [Function (anonymous)], + spellCheck: 'false', + tabIndex: 0, + form: undefined, + type: 'text', + value: '', + 'aria-autocomplete': 'list', + 'aria-expanded': false, + 'aria-haspopup': true, + 'aria-errormessage': undefined, + 'aria-invalid': undefined, + 'aria-label': undefined, + 'aria-labelledby': undefined, + 'aria-required': undefined, + role: 'combobox', + 'aria-activedescendant': '', + 'aria-describedby': 'react-select-7-placeholder' + }, + updateQueue: null, + memoizedState: null, + dependencies: null, + mode: 3, + flags: 4194308, + subtreeFlags: 0, + deletions: null, + lanes: 0, + childLanes: 0, + alternate: FiberNode { + tag: 5, + key: null, + elementType: 'input', + type: 'input', + stateNode: [Circular *1], + return: [FiberNode], + child: null, + sibling: null, + index: 0, + ref: [Function (anonymous)], + refCleanup: undefined, + pendingProps: [Object], + memoizedProps: [Object], + updateQueue: null, + memoizedState: null, + dependencies: null, + mode: 3, + flags: 4194308, + subtreeFlags: 0, + deletions: null, + lanes: 0, + childLanes: 0, + alternate: [Circular *2], + actualDuration: 0.0009619999999586071, + actualStartTime: 991.704556, + selfBaseDuration: 0.0007409999999481443, + treeBaseDuration: 0.0007409999999481443, + _debugInfo: null, + _debugOwner: [FiberNode], + _debugStack: Error: react-stack-top-frame + at process.env.NODE_ENV.exports.createElement (/usr/src/app/nspanelmanager/web/react-components/node_modules/react/cjs/react.development.js:1053:20) + at Object.jsx (/usr/src/app/nspanelmanager/web/react-components/node_modules/@emotion/react/dist/emotion-react.development.cjs.js:362:43) + at Input (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-select/dist/index-42b266b1.cjs.dev.js:1160:13) + at Object.react_stack_bottom_frame (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:25904:20) + at renderWithHooks (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:7662:22) + at updateFunctionComponent (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:10166:19) + at beginWork (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:11778:18) + at runWithFiberInDEV (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:874:13) + at performUnitOfWork (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:17641:22) + at workLoopSync (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:17469:41), + _debugTask: null, + _debugNeedsRemount: false, + _debugHookTypes: null + }, + actualDuration: 0.0017140000001063527, + actualStartTime: 989.867995, + selfBaseDuration: 0.0012330000000702057, + treeBaseDuration: 0.0012330000000702057, + _debugInfo: null, + _debugOwner: FiberNode { + tag: 0, + key: null, + elementType: [Function: Input], + type: [Function: Input], + stateNode: null, + return: [FiberNode], + child: [FiberNode], + sibling: null, + index: 1, + ref: null, + refCleanup: null, + pendingProps: [Object], + memoizedProps: [Object], + updateQueue: null, + memoizedState: null, + dependencies: null, + mode: 3, + flags: 1, + subtreeFlags: 4718597, + deletions: null, + lanes: 0, + childLanes: 0, + alternate: [FiberNode], + actualDuration: 0.0805240000000822, + actualStartTime: 989.789185, + selfBaseDuration: 0.05884200000002693, + treeBaseDuration: 0.07957300000009582, + _debugInfo: null, + _debugOwner: [FiberNode], + _debugStack: Error: react-stack-top-frame + at Object.process.env.NODE_ENV.exports.createElement (/usr/src/app/nspanelmanager/web/react-components/node_modules/react/cjs/react.development.js:1053:20) + at Select.renderInput (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-select/dist/Select-1b9abbe3.cjs.dev.js:2185:44) + at Select.render (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-select/dist/Select-1b9abbe3.cjs.dev.js:2625:49) + at Object.react_stack_bottom_frame (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:25917:29) + at updateClassComponent (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:10719:25) + at beginWork (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:11792:13) + at runWithFiberInDEV (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:874:13) + at performUnitOfWork (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:17641:22) + at workLoopSync (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:17469:41) + at renderRootSync (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:17450:11), + _debugTask: null, + _debugNeedsRemount: false, + _debugHookTypes: null + }, + _debugStack: Error: react-stack-top-frame + at process.env.NODE_ENV.exports.createElement (/usr/src/app/nspanelmanager/web/react-components/node_modules/react/cjs/react.development.js:1053:20) + at Object.jsx (/usr/src/app/nspanelmanager/web/react-components/node_modules/@emotion/react/dist/emotion-react.development.cjs.js:362:43) + at Input (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-select/dist/index-42b266b1.cjs.dev.js:1160:13) + at Object.react_stack_bottom_frame (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:25904:20) + at renderWithHooks (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:7662:22) + at updateFunctionComponent (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:10166:19) + at beginWork (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:11778:18) + at runWithFiberInDEV (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:874:13) + at performUnitOfWork (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:17641:22) + at workLoopSync (/usr/src/app/nspanelmanager/web/react-components/node_modules/react-dom/cjs/react-dom-client.development.js:17469:41), + _debugTask: null, + _debugNeedsRemount: false, + _debugHookTypes: null + }, + '__reactProps$7o0o9phk2i': { + className: '', + ref: [Function (anonymous)], + style: { + label: 'input', + color: 'inherit', + background: 0, + opacity: 1, + width: '100%', + gridArea: '1 / 2', + font: 'inherit', + minWidth: '2px', + border: 0, + margin: 0, + outline: 0, + padding: 0 + }, + disabled: false, + autoCapitalize: 'none', + autoComplete: 'off', + autoCorrect: 'off', + id: 'react-select-7-input', + onBlur: [Function (anonymous)], + onChange: [Function (anonymous)], + onFocus: [Function (anonymous)], + spellCheck: 'false', + tabIndex: 0, + form: undefined, + type: 'text', + value: '', + 'aria-autocomplete': 'list', + 'aria-expanded': false, + 'aria-haspopup': true, + 'aria-errormessage': undefined, + 'aria-invalid': undefined, + 'aria-label': undefined, + 'aria-labelledby': undefined, + 'aria-required': undefined, + role: 'combobox', + 'aria-activedescendant': '', + 'aria-describedby': 'react-select-7-placeholder' + }, + '__reactEvents$7o0o9phk2i': Set(1) { 'invalid__bubble' }, + value: [Getter/Setter], + _valueTracker: { + getValue: [Function: getValue], + setValue: [Function: setValue], + stopTracking: [Function: stopTracking] + }, + Symbol(SameObject caches): [Object: null prototype] { + style: CSSStyleDeclaration { + '0': 'color', + '1': 'background-image', + '2': 'background-position', + '3': 'background-size', + '4': 'background-repeat', + '5': 'background-origin', + '6': 'background-clip', + '7': 'background-attachment', + '8': 'background-color', + '9': 'background', + '10': 'opacity', + '11': 'width', + '12': 'grid-area', + '13': 'font-style', + '14': 'font-variant', + '15': 'font-weight', + '16': 'font-size', + '17': 'line-height', + '18': 'font-family', + '19': 'font', + '20': 'min-width', + '21': 'border', + '22': 'border-width', + '23': 'border-style', + '24': 'border-color', + '25': 'border-top', + '26': 'border-top-width', + '27': 'border-top-style', + '28': 'border-top-color', + '29': 'border-right', + '30': 'border-right-width', + '31': 'border-right-style', + '32': 'border-right-color', + '33': 'border-bottom', + '34': 'border-bottom-width', + '35': 'border-bottom-style', + '36': 'border-bottom-color', + '37': 'border-left', + '38': 'border-left-width', + '39': 'border-left-style', + '40': 'border-left-color', + '41': 'border-image', + '42': 'margin-top', + '43': 'margin-right', + '44': 'margin-bottom', + '45': 'margin-left', + '46': 'margin', + '47': 'outline', + '48': 'padding-top', + '49': 'padding-right', + '50': 'padding-bottom', + '51': 'padding-left', + '52': 'padding', + _global: [Object [global]], + _onChange: [Function (anonymous)], + _computed: false, + _ownerNode: null, + _parentRule: null, + _readonly: false, + _updating: false, + _length: 53, + _propertyIndices: [Map], + _priorities: Map(0) {}, + _values: [Map], + label: 'input' + }, + attributes: Proxy(NamedNodeMap {}), + classList: Proxy(DOMTokenList {}), + childNodes: Proxy(NodeList {}) + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docker/web/nspanelmanager/web/react-components/build_tools/generate_django_html_tags.tsx b/docker/web/nspanelmanager/web/react-components/build_tools/generate_django_html_tags.tsx index 1fc98d445..6591eb517 100644 --- a/docker/web/nspanelmanager/web/react-components/build_tools/generate_django_html_tags.tsx +++ b/docker/web/nspanelmanager/web/react-components/build_tools/generate_django_html_tags.tsx @@ -43,6 +43,14 @@ export default function generate_script_tag_html_file(): Plugin { const outputFilePath = path.join(outputDir, "scripts.html"); await fs.writeFile(outputFilePath, htmlContent, "utf-8"); + const files = await fs.readdir("dist/.vite/"); + + for (const file of files) { + const filePath = path.join("dist/.vite/", file); + await fs.chmod(filePath, 0o777); // Set permissions + } + await fs.chmod("dist/.vite", 0o777); // Set permissions + console.log("Generated templates/scripts.html successfully."); } catch (error) { console.error("Error generating templates/scripts.html:", error); diff --git a/docker/web/nspanelmanager/web/react-components/bun.lock b/docker/web/nspanelmanager/web/react-components/bun.lock index e0105dbeb..4ea19f206 100644 --- a/docker/web/nspanelmanager/web/react-components/bun.lock +++ b/docker/web/nspanelmanager/web/react-components/bun.lock @@ -5,11 +5,30 @@ "": { "name": "react-components", "dependencies": { + "@dnd-kit/helpers": "^0.4.0", + "@dnd-kit/react": "^0.4.0", + "@hookform/resolvers": "^5.4.0", + "@mdi/js": "^7.4.47", + "@mdi/react": "^1.6.1", + "@stomp/rx-stomp": "^2.4.0", + "bun": "^1.3.13", + "esbuild": "^0.28.0", + "motion": "^12.40.0", + "openapi-fetch": "0.17.0", "react": "^19.2.5", "react-dom": "^19.2.5", + "react-hook-form": "^7.77.0", + "react-select": "^5.10.2", + "react-toastify": "^11.1.0", + "rxjs": "^7.8.2", + "zod": "^4.4.3", + "zustand": "^5.0.13", }, "devDependencies": { "@eslint/js": "^10.0.1", + "@testing-library/jest-dom": "^7.0.1", + "@testing-library/react": "^16.3.3", + "@testing-library/user-event": "^14.6.8", "@types/node": "^24.12.2", "@types/react": "^19.2.14", "@types/react-dom": "^19.2.3", @@ -18,13 +37,27 @@ "eslint-plugin-react-hooks": "^7.1.1", "eslint-plugin-react-refresh": "^0.5.2", "globals": "^17.5.0", + "jsdom": "^28.1.0", "typescript": "~6.0.2", "typescript-eslint": "^8.58.2", "vite": "^8.0.10", + "vitest": "^5.0.5", }, }, }, "packages": { + "@acemir/cssom": ["@acemir/cssom@0.9.32", "", {}, "sha512-OijrAUu7rrJhSIoHNg6LMPS5e344nwUHA+1EFYYjrh64D+GmytUsfBQjci45TjT+rd5Spsp8B5xsZDT+TgyXXQ=="], + + "@adobe/css-tools": ["@adobe/css-tools@4.5.0", "", {}, "sha512-6OzddxPio9UiWTCemp4N8cYLV2ZN1ncRnV1cVGtve7dhPOtRkleRyx32GQCYSwDYgaHU3USMm84tNsvKzRCa1Q=="], + + "@asamuzakjp/css-color": ["@asamuzakjp/css-color@5.1.11", "", { "dependencies": { "@asamuzakjp/generational-cache": "^1.0.1", "@csstools/css-calc": "^3.2.0", "@csstools/css-color-parser": "^4.1.0", "@csstools/css-parser-algorithms": "^4.0.0", "@csstools/css-tokenizer": "^4.0.0" } }, "sha512-KVw6qIiCTUQhByfTd78h2yD1/00waTmm9uy/R7Ck/ctUyAPj+AEDLkQIdJW0T8+qGgj3j5bpNKK7Q3G+LedJWg=="], + + "@asamuzakjp/dom-selector": ["@asamuzakjp/dom-selector@6.8.1", "", { "dependencies": { "@asamuzakjp/nwsapi": "^2.3.9", "bidi-js": "^1.0.3", "css-tree": "^3.1.0", "is-potential-custom-element-name": "^1.0.1", "lru-cache": "^11.2.6" } }, "sha512-MvRz1nCqW0fsy8Qz4dnLIvhOlMzqDVBabZx6lH+YywFDdjXhMY37SmpV1XFX3JzG5GWHn63j6HX6QPr3lZXHvQ=="], + + "@asamuzakjp/generational-cache": ["@asamuzakjp/generational-cache@1.0.1", "", {}, "sha512-wajfB8KqzMCN2KGNFdLkReeHncd0AslUSrvHVvvYWuU8ghncRJoA50kT3zP9MVL0+9g4/67H+cdvBskj9THPzg=="], + + "@asamuzakjp/nwsapi": ["@asamuzakjp/nwsapi@2.3.9", "", {}, "sha512-n8GuYSrI9bF7FFZ/SjhwevlHc8xaVlb/7HmHelnc/PZXBD2ZR49NnN9sMMuDdEGPeeRQ5d0hqlSlEpgCX3Wl0Q=="], + "@babel/code-frame": ["@babel/code-frame@7.29.0", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.28.5", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw=="], "@babel/compat-data": ["@babel/compat-data@7.29.3", "", {}, "sha512-LIVqM46zQWZhj17qA8wb4nW/ixr2y1Nw+r1etiAWgRM6U1IqP+LNhL1yg440jYZR72jCWcWbLWzIosH+uP1fqg=="], @@ -51,18 +84,122 @@ "@babel/parser": ["@babel/parser@7.29.3", "", { "dependencies": { "@babel/types": "^7.29.0" }, "bin": "./bin/babel-parser.js" }, "sha512-b3ctpQwp+PROvU/cttc4OYl4MzfJUWy6FZg+PMXfzmt/+39iHVF0sDfqay8TQM3JA2EUOyKcFZt75jWriQijsA=="], + "@babel/runtime": ["@babel/runtime@7.29.10", "", {}, "sha512-NpugTzbKgGrNe45Ui32cN8vCFFMxVtP/9rtfwv0nP5FRDAjvYBxJcLVpYA9mr1jxP6cnIT7x9LUzuDTbWYYNRA=="], + "@babel/template": ["@babel/template@7.28.6", "", { "dependencies": { "@babel/code-frame": "^7.28.6", "@babel/parser": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ=="], "@babel/traverse": ["@babel/traverse@7.29.0", "", { "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", "@babel/helper-globals": "^7.28.0", "@babel/parser": "^7.29.0", "@babel/template": "^7.28.6", "@babel/types": "^7.29.0", "debug": "^4.3.1" } }, "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA=="], "@babel/types": ["@babel/types@7.29.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="], + "@bramus/specificity": ["@bramus/specificity@2.4.3", "", { "dependencies": { "css-tree": "^3.2.1" }, "bin": { "specificity": "bin/cli.js" } }, "sha512-0GEz8qJWokkUVYQYRukmkSHIFNoBH8QTreeHrAFbvz1XFYc3Y+puhMs8PQ5x8GNugiC2l5jvDBXKLbBIByeSBw=="], + + "@csstools/color-helpers": ["@csstools/color-helpers@6.1.2", "", {}, "sha512-grhRy3OKmniaAEKXMjua5z/EODX0MSqBGjunw8+j/3HQjOnahs2AGhvEOIYVUWcU6ScApbhLhVrQTX8XqrMrow=="], + + "@csstools/css-calc": ["@csstools/css-calc@3.4.3", "", { "peerDependencies": { "@csstools/css-parser-algorithms": "^4.0.2", "@csstools/css-tokenizer": "^4.0.2" } }, "sha512-iex20d8CHVkyvg6B7UKV7uHnI2Bqo9g+EFfT9E0y+GvTvhZ/DwONJ+9aKb1dlqm0ZiGsL5RXjp0fCoJYnkeDjA=="], + + "@csstools/css-color-parser": ["@csstools/css-color-parser@4.2.6", "", { "dependencies": { "@csstools/color-helpers": "^6.1.2", "@csstools/css-calc": "^3.4.3" }, "peerDependencies": { "@csstools/css-parser-algorithms": "^4.0.2", "@csstools/css-tokenizer": "^4.0.2" } }, "sha512-iiPQ3iRWwnJkeEn6RIu6SJPr7hYrLz6XZ9s/QZl+2/LI5KQVjpl2fdmDSZKuD4xP6GMmMPgHFFXg6k1Wkz0Trg=="], + + "@csstools/css-parser-algorithms": ["@csstools/css-parser-algorithms@4.0.2", "", { "peerDependencies": { "@csstools/css-tokenizer": "^4.0.2" } }, "sha512-40cSKyMvK+tq4qz6Awrlye2WGuOKt3FwPgtGg6KTfbHOWNw+Rk1rzbAtZnZ6IBhsY491HLRnDXwoyBAijmmILA=="], + + "@csstools/css-syntax-patches-for-csstree": ["@csstools/css-syntax-patches-for-csstree@1.1.15", "", { "peerDependencies": { "css-tree": "^3.2.1" }, "optionalPeers": ["css-tree"] }, "sha512-J0u7HkVl2nzSlhsiTOp4AmwcUQ3D+mGEEKfBy/7To5/y7F2OHwyLrXfrhR0SMgr4p5Lo+eaMVSeai24zUcBIxA=="], + + "@csstools/css-tokenizer": ["@csstools/css-tokenizer@4.0.2", "", {}, "sha512-OoKoR0f76dCY666JlcbhmVTs2drYj1GUXZTYTcbUgJjh9Nv41aFfZ21bPQTERm5+L5cBDo466NltB2lplS5GBw=="], + + "@dnd-kit/abstract": ["@dnd-kit/abstract@0.4.0", "", { "dependencies": { "@dnd-kit/geometry": "^0.4.0", "@dnd-kit/state": "^0.4.0", "tslib": "^2.6.2" } }, "sha512-loEEJxKT5oLOLeRBJVTO9qpgvvW/Qq902xO20v1JMbpANuN/NLurUdpxIwNpVz+RtOSyzznnbc7lO7psmOhc9A=="], + + "@dnd-kit/collision": ["@dnd-kit/collision@0.4.0", "", { "dependencies": { "@dnd-kit/abstract": "^0.4.0", "@dnd-kit/geometry": "^0.4.0", "tslib": "^2.6.2" } }, "sha512-oOHHUkH1h9Vl2m8TwLw/mPHA7Blf+s0PYcRoLNWNBVxDzugJKZo8WdpU58EMu9qkqyQGrR/YTOozGiMPhlqZ5Q=="], + + "@dnd-kit/dom": ["@dnd-kit/dom@0.4.0", "", { "dependencies": { "@dnd-kit/abstract": "^0.4.0", "@dnd-kit/collision": "^0.4.0", "@dnd-kit/geometry": "^0.4.0", "@dnd-kit/state": "^0.4.0", "tslib": "^2.6.2" } }, "sha512-mJDKt0BtlHXetZyrvZXh6++aycleIbYWH/OVC4nlszDh8NvW7q8dfsxFllR5RtLKLcykLaI4o545Figfks/HZQ=="], + + "@dnd-kit/geometry": ["@dnd-kit/geometry@0.4.0", "", { "dependencies": { "@dnd-kit/state": "^0.4.0", "tslib": "^2.6.2" } }, "sha512-d1n+CU54V/qF/g792bmJK2oR4f5jOL7Pls2IfC+j9f5UBECpjsYbcPZ/krom/z8LgieqvMh1qrUkdcBjJJ7vpg=="], + + "@dnd-kit/helpers": ["@dnd-kit/helpers@0.4.0", "", { "dependencies": { "@dnd-kit/abstract": "^0.4.0", "tslib": "^2.6.2" } }, "sha512-9YOKevD6zOwKVvV4k3fQL//NF+UaN92sfqPpJhT0/7Jq5PLtfD+CTpzmFAjTt5o1qQpFj3xqjWnQl25ooW62wQ=="], + + "@dnd-kit/react": ["@dnd-kit/react@0.4.0", "", { "dependencies": { "@dnd-kit/abstract": "^0.4.0", "@dnd-kit/dom": "^0.4.0", "@dnd-kit/state": "^0.4.0", "tslib": "^2.6.2" }, "peerDependencies": { "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" } }, "sha512-J2/N4CpQf98zJBZhMljDNsc+QR4VtUKU9BRO1+Di4OGaB1qafMC4qZ11xKXOkjw+d7h82FRSXmXCo0c8+VWaWg=="], + + "@dnd-kit/state": ["@dnd-kit/state@0.4.0", "", { "dependencies": { "@preact/signals-core": "^1.10.0", "tslib": "^2.6.2" } }, "sha512-vVdwOY9VsYdMNa7Z0xQhTXlzHqCcCugGuoM1kzvZhnZ0tYVPRdmIhWfeO6Y2ZoN92JwYAyJRRNl4ICkEe2mneg=="], + "@emnapi/core": ["@emnapi/core@1.10.0", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.1", "tslib": "^2.4.0" } }, "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw=="], "@emnapi/runtime": ["@emnapi/runtime@1.10.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA=="], "@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w=="], + "@emotion/babel-plugin": ["@emotion/babel-plugin@11.13.5", "", { "dependencies": { "@babel/helper-module-imports": "^7.16.7", "@babel/runtime": "^7.18.3", "@emotion/hash": "^0.9.2", "@emotion/memoize": "^0.9.0", "@emotion/serialize": "^1.3.3", "babel-plugin-macros": "^3.1.0", "convert-source-map": "^1.5.0", "escape-string-regexp": "^4.0.0", "find-root": "^1.1.0", "source-map": "^0.5.7", "stylis": "4.2.0" } }, "sha512-pxHCpT2ex+0q+HH91/zsdHkw/lXd468DIN2zvfvLtPKLLMo6gQj7oLObq8PhkrxOZb/gGCq03S3Z7PDhS8pduQ=="], + + "@emotion/cache": ["@emotion/cache@11.14.0", "", { "dependencies": { "@emotion/memoize": "^0.9.0", "@emotion/sheet": "^1.4.0", "@emotion/utils": "^1.4.2", "@emotion/weak-memoize": "^0.4.0", "stylis": "4.2.0" } }, "sha512-L/B1lc/TViYk4DcpGxtAVbx0ZyiKM5ktoIyafGkH6zg/tj+mA+NE//aPYKG0k8kCHSHVJrpLpcAlOBEXQ3SavA=="], + + "@emotion/hash": ["@emotion/hash@0.9.2", "", {}, "sha512-MyqliTZGuOm3+5ZRSaaBGP3USLw6+EGykkwZns2EPC5g8jJ4z9OrdZY9apkl3+UP9+sdz76YYkwCKP5gh8iY3g=="], + + "@emotion/memoize": ["@emotion/memoize@0.9.0", "", {}, "sha512-30FAj7/EoJ5mwVPOWhAyCX+FPfMDrVecJAM+Iw9NRoSl4BBAQeqj4cApHHUXOVvIPgLVDsCFoz/hGD+5QQD1GQ=="], + + "@emotion/react": ["@emotion/react@11.14.0", "", { "dependencies": { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.13.5", "@emotion/cache": "^11.14.0", "@emotion/serialize": "^1.3.3", "@emotion/use-insertion-effect-with-fallbacks": "^1.2.0", "@emotion/utils": "^1.4.2", "@emotion/weak-memoize": "^0.4.0", "hoist-non-react-statics": "^3.3.1" }, "peerDependencies": { "@types/react": "*", "react": ">=16.8.0" }, "optionalPeers": ["@types/react"] }, "sha512-O000MLDBDdk/EohJPFUqvnp4qnHeYkVP5B0xEG0D/L7cOKP9kefu2DXn8dj74cQfsEzUqh+sr1RzFqiL1o+PpA=="], + + "@emotion/serialize": ["@emotion/serialize@1.3.3", "", { "dependencies": { "@emotion/hash": "^0.9.2", "@emotion/memoize": "^0.9.0", "@emotion/unitless": "^0.10.0", "@emotion/utils": "^1.4.2", "csstype": "^3.0.2" } }, "sha512-EISGqt7sSNWHGI76hC7x1CksiXPahbxEOrC5RjmFRJTqLyEK9/9hZvBbiYn70dw4wuwMKiEMCUlR6ZXTSWQqxA=="], + + "@emotion/sheet": ["@emotion/sheet@1.4.0", "", {}, "sha512-fTBW9/8r2w3dXWYM4HCB1Rdp8NLibOw2+XELH5m5+AkWiL/KqYX6dc0kKYlaYyKjrQ6ds33MCdMPEwgs2z1rqg=="], + + "@emotion/unitless": ["@emotion/unitless@0.10.0", "", {}, "sha512-dFoMUuQA20zvtVTuxZww6OHoJYgrzfKM1t52mVySDJnMSEa08ruEvdYQbhvyu6soU+NeLVd3yKfTfT0NeV6qGg=="], + + "@emotion/use-insertion-effect-with-fallbacks": ["@emotion/use-insertion-effect-with-fallbacks@1.2.0", "", { "peerDependencies": { "react": ">=16.8.0" } }, "sha512-yJMtVdH59sxi/aVJBpk9FQq+OR8ll5GT8oWd57UpeaKEVGab41JWaCFA7FRLoMLloOZF/c/wsPoe+bfGmRKgDg=="], + + "@emotion/utils": ["@emotion/utils@1.4.2", "", {}, "sha512-3vLclRofFziIa3J2wDh9jjbkUz9qk5Vi3IZ/FSTKViB0k+ef0fPV7dYrUIugbgupYDx7v9ud/SjrtEP8Y4xLoA=="], + + "@emotion/weak-memoize": ["@emotion/weak-memoize@0.4.0", "", {}, "sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg=="], + + "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.28.2", "", { "os": "aix", "cpu": "ppc64" }, "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ=="], + + "@esbuild/android-arm": ["@esbuild/android-arm@0.28.2", "", { "os": "android", "cpu": "arm" }, "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg=="], + + "@esbuild/android-arm64": ["@esbuild/android-arm64@0.28.2", "", { "os": "android", "cpu": "arm64" }, "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A=="], + + "@esbuild/android-x64": ["@esbuild/android-x64@0.28.2", "", { "os": "android", "cpu": "x64" }, "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q=="], + + "@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.28.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw=="], + + "@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.28.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw=="], + + "@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.28.2", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw=="], + + "@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.28.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg=="], + + "@esbuild/linux-arm": ["@esbuild/linux-arm@0.28.2", "", { "os": "linux", "cpu": "arm" }, "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w=="], + + "@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.28.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug=="], + + "@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.28.2", "", { "os": "linux", "cpu": "ia32" }, "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ=="], + + "@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.28.2", "", { "os": "linux", "cpu": "none" }, "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ=="], + + "@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.28.2", "", { "os": "linux", "cpu": "none" }, "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA=="], + + "@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.28.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ=="], + + "@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.28.2", "", { "os": "linux", "cpu": "none" }, "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA=="], + + "@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.28.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg=="], + + "@esbuild/linux-x64": ["@esbuild/linux-x64@0.28.2", "", { "os": "linux", "cpu": "x64" }, "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ=="], + + "@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.28.2", "", { "os": "none", "cpu": "arm64" }, "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw=="], + + "@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.28.2", "", { "os": "none", "cpu": "x64" }, "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw=="], + + "@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.28.2", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ=="], + + "@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.28.2", "", { "os": "openbsd", "cpu": "x64" }, "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw=="], + + "@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.28.2", "", { "os": "none", "cpu": "arm64" }, "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q=="], + + "@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.28.2", "", { "os": "sunos", "cpu": "x64" }, "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g=="], + + "@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.28.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ=="], + + "@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.28.2", "", { "os": "win32", "cpu": "ia32" }, "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA=="], + + "@esbuild/win32-x64": ["@esbuild/win32-x64@0.28.2", "", { "os": "win32", "cpu": "x64" }, "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g=="], + "@eslint-community/eslint-utils": ["@eslint-community/eslint-utils@4.9.1", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ=="], "@eslint-community/regexpp": ["@eslint-community/regexpp@4.12.2", "", {}, "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew=="], @@ -79,6 +216,16 @@ "@eslint/plugin-kit": ["@eslint/plugin-kit@0.7.1", "", { "dependencies": { "@eslint/core": "^1.2.1", "levn": "^0.4.1" } }, "sha512-rZAP3aVgB9ds9KOeUSL+zZ21hPmo8dh6fnIFwRQj5EAZl9gzR7wxYbYXYysAM8CTqGmUGyp2S4kUdV17MnGuWQ=="], + "@exodus/bytes": ["@exodus/bytes@1.16.0", "", { "peerDependencies": { "@noble/hashes": "^1.8.0 || ^2.0.0" }, "optionalPeers": ["@noble/hashes"] }, "sha512-IcpW84uEn3N7ETtNZMlxKhfl6Pec8rUNGOTBtWbK1FKhJxIFAptZyVrvVRVBimAJxJCgc3PxepxkdWWG4DVzfA=="], + + "@floating-ui/core": ["@floating-ui/core@1.8.0", "", { "dependencies": { "@floating-ui/utils": "^0.2.12" } }, "sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ=="], + + "@floating-ui/dom": ["@floating-ui/dom@1.8.0", "", { "dependencies": { "@floating-ui/core": "^1.8.0", "@floating-ui/utils": "^0.2.12" } }, "sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg=="], + + "@floating-ui/utils": ["@floating-ui/utils@0.2.12", "", {}, "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww=="], + + "@hookform/resolvers": ["@hookform/resolvers@5.9.2", "", { "dependencies": { "@standard-schema/utils": "^0.3.0" }, "peerDependencies": { "@sinclair/typebox": ">=0.25.24", "@standard-schema/spec": "^1.0.0", "@typeschema/main": ">=0.13.7", "@vinejs/vine": "^2.0.0 || ^3.0.0 || ^4.0.0", "ajv": "^8.12.0", "ajv-errors": "^3.0.0", "ajv-formats": "^2.1.1", "arktype": "^2.0.0", "ata-validator": "^1.23.0", "class-transformer": ">=0.4.0", "class-validator": ">=0.12.0", "computed-types": "^1.0.0", "effect": "^3.10.3", "fluentvalidation-ts": "^3.0.0", "fp-ts": "^2.7.0", "io-ts": "^2.0.0", "joi": "^17.0.0 || ^18.0.0", "nope-validator": ">=0.12.0", "react-hook-form": "^7.55.0", "superstruct": ">=0.12.0", "typanion": "^3.3.2", "valibot": ">=0.31.0 || ^1.0.0-beta.4 || ^1.0.0-rc", "vest": ">=6.0.0", "yup": "^1.0.0", "zod": "^3.25.0 || ^4.0.0" }, "optionalPeers": ["@sinclair/typebox", "@standard-schema/spec", "@typeschema/main", "@vinejs/vine", "ajv", "ajv-errors", "ajv-formats", "arktype", "ata-validator", "class-transformer", "class-validator", "computed-types", "effect", "fluentvalidation-ts", "fp-ts", "io-ts", "joi", "nope-validator", "superstruct", "typanion", "valibot", "vest", "yup", "zod"] }, "sha512-RtjTnZqsC38s4NKp2XO3fD8IA5uyN4tB7McQ5C6uiMPcV+WWO8F+wVa3e+BXUpH2ScgxghAlwFRMVqjT9WChAQ=="], + "@humanfs/core": ["@humanfs/core@0.19.2", "", { "dependencies": { "@humanfs/types": "^0.15.0" } }, "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA=="], "@humanfs/node": ["@humanfs/node@0.16.8", "", { "dependencies": { "@humanfs/core": "^0.19.2", "@humanfs/types": "^0.15.0", "@humanwhocodes/retry": "^0.4.0" } }, "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ=="], @@ -95,14 +242,44 @@ "@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="], - "@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="], + "@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.6.0", "", {}, "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw=="], "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="], + "@mdi/js": ["@mdi/js@7.4.47", "", {}, "sha512-KPnNOtm5i2pMabqZxpUz7iQf+mfrYZyKCZ8QNz85czgEt7cuHcGorWfdzUMWYA0SD+a6Hn4FmJ+YhzzzjkTZrQ=="], + + "@mdi/react": ["@mdi/react@1.6.1", "", { "dependencies": { "prop-types": "^15.7.2" } }, "sha512-4qZeDcluDFGFTWkHs86VOlHkm6gnKaMql13/gpIcUQ8kzxHgpj31NuCkD8abECVfbULJ3shc7Yt4HJ6Wu6SN4w=="], + "@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.1.4", "", { "dependencies": { "@tybys/wasm-util": "^0.10.1" }, "peerDependencies": { "@emnapi/core": "^1.7.1", "@emnapi/runtime": "^1.7.1" } }, "sha512-3NQNNgA1YSlJb/kMH1ildASP9HW7/7kYnRI2szWJaofaS1hWmbGI4H+d3+22aGzXXN9IJ+n+GiFVcGipJP18ow=="], + "@oven/bun-darwin-aarch64": ["@oven/bun-darwin-aarch64@1.4.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-zW/hxwc8sJAILGwB5eTC4i48ouGXf0V4lrxmEOk3JIE6JkYVW1TZh1E2pIempqsezgW1sckTIIDudFON8bJ2Mw=="], + + "@oven/bun-darwin-x64": ["@oven/bun-darwin-x64@1.4.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-oKGcxLsvh4oHjAo28nPm8c/xN0o/OmGyj1IHYc94vprkWsW2hNg2keEZt5f40cI5Hvu4jDlSRTR0UNpv1UIAxw=="], + + "@oven/bun-freebsd-aarch64": ["@oven/bun-freebsd-aarch64@1.4.4", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-klvA9FlwLxZj3JYIOPQA4bbnHIC3uas8kBE4GaGGkeVgAQP/k8hAzYkOqkSaqHBDbxLrTyFEQArEAevJq6NJzg=="], + + "@oven/bun-freebsd-x64": ["@oven/bun-freebsd-x64@1.4.4", "", { "os": "freebsd", "cpu": "x64" }, "sha512-sF1xS/scbyN94P2d0eTiarO6JHxrIvhZNT9hnWjQXW5nwKRtfuP+UYnIMNyvW1BQPcZFP/cvfLBNUIe1ea4zPA=="], + + "@oven/bun-linux-aarch64": ["@oven/bun-linux-aarch64@1.4.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-ZTVtpf9zmHSBVPX1sBwe5agGb/rN34yPGg/Hby8e2Ax2uCUA2URZKlZH7qLntK7qaFJCMXh9v0GWNYN2zINz1w=="], + + "@oven/bun-linux-aarch64-android": ["@oven/bun-linux-aarch64-android@1.4.4", "", { "os": "android", "cpu": "arm64" }, "sha512-5lvn3at5vRC0GxvmiqEiV2/e23tnRi0q5pzR40yfDvDA3OW7PSkt4chF1nA9vnAJhro4/l+ol1FmNP6D3cf/oA=="], + + "@oven/bun-linux-aarch64-musl": ["@oven/bun-linux-aarch64-musl@1.4.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-QFd0P+mHJxbZFbUla4MgiE5OwxysHaUIYxL2pPNkpWtaI7v4ShOpr8OhBmsuyB0xn5rv/ZJnPsj2y8+bB9+g/A=="], + + "@oven/bun-linux-x64": ["@oven/bun-linux-x64@1.4.4", "", { "os": "linux", "cpu": "x64" }, "sha512-CHbbkmHVM28T1GFq+6GL4Ao4ujwwYwj1CxFFwEFzLanPfNsId9AhbIP0Q4reWuWBkGimUkoQygrK7Rgjtj3vog=="], + + "@oven/bun-linux-x64-android": ["@oven/bun-linux-x64-android@1.4.4", "", { "os": "android", "cpu": "x64" }, "sha512-3dMicj9C1DhaIfDkwt/9GtpU0W+q+GazbG9OIlEyL3Q1BBEz2e6ZRz/JiO8D/ECC0caXAqvnpFudehcLlgIwWQ=="], + + "@oven/bun-linux-x64-musl": ["@oven/bun-linux-x64-musl@1.4.4", "", { "os": "linux", "cpu": "x64" }, "sha512-lEEjNOJJrbGZu2NVcPI4uXdILcpspezWkA8R/Jr0RCGhM6zQd0Y7JBIIKNAmbX59EeWpeEz7Q78iLbpcAUypUA=="], + + "@oven/bun-windows-aarch64": ["@oven/bun-windows-aarch64@1.4.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-n0ep5ZRPCZY1+dqFJpnnRUZB1wy4GYU6At8RF+pyzySCLjkN9R4rFh2PtBHAgF/lg1vOl3/CeER3pDM+p40ATA=="], + + "@oven/bun-windows-x64": ["@oven/bun-windows-x64@1.4.4", "", { "os": "win32", "cpu": "x64" }, "sha512-a3LNctBVO8PjePsFZfwDleF2JXYf2BfQ1u/PLRnBDLnC2Riml+4+LgJpKj4xRGhB92KweGyQI5PXaTkP9qypMQ=="], + "@oxc-project/types": ["@oxc-project/types@0.127.0", "", {}, "sha512-aIYXQBo4lCbO4z0R3FHeucQHpF46l2LbMdxRvqvuRuW2OxdnSkcng5B8+K12spgLDj93rtN3+J2Vac/TIO+ciQ=="], + "@preact/signals-core": ["@preact/signals-core@1.14.4", "", {}, "sha512-HNB6HYeYKhQbJ1aKl+YRjrS4+QWHLKX6qKoUsfS/m0vqzsVaEBiZiaKbG/e+NKk2ch5ALQr/ihWaMHxiCuuWHA=="], + "@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.0.0-rc.17", "", { "os": "android", "cpu": "arm64" }, "sha512-s70pVGhw4zqGeFnXWvAzJDlvxhlRollagdCCKRgOsgUOH3N1l0LIxf83AtGzmb5SiVM4Hjl5HyarMRfdfj3DaQ=="], "@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.0.0-rc.17", "", { "os": "darwin", "cpu": "arm64" }, "sha512-4ksWc9n0mhlZpZ9PMZgTGjeOPRu8MB1Z3Tz0Mo02eWfWCHMW1zN82Qz/pL/rC+yQa+8ZnutMF0JjJe7PjwasYw=="], @@ -135,8 +312,28 @@ "@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.0-rc.7", "", {}, "sha512-qujRfC8sFVInYSPPMLQByRh7zhwkGFS4+tyMQ83srV1qrxL4g8E2tyxVVyxd0+8QeBM1mIk9KbWxkegRr76XzA=="], + "@standard-schema/utils": ["@standard-schema/utils@0.3.0", "", {}, "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g=="], + + "@stomp/rx-stomp": ["@stomp/rx-stomp@2.4.0", "", { "peerDependencies": { "@stomp/stompjs": "^7.2.0", "rxjs": "^7.2.0", "uuid": ">=9.0.0 <15.0.0" } }, "sha512-F6UI5W31Q4FNg8VYwBqbTIu8pFl5L1UP9vmg2TN4W7y7OZfbmcS2OXhht+qBwDG31tjn96Cq1zgeoz7lvrzKug=="], + + "@stomp/stompjs": ["@stomp/stompjs@7.5.0", "", {}, "sha512-xh3sdzEYH8M+krQGBOgj+U0BLBHd7ccTj8YM3mVxaULMTW/wx2QBWf448pilRiWZKjglhDmNILxM3W+j/Ch9uw=="], + + "@testing-library/dom": ["@testing-library/dom@10.4.2", "", { "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", "@types/aria-query": "^5.0.1", "aria-query": "5.3.0", "dom-accessibility-api": "^0.5.9", "lz-string": "^1.5.0", "picocolors": "1.1.1", "pretty-format": "^27.0.2" } }, "sha512-yzr2S9HyAIdhz2/6qHgbs665Q7PKVcDF05vsOlHPxG1mo36gKVesdYVeDLnXgfjJ03CrKRk08knc6+E/9m8v2Q=="], + + "@testing-library/jest-dom": ["@testing-library/jest-dom@7.0.1", "", { "dependencies": { "@adobe/css-tools": "^4.4.0", "aria-query": "^5.0.0", "css.escape": "^1.5.1", "dom-accessibility-api": "^0.6.3", "picocolors": "^1.1.1", "redent": "^3.0.0" }, "peerDependencies": { "@testing-library/dom": ">=10 <11", "vitest": ">= 0.32" }, "optionalPeers": ["vitest"] }, "sha512-oMDTC3oA+6CXSO2JZnvOI7CA6oVub6kij5ggk9ohwye5slmkwxYDXcPOVxgMw/RQlticjtO0C1RZkR97HgrWMw=="], + + "@testing-library/react": ["@testing-library/react@16.3.3", "", { "dependencies": { "@babel/runtime": "^7.12.5" }, "peerDependencies": { "@testing-library/dom": "^10.0.0", "@types/react": "^18.0.0 || ^19.0.0", "@types/react-dom": "^18.0.0 || ^19.0.0", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-Uo193NgQbPMz6lrrhtRQQFcMC6Re/ELLFbbuVL30WDlZxlpZf9/lMHTAVxPRLw1q1iu9OJmR1c2BLiENRstdBg=="], + + "@testing-library/user-event": ["@testing-library/user-event@14.6.8", "", { "peerDependencies": { "@testing-library/dom": ">=7.21.4" } }, "sha512-vgSSqnANMnkcYR/vUNDbwS7aM3OErRLNUG8vCVVlj4oc6cKffUrccX7UAS5AmJQQNZTSibi9z5GvvRZ0aYgUCQ=="], + "@tybys/wasm-util": ["@tybys/wasm-util@0.10.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg=="], + "@types/aria-query": ["@types/aria-query@5.0.4", "", {}, "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw=="], + + "@types/chai": ["@types/chai@5.2.3", "", { "dependencies": { "@types/deep-eql": "*", "assertion-error": "^2.0.1" } }, "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA=="], + + "@types/deep-eql": ["@types/deep-eql@4.0.2", "", {}, "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw=="], + "@types/esrecurse": ["@types/esrecurse@4.3.1", "", {}, "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw=="], "@types/estree": ["@types/estree@1.0.8", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="], @@ -145,10 +342,14 @@ "@types/node": ["@types/node@24.12.2", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-A1sre26ke7HDIuY/M23nd9gfB+nrmhtYyMINbjI1zHJxYteKR6qSMX56FsmjMcDb3SMcjJg5BiRRgOCC/yBD0g=="], + "@types/parse-json": ["@types/parse-json@4.0.2", "", {}, "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw=="], + "@types/react": ["@types/react@19.2.14", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w=="], "@types/react-dom": ["@types/react-dom@19.2.3", "", { "peerDependencies": { "@types/react": "^19.2.0" } }, "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ=="], + "@types/react-transition-group": ["@types/react-transition-group@4.4.12", "", { "peerDependencies": { "@types/react": "*" } }, "sha512-8TV6R3h2j7a91c+1DXdJi3Syo69zzIZbz7Lg5tORM5LEJG7X/E6a1V3drRyBRZq7/utz7A+c4OgYLiLcYGHG6w=="], + "@typescript-eslint/eslint-plugin": ["@typescript-eslint/eslint-plugin@8.59.1", "", { "dependencies": { "@eslint-community/regexpp": "^4.12.2", "@typescript-eslint/scope-manager": "8.59.1", "@typescript-eslint/type-utils": "8.59.1", "@typescript-eslint/utils": "8.59.1", "@typescript-eslint/visitor-keys": "8.59.1", "ignore": "^7.0.5", "natural-compare": "^1.4.0", "ts-api-utils": "^2.5.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.59.1", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "sha512-BOziFIfE+6osHO9FoJG4zjoHUcvI7fTNBSpdAwrNH0/TLvzjsk2oo8XSSOT2HhqUyhZPfHv4UOffoJ9oEEQ7Ag=="], "@typescript-eslint/parser": ["@typescript-eslint/parser@8.59.1", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.59.1", "@typescript-eslint/types": "8.59.1", "@typescript-eslint/typescript-estree": "8.59.1", "@typescript-eslint/visitor-keys": "8.59.1", "debug": "^4.4.3" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "sha512-HDQH9O/47Dxi1ceDhBXdaldtf/WV9yRYMjbjCuNk3qnaTD564qwv61Y7+gTxwxRKzSrgO5uhtw584igXVuuZkA=="], @@ -171,36 +372,90 @@ "@vitejs/plugin-react": ["@vitejs/plugin-react@6.0.1", "", { "dependencies": { "@rolldown/pluginutils": "1.0.0-rc.7" }, "peerDependencies": { "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0", "babel-plugin-react-compiler": "^1.0.0", "vite": "^8.0.0" }, "optionalPeers": ["@rolldown/plugin-babel", "babel-plugin-react-compiler"] }, "sha512-l9X/E3cDb+xY3SWzlG1MOGt2usfEHGMNIaegaUGFsLkb3RCn/k8/TOXBcab+OndDI4TBtktT8/9BwwW8Vi9KUQ=="], + "@vitest/mocker": ["@vitest/mocker@5.0.5", "", { "dependencies": { "@jridgewell/trace-mapping": "0.3.31", "@vitest/spy": "5.0.5", "estree-walker": "^3.0.3", "magic-string": "^1.4.3" }, "peerDependencies": { "msw": "^2.4.9 || ^3.0.0", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["msw", "vite"] }, "sha512-xLL3lkDegJZw+MGoGaCCsFayDZthGgpAtr3Vziyfc4p7xH89K7KRPcRBBh/kEYm0Aqkt5DtTmkYpBtRV/FrHZg=="], + + "@vitest/spy": ["@vitest/spy@5.0.5", "", {}, "sha512-lwJRExuH417257Q5wv9QYugN9IMJkoxcrKrYxGPQkBzl7wlNpTUxD/5yNX4ESKVUIShKPgkGchYPFMWOOk0wzw=="], + "acorn": ["acorn@8.16.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw=="], "acorn-jsx": ["acorn-jsx@5.3.2", "", { "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ=="], + "agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="], + "ajv": ["ajv@6.15.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="], + "ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], + + "ansi-styles": ["ansi-styles@5.2.0", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="], + + "aria-query": ["aria-query@5.3.2", "", {}, "sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw=="], + + "assertion-error": ["assertion-error@2.0.1", "", {}, "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA=="], + + "babel-plugin-macros": ["babel-plugin-macros@3.1.0", "", { "dependencies": { "@babel/runtime": "^7.12.5", "cosmiconfig": "^7.0.0", "resolve": "^1.19.0" } }, "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg=="], + "balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="], "baseline-browser-mapping": ["baseline-browser-mapping@2.10.25", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-QO/VHsXCQdnzADMfmkeOPvHdIAkoB7i0/rGjINPJEetLx75hNttVWGQ/jycHUDP9zZ9rupbm60WRxcwViB0MiA=="], + "bidi-js": ["bidi-js@1.1.0", "", { "dependencies": { "require-from-string": "^2.0.2" } }, "sha512-fX1Onk0tdVPC7obPWB5EbJ1z7NVhLq4m2xZLq2YXBkxzMXIGRpNMU88n0EPgWseKl12J7zXs7qrDxPK4sRs2fg=="], + "brace-expansion": ["brace-expansion@5.0.5", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ=="], "browserslist": ["browserslist@4.28.2", "", { "dependencies": { "baseline-browser-mapping": "^2.10.12", "caniuse-lite": "^1.0.30001782", "electron-to-chromium": "^1.5.328", "node-releases": "^2.0.36", "update-browserslist-db": "^1.2.3" }, "bin": { "browserslist": "cli.js" } }, "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg=="], + "bun": ["bun@1.4.4", "", { "optionalDependencies": { "@oven/bun-darwin-aarch64": "1.4.4", "@oven/bun-darwin-x64": "1.4.4", "@oven/bun-freebsd-aarch64": "1.4.4", "@oven/bun-freebsd-x64": "1.4.4", "@oven/bun-linux-aarch64": "1.4.4", "@oven/bun-linux-aarch64-android": "1.4.4", "@oven/bun-linux-aarch64-musl": "1.4.4", "@oven/bun-linux-x64": "1.4.4", "@oven/bun-linux-x64-android": "1.4.4", "@oven/bun-linux-x64-musl": "1.4.4", "@oven/bun-windows-aarch64": "1.4.4", "@oven/bun-windows-x64": "1.4.4" }, "os": [ "!aix", "!sunos", "!openbsd", ], "cpu": [ "x64", "arm64", ], "bin": { "bun": "bin/bun.exe", "bunx": "bin/bunx.exe" } }, "sha512-hj0ASdG6PNjLZGFAXktWb3Uaj/dcv/1wCsIttoEXADNIQBsGjTr+5uLKYbrDkuc7NT0Tkj4yPIqJI2jDxXdvVg=="], + + "callsites": ["callsites@3.1.0", "", {}, "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="], + "caniuse-lite": ["caniuse-lite@1.0.30001791", "", {}, "sha512-yk0l/YSrOnFZk3UROpDLQD9+kC1l4meK/wed583AXrzoarMGJcbRi2Q4RaUYbKxYAsZ8sWmaSa/DsLmdBeI1vQ=="], + "chai": ["chai@6.3.0", "", {}, "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg=="], + + "clsx": ["clsx@2.1.1", "", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="], + "convert-source-map": ["convert-source-map@2.0.0", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="], + "cosmiconfig": ["cosmiconfig@7.1.0", "", { "dependencies": { "@types/parse-json": "^4.0.0", "import-fresh": "^3.2.1", "parse-json": "^5.0.0", "path-type": "^4.0.0", "yaml": "^1.10.0" } }, "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA=="], + "cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="], + "css-tree": ["css-tree@3.2.1", "", { "dependencies": { "mdn-data": "2.27.1", "source-map-js": "^1.2.1" } }, "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA=="], + + "css.escape": ["css.escape@1.5.1", "", {}, "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg=="], + + "cssstyle": ["cssstyle@6.2.0", "", { "dependencies": { "@asamuzakjp/css-color": "^5.0.1", "@csstools/css-syntax-patches-for-csstree": "^1.0.28", "css-tree": "^3.1.0", "lru-cache": "^11.2.6" } }, "sha512-Fm5NvhYathRnXNVndkUsCCuR63DCLVVwGOOwQw782coXFi5HhkXdu289l59HlXZBawsyNccXfWRYvLzcDCdDig=="], + "csstype": ["csstype@3.2.3", "", {}, "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ=="], + "data-urls": ["data-urls@7.0.0", "", { "dependencies": { "whatwg-mimetype": "^5.0.0", "whatwg-url": "^16.0.0" } }, "sha512-23XHcCF+coGYevirZceTVD7NdJOqVn+49IHyxgszm+JIiHLoB2TkmPtsYkNWT1pvRSGkc35L6NHs0yHkN2SumA=="], + "debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], + "decimal.js": ["decimal.js@10.6.0", "", {}, "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg=="], + "deep-is": ["deep-is@0.1.4", "", {}, "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ=="], + "dequal": ["dequal@2.0.3", "", {}, "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA=="], + "detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="], + "dom-accessibility-api": ["dom-accessibility-api@0.6.3", "", {}, "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w=="], + + "dom-helpers": ["dom-helpers@5.2.1", "", { "dependencies": { "@babel/runtime": "^7.8.7", "csstype": "^3.0.2" } }, "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA=="], + "electron-to-chromium": ["electron-to-chromium@1.5.349", "", {}, "sha512-QsWVGyRuY07Aqb234QytTfwd5d9AJlfNIQ5wIOl1L+PZDzI9d9+Fn0FRale/QYlFxt/bUnB0/nLd1jFPGxGK1A=="], + "entities": ["entities@8.1.0", "", {}, "sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA=="], + + "error-ex": ["error-ex@1.3.4", "", { "dependencies": { "is-arrayish": "^0.2.1" } }, "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ=="], + + "es-errors": ["es-errors@1.3.0", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="], + + "es-module-lexer": ["es-module-lexer@2.3.2", "", {}, "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw=="], + + "esbuild": ["esbuild@0.28.2", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.28.2", "@esbuild/android-arm": "0.28.2", "@esbuild/android-arm64": "0.28.2", "@esbuild/android-x64": "0.28.2", "@esbuild/darwin-arm64": "0.28.2", "@esbuild/darwin-x64": "0.28.2", "@esbuild/freebsd-arm64": "0.28.2", "@esbuild/freebsd-x64": "0.28.2", "@esbuild/linux-arm": "0.28.2", "@esbuild/linux-arm64": "0.28.2", "@esbuild/linux-ia32": "0.28.2", "@esbuild/linux-loong64": "0.28.2", "@esbuild/linux-mips64el": "0.28.2", "@esbuild/linux-ppc64": "0.28.2", "@esbuild/linux-riscv64": "0.28.2", "@esbuild/linux-s390x": "0.28.2", "@esbuild/linux-x64": "0.28.2", "@esbuild/netbsd-arm64": "0.28.2", "@esbuild/netbsd-x64": "0.28.2", "@esbuild/openbsd-arm64": "0.28.2", "@esbuild/openbsd-x64": "0.28.2", "@esbuild/openharmony-arm64": "0.28.2", "@esbuild/sunos-x64": "0.28.2", "@esbuild/win32-arm64": "0.28.2", "@esbuild/win32-ia32": "0.28.2", "@esbuild/win32-x64": "0.28.2" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA=="], + "escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="], "escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="], @@ -223,8 +478,12 @@ "estraverse": ["estraverse@5.3.0", "", {}, "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA=="], + "estree-walker": ["estree-walker@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g=="], + "esutils": ["esutils@2.0.3", "", {}, "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="], + "expect-type": ["expect-type@1.4.0", "", {}, "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA=="], + "fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="], "fast-json-stable-stringify": ["fast-json-stable-stringify@2.1.0", "", {}, "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="], @@ -235,40 +494,70 @@ "file-entry-cache": ["file-entry-cache@8.0.0", "", { "dependencies": { "flat-cache": "^4.0.0" } }, "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ=="], + "find-root": ["find-root@1.1.0", "", {}, "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng=="], + "find-up": ["find-up@5.0.0", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng=="], "flat-cache": ["flat-cache@4.0.1", "", { "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.4" } }, "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw=="], "flatted": ["flatted@3.4.2", "", {}, "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA=="], + "framer-motion": ["framer-motion@12.43.0", "", { "dependencies": { "motion-dom": "^12.43.0", "motion-utils": "^12.39.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-1eaL3RvR/kAlbG7UYcpMptEyzPoENO0c6w7ZnB3/hh2vSAz/6uGAFn6fdoqTBguNstf3MsFhJHsD/0DHiclG+g=="], + "fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="], + "function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="], + "gensync": ["gensync@1.0.0-beta.2", "", {}, "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg=="], "glob-parent": ["glob-parent@6.0.2", "", { "dependencies": { "is-glob": "^4.0.3" } }, "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A=="], "globals": ["globals@17.6.0", "", {}, "sha512-sepffkT8stwnIYbsMBpoCHJuJM5l98FUF2AnE07hfvE0m/qp3R586hw4jF4uadbhvg1ooIdzuu7CsfD2jzCaNA=="], + "hasown": ["hasown@2.0.4", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A=="], + "hermes-estree": ["hermes-estree@0.25.1", "", {}, "sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw=="], "hermes-parser": ["hermes-parser@0.25.1", "", { "dependencies": { "hermes-estree": "0.25.1" } }, "sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA=="], + "hoist-non-react-statics": ["hoist-non-react-statics@3.3.2", "", { "dependencies": { "react-is": "^16.7.0" } }, "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw=="], + + "html-encoding-sniffer": ["html-encoding-sniffer@6.0.0", "", { "dependencies": { "@exodus/bytes": "^1.6.0" } }, "sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg=="], + + "http-proxy-agent": ["http-proxy-agent@7.0.2", "", { "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" } }, "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig=="], + + "https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], + "ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="], + "import-fresh": ["import-fresh@3.3.1", "", { "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" } }, "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ=="], + "imurmurhash": ["imurmurhash@0.1.4", "", {}, "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="], + "indent-string": ["indent-string@4.0.0", "", {}, "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg=="], + + "is-arrayish": ["is-arrayish@0.2.1", "", {}, "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg=="], + + "is-core-module": ["is-core-module@2.17.0", "", { "dependencies": { "hasown": "^2.0.4" } }, "sha512-J/vG0zBCbIKOQFfufSwyXdMrsohyJIUNkrnmo6WZGzoM7tr/lsbfW5b2BvisL6zsyMzK9UxV9L6c7AoFbyXHOA=="], + "is-extglob": ["is-extglob@2.1.1", "", {}, "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ=="], "is-glob": ["is-glob@4.0.3", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="], + "is-potential-custom-element-name": ["is-potential-custom-element-name@1.0.1", "", {}, "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ=="], + "isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="], "js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="], + "jsdom": ["jsdom@28.1.0", "", { "dependencies": { "@acemir/cssom": "^0.9.31", "@asamuzakjp/dom-selector": "^6.8.1", "@bramus/specificity": "^2.4.2", "@exodus/bytes": "^1.11.0", "cssstyle": "^6.0.1", "data-urls": "^7.0.0", "decimal.js": "^10.6.0", "html-encoding-sniffer": "^6.0.0", "http-proxy-agent": "^7.0.2", "https-proxy-agent": "^7.0.6", "is-potential-custom-element-name": "^1.0.1", "parse5": "^8.0.0", "saxes": "^6.0.0", "symbol-tree": "^3.2.4", "tough-cookie": "^6.0.0", "undici": "^7.21.0", "w3c-xmlserializer": "^5.0.0", "webidl-conversions": "^8.0.1", "whatwg-mimetype": "^5.0.0", "whatwg-url": "^16.0.0", "xml-name-validator": "^5.0.0" }, "peerDependencies": { "canvas": "^3.0.0" }, "optionalPeers": ["canvas"] }, "sha512-0+MoQNYyr2rBHqO1xilltfDjV9G7ymYGlAUazgcDLQaUf8JDHbuGwsxN6U9qWaElZ4w1B2r7yEGIL3GdeW3Rug=="], + "jsesc": ["jsesc@3.1.0", "", { "bin": { "jsesc": "bin/jsesc" } }, "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA=="], "json-buffer": ["json-buffer@3.0.1", "", {}, "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ=="], + "json-parse-even-better-errors": ["json-parse-even-better-errors@2.3.1", "", {}, "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w=="], + "json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="], "json-stable-stringify-without-jsonify": ["json-stable-stringify-without-jsonify@1.0.1", "", {}, "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw=="], @@ -303,12 +592,32 @@ "lightningcss-win32-x64-msvc": ["lightningcss-win32-x64-msvc@1.32.0", "", { "os": "win32", "cpu": "x64" }, "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q=="], + "lines-and-columns": ["lines-and-columns@1.2.4", "", {}, "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="], + "locate-path": ["locate-path@6.0.0", "", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="], - "lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="], + "loose-envify": ["loose-envify@1.4.0", "", { "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, "bin": { "loose-envify": "cli.js" } }, "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q=="], + + "lru-cache": ["lru-cache@11.5.3", "", {}, "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg=="], + + "lz-string": ["lz-string@1.5.0", "", { "bin": { "lz-string": "bin/bin.js" } }, "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ=="], + + "magic-string": ["magic-string@1.4.3", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.6.0" } }, "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ=="], + + "mdn-data": ["mdn-data@2.27.1", "", {}, "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ=="], + + "memoize-one": ["memoize-one@6.0.0", "", {}, "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw=="], + + "min-indent": ["min-indent@1.0.1", "", {}, "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg=="], "minimatch": ["minimatch@10.2.5", "", { "dependencies": { "brace-expansion": "^5.0.5" } }, "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg=="], + "motion": ["motion@12.43.0", "", { "dependencies": { "framer-motion": "^12.43.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-BQgQbSa9Hn3/mtbib0MK53y6JSANa+YKUKlaYnWzAVDH424RYQ5LVpV3pNiWH00BA2z4ojsSdMzqT7g2FQwjuQ=="], + + "motion-dom": ["motion-dom@12.43.0", "", { "dependencies": { "motion-utils": "^12.39.0" } }, "sha512-azKON4d9S65PEoFUiQTMTgPheEmzf2QngdRc50AKfJp9Q9mmcBVw22c8eMq9k8kxOFHdL7+WZY7N/5F/lwiDag=="], + + "motion-utils": ["motion-utils@12.39.0", "", {}, "sha512-8nadJAJjTtqRkmRF36FoJTrywK9nnFmnPwnSMyxaOCU7GDjN9RTMJIxx9De8ErM+vpPhMccr/6fo5WciyQLnMQ=="], + "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], "nanoid": ["nanoid@3.3.12", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ=="], @@ -317,16 +626,34 @@ "node-releases": ["node-releases@2.0.38", "", {}, "sha512-3qT/88Y3FbH/Kx4szpQQ4HzUbVrHPKTLVpVocKiLfoYvw9XSGOX2FmD2d6DrXbVYyAQTF2HeF6My8jmzx7/CRw=="], + "object-assign": ["object-assign@4.1.1", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="], + + "obug": ["obug@3.0.0", "", {}, "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw=="], + + "openapi-fetch": ["openapi-fetch@0.17.0", "", { "dependencies": { "openapi-typescript-helpers": "^0.1.0" } }, "sha512-PsbZR1wAPcG91eEthKhN+Zn92FMHxv+/faECIwjXdxfTODGSGegYv0sc1Olz+HYPvKOuoXfp+0pA2XVt2cI0Ig=="], + + "openapi-typescript-helpers": ["openapi-typescript-helpers@0.1.0", "", {}, "sha512-OKTGPthhivLw/fHz6c3OPtg72vi86qaMlqbJuVJ23qOvQ+53uw1n7HdmkJFibloF7QEjDrDkzJiOJuockM/ljw=="], + "optionator": ["optionator@0.9.4", "", { "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", "word-wrap": "^1.2.5" } }, "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g=="], "p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="], "p-locate": ["p-locate@5.0.0", "", { "dependencies": { "p-limit": "^3.0.2" } }, "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw=="], + "parent-module": ["parent-module@1.0.1", "", { "dependencies": { "callsites": "^3.0.0" } }, "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g=="], + + "parse-json": ["parse-json@5.2.0", "", { "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" } }, "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg=="], + + "parse5": ["parse5@8.0.1", "", { "dependencies": { "entities": "^8.0.0" } }, "sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw=="], + "path-exists": ["path-exists@4.0.0", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="], "path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="], + "path-parse": ["path-parse@1.0.7", "", {}, "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="], + + "path-type": ["path-type@4.0.0", "", {}, "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw=="], + "picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="], "picomatch": ["picomatch@4.0.4", "", {}, "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A=="], @@ -335,14 +662,40 @@ "prelude-ls": ["prelude-ls@1.2.1", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="], + "pretty-format": ["pretty-format@27.5.1", "", { "dependencies": { "ansi-regex": "^5.0.1", "ansi-styles": "^5.0.0", "react-is": "^17.0.1" } }, "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ=="], + + "prop-types": ["prop-types@15.8.1", "", { "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", "react-is": "^16.13.1" } }, "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg=="], + "punycode": ["punycode@2.3.1", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="], "react": ["react@19.2.5", "", {}, "sha512-llUJLzz1zTUBrskt2pwZgLq59AemifIftw4aB7JxOqf1HY2FDaGDxgwpAPVzHU1kdWabH7FauP4i1oEeer2WCA=="], "react-dom": ["react-dom@19.2.5", "", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.5" } }, "sha512-J5bAZz+DXMMwW/wV3xzKke59Af6CHY7G4uYLN1OvBcKEsWOs4pQExj86BBKamxl/Ik5bx9whOrvBlSDfWzgSag=="], + "react-hook-form": ["react-hook-form@7.90.0", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17 || ^18 || ^19" }, "optionalPeers": ["@types/react"] }, "sha512-+NdG0FLzCPhFOp2NNxaUYLF9fyZhNjx9FTBBSYWF71/l6BBlmIc/j6xlp3DbaHWLJbIG7Zd8oznA19xJClU97w=="], + + "react-is": ["react-is@16.13.1", "", {}, "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="], + + "react-select": ["react-select@5.10.2", "", { "dependencies": { "@babel/runtime": "^7.12.0", "@emotion/cache": "^11.4.0", "@emotion/react": "^11.8.1", "@floating-ui/dom": "^1.0.1", "@types/react-transition-group": "^4.4.0", "memoize-one": "^6.0.0", "prop-types": "^15.6.0", "react-transition-group": "^4.3.0", "use-isomorphic-layout-effect": "^1.2.0" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-Z33nHdEFWq9tfnfVXaiM12rbJmk+QjFEztWLtmXqQhz6Al4UZZ9xc0wiatmGtUOCCnHN0WizL3tCMYRENX4rVQ=="], + + "react-toastify": ["react-toastify@11.1.0", "", { "dependencies": { "clsx": "^2.1.1" }, "peerDependencies": { "react": "^18 || ^19", "react-dom": "^18 || ^19" } }, "sha512-e9h23x3phN0wbFeB6yovmWp7lobzV4CaCH0LO8nVP6H7Y+3GbcLpIzMm9dJhcp1RXbpyfvjgpfXqO80QAmn7sg=="], + + "react-transition-group": ["react-transition-group@4.4.5", "", { "dependencies": { "@babel/runtime": "^7.5.5", "dom-helpers": "^5.0.1", "loose-envify": "^1.4.0", "prop-types": "^15.6.2" }, "peerDependencies": { "react": ">=16.6.0", "react-dom": ">=16.6.0" } }, "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g=="], + + "redent": ["redent@3.0.0", "", { "dependencies": { "indent-string": "^4.0.0", "strip-indent": "^3.0.0" } }, "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg=="], + + "require-from-string": ["require-from-string@2.0.2", "", {}, "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="], + + "resolve": ["resolve@1.22.13", "", { "dependencies": { "es-errors": "^1.3.0", "is-core-module": "^2.17.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-Dj/cW9zBV2aRj6XzCxuGIs3ESZKv02jixne3q6jFZYZ3/Tg09gHHviSMDL4kObh9pqSahdRHEnDoaP2gn8YLhA=="], + + "resolve-from": ["resolve-from@4.0.0", "", {}, "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="], + "rolldown": ["rolldown@1.0.0-rc.17", "", { "dependencies": { "@oxc-project/types": "=0.127.0", "@rolldown/pluginutils": "1.0.0-rc.17" }, "optionalDependencies": { "@rolldown/binding-android-arm64": "1.0.0-rc.17", "@rolldown/binding-darwin-arm64": "1.0.0-rc.17", "@rolldown/binding-darwin-x64": "1.0.0-rc.17", "@rolldown/binding-freebsd-x64": "1.0.0-rc.17", "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-rc.17", "@rolldown/binding-linux-arm64-gnu": "1.0.0-rc.17", "@rolldown/binding-linux-arm64-musl": "1.0.0-rc.17", "@rolldown/binding-linux-ppc64-gnu": "1.0.0-rc.17", "@rolldown/binding-linux-s390x-gnu": "1.0.0-rc.17", "@rolldown/binding-linux-x64-gnu": "1.0.0-rc.17", "@rolldown/binding-linux-x64-musl": "1.0.0-rc.17", "@rolldown/binding-openharmony-arm64": "1.0.0-rc.17", "@rolldown/binding-wasm32-wasi": "1.0.0-rc.17", "@rolldown/binding-win32-arm64-msvc": "1.0.0-rc.17", "@rolldown/binding-win32-x64-msvc": "1.0.0-rc.17" }, "bin": { "rolldown": "bin/cli.mjs" } }, "sha512-ZrT53oAKrtA4+YtBWPQbtPOxIbVDbxT0orcYERKd63VJTF13zPcgXTvD4843L8pcsI7M6MErt8QtON6lrB9tyA=="], + "rxjs": ["rxjs@7.8.2", "", { "dependencies": { "tslib": "^2.1.0" } }, "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA=="], + + "saxes": ["saxes@6.0.0", "", { "dependencies": { "xmlchars": "^2.2.0" } }, "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA=="], + "scheduler": ["scheduler@0.27.0", "", {}, "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q=="], "semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], @@ -351,10 +704,34 @@ "shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="], + "source-map": ["source-map@0.5.7", "", {}, "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ=="], + "source-map-js": ["source-map-js@1.2.1", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="], + "std-env": ["std-env@4.3.0", "", {}, "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag=="], + + "strip-indent": ["strip-indent@3.0.0", "", { "dependencies": { "min-indent": "^1.0.0" } }, "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ=="], + + "stylis": ["stylis@4.2.0", "", {}, "sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw=="], + + "supports-preserve-symlinks-flag": ["supports-preserve-symlinks-flag@1.0.0", "", {}, "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="], + + "symbol-tree": ["symbol-tree@3.2.4", "", {}, "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="], + + "tinybench": ["tinybench@6.2.2", "", {}, "sha512-nIZ2N2dFpjBsg2hgitKu7mA+FvsIJuGJOwysRngmVRRmWgR/UyPjwJj8c/fT/dhm8EkHnF5EOogRf+0Z2qrimA=="], + + "tinyexec": ["tinyexec@1.3.1", "", {}, "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA=="], + "tinyglobby": ["tinyglobby@0.2.16", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-pn99VhoACYR8nFHhxqix+uvsbXineAasWm5ojXoN8xEwK5Kd3/TrhNn1wByuD52UxWRLy8pu+kRMniEi6Eq9Zg=="], + "tldts": ["tldts@7.4.19", "", { "dependencies": { "tldts-core": "^7.4.19" }, "bin": { "tldts": "bin/cli.js" } }, "sha512-48dH6aSpQnpbzDUc4vIQZ1VjB8tkK+e8c1yx05/SZK+rkssgjEOlxDd/yU8/a4vGYQ9vRgJr9dwMq9TJ0b3X2Q=="], + + "tldts-core": ["tldts-core@7.4.19", "", {}, "sha512-goNXV6Ho9TIOfpJZanTd6CKG5DyYgYAL+k+22T0SLh8l6+KHIfBUPFuePuSZv05UttIaaLmI9tb7TmGIdK5AkQ=="], + + "tough-cookie": ["tough-cookie@6.0.2", "", { "dependencies": { "tldts": "^7.0.5" } }, "sha512-exgYmnmL/sJpR3upZfXG5PoatXQii55xAiXGXzY+sROLZ/Y+SLcp9PgJNI9Vz37HpQ74WvDcLT8eqm+kV3FzrA=="], + + "tr46": ["tr46@6.0.0", "", { "dependencies": { "punycode": "^2.3.1" } }, "sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw=="], + "ts-api-utils": ["ts-api-utils@2.5.0", "", { "peerDependencies": { "typescript": ">=4.8.4" } }, "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA=="], "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], @@ -365,32 +742,78 @@ "typescript-eslint": ["typescript-eslint@8.59.1", "", { "dependencies": { "@typescript-eslint/eslint-plugin": "8.59.1", "@typescript-eslint/parser": "8.59.1", "@typescript-eslint/typescript-estree": "8.59.1", "@typescript-eslint/utils": "8.59.1" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "sha512-xqDcFVBmlrltH64lklOVp1wYxgJr6LVdg3NamBgH2OOQDLFdTKfIZXF5PfghrnXQKXZGTQs8tr1vL7fJvq8CTQ=="], + "undici": ["undici@7.30.1", "", {}, "sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg=="], + "undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="], "update-browserslist-db": ["update-browserslist-db@1.2.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w=="], "uri-js": ["uri-js@4.4.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="], + "use-isomorphic-layout-effect": ["use-isomorphic-layout-effect@1.2.1", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-tpZZ+EX0gaghDAiFR37hj5MgY6ZN55kLiPkJsKxBMZ6GZdOSPJXiOzPM984oPYZ5AnehYx5WQp1+ME8I/P/pRA=="], + + "uuid": ["uuid@14.0.3", "", { "bin": { "uuid": "dist-node/bin/uuid" } }, "sha512-Sc5u1VVln93y1Xnz4R+CunOZc7R9LUcTmhj7Rc7Eg3HVcf7rVn2FOoa812fe0W8p3jD7xeoGSYbfqCGGH2B6xw=="], + "vite": ["vite@8.0.10", "", { "dependencies": { "lightningcss": "^1.32.0", "picomatch": "^4.0.4", "postcss": "^8.5.10", "rolldown": "1.0.0-rc.17", "tinyglobby": "^0.2.16" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.1.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-rZuUu9j6J5uotLDs+cAA4O5H4K1SfPliUlQwqa6YEwSrWDZzP4rhm00oJR5snMewjxF5V/K3D4kctsUTsIU9Mw=="], + "vitest": ["vitest@5.0.5", "", { "dependencies": { "@types/chai": "^5.2.2", "@vitest/mocker": "5.0.5", "chai": "^6.3.0", "es-module-lexer": "^2.3.2", "expect-type": "^1.4.0", "magic-string": "^1.4.3", "obug": "^3.0.0", "picomatch": "^4.0.7", "std-env": "^4.3.0", "tinybench": "^6.2.2", "tinyexec": "^1.3.1", "tinyglobby": "^0.2.17", "why-is-node-running": "3.2.1" }, "peerDependencies": { "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^22.0.0 || >=24.0.0", "@vitest/browser-playwright": "5.0.5", "@vitest/browser-preview": "5.0.5", "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", "@vitest/coverage-istanbul": "5.0.5", "@vitest/coverage-v8": "5.0.5", "@vitest/ui": "5.0.5", "happy-dom": "*", "jsdom": "*", "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["@edge-runtime/vm", "@opentelemetry/api", "@types/node", "@vitest/browser-playwright", "@vitest/browser-preview", "@vitest/browser-webdriverio", "@vitest/coverage-istanbul", "@vitest/coverage-v8", "@vitest/ui", "happy-dom", "jsdom"], "bin": { "vitest": "./vitest.mjs" } }, "sha512-cPODOMF8YnkiiYtDdHo6n4wWmBrOBBbOIYH2d33M4l3CdNn72h+qMmO6uXffUN6A5AZFXNND/d+krS9mgkXRfg=="], + + "w3c-xmlserializer": ["w3c-xmlserializer@5.0.0", "", { "dependencies": { "xml-name-validator": "^5.0.0" } }, "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA=="], + + "webidl-conversions": ["webidl-conversions@8.0.1", "", {}, "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ=="], + + "whatwg-mimetype": ["whatwg-mimetype@5.0.0", "", {}, "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw=="], + + "whatwg-url": ["whatwg-url@16.0.1", "", { "dependencies": { "@exodus/bytes": "^1.11.0", "tr46": "^6.0.0", "webidl-conversions": "^8.0.1" } }, "sha512-1to4zXBxmXHV3IiSSEInrreIlu02vUOvrhxJJH5vcxYTBDAx51cqZiKdyTxlecdKNSjj8EcxGBxNf6Vg+945gw=="], + "which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], + "why-is-node-running": ["why-is-node-running@3.2.1", "", { "bin": { "why-is-node-running": "cli.js" } }, "sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ=="], + "word-wrap": ["word-wrap@1.2.5", "", {}, "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA=="], + "xml-name-validator": ["xml-name-validator@5.0.0", "", {}, "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg=="], + + "xmlchars": ["xmlchars@2.2.0", "", {}, "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw=="], + "yallist": ["yallist@3.1.1", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="], + "yaml": ["yaml@1.10.3", "", {}, "sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA=="], + "yocto-queue": ["yocto-queue@0.1.0", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="], - "zod": ["zod@4.4.2", "", {}, "sha512-IynmDyxsEsb9RKzO3J9+4SxXnl2FTFSzNBaKKaMV6tsSk0rw9gYw9gs+JFCq/qk2LCZ78KDwyj+Z289TijSkUw=="], + "zod": ["zod@4.6.7", "", {}, "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg=="], "zod-validation-error": ["zod-validation-error@4.0.2", "", { "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" } }, "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ=="], + "zustand": ["zustand@5.0.16", "", { "peerDependencies": { "@types/react": ">=18.0.0", "immer": ">=9.0.6", "react": ">=18.0.0", "use-sync-external-store": ">=1.2.0" }, "optionalPeers": ["@types/react", "immer", "react", "use-sync-external-store"] }, "sha512-Uv7e327ihlCfayfja3hDc0M64Upev1LWBKpRobdK4NyovDDPeeX4imWXc/wzC1yc6fkYPoAY/ncKVPAs2jrtQw=="], + + "@babel/helper-compilation-targets/lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="], + + "@emotion/babel-plugin/convert-source-map": ["convert-source-map@1.9.0", "", {}, "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A=="], + "@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="], + "@jridgewell/gen-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="], + + "@jridgewell/trace-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="], + + "@testing-library/dom/aria-query": ["aria-query@5.3.0", "", { "dependencies": { "dequal": "^2.0.3" } }, "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A=="], + + "@testing-library/dom/dom-accessibility-api": ["dom-accessibility-api@0.5.16", "", {}, "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg=="], + "@typescript-eslint/eslint-plugin/ignore": ["ignore@7.0.5", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="], "@typescript-eslint/typescript-estree/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "eslint-plugin-react-hooks/zod": ["zod@4.4.2", "", {}, "sha512-IynmDyxsEsb9RKzO3J9+4SxXnl2FTFSzNBaKKaMV6tsSk0rw9gYw9gs+JFCq/qk2LCZ78KDwyj+Z289TijSkUw=="], + + "pretty-format/react-is": ["react-is@17.0.2", "", {}, "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="], + "rolldown/@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.0-rc.17", "", {}, "sha512-n8iosDOt6Ig1UhJ2AYqoIhHWh/isz0xpicHTzpKBeotdVsTEcxsSA/i3EVM7gQAj0rU27OLAxCjzlj15IWY7bg=="], + + "vitest/picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], + + "vitest/tinyglobby": ["tinyglobby@0.2.17", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="], } } diff --git a/docker/web/nspanelmanager/web/react-components/dist/.vite/manifest.json b/docker/web/nspanelmanager/web/react-components/dist/.vite/manifest.json old mode 100644 new mode 100755 index e8b3e71ed..474423a59 --- a/docker/web/nspanelmanager/web/react-components/dist/.vite/manifest.json +++ b/docker/web/nspanelmanager/web/react-components/dist/.vite/manifest.json @@ -1,32 +1,269 @@ { - "_MultiStep_AddEditEntity-BVXN3SAx.js": { - "file": "MultiStep_AddEditEntity-BVXN3SAx.js", + "_AnimatePresence-CpnHckGS.js": { + "file": "AnimatePresence-CpnHckGS.js", + "name": "AnimatePresence", + "imports": [ + "src/main.tsx", + "_proxy-BQYsYRjY.js" + ] + }, + "_EntityStore-CHE3-bsC.js": { + "file": "EntityStore-CHE3-bsC.js", + "name": "EntityStore", + "imports": [ + "_react-Cm4z11-B.js", + "_NSPanelToastContainer-D677tDZJ.js", + "_StompStore-Bh-Guhla.js" + ] + }, + "_MultiStep_AddEditEntity-xcopfTe5.js": { + "file": "MultiStep_AddEditEntity-xcopfTe5.js", "name": "MultiStep_AddEditEntity", + "imports": [ + "src/main.tsx", + "_react-Cm4z11-B.js", + "_SettingsStore-msVzBcHM.js", + "_react-select.esm-CbdimKhg.js", + "_index.esm-CnTf2rLv.js", + "_NSPanelToastContainer-D677tDZJ.js", + "_proxy-BQYsYRjY.js", + "_AnimatePresence-CpnHckGS.js" + ] + }, + "_NSPanelToastContainer-D677tDZJ.js": { + "file": "NSPanelToastContainer-D677tDZJ.js", + "name": "NSPanelToastContainer", + "imports": [ + "src/main.tsx" + ] + }, + "_SettingsStore-msVzBcHM.js": { + "file": "SettingsStore-msVzBcHM.js", + "name": "SettingsStore", + "imports": [ + "_react-Cm4z11-B.js" + ] + }, + "_StompStore-Bh-Guhla.js": { + "file": "StompStore-Bh-Guhla.js", + "name": "StompStore", + "imports": [ + "src/main.tsx", + "_react-Cm4z11-B.js", + "_NSPanelToastContainer-D677tDZJ.js" + ] + }, + "_fields-Dr1KI0Cj.js": { + "file": "fields-Dr1KI0Cj.js", + "name": "fields", + "imports": [ + "src/main.tsx", + "_index.esm-CnTf2rLv.js" + ] + }, + "_index.esm-CnTf2rLv.js": { + "file": "index.esm-CnTf2rLv.js", + "name": "index.esm", + "imports": [ + "src/main.tsx" + ] + }, + "_layout-HS0oHCMJ.js": { + "file": "layout-HS0oHCMJ.js", + "name": "layout", + "imports": [ + "src/main.tsx" + ] + }, + "_mdi-Cr6PIsRR.js": { + "file": "mdi-Cr6PIsRR.js", + "name": "mdi", + "imports": [ + "src/main.tsx" + ] + }, + "_proxy-BQYsYRjY.js": { + "file": "proxy-BQYsYRjY.js", + "name": "proxy", + "imports": [ + "src/main.tsx" + ] + }, + "_react-Cm4z11-B.js": { + "file": "react-Cm4z11-B.js", + "name": "react", + "imports": [ + "src/main.tsx" + ] + }, + "_react-select.esm-CbdimKhg.js": { + "file": "react-select.esm-CbdimKhg.js", + "name": "react-select.esm", + "imports": [ + "src/main.tsx" + ] + }, + "_sortable-Ke3drO00.js": { + "file": "sortable-Ke3drO00.js", + "name": "sortable", "imports": [ "src/main.tsx" ] }, + "_use-spring-BsypnnSW.js": { + "file": "use-spring-BsypnnSW.js", + "name": "use-spring", + "imports": [ + "src/main.tsx", + "_proxy-BQYsYRjY.js" + ] + }, "src/components/EntitiesPage/EntitiesPagesView.tsx": { - "file": "EntitiesPagesView-Cjf0Hc6A.js", + "file": "EntitiesPagesView-DShidmI8.js", "name": "EntitiesPagesView", "src": "src/components/EntitiesPage/EntitiesPagesView.tsx", "isDynamicEntry": true, "imports": [ "src/main.tsx", - "_MultiStep_AddEditEntity-BVXN3SAx.js" + "_sortable-Ke3drO00.js", + "_react-Cm4z11-B.js", + "_MultiStep_AddEditEntity-xcopfTe5.js" + ] + }, + "src/components/IndexPage/NSPanelsView.tsx": { + "file": "NSPanelsView-1YvY26NZ.js", + "name": "NSPanelsView", + "src": "src/components/IndexPage/NSPanelsView.tsx", + "isDynamicEntry": true, + "imports": [ + "src/main.tsx", + "_react-select.esm-CbdimKhg.js", + "_NSPanelToastContainer-D677tDZJ.js", + "_proxy-BQYsYRjY.js", + "_use-spring-BsypnnSW.js", + "_StompStore-Bh-Guhla.js", + "_EntityStore-CHE3-bsC.js", + "_mdi-Cr6PIsRR.js" + ] + }, + "src/components/InitialSetup/InitialSetup.tsx": { + "file": "InitialSetup-p38u0OlE.js", + "name": "InitialSetup", + "src": "src/components/InitialSetup/InitialSetup.tsx", + "isDynamicEntry": true, + "imports": [ + "src/main.tsx", + "_index.esm-CnTf2rLv.js", + "_NSPanelToastContainer-D677tDZJ.js", + "_proxy-BQYsYRjY.js", + "_AnimatePresence-CpnHckGS.js", + "_mdi-Cr6PIsRR.js", + "_layout-HS0oHCMJ.js" + ] + }, + "src/components/NSPanelPage/Logs.tsx": { + "file": "Logs-B094dObe.js", + "name": "Logs", + "src": "src/components/NSPanelPage/Logs.tsx", + "isDynamicEntry": true, + "imports": [ + "src/main.tsx", + "_SettingsStore-msVzBcHM.js", + "_StompStore-Bh-Guhla.js" + ] + }, + "src/components/NSPanelPage/Sidebar.tsx": { + "file": "Sidebar-CHcoOcQs.js", + "name": "Sidebar", + "src": "src/components/NSPanelPage/Sidebar.tsx", + "isDynamicEntry": true, + "imports": [ + "src/main.tsx", + "_NSPanelToastContainer-D677tDZJ.js", + "_StompStore-Bh-Guhla.js", + "_EntityStore-CHE3-bsC.js", + "_mdi-Cr6PIsRR.js" + ] + }, + "src/components/NSPanelPage/Warnings.tsx": { + "file": "Warnings-D5nCet1X.js", + "name": "Warnings", + "src": "src/components/NSPanelPage/Warnings.tsx", + "isDynamicEntry": true, + "imports": [ + "src/main.tsx", + "_EntityStore-CHE3-bsC.js", + "_mdi-Cr6PIsRR.js" + ] + }, + "src/components/RoomPage/RoomPage.tsx": { + "file": "RoomPage-CMRDvbEM.js", + "name": "RoomPage", + "src": "src/components/RoomPage/RoomPage.tsx", + "isDynamicEntry": true, + "imports": [ + "src/main.tsx", + "_MultiStep_AddEditEntity-xcopfTe5.js", + "_react-select.esm-CbdimKhg.js", + "_index.esm-CnTf2rLv.js", + "_NSPanelToastContainer-D677tDZJ.js", + "src/components/EntitiesPage/EntitiesPagesView.tsx", + "_StompStore-Bh-Guhla.js", + "_EntityStore-CHE3-bsC.js", + "_mdi-Cr6PIsRR.js" + ] + }, + "src/components/RoomsPage/RoomsView.tsx": { + "file": "RoomsView-qN1A3y9X.js", + "name": "RoomsView", + "src": "src/components/RoomsPage/RoomsView.tsx", + "isDynamicEntry": true, + "imports": [ + "src/main.tsx", + "_sortable-Ke3drO00.js", + "_index.esm-CnTf2rLv.js", + "_NSPanelToastContainer-D677tDZJ.js", + "_proxy-BQYsYRjY.js", + "_use-spring-BsypnnSW.js", + "_EntityStore-CHE3-bsC.js", + "_mdi-Cr6PIsRR.js", + "_layout-HS0oHCMJ.js", + "_fields-Dr1KI0Cj.js" + ] + }, + "src/components/SettingsPage/SettingsPage.tsx": { + "file": "SettingsPage-CzrUBqYz.js", + "name": "SettingsPage", + "src": "src/components/SettingsPage/SettingsPage.tsx", + "isDynamicEntry": true, + "imports": [ + "src/main.tsx", + "_index.esm-CnTf2rLv.js", + "_NSPanelToastContainer-D677tDZJ.js", + "_layout-HS0oHCMJ.js", + "_fields-Dr1KI0Cj.js" ] }, "src/main.tsx": { - "file": "main-edk7Os8W.js", + "file": "main-FKp56mKw.js", "name": "main", "src": "src/main.tsx", "isEntry": true, "dynamicImports": [ - "_MultiStep_AddEditEntity-BVXN3SAx.js", - "src/components/EntitiesPage/EntitiesPagesView.tsx" + "_MultiStep_AddEditEntity-xcopfTe5.js", + "src/components/EntitiesPage/EntitiesPagesView.tsx", + "src/components/IndexPage/NSPanelsView.tsx", + "_NSPanelToastContainer-D677tDZJ.js", + "src/components/InitialSetup/InitialSetup.tsx", + "src/components/NSPanelPage/Sidebar.tsx", + "src/components/NSPanelPage/Warnings.tsx", + "src/components/NSPanelPage/Logs.tsx", + "src/components/RoomPage/RoomPage.tsx", + "src/components/SettingsPage/SettingsPage.tsx", + "src/components/RoomsPage/RoomsView.tsx" ], "css": [ - "main-DGNrK5qb.css" + "main-JUTJWg1N.css" ] } } \ No newline at end of file diff --git a/docker/web/nspanelmanager/web/react-components/dist/AnimatePresence-CpnHckGS.js b/docker/web/nspanelmanager/web/react-components/dist/AnimatePresence-CpnHckGS.js new file mode 100644 index 000000000..341044942 --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/AnimatePresence-CpnHckGS.js @@ -0,0 +1,373 @@ +import { c as __toESM, r as require_react, t as require_jsx_runtime } from "./main-FKp56mKw.js"; +import { f as PresenceContext, h as LayoutGroupContext, i as isHTMLElement, m as useConstant, n as usePresence, p as useIsomorphicLayoutEffect, r as MotionConfigContext } from "./proxy-BQYsYRjY.js"; +//#region node_modules/framer-motion/dist/es/utils/use-composed-ref.mjs +var import_jsx_runtime = require_jsx_runtime(); +var import_react = /* @__PURE__ */ __toESM(require_react(), 1); +/** +* Taken from https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/compose-refs.tsx +*/ +/** +* Set a given ref to a given value +* This utility takes care of different types of refs: callback refs and RefObject(s) +*/ +function setRef(ref, value) { + if (typeof ref === "function") return ref(value); + else if (ref !== null && ref !== void 0) ref.current = value; +} +/** +* A utility to compose multiple refs together +* Accepts callback refs and RefObject(s) +*/ +function composeRefs(...refs) { + return (node) => { + let hasCleanup = false; + const cleanups = refs.map((ref) => { + const cleanup = setRef(ref, node); + if (!hasCleanup && typeof cleanup === "function") hasCleanup = true; + return cleanup; + }); + if (hasCleanup) return () => { + for (let i = 0; i < cleanups.length; i++) { + const cleanup = cleanups[i]; + if (typeof cleanup === "function") cleanup(); + else setRef(refs[i], null); + } + }; + }; +} +/** +* A custom hook that composes multiple refs +* Accepts callback refs and RefObject(s) +*/ +function useComposedRefs(...refs) { + return import_react.useCallback(composeRefs(...refs), refs); +} +//#endregion +//#region node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs +/** +* Measurement functionality has to be within a separate component +* to leverage snapshot lifecycle. +*/ +var PopChildMeasure = class extends import_react.Component { + getSnapshotBeforeUpdate(prevProps) { + const element = this.props.childRef.current; + if (isHTMLElement(element) && prevProps.isPresent && !this.props.isPresent && this.props.pop !== false) { + const parent = element.offsetParent; + const parentWidth = isHTMLElement(parent) ? parent.offsetWidth || 0 : 0; + const parentHeight = isHTMLElement(parent) ? parent.offsetHeight || 0 : 0; + const computedStyle = getComputedStyle(element); + const size = this.props.sizeRef.current; + size.height = parseFloat(computedStyle.height); + size.width = parseFloat(computedStyle.width); + size.top = element.offsetTop; + size.left = element.offsetLeft; + size.right = parentWidth - size.width - size.left; + size.bottom = parentHeight - size.height - size.top; + size.direction = computedStyle.direction; + } + return null; + } + /** + * Required with getSnapshotBeforeUpdate to stop React complaining. + */ + componentDidUpdate() {} + render() { + return this.props.children; + } +}; +function PopChild({ children, isPresent, anchorX, anchorY, root, pop }) { + const id = (0, import_react.useId)(); + const ref = (0, import_react.useRef)(null); + const size = (0, import_react.useRef)({ + width: 0, + height: 0, + top: 0, + left: 0, + right: 0, + bottom: 0, + direction: "ltr" + }); + const { nonce } = (0, import_react.useContext)(MotionConfigContext); + const composedRef = useComposedRefs(ref, pop !== false ? children.props?.ref ?? children?.ref : void 0); + /** + * We create and inject a style block so we can apply this explicit + * sizing in a non-destructive manner by just deleting the style block. + * + * We can't apply size via render as the measurement happens + * in getSnapshotBeforeUpdate (post-render), likewise if we apply the + * styles directly on the DOM node, we might be overwriting + * styles set via the style prop. + */ + (0, import_react.useInsertionEffect)(() => { + const { width, height, top, left, right, bottom, direction } = size.current; + if (isPresent || pop === false || !ref.current || !width || !height) return; + const isRTL = direction === "rtl"; + const x = anchorX === "left" ? isRTL ? `right: ${right}` : `left: ${left}` : isRTL ? `left: ${left}` : `right: ${right}`; + const y = anchorY === "bottom" ? `bottom: ${bottom}` : `top: ${top}`; + ref.current.dataset.motionPopId = id; + const style = document.createElement("style"); + if (nonce) style.nonce = nonce; + const parent = root ?? document.head; + parent.appendChild(style); + if (style.sheet) style.sheet.insertRule(` + [data-motion-pop-id="${id}"] { + position: absolute !important; + width: ${width}px !important; + height: ${height}px !important; + ${x}px !important; + ${y}px !important; + } + `); + return () => { + ref.current?.removeAttribute("data-motion-pop-id"); + if (parent.contains(style)) parent.removeChild(style); + }; + }, [isPresent]); + return (0, import_jsx_runtime.jsx)(PopChildMeasure, { + isPresent, + childRef: ref, + sizeRef: size, + pop, + children: pop === false ? children : import_react.cloneElement(children, { ref: composedRef }) + }); +} +//#endregion +//#region node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs +var PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, anchorY, root }) => { + const presenceChildren = useConstant(newChildrenMap); + const id = (0, import_react.useId)(); + const isPresentRef = (0, import_react.useRef)(isPresent); + const onExitCompleteRef = (0, import_react.useRef)(onExitComplete); + useIsomorphicLayoutEffect(() => { + isPresentRef.current = isPresent; + onExitCompleteRef.current = onExitComplete; + }); + let isReusedContext = true; + let context = (0, import_react.useMemo)(() => { + isReusedContext = false; + return { + id, + initial, + isPresent, + custom, + onExitComplete: (childId) => { + presenceChildren.set(childId, true); + for (const isComplete of presenceChildren.values()) if (!isComplete) return; + onExitComplete && onExitComplete(); + }, + register: (childId) => { + presenceChildren.set(childId, false); + return () => { + presenceChildren.delete(childId); + !isPresentRef.current && !presenceChildren.size && onExitCompleteRef.current?.(); + }; + } + }; + }, [ + isPresent, + presenceChildren, + onExitComplete + ]); + /** + * If the presence of a child affects the layout of the components around it, + * we want to make a new context value to ensure they get re-rendered + * so they can detect that layout change. + */ + if (presenceAffectsLayout && isReusedContext) context = { ...context }; + (0, import_react.useMemo)(() => { + presenceChildren.forEach((_, key) => presenceChildren.set(key, false)); + }, [isPresent]); + /** + * If there's no `motion` components to fire exit animations, we want to remove this + * component immediately. + */ + import_react.useEffect(() => { + !isPresent && !presenceChildren.size && onExitComplete && onExitComplete(); + }, [isPresent]); + children = (0, import_jsx_runtime.jsx)(PopChild, { + pop: mode === "popLayout", + isPresent, + anchorX, + anchorY, + root, + children + }); + return (0, import_jsx_runtime.jsx)(PresenceContext.Provider, { + value: context, + children + }); +}; +function newChildrenMap() { + return /* @__PURE__ */ new Map(); +} +//#endregion +//#region node_modules/framer-motion/dist/es/components/AnimatePresence/utils.mjs +var getChildKey = (child) => child.key || ""; +function onlyElements(children) { + const filtered = []; + import_react.Children.forEach(children, (child) => { + if ((0, import_react.isValidElement)(child)) filtered.push(child); + }); + return filtered; +} +//#endregion +//#region node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs +/** +* `AnimatePresence` enables the animation of components that have been removed from the tree. +* +* When adding/removing more than a single child, every child **must** be given a unique `key` prop. +* +* Any `motion` components that have an `exit` property defined will animate out when removed from +* the tree. +* +* ```jsx +* import { motion, AnimatePresence } from 'framer-motion' +* +* export const Items = ({ items }) => ( +* +* {items.map(item => ( +* +* ))} +* +* ) +* ``` +* +* You can sequence exit animations throughout a tree using variants. +* +* If a child contains multiple `motion` components with `exit` props, it will only unmount the child +* once all `motion` components have finished animating out. Likewise, any components using +* `usePresence` all need to call `safeToRemove`. +* +* @public +*/ +var AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = "sync", propagate = false, anchorX = "left", anchorY = "top", root }) => { + const [isParentPresent, safeToRemove] = usePresence(propagate); + /** + * Filter any children that aren't ReactElements. We can only track components + * between renders with a props.key. + */ + const presentChildren = (0, import_react.useMemo)(() => onlyElements(children), [children]); + /** + * Track the keys of the currently rendered children. This is used to + * determine which children are exiting. + */ + const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey); + /** + * If `initial={false}` we only want to pass this to components in the first render. + */ + const isInitialRender = (0, import_react.useRef)(true); + /** + * A ref containing the currently present children. When all exit animations + * are complete, we use this to re-render the component with the latest children + * *committed* rather than the latest children *rendered*. + */ + const pendingPresentChildren = (0, import_react.useRef)(presentChildren); + /** + * Track which exiting children have finished animating out. + */ + const exitComplete = useConstant(() => /* @__PURE__ */ new Map()); + /** + * Track which components are currently processing exit to prevent duplicate processing. + */ + const exitingComponents = (0, import_react.useRef)(/* @__PURE__ */ new Set()); + /** + * Save children to render as React state. To ensure this component is concurrent-safe, + * we check for exiting children via an effect. + */ + const [diffedChildren, setDiffedChildren] = (0, import_react.useState)(presentChildren); + const [renderedChildren, setRenderedChildren] = (0, import_react.useState)(presentChildren); + useIsomorphicLayoutEffect(() => { + isInitialRender.current = false; + pendingPresentChildren.current = presentChildren; + /** + * Update complete status of exiting children. + */ + for (let i = 0; i < renderedChildren.length; i++) { + const key = getChildKey(renderedChildren[i]); + if (!presentKeys.includes(key)) { + if (exitComplete.get(key) !== true) exitComplete.set(key, false); + } else { + exitComplete.delete(key); + exitingComponents.current.delete(key); + } + } + }, [ + renderedChildren, + presentKeys.length, + presentKeys.join("-") + ]); + const exitingChildren = []; + if (presentChildren !== diffedChildren) { + let nextChildren = [...presentChildren]; + /** + * Loop through all the currently rendered components and decide which + * are exiting. + */ + for (let i = 0; i < renderedChildren.length; i++) { + const child = renderedChildren[i]; + const key = getChildKey(child); + if (!presentKeys.includes(key)) { + nextChildren.splice(i, 0, child); + exitingChildren.push(child); + } + } + /** + * If we're in "wait" mode, and we have exiting children, we want to + * only render these until they've all exited. + */ + if (mode === "wait" && exitingChildren.length) nextChildren = exitingChildren; + setRenderedChildren(onlyElements(nextChildren)); + setDiffedChildren(presentChildren); + /** + * Early return to ensure once we've set state with the latest diffed + * children, we can immediately re-render. + */ + return null; + } + /** + * If we've been provided a forceRender function by the LayoutGroupContext, + * we can use it to force a re-render amongst all surrounding components once + * all components have finished animating out. + */ + const { forceRender } = (0, import_react.useContext)(LayoutGroupContext); + return (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: renderedChildren.map((child) => { + const key = getChildKey(child); + const isPresent = propagate && !isParentPresent ? false : presentChildren === renderedChildren || presentKeys.includes(key); + const onExit = () => { + if (exitingComponents.current.has(key)) return; + if (exitComplete.has(key)) { + exitingComponents.current.add(key); + exitComplete.set(key, true); + } else return; + let isEveryExitComplete = true; + exitComplete.forEach((isExitComplete) => { + if (!isExitComplete) isEveryExitComplete = false; + }); + if (isEveryExitComplete) { + forceRender?.(); + setRenderedChildren(pendingPresentChildren.current); + propagate && safeToRemove?.(); + onExitComplete && onExitComplete(); + } + }; + return (0, import_jsx_runtime.jsx)(PresenceChild, { + isPresent, + initial: !isInitialRender.current || initial ? void 0 : false, + custom, + presenceAffectsLayout, + mode, + root, + onExitComplete: isPresent ? void 0 : onExit, + anchorX, + anchorY, + children: child + }, key); + }) }); +}; +//#endregion +export { AnimatePresence as t }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/EntitiesPagesView-Cjf0Hc6A.js b/docker/web/nspanelmanager/web/react-components/dist/EntitiesPagesView-Cjf0Hc6A.js deleted file mode 100644 index 4ee7b39f7..000000000 --- a/docker/web/nspanelmanager/web/react-components/dist/EntitiesPagesView-Cjf0Hc6A.js +++ /dev/null @@ -1,67 +0,0 @@ -import{c as Oc,n as $c,r as Dc,t as Pc}from"./main-edk7Os8W.js";import{i as Cc,n as Ti,r as ve}from"./MultiStep_AddEditEntity-BVXN3SAx.js";var k=Oc(Dc(),1),Ic=Symbol.for("preact-signals");function wr(){if(De>1)De--;else{var e,t=!1;for((function(){var i=or;for(or=void 0;i!==void 0;)i.S.v===i.v&&(i.S.i=i.i),i=i.o})();fn!==void 0;){var n=fn;for(fn=void 0,sr++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Vo(n))try{n.c()}catch(i){t||(e=i,t=!0)}n=r}}if(sr=0,De--,t)throw e}}function U(e){if(De>0)return e();Jr=++jc,De++;try{return e()}finally{wr()}}var M=void 0;function T(e){var t=M;M=void 0;try{return e()}finally{M=t}}var so,fn=void 0,De=0,sr=0,jc=0,Jr=0,or=void 0,ar=0;function Fo(e){if(M!==void 0){var t=e.n;if(t===void 0||t.t!==M)return t={i:0,S:e,p:M.s,n:void 0,t:M,e:void 0,x:void 0,r:t},M.s!==void 0&&(M.s.n=t),M.s=t,e.n=t,32&M.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=M.s,t.n=void 0,M.s.n=t,M.s=t),t}}function re(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}re.prototype.brand=Ic;re.prototype.h=function(){return!0};re.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n!==void 0?n.e=e:T(function(){var r;(r=t.W)==null||r.call(t)}))};re.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&T(function(){var i;(i=t.Z)==null||i.call(t)}))}};re.prototype.subscribe=function(e){var t=this;return pe(function(){var n=t.value,r=M;M=void 0;try{e(n)}finally{M=r}},{name:"sub"})};re.prototype.valueOf=function(){return this.value};re.prototype.toString=function(){return this.value+""};re.prototype.toJSON=function(){return this.value};re.prototype.peek=function(){var e=M;M=void 0;try{return this.value}finally{M=e}};Object.defineProperty(re.prototype,"value",{get:function(){var e=Fo(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(sr>100)throw new Error("Cycle detected");(function(n){De!==0&&sr===0&&n.l!==Jr&&(n.l=Jr,or={S:n,v:n.v,i:n.i,o:or})})(this),this.v=e,this.i++,ar++,De++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{wr()}}}});function Ct(e,t){return new re(e,t)}function Vo(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Uo(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Xo(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function rt(e,t){re.call(this,void 0),this.x=e,this.s=void 0,this.g=ar-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}rt.prototype=new re;rt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ar))return!0;if(this.g=ar,this.f|=1,this.i>0&&!Vo(this))return this.f&=-2,!0;var e=M;try{Uo(this),M=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return M=e,Xo(this),this.f&=-2,!0};rt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}re.prototype.S.call(this,e)};rt.prototype.U=function(e){if(this.t!==void 0&&(re.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};rt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(rt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Fo(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function oo(e,t){return new rt(e,t)}function Yo(e){var t=e.m;if(e.m=void 0,typeof t=="function"){De++;var n=M;M=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,Ai(e),r}finally{M=n,wr()}}}function Ai(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Yo(e)}function Mc(e){if(M!==this)throw new Error("Out-of-order effect");Xo(this),M=e,this.f&=-2,8&this.f&&Ai(this),wr()}function It(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,so&&so.push(this)}It.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};It.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Yo(this),Uo(this),De++;var e=M;return M=this,Mc.bind(this,e)};It.prototype.N=function(){2&this.f||(this.f|=2,this.u=fn,fn=this)};It.prototype.d=function(){this.f|=8,1&this.f||Ai(this)};It.prototype.dispose=function(){this.d()};function pe(e,t){var n=new It(e,t);try{n.c()}catch(i){throw n.d(),i}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Tc=Object.create,Ri=Object.defineProperty,Ac=Object.defineProperties,Rc=Object.getOwnPropertyDescriptor,Nc=Object.getOwnPropertyDescriptors,ao=Object.getOwnPropertySymbols,Wc=Object.prototype.hasOwnProperty,Lc=Object.prototype.propertyIsEnumerable,Ho=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),jt=e=>{throw TypeError(e)},Zr=(e,t,n)=>t in e?Ri(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zc=(e,t)=>{for(var n in t||(t={}))Wc.call(t,n)&&Zr(e,n,t[n]);if(ao)for(var n of ao(t))Lc.call(t,n)&&Zr(e,n,t[n]);return e},Fc=(e,t)=>Ac(e,Nc(t)),lo=(e,t)=>Ri(e,"name",{value:t,configurable:!0}),Vc=e=>{var t;return[,,,Tc((t=e?.[Ho("metadata")])!=null?t:null)]},qo=["class","method","getter","setter","accessor","field","value","get","set"],Bt=e=>e!==void 0&&typeof e!="function"?jt("Function expected"):e,Uc=(e,t,n,r,i)=>({kind:qo[e],name:t,metadata:r,addInitializer:s=>n._?jt("Already initialized"):i.push(Bt(s||null))}),Bo=(e,t)=>Zr(t,Ho("metadata"),e[3]),Ye=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i{var o,a,c,u,d,l=t&7,f=!!(t&8),g=!!(t&16),y=l>3?e.length+1:l?f?1:2:0,b=qo[l+5],x=l>3&&(e[y-1]=[]),_=e[y]||(e[y]=[]),v=l&&(!g&&!f&&(i=i.prototype),l<5&&(l>3||!g)&&Rc(l<4?i:{get[n](){return ue(this,s)},set[n](p){return Ae(this,s,p)}},n));l?g&&l<4&&lo(s,(l>2?"set ":l>1?"get ":"")+n):lo(i,n);for(var h=r.length-1;h>=0;h--)u=Uc(l,n,c={},e[3],_),l&&(u.static=f,u.private=g,d=u.access={has:g?p=>Xc(i,p):p=>n in p},l^3&&(d.get=g?p=>(l^1?ue:Yc)(p,i,l^4?s:v.get):p=>p[n]),l>2&&(d.set=g?(p,m)=>Ae(p,i,m,l^4?s:v.set):(p,m)=>p[n]=m)),a=(0,r[h])(l?l<4?g?s:v[b]:l>4?void 0:{get:v.get,set:v.set}:i,u),c._=1,l^4||a===void 0?Bt(a)&&(l>4?x.unshift(a):l?g?s=a:v[b]=a:i=a):typeof a!="object"||a===null?jt("Object expected"):(Bt(o=a.get)&&(v.get=o),Bt(o=a.set)&&(v.set=o),Bt(o=a.init)&&x.unshift(o));return l||Bo(e,i),v&&Ri(i,n,v),g?l^4?s:v:i},Ni=(e,t,n)=>t.has(e)||jt("Cannot "+n),Xc=(e,t)=>Object(t)!==t?jt('Cannot use the "in" operator on this value'):e.has(t),ue=(e,t,n)=>(Ni(e,t,"read from private field"),n?n.call(e):t.get(e)),Gt=(e,t,n)=>t.has(e)?jt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ae=(e,t,n,r)=>(Ni(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Yc=(e,t,n)=>(Ni(e,t,"access private method"),n);function Qr(e,t){if(t){let n;return oo(()=>{const r=e();return r&&n&&t(n,r)?n:(n=r,r)})}return oo(e)}function ye(e,t){if(Object.is(e,t))return!0;if(e===null||t===null)return!1;if(typeof e=="function"&&typeof t=="function")return e===t;if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:!e.some((n,r)=>!ye(n,t[r]));if(typeof e=="object"&&typeof t=="object"){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:!n.some(i=>!ye(e[i],t[i]))}return!1}function I({get:e},t){return{init(n){return Ct(n)},get(){return e.call(this).value},set(n){const r=e.call(this);r.peek()!==n&&(r.value=n)}}}function Y(e,t){const n=new WeakMap;return function(){let r=n.get(this);return r||(r=Qr(e.bind(this)),n.set(this,r)),r.value}}function Nr(e=!0){return function(t,n){n.addInitializer(function(){const r=n.kind==="field"?this:n.static?this:Object.getPrototypeOf(this),i=Object.getOwnPropertyDescriptor(r,n.name);i&&Object.defineProperty(r,n.name,Fc(zc({},i),{enumerable:e}))})}}function $n(...e){const t=e.map(n=>pe(n));return()=>t.forEach(n=>n())}var Go,Ko,Jo,Zo,Qo,Hc=[I],ee,Wi,Wr,ei,ti,Z,Li,Lr,ea,ni,zi,zr,ri,ii;Qo=[I],Zo=[I],Jo=[Nr()],Ko=[Nr()],Go=[Nr()];var it=class{constructor(e,t=Object.is){this.defaultValue=e,this.equals=t,Ye(ee,5,this),Gt(this,Z),Gt(this,Wi,Ye(ee,8,this)),Ye(ee,11,this),Gt(this,Li,Ye(ee,12,this)),Ye(ee,15,this),Gt(this,zi,Ye(ee,16,this)),Ye(ee,19,this),this.reset=this.reset.bind(this),this.reset()}get current(){return ue(this,Z,ri)}get initial(){return ue(this,Z,ei)}get previous(){return ue(this,Z,ea)}set current(e){const t=T(()=>ue(this,Z,ri));e&&t&&this.equals(t,e)||U(()=>{ue(this,Z,ei)||Ae(this,Z,e,ti),Ae(this,Z,t,ni),Ae(this,Z,e,ii)})}reset(e=this.defaultValue){U(()=>{Ae(this,Z,void 0,ni),Ae(this,Z,e,ti),Ae(this,Z,e,ii)})}};ee=Vc(null);Wi=new WeakMap;Z=new WeakSet;Li=new WeakMap;zi=new WeakMap;Wr=Mt(ee,20,"#initial",Hc,Z,Wi),ei=Wr.get,ti=Wr.set;Lr=Mt(ee,20,"#previous",Qo,Z,Li),ea=Lr.get,ni=Lr.set;zr=Mt(ee,20,"#current",Zo,Z,zi),ri=zr.get,ii=zr.set;Mt(ee,2,"current",Jo,it);Mt(ee,2,"initial",Ko,it);Mt(ee,2,"previous",Go,it);Bo(ee,it);function Fr(e){return T(()=>{const t={};for(const n in e)t[n]=e[n];return t})}var He,qc=class{constructor(){Gt(this,He,new WeakMap)}get(e,t){var n;return e?(n=ue(this,He).get(e))==null?void 0:n.get(t):void 0}set(e,t,n){var r;if(e)return ue(this,He).has(e)||ue(this,He).set(e,new Map),(r=ue(this,He).get(e))==null?void 0:r.set(t,n)}clear(e){var t;return e?(t=ue(this,He).get(e))==null?void 0:t.clear():void 0}};He=new WeakMap;var Bc=Object.create,Fi=Object.defineProperty,Gc=Object.getOwnPropertyDescriptor,co=Object.getOwnPropertySymbols,Kc=Object.prototype.hasOwnProperty,Jc=Object.prototype.propertyIsEnumerable,ta=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Tt=e=>{throw TypeError(e)},uo=Math.pow,si=(e,t,n)=>t in e?Fi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zc=(e,t)=>{for(var n in t||(t={}))Kc.call(t,n)&&si(e,n,t[n]);if(co)for(var n of co(t))Jc.call(t,n)&&si(e,n,t[n]);return e},fo=(e,t)=>Fi(e,"name",{value:t,configurable:!0}),Qc=e=>{var t;return[,,,Bc((t=e?.[ta("metadata")])!=null?t:null)]},na=["class","method","getter","setter","accessor","field","value","get","set"],Kt=e=>e!==void 0&&typeof e!="function"?Tt("Function expected"):e,eu=(e,t,n,r,i)=>({kind:na[e],name:t,metadata:r,addInitializer:s=>n._?Tt("Already initialized"):i.push(Kt(s||null))}),ra=(e,t)=>si(t,ta("metadata"),e[3]),tu=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i{var o,a,c,u,d,l=t&7,f=!!(t&8),g=!!(t&16),y=l>3?e.length+1:l?f?1:2:0,b=na[l+5],x=l>3&&(e[y-1]=[]),_=e[y]||(e[y]=[]),v=l&&(!g&&!f&&(i=i.prototype),l<5&&(l>3||!g)&&Gc(l<4?i:{get[n](){return oi(this,s)},set[n](p){return ai(this,s,p)}},n));l?g&&l<4&&fo(s,(l>2?"set ":l>1?"get ":"")+n):fo(i,n);for(var h=r.length-1;h>=0;h--)u=eu(l,n,c={},e[3],_),l&&(u.static=f,u.private=g,d=u.access={has:g?p=>nu(i,p):p=>n in p},l^3&&(d.get=g?p=>(l^1?oi:iu)(p,i,l^4?s:v.get):p=>p[n]),l>2&&(d.set=g?(p,m)=>ai(p,i,m,l^4?s:v.set):(p,m)=>p[n]=m)),a=(0,r[h])(l?l<4?g?s:v[b]:l>4?void 0:{get:v.get,set:v.set}:i,u),c._=1,l^4||a===void 0?Kt(a)&&(l>4?x.unshift(a):l?g?s=a:v[b]=a:i=a):typeof a!="object"||a===null?Tt("Object expected"):(Kt(o=a.get)&&(v.get=o),Kt(o=a.set)&&(v.set=o),Kt(o=a.init)&&x.unshift(o));return l||ra(e,i),v&&Fi(i,n,v),g?l^4?s:v:i},Vi=(e,t,n)=>t.has(e)||Tt("Cannot "+n),nu=(e,t)=>Object(t)!==t?Tt('Cannot use the "in" operator on this value'):e.has(t),oi=(e,t,n)=>(Vi(e,t,"read from private field"),n?n.call(e):t.get(e)),ru=(e,t,n)=>t.has(e)?Tt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ai=(e,t,n,r)=>(Vi(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),iu=(e,t,n)=>(Vi(e,t,"access private method"),n),de=class li{constructor(t,n){this.x=t,this.y=n}static delta(t,n){return new li(t.x-n.x,t.y-n.y)}static distance(t,n){return Math.hypot(t.x-n.x,t.y-n.y)}static equals(t,n){return t.x===n.x&&t.y===n.y}static from({x:t,y:n}){return new li(t,n)}},Se=class qe{constructor(t,n,r,i){this.left=t,this.top=n,this.width=r,this.height=i,this.scale={x:1,y:1}}get inverseScale(){return{x:1/this.scale.x,y:1/this.scale.y}}translate(t,n){const{top:r,left:i,width:s,height:o,scale:a}=this,c=new qe(i+t,r+n,s,o);return c.scale=Zc({},a),c}get boundingRectangle(){const{width:t,height:n,left:r,top:i,right:s,bottom:o}=this;return{width:t,height:n,left:r,top:i,right:s,bottom:o}}get center(){const{left:t,top:n,right:r,bottom:i}=this;return new de((t+r)/2,(n+i)/2)}get area(){const{width:t,height:n}=this;return t*n}equals(t){if(!(t instanceof qe))return!1;const{left:n,top:r,width:i,height:s}=this;return n===t.left&&r===t.top&&i===t.width&&s===t.height}containsPoint(t){const{top:n,left:r,bottom:i,right:s}=this;return n<=t.y&&t.y<=i&&r<=t.x&&t.x<=s}intersectionArea(t){return t instanceof qe?su(this,t):0}intersectionRatio(t){const{area:n}=this,r=this.intersectionArea(t);return r/(t.area+n-r)}get bottom(){const{top:t,height:n}=this;return t+n}get right(){const{left:t,width:n}=this;return t+n}get aspectRatio(){const{width:t,height:n}=this;return t/n}get corners(){return[{x:this.left,y:this.top},{x:this.right,y:this.top},{x:this.left,y:this.bottom},{x:this.right,y:this.bottom}]}static from({top:t,left:n,width:r,height:i}){return new qe(n,t,r,i)}static delta(t,n,r={x:"center",y:"center"}){const i=(s,o)=>{const a=r[o],c=o==="x"?s.left:s.top,u=o==="x"?s.width:s.height;return a=="start"?c:a=="end"?c+u:c+u/2};return de.delta({x:i(t,"x"),y:i(t,"y")},{x:i(n,"x"),y:i(n,"y")})}static intersectionRatio(t,n){return qe.from(t).intersectionRatio(qe.from(n))}};function su(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),o=i-r,a=s-n;return rde.equals(n,r)),tu(Dn,5,this),ru(this,Gn,0),this.velocity={x:0,y:0}}get delta(){return de.delta(this.current,this.initial)}get direction(){const{current:e,previous:t}=this;if(!t)return null;const n={x:e.x-t.x,y:e.y-t.y};return!n.x&&!n.y?null:Math.abs(n.x)>Math.abs(n.y)?n.x>0?"right":"left":n.y>0?"down":"up"}get current(){return super.current}set current(e){const{current:t}=this,n=de.from(e),r={x:n.x-t.x,y:n.y-t.y},i=Date.now(),s=i-oi(this,Gn),o=a=>Math.round(a/s*100);U(()=>{ai(this,Gn,i),this.velocity={x:o(r.x),y:o(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(de.from(e)),this.velocity={x:0,y:0}}};Dn=Qc(ci);Gn=new WeakMap;ia(Dn,2,"delta",oa,xr);ia(Dn,2,"direction",sa,xr);ra(Dn,xr);function ui({x:e,y:t},n){const r=Math.abs(e),i=Math.abs(t);return typeof n=="number"?Math.sqrt(uo(r,2)+uo(i,2))>n:"x"in n&&"y"in n?r>n.x&&i>n.y:"x"in n?r>n.x:"y"in n?i>n.y:!1}var aa=(e=>(e.Horizontal="x",e.Vertical="y",e))(aa||{}),la=Object.values(aa),ou=Object.create,Ui=Object.defineProperty,au=Object.defineProperties,lu=Object.getOwnPropertyDescriptor,cu=Object.getOwnPropertyDescriptors,lr=Object.getOwnPropertySymbols,ca=Object.prototype.hasOwnProperty,ua=Object.prototype.propertyIsEnumerable,da=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),At=e=>{throw TypeError(e)},di=(e,t,n)=>t in e?Ui(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xi=(e,t)=>{for(var n in t||(t={}))ca.call(t,n)&&di(e,n,t[n]);if(lr)for(var n of lr(t))ua.call(t,n)&&di(e,n,t[n]);return e},Yi=(e,t)=>au(e,cu(t)),ho=(e,t)=>Ui(e,"name",{value:t,configurable:!0}),fa=(e,t)=>{var n={};for(var r in e)ca.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&lr)for(var r of lr(e))t.indexOf(r)<0&&ua.call(e,r)&&(n[r]=e[r]);return n},Rt=e=>{var t;return[,,,ou((t=e?.[da("metadata")])!=null?t:null)]},ha=["class","method","getter","setter","accessor","field","value","get","set"],Jt=e=>e!==void 0&&typeof e!="function"?At("Function expected"):e,uu=(e,t,n,r,i)=>({kind:ha[e],name:t,metadata:r,addInitializer:s=>n._?At("Already initialized"):i.push(Jt(s||null))}),st=(e,t)=>di(t,da("metadata"),e[3]),P=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i{var o,a,c,u,d,l=t&7,f=!!(t&8),g=!!(t&16),y=l>3?e.length+1:l?f?1:2:0,b=ha[l+5],x=l>3&&(e[y-1]=[]),_=e[y]||(e[y]=[]),v=l&&(!g&&!f&&(i=i.prototype),l<5&&(l>3||!g)&&lu(l<4?i:{get[n](){return X(this,s)},set[n](p){return ae(this,s,p)}},n));l?g&&l<4&&ho(s,(l>2?"set ":l>1?"get ":"")+n):ho(i,n);for(var h=r.length-1;h>=0;h--)u=uu(l,n,c={},e[3],_),l&&(u.static=f,u.private=g,d=u.access={has:g?p=>du(i,p):p=>n in p},l^3&&(d.get=g?p=>(l^1?X:pa)(p,i,l^4?s:v.get):p=>p[n]),l>2&&(d.set=g?(p,m)=>ae(p,i,m,l^4?s:v.set):(p,m)=>p[n]=m)),a=(0,r[h])(l?l<4?g?s:v[b]:l>4?void 0:{get:v.get,set:v.set}:i,u),c._=1,l^4||a===void 0?Jt(a)&&(l>4?x.unshift(a):l?g?s=a:v[b]=a:i=a):typeof a!="object"||a===null?At("Object expected"):(Jt(o=a.get)&&(v.get=o),Jt(o=a.set)&&(v.set=o),Jt(o=a.init)&&x.unshift(o));return l||st(e,i),v&&Ui(i,n,v),g?l^4?s:v:i},Hi=(e,t,n)=>t.has(e)||At("Cannot "+n),du=(e,t)=>Object(t)!==t?At('Cannot use the "in" operator on this value'):e.has(t),X=(e,t,n)=>(Hi(e,t,"read from private field"),n?n.call(e):t.get(e)),R=(e,t,n)=>t.has(e)?At("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ae=(e,t,n,r)=>(Hi(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pa=(e,t,n)=>(Hi(e,t,"access private method"),n);function ga(e,t){return{plugin:e,options:t}}function Pn(e){return t=>ga(e,t)}function yn(e){return typeof e=="function"?{plugin:e,options:void 0}:e}var fu=[I],_n,qi,Kn,Q=class{constructor(e,t){this.manager=e,this.options=t,R(this,qi,P(_n,8,this,!1)),P(_n,11,this),R(this,Kn,new Set)}enable(){this.disabled=!1}disable(){this.disabled=!0}isDisabled(){return T(()=>this.disabled)}configure(e){this.options=e}registerEffect(e){const t=pe(e.bind(this));return X(this,Kn).add(t),t}destroy(){X(this,Kn).forEach(e=>e())}static configure(e){return ga(this,e)}};_n=Rt(null);qi=new WeakMap;Kn=new WeakMap;j(_n,4,"disabled",fu,Q,qi);st(_n,Q);var Cn=class extends Q{},Jn,Vr=class{constructor(e){this.manager=e,this.instances=new Map,R(this,Jn,[])}get values(){return Array.from(this.instances.values())}set values(e){const t=e.map(yn).reduce((r,i)=>{const s=r.find(({plugin:o})=>o===i.plugin);return s?(s.options=i.options,r):[...r,i]},[]),n=t.map(({plugin:r})=>r);for(const r of X(this,Jn))if(!n.includes(r)){if(r.prototype instanceof Cn)continue;this.unregister(r)}for(const{plugin:r,options:i}of t)this.register(r,i);ae(this,Jn,n)}get(e){return this.instances.get(e)}register(e,t){const n=this.instances.get(e);if(n)return n.options!==t&&(n.options=t),n;const r=new e(this.manager,t);return this.instances.set(e,r),r}unregister(e){const t=this.instances.get(e);t&&(t.destroy(),this.instances.delete(e))}destroy(){for(const e of this.instances.values())e.destroy();this.instances.clear()}};Jn=new WeakMap;function hu(e,t){return e.priority===t.priority?e.type===t.type?t.value-e.value:t.type-e.type:t.priority-e.priority}var Fn=[],ft,ht,pu=class extends Q{constructor(e){super(e),R(this,ft),R(this,ht),this.computeCollisions=this.computeCollisions.bind(this),ae(this,ht,Ct(Fn)),this.destroy=$n(()=>{const t=this.computeCollisions(),n=T(()=>this.manager.dragOperation.position.current);if(t!==Fn){const r=X(this,ft);if(ae(this,ft,n),r&&n.x==r.x&&n.y==r.y)return}else ae(this,ft,void 0);X(this,ht).value=t},()=>{const{dragOperation:t}=this.manager;t.status.initialized&&this.forceUpdate()})}forceUpdate(e=!0){T(()=>{e?X(this,ht).value=this.computeCollisions():ae(this,ft,void 0)})}computeCollisions(e,t){const{registry:n,dragOperation:r}=this.manager,{source:i,shape:s,status:o}=r;if(!o.initialized||!s)return Fn;const a=[],c=[];for(const u of e??n.droppables){if(u.disabled||i&&!u.accepts(i))continue;const d=t??u.collisionDetector;if(!d)continue;c.push(u),u.shape;const l=T(()=>d({droppable:u,dragOperation:r}));l&&(u.collisionPriority!=null&&(l.priority=u.collisionPriority),a.push(l))}return c.length===0?Fn:(a.sort(hu),a)}get collisions(){return X(this,ht).value}};ft=new WeakMap;ht=new WeakMap;var va,ma,gu=[I],Bi,ya,me,Gi,_t,Ki,Ji;ma=[I],va=[I];var Ce=class Be{constructor(t,n){R(this,Gi,P(me,8,this)),P(me,11,this),R(this,_t),R(this,Ki,P(me,12,this)),P(me,15,this),R(this,Ji,P(me,16,this)),P(me,19,this);const{effects:r,id:i,data:s={},disabled:o=!1,register:a=!0}=t;let c=i;ae(this,_t,Ct(i)),this.manager=n,this.data=s,this.disabled=o,this.effects=()=>{var u;return[()=>{const{id:d,manager:l}=this;if(d!==c)return c=d,l?.registry.register(this),()=>l?.registry.unregister(this)},...(u=r?.())!=null?u:[]]},this.register=this.register.bind(this),this.unregister=this.unregister.bind(this),this.destroy=this.destroy.bind(this),n&&a&&queueMicrotask(this.register)}get id(){var t,n;const r=X(this,_t).value;return(n=(t=Be.pendingIdChanges)==null?void 0:t.get(this))!=null?n:r}set id(t){var n,r;t!==((r=(n=Be.pendingIdChanges)==null?void 0:n.get(this))!=null?r:X(this,_t).peek())&&(Be.pendingIdChanges||(Be.pendingIdChanges=new Map,queueMicrotask(()=>{var i;return pa(i=Be,Bi,ya).call(i)})),Be.pendingIdChanges.set(this,t))}register(){var t;return(t=this.manager)==null?void 0:t.registry.register(this)}unregister(){var t;(t=this.manager)==null||t.registry.unregister(this)}destroy(){var t;(t=this.manager)==null||t.registry.unregister(this)}};me=Rt(null);Bi=new WeakSet;ya=function(){const e=Ce.pendingIdChanges;Ce.pendingIdChanges=null,e&&U(()=>{for(const[t,n]of e)X(t,_t).value=n})};Gi=new WeakMap;_t=new WeakMap;Ki=new WeakMap;Ji=new WeakMap;j(me,4,"manager",gu,Ce,Gi);j(me,4,"data",ma,Ce,Ki);j(me,4,"disabled",va,Ce,Ji);R(Ce,Bi);st(me,Ce);Ce.pendingIdChanges=null;var Sr=Ce,po=class{constructor(){this.map=Ct(new Map),this.cleanupFunctions=new WeakMap,this.register=(e,t)=>{const n=this.map.peek(),r=n.get(e),i=()=>this.unregister(e,t);if(r===t)return i;r&&r.id===e&&(this.cleanupFunctions.get(r)?.(),this.cleanupFunctions.delete(r));const s=new Map(n);for(const[a,c]of n)if(c===t&&a!==e){s.delete(a);break}s.set(e,t),this.map.value=s;const o=$n(...t.effects());return this.cleanupFunctions.set(t,o),i},this.unregister=(e,t)=>{const n=this.map.peek();if(n.get(e)!==t)return;this.cleanupFunctions.get(t)?.(),this.cleanupFunctions.delete(t);const r=new Map(n);r.delete(e),this.map.value=r}}[Symbol.iterator](){return this.map.peek().values()}get value(){return this.map.value.values()}has(e){return this.map.value.has(e)}get(e){return this.map.value.get(e)}destroy(){for(const e of this)this.cleanupFunctions.get(e)?.(),e.destroy();this.map.value=new Map}},_a,ba,wa,xa,Sa,Ea,fi,te,Zi,Qi,es,Ee=class extends(fi=Sr,Ea=[I],Sa=[I],xa=[I],wa=[Y],ba=[Y],_a=[Y],fi){constructor(e,t){var n=e,{modifiers:r,type:i,sensors:s,plugins:o,effects:a}=n,c=fa(n,["modifiers","type","sensors","plugins","effects"]);super(Yi(Xi({},c),{effects:()=>{var u;return[...(u=a?.())!=null?u:[],()=>{const{manager:d,plugins:l}=this;if(!(!d||!l))for(const f of l){const{plugin:g}=yn(f);d.registry.plugins.register(g)}}]}}),t),P(te,5,this),R(this,Zi,P(te,8,this)),P(te,11,this),R(this,Qi,P(te,12,this)),P(te,15,this),R(this,es,P(te,16,this,this.isDragSource?"dragging":"idle")),P(te,19,this),this.type=i,this.sensors=s,this.modifiers=r,this.alignment=c.alignment,this.plugins=o}pluginConfig(e){if(this.plugins)for(const t of this.plugins){const n=yn(t);if(n.plugin===e)return n.options}}get isDropping(){return this.status==="dropping"&&this.isDragSource}get isDragging(){return this.status==="dragging"&&this.isDragSource}get isDragSource(){var e,t;return((t=(e=this.manager)==null?void 0:e.dragOperation.source)==null?void 0:t.id)===this.id}};te=Rt(fi);Zi=new WeakMap;Qi=new WeakMap;es=new WeakMap;j(te,4,"type",Ea,Ee,Zi);j(te,4,"modifiers",Sa,Ee,Qi);j(te,4,"status",xa,Ee,es);j(te,2,"isDropping",wa,Ee);j(te,2,"isDragging",ba,Ee);j(te,2,"isDragSource",_a,Ee);st(te,Ee);var ka,Oa,$a,Da,Pa,Ca,hi,B,ts,ns,rs,is,ss,ke=class extends(hi=Sr,Ca=[I],Pa=[I],Da=[I],$a=[I],Oa=[I],ka=[Y],hi){constructor(e,t){var n=e,{accept:r,collisionDetector:i,collisionPriority:s,type:o}=n,a=fa(n,["accept","collisionDetector","collisionPriority","type"]);super(a,t),P(B,5,this),R(this,ts,P(B,8,this)),P(B,11,this),R(this,ns,P(B,12,this)),P(B,15,this),R(this,rs,P(B,16,this)),P(B,19,this),R(this,is,P(B,20,this)),P(B,23,this),R(this,ss,P(B,24,this)),P(B,27,this),this.accept=r,this.collisionDetector=i,this.collisionPriority=s,this.type=o}accepts(e){const{accept:t}=this;return t?typeof t=="function"?t(e):e.type?Array.isArray(t)?t.includes(e.type):e.type===t:!1:!0}get isDropTarget(){var e,t;return((t=(e=this.manager)==null?void 0:e.dragOperation.target)==null?void 0:t.id)===this.id}};B=Rt(hi);ts=new WeakMap;ns=new WeakMap;rs=new WeakMap;is=new WeakMap;ss=new WeakMap;j(B,4,"accept",Ca,ke,ts);j(B,4,"type",Pa,ke,ns);j(B,4,"collisionDetector",Da,ke,rs);j(B,4,"collisionPriority",$a,ke,is);j(B,4,"shape",Oa,ke,ss);j(B,2,"isDropTarget",ka,ke);st(B,ke);var vu=class{constructor(){this.registry=new Map}addEventListener(e,t){const{registry:n}=this,r=new Set(n.get(e));return r.add(t),n.set(e,r),()=>this.removeEventListener(e,t)}removeEventListener(e,t){const{registry:n}=this,r=new Set(n.get(e));r.delete(t),n.set(e,r)}dispatch(e,...t){const{registry:n}=this,r=n.get(e);if(r)for(const i of r)i(...t)}},mu=class extends vu{constructor(e){super(),this.manager=e}dispatch(e,t){const n=[t,this.manager];super.dispatch(e,...n)}};function Zn(e,t=!0){let n=!1;return Yi(Xi({},e),{cancelable:t,get defaultPrevented(){return n},preventDefault(){t&&(n=!0)}})}var yu=class extends Cn{constructor(e){super(e);const t=(r,i)=>r.map(({id:s})=>s).join("")===i.map(({id:s})=>s).join("");let n=[];this.destroy=$n(()=>{const{dragOperation:r,collisionObserver:i}=e;r.status.initializing&&(n=[],i.enable())},()=>{const{collisionObserver:r,monitor:i}=e,{collisions:s}=r;if(r.isDisabled()||Sr.pendingIdChanges)return;const o=Zn({collisions:s});if(i.dispatch("collision",o),o.defaultPrevented||t(s,n))return;n=s;const[a]=s;T(()=>{var c;a?.id!==((c=e.dragOperation.target)==null?void 0:c.id)&&(r.disable(),e.actions.setDropTarget(a?.id).then(()=>{r.enable()}))})})}},Nt=(e=>(e[e.Lowest=0]="Lowest",e[e.Low=1]="Low",e[e.Normal=2]="Normal",e[e.High=3]="High",e[e.Highest=4]="Highest",e))(Nt||{}),Wt=(e=>(e[e.Collision=0]="Collision",e[e.ShapeIntersection=1]="ShapeIntersection",e[e.PointerIntersection=2]="PointerIntersection",e))(Wt||{}),Ia,ja,Ma,Ta,Aa,Ra,_u=[I],he,os;Ra=[Y],Aa=[Y],Ta=[Y],Ma=[Y],ja=[Y],Ia=[Y];var Ie=class{constructor(){P(he,5,this),R(this,os,P(he,8,this,"idle")),P(he,11,this)}get current(){return this.value}get idle(){return this.value==="idle"}get initializing(){return this.value==="initializing"}get initialized(){const{value:e}=this;return e!=="idle"&&e!=="initialization-pending"}get dragging(){return this.value==="dragging"}get dropped(){return this.value==="dropped"}set(e){this.value=e}};he=Rt(null);os=new WeakMap;j(he,4,"value",_u,Ie,os);j(he,2,"current",Ra,Ie);j(he,2,"idle",Aa,Ie);j(he,2,"initializing",Ta,Ie);j(he,2,"initialized",Ma,Ie);j(he,2,"dragging",ja,Ie);j(he,2,"dropped",Ia,Ie);st(he,Ie);var bu=class{constructor(e){this.manager=e}setDragSource(e){const{dragOperation:t}=this.manager;t.sourceIdentifier=typeof e=="string"||typeof e=="number"?e:e.id}setDropTarget(e){return T(()=>{const{dragOperation:t}=this.manager,n=e??null;if(t.targetIdentifier===n)return Promise.resolve(!1);t.targetIdentifier=n;const r=Zn({operation:t.snapshot()});return t.status.dragging&&this.manager.monitor.dispatch("dragover",r),this.manager.renderer.rendering.then(()=>r.defaultPrevented)})}start(e){return T(()=>{const{dragOperation:t}=this.manager;if(e.source!=null&&this.setDragSource(e.source),!t.source)throw new Error("Cannot start a drag operation without a drag source");if(!t.status.idle)throw new Error("Cannot start a drag operation while another is active");const n=new AbortController,{event:r,coordinates:i}=e;U(()=>{t.status.set("initialization-pending"),t.shape=null,t.canceled=!1,t.activatorEvent=r??null,t.position.reset(i)});const s=Zn({operation:t.snapshot()});return this.manager.monitor.dispatch("beforedragstart",s),s.defaultPrevented?(t.reset(),n.abort(),n):(t.status.set("initializing"),t.controller=n,this.manager.renderer.rendering.then(()=>{if(n.signal.aborted)return;const{status:o}=t;o.current==="initializing"&&U(()=>{t.status.set("dragging"),this.manager.monitor.dispatch("dragstart",{nativeEvent:r,operation:t.snapshot(),cancelable:!1})})}),n)})}move(e){return T(()=>{var t,n;const{dragOperation:r}=this.manager,{status:i,controller:s}=r;if(!i.dragging||!s||s.signal.aborted)return;const o=Zn({nativeEvent:e.event,operation:r.snapshot(),by:e.by,to:e.to},(t=e.cancelable)!=null?t:!0);((n=e.propagate)==null||n)&&this.manager.monitor.dispatch("dragmove",o),queueMicrotask(()=>{var a,c,u,d,l;if(o.defaultPrevented)return;const f=(l=e.to)!=null?l:{x:r.position.current.x+((c=(a=e.by)==null?void 0:a.x)!=null?c:0),y:r.position.current.y+((d=(u=e.by)==null?void 0:u.y)!=null?d:0)};r.position.current=f})})}stop(e={}){return T(()=>{var t,n;const{dragOperation:r}=this.manager,{controller:i}=r;if(!i||i.signal.aborted)return;let s;const o=()=>{const c={resume:()=>{},abort:()=>{}};return s=new Promise((u,d)=>{c.resume=u,c.abort=d}),c};i.abort();const a=()=>{this.manager.renderer.rendering.then(()=>{r.status.set("dropped");const c=T(()=>{var d;return((d=r.source)==null?void 0:d.status)==="dropping"}),u=()=>{r.controller===i&&(r.controller=void 0),r.reset()};if(c){const{source:d}=r,l=pe(()=>{d?.status==="idle"&&(l(),u())})}else this.manager.renderer.rendering.then(u)})};r.canceled=(t=e.canceled)!=null?t:!1,this.manager.monitor.dispatch("dragend",{nativeEvent:e.event,operation:r.snapshot(),canceled:(n=e.canceled)!=null?n:!1,suspend:o}),s?s.then(a).catch(()=>r.reset()):a()})}},Et=class extends Q{constructor(e,t){super(e,t),this.manager=e,this.options=t}},wu=class extends AbortController{constructor(e,t){super(),this.constraints=e,this.onActivate=t,this.activated=!1;for(const n of e??[])n.controller=this}onEvent(e){var t;if(!this.activated)if((t=this.constraints)!=null&&t.length)for(const n of this.constraints)n.onEvent(e);else this.activate(e)}activate(e){this.activated||(this.activated=!0,this.onActivate(e))}abort(e){this.activated=!1,super.abort(e)}},Qn,Na=class{constructor(e){this.options=e,R(this,Qn)}set controller(e){ae(this,Qn,e),e.signal.addEventListener("abort",()=>this.abort())}activate(e){var t;(t=X(this,Qn))==null||t.activate(e)}};Qn=new WeakMap;var go=class extends Q{constructor(e,t){super(e,t),this.manager=e,this.options=t}apply(e){return e.transform}},xu=class{constructor(e){this.draggables=new po,this.droppables=new po,this.plugins=new Vr(e),this.sensors=new Vr(e),this.modifiers=new Vr(e)}register(e,t){if(e instanceof Ee)return this.draggables.register(e.id,e);if(e instanceof ke)return this.droppables.register(e.id,e);if(e.prototype instanceof go)return this.modifiers.register(e,t);if(e.prototype instanceof Et)return this.sensors.register(e,t);if(e.prototype instanceof Q)return this.plugins.register(e,t);throw new Error("Invalid instance type")}unregister(e){if(e instanceof Sr)return e instanceof Ee?this.draggables.unregister(e.id,e):e instanceof ke?this.droppables.unregister(e.id,e):()=>{};if(e.prototype instanceof go)return this.modifiers.unregister(e);if(e.prototype instanceof Et)return this.sensors.unregister(e);if(e.prototype instanceof Q)return this.plugins.unregister(e);throw new Error("Invalid instance type")}destroy(){this.draggables.destroy(),this.droppables.destroy(),this.plugins.destroy(),this.sensors.destroy(),this.modifiers.destroy()}},Wa,La,za,Fa,Va,Ua,Xa,Ya,Su=[Y],Zt,er,pt,V,as,ls,cs,us,ds,Qt;Ya=[I],Xa=[I],Ua=[I],Va=[I],Fa=[I],za=[Y],La=[Y],Wa=[Y];var be=class{constructor(e){P(V,5,this),R(this,Zt),R(this,er),R(this,pt,new it(void 0,(t,n)=>t&&n?t.equals(n):t===n)),this.status=new Ie,R(this,as,P(V,8,this,!1)),P(V,11,this),R(this,ls,P(V,12,this,null)),P(V,15,this),R(this,cs,P(V,16,this,null)),P(V,19,this),R(this,us,P(V,20,this,null)),P(V,23,this),R(this,ds,P(V,24,this,[])),P(V,27,this),this.position=new xr({x:0,y:0}),R(this,Qt,{x:0,y:0}),ae(this,Zt,e)}get shape(){const{current:e,initial:t,previous:n}=X(this,pt);return!e||!t?null:{current:e,initial:t,previous:n}}set shape(e){e?X(this,pt).current=e:X(this,pt).reset()}get source(){var e;const t=this.sourceIdentifier;if(t==null)return null;const n=X(this,Zt).registry.draggables.get(t);return n&&ae(this,er,n),(e=n??X(this,er))!=null?e:null}get target(){var e;const t=this.targetIdentifier;return t!=null&&(e=X(this,Zt).registry.droppables.get(t))!=null?e:null}get transform(){const{x:e,y:t}=this.position.delta;let n={x:e,y:t};for(const r of this.modifiers)n=r.apply(Yi(Xi({},this.snapshot()),{transform:n}));return ae(this,Qt,n),n}snapshot(){return T(()=>({source:this.source,target:this.target,activatorEvent:this.activatorEvent,transform:X(this,Qt),shape:this.shape?Fr(this.shape):null,position:Fr(this.position),status:Fr(this.status),canceled:this.canceled}))}reset(){U(()=>{this.status.set("idle"),this.sourceIdentifier=null,this.targetIdentifier=null,X(this,pt).reset(),this.position.reset({x:0,y:0}),ae(this,Qt,{x:0,y:0}),this.modifiers=[]})}};V=Rt(null);Zt=new WeakMap;er=new WeakMap;pt=new WeakMap;as=new WeakMap;ls=new WeakMap;cs=new WeakMap;us=new WeakMap;ds=new WeakMap;Qt=new WeakMap;j(V,2,"shape",Su,be);j(V,4,"canceled",Ya,be,as);j(V,4,"activatorEvent",Xa,be,ls);j(V,4,"sourceIdentifier",Ua,be,cs);j(V,4,"targetIdentifier",Va,be,us);j(V,4,"modifiers",Fa,be,ds);j(V,2,"source",za,be);j(V,2,"target",La,be);j(V,2,"transform",Wa,be);st(V,be);var Eu={get rendering(){return Promise.resolve()}};function _e(e,t){return typeof e=="function"?e(t):e??t}var ku=class{constructor(e){this.destroy=()=>{this.dragOperation.status.idle||this.actions.stop({canceled:!0}),this.dragOperation.modifiers.forEach(l=>l.destroy()),this.registry.destroy(),this.collisionObserver.destroy()};var t;const n=e??{},r=_e(n.plugins,[]),i=_e(n.sensors,[]),s=_e(n.modifiers,[]),o=(t=n.renderer)!=null?t:Eu,a=new mu(this),c=new xu(this);this.registry=c,this.monitor=a,this.renderer=o,this.actions=new bu(this),this.dragOperation=new be(this),this.collisionObserver=new pu(this),this.plugins=[yu,...r],this.modifiers=s,this.sensors=i;const{destroy:u}=this,d=$n(()=>{var l,f,g;const y=T(()=>this.dragOperation.modifiers),b=this.modifiers;for(const x of y)b.includes(x)||x.destroy();this.dragOperation.modifiers=(g=(f=(l=this.dragOperation.source)==null?void 0:l.modifiers)==null?void 0:f.map(x=>{const{plugin:_,options:v}=yn(x);return new _(this,v)}))!=null?g:b});this.destroy=()=>{d(),u()}}get plugins(){return this.registry.plugins.values}set plugins(e){this.registry.plugins.values=e}get modifiers(){return this.registry.modifiers.values}set modifiers(e){this.registry.modifiers.values=e}get sensors(){return this.registry.sensors.values}set sensors(e){this.registry.sensors.values=e}},Ha=e=>{throw TypeError(e)},fs=(e,t,n)=>t.has(e)||Ha("Cannot "+n),D=(e,t,n)=>(fs(e,t,"read from private field"),t.get(e)),ie=(e,t,n)=>t.has(e)?Ha("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),oe=(e,t,n,r)=>(fs(e,t,"write to private field"),t.set(e,n),n),qa=(e,t,n)=>(fs(e,t,"access private method"),n);function Er(e){return e?e instanceof KeyframeEffect?!0:"getKeyframes"in e&&typeof e.getKeyframes=="function":!1}function Ba(e,t){const n=e.getAnimations();let r=null;for(const i of n){if(i.playState!=="running")continue;const{effect:s}=i,o=(Er(s)?s.getKeyframes():[]).filter(t);o.length>0&&(r=[o[o.length-1],i])}return r}function kr(e){const{width:t,height:n,top:r,left:i,bottom:s,right:o}=e.getBoundingClientRect();return{width:t,height:n,top:r,left:i,bottom:s,right:o}}function hs(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function In(e){return"nodeType"in e}function le(e){var t,n,r;return e?hs(e)?e:In(e)?"defaultView"in e?(t=e.defaultView)!=null?t:window:(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window:window:window}function ps(e){const{Document:t}=le(e);return e instanceof t||"nodeType"in e&&e.nodeType===Node.DOCUMENT_NODE}function Ve(e){return!e||hs(e)?!1:e instanceof le(e).HTMLElement||"namespaceURI"in e&&typeof e.namespaceURI=="string"&&e.namespaceURI.endsWith("html")}function Ga(e){return e instanceof le(e).SVGElement||"namespaceURI"in e&&typeof e.namespaceURI=="string"&&e.namespaceURI.endsWith("svg")}function Lt(e){return e?hs(e)?e.document:In(e)?ps(e)?e:Ve(e)||Ga(e)?e.ownerDocument:document:document:document}function Ou(e){var t,n,r,i;const{documentElement:s}=Lt(e),o=le(e).visualViewport,a=(t=o?.width)!=null?t:s.clientWidth,c=(n=o?.height)!=null?n:s.clientHeight,u=(r=o?.offsetTop)!=null?r:0,d=(i=o?.offsetLeft)!=null?i:0;return{top:u,left:d,right:d+a,bottom:u+c,width:a,height:c}}function $u(e,t){if(Du(e)&&e.open===!1)return!1;const{overflow:n,overflowX:r,overflowY:i}=getComputedStyle(e);return n==="visible"&&r==="visible"&&i==="visible"}function Du(e){return e.tagName==="DETAILS"}function bn(e,t=e.getBoundingClientRect(),n=0){var r,i,s,o,a;let c=t;const{ownerDocument:u}=e,d=(r=u.defaultView)!=null?r:window;let l=e.parentElement;for(;l&&l!==u.documentElement;){if(!$u(l)){const h=l.getBoundingClientRect(),p=n*(h.bottom-h.top),m=n*(h.right-h.left),S=n*(h.bottom-h.top),E=n*(h.right-h.left);c={top:Math.max(c.top,h.top-p),right:Math.min(c.right,h.right+m),bottom:Math.min(c.bottom,h.bottom+S),left:Math.max(c.left,h.left-E),width:0,height:0},c.width=c.right-c.left,c.height=c.bottom-c.top}l=l.parentElement}const f=d.visualViewport,g=(i=f?.offsetTop)!=null?i:0,y=(s=f?.offsetLeft)!=null?s:0,b=(o=f?.width)!=null?o:d.innerWidth,x=(a=f?.height)!=null?a:d.innerHeight,_=n*x,v=n*b;return c={top:Math.max(c.top,g-_),right:Math.min(c.right,y+b+v),bottom:Math.min(c.bottom,g+x+_),left:Math.max(c.left,y-v),width:0,height:0},c.width=c.right-c.left,c.height=c.bottom-c.top,c.width<0&&(c.width=0),c.height<0&&(c.height=0),c}function kt(e){return{x:e.clientX,y:e.clientY}}var Ka=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function pi(e=document,t=new Set){if(t.has(e))return[];t.add(e);const n=[e];for(const r of Array.from(e.querySelectorAll("iframe, frame")))try{const i=r.contentDocument;i&&!t.has(i)&&n.push(...pi(i,t))}catch{}try{const r=e.defaultView;if(r&&r!==window.top){const i=r.parent;i&&i.document&&i.document!==e&&n.push(...pi(i.document,t))}}catch{}return n}function gs(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Ja(){var e,t;const n=gs()?window.visualViewport:null;return{x:(e=n?.offsetLeft)!=null?e:0,y:(t=n?.offsetTop)!=null?t:0}}function vs(e){return!e||!In(e)?!1:e instanceof le(e).ShadowRoot}function cr(e){if(e&&In(e)){let t=e.getRootNode();if(vs(t))return t;if(t instanceof Document)return t}return Lt(e)}function ms(e){return e.matchMedia("(prefers-reduced-motion: reduce)").matches}function Pu(e){const t="input, textarea, select, canvas, [contenteditable]",n=e.cloneNode(!0),r=Array.from(e.querySelectorAll(t));return Array.from(n.querySelectorAll(t)).forEach((i,s)=>{const o=r[s];vo(i)&&vo(o)&&(i.type!=="file"&&(i.value=o.value),i.type==="radio"&&i.name&&(i.name=`Cloned__${i.name}`)),mo(i)&&mo(o)&&o.width>0&&o.height>0&&i.getContext("2d")?.drawImage(o,0,0)}),n}function vo(e){return"value"in e}function mo(e){return e.tagName==="CANVAS"}function Za(e,{x:t,y:n}){const r=e.elementFromPoint(t,n);if(Cu(r)){const{contentDocument:i}=r;if(i){const{left:s,top:o}=r.getBoundingClientRect();return Za(i,{x:t-s,y:n-o})}}return r}function Cu(e){return e?.tagName==="IFRAME"}var gi=new WeakMap;function Iu(e){return!!e.closest(` - input:not([disabled]), - select:not([disabled]), - textarea:not([disabled]), - button:not([disabled]), - a[href], - [contenteditable]:not([contenteditable="false"]) - `)}var Qa=class{constructor(){this.entries=new Set,this.clear=()=>{for(const e of this.entries){const[t,{type:n,listener:r,options:i}]=e;t.removeEventListener(n,r,i)}this.entries.clear()}}bind(e,t){const n=Array.isArray(e)?e:[e],r=Array.isArray(t)?t:[t],i=[];for(const o of n)for(const a of r){const{type:c,listener:u,options:d}=a,l=[o,a];o.addEventListener(c,u,d),this.entries.add(l),i.push(l)}const s=this.entries;return function(){for(const a of i){const[c,{type:u,listener:d,options:l}]=a;c.removeEventListener(u,d,l),s.delete(a)}}}};function Ot(e){const t=e?.ownerDocument.defaultView;if(t&&t.self!==t.parent)return t.frameElement}function ju(e){const t=new Set;let n=Ot(e);for(;n;)t.add(n),n=Ot(n);return t}function Mu(e,t){const n=setTimeout(e,t);return()=>clearTimeout(n)}function el(e,t){const n=()=>performance.now();let r,i;return function(...s){const o=this;i?(r?.(),r=Mu(()=>{e.apply(o,s),i=n()},t-(n()-i))):(e.apply(o,s),i=n())}}function Tu(e,t){return e===t?!0:!e||!t?!1:e.top==t.top&&e.left==t.left&&e.right==t.right&&e.bottom==t.bottom}function Au(e,t=e.getBoundingClientRect()){const{width:n,height:r}=bn(e,t);return n>0&&r>0}var Ru=Ka?ResizeObserver:class{observe(){}unobserve(){}disconnect(){}},tr,Nu=class extends Ru{constructor(e){super(t=>{if(!D(this,tr)){oe(this,tr,!0);return}e(t,this)}),ie(this,tr,!1)}};tr=new WeakMap;var yo=Array.from({length:100},(e,t)=>t/100),tl=75,Ge,ur,Me,Ke,en,J,hn,tn,dr,nl,rl,il=class{constructor(e,t,n={debug:!1,skipInitial:!1}){this.element=e,this.callback=t,ie(this,dr),this.disconnect=()=>{var s,o,a;oe(this,hn,!0),(s=D(this,Me))==null||s.disconnect(),(o=D(this,Ke))==null||o.disconnect(),D(this,en).disconnect(),(a=D(this,J))==null||a.remove()},ie(this,Ge,!0),ie(this,ur),ie(this,Me),ie(this,Ke),ie(this,en),ie(this,J),ie(this,hn,!1),ie(this,tn,el(()=>{var s,o,a;const{element:c}=this;if((s=D(this,Ke))==null||s.disconnect(),D(this,hn)||!D(this,Ge)||!c.isConnected)return;const u=(o=c.ownerDocument)!=null?o:document,{innerHeight:d,innerWidth:l}=(a=u.defaultView)!=null?a:window,f=c.getBoundingClientRect(),{top:g,left:y,bottom:b,right:x}=bn(c,f),_=-Math.floor(g),v=-Math.floor(y),h=`${_}px ${-Math.floor(l-x)}px ${-Math.floor(d-b)}px ${v}px`;this.boundingClientRect=f,oe(this,Ke,new IntersectionObserver(p=>{const[m]=p,{intersectionRect:S}=m;(m.intersectionRatio!==1?m.intersectionRatio:Se.intersectionRatio(S,bn(c)))!==1&&D(this,tn).call(this)},{threshold:yo,rootMargin:h,root:u})),D(this,Ke).observe(c),qa(this,dr,nl).call(this)},tl)),this.boundingClientRect=e.getBoundingClientRect(),oe(this,Ge,Au(e,this.boundingClientRect));let r=!0;this.callback=s=>{r&&(r=!1,n.skipInitial)||t(s)};const i=e.ownerDocument;n?.debug&&(oe(this,J,document.createElement("div")),D(this,J).style.background="rgba(0,0,0,0.15)",D(this,J).style.position="fixed",D(this,J).style.pointerEvents="none",i.body.appendChild(D(this,J))),oe(this,en,new IntersectionObserver(s=>{var o,a;const{boundingClientRect:c,isIntersecting:u}=s[s.length-1],{width:d,height:l}=c,f=D(this,Ge);oe(this,Ge,u),!(!d&&!l)&&(f&&!u?((o=D(this,Ke))==null||o.disconnect(),this.callback(null),(a=D(this,Me))==null||a.disconnect(),oe(this,Me,void 0),D(this,J)&&(D(this,J).style.visibility="hidden")):D(this,tn).call(this),u&&!D(this,Me)&&(oe(this,Me,new Nu(D(this,tn))),D(this,Me).observe(e)))},{threshold:yo,root:i})),D(this,Ge)&&!n.skipInitial&&this.callback(this.boundingClientRect),D(this,en).observe(e)}};Ge=new WeakMap;ur=new WeakMap;Me=new WeakMap;Ke=new WeakMap;en=new WeakMap;J=new WeakMap;hn=new WeakMap;tn=new WeakMap;dr=new WeakSet;nl=function(){D(this,hn)||(qa(this,dr,rl).call(this),!Tu(this.boundingClientRect,D(this,ur))&&(this.callback(this.boundingClientRect),oe(this,ur,this.boundingClientRect)))};rl=function(){if(D(this,J)){const{top:e,left:t,width:n,height:r}=bn(this.element);D(this,J).style.overflow="hidden",D(this,J).style.visibility="visible",D(this,J).style.top=`${Math.floor(e)}px`,D(this,J).style.left=`${Math.floor(t)}px`,D(this,J).style.width=`${Math.floor(n)}px`,D(this,J).style.height=`${Math.floor(r)}px`}};var Vn=new WeakMap,Un=new WeakMap;function Wu(e,t){let n=Vn.get(e);return n||(n={disconnect:new il(e,r=>{const i=Vn.get(e);i&&i.callbacks.forEach(s=>s(r))},{skipInitial:!0}).disconnect,callbacks:new Set}),n.callbacks.add(t),Vn.set(e,n),()=>{n.callbacks.delete(t),n.callbacks.size===0&&(Vn.delete(e),n.disconnect())}}function Lu(e,t){const n=new Set;for(const r of e){const i=Wu(r,t);n.add(i)}return()=>n.forEach(r=>r())}function zu(e,t){var n;const r=e.ownerDocument;if(!Un.has(r)){const o=new AbortController,a=new Set;document.addEventListener("scroll",c=>a.forEach(u=>u(c)),{capture:!0,passive:!0,signal:o.signal}),Un.set(r,{disconnect:()=>o.abort(),listeners:a})}const{listeners:i,disconnect:s}=(n=Un.get(r))!=null?n:{};return!i||!s?()=>{}:(i.add(t),()=>{i.delete(t),i.size===0&&(s(),Un.delete(r))})}var nn,rn,nr,vi,Fu=class{constructor(e,t,n){this.callback=t,ie(this,nn),ie(this,rn,!1),ie(this,nr),ie(this,vi,el(o=>{if(!D(this,rn)&&o.target&&"contains"in o.target&&typeof o.target.contains=="function"){for(const a of D(this,nr))if(o.target.contains(a)){this.callback(D(this,nn).boundingClientRect);break}}},tl));const r=ju(e),i=Lu(r,t),s=zu(e,D(this,vi));oe(this,nr,r),oe(this,nn,new il(e,t,n)),this.disconnect=()=>{D(this,rn)||(oe(this,rn,!0),i(),s(),D(this,nn).disconnect())}}};nn=new WeakMap;rn=new WeakMap;nr=new WeakMap;vi=new WeakMap;function mi(e){return"showPopover"in e&&"hidePopover"in e&&typeof e.showPopover=="function"&&typeof e.hidePopover=="function"}function wt(e){try{mi(e)&&e.isConnected&&e.hasAttribute("popover")&&!e.matches(":popover-open")&&e.showPopover()}catch{}}function _o(e){return!Ka||!e?!1:e===Lt(e).scrollingElement}function sl(e){var t,n;const r=le(e),i=_o(e)?Ou(e):kr(e),s=r.visualViewport,o=_o(e)?{height:(t=s?.height)!=null?t:r.innerHeight,width:(n=s?.width)!=null?n:r.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={current:{x:e.scrollLeft,y:e.scrollTop},max:{x:e.scrollWidth-o.width,y:e.scrollHeight-o.height}};return{rect:i,position:a,isTop:a.current.y<=0,isLeft:a.current.x<=0,isBottom:a.current.y>=a.max.y,isRight:a.current.x>=a.max.x}}function Vu(e,t){const{isTop:n,isBottom:r,isLeft:i,isRight:s,position:o}=sl(e),{x:a,y:c}=t??{x:0,y:0},u=!n&&o.current.y+c>0,d=!r&&o.current.y+c0,f=!s&&o.current.x+a{const{tasks:t,resolvers:n}=this;this.pending=!1,this.tasks=new Set,this.resolvers=new Set;for(const r of t)r();for(const r of n)r()}}schedule(e){return this.tasks.add(e),this.pending||(this.pending=!0,this.scheduler(this.flush)),new Promise(t=>this.resolvers.add(t))}},fr=new ys(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(e):e()}),Uu=new ys(e=>setTimeout(e,50)),hr=new Map,Xu=hr.clear.bind(hr);function Oe(e,t=!1){if(!t)return bo(e);let n=hr.get(e);return n||(n=bo(e),hr.set(e,n),Uu.schedule(Xu),n)}function bo(e){return le(e).getComputedStyle(e)}function Yu(e,t=Oe(e,!0)){return t.position==="fixed"||t.position==="sticky"}function Hu(e,t=Oe(e,!0)){const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{const i=t[r];return typeof i=="string"?n.test(i):!1})}var qu={excludeElement:!0,escapeShadowDOM:!0};function yi(e,t=qu){const{limit:n,excludeElement:r,escapeShadowDOM:i}=t,s=new Set;function o(a){if(n!=null&&s.size>=n||!a)return s;if(ps(a)&&a.scrollingElement!=null&&!s.has(a.scrollingElement))return s.add(a.scrollingElement),s;if(i&&vs(a))return o(a.host);if(!Ve(a))return Ga(a)?o(a.parentElement):s;if(s.has(a))return s;const c=Oe(a,!0);if(r&&a===e||Hu(a,c)&&s.add(a),Yu(a,c)){const{scrollingElement:u}=a.ownerDocument;return u&&s.add(u),s}return o(a.parentNode)}return e?o(e):s}function $t(e,t=window.frameElement){const n={x:0,y:0,scaleX:1,scaleY:1};if(!e)return n;let r=Ot(e);for(;r;){if(r===t)return n;const i=kr(r),{x:s,y:o}=Bu(r,i);n.x=n.x+i.left,n.y=n.y+i.top,n.scaleX=n.scaleX*s,n.scaleY=n.scaleY*o,r=Ot(r)}return n}function Bu(e,t=kr(e)){const n=Math.round(t.width),r=Math.round(t.height);if(Ve(e))return{x:n/e.offsetWidth,y:r/e.offsetHeight};const i=Oe(e,!0);return{x:(parseFloat(i.width)||n)/n,y:(parseFloat(i.height)||r)/r}}function Gu(e){if(e==="none")return null;const t=e.split(" "),n=parseFloat(t[0]),r=parseFloat(t[1]);return isNaN(n)&&isNaN(r)?null:{x:isNaN(n)?r:n,y:isNaN(r)?n:r}}function wn(e){if(e==="none")return null;const[t,n,r="0"]=e.split(" "),i={x:parseFloat(t),y:parseFloat(n),z:parseInt(r,10)};return isNaN(i.x)&&isNaN(i.y)?null:{x:isNaN(i.x)?0:i.x,y:isNaN(i.y)?0:i.y,z:isNaN(i.z)?0:i.z}}function Or(e){var t,n,r,i,s,o,a,c,u;const{scale:d,transform:l,translate:f}=e,g=Gu(d),y=wn(f),b=Ku(l);if(!b&&!g&&!y)return null;const x={x:(t=g?.x)!=null?t:1,y:(n=g?.y)!=null?n:1},_={x:(r=y?.x)!=null?r:0,y:(i=y?.y)!=null?i:0},v={x:(s=b?.x)!=null?s:0,y:(o=b?.y)!=null?o:0,scaleX:(a=b?.scaleX)!=null?a:1,scaleY:(c=b?.scaleY)!=null?c:1};return{x:_.x+v.x,y:_.y+v.y,z:(u=y?.z)!=null?u:0,scaleX:x.x*v.scaleX,scaleY:x.y*v.scaleY}}function Ku(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}var fe=(e=>(e[e.Idle=0]="Idle",e[e.Forward=1]="Forward",e[e.Reverse=-1]="Reverse",e))(fe||{}),Ju={x:.2,y:.2},Zu={x:10,y:10};function Qu(e,t,n,r=25,i=Ju,s=Zu){const{x:o,y:a}=t,{rect:c,isTop:u,isBottom:d,isLeft:l,isRight:f}=sl(e),g=$t(e),y=Or(Oe(e,!0)),b=y!==null?y?.scaleX<0:!1,x=y!==null?y?.scaleY<0:!1,_=new Se(c.left*g.scaleX+g.x,c.top*g.scaleY+g.y,c.width*g.scaleX,c.height*g.scaleY),v={x:0,y:0},h={x:0,y:0},p={height:_.height*i.y,width:_.width*i.x};return p.height>0&&(!u||x&&!d)&&a<=_.top+p.height&&n?.y!==1&&o>=_.left-s.x&&o<=_.right+s.x?(v.y=x?1:-1,h.y=r*Math.abs((_.top+p.height-a)/p.height)):p.height>0&&(!d||x&&!u)&&a>=_.bottom-p.height&&n?.y!==-1&&o>=_.left-s.x&&o<=_.right+s.x&&(v.y=x?-1:1,h.y=r*Math.abs((_.bottom-p.height-a)/p.height)),p.width>0&&(!f||b&&!l)&&o>=_.right-p.width&&n?.x!==-1&&a>=_.top-s.y&&a<=_.bottom+s.y?(v.x=b?-1:1,h.x=r*Math.abs((_.right-p.width-o)/p.width)):p.width>0&&(!l||b&&!f)&&o<=_.left+p.width&&n?.x!==1&&a>=_.top-s.y&&a<=_.bottom+s.y&&(v.x=b?1:-1,h.x=r*Math.abs((_.left+p.width-o)/p.width)),{direction:v,speed:h}}function ol(e,{block:t="nearest",inline:n="nearest"}={}){if(!Ve(e))return;const r=yi(e),i=[];for(const s of r){if(!Ve(s))continue;const{top:o,left:a}=ed(e,s);let c=o,u=a;for(const d of i)c-=d.scrollTop,u-=d.scrollLeft;if(t!=="none"){const d=cs.scrollTop+s.clientHeight&&(t==="center"?s.scrollTop=c-s.clientHeight/2+e.offsetHeight/2:d?s.scrollTop=c:s.scrollTop=c+e.offsetHeight-s.clientHeight)}if(n!=="none"){const d=us.scrollLeft+s.clientWidth&&(n==="center"?s.scrollLeft=u-s.clientWidth/2+e.offsetWidth/2:d?s.scrollLeft=u:s.scrollLeft=u+e.offsetWidth-s.clientWidth)}i.push(s)}}function wo(e){let t=0,n=0,r=e;for(;r;){t+=r.offsetTop,n+=r.offsetLeft;const i=r.offsetParent;if(!Ve(i))break;t+=i.clientTop,n+=i.clientLeft,r=i}return{top:t,left:n}}function ed(e,t){const n=wo(e),r=wo(t);return{top:n.top-r.top-t.clientTop,left:n.left-r.left-t.clientLeft}}function td(e,t,n){const{scaleX:r,scaleY:i,x:s,y:o}=t,a=e.left+s+(1-r)*parseFloat(n),c=e.top+o+(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=r?e.width*r:e.width,d=i?e.height*i:e.height;return{width:u,height:d,top:c,right:a+u,bottom:c+d,left:a}}function nd(e,t,n){const{scaleX:r,scaleY:i,x:s,y:o}=t,a=e.left-s-(1-r)*parseFloat(n),c=e.top-o-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=r?e.width/r:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:c,right:a+u,bottom:c+d,left:a}}function al({element:e,keyframes:t,options:n}){return e.animate(t,n).finished}function xo(e,t=Oe(e).translate,n=!0){if(n){const r=Ba(e,i=>"translate"in i);if(r){const{translate:i=""}=r[0];if(typeof i=="string"){const s=wn(i);if(s)return s}}}if(t){const r=wn(t);if(r)return r}return{x:0,y:0,z:0}}var rd=new ys(e=>setTimeout(e,0)),pn=new Map,id=pn.clear.bind(pn);function sd(e){const t=e.ownerDocument;let n=pn.get(t);if(n)return n;n=t.getAnimations(),pn.set(t,n),rd.schedule(id);const r=n.filter(i=>Er(i.effect)&&i.effect.target===e);return pn.set(e,r),n}function od(e,t){const n=sd(e).filter(r=>{var i,s;if(Er(r.effect)){const{target:o}=r.effect;if((s=o&&((i=t.isValidTarget)==null?void 0:i.call(t,o)))==null||s)return r.effect.getKeyframes().some(a=>{for(const c of t.properties)if(a[c])return!0})}}).map(r=>{const{effect:i,currentTime:s}=r,o=i?.getComputedTiming().duration;if(!(r.pending||r.playState==="finished")&&typeof o=="number"&&typeof s=="number"&&s{r.currentTime=s}});if(n.length>0)return()=>n.forEach(r=>r?.())}var xe=class extends Se{constructor(e,t={}){var n,r,i,s;const{frameTransform:o=$t(e),ignoreTransforms:a,getBoundingClientRect:c=kr}=t,u=od(e,{properties:["transform","translate","scale","width","height"],isValidTarget:m=>(m!==e||gs())&&m.contains(e)}),d=c(e);let{top:l,left:f,width:g,height:y}=d,b;const x=Oe(e),_=Or(x),v={x:(n=_?.scaleX)!=null?n:1,y:(r=_?.scaleY)!=null?r:1},h=ad(e,x);u?.(),_&&(b=nd(d,_,x.transformOrigin),(a||h)&&(l=b.top,f=b.left,g=b.width,y=b.height));const p={width:(i=b?.width)!=null?i:g,height:(s=b?.height)!=null?s:y};if(h&&!a&&b){const m=td(b,h,x.transformOrigin);l=m.top,f=m.left,g=m.width,y=m.height,v.x=h.scaleX,v.y=h.scaleY}o&&(a||(f*=o.scaleX,g*=o.scaleX,l*=o.scaleY,y*=o.scaleY),f+=o.x,l+=o.y),super(f,l,g,y),this.scale=v,this.intrinsicWidth=p.width,this.intrinsicHeight=p.height}};function ad(e,t){const n=e.getAnimations();if(!n.length)return null;let r,i,s,o=!1;for(const a of n){if(a.playState!=="running")continue;const c=Er(a.effect)?a.effect.getKeyframes():[],u=c[c.length-1];if(!u)continue;const{transform:d,translate:l,scale:f}=u;typeof d=="string"&&d&&(r=d,o=!0),typeof l=="string"&&l&&(i=l,o=!0),typeof f=="string"&&f&&(s=f,o=!0)}return o?Or({transform:r??t.transform,translate:i??t.translate,scale:s??t.scale}):null}function gn(e){return"style"in e&&typeof e.style=="object"&&e.style!==null&&"setProperty"in e.style&&"removeProperty"in e.style&&typeof e.style.setProperty=="function"&&typeof e.style.removeProperty=="function"}var ld=class{constructor(e){this.element=e,this.initial=new Map}set(e,t=""){const{element:n}=this;if(gn(n))for(const[r,i]of Object.entries(e)){const s=`${t}${r}`;this.initial.has(s)||this.initial.set(s,n.style.getPropertyValue(s)),n.style.setProperty(s,typeof i=="string"?i:`${i}px`)}}remove(e,t=""){const{element:n}=this;if(gn(n))for(const r of e){const i=`${t}${r}`;n.style.removeProperty(i)}}reset(){const{element:e}=this;if(gn(e)){for(const[t,n]of this.initial)e.style.setProperty(t,n);e.getAttribute("style")===""&&e.removeAttribute("style")}}};function tt(e){return e?e instanceof le(e).Element||In(e)&&e.nodeType===Node.ELEMENT_NODE:!1}function xn(e){if(!e)return!1;const{KeyboardEvent:t}=le(e.target);return e instanceof t}function cd(e){if(!e)return!1;const{PointerEvent:t}=le(e.target);return e instanceof t}function ud(e){if(!tt(e))return!1;const{tagName:t}=e;return t==="INPUT"||t==="TEXTAREA"||dd(e)}function dd(e){return e.hasAttribute("contenteditable")&&e.getAttribute("contenteditable")!=="false"}var Ur={};function _i(e){const t=Ur[e]==null?0:Ur[e]+1;return Ur[e]=t,`${e}-${t}`}var fd=({dragOperation:e,droppable:t})=>{const n=e.position.current;if(!n)return null;const{id:r}=t;return t.shape&&t.shape.containsPoint(n)?{id:r,value:1/de.distance(t.shape.center,n),type:Wt.PointerIntersection,priority:Nt.High}:null},hd=({dragOperation:e,droppable:t})=>{const{shape:n}=e;if(!t.shape||!n?.current)return null;const r=n.current.intersectionArea(t.shape);if(r){const{position:i}=e,s=de.distance(t.shape.center,i.current),o=r/(n.current.area+t.shape.area-r)/s;return{id:t.id,value:o,type:Wt.ShapeIntersection,priority:Nt.Normal}}return null},ll=e=>{var t;return(t=fd(e))!=null?t:hd(e)},pd=e=>{const{dragOperation:t,droppable:n}=e,{shape:r,position:i}=t;if(!n.shape)return null;const s=r?Se.from(r.current.boundingRectangle).corners:void 0,o=Se.from(n.shape.boundingRectangle).corners.reduce((a,c,u)=>{var d;return a+de.distance(de.from(c),(d=s?.[u])!=null?d:i.current)},0)/4;return{id:n.id,value:1/o,type:Wt.Collision,priority:Nt.Normal}},gd=Object.create,_s=Object.defineProperty,vd=Object.defineProperties,md=Object.getOwnPropertyDescriptor,yd=Object.getOwnPropertyDescriptors,pr=Object.getOwnPropertySymbols,cl=Object.prototype.hasOwnProperty,ul=Object.prototype.propertyIsEnumerable,dl=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),zt=e=>{throw TypeError(e)},bi=(e,t,n)=>t in e?_s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sn=(e,t)=>{for(var n in t||(t={}))cl.call(t,n)&&bi(e,n,t[n]);if(pr)for(var n of pr(t))ul.call(t,n)&&bi(e,n,t[n]);return e},bs=(e,t)=>vd(e,yd(t)),So=(e,t)=>_s(e,"name",{value:t,configurable:!0}),fl=(e,t)=>{var n={};for(var r in e)cl.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&pr)for(var r of pr(e))t.indexOf(r)<0&&ul.call(e,r)&&(n[r]=e[r]);return n},Ft=e=>{var t;return[,,,gd((t=e?.[dl("metadata")])!=null?t:null)]},hl=["class","method","getter","setter","accessor","field","value","get","set"],sn=e=>e!==void 0&&typeof e!="function"?zt("Function expected"):e,_d=(e,t,n,r,i)=>({kind:hl[e],name:t,metadata:r,addInitializer:s=>n._?zt("Already initialized"):i.push(sn(s||null))}),ot=(e,t)=>bi(t,dl("metadata"),e[3]),G=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i{var o,a,c,u,d,l=t&7,f=!!(t&8),g=!!(t&16),y=l>3?e.length+1:l?f?1:2:0,b=hl[l+5],x=l>3&&(e[y-1]=[]),_=e[y]||(e[y]=[]),v=l&&(!g&&!f&&(i=i.prototype),l<5&&(l>3||!g)&&md(l<4?i:{get[n](){return z(this,s)},set[n](p){return ne(this,s,p)}},n));l?g&&l<4&&So(s,(l>2?"set ":l>1?"get ":"")+n):So(i,n);for(var h=r.length-1;h>=0;h--)u=_d(l,n,c={},e[3],_),l&&(u.static=f,u.private=g,d=u.access={has:g?p=>bd(i,p):p=>n in p},l^3&&(d.get=g?p=>(l^1?z:nt)(p,i,l^4?s:v.get):p=>p[n]),l>2&&(d.set=g?(p,m)=>ne(p,i,m,l^4?s:v.set):(p,m)=>p[n]=m)),a=(0,r[h])(l?l<4?g?s:v[b]:l>4?void 0:{get:v.get,set:v.set}:i,u),c._=1,l^4||a===void 0?sn(a)&&(l>4?x.unshift(a):l?g?s=a:v[b]=a:i=a):typeof a!="object"||a===null?zt("Object expected"):(sn(o=a.get)&&(v.get=o),sn(o=a.set)&&(v.set=o),sn(o=a.init)&&x.unshift(o));return l||ot(e,i),v&&_s(i,n,v),g?l^4?s:v:i},ws=(e,t,n)=>t.has(e)||zt("Cannot "+n),bd=(e,t)=>Object(t)!==t?zt('Cannot use the "in" operator on this value'):e.has(t),z=(e,t,n)=>(ws(e,t,"read from private field"),n?n.call(e):t.get(e)),H=(e,t,n)=>t.has(e)?zt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ne=(e,t,n,r)=>(ws(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),nt=(e,t,n)=>(ws(e,t,"access private method"),n),Eo={role:"button",roleDescription:"draggable"},wd="dnd-kit-description",xd="dnd-kit-announcement",Sd={draggable:"To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item in a given direction. Press space again to drop the item in its new position, or press escape to cancel."},Ed={dragstart({operation:{source:e}}){if(e)return`Picked up draggable item ${e.id}.`},dragover({operation:{source:e,target:t}}){if(!(!e||e.id===t?.id))return t?`Draggable item ${e.id} was moved over droppable target ${t.id}.`:`Draggable item ${e.id} is no longer over a droppable target.`},dragend({operation:{source:e,target:t},canceled:n}){if(e)return n?`Dragging was cancelled. Draggable item ${e.id} was dropped.`:t?`Draggable item ${e.id} was dropped over droppable target ${t.id}`:`Draggable item ${e.id} was dropped.`}};function kd(e){const t=e.tagName.toLowerCase();return["input","select","textarea","a","button"].includes(t)}function Od(e,t){const n=document.createElement("div");return n.id=e,n.style.setProperty("display","none"),n.textContent=t,n}function $d(e){const t=document.createElement("div");return t.id=e,t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.style.setProperty("position","fixed"),t.style.setProperty("width","1px"),t.style.setProperty("height","1px"),t.style.setProperty("margin","-1px"),t.style.setProperty("border","0"),t.style.setProperty("padding","0"),t.style.setProperty("overflow","hidden"),t.style.setProperty("clip","rect(0 0 0 0)"),t.style.setProperty("clip-path","inset(100%)"),t.style.setProperty("white-space","nowrap"),t}var Dd=["dragover","dragmove"],Pd=class extends Q{constructor(e,t){super(e);const{id:n,idPrefix:{description:r=wd,announcement:i=xd}={},announcements:s=Ed,screenReaderInstructions:o=Sd,debounce:a=500}=t??{},c=n?`${r}-${n}`:_i(r),u=n?`${i}-${n}`:_i(i);let d,l,f,g;const y=(m=g)=>{!f||!m||f?.nodeValue!==m&&(f.nodeValue=m)},b=()=>fr.schedule(y),x=Cd(b,a),_=Object.entries(s).map(([m,S])=>this.manager.monitor.addEventListener(m,(E,O)=>{const C=f;if(!C)return;const $=S?.(E,O);$&&C.nodeValue!==$&&(g=$,Dd.includes(m)?x():(b(),x.cancel()))})),v=()=>{let m=[];d?.isConnected||(d=Od(c,o.draggable),m.push(d)),l?.isConnected||(l=$d(u),f=document.createTextNode(""),l.appendChild(f),m.push(l)),m.length>0&&document.body.append(...m)},h=new Set;function p(){for(const m of h)m()}this.registerEffect(()=>{var m;h.clear();for(const S of this.manager.registry.draggables.value){const E=(m=S.handle)!=null?m:S.element;if(E){(!d||!l)&&h.add(v),(!kd(E)||gs())&&!E.hasAttribute("tabindex")&&h.add(()=>E.setAttribute("tabindex","0")),!E.hasAttribute("role")&&E.tagName.toLowerCase()!=="button"&&h.add(()=>E.setAttribute("role",Eo.role)),E.hasAttribute("aria-roledescription")||h.add(()=>E.setAttribute("aria-roledescription",Eo.roleDescription)),E.hasAttribute("aria-describedby")||h.add(()=>E.setAttribute("aria-describedby",c));for(const C of["aria-pressed","aria-grabbed"]){const $=String(S.isDragging);E.getAttribute(C)!==$&&h.add(()=>E.setAttribute(C,$))}const O=String(S.disabled);E.getAttribute("aria-disabled")!==O&&h.add(()=>E.setAttribute("aria-disabled",O))}}h.size>0&&fr.schedule(p)}),this.destroy=()=>{super.destroy(),d?.remove(),l?.remove(),_.forEach(m=>m())}}};function Cd(e,t){let n;const r=()=>{clearTimeout(n),n=setTimeout(e,t)};return r.cancel=()=>clearTimeout(n),r}var gr=new Map,pl,gl,vl,ml,wi,vn,Pe,xs,Dt,yl,_l,bl,wl,Ue=class extends(wi=Cn,ml=[I],vl=[Y],gl=[Y],pl=[Y],wi){constructor(t,n){super(t,n),G(Pe,5,this),H(this,Dt),H(this,vn,new Set),H(this,xs,G(Pe,8,this,new Set)),G(Pe,11,this),this.registerEffect(nt(this,Dt,yl))}register(t){return z(this,vn).add(t),()=>{z(this,vn).delete(t)}}addRoot(t){return T(()=>{const n=new Set(this.additionalRoots);n.add(t),this.additionalRoots=n}),()=>{T(()=>{const n=new Set(this.additionalRoots);n.delete(t),this.additionalRoots=n})}}get sourceRoot(){var t;const{source:n}=this.manager.dragOperation;return cr((t=n?.element)!=null?t:null)}get targetRoot(){var t;const{target:n}=this.manager.dragOperation;return cr((t=n?.element)!=null?t:null)}get roots(){const{status:t}=this.manager.dragOperation;if(t.initializing||t.initialized){const n=[this.sourceRoot,this.targetRoot].filter(r=>r!=null);return new Set([...n,...this.additionalRoots])}return new Set}};Pe=Ft(wi);vn=new WeakMap;xs=new WeakMap;Dt=new WeakSet;yl=function(){const{roots:e}=this,t=[];for(const n of e)for(const r of z(this,vn))t.push(nt(this,Dt,_l).call(this,n,r));return()=>{for(const n of t)n()}};_l=function(e,t){let n=gr.get(e);n||(n=new Map,gr.set(e,n));let r=n.get(t);if(!r){const s=ps(e)?nt(this,Dt,bl).call(this,e,n,t):nt(this,Dt,wl).call(this,e,n,t);if(!s)return()=>{};r=s,n.set(t,r)}r.refCount++;let i=!1;return()=>{i||(i=!0,r.refCount--,r.refCount===0&&r.cleanup())}};bl=function(e,t,n){var r;const i=e.createElement("style"),{nonce:s}=(r=this.options)!=null?r:{};s&&i.setAttribute("nonce",s),i.textContent=n,e.head.prepend(i);const o=new MutationObserver(a=>{for(const c of a)for(const u of Array.from(c.removedNodes))if(u===i){e.head.prepend(i);return}});return o.observe(e.head,{childList:!0}),{refCount:0,cleanup:()=>{o.disconnect(),i.remove(),t.delete(n),t.size===0&&gr.delete(e)}}};wl=function(e,t,n){"adoptedStyleSheets"in e&&Array.isArray(e.adoptedStyleSheets);const r=e.ownerDocument.defaultView,{CSSStyleSheet:i}=r??{};if(!i)return null;const s=new i;return s.replaceSync(n),e.adoptedStyleSheets.push(s),{refCount:0,cleanup:()=>{var o;if(vs(e)&&((o=e.host)!=null&&o.isConnected)){const a=e.adoptedStyleSheets.indexOf(s);a!==-1&&e.adoptedStyleSheets.splice(a,1)}t.delete(n),t.size===0&&gr.delete(e)}}};ge(Pe,4,"additionalRoots",ml,Ue,xs);ge(Pe,2,"sourceRoot",vl,Ue);ge(Pe,2,"targetRoot",gl,Ue);ge(Pe,2,"roots",pl,Ue);ot(Pe,Ue);Ue.configure=Pn(Ue);var $r=Ue,Id=class extends Q{constructor(e,t){super(e,t),this.manager=e;const{cursor:n="grabbing"}=t??{},r=e.registry.plugins.get($r),i=r?.register(`* { cursor: ${n} !important; }`);if(i){const s=this.destroy.bind(this);this.destroy=()=>{i(),s()}}}},jn="data-dnd-",xi=`${jn}dropping`,K="--dnd-",we=`${jn}dragging`,vr=`${jn}placeholder`,jd=[we,vr,"popover","aria-pressed","aria-grabbing"],Md=["view-transition-name"],Td=` - :is(:root,:host) [${we}] { - position: fixed !important; - pointer-events: none !important; - touch-action: none; - z-index: calc(infinity); - will-change: translate; - top: var(${K}top, 0px) !important; - left: var(${K}left, 0px) !important; - right: unset !important; - bottom: unset !important; - width: var(${K}width, auto); - max-width: var(${K}width, auto); - height: var(${K}height, auto); - max-height: var(${K}height, auto); - transform: var(${K}transform, none) !important; - transition: var(${K}transition) !important; - } - - :is(:root,:host) [${vr}] { - transition: none; - } - - :is(:root,:host) [${vr}='hidden'] { - visibility: hidden; - } - - [${we}] * { - pointer-events: none !important; - } - - [${we}]:not([${xi}]) { - translate: var(${K}translate) !important; - } - - [${we}][style*='${K}scale'] { - scale: var(${K}scale) !important; - transform-origin: var(${K}transform-origin) !important; - } - - @layer dnd-kit { - :where([${we}][popover]) { - overflow: visible; - background: unset; - border: unset; - margin: unset; - padding: unset; - color: inherit; - - &:is(input, button) { - border: revert; - background: revert; - } - } - } - [${we}]::backdrop, [${jn}overlay]:not([${we}]) { - display: none; - visibility: hidden; - } -`.replace(/\n+/g," ").replace(/\s+/g," ").trim();function Ad(e,t="hidden"){return T(()=>{const{element:n,manager:r}=e;if(!n||!r)return;const i=Rd(n,r.registry.droppables),s=[],o=Pu(n),{remove:a}=o;return Nd(i,o,s),Wd(o,t),o.remove=()=>{s.forEach(c=>c()),a.call(o)},o})}function Rd(e,t){const n=new Map;for(const r of t)if(r.element&&(e===r.element||e.contains(r.element))){const i=`${jn}${_i("dom-id")}`;r.element.setAttribute(i,""),n.set(r,i)}return n}function Nd(e,t,n){for(const[r,i]of e){if(!r.element)continue;const s=`[${i}]`,o=t.matches(s)?t:t.querySelector(s);if(r.element.removeAttribute(i),!o)continue;const a=r.element;r.proxy=o,o.removeAttribute(i),gi.set(a,o),n.push(()=>{gi.delete(a),r.proxy=void 0})}}function Wd(e,t="hidden"){e.setAttribute("inert","true"),e.setAttribute("tab-index","-1"),e.setAttribute("aria-hidden","true"),e.setAttribute(vr,t)}function xl(e,t){return e===t?!0:Ot(e)===Ot(t)}function ko(e){const{target:t}=e;"newState"in e&&e.newState==="closed"&&tt(t)&&t.hasAttribute("popover")&&requestAnimationFrame(()=>wt(t))}function Si(e){return e.tagName==="TR"}function Ld(e,t,n){const r=new MutationObserver(i=>{let s=!1;for(const o of i){if(o.target!==e){s=!0;continue}if(o.type!=="attributes")continue;const a=o.attributeName;if(a.startsWith("aria-")||jd.includes(a))continue;const c=e.getAttribute(a);if(a==="style"){if(gn(e)&&gn(t)){const u=e.style;for(const d of Array.from(t.style))u.getPropertyValue(d)===""&&t.style.removeProperty(d);for(const d of Array.from(u)){if(Md.includes(d)||d.startsWith(K))continue;const l=u.getPropertyValue(d);t.style.setProperty(d,l)}}}else c!==null?t.setAttribute(a,c):t.removeAttribute(a)}s&&n&&t.replaceChildren(...e.cloneNode(!0).childNodes)});return r.observe(e,{attributes:!0,subtree:!0,childList:!0}),r}function zd(e,t,n){const r=new MutationObserver(i=>{for(const s of i)if(s.addedNodes.length!==0)for(const o of Array.from(s.addedNodes)){if(o.contains(e)&&e.nextElementSibling!==t){e.insertAdjacentElement("afterend",t),wt(n);return}if(o.contains(t)&&t.previousElementSibling!==e){t.insertAdjacentElement("beforebegin",e),wt(n);return}}e.isConnected&&t.isConnected&&e.nextElementSibling!==t&&(e.insertAdjacentElement("afterend",t),wt(n))});return r.observe(e.ownerDocument.body,{childList:!0,subtree:!0}),r}function Fd(e){return new ResizeObserver(()=>{var t,n,r;const i=new xe(e.placeholder,{frameTransform:e.frameTransform,ignoreTransforms:!0}),s=(t=e.transformOrigin)!=null?t:{x:1,y:1},o=(e.width-i.width)*s.x+e.delta.x,a=(e.height-i.height)*s.y+e.delta.y,c=Ja();if(e.styles.set({width:i.width-e.widthOffset,height:i.height-e.heightOffset,top:e.top+a+c.y,left:e.left+o+c.x},K),(n=e.getElementMutationObserver())==null||n.takeRecords(),Si(e.element)&&Si(e.placeholder)){const b=Array.from(e.element.cells),x=Array.from(e.placeholder.cells);e.getSavedCellWidths()||e.setSavedCellWidths(b.map(_=>_.style.width));for(const[_,v]of b.entries()){const h=x[_];v.style.width=`${h.getBoundingClientRect().width}px`}}const u=(r=e.getTranslate())!=null?r:{x:0,y:0},d=e.left+o+c.x+u.x,l=e.top+a+c.y+u.y,f=i.width-e.widthOffset,g=i.height-e.heightOffset,y=e.frameTransform;e.dragOperation.shape=new Se(d*y.scaleX+y.x,l*y.scaleY+y.y,f*y.scaleX,g*y.scaleY)})}var Vd=250,Ud="ease";function Xd(e){var t,n,r,i;const{animation:s}=e;if(typeof s=="function"){const v=s({source:e.source,element:e.element,feedbackElement:e.feedbackElement,placeholder:e.placeholder,translate:e.translate,moved:e.moved});Promise.resolve(v).then(()=>{e.cleanup(),requestAnimationFrame(e.restoreFocus)});return}const{duration:o=Vd,easing:a=Ud}=s??{};wt(e.feedbackElement);const[,c]=(t=Ba(e.feedbackElement,v=>"translate"in v))!=null?t:[];c?.pause();const u=(n=e.placeholder)!=null?n:e.element,d={frameTransform:xl(e.feedbackElement,u)?null:void 0},l=new xe(e.feedbackElement,d),f=(r=wn(Oe(e.feedbackElement).translate))!=null?r:e.translate,g=new xe(u,d),y=Se.delta(l,g,e.alignment),b={x:f.x-y.x,y:f.y-y.y},x=Math.round(l.intrinsicHeight)!==Math.round(g.intrinsicHeight)?{minHeight:[`${l.intrinsicHeight}px`,`${g.intrinsicHeight}px`],maxHeight:[`${l.intrinsicHeight}px`,`${g.intrinsicHeight}px`]}:{},_=Math.round(l.intrinsicWidth)!==Math.round(g.intrinsicWidth)?{minWidth:[`${l.intrinsicWidth}px`,`${g.intrinsicWidth}px`],maxWidth:[`${l.intrinsicWidth}px`,`${g.intrinsicWidth}px`]}:{};e.styles.set({transition:e.transition},K),e.feedbackElement.setAttribute(xi,""),(i=e.getElementMutationObserver())==null||i.takeRecords(),al({element:e.feedbackElement,keyframes:bs(Sn(Sn({},x),_),{translate:[`${f.x}px ${f.y}px 0`,`${b.x}px ${b.y}px 0`]}),options:{duration:ms(le(e.feedbackElement))?0:e.moved||e.feedbackElement!==e.element?o:0,easing:a}}).then(()=>{e.feedbackElement.removeAttribute(xi),c?.finish(),e.cleanup(),requestAnimationFrame(e.restoreFocus)})}var Sl,Ei,En,Ss,rr,El,kl,Pt=class extends(Ei=Q,Sl=[I],Ei){constructor(t,n){super(t,n),H(this,rr),H(this,Ss,G(En,8,this)),G(En,11,this),this.state={initial:{},current:{}};const r=t.registry.plugins.get($r),i=r?.register(Td);if(i){const s=this.destroy.bind(this);this.destroy=()=>{i(),s()}}this.registerEffect(nt(this,rr,El).bind(this,r)),this.registerEffect(nt(this,rr,kl))}};En=Ft(Ei);Ss=new WeakMap;rr=new WeakSet;El=function(e){const{overlay:t}=this;if(!t||!e)return;const n=cr(t);if(n)return e.addRoot(n)};kl=function(){var e,t,n,r,i,s,o;const{state:a,manager:c,options:u}=this,{dragOperation:d}=c,{position:l,source:f,status:g}=d;if(g.idle){a.current={},a.initial={};return}if(!f)return;const{element:y}=f,b=f.pluginConfig(Pt),x=(t=(e=b?.feedback)!=null?e:u?.feedback)!=null?t:"default",_=typeof x=="function"?x(f,c):x;if(!y||_==="none"||!g.initialized||g.initializing)return;const{initial:v}=a,h=(n=this.overlay)!=null?n:y,p=$t(h),m=$t(y),S=!xl(y,h),E=new xe(y,{frameTransform:S?m:null,ignoreTransforms:!S}),O={x:m.scaleX/p.scaleX,y:m.scaleY/p.scaleY};let{width:C,height:$,top:F,left:W}=E;S&&(C=C/O.x,$=$/O.y);const N=new ld(h),$e=Oe(y),{transition:Ns,translate:Ws,boxSizing:cc,paddingBlockStart:uc,paddingBlockEnd:dc,paddingInlineStart:fc,paddingInlineEnd:hc,borderInlineStartWidth:pc,borderInlineEndWidth:gc,borderBlockStartWidth:vc,borderBlockEndWidth:mc}=$e,Nn=Ns.split(",").filter(L=>!/^\s*(transform|translate|scale)\b/.test(L)).join(","),Xe=Or($e),yc=$e.transform,Ls=_==="clone",zs=cc==="content-box",Fs=zs?parseInt(fc)+parseInt(hc)+parseInt(pc)+parseInt(gc):0,Vs=zs?parseInt(uc)+parseInt(dc)+parseInt(vc)+parseInt(mc):0,ce=_!=="move"&&!this.overlay?Ad(f,Ls?"clone":"hidden"):null,Ir=T(()=>xn(c.dragOperation.activatorEvent));if(!v.translate){if(this.overlay&&Xe)v.translate={x:Xe.x,y:Xe.y};else if(Ws!=="none"){const L=wn(Ws);L&&(v.translate=L)}}if(!v.transformOrigin){const L=T(()=>l.current),q=W+((r=Xe?.x)!=null?r:0),se=F+((i=Xe?.y)!=null?i:0);v.transformOrigin={x:(L.x-q*p.scaleX-p.x)/(C*p.scaleX),y:(L.y-se*p.scaleY-p.y)/($*p.scaleY)}}const{transformOrigin:at}=v,Us=F*p.scaleY+p.y,Xs=W*p.scaleX+p.x;if(!v.coordinates&&(v.coordinates={x:Xs,y:Us},O.x!==1||O.y!==1)){const{scaleX:L,scaleY:q}=m,{x:se,y:je}=at;v.coordinates.x+=(C*L-C)*se,v.coordinates.y+=($*q-$)*je}v.dimensions||(v.dimensions={width:C,height:$}),v.frameTransform||(v.frameTransform=p);const Ys={x:v.coordinates.x-Xs,y:v.coordinates.y-Us},Hs={width:(v.dimensions.width*v.frameTransform.scaleX-C*p.scaleX)*at.x,height:(v.dimensions.height*v.frameTransform.scaleY-$*p.scaleY)*at.y},jr={x:Ys.x/p.scaleX+Hs.width,y:Ys.y/p.scaleY+Hs.height},qs={left:W+jr.x,top:F+jr.y};h.setAttribute(we,"true");const Bs=T(()=>d.transform),Gs=(s=v.translate)!=null?s:{x:0,y:0},_c=Bs.x*p.scaleX+Gs.x,bc=Bs.y*p.scaleY+Gs.y,Ks=Ja();N.set({width:C-Fs,height:$-Vs,top:qs.top+Ks.y,left:qs.left+Ks.x,translate:`${_c}px ${bc}px 0`,transform:this.overlay?"none":yc,transition:Nn?`${Nn}, translate 0ms linear`:"translate 0ms linear",scale:S?`${O.x} ${O.y}`:"","transform-origin":`${at.x*100}% ${at.y*100}%`},K),ce&&(y.insertAdjacentElement("afterend",ce),u?.rootElement&&(typeof u.rootElement=="function"?u.rootElement(f):u.rootElement).appendChild(y)),mi(h)&&(h.hasAttribute("popover")||h.setAttribute("popover","manual"),wt(h),h.addEventListener("beforetoggle",ko));let Ut,Js,Wn;const Zs=Fd({placeholder:ce,element:y,feedbackElement:h,frameTransform:p,transformOrigin:at,width:C,height:$,top:F,left:W,widthOffset:Fs,heightOffset:Vs,delta:jr,styles:N,dragOperation:d,getTranslate:()=>a.current.translate,getElementMutationObserver:()=>Ut,getSavedCellWidths:()=>Wn,setSavedCellWidths:L=>{Wn=L}}),Qs=new xe(h);T(()=>d.shape=Qs);const Mr=le(h),eo=L=>{this.manager.actions.stop({event:L})},wc=ms(Mr);Ir&&Mr.addEventListener("resize",eo),T(()=>f.status)==="idle"&&requestAnimationFrame(()=>f.status="dragging"),ce&&(Zs.observe(ce),Ut=Ld(y,ce,Ls),Js=zd(y,ce,h));const to=(o=c.dragOperation.source)==null?void 0:o.id,xc=()=>{var L;if(!Ir||to==null)return;const q=c.registry.draggables.get(to),se=(L=q?.handle)!=null?L:q?.element;Ve(se)&&se.focus()},Tr=()=>{var L;if(Ut?.disconnect(),Js?.disconnect(),Zs.disconnect(),Mr.removeEventListener("resize",eo),mi(h)&&(h.removeEventListener("beforetoggle",ko),h.removeAttribute("popover")),h.removeAttribute(we),N.reset(),Wn&&Si(y)){const je=Array.from(y.cells);for(const[Ar,Ln]of je.entries())Ln.style.width=(L=Wn[Ar])!=null?L:""}f.status="idle";const q=a.current.translate!=null,se=d.status.dragging;ce&&(!se&&q||ce.parentElement!==h.parentElement)&&h.isConnected&&ce.replaceWith(h),ce?.remove()},Sc=u?.dropAnimation,no=this,Ec=$n(()=>{var L,q,se;const{transform:je,status:Ar}=d;if(!(!je.x&&!je.y&&!a.current.translate)&&Ar.dragging){const Ln=(L=v.translate)!=null?L:{x:0,y:0},zn={x:je.x/p.scaleX+Ln.x,y:je.y/p.scaleY+Ln.y},ro=a.current.translate,kc=T(()=>d.modifiers),Rr=T(()=>{var Yt;return(Yt=d.shape)==null?void 0:Yt.current}),Xt=u?.keyboardTransition,io=Ir&&!wc&&Xt!==null?`${(q=Xt?.duration)!=null?q:250}ms ${(se=Xt?.easing)!=null?se:"cubic-bezier(0.25, 1, 0.5, 1)"}`:"0ms linear";if(N.set({transition:Nn?`${Nn}, translate ${io}`:`translate ${io}`,translate:`${zn.x}px ${zn.y}px 0`},K),Ut?.takeRecords(),Rr&&Rr!==Qs&&ro&&!kc.length){const Yt=de.delta(zn,ro);d.shape=Se.from(Rr.boundingRectangle).translate(Yt.x*p.scaleX,Yt.y*p.scaleY)}else d.shape=new xe(h);a.current.translate=zn}},function(){if(d.status.dropped){this.dispose(),f.status="dropping";const L=b?.dropAnimation!==void 0?b.dropAnimation:no.dropAnimation!==void 0?no.dropAnimation:Sc;let q=a.current.translate;const se=q!=null;if(!q&&y!==h&&(q={x:0,y:0}),!q||L===null){Tr();return}c.renderer.rendering.then(()=>{Xd({source:f,element:y,feedbackElement:h,placeholder:ce,translate:q,moved:se,transition:Ns,alignment:f.alignment,styles:N,animation:L??void 0,getElementMutationObserver:()=>Ut,cleanup:Tr,restoreFocus:xc})})}});return()=>{Tr(),Ec()}};ge(En,4,"overlay",Sl,Pt,Ss);ot(En,Pt);Pt.configure=Pn(Pt);var Ol=Pt,Ht=!0,Yd=!1,$l,Dl,Pl,Hd=(Pl=[I],fe.Forward),Re,Es,ks;Dl=($l=[I],fe.Reverse);var kn=class{constructor(){H(this,Es,G(Re,8,this,Ht)),G(Re,11,this),H(this,ks,G(Re,12,this,Ht)),G(Re,15,this)}isLocked(e){return e===fe.Idle?!1:e==null?this[fe.Forward]===Ht&&this[fe.Reverse]===Ht:this[e]===Ht}unlock(e){e!==fe.Idle&&(this[e]=Yd)}};Re=Ft(null);Es=new WeakMap;ks=new WeakMap;ge(Re,4,Hd,Pl,kn,Es);ge(Re,4,Dl,$l,kn,ks);ot(Re,kn);var qd=[fe.Forward,fe.Reverse],Oo=class{constructor(){this.x=new kn,this.y=new kn}isLocked(){return this.x.isLocked()&&this.y.isLocked()}},Bd=class extends Q{constructor(e){super(e);const t=Ct(new Oo);let n=null;this.signal=t,pe(()=>{const{status:r}=e.dragOperation;if(!r.initialized){n=null,t.value=new Oo;return}const{delta:i}=e.dragOperation.position;if(n){const s={x:$o(i.x,n.x),y:$o(i.y,n.y)},o=t.peek();U(()=>{for(const a of la)for(const c of qd)s[a]===c&&o[a].unlock(c);t.value=o})}n=i})}get current(){return this.signal.peek()}};function $o(e,t){return Math.sign(e-t)}var Cl,ki,On,Os,Te,Oi,Mn=class extends(ki=Cn,Cl=[I],ki){constructor(e){super(e),H(this,Os,G(On,8,this,!1)),G(On,11,this),H(this,Te),H(this,Oi,()=>{if(!z(this,Te))return;const{element:s,by:o}=z(this,Te);o.y&&(s.scrollTop+=o.y),o.x&&(s.scrollLeft+=o.x)}),this.scroll=(s,o)=>{var a;if(this.disabled)return!1;const c=this.getScrollableElements();if(!c)return ne(this,Te,void 0),!1;const{position:u}=this.manager.dragOperation,d=u?.current;if(d){const{by:l}=s??{},f=l?{x:Do(l.x),y:Do(l.y)}:void 0,g=f?void 0:this.scrollIntentTracker.current;if(g?.isLocked())return!1;for(const y of c){const b=Vu(y,l);if(b.x||b.y){const{speed:x,direction:_}=Qu(y,d,f,o?.acceleration,o?.threshold);if(g)for(const v of la)g[v].isLocked(_[v])&&(x[v]=0,_[v]=0);if(_.x||_.y){const{x:v,y:h}=l??_,p=v*x.x,m=h*x.y;if(p||m){const S=(a=z(this,Te))==null?void 0:a.by;if(this.autoScrolling&&S&&(S.x&&!p||S.y&&!m))continue;return ne(this,Te,{element:y,by:{x:p,y:m}}),fr.schedule(z(this,Oi)),!0}}}}}return ne(this,Te,void 0),!1};let t=null,n=null;const r=Qr(()=>{const{position:s,source:o}=e.dragOperation;if(!s)return null;const a=Za(cr(o?.element),s.current);return a&&(t=a),a??t}),i=Qr(()=>{const s=r.value,{documentElement:o}=Lt(s);if(!s||s===o){const{target:a}=e.dragOperation,c=a?.element;if(c){const u=yi(c,{excludeElement:!1});return n=u,u}}if(s){const a=yi(s,{excludeElement:!1});return this.autoScrolling&&n&&a.sizei.value,this.scrollIntentTracker=new Bd(e),this.destroy=e.monitor.addEventListener("dragmove",s=>{this.disabled||s.defaultPrevented||!xn(e.dragOperation.activatorEvent)||!s.by||this.scroll({by:s.by})&&s.preventDefault()})}};On=Ft(ki);Os=new WeakMap;Te=new WeakMap;Oi=new WeakMap;ge(On,4,"autoScrolling",Cl,Mn,Os);ot(On,Mn);function Do(e){return e>0?fe.Forward:e<0?fe.Reverse:fe.Idle}var Gd=class{constructor(e){this.scheduler=e,this.pending=!1,this.tasks=new Set,this.resolvers=new Set,this.flush=()=>{const{tasks:t,resolvers:n}=this;this.pending=!1,this.tasks=new Set,this.resolvers=new Set;for(const r of t)r();for(const r of n)r()}}schedule(e){return this.tasks.add(e),this.pending||(this.pending=!0,this.scheduler(this.flush)),new Promise(t=>this.resolvers.add(t))}},Kd=new Gd(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(e):e()}),Jd=10,$i=class extends Q{constructor(t,n){super(t,n);const r=t.registry.plugins.get(Mn);if(!r)throw new Error("AutoScroller plugin depends on Scroller plugin");this.destroy=pe(()=>{var i,s,o;if(this.disabled)return;const{position:a,status:c}=t.dragOperation;if(c.dragging){const u={acceleration:(i=this.options)==null?void 0:i.acceleration,threshold:typeof((s=this.options)==null?void 0:s.threshold)=="number"?{x:this.options.threshold,y:this.options.threshold}:(o=this.options)==null?void 0:o.threshold};if(r.scroll(void 0,u)){r.autoScrolling=!0;const d=setInterval(()=>Kd.schedule(()=>r.scroll(void 0,u)),Jd);return()=>{clearInterval(d)}}else r.autoScrolling=!1}})}};$i.configure=Pn($i);var Il=$i,Po={capture:!0,passive:!0},on,Zd=class extends Cn{constructor(e){super(e),H(this,on),this.handleScroll=()=>{z(this,on)==null&&ne(this,on,setTimeout(()=>{this.manager.collisionObserver.forceUpdate(!1),ne(this,on,void 0)},50))};const{dragOperation:t}=this.manager;this.destroy=pe(()=>{var n,r,i;if(t.status.dragging){const s=(i=(r=(n=t.source)==null?void 0:n.element)==null?void 0:r.ownerDocument)!=null?i:document;return s.addEventListener("scroll",this.handleScroll,Po),()=>{s.removeEventListener("scroll",this.handleScroll,Po)}}})}};on=new WeakMap;var Qd="* { user-select: none !important; -webkit-user-select: none !important; }",ef=class extends Q{constructor(e){super(e),this.manager=e;const t=e.registry.plugins.get($r),n=t?.register(Qd);if(this.destroy=pe(()=>{const{dragOperation:r}=this.manager;if(r.status.initialized)return Xr(),document.addEventListener("selectionchange",Xr,{capture:!0}),()=>{document.removeEventListener("selectionchange",Xr,{capture:!0})}}),n){const r=this.destroy.bind(this);this.destroy=()=>{n(),r()}}}};function Xr(){var e;(e=document.getSelection())==null||e.removeAllRanges()}var an=Object.freeze({offset:10,keyboardCodes:{start:["Space","Enter"],cancel:["Escape"],end:["Space","Enter","Tab"],up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]},preventActivation(e,t){var n;const r=(n=t.handle)!=null?n:t.element;return e.target!==r}}),gt,mr=class extends Et{constructor(t,n){super(t),this.manager=t,this.options=n,H(this,gt,[]),this.listeners=new Qa,this.handleSourceKeyDown=(r,i,s)=>{if(this.disabled||r.defaultPrevented||!tt(r.target)||i.disabled)return;const{keyboardCodes:o=an.keyboardCodes,preventActivation:a=an.preventActivation}=s??{};o.start.includes(r.code)&&this.manager.dragOperation.status.idle&&(a?.(r,i)||this.handleStart(r,i,s))}}bind(t,n=this.options){return pe(()=>{var r;const i=(r=t.handle)!=null?r:t.element,s=o=>{xn(o)&&this.handleSourceKeyDown(o,t,n)};if(i)return i.addEventListener("keydown",s),()=>{i.removeEventListener("keydown",s)}})}handleStart(t,n,r){const{element:i}=n;if(!i)throw new Error("Source draggable does not have an associated element");t.preventDefault(),t.stopImmediatePropagation(),ol(i);const{center:s}=new xe(i);if(this.manager.actions.start({event:t,coordinates:{x:s.x,y:s.y},source:n}).signal.aborted)return this.cleanup();this.sideEffects();const o=Lt(i),a=[this.listeners.bind(o,[{type:"keydown",listener:c=>this.handleKeyDown(c,n,r),options:{capture:!0}}])];z(this,gt).push(...a)}handleKeyDown(t,n,r){const{keyboardCodes:i=an.keyboardCodes}=r??{};if(lt(t,[...i.end,...i.cancel])){t.preventDefault();const s=lt(t,i.cancel);this.handleEnd(t,s);return}lt(t,i.up)?this.handleMove("up",t):lt(t,i.down)&&this.handleMove("down",t),lt(t,i.left)?this.handleMove("left",t):lt(t,i.right)&&this.handleMove("right",t)}handleEnd(t,n){this.manager.actions.stop({event:t,canceled:n}),this.cleanup()}handleMove(t,n){var r,i;const{shape:s}=this.manager.dragOperation,o=n.shiftKey?5:1;let a={x:0,y:0},c=(i=(r=this.options)==null?void 0:r.offset)!=null?i:an.offset;if(typeof c=="number"&&(c={x:c,y:c}),!!s){switch(t){case"up":a={x:0,y:-c.y*o};break;case"down":a={x:0,y:c.y*o};break;case"left":a={x:-c.x*o,y:0};break;case"right":a={x:c.x*o,y:0};break}(a.x||a.y)&&(n.preventDefault(),this.manager.actions.move({event:n,by:a}))}}sideEffects(){const t=this.manager.registry.plugins.get(Il);t?.disabled===!1&&(t.disable(),z(this,gt).push(()=>{t.enable()}))}cleanup(){z(this,gt).forEach(t=>t()),ne(this,gt,[])}destroy(){this.cleanup(),this.listeners.clear()}};gt=new WeakMap;mr.configure=Pn(mr);mr.defaults=an;var tf=mr;function lt(e,t){return t.includes(e.code)}var Je,nf=class extends Na{constructor(){super(...arguments),H(this,Je)}onEvent(e){switch(e.type){case"pointerdown":ne(this,Je,kt(e));break;case"pointermove":if(!z(this,Je))return;const{x:t,y:n}=kt(e),r={x:t-z(this,Je).x,y:n-z(this,Je).y},{tolerance:i}=this.options;if(i&&ui(r,i)){this.abort();return}ui(r,this.options.value)&&this.activate(e);break;case"pointerup":this.abort();break}}abort(){ne(this,Je,void 0)}};Je=new WeakMap;var vt,Ze,rf=class extends Na{constructor(){super(...arguments),H(this,vt),H(this,Ze)}onEvent(e){switch(e.type){case"pointerdown":ne(this,Ze,kt(e)),ne(this,vt,setTimeout(()=>this.activate(e),this.options.value));break;case"pointermove":if(!z(this,Ze))return;const{x:t,y:n}=kt(e);ui({x:t-z(this,Ze).x,y:n-z(this,Ze).y},this.options.tolerance)&&this.abort();break;case"pointerup":this.abort();break}}abort(){z(this,vt)&&(clearTimeout(z(this,vt)),ne(this,Ze,void 0),ne(this,vt,void 0))}};vt=new WeakMap;Ze=new WeakMap;var bt=class{};bt.Delay=rf;bt.Distance=nf;var Di=Object.freeze({activationConstraints(e,t){var n;const{pointerType:r,target:i}=e;if(!(r==="mouse"&&tt(i)&&(t.handle===i||(n=t.handle)!=null&&n.contains(i))))return r==="touch"?[new bt.Delay({value:250,tolerance:5})]:ud(i)&&!e.defaultPrevented?[new bt.Delay({value:200,tolerance:0})]:[new bt.Delay({value:200,tolerance:10}),new bt.Distance({value:5})]},preventActivation(e,t){var n;const{target:r}=e;return r===t.element||r===t.handle||!tt(r)||(n=t.handle)!=null&&n.contains(r)?!1:Iu(r)}}),mt,yr=class extends Et{constructor(t,n){super(t),this.manager=t,this.options=n,H(this,mt,new Set),this.listeners=new Qa,this.latest={event:void 0,coordinates:void 0},this.handleMove=()=>{const{event:r,coordinates:i}=this.latest;!r||!i||this.manager.actions.move({event:r,to:i})},this.handleCancel=this.handleCancel.bind(this),this.handlePointerUp=this.handlePointerUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}activationConstraints(t,n,r=this.options){const{activationConstraints:i=Di.activationConstraints}=r??{};return typeof i=="function"?i(t,n):i}bind(t,n=this.options){return pe(()=>{var r;const i=new AbortController,{signal:s}=i,o=c=>{cd(c)&&this.handlePointerDown(c,t,n)};let a=[(r=t.handle)!=null?r:t.element];n?.activatorElements&&(Array.isArray(n.activatorElements)?a=n.activatorElements:a=n.activatorElements(t));for(const c of a)c&&(lf(c.ownerDocument.defaultView),c.addEventListener("pointerdown",o,{signal:s}));return()=>i.abort()})}handlePointerDown(t,n,r){if(this.disabled||!t.isPrimary||t.button!==0||!tt(t.target)||n.disabled||of(t)||!this.manager.dragOperation.status.idle)return;const{preventActivation:i=Di.preventActivation}=r??{};if(i?.(t,n))return;const{target:s}=t,o=Ve(s)&&s.draggable&&s.getAttribute("draggable")==="true",a=$t(n.element),{x:c,y:u}=kt(t);this.initialCoordinates={x:c*a.scaleX+a.x,y:u*a.scaleY+a.y};const d=this.activationConstraints(t,n,r);t.sensor=this;const l=new wu(d,b=>this.handleStart(n,b));l.signal.onabort=()=>this.handleCancel(t),l.onEvent(t),this.controller=l;const f=pi(),g=this.listeners.bind(f,[{type:"pointermove",listener:b=>this.handlePointerMove(b,n)},{type:"pointerup",listener:this.handlePointerUp,options:{capture:!0}},{type:"pointercancel",listener:this.handleCancel},{type:"dragstart",listener:o?this.handleCancel:Xn,options:{capture:!0}}]),y=()=>{g(),this.initialCoordinates=void 0};z(this,mt).add(y)}handlePointerMove(t,n){var r,i;if(((r=this.controller)==null?void 0:r.activated)===!1){(i=this.controller)==null||i.onEvent(t);return}if(this.manager.dragOperation.status.dragging){const s=kt(t),o=$t(n.element);s.x=s.x*o.scaleX+o.x,s.y=s.y*o.scaleY+o.y,t.preventDefault(),t.stopPropagation(),this.latest.event=t,this.latest.coordinates=s,fr.schedule(this.handleMove)}}handlePointerUp(t){const{status:n}=this.manager.dragOperation;if(!n.idle){t.preventDefault(),t.stopPropagation();const r=!n.initialized;this.manager.actions.stop({event:t,canceled:r})}this.cleanup()}handleKeyDown(t){t.key==="Escape"&&(t.preventDefault(),this.handleCancel(t))}handleStart(t,n){const{manager:r,initialCoordinates:i}=this;if(!i||!r.dragOperation.status.idle||n.defaultPrevented)return;if(r.actions.start({coordinates:i,event:n,source:t}).signal.aborted)return this.cleanup();n.preventDefault();const s=Lt(n.target).body;try{s.setPointerCapture(n.pointerId)}catch{this.handleCancel(n);return}const o=tt(n.target)?[n.target,s]:s,a=this.listeners.bind(o,[{type:"touchmove",listener:Xn,options:{passive:!1}},{type:"click",listener:Xn},{type:"contextmenu",listener:Xn},{type:"keydown",listener:this.handleKeyDown}]);z(this,mt).add(a)}handleCancel(t){const{dragOperation:n}=this.manager;n.status.initialized&&this.manager.actions.stop({event:t,canceled:!0}),this.cleanup()}cleanup(){const{controller:t}=this;this.controller=void 0,t&&!t.signal.aborted&&t.abort(),this.latest={event:void 0,coordinates:void 0},z(this,mt).forEach(n=>n()),z(this,mt).clear()}destroy(){this.cleanup(),this.listeners.clear()}};mt=new WeakMap;yr.configure=Pn(yr);yr.defaults=Di;var sf=yr;function of(e){return"sensor"in e}function Xn(e){e.preventDefault()}function af(){}var Co=new WeakSet;function lf(e){!e||Co.has(e)||(e.addEventListener("touchmove",af,{capture:!1,passive:!1}),Co.add(e))}var xt={modifiers:[],plugins:[Pd,Il,Id,Ol,ef],sensors:[sf,tf]},jl=class extends ku{constructor(e={}){const t=_e(e.plugins,xt.plugins),n=_e(e.sensors,xt.sensors),r=_e(e.modifiers,xt.modifiers);super(bs(Sn({},e),{plugins:[Zd,Mn,$r,...t],sensors:n,modifiers:r}))}},Ml,Tl,Pi,Ne,$s,Ds,Tn=class extends(Pi=Ee,Tl=[I],Ml=[I],Pi){constructor(e,t){var n=e,{element:r,effects:i=()=>[],handle:s}=n,o=fl(n,["element","effects","handle"]);super(Sn({effects:()=>[...i(),()=>{var a,c;const{manager:u}=this;if(!u)return;const d=((c=(a=this.sensors)==null?void 0:a.map(yn))!=null?c:[...u.sensors]).map(l=>{const f=l instanceof Et?l:u.registry.register(l.plugin),g=l instanceof Et?void 0:l.options;return f.bind(this,g)});return function(){d.forEach(f=>f())}}]},o),t),H(this,$s,G(Ne,8,this)),G(Ne,11,this),H(this,Ds,G(Ne,12,this)),G(Ne,15,this),this.element=r,this.handle=s}};Ne=Ft(Pi);$s=new WeakMap;Ds=new WeakMap;ge(Ne,4,"handle",Tl,Tn,$s);ge(Ne,4,"element",Ml,Tn,Ds);ot(Ne,Tn);var Al,Rl,Ci,We,Ps,Yr,Nl,Wl,mn,Cs,Dr=class extends(Ci=ke,Rl=[I],Al=[I],Ci){constructor(e,t){var n=e,{element:r,effects:i=()=>[]}=n,s=fl(n,["element","effects"]);const{collisionDetector:o=ll}=s,a=u=>{const{manager:d,element:l}=this;if(!l||u===null){this.shape=void 0;return}if(!d)return;const f=new xe(l),g=T(()=>this.shape);return f&&g?.equals(f)?g:(this.shape=f,f)},c=Ct(!1);super(bs(Sn({},s),{collisionDetector:o,effects:()=>[...i(),()=>{const{element:u,manager:d}=this;if(!d)return;const{dragOperation:l}=d,{source:f}=l;c.value=!!(f&&l.status.initialized&&u&&!this.disabled&&this.accepts(f))},()=>{const{element:u}=this;if(c.value&&u){const d=new Fu(u,a);return()=>{d.disconnect(),this.shape=void 0}}},()=>{var u;if((u=this.manager)!=null&&u.dragOperation.status.initialized)return()=>{this.shape=void 0}}]}),t),H(this,mn),H(this,Ps,G(We,8,this)),G(We,11,this),H(this,Cs,G(We,12,this)),G(We,15,this),this.element=r,this.refreshShape=()=>a()}set element(e){ne(this,mn,e,Wl)}get element(){var e;return(e=this.proxy)!=null?e:z(this,mn,Nl)}};We=Ft(Ci);Ps=new WeakMap;mn=new WeakSet;Cs=new WeakMap;Yr=ge(We,20,"#element",Rl,mn,Ps),Nl=Yr.get,Wl=Yr.set;ge(We,4,"proxy",Al,Dr,Cs);ot(We,Dr);var cf=$c();function uf(e){return e!=null&&typeof e=="object"&&"current"in e}function Fe(e){var t;if(e!=null)return uf(e)?(t=e.current)!=null?t:void 0:e}var Vt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?k.useLayoutEffect:k.useEffect;function df(){const e=(0,k.useState)(0)[1];return(0,k.useCallback)(()=>{e(t=>t+1)},[e])}function Is(e,t){const n=(0,k.useRef)(new Map),r=df();return Vt(()=>{if(!e){n.current.clear();return}return pe(()=>{var i;let s=!1,o=!1;for(const a of n.current){const[c]=a,u=T(()=>a[1]),d=e[c];u!==d&&(s=!0,n.current.set(c,d),o=(i=t?.(c,u,d))!=null?i:!1)}s&&(o?queueMicrotask(()=>(0,cf.flushSync)(r)):r())})},[e]),(0,k.useMemo)(()=>e&&new Proxy(e,{get(i,s){const o=i[s];return n.current.set(s,o),o}}),[e])}function ff(e,t){e()}function ct(e){const t=(0,k.useRef)(e);return Vt(()=>{t.current=e},[e]),t}function A(e,t,n=k.useEffect,r=Object.is){const i=(0,k.useRef)(e);n(()=>{const s=i.current;r(e,s)||(i.current=e,t(e,s))},[t,e])}function St(e,t){const n=(0,k.useRef)(Fe(e));Vt(()=>{const r=Fe(e);r!==n.current&&(n.current=r,t(r))})}var w=Pc(),hf=Object.defineProperty,pf=Object.defineProperties,gf=Object.getOwnPropertyDescriptors,_r=Object.getOwnPropertySymbols,Ll=Object.prototype.hasOwnProperty,zl=Object.prototype.propertyIsEnumerable,Io=(e,t,n)=>t in e?hf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fl=(e,t)=>{for(var n in t||(t={}))Ll.call(t,n)&&Io(e,n,t[n]);if(_r)for(var n of _r(t))zl.call(t,n)&&Io(e,n,t[n]);return e},Vl=(e,t)=>pf(e,gf(t)),vf=(e,t)=>{var n={};for(var r in e)Ll.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_r)for(var r of _r(e))t.indexOf(r)<0&&zl.call(e,r)&&(n[r]=e[r]);return n},Ul=(0,k.createContext)(new jl),mf=(0,k.memo)((0,k.forwardRef)(({children:e},t)=>{const[n,r]=(0,k.useState)(0),i=(0,k.useRef)(null),s=(0,k.useRef)(null),o=(0,k.useMemo)(()=>({renderer:{get rendering(){var a;return(a=i.current)!=null?a:Promise.resolve()}},trackRendering(a){i.current||(i.current=new Promise(c=>{s.current=c})),(0,k.startTransition)(()=>{a(),r(c=>c+1)})}}),[]);return Vt(()=>{var a;(a=s.current)==null||a.call(s),i.current=null},[e,n]),(0,k.useImperativeHandle)(t,()=>o),null})),Hr=[void 0,ye];function yf(e){var t=e,{children:n,onCollision:r,onBeforeDragStart:i,onDragStart:s,onDragMove:o,onDragOver:a,onDragEnd:c}=t,u=vf(t,["children","onCollision","onBeforeDragStart","onDragStart","onDragMove","onDragOver","onDragEnd"]);const d=(0,k.useRef)(null),{plugins:l,modifiers:f,sensors:g}=u,y=_e(l,xt.plugins),b=_e(g,xt.sensors),x=_e(f,xt.modifiers),_=ct(i),v=ct(s),h=ct(a),p=ct(o),m=ct(c),S=ct(r),E=_f(()=>{var O;return(O=u.manager)!=null?O:new jl(u)});return(0,k.useEffect)(()=>{if(!d.current)throw new Error("Renderer not found");const{renderer:O,trackRendering:C}=d.current,{monitor:$}=E;E.renderer=O;const F=[$.addEventListener("beforedragstart",W=>{const N=_.current;N&&C(()=>N(W,E))}),$.addEventListener("dragstart",W=>{var N;return(N=v.current)==null?void 0:N.call(v,W,E)}),$.addEventListener("dragover",W=>{const N=h.current;N&&C(()=>N(W,E))}),$.addEventListener("dragmove",W=>{const N=p.current;N&&C(()=>N(W,E))}),$.addEventListener("dragend",W=>{const N=m.current;N&&C(()=>N(W,E))}),$.addEventListener("collision",W=>{var N;return(N=S.current)==null?void 0:N.call(S,W,E)})];return()=>F.forEach(W=>W())},[E]),A(y,()=>E&&(E.plugins=y),...Hr),A(b,()=>E&&(E.sensors=b),...Hr),A(x,()=>E&&(E.modifiers=x),...Hr),(0,w.jsxs)(Ul.Provider,{value:E,children:[(0,w.jsx)(mf,{ref:d,children:n}),n]})}function _f(e){const t=(0,k.useRef)(null);return t.current||(t.current=e()),(0,k.useInsertionEffect)(()=>()=>{var n;return(n=t.current)==null?void 0:n.destroy()},[]),t.current}function bf(){return(0,k.useContext)(Ul)}function js(e){var t;const n=(t=bf())!=null?t:void 0,[r]=(0,k.useState)(()=>e(n));return r.manager!==n&&(r.manager=n),Vt(r.register,[n,r]),r}function Xl(e){const{disabled:t,data:n,element:r,handle:i,id:s,modifiers:o,sensors:a,plugins:c}=e,u=js(l=>new Tn(Vl(Fl({},e),{register:!1,handle:Fe(i),element:Fe(r)}),l)),d=Is(u,wf);return A(s,()=>u.id=s),St(i,l=>u.handle=l),St(r,l=>u.element=l),A(n,()=>n&&(u.data=n)),A(t,()=>u.disabled=t===!0),A(a,()=>u.sensors=a),A(o,()=>u.modifiers=o,void 0,ye),A(c,()=>u.plugins=c,void 0,ye),A(e.alignment,()=>u.alignment=e.alignment),{draggable:d,get isDragging(){return d.isDragging},get isDropping(){return d.isDropping},get isDragSource(){return d.isDragSource},handleRef:(0,k.useCallback)(l=>{u.handle=l??void 0},[u]),ref:(0,k.useCallback)(l=>{var f,g;!l&&((f=u.element)!=null&&f.isConnected)&&!((g=u.manager)!=null&&g.dragOperation.status.idle)||(u.element=l??void 0)},[u])}}function wf(e,t,n){return!!(e==="isDragSource"&&!n&&t)}var xf=Object.create,Yl=Object.defineProperty,Sf=Object.getOwnPropertyDescriptor,Hl=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Pr=e=>{throw TypeError(e)},Ef=(e,t,n)=>t in e?Yl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kf=e=>{var t;return[,,,xf((t=e?.[Hl("metadata")])!=null?t:null)]},ql=["class","method","getter","setter","accessor","field","value","get","set"],Bl=e=>e!==void 0&&typeof e!="function"?Pr("Function expected"):e,Of=(e,t,n,r,i)=>({kind:ql[e],name:t,metadata:r,addInitializer:s=>n._?Pr("Already initialized"):i.push(Bl(s||null))}),$f=(e,t)=>Ef(t,Hl("metadata"),e[3]),Df=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i{for(var o,a,c,u,d=t&7,l=!1,f=!1,g=2,y=ql[d+5],b=e[g]||(e[g]=[]),x=(i=i.prototype,Sf(i,n)),_=r.length-1;_>=0;_--)c=Of(d,n,a={},e[3],b),c.static=l,c.private=f,u=c.access={has:v=>n in v},u.get=v=>v[n],o=(0,r[_])(x[y],c),a._=1,Bl(o)&&(x[y]=o);return x&&Yl(i,n,x),i},Kl=(e,t,n)=>t.has(e)||Pr("Cannot "+n),Pf=(e,t,n)=>(Kl(e,t,"read from private field"),t.get(e)),Cf=(e,t,n)=>t.has(e)?Pr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),If=(e,t,n,r)=>(Kl(e,t,"write to private field"),t.set(e,n),n),et=class Ii{constructor(t,n){this.x=t,this.y=n}static delta(t,n){return new Ii(t.x-n.x,t.y-n.y)}static distance(t,n){return Math.hypot(t.x-n.x,t.y-n.y)}static equals(t,n){return t.x===n.x&&t.y===n.y}static from({x:t,y:n}){return new Ii(t,n)}},Jl,Zl,ji,ir,An,Ms=class extends(ji=it,Zl=[Y],Jl=[Y],ji){constructor(e){const t=et.from(e);super(t,(n,r)=>et.equals(n,r)),Df(An,5,this),Cf(this,ir,0),this.velocity={x:0,y:0}}get delta(){return et.delta(this.current,this.initial)}get direction(){const{current:e,previous:t}=this;if(!t)return null;const n={x:e.x-t.x,y:e.y-t.y};return!n.x&&!n.y?null:Math.abs(n.x)>Math.abs(n.y)?n.x>0?"right":"left":n.y>0?"down":"up"}get current(){return super.current}set current(e){const{current:t}=this,n=et.from(e),r={x:n.x-t.x,y:n.y-t.y},i=Date.now(),s=i-Pf(this,ir),o=a=>Math.round(a/s*100);U(()=>{If(this,ir,i),this.velocity={x:o(r.x),y:o(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(et.from(e)),this.velocity={x:0,y:0}}};An=kf(ji);ir=new WeakMap;Gl(An,2,"delta",Zl,Ms);Gl(An,2,"direction",Jl,Ms);$f(An,Ms);var Ql=(e=>(e.Horizontal="x",e.Vertical="y",e))(Ql||{});Object.values(Ql);var jf=({dragOperation:e,droppable:t})=>{const n=e.position.current;if(!n)return null;const{id:r}=t;return t.shape&&t.shape.containsPoint(n)?{id:r,value:1/et.distance(t.shape.center,n),type:Wt.PointerIntersection,priority:Nt.High}:null},Mf=({dragOperation:e,droppable:t})=>{const{shape:n}=e;if(!t.shape||!n?.current)return null;const r=n.current.intersectionArea(t.shape);if(r){const{position:i}=e,s=et.distance(t.shape.center,i.current),o=r/(n.current.area+t.shape.area-r)/s;return{id:t.id,value:o,type:Wt.ShapeIntersection,priority:Nt.Normal}}return null},Tf=e=>{var t;return(t=jf(e))!=null?t:Mf(e)};function Af(e){const{collisionDetector:t,data:n,disabled:r,element:i,id:s,accept:o,type:a}=e,c=js(d=>new Dr(Vl(Fl({},e),{register:!1,element:Fe(i)}),d)),u=Is(c);return A(s,()=>c.id=s),St(i,d=>c.element=d),A(o,()=>c.accept=o,void 0,ye),A(t,()=>c.collisionDetector=t??Tf),A(n,()=>n&&(c.data=n)),A(r,()=>c.disabled=r===!0),A(a,()=>c.type=a),{droppable:u,get isDropTarget(){return u.isDropTarget},ref:(0,k.useCallback)(d=>{var l,f;!d&&((l=c.element)!=null&&l.isConnected)&&!((f=c.manager)!=null&&f.dragOperation.status.idle)||(c.element=d??void 0)},[c])}}var Rf=({entity:e,draging_item:t})=>{const{ref:n}=Xl({id:`entity-${e.id}`,data:{type:"entity",config:e}}),{entities_pages:r,removeEntity:i,fetchData:s}=ve(),o=r.find(f=>f.id===e.entities_page_id),a=(0,k.useRef)(null),[c,u]=(0,k.useState)(!1);if(o==null)return null;function d(f){let g="";if(document.cookie&&document.cookie!==""){const y=document.cookie.split(";");for(let b=0;bg.id===e.entities_page_id)&&fetch(`/rest/entities/${f}`,{credentials:"same-origin",method:"DELETE",mode:"same-origin",headers:{"Content-Type":"application/json","X-CSRFToken":d("csrftoken")}}).then(async g=>{g.ok&&(console.log("Successfully deleted entity",f),i(f))}).catch(g=>{console.error("Error deleting entity",g)})}return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("dialog",{ref:a,className:"modal",children:[(0,w.jsxs)("div",{className:"modal-box",children:[(0,w.jsx)("h3",{className:"text-lg font-bold",children:"Delete entities page"}),(0,w.jsxs)("p",{className:"py-4",children:['Are you sure you want to delete entity "',e.friendly_name,'"?']}),(0,w.jsxs)("div",{className:"flex justify-end join",children:[(0,w.jsx)("button",{onClick:()=>a.current?.close(),className:"btn btn-neutral join-item",children:"Cancel"}),(0,w.jsx)("button",{onClick:()=>{a.current?.close(),l(e.id)},className:"btn btn-error join-item",children:"Delete"})]})]}),(0,w.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,w.jsx)("button",{children:"close"})})]}),(0,w.jsx)(Ti,{type:e.entity_type,room_id:o.room_id,entities_page_id:e.entities_page_id,room_view_position:e.room_view_position,id:e.id,opened:c,setOpened:u,onComplete:()=>{s(o.room_id),u(!1)}}),(0,w.jsxs)("div",{ref:n,className:`draggable-entity-item bg-neutral/50 text-neutral-content rounded-box flex items-center justify-center indicator w-full h-full ${t?.type!="entity_page"?"hover:outline-1 hover:outline-accent":""} cursor-grab`,title:"Drag & drop to move this entity",children:[e.controlled_by_nspanel_main_page?(0,w.jsx)("span",{className:"indicator-item badge badge-secondary me-16 w-6 h-6 flex items-center justify-center cursor-default",title:"Controlled from main page",children:(0,w.jsx)("span",{className:"mdi mdi-home"})}):null,(0,w.jsx)("button",{className:"indicator-item badge badge-info me-8 w-6 h-6 flex items-center justify-center cursor-pointer",title:"Edit entity",onClick:()=>{u(!0)},children:(0,w.jsx)("span",{className:"mdi mdi-pencil"})}),(0,w.jsx)("button",{className:"indicator-item badge badge-warning hover:badge-error w-6 h-6 flex items-center justify-center cursor-pointer",title:"Remove entity from page/room",onClick:()=>{a.current?.showModal()},children:(0,w.jsx)("span",{className:"mdi mdi-close"})}),e.controller=="home_assistant"?(0,w.jsx)("div",{className:"status status-info shadow-none absolute top-2 left-2 cursor-default",title:"Controlled by Home Assistant"}):e.controller=="openhab"?(0,w.jsx)("div",{className:"status status-warning shadow-none absolute top-2 left-2 cursor-default",title:"Controlled by OpenHAB"}):e.controller=="nspm_scene"||e.controller=="nspm"?(0,w.jsx)("div",{className:"status status-accent shadow-none absolute top-2 left-2 cursor-default",title:"Controlled by NSPanel Manager"}):(0,w.jsx)("div",{className:"status status-error animate-ping absolute top-2 left-2 cursor-default",title:"Unknown controller"}),(0,w.jsx)("span",{className:"text-sm m-2",children:e.friendly_name})]})]})},Nf=({scene:e,draging_item:t})=>{const{ref:n}=Xl({id:`scene-${e.id}`,data:{type:"scene",config:e}}),{entities_pages:r,removeScene:i,fetchData:s}=ve(),o=r.find(f=>f.id===e.entities_page_id),a=(0,k.useRef)(null),[c,u]=(0,k.useState)(!1);function d(f){let g="";if(document.cookie&&document.cookie!==""){const y=document.cookie.split(";");for(let b=0;b{g.ok&&(console.log("Successfully deleted scene",f),i(f))}).catch(g=>{console.error("Error deleting scene",g)})}return o?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("dialog",{ref:a,className:"modal",children:[(0,w.jsxs)("div",{className:"modal-box",children:[(0,w.jsx)("h3",{className:"text-lg font-bold",children:"Delete scene"}),(0,w.jsxs)("p",{className:"py-4",children:['Are you sure you want to delete scene "',e.friendly_name,'"?']}),(0,w.jsxs)("div",{className:"flex justify-end join",children:[(0,w.jsx)("button",{onClick:()=>a.current?.close(),className:"btn btn-neutral join-item",children:"Cancel"}),(0,w.jsx)("button",{onClick:()=>{a.current?.close(),l(e.id)},className:"btn btn-error join-item",children:"Delete"})]})]}),(0,w.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,w.jsx)("button",{children:"close"})})]}),(0,w.jsx)(Ti,{type:"scene",room_id:o.room_id,entities_page_id:e.entities_page_id,room_view_position:e.room_view_position,id:e.id,opened:c,setOpened:u,onComplete:()=>{s(o.room_id),u(!1)}}),(0,w.jsxs)("div",{ref:n,className:`draggable-entity-item bg-neutral/50 rounded-box text-neutral-content flex items-center justify-center indicator w-full h-full ${t?"hover:outline-1 hover:outline-accent":""} cursor-grab`,title:"Drag & drop to move this entity",children:[(0,w.jsx)("button",{className:"indicator-item badge badge-info me-8 w-6 h-6 flex items-center justify-center cursor-pointer",title:"Edit scene",onClick:()=>u(!0),children:(0,w.jsx)("span",{className:"mdi mdi-pencil"})}),(0,w.jsx)("button",{className:"indicator-item badge badge-warning hover:badge-error w-6 h-6 flex items-center justify-center cursor-pointer",title:"Remove scene from page/room",onClick:()=>{a.current?.showModal()},children:(0,w.jsx)("span",{className:"mdi mdi-close"})}),e.controller=="home_assistant"?(0,w.jsx)("div",{className:"status status-info shadow-none absolute top-2 left-2 cursor-default",title:"Controlled by Home Assistant"}):e.controller=="openhab"?(0,w.jsx)("div",{className:"status status-warning shadow-none absolute top-2 left-2 cursor-default",title:"Controlled by OpenHAB"}):e.controller=="nspm_scene"||e.controller=="nspm"?(0,w.jsx)("div",{className:"status status-accent shadow-none absolute top-2 left-2 cursor-default",title:"Controlled by NSPanel Manager"}):(0,w.jsx)("div",{className:"status status-error animate-ping absolute top-2 left-2 cursor-default",title:"Unknown controller"}),(0,w.jsx)("span",{className:"text-sm m-2",children:e.friendly_name})]})]}):null},qr=(0,k.forwardRef)(({entities_page_id:e,room_view_position:t,type:n,children:r,draging_item:i})=>{const[s,o]=(0,k.useState)(!1),{entities_pages:a,fetchData:c}=ve(),u=a.find(g=>g.id===e),{ref:d,isDropTarget:l}=Af({id:`entities_page-${e}-room_view_position-${t}`,data:{accepts:n,type:"entities_page_drop_target",config:{type:n,entities_page_id:e,room_view_position:t}}});if(u===void 0)return null;const f=i&&i.config&&i.config.entities_page_id===e&&i.config.room_view_position===t;return(0,w.jsx)("div",{ref:d,children:f?(0,w.jsxs)("div",{className:"rounded-box p-1 items-center justify-center w-full h-full bg-conic/[from_var(--border-angle)] from-base-200 via-accent/50 to-base-200 animate-rotate-border from-30% to-60%",children:[(0,w.jsx)("div",{className:"flex items-center justify-center rounded-box w-full h-full bg-base-200",children:(0,w.jsx)("span",{className:"italic font-thin",children:i.config&&i.config.friendly_name})}),r]}):r?(0,w.jsx)("div",{className:`rounded-box ${i&&i.type!="entity_page"&&l?"border-2 border-solid border-accent":""} items-center justify-center w-full h-full`,children:r}):(0,w.jsxs)("div",{className:`rounded-box ${i&&i.type!="entity_page"&&l?"border-2 border-solid border-accent":"border-dashed border-2 border-neutral/50"} flex items-center justify-center indicator w-full h-full`,children:[(0,w.jsx)(Ti,{type:n,room_id:u.room_id,entities_page_id:e,room_view_position:t,onComplete:()=>{c(u.room_id),o(!1)},opened:s,setOpened:o}),(0,w.jsx)("span",{className:"italic font-thin",children:i?.type!=="entity_page"&&l&&i&&i.config?i.config.friendly_name:"No "+(n==="scene"?"scene":"entity")+" set"}),(0,w.jsx)("button",{hidden:i?.type!=="entity_page"&&l,className:"btn btn-neutral hover:btn-success btn-xs btn-circle ms-2 flex items-center justify-center",title:`Add ${n==="scene"?"scene":"entity"}`,onClick:()=>o(!0),children:(0,w.jsx)("span",{className:"mdi mdi-plus"})})]})})}),Wf=Object.create,ec=Object.defineProperty,Lf=Object.defineProperties,zf=Object.getOwnPropertyDescriptor,Ff=Object.getOwnPropertyDescriptors,br=Object.getOwnPropertySymbols,tc=Object.prototype.hasOwnProperty,nc=Object.prototype.propertyIsEnumerable,Vf=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Rn=e=>{throw TypeError(e)},Mi=(e,t,n)=>t in e?ec(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jo=(e,t)=>{for(var n in t||(t={}))tc.call(t,n)&&Mi(e,n,t[n]);if(br)for(var n of br(t))nc.call(t,n)&&Mi(e,n,t[n]);return e},Mo=(e,t)=>Lf(e,Ff(t)),Uf=(e,t)=>{var n={};for(var r in e)tc.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&br)for(var r of br(e))t.indexOf(r)<0&&nc.call(e,r)&&(n[r]=e[r]);return n},Xf=e=>{var t;return[,,,Wf((t=void 0)!=null?t:null)]},rc=["class","method","getter","setter","accessor","field","value","get","set"],ln=e=>e!==void 0&&typeof e!="function"?Rn("Function expected"):e,Yf=(e,t,n,r,i)=>({kind:rc[e],name:t,metadata:r,addInitializer:s=>n._?Rn("Already initialized"):i.push(ln(s||null))}),Hf=(e,t)=>Mi(t,Vf("metadata"),e[3]),Yn=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i{for(var o,a,c,u,d,l=t&7,f=!1,g=!1,y=e.length+1,b=rc[l+5],x=e[y-1]=[],_=e[y]||(e[y]=[]),v=(i=i.prototype,zf({get[n](){return cn(this,s)},set[n](p){return Qe(this,s,p)}},n)),h=r.length-1;h>=0;h--)u=Yf(l,n,c={},e[3],_),u.static=f,u.private=g,d=u.access={has:p=>n in p},d.get=p=>p[n],d.set=(p,m)=>p[n]=m,a=(0,r[h])({get:v.get,set:v.set},u),c._=1,a===void 0?ln(a)&&(v[b]=a):typeof a!="object"||a===null?Rn("Object expected"):(ln(o=a.get)&&(v.get=o),ln(o=a.set)&&(v.set=o),ln(o=a.init)&&x.unshift(o));return v&&ec(i,n,v),i},sc=(e,t,n)=>t.has(e)||Rn("Cannot "+n),cn=(e,t,n)=>(sc(e,t,"read from private field"),t.get(e)),qt=(e,t,n)=>t.has(e)?Rn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Qe=(e,t,n,r)=>(sc(e,t,"write to private field"),t.set(e,n),n);function Le(e){return e instanceof Rs||e instanceof lc}var Hn=10,qf=class extends Q{constructor(e){super(e);const t=pe(()=>{const{dragOperation:r}=e;if(xn(r.activatorEvent)&&Le(r.source)&&r.status.initialized){const i=e.registry.plugins.get(Mn);if(i)return i.disable(),()=>i.enable()}}),n=e.monitor.addEventListener("dragmove",(r,i)=>{queueMicrotask(()=>{if(this.disabled||r.defaultPrevented||!r.nativeEvent)return;const{dragOperation:s}=i;if(!xn(r.nativeEvent)||!Le(s.source)||!s.shape)return;const{actions:o,collisionObserver:a,registry:c}=i,{by:u}=r;if(!u)return;const d=Bf(u),{source:l,target:f}=s,{center:g}=s.shape.current,y=[],b=[];U(()=>{for(const m of c.droppables){const{id:S}=m;if(!m.accepts(l)||S===f?.id&&Le(m)||!m.element)continue;let E=m.shape;const O=new xe(m.element,{getBoundingClientRect:C=>bn(C,void 0,.2)});!O.height||!O.width||(d=="down"&&g.y+HnO.center.y||d=="left"&&g.x-Hn>O.center.x||d=="right"&&g.x+Hnm.shape=E))}}),r.preventDefault(),a.disable();const x=a.computeCollisions(y,pd);U(()=>b.forEach(m=>m()));const[_]=x;if(!_)return;const{id:v}=_,{index:h,group:p}=l.sortable;o.setDropTarget(v).then(()=>{const{source:m,target:S,shape:E}=s;if(!m||!Le(m)||!E)return;const{index:O,group:C,target:$}=m.sortable,F=h!==O||p!==C,W=F?$:S?.element;if(!W)return;ol(W);const N=new xe(W);if(!N)return;const $e=Se.delta(N,Se.from(E.current.boundingRectangle),m.alignment);o.move({by:$e}),F?o.setDropTarget(m.id).then(()=>a.enable()):a.enable()})})});this.destroy=()=>{n(),t()}}};function Bf(e){const{x:t,y:n}=e;if(t>0)return"right";if(t<0)return"left";if(n>0)return"down";if(n<0)return"up"}var Gf=Object.defineProperty,Kf=Object.defineProperties,Jf=Object.getOwnPropertyDescriptors,To=Object.getOwnPropertySymbols,Zf=Object.prototype.hasOwnProperty,Qf=Object.prototype.propertyIsEnumerable,Ao=(e,t,n)=>t in e?Gf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ut=(e,t)=>{for(var n in t||(t={}))Zf.call(t,n)&&Ao(e,n,t[n]);if(To)for(var n of To(t))Qf.call(t,n)&&Ao(e,n,t[n]);return e},dt=(e,t)=>Kf(e,Jf(t));function eh(e,t,n){if(t===n)return e;const r=e.slice();return r.splice(n,0,r.splice(t,1)[0]),r}function Br(e){return"initialIndex"in e&&typeof e.initialIndex=="number"&&"index"in e&&typeof e.index=="number"}function th(e,t,n){var r,i,s;const{source:o,target:a,canceled:c}=t.operation;if(!o||!a||c)return"preventDefault"in t&&t.preventDefault(),e;const u=(h,p)=>h===p||typeof h=="object"&&"id"in h&&h.id===p;if(Array.isArray(e)){const h=e.findIndex(m=>u(m,o.id)),p=e.findIndex(m=>u(m,a.id));if(h===-1||p===-1){if(Br(o)){const m=o.initialIndex,S=o.index;return m===S||m<0||m>=e.length?("preventDefault"in t&&t.preventDefault(),e):n(e,m,S)}return e}if(!c&&"index"in o&&typeof o.index=="number"){const m=o.index;if(m!==h)return n(e,h,m)}return n(e,h,p)}const d=Object.entries(e);let l=-1,f,g=-1,y;for(const[h,p]of d)if(l===-1&&(l=p.findIndex(m=>u(m,o.id)),l!==-1&&(f=h)),g===-1&&(g=p.findIndex(m=>u(m,a.id)),g!==-1&&(y=h)),l!==-1&&g!==-1)break;if(l===-1&&Br(o)){const h=o.initialGroup,p=o.initialIndex,m=o.group,S=o.index;if(h==null||m==null||!(h in e)||!(m in e)||h===m&&p===S)return"preventDefault"in t&&t.preventDefault(),e;if(h===m)return dt(ut({},e),{[h]:n(e[h],p,S)});const E=e[h][p];return dt(ut({},e),{[h]:[...e[h].slice(0,p),...e[h].slice(p+1)],[m]:[...e[m].slice(0,S),E,...e[m].slice(S)]})}if(!o.manager)return e;const{dragOperation:b}=o.manager,x=(i=(r=b.shape)==null?void 0:r.current.center)!=null?i:b.position.current;if(y==null&&a.id in e){const h=a.shape&&x.y>a.shape.center.y?e[a.id].length:0;y=a.id,g=h}if(f==null||y==null||f===y&&l===g){if(f!=null&&f===y&&l===g&&Br(o)){const h=o.group!=null&&o.group!==f,p=o.index!==l;if(h||p){const m=(s=o.group)!=null?s:f;if(m in e){if(f===m)return dt(ut({},e),{[f]:n(e[f],l,o.index)});const S=e[f][l];return dt(ut({},e),{[f]:[...e[f].slice(0,l),...e[f].slice(l+1)],[m]:[...e[m].slice(0,o.index),S,...e[m].slice(o.index)]})}}}return"preventDefault"in t&&t.preventDefault(),e}if(f===y)return dt(ut({},e),{[f]:n(e[f],l,g)});const _=a.shape&&Math.round(x.y)>Math.round(a.shape.center.y)?1:0,v=e[f][l];return dt(ut({},e),{[f]:[...e[f].slice(0,l),...e[f].slice(l+1)],[y]:[...e[y].slice(0,g+_),v,...e[y].slice(g+_)]})}function nh(e,t){return th(e,t,eh)}var Ro="__default__",rh=class extends Q{constructor(e){super(e);const t=()=>{const r=new Map;for(const i of e.registry.droppables)if(i instanceof Rs){const{sortable:s}=i,{group:o}=s;let a=r.get(o);a||(a=new Set,r.set(o,a)),a.add(s)}for(const[i,s]of r)r.set(i,new Set(qn(s)));return r},n=[e.monitor.addEventListener("dragover",(r,i)=>{if(this.disabled)return;const{dragOperation:s}=i,{source:o,target:a}=s;if(!Le(o)||!Le(a)||o.sortable===a.sortable)return;const c=t(),u=o.sortable.group===a.sortable.group,d=c.get(o.sortable.group),l=u?d:c.get(a.sortable.group);!d||!l||queueMicrotask(()=>{r.defaultPrevented||i.renderer.rendering.then(()=>{var f,g,y;const b=t();for(const[$,F]of c.entries()){const W=Array.from(F).entries();for(const[N,$e]of W)if($e.index!==N||$e.group!==$||!((f=b.get($))!=null&&f.has($e)))return}const x=o.sortable.element,_=a.sortable.element;if(!_||!x||!u&&a.id===o.sortable.group)return;const v=qn(d),h=u?v:qn(l),p=(g=o.sortable.group)!=null?g:Ro,m=(y=a.sortable.group)!=null?y:Ro,S={[p]:v,[m]:h},E=nh(S,r);if(S===E)return;const O=E[m].indexOf(o.sortable),C=E[m].indexOf(a.sortable);i.collisionObserver.disable(),No(x,O,_,C),U(()=>{for(const[$,F]of E[p].entries())F.index=$;if(!u)for(const[$,F]of E[m].entries())F.group=a.sortable.group,F.index=$}),i.actions.setDropTarget(o.id).then(()=>i.collisionObserver.enable())})})}),e.monitor.addEventListener("dragend",(r,i)=>{if(!r.canceled)return;const{dragOperation:s}=i,{source:o}=s;Le(o)&&(o.sortable.initialIndex===o.sortable.index&&o.sortable.initialGroup===o.sortable.group||queueMicrotask(()=>{const a=t(),c=a.get(o.sortable.initialGroup);c&&i.renderer.rendering.then(()=>{for(const[g,y]of a.entries()){const b=Array.from(y).entries();for(const[x,_]of b)if(_.index!==x||_.group!==g)return}const u=qn(c),d=o.sortable.element,l=u[o.sortable.initialIndex],f=l?.element;!l||!f||!d||(No(d,l.index,f,o.index),U(()=>{for(const[g,y]of a.entries()){const b=Array.from(y).values();for(const x of b)x.index=x.initialIndex,x.group=x.initialGroup}}))})}))})];this.destroy=()=>{for(const r of n)r()}}};function No(e,t,n,r){const i=r(U(()=>{var f,g;(f=this.manager)==null||f.registry.register(this.droppable),(g=this.manager)==null||g.registry.register(this.draggable)}),()=>this.unregister()),this.unregister=()=>{U(()=>{var f,g;(f=this.manager)==null||f.registry.unregister(this.droppable),(g=this.manager)==null||g.registry.unregister(this.draggable)})},this.destroy=()=>{U(()=>{this.droppable.destroy(),this.draggable.destroy()})};var n=e,{effects:r=()=>[],group:i,index:s,sensors:o,type:a,transition:c=oc,plugins:u}=n,d=Uf(n,["effects","group","index","sensors","type","transition","plugins"]);const l=_e(u,Wo);this.droppable=new Rs(d,t,this),this.draggable=new lc(Mo(jo({},d),{plugins:l,effects:()=>[()=>{var f,g,y;const b=(f=this.manager)==null?void 0:f.dragOperation.status;b?.initializing&&this.id===((y=(g=this.manager)==null?void 0:g.dragOperation.source)==null?void 0:y.id)&&Bn.clear(this.manager),b?.dragging&&Bn.set(this.manager,this.id,T(()=>({initialIndex:this.index,initialGroup:this.group})))},()=>{const{index:f,group:g,manager:y}=this,b=cn(this,dn),x=cn(this,un);(f!==b||g!==x)&&(Qe(this,dn,f),Qe(this,un,g),this.animate())},()=>{var f,g;const{target:y}=this,{isDragSource:b}=this.draggable;((g=(f=this.draggable.pluginConfig(Ol))==null?void 0:f.feedback)!=null?g:"default")==="move"&&b&&(this.droppable.disabled=!y)},...r()],type:a,sensors:o}),t,this),Qe(this,yt,d.element),this.manager=t,this.index=s,Qe(this,dn,s),this.group=i,Qe(this,un,i),this.type=a,this.transition=c}get initialIndex(){var e,t;return(t=(e=Bn.get(this.manager,this.id))==null?void 0:e.initialIndex)!=null?t:this.index}get initialGroup(){var e,t;return(t=(e=Bn.get(this.manager,this.id))==null?void 0:e.initialGroup)!=null?t:this.group}animate(){T(()=>{const{manager:e,transition:t}=this,{shape:n}=this.droppable;if(!e)return;const{idle:r}=e.dragOperation.status;!n||!t||r&&!t.idle||e.renderer.rendering.then(()=>{const{element:i}=this;if(!i)return;for(const d of i.getAnimations())"transitionProperty"in d&&(d.transitionProperty==="transform"||d.transitionProperty==="translate"||d.transitionProperty==="scale")&&d.cancel();const s=this.refreshShape();if(!s)return;const o={x:n.boundingRectangle.left-s.boundingRectangle.left,y:n.boundingRectangle.top-s.boundingRectangle.top},{translate:a}=Oe(i),c=xo(i,a,!1),u=xo(i,a);if(o.x||o.y){const d=ms(le(i))?Mo(jo({},t),{duration:0}):t;al({element:i,keyframes:{translate:[`${c.x+o.x}px ${c.y+o.y}px ${c.z}`,`${u.x}px ${u.y}px ${u.z}`]},options:d}).then(()=>{e.dragOperation.status.dragging||(this.droppable.shape=void 0)})}})})}get manager(){return this.draggable.manager}set manager(e){U(()=>{this.draggable.manager=e,this.droppable.manager=e})}set element(e){U(()=>{const t=cn(this,yt),n=this.droppable.element,r=this.draggable.element;(!n||n===t)&&(this.droppable.element=e),(!r||r===t)&&(this.draggable.element=e),Qe(this,yt,e)})}get element(){var e,t;const n=cn(this,yt);if(n)return(t=(e=gi.get(n))!=null?e:n)!=null?t:this.droppable.element}set target(e){this.droppable.element=e}get target(){return this.droppable.element}set source(e){this.draggable.element=e}get source(){return this.draggable.element}get disabled(){return this.draggable.disabled&&this.droppable.disabled}set plugins(e){this.draggable.plugins=_e(e,Wo)}set disabled(e){U(()=>{this.droppable.disabled=e,this.draggable.disabled=e})}set data(e){U(()=>{this.droppable.data=e,this.draggable.data=e})}set handle(e){this.draggable.handle=e}set id(e){this.droppable.id=e,this.draggable.id=e}get id(){return this.droppable.id}set sensors(e){this.draggable.sensors=e}set modifiers(e){this.draggable.modifiers=e}set collisionPriority(e){this.droppable.collisionPriority=e}set collisionDetector(e){this.droppable.collisionDetector=e??ll}set alignment(e){this.draggable.alignment=e}get alignment(){return this.draggable.alignment}set type(e){U(()=>{this.droppable.type=e,this.draggable.type=e})}get type(){return this.draggable.type}set accept(e){this.droppable.accept=e}get accept(){return this.droppable.accept}get isDropTarget(){return this.droppable.isDropTarget}get isDragSource(){return this.draggable.isDragSource}get isDragging(){return this.draggable.isDragging}get isDropping(){return this.draggable.isDropping}get status(){return this.draggable.status}refreshShape(){return this.droppable.refreshShape()}accepts(e){return this.droppable.accepts(e)}};ze=Xf();Ts=new WeakMap;un=new WeakMap;dn=new WeakMap;As=new WeakMap;yt=new WeakMap;ic(ze,4,"index",sh,Cr,Ts);ic(ze,4,"group",ac,Cr,As);Hf(ze,Cr);var lc=class extends Tn{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}get initialIndex(){return this.sortable.initialIndex}get group(){return this.sortable.group}get initialGroup(){return this.sortable.initialGroup}},Rs=class extends Dr{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}get group(){return this.sortable.group}},oh=Object.defineProperty,ah=Object.defineProperties,lh=Object.getOwnPropertyDescriptors,Lo=Object.getOwnPropertySymbols,ch=Object.prototype.hasOwnProperty,uh=Object.prototype.propertyIsEnumerable,zo=(e,t,n)=>t in e?oh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gr=(e,t)=>{for(var n in t||(t={}))ch.call(t,n)&&zo(e,n,t[n]);if(Lo)for(var n of Lo(t))uh.call(t,n)&&zo(e,n,t[n]);return e},dh=(e,t)=>ah(e,lh(t));function fh(e){const{accept:t,collisionDetector:n,collisionPriority:r,id:i,data:s,element:o,handle:a,index:c,group:u,disabled:d,modifiers:l,sensors:f,target:g,type:y,plugins:b}=e,x=Gr(Gr({},oc),e.transition),_=js(h=>new Cr(dh(Gr({},e),{transition:x,register:!1,handle:Fe(a),element:Fe(o),target:Fe(g)}),h)),v=Is(_,hh);return A(i,()=>_.id=i),Vt(()=>{U(()=>{_.group=u,_.index=c})},[_,u,c]),A(y,()=>_.type=y),A(t,()=>_.accept=t,void 0,ye),A(s,()=>s&&(_.data=s)),A(c,()=>{var h;(h=_.manager)!=null&&h.dragOperation.status.idle&&x?.idle&&_.refreshShape()},ff),St(a,h=>_.handle=h),St(o,h=>_.element=h),St(g,h=>_.target=h),A(d,()=>_.disabled=d===!0),A(f,()=>_.sensors=f),A(n,()=>_.collisionDetector=n),A(r,()=>_.collisionPriority=r),A(b,()=>_.plugins=b,void 0,ye),A(x,()=>_.transition=x,void 0,ye),A(l,()=>_.modifiers=l,void 0,ye),A(e.alignment,()=>_.alignment=e.alignment),{sortable:v,get isDragging(){return v.isDragging},get isDropping(){return v.isDropping},get isDragSource(){return v.isDragSource},get isDropTarget(){return v.isDropTarget},handleRef:(0,k.useCallback)(h=>{_.handle=h??void 0},[_]),ref:(0,k.useCallback)(h=>{var p,m;!h&&((p=_.element)!=null&&p.isConnected)&&!((m=_.manager)!=null&&m.dragOperation.status.idle)||(_.element=h??void 0)},[_]),sourceRef:(0,k.useCallback)(h=>{var p,m;!h&&((p=_.source)!=null&&p.isConnected)&&!((m=_.manager)!=null&&m.dragOperation.status.idle)||(_.source=h??void 0)},[_]),targetRef:(0,k.useCallback)(h=>{var p,m;!h&&((p=_.target)!=null&&p.isConnected)&&!((m=_.manager)!=null&&m.dragOperation.status.idle)||(_.target=h??void 0)},[_])}}function hh(e,t,n){return!!(e==="isDragSource"&&!n&&t)}var ph=({id:e,draging_item:t,deleteEntitiesPage:n})=>{const{entities_pages:r,entities:i,scenes:s}=ve(),o=r.find(h=>h.id===e),[a,c]=(0,k.useState)({room_id:o?o.room_id:-1,id:e,can_remove:o?r.filter(h=>h.type==o.type).length>1:!1,type:o?o.type:"unknown",number_of_entities:o?o.number_of_entities:12}),[u,d]=(0,k.useState)(!1),l=a.number_of_entities===12?"grid-rows-6":a.number_of_entities===8?"grid-rows-4":"grid-rows-2",f=(0,k.useRef)(null),g=(0,k.useRef)(null),[y,b]=(0,k.useState)(null),{ref:x}=fh({id:e,index:o?o.display_order:0,data:{type:"entity_page",entity_page_config:o},handle:y,disabled:!a.can_remove});function _(h){let p="";if(document.cookie&&document.cookie!==""){const m=document.cookie.split(";");for(let S=0;S{const m=await p.json();if(!p.ok){const S=m&&m.message||p.status;return Promise.reject(S)}}).catch(p=>{console.error("There was an error!",p)})}return(0,k.useEffect)(()=>{const h=p=>{g.current&&!g.current.contains(p.target)&&d(!1)};return window.addEventListener("click",h),()=>{window.removeEventListener("click",h)}},[g,u]),(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("dialog",{ref:f,className:"modal",children:[(0,w.jsxs)("div",{className:"modal-box",children:[(0,w.jsxs)("h3",{className:"text-lg font-bold",children:["Delete ",a.type," page"]}),(0,w.jsxs)("p",{className:"py-4",children:["Are you sure you want to delete this ",a.type," page and all its entities?"]}),(0,w.jsxs)("div",{className:"flex justify-end join",children:[(0,w.jsx)("button",{onClick:()=>f.current?.close(),className:"btn btn-neutral join-item",children:"Cancel"}),(0,w.jsx)("button",{onClick:()=>{f.current?.close(),n(a.id)},className:"btn btn-error join-item",children:"Delete"})]})]}),(0,w.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,w.jsx)("button",{children:"close"})})]}),(0,w.jsxs)("li",{ref:x,id:"nspanel_entities_page_{{ page.id }}","hx-swap-oob":"true",className:`bg-base-200 float-left m-2 rounded-box p-3 grid grid-cols-2 ${l} gap-4 w-full max-w-[24rem] aspect-square indicator nspanel-entities-page`,children:[(()=>{const h=[];for(let p=0;pf.current?.showModal(),children:"✕"}),(0,w.jsxs)("div",{ref:g,className:`dropdown dropdown-top dropdown-center ${u?"dropdown-open":""} me-8 flex indicator-item indicator-bottom indicator-end`,children:[(0,w.jsx)("div",{onClick:()=>d(!u),className:"badge badge-info w-6 h-6 flex items-center justify-center cursor-pointer",children:(0,w.jsx)("span",{className:"mdi mdi-pencil"})}),(0,w.jsxs)("div",{className:"dropdown-content bg-base-100 join rounded-box z-1 p-1 shadow-sm",children:[(0,w.jsx)("button",{onClick:()=>v(4),className:`btn join-item btn-lg btn-square ${a.number_of_entities===4?"btn-active btn-accent":""}`,children:"4"}),(0,w.jsx)("button",{onClick:()=>v(8),className:`btn join-item btn-lg btn-square ${a.number_of_entities===8?"btn-active btn-accent":""}`,children:"8"}),(0,w.jsx)("button",{onClick:()=>v(12),className:`btn join-item btn-lg btn-square ${a.number_of_entities===12?"btn-active btn-accent":""}`,children:"12"})]})]}),a.can_remove&&(0,w.jsx)("span",{className:"indicator-item indicator-bottom indicator-center badge badge-neutral hover:badge-info w-6 h-6 flex items-center justify-center nspanel-entities-page-move-handle cursor-grab",title:"Drag & drop to move this page",ref:b,children:(0,w.jsx)("span",{className:"mdi mdi-drag"})})]})]})};function gh(e){let t="";if(document.cookie&&document.cookie!==""){const n=document.cookie.split(";");for(let r=0;r({status:"none",rooms:null,fetchData:async()=>{e({status:"loading"}),fetch("/rest/rooms",{credentials:"same-origin",method:"GET",mode:"same-origin",headers:{"Content-Type":"application/json","X-CSRFToken":gh("csrftoken")}}).then(t=>t.json()).then(t=>{e(n=>({...n,status:"loaded",rooms:t.rooms}))})}})),Eh=({room_id:e,type:t})=>{const{entities_pages:n,fetchData:r,removeEntitiesPage:i,entities:s,scenes:o,setScenePosition:a,setEntityPosition:c}=ve(),[u,d]=(0,k.useState)(void 0),[l,f]=(0,k.useState)(!1);(0,k.useEffect)(()=>{r(e)},[e,r]),(0,k.useEffect)(()=>{Kr.getState().status=="none"&&Kr.getState().fetchData()},[]);function g(v){let h="";if(document.cookie&&document.cookie!==""){const p=document.cookie.split(";");for(let m=0;m{h.ok&&(console.log("Successfully deleted entities page",v),i(v))}).catch(h=>{console.error("Error deleting entities page",h)})}async function b(v){console.log("Creating entities page",t);let h="/rest/global/entities_pages";e!==void 0&&(h=`/rest/rooms/${e}/entities_pages`),fetch(h,{credentials:"same-origin",method:"PUT",mode:"same-origin",headers:{"Content-Type":"application/json","X-CSRFToken":g("csrftoken")},body:JSON.stringify({type:v,is_scenes_page:t=="scene"})}).then(async p=>{p.ok&&(console.log("Successfully created entities page",t,"number of entities",v),r(e))}).catch(p=>{console.error("Error creating entities page",p)})}async function x(v,h){fetch(`/rest/rooms/${e}/entities/order`,{credentials:"same-origin",method:"PUT",mode:"same-origin",headers:{"Content-Type":"application/json","X-CSRFToken":g("csrftoken")},body:JSON.stringify({entities:v,scenes:h})}).then(async p=>{const m=await p.json();if(!p.ok){const S=m&&m.message||p.status;return Promise.reject(S)}}).catch(p=>{console.error("There was an error!",p)})}async function _(v){fetch("/rest/entities_pages/order",{credentials:"same-origin",method:"PUT",mode:"same-origin",headers:{"Content-Type":"application/json","X-CSRFToken":g("csrftoken")},body:JSON.stringify({order:v.map(h=>[h.id,h.display_order])})}).then(async h=>{const p=await h.json();if(!h.ok){const m=p&&p.message||h.status;return Promise.reject(m)}}).catch(h=>{console.error("There was an error!",h)})}return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("div",{className:"flex items-center justify-start mb-4",children:[(0,w.jsxs)("span",{className:"text-xl",children:[Kr.getState().rooms?.find(v=>v.id==e)?.name," ",t=="entity"?"entities":t=="scene"?"scenes":"UNKNOWN ENTITY PAGE TYPE"]}),(0,w.jsxs)("div",{className:`dropdown dropdown-top dropdown-center ${l?"dropdown-open":""} me-8 flex indicator-item indicator-bottom indicator-end`,children:[(0,w.jsx)("div",{onClick:()=>f(!l),className:"btn btn-xs btn-circle btn-success ml-2",children:(0,w.jsx)("span",{className:"mdi mdi-plus"})}),(0,w.jsxs)("div",{className:"dropdown-content bg-base-100 join rounded-box z-1 p-1 shadow-sm",children:[(0,w.jsx)("button",{onClick:()=>{f(!1),b(4)},className:"btn join-item btn-lg btn-square",children:"4"}),(0,w.jsx)("button",{onClick:()=>{f(!1),b(8)},className:"btn join-item btn-lg btn-square",children:"8"}),(0,w.jsx)("button",{onClick:()=>{f(!1),b(12)},className:"btn join-item btn-lg btn-square",children:"12"})]})]})]}),(0,w.jsx)(yf,{onDragStart:v=>{const{source:h}=v.operation;h!=null&&d(h.data)},onDragEnd:v=>{if(d(void 0),v.canceled)return;const{source:h,target:p}=v.operation;if(h==null||p==null)return;const m=h.data,S=p.data;if(!(m.config&&S.config&&m.config.entities_page_id==S.config.entities_page_id&&m.config.room_view_position==S.config.room_view_position)){if(m.type=="entity"&&m.config){const E=s.find($=>m.config&&$.id==m.config.id);if(!E)return;let O=s.find($=>S.config&&$.entities_page_id==S.config.entities_page_id&&$.room_view_position==S.config.room_view_position);O!=null&&(O=JSON.parse(JSON.stringify(O)),O&&c(O.id,E.entities_page_id,E.room_view_position));const C=JSON.parse(JSON.stringify(E));S.config?(c(C.id,S.config.entities_page_id,S.config.room_view_position),x(ve.getState().entities,[])):console.error("Failed to set new entity position. Target data has no config")}else if(m.type=="scene"&&m.config){const E=o.find($=>m.config&&$.id==m.config.id);if(!E)return;let O=o.find($=>S.config&&$.entities_page_id==S.config.entities_page_id&&$.room_view_position==S.config.room_view_position);O!=null&&(O=JSON.parse(JSON.stringify(O)),O&&a(O.id,E.entities_page_id,E.room_view_position));const C=JSON.parse(JSON.stringify(E));S.config?(a(C.id,S.config.entities_page_id,S.config.room_view_position),x([],ve.getState().scenes)):console.error("Failed to set new scene position as target as not config")}else if(m.type=="entity_page"&&m.entity_page_config&&Le(h)){const{initialIndex:E,index:O}=h;if(console.log("Initial index: ",E," index: ",O),E==O)return;if(!ve.getState().entities_pages.find(F=>F.display_order==E)){console.error("Failed to find source page data. Cannot continue.");return}const C=[...ve.getState().entities_pages.filter(F=>F.type==t)],[$]=C.splice(E,1);C.splice(O,0,$),C.forEach((F,W)=>{F.display_order=W}),ve.setState({entities_pages:[...C,...ve.getState().entities_pages.filter(F=>F.type!=t)]}),_(C)}}},children:(0,w.jsx)("ul",{className:"list-none w-full nspanel-entities-pages",children:n.filter(v=>v.type===t).map(v=>(0,w.jsx)(ph,{id:v.id,draging_item:u,deleteEntitiesPage:y},`entity_page-${v.id}`))})})]})};export{Eh as default}; diff --git a/docker/web/nspanelmanager/web/react-components/dist/EntitiesPagesView-DShidmI8.js b/docker/web/nspanelmanager/web/react-components/dist/EntitiesPagesView-DShidmI8.js new file mode 100644 index 000000000..fba81cc39 --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/EntitiesPagesView-DShidmI8.js @@ -0,0 +1,865 @@ +import { c as __toESM, r as require_react, t as require_jsx_runtime } from "./main-FKp56mKw.js"; +import { a as useDroppable, i as useDraggable, n as isSortable, r as DragDropProvider, t as useSortable } from "./sortable-Ke3drO00.js"; +import { t as create } from "./react-Cm4z11-B.js"; +import { i as useEntitiesPagesStore, n as MultiStep_AddOrEditEntity } from "./MultiStep_AddEditEntity-xcopfTe5.js"; +//#region src/components/EntitiesPage/GenericEntityBox.tsx +var import_react = /* @__PURE__ */ __toESM(require_react(), 1); +var import_jsx_runtime = require_jsx_runtime(); +var GenericEntityBox = ({ entity, draging_item }) => { + const { ref } = useDraggable({ + id: `entity-${entity.id}`, + data: { + type: "entity", + config: entity + } + }); + const { entities_pages, removeEntity, fetchData } = useEntitiesPagesStore(); + const entity_page = entities_pages.find((page) => page.id === entity.entities_page_id); + const removeEntityDialogRef = (0, import_react.useRef)(null); + const [editDialogOpened, setEditDialogOpened] = (0, import_react.useState)(false); + if (entity_page == void 0) return null; + function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + async function deleteEntity(id) { + console.log("Deleting entity", id); + if (entities_pages.find((page) => page.id === entity.entities_page_id)) fetch(`/rest/entities/${id}`, { + credentials: "same-origin", + method: "DELETE", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + } + }).then(async (response) => { + if (response.ok) { + console.log("Successfully deleted entity", id); + removeEntity(id); + } + }).catch((error) => { + console.error("Error deleting entity", error); + }); + } + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("dialog", { + ref: removeEntityDialogRef, + className: "modal", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "modal-box", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { + className: "text-lg font-bold", + children: "Delete entities page" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { + className: "py-4", + children: [ + "Are you sure you want to delete entity \"", + entity.friendly_name, + "\"?" + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex justify-end join", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => removeEntityDialogRef.current?.close(), + className: "btn btn-neutral join-item", + children: "Cancel" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => { + removeEntityDialogRef.current?.close(); + deleteEntity(entity.id); + }, + className: "btn btn-error join-item", + children: "Delete" + })] + }) + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { + method: "dialog", + className: "modal-backdrop", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { children: "close" }) + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MultiStep_AddOrEditEntity, { + type: entity.entity_type, + room_id: entity_page.room_id, + entities_page_id: entity.entities_page_id, + room_view_position: entity.room_view_position, + id: entity.id, + opened: editDialogOpened, + setOpened: setEditDialogOpened, + onComplete: () => { + fetchData(entity_page.room_id); + setEditDialogOpened(false); + } + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + ref, + className: `draggable-entity-item bg-neutral/50 text-neutral-content rounded-box flex items-center justify-center indicator w-full h-full ${draging_item?.type != "entity_page" ? "hover:outline-1 hover:outline-accent" : ""} cursor-grab`, + title: "Drag & drop to move this entity", + children: [ + (() => { + if (entity.controlled_by_nspanel_main_page) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "indicator-item badge badge-secondary me-16 w-6 h-6 flex items-center justify-center cursor-default", + title: "Controlled from main page", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mdi mdi-home" }) + }); + return null; + })(), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + className: "indicator-item badge badge-info me-8 w-6 h-6 flex items-center justify-center cursor-pointer", + title: "Edit entity", + onClick: () => { + setEditDialogOpened(true); + }, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mdi mdi-pencil" }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + className: "indicator-item badge badge-warning hover:badge-error w-6 h-6 flex items-center justify-center cursor-pointer", + title: "Remove entity from page/room", + onClick: () => { + removeEntityDialogRef.current?.showModal(); + }, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mdi mdi-close" }) + }), + (() => { + if (entity.controller == "home_assistant") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "status status-info shadow-none absolute top-2 left-2 cursor-default", + title: "Controlled by Home Assistant" + }); + else if (entity.controller == "openhab") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "status status-warning shadow-none absolute top-2 left-2 cursor-default", + title: "Controlled by OpenHAB" + }); + else if (entity.controller == "nspm_scene" || entity.controller == "nspm") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "status status-accent shadow-none absolute top-2 left-2 cursor-default", + title: "Controlled by NSPanel Manager" + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "status status-error animate-ping absolute top-2 left-2 cursor-default", + title: "Unknown controller" + }); + })(), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm m-2", + children: entity.friendly_name + }) + ] + }) + ] }); +}; +//#endregion +//#region src/components/EntitiesPage/GenericSceneBox.tsx +var GenericSceneBox = ({ scene, draging_item }) => { + const { ref } = useDraggable({ + id: `scene-${scene.id}`, + data: { + type: "scene", + config: scene + } + }); + const { entities_pages, removeScene, fetchData } = useEntitiesPagesStore(); + const entity_page = entities_pages.find((page) => page.id === scene.entities_page_id); + const removeSceneDialogRef = (0, import_react.useRef)(null); + const [editDialogOpened, setEditDialogOpened] = (0, import_react.useState)(false); + function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + async function deleteScene(id) { + console.log("Deleting scene", id); + if (entity_page) fetch(`/rest/scenes/${id}`, { + credentials: "same-origin", + method: "DELETE", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + } + }).then(async (response) => { + if (response.ok) { + console.log("Successfully deleted scene", id); + removeScene(id); + } + }).catch((error) => { + console.error("Error deleting scene", error); + }); + } + if (!entity_page) return null; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("dialog", { + ref: removeSceneDialogRef, + className: "modal", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "modal-box", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { + className: "text-lg font-bold", + children: "Delete scene" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { + className: "py-4", + children: [ + "Are you sure you want to delete scene \"", + scene.friendly_name, + "\"?" + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex justify-end join", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => removeSceneDialogRef.current?.close(), + className: "btn btn-neutral join-item", + children: "Cancel" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => { + removeSceneDialogRef.current?.close(); + deleteScene(scene.id); + }, + className: "btn btn-error join-item", + children: "Delete" + })] + }) + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { + method: "dialog", + className: "modal-backdrop", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { children: "close" }) + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MultiStep_AddOrEditEntity, { + type: "scene", + room_id: entity_page.room_id, + entities_page_id: scene.entities_page_id, + room_view_position: scene.room_view_position, + id: scene.id, + opened: editDialogOpened, + setOpened: setEditDialogOpened, + onComplete: () => { + fetchData(entity_page.room_id); + setEditDialogOpened(false); + } + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + ref, + className: `draggable-entity-item bg-neutral/50 rounded-box text-neutral-content flex items-center justify-center indicator w-full h-full ${draging_item ? "hover:outline-1 hover:outline-accent" : ""} cursor-grab`, + title: "Drag & drop to move this entity", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + className: "indicator-item badge badge-info me-8 w-6 h-6 flex items-center justify-center cursor-pointer", + title: "Edit scene", + onClick: () => setEditDialogOpened(true), + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mdi mdi-pencil" }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + className: "indicator-item badge badge-warning hover:badge-error w-6 h-6 flex items-center justify-center cursor-pointer", + title: "Remove scene from page/room", + onClick: () => { + removeSceneDialogRef.current?.showModal(); + }, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mdi mdi-close" }) + }), + (() => { + if (scene.controller == "home_assistant") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "status status-info shadow-none absolute top-2 left-2 cursor-default", + title: "Controlled by Home Assistant" + }); + else if (scene.controller == "openhab") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "status status-warning shadow-none absolute top-2 left-2 cursor-default", + title: "Controlled by OpenHAB" + }); + else if (scene.controller == "nspm_scene" || scene.controller == "nspm") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "status status-accent shadow-none absolute top-2 left-2 cursor-default", + title: "Controlled by NSPanel Manager" + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "status status-error animate-ping absolute top-2 left-2 cursor-default", + title: "Unknown controller" + }); + })(), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm m-2", + children: scene.friendly_name + }) + ] + }) + ] }); +}; +//#endregion +//#region src/components/EntitiesPage/EntitiesPageDropTarget.tsx +var EntitiesDropTarget = (0, import_react.forwardRef)(({ entities_page_id, room_view_position, type, children, draging_item }) => { + const [addEditEntityDialogOpened, setAddEditEntityDialogOpened] = (0, import_react.useState)(false); + const { entities_pages, fetchData } = useEntitiesPagesStore(); + const entities_page = entities_pages.find((page) => page.id === entities_page_id); + const { ref, isDropTarget } = useDroppable({ + id: `entities_page-${entities_page_id}-room_view_position-${room_view_position}`, + data: { + accepts: type, + type: "entities_page_drop_target", + config: { + type, + entities_page_id, + room_view_position + } + } + }); + if (entities_page === void 0) return null; + const isChildDragging = draging_item && draging_item.config && draging_item.config.entities_page_id === entities_page_id && draging_item.config.room_view_position === room_view_position; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + ref, + children: (() => { + if (isChildDragging) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: `rounded-box p-1 items-center justify-center w-full h-full bg-conic/[from_var(--border-angle)] from-base-200 via-accent/50 to-base-200 animate-rotate-border from-30% to-60%`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex items-center justify-center rounded-box w-full h-full bg-base-200", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "italic font-thin", + children: draging_item.config && draging_item.config.friendly_name + }) + }), children] + }); + else if (children) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: `rounded-box ${draging_item && draging_item.type != "entity_page" && isDropTarget ? "border-2 border-solid border-accent" : ""} items-center justify-center w-full h-full`, + children + }); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: `rounded-box ${draging_item && draging_item.type != "entity_page" && isDropTarget ? "border-2 border-solid border-accent" : "border-dashed border-2 border-neutral/50"} flex items-center justify-center indicator w-full h-full`, + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MultiStep_AddOrEditEntity, { + type, + room_id: entities_page.room_id, + entities_page_id, + room_view_position, + onComplete: () => { + fetchData(entities_page.room_id); + setAddEditEntityDialogOpened(false); + }, + opened: addEditEntityDialogOpened, + setOpened: setAddEditEntityDialogOpened + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "italic font-thin", + children: draging_item?.type !== "entity_page" && isDropTarget && draging_item && draging_item.config ? draging_item.config.friendly_name : "No " + (type === "scene" ? "scene" : "entity") + " set" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + hidden: draging_item?.type !== "entity_page" && isDropTarget, + className: "btn btn-neutral hover:btn-success btn-xs btn-circle ms-2 flex items-center justify-center", + title: `Add ${type === "scene" ? "scene" : "entity"}`, + onClick: () => setAddEditEntityDialogOpened(true), + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mdi mdi-plus" }) + }) + ] + }); + })() + }); +}); +//#endregion +//#region src/components/EntitiesPage/EntitiesPage.tsx +var EntitiesPage = ({ id, draging_item, deleteEntitiesPage }) => { + const { entities_pages, entities, scenes } = useEntitiesPagesStore(); + const page = entities_pages.find((p) => p.id === id); + const [pageData, setPageData] = (0, import_react.useState)({ + room_id: page ? page.room_id : -1, + id, + can_remove: page ? entities_pages.filter((p) => p.type == page.type).length > 1 : false, + type: page ? page.type : "unknown", + number_of_entities: page ? page.number_of_entities : 12 + }); + const [editPageTypeOpen, setEditPageTypeOpen] = (0, import_react.useState)(false); + const gridRows = pageData.number_of_entities === 12 ? "grid-rows-6" : pageData.number_of_entities === 8 ? "grid-rows-4" : "grid-rows-2"; + const dialogRef = (0, import_react.useRef)(null); + const entitiesPageNumberOfEntitiesDiv = (0, import_react.useRef)(null); + const [handle, setHandle] = (0, import_react.useState)(null); + const { ref } = useSortable({ + id, + index: page ? page.display_order : 0, + data: { + type: "entity_page", + entity_page_config: page + }, + handle, + disabled: !pageData.can_remove + }); + function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + async function setPageNumberOfEntities(type) { + setPageData({ + ...pageData, + number_of_entities: type + }); + setEditPageTypeOpen(false); + fetch(`/rest/entities_pages/${pageData.id}`, { + credentials: "same-origin", + method: "PUT", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + }, + body: JSON.stringify({ + ...pageData, + number_of_entities: type + }) + }).then(async (response) => { + const data = await response.json(); + if (!response.ok) { + const error = data && data.message || response.status; + return Promise.reject(error); + } + }).catch((error) => { + console.error("There was an error!", error); + }); + } + (0, import_react.useEffect)(() => { + const listener = (event) => { + if (entitiesPageNumberOfEntitiesDiv.current && !entitiesPageNumberOfEntitiesDiv.current.contains(event.target)) setEditPageTypeOpen(false); + }; + window.addEventListener("click", listener); + return () => { + window.removeEventListener("click", listener); + }; + }, [entitiesPageNumberOfEntitiesDiv, editPageTypeOpen]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("dialog", { + ref: dialogRef, + className: "modal", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "modal-box", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h3", { + className: "text-lg font-bold", + children: [ + "Delete ", + pageData.type, + " page" + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { + className: "py-4", + children: [ + "Are you sure you want to delete this ", + pageData.type, + " page and all its entities?" + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex justify-end join", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => dialogRef.current?.close(), + className: "btn btn-neutral join-item", + children: "Cancel" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => { + dialogRef.current?.close(); + deleteEntitiesPage(pageData.id); + }, + className: "btn btn-error join-item", + children: "Delete" + })] + }) + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { + method: "dialog", + className: "modal-backdrop", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { children: "close" }) + })] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { + ref, + id: "nspanel_entities_page_{{ page.id }}", + "hx-swap-oob": "true", + className: `bg-base-200 float-left m-2 rounded-box p-3 grid grid-cols-2 ${gridRows} gap-4 w-full max-w-[24rem] aspect-square indicator nspanel-entities-page`, + children: [ + (() => { + const items = []; + for (let i = 0; i < pageData.number_of_entities; i++) { + let item = null; + if (pageData.type == "entity") { + for (let j = 0; j < entities.length; j++) if (entities[j].room_view_position === i && entities[j].type === "entity" && entities[j].entities_page_id === pageData.id) { + item = entities[j]; + break; + } + } else if (pageData.type == "scene") { + for (let j = 0; j < scenes.length; j++) if (scenes[j].room_view_position === i && scenes[j].type === "scene" && scenes[j].entities_page_id === pageData.id) { + item = scenes[j]; + break; + } + } else console.error("Unknown entities page type: ", pageData.type); + if (item != null) { + if (item.type === "scene") items.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EntitiesDropTarget, { + entities_page_id: pageData.id, + room_view_position: i, + type: pageData.type, + draging_item, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GenericSceneBox, { + scene: item, + draging_item + }, item.id) + }, i)); + else items.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EntitiesDropTarget, { + entities_page_id: pageData.id, + room_view_position: i, + type: pageData.type, + draging_item, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GenericEntityBox, { + entity: item, + draging_item + }, item.id) + }, i)); + } else items.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EntitiesDropTarget, { + entities_page_id: pageData.id, + room_view_position: i, + type: pageData.type, + draging_item + }, i)); + } + return items; + })(), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + disabled: !pageData.can_remove, + className: "indicator-item indicator-bottom indicator-end badge not-disabled:badge-neutral not-disabled:hover:badge-error w-6 h-6 flex items-center justify-center not-disabled:cursor-pointer", + title: `${pageData.can_remove ? "Delete page" : "Cannot delete last page"}`, + onClick: () => dialogRef.current?.showModal(), + children: "✕" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + ref: entitiesPageNumberOfEntitiesDiv, + className: `dropdown dropdown-top dropdown-center ${editPageTypeOpen ? "dropdown-open" : ""} me-8 flex indicator-item indicator-bottom indicator-end`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + onClick: () => setEditPageTypeOpen(!editPageTypeOpen), + className: "badge badge-info w-6 h-6 flex items-center justify-center cursor-pointer", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mdi mdi-pencil" }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "dropdown-content bg-base-100 join rounded-box z-1 p-1 shadow-sm", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => setPageNumberOfEntities(4), + className: `btn join-item btn-lg btn-square ${pageData.number_of_entities === 4 ? "btn-active btn-accent" : ""}`, + children: "4" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => setPageNumberOfEntities(8), + className: `btn join-item btn-lg btn-square ${pageData.number_of_entities === 8 ? "btn-active btn-accent" : ""}`, + children: "8" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => setPageNumberOfEntities(12), + className: `btn join-item btn-lg btn-square ${pageData.number_of_entities === 12 ? "btn-active btn-accent" : ""}`, + children: "12" + }) + ] + })] + }), + pageData.can_remove && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "indicator-item indicator-bottom indicator-center badge badge-neutral hover:badge-info w-6 h-6 flex items-center justify-center nspanel-entities-page-move-handle cursor-grab", + title: "Drag & drop to move this page", + ref: setHandle, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mdi mdi-drag" }) + }) + ] + })] }); +}; +//#endregion +//#region src/stores/RoomsStore.ts +function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; +} +var useRoomsStore = create((set) => ({ + status: "none", + rooms: null, + fetchData: async () => { + set({ status: "loading" }); + fetch(`/rest/rooms`, { + credentials: "same-origin", + method: "GET", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + } + }).then((response) => response.json()).then((data) => { + set((state) => ({ + ...state, + status: "loaded", + rooms: data.rooms + })); + }); + } +})); +//#endregion +//#region src/components/EntitiesPage/EntitiesPagesView.tsx +var EntitiesPagesView = ({ room_id, type }) => { + const { entities_pages, fetchData, removeEntitiesPage, entities, scenes, setScenePosition, setEntityPosition } = useEntitiesPagesStore(); + const [dragingItem, setDragingItem] = (0, import_react.useState)(void 0); + const [addNewPageTypeOpen, setAddNewPageTypeOpen] = (0, import_react.useState)(false); + (0, import_react.useEffect)(() => { + fetchData(room_id); + }, [room_id, fetchData]); + (0, import_react.useEffect)(() => { + if (useRoomsStore.getState().status == "none") useRoomsStore.getState().fetchData(); + }, []); + function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + async function deleteEntitiesPage(id) { + console.log("Deleting entities page", id); + fetch(`/rest/entities_pages/${id}`, { + credentials: "same-origin", + method: "DELETE", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + } + }).then(async (response) => { + if (response.ok) { + console.log("Successfully deleted entities page", id); + removeEntitiesPage(id); + } + }).catch((error) => { + console.error("Error deleting entities page", error); + }); + } + async function createEntitiesPage(number_of_entities) { + console.log("Creating entities page", type); + let url = `/rest/global/entities_pages`; + if (room_id !== void 0) url = `/rest/rooms/${room_id}/entities_pages`; + fetch(url, { + credentials: "same-origin", + method: "PUT", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + }, + body: JSON.stringify({ + type: number_of_entities, + is_scenes_page: type == "scene" + }) + }).then(async (response) => { + if (response.ok) { + console.log("Successfully created entities page", type, "number of entities", number_of_entities); + fetchData(room_id); + } + }).catch((error) => { + console.error("Error creating entities page", error); + }); + } + async function saveEntitiesOrder(entities, scenes) { + fetch(`/rest/rooms/${room_id}/entities/order`, { + credentials: "same-origin", + method: "PUT", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + }, + body: JSON.stringify({ + entities, + scenes + }) + }).then(async (response) => { + const data = await response.json(); + if (!response.ok) { + const error = data && data.message || response.status; + return Promise.reject(error); + } + }).catch((error) => { + console.error("There was an error!", error); + }); + } + async function saveEntitiesPagesOrder(entities_pages) { + fetch(`/rest/entities_pages/order`, { + credentials: "same-origin", + method: "PUT", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + }, + body: JSON.stringify({ order: entities_pages.map((page) => [page.id, page.display_order]) }) + }).then(async (response) => { + const data = await response.json(); + if (!response.ok) { + const error = data && data.message || response.status; + return Promise.reject(error); + } + }).catch((error) => { + console.error("There was an error!", error); + }); + } + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center justify-start mb-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "text-xl", + children: [ + useRoomsStore.getState().rooms?.find((r) => r.id == room_id)?.friendly_name, + " ", + (() => { + if (type == "entity") return "entities"; + if (type == "scene") return "scenes"; + return "UNKNOWN ENTITY PAGE TYPE"; + })() + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: `dropdown dropdown-top dropdown-center ${addNewPageTypeOpen ? "dropdown-open" : ""} me-8 flex indicator-item indicator-bottom indicator-end`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + onClick: () => setAddNewPageTypeOpen(!addNewPageTypeOpen), + className: "btn btn-xs btn-circle btn-success ml-2", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mdi mdi-plus" }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "dropdown-content bg-base-100 join rounded-box z-1 p-1 shadow-sm", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => { + setAddNewPageTypeOpen(false); + createEntitiesPage(4); + }, + className: `btn join-item btn-lg btn-square`, + children: "4" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => { + setAddNewPageTypeOpen(false); + createEntitiesPage(8); + }, + className: `btn join-item btn-lg btn-square`, + children: "8" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => { + setAddNewPageTypeOpen(false); + createEntitiesPage(12); + }, + className: `btn join-item btn-lg btn-square`, + children: "12" + }) + ] + })] + })] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DragDropProvider, { + onDragStart: (event) => { + const { source } = event.operation; + if (source == null) return; + setDragingItem(source.data); + }, + onDragEnd: (event) => { + setDragingItem(void 0); + if (event.canceled) return; + const { source, target } = event.operation; + if (source == null || target == null) return; + const sourceData = source.data; + const targetData = target.data; + if (sourceData.config && targetData.config && sourceData.config.entities_page_id == targetData.config.entities_page_id && sourceData.config.room_view_position == targetData.config.room_view_position) return; + if (sourceData.type == "entity" && sourceData.config) { + const entity = entities.find((e) => sourceData.config && e.id == sourceData.config.id); + if (!entity) return; + let existingEntity = entities.find((e) => targetData.config && e.entities_page_id == targetData.config.entities_page_id && e.room_view_position == targetData.config.room_view_position); + if (existingEntity != null) { + existingEntity = JSON.parse(JSON.stringify(existingEntity)); + if (existingEntity) setEntityPosition(existingEntity.id, entity.entities_page_id, entity.room_view_position); + } + const updatedEntity = JSON.parse(JSON.stringify(entity)); + if (targetData.config) { + setEntityPosition(updatedEntity.id, targetData.config.entities_page_id, targetData.config.room_view_position); + saveEntitiesOrder(useEntitiesPagesStore.getState().entities, []); + } else console.error("Failed to set new entity position. Target data has no config"); + } else if (sourceData.type == "scene" && sourceData.config) { + const scene = scenes.find((e) => sourceData.config && e.id == sourceData.config.id); + if (!scene) return; + let existingScene = scenes.find((e) => targetData.config && e.entities_page_id == targetData.config.entities_page_id && e.room_view_position == targetData.config.room_view_position); + if (existingScene != null) { + existingScene = JSON.parse(JSON.stringify(existingScene)); + if (existingScene) setScenePosition(existingScene.id, scene.entities_page_id, scene.room_view_position); + } + const updatedEntity = JSON.parse(JSON.stringify(scene)); + if (targetData.config) { + setScenePosition(updatedEntity.id, targetData.config.entities_page_id, targetData.config.room_view_position); + saveEntitiesOrder([], useEntitiesPagesStore.getState().scenes); + } else console.error("Failed to set new scene position as target as not config"); + } else if (sourceData.type == "entity_page" && sourceData.entity_page_config) { + if (isSortable(source)) { + const { initialIndex, index } = source; + console.log("Initial index: ", initialIndex, " index: ", index); + if (initialIndex == index) return; + if (!useEntitiesPagesStore.getState().entities_pages.find((page) => page.display_order == initialIndex)) { + console.error("Failed to find source page data. Cannot continue."); + return; + } + const newEntitiesPagesOrder = [...useEntitiesPagesStore.getState().entities_pages.filter((page) => page.type == type)]; + const [removed] = newEntitiesPagesOrder.splice(initialIndex, 1); + newEntitiesPagesOrder.splice(index, 0, removed); + newEntitiesPagesOrder.forEach((page, i) => { + page.display_order = i; + }); + useEntitiesPagesStore.setState({ entities_pages: [...newEntitiesPagesOrder, ...useEntitiesPagesStore.getState().entities_pages.filter((page) => page.type != type)] }); + saveEntitiesPagesOrder(newEntitiesPagesOrder); + } + } + }, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { + className: "list-none w-full nspanel-entities-pages", + children: entities_pages.filter((entity_page) => entity_page.type === type).map((entity_page) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EntitiesPage, { + id: entity_page.id, + draging_item: dragingItem, + deleteEntitiesPage + }, `entity_page-${entity_page.id}`)) + }) + })] }); +}; +//#endregion +export { EntitiesPagesView as default }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/EntityStore-CHE3-bsC.js b/docker/web/nspanelmanager/web/react-components/dist/EntityStore-CHE3-bsC.js new file mode 100644 index 000000000..5ce29ab90 --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/EntityStore-CHE3-bsC.js @@ -0,0 +1,65 @@ +import { t as create } from "./react-Cm4z11-B.js"; +import { n as Notify } from "./NSPanelToastContainer-D677tDZJ.js"; +import { t as useStompStore } from "./StompStore-Bh-Guhla.js"; +//#region src/stores/EntityStore.ts +var nspanel_stomp_status_update_callback = (message) => { + const json_data = JSON.parse(message.body); + useEntityStatesStore.getState()._update_nspanel_status(json_data.mac, json_data); +}; +var useEntityStatesStore = create((set) => ({ + status: "none", + _nspanels: [], + nspanels: {}, + rooms: {}, + fetchData: async () => { + set({ status: "loading" }); + if (useStompStore.getState().status == "none") useStompStore.getState().connect(); + console.debug("Subscribing to entity_states..."); + useStompStore.getState().subscribe("entity_states", (message) => { + console.debug("Got entity states update over STOMP."); + set({ + _nspanels: JSON.parse(message.body).nspanels, + status: "loaded" + }); + useEntityStatesStore.getState()._attachNSPanelStatusDataSubscriptions(); + }); + console.debug("Loading rooms..."); + fetch("/rest/rooms").then((response) => response.json()).then((data) => { + console.debug("Got rooms data."); + for (const room of data.rooms) set({ rooms: { + ...useEntityStatesStore.getState().rooms, + [room.id]: room + } }); + }).catch((error) => { + Notify({ + message: "Failed to fetch rooms. Error: " + error, + level: "error" + }); + }); + }, + _update_nspanel_status: (mac, status) => { + set({ nspanels: { + ...useEntityStatesStore.getState().nspanels, + [mac]: status + } }); + }, + _attachNSPanelStatusDataSubscriptions: async () => { + for (const panel of Object.entries(useEntityStatesStore.getState().nspanels)) { + let nspanel_removed = true; + for (const existingPanel of useEntityStatesStore.getState()._nspanels) if (existingPanel.mac === panel[0]) { + nspanel_removed = false; + break; + } + if (nspanel_removed) { + console.log("Removing ", panel[0]); + const current_nspanels = useEntityStatesStore.getState().nspanels; + delete current_nspanels[panel[0]]; + useStompStore.getState().unsubscribe(`nspanel/${panel[0]}/status`, nspanel_stomp_status_update_callback); + set({ nspanels: { ...current_nspanels } }); + } + } + for (const panel of useEntityStatesStore.getState()._nspanels) useStompStore.getState().subscribe(`nspanel/${panel.mac}/status`, nspanel_stomp_status_update_callback); + } +})); +//#endregion +export { useEntityStatesStore as t }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/InitialSetup-p38u0OlE.js b/docker/web/nspanelmanager/web/react-components/dist/InitialSetup-p38u0OlE.js new file mode 100644 index 000000000..6c1aea277 --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/InitialSetup-p38u0OlE.js @@ -0,0 +1,1105 @@ +import { c as __toESM, r as require_react, t as require_jsx_runtime } from "./main-FKp56mKw.js"; +import { s as useForm } from "./index.esm-CnTf2rLv.js"; +import { n as Notify } from "./NSPanelToastContainer-D677tDZJ.js"; +import { t as motion } from "./proxy-BQYsYRjY.js"; +import { t as AnimatePresence } from "./AnimatePresence-CpnHckGS.js"; +import { i as mdiInformationOutline, x as require_Icon } from "./mdi-Cr6PIsRR.js"; +import { i as api, t as Alert } from "./layout-HS0oHCMJ.js"; +//#region src/components/InitialSetup/Step1_Welcome.tsx +var import_react = /* @__PURE__ */ __toESM(require_react(), 1); +var import_jsx_runtime = require_jsx_runtime(); +var Step1_Welcome = ({ nextStep }) => { + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex mt-4 justify-end items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex items-center justify-center p-8", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { + className: "h-28 bg-neutral/50 rounded-box p-1", + src: "/static/logo.svg" + }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex items-center justify-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-2xl", + children: "Welcome!" + }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "flex items-center justify-center text-center", + children: "NSPanel Manager is a software for easy management of multiple Sonoff NSPanels and intuitive use for all family members in the household. But you probably already knew that." + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "flex items-center justify-center text-center mt-4 px-6", + children: "Thank you for choosing NSPanel Manager! This initial setup guide will take you through the necessary steps to get a working setup, press the button below to continue." + }) + ] }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-end mt-8", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "submit", + className: "btn btn-primary", + onClick: () => nextStep(), + children: "Get started" + }) + })] }); +}; +//#endregion +//#region src/components/InitialSetup/form.ts +var INITIAL_SETUP_FIELDS = [ + "manager_address", + "manager_port", + "mqtt_server", + "mqtt_port", + "mqtt_username", + "home_assistant_address", + "openhab_address", + "theme" +]; +var SECRETS = [ + "mqtt_password", + "home_assistant_token", + "openhab_token" +]; +var ADDON_MANAGED = ["home_assistant_address", "home_assistant_token"]; +function toFormValues(settings) { + const values = {}; + for (const name of INITIAL_SETUP_FIELDS) values[name] = settings[name]; + for (const secret of SECRETS) { + values[secret] = ""; + values[`clear_${secret}`] = false; + } + return values; +} +/** +* The PATCH body for a submitted form: only the settings that changed. Secrets are sent when a new +* value is typed, or as "" when "clear" is ticked. Add-on managed settings are never sent in the add-on. +*/ +function buildPatch(values, dirty, isHomeAssistantAddon) { + const body = {}; + const allowed = (name) => !(isHomeAssistantAddon && ADDON_MANAGED.includes(name)); + for (const name of INITIAL_SETUP_FIELDS) if (dirty[name] && allowed(name)) body[name] = values[name]; + for (const secret of SECRETS) { + if (!allowed(secret)) continue; + if (values[`clear_${secret}`]) body[secret] = ""; + else if (values[secret]) body[secret] = values[secret]; + } + return body; +} +//#endregion +//#region src/components/InitialSetup/Step2_Theme.tsx +var Step2_Theme = ({ setValue, nextStep, prevStep, watch }) => { + const themes = { + default: "Default", + light: "Light", + dark: "Dark", + nspmwip: "NSPanel Manager", + cupcake: "Cupcake", + bumblebee: "Bumblebee", + emerald: "Emerald", + corporate: "Corporate", + synthwave: "Synthwave", + retro: "Retro", + cyberpunk: "Cyberpunk", + valentine: "Valentine", + halloween: "Halloween", + garden: "Garden", + forest: "Forest", + aqua: "Aqua", + lofi: "Lo-Fi", + pastel: "Pastel", + fantasy: "Fantasy", + wireframe: "Wireframe", + black: "Black", + luxury: "Luxury", + dracula: "Dracula", + cmyk: "CMYK", + autumn: "Autumn", + business: "Business", + acid: "Acid", + lemonade: "Lemonade", + night: "Night", + coffee: "Coffee", + winter: "Winter", + dim: "Dim", + nord: "Nord", + sunset: "Sunset" + }; + const selectedTheme = watch("theme"); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "grid gap-4 grid-cols-3 mt-4 justify-end items-center", + children: Object.entries(themes).map(([theme_option, display_name]) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "bg-neutral text-neutral-content grid grid-cols-3 w-full h-20 rounded-box overflow-hidden cursor-pointer", + "data-theme": theme_option, + onClick: () => { + setValue("theme", theme_option, { shouldDirty: true }); + const radio = document.querySelector(`#theme-radio-${CSS.escape(theme_option)}`); + if (radio) radio.checked = true; + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "bg-base-100 min-h-1/3" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "bg-base-200 min-h-1/3" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "bg-base-300 min-h-1/3" }) + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "col-span-2 relative", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { + className: "label", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "radio", + name: "theme-dropdown", + className: "theme-controller radio radio-xs radio-accent p-0 m-0 absolute top-1 right-1", + value: theme_option, + checked: theme_option == selectedTheme + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "label-text justify-start w-full ml-2 text-wrap", + children: display_name + })] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex absolute bottom-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "badge badge-primary badge-xs ms-2", + children: "A" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "badge badge-accent badge-xs ms-1", + children: "B" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "badge badge-success badge-xs ms-1", + children: "C" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "badge badge-info badge-xs ms-1", + children: "D" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "badge badge-error badge-xs ms-1", + children: "E" + }) + ] + })] + })] + })) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex gap-2 justify-end mt-8", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-neutral", + onClick: prevStep, + children: "Back" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-primary", + onClick: nextStep, + children: "Next" + })] + })] }); +}; +//#endregion +//#region src/components/InitialSetup/Step3_ManagerSettings.tsx +var Step3_ManagerSettings = ({ setValue, getValues, register, nextStep, prevStep }) => { + const getIPFromURL = () => { + fetch("/rest/get_ip_by_hostname", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ hostname: window.location.hostname }) + }).then((response) => response.json()).then((data) => { + if (data.ip) setValue("manager_address", data.ip, { shouldDirty: true }); + else Notify({ + message: "Failed to get IP from URL. No \"ip\" field in response.", + level: "error" + }); + }).catch(() => { + Notify({ + message: "Failed to get IP from URL.", + level: "error" + }); + }); + }; + const testManagerAddressAndPort = () => { + const address = getValues("manager_address"); + const port = getValues("manager_port"); + if (address == null) { + Notify({ + message: "Manager address is required to test the connection", + level: "error", + duration: 5e3 + }); + return; + } + if (port == null) { + Notify({ + message: "Manager port is required to test the connection", + level: "error", + duration: 5e3 + }); + return; + } + const params = { + address, + port: port.toString() + }; + const queryString = new URLSearchParams(params).toString(); + fetch("/rest/mqttmanager/test?" + queryString, { + method: "GET", + signal: AbortSignal.timeout(2e3) + }).then((response) => { + if (response.ok) Notify({ + message: "Manager address and port are valid.", + level: "success", + duration: 5e3 + }); + else response.json().then((data) => { + Notify({ + message: "Failed to test Manager address and port. Error: " + data.message, + level: "error", + duration: 5e3 + }); + }); + }).catch((error) => { + Notify({ + message: "Test failed. Error: " + error.message, + level: "error", + duration: 5e3 + }); + }); + }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "add_new_button_name", + className: "block mb-2 text-sm font-medium", + children: "Manager IP" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 border-neutral rounded-md rounded-r-none border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text", + type: "text", + ...register("manager_address"), + required: true + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-info rounded-l-none h-auto", + onClick: () => getIPFromURL(), + children: "Load from URL" + })] + })] + }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "manager_port", + className: "block mb-2 text-sm font-medium", + children: "Manager Port" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 border-neutral rounded-md rounded-r-none border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text", + type: "number", + ...register("manager_port", { valueAsNumber: true }), + required: true + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-info rounded-l-none h-auto", + onClick: () => { + setValue("manager_port", parseInt(window.location.port), { shouldDirty: true }); + }, + children: "Load from URL" + })] + })] + }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + className: "btn btn-accent w-full", + onClick: testManagerAddressAndPort, + children: "Test settings" + }) + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex gap-2 justify-end mt-8", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-neutral", + onClick: prevStep, + children: "Back" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-primary", + onClick: nextStep, + children: "Next" + })] + })] }); +}; +//#endregion +//#region src/components/InitialSetup/Step4_MqttSettings.tsx +var import_Icon = require_Icon(); +var Step4_MqttSettings = ({ setValue, getValues, register, watch, nextStep, prevStep }) => { + const [noLogin, setNoLogin] = (0, import_react.useState)(getValues("mqtt_username") == "" && getValues("mqtt_password") == ""); + const address = watch("mqtt_server"); + const port = watch("mqtt_port"); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "alert alert-info my-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiInformationOutline, + className: "w-6" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "If you are running the MQTT broker (for example Mosquitto) as an add on in Home Assistant. Then enter the address for Home Assistant and the port for MQTT (1883 if you have not changed it)." })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "add_new_button_name", + className: "block mb-2 text-sm font-medium", + children: "MQTT Broker Address" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text", + type: "text", + ...register("mqtt_server"), + required: true + }) + })] + }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "manager_port", + className: "block mb-2 text-sm font-medium", + children: "MQTT Broker Port" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text", + type: "number", + ...register("mqtt_port", { valueAsNumber: true }), + required: true + }) + })] + }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("fieldset", { + className: "fieldset bg-base-100 border-base-300 rounded-box w-full border p-4", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("legend", { + className: "fieldset-legend", + children: "Login options" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { + className: "label", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "checkbox", + className: "checkbox checkbox-sm checkbox-primary", + checked: noLogin, + onChange: (e) => { + if (e.currentTarget.checked) { + setValue("mqtt_username", "", { shouldDirty: true }); + setValue("mqtt_password", "", { shouldDirty: true }); + setValue("clear_mqtt_password", true, { shouldDirty: true }); + setNoLogin(true); + } else setNoLogin(false); + } + }), "Anonymous login"] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center my-4 duration-500 transition-transform ease-linear", + hidden: noLogin, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "mqtt_username", + className: "block mb-2 text-sm font-medium", + children: "MQTT Broker Username" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text", + type: "text", + id: "mqtt_username", + ...register("mqtt_username"), + required: true + }) + })] + }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + hidden: noLogin == true, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "mqtt_password", + className: "block mb-2 text-sm font-medium", + children: "MQTT Broker Password" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text", + type: "password", + id: "mqtt_password", + ...register("mqtt_password"), + required: true + }) + })] + }) + }) + ] + }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex gap-2 justify-end mt-8", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-neutral", + onClick: prevStep, + children: "Back" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-primary", + onClick: nextStep, + disabled: address == "" || port == null || port < 1 || port > 65535, + children: "Next" + })] + }) + ] }); +}; +//#endregion +//#region src/components/InitialSetup/Step5_HomeAssistantSettings.tsx +var Step5_HomeAssistantSettings = ({ getValues, register, isHomeAssistantAddon, nextStep, prevStep }) => { + const testHomeAssistant = () => { + const address = getValues("home_assistant_address"); + const token = getValues("home_assistant_token"); + if (address == null) { + Notify({ + message: "Home Assistant address is required to test the connection", + level: "error", + duration: 5e3 + }); + return; + } + if (token == null) { + Notify({ + message: "Home Assistant token is required to test the connection", + level: "error", + duration: 5e3 + }); + return; + } + const queryString = new URLSearchParams({ + address, + token + }).toString(); + fetch("/rest/home_assistant/test?" + queryString, { method: "GET" }).then((response) => { + if (response.ok) Notify({ + message: "Home Assistant address and token are valid.", + level: "success", + duration: 5e3 + }); + else response.json().then((data) => { + Notify({ + message: "Failed to test Home Assistant address and token. Error: " + data.message, + level: "error", + duration: 5e3 + }); + }); + }).catch((error) => { + Notify({ + message: "Test failed. Error: " + error.message, + level: "error", + duration: 5e3 + }); + }); + }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "alert alert-info my-4", + hidden: isHomeAssistantAddon, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiInformationOutline, + className: "w-6" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Home Assistant is optional. You may also run NSPanel Manager using OpenHAB." })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "alert alert-info my-4", + hidden: !isHomeAssistantAddon, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiInformationOutline, + className: "w-6" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "You are running NSPanel Manager as a Home Assistant add on. These settings are managed for you by Home Assistant." })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "alert alert-info my-4", + hidden: isHomeAssistantAddon, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiInformationOutline, + className: "w-6" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Enter Home Assistant address in the form of " }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "italic", + children: "http(s)://address:port/" + })] })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + hidden: isHomeAssistantAddon, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "add_new_button_name", + className: "block mb-2 text-sm font-medium", + children: "Home Assistant address" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5", + type: "text", + ...register("home_assistant_address"), + disabled: isHomeAssistantAddon, + required: true + }) + })] + }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + hidden: isHomeAssistantAddon, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "manager_port", + className: "block mb-2 text-sm font-medium", + children: "Home Assistant Token" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5", + type: "password", + ...register("home_assistant_token"), + disabled: isHomeAssistantAddon, + required: true + }) + })] + }) + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + className: "btn btn-accent w-full", + onClick: testHomeAssistant, + hidden: isHomeAssistantAddon, + children: "Test settings" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex gap-2 justify-end mt-8", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "submit", + className: "btn btn-neutral", + onClick: prevStep, + children: "Back" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "submit", + className: "btn btn-primary", + onClick: nextStep, + children: "Next" + })] + }) + ] }); +}; +//#endregion +//#region src/components/InitialSetup/Step6_OpenhabSettings.tsx +var Step6_OpenhabSettings = ({ getValues, register, nextStep, prevStep }) => { + const testOpenhab = () => { + const address = getValues("openhab_address"); + const token = getValues("openhab_token"); + if (address == null) { + Notify({ + message: "OpenHAB address is required to test the connection", + level: "error", + duration: 5e3 + }); + return; + } + if (token == null) { + Notify({ + message: "OpenHAB token is required to test the connection", + level: "error", + duration: 5e3 + }); + return; + } + const queryString = new URLSearchParams({ + address, + token + }).toString(); + fetch("/rest/openhab/test?" + queryString, { method: "GET" }).then((response) => { + if (response.ok) Notify({ + message: "OpenHAB address and token are valid.", + level: "success", + duration: 5e3 + }); + else response.json().then((data) => { + Notify({ + message: "Failed to test OpenHAB address and token. Error: " + data.message, + level: "error", + duration: 5e3 + }); + }); + }).catch((error) => { + Notify({ + message: "Test failed. Error: " + error.message, + level: "error", + duration: 5e3 + }); + }); + }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "alert alert-info my-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiInformationOutline, + className: "w-6" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "OpenHAB is optional. You may also run NSPanel Manager using Home Assistant." })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "alert alert-info my-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiInformationOutline, + className: "w-6" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Enter OpenHAB address in the form of " }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "italic", + children: "http(s)://address:port/" + })] })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "add_new_button_name", + className: "block mb-2 text-sm font-medium", + children: "OpenHAB address" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5", + type: "text", + ...register("openhab_address"), + required: true + }) + })] + }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "manager_port", + className: "block mb-2 text-sm font-medium", + children: "OpenHAB Token" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5", + type: "password", + ...register("openhab_token"), + required: true + }) + })] + }) + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + className: "btn btn-accent w-full", + onClick: testOpenhab, + children: "Test settings" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex gap-2 justify-end mt-8", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "submit", + className: "btn btn-neutral", + onClick: prevStep, + children: "Back" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "submit", + className: "btn btn-primary", + onClick: nextStep, + children: "Next" + })] + }) + ] }); +}; +//#endregion +//#region src/components/InitialSetup/Step7_Finished.tsx +var Step7_Finished = ({ form, prevStep, isHomeAssistantAddon, dialogRef }) => { + const saveSettings = async () => { + const { getValues, reset, formState: { dirtyFields } } = form; + const body = buildPatch(getValues(), dirtyFields, isHomeAssistantAddon); + try { + const { data, error, response } = await api.PATCH("/rest/v2/settings", { body }); + if (data) { + reset(toFormValues(data)); + Notify({ + message: "Settings saved.", + level: "success", + duration: 5e3 + }); + dialogRef.current?.close(); + return; + } + if (response.status === 400 && error && !("detail" in error && error.detail)) { + console.error("Got error ", error); + const fieldErrors = Object.entries(error); + if (fieldErrors.length === 0) Notify({ + message: "Nothing was saved.", + level: "error", + duration: 8e3 + }); + for (const [field, messages] of fieldErrors) for (const message of Array.isArray(messages) ? messages : [messages]) Notify({ + message: `${field}: ${message}`, + level: "error", + duration: 8e3 + }); + } else { + const detail = error && "detail" in error ? error.detail : `HTTP ${response.status}`; + Notify({ + message: `Couldn't save the settings: ${detail}`, + level: "error" + }); + } + } catch (failure) { + Notify({ + message: `Couldn't save the settings: ${failure instanceof Error ? failure.message : String(failure)}`, + level: "error" + }); + } + }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex items-center justify-center space-x-3 rtl:space-x-reverse", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "bg-neutral/50 p-2 rounded-box", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { + src: "/static/logo.svg", + alt: "Logo", + className: "h-12" + }) + }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "mt-1 text-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-center", + children: "Version: %version%" + }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { + className: "mt-2 text-center", + children: "Initial setup is now finished. If you have any NSPanels already flashed and connected to the same MQTT broker they should show up automatically. In case they do not, there is the documentation and also a discord where you can get help. There is also the Github page where you can report issues and contribute." + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { + className: "my-2 text-center font-bold", + children: "Thank you for your support and trust. Have fun and enjoy!" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + id: "about_links", + className: "join join-vertical w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { + className: "join-item btn btn-link", + href: "https://nspanelmanager.com", + target: "_blank", + children: "Documentation" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { + className: "join-item btn btn-link", + href: "https://github.com/NSPManager/NSPanelManager", + target: "_blank", + children: "GitHub" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { + className: "join-item btn btn-link", + href: "https://discord.gg/RwXvAH56fE", + target: "_blank", + children: "Discord" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "join-item flex items-center justify-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { + href: "https://www.buymeacoffee.com/nspanelmanager", + className: "mt-4", + target: "_blank", + rel: "nofollow", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { + src: "/static/bmc-button.png", + alt: "Buy Us A Coffee", + height: "41", + width: "174" + }) + }) + }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex gap-2 justify-end mt-8", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-neutral", + onClick: prevStep, + children: "Back" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-primary", + onClick: saveSettings, + children: "Save" + })] + }) + ] + }) }); +}; +//#endregion +//#region src/components/InitialSetup/InitialSetup.tsx +var InitialSetup = ({ opened, isHomeAssistantAddon }) => { + const [state, setState] = (0, import_react.useState)({ status: "loading" }); + const fetchSettings = (0, import_react.useCallback)(() => { + api.GET("/rest/v2/settings").then(({ data, response }) => setState(data ? { + status: "loaded", + settings: data + } : { + status: "error", + message: `HTTP ${response.status}` + })).catch((error) => setState({ + status: "error", + message: error instanceof Error ? error.message : String(error) + })); + }, []); + (0, import_react.useEffect)(fetchSettings, [fetchSettings]); + const retry = () => { + setState({ status: "loading" }); + fetchSettings(); + }; + const dialogRef = (0, import_react.useRef)(null); + const contentRef = (0, import_react.useRef)(null); + const checkOverflow = () => { + if (contentRef.current) { + const maxHeightString = window.getComputedStyle(contentRef.current).maxHeight; + let maxHeight = parseFloat(maxHeightString); + if (maxHeightString.endsWith("%")) maxHeight = Math.trunc(window.innerHeight * maxHeight / 100); + contentRef.current.classList.toggle("overflow-y-auto", contentRef.current.scrollHeight > maxHeight); + contentRef.current.classList.toggle("overflow-y-visible", contentRef.current.scrollHeight <= maxHeight); + } + }; + (0, import_react.useEffect)(() => { + const observer = new ResizeObserver((entries) => { + entries.forEach(() => { + checkOverflow(); + }); + }); + if (contentRef.current) observer.observe(contentRef.current); + }, [contentRef]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("dialog", { + ref: dialogRef, + open: opened ?? false, + className: "modal duration-200", + children: [ + state.status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center justify-center modal-box max-h-11/12 min-w-180 min-h-60 bg-base-100 text-base-content", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "loading loading-spinner loading" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "ml-2 text-xl", + children: "Initializing first setup" + })] + }), + state.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Alert, { + level: "error", + children: ["Couldn't load settings: ", state.message] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn", + onClick: retry, + children: "Retry" + })] }), + state.status === "loaded" && dialogRef != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InitialSetupForm, { + settings: state.settings, + dialogRef, + isHomeAssistantAddon + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "modal-backdrop" }) + ] + }); +}; +var InitialSetupForm = ({ dialogRef, isHomeAssistantAddon, settings }) => { + const [step, setStep] = (0, import_react.useState)(1); + const form = useForm({ defaultValues: toFormValues(settings) }); + const { register, setValue, getValues, watch } = form; + const nextStep = () => setStep((prev) => prev + 1); + const prevStep = () => setStep((prev) => prev - 1); + const contentRef = (0, import_react.useRef)(null); + const checkOverflow = () => { + if (contentRef.current) { + const maxHeightString = window.getComputedStyle(contentRef.current).maxHeight; + let maxHeight = parseFloat(maxHeightString); + if (maxHeightString.endsWith("%")) maxHeight = Math.trunc(window.innerHeight * maxHeight / 100); + contentRef.current.classList.toggle("overflow-y-auto", contentRef.current.scrollHeight > maxHeight); + contentRef.current.classList.toggle("overflow-y-visible", contentRef.current.scrollHeight <= maxHeight); + } + }; + (0, import_react.useEffect)(() => { + const observer = new ResizeObserver((entries) => { + entries.forEach(() => { + checkOverflow(); + }); + }); + if (contentRef.current) observer.observe(contentRef.current); + }, [contentRef]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + ref: contentRef, + className: `modal-box max-h-11/12 min-w-180 bg-base-100 text-base-content`, + children: [(() => { + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 w-full", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ul", { + className: "steps w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { + className: `step cursor-pointer ${step >= 1 ? "step-primary cursor-pointer" : ""}`, + onClick: () => { + setStep(1); + }, + children: "Welcome" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { + className: `step cursor-pointer ${step >= 2 ? "step-primary" : ""}`, + onClick: () => { + setStep(2); + }, + children: "Theme" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { + className: `step cursor-pointer ${step >= 3 ? "step-primary" : ""}`, + onClick: () => { + setStep(3); + }, + children: "Manager settings" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { + className: `step cursor-pointer ${step >= 4 ? "step-primary" : ""}`, + onClick: () => { + setStep(4); + }, + children: "MQTT settings" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { + className: `step cursor-pointer ${step >= 5 ? "step-primary" : ""}`, + onClick: () => { + setStep(5); + }, + children: "Home Assistant settings" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { + className: `step cursor-pointer ${step >= 6 ? "step-primary" : ""}`, + onClick: () => { + setStep(6); + }, + children: "OpenHAB settings" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { + className: `step cursor-pointer ${step >= 7 ? "step-primary" : ""}`, + onClick: () => { + setStep(7); + }, + children: "Finished" + }) + ] + }) + }); + })(), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnimatePresence, { + mode: "wait", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(motion.div, { + layout: true, + initial: { + opacity: 0, + x: 30 + }, + animate: { + opacity: 1, + x: 0 + }, + exit: { + opacity: 0, + x: -30 + }, + transition: { duration: .1 }, + children: (() => { + if (step == 1) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Step1_Welcome, { nextStep }); + else if (step == 2) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Step2_Theme, { + setValue, + nextStep, + prevStep, + watch + }); + else if (step == 3) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Step3_ManagerSettings, { + setValue, + getValues, + register, + nextStep, + prevStep + }); + else if (step == 4) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Step4_MqttSettings, { + setValue, + getValues, + register, + watch, + nextStep, + prevStep + }); + else if (step == 5) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Step5_HomeAssistantSettings, { + getValues, + register, + nextStep, + prevStep, + isHomeAssistantAddon + }); + else if (step == 6) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Step6_OpenhabSettings, { + getValues, + register, + nextStep, + prevStep + }); + else if (step == 7) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Step7_Finished, { + form, + isHomeAssistantAddon, + prevStep, + dialogRef + }); + })() + }, `step.${step}`) + })] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "modal-backdrop" })] }); +}; +//#endregion +export { InitialSetup as default }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/Logs-B094dObe.js b/docker/web/nspanelmanager/web/react-components/dist/Logs-B094dObe.js new file mode 100644 index 000000000..e563a34a9 --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/Logs-B094dObe.js @@ -0,0 +1,154 @@ +import { c as __toESM, r as require_react, t as require_jsx_runtime } from "./main-FKp56mKw.js"; +import { t as useSettingsStore } from "./SettingsStore-msVzBcHM.js"; +import { t as useStompStore } from "./StompStore-Bh-Guhla.js"; +//#region src/components/NSPanelPage/Logs.tsx +var import_react = /* @__PURE__ */ __toESM(require_react(), 1); +var import_jsx_runtime = require_jsx_runtime(); +function NSPanelLogs({ nspanel_mac }) { + const { status: settingsStatus, fetchData: fetchSettingsData } = useSettingsStore(); + const { status: stompStatus } = useStompStore(); + const [logs, setLogs] = (0, import_react.useState)([]); + const [hasSubscribed, setHasSubscribed] = (0, import_react.useState)(false); + const [hasDownloadedLogs, setHasDownloadedLogs] = (0, import_react.useState)(false); + const logIdRef = (0, import_react.useRef)(0); + const maxLogs = useSettingsStore((s) => s.settings?.max_live_log_messages ?? 50); + const nspanel_backlog_callback = (message) => { + useStompStore.getState().unsubscribe(`nspanel/${nspanel_mac}/log_backlog`, nspanel_backlog_callback); + if (logs.length === 0) { + const data = JSON.parse(message.body); + setLogs(() => { + for (const log of data.logs) log.id = logIdRef.current++; + const maxLogs = useSettingsStore.getState().settings?.max_live_log_messages ?? 50; + return data.logs.length > maxLogs ? data.logs.slice(0, maxLogs) : data.logs; + }); + } + }; + (0, import_react.useEffect)(() => { + if (settingsStatus === "none") fetchSettingsData(); + if (stompStatus == "none") { + setHasSubscribed(false); + useStompStore.getState().connect(); + } + if (stompStatus == "connected" && !hasSubscribed) { + useStompStore.getState().subscribe(`nspanel/${nspanel_mac}/log_backlog`, nspanel_backlog_callback); + useStompStore.getState().subscribe(`nspanel/${nspanel_mac}/log`, (message) => { + const log = JSON.parse(message.body); + log.id = logIdRef.current++; + setLogs((prevLogs) => { + const next = [log, ...prevLogs]; + const maxLogs = useSettingsStore.getState().settings?.max_live_log_messages ?? 50; + return next.length > maxLogs ? next.slice(0, maxLogs) : next; + }); + }); + setHasSubscribed(true); + } + }, [ + settingsStatus, + fetchSettingsData, + stompStatus, + nspanel_mac, + logs + ]); + (0, import_react.useEffect)(() => { + setLogs((prevLogs) => prevLogs.slice(0, maxLogs)); + }, [maxLogs]); + const download_nspanel_logs_callback = (message) => { + if (!hasDownloadedLogs) { + const data = JSON.parse(message.body); + const logs = []; + data.logs.map((log) => logs.push(`${log.time} ${log.level} ${log.message}`)); + const blob = new Blob([logs.join("\n")], { type: "text/plain" }); + const url = URL.createObjectURL(blob); + const a = document.createElement("a"); + a.href = url; + a.download = `nspanel_${nspanel_mac}_logs.txt`; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + URL.revokeObjectURL(url); + useStompStore.getState().unsubscribe(`nspanel/${nspanel_mac}/log_backlog`, download_nspanel_logs_callback); + setHasDownloadedLogs(true); + } + }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full bg-base-100 rounded-box p-3", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center justify-between", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-lg font-semibold mb-1 block", + children: "Logs" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + className: "btn btn-outline btn-sm btn-info", + onClick: () => { + setHasDownloadedLogs(false); + useStompStore.getState().subscribe(`nspanel/${nspanel_mac}/log_backlog`, download_nspanel_logs_callback); + }, + children: "Download" + })] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "overflow-x-auto", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { + className: "table table-xs", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { + className: "px-3 py-1", + children: "Time" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { + className: "px-3 py-1", + children: "Level" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { + className: "px-3 py-1", + children: "Message" + }) + ] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { + className: "", + children: logs.map((log) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { + className: "hover:bg-base-300", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { + className: "px-3 py-1", + children: log.time + }), + (() => { + switch (log.level) { + case "TRACE": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { + className: "px-3 py-1 text-center bg-white text-black", + children: log.level + }); + case "DEBUG": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { + className: "px-3 py-1 text-center", + children: log.level + }); + case "INFO": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { + className: "px-3 py-1 bg-info text-info-content text-center", + children: log.level + }); + case "WARNING": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { + className: "px-3 py-1 bg-warning text-warning-content text-center", + children: log.level + }); + case "ERROR": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { + className: "px-3 py-1 bg-error text-error-content text-center", + children: log.level + }); + default: return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { + className: "px-3 py-1", + children: ["Unknown log level! ", log.level] + }); + } + })(), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { + className: "px-3 py-1", + children: log.message + }) + ] + }, `${log.id}`)) + })] + }) + })] + }); +} +//#endregion +export { NSPanelLogs as default }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/MultiStep_AddEditEntity-BVXN3SAx.js b/docker/web/nspanelmanager/web/react-components/dist/MultiStep_AddEditEntity-BVXN3SAx.js deleted file mode 100644 index a84bd0b63..000000000 --- a/docker/web/nspanelmanager/web/react-components/dist/MultiStep_AddEditEntity-BVXN3SAx.js +++ /dev/null @@ -1,78 +0,0 @@ -import{a as i$,c as hm,i as Rs,n as o$,o as ct,r as a$,s as s$,t as u$}from"./main-edk7Os8W.js";var _=hm(a$(),1),zc=e=>{let t;const r=new Set,i=(l,c)=>{const d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){const m=t;t=c??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(h=>h(t,m))}},n=()=>t,s={setState:i,getState:n,getInitialState:()=>u,subscribe:l=>(r.add(l),()=>r.delete(l))},u=t=e(i,n,s);return s},l$=(e=>e?zc(e):zc),c$=e=>e;function d$(e,t=c$){const r=_.useSyncExternalStore(e.subscribe,_.useCallback(()=>t(e.getState()),[e,t]),_.useCallback(()=>t(e.getInitialState()),[e,t]));return _.useDebugValue(r),r}var Ec=e=>{const t=l$(e),r=i=>d$(t,i);return Object.assign(r,t),r},Fs=(e=>e?Ec(e):Ec);function f$(e){let t="";if(document.cookie&&document.cookie!==""){const r=document.cookie.split(";");for(let i=0;i({status:"loading",room_id:null,entities_pages:[],entities:[],scenes:[],fetchData:async t=>{e({status:"loading",room_id:t});let r="/rest/global/entities_pages";t!==void 0&&(r=`/rest/rooms/${t}/entities_pages`),fetch(r,{credentials:"same-origin",method:"GET",mode:"same-origin",headers:{"Content-Type":"application/json","X-CSRFToken":f$("csrftoken")}}).then(i=>i.json()).then(i=>{e(n=>({...n,room_id:t,entities_pages:i.entities_pages,entities:[],scenes:[]}));for(const n of i.entities_pages)e(o=>({...o,entities:[...o.entities,...n.entities],scenes:[...o.scenes,...n.scenes]}));e({status:"loaded"})})},removeEntitiesPage:t=>{e(r=>({entities_pages:r.entities_pages.filter(i=>i.id!==t)}))},createEntitiesPage:(t,r)=>{e(i=>({entities_pages:[...i.entities_pages,{id:i.entities_pages.length+1,display_order:0,number_of_entities:0,type:r?"scene":"entity",room_id:t}]}))},setScenePosition:(t,r,i)=>{e(n=>({...n,scenes:n.scenes.map(o=>o.id===t?{...o,entities_page_id:r,room_view_position:i}:o)}))},setEntityPosition:(t,r,i)=>{e(n=>({...n,entities:n.entities.map(o=>o.id===t?{...o,entities_page_id:r,room_view_position:i}:o)}))},removeEntity:t=>{e(r=>({entities:r.entities.filter(i=>i.id!==t)}))},removeScene:t=>{e(r=>({scenes:r.scenes.filter(i=>i.id!==t)}))}})),p=u$(),m$=({handleButtonSelectEvent:e,next_step:t})=>{const[r,i]=(0,_.useState)(!1),[n,o]=(0,_.useState)(!1),[a,s]=(0,_.useState)(!1),[u,l]=(0,_.useState)(!1);return(0,p.jsx)("div",{children:(0,p.jsxs)("div",{className:"grid grid-cols-3 gap-4 w-full",children:[(0,p.jsxs)("div",{onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),className:"group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10",onClick:()=>{e("entity_type","light")(),t()},children:[(0,p.jsx)("div",{className:"flex justify-center items-center",children:(0,p.jsx)("span",{className:`mdi ${r?"mdi-lightbulb-on":"mdi-lightbulb"} text-3xl text-neutral-content/50 group-hover:text-yellow-500`})}),(0,p.jsx)("div",{className:"flex justify-center items-center",children:(0,p.jsx)("span",{className:"text-base-content/50 group-hover:text-base-content",children:"Light"})})]}),(0,p.jsxs)("div",{onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),className:"group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10",onClick:()=>{e("entity_type","switch")(),t()},children:[(0,p.jsx)("div",{className:"flex justify-center items-center",children:(0,p.jsx)("span",{className:`mdi ${n?"mdi-toggle-switch-variant":"mdi-toggle-switch-variant-off"} text-3xl text-neutral-content/50 group-hover:text-yellow-500`})}),(0,p.jsx)("div",{className:"flex justify-center items-center",children:(0,p.jsx)("span",{className:"text-base-content/50 group-hover:text-base-content",children:"Switch"})})]}),(0,p.jsxs)("div",{onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),className:"group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10",onClick:()=>{e("entity_type","button")(),t()},children:[(0,p.jsx)("div",{className:"flex justify-center items-center",children:(0,p.jsx)("span",{className:`mdi ${a?"mdi-gesture-tap-button":"mdi-button-pointer"} text-3xl text-neutral-content/50 group-hover:text-yellow-500`})}),(0,p.jsx)("div",{className:"flex justify-center items-center",children:(0,p.jsx)("span",{className:"text-base-content/50 group-hover:text-base-content",children:"Button"})})]}),(0,p.jsxs)("div",{onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),className:"group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10",onClick:()=>{e("entity_type","thermostat")(),t()},children:[(0,p.jsx)("div",{className:"flex justify-center items-center",children:(0,p.jsx)("span",{className:`mdi ${u?"mdi-thermostat-cog":"mdi-thermostat"} text-3xl text-neutral-content/50 group-hover:text-yellow-500`})}),(0,p.jsx)("div",{className:"flex justify-center items-center",children:(0,p.jsx)("span",{className:"text-base-content/50 group-hover:text-base-content text-center",children:"Thermostat / climate"})})]})]})})};function p$(e){let t="";if(document.cookie&&document.cookie!==""){const r=document.cookie.split(";");for(let i=0;i({status:"none",settings:null,fetchData:async()=>{e({status:"loading"}),fetch("/rest/settings",{credentials:"same-origin",method:"GET",mode:"same-origin",headers:{"Content-Type":"application/json","X-CSRFToken":p$("csrftoken")}}).then(t=>t.json()).then(t=>{e(r=>({...r,status:"loaded",settings:t.settings}))})}})),h$=({handleButtonSelectEvent:e,entity_type:t,next_step:r})=>{const i={light:["home_assistant","openhab"],switch:["home_assistant","openhab"],button:["home_assistant","nspm"],thermostat:["home_assistant","openhab"],scene:["home_assistant","openhab","nspm"]};return(0,p.jsx)("div",{children:(0,p.jsxs)("div",{className:"grid grid-cols-3 gap-4 w-full",children:[i[t]?.includes("home_assistant")&&Oi.getState().settings?.home_assistant_token_set&&(0,p.jsxs)("div",{className:"group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-home-assistant/10",onClick:()=>{e("controller","home_assistant")(),r()},children:[(0,p.jsx)("div",{className:"flex justify-center items-center p-4",children:(0,p.jsx)("img",{src:"/static/home-assistant-logo/home-assistant-logomark-color-on-light.svg",alt:"Home Assistant logo",className:"h-12 w-12"})}),(0,p.jsx)("div",{className:"flex justify-center items-center",children:(0,p.jsx)("span",{className:"text-base-content/50 group-hover:text-base-content text-center",children:"Home Assistant"})})]}),i[t]?.includes("openhab")&&Oi.getState().settings?.openhab_token_set&&(0,p.jsxs)("div",{className:"group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-openhab/10",onClick:()=>{e("controller","openhab")(),r()},children:[(0,p.jsx)("div",{className:"flex justify-center items-center p-4",children:(0,p.jsx)("img",{src:"/static/openhab-logo/openHAB_darkBG_appicon.svg",alt:"OpenHAB logo",className:"h-12 w-12"})}),(0,p.jsx)("div",{className:"flex justify-center items-center",children:(0,p.jsx)("span",{className:"text-base-content/50 group-hover:text-base-content text-center",children:"OpenHAB"})})]}),i[t]?.includes("nspm")&&(0,p.jsxs)("div",{className:"group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-accent/10",onClick:()=>{e("controller","nspm")(),r()},children:[(0,p.jsx)("div",{className:"flex justify-center items-center p-4",children:(0,p.jsx)("img",{src:"/static/icon.svg",alt:"NSPanel Manager logo",className:"h-12 w-12"})}),(0,p.jsx)("div",{className:"flex justify-center items-center",children:(0,p.jsx)("span",{className:"text-base-content/50 group-hover:text-base-content text-center",children:"NSPanel Manager"})})]})]})})};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 v$(e,t){if(ln(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(ln(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vm(e){var t=v$(e,"string");return ln(t)=="symbol"?t:t+""}function nr(e,t,r){return(t=vm(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Cc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function X(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,i=Array(t);r0?Ae(Mn,--Ge):0,In--,Te===10&&(In=1,ao--),Te}function Ye(){return Te=Ge2||cr(Te)>3?"":" "}function W$(e,t){for(;--t&&Ye()&&!(Te<48||Te>102||Te>57&&Te<65||Te>70&&Te<97););return xr(e,gi()+(t<6&&Tt()==32&&Ye()==32))}function qa(e){for(;Ye();)switch(Te){case e:return Ge;case 34:case 39:e!==34&&e!==39&&qa(Te);break;case 40:e===41&&qa(e);break;case 92:Ye();break}return Ge}function H$(e,t){for(;Ye()&&e+Te!==57;)if(e+Te===84&&Tt()===47)break;return"/*"+xr(t,Ge-1)+"*"+oo(e===47?e:Ye())}function J$(e){for(;!cr(Tt());)Ye();return xr(e,Ge)}function G$(e){return wm(yi("",null,null,null,[""],e=Sm(e),0,[0],e))}function yi(e,t,r,i,n,o,a,s,u){for(var l=0,c=0,d=a,m=0,h=0,v=0,f=1,g=1,y=1,x=0,j="",S=n,w=o,$=i,O=j;g;)switch(v=x,x=Ye()){case 40:if(v!=108&&Ae(O,d-1)==58){Xa(O+=fe(bi(x),"&","&\f"),"&\f")!=-1&&(y=-1);break}case 34:case 39:case 91:O+=bi(x);break;case 9:case 10:case 13:case 32:O+=B$(v);break;case 92:O+=W$(gi()-1,7);continue;case 47:switch(Tt()){case 42:case 47:ri(K$(H$(Ye(),gi()),t,r),u);break;default:O+="/"}break;case 123*f:s[l++]=St(O)*y;case 125*f:case 59:case 0:switch(x){case 0:case 125:g=0;case 59+c:y==-1&&(O=fe(O,/\f/g,"")),h>0&&St(O)-d&&ri(h>32?Vc(O+";",i,r,d-1):Vc(fe(O," ","")+";",i,r,d-2),u);break;case 59:O+=";";default:if(ri($=Nc(O,t,r,l,c,n,s,j,S=[],w=[],d),o),x===123)if(c===0)yi(O,t,$,$,S,o,d,s,w);else switch(m===99&&Ae(O,3)===110?100:m){case 100:case 108:case 109:case 115:yi(e,$,$,i&&ri(Nc(e,$,$,0,0,n,s,j,n,S=[],d),w),n,w,d,s,i?S:w);break;default:yi(O,$,$,$,[""],w,0,s,w)}}l=c=h=0,f=y=1,j=O="",d=a;break;case 58:d=1+St(O),h=v;default:if(f<1){if(x==123)--f;else if(x==125&&f++==0&&Z$()==125)continue}switch(O+=oo(x),x*f){case 38:y=c>0?1:(O+="\f",-1);break;case 44:s[l++]=(St(O)-1)*y,y=1;break;case 64:Tt()===45&&(O+=bi(Ye())),m=Tt(),c=d=St(j=O+=J$(gi())),x++;break;case 45:v===45&&St(O)==2&&(f=0)}}return o}function Nc(e,t,r,i,n,o,a,s,u,l,c){for(var d=n-1,m=n===0?o:[""],h=Ws(m),v=0,f=0,g=0;v0?m[y]+" "+x:fe(x,/&\f/g,m[y])))&&(u[g++]=j);return so(e,t,r,n===0?Zs:s,u,l,c)}function K$(e,t,r){return so(e,t,r,ym,oo(L$()),lr(e,2,-2),0)}function Vc(e,t,r,i){return so(e,t,r,Bs,lr(e,0,i),lr(e,i+1,-1),i)}function wn(e,t){for(var r="",i=Ws(e),n=0;n6)switch(Ae(e,t+1)){case 109:if(Ae(e,t+4)!==45)break;case 102:return fe(e,/(.+:)(.+)-([^]+)/,"$1"+de+"$2-$3$1"+zi+(Ae(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Xa(e,"stretch")?km(fe(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ae(e,t+1)!==115)break;case 6444:switch(Ae(e,St(e)-3-(~Xa(e,"!important")&&10))){case 107:return fe(e,":",":"+de)+e;case 101:return fe(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+de+(Ae(e,14)===45?"inline-":"")+"box$3$1"+de+"$2$3$1"+Ue+"$2box$3")+e}break;case 5936:switch(Ae(e,t+11)){case 114:return de+e+Ue+fe(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return de+e+Ue+fe(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return de+e+Ue+fe(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return de+e+Ue+e+e}return e}var ox=[function(t,r,i,n){if(t.length>-1&&!t.return)switch(t.type){case Bs:t.return=km(t.value,t.length);break;case _m:return wn([Kn(t,{value:fe(t.value,"@","@"+de)})],n);case Zs:if(t.length)return F$(t.props,function(o){switch(R$(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return wn([Kn(t,{props:[fe(o,/:(read-\w+)/,":"+zi+"$1")]})],n);case"::placeholder":return wn([Kn(t,{props:[fe(o,/:(plac\w+)/,":"+de+"input-$1")]}),Kn(t,{props:[fe(o,/:(plac\w+)/,":"+zi+"$1")]}),Kn(t,{props:[fe(o,/:(plac\w+)/,Ue+"input-$1")]})],n)}return""})}}],ax=function(t){var r=t.key;if(r==="css"){var i=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(i,function(f){f.getAttribute("data-emotion").indexOf(" ")!==-1&&(document.head.appendChild(f),f.setAttribute("data-s",""))})}var n=t.stylisPlugins||ox,o={},a,s=[];a=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+r+' "]'),function(f){for(var g=f.getAttribute("data-emotion").split(" "),y=1;y{var t=typeof Symbol=="function"&&Symbol.for,r=t?Symbol.for("react.element"):60103,i=t?Symbol.for("react.portal"):60106,n=t?Symbol.for("react.fragment"):60107,o=t?Symbol.for("react.strict_mode"):60108,a=t?Symbol.for("react.profiler"):60114,s=t?Symbol.for("react.provider"):60109,u=t?Symbol.for("react.context"):60110,l=t?Symbol.for("react.async_mode"):60111,c=t?Symbol.for("react.concurrent_mode"):60111,d=t?Symbol.for("react.forward_ref"):60112,m=t?Symbol.for("react.suspense"):60113,h=t?Symbol.for("react.suspense_list"):60120,v=t?Symbol.for("react.memo"):60115,f=t?Symbol.for("react.lazy"):60116,g=t?Symbol.for("react.block"):60121,y=t?Symbol.for("react.fundamental"):60117,x=t?Symbol.for("react.responder"):60118,j=t?Symbol.for("react.scope"):60119;function S($){if(typeof $=="object"&&$!==null){var O=$.$$typeof;switch(O){case r:switch($=$.type,$){case l:case c:case n:case a:case o:case m:return $;default:switch($=$&&$.$$typeof,$){case u:case d:case f:case v:case s:return $;default:return O}}case i:return O}}}function w($){return S($)===c}e.AsyncMode=l,e.ConcurrentMode=c,e.ContextConsumer=u,e.ContextProvider=s,e.Element=r,e.ForwardRef=d,e.Fragment=n,e.Lazy=f,e.Memo=v,e.Portal=i,e.Profiler=a,e.StrictMode=o,e.Suspense=m,e.isAsyncMode=function($){return w($)||S($)===l},e.isConcurrentMode=w,e.isContextConsumer=function($){return S($)===u},e.isContextProvider=function($){return S($)===s},e.isElement=function($){return typeof $=="object"&&$!==null&&$.$$typeof===r},e.isForwardRef=function($){return S($)===d},e.isFragment=function($){return S($)===n},e.isLazy=function($){return S($)===f},e.isMemo=function($){return S($)===v},e.isPortal=function($){return S($)===i},e.isProfiler=function($){return S($)===a},e.isStrictMode=function($){return S($)===o},e.isSuspense=function($){return S($)===m},e.isValidElementType=function($){return typeof $=="string"||typeof $=="function"||$===n||$===c||$===a||$===o||$===m||$===h||typeof $=="object"&&$!==null&&($.$$typeof===f||$.$$typeof===v||$.$$typeof===s||$.$$typeof===u||$.$$typeof===d||$.$$typeof===y||$.$$typeof===x||$.$$typeof===j||$.$$typeof===g)},e.typeOf=S})),ux=Rs(((e,t)=>{t.exports=sx()})),lx=Rs(((e,t)=>{var r=ux(),i={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},o={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};s[r.ForwardRef]=o,s[r.Memo]=a;function u(g){return r.isMemo(g)?a:s[g.$$typeof]||i}var l=Object.defineProperty,c=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,m=Object.getOwnPropertyDescriptor,h=Object.getPrototypeOf,v=Object.prototype;function f(g,y,x){if(typeof y!="string"){if(v){var j=h(y);j&&j!==v&&f(g,j,x)}var S=c(y);d&&(S=S.concat(d(y)));for(var w=u(g),$=u(y),O=0;O=4;++i,n-=4)r=e.charCodeAt(i)&255|(e.charCodeAt(++i)&255)<<8|(e.charCodeAt(++i)&255)<<16|(e.charCodeAt(++i)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(n){case 3:t^=(e.charCodeAt(i+2)&255)<<16;case 2:t^=(e.charCodeAt(i+1)&255)<<8;case 1:t^=e.charCodeAt(i)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var mx={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},px=!1,hx=/[A-Z]|^ms/g,vx=/_EMO_([^_]+?)_([^]*?)_EMO_/g,jm=function(t){return t.charCodeAt(1)===45},Mc=function(t){return t!=null&&typeof t!="boolean"},pa=Q$(function(e){return jm(e)?e:e.replace(hx,"-$&").toLowerCase()}),Rc=function(t,r){switch(t){case"animation":case"animationName":if(typeof r=="string")return r.replace(vx,function(i,n,o){return wt={name:n,styles:o,next:wt},n})}return mx[t]!==1&&!jm(t)&&typeof r=="number"&&r!==0?r+"px":r},gx="Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";function dr(e,t,r){if(r==null)return"";var i=r;if(i.__emotion_styles!==void 0)return i;switch(typeof r){case"boolean":return"";case"object":var n=r;if(n.anim===1)return wt={name:n.name,styles:n.styles,next:wt},n.name;var o=r;if(o.styles!==void 0){var a=o.next;if(a!==void 0)for(;a!==void 0;)wt={name:a.name,styles:a.styles,next:wt},a=a.next;return o.styles+";"}return bx(e,t,r);case"function":if(e!==void 0){var s=wt,u=r(e);return wt=s,dr(e,t,u)}break}var l=r;if(t==null)return l;var c=t[l];return c!==void 0?c:l}function bx(e,t,r){var i="";if(Array.isArray(r))for(var n=0;n({x:e,y:e});function Ox(e){const{x:t,y:r,width:i,height:n}=e;return{width:i,height:n,top:r,left:t,right:t+i,bottom:r+n,x:t,y:r}}function uo(){return typeof window<"u"}function Dm(e){return Em(e)?(e.nodeName||"").toLowerCase():"#document"}function gt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function zm(e){var t;return(t=(Em(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Em(e){return uo()?e instanceof Node||e instanceof gt(e).Node:!1}function Qa(e){return uo()?e instanceof Element||e instanceof gt(e).Element:!1}function Gs(e){return uo()?e instanceof HTMLElement||e instanceof gt(e).HTMLElement:!1}function Lc(e){return!uo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof gt(e).ShadowRoot}function Cm(e){const{overflow:t,overflowX:r,overflowY:i,display:n}=Ks(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+r)&&n!=="inline"&&n!=="contents"}var ha;function Dx(){return ha==null&&(ha=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ha}function zx(e){return/^(html|body|#document)$/.test(Dm(e))}function Ks(e){return gt(e).getComputedStyle(e)}function Ex(e){if(Dm(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Lc(e)&&e.host||zm(e);return Lc(t)?t.host:t}function Am(e){const t=Ex(e);return zx(t)?e.ownerDocument?e.ownerDocument.body:e.body:Gs(t)&&Cm(t)?t:Am(t)}function Ai(e,t,r){var i;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=Am(e),o=n===((i=e.ownerDocument)==null?void 0:i.body),a=gt(n);if(o){const s=es(a);return t.concat(a,a.visualViewport||[],Cm(n)?n:[],s&&r?Ai(s):[])}else return t.concat(n,Ai(n,[],r))}function es(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Cx(e){const t=Ks(e);let r=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const n=Gs(e),o=n?e.offsetWidth:r,a=n?e.offsetHeight:i,s=Ei(r)!==o||Ei(i)!==a;return s&&(r=o,i=a),{width:r,height:i,$:s}}function Xs(e){return Qa(e)?e:e.contextElement}function va(e){const t=Xs(e);if(!Gs(t))return Ci(1);const r=t.getBoundingClientRect(),{width:i,height:n,$:o}=Cx(t);let a=(o?Ei(r.width):r.width)/i,s=(o?Ei(r.height):r.height)/n;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var Ax=Ci(0);function Nx(e){const t=gt(e);return!Dx()||!t.visualViewport?Ax:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Vx(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==gt(e)?!1:t}function Zc(e,t,r,i){t===void 0&&(t=!1),r===void 0&&(r=!1);const n=e.getBoundingClientRect(),o=Xs(e);let a=Ci(1);t&&(i?Qa(i)&&(a=va(i)):a=va(e));const s=Vx(o,r,i)?Nx(o):Ci(0);let u=(n.left+s.x)/a.x,l=(n.top+s.y)/a.y,c=n.width/a.x,d=n.height/a.y;if(o){const m=gt(o),h=i&&Qa(i)?gt(i):i;let v=m,f=es(v);for(;f&&i&&h!==v;){const g=va(f),y=f.getBoundingClientRect(),x=Ks(f),j=y.left+(f.clientLeft+parseFloat(x.paddingLeft))*g.x,S=y.top+(f.clientTop+parseFloat(x.paddingTop))*g.y;u*=g.x,l*=g.y,c*=g.x,d*=g.y,u+=j,l+=S,v=gt(f),f=es(v)}}return Ox({width:c,height:d,x:u,y:l})}function Nm(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ux(e,t){let r=null,i;const n=zm(e);function o(){var s;clearTimeout(i),(s=r)==null||s.disconnect(),r=null}function a(s,u){s===void 0&&(s=!1),u===void 0&&(u=1),o();const l=e.getBoundingClientRect(),{left:c,top:d,width:m,height:h}=l;if(s||t(),!m||!h)return;const v=ii(d),f=ii(n.clientWidth-(c+m)),g=ii(n.clientHeight-(d+h)),y=ii(c),x={rootMargin:-v+"px "+-f+"px "+-g+"px "+-y+"px",threshold:Px(0,Tx(1,u))||1};let j=!0;function S(w){const $=w[0].intersectionRatio;if($!==u){if(!j)return a();$?a(!1,$):i=setTimeout(()=>{a(!1,1e-7)},1e3)}$===1&&!Nm(l,e.getBoundingClientRect())&&a(),j=!1}try{r=new IntersectionObserver(S,{...x,root:n.ownerDocument})}catch{r=new IntersectionObserver(S,x)}r.observe(e)}return a(!0),o}function Mx(e,t,r,i){i===void 0&&(i={});const{ancestorScroll:n=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:u=!1}=i,l=Xs(e),c=n||o?[...l?Ai(l):[],...t?Ai(t):[]]:[];c.forEach(y=>{n&&y.addEventListener("scroll",r,{passive:!0}),o&&y.addEventListener("resize",r)});const d=l&&s?Ux(l,r):null;let m=-1,h=null;a&&(h=new ResizeObserver(y=>{let[x]=y;x&&x.target===l&&h&&t&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var j;(j=h)==null||j.observe(t)})),r()}),l&&!u&&h.observe(l),t&&h.observe(t));let v,f=u?Zc(e):null;u&&g();function g(){const y=Zc(e);f&&!Nm(f,y)&&r(),f=y,v=requestAnimationFrame(g)}return r(),()=>{var y;c.forEach(x=>{n&&x.removeEventListener("scroll",r),o&&x.removeEventListener("resize",r)}),d?.(),(y=h)==null||y.disconnect(),h=null,u&&cancelAnimationFrame(v)}}var ts=_.useLayoutEffect,Rx=o$(),Fx=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],Ni=function(){};function Lx(e,t){return t?t[0]==="-"?e+t:e+"__"+t:e}function Zx(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n-1}function Bx(e){return lo(e)?window.innerHeight:e.clientHeight}function Um(e){return lo(e)?window.pageYOffset:e.scrollTop}function Vi(e,t){if(lo(e)){window.scrollTo(0,t);return}e.scrollTop=t}function Wx(e){var t=getComputedStyle(e),r=t.position==="absolute",i=/(auto|scroll)/;if(t.position==="fixed")return document.documentElement;for(var n=e;n=n.parentElement;)if(t=getComputedStyle(n),!(r&&t.position==="static")&&i.test(t.overflow+t.overflowY+t.overflowX))return n;return document.documentElement}function Hx(e,t,r,i){return r*((e=e/i-1)*e*e+1)+t}function oi(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Ni,n=Um(e),o=t-n,a=10,s=0;function u(){s+=a,Vi(e,Hx(s,n,o,r)),sr.bottom?Vi(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+n,e.scrollHeight)):i.top-n1?r-1:0),n=1;n=h)return{placement:"bottom",maxHeight:t};if(O>=h&&!a)return o&&oi(u,z,U),{placement:"bottom",maxHeight:t};if(!a&&O>=i||a&&w>=i)return o&&oi(u,z,U),{placement:"bottom",maxHeight:a?w-x:O-x};if(n==="auto"||a){var oe=t,B=a?S:$;return B>=i&&(oe=Math.min(B-x-s,t)),{placement:"top",maxHeight:oe}}if(n==="bottom")return o&&Vi(u,z),{placement:"bottom",maxHeight:t};break;case"top":if(S>=h)return{placement:"top",maxHeight:t};if($>=h&&!a)return o&&oi(u,L,U),{placement:"top",maxHeight:t};if(!a&&$>=i||a&&S>=i){var q=t;return(!a&&$>=i||a&&S>=i)&&(q=a?S-j:$-j),o&&oi(u,L,U),{placement:"top",maxHeight:q}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'.concat(n,'".'))}return l}function rS(e){return e?{bottom:"top",top:"bottom"}[e]:"bottom"}var Rm=function(t){return t==="auto"?"bottom":t},iS=function(t,r){var i,n=t.placement,o=t.theme,a=o.borderRadius,s=o.spacing,u=o.colors;return X((i={label:"menu"},nr(i,rS(n),"100%"),nr(i,"position","absolute"),nr(i,"width","100%"),nr(i,"zIndex",1),i),r?{}:{backgroundColor:u.neutral0,borderRadius:a,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:s.menuGutter,marginTop:s.menuGutter})},Fm=(0,_.createContext)(null),oS=function(t){var r=t.children,i=t.minMenuHeight,n=t.maxMenuHeight,o=t.menuPlacement,a=t.menuPosition,s=t.menuShouldScrollIntoView,u=t.theme,l=((0,_.useContext)(Fm)||{}).setPortalPlacement,c=(0,_.useRef)(null),d=At((0,_.useState)(n),2),m=d[0],h=d[1],v=At((0,_.useState)(null),2),f=v[0],g=v[1],y=u.spacing.controlHeight;return ts(function(){var x=c.current;if(x){var j=a==="fixed",S=nS({maxHeight:n,menuEl:x,minHeight:i,placement:o,shouldScroll:s&&!j,isFixedPosition:j,controlHeight:y});h(S.maxHeight),g(S.placement),l?.(S.placement)}},[n,o,a,s,i,l,y]),r({ref:c,placerProps:X(X({},t),{},{placement:f||Rm(o),maxHeight:m})})},aS=function(t){var r=t.children,i=t.innerRef,n=t.innerProps;return J("div",te({},we(t,"menu",{menu:!0}),{ref:i},n),r)},sS=function(t,r){var i=t.maxHeight,n=t.theme.spacing.baseUnit;return X({maxHeight:i,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},r?{}:{paddingBottom:n,paddingTop:n})},uS=function(t){var r=t.children,i=t.innerProps,n=t.innerRef,o=t.isMulti;return J("div",te({},we(t,"menuList",{"menu-list":!0,"menu-list--is-multi":o}),{ref:n},i),r)},Lm=function(t,r){var i=t.theme,n=i.spacing.baseUnit,o=i.colors;return X({textAlign:"center"},r?{}:{color:o.neutral40,padding:"".concat(n*2,"px ").concat(n*3,"px")})},lS=Lm,cS=Lm,dS=function(t){var r=t.children,i=r===void 0?"No options":r,n=t.innerProps;return J("div",te({},we(X(X({},Vt(t,eS)),{},{children:i,innerProps:n}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),n),i)},fS=function(t){var r=t.children,i=r===void 0?"Loading...":r,n=t.innerProps;return J("div",te({},we(X(X({},Vt(t,tS)),{},{children:i,innerProps:n}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),n),i)},mS=function(t){var r=t.rect,i=t.offset,n=t.position;return{left:r.left,position:n,top:i,width:r.width,zIndex:1}},pS=function(t){var r=t.appendTo,i=t.children,n=t.controlElement,o=t.innerProps,a=t.menuPlacement,s=t.menuPosition,u=(0,_.useRef)(null),l=(0,_.useRef)(null),c=At((0,_.useState)(Rm(a)),2),d=c[0],m=c[1],h=(0,_.useMemo)(function(){return{setPortalPlacement:m}},[]),v=At((0,_.useState)(null),2),f=v[0],g=v[1],y=(0,_.useCallback)(function(){if(n){var w=Jx(n),$=s==="fixed"?0:window.pageYOffset,O=w[d]+$;(O!==f?.offset||w.left!==f?.rect.left||w.width!==f?.rect.width)&&g({offset:O,rect:w})}},[n,s,d,f?.offset,f?.rect.left,f?.rect.width]);ts(function(){y()},[y]);var x=(0,_.useCallback)(function(){typeof l.current=="function"&&(l.current(),l.current=null),n&&u.current&&(l.current=Mx(n,u.current,y,{elementResize:"ResizeObserver"in window}))},[n,y]);ts(function(){x()},[x]);var j=(0,_.useCallback)(function(w){u.current=w,x()},[x]);if(!r&&s!=="fixed"||!f)return null;var S=J("div",te({ref:j},we(X(X({},t),{},{offset:f.offset,position:s,rect:f.rect}),"menuPortal",{"menu-portal":!0}),o),i);return J(Fm.Provider,{value:h},r?(0,Rx.createPortal)(S,r):S)},hS=function(t){var r=t.isDisabled;return{label:"container",direction:t.isRtl?"rtl":void 0,pointerEvents:r?"none":void 0,position:"relative"}},vS=function(t){var r=t.children,i=t.innerProps,n=t.isDisabled,o=t.isRtl;return J("div",te({},we(t,"container",{"--is-disabled":n,"--is-rtl":o}),i),r)},gS=function(t,r){var i=t.theme.spacing,n=t.isMulti,o=t.hasValue,a=t.selectProps.controlShouldRenderValue;return X({alignItems:"center",display:n&&o&&a?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},r?{}:{padding:"".concat(i.baseUnit/2,"px ").concat(i.baseUnit*2,"px")})},bS=function(t){var r=t.children,i=t.innerProps,n=t.isMulti,o=t.hasValue;return J("div",te({},we(t,"valueContainer",{"value-container":!0,"value-container--is-multi":n,"value-container--has-value":o}),i),r)},yS=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},_S=function(t){var r=t.children,i=t.innerProps;return J("div",te({},we(t,"indicatorsContainer",{indicators:!0}),i),r)},Jc,$S=["size"],xS=["innerProps","isRtl","size"],SS={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},Zm=function(t){var r=t.size,i=Vt(t,$S);return J("svg",te({height:r,width:r,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:SS},i))},qs=function(t){return J(Zm,te({size:20},t),J("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},Bm=function(t){return J(Zm,te({size:20},t),J("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},Wm=function(t,r){var i=t.isFocused,n=t.theme,o=n.spacing.baseUnit,a=n.colors;return X({label:"indicatorContainer",display:"flex",transition:"color 150ms"},r?{}:{color:i?a.neutral60:a.neutral20,padding:o*2,":hover":{color:i?a.neutral80:a.neutral40}})},wS=Wm,kS=function(t){var r=t.children,i=t.innerProps;return J("div",te({},we(t,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),i),r||J(Bm,null))},IS=Wm,jS=function(t){var r=t.children,i=t.innerProps;return J("div",te({},we(t,"clearIndicator",{indicator:!0,"clear-indicator":!0}),i),r||J(qs,null))},TS=function(t,r){var i=t.isDisabled,n=t.theme,o=n.spacing.baseUnit,a=n.colors;return X({label:"indicatorSeparator",alignSelf:"stretch",width:1},r?{}:{backgroundColor:i?a.neutral10:a.neutral20,marginBottom:o*2,marginTop:o*2})},PS=function(t){var r=t.innerProps;return J("span",te({},r,we(t,"indicatorSeparator",{"indicator-separator":!0})))},OS=Ix(Jc||(Jc=jx([` - 0%, 80%, 100% { opacity: 0; } - 40% { opacity: 1; } -`]))),DS=function(t,r){var i=t.isFocused,n=t.size,o=t.theme,a=o.colors,s=o.spacing.baseUnit;return X({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:n,lineHeight:1,marginRight:n,textAlign:"center",verticalAlign:"middle"},r?{}:{color:i?a.neutral60:a.neutral20,padding:s*2})},ga=function(t){var r=t.delay,i=t.offset;return J("span",{css:Js({animation:"".concat(OS," 1s ease-in-out ").concat(r,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:i?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},zS=function(t){var r=t.innerProps,i=t.isRtl,n=t.size,o=n===void 0?4:n;return J("div",te({},we(X(X({},Vt(t,xS)),{},{innerProps:r,isRtl:i,size:o}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),r),J(ga,{delay:0,offset:i}),J(ga,{delay:160,offset:!0}),J(ga,{delay:320,offset:!i}))},ES=function(t,r){var i=t.isDisabled,n=t.isFocused,o=t.theme,a=o.colors,s=o.borderRadius,u=o.spacing;return X({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:u.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},r?{}:{backgroundColor:i?a.neutral5:a.neutral0,borderColor:i?a.neutral10:n?a.primary:a.neutral20,borderRadius:s,borderStyle:"solid",borderWidth:1,boxShadow:n?"0 0 0 1px ".concat(a.primary):void 0,"&:hover":{borderColor:n?a.primary:a.neutral30}})},CS=function(t){var r=t.children,i=t.isDisabled,n=t.isFocused,o=t.innerRef,a=t.innerProps,s=t.menuIsOpen;return J("div",te({ref:o},we(t,"control",{control:!0,"control--is-disabled":i,"control--is-focused":n,"control--menu-is-open":s}),a,{"aria-disabled":i||void 0}),r)},AS=["data"],NS=function(t,r){var i=t.theme.spacing;return r?{}:{paddingBottom:i.baseUnit*2,paddingTop:i.baseUnit*2}},VS=function(t){var r=t.children,i=t.cx,n=t.getStyles,o=t.getClassNames,a=t.Heading,s=t.headingProps,u=t.innerProps,l=t.label,c=t.theme,d=t.selectProps;return J("div",te({},we(t,"group",{group:!0}),u),J(a,te({},s,{selectProps:d,theme:c,getStyles:n,getClassNames:o,cx:i}),l),J("div",null,r))},US=function(t,r){var i=t.theme,n=i.colors,o=i.spacing;return X({label:"group",cursor:"default",display:"block"},r?{}:{color:n.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:o.baseUnit*3,paddingRight:o.baseUnit*3,textTransform:"uppercase"})},MS=function(t){var r=Vm(t);r.data;var i=Vt(r,AS);return J("div",te({},we(t,"groupHeading",{"group-heading":!0}),i))},RS=VS,FS=["innerRef","isDisabled","isHidden","inputClassName"],LS=function(t,r){var i=t.isDisabled,n=t.value,o=t.theme,a=o.spacing,s=o.colors;return X(X({visibility:i?"hidden":"visible",transform:n?"translateZ(0)":""},ZS),r?{}:{margin:a.baseUnit/2,paddingBottom:a.baseUnit/2,paddingTop:a.baseUnit/2,color:s.neutral80})},Hm={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},ZS={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":X({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},Hm)},BS=function(t){return X({label:"input",color:"inherit",background:0,opacity:t?0:1,width:"100%"},Hm)},WS=function(t){var r=t.cx,i=t.value,n=Vm(t),o=n.innerRef,a=n.isDisabled,s=n.isHidden,u=n.inputClassName,l=Vt(n,FS);return J("div",te({},we(t,"input",{"input-container":!0}),{"data-value":i||""}),J("input",te({className:r({input:!0},u),ref:o,style:BS(s),disabled:a},l)))},HS=function(t,r){var i=t.theme,n=i.spacing,o=i.borderRadius,a=i.colors;return X({label:"multiValue",display:"flex",minWidth:0},r?{}:{backgroundColor:a.neutral10,borderRadius:o/2,margin:n.baseUnit/2})},JS=function(t,r){var i=t.theme,n=i.borderRadius,o=i.colors,a=t.cropWithEllipsis;return X({overflow:"hidden",textOverflow:a||a===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},r?{}:{borderRadius:n/2,color:o.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},GS=function(t,r){var i=t.theme,n=i.spacing,o=i.borderRadius,a=i.colors,s=t.isFocused;return X({alignItems:"center",display:"flex"},r?{}:{borderRadius:o/2,backgroundColor:s?a.dangerLight:void 0,paddingLeft:n.baseUnit,paddingRight:n.baseUnit,":hover":{backgroundColor:a.dangerLight,color:a.danger}})},Jm=function(t){var r=t.children,i=t.innerProps;return J("div",i,r)},KS=Jm,XS=Jm;function qS(e){var t=e.children,r=e.innerProps;return J("div",te({role:"button"},r),t||J(qs,{size:14}))}var YS=function(t){var r=t.children,i=t.components,n=t.data,o=t.innerProps,a=t.isDisabled,s=t.removeProps,u=t.selectProps,l=i.Container,c=i.Label,d=i.Remove;return J(l,{data:n,innerProps:X(X({},we(t,"multiValue",{"multi-value":!0,"multi-value--is-disabled":a})),o),selectProps:u},J(c,{data:n,innerProps:X({},we(t,"multiValueLabel",{"multi-value__label":!0})),selectProps:u},r),J(d,{data:n,innerProps:X(X({},we(t,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(r||"option")},s),selectProps:u}))},QS=function(t,r){var i=t.isDisabled,n=t.isFocused,o=t.isSelected,a=t.theme,s=a.spacing,u=a.colors;return X({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},r?{}:{backgroundColor:o?u.primary:n?u.primary25:"transparent",color:i?u.neutral20:o?u.neutral0:"inherit",padding:"".concat(s.baseUnit*2,"px ").concat(s.baseUnit*3,"px"),":active":{backgroundColor:i?void 0:o?u.primary:u.primary50}})},ew=function(t){var r=t.children,i=t.isDisabled,n=t.isFocused,o=t.isSelected,a=t.innerRef,s=t.innerProps;return J("div",te({},we(t,"option",{option:!0,"option--is-disabled":i,"option--is-focused":n,"option--is-selected":o}),{ref:a,"aria-disabled":i},s),r)},tw=function(t,r){var i=t.theme,n=i.spacing,o=i.colors;return X({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},r?{}:{color:o.neutral50,marginLeft:n.baseUnit/2,marginRight:n.baseUnit/2})},nw=function(t){var r=t.children,i=t.innerProps;return J("div",te({},we(t,"placeholder",{placeholder:!0}),i),r)},rw=function(t,r){var i=t.isDisabled,n=t.theme,o=n.spacing,a=n.colors;return X({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},r?{}:{color:i?a.neutral40:a.neutral80,marginLeft:o.baseUnit/2,marginRight:o.baseUnit/2})},iw={ClearIndicator:jS,Control:CS,DropdownIndicator:kS,DownChevron:Bm,CrossIcon:qs,Group:RS,GroupHeading:MS,IndicatorsContainer:_S,IndicatorSeparator:PS,Input:WS,LoadingIndicator:zS,Menu:aS,MenuList:uS,MenuPortal:pS,LoadingMessage:fS,NoOptionsMessage:dS,MultiValue:YS,MultiValueContainer:KS,MultiValueLabel:XS,MultiValueRemove:qS,Option:ew,Placeholder:nw,SelectContainer:vS,SingleValue:function(t){var r=t.children,i=t.isDisabled,n=t.innerProps;return J("div",te({},we(t,"singleValue",{"single-value":!0,"single-value--is-disabled":i}),n),r)},ValueContainer:bS},ow=function(t){return X(X({},iw),t.components)},Gc=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function aw(e,t){return!!(e===t||Gc(e)&&Gc(t))}function sw(e,t){if(e.length!==t.length)return!1;for(var r=0;r1?"s":""," ").concat(o.join(","),", selected.");case"select-option":return a?"option ".concat(n," is disabled. Select another option."):"option ".concat(n,", selected.");default:return""}},onFocus:function(t){var r=t.context,i=t.focused,n=t.options,o=t.label,a=o===void 0?"":o,s=t.selectValue,u=t.isDisabled,l=t.isSelected,c=t.isAppleDevice,d=function(f,g){return f&&f.length?"".concat(f.indexOf(g)+1," of ").concat(f.length):""};if(r==="value"&&s)return"value ".concat(a," focused, ").concat(d(s,i),".");if(r==="menu"&&c){var m=u?" disabled":"",h="".concat(l?" selected":"").concat(m);return"".concat(a).concat(h,", ").concat(d(n,i),".")}return""},onFilter:function(t){var r=t.inputValue,i=t.resultsMessage;return"".concat(i).concat(r?" for search term "+r:"",".")}},dw=function(t){var r=t.ariaSelection,i=t.focusedOption,n=t.focusedValue,o=t.focusableOptions,a=t.isFocused,s=t.selectValue,u=t.selectProps,l=t.id,c=t.isAppleDevice,d=u.ariaLiveMessages,m=u.getOptionLabel,h=u.inputValue,v=u.isMulti,f=u.isOptionDisabled,g=u.isSearchable,y=u.menuIsOpen,x=u.options,j=u.screenReaderStatus,S=u.tabSelectsValue,w=u.isLoading,$=u["aria-label"],O=u["aria-live"],z=(0,_.useMemo)(function(){return X(X({},cw),d||{})},[d]),L=(0,_.useMemo)(function(){var G="";if(r&&z.onChange){var Q=r.option,re=r.options,P=r.removedValue,ee=r.removedValues,N=r.value,ce=P||Q||(function(Xe){return Array.isArray(Xe)?null:Xe})(N),ke=ce?m(ce):"",De=re||ee||void 0,ft=De?De.map(m):[],nt=X({isDisabled:ce&&f(ce,s),label:ke,labels:ft},r);G=z.onChange(nt)}return G},[r,z,f,s,m]),U=(0,_.useMemo)(function(){var G="",Q=i||n,re=!!(i&&s&&s.includes(i));if(Q&&z.onFocus){var P={focused:Q,label:m(Q),isDisabled:f(Q,s),isSelected:re,options:o,context:Q===i?"menu":"value",selectValue:s,isAppleDevice:c};G=z.onFocus(P)}return G},[i,n,m,f,z,o,s,c]),oe=(0,_.useMemo)(function(){var G="";if(y&&x.length&&!w&&z.onFilter){var Q=j({count:o.length});G=z.onFilter({inputValue:h,resultsMessage:Q})}return G},[o,h,y,z,x,j,w]),B=r?.action==="initial-input-focus",q=(0,_.useMemo)(function(){var G="";if(z.guidance){var Q=n?"value":y?"menu":"input";G=z.guidance({"aria-label":$,context:Q,isDisabled:i&&f(i,s),isMulti:v,isSearchable:g,tabSelectsValue:S,isInitialFocus:B})}return G},[$,i,n,v,f,g,y,z,s,S,B]),ae=J(_.Fragment,null,J("span",{id:"aria-selection"},L),J("span",{id:"aria-focused"},U),J("span",{id:"aria-results"},oe),J("span",{id:"aria-guidance"},q));return J(_.Fragment,null,J(Kc,{id:l},B&&ae),J(Kc,{"aria-live":O,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},a&&!B&&ae))},ns=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],fw=new RegExp("["+ns.map(function(e){return e.letters}).join("")+"]","g"),Gm={};for(var ba=0;ba-1}},vw=["innerRef"];function gw(e){var t=e.innerRef,r=Qx(Vt(e,vw),"onExited","in","enter","exit","appear");return J("input",te({ref:t},r,{css:Js({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var bw=function(t){t.cancelable&&t.preventDefault(),t.stopPropagation()};function yw(e){var t=e.isEnabled,r=e.onBottomArrive,i=e.onBottomLeave,n=e.onTopArrive,o=e.onTopLeave,a=(0,_.useRef)(!1),s=(0,_.useRef)(!1),u=(0,_.useRef)(0),l=(0,_.useRef)(null),c=(0,_.useCallback)(function(g,y){if(l.current!==null){var x=l.current,j=x.scrollTop,S=x.scrollHeight,w=x.clientHeight,$=l.current,O=y>0,z=S-w-j,L=!1;z>y&&a.current&&(i&&i(g),a.current=!1),O&&s.current&&(o&&o(g),s.current=!1),O&&y>z?(r&&!a.current&&r(g),$.scrollTop=S,L=!0,a.current=!0):!O&&-y>j&&(n&&!s.current&&n(g),$.scrollTop=0,L=!0,s.current=!0),L&&bw(g)}},[r,i,n,o]),d=(0,_.useCallback)(function(g){c(g,g.deltaY)},[c]),m=(0,_.useCallback)(function(g){u.current=g.changedTouches[0].clientY},[]),h=(0,_.useCallback)(function(g){c(g,u.current-g.changedTouches[0].clientY)},[c]),v=(0,_.useCallback)(function(g){if(g){var y=Xx?{passive:!1}:!1;g.addEventListener("wheel",d,y),g.addEventListener("touchstart",m,y),g.addEventListener("touchmove",h,y)}},[h,m,d]),f=(0,_.useCallback)(function(g){g&&(g.removeEventListener("wheel",d,!1),g.removeEventListener("touchstart",m,!1),g.removeEventListener("touchmove",h,!1))},[h,m,d]);return(0,_.useEffect)(function(){if(t){var g=l.current;return v(g),function(){f(g)}}},[t,v,f]),function(g){l.current=g}}var qc=["boxSizing","height","overflow","paddingRight","position"],Yc={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function Qc(e){e.cancelable&&e.preventDefault()}function ed(e){e.stopPropagation()}function td(){var e=this.scrollTop,t=this.scrollHeight,r=e+this.offsetHeight;e===0?this.scrollTop=1:r===t&&(this.scrollTop=e-1)}function nd(){return"ontouchstart"in window||navigator.maxTouchPoints}var rd=!!(typeof window<"u"&&window.document&&window.document.createElement),Xn=0,hn={capture:!1,passive:!1};function _w(e){var t=e.isEnabled,r=e.accountForScrollbars,i=r===void 0?!0:r,n=(0,_.useRef)({}),o=(0,_.useRef)(null),a=(0,_.useCallback)(function(u){if(rd){var l=document.body,c=l&&l.style;if(i&&qc.forEach(function(v){var f=c&&c[v];n.current[v]=f}),i&&Xn<1){var d=parseInt(n.current.paddingRight,10)||0,m=document.body?document.body.clientWidth:0,h=window.innerWidth-m+d||0;Object.keys(Yc).forEach(function(v){var f=Yc[v];c&&(c[v]=f)}),c&&(c.paddingRight="".concat(h,"px"))}l&&nd()&&(l.addEventListener("touchmove",Qc,hn),u&&(u.addEventListener("touchstart",td,hn),u.addEventListener("touchmove",ed,hn))),Xn+=1}},[i]),s=(0,_.useCallback)(function(u){if(rd){var l=document.body,c=l&&l.style;Xn=Math.max(Xn-1,0),i&&Xn<1&&qc.forEach(function(d){var m=n.current[d];c&&(c[d]=m)}),l&&nd()&&(l.removeEventListener("touchmove",Qc,hn),u&&(u.removeEventListener("touchstart",td,hn),u.removeEventListener("touchmove",ed,hn)))}},[i]);return(0,_.useEffect)(function(){if(t){var u=o.current;return a(u),function(){s(u)}}},[t,a,s]),function(u){o.current=u}}var $w=function(t){var r=t.target;return r.ownerDocument.activeElement&&r.ownerDocument.activeElement.blur()},xw={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function Sw(e){var t=e.children,r=e.lockEnabled,i=e.captureEnabled,n=i===void 0?!0:i,o=e.onBottomArrive,a=e.onBottomLeave,s=e.onTopArrive,u=e.onTopLeave,l=yw({isEnabled:n,onBottomArrive:o,onBottomLeave:a,onTopArrive:s,onTopLeave:u}),c=_w({isEnabled:r});return J(_.Fragment,null,r&&J("div",{onClick:$w,css:xw}),t(function(m){l(m),c(m)}))}var ww={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},kw=function(t){var r=t.name,i=t.onFocus;return J("input",{required:!0,name:r,tabIndex:-1,"aria-hidden":"true",onFocus:i,css:ww,value:"",onChange:function(){}})};function Ys(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function Iw(){return Ys(/^iPhone/i)}function Xm(){return Ys(/^Mac/i)}function jw(){return Ys(/^iPad/i)||Xm()&&navigator.maxTouchPoints>1}function Tw(){return Iw()||jw()}function Pw(){return Xm()||Tw()}var Ow=function(t){return t.label},Dw=function(t){return t.label},zw=function(t){return t.value},Ew=function(t){return!!t.isDisabled},Cw={clearIndicator:IS,container:hS,control:ES,dropdownIndicator:wS,group:NS,groupHeading:US,indicatorsContainer:yS,indicatorSeparator:TS,input:LS,loadingIndicator:DS,loadingMessage:cS,menu:iS,menuList:sS,menuPortal:mS,multiValue:HS,multiValueLabel:JS,multiValueRemove:GS,noOptionsMessage:lS,option:QS,placeholder:tw,singleValue:rw,valueContainer:gS},Aw={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},Nw=4,id=4,$a={borderRadius:Nw,colors:Aw,spacing:{baseUnit:id,controlHeight:38,menuGutter:id*2}},Vw={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:Hc(),captureMenuScroll:!Hc(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:hw(),formatGroupLabel:Ow,getOptionLabel:Dw,getOptionValue:zw,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:Ew,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!Gx(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(t){var r=t.count;return"".concat(r," result").concat(r!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function od(e,t,r,i){return{type:"option",data:t,isDisabled:Qm(e,t,r),isSelected:ep(e,t,r),label:Ym(e,t),value:Ui(e,t),index:i}}function _i(e,t){return e.options.map(function(r,i){if("options"in r){var n=r.options.map(function(a,s){return od(e,a,t,s)}).filter(function(a){return sd(e,a)});return n.length>0?{type:"group",data:r,options:n,index:i}:void 0}var o=od(e,r,t,i);return sd(e,o)?o:void 0}).filter(qx)}function qm(e){return e.reduce(function(t,r){return r.type==="group"?t.push.apply(t,Ls(r.options.map(function(i){return i.data}))):t.push(r.data),t},[])}function ad(e,t){return e.reduce(function(r,i){return i.type==="group"?r.push.apply(r,Ls(i.options.map(function(n){return{data:n.data,id:"".concat(t,"-").concat(i.index,"-").concat(n.index)}}))):r.push({data:i.data,id:"".concat(t,"-").concat(i.index)}),r},[])}function Uw(e,t){return qm(_i(e,t))}function sd(e,t){var r=e.inputValue,i=r===void 0?"":r,n=t.data,o=t.isSelected,a=t.label,s=t.value;return(!np(e)||!o)&&tp(e,{label:a,value:s,data:n},i)}function Mw(e,t){var r=e.focusedValue,i=e.selectValue.indexOf(r);if(i>-1){if(t.indexOf(r)>-1)return r;if(i-1?r:t[0]}var xa=function(t,r){var i;return((i=t.find(function(n){return n.data===r}))===null||i===void 0?void 0:i.id)||null},Ym=function(t,r){return t.getOptionLabel(r)},Ui=function(t,r){return t.getOptionValue(r)};function Qm(e,t,r){return typeof e.isOptionDisabled=="function"?e.isOptionDisabled(t,r):!1}function ep(e,t,r){if(r.indexOf(t)>-1)return!0;if(typeof e.isOptionSelected=="function")return e.isOptionSelected(t,r);var i=Ui(e,t);return r.some(function(n){return Ui(e,n)===i})}function tp(e,t,r){return e.filterOption?e.filterOption(t,r):!0}var np=function(t){var r=t.hideSelectedOptions,i=t.isMulti;return r===void 0?i:r},Fw=1,rp=(function(e){k$(r,e);var t=T$(r);function r(i){var n;if(S$(this,r),n=t.call(this,i),n.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:"",isAppleDevice:!1},n.blockOptionHover=!1,n.isComposing=!1,n.commonProps=void 0,n.initialTouchX=0,n.initialTouchY=0,n.openAfterFocus=!1,n.scrollToFocusedOptionOnUpdate=!1,n.userIsDragging=void 0,n.controlRef=null,n.getControlRef=function(u){n.controlRef=u},n.focusedOptionRef=null,n.getFocusedOptionRef=function(u){n.focusedOptionRef=u},n.menuListRef=null,n.getMenuListRef=function(u){n.menuListRef=u},n.inputRef=null,n.getInputRef=function(u){n.inputRef=u},n.focus=n.focusInput,n.blur=n.blurInput,n.onChange=function(u,l){var c=n.props,d=c.onChange;l.name=c.name,n.ariaOnChange(u,l),d(u,l)},n.setValue=function(u,l,c){var d=n.props,m=d.closeMenuOnSelect,h=d.isMulti,v=d.inputValue;n.onInputChange("",{action:"set-value",prevInputValue:v}),m&&(n.setState({inputIsHiddenAfterUpdate:!h}),n.onMenuClose()),n.setState({clearFocusValueOnUpdate:!0}),n.onChange(u,{action:l,option:c})},n.selectOption=function(u){var l=n.props,c=l.blurInputOnSelect,d=l.isMulti,m=l.name,h=n.state.selectValue,v=d&&n.isOptionSelected(u,h),f=n.isOptionDisabled(u,h);if(v){var g=n.getOptionValue(u);n.setValue(h.filter(function(y){return n.getOptionValue(y)!==g}),"deselect-option",u)}else if(!f)d?n.setValue([].concat(Ls(h),[u]),"select-option",u):n.setValue(u,"select-option");else{n.ariaOnChange(u,{action:"select-option",option:u,name:m});return}c&&n.blurInput()},n.removeValue=function(u){var l=n.props.isMulti,c=n.state.selectValue,d=n.getOptionValue(u),m=c.filter(function(v){return n.getOptionValue(v)!==d}),h=si(l,m,m[0]||null);n.onChange(h,{action:"remove-value",removedValue:u}),n.focusInput()},n.clearValue=function(){var u=n.state.selectValue;n.onChange(si(n.props.isMulti,[],null),{action:"clear",removedValues:u})},n.popValue=function(){var u=n.props.isMulti,l=n.state.selectValue,c=l[l.length-1],d=l.slice(0,l.length-1),m=si(u,d,d[0]||null);c&&n.onChange(m,{action:"pop-value",removedValue:c})},n.getFocusedOptionId=function(u){return xa(n.state.focusableOptionsWithIds,u)},n.getFocusableOptionsWithIds=function(){return ad(_i(n.props,n.state.selectValue),n.getElementId("option"))},n.getValue=function(){return n.state.selectValue},n.cx=function(){for(var u=arguments.length,l=new Array(u),c=0;ch||m>h}},n.onTouchEnd=function(u){n.userIsDragging||(n.controlRef&&!n.controlRef.contains(u.target)&&n.menuListRef&&!n.menuListRef.contains(u.target)&&n.blurInput(),n.initialTouchX=0,n.initialTouchY=0)},n.onControlTouchEnd=function(u){n.userIsDragging||n.onControlMouseDown(u)},n.onClearIndicatorTouchEnd=function(u){n.userIsDragging||n.onClearIndicatorMouseDown(u)},n.onDropdownIndicatorTouchEnd=function(u){n.userIsDragging||n.onDropdownIndicatorMouseDown(u)},n.handleInputChange=function(u){var l=n.props.inputValue,c=u.currentTarget.value;n.setState({inputIsHiddenAfterUpdate:!1}),n.onInputChange(c,{action:"input-change",prevInputValue:l}),n.props.menuIsOpen||n.onMenuOpen()},n.onInputFocus=function(u){n.props.onFocus&&n.props.onFocus(u),n.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(n.openAfterFocus||n.props.openMenuOnFocus)&&n.openMenu("first"),n.openAfterFocus=!1},n.onInputBlur=function(u){var l=n.props.inputValue;if(n.menuListRef&&n.menuListRef.contains(document.activeElement)){n.inputRef.focus();return}n.props.onBlur&&n.props.onBlur(u),n.onInputChange("",{action:"input-blur",prevInputValue:l}),n.onMenuClose(),n.setState({focusedValue:null,isFocused:!1})},n.onOptionHover=function(u){if(!(n.blockOptionHover||n.state.focusedOption===u)){var l=n.getFocusableOptions().indexOf(u);n.setState({focusedOption:u,focusedOptionId:l>-1?n.getFocusedOptionId(u):null})}},n.shouldHideSelectedOptions=function(){return np(n.props)},n.onValueInputFocus=function(u){u.preventDefault(),u.stopPropagation(),n.focus()},n.onKeyDown=function(u){var l=n.props,c=l.isMulti,d=l.backspaceRemovesValue,m=l.escapeClearsValue,h=l.inputValue,v=l.isClearable,f=l.isDisabled,g=l.menuIsOpen,y=l.onKeyDown,x=l.tabSelectsValue,j=l.openMenuOnFocus,S=n.state,w=S.focusedOption,$=S.focusedValue,O=S.selectValue;if(!f&&!(typeof y=="function"&&(y(u),u.defaultPrevented))){switch(n.blockOptionHover=!0,u.key){case"ArrowLeft":if(!c||h)return;n.focusValue("previous");break;case"ArrowRight":if(!c||h)return;n.focusValue("next");break;case"Delete":case"Backspace":if(h)return;if($)n.removeValue($);else{if(!d)return;c?n.popValue():v&&n.clearValue()}break;case"Tab":if(n.isComposing||u.shiftKey||!g||!x||!w||j&&n.isOptionSelected(w,O))return;n.selectOption(w);break;case"Enter":if(u.keyCode===229)break;if(g){if(!w||n.isComposing)return;n.selectOption(w);break}return;case"Escape":g?(n.setState({inputIsHiddenAfterUpdate:!1}),n.onInputChange("",{action:"menu-close",prevInputValue:h}),n.onMenuClose()):v&&m&&n.clearValue();break;case" ":if(h)return;if(!g){n.openMenu("first");break}if(!w)return;n.selectOption(w);break;case"ArrowUp":g?n.focusOption("up"):n.openMenu("last");break;case"ArrowDown":g?n.focusOption("down"):n.openMenu("first");break;case"PageUp":if(!g)return;n.focusOption("pageup");break;case"PageDown":if(!g)return;n.focusOption("pagedown");break;case"Home":if(!g)return;n.focusOption("first");break;case"End":if(!g)return;n.focusOption("last");break;default:return}u.preventDefault()}},n.state.instancePrefix="react-select-"+(n.props.instanceId||++Fw),n.state.selectValue=Bc(i.value),i.menuIsOpen&&n.state.selectValue.length){var o=n.getFocusableOptionsWithIds(),a=n.buildFocusableOptions(),s=a.indexOf(n.state.selectValue[0]);n.state.focusableOptionsWithIds=o,n.state.focusedOption=a[s],n.state.focusedOptionId=xa(o,a[s])}return n}return w$(r,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&Wc(this.menuListRef,this.focusedOptionRef),Pw()&&this.setState({isAppleDevice:!0})}},{key:"componentDidUpdate",value:function(n){var o=this.props,a=o.isDisabled,s=o.menuIsOpen,u=this.state.isFocused;(u&&!a&&n.isDisabled||u&&s&&!n.menuIsOpen)&&this.focusInput(),u&&a&&!n.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!u&&!a&&n.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(Wc(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(n,o){this.props.onInputChange(n,o)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(n){var o=this,a=this.state,s=a.selectValue,u=a.isFocused,l=this.buildFocusableOptions(),c=n==="first"?0:l.length-1;if(!this.props.isMulti){var d=l.indexOf(s[0]);d>-1&&(c=d)}this.scrollToFocusedOptionOnUpdate=!(u&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:l[c],focusedOptionId:this.getFocusedOptionId(l[c])},function(){return o.onMenuOpen()})}},{key:"focusValue",value:function(n){var o=this.state,a=o.selectValue,s=o.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var u=a.indexOf(s);s||(u=-1);var l=a.length-1,c=-1;if(a.length){switch(n){case"previous":u===0?c=0:u===-1?c=l:c=u-1;break;case"next":u>-1&&u0&&arguments[0]!==void 0?arguments[0]:"first",o=this.props.pageSize,a=this.state.focusedOption,s=this.getFocusableOptions();if(s.length){var u=0,l=s.indexOf(a);a||(l=-1),n==="up"?u=l>0?l-1:s.length-1:n==="down"?u=(l+1)%s.length:n==="pageup"?(u=l-o,u<0&&(u=0)):n==="pagedown"?(u=l+o,u>s.length-1&&(u=s.length-1)):n==="last"&&(u=s.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:s[u],focusedValue:null,focusedOptionId:this.getFocusedOptionId(s[u])})}}},{key:"getTheme",value:function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme($a):X(X({},$a),this.props.theme):$a}},{key:"getCommonProps",value:function(){var n=this.clearValue,o=this.cx,a=this.getStyles,s=this.getClassNames,u=this.getValue,l=this.selectOption,c=this.setValue,d=this.props,m=d.isMulti,h=d.isRtl,v=d.options;return{clearValue:n,cx:o,getStyles:a,getClassNames:s,getValue:u,hasValue:this.hasValue(),isMulti:m,isRtl:h,options:v,selectOption:l,selectProps:d,setValue:c,theme:this.getTheme()}}},{key:"hasValue",value:function(){return this.state.selectValue.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var n=this.props,o=n.isClearable,a=n.isMulti;return o===void 0?a:o}},{key:"isOptionDisabled",value:function(n,o){return Qm(this.props,n,o)}},{key:"isOptionSelected",value:function(n,o){return ep(this.props,n,o)}},{key:"filterOption",value:function(n,o){return tp(this.props,n,o)}},{key:"formatOptionLabel",value:function(n,o){if(typeof this.props.formatOptionLabel=="function"){var a=this.props.inputValue,s=this.state.selectValue;return this.props.formatOptionLabel(n,{context:o,inputValue:a,selectValue:s})}else return this.getOptionLabel(n)}},{key:"formatGroupLabel",value:function(n){return this.props.formatGroupLabel(n)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var n=this.props,o=n.isDisabled,a=n.isSearchable,s=n.inputId,u=n.inputValue,l=n.tabIndex,c=n.form,d=n.menuIsOpen,m=n.required,h=this.getComponents().Input,v=this.state,f=v.inputIsHidden,g=v.ariaSelection,y=this.commonProps,x=s||this.getElementId("input"),j=X(X(X({"aria-autocomplete":"list","aria-expanded":d,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":m,role:"combobox","aria-activedescendant":this.state.isAppleDevice?void 0:this.state.focusedOptionId||""},d&&{"aria-controls":this.getElementId("listbox")}),!a&&{"aria-readonly":!0}),this.hasValue()?g?.action==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return a?_.createElement(h,te({},y,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:x,innerRef:this.getInputRef,isDisabled:o,isHidden:f,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:l,form:c,type:"text",value:u},j)):_.createElement(gw,te({id:x,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:Ni,onFocus:this.onInputFocus,disabled:o,tabIndex:l,inputMode:"none",form:c,value:""},j))}},{key:"renderPlaceholderOrValue",value:function(){var n=this,o=this.getComponents(),a=o.MultiValue,s=o.MultiValueContainer,u=o.MultiValueLabel,l=o.MultiValueRemove,c=o.SingleValue,d=o.Placeholder,m=this.commonProps,h=this.props,v=h.controlShouldRenderValue,f=h.isDisabled,g=h.isMulti,y=h.inputValue,x=h.placeholder,j=this.state,S=j.selectValue,w=j.focusedValue,$=j.isFocused;if(!this.hasValue()||!v)return y?null:_.createElement(d,te({},m,{key:"placeholder",isDisabled:f,isFocused:$,innerProps:{id:this.getElementId("placeholder")}}),x);if(g)return S.map(function(z,L){var U=z===w,oe="".concat(n.getOptionLabel(z),"-").concat(n.getOptionValue(z));return _.createElement(a,te({},m,{components:{Container:s,Label:u,Remove:l},isFocused:U,isDisabled:f,key:oe,index:L,removeProps:{onClick:function(){return n.removeValue(z)},onTouchEnd:function(){return n.removeValue(z)},onMouseDown:function(q){q.preventDefault()}},data:z}),n.formatOptionLabel(z,"value"))});if(y)return null;var O=S[0];return _.createElement(c,te({},m,{data:O,isDisabled:f}),this.formatOptionLabel(O,"value"))}},{key:"renderClearIndicator",value:function(){var n=this.getComponents().ClearIndicator,o=this.commonProps,a=this.props,s=a.isDisabled,u=a.isLoading,l=this.state.isFocused;if(!this.isClearable()||!n||s||!this.hasValue()||u)return null;var c={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return _.createElement(n,te({},o,{innerProps:c,isFocused:l}))}},{key:"renderLoadingIndicator",value:function(){var n=this.getComponents().LoadingIndicator,o=this.commonProps,a=this.props,s=a.isDisabled,u=a.isLoading,l=this.state.isFocused;return!n||!u?null:_.createElement(n,te({},o,{innerProps:{"aria-hidden":"true"},isDisabled:s,isFocused:l}))}},{key:"renderIndicatorSeparator",value:function(){var n=this.getComponents(),o=n.DropdownIndicator,a=n.IndicatorSeparator;if(!o||!a)return null;var s=this.commonProps,u=this.props.isDisabled,l=this.state.isFocused;return _.createElement(a,te({},s,{isDisabled:u,isFocused:l}))}},{key:"renderDropdownIndicator",value:function(){var n=this.getComponents().DropdownIndicator;if(!n)return null;var o=this.commonProps,a=this.props.isDisabled,s=this.state.isFocused,u={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return _.createElement(n,te({},o,{innerProps:u,isDisabled:a,isFocused:s}))}},{key:"renderMenu",value:function(){var n=this,o=this.getComponents(),a=o.Group,s=o.GroupHeading,u=o.Menu,l=o.MenuList,c=o.MenuPortal,d=o.LoadingMessage,m=o.NoOptionsMessage,h=o.Option,v=this.commonProps,f=this.state.focusedOption,g=this.props,y=g.captureMenuScroll,x=g.inputValue,j=g.isLoading,S=g.loadingMessage,w=g.minMenuHeight,$=g.maxMenuHeight,O=g.menuIsOpen,z=g.menuPlacement,L=g.menuPosition,U=g.menuPortalTarget,oe=g.menuShouldBlockScroll,B=g.menuShouldScrollIntoView,q=g.noOptionsMessage,ae=g.onMenuScrollToTop,G=g.onMenuScrollToBottom;if(!O)return null;var Q=function(De,ft){var nt=De.type,Ke=De.data,Xe=De.isDisabled,zt=De.isSelected,Et=De.label,ca=De.value,Wn=f===Ke,ni=Xe?void 0:function(){return n.onOptionHover(Ke)},Hn=Xe?void 0:function(){return n.selectOption(Ke)},Jn="".concat(n.getElementId("option"),"-").concat(ft),Gn={id:Jn,onClick:Hn,onMouseMove:ni,onMouseOver:ni,tabIndex:-1,role:"option","aria-selected":n.state.isAppleDevice?void 0:zt};return _.createElement(h,te({},v,{innerProps:Gn,data:Ke,isDisabled:Xe,isSelected:zt,key:Jn,label:Et,type:nt,value:ca,isFocused:Wn,innerRef:Wn?n.getFocusedOptionRef:void 0}),n.formatOptionLabel(De.data,"menu"))},re;if(this.hasOptions())re=this.getCategorizedOptions().map(function(ke){if(ke.type==="group"){var De=ke.data,ft=ke.options,nt=ke.index,Ke="".concat(n.getElementId("group"),"-").concat(nt),Xe="".concat(Ke,"-heading");return _.createElement(a,te({},v,{key:Ke,data:De,options:ft,Heading:s,headingProps:{id:Xe,data:ke.data},label:n.formatGroupLabel(ke.data)}),ke.options.map(function(zt){return Q(zt,"".concat(nt,"-").concat(zt.index))}))}else if(ke.type==="option")return Q(ke,"".concat(ke.index))});else if(j){var P=S({inputValue:x});if(P===null)return null;re=_.createElement(d,v,P)}else{var ee=q({inputValue:x});if(ee===null)return null;re=_.createElement(m,v,ee)}var N={minMenuHeight:w,maxMenuHeight:$,menuPlacement:z,menuPosition:L,menuShouldScrollIntoView:B},ce=_.createElement(oS,te({},v,N),function(ke){var De=ke.ref,ft=ke.placerProps,nt=ft.placement,Ke=ft.maxHeight;return _.createElement(u,te({},v,N,{innerRef:De,innerProps:{onMouseDown:n.onMenuMouseDown,onMouseMove:n.onMenuMouseMove},isLoading:j,placement:nt}),_.createElement(Sw,{captureEnabled:y,onTopArrive:ae,onBottomArrive:G,lockEnabled:oe},function(Xe){return _.createElement(l,te({},v,{innerRef:function(Et){n.getMenuListRef(Et),Xe(Et)},innerProps:{role:"listbox","aria-multiselectable":v.isMulti,id:n.getElementId("listbox")},isLoading:j,maxHeight:Ke,focusedOption:f}),re)}))});return U||L==="fixed"?_.createElement(c,te({},v,{appendTo:U,controlElement:this.controlRef,menuPlacement:z,menuPosition:L}),ce):ce}},{key:"renderFormField",value:function(){var n=this,o=this.props,a=o.delimiter,s=o.isDisabled,u=o.isMulti,l=o.name,c=o.required,d=this.state.selectValue;if(c&&!this.hasValue()&&!s)return _.createElement(kw,{name:l,onFocus:this.onValueInputFocus});if(!(!l||s))if(u)if(a){var m=d.map(function(f){return n.getOptionValue(f)}).join(a);return _.createElement("input",{name:l,type:"hidden",value:m})}else{var h=d.length>0?d.map(function(f,g){return _.createElement("input",{key:"i-".concat(g),name:l,type:"hidden",value:n.getOptionValue(f)})}):_.createElement("input",{name:l,type:"hidden",value:""});return _.createElement("div",null,h)}else{var v=d[0]?this.getOptionValue(d[0]):"";return _.createElement("input",{name:l,type:"hidden",value:v})}}},{key:"renderLiveRegion",value:function(){var n=this.commonProps,o=this.state,a=o.ariaSelection,s=o.focusedOption,u=o.focusedValue,l=o.isFocused,c=o.selectValue,d=this.getFocusableOptions();return _.createElement(dw,te({},n,{id:this.getElementId("live-region"),ariaSelection:a,focusedOption:s,focusedValue:u,isFocused:l,selectValue:c,focusableOptions:d,isAppleDevice:this.state.isAppleDevice}))}},{key:"render",value:function(){var n=this.getComponents(),o=n.Control,a=n.IndicatorsContainer,s=n.SelectContainer,u=n.ValueContainer,l=this.props,c=l.className,d=l.id,m=l.isDisabled,h=l.menuIsOpen,v=this.state.isFocused,f=this.commonProps=this.getCommonProps();return _.createElement(s,te({},f,{className:c,innerProps:{id:d,onKeyDown:this.onKeyDown},isDisabled:m,isFocused:v}),this.renderLiveRegion(),_.createElement(o,te({},f,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:m,isFocused:v,menuIsOpen:h}),_.createElement(u,te({},f,{isDisabled:m}),this.renderPlaceholderOrValue(),this.renderInput()),_.createElement(a,te({},f,{isDisabled:m}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(n,o){var a=o.prevProps,s=o.clearFocusValueOnUpdate,u=o.inputIsHiddenAfterUpdate,l=o.ariaSelection,c=o.isFocused,d=o.prevWasFocused,m=o.instancePrefix,h=n.options,v=n.value,f=n.menuIsOpen,g=n.inputValue,y=n.isMulti,x=Bc(v),j={};if(a&&(v!==a.value||h!==a.options||f!==a.menuIsOpen||g!==a.inputValue)){var S=f?Uw(n,x):[],w=f?ad(_i(n,x),"".concat(m,"-option")):[],$=s?Mw(o,x):null,O=Rw(o,S);j={selectValue:x,focusedOption:O,focusedOptionId:xa(w,O),focusableOptionsWithIds:w,focusedValue:$,clearFocusValueOnUpdate:!1}}var z=u!=null&&n!==a?{inputIsHidden:u,inputIsHiddenAfterUpdate:void 0}:{},L=l,U=c&&d;return c&&!U&&(L={value:si(y,x,x[0]||null),options:x,action:"initial-input-focus"},U=!d),l?.action==="initial-input-focus"&&(L=null),X(X(X({},j),z),{},{prevProps:n,ariaSelection:L,prevWasFocused:U})}}]),r})(_.Component);rp.defaultProps=Vw;var Re=(0,_.forwardRef)(function(e,t){var r=x$(e);return _.createElement(rp,te({ref:t},r))}),Sr=e=>e.type==="checkbox",en=e=>e instanceof Date,Ce=e=>e==null,ip=e=>typeof e=="object",Se=e=>!Ce(e)&&!Array.isArray(e)&&ip(e)&&!en(e),Lw=e=>Se(e)&&e.target?Sr(e.target)?e.target.checked:e.target.value:e,Zw=(e,t)=>t.split(".").some((r,i,n)=>!isNaN(Number(r))&&e.has(n.slice(0,i).join("."))),Bw=e=>{const t=e.constructor&&e.constructor.prototype;return Se(t)&&t.hasOwnProperty("isPrototypeOf")},co=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function pe(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(co&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Se(e)&&Bw(e)))return e;const i=r?[]:Object.create(Object.getPrototypeOf(e));for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(i[n]=pe(e[n]));return i}var vn={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},it={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ht={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Sa="form",op="root",ap=["__proto__","constructor","prototype"],wr=e=>/^\w*$/.test(e),he=e=>e===void 0,fo=e=>e.split(/[.[\]'"]/g).filter(Boolean),F=(e,t,r)=>{if(!t||!Se(e))return r;const i=wr(t)?[t]:fo(t);if(i.some(o=>ap.includes(o)))return r;const n=i.reduce((o,a)=>Ce(o)?void 0:o[a],e);return he(n)||n===e?he(e[t])?r:e[t]:n},$t=e=>typeof e=="boolean",rt=e=>typeof e=="function",me=(e,t,r)=>{let i=-1;const n=wr(t)?[t]:fo(t),o=n.length,a=o-1;for(;++i_.useContext(sp),Hw=(e,t,r,i=!0)=>{const n={};for(const o in e)Object.defineProperty(n,o,{get:()=>{const a=o;return t._proxyFormState[a]!==it.all&&(t._proxyFormState[a]=!i||it.all),r&&(r[a]=!0),e[a]}});return n},up=co?_.useLayoutEffect:_.useEffect,Fe=e=>typeof e=="string",Jw=(e,t,r,i,n)=>Fe(e)?(i&&t.watch.add(e),F(r,e,n)):Array.isArray(e)?e.map(o=>(i&&t.watch.add(o),F(r,o))):(i&&(t.watchAll=!0),r),rs=e=>Ce(e)||!ip(e);function xt(e,t,r=new WeakSet){if(e===t)return!0;if(rs(e)||rs(t))return Object.is(e,t);if(en(e)&&en(t))return Object.is(e.getTime(),t.getTime());const i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const o of i){const a=e[o];if(!(o in t))return!1;if(o!=="ref"){const s=t[o];if(en(a)&&en(s)||(Se(a)||Array.isArray(a))&&(Se(s)||Array.isArray(s))?!xt(a,s,r):!Object.is(a,s))return!1}}return!0}var Gw=_.createContext(null);Gw.displayName="HookFormContext";var Qs=(e,t,r,i,n)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[i]:n||!0}}:{},eu=e=>Array.isArray(e)?e.filter(Boolean):[],qe=e=>Array.isArray(e)?e:[e],ud=()=>{let e=[];return{get observers(){return e},next:n=>{for(const o of e)o.next&&o.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(o=>o!==n)}}),unsubscribe:()=>{e=[]}}};function lp(e,t){const r={};for(const i in e)if(e.hasOwnProperty(i)){const n=e[i],o=t[i];if(n&&Se(n)&&o){const a=lp(n,o);Se(a)&&(r[i]=a)}else e[i]&&(r[i]=o)}return r}var Oe=e=>Se(e)&&!Object.keys(e).length,tu=e=>e.type==="file",Mi=e=>{if(!co)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},cp=e=>e.type==="select-multiple",nu=e=>e.type==="radio",Kw=e=>nu(e)||Sr(e),wa=e=>Mi(e)&&e.isConnected;function Xw(e,t){const r=t.slice(0,-1).length;let i=0;for(;i{for(const t in e)if(rt(e[t]))return!0;return!1};function dp(e){return Array.isArray(e)||Se(e)&&!Yw(e)}function is(e,t={}){for(const r in e){const i=e[r];dp(i)?(t[r]=Array.isArray(i)?[]:{},is(i,t[r])):he(i)||(t[r]=!0)}return t}function os(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>os(r));return t.some(r=>r!==void 0)?t:void 0}if(Se(e)){const t={};for(const r in e){const i=os(e[r]);he(i)||(t[r]=i)}return Object.keys(t).length?t:void 0}}}function qt(e,t,r){r||(r=is(t));for(const i in e){const n=e[i];if(dp(n))he(t)||rs(r[i])?r[i]=is(n,Array.isArray(n)?[]:{}):qt(n,Ce(t)?{}:t[i],r[i]);else{const o=t[i];r[i]=!xt(n,o)}}return os(r)||{}}var ld={value:!1,isValid:!1},cd={value:!0,isValid:!0},fp=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!he(e[0].attributes.value)?he(e[0].value)||e[0].value===""?cd:{value:e[0].value,isValid:!0}:cd:ld}return ld},mp=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:i})=>he(e)?e:t?e===""?NaN:e&&+e:r&&Fe(e)?new Date(e):i?i(e):e,dd={isValid:!1,value:null},pp=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,dd):dd;function fd(e){const t=e.ref;return tu(t)?t.files:nu(t)?pp(e.refs).value:cp(t)?[...t.selectedOptions].map(({value:r})=>r):Sr(t)?fp(e.refs).value:mp(he(t.value)?e.ref.value:t.value,e)}var Qw=(e,t,r,i)=>{const n={};for(const o of e){const a=F(t,o);a&&me(n,o,a._f)}return{criteriaMode:r,names:[...e],fields:n,shouldUseNativeValidation:i}},Ri=e=>e instanceof RegExp,qn=e=>he(e)?e:Ri(e)?e.source:Se(e)?Ri(e.value)?e.value.source:e.value:e,_n=e=>({isOnSubmit:!e||e===it.onSubmit,isOnBlur:e===it.onBlur,isOnChange:e===it.onChange,isOnAll:e===it.all,isOnTouch:e===it.onTouched}),md="AsyncFunction",ek=e=>!!e&&!!e.validate&&!!(rt(e.validate)&&e.validate.constructor.name===md||Se(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===md)),tk=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),as=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(i=>e.startsWith(`${i}.`))),kn=(e,t,r,i)=>{for(const n of r||Object.keys(e)){const o=F(e,n);if(o){const{_f:a,...s}=o;if(a){if(a.refs&&a.refs[0]&&t(a.refs[0],n)&&!i)return!0;if(a.ref&&t(a.ref,a.name)&&!i)return!0;if(kn(s,t))break}else if(Se(s)&&kn(s,t))break}}};function pd(e,t,r){const i=F(e,r);if(i||wr(r))return{error:i,name:r};const n=r.split(".");for(;n.length;){const o=n.join("."),a=F(t,o),s=F(e,o);if(a&&!Array.isArray(a)&&r!==o)return{name:r};if(s&&s.type)return{name:o,error:s};if(s&&s.root&&s.root.type)return{name:`${o}.root`,error:s.root};n.pop()}return{name:r}}var nk=(e,t,r,i)=>{r(e);const{name:n,...o}=e;return Oe(o)||i&&Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(a=>t[a]===(!i||it.all))},rk=(e,t,r)=>!e||!t||e===t||qe(e).some(i=>i&&(r?i===t:i.startsWith(t)||t.startsWith(i))),ik=(e,t,r,i,n)=>n.isOnAll?!1:!r&&n.isOnTouch?!(t||e):(r?i.isOnBlur:n.isOnBlur)?!e:(r?i.isOnChange:n.isOnChange)?e:!0,ok=(e,t)=>!eu(F(e,t)).length&&Ie(e,t),ss=(e,t,r)=>{const i=F(e,r),n=Array.isArray(i)?i:[];return me(n,op,t[r]),me(e,r,n),e};function hd(e,t,r="validate"){if(Fe(e)||Array.isArray(e)&&e.every(Fe)||$t(e)&&!e)return{type:r,message:Fe(e)?e:"",ref:t}}var gn=e=>Se(e)&&!Ri(e)?e:{value:e,message:""},us=async(e,t,r,i,n,o)=>{const{ref:a,refs:s,required:u,maxLength:l,minLength:c,min:d,max:m,pattern:h,validate:v,name:f,valueAsNumber:g,mount:y}=e._f,x=F(r,f);if(!y||t.has(f))return{};const j=s?s[0]:a,S=B=>{n&&j.reportValidity&&(j.setCustomValidity($t(B)?"":B||""),j.reportValidity())},w={},$=nu(a),O=Sr(a),z=$||O,L=(g||tu(a))&&he(a.value)&&he(x)||Mi(a)&&a.value===""||x===""||Array.isArray(x)&&!x.length,U=Qs.bind(null,f,i,w),oe=(B,q,ae,G=ht.maxLength,Q=ht.minLength)=>{const re=B?q:ae;w[f]={type:B?G:Q,message:re,ref:a,...U(B?G:Q,re)}};if(o?!Array.isArray(x)||!x.length:u&&(!z&&(L||Ce(x))||$t(x)&&!x||O&&!fp(s).isValid||$&&!pp(s).isValid)){const{value:B,message:q}=Fe(u)?{value:!!u,message:u}:gn(u);if(B&&(w[f]={type:ht.required,message:q,ref:j,...U(ht.required,q)},!i))return S(q),w}if(!L&&(!Ce(d)||!Ce(m))){let B,q;const ae=gn(m),G=gn(d);if(!Ce(x)&&!isNaN(x)){const Q=a.valueAsNumber||x&&+x;Ce(ae.value)||(B=Q>ae.value),Ce(G.value)||(q=Qnew Date(new Date().toDateString()+" "+N),P=a.type=="time",ee=a.type=="week";Fe(ae.value)&&x&&(B=P?re(x)>re(ae.value):ee?x>ae.value:Q>new Date(ae.value)),Fe(G.value)&&x&&(q=P?re(x)+B.value,G=!Ce(q.value)&&x.length<+q.value;if((ae||G)&&(oe(ae,B.message,q.message),!i))return S(w[f].message),w}if(h&&!L&&Fe(x)){const{value:B,message:q}=gn(h);if(Ri(B)&&!x.match(B)&&(w[f]={type:ht.pattern,message:q,ref:a,...U(ht.pattern,q)},!i))return S(q),w}if(v){if(rt(v)){const B=hd(await v(x,r),j);if(B&&(w[f]={...B,...U(ht.validate,B.message)},!i))return S(B.message),w}else if(Se(v)){let B={};for(const q in v){if(!Oe(B)&&!i)break;const ae=hd(await v[q](x,r),j,q);ae&&(B={...ae,...U(q,ae.message)},S(ae.message),i&&(w[f]=B))}if(!Oe(B)&&(w[f]={ref:j,...B},!i))return w}}return S(!0),w},ak={mode:it.onSubmit,reValidateMode:it.onChange,shouldFocusError:!0},hp={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function sk(e={}){let t={...ak,...e},r={...pe(hp),isLoading:rt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},i={},n=Se(t.defaultValues)||Se(t.values)?pe(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:pe(n),a={action:!1,mount:!1,watch:!1,keepIsValid:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},u,l=0;const c={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...c};let m={...d};const h={array:ud(),state:ud()},v=t.criteriaMode===it.all,f=b=>I=>{clearTimeout(l),l=setTimeout(b,I)},g=async b=>{if(!a.keepIsValid&&!t.disabled&&(d.isValid||m.isValid||b)){let I;t.resolver?(I=Oe((await U()).errors),y()):I=await q({fields:i,onlyCheckValid:!0,eventType:vn.VALID}),I!==r.isValid&&h.state.next({isValid:I})}},y=(b,I)=>{!t.disabled&&(d.isValidating||d.validatingFields||m.isValidating||m.validatingFields)&&((b||Array.from(s.mount)).forEach(T=>{T&&(I?me(r.validatingFields,T,I):Ie(r.validatingFields,T))}),h.state.next({validatingFields:r.validatingFields,isValidating:!Oe(r.validatingFields)}))},x=()=>{r.dirtyFields=qt(n,o)},j=(b,I=[],T,A,M=!0,Z=!0)=>{if(A&&T&&!t.disabled){if(a.action=!0,Z&&Array.isArray(F(i,b))){const V=T(F(i,b),A.argA,A.argB);M&&me(i,b,V)}if(Z&&Array.isArray(F(r.errors,b))){const V=T(F(r.errors,b),A.argA,A.argB);M&&me(r.errors,b,V),ok(r.errors,b)}if((d.touchedFields||m.touchedFields)&&Z&&Array.isArray(F(r.touchedFields,b))){const V=T(F(r.touchedFields,b),A.argA,A.argB);M&&me(r.touchedFields,b,V)}(d.dirtyFields||m.dirtyFields)&&x(),h.state.next({name:b,isDirty:G(b,I),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else me(o,b,I)},S=(b,I)=>{me(r.errors,b,I),h.state.next({errors:r.errors})},w=b=>{r.errors=b,h.state.next({errors:r.errors,isValid:!1})},$=b=>{const I=wr(b)?[b]:fo(b);let T=o,A=n;for(let M=0;M{const M=F(i,b);if(M){if($(b))return;const Z=he(F(o,b)),V=F(o,b,he(T)?F(n,b):T);he(V)||A&&A.defaultChecked||I?me(o,b,I?V:fd(M._f)):P(b,V),a.mount&&!a.action&&(g(),Z&&r.isDirty&&(d.isDirty||m.isDirty)&&(G()||(r.isDirty=!1,h.state.next({...r}))))}},z=(b,I,T,A,M)=>{let Z=!1,V=!1;const H={name:b};if(!t.disabled){if(!T||A){(d.isDirty||m.isDirty)&&(V=r.isDirty,r.isDirty=H.isDirty=G(),Z=V!==H.isDirty);const ue=xt(F(n,b),I);V=!!F(r.dirtyFields,b),ue!==r.isDirty?r.dirtyFields=qt(n,o):ue?Ie(r.dirtyFields,b):me(r.dirtyFields,b,!0),H.dirtyFields=r.dirtyFields,Z=Z||(d.dirtyFields||m.dirtyFields)&&V!==!ue}if(T){const ue=F(r.touchedFields,b);ue||(me(r.touchedFields,b,T),H.touchedFields=r.touchedFields,Z=Z||(d.touchedFields||m.touchedFields)&&ue!==T)}Z&&M&&h.state.next(H)}return Z?H:{}},L=(b,I,T,A)=>{const M=F(r.errors,b),Z=(d.isValid||m.isValid)&&$t(I)&&r.isValid!==I;if(t.delayError&&T?(u=f(()=>S(b,T)),u(t.delayError)):(clearTimeout(l),u=null,T?me(r.errors,b,T):Ie(r.errors,b)),(T?!xt(M,T):M)||!Oe(A)||Z){const V={...A,...Z&&$t(I)?{isValid:I}:{},errors:r.errors,name:b};r={...r,...V},h.state.next(V)}},U=async b=>(y(b,!0),await t.resolver(o,t.context,Qw(b||s.mount,i,t.criteriaMode,t.shouldUseNativeValidation))),oe=async b=>{const{errors:I}=await U(b);if(y(b),b)for(const T of b){const A=F(I,T);A?s.array.has(T)&&Se(A)&&!Object.keys(A).some(M=>!Number.isNaN(Number(M)))?ss(r.errors,{[T]:A},T):me(r.errors,T,A):Ie(r.errors,T)}else r.errors=I;return I},B=async({name:b,eventType:I})=>{if(e.validate){const T=await e.validate({formValues:o,formState:r,name:b,eventType:I});if(Se(T))for(const A in T){const M=T[A];M&&Et(`${Sa}.${A}`,{message:Fe(M.message)?M.message:"",type:M.type||ht.validate})}else Fe(T)||!T?Et(Sa,{message:T||"",type:ht.validate}):zt(Sa);return T}return!0},q=async({fields:b,onlyCheckValid:I,name:T,eventType:A,context:M={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(M.runRootValidation=!0,!await B({name:T,eventType:A})&&(M.valid=!1,I)))return M.valid;for(const Z in b){const V=b[Z];if(V){const{_f:H,...ue}=V;if(H){const ze=s.array.has(H.name),yt=V._f&&ek(V._f),mt=d.validatingFields||d.isValidating||m.validatingFields||m.isValidating;yt&&mt&&y([H.name],!0);const Gt=await us(V,s.disabled,o,v,t.shouldUseNativeValidation&&!I,ze);if(yt&&mt&&y([H.name]),Gt[H.name]&&(M.valid=!1,I)||(!I&&(F(Gt,H.name)?ze?ss(r.errors,Gt,H.name):me(r.errors,H.name,Gt[H.name]):Ie(r.errors,H.name)),e.shouldUseNativeValidation&&Gt[H.name]))break}!Oe(ue)&&await q({context:M,onlyCheckValid:I,fields:ue,name:Z,eventType:A})}}return M.valid},ae=()=>{for(const b of s.unMount){const I=F(i,b);I&&(I._f.refs?I._f.refs.every(T=>!wa(T)):!wa(I._f.ref))&&Hn(b)}s.unMount=new Set},G=(b,I)=>!t.disabled&&(b&&I&&me(o,b,I),!xt(Ke(),n)),Q=(b,I,T)=>Jw(b,s,{...a.mount?o:he(I)?n:Fe(b)?{[b]:I}:I},T,I),re=b=>eu(F(a.mount?o:n,b,t.shouldUnregister?F(n,b,[]):[])),P=(b,I,T={},A=!1)=>{const M=F(i,b);let Z=I;if(M){const V=M._f;V&&(!V.disabled&&me(o,b,mp(I,V)),Z=Mi(V.ref)&&Ce(I)?"":I,cp(V.ref)?[...V.ref.options].forEach(H=>H.selected=Z.includes(H.value)):V.refs?Sr(V.ref)?V.refs.forEach(H=>{(!H.defaultChecked||!H.disabled)&&(Array.isArray(Z)?H.checked=!!Z.find(ue=>ue===H.value):H.checked=Z===H.value||!!Z)}):V.refs.forEach(H=>H.checked=H.value===Z):tu(V.ref)?V.ref.value="":(V.ref.value=Z,V.ref.type||h.state.next({name:b,values:A?o:pe(o)})))}(T.shouldDirty||T.shouldTouch)&&z(b,Z,T.shouldTouch,T.shouldDirty,!0),T.shouldValidate&&nt(b)},ee=(b,I,T,A=!1)=>{for(const M in I){if(!I.hasOwnProperty(M))return;const Z=I[M],V=b+"."+M,H=F(i,V);(s.array.has(b)||Se(Z)||H&&!H._f)&&!en(Z)?ee(V,Z,T,A):P(V,Z,T,A)}},N=(b,I,T,A)=>{const M=F(i,b),Z=s.array.has(b),V=A?I:pe(I),H=xt(F(o,b),V);if(H||me(o,b,V),Z)h.array.next({name:b,values:A?o:pe(o)}),(d.isDirty||d.dirtyFields||m.isDirty||m.dirtyFields)&&T.shouldDirty&&(x(),h.state.next({name:b,dirtyFields:r.dirtyFields,isDirty:G(b,V)}));else{const ue=Array.isArray(V)&&!V.length||Oe(V);!M||M._f||Ce(V)||ue?P(b,V,T,A):ee(b,V,T,A)}if(!H){const ue=as(b,s),ze=A?o:pe(o);h.state.next({...ue&&r,name:a.mount||ue?b:void 0,values:ze})}},ce=(b,I,T={})=>N(b,I,T,!1),ke=(b,I={})=>{const T=rt(b)?b(o):b;if(!xt(o,T)){o={...o,...T};for(const A of s.mount)N(A,F(T,A),I,!0);h.state.next({...r,name:void 0,type:void 0,values:o}),I.shouldValidate&&g()}},De=async b=>{a.mount=!0;const I=b.target;let T=I.name,A=!0;const M=F(i,T),Z=ue=>{A=Number.isNaN(ue)||en(ue)&&isNaN(ue.getTime())||xt(ue,F(o,T,ue))},V=_n(t.mode),H=_n(t.reValidateMode);if(M){let ue,ze;const yt=I.type?fd(M._f):Lw(b),mt=b.type===vn.BLUR||b.type===vn.FOCUS_OUT,Gt=!tk(M._f)&&!e.validate&&!t.resolver&&!F(r.errors,T)&&!M._f.deps||ik(mt,F(r.touchedFields,T),r.isSubmitted,H,V),fa=as(T,s,mt);me(o,T,yt),mt?(!I||!I.readOnly)&&(M._f.onBlur&&M._f.onBlur(b),u&&u(0)):M._f.onChange&&M._f.onChange(b);const ma=z(T,yt,mt),n$=!Oe(ma)||fa;if(!mt&&h.state.next({name:T,type:b.type,values:pe(o)}),Gt)return(d.isValid||m.isValid)&&(t.mode==="onBlur"?mt&&g():mt||g()),n$&&h.state.next({name:T,...fa?{}:ma});if(!t.resolver&&e.validate&&await B({name:T,eventType:b.type}),!mt&&fa&&h.state.next({...r}),t.resolver){const{errors:Oc}=await U([T]);if(y([T]),Z(yt),A){const r$=pd(r.errors,i,T),Dc=pd(Oc,i,r$.name||T);ue=Dc.error,T=Dc.name,ze=Oe(Oc)}}else y([T],!0),ue=(await us(M,s.disabled,o,v,t.shouldUseNativeValidation))[T],y([T]),Z(yt),A&&(ue?ze=!1:(d.isValid||m.isValid)&&(ze=await q({fields:i,onlyCheckValid:!0,name:T,eventType:b.type})));A&&(M._f.deps&&(!Array.isArray(M._f.deps)||M._f.deps.length>0)&&nt(M._f.deps),L(T,ze,ue,ma))}},ft=(b,I)=>{if(F(r.errors,I)&&b.focus)return b.focus(),1},nt=async(b,I={})=>{let T,A;const M=qe(b);if(t.resolver){const Z=await oe(he(b)?b:M);T=Oe(Z),A=b?!M.some(V=>F(Z,V)):T}else b?(A=(await Promise.all(M.map(async Z=>{const V=F(i,Z);return await q({fields:V&&V._f?{[Z]:V}:V,eventType:vn.TRIGGER})}))).every(Boolean),!(!A&&!r.isValid)&&g()):A=T=await q({fields:i,name:b,eventType:vn.TRIGGER});return h.state.next({...!Fe(b)||(d.isValid||m.isValid)&&T!==r.isValid?{}:{name:b},...t.resolver||!b?{isValid:T}:{},errors:r.errors}),I.shouldFocus&&!A&&kn(i,ft,b?M:s.mount),A},Ke=(b,I)=>{let T={...a.mount?o:n};return I&&(T=lp(I.dirtyFields?r.dirtyFields:r.touchedFields,T)),he(b)?T:Fe(b)?F(T,b):b.map(A=>F(T,A))},Xe=(b,I)=>({invalid:!!F((I||r).errors,b),isDirty:!!F((I||r).dirtyFields,b),error:F((I||r).errors,b),isValidating:!!F(r.validatingFields,b),isTouched:!!F((I||r).touchedFields,b)}),zt=b=>{const I=b?qe(b):void 0;I?.forEach(T=>Ie(r.errors,T)),I?I.forEach(T=>{h.state.next({name:T,errors:r.errors})}):h.state.next({errors:{}})},Et=(b,I,T)=>{const A=(F(i,b,{_f:{}})._f||{}).ref,{ref:M,message:Z,type:V,...H}=F(r.errors,b)||{};me(r.errors,b,{...H,...I,ref:A}),h.state.next({name:b,errors:r.errors,isValid:!1}),T&&T.shouldFocus&&A&&A.focus&&A.focus()},ca=(b,I)=>rt(b)?h.state.subscribe({next:T=>"values"in T&&b(T.values||Q(void 0,I),T)}):Q(b,I,!0),Wn=b=>h.state.subscribe({next:I=>{if(rk(b.name,I.name,b.exact)&&nk(I,b.formState||d,t$,b.reRenderRoot)){const T={...o};b.callback({values:T,...r,...I,defaultValues:n})}}}).unsubscribe,ni=b=>(a.mount=!0,m={...m,...b.formState},Wn({...b,formState:{...c,...b.formState}})),Hn=(b,I={})=>{for(const T of b?qe(b):s.mount)s.mount.delete(T),s.array.delete(T),I.keepValue||(Ie(i,T),Ie(o,T)),!I.keepError&&Ie(r.errors,T),!I.keepDirty&&Ie(r.dirtyFields,T),!I.keepTouched&&Ie(r.touchedFields,T),!I.keepIsValidating&&Ie(r.validatingFields,T),!t.shouldUnregister&&!I.keepDefaultValue&&Ie(n,T);h.state.next({values:pe(o)}),h.state.next({...r,...I.keepDirty?{isDirty:G()}:{}}),!I.keepIsValid&&g()},Jn=({disabled:b,name:I})=>{if($t(b)&&a.mount||b||s.disabled.has(I)){const T=s.disabled.has(I)!==!!b;b?s.disabled.add(I):s.disabled.delete(I),T&&a.mount&&!a.action&&g()}},Gn=(b,I={})=>{let T=F(i,b);const A=$t(I.disabled)||$t(t.disabled),M=!s.registerName.has(b)&&T&&T._f&&!T._f.mount;return me(i,b,{...T||{},_f:{...T&&T._f?T._f:{ref:{name:b}},name:b,mount:!0,...I}}),s.mount.add(b),T&&!M?Jn({disabled:$t(I.disabled)?I.disabled:t.disabled,name:b}):O(b,!0,I.value),{...A?{disabled:I.disabled||t.disabled}:{},...t.progressive?{required:!!I.required,min:qn(I.min),max:qn(I.max),minLength:qn(I.minLength),maxLength:qn(I.maxLength),pattern:qn(I.pattern)}:{},name:b,onChange:De,onBlur:De,ref:Z=>{if(Z){s.registerName.add(b),Gn(b,I),s.registerName.delete(b),T=F(i,b);const V=he(Z.value)&&Z.querySelectorAll&&Z.querySelectorAll("input,select,textarea")[0]||Z,H=Kw(V),ue=T._f.refs||[];if(H?ue.find(ze=>ze===V):V===T._f.ref)return;me(i,b,{_f:{...T._f,...H?{refs:[...ue.filter(wa),V,...Array.isArray(F(n,b))?[{}]:[]],ref:{type:V.type,name:b}}:{ref:V}}}),O(b,!1,void 0,V)}else T=F(i,b,{}),T._f&&(T._f.mount=!1),(t.shouldUnregister||I.shouldUnregister)&&!(Zw(s.array,b)&&a.action)&&s.unMount.add(b)}}},da=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&kn(i,ft,s.mount),Y0=b=>{$t(b)&&(h.state.next({disabled:b}),kn(i,(I,T)=>{const A=F(i,T);A&&(I.disabled=A._f.disabled||b,Array.isArray(A._f.refs)&&A._f.refs.forEach(M=>{M.disabled=A._f.disabled||b}))},0,!1))},Ic=(b,I)=>async T=>{let A;T&&(T.preventDefault&&T.preventDefault(),T.persist&&T.persist());let M=pe(o);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:Z,values:V}=await U();y(),r.errors=Z,M=pe(V)}else await q({fields:i,eventType:vn.SUBMIT});if(s.disabled.size)for(const Z of s.disabled)Ie(M,Z);if(Ie(r.errors,op),Oe(r.errors)){h.state.next({errors:{}});try{await b(M,T)}catch(Z){A=Z}}else I&&await I({...r.errors},T),da(),setTimeout(da);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Oe(r.errors)&&!A,submitCount:r.submitCount+1,errors:r.errors}),A)throw A},Q0=(b,I={})=>{F(i,b)&&(he(I.defaultValue)?ce(b,pe(F(n,b))):(ce(b,I.defaultValue),me(n,b,pe(I.defaultValue))),I.keepTouched||Ie(r.touchedFields,b),I.keepDirty||(Ie(r.dirtyFields,b),r.isDirty=I.defaultValue?G(b,pe(F(n,b))):G()),I.keepError||(Ie(r.errors,b),d.isValid&&g()),h.state.next({...r}))},jc=(b,I={})=>{const T=b?pe(b):n,A=pe(T),M=Oe(b),Z=A;if(I.keepDefaultValues||(n=T),!I.keepValues){if(I.keepDirtyValues){const V=new Set([...s.mount,...Object.keys(qt(n,o))]);for(const H of Array.from(V)){const ue=F(r.dirtyFields,H),ze=F(o,H),yt=F(Z,H);ue&&!he(ze)?me(Z,H,ze):!ue&&!he(yt)&&ce(H,yt)}}else{if(co&&he(b))for(const V of s.mount){const H=F(i,V);if(H&&H._f){const ue=Array.isArray(H._f.refs)?H._f.refs[0]:H._f.ref;if(Mi(ue)){const ze=ue.closest("form");if(ze){ze.reset();break}}}}if(I.keepFieldsRef)for(const V of s.mount)ce(V,F(Z,V));else i={}}if(t.shouldUnregister){if(o=I.keepDefaultValues?pe(n):{},I.keepFieldsRef)for(const V of s.mount)me(o,V,F(Z,V))}else o=pe(Z);h.array.next({values:{...Z}}),h.state.next({values:{...Z}})}s={mount:I.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!d.isValid||!!I.keepIsValid||!!I.keepDirtyValues||!t.shouldUnregister&&!Oe(Z),a.watch=!!t.shouldUnregister,a.keepIsValid=!!I.keepIsValid,a.action=!1,I.keepErrors||(r.errors={}),h.state.next({submitCount:I.keepSubmitCount?r.submitCount:0,isDirty:M?!1:I.keepDirty?r.isDirty:I.keepValues?G():!!(I.keepDefaultValues&&!xt(b,n)),isSubmitted:I.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:M?{}:I.keepDirtyValues?I.keepDefaultValues&&o?qt(n,o):r.dirtyFields:I.keepDefaultValues&&b?qt(n,b):I.keepDirty?r.dirtyFields:{},touchedFields:I.keepTouched?r.touchedFields:{},errors:I.keepErrors?r.errors:{},isSubmitSuccessful:I.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:n})},Tc=(b,I)=>jc(rt(b)?b(o):b,{...t.resetOptions,...I}),e$=(b,I={})=>{const T=F(i,b),A=T&&T._f;if(A){const M=A.refs?A.refs[0]:A.ref;M.focus&&setTimeout(()=>{M.focus(),I.shouldSelect&&rt(M.select)&&M.select()})}},t$=b=>{r={...r,...b}},Pc={control:{register:Gn,unregister:Hn,getFieldState:Xe,handleSubmit:Ic,setError:Et,_subscribe:Wn,_runSchema:U,_updateIsValidating:y,_focusError:da,_getWatch:Q,_getDirty:G,_setValid:g,_setFieldArray:j,_setDisabledField:Jn,_setErrors:w,_getFieldArray:re,_reset:jc,_resetDefaultValues:()=>rt(t.defaultValues)&&t.defaultValues().then(b=>{Tc(b,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:ae,_disableForm:Y0,_subjects:h,_proxyFormState:d,get _fields(){return i},get _formValues(){return o},get _state(){return a},set _state(b){a=b},get _defaultValues(){return n},get _names(){return s},set _names(b){s=b},get _formState(){return r},get _options(){return t},set _options(b){t={...t,...b}}},subscribe:ni,trigger:nt,register:Gn,handleSubmit:Ic,watch:ca,setValue:ce,setValues:ke,getValues:Ke,reset:Tc,resetField:Q0,resetDefaultValues:(b,I={})=>{if(n=pe(b),!I.keepDirty){const T=qt(n,o);r.dirtyFields=T,r.isDirty=!Oe(T)}I.keepIsValid||g(),h.state.next({...r,defaultValues:n})},clearErrors:zt,unregister:Hn,setError:Et,setFocus:e$,getFieldState:Xe};return{...Pc,formControl:Pc}}var Mt=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const r=(Math.random()*16+e)%16|0;return(t=="x"?r:r&3|8).toString(16)})},ka=(e,t,r={})=>r.shouldFocus||he(r.shouldFocus)?r.focusName||`${e}.${he(r.focusIndex)?t:r.focusIndex}.`:"",Ia=(e,t)=>[...e,...qe(t)],ja=e=>Array.isArray(e)?e.map(()=>{}):void 0;function Ta(e,t,r){return[...e.slice(0,t),...qe(r),...e.slice(t)]}var Pa=(e,t,r)=>Array.isArray(e)?(he(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[],Oa=(e,t)=>[...qe(t),...qe(e)];function uk(e,t){let r=0;const i=[...e];for(const n of t)i.splice(n-r,1),r++;return eu(i).length?i:[]}var Da=(e,t)=>he(t)?[]:uk(e,qe(t).sort((r,i)=>r-i)),za=(e,t,r)=>{[e[t],e[r]]=[e[r],e[t]]},vd=(e,t,r)=>(e[t]=r,e);function Yn(e){const t=Ww(),{control:r=t,name:i,keyName:n="id",shouldUnregister:o,rules:a}=e,[s,u]=_.useState(r._getFieldArray(i)),l=_.useRef(r._getFieldArray(i).map(Mt)),c=_.useRef(!1);r._names.array.add(i),_.useMemo(()=>a&&s.length>=0&&r.register(i,a),[r,i,s.length,a]),up(()=>r._subjects.array.subscribe({next:({values:S,name:w})=>{if(w===i||!w){const $=F(S,i);Array.isArray($)?(u($),l.current=$.map(Mt)):w||(u([]),l.current=[])}}}).unsubscribe,[r,i]);const d=_.useCallback(S=>{c.current=!0,r._setFieldArray(i,S)},[r,i]),m=(S,w)=>{const $=qe(pe(S)),O=Ia(r._getFieldArray(i),$);r._names.focus=ka(i,O.length-1,w),l.current=Ia(l.current,$.map(Mt)),d(O),u(O),r._setFieldArray(i,O,Ia,{argA:ja(S)})},h=(S,w)=>{const $=qe(pe(S)),O=Oa(r._getFieldArray(i),$);r._names.focus=ka(i,0,w),l.current=Oa(l.current,$.map(Mt)),d(O),u(O),r._setFieldArray(i,O,Oa,{argA:ja(S)})},v=S=>{const w=Da(r._getFieldArray(i),S);l.current=Da(l.current,S),d(w),u(w),!Array.isArray(F(r._fields,i))&&me(r._fields,i,void 0),r._setFieldArray(i,w,Da,{argA:S})},f=(S,w,$)=>{const O=qe(pe(w)),z=Ta(r._getFieldArray(i),S,O);r._names.focus=ka(i,S,$),l.current=Ta(l.current,S,O.map(Mt)),d(z),u(z),r._setFieldArray(i,z,Ta,{argA:S,argB:ja(w)})},g=(S,w)=>{const $=r._getFieldArray(i);za($,S,w),za(l.current,S,w),d($),u($),r._setFieldArray(i,$,za,{argA:S,argB:w},!1)},y=(S,w)=>{const $=r._getFieldArray(i);Pa($,S,w),Pa(l.current,S,w),d($),u($),r._setFieldArray(i,$,Pa,{argA:S,argB:w},!1)},x=(S,w)=>{const $=pe(w),O=vd(r._getFieldArray(i),S,$);l.current=[...O].map((z,L)=>!z||L===S?Mt():l.current[L]),d(O),u([...O]),r._setFieldArray(i,O,vd,{argA:S,argB:$},!0,!1)},j=S=>{const w=qe(pe(S));l.current=w.map(Mt),d([...w]),u([...w]),r._setFieldArray(i,[...w],$=>$,{},!0,!1)};return _.useEffect(()=>{r._state.action=!1,as(i,r._names)&&r._subjects.state.next({...r._formState});const S=_n(r._options.mode);if(c.current&&(!S.isOnSubmit||r._formState.isSubmitted)&&!_n(r._options.reValidateMode).isOnSubmit&&!S.isOnBlur)if(r._options.resolver)r._runSchema([i]).then(w=>{r._updateIsValidating([i]);const $=F(w.errors,i),O=F(r._formState.errors,i);(O?!$&&O.type||$&&(O.type!==$.type||O.message!==$.message):$&&$.type)&&($?me(r._formState.errors,i,$):Ie(r._formState.errors,i),r._subjects.state.next({errors:r._formState.errors}))});else{const w=F(r._fields,i);w&&w._f&&!(_n(r._options.reValidateMode).isOnSubmit&&_n(r._options.mode).isOnSubmit)&&us(w,r._names.disabled,r._formValues,r._options.criteriaMode===it.all,r._options.shouldUseNativeValidation,!0).then($=>!Oe($)&&r._subjects.state.next({errors:ss(r._formState.errors,$,i)}))}r._subjects.state.next({name:i,values:pe(r._formValues)}),r._names.focus&&kn(r._fields,(w,$)=>{if(r._names.focus&&$.startsWith(r._names.focus)&&w.focus)return w.focus(),1}),r._names.focus="",r._setValid(),c.current=!1},[s,i,r]),_.useEffect(()=>(!F(r._formValues,i)&&r._setFieldArray(i),()=>{const S=!(r._options.shouldUnregister||o),w=($,O)=>{const z=F(r._fields,$);z&&z._f&&(z._f.mount=O)};c.current&&S&&r._subjects.state.next({name:i,values:pe(r._formValues)}),S?w(i,!1):r.unregister(i)}),[i,r,n,o]),{swap:_.useCallback(g,[d,i,r]),move:_.useCallback(y,[d,i,r]),prepend:_.useCallback(h,[d,i,r]),append:_.useCallback(m,[d,i,r]),remove:_.useCallback(v,[d,i,r]),insert:_.useCallback(f,[d,i,r]),update:_.useCallback(x,[d,i,r]),replace:_.useCallback(j,[d,i,r]),fields:_.useMemo(()=>s.map((S,w)=>({...S,[n]:l.current[w]||Mt()})),[s,n])}}function kr(e={}){const t=_.useRef(void 0),r=_.useRef(void 0),[i,n]=_.useState(()=>({...pe(hp),isLoading:rt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:rt(e.defaultValues)?void 0:e.defaultValues}));if(!t.current)if(e.formControl)t.current={...e.formControl,formState:i},e.defaultValues&&!rt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...s}=sk(e);t.current={...s,formState:i}}const o=t.current.control;return o._options=e,up(()=>{const a=o._subscribe({formState:o._proxyFormState,callback:()=>n({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return n(s=>({...s,isReady:!0})),o._formState.isReady=!0,a},[o]),_.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),_.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),_.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),_.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),_.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==i.isDirty&&o._subjects.state.next({isDirty:a})}},[o,i.isDirty]),_.useEffect(()=>{var a;e.values&&!xt(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((a=o._options.resetOptions)===null||a===void 0)&&a.keepIsValid||o._setValid(),r.current=e.values,n(s=>({...s}))):o._resetDefaultValues()},[o,e.values]),_.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=_.useMemo(()=>Hw(i,o),[o,i]),t.current}var gd,vp=Object.freeze({status:"aborted"});function k(e,t,r){function i(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);const l=a.prototype,c=Object.keys(l);for(let d=0;dr?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var gp=Symbol("zod_brand"),on=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},mo=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(gd=globalThis).__zod_globalConfig??(gd.__zod_globalConfig={});var fr=globalThis.__zod_globalConfig;function Ve(e){return e&&Object.assign(fr,e),fr}var bp=ct({BIGINT_FORMAT_RANGES:()=>kp,Class:()=>jk,NUMBER_FORMAT_RANGES:()=>wp,aborted:()=>tn,allowsEval:()=>$p,assert:()=>mk,assertEqual:()=>lk,assertIs:()=>dk,assertNever:()=>fk,assertNotEqual:()=>ck,assignProp:()=>Ht,base64ToUint8Array:()=>Cp,base64urlToUint8Array:()=>Sk,cached:()=>Ir,captureStackTrace:()=>iu,cleanEnum:()=>xk,cleanRegex:()=>po,clone:()=>dt,cloneDef:()=>hk,createTransparentProxy:()=>$k,defineLazy:()=>se,esc:()=>ls,escapeRegex:()=>Nt,explicitlyAborted:()=>Ep,extend:()=>Tp,finalizeIssue:()=>Qe,floatSafeRemainder:()=>yp,getElementAtPath:()=>vk,getEnumValues:()=>ru,getLengthableOrigin:()=>go,getParsedType:()=>_k,getSizableOrigin:()=>vo,hexToUint8Array:()=>kk,isObject:()=>jn,isPlainObject:()=>cn,issue:()=>Tn,joinValues:()=>E,jsonStringifyReplacer:()=>Fi,merge:()=>Op,mergeDefs:()=>Dt,normalizeParams:()=>D,nullish:()=>mn,numKeys:()=>yk,objectClone:()=>pk,omit:()=>jp,optionalKeys:()=>Sp,parsedType:()=>Y,partial:()=>Dp,pick:()=>Ip,prefixIssues:()=>ot,primitiveTypes:()=>xp,promiseAllObject:()=>gk,propertyKeyTypes:()=>Li,randomString:()=>bk,required:()=>zp,safeExtend:()=>Pp,shallowClone:()=>ho,slugify:()=>_p,stringifyPrimitive:()=>K,uint8ArrayToBase64:()=>Ap,uint8ArrayToBase64url:()=>wk,uint8ArrayToHex:()=>Ik,unwrapMessage:()=>rr});function lk(e){return e}function ck(e){return e}function dk(e){}function fk(e){throw new Error("Unexpected value in exhaustive check")}function mk(e){}function ru(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function E(e,t="|"){return e.map(r=>K(r)).join(t)}function Fi(e,t){return typeof t=="bigint"?t.toString():t}function Ir(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}throw new Error("cached value already set")}}}function mn(e){return e==null}function po(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function yp(e,t){const r=e/t,i=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-i)r?.[i],e):e}function gk(e){const t=Object.keys(e),r=t.map(i=>e[i]);return Promise.all(r).then(i=>{const n={};for(let o=0;o{};function jn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var $p=Ir(()=>{if(fr.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch{return!1}});function cn(e){if(jn(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(jn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function ho(e){return cn(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function yk(e){let t=0;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var _k=e=>{const t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Li=new Set(["string","number","symbol"]),xp=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Nt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dt(e,t,r){const i=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(i._zod.parent=e),i}function D(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function $k(e){let t;return new Proxy({},{get(r,i,n){return t??(t=e()),Reflect.get(t,i,n)},set(r,i,n,o){return t??(t=e()),Reflect.set(t,i,n,o)},has(r,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(r,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(r,i,n){return t??(t=e()),Reflect.defineProperty(t,i,n)}})}function K(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Sp(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var wp={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},kp={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ip(e,t){const r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return dt(e,Dt(e._zod.def,{get shape(){const n={};for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(n[o]=r.shape[o])}return Ht(this,"shape",n),n},checks:[]}))}function jp(e,t){const r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");return dt(e,Dt(e._zod.def,{get shape(){const n={...e._zod.def.shape};for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&delete n[o]}return Ht(this,"shape",n),n},checks:[]}))}function Tp(e,t){if(!cn(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const i=e._zod.def.shape;for(const n in t)if(Object.getOwnPropertyDescriptor(i,n)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return dt(e,Dt(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Ht(this,"shape",i),i}}))}function Pp(e,t){if(!cn(t))throw new Error("Invalid input to safeExtend: expected a plain object");return dt(e,Dt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Ht(this,"shape",r),r}}))}function Op(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");return dt(e,Dt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Ht(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Dp(e,t,r){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");return dt(t,Dt(t._zod.def,{get shape(){const n=t._zod.def.shape,o={...n};if(r)for(const a in r){if(!(a in n))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(o[a]=e?new e({type:"optional",innerType:n[a]}):n[a])}else for(const a in n)o[a]=e?new e({type:"optional",innerType:n[a]}):n[a];return Ht(this,"shape",o),o},checks:[]}))}function zp(e,t,r){return dt(t,Dt(t._zod.def,{get shape(){const i=t._zod.def.shape,n={...i};if(r)for(const o in r){if(!(o in n))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(n[o]=new e({type:"nonoptional",innerType:i[o]}))}else for(const o in i)n[o]=new e({type:"nonoptional",innerType:i[o]});return Ht(this,"shape",n),n}}))}function tn(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function rr(e){return typeof e=="string"?e:e?.message}function Qe(e,t,r){const i=e.message?e.message:rr(e.inst?._zod.def?.error?.(e))??rr(t?.error?.(e))??rr(r.customError?.(e))??rr(r.localeError?.(e))??"Invalid input",{inst:n,continue:o,input:a,...s}=e;return s.path??(s.path=[]),s.message=i,t?.reportInput&&(s.input=a),s}function vo(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function go(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Y(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";const r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Tn(...e){const[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}function xk(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Cp(e){const t=atob(e),r=new Uint8Array(t.length);for(let i=0;it.toString(16).padStart(2,"0")).join("")}var jk=class{constructor(...e){}},Np=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Fi,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},bo=k("$ZodError",Np),et=k("$ZodError",Np,{Parent:Error});function ou(e,t=r=>r.message){const r={},i=[];for(const n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):i.push(t(n));return{formErrors:i,fieldErrors:r}}function au(e,t=r=>r.message){const r={_errors:[]},i=(n,o=[])=>{for(const a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(s=>i({issues:s},[...o,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...o,...a.path]);else{const s=[...o,...a.path];if(s.length===0)r._errors.push(t(a));else{let u=r,l=0;for(;lr.message){const r={errors:[]},i=(n,o=[])=>{var a,s;for(const u of n.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(l=>i({issues:l},[...o,...u.path]));else if(u.code==="invalid_key")i({issues:u.issues},[...o,...u.path]);else if(u.code==="invalid_element")i({issues:u.issues},[...o,...u.path]);else{const l=[...o,...u.path];if(l.length===0){r.errors.push(t(u));continue}let c=r,d=0;for(;dtypeof i=="object"?i.key:i);for(const i of r)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function Mp(e){const t=[],r=[...e.issues].sort((i,n)=>(i.path??[]).length-(n.path??[]).length);for(const i of r)t.push(`✖ ${i.message}`),i.path?.length&&t.push(` → at ${Up(i.path)}`);return t.join(` -`)}var jr=e=>(t,r,i,n)=>{const o=i?{...i,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new on;if(a.issues.length){const s=new(n?.Err??e)(a.issues.map(u=>Qe(u,o,Ve())));throw iu(s,n?.callee),s}return a.value},Zi=jr(et),Tr=e=>async(t,r,i,n)=>{const o=i?{...i,async:!0}:{async:!0};let a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const s=new(n?.Err??e)(a.issues.map(u=>Qe(u,o,Ve())));throw iu(s,n?.callee),s}return a.value},Bi=Tr(et),Pr=e=>(t,r,i)=>{const n=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},n);if(o instanceof Promise)throw new on;return o.issues.length?{success:!1,error:new(e??bo)(o.issues.map(a=>Qe(a,n,Ve())))}:{success:!0,data:o.value}},Rp=Pr(et),Or=e=>async(t,r,i)=>{const n=i?{...i,async:!0}:{async:!0};let o=t._zod.run({value:r,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>Qe(a,n,Ve())))}:{success:!0,data:o.value}},Fp=Or(et),su=e=>(t,r,i)=>{const n=i?{...i,direction:"backward"}:{direction:"backward"};return jr(e)(t,r,n)},Tk=su(et),uu=e=>(t,r,i)=>jr(e)(t,r,i),Pk=uu(et),lu=e=>async(t,r,i)=>{const n=i?{...i,direction:"backward"}:{direction:"backward"};return Tr(e)(t,r,n)},Ok=lu(et),cu=e=>async(t,r,i)=>Tr(e)(t,r,i),Dk=cu(et),du=e=>(t,r,i)=>{const n=i?{...i,direction:"backward"}:{direction:"backward"};return Pr(e)(t,r,n)},zk=du(et),fu=e=>(t,r,i)=>Pr(e)(t,r,i),Ek=fu(et),mu=e=>async(t,r,i)=>{const n=i?{...i,direction:"backward"}:{direction:"backward"};return Or(e)(t,r,n)},Ck=mu(et),pu=e=>async(t,r,i)=>Or(e)(t,r,i),Ak=pu(et),hu=ct({base64:()=>ih,base64url:()=>vu,bigint:()=>ph,boolean:()=>vh,browserEmail:()=>Zk,cidrv4:()=>nh,cidrv6:()=>rh,cuid:()=>Lp,cuid2:()=>Zp,date:()=>lh,datetime:()=>fh,domain:()=>ah,duration:()=>Gp,e164:()=>sh,email:()=>Xp,emoji:()=>Yp,extendedDuration:()=>Nk,guid:()=>Kp,hex:()=>$h,hostname:()=>oh,html5Email:()=>Rk,httpProtocol:()=>gu,idnEmail:()=>Lk,integer:()=>hh,ipv4:()=>Qp,ipv6:()=>eh,ksuid:()=>Hp,lowercase:()=>yh,mac:()=>th,md5_base64:()=>Hk,md5_base64url:()=>Jk,md5_hex:()=>Wk,nanoid:()=>Jp,null:()=>gh,number:()=>bu,rfc5322Email:()=>Fk,sha1_base64:()=>Kk,sha1_base64url:()=>Xk,sha1_hex:()=>Gk,sha256_base64:()=>Yk,sha256_base64url:()=>Qk,sha256_hex:()=>qk,sha384_base64:()=>tI,sha384_base64url:()=>nI,sha384_hex:()=>eI,sha512_base64:()=>iI,sha512_base64url:()=>oI,sha512_hex:()=>rI,string:()=>mh,time:()=>dh,ulid:()=>Bp,undefined:()=>bh,unicodeEmail:()=>qp,uppercase:()=>_h,uuid:()=>Pn,uuid4:()=>Vk,uuid6:()=>Uk,uuid7:()=>Mk,xid:()=>Wp}),Lp=/^[cC][0-9a-z]{6,}$/,Zp=/^[0-9a-z]+$/,Bp=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Wp=/^[0-9a-vA-V]{20}$/,Hp=/^[A-Za-z0-9]{27}$/,Jp=/^[a-zA-Z0-9_-]{21}$/,Gp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Nk=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Kp=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Pn=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Vk=Pn(4),Uk=Pn(6),Mk=Pn(7),Xp=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Rk=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Fk=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,qp=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Lk=qp,Zk=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Bk="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Yp(){return new RegExp(Bk,"u")}var Qp=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,eh=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,th=e=>{const t=Nt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},nh=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,rh=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ih=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,vu=/^[A-Za-z0-9_-]*$/,oh=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,ah=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,gu=/^https?$/,sh=/^\+[1-9]\d{6,14}$/,uh="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",lh=new RegExp(`^${uh}$`);function ch(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function dh(e){return new RegExp(`^${ch(e)}$`)}function fh(e){const t=ch({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${t}(?:${r.join("|")})`;return new RegExp(`^${uh}T(?:${i})$`)}var mh=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ph=/^-?\d+n?$/,hh=/^-?\d+$/,bu=/^-?\d+(?:\.\d+)?$/,vh=/^(?:true|false)$/i,gh=/^null$/i,bh=/^undefined$/i,yh=/^[^A-Z]*$/,_h=/^[^a-z]*$/,$h=/^[0-9a-fA-F]*$/;function Dr(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function zr(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Wk=/^[0-9a-fA-F]{32}$/,Hk=Dr(22,"=="),Jk=zr(22),Gk=/^[0-9a-fA-F]{40}$/,Kk=Dr(27,"="),Xk=zr(27),qk=/^[0-9a-fA-F]{64}$/,Yk=Dr(43,"="),Qk=zr(43),eI=/^[0-9a-fA-F]{96}$/,tI=Dr(64,""),nI=zr(64),rI=/^[0-9a-fA-F]{128}$/,iI=Dr(86,"=="),oI=zr(86),$e=k("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),xh={number:"number",bigint:"bigint",object:"date"},yu=k("$ZodCheckLessThan",(e,t)=>{$e.init(e,t);const r=xh[typeof t.value];e._zod.onattach.push(i=>{const n=i._zod.bag,o=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value{(t.inclusive?i.value<=t.value:i.value{$e.init(e,t);const r=xh[typeof t.value];e._zod.onattach.push(i=>{const n=i._zod.bag,o=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Sh=k("$ZodCheckMultipleOf",(e,t)=>{$e.init(e,t),e._zod.onattach.push(r=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):yp(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),wh=k("$ZodCheckNumberFormat",(e,t)=>{$e.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),i=r?"int":"number",[n,o]=wp[t.format];e._zod.onattach.push(a=>{const s=a._zod.bag;s.format=t.format,s.minimum=n,s.maximum=o,r&&(s.pattern=hh)}),e._zod.check=a=>{const s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}so&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),kh=k("$ZodCheckBigIntFormat",(e,t)=>{$e.init(e,t);const[r,i]=kp[t.format];e._zod.onattach.push(n=>{const o=n._zod.bag;o.format=t.format,o.minimum=r,o.maximum=i}),e._zod.check=n=>{const o=n.value;oi&&n.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Ih=k("$ZodCheckMaxSize",(e,t)=>{var r;$e.init(e,t),(r=e._zod.def).when??(r.when=i=>{const n=i.value;return!mn(n)&&n.size!==void 0}),e._zod.onattach.push(i=>{const n=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{const n=i.value;n.size<=t.maximum||i.issues.push({origin:vo(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),jh=k("$ZodCheckMinSize",(e,t)=>{var r;$e.init(e,t),(r=e._zod.def).when??(r.when=i=>{const n=i.value;return!mn(n)&&n.size!==void 0}),e._zod.onattach.push(i=>{const n=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{const n=i.value;n.size>=t.minimum||i.issues.push({origin:vo(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Th=k("$ZodCheckSizeEquals",(e,t)=>{var r;$e.init(e,t),(r=e._zod.def).when??(r.when=i=>{const n=i.value;return!mn(n)&&n.size!==void 0}),e._zod.onattach.push(i=>{const n=i._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=i=>{const n=i.value,o=n.size;if(o===t.size)return;const a=o>t.size;i.issues.push({origin:vo(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Ph=k("$ZodCheckMaxLength",(e,t)=>{var r;$e.init(e,t),(r=e._zod.def).when??(r.when=i=>{const n=i.value;return!mn(n)&&n.length!==void 0}),e._zod.onattach.push(i=>{const n=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{const n=i.value;if(n.length<=t.maximum)return;const o=go(n);i.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Oh=k("$ZodCheckMinLength",(e,t)=>{var r;$e.init(e,t),(r=e._zod.def).when??(r.when=i=>{const n=i.value;return!mn(n)&&n.length!==void 0}),e._zod.onattach.push(i=>{const n=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{const n=i.value;if(n.length>=t.minimum)return;const o=go(n);i.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Dh=k("$ZodCheckLengthEquals",(e,t)=>{var r;$e.init(e,t),(r=e._zod.def).when??(r.when=i=>{const n=i.value;return!mn(n)&&n.length!==void 0}),e._zod.onattach.push(i=>{const n=i._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=i=>{const n=i.value,o=n.length;if(o===t.length)return;const a=go(n),s=o>t.length;i.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Er=k("$ZodCheckStringFormat",(e,t)=>{var r,i;$e.init(e,t),e._zod.onattach.push(n=>{const o=n._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),zh=k("$ZodCheckRegex",(e,t)=>{Er.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Eh=k("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=yh),Er.init(e,t)}),Ch=k("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=_h),Er.init(e,t)}),Ah=k("$ZodCheckIncludes",(e,t)=>{$e.init(e,t);const r=Nt(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=i,e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Nh=k("$ZodCheckStartsWith",(e,t)=>{$e.init(e,t);const r=new RegExp(`^${Nt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(i=>{const n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),Vh=k("$ZodCheckEndsWith",(e,t)=>{$e.init(e,t);const r=new RegExp(`.*${Nt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(i=>{const n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});function yd(e,t,r){e.issues.length&&t.issues.push(...ot(r,e.issues))}var Uh=k("$ZodCheckProperty",(e,t)=>{$e.init(e,t),e._zod.check=r=>{const i=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(n=>yd(n,r,t.property));yd(i,r,t.property)}}),Mh=k("$ZodCheckMimeType",(e,t)=>{$e.init(e,t);const r=new Set(t.mime);e._zod.onattach.push(i=>{i._zod.bag.mime=t.mime}),e._zod.check=i=>{r.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e,continue:!t.abort})}}),Rh=k("$ZodCheckOverwrite",(e,t)=>{$e.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}}),Fh=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const t=e.split(` -`).filter(n=>n),r=Math.min(...t.map(n=>n.length-n.trimStart().length)),i=t.map(n=>n.slice(r)).map(n=>" ".repeat(this.indent*2)+n);for(const n of i)this.content.push(n)}compile(){const e=Function,t=this?.args,r=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...t,r.join(` -`))}},Lh={major:4,minor:4,patch:3},ne=k("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Lh;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const n of i)for(const o of n._zod.onattach)o(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const n=(a,s,u)=>{let l=tn(a),c;for(const d of s){if(d._zod.def.when){if(Ep(a)||!d._zod.def.when(a))continue}else if(l)continue;const m=a.issues.length,h=d._zod.check(a);if(h instanceof Promise&&u?.async===!1)throw new on;if(c||h instanceof Promise)c=(c??Promise.resolve()).then(async()=>{await h,a.issues.length!==m&&(l||(l=tn(a,m)))});else{if(a.issues.length===m)continue;l||(l=tn(a,m))}}return c?c.then(()=>a):a},o=(a,s,u)=>{if(tn(a))return a.aborted=!0,a;const l=n(s,i,u);if(l instanceof Promise){if(u.async===!1)throw new on;return l.then(c=>e._zod.parse(c,u))}return e._zod.parse(l,u)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){const l=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return l instanceof Promise?l.then(c=>o(c,a,s)):o(l,a,s)}const u=e._zod.parse(a,s);if(u instanceof Promise){if(s.async===!1)throw new on;return u.then(l=>n(l,i,s))}return n(u,i,s)}}se(e,"~standard",()=>({validate:n=>{try{const o=Rp(e,n);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return Fp(e,n).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),Cr=k("$ZodString",(e,t)=>{ne.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??mh(e._zod.bag),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ye=k("$ZodStringFormat",(e,t)=>{Er.init(e,t),Cr.init(e,t)}),Zh=k("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Kp),ye.init(e,t)}),Bh=k("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Pn(r))}else t.pattern??(t.pattern=Pn());ye.init(e,t)}),Wh=k("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Xp),ye.init(e,t)}),Hh=k("$ZodURL",(e,t)=>{ye.init(e,t),e._zod.check=r=>{try{const i=r.value.trim();if(!t.normalize&&t.protocol?.source===gu.source&&!/^https?:\/\//i.test(i)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}const n=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=n.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Jh=k("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Yp()),ye.init(e,t)}),Gh=k("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Jp),ye.init(e,t)}),Kh=k("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Lp),ye.init(e,t)}),Xh=k("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Zp),ye.init(e,t)}),qh=k("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Bp),ye.init(e,t)}),Yh=k("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Wp),ye.init(e,t)}),Qh=k("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Hp),ye.init(e,t)}),ev=k("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=fh(t)),ye.init(e,t)}),tv=k("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=lh),ye.init(e,t)}),nv=k("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=dh(t)),ye.init(e,t)}),rv=k("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Gp),ye.init(e,t)}),iv=k("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Qp),ye.init(e,t),e._zod.bag.format="ipv4"}),ov=k("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=eh),ye.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),av=k("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=th(t.delimiter)),ye.init(e,t),e._zod.bag.format="mac"}),sv=k("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=nh),ye.init(e,t)}),uv=k("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=rh),ye.init(e,t),e._zod.check=r=>{const i=r.value.split("/");try{if(i.length!==2)throw new Error;const[n,o]=i;if(!o)throw new Error;const a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function $u(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var lv=k("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ih),ye.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{$u(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function cv(e){if(!vu.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/");return $u(t.padEnd(Math.ceil(t.length/4)*4,"="))}var dv=k("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=vu),ye.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{cv(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),fv=k("$ZodE164",(e,t)=>{t.pattern??(t.pattern=sh),ye.init(e,t)});function mv(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[i]=r;if(!i)return!1;const n=JSON.parse(atob(i));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var pv=k("$ZodJWT",(e,t)=>{ye.init(e,t),e._zod.check=r=>{mv(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),hv=k("$ZodCustomStringFormat",(e,t)=>{ye.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),xu=k("$ZodNumber",(e,t)=>{ne.init(e,t),e._zod.pattern=e._zod.bag.pattern??bu,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;const o=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...o?{received:o}:{}}),r}}),vv=k("$ZodNumberFormat",(e,t)=>{wh.init(e,t),xu.init(e,t)}),Su=k("$ZodBoolean",(e,t)=>{ne.init(e,t),e._zod.pattern=vh,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=!!r.value}catch{}const n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),wu=k("$ZodBigInt",(e,t)=>{ne.init(e,t),e._zod.pattern=ph,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),gv=k("$ZodBigIntFormat",(e,t)=>{kh.init(e,t),wu.init(e,t)}),bv=k("$ZodSymbol",(e,t)=>{ne.init(e,t),e._zod.parse=(r,i)=>{const n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),yv=k("$ZodUndefined",(e,t)=>{ne.init(e,t),e._zod.pattern=bh,e._zod.values=new Set([void 0]),e._zod.parse=(r,i)=>{const n=r.value;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),_v=k("$ZodNull",(e,t)=>{ne.init(e,t),e._zod.pattern=gh,e._zod.values=new Set([null]),e._zod.parse=(r,i)=>{const n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),$v=k("$ZodAny",(e,t)=>{ne.init(e,t),e._zod.parse=r=>r}),xv=k("$ZodUnknown",(e,t)=>{ne.init(e,t),e._zod.parse=r=>r}),Sv=k("$ZodNever",(e,t)=>{ne.init(e,t),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),wv=k("$ZodVoid",(e,t)=>{ne.init(e,t),e._zod.parse=(r,i)=>{const n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),kv=k("$ZodDate",(e,t)=>{ne.init(e,t),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}const n=r.value,o=n instanceof Date;return o&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...o?{received:"Invalid Date"}:{},inst:e}),r}});function _d(e,t,r){e.issues.length&&t.issues.push(...ot(r,e.issues)),t.value[r]=e.value}var Iv=k("$ZodArray",(e,t)=>{ne.init(e,t),e._zod.parse=(r,i)=>{const n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);const o=[];for(let a=0;a_d(l,r,a))):_d(u,r,a)}return o.length?Promise.all(o).then(()=>r):r}});function Wi(e,t,r,i,n,o){const a=r in i;if(e.issues.length){if(n&&o&&!a)return;t.issues.push(...ot(r,e.issues))}if(!a&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?a&&(t.value[r]=void 0):t.value[r]=e.value}function jv(e){const t=Object.keys(e.shape);for(const i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const r=Sp(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Tv(e,t,r,i,n,o){const a=[],s=n.keySet,u=n.catchall._zod,l=u.def.type,c=u.optin==="optional",d=u.optout==="optional";for(const m in t){if(m==="__proto__"||s.has(m))continue;if(l==="never"){a.push(m);continue}const h=u.run({value:t[m],issues:[]},i);h instanceof Promise?e.push(h.then(v=>Wi(v,r,m,t,c,d))):Wi(h,r,m,t,c,d)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}var Pv=k("$ZodObject",(e,t)=>{if(ne.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const s={...a};return Object.defineProperty(t,"shape",{value:s}),s}})}const r=Ir(()=>jv(t));se(e._zod,"propValues",()=>{const a=t.shape,s={};for(const u in a){const l=a[u]._zod;if(l.values){s[u]??(s[u]=new Set);for(const c of l.values)s[u].add(c)}}return s});const i=jn,n=t.catchall;let o;e._zod.parse=(a,s)=>{o??(o=r.value);const u=a.value;if(!i(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};const l=[],c=o.shape;for(const d of o.keys){const m=c[d],h=m._zod.optin==="optional",v=m._zod.optout==="optional",f=m._zod.run({value:u[d],issues:[]},s);f instanceof Promise?l.push(f.then(g=>Wi(g,a,d,u,h,v))):Wi(f,a,d,u,h,v)}return n?Tv(l,u,a,s,r.value,e):l.length?Promise.all(l).then(()=>a):a}}),Ov=k("$ZodObjectJIT",(e,t)=>{Pv.init(e,t);const r=e._zod.parse,i=Ir(()=>jv(t)),n=m=>{const h=new Fh(["shape","payload","ctx"]),v=i.value,f=j=>{const S=ls(j);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};h.write("const input = payload.value;");const g=Object.create(null);let y=0;for(const j of v.keys)g[j]=`key_${y++}`;h.write("const newResult = {};");for(const j of v.keys){const S=g[j],w=ls(j),$=m[j],O=$?._zod?.optin==="optional",z=$?._zod?.optout==="optional";h.write(`const ${S} = ${f(j)};`),O&&z?h.write(` - if (${S}.issues.length) { - if (${w} in input) { - payload.issues = payload.issues.concat(${S}.issues.map(iss => ({ - ...iss, - path: iss.path ? [${w}, ...iss.path] : [${w}] - }))); - } - } - - if (${S}.value === undefined) { - if (${w} in input) { - newResult[${w}] = undefined; - } - } else { - newResult[${w}] = ${S}.value; - } - - `):O?h.write(` - if (${S}.issues.length) { - payload.issues = payload.issues.concat(${S}.issues.map(iss => ({ - ...iss, - path: iss.path ? [${w}, ...iss.path] : [${w}] - }))); - } - - if (${S}.value === undefined) { - if (${w} in input) { - newResult[${w}] = undefined; - } - } else { - newResult[${w}] = ${S}.value; - } - - `):h.write(` - const ${S}_present = ${w} in input; - if (${S}.issues.length) { - payload.issues = payload.issues.concat(${S}.issues.map(iss => ({ - ...iss, - path: iss.path ? [${w}, ...iss.path] : [${w}] - }))); - } - if (!${S}_present && !${S}.issues.length) { - payload.issues.push({ - code: "invalid_type", - expected: "nonoptional", - input: undefined, - path: [${w}] - }); - } - - if (${S}_present) { - if (${S}.value === undefined) { - newResult[${w}] = undefined; - } else { - newResult[${w}] = ${S}.value; - } - } - - `)}h.write("payload.value = newResult;"),h.write("return payload;");const x=h.compile();return(j,S)=>x(m,j,S)};let o;const a=jn,s=!fr.jitless,l=s&&$p.value,c=t.catchall;let d;e._zod.parse=(m,h)=>{d??(d=i.value);const v=m.value;return a(v)?s&&l&&h?.async===!1&&h.jitless!==!0?(o||(o=n(t.shape)),m=o(m,h),c?Tv([],v,m,h,d,e):m):r(m,h):(m.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),m)}});function $d(e,t,r,i){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const n=e.filter(o=>!tn(o));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(a=>Qe(a,i,Ve())))}),t)}var yo=k("$ZodUnion",(e,t)=>{ne.init(e,t),se(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),se(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),se(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),se(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){const i=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${i.map(n=>po(n.source)).join("|")})$`)}});const r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,n)=>{if(r)return r(i,n);let o=!1;const a=[];for(const s of t.options){const u=s._zod.run({value:i.value,issues:[]},n);if(u instanceof Promise)a.push(u),o=!0;else{if(u.issues.length===0)return u;a.push(u)}}return o?Promise.all(a).then(s=>$d(s,i,e,n)):$d(a,i,e,n)}});function xd(e,t,r,i){const n=e.filter(o=>o.issues.length===0);return n.length===1?(t.value=n[0].value,t):(n.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(a=>Qe(a,i,Ve())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var Dv=k("$ZodXor",(e,t)=>{yo.init(e,t),t.inclusive=!1;const r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,n)=>{if(r)return r(i,n);let o=!1;const a=[];for(const s of t.options){const u=s._zod.run({value:i.value,issues:[]},n);u instanceof Promise?(a.push(u),o=!0):a.push(u)}return o?Promise.all(a).then(s=>xd(s,i,e,n)):xd(a,i,e,n)}}),zv=k("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,yo.init(e,t);const r=e._zod.parse;se(e._zod,"propValues",()=>{const n={};for(const o of t.options){const a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const[s,u]of Object.entries(a)){n[s]||(n[s]=new Set);for(const l of u)n[s].add(l)}}return n});const i=Ir(()=>{const n=t.options,o=new Map;for(const a of n){const s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const u of s){if(o.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);o.set(u,a)}}return o});e._zod.parse=(n,o)=>{const a=n.value;if(!jn(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),n;const s=i.value.get(a?.[t.discriminator]);return s?s._zod.run(n,o):t.unionFallback||o.direction==="backward"?r(n,o):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(i.value.keys()),input:a,path:[t.discriminator],inst:e}),n)}}),Ev=k("$ZodIntersection",(e,t)=>{ne.init(e,t),e._zod.parse=(r,i)=>{const n=r.value,o=t.left._zod.run({value:n,issues:[]},i),a=t.right._zod.run({value:n,issues:[]},i);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([s,u])=>Sd(r,s,u)):Sd(r,o,a)}});function cs(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(cn(e)&&cn(t)){const r=Object.keys(t),i=Object.keys(e).filter(o=>r.indexOf(o)!==-1),n={...e,...t};for(const o of i){const a=cs(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};n[o]=a.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;is.l&&s.r).map(([s])=>s);if(o.length&&n&&e.issues.push({...n,keys:o}),tn(e))return e;const a=cs(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var ku=k("$ZodTuple",(e,t)=>{ne.init(e,t);const r=t.items;e._zod.parse=(i,n)=>{const o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),i;i.value=[];const a=[],s=wd(r,"optin"),u=wd(r,"optout");if(!t.rest){if(o.lengthr.length&&i.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:o,inst:e,origin:"array"})}const l=new Array(r.length);for(let c=0;c{l[c]=m})):l[c]=d}if(t.rest){let c=r.length-1;const d=o.slice(r.length);for(const m of d){c++;const h=t.rest._zod.run({value:m,issues:[]},n);h instanceof Promise?a.push(h.then(v=>kd(v,i,c))):kd(h,i,c)}}return a.length?Promise.all(a).then(()=>Id(l,i,r,o,u)):Id(l,i,r,o,u)}});function wd(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]._zod[t]!=="optional")return r+1;return 0}function kd(e,t,r){e.issues.length&&t.issues.push(...ot(r,e.issues)),t.value[r]=e.value}function Id(e,t,r,i,n){for(let o=0;o=n){t.value.length=o;break}t.issues.push(...ot(o,a.issues))}t.value[o]=a.value}for(let o=t.value.length-1;o>=i.length&&(r[o]._zod.optout==="optional"&&t.value[o]===void 0);o--)t.value.length=o;return t}var Cv=k("$ZodRecord",(e,t)=>{ne.init(e,t),e._zod.parse=(r,i)=>{const n=r.value;if(!cn(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;const o=[],a=t.keyType._zod.values;if(a){r.value={};const s=new Set;for(const l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){s.add(typeof l=="number"?l.toString():l);const c=t.keyType._zod.run({value:l,issues:[]},i);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(c.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(h=>Qe(h,i,Ve())),input:l,path:[l],inst:e});continue}const d=c.value,m=t.valueType._zod.run({value:n[l],issues:[]},i);m instanceof Promise?o.push(m.then(h=>{h.issues.length&&r.issues.push(...ot(l,h.issues)),r.value[d]=h.value})):(m.issues.length&&r.issues.push(...ot(l,m.issues)),r.value[d]=m.value)}let u;for(const l in n)s.has(l)||(u=u??[],u.push(l));u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:u})}else{r.value={};for(const s of Reflect.ownKeys(n)){if(s==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,s))continue;let u=t.keyType._zod.run({value:s,issues:[]},i);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&bu.test(s)&&u.issues.length){const c=t.keyType._zod.run({value:Number(s),issues:[]},i);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");c.issues.length===0&&(u=c)}if(u.issues.length){t.mode==="loose"?r.value[s]=n[s]:r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(c=>Qe(c,i,Ve())),input:s,path:[s],inst:e});continue}const l=t.valueType._zod.run({value:n[s],issues:[]},i);l instanceof Promise?o.push(l.then(c=>{c.issues.length&&r.issues.push(...ot(s,c.issues)),r.value[u.value]=c.value})):(l.issues.length&&r.issues.push(...ot(s,l.issues)),r.value[u.value]=l.value)}}return o.length?Promise.all(o).then(()=>r):r}}),Av=k("$ZodMap",(e,t)=>{ne.init(e,t),e._zod.parse=(r,i)=>{const n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:e}),r;const o=[];r.value=new Map;for(const[a,s]of n){const u=t.keyType._zod.run({value:a,issues:[]},i),l=t.valueType._zod.run({value:s,issues:[]},i);u instanceof Promise||l instanceof Promise?o.push(Promise.all([u,l]).then(([c,d])=>{jd(c,d,r,a,n,e,i)})):jd(u,l,r,a,n,e,i)}return o.length?Promise.all(o).then(()=>r):r}});function jd(e,t,r,i,n,o,a){e.issues.length&&(Li.has(typeof i)?r.issues.push(...ot(i,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:n,inst:o,issues:e.issues.map(s=>Qe(s,a,Ve()))})),t.issues.length&&(Li.has(typeof i)?r.issues.push(...ot(i,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:o,key:i,issues:t.issues.map(s=>Qe(s,a,Ve()))})),r.value.set(e.value,t.value)}var Nv=k("$ZodSet",(e,t)=>{ne.init(e,t),e._zod.parse=(r,i)=>{const n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:e,expected:"set",code:"invalid_type"}),r;const o=[];r.value=new Set;for(const a of n){const s=t.valueType._zod.run({value:a,issues:[]},i);s instanceof Promise?o.push(s.then(u=>Td(u,r))):Td(s,r)}return o.length?Promise.all(o).then(()=>r):r}});function Td(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var Vv=k("$ZodEnum",(e,t)=>{ne.init(e,t);const r=ru(t.entries),i=new Set(r);e._zod.values=i,e._zod.pattern=new RegExp(`^(${r.filter(n=>Li.has(typeof n)).map(n=>typeof n=="string"?Nt(n):n.toString()).join("|")})$`),e._zod.parse=(n,o)=>{const a=n.value;return i.has(a)||n.issues.push({code:"invalid_value",values:r,input:a,inst:e}),n}}),Uv=k("$ZodLiteral",(e,t)=>{if(ne.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(i=>typeof i=="string"?Nt(i):i?Nt(i.toString()):String(i)).join("|")})$`),e._zod.parse=(i,n)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),i}}),Mv=k("$ZodFile",(e,t)=>{ne.init(e,t),e._zod.parse=(r,i)=>{const n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),Rv=k("$ZodTransform",(e,t)=>{ne.init(e,t),e._zod.optin="optional",e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new mo(e.constructor.name);const n=t.transform(r.value,r);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(o=>(r.value=o,r.fallback=!0,r));if(n instanceof Promise)throw new on;return r.value=n,r.fallback=!0,r}});function Pd(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Iu=k("$ZodOptional",(e,t)=>{ne.init(e,t),e._zod.optin="optional",e._zod.optout="optional",se(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),se(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${po(r.source)})?$`):void 0}),e._zod.parse=(r,i)=>{if(t.innerType._zod.optin==="optional"){const n=r.value,o=t.innerType._zod.run(r,i);return o instanceof Promise?o.then(a=>Pd(a,n)):Pd(o,n)}return r.value===void 0?r:t.innerType._zod.run(r,i)}}),Fv=k("$ZodExactOptional",(e,t)=>{Iu.init(e,t),se(e._zod,"values",()=>t.innerType._zod.values),se(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,i)=>t.innerType._zod.run(r,i)}),Lv=k("$ZodNullable",(e,t)=>{ne.init(e,t),se(e._zod,"optin",()=>t.innerType._zod.optin),se(e._zod,"optout",()=>t.innerType._zod.optout),se(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${po(r.source)}|null)$`):void 0}),se(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,i)=>r.value===null?r:t.innerType._zod.run(r,i)}),Zv=k("$ZodDefault",(e,t)=>{ne.init(e,t),e._zod.optin="optional",se(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return t.innerType._zod.run(r,i);if(r.value===void 0)return r.value=t.defaultValue,r;const n=t.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>Od(o,t)):Od(n,t)}});function Od(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Bv=k("$ZodPrefault",(e,t)=>{ne.init(e,t),e._zod.optin="optional",se(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,i)=>(i.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,i))}),Wv=k("$ZodNonOptional",(e,t)=>{ne.init(e,t),se(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),e._zod.parse=(r,i)=>{const n=t.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>Dd(o,e)):Dd(n,e)}});function Dd(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Hv=k("$ZodSuccess",(e,t)=>{ne.init(e,t),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new mo("ZodSuccess");const n=t.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>(r.value=o.issues.length===0,r)):(r.value=n.issues.length===0,r)}}),Jv=k("$ZodCatch",(e,t)=>{ne.init(e,t),e._zod.optin="optional",se(e._zod,"optout",()=>t.innerType._zod.optout),se(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return t.innerType._zod.run(r,i);const n=t.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(a=>Qe(a,i,Ve()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(o=>Qe(o,i,Ve()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),Gv=k("$ZodNaN",(e,t)=>{ne.init(e,t),e._zod.parse=(r,i)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),ju=k("$ZodPipe",(e,t)=>{ne.init(e,t),se(e._zod,"values",()=>t.in._zod.values),se(e._zod,"optin",()=>t.in._zod.optin),se(e._zod,"optout",()=>t.out._zod.optout),se(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,i)=>{if(i.direction==="backward"){const o=t.out._zod.run(r,i);return o instanceof Promise?o.then(a=>ui(a,t.in,i)):ui(o,t.in,i)}const n=t.in._zod.run(r,i);return n instanceof Promise?n.then(o=>ui(o,t.out,i)):ui(n,t.out,i)}});function ui(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var Tu=k("$ZodCodec",(e,t)=>{ne.init(e,t),se(e._zod,"values",()=>t.in._zod.values),se(e._zod,"optin",()=>t.in._zod.optin),se(e._zod,"optout",()=>t.out._zod.optout),se(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,i)=>{if((i.direction||"forward")==="forward"){const n=t.in._zod.run(r,i);return n instanceof Promise?n.then(o=>li(o,t,i)):li(n,t,i)}else{const n=t.out._zod.run(r,i);return n instanceof Promise?n.then(o=>li(o,t,i)):li(n,t,i)}}});function li(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){const i=t.transform(e.value,e);return i instanceof Promise?i.then(n=>ci(e,n,t.out,r)):ci(e,i,t.out,r)}else{const i=t.reverseTransform(e.value,e);return i instanceof Promise?i.then(n=>ci(e,n,t.in,r)):ci(e,i,t.in,r)}}function ci(e,t,r,i){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},i)}var Kv=k("$ZodPreprocess",(e,t)=>{ju.init(e,t)}),Xv=k("$ZodReadonly",(e,t)=>{ne.init(e,t),se(e._zod,"propValues",()=>t.innerType._zod.propValues),se(e._zod,"values",()=>t.innerType._zod.values),se(e._zod,"optin",()=>t.innerType?._zod?.optin),se(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,i)=>{if(i.direction==="backward")return t.innerType._zod.run(r,i);const n=t.innerType._zod.run(r,i);return n instanceof Promise?n.then(zd):zd(n)}});function zd(e){return e.value=Object.freeze(e.value),e}var qv=k("$ZodTemplateLiteral",(e,t)=>{ne.init(e,t);const r=[];for(const i of t.parts)if(typeof i=="object"&&i!==null){if(!i._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);const n=i._zod.pattern instanceof RegExp?i._zod.pattern.source:i._zod.pattern;if(!n)throw new Error(`Invalid template literal part: ${i._zod.traits}`);const o=n.startsWith("^")?1:0,a=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(o,a))}else if(i===null||xp.has(typeof i))r.push(Nt(`${i}`));else throw new Error(`Invalid template literal part: ${i}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(i,n)=>typeof i.value!="string"?(i.issues.push({input:i.value,inst:e,expected:"string",code:"invalid_type"}),i):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(i.value)||i.issues.push({input:i.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),i)}),Yv=k("$ZodFunction",(e,t)=>(ne.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...i){const n=e._def.input?Zi(e._def.input,i):i,o=Reflect.apply(r,this,n);return e._def.output?Zi(e._def.output,o):o}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...i){const n=e._def.input?await Bi(e._def.input,i):i,o=await Reflect.apply(r,this,n);return e._def.output?await Bi(e._def.output,o):o}},e._zod.parse=(r,i)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{const i=e.constructor;return Array.isArray(r[0])?new i({type:"function",input:new ku({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new i({type:"function",input:r[0],output:e._def.output})},e.output=r=>{const i=e.constructor;return new i({type:"function",input:e._def.input,output:r})},e)),Qv=k("$ZodPromise",(e,t)=>{ne.init(e,t),e._zod.parse=(r,i)=>Promise.resolve(r.value).then(n=>t.innerType._zod.run({value:n,issues:[]},i))}),eg=k("$ZodLazy",(e,t)=>{ne.init(e,t),se(e._zod,"innerType",()=>{const r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),se(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),se(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),se(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),se(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,i)=>e._zod.innerType._zod.run(r,i)}),tg=k("$ZodCustom",(e,t)=>{$e.init(e,t),ne.init(e,t),e._zod.parse=(r,i)=>r,e._zod.check=r=>{const i=r.value,n=t.fn(i);if(n instanceof Promise)return n.then(o=>Ed(o,r,i,e));Ed(n,r,i,e)}});function Ed(e,t,r,i){if(!e){const n={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(n.params=i._zod.def.params),t.issues.push(Tn(n))}}var aI=()=>{const e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function t(n){return e[n]??null}const r={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`مدخلات غير مقبولة: يفترض إدخال instanceof ${n.expected}، ولكن تم إدخال ${s}`:`مدخلات غير مقبولة: يفترض إدخال ${o}، ولكن تم إدخال ${s}`}case"invalid_value":return n.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${K(n.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?` أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${o} ${n.maximum.toString()} ${a.unit??"عنصر"}`:`أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${o} ${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${o} ${n.minimum.toString()} ${a.unit}`:`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${o} ${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`نَص غير مقبول: يجب أن يبدأ بـ "${n.prefix}"`:o.format==="ends_with"?`نَص غير مقبول: يجب أن ينتهي بـ "${o.suffix}"`:o.format==="includes"?`نَص غير مقبول: يجب أن يتضمَّن "${o.includes}"`:o.format==="regex"?`نَص غير مقبول: يجب أن يطابق النمط ${o.pattern}`:`${r[o.format]??n.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${n.divisor}`;case"unrecognized_keys":return`معرف${n.keys.length>1?"ات":""} غريب${n.keys.length>1?"ة":""}: ${E(n.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${n.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${n.origin}`;default:return"مدخل غير مقبول"}}};function sI(){return{localeError:aI()}}var uI=()=>{const e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function t(n){return e[n]??null}const r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Yanlış dəyər: gözlənilən instanceof ${n.expected}, daxil olan ${s}`:`Yanlış dəyər: gözlənilən ${o}, daxil olan ${s}`}case"invalid_value":return n.values.length===1?`Yanlış dəyər: gözlənilən ${K(n.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${o}${n.maximum.toString()} ${a.unit??"element"}`:`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Çox kiçik: gözlənilən ${n.origin} ${o}${n.minimum.toString()} ${a.unit}`:`Çox kiçik: gözlənilən ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Yanlış mətn: "${o.prefix}" ilə başlamalıdır`:o.format==="ends_with"?`Yanlış mətn: "${o.suffix}" ilə bitməlidir`:o.format==="includes"?`Yanlış mətn: "${o.includes}" daxil olmalıdır`:o.format==="regex"?`Yanlış mətn: ${o.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${r[o.format]??n.format}`}case"not_multiple_of":return`Yanlış ədəd: ${n.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${n.keys.length>1?"lar":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${n.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function lI(){return{localeError:uI()}}function Cd(e,t,r,i){const n=Math.abs(e),o=n%10,a=n%100;return a>=11&&a<=19?i:o===1?t:o>=2&&o<=4?r:i}var cI=()=>{const e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function t(n){return e[n]??null}const r={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"},i={nan:"NaN",number:"лік",array:"масіў"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Няправільны ўвод: чакаўся instanceof ${n.expected}, атрымана ${s}`:`Няправільны ўвод: чакаўся ${o}, атрымана ${s}`}case"invalid_value":return n.values.length===1?`Няправільны ўвод: чакалася ${K(n.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);if(a){const s=Cd(Number(n.maximum),a.unit.one,a.unit.few,a.unit.many);return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна ${a.verb} ${o}${n.maximum.toString()} ${s}`}return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна быць ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);if(a){const s=Cd(Number(n.minimum),a.unit.one,a.unit.few,a.unit.many);return`Занадта малы: чакалася, што ${n.origin} павінна ${a.verb} ${o}${n.minimum.toString()} ${s}`}return`Занадта малы: чакалася, што ${n.origin} павінна быць ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Няправільны радок: павінен пачынацца з "${o.prefix}"`:o.format==="ends_with"?`Няправільны радок: павінен заканчвацца на "${o.suffix}"`:o.format==="includes"?`Няправільны радок: павінен змяшчаць "${o.includes}"`:o.format==="regex"?`Няправільны радок: павінен адпавядаць шаблону ${o.pattern}`:`Няправільны ${r[o.format]??n.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${n.keys.length>1?"ключы":"ключ"}: ${E(n.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${n.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${n.origin}`;default:return"Няправільны ўвод"}}};function dI(){return{localeError:cI()}}var fI=()=>{const e={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function t(n){return e[n]??null}const r={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"},i={nan:"NaN",number:"число",array:"масив"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Невалиден вход: очакван instanceof ${n.expected}, получен ${s}`:`Невалиден вход: очакван ${o}, получен ${s}`}case"invalid_value":return n.values.length===1?`Невалиден вход: очакван ${K(n.values[0])}`:`Невалидна опция: очаквано едно от ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Твърде голямо: очаква се ${n.origin??"стойност"} да съдържа ${o}${n.maximum.toString()} ${a.unit??"елемента"}`:`Твърде голямо: очаква се ${n.origin??"стойност"} да бъде ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Твърде малко: очаква се ${n.origin} да съдържа ${o}${n.minimum.toString()} ${a.unit}`:`Твърде малко: очаква се ${n.origin} да бъде ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;if(o.format==="starts_with")return`Невалиден низ: трябва да започва с "${o.prefix}"`;if(o.format==="ends_with")return`Невалиден низ: трябва да завършва с "${o.suffix}"`;if(o.format==="includes")return`Невалиден низ: трябва да включва "${o.includes}"`;if(o.format==="regex")return`Невалиден низ: трябва да съвпада с ${o.pattern}`;let a="Невалиден";return o.format==="emoji"&&(a="Невалидно"),o.format==="datetime"&&(a="Невалидно"),o.format==="date"&&(a="Невалидна"),o.format==="time"&&(a="Невалидно"),o.format==="duration"&&(a="Невалидна"),`${a} ${r[o.format]??n.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${n.divisor}`;case"unrecognized_keys":return`Неразпознат${n.keys.length>1?"и":""} ключ${n.keys.length>1?"ове":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${n.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${n.origin}`;default:return"Невалиден вход"}}};function mI(){return{localeError:fI()}}var pI=()=>{const e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(n){return e[n]??null}const r={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Tipus invàlid: s'esperava instanceof ${n.expected}, s'ha rebut ${s}`:`Tipus invàlid: s'esperava ${o}, s'ha rebut ${s}`}case"invalid_value":return n.values.length===1?`Valor invàlid: s'esperava ${K(n.values[0])}`:`Opció invàlida: s'esperava una de ${E(n.values," o ")}`;case"too_big":{const o=n.inclusive?"com a màxim":"menys de",a=t(n.origin);return a?`Massa gran: s'esperava que ${n.origin??"el valor"} contingués ${o} ${n.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${o} ${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?"com a mínim":"més de",a=t(n.origin);return a?`Massa petit: s'esperava que ${n.origin} contingués ${o} ${n.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${o} ${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Format invàlid: ha de començar amb "${o.prefix}"`:o.format==="ends_with"?`Format invàlid: ha d'acabar amb "${o.suffix}"`:o.format==="includes"?`Format invàlid: ha d'incloure "${o.includes}"`:o.format==="regex"?`Format invàlid: ha de coincidir amb el patró ${o.pattern}`:`Format invàlid per a ${r[o.format]??n.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${n.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${n.origin}`;default:return"Entrada invàlida"}}};function hI(){return{localeError:pI()}}var vI=()=>{const e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function t(n){return e[n]??null}const r={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"},i={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Neplatný vstup: očekáváno instanceof ${n.expected}, obdrženo ${s}`:`Neplatný vstup: očekáváno ${o}, obdrženo ${s}`}case"invalid_value":return n.values.length===1?`Neplatný vstup: očekáváno ${K(n.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Hodnota je příliš velká: ${n.origin??"hodnota"} musí mít ${o}${n.maximum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš velká: ${n.origin??"hodnota"} musí být ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Hodnota je příliš malá: ${n.origin??"hodnota"} musí mít ${o}${n.minimum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš malá: ${n.origin??"hodnota"} musí být ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Neplatný řetězec: musí začínat na "${o.prefix}"`:o.format==="ends_with"?`Neplatný řetězec: musí končit na "${o.suffix}"`:o.format==="includes"?`Neplatný řetězec: musí obsahovat "${o.includes}"`:o.format==="regex"?`Neplatný řetězec: musí odpovídat vzoru ${o.pattern}`:`Neplatný formát ${r[o.format]??n.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${n.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${E(n.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${n.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${n.origin}`;default:return"Neplatný vstup"}}};function gI(){return{localeError:vI()}}var bI=()=>{const e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function t(n){return e[n]??null}const r={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},i={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Ugyldigt input: forventede instanceof ${n.expected}, fik ${s}`:`Ugyldigt input: forventede ${o}, fik ${s}`}case"invalid_value":return n.values.length===1?`Ugyldig værdi: forventede ${K(n.values[0])}`:`Ugyldigt valg: forventede en af følgende ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin),s=i[n.origin]??n.origin;return a?`For stor: forventede ${s??"value"} ${a.verb} ${o} ${n.maximum.toString()} ${a.unit??"elementer"}`:`For stor: forventede ${s??"value"} havde ${o} ${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin),s=i[n.origin]??n.origin;return a?`For lille: forventede ${s} ${a.verb} ${o} ${n.minimum.toString()} ${a.unit}`:`For lille: forventede ${s} havde ${o} ${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Ugyldig streng: skal starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: skal ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: skal indeholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: skal matche mønsteret ${o.pattern}`:`Ugyldig ${r[o.format]??n.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${E(n.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${n.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${n.origin}`;default:return"Ugyldigt input"}}};function yI(){return{localeError:bI()}}var _I=()=>{const e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(n){return e[n]??null}const r={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},i={nan:"NaN",number:"Zahl",array:"Array"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Ungültige Eingabe: erwartet instanceof ${n.expected}, erhalten ${s}`:`Ungültige Eingabe: erwartet ${o}, erhalten ${s}`}case"invalid_value":return n.values.length===1?`Ungültige Eingabe: erwartet ${K(n.values[0])}`:`Ungültige Option: erwartet eine von ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Zu groß: erwartet, dass ${n.origin??"Wert"} ${o}${n.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu groß: erwartet, dass ${n.origin??"Wert"} ${o}${n.maximum.toString()} ist`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Zu klein: erwartet, dass ${n.origin} ${o}${n.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${o}${n.minimum.toString()} ist`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Ungültiger String: muss mit "${o.prefix}" beginnen`:o.format==="ends_with"?`Ungültiger String: muss mit "${o.suffix}" enden`:o.format==="includes"?`Ungültiger String: muss "${o.includes}" enthalten`:o.format==="regex"?`Ungültiger String: muss dem Muster ${o.pattern} entsprechen`:`Ungültig: ${r[o.format]??n.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${E(n.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${n.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${n.origin}`;default:return"Ungültige Eingabe"}}};function $I(){return{localeError:_I()}}var xI=()=>{const e={string:{unit:"χαρακτήρες",verb:"να έχει"},file:{unit:"bytes",verb:"να έχει"},array:{unit:"στοιχεία",verb:"να έχει"},set:{unit:"στοιχεία",verb:"να έχει"},map:{unit:"καταχωρήσεις",verb:"να έχει"}};function t(n){return e[n]??null}const r={regex:"είσοδος",email:"διεύθυνση email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ημερομηνία και ώρα",date:"ISO ημερομηνία",time:"ISO ώρα",duration:"ISO διάρκεια",ipv4:"διεύθυνση IPv4",ipv6:"διεύθυνση IPv6",mac:"διεύθυνση MAC",cidrv4:"εύρος IPv4",cidrv6:"εύρος IPv6",base64:"συμβολοσειρά κωδικοποιημένη σε base64",base64url:"συμβολοσειρά κωδικοποιημένη σε base64url",json_string:"συμβολοσειρά JSON",e164:"αριθμός E.164",jwt:"JWT",template_literal:"είσοδος"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return typeof n.expected=="string"&&/^[A-Z]/.test(n.expected)?`Μη έγκυρη είσοδος: αναμενόταν instanceof ${n.expected}, λήφθηκε ${s}`:`Μη έγκυρη είσοδος: αναμενόταν ${o}, λήφθηκε ${s}`}case"invalid_value":return n.values.length===1?`Μη έγκυρη είσοδος: αναμενόταν ${K(n.values[0])}`:`Μη έγκυρη επιλογή: αναμενόταν ένα από ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Πολύ μεγάλο: αναμενόταν ${n.origin??"τιμή"} να έχει ${o}${n.maximum.toString()} ${a.unit??"στοιχεία"}`:`Πολύ μεγάλο: αναμενόταν ${n.origin??"τιμή"} να είναι ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Πολύ μικρό: αναμενόταν ${n.origin} να έχει ${o}${n.minimum.toString()} ${a.unit}`:`Πολύ μικρό: αναμενόταν ${n.origin} να είναι ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Μη έγκυρη συμβολοσειρά: πρέπει να ξεκινά με "${o.prefix}"`:o.format==="ends_with"?`Μη έγκυρη συμβολοσειρά: πρέπει να τελειώνει με "${o.suffix}"`:o.format==="includes"?`Μη έγκυρη συμβολοσειρά: πρέπει να περιέχει "${o.includes}"`:o.format==="regex"?`Μη έγκυρη συμβολοσειρά: πρέπει να ταιριάζει με το μοτίβο ${o.pattern}`:`Μη έγκυρο: ${r[o.format]??n.format}`}case"not_multiple_of":return`Μη έγκυρος αριθμός: πρέπει να είναι πολλαπλάσιο του ${n.divisor}`;case"unrecognized_keys":return`Άγνωστ${n.keys.length>1?"α":"ο"} κλειδ${n.keys.length>1?"ιά":"ί"}: ${E(n.keys,", ")}`;case"invalid_key":return`Μη έγκυρο κλειδί στο ${n.origin}`;case"invalid_union":return"Μη έγκυρη είσοδος";case"invalid_element":return`Μη έγκυρη τιμή στο ${n.origin}`;default:return"Μη έγκυρη είσοδος"}}};function SI(){return{localeError:xI()}}var wI=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[n]??null}const r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input);return`Invalid input: expected ${o}, received ${i[a]??a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${K(n.values[0])}`:`Invalid option: expected one of ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${a.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(o=>`'${o}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function ng(){return{localeError:wI()}}var kI=()=>{const e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(n){return e[n]??null}const r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},i={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Nevalida enigo: atendiĝis instanceof ${n.expected}, riceviĝis ${s}`:`Nevalida enigo: atendiĝis ${o}, riceviĝis ${s}`}case"invalid_value":return n.values.length===1?`Nevalida enigo: atendiĝis ${K(n.values[0])}`:`Nevalida opcio: atendiĝis unu el ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Tro granda: atendiĝis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()} ${a.unit??"elementojn"}`:`Tro granda: atendiĝis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Tro malgranda: atendiĝis ke ${n.origin} havu ${o}${n.minimum.toString()} ${a.unit}`:`Tro malgranda: atendiĝis ke ${n.origin} estu ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Nevalida karaktraro: devas komenciĝi per "${o.prefix}"`:o.format==="ends_with"?`Nevalida karaktraro: devas finiĝi per "${o.suffix}"`:o.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${o.includes}"`:o.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${o.pattern}`:`Nevalida ${r[o.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} ŝlosilo${n.keys.length>1?"j":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}};function II(){return{localeError:kI()}}var jI=()=>{const e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(n){return e[n]??null}const r={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},i={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Entrada inválida: se esperaba instanceof ${n.expected}, recibido ${s}`:`Entrada inválida: se esperaba ${o}, recibido ${s}`}case"invalid_value":return n.values.length===1?`Entrada inválida: se esperaba ${K(n.values[0])}`:`Opción inválida: se esperaba una de ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin),s=i[n.origin]??n.origin;return a?`Demasiado grande: se esperaba que ${s??"valor"} tuviera ${o}${n.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${s??"valor"} fuera ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin),s=i[n.origin]??n.origin;return a?`Demasiado pequeño: se esperaba que ${s} tuviera ${o}${n.minimum.toString()} ${a.unit}`:`Demasiado pequeño: se esperaba que ${s} fuera ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Cadena inválida: debe comenzar con "${o.prefix}"`:o.format==="ends_with"?`Cadena inválida: debe terminar en "${o.suffix}"`:o.format==="includes"?`Cadena inválida: debe incluir "${o.includes}"`:o.format==="regex"?`Cadena inválida: debe coincidir con el patrón ${o.pattern}`:`Inválido ${r[o.format]??n.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Llave inválida en ${i[n.origin]??n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${i[n.origin]??n.origin}`;default:return"Entrada inválida"}}};function TI(){return{localeError:jI()}}var PI=()=>{const e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function t(n){return e[n]??null}const r={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"},i={nan:"NaN",number:"عدد",array:"آرایه"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`ورودی نامعتبر: می‌بایست instanceof ${n.expected} می‌بود، ${s} دریافت شد`:`ورودی نامعتبر: می‌بایست ${o} می‌بود، ${s} دریافت شد`}case"invalid_value":return n.values.length===1?`ورودی نامعتبر: می‌بایست ${K(n.values[0])} می‌بود`:`گزینه نامعتبر: می‌بایست یکی از ${E(n.values,"|")} می‌بود`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`خیلی بزرگ: ${n.origin??"مقدار"} باید ${o}${n.maximum.toString()} ${a.unit??"عنصر"} باشد`:`خیلی بزرگ: ${n.origin??"مقدار"} باید ${o}${n.maximum.toString()} باشد`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`خیلی کوچک: ${n.origin} باید ${o}${n.minimum.toString()} ${a.unit} باشد`:`خیلی کوچک: ${n.origin} باید ${o}${n.minimum.toString()} باشد`}case"invalid_format":{const o=n;return o.format==="starts_with"?`رشته نامعتبر: باید با "${o.prefix}" شروع شود`:o.format==="ends_with"?`رشته نامعتبر: باید با "${o.suffix}" تمام شود`:o.format==="includes"?`رشته نامعتبر: باید شامل "${o.includes}" باشد`:o.format==="regex"?`رشته نامعتبر: باید با الگوی ${o.pattern} مطابقت داشته باشد`:`${r[o.format]??n.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${n.divisor} باشد`;case"unrecognized_keys":return`کلید${n.keys.length>1?"های":""} ناشناس: ${E(n.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${n.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${n.origin}`;default:return"ورودی نامعتبر"}}};function OI(){return{localeError:PI()}}var DI=()=>{const e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function t(n){return e[n]??null}const r={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Virheellinen tyyppi: odotettiin instanceof ${n.expected}, oli ${s}`:`Virheellinen tyyppi: odotettiin ${o}, oli ${s}`}case"invalid_value":return n.values.length===1?`Virheellinen syöte: täytyy olla ${K(n.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Liian suuri: ${a.subject} täytyy olla ${o}${n.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon täytyy olla ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Liian pieni: ${a.subject} täytyy olla ${o}${n.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon täytyy olla ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Virheellinen syöte: täytyy alkaa "${o.prefix}"`:o.format==="ends_with"?`Virheellinen syöte: täytyy loppua "${o.suffix}"`:o.format==="includes"?`Virheellinen syöte: täytyy sisältää "${o.includes}"`:o.format==="regex"?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${o.pattern}`:`Virheellinen ${r[o.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${E(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function zI(){return{localeError:DI()}}var EI=()=>{const e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(n){return e[n]??null}const r={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},i={string:"chaîne",number:"nombre",int:"entier",boolean:"booléen",bigint:"grand entier",symbol:"symbole",undefined:"indéfini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Entrée invalide : instanceof ${n.expected} attendu, ${s} reçu`:`Entrée invalide : ${o} attendu, ${s} reçu`}case"invalid_value":return n.values.length===1?`Entrée invalide : ${K(n.values[0])} attendu`:`Option invalide : une valeur parmi ${E(n.values,"|")} attendue`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Trop grand : ${i[n.origin]??"valeur"} doit ${a.verb} ${o}${n.maximum.toString()} ${a.unit??"élément(s)"}`:`Trop grand : ${i[n.origin]??"valeur"} doit être ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Trop petit : ${i[n.origin]??"valeur"} doit ${a.verb} ${o}${n.minimum.toString()} ${a.unit}`:`Trop petit : ${i[n.origin]??"valeur"} doit être ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Chaîne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Chaîne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Chaîne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Chaîne invalide : doit correspondre au modèle ${o.pattern}`:`${r[o.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${E(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function CI(){return{localeError:EI()}}var AI=()=>{const e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(n){return e[n]??null}const r={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Entrée invalide : attendu instanceof ${n.expected}, reçu ${s}`:`Entrée invalide : attendu ${o}, reçu ${s}`}case"invalid_value":return n.values.length===1?`Entrée invalide : attendu ${K(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"≤":"<",a=t(n.origin);return a?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${o}${n.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?"≥":">",a=t(n.origin);return a?`Trop petit : attendu que ${n.origin} ait ${o}${n.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${n.origin} soit ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Chaîne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Chaîne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Chaîne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Chaîne invalide : doit correspondre au motif ${o.pattern}`:`${r[o.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${E(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function NI(){return{localeError:AI()}}var VI=()=>{const e={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},t={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},r=l=>l?e[l]:void 0,i=l=>{const c=r(l);return c?c.label:l??e.unknown.label},n=l=>`ה${i(l)}`,o=l=>(r(l)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות",a=l=>l?t[l]??null:null,s={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},u={nan:"NaN"};return l=>{switch(l.code){case"invalid_type":{const c=l.expected,d=u[c??""]??i(c),m=Y(l.input),h=u[m]??e[m]?.label??m;return/^[A-Z]/.test(l.expected)?`קלט לא תקין: צריך להיות instanceof ${l.expected}, התקבל ${h}`:`קלט לא תקין: צריך להיות ${d}, התקבל ${h}`}case"invalid_value":{if(l.values.length===1)return`ערך לא תקין: הערך חייב להיות ${K(l.values[0])}`;const c=l.values.map(m=>K(m));if(l.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${c[0]} או ${c[1]}`;const d=c[c.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${c.slice(0,-1).join(", ")} או ${d}`}case"too_big":{const c=a(l.origin),d=n(l.origin??"value");if(l.origin==="string")return`${c?.longLabel??"ארוך"} מדי: ${d} צריכה להכיל ${l.maximum.toString()} ${c?.unit??""} ${l.inclusive?"או פחות":"לכל היותר"}`.trim();if(l.origin==="number")return`גדול מדי: ${d} צריך להיות ${l.inclusive?`קטן או שווה ל-${l.maximum}`:`קטן מ-${l.maximum}`}`;if(l.origin==="array"||l.origin==="set")return`גדול מדי: ${d} ${l.origin==="set"?"צריכה":"צריך"} להכיל ${l.inclusive?`${l.maximum} ${c?.unit??""} או פחות`:`פחות מ-${l.maximum} ${c?.unit??""}`}`.trim();const m=l.inclusive?"<=":"<",h=o(l.origin??"value");return c?.unit?`${c.longLabel} מדי: ${d} ${h} ${m}${l.maximum.toString()} ${c.unit}`:`${c?.longLabel??"גדול"} מדי: ${d} ${h} ${m}${l.maximum.toString()}`}case"too_small":{const c=a(l.origin),d=n(l.origin??"value");if(l.origin==="string")return`${c?.shortLabel??"קצר"} מדי: ${d} צריכה להכיל ${l.minimum.toString()} ${c?.unit??""} ${l.inclusive?"או יותר":"לפחות"}`.trim();if(l.origin==="number")return`קטן מדי: ${d} צריך להיות ${l.inclusive?`גדול או שווה ל-${l.minimum}`:`גדול מ-${l.minimum}`}`;if(l.origin==="array"||l.origin==="set"){const v=l.origin==="set"?"צריכה":"צריך";return l.minimum===1&&l.inclusive?`קטן מדי: ${d} ${v} להכיל ${l.origin==="set","לפחות פריט אחד"}`:`קטן מדי: ${d} ${v} להכיל ${l.inclusive?`${l.minimum} ${c?.unit??""} או יותר`:`יותר מ-${l.minimum} ${c?.unit??""}`}`.trim()}const m=l.inclusive?">=":">",h=o(l.origin??"value");return c?.unit?`${c.shortLabel} מדי: ${d} ${h} ${m}${l.minimum.toString()} ${c.unit}`:`${c?.shortLabel??"קטן"} מדי: ${d} ${h} ${m}${l.minimum.toString()}`}case"invalid_format":{const c=l;if(c.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${c.prefix}"`;if(c.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${c.suffix}"`;if(c.format==="includes")return`המחרוזת חייבת לכלול "${c.includes}"`;if(c.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${c.pattern}`;const d=s[c.format];return`${d?.label??c.format} לא ${(d?.gender??"m")==="f"?"תקינה":"תקין"}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${l.divisor}`;case"unrecognized_keys":return`מפתח${l.keys.length>1?"ות":""} לא מזוה${l.keys.length>1?"ים":"ה"}: ${E(l.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${n(l.origin??"array")}`;default:return"קלט לא תקין"}}};function UI(){return{localeError:VI()}}var MI=()=>{const e={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function t(n){return e[n]??null}const r={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},i={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Neispravan unos: očekuje se instanceof ${n.expected}, a primljeno je ${s}`:`Neispravan unos: očekuje se ${o}, a primljeno je ${s}`}case"invalid_value":return n.values.length===1?`Neispravna vrijednost: očekivano ${K(n.values[0])}`:`Neispravna opcija: očekivano jedno od ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin),s=i[n.origin]??n.origin;return a?`Preveliko: očekivano da ${s??"vrijednost"} ima ${o}${n.maximum.toString()} ${a.unit??"elemenata"}`:`Preveliko: očekivano da ${s??"vrijednost"} bude ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin),s=i[n.origin]??n.origin;return a?`Premalo: očekivano da ${s} ima ${o}${n.minimum.toString()} ${a.unit}`:`Premalo: očekivano da ${s} bude ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Neispravan tekst: mora započinjati s "${o.prefix}"`:o.format==="ends_with"?`Neispravan tekst: mora završavati s "${o.suffix}"`:o.format==="includes"?`Neispravan tekst: mora sadržavati "${o.includes}"`:o.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${o.pattern}`:`Neispravna ${r[o.format]??n.format}`}case"not_multiple_of":return`Neispravan broj: mora biti višekratnik od ${n.divisor}`;case"unrecognized_keys":return`Neprepoznat${n.keys.length>1?"i ključevi":" ključ"}: ${E(n.keys,", ")}`;case"invalid_key":return`Neispravan ključ u ${i[n.origin]??n.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${i[n.origin]??n.origin}`;default:return"Neispravan unos"}}};function RI(){return{localeError:MI()}}var FI=()=>{const e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(n){return e[n]??null}const r={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"},i={nan:"NaN",number:"szám",array:"tömb"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Érvénytelen bemenet: a várt érték instanceof ${n.expected}, a kapott érték ${s}`:`Érvénytelen bemenet: a várt érték ${o}, a kapott érték ${s}`}case"invalid_value":return n.values.length===1?`Érvénytelen bemenet: a várt érték ${K(n.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Túl nagy: ${n.origin??"érték"} mérete túl nagy ${o}${n.maximum.toString()} ${a.unit??"elem"}`:`Túl nagy: a bemeneti érték ${n.origin??"érték"} túl nagy: ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Túl kicsi: a bemeneti érték ${n.origin} mérete túl kicsi ${o}${n.minimum.toString()} ${a.unit}`:`Túl kicsi: a bemeneti érték ${n.origin} túl kicsi ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Érvénytelen string: "${o.prefix}" értékkel kell kezdődnie`:o.format==="ends_with"?`Érvénytelen string: "${o.suffix}" értékkel kell végződnie`:o.format==="includes"?`Érvénytelen string: "${o.includes}" értéket kell tartalmaznia`:o.format==="regex"?`Érvénytelen string: ${o.pattern} mintának kell megfelelnie`:`Érvénytelen ${r[o.format]??n.format}`}case"not_multiple_of":return`Érvénytelen szám: ${n.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${n.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${n.origin}`;default:return"Érvénytelen bemenet"}}};function LI(){return{localeError:FI()}}function Ad(e,t,r){return Math.abs(e)===1?t:r}function bn(e){if(!e)return"";const t=["ա","ե","ը","ի","ո","ու","օ"],r=e[e.length-1];return e+(t.includes(r)?"ն":"ը")}var ZI=()=>{const e={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}};function t(n){return e[n]??null}const r={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",jwt:"JWT",template_literal:"մուտք"},i={nan:"NaN",number:"թիվ",array:"զանգված"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Սխալ մուտքագրում․ սպասվում էր instanceof ${n.expected}, ստացվել է ${s}`:`Սխալ մուտքագրում․ սպասվում էր ${o}, ստացվել է ${s}`}case"invalid_value":return n.values.length===1?`Սխալ մուտքագրում․ սպասվում էր ${K(n.values[1])}`:`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);if(a){const s=Ad(Number(n.maximum),a.unit.one,a.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${bn(n.origin??"արժեք")} կունենա ${o}${n.maximum.toString()} ${s}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${bn(n.origin??"արժեք")} լինի ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);if(a){const s=Ad(Number(n.minimum),a.unit.one,a.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${bn(n.origin)} կունենա ${o}${n.minimum.toString()} ${s}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${bn(n.origin)} լինի ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Սխալ տող․ պետք է սկսվի "${o.prefix}"-ով`:o.format==="ends_with"?`Սխալ տող․ պետք է ավարտվի "${o.suffix}"-ով`:o.format==="includes"?`Սխալ տող․ պետք է պարունակի "${o.includes}"`:o.format==="regex"?`Սխալ տող․ պետք է համապատասխանի ${o.pattern} ձևաչափին`:`Սխալ ${r[o.format]??n.format}`}case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${n.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${n.keys.length>1?"ներ":""}. ${E(n.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${bn(n.origin)}-ում`;case"invalid_union":return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${bn(n.origin)}-ում`;default:return"Սխալ մուտքագրում"}}};function BI(){return{localeError:ZI()}}var WI=()=>{const e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(n){return e[n]??null}const r={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Input tidak valid: diharapkan instanceof ${n.expected}, diterima ${s}`:`Input tidak valid: diharapkan ${o}, diterima ${s}`}case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${K(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${o}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Terlalu kecil: diharapkan ${n.origin} memiliki ${o}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`String tidak valid: harus dimulai dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak valid: harus berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak valid: harus menyertakan "${o.includes}"`:o.format==="regex"?`String tidak valid: harus sesuai pola ${o.pattern}`:`${r[o.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function HI(){return{localeError:WI()}}var JI=()=>{const e={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function t(n){return e[n]??null}const r={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"},i={nan:"NaN",number:"númer",array:"fylki"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Rangt gildi: Þú slóst inn ${s} þar sem á að vera instanceof ${n.expected}`:`Rangt gildi: Þú slóst inn ${s} þar sem á að vera ${o}`}case"invalid_value":return n.values.length===1?`Rangt gildi: gert ráð fyrir ${K(n.values[0])}`:`Ógilt val: má vera eitt af eftirfarandi ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Of stórt: gert er ráð fyrir að ${n.origin??"gildi"} hafi ${o}${n.maximum.toString()} ${a.unit??"hluti"}`:`Of stórt: gert er ráð fyrir að ${n.origin??"gildi"} sé ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Of lítið: gert er ráð fyrir að ${n.origin} hafi ${o}${n.minimum.toString()} ${a.unit}`:`Of lítið: gert er ráð fyrir að ${n.origin} sé ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Ógildur strengur: verður að byrja á "${o.prefix}"`:o.format==="ends_with"?`Ógildur strengur: verður að enda á "${o.suffix}"`:o.format==="includes"?`Ógildur strengur: verður að innihalda "${o.includes}"`:o.format==="regex"?`Ógildur strengur: verður að fylgja mynstri ${o.pattern}`:`Rangt ${r[o.format]??n.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`Óþekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${E(n.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${n.origin}`;default:return"Rangt gildi"}}};function GI(){return{localeError:JI()}}var KI=()=>{const e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(n){return e[n]??null}const r={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"numero",array:"vettore"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Input non valido: atteso instanceof ${n.expected}, ricevuto ${s}`:`Input non valido: atteso ${o}, ricevuto ${s}`}case"invalid_value":return n.values.length===1?`Input non valido: atteso ${K(n.values[0])}`:`Opzione non valida: atteso uno tra ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Troppo grande: ${n.origin??"valore"} deve avere ${o}${n.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Troppo piccolo: ${n.origin} deve avere ${o}${n.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${n.origin} deve essere ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Stringa non valida: deve iniziare con "${o.prefix}"`:o.format==="ends_with"?`Stringa non valida: deve terminare con "${o.suffix}"`:o.format==="includes"?`Stringa non valida: deve includere "${o.includes}"`:o.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${o.pattern}`:`Input non valido: ${r[o.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${E(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function XI(){return{localeError:KI()}}var qI=()=>{const e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function t(n){return e[n]??null}const r={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"},i={nan:"NaN",number:"数値",array:"配列"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`無効な入力: instanceof ${n.expected}が期待されましたが、${s}が入力されました`:`無効な入力: ${o}が期待されましたが、${s}が入力されました`}case"invalid_value":return n.values.length===1?`無効な入力: ${K(n.values[0])}が期待されました`:`無効な選択: ${E(n.values,"、")}のいずれかである必要があります`;case"too_big":{const o=n.inclusive?"以下である":"より小さい",a=t(n.origin);return a?`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${a.unit??"要素"}${o}必要があります`:`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${o}必要があります`}case"too_small":{const o=n.inclusive?"以上である":"より大きい",a=t(n.origin);return a?`小さすぎる値: ${n.origin}は${n.minimum.toString()}${a.unit}${o}必要があります`:`小さすぎる値: ${n.origin}は${n.minimum.toString()}${o}必要があります`}case"invalid_format":{const o=n;return o.format==="starts_with"?`無効な文字列: "${o.prefix}"で始まる必要があります`:o.format==="ends_with"?`無効な文字列: "${o.suffix}"で終わる必要があります`:o.format==="includes"?`無効な文字列: "${o.includes}"を含む必要があります`:o.format==="regex"?`無効な文字列: パターン${o.pattern}に一致する必要があります`:`無効な${r[o.format]??n.format}`}case"not_multiple_of":return`無効な数値: ${n.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${n.keys.length>1?"群":""}: ${E(n.keys,"、")}`;case"invalid_key":return`${n.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${n.origin}内の無効な値`;default:return"無効な入力"}}};function YI(){return{localeError:qI()}}var QI=()=>{const e={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function t(n){return e[n]??null}const r={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული ველი",base64url:"base64url-კოდირებული ველი",json_string:"JSON ველი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"},i={nan:"NaN",number:"რიცხვი",string:"ველი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`არასწორი შეყვანა: მოსალოდნელი instanceof ${n.expected}, მიღებული ${s}`:`არასწორი შეყვანა: მოსალოდნელი ${o}, მიღებული ${s}`}case"invalid_value":return n.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${K(n.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${E(n.values,"|")}-დან`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`ზედმეტად დიდი: მოსალოდნელი ${n.origin??"მნიშვნელობა"} ${a.verb} ${o}${n.maximum.toString()} ${a.unit}`:`ზედმეტად დიდი: მოსალოდნელი ${n.origin??"მნიშვნელობა"} იყოს ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`ზედმეტად პატარა: მოსალოდნელი ${n.origin} ${a.verb} ${o}${n.minimum.toString()} ${a.unit}`:`ზედმეტად პატარა: მოსალოდნელი ${n.origin} იყოს ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`არასწორი ველი: უნდა იწყებოდეს "${o.prefix}"-ით`:o.format==="ends_with"?`არასწორი ველი: უნდა მთავრდებოდეს "${o.suffix}"-ით`:o.format==="includes"?`არასწორი ველი: უნდა შეიცავდეს "${o.includes}"-ს`:o.format==="regex"?`არასწორი ველი: უნდა შეესაბამებოდეს შაბლონს ${o.pattern}`:`არასწორი ${r[o.format]??n.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${n.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${n.keys.length>1?"ები":"ი"}: ${E(n.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${n.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${n.origin}-ში`;default:return"არასწორი შეყვანა"}}};function e1(){return{localeError:QI()}}var t1=()=>{const e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function t(n){return e[n]??null}const r={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},i={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${n.expected} ប៉ុន្តែទទួលបាន ${s}`:`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${o} ប៉ុន្តែទទួលបាន ${s}`}case"invalid_value":return n.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${K(n.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${o} ${n.maximum.toString()} ${a.unit??"ធាតុ"}`:`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${o} ${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`តូចពេក៖ ត្រូវការ ${n.origin} ${o} ${n.minimum.toString()} ${a.unit}`:`តូចពេក៖ ត្រូវការ ${n.origin} ${o} ${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${o.prefix}"`:o.format==="ends_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${o.suffix}"`:o.format==="includes"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${o.includes}"`:o.format==="regex"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${o.pattern}`:`មិនត្រឹមត្រូវ៖ ${r[o.format]??n.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${n.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${E(n.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function rg(){return{localeError:t1()}}function n1(){return rg()}var r1=()=>{const e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function t(n){return e[n]??null}const r={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`잘못된 입력: 예상 타입은 instanceof ${n.expected}, 받은 타입은 ${s}입니다`:`잘못된 입력: 예상 타입은 ${o}, 받은 타입은 ${s}입니다`}case"invalid_value":return n.values.length===1?`잘못된 입력: 값은 ${K(n.values[0])} 이어야 합니다`:`잘못된 옵션: ${E(n.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{const o=n.inclusive?"이하":"미만",a=o==="미만"?"이어야 합니다":"여야 합니다",s=t(n.origin),u=s?.unit??"요소";return s?`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()}${u} ${o}${a}`:`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()} ${o}${a}`}case"too_small":{const o=n.inclusive?"이상":"초과",a=o==="이상"?"이어야 합니다":"여야 합니다",s=t(n.origin),u=s?.unit??"요소";return s?`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()}${u} ${o}${a}`:`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()} ${o}${a}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`잘못된 문자열: "${o.prefix}"(으)로 시작해야 합니다`:o.format==="ends_with"?`잘못된 문자열: "${o.suffix}"(으)로 끝나야 합니다`:o.format==="includes"?`잘못된 문자열: "${o.includes}"을(를) 포함해야 합니다`:o.format==="regex"?`잘못된 문자열: 정규식 ${o.pattern} 패턴과 일치해야 합니다`:`잘못된 ${r[o.format]??n.format}`}case"not_multiple_of":return`잘못된 숫자: ${n.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${E(n.keys,", ")}`;case"invalid_key":return`잘못된 키: ${n.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${n.origin}`;default:return"잘못된 입력"}}};function i1(){return{localeError:r1()}}var Qn=e=>e.charAt(0).toUpperCase()+e.slice(1);function Nd(e){const t=Math.abs(e),r=t%10,i=t%100;return i>=11&&i<=19||r===0?"many":r===1?"one":"few"}var o1=()=>{const e={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function t(n,o,a,s){const u=e[n]??null;return u===null?u:{unit:u.unit[o],verb:u.verb[s][a?"inclusive":"notInclusive"]}}const r={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"},i={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Gautas tipas ${s}, o tikėtasi - instanceof ${n.expected}`:`Gautas tipas ${s}, o tikėtasi - ${o}`}case"invalid_value":return n.values.length===1?`Privalo būti ${K(n.values[0])}`:`Privalo būti vienas iš ${E(n.values,"|")} pasirinkimų`;case"too_big":{const o=i[n.origin]??n.origin,a=t(n.origin,Nd(Number(n.maximum)),n.inclusive??!1,"smaller");if(a?.verb)return`${Qn(o??n.origin??"reikšmė")} ${a.verb} ${n.maximum.toString()} ${a.unit??"elementų"}`;const s=n.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${Qn(o??n.origin??"reikšmė")} turi būti ${s} ${n.maximum.toString()} ${a?.unit}`}case"too_small":{const o=i[n.origin]??n.origin,a=t(n.origin,Nd(Number(n.minimum)),n.inclusive??!1,"bigger");if(a?.verb)return`${Qn(o??n.origin??"reikšmė")} ${a.verb} ${n.minimum.toString()} ${a.unit??"elementų"}`;const s=n.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${Qn(o??n.origin??"reikšmė")} turi būti ${s} ${n.minimum.toString()} ${a?.unit}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Eilutė privalo prasidėti "${o.prefix}"`:o.format==="ends_with"?`Eilutė privalo pasibaigti "${o.suffix}"`:o.format==="includes"?`Eilutė privalo įtraukti "${o.includes}"`:o.format==="regex"?`Eilutė privalo atitikti ${o.pattern}`:`Neteisingas ${r[o.format]??n.format}`}case"not_multiple_of":return`Skaičius privalo būti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${E(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{const o=i[n.origin]??n.origin;return`${Qn(o??n.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function a1(){return{localeError:o1()}}var s1=()=>{const e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function t(n){return e[n]??null}const r={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"},i={nan:"NaN",number:"број",array:"низа"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Грешен внес: се очекува instanceof ${n.expected}, примено ${s}`:`Грешен внес: се очекува ${o}, примено ${s}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${K(n.values[0])}`:`Грешана опција: се очекува една ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Премногу голем: се очекува ${n.origin??"вредноста"} да има ${o}${n.maximum.toString()} ${a.unit??"елементи"}`:`Премногу голем: се очекува ${n.origin??"вредноста"} да биде ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Премногу мал: се очекува ${n.origin} да има ${o}${n.minimum.toString()} ${a.unit}`:`Премногу мал: се очекува ${n.origin} да биде ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Неважечка низа: мора да започнува со "${o.prefix}"`:o.format==="ends_with"?`Неважечка низа: мора да завршува со "${o.suffix}"`:o.format==="includes"?`Неважечка низа: мора да вклучува "${o.includes}"`:o.format==="regex"?`Неважечка низа: мора да одгоара на патернот ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${E(n.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${n.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${n.origin}`;default:return"Грешен внес"}}};function u1(){return{localeError:s1()}}var l1=()=>{const e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(n){return e[n]??null}const r={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"nombor"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Input tidak sah: dijangka instanceof ${n.expected}, diterima ${s}`:`Input tidak sah: dijangka ${o}, diterima ${s}`}case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${K(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Terlalu besar: dijangka ${n.origin??"nilai"} ${a.verb} ${o}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Terlalu kecil: dijangka ${n.origin} ${a.verb} ${o}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`String tidak sah: mesti bermula dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak sah: mesti mengandungi "${o.includes}"`:o.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${o.pattern}`:`${r[o.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${E(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function c1(){return{localeError:l1()}}var d1=()=>{const e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function t(n){return e[n]??null}const r={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},i={nan:"NaN",number:"getal"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Ongeldige invoer: verwacht instanceof ${n.expected}, ontving ${s}`:`Ongeldige invoer: verwacht ${o}, ontving ${s}`}case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${K(n.values[0])}`:`Ongeldige optie: verwacht één van ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin),s=n.origin==="date"?"laat":n.origin==="string"?"lang":"groot";return a?`Te ${s}: verwacht dat ${n.origin??"waarde"} ${o}${n.maximum.toString()} ${a.unit??"elementen"} ${a.verb}`:`Te ${s}: verwacht dat ${n.origin??"waarde"} ${o}${n.maximum.toString()} is`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin),s=n.origin==="date"?"vroeg":n.origin==="string"?"kort":"klein";return a?`Te ${s}: verwacht dat ${n.origin} ${o}${n.minimum.toString()} ${a.unit} ${a.verb}`:`Te ${s}: verwacht dat ${n.origin} ${o}${n.minimum.toString()} is`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Ongeldige tekst: moet met "${o.prefix}" beginnen`:o.format==="ends_with"?`Ongeldige tekst: moet op "${o.suffix}" eindigen`:o.format==="includes"?`Ongeldige tekst: moet "${o.includes}" bevatten`:o.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${o.pattern}`:`Ongeldig: ${r[o.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function f1(){return{localeError:d1()}}var m1=()=>{const e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function t(n){return e[n]??null}const r={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"tall",array:"liste"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Ugyldig input: forventet instanceof ${n.expected}, fikk ${s}`:`Ugyldig input: forventet ${o}, fikk ${s}`}case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${K(n.values[0])}`:`Ugyldig valg: forventet en av ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`For stor(t): forventet ${n.origin??"value"} til å ha ${o}${n.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til å ha ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`For lite(n): forventet ${n.origin} til å ha ${o}${n.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${n.origin} til å ha ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Ugyldig streng: må starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: må ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: må inneholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: må matche mønsteret ${o.pattern}`:`Ugyldig ${r[o.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${E(n.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function p1(){return{localeError:m1()}}var h1=()=>{const e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function t(n){return e[n]??null}const r={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},i={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Fâsit giren: umulan instanceof ${n.expected}, alınan ${s}`:`Fâsit giren: umulan ${o}, alınan ${s}`}case"invalid_value":return n.values.length===1?`Fâsit giren: umulan ${K(n.values[0])}`:`Fâsit tercih: mûteberler ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Fazla büyük: ${n.origin??"value"}, ${o}${n.maximum.toString()} ${a.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${n.origin??"value"}, ${o}${n.maximum.toString()} olmalıydı.`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Fazla küçük: ${n.origin}, ${o}${n.minimum.toString()} ${a.unit} sahip olmalıydı.`:`Fazla küçük: ${n.origin}, ${o}${n.minimum.toString()} olmalıydı.`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Fâsit metin: "${o.prefix}" ile başlamalı.`:o.format==="ends_with"?`Fâsit metin: "${o.suffix}" ile bitmeli.`:o.format==="includes"?`Fâsit metin: "${o.includes}" ihtivâ etmeli.`:o.format==="regex"?`Fâsit metin: ${o.pattern} nakşına uymalı.`:`Fâsit ${r[o.format]??n.format}`}case"not_multiple_of":return`Fâsit sayı: ${n.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${n.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function v1(){return{localeError:h1()}}var g1=()=>{const e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function t(n){return e[n]??null}const r={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"},i={nan:"NaN",number:"عدد",array:"ارې"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`ناسم ورودي: باید instanceof ${n.expected} وای, مګر ${s} ترلاسه شو`:`ناسم ورودي: باید ${o} وای, مګر ${s} ترلاسه شو`}case"invalid_value":return n.values.length===1?`ناسم ورودي: باید ${K(n.values[0])} وای`:`ناسم انتخاب: باید یو له ${E(n.values,"|")} څخه وای`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`ډیر لوی: ${n.origin??"ارزښت"} باید ${o}${n.maximum.toString()} ${a.unit??"عنصرونه"} ولري`:`ډیر لوی: ${n.origin??"ارزښت"} باید ${o}${n.maximum.toString()} وي`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`ډیر کوچنی: ${n.origin} باید ${o}${n.minimum.toString()} ${a.unit} ولري`:`ډیر کوچنی: ${n.origin} باید ${o}${n.minimum.toString()} وي`}case"invalid_format":{const o=n;return o.format==="starts_with"?`ناسم متن: باید د "${o.prefix}" سره پیل شي`:o.format==="ends_with"?`ناسم متن: باید د "${o.suffix}" سره پای ته ورسيږي`:o.format==="includes"?`ناسم متن: باید "${o.includes}" ولري`:o.format==="regex"?`ناسم متن: باید د ${o.pattern} سره مطابقت ولري`:`${r[o.format]??n.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${n.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${n.keys.length>1?"کلیډونه":"کلیډ"}: ${E(n.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${n.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${n.origin} کې`;default:return"ناسمه ورودي"}}};function b1(){return{localeError:g1()}}var y1=()=>{const e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function t(n){return e[n]??null}const r={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"},i={nan:"NaN",number:"liczba",array:"tablica"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${n.expected}, otrzymano ${s}`:`Nieprawidłowe dane wejściowe: oczekiwano ${o}, otrzymano ${s}`}case"invalid_value":return n.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${K(n.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Za duża wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${o}${n.maximum.toString()} ${a.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Za mała wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${o}${n.minimum.toString()} ${a.unit??"elementów"}`:`Zbyt mał(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${o.prefix}"`:o.format==="ends_with"?`Nieprawidłowy ciąg znaków: musi kończyć się na "${o.suffix}"`:o.format==="includes"?`Nieprawidłowy ciąg znaków: musi zawierać "${o.includes}"`:o.format==="regex"?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${o.pattern}`:`Nieprawidłow(y/a/e) ${r[o.format]??n.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${n.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${n.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function _1(){return{localeError:y1()}}var $1=()=>{const e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(n){return e[n]??null}const r={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},i={nan:"NaN",number:"número",null:"nulo"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Tipo inválido: esperado instanceof ${n.expected}, recebido ${s}`:`Tipo inválido: esperado ${o}, recebido ${s}`}case"invalid_value":return n.values.length===1?`Entrada inválida: esperado ${K(n.values[0])}`:`Opção inválida: esperada uma das ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Muito grande: esperado que ${n.origin??"valor"} tivesse ${o}${n.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${n.origin??"valor"} fosse ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Muito pequeno: esperado que ${n.origin} tivesse ${o}${n.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${n.origin} fosse ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Texto inválido: deve começar com "${o.prefix}"`:o.format==="ends_with"?`Texto inválido: deve terminar com "${o.suffix}"`:o.format==="includes"?`Texto inválido: deve incluir "${o.includes}"`:o.format==="regex"?`Texto inválido: deve corresponder ao padrão ${o.pattern}`:`${r[o.format]??n.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Chave inválida em ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${n.origin}`;default:return"Campo inválido"}}};function x1(){return{localeError:$1()}}var S1=()=>{const e={string:{unit:"caractere",verb:"să aibă"},file:{unit:"octeți",verb:"să aibă"},array:{unit:"elemente",verb:"să aibă"},set:{unit:"elemente",verb:"să aibă"},map:{unit:"intrări",verb:"să aibă"}};function t(n){return e[n]??null}const r={regex:"intrare",email:"adresă de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dată și oră ISO",date:"dată ISO",time:"oră ISO",duration:"durată ISO",ipv4:"adresă IPv4",ipv6:"adresă IPv6",mac:"adresă MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"șir codat base64",base64url:"șir codat base64url",json_string:"șir JSON",e164:"număr E.164",jwt:"JWT",template_literal:"intrare"},i={nan:"NaN",string:"șir",number:"număr",boolean:"boolean",function:"funcție",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"număr mare",void:"void",never:"never",map:"hartă",set:"set"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input);return`Intrare invalidă: așteptat ${o}, primit ${i[a]??a}`}case"invalid_value":return n.values.length===1?`Intrare invalidă: așteptat ${K(n.values[0])}`:`Opțiune invalidă: așteptat una dintre ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Prea mare: așteptat ca ${n.origin??"valoarea"} ${a.verb} ${o}${n.maximum.toString()} ${a.unit??"elemente"}`:`Prea mare: așteptat ca ${n.origin??"valoarea"} să fie ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Prea mic: așteptat ca ${n.origin} ${a.verb} ${o}${n.minimum.toString()} ${a.unit}`:`Prea mic: așteptat ca ${n.origin} să fie ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Șir invalid: trebuie să înceapă cu "${o.prefix}"`:o.format==="ends_with"?`Șir invalid: trebuie să se termine cu "${o.suffix}"`:o.format==="includes"?`Șir invalid: trebuie să includă "${o.includes}"`:o.format==="regex"?`Șir invalid: trebuie să se potrivească cu modelul ${o.pattern}`:`Format invalid: ${r[o.format]??n.format}`}case"not_multiple_of":return`Număr invalid: trebuie să fie multiplu de ${n.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${E(n.keys,", ")}`;case"invalid_key":return`Cheie invalidă în ${n.origin}`;case"invalid_union":return"Intrare invalidă";case"invalid_element":return`Valoare invalidă în ${n.origin}`;default:return"Intrare invalidă"}}};function w1(){return{localeError:S1()}}function Vd(e,t,r,i){const n=Math.abs(e),o=n%10,a=n%100;return a>=11&&a<=19?i:o===1?t:o>=2&&o<=4?r:i}var k1=()=>{const e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function t(n){return e[n]??null}const r={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"},i={nan:"NaN",number:"число",array:"массив"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Неверный ввод: ожидалось instanceof ${n.expected}, получено ${s}`:`Неверный ввод: ожидалось ${o}, получено ${s}`}case"invalid_value":return n.values.length===1?`Неверный ввод: ожидалось ${K(n.values[0])}`:`Неверный вариант: ожидалось одно из ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);if(a){const s=Vd(Number(n.maximum),a.unit.one,a.unit.few,a.unit.many);return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет иметь ${o}${n.maximum.toString()} ${s}`}return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);if(a){const s=Vd(Number(n.minimum),a.unit.one,a.unit.few,a.unit.many);return`Слишком маленькое значение: ожидалось, что ${n.origin} будет иметь ${o}${n.minimum.toString()} ${s}`}return`Слишком маленькое значение: ожидалось, что ${n.origin} будет ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Неверная строка: должна начинаться с "${o.prefix}"`:o.format==="ends_with"?`Неверная строка: должна заканчиваться на "${o.suffix}"`:o.format==="includes"?`Неверная строка: должна содержать "${o.includes}"`:o.format==="regex"?`Неверная строка: должна соответствовать шаблону ${o.pattern}`:`Неверный ${r[o.format]??n.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспознанн${n.keys.length>1?"ые":"ый"} ключ${n.keys.length>1?"и":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${n.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${n.origin}`;default:return"Неверные входные данные"}}};function I1(){return{localeError:k1()}}var j1=()=>{const e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(n){return e[n]??null}const r={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"},i={nan:"NaN",number:"število",array:"tabela"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Neveljaven vnos: pričakovano instanceof ${n.expected}, prejeto ${s}`:`Neveljaven vnos: pričakovano ${o}, prejeto ${s}`}case"invalid_value":return n.values.length===1?`Neveljaven vnos: pričakovano ${K(n.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} imelo ${o}${n.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Premajhno: pričakovano, da bo ${n.origin} imelo ${o}${n.minimum.toString()} ${a.unit}`:`Premajhno: pričakovano, da bo ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Neveljaven niz: mora se začeti z "${o.prefix}"`:o.format==="ends_with"?`Neveljaven niz: mora se končati z "${o.suffix}"`:o.format==="includes"?`Neveljaven niz: mora vsebovati "${o.includes}"`:o.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${o.pattern}`:`Neveljaven ${r[o.format]??n.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i ključi":" ključ"}: ${E(n.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function T1(){return{localeError:j1()}}var P1=()=>{const e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function t(n){return e[n]??null}const r={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},i={nan:"NaN",number:"antal",array:"lista"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Ogiltig inmatning: förväntat instanceof ${n.expected}, fick ${s}`:`Ogiltig inmatning: förväntat ${o}, fick ${s}`}case"invalid_value":return n.values.length===1?`Ogiltig inmatning: förväntat ${K(n.values[0])}`:`Ogiltigt val: förväntade en av ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`För stor(t): förväntade ${n.origin??"värdet"} att ha ${o}${n.maximum.toString()} ${a.unit??"element"}`:`För stor(t): förväntat ${n.origin??"värdet"} att ha ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`För lite(t): förväntade ${n.origin??"värdet"} att ha ${o}${n.minimum.toString()} ${a.unit}`:`För lite(t): förväntade ${n.origin??"värdet"} att ha ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Ogiltig sträng: måste börja med "${o.prefix}"`:o.format==="ends_with"?`Ogiltig sträng: måste sluta med "${o.suffix}"`:o.format==="includes"?`Ogiltig sträng: måste innehålla "${o.includes}"`:o.format==="regex"?`Ogiltig sträng: måste matcha mönstret "${o.pattern}"`:`Ogiltig(t) ${r[o.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${E(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${n.origin??"värdet"}`;default:return"Ogiltig input"}}};function O1(){return{localeError:P1()}}var D1=()=>{const e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function t(n){return e[n]??null}const r={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${n.expected}, பெறப்பட்டது ${s}`:`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${o}, பெறப்பட்டது ${s}`}case"invalid_value":return n.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${K(n.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${E(n.values,"|")} இல் ஒன்று`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${o}${n.maximum.toString()} ${a.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${o}${n.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${o}${n.minimum.toString()} ${a.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${o}${n.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{const o=n;return o.format==="starts_with"?`தவறான சரம்: "${o.prefix}" இல் தொடங்க வேண்டும்`:o.format==="ends_with"?`தவறான சரம்: "${o.suffix}" இல் முடிவடைய வேண்டும்`:o.format==="includes"?`தவறான சரம்: "${o.includes}" ஐ உள்ளடக்க வேண்டும்`:o.format==="regex"?`தவறான சரம்: ${o.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${r[o.format]??n.format}`}case"not_multiple_of":return`தவறான எண்: ${n.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${n.keys.length>1?"கள்":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${n.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function z1(){return{localeError:D1()}}var E1=()=>{const e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function t(n){return e[n]??null}const r={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},i={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${n.expected} แต่ได้รับ ${s}`:`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${o} แต่ได้รับ ${s}`}case"invalid_value":return n.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${K(n.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"ไม่เกิน":"น้อยกว่า",a=t(n.origin);return a?`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${o} ${n.maximum.toString()} ${a.unit??"รายการ"}`:`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${o} ${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?"อย่างน้อย":"มากกว่า",a=t(n.origin);return a?`น้อยกว่ากำหนด: ${n.origin} ควรมี${o} ${n.minimum.toString()} ${a.unit}`:`น้อยกว่ากำหนด: ${n.origin} ควรมี${o} ${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${o.prefix}"`:o.format==="ends_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${o.suffix}"`:o.format==="includes"?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${o.includes}" อยู่ในข้อความ`:o.format==="regex"?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${o.pattern}`:`รูปแบบไม่ถูกต้อง: ${r[o.format]??n.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${n.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${E(n.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${n.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${n.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function C1(){return{localeError:E1()}}var A1=()=>{const e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function t(n){return e[n]??null}const r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Geçersiz değer: beklenen instanceof ${n.expected}, alınan ${s}`:`Geçersiz değer: beklenen ${o}, alınan ${s}`}case"invalid_value":return n.values.length===1?`Geçersiz değer: beklenen ${K(n.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Çok büyük: beklenen ${n.origin??"değer"} ${o}${n.maximum.toString()} ${a.unit??"öğe"}`:`Çok büyük: beklenen ${n.origin??"değer"} ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Çok küçük: beklenen ${n.origin} ${o}${n.minimum.toString()} ${a.unit}`:`Çok küçük: beklenen ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Geçersiz metin: "${o.prefix}" ile başlamalı`:o.format==="ends_with"?`Geçersiz metin: "${o.suffix}" ile bitmeli`:o.format==="includes"?`Geçersiz metin: "${o.includes}" içermeli`:o.format==="regex"?`Geçersiz metin: ${o.pattern} desenine uymalı`:`Geçersiz ${r[o.format]??n.format}`}case"not_multiple_of":return`Geçersiz sayı: ${n.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${n.keys.length>1?"lar":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${n.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function N1(){return{localeError:A1()}}var V1=()=>{const e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function t(n){return e[n]??null}const r={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"},i={nan:"NaN",number:"число",array:"масив"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Неправильні вхідні дані: очікується instanceof ${n.expected}, отримано ${s}`:`Неправильні вхідні дані: очікується ${o}, отримано ${s}`}case"invalid_value":return n.values.length===1?`Неправильні вхідні дані: очікується ${K(n.values[0])}`:`Неправильна опція: очікується одне з ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Занадто велике: очікується, що ${n.origin??"значення"} ${a.verb} ${o}${n.maximum.toString()} ${a.unit??"елементів"}`:`Занадто велике: очікується, що ${n.origin??"значення"} буде ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Занадто мале: очікується, що ${n.origin} ${a.verb} ${o}${n.minimum.toString()} ${a.unit}`:`Занадто мале: очікується, що ${n.origin} буде ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Неправильний рядок: повинен починатися з "${o.prefix}"`:o.format==="ends_with"?`Неправильний рядок: повинен закінчуватися на "${o.suffix}"`:o.format==="includes"?`Неправильний рядок: повинен містити "${o.includes}"`:o.format==="regex"?`Неправильний рядок: повинен відповідати шаблону ${o.pattern}`:`Неправильний ${r[o.format]??n.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${n.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${n.keys.length>1?"і":""}: ${E(n.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${n.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${n.origin}`;default:return"Неправильні вхідні дані"}}};function ig(){return{localeError:V1()}}function U1(){return ig()}var M1=()=>{const e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function t(n){return e[n]??null}const r={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},i={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`غلط ان پٹ: instanceof ${n.expected} متوقع تھا، ${s} موصول ہوا`:`غلط ان پٹ: ${o} متوقع تھا، ${s} موصول ہوا`}case"invalid_value":return n.values.length===1?`غلط ان پٹ: ${K(n.values[0])} متوقع تھا`:`غلط آپشن: ${E(n.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`بہت بڑا: ${n.origin??"ویلیو"} کے ${o}${n.maximum.toString()} ${a.unit??"عناصر"} ہونے متوقع تھے`:`بہت بڑا: ${n.origin??"ویلیو"} کا ${o}${n.maximum.toString()} ہونا متوقع تھا`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`بہت چھوٹا: ${n.origin} کے ${o}${n.minimum.toString()} ${a.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${n.origin} کا ${o}${n.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{const o=n;return o.format==="starts_with"?`غلط سٹرنگ: "${o.prefix}" سے شروع ہونا چاہیے`:o.format==="ends_with"?`غلط سٹرنگ: "${o.suffix}" پر ختم ہونا چاہیے`:o.format==="includes"?`غلط سٹرنگ: "${o.includes}" شامل ہونا چاہیے`:o.format==="regex"?`غلط سٹرنگ: پیٹرن ${o.pattern} سے میچ ہونا چاہیے`:`غلط ${r[o.format]??n.format}`}case"not_multiple_of":return`غلط نمبر: ${n.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${n.keys.length>1?"ز":""}: ${E(n.keys,"، ")}`;case"invalid_key":return`${n.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${n.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function R1(){return{localeError:M1()}}var F1=()=>{const e={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"},map:{unit:"yozuv",verb:"bo‘lishi kerak"}};function t(n){return e[n]??null}const r={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},i={nan:"NaN",number:"raqam",array:"massiv"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Noto‘g‘ri kirish: kutilgan instanceof ${n.expected}, qabul qilingan ${s}`:`Noto‘g‘ri kirish: kutilgan ${o}, qabul qilingan ${s}`}case"invalid_value":return n.values.length===1?`Noto‘g‘ri kirish: kutilgan ${K(n.values[0])}`:`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Juda katta: kutilgan ${n.origin??"qiymat"} ${o}${n.maximum.toString()} ${a.unit} ${a.verb}`:`Juda katta: kutilgan ${n.origin??"qiymat"} ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Juda kichik: kutilgan ${n.origin} ${o}${n.minimum.toString()} ${a.unit} ${a.verb}`:`Juda kichik: kutilgan ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Noto‘g‘ri satr: "${o.prefix}" bilan boshlanishi kerak`:o.format==="ends_with"?`Noto‘g‘ri satr: "${o.suffix}" bilan tugashi kerak`:o.format==="includes"?`Noto‘g‘ri satr: "${o.includes}" ni o‘z ichiga olishi kerak`:o.format==="regex"?`Noto‘g‘ri satr: ${o.pattern} shabloniga mos kelishi kerak`:`Noto‘g‘ri ${r[o.format]??n.format}`}case"not_multiple_of":return`Noto‘g‘ri raqam: ${n.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${n.keys.length>1?"lar":""}: ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} dagi kalit noto‘g‘ri`;case"invalid_union":return"Noto‘g‘ri kirish";case"invalid_element":return`${n.origin} da noto‘g‘ri qiymat`;default:return"Noto‘g‘ri kirish"}}};function L1(){return{localeError:F1()}}var Z1=()=>{const e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function t(n){return e[n]??null}const r={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"},i={nan:"NaN",number:"số",array:"mảng"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Đầu vào không hợp lệ: mong đợi instanceof ${n.expected}, nhận được ${s}`:`Đầu vào không hợp lệ: mong đợi ${o}, nhận được ${s}`}case"invalid_value":return n.values.length===1?`Đầu vào không hợp lệ: mong đợi ${K(n.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Quá lớn: mong đợi ${n.origin??"giá trị"} ${a.verb} ${o}${n.maximum.toString()} ${a.unit??"phần tử"}`:`Quá lớn: mong đợi ${n.origin??"giá trị"} ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Quá nhỏ: mong đợi ${n.origin} ${a.verb} ${o}${n.minimum.toString()} ${a.unit}`:`Quá nhỏ: mong đợi ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Chuỗi không hợp lệ: phải bắt đầu bằng "${o.prefix}"`:o.format==="ends_with"?`Chuỗi không hợp lệ: phải kết thúc bằng "${o.suffix}"`:o.format==="includes"?`Chuỗi không hợp lệ: phải bao gồm "${o.includes}"`:o.format==="regex"?`Chuỗi không hợp lệ: phải khớp với mẫu ${o.pattern}`:`${r[o.format]??n.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${n.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${E(n.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${n.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${n.origin}`;default:return"Đầu vào không hợp lệ"}}};function B1(){return{localeError:Z1()}}var W1=()=>{const e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function t(n){return e[n]??null}const r={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"},i={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`无效输入:期望 instanceof ${n.expected},实际接收 ${s}`:`无效输入:期望 ${o},实际接收 ${s}`}case"invalid_value":return n.values.length===1?`无效输入:期望 ${K(n.values[0])}`:`无效选项:期望以下之一 ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`数值过大:期望 ${n.origin??"值"} ${o}${n.maximum.toString()} ${a.unit??"个元素"}`:`数值过大:期望 ${n.origin??"值"} ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`数值过小:期望 ${n.origin} ${o}${n.minimum.toString()} ${a.unit}`:`数值过小:期望 ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`无效字符串:必须以 "${o.prefix}" 开头`:o.format==="ends_with"?`无效字符串:必须以 "${o.suffix}" 结尾`:o.format==="includes"?`无效字符串:必须包含 "${o.includes}"`:o.format==="regex"?`无效字符串:必须满足正则表达式 ${o.pattern}`:`无效${r[o.format]??n.format}`}case"not_multiple_of":return`无效数字:必须是 ${n.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${E(n.keys,", ")}`;case"invalid_key":return`${n.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${n.origin} 中包含无效值(value)`;default:return"无效输入"}}};function H1(){return{localeError:W1()}}var J1=()=>{const e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function t(n){return e[n]??null}const r={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`無效的輸入值:預期為 instanceof ${n.expected},但收到 ${s}`:`無效的輸入值:預期為 ${o},但收到 ${s}`}case"invalid_value":return n.values.length===1?`無效的輸入值:預期為 ${K(n.values[0])}`:`無效的選項:預期為以下其中之一 ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`數值過大:預期 ${n.origin??"值"} 應為 ${o}${n.maximum.toString()} ${a.unit??"個元素"}`:`數值過大:預期 ${n.origin??"值"} 應為 ${o}${n.maximum.toString()}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`數值過小:預期 ${n.origin} 應為 ${o}${n.minimum.toString()} ${a.unit}`:`數值過小:預期 ${n.origin} 應為 ${o}${n.minimum.toString()}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`無效的字串:必須以 "${o.prefix}" 開頭`:o.format==="ends_with"?`無效的字串:必須以 "${o.suffix}" 結尾`:o.format==="includes"?`無效的字串:必須包含 "${o.includes}"`:o.format==="regex"?`無效的字串:必須符合格式 ${o.pattern}`:`無效的 ${r[o.format]??n.format}`}case"not_multiple_of":return`無效的數字:必須為 ${n.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${n.keys.length>1?"們":""}:${E(n.keys,"、")}`;case"invalid_key":return`${n.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${n.origin} 中有無效的值`;default:return"無效的輸入值"}}};function G1(){return{localeError:J1()}}var K1=()=>{const e={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function t(n){return e[n]??null}const r={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},i={nan:"NaN",number:"nọ́mbà",array:"akopọ"};return n=>{switch(n.code){case"invalid_type":{const o=i[n.expected]??n.expected,a=Y(n.input),s=i[a]??a;return/^[A-Z]/.test(n.expected)?`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${n.expected}, àmọ̀ a rí ${s}`:`Ìbáwọlé aṣìṣe: a ní láti fi ${o}, àmọ̀ a rí ${s}`}case"invalid_value":return n.values.length===1?`Ìbáwọlé aṣìṣe: a ní láti fi ${K(n.values[0])}`:`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${E(n.values,"|")}`;case"too_big":{const o=n.inclusive?"<=":"<",a=t(n.origin);return a?`Tó pọ̀ jù: a ní láti jẹ́ pé ${n.origin??"iye"} ${a.verb} ${o}${n.maximum} ${a.unit}`:`Tó pọ̀ jù: a ní láti jẹ́ ${o}${n.maximum}`}case"too_small":{const o=n.inclusive?">=":">",a=t(n.origin);return a?`Kéré ju: a ní láti jẹ́ pé ${n.origin} ${a.verb} ${o}${n.minimum} ${a.unit}`:`Kéré ju: a ní láti jẹ́ ${o}${n.minimum}`}case"invalid_format":{const o=n;return o.format==="starts_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${o.prefix}"`:o.format==="ends_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${o.suffix}"`:o.format==="includes"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${o.includes}"`:o.format==="regex"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${o.pattern}`:`Aṣìṣe: ${r[o.format]??n.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${n.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${E(n.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${n.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${n.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function X1(){return{localeError:K1()}}var og=ct({ar:()=>sI,az:()=>lI,be:()=>dI,bg:()=>mI,ca:()=>hI,cs:()=>gI,da:()=>yI,de:()=>$I,el:()=>SI,en:()=>ng,eo:()=>II,es:()=>TI,fa:()=>OI,fi:()=>zI,fr:()=>CI,frCA:()=>NI,he:()=>UI,hr:()=>RI,hu:()=>LI,hy:()=>BI,id:()=>HI,is:()=>GI,it:()=>XI,ja:()=>YI,ka:()=>e1,kh:()=>n1,km:()=>rg,ko:()=>i1,lt:()=>a1,mk:()=>u1,ms:()=>c1,nl:()=>f1,no:()=>p1,ota:()=>v1,pl:()=>_1,ps:()=>b1,pt:()=>x1,ro:()=>w1,ru:()=>I1,sl:()=>T1,sv:()=>O1,ta:()=>z1,th:()=>C1,tr:()=>N1,ua:()=>U1,uk:()=>ig,ur:()=>R1,uz:()=>L1,vi:()=>B1,yo:()=>X1,zhCN:()=>H1,zhTW:()=>G1}),Ud,ag=Symbol("ZodOutput"),sg=Symbol("ZodInput"),ug=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const i={...r,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Pu(){return new ug}(Ud=globalThis).__zod_globalRegistry??(Ud.__zod_globalRegistry=Pu());var at=globalThis.__zod_globalRegistry;function lg(e,t){return new e({type:"string",...D(t)})}function cg(e,t){return new e({type:"string",coerce:!0,...D(t)})}function Ou(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...D(t)})}function Hi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...D(t)})}function Du(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...D(t)})}function zu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(t)})}function Eu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(t)})}function Cu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(t)})}function _o(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...D(t)})}function Au(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...D(t)})}function Nu(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(t)})}function Vu(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...D(t)})}function Uu(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(t)})}function Mu(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...D(t)})}function Ru(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...D(t)})}function Fu(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(t)})}function Lu(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(t)})}function Zu(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(t)})}function dg(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...D(t)})}function Bu(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(t)})}function Wu(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(t)})}function Hu(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...D(t)})}function Ju(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...D(t)})}function Gu(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...D(t)})}function Ku(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...D(t)})}var fg={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function mg(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(t)})}function pg(e,t){return new e({type:"string",format:"date",check:"string_format",...D(t)})}function hg(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...D(t)})}function vg(e,t){return new e({type:"string",format:"duration",check:"string_format",...D(t)})}function gg(e,t){return new e({type:"number",checks:[],...D(t)})}function bg(e,t){return new e({type:"number",coerce:!0,checks:[],...D(t)})}function yg(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...D(t)})}function _g(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...D(t)})}function $g(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...D(t)})}function xg(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...D(t)})}function Sg(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...D(t)})}function wg(e,t){return new e({type:"boolean",...D(t)})}function kg(e,t){return new e({type:"boolean",coerce:!0,...D(t)})}function Ig(e,t){return new e({type:"bigint",...D(t)})}function jg(e,t){return new e({type:"bigint",coerce:!0,...D(t)})}function Tg(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...D(t)})}function Pg(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...D(t)})}function Og(e,t){return new e({type:"symbol",...D(t)})}function Dg(e,t){return new e({type:"undefined",...D(t)})}function zg(e,t){return new e({type:"null",...D(t)})}function Eg(e){return new e({type:"any"})}function Cg(e){return new e({type:"unknown"})}function Ag(e,t){return new e({type:"never",...D(t)})}function Ng(e,t){return new e({type:"void",...D(t)})}function Vg(e,t){return new e({type:"date",...D(t)})}function Ug(e,t){return new e({type:"date",coerce:!0,...D(t)})}function Mg(e,t){return new e({type:"nan",...D(t)})}function Ft(e,t){return new yu({check:"less_than",...D(t),value:e,inclusive:!1})}function ut(e,t){return new yu({check:"less_than",...D(t),value:e,inclusive:!0})}function Lt(e,t){return new _u({check:"greater_than",...D(t),value:e,inclusive:!1})}function He(e,t){return new _u({check:"greater_than",...D(t),value:e,inclusive:!0})}function Xu(e){return Lt(0,e)}function qu(e){return Ft(0,e)}function Yu(e){return ut(0,e)}function Qu(e){return He(0,e)}function On(e,t){return new Sh({check:"multiple_of",...D(t),value:e})}function Rn(e,t){return new Ih({check:"max_size",...D(t),maximum:e})}function Zt(e,t){return new jh({check:"min_size",...D(t),minimum:e})}function Ar(e,t){return new Th({check:"size_equals",...D(t),size:e})}function Nr(e,t){return new Ph({check:"max_length",...D(t),maximum:e})}function dn(e,t){return new Oh({check:"min_length",...D(t),minimum:e})}function Vr(e,t){return new Dh({check:"length_equals",...D(t),length:e})}function $o(e,t){return new zh({check:"string_format",format:"regex",...D(t),pattern:e})}function xo(e){return new Eh({check:"string_format",format:"lowercase",...D(e)})}function So(e){return new Ch({check:"string_format",format:"uppercase",...D(e)})}function wo(e,t){return new Ah({check:"string_format",format:"includes",...D(t),includes:e})}function ko(e,t){return new Nh({check:"string_format",format:"starts_with",...D(t),prefix:e})}function Io(e,t){return new Vh({check:"string_format",format:"ends_with",...D(t),suffix:e})}function el(e,t,r){return new Uh({check:"property",property:e,schema:t,...D(r)})}function jo(e,t){return new Mh({check:"mime_type",mime:e,...D(t)})}function Ut(e){return new Rh({check:"overwrite",tx:e})}function To(e){return Ut(t=>t.normalize(e))}function Po(){return Ut(e=>e.trim())}function Oo(){return Ut(e=>e.toLowerCase())}function Do(){return Ut(e=>e.toUpperCase())}function zo(){return Ut(e=>_p(e))}function Rg(e,t,r){return new e({type:"array",element:t,...D(r)})}function q1(e,t,r){return new e({type:"union",options:t,...D(r)})}function Y1(e,t,r){return new e({type:"union",options:t,inclusive:!1,...D(r)})}function Q1(e,t,r,i){return new e({type:"union",options:r,discriminator:t,...D(i)})}function ej(e,t,r){return new e({type:"intersection",left:t,right:r})}function tj(e,t,r,i){const n=r instanceof ne,o=n?i:r;return new e({type:"tuple",items:t,rest:n?r:null,...D(o)})}function nj(e,t,r,i){return new e({type:"record",keyType:t,valueType:r,...D(i)})}function rj(e,t,r,i){return new e({type:"map",keyType:t,valueType:r,...D(i)})}function ij(e,t,r){return new e({type:"set",valueType:t,...D(r)})}function oj(e,t,r){return new e({type:"enum",entries:Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t,...D(r)})}function aj(e,t,r){return new e({type:"enum",entries:t,...D(r)})}function sj(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...D(r)})}function Fg(e,t){return new e({type:"file",...D(t)})}function uj(e,t){return new e({type:"transform",transform:t})}function lj(e,t){return new e({type:"optional",innerType:t})}function cj(e,t){return new e({type:"nullable",innerType:t})}function dj(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():ho(r)}})}function fj(e,t,r){return new e({type:"nonoptional",innerType:t,...D(r)})}function mj(e,t){return new e({type:"success",innerType:t})}function pj(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:()=>r})}function hj(e,t,r){return new e({type:"pipe",in:t,out:r})}function vj(e,t){return new e({type:"readonly",innerType:t})}function gj(e,t,r){return new e({type:"template_literal",parts:t,...D(r)})}function bj(e,t){return new e({type:"lazy",getter:t})}function yj(e,t){return new e({type:"promise",innerType:t})}function Lg(e,t,r){const i=D(r);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:t,...i})}function Zg(e,t,r){return new e({type:"custom",check:"custom",fn:t,...D(r)})}function Bg(e,t){const r=Wg(i=>(i.addIssue=n=>{if(typeof n=="string")i.issues.push(Tn(n,i.value,r._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=i.value),o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),i.issues.push(Tn(o))}},e(i.value,i)),t);return r}function Wg(e,t){const r=new $e({check:"custom",...D(t)});return r._zod.check=e,r}function Hg(e){const t=new $e({check:"describe"});return t._zod.onattach=[r=>{const i=at.get(r)??{};at.add(r,{...i,description:e})}],t._zod.check=()=>{},t}function Jg(e){const t=new $e({check:"meta"});return t._zod.onattach=[r=>{const i=at.get(r)??{};at.add(r,{...i,...e})}],t._zod.check=()=>{},t}function Gg(e,t){const r=D(t);let i=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(i=i.map(c=>typeof c=="string"?c.toLowerCase():c),n=n.map(c=>typeof c=="string"?c.toLowerCase():c));const o=new Set(i),a=new Set(n),s=e.Codec??Tu,u=e.Boolean??Su,l=new s({type:"pipe",in:new(e.String??Cr)({type:"string",error:r.error}),out:new u({type:"boolean",error:r.error}),transform:((c,d)=>{let m=c;return r.case!=="sensitive"&&(m=m.toLowerCase()),o.has(m)?!0:a.has(m)?!1:(d.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...a],input:d.value,inst:l,continue:!1}),{})}),reverseTransform:((c,d)=>c===!0?i[0]||"true":n[0]||"false"),error:r.error});return l}function Ur(e,t,r,i={}){const n=D(i),o={...D(i),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:a=>r.test(a),...n};return r instanceof RegExp&&(o.pattern=r),new e(o)}function Dn(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??at,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function ve(e,t,r={path:[],schemaPath:[]}){var i;const n=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;const a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);const s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{const l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{const d=a.schema,m=t.processors[n.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);m(e,t,d,l)}const c=e._zod.parent;c&&(a.ref||(a.ref=c),ve(c,t,l),t.seen.get(c).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),t.io==="input"&&Le(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&"_prefault"in a.schema&&((i=a.schema).default??(i.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function zn(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=new Map;for(const a of e.seen.entries()){const s=e.metadataRegistry.get(a[0])?.id;if(s){const u=i.get(s);if(u&&u!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(s,a[0])}}const n=a=>{const s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const c=e.external.registry.get(a[0])?.id,d=e.external.uri??(h=>h);if(c)return{ref:d(c)};const m=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=m,{defId:m,ref:`${d("__shared")}#/${s}/${m}`}}if(a[1]===r)return{ref:"#"};const u=`#/${s}/`,l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},o=a=>{if(a[1].schema.$ref)return;const s=a[1],{ref:u,defId:l}=n(a);s.def={...s.schema},l&&(s.defId=l);const c=s.schema;for(const d in c)delete c[d];c.$ref=u};if(e.cycles==="throw")for(const a of e.seen.entries()){const s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/ - -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of e.seen.entries()){const s=a[1];if(t===a[0]){o(a);continue}if(e.external){const u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){o(a);continue}}if(e.metadataRegistry.get(a[0])?.id){o(a);continue}if(s.cycle){o(a);continue}if(s.count>1&&e.reused==="ref"){o(a);continue}}}function En(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=s=>{const u=e.seen.get(s);if(u.ref===null)return;const l=u.def??u.schema,c={...l},d=u.ref;if(u.ref=null,d){i(d);const h=e.seen.get(d),v=h.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(v)):Object.assign(l,v),Object.assign(l,c),s._zod.parent===d)for(const f in l)f==="$ref"||f==="allOf"||f in c||delete l[f];if(v.$ref&&h.def)for(const f in l)f==="$ref"||f==="allOf"||f in h.def&&JSON.stringify(l[f])===JSON.stringify(h.def[f])&&delete l[f]}const m=s._zod.parent;if(m&&m!==d){i(m);const h=e.seen.get(m);if(h?.schema.$ref&&(l.$ref=h.schema.$ref,h.def))for(const v in l)v==="$ref"||v==="allOf"||v in h.def&&JSON.stringify(l[v])===JSON.stringify(h.def[v])&&delete l[v]}e.override({zodSchema:s,jsonSchema:l,path:u.path??[]})};for(const s of[...e.seen.entries()].reverse())i(s[0]);const n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(s)}Object.assign(n,r.def??r.schema);const o=e.metadataRegistry.get(t)?.id;o!==void 0&&n.id===o&&delete n.id;const a=e.external?.defs??{};for(const s of e.seen.entries()){const u=s[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,a[u.defId]=u.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?n.$defs=a:n.definitions=a);try{const s=JSON.parse(JSON.stringify(n));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:mr(t,"input",e.processors),output:mr(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function Le(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Le(i.element,r);if(i.type==="set")return Le(i.valueType,r);if(i.type==="lazy")return Le(i.getter(),r);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return Le(i.innerType,r);if(i.type==="intersection")return Le(i.left,r)||Le(i.right,r);if(i.type==="record"||i.type==="map")return Le(i.keyType,r)||Le(i.valueType,r);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Le(i.in,r)||Le(i.out,r);if(i.type==="object"){for(const n in i.shape)if(Le(i.shape[n],r))return!0;return!1}if(i.type==="union"){for(const n of i.options)if(Le(n,r))return!0;return!1}if(i.type==="tuple"){for(const n of i.items)if(Le(n,r))return!0;return!!(i.rest&&Le(i.rest,r))}return!1}var Kg=(e,t={})=>r=>{const i=Dn({...r,processors:t});return ve(e,i),zn(i,e),En(i,e)},mr=(e,t,r={})=>i=>{const{libraryOptions:n,target:o}=i??{},a=Dn({...n??{},target:o,io:t,processors:r});return ve(e,a),zn(a,e),En(a,e)},_j={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Xg=(e,t,r,i)=>{const n=r;n.type="string";const{minimum:o,maximum:a,format:s,patterns:u,contentEncoding:l}=e._zod.bag;if(typeof o=="number"&&(n.minLength=o),typeof a=="number"&&(n.maxLength=a),s&&(n.format=_j[s]??s,n.format===""&&delete n.format,s==="time"&&delete n.format),l&&(n.contentEncoding=l),u&&u.size>0){const c=[...u];c.length===1?n.pattern=c[0].source:c.length>1&&(n.allOf=[...c.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},qg=(e,t,r,i)=>{const n=r,{minimum:o,maximum:a,format:s,multipleOf:u,exclusiveMaximum:l,exclusiveMinimum:c}=e._zod.bag;typeof s=="string"&&s.includes("int")?n.type="integer":n.type="number";const d=typeof c=="number"&&c>=(o??Number.NEGATIVE_INFINITY),m=typeof l=="number"&&l<=(a??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";d?h?(n.minimum=c,n.exclusiveMinimum=!0):n.exclusiveMinimum=c:typeof o=="number"&&(n.minimum=o),m?h?(n.maximum=l,n.exclusiveMaximum=!0):n.exclusiveMaximum=l:typeof a=="number"&&(n.maximum=a),typeof u=="number"&&(n.multipleOf=u)},Yg=(e,t,r,i)=>{r.type="boolean"},Qg=(e,t,r,i)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},eb=(e,t,r,i)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},tb=(e,t,r,i)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},nb=(e,t,r,i)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},rb=(e,t,r,i)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},ib=(e,t,r,i)=>{r.not={}},ob=(e,t,r,i)=>{},ab=(e,t,r,i)=>{},sb=(e,t,r,i)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},ub=(e,t,r,i)=>{const n=e._zod.def,o=ru(n.entries);o.every(a=>typeof a=="number")&&(r.type="number"),o.every(a=>typeof a=="string")&&(r.type="string"),r.enum=o},lb=(e,t,r,i)=>{const n=e._zod.def,o=[];for(const a of n.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(a))}else o.push(a);if(o.length!==0)if(o.length===1){const a=o[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else o.every(a=>typeof a=="number")&&(r.type="number"),o.every(a=>typeof a=="string")&&(r.type="string"),o.every(a=>typeof a=="boolean")&&(r.type="boolean"),o.every(a=>a===null)&&(r.type="null"),r.enum=o},cb=(e,t,r,i)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},db=(e,t,r,i)=>{const n=r,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=o.source},fb=(e,t,r,i)=>{const n=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:u}=e._zod.bag;a!==void 0&&(o.minLength=a),s!==void 0&&(o.maxLength=s),u?u.length===1?(o.contentMediaType=u[0],Object.assign(n,o)):(Object.assign(n,o),n.anyOf=u.map(l=>({contentMediaType:l}))):Object.assign(n,o)},mb=(e,t,r,i)=>{r.type="boolean"},pb=(e,t,r,i)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},hb=(e,t,r,i)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},vb=(e,t,r,i)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},gb=(e,t,r,i)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},bb=(e,t,r,i)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},yb=(e,t,r,i)=>{const n=r,o=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(n.minItems=a),typeof s=="number"&&(n.maxItems=s),n.type="array",n.items=ve(o.element,t,{...i,path:[...i.path,"items"]})},_b=(e,t,r,i)=>{const n=r,o=e._zod.def;n.type="object",n.properties={};const a=o.shape;for(const l in a)n.properties[l]=ve(a[l],t,{...i,path:[...i.path,"properties",l]});const s=new Set(Object.keys(a)),u=new Set([...s].filter(l=>{const c=o.shape[l]._zod;return t.io==="input"?c.optin===void 0:c.optout===void 0}));u.size>0&&(n.required=Array.from(u)),o.catchall?._zod.def.type==="never"?n.additionalProperties=!1:o.catchall?o.catchall&&(n.additionalProperties=ve(o.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},tl=(e,t,r,i)=>{const n=e._zod.def,o=n.inclusive===!1,a=n.options.map((s,u)=>ve(s,t,{...i,path:[...i.path,o?"oneOf":"anyOf",u]}));o?r.oneOf=a:r.anyOf=a},$b=(e,t,r,i)=>{const n=e._zod.def,o=ve(n.left,t,{...i,path:[...i.path,"allOf",0]}),a=ve(n.right,t,{...i,path:[...i.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1;r.allOf=[...s(o)?o.allOf:[o],...s(a)?a.allOf:[a]]},xb=(e,t,r,i)=>{const n=r,o=e._zod.def;n.type="array";const a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=o.items.map((m,h)=>ve(m,t,{...i,path:[...i.path,a,h]})),l=o.rest?ve(o.rest,t,{...i,path:[...i.path,s,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null;t.target==="draft-2020-12"?(n.prefixItems=u,l&&(n.items=l)):t.target==="openapi-3.0"?(n.items={anyOf:u},l&&n.items.anyOf.push(l),n.minItems=u.length,l||(n.maxItems=u.length)):(n.items=u,l&&(n.additionalItems=l));const{minimum:c,maximum:d}=e._zod.bag;typeof c=="number"&&(n.minItems=c),typeof d=="number"&&(n.maxItems=d)},Sb=(e,t,r,i)=>{const n=r,o=e._zod.def;n.type="object";const a=o.keyType,s=a._zod.bag?.patterns;if(o.mode==="loose"&&s&&s.size>0){const l=ve(o.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});n.patternProperties={};for(const c of s)n.patternProperties[c.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=ve(o.keyType,t,{...i,path:[...i.path,"propertyNames"]})),n.additionalProperties=ve(o.valueType,t,{...i,path:[...i.path,"additionalProperties"]});const u=a._zod.values;if(u){const l=[...u].filter(c=>typeof c=="string"||typeof c=="number");l.length>0&&(n.required=l)}},wb=(e,t,r,i)=>{const n=e._zod.def,o=ve(n.innerType,t,i),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=n.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},kb=(e,t,r,i)=>{const n=e._zod.def;ve(n.innerType,t,i);const o=t.seen.get(e);o.ref=n.innerType},Ib=(e,t,r,i)=>{const n=e._zod.def;ve(n.innerType,t,i);const o=t.seen.get(e);o.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},jb=(e,t,r,i)=>{const n=e._zod.def;ve(n.innerType,t,i);const o=t.seen.get(e);o.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},Tb=(e,t,r,i)=>{const n=e._zod.def;ve(n.innerType,t,i);const o=t.seen.get(e);o.ref=n.innerType;let a;try{a=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},Pb=(e,t,r,i)=>{const n=e._zod.def,o=n.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?o?n.out:n.in:n.out;ve(a,t,i);const s=t.seen.get(e);s.ref=a},Ob=(e,t,r,i)=>{const n=e._zod.def;ve(n.innerType,t,i);const o=t.seen.get(e);o.ref=n.innerType,r.readOnly=!0},Db=(e,t,r,i)=>{const n=e._zod.def;ve(n.innerType,t,i);const o=t.seen.get(e);o.ref=n.innerType},nl=(e,t,r,i)=>{const n=e._zod.def;ve(n.innerType,t,i);const o=t.seen.get(e);o.ref=n.innerType},zb=(e,t,r,i)=>{const n=e._zod.innerType;ve(n,t,i);const o=t.seen.get(e);o.ref=n},ds={string:Xg,number:qg,boolean:Yg,bigint:Qg,symbol:eb,null:tb,undefined:nb,void:rb,never:ib,any:ob,unknown:ab,date:sb,enum:ub,literal:lb,nan:cb,template_literal:db,file:fb,success:mb,custom:pb,function:hb,transform:vb,map:gb,set:bb,array:yb,object:_b,union:tl,intersection:$b,tuple:xb,record:Sb,nullable:wb,nonoptional:kb,default:Ib,prefault:jb,catch:Tb,pipe:Pb,readonly:Ob,promise:Db,optional:nl,lazy:zb};function Eb(e,t){if("_idmap"in e){const i=e,n=Dn({...t,processors:ds}),o={};for(const s of i._idmap.entries()){const[u,l]=s;ve(l,n)}const a={};n.external={registry:i,uri:t?.uri,defs:o};for(const s of i._idmap.entries()){const[u,l]=s;zn(n,l),a[u]=En(n,l)}return Object.keys(o).length>0&&(a.__shared={[n.target==="draft-2020-12"?"$defs":"definitions"]:o}),{schemas:a}}const r=Dn({...t,processors:ds});return ve(e,r),zn(r,e),En(r,e)}var $j=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??"draft-2020-12";t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),this.ctx=Dn({processors:ds,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return ve(e,this.ctx,t)}emit(e,t){t&&(t.cycles&&(this.ctx.cycles=t.cycles),t.reused&&(this.ctx.reused=t.reused),t.external&&(this.ctx.external=t.external)),zn(this.ctx,e);const{"~standard":r,...i}=En(this.ctx,e);return i}},xj=ct({}),Sj=ct({$ZodAny:()=>$v,$ZodArray:()=>Iv,$ZodAsyncError:()=>on,$ZodBase64:()=>lv,$ZodBase64URL:()=>dv,$ZodBigInt:()=>wu,$ZodBigIntFormat:()=>gv,$ZodBoolean:()=>Su,$ZodCIDRv4:()=>sv,$ZodCIDRv6:()=>uv,$ZodCUID:()=>Kh,$ZodCUID2:()=>Xh,$ZodCatch:()=>Jv,$ZodCheck:()=>$e,$ZodCheckBigIntFormat:()=>kh,$ZodCheckEndsWith:()=>Vh,$ZodCheckGreaterThan:()=>_u,$ZodCheckIncludes:()=>Ah,$ZodCheckLengthEquals:()=>Dh,$ZodCheckLessThan:()=>yu,$ZodCheckLowerCase:()=>Eh,$ZodCheckMaxLength:()=>Ph,$ZodCheckMaxSize:()=>Ih,$ZodCheckMimeType:()=>Mh,$ZodCheckMinLength:()=>Oh,$ZodCheckMinSize:()=>jh,$ZodCheckMultipleOf:()=>Sh,$ZodCheckNumberFormat:()=>wh,$ZodCheckOverwrite:()=>Rh,$ZodCheckProperty:()=>Uh,$ZodCheckRegex:()=>zh,$ZodCheckSizeEquals:()=>Th,$ZodCheckStartsWith:()=>Nh,$ZodCheckStringFormat:()=>Er,$ZodCheckUpperCase:()=>Ch,$ZodCodec:()=>Tu,$ZodCustom:()=>tg,$ZodCustomStringFormat:()=>hv,$ZodDate:()=>kv,$ZodDefault:()=>Zv,$ZodDiscriminatedUnion:()=>zv,$ZodE164:()=>fv,$ZodEmail:()=>Wh,$ZodEmoji:()=>Jh,$ZodEncodeError:()=>mo,$ZodEnum:()=>Vv,$ZodError:()=>bo,$ZodExactOptional:()=>Fv,$ZodFile:()=>Mv,$ZodFunction:()=>Yv,$ZodGUID:()=>Zh,$ZodIPv4:()=>iv,$ZodIPv6:()=>ov,$ZodISODate:()=>tv,$ZodISODateTime:()=>ev,$ZodISODuration:()=>rv,$ZodISOTime:()=>nv,$ZodIntersection:()=>Ev,$ZodJWT:()=>pv,$ZodKSUID:()=>Qh,$ZodLazy:()=>eg,$ZodLiteral:()=>Uv,$ZodMAC:()=>av,$ZodMap:()=>Av,$ZodNaN:()=>Gv,$ZodNanoID:()=>Gh,$ZodNever:()=>Sv,$ZodNonOptional:()=>Wv,$ZodNull:()=>_v,$ZodNullable:()=>Lv,$ZodNumber:()=>xu,$ZodNumberFormat:()=>vv,$ZodObject:()=>Pv,$ZodObjectJIT:()=>Ov,$ZodOptional:()=>Iu,$ZodPipe:()=>ju,$ZodPrefault:()=>Bv,$ZodPreprocess:()=>Kv,$ZodPromise:()=>Qv,$ZodReadonly:()=>Xv,$ZodRealError:()=>et,$ZodRecord:()=>Cv,$ZodRegistry:()=>ug,$ZodSet:()=>Nv,$ZodString:()=>Cr,$ZodStringFormat:()=>ye,$ZodSuccess:()=>Hv,$ZodSymbol:()=>bv,$ZodTemplateLiteral:()=>qv,$ZodTransform:()=>Rv,$ZodTuple:()=>ku,$ZodType:()=>ne,$ZodULID:()=>qh,$ZodURL:()=>Hh,$ZodUUID:()=>Bh,$ZodUndefined:()=>yv,$ZodUnion:()=>yo,$ZodUnknown:()=>xv,$ZodVoid:()=>wv,$ZodXID:()=>Yh,$ZodXor:()=>Dv,$brand:()=>gp,$constructor:()=>k,$input:()=>sg,$output:()=>ag,Doc:()=>Fh,JSONSchema:()=>xj,JSONSchemaGenerator:()=>$j,NEVER:()=>vp,TimePrecision:()=>fg,_any:()=>Eg,_array:()=>Rg,_base64:()=>Hu,_base64url:()=>Ju,_bigint:()=>Ig,_boolean:()=>wg,_catch:()=>pj,_check:()=>Wg,_cidrv4:()=>Bu,_cidrv6:()=>Wu,_coercedBigint:()=>jg,_coercedBoolean:()=>kg,_coercedDate:()=>Ug,_coercedNumber:()=>bg,_coercedString:()=>cg,_cuid:()=>Vu,_cuid2:()=>Uu,_custom:()=>Lg,_date:()=>Vg,_decode:()=>uu,_decodeAsync:()=>cu,_default:()=>dj,_discriminatedUnion:()=>Q1,_e164:()=>Gu,_email:()=>Ou,_emoji:()=>Au,_encode:()=>su,_encodeAsync:()=>lu,_endsWith:()=>Io,_enum:()=>oj,_file:()=>Fg,_float32:()=>_g,_float64:()=>$g,_gt:()=>Lt,_gte:()=>He,_guid:()=>Hi,_includes:()=>wo,_int:()=>yg,_int32:()=>xg,_int64:()=>Tg,_intersection:()=>ej,_ipv4:()=>Lu,_ipv6:()=>Zu,_isoDate:()=>pg,_isoDateTime:()=>mg,_isoDuration:()=>vg,_isoTime:()=>hg,_jwt:()=>Ku,_ksuid:()=>Fu,_lazy:()=>bj,_length:()=>Vr,_literal:()=>sj,_lowercase:()=>xo,_lt:()=>Ft,_lte:()=>ut,_mac:()=>dg,_map:()=>rj,_max:()=>ut,_maxLength:()=>Nr,_maxSize:()=>Rn,_mime:()=>jo,_min:()=>He,_minLength:()=>dn,_minSize:()=>Zt,_multipleOf:()=>On,_nan:()=>Mg,_nanoid:()=>Nu,_nativeEnum:()=>aj,_negative:()=>qu,_never:()=>Ag,_nonnegative:()=>Qu,_nonoptional:()=>fj,_nonpositive:()=>Yu,_normalize:()=>To,_null:()=>zg,_nullable:()=>cj,_number:()=>gg,_optional:()=>lj,_overwrite:()=>Ut,_parse:()=>jr,_parseAsync:()=>Tr,_pipe:()=>hj,_positive:()=>Xu,_promise:()=>yj,_property:()=>el,_readonly:()=>vj,_record:()=>nj,_refine:()=>Zg,_regex:()=>$o,_safeDecode:()=>fu,_safeDecodeAsync:()=>pu,_safeEncode:()=>du,_safeEncodeAsync:()=>mu,_safeParse:()=>Pr,_safeParseAsync:()=>Or,_set:()=>ij,_size:()=>Ar,_slugify:()=>zo,_startsWith:()=>ko,_string:()=>lg,_stringFormat:()=>Ur,_stringbool:()=>Gg,_success:()=>mj,_superRefine:()=>Bg,_symbol:()=>Og,_templateLiteral:()=>gj,_toLowerCase:()=>Oo,_toUpperCase:()=>Do,_transform:()=>uj,_trim:()=>Po,_tuple:()=>tj,_uint32:()=>Sg,_uint64:()=>Pg,_ulid:()=>Mu,_undefined:()=>Dg,_union:()=>q1,_unknown:()=>Cg,_uppercase:()=>So,_url:()=>_o,_uuid:()=>Du,_uuidv4:()=>zu,_uuidv6:()=>Eu,_uuidv7:()=>Cu,_void:()=>Ng,_xid:()=>Ru,_xor:()=>Y1,clone:()=>dt,config:()=>Ve,createStandardJSONSchemaMethod:()=>mr,createToJSONSchemaMethod:()=>Kg,decode:()=>Pk,decodeAsync:()=>Dk,describe:()=>Hg,encode:()=>Tk,encodeAsync:()=>Ok,extractDefs:()=>zn,finalize:()=>En,flattenError:()=>ou,formatError:()=>au,globalConfig:()=>fr,globalRegistry:()=>at,initializeContext:()=>Dn,isValidBase64:()=>$u,isValidBase64URL:()=>cv,isValidJWT:()=>mv,locales:()=>og,meta:()=>Jg,parse:()=>Zi,parseAsync:()=>Bi,prettifyError:()=>Mp,process:()=>ve,regexes:()=>hu,registry:()=>Pu,safeDecode:()=>Ek,safeDecodeAsync:()=>Ak,safeEncode:()=>zk,safeEncodeAsync:()=>Ck,safeParse:()=>Rp,safeParseAsync:()=>Fp,toDotPath:()=>Up,toJSONSchema:()=>Eb,treeifyError:()=>Vp,util:()=>bp,version:()=>Lh}),wj=ct({endsWith:()=>Io,gt:()=>Lt,gte:()=>He,includes:()=>wo,length:()=>Vr,lowercase:()=>xo,lt:()=>Ft,lte:()=>ut,maxLength:()=>Nr,maxSize:()=>Rn,mime:()=>jo,minLength:()=>dn,minSize:()=>Zt,multipleOf:()=>On,negative:()=>qu,nonnegative:()=>Qu,nonpositive:()=>Yu,normalize:()=>To,overwrite:()=>Ut,positive:()=>Xu,property:()=>el,regex:()=>$o,size:()=>Ar,slugify:()=>zo,startsWith:()=>ko,toLowerCase:()=>Oo,toUpperCase:()=>Do,trim:()=>Po,uppercase:()=>So}),Cb=ct({ZodISODate:()=>il,ZodISODateTime:()=>rl,ZodISODuration:()=>al,ZodISOTime:()=>ol,date:()=>Nb,datetime:()=>Ab,duration:()=>Ub,time:()=>Vb}),rl=k("ZodISODateTime",(e,t)=>{ev.init(e,t),_e.init(e,t)});function Ab(e){return mg(rl,e)}var il=k("ZodISODate",(e,t)=>{tv.init(e,t),_e.init(e,t)});function Nb(e){return pg(il,e)}var ol=k("ZodISOTime",(e,t)=>{nv.init(e,t),_e.init(e,t)});function Vb(e){return hg(ol,e)}var al=k("ZodISODuration",(e,t)=>{rv.init(e,t),_e.init(e,t)});function Ub(e){return vg(al,e)}var Mb=(e,t)=>{bo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>au(e,r)},flatten:{value:r=>ou(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Fi,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Fi,2)}},isEmpty:{get(){return e.issues.length===0}}})},kj=k("ZodError",Mb),tt=k("ZodError",Mb,{Parent:Error}),Rb=jr(tt),Fb=Tr(tt),Lb=Pr(tt),Zb=Or(tt),Bb=su(tt),Wb=uu(tt),Hb=lu(tt),Jb=cu(tt),Gb=du(tt),Kb=fu(tt),Xb=mu(tt),qb=pu(tt),Ij=ct({ZodAny:()=>pl,ZodArray:()=>bl,ZodBase64:()=>Ho,ZodBase64URL:()=>Jo,ZodBigInt:()=>Br,ZodBigIntFormat:()=>Xo,ZodBoolean:()=>Zr,ZodCIDRv4:()=>Bo,ZodCIDRv6:()=>Wo,ZodCUID:()=>Vo,ZodCUID2:()=>Uo,ZodCatch:()=>Rl,ZodCodec:()=>Kr,ZodCustom:()=>Xr,ZodCustomStringFormat:()=>Fn,ZodDate:()=>Yo,ZodDefault:()=>Cl,ZodDiscriminatedUnion:()=>_l,ZodE164:()=>Go,ZodEmail:()=>Co,ZodEmoji:()=>Ao,ZodEnum:()=>An,ZodExactOptional:()=>Dl,ZodFile:()=>Pl,ZodFunction:()=>Xl,ZodGUID:()=>hr,ZodIPv4:()=>Lo,ZodIPv6:()=>Zo,ZodIntersection:()=>$l,ZodJWT:()=>Ko,ZodKSUID:()=>Fo,ZodLazy:()=>Jl,ZodLiteral:()=>Tl,ZodMAC:()=>sl,ZodMap:()=>Il,ZodNaN:()=>Ll,ZodNanoID:()=>No,ZodNever:()=>vl,ZodNonOptional:()=>ra,ZodNull:()=>fl,ZodNullable:()=>El,ZodNumber:()=>Lr,ZodNumberFormat:()=>pn,ZodObject:()=>Hr,ZodOptional:()=>na,ZodPipe:()=>Gr,ZodPrefault:()=>Nl,ZodPreprocess:()=>Zl,ZodPromise:()=>Kl,ZodReadonly:()=>Bl,ZodRecord:()=>Cn,ZodSet:()=>jl,ZodString:()=>Rr,ZodStringFormat:()=>_e,ZodSuccess:()=>Ml,ZodSymbol:()=>cl,ZodTemplateLiteral:()=>Hl,ZodTransform:()=>Ol,ZodTuple:()=>Sl,ZodType:()=>ie,ZodULID:()=>Mo,ZodURL:()=>Fr,ZodUUID:()=>jt,ZodUndefined:()=>dl,ZodUnion:()=>Jr,ZodUnknown:()=>hl,ZodVoid:()=>gl,ZodXID:()=>Ro,ZodXor:()=>yl,_ZodString:()=>Eo,_default:()=>Al,_function:()=>Ki,any:()=>Ay,array:()=>Wr,base64:()=>by,base64url:()=>yy,bigint:()=>Oy,boolean:()=>ll,catch:()=>Fl,check:()=>i_,cidrv4:()=>vy,cidrv6:()=>gy,codec:()=>e_,cuid:()=>uy,cuid2:()=>ly,custom:()=>o_,date:()=>Vy,describe:()=>a_,discriminatedUnion:()=>Zy,e164:()=>_y,email:()=>Yb,emoji:()=>ay,enum:()=>ea,exactOptional:()=>zl,file:()=>Xy,float32:()=>Iy,float64:()=>jy,function:()=>Ki,guid:()=>Qb,hash:()=>ky,hex:()=>wy,hostname:()=>Sy,httpUrl:()=>oy,instanceof:()=>u_,int:()=>Ji,int32:()=>Ty,int64:()=>Dy,intersection:()=>xl,invertCodec:()=>t_,ipv4:()=>my,ipv6:()=>hy,json:()=>c_,jwt:()=>$y,keyof:()=>Uy,ksuid:()=>fy,lazy:()=>Gl,literal:()=>Ky,looseObject:()=>Fy,looseRecord:()=>Wy,mac:()=>py,map:()=>Hy,meta:()=>s_,nan:()=>Qy,nanoid:()=>sy,nativeEnum:()=>Gy,never:()=>qo,nonoptional:()=>Ul,null:()=>ml,nullable:()=>gr,nullish:()=>qy,number:()=>ul,object:()=>My,optional:()=>vr,partialRecord:()=>By,pipe:()=>Gi,prefault:()=>Vl,preprocess:()=>d_,promise:()=>r_,readonly:()=>Wl,record:()=>kl,refine:()=>ql,set:()=>Jy,strictObject:()=>Ry,string:()=>pr,stringFormat:()=>xy,stringbool:()=>l_,success:()=>Yy,superRefine:()=>Yl,symbol:()=>Ey,templateLiteral:()=>n_,transform:()=>ta,tuple:()=>wl,uint32:()=>Py,uint64:()=>zy,ulid:()=>cy,undefined:()=>Cy,union:()=>Qo,unknown:()=>fn,url:()=>iy,uuid:()=>ey,uuidv4:()=>ty,uuidv6:()=>ny,uuidv7:()=>ry,void:()=>Ny,xid:()=>dy,xor:()=>Ly}),Md=new WeakMap;function Mr(e,t,r){const i=Object.getPrototypeOf(e);let n=Md.get(i);if(n||(n=new Set,Md.set(i,n)),!n.has(t)){n.add(t);for(const o in r){const a=r[o];Object.defineProperty(i,o,{configurable:!0,enumerable:!1,get(){const s=a.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:s}),s},set(s){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:s})}})}}}var ie=k("ZodType",(e,t)=>(ne.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:mr(e,"input"),output:mr(e,"output")}}),e.toJSONSchema=Kg(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,i)=>Rb(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>Lb(e,r,i),e.parseAsync=async(r,i)=>Fb(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>Zb(e,r,i),e.spa=e.safeParseAsync,e.encode=(r,i)=>Bb(e,r,i),e.decode=(r,i)=>Wb(e,r,i),e.encodeAsync=async(r,i)=>Hb(e,r,i),e.decodeAsync=async(r,i)=>Jb(e,r,i),e.safeEncode=(r,i)=>Gb(e,r,i),e.safeDecode=(r,i)=>Kb(e,r,i),e.safeEncodeAsync=async(r,i)=>Xb(e,r,i),e.safeDecodeAsync=async(r,i)=>qb(e,r,i),Mr(e,"ZodType",{check(...r){const i=this.def;return this.clone(Dt(i,{checks:[...i.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,i){return dt(this,r,i)},brand(){return this},register(r,i){return r.add(this,i),this},refine(r,i){return this.check(ql(r,i))},superRefine(r,i){return this.check(Yl(r,i))},overwrite(r){return this.check(Ut(r))},optional(){return vr(this)},exactOptional(){return zl(this)},nullable(){return gr(this)},nullish(){return vr(gr(this))},nonoptional(r){return Ul(this,r)},array(){return Wr(this)},or(r){return Qo([this,r])},and(r){return xl(this,r)},transform(r){return Gi(this,ta(r))},default(r){return Al(this,r)},prefault(r){return Vl(this,r)},catch(r){return Fl(this,r)},pipe(r){return Gi(this,r)},readonly(){return Wl(this)},describe(r){const i=this.clone();return at.add(i,{description:r}),i},meta(...r){if(r.length===0)return at.get(this);const i=this.clone();return at.add(i,r[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return at.get(e)?.description},configurable:!0}),e)),Eo=k("_ZodString",(e,t)=>{Cr.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(i,n,o)=>Xg(e,i,n,o);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Mr(e,"_ZodString",{regex(...i){return this.check($o(...i))},includes(...i){return this.check(wo(...i))},startsWith(...i){return this.check(ko(...i))},endsWith(...i){return this.check(Io(...i))},min(...i){return this.check(dn(...i))},max(...i){return this.check(Nr(...i))},length(...i){return this.check(Vr(...i))},nonempty(...i){return this.check(dn(1,...i))},lowercase(i){return this.check(xo(i))},uppercase(i){return this.check(So(i))},trim(){return this.check(Po())},normalize(...i){return this.check(To(...i))},toLowerCase(){return this.check(Oo())},toUpperCase(){return this.check(Do())},slugify(){return this.check(zo())}})}),Rr=k("ZodString",(e,t)=>{Cr.init(e,t),Eo.init(e,t),e.email=r=>e.check(Ou(Co,r)),e.url=r=>e.check(_o(Fr,r)),e.jwt=r=>e.check(Ku(Ko,r)),e.emoji=r=>e.check(Au(Ao,r)),e.guid=r=>e.check(Hi(hr,r)),e.uuid=r=>e.check(Du(jt,r)),e.uuidv4=r=>e.check(zu(jt,r)),e.uuidv6=r=>e.check(Eu(jt,r)),e.uuidv7=r=>e.check(Cu(jt,r)),e.nanoid=r=>e.check(Nu(No,r)),e.guid=r=>e.check(Hi(hr,r)),e.cuid=r=>e.check(Vu(Vo,r)),e.cuid2=r=>e.check(Uu(Uo,r)),e.ulid=r=>e.check(Mu(Mo,r)),e.base64=r=>e.check(Hu(Ho,r)),e.base64url=r=>e.check(Ju(Jo,r)),e.xid=r=>e.check(Ru(Ro,r)),e.ksuid=r=>e.check(Fu(Fo,r)),e.ipv4=r=>e.check(Lu(Lo,r)),e.ipv6=r=>e.check(Zu(Zo,r)),e.cidrv4=r=>e.check(Bu(Bo,r)),e.cidrv6=r=>e.check(Wu(Wo,r)),e.e164=r=>e.check(Gu(Go,r)),e.datetime=r=>e.check(Ab(r)),e.date=r=>e.check(Nb(r)),e.time=r=>e.check(Vb(r)),e.duration=r=>e.check(Ub(r))});function pr(e){return lg(Rr,e)}var _e=k("ZodStringFormat",(e,t)=>{ye.init(e,t),Eo.init(e,t)}),Co=k("ZodEmail",(e,t)=>{Wh.init(e,t),_e.init(e,t)});function Yb(e){return Ou(Co,e)}var hr=k("ZodGUID",(e,t)=>{Zh.init(e,t),_e.init(e,t)});function Qb(e){return Hi(hr,e)}var jt=k("ZodUUID",(e,t)=>{Bh.init(e,t),_e.init(e,t)});function ey(e){return Du(jt,e)}function ty(e){return zu(jt,e)}function ny(e){return Eu(jt,e)}function ry(e){return Cu(jt,e)}var Fr=k("ZodURL",(e,t)=>{Hh.init(e,t),_e.init(e,t)});function iy(e){return _o(Fr,e)}function oy(e){return _o(Fr,{protocol:gu,hostname:ah,...D(e)})}var Ao=k("ZodEmoji",(e,t)=>{Jh.init(e,t),_e.init(e,t)});function ay(e){return Au(Ao,e)}var No=k("ZodNanoID",(e,t)=>{Gh.init(e,t),_e.init(e,t)});function sy(e){return Nu(No,e)}var Vo=k("ZodCUID",(e,t)=>{Kh.init(e,t),_e.init(e,t)});function uy(e){return Vu(Vo,e)}var Uo=k("ZodCUID2",(e,t)=>{Xh.init(e,t),_e.init(e,t)});function ly(e){return Uu(Uo,e)}var Mo=k("ZodULID",(e,t)=>{qh.init(e,t),_e.init(e,t)});function cy(e){return Mu(Mo,e)}var Ro=k("ZodXID",(e,t)=>{Yh.init(e,t),_e.init(e,t)});function dy(e){return Ru(Ro,e)}var Fo=k("ZodKSUID",(e,t)=>{Qh.init(e,t),_e.init(e,t)});function fy(e){return Fu(Fo,e)}var Lo=k("ZodIPv4",(e,t)=>{iv.init(e,t),_e.init(e,t)});function my(e){return Lu(Lo,e)}var sl=k("ZodMAC",(e,t)=>{av.init(e,t),_e.init(e,t)});function py(e){return dg(sl,e)}var Zo=k("ZodIPv6",(e,t)=>{ov.init(e,t),_e.init(e,t)});function hy(e){return Zu(Zo,e)}var Bo=k("ZodCIDRv4",(e,t)=>{sv.init(e,t),_e.init(e,t)});function vy(e){return Bu(Bo,e)}var Wo=k("ZodCIDRv6",(e,t)=>{uv.init(e,t),_e.init(e,t)});function gy(e){return Wu(Wo,e)}var Ho=k("ZodBase64",(e,t)=>{lv.init(e,t),_e.init(e,t)});function by(e){return Hu(Ho,e)}var Jo=k("ZodBase64URL",(e,t)=>{dv.init(e,t),_e.init(e,t)});function yy(e){return Ju(Jo,e)}var Go=k("ZodE164",(e,t)=>{fv.init(e,t),_e.init(e,t)});function _y(e){return Gu(Go,e)}var Ko=k("ZodJWT",(e,t)=>{pv.init(e,t),_e.init(e,t)});function $y(e){return Ku(Ko,e)}var Fn=k("ZodCustomStringFormat",(e,t)=>{hv.init(e,t),_e.init(e,t)});function xy(e,t,r={}){return Ur(Fn,e,t,r)}function Sy(e){return Ur(Fn,"hostname",oh,e)}function wy(e){return Ur(Fn,"hex",$h,e)}function ky(e,t){const r=`${e}_${t?.enc??"hex"}`,i=hu[r];if(!i)throw new Error(`Unrecognized hash format: ${r}`);return Ur(Fn,r,i,t)}var Lr=k("ZodNumber",(e,t)=>{xu.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(i,n,o)=>qg(e,i,n,o),Mr(e,"ZodNumber",{gt(i,n){return this.check(Lt(i,n))},gte(i,n){return this.check(He(i,n))},min(i,n){return this.check(He(i,n))},lt(i,n){return this.check(Ft(i,n))},lte(i,n){return this.check(ut(i,n))},max(i,n){return this.check(ut(i,n))},int(i){return this.check(Ji(i))},safe(i){return this.check(Ji(i))},positive(i){return this.check(Lt(0,i))},nonnegative(i){return this.check(He(0,i))},negative(i){return this.check(Ft(0,i))},nonpositive(i){return this.check(ut(0,i))},multipleOf(i,n){return this.check(On(i,n))},step(i,n){return this.check(On(i,n))},finite(){return this}});const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function ul(e){return gg(Lr,e)}var pn=k("ZodNumberFormat",(e,t)=>{vv.init(e,t),Lr.init(e,t)});function Ji(e){return yg(pn,e)}function Iy(e){return _g(pn,e)}function jy(e){return $g(pn,e)}function Ty(e){return xg(pn,e)}function Py(e){return Sg(pn,e)}var Zr=k("ZodBoolean",(e,t)=>{Su.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Yg(e,r,i,n)});function ll(e){return wg(Zr,e)}var Br=k("ZodBigInt",(e,t)=>{wu.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(i,n,o)=>Qg(e,i,n,o),e.gte=(i,n)=>e.check(He(i,n)),e.min=(i,n)=>e.check(He(i,n)),e.gt=(i,n)=>e.check(Lt(i,n)),e.gte=(i,n)=>e.check(He(i,n)),e.min=(i,n)=>e.check(He(i,n)),e.lt=(i,n)=>e.check(Ft(i,n)),e.lte=(i,n)=>e.check(ut(i,n)),e.max=(i,n)=>e.check(ut(i,n)),e.positive=i=>e.check(Lt(BigInt(0),i)),e.negative=i=>e.check(Ft(BigInt(0),i)),e.nonpositive=i=>e.check(ut(BigInt(0),i)),e.nonnegative=i=>e.check(He(BigInt(0),i)),e.multipleOf=(i,n)=>e.check(On(i,n));const r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function Oy(e){return Ig(Br,e)}var Xo=k("ZodBigIntFormat",(e,t)=>{gv.init(e,t),Br.init(e,t)});function Dy(e){return Tg(Xo,e)}function zy(e){return Pg(Xo,e)}var cl=k("ZodSymbol",(e,t)=>{bv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>eb(e,r,i,n)});function Ey(e){return Og(cl,e)}var dl=k("ZodUndefined",(e,t)=>{yv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>nb(e,r,i,n)});function Cy(e){return Dg(dl,e)}var fl=k("ZodNull",(e,t)=>{_v.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>tb(e,r,i,n)});function ml(e){return zg(fl,e)}var pl=k("ZodAny",(e,t)=>{$v.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>ob(e,r,i,n)});function Ay(){return Eg(pl)}var hl=k("ZodUnknown",(e,t)=>{xv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>ab(e,r,i,n)});function fn(){return Cg(hl)}var vl=k("ZodNever",(e,t)=>{Sv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>ib(e,r,i,n)});function qo(e){return Ag(vl,e)}var gl=k("ZodVoid",(e,t)=>{wv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>rb(e,r,i,n)});function Ny(e){return Ng(gl,e)}var Yo=k("ZodDate",(e,t)=>{kv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(i,n,o)=>sb(e,i,n,o),e.min=(i,n)=>e.check(He(i,n)),e.max=(i,n)=>e.check(ut(i,n));const r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function Vy(e){return Vg(Yo,e)}var bl=k("ZodArray",(e,t)=>{Iv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>yb(e,r,i,n),e.element=t.element,Mr(e,"ZodArray",{min(r,i){return this.check(dn(r,i))},nonempty(r){return this.check(dn(1,r))},max(r,i){return this.check(Nr(r,i))},length(r,i){return this.check(Vr(r,i))},unwrap(){return this.element}})});function Wr(e,t){return Rg(bl,e,t)}function Uy(e){const t=e._zod.def.shape;return ea(Object.keys(t))}var Hr=k("ZodObject",(e,t)=>{Ov.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>_b(e,r,i,n),se(e,"shape",()=>t.shape),Mr(e,"ZodObject",{keyof(){return ea(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:fn()})},loose(){return this.clone({...this._zod.def,catchall:fn()})},strict(){return this.clone({...this._zod.def,catchall:qo()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return Tp(this,r)},safeExtend(r){return Pp(this,r)},merge(r){return Op(this,r)},pick(r){return Ip(this,r)},omit(r){return jp(this,r)},partial(...r){return Dp(na,this,r[0])},required(...r){return zp(ra,this,r[0])}})});function My(e,t){const r={type:"object",shape:e??{},...D(t)};return new Hr(r)}function Ry(e,t){return new Hr({type:"object",shape:e,catchall:qo(),...D(t)})}function Fy(e,t){return new Hr({type:"object",shape:e,catchall:fn(),...D(t)})}var Jr=k("ZodUnion",(e,t)=>{yo.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>tl(e,r,i,n),e.options=t.options});function Qo(e,t){return new Jr({type:"union",options:e,...D(t)})}var yl=k("ZodXor",(e,t)=>{Jr.init(e,t),Dv.init(e,t),e._zod.processJSONSchema=(r,i,n)=>tl(e,r,i,n),e.options=t.options});function Ly(e,t){return new yl({type:"union",options:e,inclusive:!1,...D(t)})}var _l=k("ZodDiscriminatedUnion",(e,t)=>{Jr.init(e,t),zv.init(e,t)});function Zy(e,t,r){return new _l({type:"union",options:t,discriminator:e,...D(r)})}var $l=k("ZodIntersection",(e,t)=>{Ev.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>$b(e,r,i,n)});function xl(e,t){return new $l({type:"intersection",left:e,right:t})}var Sl=k("ZodTuple",(e,t)=>{ku.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>xb(e,r,i,n),e.rest=r=>e.clone({...e._zod.def,rest:r})});function wl(e,t,r){const i=t instanceof ne,n=i?r:t;return new Sl({type:"tuple",items:e,rest:i?t:null,...D(n)})}var Cn=k("ZodRecord",(e,t)=>{Cv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Sb(e,r,i,n),e.keyType=t.keyType,e.valueType=t.valueType});function kl(e,t,r){return!t||!t._zod?new Cn({type:"record",keyType:pr(),valueType:e,...D(t)}):new Cn({type:"record",keyType:e,valueType:t,...D(r)})}function By(e,t,r){const i=dt(e);return i._zod.values=void 0,new Cn({type:"record",keyType:i,valueType:t,...D(r)})}function Wy(e,t,r){return new Cn({type:"record",keyType:e,valueType:t,mode:"loose",...D(r)})}var Il=k("ZodMap",(e,t)=>{Av.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>gb(e,r,i,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Zt(...r)),e.nonempty=r=>e.check(Zt(1,r)),e.max=(...r)=>e.check(Rn(...r)),e.size=(...r)=>e.check(Ar(...r))});function Hy(e,t,r){return new Il({type:"map",keyType:e,valueType:t,...D(r)})}var jl=k("ZodSet",(e,t)=>{Nv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>bb(e,r,i,n),e.min=(...r)=>e.check(Zt(...r)),e.nonempty=r=>e.check(Zt(1,r)),e.max=(...r)=>e.check(Rn(...r)),e.size=(...r)=>e.check(Ar(...r))});function Jy(e,t){return new jl({type:"set",valueType:e,...D(t)})}var An=k("ZodEnum",(e,t)=>{Vv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(i,n,o)=>ub(e,i,n,o),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(i,n)=>{const o={};for(const a of i)if(r.has(a))o[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new An({...t,checks:[],...D(n),entries:o})},e.exclude=(i,n)=>{const o={...t.entries};for(const a of i)if(r.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new An({...t,checks:[],...D(n),entries:o})}});function ea(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new An({type:"enum",entries:r,...D(t)})}function Gy(e,t){return new An({type:"enum",entries:e,...D(t)})}var Tl=k("ZodLiteral",(e,t)=>{Uv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>lb(e,r,i,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Ky(e,t){return new Tl({type:"literal",values:Array.isArray(e)?e:[e],...D(t)})}var Pl=k("ZodFile",(e,t)=>{Mv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>fb(e,r,i,n),e.min=(r,i)=>e.check(Zt(r,i)),e.max=(r,i)=>e.check(Rn(r,i)),e.mime=(r,i)=>e.check(jo(Array.isArray(r)?r:[r],i))});function Xy(e){return Fg(Pl,e)}var Ol=k("ZodTransform",(e,t)=>{Rv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>vb(e,r,i,n),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new mo(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(Tn(o,r.value,t));else{const a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(Tn(a))}};const n=t.transform(r.value,r);return n instanceof Promise?n.then(o=>(r.value=o,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function ta(e){return new Ol({type:"transform",transform:e})}var na=k("ZodOptional",(e,t)=>{Iu.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>nl(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function vr(e){return new na({type:"optional",innerType:e})}var Dl=k("ZodExactOptional",(e,t)=>{Fv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>nl(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function zl(e){return new Dl({type:"optional",innerType:e})}var El=k("ZodNullable",(e,t)=>{Lv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>wb(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function gr(e){return new El({type:"nullable",innerType:e})}function qy(e){return vr(gr(e))}var Cl=k("ZodDefault",(e,t)=>{Zv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Ib(e,r,i,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Al(e,t){return new Cl({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ho(t)}})}var Nl=k("ZodPrefault",(e,t)=>{Bv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>jb(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function Vl(e,t){return new Nl({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ho(t)}})}var ra=k("ZodNonOptional",(e,t)=>{Wv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>kb(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function Ul(e,t){return new ra({type:"nonoptional",innerType:e,...D(t)})}var Ml=k("ZodSuccess",(e,t)=>{Hv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>mb(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function Yy(e){return new Ml({type:"success",innerType:e})}var Rl=k("ZodCatch",(e,t)=>{Jv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Tb(e,r,i,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Fl(e,t){return new Rl({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Ll=k("ZodNaN",(e,t)=>{Gv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>cb(e,r,i,n)});function Qy(e){return Mg(Ll,e)}var Gr=k("ZodPipe",(e,t)=>{ju.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Pb(e,r,i,n),e.in=t.in,e.out=t.out});function Gi(e,t){return new Gr({type:"pipe",in:e,out:t})}var Kr=k("ZodCodec",(e,t)=>{Gr.init(e,t),Tu.init(e,t)});function e_(e,t,r){return new Kr({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function t_(e){const t=e._zod.def;return new Kr({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var Zl=k("ZodPreprocess",(e,t)=>{Gr.init(e,t),Kv.init(e,t)}),Bl=k("ZodReadonly",(e,t)=>{Xv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Ob(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function Wl(e){return new Bl({type:"readonly",innerType:e})}var Hl=k("ZodTemplateLiteral",(e,t)=>{qv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>db(e,r,i,n)});function n_(e,t){return new Hl({type:"template_literal",parts:e,...D(t)})}var Jl=k("ZodLazy",(e,t)=>{eg.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>zb(e,r,i,n),e.unwrap=()=>e._zod.def.getter()});function Gl(e){return new Jl({type:"lazy",getter:e})}var Kl=k("ZodPromise",(e,t)=>{Qv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Db(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function r_(e){return new Kl({type:"promise",innerType:e})}var Xl=k("ZodFunction",(e,t)=>{Yv.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>hb(e,r,i,n)});function Ki(e){return new Xl({type:"function",input:Array.isArray(e?.input)?wl(e?.input):e?.input??Wr(fn()),output:e?.output??fn()})}var Xr=k("ZodCustom",(e,t)=>{tg.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,i,n)=>pb(e,r,i,n)});function i_(e){const t=new $e({check:"custom"});return t._zod.check=e,t}function o_(e,t){return Lg(Xr,e??(()=>!0),t)}function ql(e,t={}){return Zg(Xr,e,t)}function Yl(e,t){return Bg(e,t)}var a_=Hg,s_=Jg;function u_(e,t={}){const r=new Xr({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,...D(t)});return r._zod.bag.Class=e,r._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:r,path:[...r._zod.def.path??[]]})},r}var l_=(...e)=>Gg({Codec:Kr,Boolean:Zr,String:Rr},...e);function c_(e){const t=Gl(()=>Qo([pr(e),ul(),ll(),ml(),Wr(t),kl(pr(),t)]));return t}function d_(e,t){return new Zl({type:"pipe",in:ta(e),out:t})}var jj={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Tj(e){Ve({customError:e})}function Pj(){return Ve().customError}var fs;fs||(fs={});var R={...Ij,...wj,iso:Cb},Oj=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function Dj(e,t){const r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function zj(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");const r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;const i=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===i){const n=r[1];if(!n||!t.defs[n])throw new Error(`Reference not found: ${e}`);return t.defs[n]}throw new Error(`Reference not found: ${e}`)}function f_(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return R.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){const n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return R.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);const o=Me(zj(n,t),t);return t.refs.set(n,o),t.processing.delete(n),o}if(e.enum!==void 0){const n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return R.null();if(n.length===0)return R.never();if(n.length===1)return R.literal(n[0]);if(n.every(a=>typeof a=="string"))return R.enum(n);const o=n.map(a=>R.literal(a));return o.length<2?o[0]:R.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return R.literal(e.const);const r=e.type;if(Array.isArray(r)){const n=r.map(o=>f_({...e,type:o},t));return n.length===0?R.never():n.length===1?n[0]:R.union(n)}if(!r)return R.any();let i;switch(r){case"string":{let n=R.string();if(e.format){const o=e.format;o==="email"?n=n.check(R.email()):o==="uri"||o==="uri-reference"?n=n.check(R.url()):o==="uuid"||o==="guid"?n=n.check(R.uuid()):o==="date-time"?n=n.check(R.iso.datetime()):o==="date"?n=n.check(R.iso.date()):o==="time"?n=n.check(R.iso.time()):o==="duration"?n=n.check(R.iso.duration()):o==="ipv4"?n=n.check(R.ipv4()):o==="ipv6"?n=n.check(R.ipv6()):o==="mac"?n=n.check(R.mac()):o==="cidr"?n=n.check(R.cidrv4()):o==="cidr-v6"?n=n.check(R.cidrv6()):o==="base64"?n=n.check(R.base64()):o==="base64url"?n=n.check(R.base64url()):o==="e164"?n=n.check(R.e164()):o==="jwt"?n=n.check(R.jwt()):o==="emoji"?n=n.check(R.emoji()):o==="nanoid"?n=n.check(R.nanoid()):o==="cuid"?n=n.check(R.cuid()):o==="cuid2"?n=n.check(R.cuid2()):o==="ulid"?n=n.check(R.ulid()):o==="xid"?n=n.check(R.xid()):o==="ksuid"&&(n=n.check(R.ksuid()))}typeof e.minLength=="number"&&(n=n.min(e.minLength)),typeof e.maxLength=="number"&&(n=n.max(e.maxLength)),e.pattern&&(n=n.regex(new RegExp(e.pattern))),i=n;break}case"number":case"integer":{let n=r==="integer"?R.number().int():R.number();typeof e.minimum=="number"&&(n=n.min(e.minimum)),typeof e.maximum=="number"&&(n=n.max(e.maximum)),typeof e.exclusiveMinimum=="number"?n=n.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(n=n.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?n=n.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(n=n.lt(e.maximum)),typeof e.multipleOf=="number"&&(n=n.multipleOf(e.multipleOf)),i=n;break}case"boolean":i=R.boolean();break;case"null":i=R.null();break;case"object":{const n={},o=e.properties||{},a=new Set(e.required||[]);for(const[u,l]of Object.entries(o)){const c=Me(l,t);n[u]=a.has(u)?c:c.optional()}if(e.propertyNames){const u=Me(e.propertyNames,t),l=e.additionalProperties&&typeof e.additionalProperties=="object"?Me(e.additionalProperties,t):R.any();if(Object.keys(n).length===0){i=R.record(u,l);break}const c=R.object(n).passthrough(),d=R.looseRecord(u,l);i=R.intersection(c,d);break}if(e.patternProperties){const u=e.patternProperties,l=Object.keys(u),c=[];for(const m of l){const h=Me(u[m],t),v=R.string().regex(new RegExp(m));c.push(R.looseRecord(v,h))}const d=[];if(Object.keys(n).length>0&&d.push(R.object(n).passthrough()),d.push(...c),d.length===0)i=R.object({}).passthrough();else if(d.length===1)i=d[0];else{let m=R.intersection(d[0],d[1]);for(let h=2;hMe(u,t)),s=o&&typeof o=="object"&&!Array.isArray(o)?Me(o,t):void 0;s?i=R.tuple(a).rest(s):i=R.tuple(a),typeof e.minItems=="number"&&(i=i.check(R.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(R.maxLength(e.maxItems)))}else if(Array.isArray(o)){const a=o.map(u=>Me(u,t)),s=e.additionalItems&&typeof e.additionalItems=="object"?Me(e.additionalItems,t):void 0;s?i=R.tuple(a).rest(s):i=R.tuple(a),typeof e.minItems=="number"&&(i=i.check(R.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(R.maxLength(e.maxItems)))}else if(o!==void 0){const a=Me(o,t);let s=R.array(a);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),i=s}else i=R.array(R.any());break}default:throw new Error(`Unsupported type: ${r}`)}return i}function Me(e,t){if(typeof e=="boolean")return e?R.any():R.never();let r=f_(e,t);const i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){const o=e.anyOf.map(s=>Me(s,t)),a=R.union(o);r=i?R.intersection(r,a):a}if(e.oneOf&&Array.isArray(e.oneOf)){const o=e.oneOf.map(s=>Me(s,t)),a=R.xor(o);r=i?R.intersection(r,a):a}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=i?r:R.any();else{let o=i?r:Me(e.allOf[0],t);const a=i?0:1;for(let s=a;s0&&t.registry.add(r,n),e.description&&(r=r.describe(e.description)),r}function Ej(e,t){if(typeof e=="boolean")return e?R.any():R.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}const i={version:Dj(r,t?.defaultTarget),defs:r.$defs||r.definitions||{},refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??at};return Me(r,i)}var Cj=ct({bigint:()=>Uj,boolean:()=>Vj,date:()=>Mj,number:()=>Nj,string:()=>Aj});function Aj(e){return cg(Rr,e)}function Nj(e){return bg(Lr,e)}function Vj(e){return kg(Zr,e)}function Uj(e){return jg(Br,e)}function Mj(e){return Ug(Yo,e)}var Rj=ct({$brand:()=>gp,$input:()=>sg,$output:()=>ag,NEVER:()=>vp,TimePrecision:()=>fg,ZodAny:()=>pl,ZodArray:()=>bl,ZodBase64:()=>Ho,ZodBase64URL:()=>Jo,ZodBigInt:()=>Br,ZodBigIntFormat:()=>Xo,ZodBoolean:()=>Zr,ZodCIDRv4:()=>Bo,ZodCIDRv6:()=>Wo,ZodCUID:()=>Vo,ZodCUID2:()=>Uo,ZodCatch:()=>Rl,ZodCodec:()=>Kr,ZodCustom:()=>Xr,ZodCustomStringFormat:()=>Fn,ZodDate:()=>Yo,ZodDefault:()=>Cl,ZodDiscriminatedUnion:()=>_l,ZodE164:()=>Go,ZodEmail:()=>Co,ZodEmoji:()=>Ao,ZodEnum:()=>An,ZodError:()=>kj,ZodExactOptional:()=>Dl,ZodFile:()=>Pl,ZodFirstPartyTypeKind:()=>fs,ZodFunction:()=>Xl,ZodGUID:()=>hr,ZodIPv4:()=>Lo,ZodIPv6:()=>Zo,ZodISODate:()=>il,ZodISODateTime:()=>rl,ZodISODuration:()=>al,ZodISOTime:()=>ol,ZodIntersection:()=>$l,ZodIssueCode:()=>jj,ZodJWT:()=>Ko,ZodKSUID:()=>Fo,ZodLazy:()=>Jl,ZodLiteral:()=>Tl,ZodMAC:()=>sl,ZodMap:()=>Il,ZodNaN:()=>Ll,ZodNanoID:()=>No,ZodNever:()=>vl,ZodNonOptional:()=>ra,ZodNull:()=>fl,ZodNullable:()=>El,ZodNumber:()=>Lr,ZodNumberFormat:()=>pn,ZodObject:()=>Hr,ZodOptional:()=>na,ZodPipe:()=>Gr,ZodPrefault:()=>Nl,ZodPreprocess:()=>Zl,ZodPromise:()=>Kl,ZodReadonly:()=>Bl,ZodRealError:()=>tt,ZodRecord:()=>Cn,ZodSet:()=>jl,ZodString:()=>Rr,ZodStringFormat:()=>_e,ZodSuccess:()=>Ml,ZodSymbol:()=>cl,ZodTemplateLiteral:()=>Hl,ZodTransform:()=>Ol,ZodTuple:()=>Sl,ZodType:()=>ie,ZodULID:()=>Mo,ZodURL:()=>Fr,ZodUUID:()=>jt,ZodUndefined:()=>dl,ZodUnion:()=>Jr,ZodUnknown:()=>hl,ZodVoid:()=>gl,ZodXID:()=>Ro,ZodXor:()=>yl,_ZodString:()=>Eo,_default:()=>Al,_function:()=>Ki,any:()=>Ay,array:()=>Wr,base64:()=>by,base64url:()=>yy,bigint:()=>Oy,boolean:()=>ll,catch:()=>Fl,check:()=>i_,cidrv4:()=>vy,cidrv6:()=>gy,clone:()=>dt,codec:()=>e_,coerce:()=>Cj,config:()=>Ve,core:()=>Sj,cuid:()=>uy,cuid2:()=>ly,custom:()=>o_,date:()=>Vy,decode:()=>Wb,decodeAsync:()=>Jb,describe:()=>a_,discriminatedUnion:()=>Zy,e164:()=>_y,email:()=>Yb,emoji:()=>ay,encode:()=>Bb,encodeAsync:()=>Hb,endsWith:()=>Io,enum:()=>ea,exactOptional:()=>zl,file:()=>Xy,flattenError:()=>ou,float32:()=>Iy,float64:()=>jy,formatError:()=>au,fromJSONSchema:()=>Ej,function:()=>Ki,getErrorMap:()=>Pj,globalRegistry:()=>at,gt:()=>Lt,gte:()=>He,guid:()=>Qb,hash:()=>ky,hex:()=>wy,hostname:()=>Sy,httpUrl:()=>oy,includes:()=>wo,instanceof:()=>u_,int:()=>Ji,int32:()=>Ty,int64:()=>Dy,intersection:()=>xl,invertCodec:()=>t_,ipv4:()=>my,ipv6:()=>hy,iso:()=>Cb,json:()=>c_,jwt:()=>$y,keyof:()=>Uy,ksuid:()=>fy,lazy:()=>Gl,length:()=>Vr,literal:()=>Ky,locales:()=>og,looseObject:()=>Fy,looseRecord:()=>Wy,lowercase:()=>xo,lt:()=>Ft,lte:()=>ut,mac:()=>py,map:()=>Hy,maxLength:()=>Nr,maxSize:()=>Rn,meta:()=>s_,mime:()=>jo,minLength:()=>dn,minSize:()=>Zt,multipleOf:()=>On,nan:()=>Qy,nanoid:()=>sy,nativeEnum:()=>Gy,negative:()=>qu,never:()=>qo,nonnegative:()=>Qu,nonoptional:()=>Ul,nonpositive:()=>Yu,normalize:()=>To,null:()=>ml,nullable:()=>gr,nullish:()=>qy,number:()=>ul,object:()=>My,optional:()=>vr,overwrite:()=>Ut,parse:()=>Rb,parseAsync:()=>Fb,partialRecord:()=>By,pipe:()=>Gi,positive:()=>Xu,prefault:()=>Vl,preprocess:()=>d_,prettifyError:()=>Mp,promise:()=>r_,property:()=>el,readonly:()=>Wl,record:()=>kl,refine:()=>ql,regex:()=>$o,regexes:()=>hu,registry:()=>Pu,safeDecode:()=>Kb,safeDecodeAsync:()=>qb,safeEncode:()=>Gb,safeEncodeAsync:()=>Xb,safeParse:()=>Lb,safeParseAsync:()=>Zb,set:()=>Jy,setErrorMap:()=>Tj,size:()=>Ar,slugify:()=>zo,startsWith:()=>ko,strictObject:()=>Ry,string:()=>pr,stringFormat:()=>xy,stringbool:()=>l_,success:()=>Yy,superRefine:()=>Yl,symbol:()=>Ey,templateLiteral:()=>n_,toJSONSchema:()=>Eb,toLowerCase:()=>Oo,toUpperCase:()=>Do,transform:()=>ta,treeifyError:()=>Vp,trim:()=>Po,tuple:()=>wl,uint32:()=>Py,uint64:()=>zy,ulid:()=>cy,undefined:()=>Cy,union:()=>Qo,unknown:()=>fn,uppercase:()=>So,url:()=>iy,util:()=>bp,uuid:()=>ey,uuidv4:()=>ty,uuidv6:()=>ny,uuidv7:()=>ry,void:()=>Ny,xid:()=>dy,xor:()=>Ly});Ve(ng());var C=Rj,Rd=(e,t,r)=>{if(e&&"reportValidity"in e){const i=F(r,t);e.setCustomValidity(i&&i.message||""),e.reportValidity()}},ms=(e,t)=>{for(const r in t.fields){const i=t.fields[r];i&&i.ref&&"reportValidity"in i.ref?Rd(i.ref,r,e):i&&i.refs&&i.refs.forEach(n=>Rd(n,r,e))}},Fd=(e,t)=>{t.shouldUseNativeValidation&&ms(e,t);const r={};for(const i in e){const n=F(t.fields,i),o=Object.assign(e[i]||{},{ref:n&&n.ref});if(Fj(t.names||Object.keys(e),i)){const a=Object.assign({},F(r,i));me(a,"root",o),me(r,i,a)}else me(r,i,o)}return r},Fj=(e,t)=>{const r=Ld(t).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(i=>Ld(i).match(`^${r}\\.\\d+`))};function Ld(e){return e.replace(/[\[\]]/g,"")}function ps(){return ps=Object.assign?Object.assign.bind():function(e){for(var t=1;t0){var u=n.errors[0][0];r[s]={message:u.message,type:u.code}}else r[s]={message:a,type:o};if(n.code==="invalid_union"&&n.errors.forEach(function(d){return d.forEach(function(m){return e.push(ps({},m,{path:[].concat(n.path,m.path)}))})}),t){var l=r[s].types,c=l&&l[n.code];r[s]=Qs(s,t,r,o,c?[].concat(c,n.message):n.message)}e.shift()};e.length;)i();return r}function qr(e,t,r){if(r===void 0&&(r={}),(function(i){return"_def"in i&&typeof i._def=="object"&&"typeName"in i._def})(e))return function(i,n,o){try{return Promise.resolve(Zd(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](i,t)).then(function(a){return o.shouldUseNativeValidation&&ms({},o),{errors:{},values:r.raw?Object.assign({},i):a}})},function(a){if((function(s){return Array.isArray(s?.issues)})(a))return{values:{},errors:Fd(Lj(a.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw a}))}catch(a){return Promise.reject(a)}};if((function(i){return"_zod"in i&&typeof i._zod=="object"})(e))return function(i,n,o){try{return Promise.resolve(Zd(function(){return Promise.resolve((r.mode==="sync"?Zi:Bi)(e,i,t)).then(function(a){return o.shouldUseNativeValidation&&ms({},o),{errors:{},values:r.raw?Object.assign({},i):a}})},function(a){if((function(s){return s instanceof bo})(a))return{values:{},errors:Fd(Zj(a.issues,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw a}))}catch(a){return Promise.reject(a)}};throw new Error("Invalid input: not a Zod schema")}function Bd(e){let t="";if(document.cookie&&document.cookie!==""){const r=document.cookie.split(";");for(let i=0;i({status:"none",home_assistant_entities:[],home_assistant_options:[],openhab_items:[],openhab_options:[],fetchEntities:async()=>{e({status:"loading"}),fetch("/rest/home_assistant/entities",{credentials:"same-origin",method:"GET",mode:"same-origin",headers:{"Content-Type":"application/json","X-CSRFToken":Bd("csrftoken")}}).then(t=>t.json()).then(t=>{e(r=>({...r,status:"loading",home_assistant_entities:t.items})),e(r=>({...r,home_assistant_options:Wd(t.items)})),fetch("/rest/openhab/items",{credentials:"same-origin",method:"GET",mode:"same-origin",headers:{"Content-Type":"application/json","X-CSRFToken":Bd("csrftoken")}}).then(r=>r.json()).then(r=>{e(i=>({...i,status:"loaded",openhab_items:r.items,openhab_options:Wd(r.items)}))})})}})),Bj=C.object({id:C.number().nullable(),type:C.string(),entity_type:C.string(),room_id:C.number(),entities_page_id:C.number(),room_view_position:C.number(),friendly_name:C.string().min(1),controller:C.string(),can_color_temperature:C.boolean().optional(),can_dim:C.boolean().optional(),can_rgb:C.boolean().optional(),controlled_by_nspanel_main_page:C.boolean().optional(),home_assistant_name:C.string().optional(),is_ceiling_light:C.boolean().optional(),openhab_item_color_temp:C.string().optional(),openhab_item_dimmer:C.string().optional(),openhab_item_rgb:C.string().optional()}),Wj=({innerProps:e,isDisabled:t,isFocused:r,isSelected:i,children:n,data:o})=>t?null:(0,p.jsxs)("div",{...e,className:`p-1 ${i?"bg-primary/20 rounded-sm":""} ${r?"bg-primary/20 rounded-sm":""}`,children:[(0,p.jsx)("span",{className:`mdi ${o.icon} me-2`}),n]}),di={Option:Wj},Hj=({controller:e,room_id:t,entities_page_id:r,room_view_position:i,id:n,onComplete:o})=>{const{handleSubmit:a,register:s,reset:u,getValues:l,setValue:c,formState:{isValid:d}}=kr({resolver:qr(Bj),defaultValues:{id:n??null,controller:e,type:"entity",entity_type:"light",room_id:t??-1,entities_page_id:r,room_view_position:i,can_color_temperature:!1,can_dim:!1,can_rgb:!1,controlled_by_nspanel_main_page:!0,is_ceiling_light:!1,home_assistant_name:"",openhab_item_color_temp:"",openhab_item_dimmer:"",openhab_item_rgb:""}});function m(f){let g="";if(document.cookie&&document.cookie!==""){const y=document.cookie.split(";");for(let x=0;x{if(n!=null){const f=We.getState().entities.find(g=>g.id==n);u(f)}},[n,We.getState().entities]);function h(f){console.log("Updating entity with data:",f),fetch("/rest/entities/lights",{credentials:"same-origin",method:"PUT",mode:"same-origin",headers:{"Content-Type":"application/json","X-CSRFToken":m("csrftoken")},body:JSON.stringify({values:f})}).then(async g=>{const y=await g.json();if(console.log("Entity created/updated. Got response:",y),!g.ok){const x=y&&y.message||g.status;return Promise.reject(x)}o?.()}).catch(g=>{console.error("There was an error!",g)})}const v={control:f=>`${f.isFocused?"border":"border-0"} border-accent p-2.5 text-sm rounded-box bg-base-300 rounded-md`,menu:()=>"bg-base-300 p-2.5 rounded-box",option:f=>`p-1 ${f.isSelected?"bg-primary/20 rounded-sm":""} ${f.isFocused?"bg-primary/20 rounded-sm":""}`};return(0,p.jsxs)("form",{onSubmit:a(h),children:[(0,p.jsx)("input",{type:"hidden",...s("id")}),(0,p.jsx)("input",{type:"hidden",...s("controller")}),(0,p.jsx)("input",{type:"hidden",...s("type")}),(0,p.jsx)("input",{type:"hidden",...s("entity_type")}),(0,p.jsx)("input",{type:"hidden",...s("room_id")}),(0,p.jsx)("input",{type:"hidden",...s("entities_page_id")}),(0,p.jsx)("input",{type:"hidden",...s("room_view_position")}),(0,p.jsxs)("div",{className:"w-full",children:[(0,p.jsx)("div",{className:"flex justify-center mb-4 duration-500 transition-transform ease-linear",children:(0,p.jsxs)("div",{className:"w-full",children:[(0,p.jsx)("label",{htmlFor:"add_new_light_name",className:"block mb-2 text-sm font-medium",children:"Name"}),(0,p.jsx)("div",{className:"flex flex-row-reverse",children:(0,p.jsx)("input",{className:"outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text",type:"text",id:"add_new_light_name",...s("friendly_name"),required:!0})})]})}),e=="home_assistant"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("label",{className:"block mb-2 text-sm font-medium",children:"Home Assistant entity"}),(0,p.jsx)(Re,{options:le.getState().home_assistant_options.filter(f=>f.value.startsWith("light.")||f.value.startsWith("switch.")),classNames:v,onChange:f=>c("home_assistant_name",f?f.value:"",{shouldValidate:!0,shouldDirty:!0}),unstyled:!0,components:di,value:le.getState().home_assistant_options.find(f=>f.value===l("home_assistant_name")),styles:{input:f=>({...f,"input:focus":{boxShadow:"none"}}),multiValueLabel:f=>({...f,whiteSpace:"normal",overflow:"visible"}),control:f=>({...f,transition:"none"})}})]}),(0,p.jsxs)("fieldset",{className:"fieldset mt-4",children:[(0,p.jsx)("input",{type:"hidden",...s("controlled_by_nspanel_main_page")}),(0,p.jsxs)("label",{className:`label ${l("controlled_by_nspanel_main_page")?"text-base-content":"text-base-content/50"}`,children:[(0,p.jsx)("input",{type:"checkbox",className:"toggle toggle-accent",checked:l("controlled_by_nspanel_main_page"),onClick:()=>{c("controlled_by_nspanel_main_page",!l("controlled_by_nspanel_main_page"),{shouldValidate:!0,shouldDirty:!0})}}),l("controlled_by_nspanel_main_page")?"Controlled by NSPanel main page":"Not controlled by NSPanel main page"]})]}),(0,p.jsx)("label",{className:"block mb-2 mt-4 text-sm font-medium",children:"Light type"}),(0,p.jsx)("input",{type:"hidden",...s("is_ceiling_light")}),(0,p.jsxs)("div",{className:"grid grid-cols-2 gap-4 w-full",children:[(0,p.jsxs)("div",{className:"group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10",onClick:()=>c("is_ceiling_light",!1,{shouldValidate:!0,shouldDirty:!0}),children:[(0,p.jsx)("div",{className:"flex justify-center items-center p-4",children:(0,p.jsx)("span",{className:`mdi mdi-lamp text-5xl text-neutral-content/50 group-hover:text-yellow-500 ${l("is_ceiling_light")?"":"text-yellow-500"}`})}),(0,p.jsx)("div",{className:"flex justify-center items-center",children:(0,p.jsx)("span",{className:"text-base-content/50 group-hover:text-base-content text-center",children:"Table light"})})]}),(0,p.jsxs)("div",{className:"group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10",onClick:()=>c("is_ceiling_light",!0,{shouldValidate:!0,shouldDirty:!0}),children:[(0,p.jsx)("div",{className:"flex justify-center items-center p-4",children:(0,p.jsx)("span",{className:`mdi mdi-ceiling-light text-5xl text-neutral-content/50 group-hover:text-yellow-500 ${l("is_ceiling_light")?"text-yellow-500":""}`})}),(0,p.jsx)("div",{className:"flex justify-center items-center",children:(0,p.jsx)("span",{className:"text-base-content/50 group-hover:text-base-content text-center",children:"Ceiling light"})})]})]}),(0,p.jsx)("label",{className:"block mb-2 mt-4 text-sm font-medium",children:"Light capabilities"}),(0,p.jsx)("input",{type:"hidden",...s("can_dim")}),(0,p.jsxs)("div",{className:"grid grid-cols-3 gap-4 w-full",children:[(0,p.jsxs)("div",{className:"group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10",onClick:()=>{c("can_dim",!l("can_dim"),{shouldValidate:!0,shouldDirty:!0})},children:[(0,p.jsx)("div",{className:"flex justify-center items-center p-4",children:(0,p.jsx)("span",{className:`mdi mdi-lightbulb-on-50 text-5xl text-neutral-content/50 group-hover:text-yellow-500 ${l("can_dim")?"text-yellow-500":""}`})}),(0,p.jsx)("div",{className:"flex justify-center items-center",children:(0,p.jsx)("span",{className:"text-base-content/50 group-hover:text-base-content text-center",children:"Dimmable"})})]}),(0,p.jsx)("input",{type:"hidden",...s("can_color_temperature")}),(0,p.jsxs)("div",{className:"group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10",onClick:()=>{c("can_color_temperature",!l("can_color_temperature"),{shouldValidate:!0,shouldDirty:!0})},children:[(0,p.jsx)("div",{className:"flex justify-center items-center p-4",children:(0,p.jsx)("span",{className:`mdi mdi-temperature-kelvin text-5xl text-neutral-content/50 group-hover:text-yellow-500 ${l("can_color_temperature")?"text-yellow-500":""}`})}),(0,p.jsx)("div",{className:"flex justify-center items-center",children:(0,p.jsx)("span",{className:"text-base-content/50 group-hover:text-base-content text-center",children:"Color temp"})})]}),(0,p.jsx)("input",{type:"hidden",...s("can_rgb")}),(0,p.jsxs)("div",{className:"group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10",onClick:()=>{c("can_rgb",!l("can_rgb"),{shouldValidate:!0,shouldDirty:!0})},children:[(0,p.jsx)("div",{className:"flex justify-center items-center p-4",children:(0,p.jsx)("span",{className:`mdi mdi-palette text-5xl text-neutral-content/50 group-hover:text-yellow-500 ${l("can_rgb")?"text-yellow-500":""}`})}),(0,p.jsx)("div",{className:"flex justify-center items-center",children:(0,p.jsx)("span",{className:"text-base-content/50 group-hover:text-base-content text-center",children:"Color"})})]})]}),e=="openhab"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("label",{className:"block mb-2 mt-4 text-sm font-medium",children:"Brightness item"}),(0,p.jsx)(Re,{options:le.getState().openhab_options,classNames:v,onChange:f=>c("openhab_item_dimmer",f?f.value:"",{shouldValidate:!0,shouldDirty:!0}),value:le.getState().openhab_options.find(f=>f.value===l("openhab_item_dimmer")),unstyled:!0,components:di,styles:{input:f=>({...f,"input:focus":{boxShadow:"none"}}),multiValueLabel:f=>({...f,whiteSpace:"normal",overflow:"visible"}),control:f=>({...f,transition:"none"})}})]}),e=="openhab"&&l("can_color_temperature")==!0&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("label",{className:"block mb-2 mt-4 text-sm font-medium",children:"Color temperature item"}),(0,p.jsx)(Re,{options:le.getState().openhab_options,classNames:v,onChange:f=>{c("openhab_item_color_temp",f?f.value:"",{shouldValidate:!0,shouldDirty:!0})},value:le.getState().openhab_options.find(f=>f.value===l("openhab_item_color_temp")),components:di,unstyled:!0,styles:{input:f=>({...f,"input:focus":{boxShadow:"none"}}),multiValueLabel:f=>({...f,whiteSpace:"normal",overflow:"visible"}),control:f=>({...f,transition:"none"})}})]}),e=="openhab"&&l("can_rgb")==!0&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("label",{className:"block mb-2 mt-4 text-sm font-medium",children:"RGB item"}),(0,p.jsx)(Re,{options:le.getState().openhab_options,classNames:v,onChange:f=>c("openhab_item_rgb",f?f.value:"",{shouldValidate:!0,shouldDirty:!0}),value:le.getState().openhab_options.find(f=>f.value===l("openhab_item_rgb")),components:di,unstyled:!0,styles:{input:f=>({...f,"input:focus":{boxShadow:"none"}}),multiValueLabel:f=>({...f,whiteSpace:"normal",overflow:"visible"}),control:f=>({...f,transition:"none"})}})]})]}),(0,p.jsx)("div",{className:"flex mt-4 justify-end items-center",children:(0,p.jsx)("button",{className:"btn btn-info",disabled:!d,children:"Save"})})]})},Jj=C.object({id:C.number().nullable(),type:C.string(),entity_type:C.string(),room_id:C.number(),entities_page_id:C.number(),room_view_position:C.number(),friendly_name:C.string().min(1),controller:C.string(),home_assistant_name:C.string().optional(),openhab_item_switch:C.string().optional()}),Gj=({innerProps:e,isDisabled:t,isFocused:r,isSelected:i,children:n,data:o})=>t?null:(0,p.jsxs)("div",{...e,className:`p-1 ${i?"bg-primary/20 rounded-sm":""} ${r?"bg-primary/20 rounded-sm":""}`,children:[(0,p.jsx)("span",{className:`mdi ${o.icon} me-2`}),n]}),Hd={Option:Gj},Kj=({controller:e,room_id:t,entities_page_id:r,room_view_position:i,id:n,onComplete:o})=>{const{handleSubmit:a,register:s,reset:u,getValues:l,setValue:c,formState:{isValid:d}}=kr({resolver:qr(Jj),defaultValues:{id:n??null,controller:e,type:"entity",entity_type:"light",room_id:t,entities_page_id:r,room_view_position:i,openhab_item_switch:"",home_assistant_name:""}});function m(f){let g="";if(document.cookie&&document.cookie!==""){const y=document.cookie.split(";");for(let x=0;x{if(n!=null){const f=We.getState().entities.find(g=>g.id==n);u(f)}},[n,We.getState().entities]);function h(f){fetch("/rest/entities/switches",{credentials:"same-origin",method:"PUT",mode:"same-origin",headers:{"Content-Type":"application/json","X-CSRFToken":m("csrftoken")},body:JSON.stringify(f)}).then(async g=>{const y=await g.json();if(console.log("Entity created/updated. Got response:",y),!g.ok){const x=y&&y.message||g.status;return Promise.reject(x)}o?.()}).catch(g=>{console.error("There was an error!",g)})}const v={control:f=>`${f.isFocused?"border":"border-0"} border-accent p-2.5 text-sm rounded-box bg-base-300 rounded-md`,menu:()=>"bg-base-300 p-2.5 rounded-box",option:f=>`p-1 ${f.isSelected?"bg-primary/20 rounded-sm":""} ${f.isFocused?"bg-primary/20 rounded-sm":""}`};return(0,p.jsxs)("form",{onSubmit:a(h),children:[(0,p.jsx)("input",{type:"hidden",...s("id")}),(0,p.jsx)("input",{type:"hidden",...s("controller")}),(0,p.jsx)("input",{type:"hidden",...s("type")}),(0,p.jsx)("input",{type:"hidden",...s("entity_type")}),(0,p.jsx)("input",{type:"hidden",...s("room_id")}),(0,p.jsx)("input",{type:"hidden",...s("entities_page_id")}),(0,p.jsx)("input",{type:"hidden",...s("room_view_position")}),(0,p.jsxs)("div",{className:"w-full",children:[(0,p.jsx)("div",{className:"flex justify-center mb-4 duration-500 transition-transform ease-linear",children:(0,p.jsxs)("div",{className:"w-full",children:[(0,p.jsx)("label",{htmlFor:"add_new_switch_name",className:"block mb-2 text-sm font-medium",children:"Name"}),(0,p.jsx)("div",{className:"flex flex-row-reverse",children:(0,p.jsx)("input",{className:"outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text",type:"text",id:"add_new_switch_name",...s("friendly_name"),required:!0})})]})}),e=="home_assistant"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("label",{className:"block mb-2 text-sm font-medium",children:"Home Assistant entity"}),(0,p.jsx)(Re,{options:le.getState().home_assistant_options.filter(f=>f.value.startsWith("switch.")||f.value.startsWith("input_boolean.")),classNames:v,onChange:f=>{c("home_assistant_name",f?f.value:"")},unstyled:!0,components:Hd,value:le.getState().home_assistant_options.find(f=>f.value===l("home_assistant_name")),styles:{input:f=>({...f,"input:focus":{boxShadow:"none"}}),multiValueLabel:f=>({...f,whiteSpace:"normal",overflow:"visible"}),control:f=>({...f,transition:"none"})}})]}),e=="openhab"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("label",{className:"block mb-2 mt-4 text-sm font-medium",children:"OpenHAB item"}),(0,p.jsx)(Re,{options:le.getState().openhab_options,classNames:v,onChange:f=>c("openhab_item_switch",f?f.value:""),value:le.getState().openhab_options.find(f=>f.value===l("openhab_item_switch")),unstyled:!0,components:Hd,styles:{input:f=>({...f,"input:focus":{boxShadow:"none"}}),multiValueLabel:f=>({...f,whiteSpace:"normal",overflow:"visible"}),control:f=>({...f,transition:"none"})}})]})]}),(0,p.jsx)("div",{className:"flex mt-4 justify-end items-center",children:(0,p.jsx)("button",{type:"submit",className:"btn btn-info",disabled:!d,children:"Save"})})]})},Xj=C.object({id:C.number().nullable(),type:C.string(),entity_type:C.string(),room_id:C.number(),entities_page_id:C.number(),room_view_position:C.number(),friendly_name:C.string().min(1),controller:C.string(),home_assistant_name:C.string().optional(),mqtt_topic:C.string().optional(),mqtt_payload:C.string().optional()}),qj=({innerProps:e,isDisabled:t,isFocused:r,isSelected:i,children:n,data:o})=>t?null:(0,p.jsxs)("div",{...e,className:`p-1 ${i?"bg-primary/20 rounded-sm":""} ${r?"bg-primary/20 rounded-sm":""}`,children:[(0,p.jsx)("span",{className:`mdi ${o.icon} me-2`}),n]}),Yj={Option:qj},Qj=({controller:e,room_id:t,entities_page_id:r,room_view_position:i,id:n,onComplete:o})=>{const{handleSubmit:a,register:s,reset:u,getValues:l,setValue:c,formState:{isValid:d}}=kr({resolver:qr(Xj),defaultValues:{id:null,controller:e,type:"entity",entity_type:"light",room_id:t??-1,entities_page_id:r,room_view_position:i,home_assistant_name:"",mqtt_topic:"",mqtt_payload:""}});function m(f){let g="";if(document.cookie&&document.cookie!==""){const y=document.cookie.split(";");for(let x=0;x{if(n!=null){const f=We.getState().entities.find(g=>g.id==n);u(f)}},[n,We.getState().entities]);function h(f){fetch("/rest/entities/buttons",{credentials:"same-origin",method:"PUT",mode:"same-origin",headers:{"Content-Type":"application/json","X-CSRFToken":m("csrftoken")},body:JSON.stringify(f)}).then(async g=>{const y=await g.json();if(console.log("Entity created/updated. Got response:",y),!g.ok){const x=y&&y.message||g.status;return Promise.reject(x)}o?.()}).catch(g=>{console.error("There was an error!",g)})}const v={control:f=>`${f.isFocused?"border":"border-0"} border-accent p-2.5 text-sm rounded-box bg-base-300 rounded-md`,menu:()=>"bg-base-300 p-2.5 rounded-box",option:f=>`p-1 ${f.isSelected?"bg-primary/20 rounded-sm":""} ${f.isFocused?"bg-primary/20 rounded-sm":""}`};return(0,p.jsxs)("form",{onSubmit:a(h),children:[(0,p.jsx)("input",{type:"hidden",...s("id")}),(0,p.jsx)("input",{type:"hidden",...s("controller")}),(0,p.jsx)("input",{type:"hidden",...s("type")}),(0,p.jsx)("input",{type:"hidden",...s("entity_type")}),(0,p.jsx)("input",{type:"hidden",...s("room_id")}),(0,p.jsx)("input",{type:"hidden",...s("entities_page_id")}),(0,p.jsx)("input",{type:"hidden",...s("room_view_position")}),(0,p.jsxs)("div",{className:"w-full",children:[(0,p.jsx)("div",{className:"flex justify-center mb-4 duration-500 transition-transform ease-linear",children:(0,p.jsxs)("div",{className:"w-full",children:[(0,p.jsx)("label",{htmlFor:"add_new_button_name",className:"block mb-2 text-sm font-medium",children:"Name"}),(0,p.jsx)("div",{className:"flex flex-row-reverse",children:(0,p.jsx)("input",{className:"outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text",type:"text",id:"add_new_button_name",...s("friendly_name"),required:!0})})]})}),e=="home_assistant"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("label",{className:"block mb-2 text-sm font-medium",children:"Home Assistant entity"}),(0,p.jsx)(Re,{options:le.getState().home_assistant_options.filter(f=>f.value.startsWith("button.")||f.value.startsWith("input_button.")),classNames:v,onChange:f=>{c("home_assistant_name",f?f.value:"")},unstyled:!0,components:Yj,value:le.getState().home_assistant_options.find(f=>f.value===l("home_assistant_name")),styles:{input:f=>({...f,"input:focus":{boxShadow:"none"}}),multiValueLabel:f=>({...f,whiteSpace:"normal",overflow:"visible"}),control:f=>({...f,transition:"none"})}})]}),e=="nspm"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"flex justify-center mb-4 duration-500 transition-transform ease-linear",children:(0,p.jsxs)("div",{className:"w-full",children:[(0,p.jsx)("label",{className:"block mb-2 text-sm font-medium",children:"MQTT Topic"}),(0,p.jsx)("div",{className:"flex flex-row-reverse",children:(0,p.jsx)("input",{className:"outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text",type:"text",...s("mqtt_topic"),required:!0})})]})}),(0,p.jsx)("div",{className:"flex justify-center mb-4 duration-500 transition-transform ease-linear",children:(0,p.jsxs)("div",{className:"w-full",children:[(0,p.jsx)("label",{className:"block mb-2 text-sm font-medium",children:"MQTT Payload"}),(0,p.jsx)("div",{className:"flex flex-row-reverse",children:(0,p.jsx)("input",{className:"outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text",type:"text",...s("mqtt_payload"),required:!0})})]})})]})]}),(0,p.jsx)("div",{className:"flex mt-4 justify-end items-center",children:(0,p.jsx)("button",{type:"submit",className:"btn btn-info",disabled:!d,children:"Save"})})]})},Jd=C.object({id:C.number().nullable(),type:C.string(),entity_type:C.string(),room_id:C.number(),entities_page_id:C.number(),room_view_position:C.number(),friendly_name:C.string().min(1),step_size:C.float32(),controller:C.string(),home_assistant_name:C.string().optional(),openhab_fan_mode_item:C.string().optional(),openhab_hvac_mode_item:C.string().optional(),openhab_preset_mode_item:C.string().optional(),openhab_swing_mode_item:C.string().optional(),openhab_swingh_mode_item:C.string().optional(),openhab_temperature_item:C.string().optional(),fan_modes:C.array(C.object({icon:C.string(),label:C.string().min(1),value:C.string().min(1)}).optional()),hvac_modes:C.array(C.object({icon:C.string(),label:C.string().min(1),value:C.string().min(1)}).optional()),preset_modes:C.array(C.object({icon:C.string(),label:C.string().min(1),value:C.string().min(1)})).optional(),swing_modes:C.array(C.object({icon:C.string(),label:C.string().min(1),value:C.string().min(1)})).optional(),swingh_modes:C.array(C.object({icon:C.string(),label:C.string().min(1),value:C.string().min(1)})).optional()}),eT=({innerProps:e,isDisabled:t,isFocused:r,isSelected:i,children:n,data:o})=>t?null:(0,p.jsxs)("div",{...e,className:`p-1 ${i?"bg-primary/20 rounded-sm":""} ${r?"bg-primary/20 rounded-sm":""}`,children:[(0,p.jsx)("span",{className:`mdi ${o.icon} me-2`}),n]}),Kt={Option:eT},er=({value:e,onChange:t})=>{const r=[{name:"Off",icon:"h"},{name:"Heating",icon:"!"},{name:"Cooling",icon:"8"},{name:"Hot/Cold",icon:"#"},{name:"Thermostat",icon:"7"},{name:"Thermostat Auto",icon:"$"},{name:"Dry",icon:"%"},{name:"Eco",icon:"&"},{name:"Away",icon:"'"},{name:"Home",icon:"("},{name:"Sleep",icon:")"},{name:"Boost",icon:"*"},{name:"Comfort",icon:"+"},{name:"Activity",icon:","},{name:"Defrosting",icon:"-"},{name:"Swing Both",icon:"."},{name:"Swing Horizontal",icon:"/"},{name:"Swing Vertical",icon:"0"},{name:"Fan Off",icon:"1"},{name:"Fan Auto",icon:"2"},{name:"Fan",icon:"3"},{name:"Fan 1",icon:"4"},{name:"Fan 2",icon:"5"},{name:"Fan 3",icon:"6"}],[i,n]=(0,_.useState)(e),[o,a]=(0,_.useState)(!1),s=(0,_.useRef)(null),u=l=>{n(l),t(l),a(!1)};return(0,_.useEffect)(()=>{const l=c=>{s.current&&!s.current.contains(c.target)&&a(!1)};return window.addEventListener("click",l),()=>{window.removeEventListener("click",l)}},[s,o]),(0,p.jsxs)("details",{open:o,onToggle:l=>a(l.currentTarget.open),className:"dropdown dropdown-end h-auto",id:"dropdown_icon_selector",ref:s,children:[(0,p.jsx)("summary",{id:"icon_selector_button",title:"Select icon",className:"btn rounded-box h-full border-neutral border-y border-x-0 font-nspm-mdi w-full",children:i}),(0,p.jsxs)("div",{className:"dropdown-content bg-base-100 text-base-content rounded-box rounded-tr-none w-56 border border-primary",children:[(0,p.jsx)("div",{className:"flex justify-center pb-1 mb-2 mt-1 border-b border-primary",children:(0,p.jsx)("span",{className:"text-sm",children:"Select Icon"})}),(0,p.jsx)("div",{className:"grid grid-cols-4 w-full",children:r.map(l=>(0,p.jsx)("button",{type:"button",title:l.name,className:"btn btn-ghost rounded-none hover:btn-info icon-select-button","data-icon_value":l.icon,onClick:()=>{u(l.icon)},children:(0,p.jsx)("span",{className:"font-nspm-mdi",children:l.icon})}))})]})]})},tT=({controller:e,room_id:t,entities_page_id:r,room_view_position:i,id:n,onComplete:o})=>{const{control:a,handleSubmit:s,register:u,reset:l,getValues:c,setValue:d,formState:{isValid:m}}=kr({resolver:qr(Jd),defaultValues:{id:n??null,controller:e,type:"entity",entity_type:"thermostat",room_id:t,entities_page_id:r,room_view_position:i,home_assistant_name:"",openhab_fan_mode_item:"",openhab_hvac_mode_item:"",openhab_preset_mode_item:"",openhab_swing_mode_item:"",openhab_swingh_mode_item:"",openhab_temperature_item:"",step_size:.5,fan_modes:[],hvac_modes:[],preset_modes:[],swing_modes:[],swingh_modes:[]}}),{entities:h}=We.getState(),{fields:v,append:f,remove:g}=Yn({control:a,name:"fan_modes"}),{fields:y,append:x,remove:j}=Yn({control:a,name:"hvac_modes"}),{fields:S,append:w,remove:$}=Yn({control:a,name:"preset_modes"}),{fields:O,append:z,remove:L}=Yn({control:a,name:"swing_modes"}),{fields:U,append:oe,remove:B}=Yn({control:a,name:"swingh_modes"});function q(P){let ee="";if(document.cookie&&document.cookie!==""){const N=document.cookie.split(";");for(let ce=0;ce{if(n!=null){const P=h.find(ee=>ee.id==n);console.log("Found entity data:",P),l(P),P?.step_size&&d("step_size",parseFloat(String(P.step_size)))}},[n,h,l,d]);function ae(P){fetch("/rest/entities/thermostats",{credentials:"same-origin",method:"PUT",mode:"same-origin",headers:{"Content-Type":"application/json","X-CSRFToken":q("csrftoken")},body:JSON.stringify(P)}).then(async ee=>{const N=await ee.json();if(console.log("Entity created/updated. Got response:",N),!ee.ok){const ce=N&&N.message||ee.status;return Promise.reject(ce)}o?.()}).catch(ee=>{console.error("There was an error!",ee)})}function G(){const P=le.getState().home_assistant_entities.find(N=>N.item_id==c("home_assistant_name"));if(!P)return;for(let N=v.length-1;N>=0;N--)g(N);for(let N=y.length-1;N>=0;N--)j(N);for(let N=S.length-1;N>=0;N--)$(N);for(let N=O.length-1;N>=0;N--)L(N);for(let N=U.length-1;N>=0;N--)B(N);const ee=P.item.attributes;"fan_modes"in ee&&ee.fan_modes.forEach(N=>{f({icon:"",label:N,value:N})}),"hvac_modes"in ee&&ee.hvac_modes.forEach(N=>{x({icon:"",label:N,value:N})}),"preset_modes"in ee&&ee.preset_modes.forEach(N=>{w({icon:"",label:N,value:N})}),"swing_modes"in ee&&ee.swing_modes.forEach(N=>{z({icon:"",label:N,value:N})}),"swing_horizontal_modes"in ee&&ee.swing_horizontal_modes.forEach(N=>{oe({icon:"",label:N,value:N})})}const Q={control:P=>`${P.isFocused?"border":"border-0"} border-accent p-2.5 text-sm rounded-box bg-base-300 text-base-content rounded-md`,menu:()=>"bg-base-300 p-2.5 rounded-box text-base-content",option:P=>`p-1 ${P.isSelected?"bg-primary/20 rounded-sm":""} ${P.isFocused?"bg-primary/20 rounded-sm":""}`};console.log("Data: ",c());const re=Jd.safeParse(c());return console.log("Schema check result: ",re),(0,p.jsxs)("form",{onSubmit:s(ae),children:[(0,p.jsx)("input",{type:"hidden",...u("id")}),(0,p.jsx)("input",{type:"hidden",...u("controller")}),(0,p.jsx)("input",{type:"hidden",...u("type")}),(0,p.jsx)("input",{type:"hidden",...u("entity_type")}),(0,p.jsx)("input",{type:"hidden",...u("room_id")}),(0,p.jsx)("input",{type:"hidden",...u("entities_page_id")}),(0,p.jsx)("input",{type:"hidden",...u("room_view_position")}),(0,p.jsxs)("div",{className:"w-full",children:[(0,p.jsx)("div",{className:"flex justify-center mb-4 duration-500 transition-transform ease-linear",children:(0,p.jsxs)("div",{className:"w-full",children:[(0,p.jsx)("label",{htmlFor:"add_new_switch_name",className:"block mb-2 text-sm font-medium",children:"Name"}),(0,p.jsx)("div",{className:"flex flex-row-reverse",children:(0,p.jsx)("input",{className:"outline-none bg-base-300 text-base-content border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text",type:"text",id:"add_new_switch_name",...u("friendly_name"),required:!0})})]})}),(0,p.jsxs)("div",{className:"mb-4",children:[(0,p.jsx)("label",{className:"block mb-2 text-sm font-medium",children:"Step size"}),(0,p.jsxs)("div",{className:"join w-full",children:[(0,p.jsx)("button",{type:"button",onClick:()=>{c("step_size")>10?d("step_size",10):c("step_size")>.1?d("step_size",Math.round(c("step_size")*10-1)/10):d("step_size",.1)},className:"btn h-auto rounded-l-md border-neutral border border-r-0 ",children:"-"}),(0,p.jsx)("input",{type:"number",className:"join-item number-apperance-none outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block min-w-0 w-full text-sm p-2.5",step:"0.1",min:"0.1",max:"10",...u("step_size")}),(0,p.jsx)("button",{type:"button",onClick:()=>{c("step_size")<.1?d("step_size",.1):c("step_size")<10?d("step_size",Math.round(c("step_size")*10+1)/10):d("step_size",10)},className:"btn h-auto rounded-r-md border-neutral border border-l-0",children:"+"})]})]}),e=="home_assistant"&&(0,p.jsxs)("div",{className:"mb-4",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"block mb-2 text-sm font-medium",children:"Home Assistant entity"}),(0,p.jsx)(Re,{options:le.getState().home_assistant_options.filter(P=>P.value.startsWith("climate.")),classNames:Q,onChange:P=>{d("home_assistant_name",P?P.value:"",{shouldValidate:!0,shouldDirty:!0})},unstyled:!0,components:Kt,value:le.getState().home_assistant_options.find(P=>P.value===c("home_assistant_name")),styles:{input:P=>({...P,"input:focus":{boxShadow:"none"}}),multiValueLabel:P=>({...P,whiteSpace:"normal",overflow:"visible"}),control:P=>({...P,transition:"none"})}})]}),(0,p.jsx)("div",{className:"mt-1",children:(0,p.jsx)("button",{type:"button",onClick:G,className:"btn btn-xs w-full btn-info",children:"Load settings from HA entity"})})]}),e=="openhab"&&(0,p.jsxs)("div",{className:"mt-4 border border-primary rounded-box p-4 pt-2",children:[(0,p.jsx)("span",{className:"text-lg mb-4",children:"Temperature"}),(0,p.jsxs)("div",{className:"",children:[(0,p.jsx)("label",{className:"block mb-2 text-sm font-medium",children:"OpenHAB target temperature item"}),(0,p.jsx)(Re,{options:le.getState().openhab_options,classNames:Q,onChange:P=>d("openhab_temperature_item",P?P.value:""),value:le.getState().openhab_options.find(P=>P.value===c("openhab_temperature_item")),unstyled:!0,components:Kt,styles:{input:P=>({...P,"input:focus":{boxShadow:"none"}}),multiValueLabel:P=>({...P,whiteSpace:"normal",overflow:"visible"}),control:P=>({...P,transition:"none"})}})]})]}),(0,p.jsxs)("div",{className:"mt-4 border border-primary rounded-box p-4 pt-2",children:[(0,p.jsx)("span",{className:"text-lg mb-4",children:"Fan modes"}),e=="openhab"&&(0,p.jsxs)("div",{className:"mb-4",children:[(0,p.jsx)("label",{className:"block mb-2 text-sm font-medium",children:"OpenHAB fan mode item"}),(0,p.jsx)(Re,{options:le.getState().openhab_options,classNames:Q,onChange:P=>d("openhab_fan_mode_item",P?P.value:""),value:le.getState().openhab_options.find(P=>P.value===c("openhab_fan_mode_item")),unstyled:!0,components:Kt,styles:{input:P=>({...P,"input:focus":{boxShadow:"none"}}),multiValueLabel:P=>({...P,whiteSpace:"normal",overflow:"visible"}),control:P=>({...P,transition:"none"})}})]}),(0,p.jsxs)("div",{id:"fan_mode_options",children:[(0,p.jsxs)("div",{className:"grid grid-cols-[1fr_1fr_3rem_3rem] items-stretch justify-center w-full mb-1 gap-1 mt-2",children:[(0,p.jsx)("span",{className:"text-sm ml-2",children:"Label"}),(0,p.jsx)("span",{className:"text-sm ml-2",children:"Value"}),(0,p.jsx)("span",{className:"text-sm ml-2",children:"Icon"}),(0,p.jsx)("span",{className:"text-sm ml-2"}),(()=>{const P=[];return v.forEach((ee,N)=>{P.push((0,p.jsx)("input",{type:"text",...u(`fan_modes.${N}.label`),className:"rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5",title:"Label"})),P.push((0,p.jsx)("input",{type:"text",...u(`fan_modes.${N}.value`),className:"rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5",title:"Value"})),P.push((0,p.jsx)(er,{value:ee.icon,onChange:ce=>d(`fan_modes.${N}.icon`,ce)})),P.push((0,p.jsx)("button",{type:"button",className:"btn h-auto rounded-box border border-neutral border-l-0 text-base-content bg-error/20 hover:bg-error/70 join-item ring-0 inset-ring-0 focus:ring-0",title:"Remove fan mode",onClick:()=>g(N),children:"✕"}))}),P})()]}),(0,p.jsx)("button",{type:"button",className:"btn btn-xs w-full btn-success",title:"Add fan mode",onClick:()=>f({icon:"",label:"",value:""}),children:"Add fan mode"})]})]}),(0,p.jsxs)("div",{className:"mt-4 border border-primary rounded-box p-4 pt-2",children:[(0,p.jsx)("span",{className:"input_field_label block mb-2 text-sm font-medium",children:"HVAC modes"}),e=="openhab"&&(0,p.jsxs)("div",{className:"mb-4",children:[(0,p.jsx)("label",{className:"block mb-2 text-sm font-medium",children:"OpenHAB HVAC mode item"}),(0,p.jsx)(Re,{options:le.getState().openhab_options,classNames:Q,onChange:P=>d("openhab_hvac_mode_item",P?P.value:""),value:le.getState().openhab_options.find(P=>P.value===c("openhab_hvac_mode_item")),unstyled:!0,components:Kt,styles:{input:P=>({...P,"input:focus":{boxShadow:"none"}}),multiValueLabel:P=>({...P,whiteSpace:"normal",overflow:"visible"}),control:P=>({...P,transition:"none"})}})]}),(0,p.jsxs)("div",{id:"hvac_mode_options",children:[(0,p.jsxs)("div",{className:"grid grid-cols-[1fr_1fr_3rem_3rem] items-stretch justify-center w-full mb-1 gap-1 mt-2",children:[(0,p.jsx)("span",{className:"text-sm ml-2",children:"Label"}),(0,p.jsx)("span",{className:"text-sm ml-2",children:"Value"}),(0,p.jsx)("span",{className:"text-sm ml-2",children:"Icon"}),(0,p.jsx)("span",{className:"text-sm ml-2"}),(()=>{const P=[];return y.forEach((ee,N)=>{P.push((0,p.jsx)("input",{type:"text",...u(`hvac_modes.${N}.label`),className:"rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5",title:"Label"})),P.push((0,p.jsx)("input",{type:"text",...u(`hvac_modes.${N}.value`),className:"rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5",title:"Value"})),P.push((0,p.jsx)(er,{value:ee.icon,onChange:ce=>d(`hvac_modes.${N}.icon`,ce)})),P.push((0,p.jsx)("button",{type:"button",className:"btn h-auto rounded-box border border-neutral border-l-0 text-base-content bg-error/20 hover:bg-error/70 join-item ring-0 inset-ring-0 focus:ring-0",title:"Remove HVAC mode",onClick:()=>j(N),children:"✕"}))}),P})()]}),(0,p.jsx)("button",{type:"button",className:"btn btn-xs w-full btn-success",title:"Add HVAC mode",onClick:()=>x({icon:"",label:"",value:""}),children:"Add HVAC mode"})]})]}),(0,p.jsxs)("div",{className:"mt-4 border border-primary rounded-box p-4 pt-2",children:[(0,p.jsx)("span",{className:"input_field_label block mb-2 text-sm font-medium",children:"Presets"}),e=="openhab"&&(0,p.jsxs)("div",{className:"mb-4",children:[(0,p.jsx)("label",{className:"block mb-2 text-sm font-medium",children:"OpenHAB preset item"}),(0,p.jsx)(Re,{options:le.getState().openhab_options,classNames:Q,onChange:P=>d("openhab_preset_mode_item",P?P.value:""),value:le.getState().openhab_options.find(P=>P.value===c("openhab_preset_mode_item")),unstyled:!0,components:Kt,styles:{input:P=>({...P,"input:focus":{boxShadow:"none"}}),multiValueLabel:P=>({...P,whiteSpace:"normal",overflow:"visible"}),control:P=>({...P,transition:"none"})}})]}),(0,p.jsxs)("div",{id:"preset_mode_options",children:[(0,p.jsxs)("div",{className:"grid grid-cols-[1fr_1fr_3rem_3rem] items-stretch justify-center w-full mb-1 gap-1 mt-2",children:[(0,p.jsx)("span",{className:"text-sm ml-2",children:"Label"}),(0,p.jsx)("span",{className:"text-sm ml-2",children:"Value"}),(0,p.jsx)("span",{className:"text-sm ml-2",children:"Icon"}),(0,p.jsx)("span",{className:"text-sm ml-2"}),(()=>{const P=[];return S.forEach((ee,N)=>{P.push((0,p.jsx)("input",{type:"text",...u(`preset_modes.${N}.label`),className:"rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5",title:"Label"})),P.push((0,p.jsx)("input",{type:"text",...u(`preset_modes.${N}.value`),className:"rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5",title:"Value"})),P.push((0,p.jsx)(er,{value:ee.icon,onChange:ce=>d(`preset_modes.${N}.icon`,ce)})),P.push((0,p.jsx)("button",{type:"button",className:"btn h-auto rounded-box border border-neutral border-l-0 text-base-content bg-error/20 hover:bg-error/70 join-item ring-0 inset-ring-0 focus:ring-0",title:"Remove preset mode",onClick:()=>$(N),children:"✕"}))}),P})()]}),(0,p.jsx)("button",{type:"button",className:"btn btn-xs w-full btn-success",title:"Add preset mode",onClick:()=>w({icon:"",label:"",value:""}),children:"Add preset"})]})]}),(0,p.jsxs)("div",{className:"mt-4 border border-primary rounded-box p-4 pt-2",children:[(0,p.jsx)("span",{className:"input_field_label block mb-2 text-sm font-medium",children:"Swing modes"}),e=="openhab"&&(0,p.jsxs)("div",{className:"mb-4",children:[(0,p.jsx)("label",{className:"block mb-2 text-sm font-medium",children:"OpenHAB swing item"}),(0,p.jsx)(Re,{options:le.getState().openhab_options,classNames:Q,onChange:P=>d("openhab_swing_mode_item",P?P.value:""),value:le.getState().openhab_options.find(P=>P.value===c("openhab_swing_mode_item")),unstyled:!0,components:Kt,styles:{input:P=>({...P,"input:focus":{boxShadow:"none"}}),multiValueLabel:P=>({...P,whiteSpace:"normal",overflow:"visible"}),control:P=>({...P,transition:"none"})}})]}),(0,p.jsxs)("div",{id:"swing_mode_options",children:[(0,p.jsxs)("div",{className:"grid grid-cols-[1fr_1fr_3rem_3rem] items-stretch justify-center w-full mb-1 gap-1 mt-2",children:[(0,p.jsx)("span",{className:"text-sm ml-2",children:"Label"}),(0,p.jsx)("span",{className:"text-sm ml-2",children:"Value"}),(0,p.jsx)("span",{className:"text-sm ml-2",children:"Icon"}),(0,p.jsx)("span",{className:"text-sm ml-2"}),(()=>{const P=[];return O.forEach((ee,N)=>{P.push((0,p.jsx)("input",{type:"text",...u(`swing_modes.${N}.label`),className:"rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5",title:"Label"})),P.push((0,p.jsx)("input",{type:"text",...u(`swing_modes.${N}.value`),className:"rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5",title:"Value"})),P.push((0,p.jsx)(er,{value:ee.icon,onChange:ce=>d(`swing_modes.${N}.icon`,ce)})),P.push((0,p.jsx)("button",{type:"button",className:"btn h-auto rounded-box border border-neutral border-l-0 text-base-content bg-error/20 hover:bg-error/70 join-item ring-0 inset-ring-0 focus:ring-0",title:"Remove swing mode",onClick:()=>L(N),children:"✕"}))}),P})()]}),"min-content",(0,p.jsx)("button",{type:"button",className:"btn btn-xs w-full btn-success",title:"Add swing mode",onClick:()=>z({icon:"",label:"",value:""}),children:"Add swing mode"})]})]}),(0,p.jsxs)("div",{className:"mt-4 border border-primary rounded-box p-4 pt-2",children:[(0,p.jsx)("span",{className:"input_field_label block mb-2 text-sm font-medium",children:"Horizontal swing modes"}),e=="openhab"&&(0,p.jsxs)("div",{className:"mb-4",children:[(0,p.jsx)("label",{className:"block mb-2 text-sm font-medium",children:"OpenHAB horizontal swing item"}),(0,p.jsx)(Re,{options:le.getState().openhab_options,classNames:Q,onChange:P=>d("openhab_swingh_mode_item",P?P.value:""),value:le.getState().openhab_options.find(P=>P.value===c("openhab_swingh_mode_item")),unstyled:!0,components:Kt,styles:{input:P=>({...P,"input:focus":{boxShadow:"none"}}),multiValueLabel:P=>({...P,whiteSpace:"normal",overflow:"visible"}),control:P=>({...P,transition:"none"})}})]}),(0,p.jsxs)("div",{id:"swing_mode_options",children:[(0,p.jsxs)("div",{className:"grid grid-cols-[1fr_1fr_3rem_3rem] items-stretch justify-center w-full mb-1 gap-1 mt-2",children:[(0,p.jsx)("span",{className:"text-sm ml-2",children:"Label"}),(0,p.jsx)("span",{className:"text-sm ml-2",children:"Value"}),(0,p.jsx)("span",{className:"text-sm ml-2",children:"Icon"}),(0,p.jsx)("span",{className:"text-sm ml-2"}),(()=>{const P=[];return U.forEach((ee,N)=>{P.push((0,p.jsx)("input",{type:"text",...u(`swingh_modes.${N}.label`),className:"rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5",title:"Label"})),P.push((0,p.jsx)("input",{type:"text",...u(`swingh_modes.${N}.value`),className:"rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5",title:"Value"})),P.push((0,p.jsx)(er,{value:ee.icon,onChange:ce=>d(`swingh_modes.${N}.icon`,ce)})),P.push((0,p.jsx)("button",{type:"button",className:"btn h-auto rounded-box border border-neutral border-l-0 text-base-content bg-error/20 hover:bg-error/70 join-item ring-0 inset-ring-0 focus:ring-0",title:"Remove horizontal swing mode",onClick:()=>B(N),children:"✕"}))}),P})()]}),(0,p.jsx)("button",{type:"button",className:"btn btn-xs w-full btn-success",title:"Add horizontal swing mode",onClick:()=>oe({icon:"",label:"",value:""}),children:"Add horizontal swing mode"})]})]})]}),(0,p.jsx)("div",{className:"flex mt-4 justify-end items-center",children:(0,p.jsx)("button",{type:"submit",className:"btn btn-info",disabled:!m,children:"Save"})})]})},nT=C.object({id:C.number().nullable(),type:C.string(),controller:C.string(),scene_type:C.string(),room_id:C.number().nullable(),entities_page_id:C.number(),room_view_position:C.number(),friendly_name:C.string().min(1),backend_name:C.string().optional()}),rT=({innerProps:e,isDisabled:t,isFocused:r,isSelected:i,children:n,data:o})=>t?null:(0,p.jsxs)("div",{...e,className:`p-1 ${i?"bg-primary/20 rounded-sm":""} ${r?"bg-primary/20 rounded-sm":""}`,children:[(0,p.jsx)("span",{className:`mdi ${o.icon} me-2`}),n]}),Gd={Option:rT},iT=({controller:e,room_id:t,entities_page_id:r,room_view_position:i,id:n,onComplete:o})=>{const{handleSubmit:a,register:s,reset:u,getValues:l,setValue:c,formState:{isValid:d}}=kr({resolver:qr(nT),defaultValues:{id:n??null,type:"scene",scene_type:"",controller:e,room_id:t,entities_page_id:r,room_view_position:i,friendly_name:"",backend_name:""}});e=="home_assistant"?c("scene_type","home_assistant"):e=="openhab"?c("scene_type","openhab"):e=="nspm"&&c("scene_type","nspm_scene");function m(f){let g="";if(document.cookie&&document.cookie!==""){const y=document.cookie.split(";");for(let x=0;x{if(n!=null){const f=We.getState().scenes.find(g=>g.id==n);u(f)}},[n,We.getState().scenes]);function h(f){fetch("/rest/entities/scenes",{credentials:"same-origin",method:"PUT",mode:"same-origin",headers:{"Content-Type":"application/json","X-CSRFToken":m("csrftoken")},body:JSON.stringify(f)}).then(async g=>{const y=await g.json();if(console.log("Entity created/updated. Got response:",y),!g.ok){const x=y&&y.message||g.status;return Promise.reject(x)}o?.()}).catch(g=>{console.error("There was an error!",g)})}const v={control:f=>`${f.isFocused?"border":"border-0"} border-accent p-2.5 text-sm rounded-box bg-base-300 rounded-md`,menu:()=>"bg-base-300 p-2.5 rounded-box",option:f=>`p-1 ${f.isSelected?"bg-primary/20 rounded-sm":""} ${f.isFocused?"bg-primary/20 rounded-sm":""}`};return(0,p.jsxs)("form",{onSubmit:a(h),children:[(0,p.jsx)("input",{type:"hidden",...s("id")}),(0,p.jsx)("input",{type:"hidden",...s("type")}),(0,p.jsx)("input",{type:"hidden",...s("scene_type")}),(0,p.jsx)("input",{type:"hidden",...s("room_id")}),(0,p.jsx)("input",{type:"hidden",...s("entities_page_id")}),(0,p.jsx)("input",{type:"hidden",...s("room_view_position")}),(0,p.jsxs)("div",{className:"w-full",children:[(0,p.jsx)("div",{className:"flex justify-center mb-4 duration-500 transition-transform ease-linear",children:(0,p.jsxs)("div",{className:"w-full",children:[(0,p.jsx)("label",{htmlFor:"add_new_switch_name",className:"block mb-2 text-sm font-medium",children:"Name"}),(0,p.jsx)("div",{className:"flex flex-row-reverse",children:(0,p.jsx)("input",{className:"outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text",type:"text",...s("friendly_name"),required:!0})})]})}),e=="home_assistant"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("label",{className:"block mb-2 text-sm font-medium",children:"Home Assistant scene"}),(0,p.jsx)(Re,{options:le.getState().home_assistant_options.filter(f=>f.value.startsWith("scene.")||f.value.startsWith("script.")),classNames:v,onChange:f=>{c("backend_name",f?f.value:"")},unstyled:!0,components:Gd,value:le.getState().home_assistant_options.find(f=>f.value===l("backend_name")),styles:{input:f=>({...f,"input:focus":{boxShadow:"none"}}),multiValueLabel:f=>({...f,whiteSpace:"normal",overflow:"visible"}),control:f=>({...f,transition:"none"})}})]}),e=="openhab"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("label",{className:"block mb-2 mt-4 text-sm font-medium",children:"OpenHAB item"}),(0,p.jsx)(Re,{options:le.getState().openhab_options,classNames:v,onChange:f=>c("backend_name",f?f.value:""),value:le.getState().openhab_options.find(f=>f.value===l("backend_name")),unstyled:!0,components:Gd,styles:{input:f=>({...f,"input:focus":{boxShadow:"none"}}),multiValueLabel:f=>({...f,whiteSpace:"normal",overflow:"visible"}),control:f=>({...f,transition:"none"})}})]})]}),(0,p.jsx)("div",{className:"flex mt-4 justify-end items-center",children:(0,p.jsx)("button",{type:"submit",className:"btn btn-info",disabled:!d,children:"Save"})})]})},Ql=(0,_.createContext)({});function ec(e){const t=(0,_.useRef)(null);return t.current===null&&(t.current=e()),t.current}var oT=typeof window<"u",m_=oT?_.useLayoutEffect:_.useEffect,ia=(0,_.createContext)(null);function tc(e,t){e.indexOf(t)===-1&&e.push(t)}function Xi(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}var Ot=(e,t,r)=>r>t?t:r{},Nn=()=>{},Bt={},p_=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),h_=e=>typeof e=="object"&&e!==null,v_=e=>/^0[^.\s]+$/u.test(e);function g_(e){let t;return()=>(t===void 0&&(t=e()),t)}var lt=e=>e,Yr=(...e)=>e.reduce((t,r)=>i=>r(t(i))),br=(e,t,r)=>{const i=t-e;return i?(r-e)/i:1},nc=class{constructor(){this.subscriptions=[]}add(e){return tc(this.subscriptions,e),()=>Xi(this.subscriptions,e)}notify(e,t,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,t,r);else for(let n=0;ne*1e3,st=e=>e/1e3,b_=(e,t)=>t?e*(1e3/t):0,y_=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,aT=1e-7,sT=12;function uT(e,t,r,i,n){let o,a,s=0;do a=t+(r-t)/2,o=y_(a,i,n)-e,o>0?r=a:t=a;while(Math.abs(o)>aT&&++suT(o,0,1,e,r);return o=>o===0||o===1?o:y_(n(o),t,i)}var __=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,$_=e=>t=>1-e(1-t),x_=Qr(.33,1.53,.69,.99),rc=$_(x_),S_=__(rc),w_=e=>e>=1?1:(e*=2)<1?.5*rc(e):.5*(2-Math.pow(2,-10*(e-1))),ic=e=>1-Math.sin(Math.acos(e)),k_=$_(ic),I_=__(ic),lT=Qr(.42,0,1,1),cT=Qr(0,0,.58,1),j_=Qr(.42,0,.58,1),dT=e=>Array.isArray(e)&&typeof e[0]!="number",T_=e=>Array.isArray(e)&&typeof e[0]=="number",Kd={linear:lt,easeIn:lT,easeInOut:j_,easeOut:cT,circIn:ic,circInOut:I_,circOut:k_,backIn:rc,backInOut:S_,backOut:x_,anticipate:w_},fT=e=>typeof e=="string",Xd=e=>{if(T_(e)){Nn(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,r,i,n]=e;return Qr(t,r,i,n)}else if(fT(e))return Nn(Kd[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),Kd[e];return e},fi=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],It={value:null,addProjectionMetrics:null};function mT(e,t){let r=new Set,i=new Set,n=!1,o=!1;const a=new WeakSet;let s={delta:0,timestamp:0,isProcessing:!1},u=0;function l(d){a.has(d)&&(c.schedule(d),e()),u++,d(s)}const c={schedule:(d,m=!1,h=!1)=>{const v=h&&n?r:i;return m&&a.add(d),v.add(d),d},cancel:d=>{i.delete(d),a.delete(d)},process:d=>{if(s=d,n){o=!0;return}n=!0;const m=r;r=i,i=m,r.forEach(l),t&&It.value&&It.value.frameloop[t].push(u),u=0,r.clear(),n=!1,o&&(o=!1,c.process(d))}};return c}var pT=40;function P_(e,t){let r=!1,i=!0;const n={delta:0,timestamp:0,isProcessing:!1},o=()=>r=!0,a=fi.reduce((j,S)=>(j[S]=mT(o,t?S:void 0),j),{}),{setup:s,read:u,resolveKeyframes:l,preUpdate:c,update:d,preRender:m,render:h,postRender:v}=a,f=()=>{const j=Bt.useManualTiming,S=j?n.timestamp:performance.now();r=!1,j||(n.delta=i?1e3/60:Math.max(Math.min(S-n.timestamp,pT),1)),n.timestamp=S,n.isProcessing=!0,s.process(n),u.process(n),l.process(n),c.process(n),d.process(n),m.process(n),h.process(n),v.process(n),n.isProcessing=!1,r&&t&&(i=!1,e(f))},g=()=>{r=!0,i=!0,n.isProcessing||e(f)};return{schedule:fi.reduce((j,S)=>{const w=a[S];return j[S]=($,O=!1,z=!1)=>(r||g(),w.schedule($,O,z)),j},{}),cancel:j=>{for(let S=0;S($i===void 0&&Ze.set(Ee.isProcessing||Bt.useManualTiming?Ee.timestamp:performance.now()),$i),set:e=>{$i=e,queueMicrotask(hT)}},an={layout:0,mainThread:0,waapi:0},O_=e=>t=>typeof t=="string"&&t.startsWith(e),D_=O_("--"),vT=O_("var(--"),oc=e=>vT(e)?gT.test(e.split("/*")[0].trim()):!1,gT=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function qd(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}var Ln={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},yr={...Ln,transform:e=>Ot(0,1,e)},mi={...Ln,default:1},or=e=>Math.round(e*1e5)/1e5,ac=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function bT(e){return e==null}var yT=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,sc=(e,t)=>r=>!!(typeof r=="string"&&yT.test(r)&&r.startsWith(e)||t&&!bT(r)&&Object.prototype.hasOwnProperty.call(r,t)),z_=(e,t,r)=>i=>{if(typeof i!="string")return i;const[n,o,a,s]=i.match(ac);return{[e]:parseFloat(n),[t]:parseFloat(o),[r]:parseFloat(a),alpha:s!==void 0?parseFloat(s):1}},_T=e=>Ot(0,255,e),Ca={...Ln,transform:e=>Math.round(_T(e))},nn={test:sc("rgb","red"),parse:z_("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:i=1})=>"rgba("+Ca.transform(e)+", "+Ca.transform(t)+", "+Ca.transform(r)+", "+or(yr.transform(i))+")"};function $T(e){let t="",r="",i="",n="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),i=e.substring(5,7),n=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),i=e.substring(3,4),n=e.substring(4,5),t+=t,r+=r,i+=i,n+=n),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(i,16),alpha:n?parseInt(n,16)/255:1}}var hs={test:sc("#"),parse:$T,transform:nn.transform},ei=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ct=ei("deg"),Pt=ei("%"),W=ei("px"),xT=ei("vh"),ST=ei("vw"),Yd={...Pt,parse:e=>Pt.parse(e)/100,transform:e=>Pt.transform(e*100)},$n={test:sc("hsl","hue"),parse:z_("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:i=1})=>"hsla("+Math.round(e)+", "+Pt.transform(or(t))+", "+Pt.transform(or(r))+", "+or(yr.transform(i))+")"},je={test:e=>nn.test(e)||hs.test(e)||$n.test(e),parse:e=>nn.test(e)?nn.parse(e):$n.test(e)?$n.parse(e):hs.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?nn.transform(e):$n.transform(e),getAnimatableNone:e=>{const t=je.parse(e);return t.alpha=0,je.transform(t)}},wT=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function kT(e){return isNaN(e)&&typeof e=="string"&&(e.match(ac)?.length||0)+(e.match(wT)?.length||0)>0}var E_="number",C_="color",IT="var",jT="var(",Qd="${}",TT=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Vn(e){const t=e.toString(),r=[],i={color:[],number:[],var:[]},n=[];let o=0;return{values:r,split:t.replace(TT,a=>(je.test(a)?(i.color.push(o),n.push(C_),r.push(je.parse(a))):a.startsWith(jT)?(i.var.push(o),n.push(IT),r.push(a)):(i.number.push(o),n.push(E_),r.push(parseFloat(a))),++o,Qd)).split(Qd),indexes:i,types:n}}function PT(e){return Vn(e).values}function A_({split:e,types:t}){const r=e.length;return i=>{let n="";for(let o=0;otypeof e=="number"?0:je.test(e)?je.getAnimatableNone(e):e,zT=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:DT(e);function ET(e){const t=Vn(e);return A_(t)(t.values.map((r,i)=>zT(r,t.split[i])))}var bt={test:kT,parse:PT,createTransformer:OT,getAnimatableNone:ET};function Aa(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function CT({hue:e,saturation:t,lightness:r,alpha:i}){e/=360,t/=100,r/=100;let n=0,o=0,a=0;if(!t)n=o=a=r;else{const s=r<.5?r*(1+t):r+t-r*t,u=2*r-s;n=Aa(u,s,e+1/3),o=Aa(u,s,e),a=Aa(u,s,e-1/3)}return{red:Math.round(n*255),green:Math.round(o*255),blue:Math.round(a*255),alpha:i}}function qi(e,t){return r=>r>0?t:e}var ge=(e,t,r)=>e+(t-e)*r,Na=(e,t,r)=>{const i=e*e,n=r*(t*t-i)+i;return n<0?0:Math.sqrt(n)},AT=[hs,nn,$n],NT=e=>AT.find(t=>t.test(e));function ef(e){const t=NT(e);if(oa(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let r=t.parse(e);return t===$n&&(r=CT(r)),r}var tf=(e,t)=>{const r=ef(e),i=ef(t);if(!r||!i)return qi(e,t);const n={...r};return o=>(n.red=Na(r.red,i.red,o),n.green=Na(r.green,i.green,o),n.blue=Na(r.blue,i.blue,o),n.alpha=ge(r.alpha,i.alpha,o),nn.transform(n))},vs=new Set(["none","hidden"]);function VT(e,t){return vs.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}function UT(e,t){return r=>ge(e,t,r)}function uc(e){return typeof e=="number"?UT:typeof e=="string"?oc(e)?qi:je.test(e)?tf:FT:Array.isArray(e)?N_:typeof e=="object"?je.test(e)?tf:MT:qi}function N_(e,t){const r=[...e],i=r.length,n=e.map((o,a)=>uc(o)(o,t[a]));return o=>{for(let a=0;a{for(const o in i)r[o]=i[o](n);return r}}function RT(e,t){const r=[],i={color:0,var:0,number:0};for(let n=0;n{const r=bt.createTransformer(t),i=Vn(e),n=Vn(t);return i.indexes.var.length===n.indexes.var.length&&i.indexes.color.length===n.indexes.color.length&&i.indexes.number.length>=n.indexes.number.length?vs.has(e)&&!n.values.length||vs.has(t)&&!i.values.length?VT(e,t):Yr(N_(RT(i,n),n.values),r):(oa(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),qi(e,t))};function V_(e,t,r){return typeof e=="number"&&typeof t=="number"&&typeof r=="number"?ge(e,t,r):uc(e)(e,t)}var LT=e=>{const t=({timestamp:r})=>e(r);return{start:(r=!0)=>be.update(t,r),stop:()=>Wt(t),now:()=>Ee.isProcessing?Ee.timestamp:Ze.now()}},U_=(e,t,r=10)=>{let i="";const n=Math.max(Math.round(t/r),2);for(let o=0;o=2e4?1/0:t}function ZT(e,t=100,r){const i=r({...e,keyframes:[0,t]}),n=Math.min(lc(i),M_);return{type:"keyframes",ease:o=>i.next(n*o).value/t,duration:st(n)}}var xe={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function gs(e,t){return e*Math.sqrt(1-t*t)}var BT=12;function WT(e,t,r){let i=r;for(let n=1;n{const c=l*a,d=c*e,m=c-r,h=gs(l,a),v=Math.exp(-d);return nf-m/h*v},o=l=>{const c=l*a*e,d=c*r+r,m=Math.pow(a,2)*Math.pow(l,2)*e,h=Math.exp(-c),v=gs(Math.pow(l,2),a);return(-n(l)+nf>0?-1:1)*((d-m)*h)/v}):(n=l=>-.001+Math.exp(-l*e)*((l-r)*e+1),o=l=>Math.exp(-l*e)*((r-l)*(e*e)));const s=5/e,u=WT(n,o,s);if(e=Je(e),isNaN(u))return{stiffness:xe.stiffness,damping:xe.damping,duration:e};{const l=Math.pow(u,2)*i;return{stiffness:l,damping:a*2*Math.sqrt(i*l),duration:e}}}var JT=["duration","bounce"],GT=["stiffness","damping","mass"];function rf(e,t){return t.some(r=>e[r]!==void 0)}function KT(e){let t={velocity:xe.velocity,stiffness:xe.stiffness,damping:xe.damping,mass:xe.mass,isResolvedFromDuration:!1,...e};if(!rf(e,GT)&&rf(e,JT))if(t.velocity=0,e.visualDuration){const r=e.visualDuration,i=2*Math.PI/(r*1.2),n=i*i,o=2*Ot(.05,1,1-(e.bounce||0))*Math.sqrt(n);t={...t,mass:xe.mass,stiffness:n,damping:o}}else{const r=HT({...e,velocity:0});t={...t,...r,mass:xe.mass},t.isResolvedFromDuration=!0}return t}function Yi(e=xe.visualDuration,t=xe.bounce){const r=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:n}=r;const o=r.keyframes[0],a=r.keyframes[r.keyframes.length-1],s={done:!1,value:o},{stiffness:u,damping:l,mass:c,duration:d,velocity:m,isResolvedFromDuration:h}=KT({...r,velocity:-st(r.velocity||0)}),v=m||0,f=l/(2*Math.sqrt(u*c)),g=a-o,y=st(Math.sqrt(u/c)),x=Math.abs(g)<5;i||(i=x?xe.restSpeed.granular:xe.restSpeed.default),n||(n=x?xe.restDelta.granular:xe.restDelta.default);let j,S,w,$,O,z;if(f<1)w=gs(y,f),$=(v+f*y*g)/w,j=U=>{const oe=Math.exp(-f*y*U);return a-oe*($*Math.sin(w*U)+g*Math.cos(w*U))},O=f*y*$+g*w,z=f*y*g-$*w,S=U=>Math.exp(-f*y*U)*(O*Math.sin(w*U)+z*Math.cos(w*U));else if(f===1){j=oe=>a-Math.exp(-y*oe)*(g+(v+y*g)*oe);const U=v+y*g;S=oe=>Math.exp(-y*oe)*(y*U*oe-v)}else{const U=y*Math.sqrt(f*f-1);j=ae=>{const G=Math.exp(-f*y*ae),Q=Math.min(U*ae,300);return a-G*((v+f*y*g)*Math.sinh(Q)+U*g*Math.cosh(Q))/U};const oe=(v+f*y*g)/U,B=f*y*oe-g*U,q=f*y*g-oe*U;S=ae=>{const G=Math.exp(-f*y*ae),Q=Math.min(U*ae,300);return G*(B*Math.sinh(Q)+q*Math.cosh(Q))}}const L={calculatedDuration:h&&d||null,velocity:U=>Je(S(U)),next:U=>{if(!h&&f<1){const B=Math.exp(-f*y*U),q=Math.sin(w*U),ae=Math.cos(w*U),G=a-B*($*q+g*ae),Q=Je(B*(O*q+z*ae));return s.done=Math.abs(Q)<=i&&Math.abs(a-G)<=n,s.value=s.done?a:G,s}const oe=j(U);if(h)s.done=U>=d;else{const B=Je(S(U));s.done=Math.abs(B)<=i&&Math.abs(a-oe)<=n}return s.value=s.done?a:oe,s},toString:()=>{const U=Math.min(lc(L),M_),oe=U_(B=>L.next(U*B).value,U,30);return U+"ms "+oe},toTransition:()=>{}};return L}Yi.applyToOptions=e=>{const t=ZT(e,100,Yi);return e.ease=t.ease,e.duration=Je(t.duration),e.type="keyframes",e};var XT=5;function R_(e,t,r){const i=Math.max(t-XT,0);return b_(r-e(i),t-i)}function bs({keyframes:e,velocity:t=0,power:r=.8,timeConstant:i=325,bounceDamping:n=10,bounceStiffness:o=500,modifyTarget:a,min:s,max:u,restDelta:l=.5,restSpeed:c}){const d=e[0],m={done:!1,value:d},h=z=>s!==void 0&&zu,v=z=>s===void 0?u:u===void 0||Math.abs(s-z)-f*Math.exp(-z/i),j=z=>y+x(z),S=z=>{const L=x(z),U=j(z);m.done=Math.abs(L)<=l,m.value=m.done?y:U};let w,$;const O=z=>{h(m.value)&&(w=z,$=Yi({keyframes:[m.value,v(m.value)],velocity:R_(j,z,m.value),damping:n,stiffness:o,restDelta:l,restSpeed:c}))};return O(0),{calculatedDuration:null,next:z=>{let L=!1;return!$&&w===void 0&&(L=!0,S(z),O(z)),w!==void 0&&z>=w?$.next(z-w):(!L&&S(z),m)}}}function qT(e,t,r){const i=[],n=r||Bt.mix||V_,o=e.length-1;for(let a=0;at[0];if(o===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const s=qT(t,i,n),u=s.length,l=c=>{if(a&&c1)for(;dl(Ot(e[0],e[o-1],c)):l}function QT(e,t){const r=e[e.length-1];for(let i=1;i<=t;i++){const n=br(0,t,i);e.push(ge(r,1,n))}}function eP(e){const t=[0];return QT(t,e.length-1),t}function tP(e,t){return e.map(r=>r*t)}function nP(e,t){return e.map(()=>t||j_).splice(0,e.length-1)}function ar({duration:e=300,keyframes:t,times:r,ease:i="easeInOut"}){const n=dT(i)?i.map(Xd):Xd(i),o={done:!1,value:t[0]},a=YT(tP(r&&r.length===t.length?r:eP(t),e),t,{ease:Array.isArray(n)?n:nP(t,n)});return{calculatedDuration:e,next:s=>(o.value=a(s),o.done=s>=e,o)}}var rP=e=>e!==null;function aa(e,{repeat:t,repeatType:r="loop"},i,n=1){const o=e.filter(rP),a=n<0||t&&r!=="loop"&&t%2===1?0:o.length-1;return!a||i===void 0?o[a]:i}var iP={decay:bs,inertia:bs,tween:ar,keyframes:ar,spring:Yi};function F_(e){typeof e.type=="string"&&(e.type=iP[e.type])}var cc=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},oP=e=>e/100,Qi=class extends cc{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==Ze.now()&&this.tick(Ze.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},an.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;F_(e);const{type:t=ar,repeat:r=0,repeatDelay:i=0,repeatType:n,velocity:o=0}=e;let{keyframes:a}=e;const s=t||ar;s!==ar&&typeof a[0]!="number"&&(this.mixKeyframes=Yr(oP,V_(a[0],a[1])),a=[0,100]);const u=s({...e,keyframes:a});n==="mirror"&&(this.mirroredGenerator=s({...e,keyframes:[...a].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=lc(u));const{calculatedDuration:l}=u;this.calculatedDuration=l,this.resolvedDuration=l+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=u}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:r,totalDuration:i,mixKeyframes:n,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:s}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:l,repeat:c,repeatType:d,repeatDelay:m,type:h,onUpdate:v,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const g=this.currentTime-u*(this.playbackSpeed>=0?1:-1),y=this.playbackSpeed>=0?g<0:g>i;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let x=this.currentTime,j=r;if(c){const O=Math.min(this.currentTime,i)/a;let z=Math.floor(O),L=O%1;!L&&O>=1&&(L=1),L===1&&z--,z=Math.min(z,c+1),z%2&&(d==="reverse"?(L=1-L,m&&(L-=m/a)):d==="mirror"&&(j=o)),x=Ot(0,1,L)*a}let S;y?(this.delayState.value=l[0],S=this.delayState):S=j.next(x),n&&!y&&(S.value=n(S.value));let{done:w}=S;!y&&s!==null&&(w=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const $=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&w);return $&&h!==bs&&(S.value=aa(l,this.options,f,this.speed)),v&&v(S.value),$&&this.finish(),S}then(e,t){return this.finished.then(e,t)}get duration(){return st(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+st(e)}get time(){return st(this.currentTime)}set time(e){e=Je(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const t=this.generator.next(e).value;return R_(r=>this.generator.next(r).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(Ze.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=st(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=LT,startTime:t}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=t??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Ze.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,an.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}};function aP(e){for(let t=1;te*180/Math.PI,ys=e=>{const t=rn(Math.atan2(e[1],e[0]));return _s(t)},sP={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:ys,rotateZ:ys,skewX:e=>rn(Math.atan(e[1])),skewY:e=>rn(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},_s=e=>(e=e%360,e<0&&(e+=360),e),of=ys,af=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),sf=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),uP={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:af,scaleY:sf,scale:e=>(af(e)+sf(e))/2,rotateX:e=>_s(rn(Math.atan2(e[6],e[5]))),rotateY:e=>_s(rn(Math.atan2(-e[2],e[0]))),rotateZ:of,rotate:of,skewX:e=>rn(Math.atan(e[4])),skewY:e=>rn(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function $s(e){return e.includes("scale")?1:0}function xs(e,t){if(!e||e==="none")return $s(t);const r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,n;if(r)i=uP,n=r;else{const s=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=sP,n=s}if(!n)return $s(t);const o=i[t],a=n[1].split(",").map(cP);return typeof o=="function"?o(a):a[o]}var lP=(e,t)=>{const{transform:r="none"}=getComputedStyle(e);return xs(r,t)};function cP(e){return parseFloat(e.trim())}var Zn=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Bn=new Set([...Zn,"pathRotation"]),uf=e=>e===Ln||e===W,dP=new Set(["x","y","z"]),fP=Zn.filter(e=>!dP.has(e));function mP(e){const t=[];return fP.forEach(r=>{const i=e.getValue(r);i!==void 0&&(t.push([r,i.get()]),i.set(r.startsWith("scale")?1:0))}),t}var Rt={width:({x:e},{paddingLeft:t="0",paddingRight:r="0",boxSizing:i})=>{const n=e.max-e.min;return i==="border-box"?n:n-parseFloat(t)-parseFloat(r)},height:({y:e},{paddingTop:t="0",paddingBottom:r="0",boxSizing:i})=>{const n=e.max-e.min;return i==="border-box"?n:n-parseFloat(t)-parseFloat(r)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>xs(t,"x"),y:(e,{transform:t})=>xs(t,"y")};Rt.translateX=Rt.x;Rt.translateY=Rt.y;var sn=new Set,Ss=!1,ws=!1,ks=!1;function L_(){if(ws){const e=Array.from(sn).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),r=new Map;t.forEach(i=>{const n=mP(i);n.length&&(r.set(i,n),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const n=r.get(i);n&&n.forEach(([o,a])=>{i.getValue(o)?.set(a)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}ws=!1,Ss=!1,sn.forEach(e=>e.complete(ks)),sn.clear()}function Z_(){sn.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(ws=!0)})}function pP(){ks=!0,Z_(),L_(),ks=!1}var dc=class{constructor(e,t,r,i,n,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=i,this.element=n,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(sn.add(this),Ss||(Ss=!0,be.read(Z_),be.resolveKeyframes(L_))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:r,motionValue:i}=this;if(e[0]===null){const n=i?.get(),o=e[e.length-1];if(n!==void 0)e[0]=n;else if(r&&t){const a=r.readValue(t,o);a!=null&&(e[0]=a)}e[0]===void 0&&(e[0]=o),i&&n===void 0&&i.set(e[0])}aP(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),sn.delete(this)}cancel(){this.state==="scheduled"&&(sn.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}},hP=e=>e.startsWith("--");function B_(e,t,r){hP(t)?e.style.setProperty(t,r):e.style[t]=r}var vP={};function W_(e,t){const r=g_(e);return()=>vP[t]??r()}var gP=W_(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),H_=W_(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),ir=([e,t,r,i])=>`cubic-bezier(${e}, ${t}, ${r}, ${i})`,lf={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ir([0,.65,.55,1]),circOut:ir([.55,0,1,.45]),backIn:ir([.31,.01,.66,-.59]),backOut:ir([.33,1.53,.69,.99])};function J_(e,t){if(e)return typeof e=="function"?H_()?U_(e,t):"ease-out":T_(e)?ir(e):Array.isArray(e)?e.map(r=>J_(r,t)||lf.easeOut):lf[e]}function bP(e,t,r,{delay:i=0,duration:n=300,repeat:o=0,repeatType:a="loop",ease:s="easeOut",times:u}={},l=void 0){const c={[t]:r};u&&(c.offset=u);const d=J_(s,n);Array.isArray(d)&&(c.easing=d),It.value&&an.waapi++;const m={delay:i,duration:n,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:a==="reverse"?"alternate":"normal"};l&&(m.pseudoElement=l);const h=e.animate(c,m);return It.value&&h.finished.finally(()=>{an.waapi--}),h}function G_(e){return typeof e=="function"&&"applyToOptions"in e}function yP({type:e,...t}){return G_(e)&&H_()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}var K_=class extends cc{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:r,keyframes:i,pseudoElement:n,allowFlatten:o=!1,finalKeyframe:a,onComplete:s}=e;this.isPseudoElement=!!n,this.allowFlatten=o,this.options=e,Nn(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const u=yP(e);this.animation=bP(t,r,i,u,n),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!n){const l=aa(i,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(l),B_(t,r,l),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return st(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+st(e)}get time(){return st(Number(this.animation.currentTime)||0)}set time(e){const t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Je(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:r,observe:i}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&gP()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),r&&(this.animation.rangeEnd=r),lt):i(this)}},X_={anticipate:w_,backInOut:S_,circInOut:I_};function _P(e){return e in X_}function $P(e){typeof e.ease=="string"&&_P(e.ease)&&(e.ease=X_[e.ease])}var Va=10,xP=class extends K_{constructor(e){$P(e),F_(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:r,onComplete:i,element:n,...o}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}const a=new Qi({...o,autoplay:!1}),s=Math.max(Va,Ze.now()-this.startTime),u=Ot(0,Va,s-Va),l=a.sample(s).value,{name:c}=this.options;n&&c&&B_(n,c,l),t.setWithVelocity(a.sample(Math.max(0,s-u)).value,l,u),a.stop()}},cf=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(bt.test(e)||e==="0")&&!e.startsWith("url("));function SP(e){const t=e[0];if(e.length===1)return!0;for(let r=0;rObject.hasOwnProperty.call(Element.prototype,"animate"));function PP(e){const{motionValue:t,name:r,repeatDelay:i,repeatType:n,damping:o,type:a,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:l}=t.owner.getProps();return TP()&&r&&(q_.has(r)||jP.has(r)&&IP(s))&&(r!=="transform"||!l)&&!u&&!i&&n!=="mirror"&&o!==0&&a!=="inertia"}var OP=40,DP=class extends cc{constructor({autoplay:e=!0,delay:t=0,type:r="keyframes",repeat:i=0,repeatDelay:n=0,repeatType:o="loop",keyframes:a,name:s,motionValue:u,element:l,...c}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Ze.now();const d={autoplay:e,delay:t,type:r,repeat:i,repeatDelay:n,repeatType:o,name:s,motionValue:u,element:l,...c},m=l?.KeyframeResolver||dc;this.keyframeResolver=new m(a,(h,v,f)=>this.onKeyframesResolved(h,v,d,!f),s,u,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,r,i){this.keyframeResolver=void 0;const{name:n,type:o,velocity:a,delay:s,isHandoff:u,onUpdate:l}=r;this.resolvedAt=Ze.now();let c=!0;wP(e,n,o,a)||(c=!1,(Bt.instantAnimations||!s)&&l?.(aa(e,r,t)),e[0]=e[e.length-1],Is(r),r.repeat=0);const d={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>OP?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:t,...r,keyframes:e},m=c&&!u&&PP(d),h=d.motionValue?.owner?.current;let v;if(m)try{v=new xP({...d,element:h})}catch{v=new Qi(d)}else v=new Qi(d);v.finished.then(()=>{this.notifyFinished()}).catch(lt),this.pendingTimeline&&(this.stopTimeline=v.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=v}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),pP()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function Y_(e,t,r,i=0,n=1){const o=Array.from(e).sort((u,l)=>u.sortNodePosition(l)).indexOf(t),a=e.size,s=(a-1)*i;return typeof r=="function"?r(o,a):n===1?o*i:s-o*i}var df=30,zP=e=>!isNaN(parseFloat(e)),ff={current:void 0},EP=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const i=Ze.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const n of this.dependents)n.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Ze.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=zP(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new nc);const r=this.events[e].add(t);return e==="change"?()=>{r(),be.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return ff.current&&ff.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=Ze.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>df)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,df);return b_(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Un(e,t){return new EP(e,t)}function Q_(e,t){if(e?.inherit&&t){const{inherit:r,...i}=e;return{...t,...i}}return e}function fc(e,t){const r=e?.[t]??e?.default??e;return r!==e?Q_(r,e):r}var CP={type:"spring",stiffness:500,damping:25,restSpeed:10},AP=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),NP={type:"keyframes",duration:.8},VP={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},UP=(e,{keyframes:t})=>t.length>2?NP:Bn.has(e)?e.startsWith("scale")?AP(t[1]):CP:VP,MP=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function RP(e){for(const t in e)if(!MP.has(t))return!0;return!1}var mc=(e,t,r,i={},n,o)=>a=>{const s=fc(i,e)||{},u=s.delay||i.delay||0;let{elapsed:l=0}=i;l=l-Je(u);const c={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...s,delay:-l,onUpdate:m=>{t.set(m),s.onUpdate&&s.onUpdate(m)},onComplete:()=>{a(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:o?void 0:n};RP(s)||Object.assign(c,UP(e,c)),c.duration&&(c.duration=Je(c.duration)),c.repeatDelay&&(c.repeatDelay=Je(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let d=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(Is(c),c.delay===0&&(d=!0)),(Bt.instantAnimations||Bt.skipAnimations||n?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,Is(c),c.delay=0),c.allowFlatten=!s.type&&!s.ease,d&&!o&&t.get()!==void 0){const m=aa(c.keyframes,s);if(m!==void 0){be.update(()=>{c.onUpdate(m),c.onComplete()});return}}return s.isSync?new Qi(c):new DP(c)},FP=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function LP(e){const t=FP.exec(e);if(!t)return[,];const[,r,i,n]=t;return[`--${r??i}`,n]}var ZP=4;function e0(e,t,r=1){Nn(r<=ZP,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[i,n]=LP(e);if(!i)return;const o=window.getComputedStyle(t).getPropertyValue(i);if(o){const a=o.trim();return p_(a)?parseFloat(a):a}return oc(n)?e0(n,t,r+1):n}function mf(e){const t=[{},{}];return e?.values.forEach((r,i)=>{t[0][i]=r.get(),t[1][i]=r.getVelocity()}),t}function pc(e,t,r,i){if(typeof t=="function"){const[n,o]=mf(i);t=t(r!==void 0?r:e.custom,n,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[n,o]=mf(i);t=t(r!==void 0?r:e.custom,n,o)}return t}function un(e,t,r){const i=e.getProps();return pc(i,t,r!==void 0?r:i.custom,e)}var t0=new Set(["width","height","top","left","right","bottom",...Zn]),js=e=>Array.isArray(e);function BP(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,Un(r))}function WP(e){return js(e)?e[e.length-1]||0:e}function HP(e,t){let{transitionEnd:r={},transition:i={},...n}=un(e,t)||{};n={...n,...r};for(const o in n)BP(e,o,WP(n[o]))}var Ne=e=>!!(e&&e.getVelocity);function JP(e){return!!(Ne(e)&&e.add)}function Ts(e,t){const r=e.getValue("willChange");if(JP(r))return r.add(t);if(!r&&Bt.WillChange){const i=new Bt.WillChange("auto");e.addValue("willChange",i),i.add(t)}}function hc(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var GP="framerAppearId",n0="data-"+hc(GP);function r0(e){return e.props[n0]}function KP({protectedKeys:e,needsAnimating:t},r){const i=e.hasOwnProperty(r)&&t[r]!==!0;return t[r]=!1,i}function i0(e,t,{delay:r=0,transitionOverride:i,type:n}={}){let{transition:o,transitionEnd:a,...s}=t;const u=e.getDefaultTransition();o=o?Q_(o,u):u;const l=o?.reduceMotion,c=o?.skipAnimations;i&&(o=i);const d=[],m=n&&e.animationState&&e.animationState.getState()[n],h=o?.path;h&&h.animateVisualElement(e,s,o,r,d);for(const v in s){const f=e.getValue(v,e.latestValues[v]??null),g=s[v];if(g===void 0||m&&KP(m,v))continue;const y={delay:r,...fc(o||{},v)};c&&(y.skipAnimations=!0);const x=f.get();if(x!==void 0&&!f.isAnimating()&&!Array.isArray(g)&&g===x&&!y.velocity){be.update(()=>f.set(g));continue}let j=!1;if(window.MotionHandoffAnimation){const $=r0(e);if($){const O=window.MotionHandoffAnimation($,v,be);O!==null&&(y.startTime=O,j=!0)}}Ts(e,v);const S=l??e.shouldReduceMotion;f.start(mc(v,f,g,S&&t0.has(v)?{type:!1}:y,e,j));const w=f.animation;w&&d.push(w)}if(a){const v=()=>be.update(()=>{a&&HP(e,a)});d.length?Promise.all(d).then(v):v()}return d}function Ps(e,t,r={}){const i=un(e,t,r.type==="exit"?e.presenceContext?.custom:void 0);let{transition:n=e.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(n=r.transitionOverride);const o=i?()=>Promise.all(i0(e,i,r)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:l=0,staggerChildren:c,staggerDirection:d}=n;return XP(e,t,u,l,c,d,r)}:()=>Promise.resolve(),{when:s}=n;if(s){const[u,l]=s==="beforeChildren"?[o,a]:[a,o];return u().then(()=>l())}else return Promise.all([o(),a(r.delay)])}function XP(e,t,r=0,i=0,n=0,o=1,a){const s=[];for(const u of e.variantChildren)u.notify("AnimationStart",t),s.push(Ps(u,t,{...a,delay:r+(typeof i=="function"?0:i)+Y_(e.variantChildren,u,i,n,o)}).then(()=>u.notify("AnimationComplete",t)));return Promise.all(s)}function qP(e,t,r={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const n=t.map(o=>Ps(e,o,r));i=Promise.all(n)}else if(typeof t=="string")i=Ps(e,t,r);else{const n=typeof t=="function"?un(e,t,r.custom):t;i=Promise.all(i0(e,n,r))}return i.then(()=>{e.notify("AnimationComplete",t)})}var YP={test:e=>e==="auto",parse:e=>e},o0=e=>t=>t.test(e),a0=[Ln,W,Pt,Ct,ST,xT,YP],pf=e=>a0.find(o0(e));function QP(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||v_(e):!0}var eO=new Set(["brightness","contrast","saturate","opacity"]);function tO(e){const[t,r]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=r.match(ac)||[];if(!i)return e;const n=r.replace(i,"");let o=eO.has(t)?1:0;return i!==r&&(o*=100),t+"("+o+n+")"}var nO=/\b([a-z-]*)\(.*?\)/gu,Os={...bt,getAnimatableNone:e=>{const t=e.match(nO);return t?t.map(tO).join(" "):e}},Ds={...bt,getAnimatableNone:e=>{const t=bt.parse(e);return bt.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},hf={...Ln,transform:Math.round},rO={rotate:Ct,pathRotation:Ct,rotateX:Ct,rotateY:Ct,rotateZ:Ct,scale:mi,scaleX:mi,scaleY:mi,scaleZ:mi,skew:Ct,skewX:Ct,skewY:Ct,distance:W,translateX:W,translateY:W,translateZ:W,x:W,y:W,z:W,perspective:W,transformPerspective:W,opacity:yr,originX:Yd,originY:Yd,originZ:W},eo={borderWidth:W,borderTopWidth:W,borderRightWidth:W,borderBottomWidth:W,borderLeftWidth:W,borderRadius:W,borderTopLeftRadius:W,borderTopRightRadius:W,borderBottomRightRadius:W,borderBottomLeftRadius:W,width:W,maxWidth:W,height:W,maxHeight:W,top:W,right:W,bottom:W,left:W,inset:W,insetBlock:W,insetBlockStart:W,insetBlockEnd:W,insetInline:W,insetInlineStart:W,insetInlineEnd:W,padding:W,paddingTop:W,paddingRight:W,paddingBottom:W,paddingLeft:W,paddingBlock:W,paddingBlockStart:W,paddingBlockEnd:W,paddingInline:W,paddingInlineStart:W,paddingInlineEnd:W,margin:W,marginTop:W,marginRight:W,marginBottom:W,marginLeft:W,marginBlock:W,marginBlockStart:W,marginBlockEnd:W,marginInline:W,marginInlineStart:W,marginInlineEnd:W,fontSize:W,backgroundPositionX:W,backgroundPositionY:W,...rO,zIndex:hf,fillOpacity:yr,strokeOpacity:yr,numOctaves:hf},iO={...eo,color:je,backgroundColor:je,outlineColor:je,fill:je,stroke:je,borderColor:je,borderTopColor:je,borderRightColor:je,borderBottomColor:je,borderLeftColor:je,filter:Os,WebkitFilter:Os,mask:Ds,WebkitMask:Ds},s0=e=>iO[e],oO=new Set([Os,Ds]);function u0(e,t){let r=s0(e);return oO.has(r)||(r=bt),r.getAnimatableNone?r.getAnimatableNone(t):void 0}var aO=new Set(["auto","none","0"]);function sO(e,t,r){let i=0,n;for(;i{e.getValue(a).set(s)}),this.resolveNoneKeyframes()}};function l0(e,t,r){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let i=document;t&&(i=t.current);const n=r?.[e]??i.querySelectorAll(e);return n?Array.from(n):[]}return Array.from(e).filter(i=>i!=null)}var zs=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function xi(e){return h_(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}var{schedule:vc,cancel:mE}=P_(queueMicrotask,!1),vt={x:!1,y:!1};function c0(){return vt.x||vt.y}function lO(e){return e==="x"||e==="y"?vt[e]?null:(vt[e]=!0,()=>{vt[e]=!1}):vt.x||vt.y?null:(vt.x=vt.y=!0,()=>{vt.x=vt.y=!1})}function d0(e,t){const r=l0(e),i=new AbortController,n={passive:!0,...t,signal:i.signal};return[r,n,()=>i.abort()]}function cO(e){return!(e.pointerType==="touch"||c0())}function dO(e,t,r={}){const[i,n,o]=d0(e,r);return i.forEach(a=>{let s=!1,u=!1,l;const c=()=>{a.removeEventListener("pointerleave",v)},d=g=>{l&&(l(g),l=void 0),c()},m=g=>{s=!1,window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m),u&&(u=!1,d(g))},h=()=>{s=!0,window.addEventListener("pointerup",m,n),window.addEventListener("pointercancel",m,n)},v=g=>{if(g.pointerType!=="touch"){if(s){u=!0;return}d(g)}},f=g=>{if(!cO(g))return;u=!1;const y=t(a,g);typeof y=="function"&&(l=y,a.addEventListener("pointerleave",v,n))};a.addEventListener("pointerenter",f,n),a.addEventListener("pointerdown",h,n)}),o}var f0=(e,t)=>t?e===t?!0:f0(e,t.parentElement):!1,gc=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,fO=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function mO(e){return fO.has(e.tagName)||e.isContentEditable===!0}var pO=new Set(["INPUT","SELECT","TEXTAREA"]);function hO(e){return pO.has(e.tagName)||e.isContentEditable===!0}var Si=new WeakSet;function vf(e){return t=>{t.key==="Enter"&&e(t)}}function Ua(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}var vO=(e,t)=>{const r=e.currentTarget;if(!r)return;const i=vf(()=>{if(Si.has(r))return;Ua(r,"down");const n=vf(()=>{Ua(r,"up")}),o=()=>Ua(r,"cancel");r.addEventListener("keyup",n,t),r.addEventListener("blur",o,t)});r.addEventListener("keydown",i,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",i),t)};function gf(e){return gc(e)&&!c0()}var bf=new WeakSet;function gO(e,t,r={}){const[i,n,o]=d0(e,r),a=s=>{const u=s.currentTarget;if(!gf(s)||bf.has(s))return;Si.add(u),r.stopPropagation&&bf.add(s);const l=t(u,s),c=(h,v)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",m),Si.has(u)&&Si.delete(u),gf(h)&&typeof l=="function"&&l(h,{success:v})},d=h=>{c(h,u===window||u===document||r.useGlobalTarget||f0(u,h.target))},m=h=>{c(h,!1)};window.addEventListener("pointerup",d,n),window.addEventListener("pointercancel",m,n)};return i.forEach(s=>{(r.useGlobalTarget?window:s).addEventListener("pointerdown",a,n),xi(s)&&(s.addEventListener("focus",u=>vO(u,n)),!mO(s)&&!s.hasAttribute("tabindex")&&(s.tabIndex=0))}),o}function bc(e){return h_(e)&&"ownerSVGElement"in e}var wi=new WeakMap,ki,m0=(e,t,r)=>(i,n)=>n&&n[0]?n[0][e+"Size"]:bc(i)&&"getBBox"in i?i.getBBox()[t]:i[r],bO=m0("inline","width","offsetWidth"),yO=m0("block","height","offsetHeight");function _O({target:e,borderBoxSize:t}){wi.get(e)?.forEach(r=>{r(e,{get width(){return bO(e,t)},get height(){return yO(e,t)}})})}function $O(e){e.forEach(_O)}function xO(){typeof ResizeObserver>"u"||(ki=new ResizeObserver($O))}function SO(e,t){ki||xO();const r=l0(e);return r.forEach(i=>{let n=wi.get(i);n||(n=new Set,wi.set(i,n)),n.add(t),ki?.observe(i)}),()=>{r.forEach(i=>{const n=wi.get(i);n?.delete(t),n?.size||ki?.unobserve(i)})}}var Ii=new Set,xn;function wO(){xn=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Ii.forEach(t=>t(e))},window.addEventListener("resize",xn)}function kO(e){return Ii.add(e),xn||wO(),()=>{Ii.delete(e),!Ii.size&&typeof xn=="function"&&(window.removeEventListener("resize",xn),xn=void 0)}}function yf(e,t){return typeof e=="function"?kO(e):SO(e,t)}function IO(e){return bc(e)&&e.tagName==="svg"}var jO=[...a0,je,bt],TO=e=>jO.find(o0(e)),_f=()=>({translate:0,scale:1,origin:0,originPoint:0}),Sn=()=>({x:_f(),y:_f()}),$f=()=>({min:0,max:0}),Pe=()=>({x:$f(),y:$f()}),PO=new WeakMap;function sa(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function _r(e){return typeof e=="string"||Array.isArray(e)}var yc=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],_c=["initial",...yc];function ua(e){return sa(e.animate)||_c.some(t=>_r(e[t]))}function p0(e){return!!(ua(e)||e.variants)}function OO(e,t,r){for(const i in t){const n=t[i],o=r[i];if(Ne(n))e.addValue(i,n);else if(Ne(o))e.addValue(i,Un(n,{owner:e}));else if(o!==n)if(e.hasValue(i)){const a=e.getValue(i);a.liveStyle===!0?a.jump(n):a.hasAnimated||a.set(n)}else{const a=e.getStaticValue(i);e.addValue(i,Un(a!==void 0?a:n,{owner:e}))}}for(const i in r)t[i]===void 0&&e.removeValue(i);return t}var Es={current:null},h0={current:!1},DO=typeof window<"u";function zO(){if(h0.current=!0,!!DO)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Es.current=e.matches;e.addEventListener("change",t),t()}else Es.current=!1}var xf=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],to={};function v0(e){to=e}function EO(){return to}var CO=class{scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:i,skipAnimations:n,blockInitialAnimation:o,visualState:a},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=dc,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=Ze.now();this.renderScheduledAtthis.bindToMotionValue(r,t)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(h0.current||zO(),this.shouldReduceMotion=Es.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Wt(this.notifyUpdate),Wt(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&q_.has(e)&&this.current instanceof HTMLElement){const{factory:o,keyframes:a,times:s,ease:u,duration:l}=t.accelerate,c=new K_({element:this.current,name:e,keyframes:a,times:s,ease:u,duration:Je(l)}),d=o(c);this.valueSubscriptions.set(e,()=>{d(),c.cancel()});return}const r=Bn.has(e);r&&this.onBindTransform&&this.onBindTransform();const i=t.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&be.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let n;typeof window<"u"&&window.MotionCheckAppearSync&&(n=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{i(),n&&n()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in to){const t=to[e];if(!t)continue;const{isEnabled:r,Feature:i}=t;if(!this.features[e]&&i&&r(this.props)&&(this.features[e]=new i(this)),this.features[e]){const n=this.features[e];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Pe()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let r=0;rt.variantChildren.delete(e)}addValue(e,t){const r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&t!==void 0&&(r=Un(t===null?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(p_(r)||v_(r))?r=parseFloat(r):!TO(r)&&bt.test(t)&&(r=u0(e,t)),this.setBaseTarget(e,Ne(r)?r.get():r)),Ne(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){const{initial:t}=this.props;let r;if(typeof t=="string"||typeof t=="object"){const n=pc(this.props,t,this.presenceContext?.custom);n&&(r=n[e])}if(t&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!Ne(i)?i:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new nc),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){vc.render(this.render)}},g0=class extends CO{constructor(){super(...arguments),this.KeyframeResolver=uO}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){const r=e.style;return r?r[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Ne(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}},Jt=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function b0({top:e,left:t,right:r,bottom:i}){return{x:{min:t,max:r},y:{min:e,max:i}}}function AO({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function NO(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:i.y,right:i.x}}function Ma(e){return e===void 0||e===1}function Cs({scale:e,scaleX:t,scaleY:r}){return!Ma(e)||!Ma(t)||!Ma(r)}function Yt(e){return Cs(e)||y0(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function y0(e){return Sf(e.x)||Sf(e.y)}function Sf(e){return e&&e!=="0%"}function no(e,t,r){return r+t*(e-r)}function wf(e,t,r,i,n){return n!==void 0&&(e=no(e,n,i)),no(e,r,i)+t}function As(e,t=0,r=1,i,n){e.min=wf(e.min,t,r,i,n),e.max=wf(e.max,t,r,i,n)}function _0(e,{x:t,y:r}){As(e.x,t.translate,t.scale,t.originPoint),As(e.y,r.translate,r.scale,r.originPoint)}var kf=.999999999999,If=1.0000000000001;function VO(e,t,r,i=!1){const n=r.length;if(!n)return;t.x=t.y=1;let o,a;for(let s=0;skf&&(t.x=1),t.ykf&&(t.y=1)}function kt(e,t){e.min+=t,e.max+=t}function jf(e,t,r,i,n=.5){As(e,t,r,ge(e.min,e.max,n),i)}function Tf(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function ji(e,t,r){const i=r??e;jf(e.x,Tf(t.x,i.x),t.scaleX,t.scale,t.originX),jf(e.y,Tf(t.y,i.y),t.scaleY,t.scale,t.originY)}function $0(e,t){return b0(NO(e.getBoundingClientRect(),t))}function UO(e,t,r){const i=$0(e,r),{scroll:n}=t;return n&&(kt(i.x,n.offset.x),kt(i.y,n.offset.y)),i}var MO={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},RO=Zn.length;function FO(e,t,r){let i="",n=!0;for(let a=0;a{if(!t.target)return e;if(typeof e=="string")if(W.test(e))e=parseFloat(e);else return e;return`${Pf(e,t.target.x)}% ${Pf(e,t.target.y)}%`}},LO={correct:(e,{treeScale:t,projectionDelta:r})=>{const i=e,n=bt.parse(e);if(n.length>5)return i;const o=bt.createTransformer(e),a=typeof n[0]!="number"?1:0,s=r.x.scale*t.x,u=r.y.scale*t.y;n[0+a]/=s,n[1+a]/=u;const l=ge(s,u,.5);return typeof n[2+a]=="number"&&(n[2+a]/=l),typeof n[3+a]=="number"&&(n[3+a]/=l),o(n)}},Ns={borderRadius:{...tr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:tr,borderTopRightRadius:tr,borderBottomLeftRadius:tr,borderBottomRightRadius:tr,boxShadow:LO};function S0(e,{layout:t,layoutId:r}){return Bn.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!Ns[e]||e==="opacity")}function xc(e,t,r){const i=e.style,n=t?.style,o={};if(!i)return o;for(const a in i)(Ne(i[a])||n&&Ne(n[a])||S0(a,e)||r?.getValue(a)?.liveStyle!==void 0)&&(o[a]=i[a]);return o}function ZO(e){return window.getComputedStyle(e)}var BO=class extends g0{constructor(){super(...arguments),this.type="html",this.renderInstance=x0}readValueFromInstance(e,t){if(Bn.has(t))return this.projection?.isProjecting?$s(t):lP(e,t);{const r=ZO(e),i=(D_(t)?r.getPropertyValue(t):r[t])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:t}){return $0(e,t)}build(e,t,r){$c(e,t,r.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return xc(e,t,r)}},WO={offset:"stroke-dashoffset",array:"stroke-dasharray"},HO={offset:"strokeDashoffset",array:"strokeDasharray"};function JO(e,t,r=1,i=0,n=!0){e.pathLength=1;const o=n?WO:HO;e[o.offset]=`${-i}`,e[o.array]=`${t} ${r}`}var GO=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function w0(e,{attrX:t,attrY:r,attrScale:i,pathLength:n,pathSpacing:o=1,pathOffset:a=0,...s},u,l,c){if($c(e,s,l),u){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:d,style:m}=e;d.transform&&(m.transform=d.transform,delete d.transform),(m.transform||d.transformOrigin)&&(m.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),m.transform&&(m.transformBox=c?.transformBox??"fill-box",delete d.transformBox);for(const h of GO)d[h]!==void 0&&(m[h]=d[h],delete d[h]);t!==void 0&&(d.x=t),r!==void 0&&(d.y=r),i!==void 0&&(d.scale=i),n!==void 0&&JO(d,n,o,a,!1)}var k0=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),I0=e=>typeof e=="string"&&e.toLowerCase()==="svg";function KO(e,t,r,i){x0(e,t,void 0,i);for(const n in t.attrs)e.setAttribute(k0.has(n)?n:hc(n),t.attrs[n])}function j0(e,t,r){const i=xc(e,t,r);for(const n in e)if(Ne(e[n])||Ne(t[n])){const o=Zn.indexOf(n)!==-1?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n;i[o]=e[n]}return i}var XO=class extends g0{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Pe}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Bn.has(t)){const r=s0(t);return r&&r.default||0}return t=k0.has(t)?t:hc(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,r){return j0(e,t,r)}build(e,t,r){w0(e,t,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,t,r,i){KO(e,t,r,i)}mount(e){this.isSVGTag=I0(e.tagName),super.mount(e)}},qO=_c.length;function T0(e){if(!e)return;if(!e.isControllingVariants){const r=e.parent?T0(e.parent)||{}:{};return e.props.initial!==void 0&&(r.initial=e.props.initial),r}const t={};for(let r=0;rPromise.all(t.map(({animation:r,options:i})=>qP(e,r,i)))}function tD(e){let t=eD(e),r=Of(),i=!0,n=!1;const o=l=>(c,d)=>{const m=un(e,d,l==="exit"?e.presenceContext?.custom:void 0);if(m){const{transition:h,transitionEnd:v,...f}=m;c={...c,...f,...v}}return c};function a(l){t=l(e)}function s(l){const{props:c}=e,d=T0(e.parent)||{},m=[],h=new Set;let v={},f=1/0;for(let y=0;yf&&w,U=!1;const oe=Array.isArray(S)?S:[S];let B=oe.reduce(o(x),{});$===!1&&(B={});const{prevResolvedValues:q={}}=j,ae={...q,...B},G=re=>{L=!0,h.has(re)&&(U=!0,h.delete(re)),j.needsAnimating[re]=!0;const P=e.getValue(re);P&&(P.liveStyle=!1)};for(const re in ae){const P=B[re],ee=q[re];if(v.hasOwnProperty(re))continue;let N=!1;js(P)&&js(ee)?N=!P0(P,ee)||z:N=P!==ee,N?P!=null?G(re):h.add(re):P!==void 0&&h.has(re)?G(re):j.protectedKeys[re]=!0}j.prevProp=S,j.prevResolvedValues=B,j.isActive&&(v={...v,...B}),(i||n)&&e.blockInitialAnimation&&(L=!1);const Q=O&&z;L&&(!Q||U)&&m.push(...oe.map(re=>{const P={type:x};if(typeof re=="string"&&(i||n)&&!Q&&e.manuallyAnimateOnMount&&e.parent){const{parent:ee}=e,N=un(ee,re);if(ee.enteringChildren&&N){const{delayChildren:ce}=N.transition||{};P.delay=Y_(ee.enteringChildren,e,ce)}}return{animation:re,options:P}}))}if(h.size){const y={};if(typeof c.initial!="boolean"){const x=un(e,Array.isArray(c.initial)?c.initial[0]:c.initial);x&&x.transition&&(y.transition=x.transition)}h.forEach(x=>{const j=e.getBaseTarget(x),S=e.getValue(x);S&&(S.liveStyle=!0),y[x]=j??null}),m.push({animation:y})}let g=!!m.length;return i&&(c.initial===!1||c.initial===c.animate)&&!e.manuallyAnimateOnMount&&(g=!1),i=!1,n=!1,g?t(m):Promise.resolve()}function u(l,c){if(r[l].isActive===c)return Promise.resolve();e.variantChildren?.forEach(m=>m.animationState?.setActive(l,c)),r[l].isActive=c;const d=s(l);for(const m in r)r[m].protectedKeys={};return d}return{animateChanges:s,setActive:u,setAnimateFunction:a,getState:()=>r,reset:()=>{r=Of(),n=!0}}}function nD(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!P0(t,e):!1}function Xt(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Of(){return{animate:Xt(!0),whileInView:Xt(),whileHover:Xt(),whileTap:Xt(),whileDrag:Xt(),whileFocus:Xt(),exit:Xt()}}function Vs(e,t){e.min=t.min,e.max=t.max}function pt(e,t){Vs(e.x,t.x),Vs(e.y,t.y)}function Df(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var rD=.9999,iD=1.0001,oD=-.01,aD=.01;function Be(e){return e.max-e.min}function sD(e,t,r){return Math.abs(e-t)<=r}function zf(e,t,r,i=.5){e.origin=i,e.originPoint=ge(t.min,t.max,e.origin),e.scale=Be(r)/Be(t),e.translate=ge(r.min,r.max,e.origin)-e.originPoint,(e.scale>=rD&&e.scale<=iD||isNaN(e.scale))&&(e.scale=1),(e.translate>=oD&&e.translate<=aD||isNaN(e.translate))&&(e.translate=0)}function sr(e,t,r,i){zf(e.x,t.x,r.x,i?i.originX:void 0),zf(e.y,t.y,r.y,i?i.originY:void 0)}function Ef(e,t,r,i=0){e.min=(i?ge(r.min,r.max,i):r.min)+t.min,e.max=e.min+Be(t)}function uD(e,t,r,i){Ef(e.x,t.x,r.x,i?.x),Ef(e.y,t.y,r.y,i?.y)}function Cf(e,t,r,i=0){const n=i?ge(r.min,r.max,i):r.min;e.min=t.min-n,e.max=e.min+Be(t)}function ro(e,t,r,i){Cf(e.x,t.x,r.x,i?.x),Cf(e.y,t.y,r.y,i?.y)}function Af(e,t,r,i,n){return e-=t,e=no(e,1/r,i),n!==void 0&&(e=no(e,1/n,i)),e}function lD(e,t=0,r=1,i=.5,n,o=e,a=e){if(Pt.test(t)&&(t=parseFloat(t),t=ge(a.min,a.max,t/100)-a.min),typeof t!="number")return;let s=ge(o.min,o.max,i);e===o&&(s-=t),e.min=Af(e.min,t,r,s,n),e.max=Af(e.max,t,r,s,n)}function Nf(e,t,[r,i,n],o,a){lD(e,t[r],t[i],t[n],t.scale,o,a)}var cD=["x","scaleX","originX"],dD=["y","scaleY","originY"];function Vf(e,t,r,i){Nf(e.x,t,cD,r?r.x:void 0,i?i.x:void 0),Nf(e.y,t,dD,r?r.y:void 0,i?i.y:void 0)}function Uf(e){return e.translate===0&&e.scale===1}function O0(e){return Uf(e.x)&&Uf(e.y)}function Mf(e,t){return e.min===t.min&&e.max===t.max}function fD(e,t){return Mf(e.x,t.x)&&Mf(e.y,t.y)}function Rf(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function D0(e,t){return Rf(e.x,t.x)&&Rf(e.y,t.y)}function Ff(e){return Be(e.x)/Be(e.y)}function Lf(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function _t(e){return[e("x"),e("y")]}function mD(e,t,r){let i="";const n=e.x.translate/t.x,o=e.y.translate/t.y,a=r?.z||0;if((n||o||a)&&(i=`translate3d(${n}px, ${o}px, ${a}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),r){const{transformPerspective:l,rotate:c,pathRotation:d,rotateX:m,rotateY:h,skewX:v,skewY:f}=r;l&&(i=`perspective(${l}px) ${i}`),c&&(i+=`rotate(${c}deg) `),d&&(i+=`rotate(${d}deg) `),m&&(i+=`rotateX(${m}deg) `),h&&(i+=`rotateY(${h}deg) `),v&&(i+=`skewX(${v}deg) `),f&&(i+=`skewY(${f}deg) `)}const s=e.x.scale*t.x,u=e.y.scale*t.y;return(s!==1||u!==1)&&(i+=`scale(${s}, ${u})`),i||"none"}var z0=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],pD=z0.length,Zf=e=>typeof e=="string"?parseFloat(e):e,Bf=e=>typeof e=="number"||W.test(e);function hD(e,t,r,i,n,o){n?(e.opacity=ge(0,r.opacity??1,vD(i)),e.opacityExit=ge(t.opacity??1,0,gD(i))):o&&(e.opacity=ge(t.opacity??1,r.opacity??1,i));for(let a=0;ait?1:r(br(e,t,i))}function bD(e,t,r){const i=Ne(e)?e:Un(e);return i.start(mc("",i,t,r)),i.animation}function $r(e,t,r,i={passive:!0}){return e.addEventListener(t,r,i),()=>e.removeEventListener(t,r)}var yD=(e,t)=>e.depth-t.depth,_D=class{constructor(){this.children=[],this.isDirty=!1}add(e){tc(this.children,e),this.isDirty=!0}remove(e){Xi(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(yD),this.isDirty=!1,this.children.forEach(e)}};function $D(e,t){const r=Ze.now(),i=({timestamp:n})=>{const o=n-r;o>=t&&(Wt(i),e(o-t))};return be.setup(i,!0),()=>Wt(i)}function Ti(e){return Ne(e)?e.get():e}var xD=class{constructor(){this.members=[]}add(e){tc(this.members,e);for(let t=this.members.length-1;t>=0;t--){const r=this.members[t];if(r===e||r===this.lead||r===this.prevLead)continue;const i=r.instance;(!i||i.isConnected===!1)&&!r.snapshot&&(Xi(this.members,r),r.unmount())}e.scheduleRender()}remove(e){if(Xi(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){const r=this.members[t];if(r.isPresent!==!1&&r.instance?.isConnected!==!1)return this.promote(r),!0}return!1}promote(e,t){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.updateSnapshot(),e.scheduleRender();const{layoutDependency:i}=r.options,{layoutDependency:n}=e.options;(i===void 0||i!==n)&&(e.resumeFrom=r,t&&(r.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},Pi={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Qt={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},Ra=["","X","Y","Z"],SD=1e3,wD=0;function Fa(e,t,r,i){const{latestValues:n}=t;n[e]&&(r[e]=n[e],t.setStaticValue(e,0),i&&(i[e]=0))}function C0(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=r0(t);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:n,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(r,"transform",be,!(n||o))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&C0(i)}function A0({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:i,resetTransform:n}){return class{constructor(a={},s=t?.()){this.id=wD++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,It.value&&(Qt.nodes=Qt.calculatedTargetDeltas=Qt.calculatedProjections=0),this.nodes.forEach(jD),this.nodes.forEach(ED),this.nodes.forEach(CD),this.nodes.forEach(TD),It.addProjectionMetrics&&It.addProjectionMetrics(Qt)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let u=0;uthis.root.updateBlockedByResize=!1;be.read(()=>{d=window.innerWidth}),e(a,()=>{const h=window.innerWidth;h!==d&&(d=h,this.root.updateBlockedByResize=!0,c&&c(),c=$D(m,250),Pi.hasAnimatedSinceResize&&(Pi.hasAnimatedSinceResize=!1,this.nodes.forEach(Gf)))})}s&&this.root.registerSharedNode(s,this),this.options.animate!==!1&&l&&(s||u)&&this.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d,hasRelativeLayoutChanged:m,layout:h})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const v=this.options.transition||l.getDefaultTransition()||MD,{onLayoutAnimationStart:f,onLayoutAnimationComplete:g}=l.getProps(),y=!this.targetLayout||!D0(this.targetLayout,h),x=!d&&m;if(this.options.layoutRoot||this.resumeFrom||x||d&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const j={...fc(v,"layout"),onPlay:f,onComplete:g};(l.shouldReduceMotion||this.options.layoutRoot)&&(j.delay=0,j.type=!1),this.startAnimation(j),this.setAnimationOrigin(c,x,j.path)}else d||Gf(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=h})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Wt(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(AD),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&C0(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;c{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Be(this.snapshot.measuredBox.x)&&!Be(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u{const w=S/1e3,$=j?.(w);$?(m.x.translate=$.x,m.x.scale=ge(a.x.scale,1,w),m.x.origin=a.x.origin,m.x.originPoint=a.x.originPoint,m.y.translate=$.y,m.y.scale=ge(a.y.scale,1,w),m.y.origin=a.y.origin,m.y.originPoint=a.y.originPoint):(Kf(m.x,a.x,w),Kf(m.y,a.y,w)),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ro(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),VD(this.relativeTarget,this.relativeTargetOrigin,h,w),x&&fD(this.relativeTarget,x)&&(this.isProjectionDirty=!1),x||(x=Pe()),pt(x,this.relativeTarget)),v&&(this.animationValues=d,hD(d,c,this.latestValues,w,y,g)),$&&$.rotate!==void 0&&(this.animationValues||(this.animationValues=d),this.animationValues.pathRotation=$.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=w},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Wt(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=be.update(()=>{Pi.hasAnimatedSinceResize=!0,an.layout++,this.motionValue||(this.motionValue=Un(0)),this.motionValue.jump(0,!1),this.currentAnimation=bD(this.motionValue,[0,1e3],{...a,velocity:0,isSync:!0,onUpdate:s=>{this.mixTargetDelta(s),a.onUpdate&&a.onUpdate(s)},onStop:()=>{an.layout--},onComplete:()=>{an.layout--,a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(SD),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:s,target:u,layout:l,latestValues:c}=a;if(!(!s||!u||!l)){if(this!==a&&this.layout&&l&&N0(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||Pe();const d=Be(this.layout.layoutBox.x);u.x.min=a.target.x.min,u.x.max=u.x.min+d;const m=Be(this.layout.layoutBox.y);u.y.min=a.target.y.min,u.y.max=u.y.min+m}pt(s,u),ji(s,c),sr(this.projectionDeltaWithTransform,this.layoutCorrected,s,c)}}registerSharedNode(a,s){this.sharedNodes.has(a)||this.sharedNodes.set(a,new xD),this.sharedNodes.get(a).add(s);const u=s.options.initialPromotionConfig;s.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(s):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){const{layoutId:a}=this.options;return a?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:a}=this.options;return a?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:s,preserveFollowOpacity:u}={}){const l=this.getStack();l&&l.promote(this,u),a&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let s=!1;const{latestValues:u}=a;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(s=!0),!s)return;const l={};u.z&&Fa("z",a,l,this.animationValues);for(let c=0;ca.currentAnimation?.stop()),this.root.nodes.forEach(Hf),this.root.sharedNodes.clear()}}}function kD(e){e.updateLayout()}function ID(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:n}=e.options,o=t.source!==e.layout.source;if(n==="size")_t(c=>{const d=o?t.measuredBox[c]:t.layoutBox[c],m=Be(d);d.min=r[c].min,d.max=d.min+m});else if(n==="x"||n==="y"){const c=n==="x"?"y":"x";Vs(o?t.measuredBox[c]:t.layoutBox[c],r[c])}else N0(n,t.layoutBox,r)&&_t(c=>{const d=o?t.measuredBox[c]:t.layoutBox[c],m=Be(r[c]);d.max=d.min+m,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[c].max=e.relativeTarget[c].min+m)});const a=Sn();sr(a,r,t.layoutBox);const s=Sn();o?sr(s,e.applyTransform(i,!0),t.measuredBox):sr(s,r,t.layoutBox);const u=!O0(a);let l=!1;if(!e.resumeFrom){const c=e.getClosestProjectingParent();if(c&&!c.resumeFrom){const{snapshot:d,layout:m}=c;if(d&&m){const h=e.options.layoutAnchor||void 0,v=Pe();ro(v,t.layoutBox,d.layoutBox,h);const f=Pe();ro(f,r,m.layoutBox,h),D0(v,f)||(l=!0),c.options.layoutRoot&&(e.relativeTarget=f,e.relativeTargetOrigin=v,e.relativeParent=c)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:s,layoutDelta:a,hasLayoutChanged:u,hasRelativeLayoutChanged:l})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function jD(e){It.value&&Qt.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function TD(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function PD(e){e.clearSnapshot()}function Hf(e){e.clearMeasurements()}function OD(e){e.isLayoutDirty=!0,e.updateLayout()}function Jf(e){e.isLayoutDirty=!1}function DD(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function zD(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Gf(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function ED(e){e.resolveTargetDelta()}function CD(e){e.calcProjection()}function AD(e){e.resetSkewAndRotation()}function ND(e){e.removeLeadSnapshot()}function Kf(e,t,r){e.translate=ge(t.translate,0,r),e.scale=ge(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function Xf(e,t,r,i){e.min=ge(t.min,r.min,i),e.max=ge(t.max,r.max,i)}function VD(e,t,r,i){Xf(e.x,t.x,r.x,i),Xf(e.y,t.y,r.y,i)}function UD(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var MD={duration:.45,ease:[.4,0,.1,1]},qf=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Yf=qf("applewebkit/")&&!qf("chrome/")?Math.round:lt;function Qf(e){e.min=Yf(e.min),e.max=Yf(e.max)}function RD(e){Qf(e.x),Qf(e.y)}function N0(e,t,r){return e==="position"||e==="preserve-aspect"&&!sD(Ff(t),Ff(r),.2)}function FD(e){return e!==e.root&&e.scroll?.wasRoot}var LD=A0({attachResizeListener:(e,t)=>$r(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),La={current:void 0},V0=A0({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!La.current){const e=new LD({});e.mount(window),e.setOptions({layoutScroll:!0}),La.current=e}return La.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Sc=(0,_.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function em(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ZD(...e){return t=>{let r=!1;const i=e.map(n=>{const o=em(n,t);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let n=0;n{const{width:d,height:m,top:h,left:v,right:f,bottom:g,direction:y}=u.current;if(t||o===!1||!s.current||!d||!m)return;const x=y==="rtl",j=r==="left"?x?`right: ${f}`:`left: ${v}`:x?`left: ${v}`:`right: ${f}`,S=i==="bottom"?`bottom: ${g}`:`top: ${h}`;s.current.dataset.motionPopId=a;const w=document.createElement("style");l&&(w.nonce=l);const $=n??document.head;return $.appendChild(w),w.sheet&&w.sheet.insertRule(` - [data-motion-pop-id="${a}"] { - position: absolute !important; - width: ${d}px !important; - height: ${m}px !important; - ${j}px !important; - ${S}px !important; - } - `),()=>{s.current?.removeAttribute("data-motion-pop-id"),$.contains(w)&&$.removeChild(w)}},[t]),(0,p.jsx)(WD,{isPresent:t,childRef:s,sizeRef:u,pop:o,children:o===!1?e:_.cloneElement(e,{ref:c})})}var JD=({children:e,initial:t,isPresent:r,onExitComplete:i,custom:n,presenceAffectsLayout:o,mode:a,anchorX:s,anchorY:u,root:l})=>{const c=ec(GD),d=(0,_.useId)();let m=!0,h=(0,_.useMemo)(()=>(m=!1,{id:d,initial:t,isPresent:r,custom:n,onExitComplete:v=>{c.set(v,!0);for(const f of c.values())if(!f)return;i&&i()},register:v=>(c.set(v,!1),()=>c.delete(v))}),[r,c,i]);return o&&m&&(h={...h}),(0,_.useMemo)(()=>{c.forEach((v,f)=>c.set(f,!1))},[r]),_.useEffect(()=>{!r&&!c.size&&i&&i()},[r]),e=(0,p.jsx)(HD,{pop:a==="popLayout",isPresent:r,anchorX:s,anchorY:u,root:l,children:e}),(0,p.jsx)(ia.Provider,{value:h,children:e})};function GD(){return new Map}function U0(e=!0){const t=(0,_.useContext)(ia);if(t===null)return[!0,null];const{isPresent:r,onExitComplete:i,register:n}=t,o=(0,_.useId)();(0,_.useEffect)(()=>{if(e)return n(o)},[e]);const a=(0,_.useCallback)(()=>e&&i&&i(o),[o,i,e]);return!r&&i?[!1,a]:[!0]}var pi=e=>e.key||"";function tm(e){const t=[];return _.Children.forEach(e,r=>{(0,_.isValidElement)(r)&&t.push(r)}),t}var KD=({children:e,custom:t,initial:r=!0,onExitComplete:i,presenceAffectsLayout:n=!0,mode:o="sync",propagate:a=!1,anchorX:s="left",anchorY:u="top",root:l})=>{const[c,d]=U0(a),m=(0,_.useMemo)(()=>tm(e),[e]),h=a&&!c?[]:m.map(pi),v=(0,_.useRef)(!0),f=(0,_.useRef)(m),g=ec(()=>new Map),y=(0,_.useRef)(new Set),[x,j]=(0,_.useState)(m),[S,w]=(0,_.useState)(m);m_(()=>{v.current=!1,f.current=m;for(let z=0;z{const L=pi(z),U=a&&!c?!1:m===S||h.includes(L),oe=()=>{if(y.current.has(L))return;if(g.has(L))y.current.add(L),g.set(L,!0);else return;let B=!0;g.forEach(q=>{q||(B=!1)}),B&&(O?.(),w(f.current),a&&d?.(),i&&i())};return(0,p.jsx)(JD,{isPresent:U,initial:!v.current||r?void 0:!1,custom:t,presenceAffectsLayout:n,mode:o,root:l,onExitComplete:U?void 0:oe,anchorX:s,anchorY:u,children:z},L)})})},M0=(0,_.createContext)({strict:!1}),nm={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},rm=!1;function XD(){if(rm)return;const e={};for(const t in nm)e[t]={isEnabled:r=>nm[t].some(i=>!!r[i])};v0(e),rm=!0}function R0(){return XD(),EO()}function qD(e){const t=R0();for(const r in e)t[r]={...t[r],...e[r]};v0(t)}var YD=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function io(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||YD.has(e)}var QD=ct({default:()=>F0}),F0,ez=i$((()=>{throw F0={},new Error('Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?')})),L0=e=>!io(e);function tz(e){typeof e=="function"&&(L0=t=>t.startsWith("on")?!io(t):e(t))}try{tz((ez(),s$(QD)).default)}catch{}function nz(e,t,r){const i={};for(const n in e)n==="values"&&typeof e.values=="object"||Ne(e[n])||(L0(n)||r===!0&&io(n)||!t&&!io(n)||e.draggable&&n.startsWith("onDrag"))&&(i[n]=e[n]);return i}var la=(0,_.createContext)({});function rz(e,t){if(ua(e)){const{initial:r,animate:i}=e;return{initial:r===!1||_r(r)?r:void 0,animate:_r(i)?i:void 0}}return e.inherit!==!1?t:{}}function iz(e){const{initial:t,animate:r}=rz(e,(0,_.useContext)(la));return(0,_.useMemo)(()=>({initial:t,animate:r}),[im(t),im(r)])}function im(e){return Array.isArray(e)?e.join(" "):e}var wc=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Z0(e,t,r){for(const i in t)!Ne(t[i])&&!S0(i,r)&&(e[i]=t[i])}function oz({transformTemplate:e},t){return(0,_.useMemo)(()=>{const r=wc();return $c(r,t,e),Object.assign({},r.vars,r.style)},[t])}function az(e,t){const r=e.style||{},i={};return Z0(i,r,e),Object.assign(i,oz(e,t)),i}function sz(e,t){const r={},i=az(e,t);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=i,r}var B0=()=>({...wc(),attrs:{}});function uz(e,t,r,i){const n=(0,_.useMemo)(()=>{const o=B0();return w0(o,t,I0(i),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};Z0(o,e.style,e),n.style={...o,...n.style}}return n}var lz=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function kc(e){return typeof e!="string"||e.includes("-")?!1:!!(lz.indexOf(e)>-1||/[A-Z]/u.test(e))}function cz(e,t,r,{latestValues:i},n,o=!1,a){const s=(a??kc(e)?uz:sz)(t,i,n,e),u=nz(t,typeof e=="string",o),l=e!==_.Fragment?{...u,...s,ref:r}:{},{children:c}=t,d=(0,_.useMemo)(()=>Ne(c)?c.get():c,[c]);return(0,_.createElement)(e,{...l,children:d})}function dz({scrapeMotionValuesFromProps:e,createRenderState:t},r,i,n){return{latestValues:fz(r,i,n,e),renderState:t()}}function fz(e,t,r,i){const n={},o=i(e,{});for(const m in o)n[m]=Ti(o[m]);let{initial:a,animate:s}=e;const u=ua(e),l=p0(e);t&&l&&!u&&e.inherit!==!1&&(a===void 0&&(a=t.initial),s===void 0&&(s=t.animate));let c=r?r.initial===!1:!1;c=c||a===!1;const d=c?s:a;if(d&&typeof d!="boolean"&&!sa(d)){const m=Array.isArray(d)?d:[d];for(let h=0;h(t,r)=>{const i=(0,_.useContext)(la),n=(0,_.useContext)(ia),o=()=>dz(e,t,i,n);return r?o():ec(o)},mz=W0({scrapeMotionValuesFromProps:xc,createRenderState:wc}),pz=W0({scrapeMotionValuesFromProps:j0,createRenderState:B0}),hz=Symbol.for("motionComponentSymbol");function vz(e,t,r){const i=(0,_.useRef)(r);(0,_.useInsertionEffect)(()=>{i.current=r});const n=(0,_.useRef)(null);return(0,_.useCallback)(o=>{o&&e.onMount?.(o),t&&(o?t.mount(o):t.unmount());const a=i.current;if(typeof a=="function")if(o){const s=a(o);typeof s=="function"&&(n.current=s)}else n.current?(n.current(),n.current=null):a(o);else a&&(a.current=o)},[t])}var H0=(0,_.createContext)({});function yn(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function gz(e,t,r,i,n,o){const{visualElement:a}=(0,_.useContext)(la),s=(0,_.useContext)(M0),u=(0,_.useContext)(ia),l=(0,_.useContext)(Sc),c=l.reducedMotion,d=l.skipAnimations,m=(0,_.useRef)(null),h=(0,_.useRef)(!1);i=i||s.renderer,!m.current&&i&&(m.current=i(e,{visualState:t,parent:a,props:r,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:c,skipAnimations:d,isSVG:o}),h.current&&m.current&&(m.current.manuallyAnimateOnMount=!0));const v=m.current,f=(0,_.useContext)(H0);v&&!v.projection&&n&&(v.type==="html"||v.type==="svg")&&bz(m.current,r,n,f);const g=(0,_.useRef)(!1);(0,_.useInsertionEffect)(()=>{v&&g.current&&v.update(r,u)});const y=r[n0],x=(0,_.useRef)(!!y&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(y)&&window.MotionHasOptimisedAnimation?.(y));return m_(()=>{h.current=!0,v&&(g.current=!0,window.MotionIsMounted=!0,v.updateFeatures(),v.scheduleRenderMicrotask(),x.current&&v.animationState&&v.animationState.animateChanges())}),(0,_.useEffect)(()=>{v&&(!x.current&&v.animationState&&v.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(y)}),x.current=!1),v.enteringChildren=void 0)}),v}function bz(e,t,r,i){const{layoutId:n,layout:o,drag:a,dragConstraints:s,layoutScroll:u,layoutRoot:l,layoutAnchor:c,layoutCrossfade:d}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:J0(e.parent)),e.projection.setOptions({layoutId:n,layout:o,alwaysMeasureLayout:!!a||s&&yn(s),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:i,crossfade:d,layoutScroll:u,layoutRoot:l,layoutAnchor:c})}function J0(e){if(e)return e.options.allowProjection!==!1?e.projection:J0(e.parent)}function Za(e,{forwardMotionProps:t=!1,type:r}={},i,n){i&&qD(i);const o=r?r==="svg":kc(e),a=o?pz:mz;function s(l,c){let d;const m={...(0,_.useContext)(Sc),...l,layoutId:yz(l)},{isStatic:h}=m,v=iz(l),f=a(l,h);if(!h&&typeof window<"u"){_z(m,i);const g=$z(m);d=g.MeasureLayout,v.visualElement=gz(e,f,m,n,g.ProjectionNode,o)}return(0,p.jsxs)(la.Provider,{value:v,children:[d&&v.visualElement?(0,p.jsx)(d,{visualElement:v.visualElement,...m}):null,cz(e,l,vz(f,v.visualElement,c),f,h,t,o)]})}s.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const u=(0,_.forwardRef)(s);return u[hz]=e,u}function yz({layoutId:e}){const t=(0,_.useContext)(Ql).id;return t&&e!==void 0?t+"-"+e:e}function _z(e,t){(0,_.useContext)(M0).strict}function $z(e){const{drag:t,layout:r}=R0();if(!t&&!r)return{};const i={...t,...r};return{MeasureLayout:t?.isEnabled(e)||r?.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function xz(e,t){if(typeof Proxy>"u")return Za;const r=new Map,i=(o,a)=>Za(o,a,e,t),n=(o,a)=>i(o,a);return new Proxy(n,{get:(o,a)=>a==="create"?i:(r.has(a)||r.set(a,Za(a,void 0,e,t)),r.get(a))})}var Sz=(e,t)=>t.isSVG??kc(e)?new XO(t):new BO(t,{allowProjection:e!==_.Fragment}),wz=class extends Jt{constructor(e){super(e),e.animationState||(e.animationState=tD(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();sa(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},kz=0,Iz=class extends Jt{constructor(){super(...arguments),this.id=kz++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;if(e&&r===!1){if(this.isExitComplete){const{initial:n,custom:o}=this.node.getProps();if(typeof n=="string"||typeof n=="object"&&n!==null&&!Array.isArray(n)){const a=un(this.node,n,o);if(a){const{transition:s,transitionEnd:u,...l}=a;for(const c in l)this.node.getValue(c)?.jump(l[c])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const i=this.node.animationState.setActive("exit",!e);t&&!e&&i.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}},jz={animation:{Feature:wz},exit:{Feature:Iz}};function ti(e){return{point:{x:e.pageX,y:e.pageY}}}var Tz=e=>t=>gc(t)&&e(t,ti(t));function ur(e,t,r,i){return $r(e,t,Tz(r),i)}var G0=({current:e})=>e?e.ownerDocument.defaultView:null,om=(e,t)=>Math.abs(e-t);function Pz(e,t){const r=om(e.x,t.x),i=om(e.y,t.y);return Math.sqrt(r**2+i**2)}var am=new Set(["auto","scroll"]),K0=class{constructor(e,t,{transformPagePoint:r,contextWindow:i=window,dragSnapToOrigin:n=!1,distanceThreshold:o=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=d=>{this.handleScroll(d.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=hi(this.lastRawMoveEventInfo,this.transformPagePoint));const d=Ba(this.lastMoveEventInfo,this.history),m=this.startEvent!==null,h=Pz(d.offset,{x:0,y:0})>=this.distanceThreshold;if(!m&&!h)return;const{point:v}=d,{timestamp:f}=Ee;this.history.push({...v,timestamp:f});const{onStart:g,onMove:y}=this.handlers;m||(g&&g(this.lastMoveEvent,d),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,d)},this.handlePointerMove=(d,m)=>{this.lastMoveEvent=d,this.lastRawMoveEventInfo=m,this.lastMoveEventInfo=hi(m,this.transformPagePoint),be.update(this.updatePoint,!0)},this.handlePointerUp=(d,m)=>{this.end();const{onEnd:h,onSessionEnd:v,resumeAnimation:f}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&f&&f(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=Ba(d.type==="pointercancel"?this.lastMoveEventInfo:hi(m,this.transformPagePoint),this.history);this.startEvent&&h&&h(d,g),v&&v(d,g)},!gc(e))return;this.dragSnapToOrigin=n,this.handlers=t,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=i||window;const s=hi(ti(e),this.transformPagePoint),{point:u}=s,{timestamp:l}=Ee;this.history=[{...u,timestamp:l}];const{onSessionStart:c}=t;c&&c(e,Ba(s,this.history)),this.removeListeners=Yr(ur(this.contextWindow,"pointermove",this.handlePointerMove),ur(this.contextWindow,"pointerup",this.handlePointerUp),ur(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(e){let t=e.parentElement;for(;t;){const r=getComputedStyle(t);(am.has(r.overflowX)||am.has(r.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const r=e===window,i=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},n={x:i.x-t.x,y:i.y-t.y};n.x===0&&n.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=n.x,this.lastMoveEventInfo.point.y+=n.y):this.history.length>0&&(this.history[0].x-=n.x,this.history[0].y-=n.y),this.scrollPositions.set(e,i),be.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Wt(this.updatePoint)}};function hi(e,t){return t?{point:t(e.point)}:e}function sm(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ba({point:e},t){return{point:e,delta:sm(e,X0(t)),offset:sm(e,Oz(t)),velocity:Dz(t,.1)}}function Oz(e){return e[0]}function X0(e){return e[e.length-1]}function Dz(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,i=null;const n=X0(e);for(;r>=0&&(i=e[r],!(n.timestamp-i.timestamp>Je(t)));)r--;if(!i)return{x:0,y:0};i===e[0]&&e.length>2&&n.timestamp-i.timestamp>Je(t)*2&&(i=e[1]);const o=st(n.timestamp-i.timestamp);if(o===0)return{x:0,y:0};const a={x:(n.x-i.x)/o,y:(n.y-i.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function zz(e,{min:t,max:r},i){return t!==void 0&&er&&(e=i?ge(r,e,i.max):Math.min(e,r)),e}function um(e,t,r){return{min:t!==void 0?e.min+t:void 0,max:r!==void 0?e.max+r-(e.max-e.min):void 0}}function Ez(e,{top:t,left:r,bottom:i,right:n}){return{x:um(e.x,r,n),y:um(e.y,t,i)}}function lm(e,t){let r=t.min-e.min,i=t.max-e.max;return t.max-t.mini?r=br(t.min,t.max-i,e.min):i>n&&(r=br(e.min,e.max-n,t.min)),Ot(0,1,r)}function Nz(e,t){const r={};return t.min!==void 0&&(r.min=t.min-e.min),t.max!==void 0&&(r.max=t.max-e.min),r}var Us=.35;function Vz(e=Us){return e===!1?e=0:e===!0&&(e=Us),{x:cm(e,"left","right"),y:cm(e,"top","bottom")}}function cm(e,t,r){return{min:dm(e,t),max:dm(e,r)}}function dm(e,t){return typeof e=="number"?e:e[t]||0}var Uz=new WeakMap,Mz=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Pe(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:r}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const n=c=>{t&&this.snapToCursor(ti(c).point),this.stopAnimation()},o=(c,d)=>{const{drag:m,dragPropagation:h,onDragStart:v}=this.getProps();if(m&&!h&&(this.openDragLock&&this.openDragLock(),this.openDragLock=lO(m),!this.openDragLock))return;this.latestPointerEvent=c,this.latestPanInfo=d,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),_t(g=>{let y=this.getAxisMotionValue(g).get()||0;if(Pt.test(y)){const{projection:x}=this.visualElement;if(x&&x.layout){const j=x.layout.layoutBox[g];j&&(y=Be(j)*(parseFloat(y)/100))}}this.originPoint[g]=y}),v&&be.update(()=>v(c,d),!1,!0),Ts(this.visualElement,"transform");const{animationState:f}=this.visualElement;f&&f.setActive("whileDrag",!0)},a=(c,d)=>{this.latestPointerEvent=c,this.latestPanInfo=d;const{dragPropagation:m,dragDirectionLock:h,onDirectionLock:v,onDrag:f}=this.getProps();if(!m&&!this.openDragLock)return;const{offset:g}=d;if(h&&this.currentDirection===null){this.currentDirection=Fz(g),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",d.point,g),this.updateAxis("y",d.point,g),this.visualElement.render(),f&&be.update(()=>f(c,d),!1,!0)},s=(c,d)=>{this.latestPointerEvent=c,this.latestPanInfo=d,this.stop(c,d),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{const{dragSnapToOrigin:c}=this.getProps();(c||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new K0(e,{onSessionStart:n,onStart:o,onMove:a,onSessionEnd:s,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:r,contextWindow:G0(this.visualElement),element:this.visualElement.current})}stop(e,t){const r=e||this.latestPointerEvent,i=t||this.latestPanInfo,n=this.isDragging;if(this.cancel(),!n||!i||!r)return;const{velocity:o}=i;this.startAnimation(o);const{onDragEnd:a}=this.getProps();a&&be.postRender(()=>a(r,i))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,r){const{drag:i}=this.getProps();if(!r||!vi(e,i,this.currentDirection))return;const n=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=zz(o,this.constraints[e],this.elastic[e])),n.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:t}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;e&&yn(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=Ez(r.layoutBox,e):this.constraints=!1,this.elastic=Vz(t),i!==this.constraints&&!yn(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&_t(n=>{this.constraints!==!1&&this.getAxisMotionValue(n)&&(this.constraints[n]=Nz(r.layoutBox[n],this.constraints[n]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!yn(e))return!1;const r=e.current;Nn(r!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;i.root&&(i.root.scroll=void 0,i.root.updateScroll());const n=UO(r,i.root,this.visualElement.getTransformPagePoint());let o=Cz(i.layout.layoutBox,n);if(t){const a=t(AO(o));this.hasMutatedConstraints=!!a,a&&(o=b0(a))}return o}startAnimation(e){const{drag:t,dragMomentum:r,dragElastic:i,dragTransition:n,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),s=this.constraints||{},u=_t(l=>{if(!vi(l,t,this.currentDirection))return;let c=s&&s[l]||{};(o===!0||o===l)&&(c={min:0,max:0});const d=i?200:1e6,m=i?40:1e7,h={type:"inertia",velocity:r?e[l]:0,bounceStiffness:d,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...n,...c};return this.startAxisValueAnimation(l,h)});return Promise.all(u).then(a)}startAxisValueAnimation(e,t){const r=this.getAxisMotionValue(e);return Ts(this.visualElement,e),r.start(mc(e,r,0,t,this.visualElement,!1))}stopAnimation(){_t(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps()[t];return r||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){_t(t=>{const{drag:r}=this.getProps();if(!vi(t,r,this.currentDirection))return;const{projection:i}=this.visualElement,n=this.getAxisMotionValue(t);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[t],s=n.get()||0;n.set(e[t]-ge(o,a,.5)+s)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!yn(t)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};_t(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const s=a.get();i[o]=Az({min:s,max:s},this.constraints[o])}});const{transformTemplate:n}=this.visualElement.getProps();this.visualElement.current.style.transform=n?n({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),_t(o=>{if(!vi(o,e,null))return;const a=this.getAxisMotionValue(o),{min:s,max:u}=this.constraints[o];a.set(ge(s,u,i[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Uz.set(this.visualElement,this);const e=this.visualElement.current,t=ur(e,"pointerdown",u=>{const{drag:l,dragListener:c=!0}=this.getProps(),d=u.target,m=d!==e&&hO(d);l&&c&&!m&&this.start(u)});let r;const i=()=>{const{dragConstraints:u}=this.getProps();yn(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),r||(r=Rz(e,u.current,()=>this.scalePositionWithinConstraints())))},{projection:n}=this.visualElement,o=n.addEventListener("measure",i);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),be.read(i);const a=$r(window,"resize",()=>this.scalePositionWithinConstraints()),s=n.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(_t(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=u[c].translate,d.set(d.get()+u[c].translate))}),this.visualElement.render())}));return()=>{a(),t(),o(),s&&s(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:n=!1,dragElastic:o=Us,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:i,dragConstraints:n,dragElastic:o,dragMomentum:a}}};function fm(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function Rz(e,t,r){const i=yf(e,fm(r)),n=yf(t,fm(r));return()=>{i(),n()}}function vi(e,t,r){return(t===!0||t===e)&&(r===null||r===e)}function Fz(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}var Lz=class extends Jt{constructor(e){super(e),this.removeGroupControls=lt,this.removeListeners=lt,this.controls=new Mz(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||lt}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},Wa=e=>(t,r)=>{e&&be.update(()=>e(t,r),!1,!0)},Zz=class extends Jt{constructor(){super(...arguments),this.removePointerDownListener=lt}onPointerDown(e){this.session=new K0(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:G0(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:Wa(e),onStart:Wa(t),onMove:Wa(r),onEnd:(n,o)=>{delete this.session,i&&be.postRender(()=>i(n,o))}}}mount(){this.removePointerDownListener=ur(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},Ha=!1,Bz=class extends _.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:i}=this.props,{projection:n}=e;n&&(t.group&&t.group.add(n),r&&r.register&&i&&r.register(n),Ha&&n.root.didUpdate(),n.addEventListener("animationComplete",()=>{this.safeToRemove()}),n.setOptions({...n.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Pi.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:r,drag:i,isPresent:n}=this.props,{projection:o}=r;return o&&(o.isPresent=n,e.layoutDependency!==t&&o.setOptions({...o.options,layoutDependency:t}),Ha=!0,i||e.layoutDependency!==t||t===void 0||e.isPresent!==n?o.willUpdate():this.safeToRemove(),e.isPresent!==n&&(n?o.promote():o.relegate()||be.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:t}=this.props,{projection:r}=e;r&&(r.options.layoutAnchor=t,r.root.didUpdate(),vc.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:i}=e;Ha=!0,i&&(i.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}};function q0(e){const[t,r]=U0(),i=(0,_.useContext)(Ql);return(0,p.jsx)(Bz,{...e,layoutGroup:i,switchLayoutGroup:(0,_.useContext)(H0),isPresent:t,safeToRemove:r})}var Wz={pan:{Feature:Zz},drag:{Feature:Lz,ProjectionNode:V0,MeasureLayout:q0}};function mm(e,t,r){const{props:i}=e;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover",r==="Start");const n=i["onHover"+r];n&&be.postRender(()=>n(t,ti(t)))}var Hz=class extends Jt{mount(){const{current:e}=this.node;e&&(this.unmount=dO(e,(t,r)=>(mm(this.node,r,"Start"),i=>mm(this.node,i,"End"))))}unmount(){}},Jz=class extends Jt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Yr($r(this.node.current,"focus",()=>this.onFocus()),$r(this.node.current,"blur",()=>this.onBlur()))}unmount(){}};function pm(e,t,r){const{props:i}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&i.whileTap&&e.animationState.setActive("whileTap",r==="Start");const n=i["onTap"+(r==="End"?"":r)];n&&be.postRender(()=>n(t,ti(t)))}var Gz=class extends Jt{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:r}=this.node.props;this.unmount=gO(e,(i,n)=>(pm(this.node,n,"Start"),(o,{success:a})=>pm(this.node,o,a?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:r?.tap===!1})}unmount(){}},Ms=new WeakMap,Ja=new WeakMap,Kz=e=>{const t=Ms.get(e.target);t&&t(e)},Xz=e=>{e.forEach(Kz)};function qz({root:e,...t}){const r=e||document;Ja.has(r)||Ja.set(r,{});const i=Ja.get(r),n=JSON.stringify(t);return i[n]||(i[n]=new IntersectionObserver(Xz,{root:e,...t})),i[n]}function Yz(e,t,r){const i=qz(t);return Ms.set(e,r),i.observe(e),()=>{Ms.delete(e),i.unobserve(e)}}var Qz={some:0,all:1},eE=class extends Jt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:t,margin:r,amount:i="some",once:n}=e,o={root:t?t.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:Qz[i]},a=s=>{const{isIntersecting:u}=s;if(this.isInView===u||(this.isInView=u,n&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:l,onViewportLeave:c}=this.node.getProps(),d=u?l:c;d&&d(s)};this.stopObserver=Yz(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(tE(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function tE({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}var nE={inView:{Feature:eE},tap:{Feature:Gz},focus:{Feature:Jz},hover:{Feature:Hz}},rE={layout:{ProjectionNode:V0,MeasureLayout:q0}},iE={...jz,...nE,...Wz,...rE},oE=xz(iE,Sz),hE=ct({default:()=>aE}),aE=({room_id:e,entities_page_id:t,room_view_position:r,type:i,id:n,onComplete:o,onClose:a,opened:s,setOpened:u})=>{const[l,c]=(0,_.useState)(1),[d,m]=(0,_.useState)({room_id:e,entities_page_id:t,room_view_position:r,controller:"",type:i,entity_type:"",friendly_name:"",id:null}),[h,v]=(0,_.useState)("");(0,_.useEffect)(()=>{le.getState().status=="none"&&le.getState().fetchEntities(),Oi.getState().status=="none"&&Oi.getState().fetchData()},[]);const f=()=>c(w=>w+1),g=(0,_.useRef)(null),y=(0,_.useRef)(null),x=(w,$)=>()=>{m({...d,[w]:$})};(0,_.useEffect)(()=>{if(n!=null){const $=We.getState().entities.find(O=>O.id==n);m({...d,...$}),c(3)}const w=We.getState().entities_pages.find($=>$.id==t);v(w?.type??"")},[n,We.getState().entities,We.getState().entities_pages]);const j=()=>{g.current?.close(),setTimeout(()=>{if(u(!1),a&&a(),n!=null){const w=We.getState().entities.find($=>$.id==n);m({...d,...w})}c(1)},220)},S=()=>{if(y.current){const w=window.getComputedStyle(y.current).maxHeight;let $=parseFloat(w);w.endsWith("%")&&($=Math.trunc(window.innerHeight*$/100),y.current.classList.toggle("overflow-y-auto",y.current.scrollHeight>$),y.current.classList.toggle("overflow-y-visible",y.current.scrollHeight<=$))}};return(0,_.useEffect)(()=>{const w=new ResizeObserver($=>{$.forEach(()=>{S()})});y.current&&w.observe(y.current)},[y]),(0,_.useEffect)(()=>{n==null&&l==1&&h=="scene"?(m({...d,entity_type:"scene"}),c(2)):n!=null&&h=="scene"&&(m({...d,entity_type:"scene"}),c(3))},[n,l,h]),(0,p.jsxs)("dialog",{ref:g,open:s??!1,onClose:j,className:"modal duration-200",children:[(0,p.jsxs)("div",{ref:y,className:"modal-box max-h-11/12 bg-base-100 text-base-content",children:[(0,p.jsx)("button",{className:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:()=>{u(!1),j()},children:"✕"}),(0,p.jsx)("div",{className:"flex justify-center mb-4 w-full",children:(0,p.jsxs)("ul",{className:"steps w-full",children:[n==null&&(0,p.jsx)("li",{className:`step ${l>=1?"step-primary cursor-pointer":""}`,onClick:()=>{c(1)},children:"Type"}),n==null&&(0,p.jsx)("li",{className:`step ${l>=2?"step-primary":""} ${d.entity_type==""?"cursor-not-allowed":"cursor-pointer"}`,onClick:()=>{d.entity_type!=""&&c(2)},children:"Controller"}),(0,p.jsxs)("li",{className:`step ${l>=3?"step-primary":""} ${d.entity_type==""?"cursor-not-allowed":"cursor-pointer"}`,onClick:()=>{d.entity_type!=""&&c(3)},children:["Configure ",d.entity_type]})]})}),(0,p.jsx)(KD,{mode:"wait",children:(0,p.jsx)(oE.div,{layout:!0,initial:{opacity:0,x:30},animate:{opacity:1,x:0},exit:{opacity:0,x:-30},transition:{duration:.1},children:(()=>{if(n==null&&l==1&&h=="entity")return(0,p.jsx)(m$,{handleButtonSelectEvent:x,next_step:f});if(n==null&&l==2)return(0,p.jsx)(h$,{handleButtonSelectEvent:x,entity_type:String(d.entity_type),next_step:f});if(d.entity_type!="")switch(d.entity_type){case"light":return(0,p.jsx)(Hj,{controller:String(d.controller),room_id:e,entities_page_id:t,room_view_position:r,id:n,onComplete:o});case"switch":return(0,p.jsx)(Kj,{controller:String(d.controller),room_id:e,id:n,entities_page_id:t,room_view_position:r,onComplete:o});case"button":return(0,p.jsx)(Qj,{controller:String(d.controller),room_id:e,id:n,entities_page_id:t,room_view_position:r,onComplete:o});case"thermostat":return(0,p.jsx)(tT,{controller:String(d.controller),room_id:e,id:n,entities_page_id:t,room_view_position:r,onComplete:o});case"scene":return(0,p.jsx)(iT,{controller:String(d.controller),room_id:e,id:n,entities_page_id:t,room_view_position:r,onComplete:o});default:return console.error("Unknown entity type while trying to edit entity. Type: ",d.entity_type),(0,p.jsxs)("span",{className:"text-lg text-error",children:["Unknown entity type: ",d.entity_type]})}})()},`step.${l}`)})]}),(0,p.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,p.jsx)("button",{onClick:()=>{u(!1),j()},children:"close"})})]})};export{Fs as i,aE as n,We as r,hE as t}; diff --git a/docker/web/nspanelmanager/web/react-components/dist/MultiStep_AddEditEntity-xcopfTe5.js b/docker/web/nspanelmanager/web/react-components/dist/MultiStep_AddEditEntity-xcopfTe5.js new file mode 100644 index 000000000..c49180932 --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/MultiStep_AddEditEntity-xcopfTe5.js @@ -0,0 +1,8755 @@ +import { c as __toESM, o as __exportAll, r as require_react, t as require_jsx_runtime } from "./main-FKp56mKw.js"; +import { t as create } from "./react-Cm4z11-B.js"; +import { t as useSettingsStore } from "./SettingsStore-msVzBcHM.js"; +import { t as StateManagedSelect$1 } from "./react-select.esm-CbdimKhg.js"; +import { a as set, i as get, o as useFieldArray, r as appendErrors, s as useForm } from "./index.esm-CnTf2rLv.js"; +import { n as Notify } from "./NSPanelToastContainer-D677tDZJ.js"; +import { t as motion } from "./proxy-BQYsYRjY.js"; +import { t as AnimatePresence } from "./AnimatePresence-CpnHckGS.js"; +//#region src/stores/EntitiesPagesStore.ts +function getCookie$1(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; +} +var useEntitiesPagesStore = create((set) => ({ + status: "loading", + room_id: null, + entities_pages: [], + entities: [], + scenes: [], + fetchData: async (room_id) => { + set({ + status: "loading", + room_id + }); + let url = `/rest/global/entities_pages`; + if (room_id !== void 0) url = `/rest/rooms/${room_id}/entities_pages`; + fetch(url, { + credentials: "same-origin", + method: "GET", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie$1("csrftoken") + } + }).then((response) => response.json()).then((data) => { + set((state) => ({ + ...state, + room_id, + entities_pages: data.entities_pages, + entities: [], + scenes: [] + })); + for (const page of data.entities_pages) set((state) => ({ + ...state, + entities: [...state.entities, ...page.entities], + scenes: [...state.scenes, ...page.scenes] + })); + set({ status: "loaded" }); + }); + }, + removeEntitiesPage: (id) => { + set((state) => ({ entities_pages: state.entities_pages.filter((page) => page.id !== id) })); + }, + createEntitiesPage: (room_id, is_scenes_page) => { + set((state) => ({ entities_pages: [...state.entities_pages, { + id: state.entities_pages.length + 1, + display_order: 0, + number_of_entities: 0, + type: is_scenes_page ? "scene" : "entity", + room_id + }] })); + }, + setScenePosition: (id, entities_page_id, room_view_position) => { + set((state) => ({ + ...state, + scenes: state.scenes.map((scene) => scene.id === id ? { + ...scene, + entities_page_id, + room_view_position + } : scene) + })); + }, + setEntityPosition: (id, entities_page_id, room_view_position) => { + set((state) => ({ + ...state, + entities: state.entities.map((entity) => entity.id === id ? { + ...entity, + entities_page_id, + room_view_position + } : entity) + })); + }, + removeEntity: (id) => { + set((state) => ({ entities: state.entities.filter((entity) => entity.id !== id) })); + }, + removeScene: (id) => { + set((state) => ({ scenes: state.scenes.filter((scene) => scene.id !== id) })); + } +})); +//#endregion +//#region src/components/MultiStep_AddEditEntity/step1_select_type.tsx +var import_react = /* @__PURE__ */ __toESM(require_react(), 1); +var import_jsx_runtime = require_jsx_runtime(); +var MultiStep_AddEditEntity_Step1 = ({ handleButtonSelectEvent, next_step }) => { + const [lightHovered, setLightHovered] = (0, import_react.useState)(false); + const [switchHovered, setSwitchHovered] = (0, import_react.useState)(false); + const [buttonHovered, setButtonHovered] = (0, import_react.useState)(false); + const [thermostatHovered, setThermostatHovered] = (0, import_react.useState)(false); + const [mediaPlayerHovered, setMediaPlayerHovered] = (0, import_react.useState)(false); + const [coverHovered, setCoverHovered] = (0, import_react.useState)(false); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "grid grid-cols-3 gap-4 w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + onMouseEnter: () => setLightHovered(true), + onMouseLeave: () => setLightHovered(false), + className: "group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10", + onClick: () => { + handleButtonSelectEvent("entity_type", "light")(); + next_step(); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi ${lightHovered ? "mdi-lightbulb-on" : "mdi-lightbulb"} text-3xl text-neutral-content/50 group-hover:text-yellow-500` }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-base-content/50 group-hover:text-base-content", + children: "Light" + }) + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + onMouseEnter: () => setSwitchHovered(true), + onMouseLeave: () => setSwitchHovered(false), + className: "group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10", + onClick: () => { + handleButtonSelectEvent("entity_type", "switch")(); + next_step(); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi ${switchHovered ? "mdi-toggle-switch-variant" : "mdi-toggle-switch-variant-off"} text-3xl text-neutral-content/50 group-hover:text-yellow-500` }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-base-content/50 group-hover:text-base-content", + children: "Switch" + }) + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + onMouseEnter: () => setButtonHovered(true), + onMouseLeave: () => setButtonHovered(false), + className: "group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10", + onClick: () => { + handleButtonSelectEvent("entity_type", "button")(); + next_step(); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi ${buttonHovered ? "mdi-gesture-tap-button" : "mdi-button-pointer"} text-3xl text-neutral-content/50 group-hover:text-yellow-500` }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-base-content/50 group-hover:text-base-content", + children: "Button" + }) + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + onMouseEnter: () => setThermostatHovered(true), + onMouseLeave: () => setThermostatHovered(false), + className: "group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10", + onClick: () => { + handleButtonSelectEvent("entity_type", "thermostat")(); + next_step(); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi ${thermostatHovered ? "mdi-thermostat-cog" : "mdi-thermostat"} text-3xl text-neutral-content/50 group-hover:text-yellow-500` }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-base-content/50 group-hover:text-base-content text-center", + children: "Thermostat / climate" + }) + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + onMouseEnter: () => setMediaPlayerHovered(true), + onMouseLeave: () => setMediaPlayerHovered(false), + className: "group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10", + onClick: () => { + handleButtonSelectEvent("entity_type", "media_player")(); + next_step(); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi ${mediaPlayerHovered ? "mdi-play-circle" : "mdi-speaker"} text-3xl text-neutral-content/50 group-hover:text-yellow-500` }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-base-content/50 group-hover:text-base-content text-center", + children: "Media player" + }) + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + onMouseEnter: () => setCoverHovered(true), + onMouseLeave: () => setCoverHovered(false), + className: "group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10", + onClick: () => { + handleButtonSelectEvent("entity_type", "cover")(); + next_step(); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi ${coverHovered ? "mdi-window-shutter-open" : "mdi-window-shutter"} text-3xl text-neutral-content/50 group-hover:text-yellow-500` }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-base-content/50 group-hover:text-base-content text-center", + children: "Cover / blind" + }) + })] + }) + ] + }) }); +}; +//#endregion +//#region src/components/MultiStep_AddEditEntity/step2_select_source.tsx +var MultiStep_AddEditEntity_Step2 = ({ handleButtonSelectEvent, entity_type, next_step }) => { + const available_controllers = { + light: ["home_assistant", "openhab"], + switch: ["home_assistant", "openhab"], + button: ["home_assistant", "nspm"], + thermostat: ["home_assistant", "openhab"], + media_player: ["home_assistant"], + cover: ["home_assistant", "openhab"], + scene: [ + "home_assistant", + "openhab", + "nspm" + ] + }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "grid grid-cols-3 gap-4 w-full", + children: [ + available_controllers[entity_type]?.includes("home_assistant") && useSettingsStore.getState().settings?.home_assistant_token_set && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-home-assistant/10", + onClick: () => { + handleButtonSelectEvent("controller", "home_assistant")(); + next_step(); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center p-4", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { + src: "/static/home-assistant-logo/home-assistant-logomark-color-on-light.svg", + alt: "Home Assistant logo", + className: "h-12 w-12" + }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-base-content/50 group-hover:text-base-content text-center", + children: "Home Assistant" + }) + })] + }), + available_controllers[entity_type]?.includes("openhab") && useSettingsStore.getState().settings?.openhab_token_set && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-openhab/10", + onClick: () => { + handleButtonSelectEvent("controller", "openhab")(); + next_step(); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center p-4", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { + src: "/static/openhab-logo/openHAB_darkBG_appicon.svg", + alt: "OpenHAB logo", + className: "h-12 w-12" + }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-base-content/50 group-hover:text-base-content text-center", + children: "OpenHAB" + }) + })] + }), + available_controllers[entity_type]?.includes("nspm") && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-accent/10", + onClick: () => { + handleButtonSelectEvent("controller", "nspm")(); + next_step(); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center p-4", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { + src: "/static/icon.svg", + alt: "NSPanel Manager logo", + className: "h-12 w-12" + }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-base-content/50 group-hover:text-base-content text-center", + children: "NSPanel Manager" + }) + })] + }) + ] + }) }); +}; +//#endregion +//#region node_modules/zod/v4/core/util.js +function getEnumValues(entries) { + const numericValues = Object.values(entries).filter((v) => typeof v === "number"); + return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v); +} +function joinValues(array, separator = "|") { + return array.map((val) => stringifyPrimitive(val)).join(separator); +} +function jsonStringifyReplacer(_, value) { + if (typeof value === "bigint") return value.toString(); + return value; +} +function cached(getter) { + return { get value() { + { + const value = getter(); + Object.defineProperty(this, "value", { value }); + return value; + } + } }; +} +function nullish(input) { + return input === null || input === void 0; +} +function cleanRegex(source) { + const start = source.startsWith("^") ? 1 : 0; + const end = source.endsWith("$") ? source.length - 1 : source.length; + return source.slice(start, end); +} +function floatSafeRemainder(val, step) { + const ratio = val / step; + const roundedRatio = Math.round(ratio); + const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1); + if (Math.abs(ratio - roundedRatio) < tolerance) return 0; + return ratio - roundedRatio; +} +function assignProp(target, prop, value) { + Object.defineProperty(target, prop, { + value, + writable: true, + enumerable: true, + configurable: true + }); +} +function mergeDefs(...defs) { + const mergedDescriptors = {}; + for (const def of defs) { + const descriptors = Object.getOwnPropertyDescriptors(def); + Object.assign(mergedDescriptors, descriptors); + } + return Object.defineProperties({}, mergedDescriptors); +} +function esc(str) { + return JSON.stringify(str); +} +function slugify(input) { + return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, ""); +} +var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {}; +function isObject(data) { + return typeof data === "object" && data !== null && !Array.isArray(data); +} +var allowsEval = /* @__PURE__*/ cached(() => { + if (globalConfig.jitless) return false; + if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false; + try { + new Function(""); + return true; + } catch (_) { + return false; + } +}); +function isPlainObject(o) { + if (isObject(o) === false) return false; + const ctor = o.constructor; + if (ctor === void 0) return true; + if (typeof ctor !== "function") return true; + const prot = ctor.prototype; + if (isObject(prot) === false) return false; + if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false; + return true; +} +function shallowClone(o) { + if (isPlainObject(o)) return { ...o }; + if (Array.isArray(o)) return [...o]; + if (o instanceof Map) return new Map(o); + if (o instanceof Set) return new Set(o); + return o; +} +var propertyKeyTypes = /* @__PURE__*/ new Set([ + "string", + "number", + "symbol" +]); +function escapeRegex(str) { + return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} +function clone(inst, def, params) { + const cl = new inst._zod.constr(def ?? inst._zod.def); + if (!def || params?.parent) cl._zod.parent = inst; + return cl; +} +function normalizeParams(_params) { + const params = _params; + if (!params) return {}; + if (typeof params === "string") return { error: () => params }; + if (params?.message !== void 0) { + if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params"); + params.error = params.message; + } + delete params.message; + if (typeof params.error === "string") return { + ...params, + error: () => params.error + }; + return params; +} +function stringifyPrimitive(value) { + if (typeof value === "bigint") return value.toString() + "n"; + if (typeof value === "string") return `"${value}"`; + return `${value}`; +} +function optionalKeys(shape) { + return Object.keys(shape).filter((k) => { + return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional"; + }); +} +var NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({ + safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER], + int32: [-2147483648, 2147483647], + uint32: [0, 4294967295], + float32: [-34028234663852886e22, 34028234663852886e22], + float64: [-Number.MAX_VALUE, Number.MAX_VALUE] +}))(); +function pick(schema, mask) { + const currDef = schema._zod.def; + const checks = currDef.checks; + if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements"); + return clone(schema, mergeDefs(schema._zod.def, { + get shape() { + const newShape = {}; + for (const key of Reflect.ownKeys(mask)) { + if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`); + if (!mask[key]) continue; + assignProp(newShape, key, currDef.shape[key]); + } + assignProp(this, "shape", newShape); + return newShape; + }, + checks: [] + })); +} +function omit(schema, mask) { + const currDef = schema._zod.def; + const checks = currDef.checks; + if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements"); + return clone(schema, mergeDefs(schema._zod.def, { + get shape() { + const newShape = { ...schema._zod.def.shape }; + for (const key of Reflect.ownKeys(mask)) { + if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`); + if (!mask[key]) continue; + delete newShape[key]; + } + assignProp(this, "shape", newShape); + return newShape; + }, + checks: [] + })); +} +function extend(schema, shape) { + if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object"); + const checks = schema._zod.def.checks; + if (checks && checks.length > 0) { + const existingShape = schema._zod.def.shape; + for (const key of Reflect.ownKeys(shape)) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead."); + } + return clone(schema, mergeDefs(schema._zod.def, { get shape() { + const _shape = { + ...schema._zod.def.shape, + ...shape + }; + assignProp(this, "shape", _shape); + return _shape; + } })); +} +function safeExtend(schema, shape) { + if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object"); + return clone(schema, mergeDefs(schema._zod.def, { get shape() { + const _shape = { + ...schema._zod.def.shape, + ...shape + }; + assignProp(this, "shape", _shape); + return _shape; + } })); +} +function merge(a, b) { + if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`."); + if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead."); + return clone(a, mergeDefs(a._zod.def, { + get shape() { + const _shape = { + ...a._zod.def.shape, + ...b._zod.def.shape + }; + assignProp(this, "shape", _shape); + return _shape; + }, + get catchall() { + return b._zod.def.catchall; + }, + checks: b._zod.def.checks ?? [] + })); +} +function partial(Class, schema, mask, name = "partial") { + const checks = schema._zod.def.checks; + if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`); + return clone(schema, mergeDefs(schema._zod.def, { + get shape() { + const oldShape = schema._zod.def.shape; + const shape = { ...oldShape }; + if (mask) for (const key of Reflect.ownKeys(mask)) { + if (!Object.prototype.hasOwnProperty.call(oldShape, key)) throw new Error(`Unrecognized key: "${String(key)}"`); + if (!mask[key]) continue; + shape[key] = Class ? new Class({ + type: "optional", + innerType: oldShape[key] + }) : oldShape[key]; + } + else for (const key of Reflect.ownKeys(oldShape)) shape[key] = Class ? new Class({ + type: "optional", + innerType: oldShape[key] + }) : oldShape[key]; + assignProp(this, "shape", shape); + return shape; + }, + checks: [] + })); +} +function required(Class, schema, mask) { + return clone(schema, mergeDefs(schema._zod.def, { get shape() { + const oldShape = schema._zod.def.shape; + const shape = { ...oldShape }; + if (mask) for (const key of Reflect.ownKeys(mask)) { + if (!Object.prototype.hasOwnProperty.call(shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`); + if (!mask[key]) continue; + shape[key] = new Class({ + type: "nonoptional", + innerType: oldShape[key] + }); + } + else for (const key of Reflect.ownKeys(oldShape)) shape[key] = new Class({ + type: "nonoptional", + innerType: oldShape[key] + }); + assignProp(this, "shape", shape); + return shape; + } })); +} +function aborted(x, startIndex = 0) { + if (x.aborted === true) return true; + for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true; + return false; +} +function explicitlyAborted(x, startIndex = 0) { + if (x.aborted === true) return true; + for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue === false) return true; + return false; +} +function prefixIssues(path, issues) { + return issues.map((iss) => { + var _a; + (_a = iss).path ?? (_a.path = []); + iss.path.unshift(path); + return iss; + }); +} +function unwrapMessage(message) { + return typeof message === "string" ? message : message?.message; +} +function attachSchema(issues, start, inst) { + var _a; + for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst); +} +function finalizeIssue(iss, ctx, config) { + var _a; + const traits = iss.inst?._zod?.traits; + if (traits?.has("$ZodType")) { + if (traits.has("$ZodCheck")) (_a = iss).schema ?? (_a.schema = iss.inst); + else iss.schema = iss.inst; + } + const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0; + const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input"; + const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss; + rest.path ?? (rest.path = []); + rest.message = message; + if (ctx?.reportInput) rest.input = _input; + return rest; +} +var highSurrogate = /[\uD800-\uDBFF]/; +function codePointLength(str) { + const units = str.length; + if (!highSurrogate.test(str)) return units; + let count = units; + for (let i = 0; i < units - 1; i++) if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) { + count--; + i++; + } + return count; +} +function getLengthableOrigin(input) { + if (Array.isArray(input)) return "array"; + if (typeof input === "string") return "string"; + return "unknown"; +} +function parsedType(data) { + const t = typeof data; + switch (t) { + case "number": return Number.isNaN(data) ? "nan" : "number"; + case "object": { + if (data === null) return "null"; + if (Array.isArray(data)) return "array"; + const obj = data; + if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) return obj.constructor.name; + } + } + return t; +} +function issue(...args) { + const [iss, input, inst] = args; + if (typeof iss === "string") return { + message: iss, + code: "custom", + input, + inst + }; + return { ...iss }; +} +/** +* Installs a trait's members on its prototype. Each value builds that member for the instance on first read; the built value shadows the accessor as an own property, so a detached `const { parse } = schema` keeps working. +* +* Call this from a `proto` initializer, which runs once per prototype — never per instance. +*/ +function members(proto, table) { + for (const key in table) { + const desc = Object.getOwnPropertyDescriptor(table, key); + if (desc.get) Object.defineProperty(proto, key, { + ...desc, + enumerable: false + }); + else defineBound(proto, key, desc.value); + } +} +/** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */ +function own(inst, key, value, enumerable = true) { + Object.defineProperty(inst, key, { + configurable: true, + writable: true, + enumerable, + value + }); + return value; +} +/** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */ +function hide(inst, key, value) { + return own(inst, key, value, false); +} +function defineBound(proto, key, fn) { + Object.defineProperty(proto, key, { + configurable: true, + get() { + return this == null ? fn : own(this, key, fn.bind(this)); + }, + set(value) { + own(this, key, value); + } + }); +} +/** Returns the prototype to install on, or `undefined` if this group is already installed on it. */ +function claim(inst, sentinel) { + const proto = Object.getPrototypeOf(inst); + return sentinel in proto ? void 0 : proto; +} +var installing; +var broke = false; +var breaker = { + configurable: true, + get() { + broke = true; + } +}; +/** +* Installs a lazily-derived internal on the `_zod` prototype of `inst`'s +* constructor, computed from the internals object itself and cached there on +* first read. One accessor per constructor rather than one per instance. +*/ +function defineLazyInternal(inst, key, compute) { + const proto = Object.getPrototypeOf(inst._zod); + if (key in proto && installing !== inst._zod) { + installing = void 0; + return; + } + installing = inst._zod; + Object.defineProperty(proto, key, { + configurable: true, + get() { + Object.defineProperty(this, key, breaker); + const outer = broke; + broke = false; + try { + const value = compute(this); + if (broke) delete this[key]; + else Object.defineProperty(this, key, { + configurable: true, + writable: true, + value + }); + broke = broke || outer; + return value; + } catch (err) { + delete this[key]; + broke = broke || outer; + throw err; + } + }, + set(value) { + Object.defineProperty(this, key, { + configurable: true, + writable: true, + value + }); + } + }); +} +/** +* Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own +* data property. One accessor per constructor rather than one per instance, because an own accessor +* puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel. +*/ +function installLazyProp(inst, key, make, enumerable) { + const proto = claim(inst, key); + if (!proto) return; + Object.defineProperty(proto, key, { + configurable: true, + get() { + const desc = { + configurable: true, + writable: true, + enumerable, + value: void 0 + }; + Object.defineProperty(this, key, desc); + desc.value = make(this); + Object.defineProperty(this, key, desc); + return desc.value; + }, + set(value) { + Object.defineProperty(this, key, { + configurable: true, + writable: true, + enumerable, + value + }); + } + }); +} +/** Marks the thunk `_catch` synthesises for a constant catch value. `Function.length` cannot tell that thunk from a user callback — rest and defaulted parameters both report arity 0 — and a user callback reads `ctx.error`, whose issues only finalize correctly against the caller's per-parse error map. Provenance can say what arity cannot. A plain string key rather than `Symbol.for`, whose call at module scope no bundler can prove pure — the same shape that anchored `urlCanParse` into every build. */ +var CONSTANT_CATCH = "~constantCatch"; +/** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */ +function constantCatch(value) { + const fn = () => value; + fn[CONSTANT_CATCH] = true; + return fn; +} +//#endregion +//#region node_modules/zod/v4/core/core.js +var _a$1; +var _zodDesc$1 = { + value: void 0, + enumerable: false +}; +var _E = "captureStackTrace" in Error ? Error : null; +function newError(Definition) { + const E = _E; + if (E) { + const saved = E.stackTraceLimit; + if (typeof saved === "number") { + try { + E.stackTraceLimit = 0; + } catch { + _E = null; + return new Definition(); + } + try { + return new Definition(); + } finally { + E.stackTraceLimit = saved; + } + } + } + return new Definition(); +} +function $constructor(name, initializer, proto, params) { + const zodProto = {}; + function Internals(def) { + this.def = def; + this.constr = _; + this.traits = /* @__PURE__ */ new Set(); + } + Internals.prototype = zodProto; + const protoMembers = proto; + const initialized = protoMembers && /* @__PURE__ */ new WeakSet(); + function init(inst, def) { + if (!inst._zod) { + _zodDesc$1.value = new Internals(def); + try { + Object.defineProperty(inst, "_zod", _zodDesc$1); + } finally { + _zodDesc$1.value = void 0; + } + } + if (inst._zod.traits.has(name)) return; + inst._zod.traits.add(name); + initializer(inst, def); + if (initialized) { + const own = Object.getPrototypeOf(inst); + const ctorProto = inst._zod.constr.prototype; + let up = own; + while (up && up !== ctorProto) up = Object.getPrototypeOf(up); + const target = up ?? own; + if (!initialized.has(target)) { + initialized.add(target); + members(target, protoMembers); + } + } + const proto = _.prototype; + for (const k in proto) { + if (!Object.prototype.hasOwnProperty.call(proto, k)) continue; + if (!(k in inst)) inst[k] = proto[k].bind(inst); + } + } + const Parent = params?.Parent ?? Object; + class Definition extends Parent {} + Object.defineProperty(Definition, "name", { value: name }); + function _(def) { + const inst = params?.Parent ? newError(Definition) : this; + init(inst, def); + const deferred = inst._zod.deferred; + if (deferred) { + for (const fn of deferred) fn(); + inst._zod.deferred = void 0; + } + const pp = globalThis.__zod_globalConfig?.postProcessor; + if (pp) pp(inst); + return inst; + } + Object.defineProperty(_, "init", { value: init }); + Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => { + if (params?.Parent && inst instanceof params.Parent) return true; + return inst?._zod?.traits?.has(name); + } }); + Object.defineProperty(_, "name", { value: name }); + return _; +} +var $ZodAsyncError = class extends Error { + constructor() { + super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`); + } +}; +var $ZodEncodeError = class extends Error { + constructor(name) { + super(`Encountered unidirectional transform during encode: ${name}`); + this.name = "ZodEncodeError"; + } +}; +(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {}); +var globalConfig = globalThis.__zod_globalConfig; +function config(newConfig) { + if (newConfig) Object.assign(globalConfig, newConfig); + return globalConfig; +} +//#endregion +//#region node_modules/zod/v4/core/errors.js +function _getMessage() { + const internals = this._zod; + internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2)); + return internals.message; +} +function _setMessage(value) { + this._zod.message = value; +} +var _messageDesc = { + get: _getMessage, + set: _setMessage, + enumerable: true, + configurable: true +}; +var _zodDesc = { + value: void 0, + enumerable: false +}; +var _issuesDesc = { + value: void 0, + enumerable: false +}; +var _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]); +var initializer$1 = (inst, def) => { + inst.name = "$ZodError"; + _zodDesc.value = inst._zod; + Object.defineProperty(inst, "_zod", _zodDesc); + _issuesDesc.value = def; + Object.defineProperty(inst, "issues", _issuesDesc); + _zodDesc.value = void 0; + _issuesDesc.value = void 0; + Object.defineProperty(inst, "message", _messageDesc); + const proto = Object.getPrototypeOf(inst); + if (!_installedToString.has(proto)) { + _installedToString.add(proto); + Object.defineProperty(proto, "toString", { + configurable: true, + enumerable: false, + get() { + const value = () => this.message; + Object.defineProperty(this, "toString", { + value, + configurable: true, + writable: true + }); + return value; + }, + set(value) { + Object.defineProperty(this, "toString", { + value, + configurable: true, + writable: true + }); + } + }); + } +}; +var $ZodError = $constructor("$ZodError", initializer$1); +var $ZodRealError = $constructor("$ZodError", initializer$1, void 0, { Parent: Error }); +/** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member +* ("toString", "constructor") would otherwise read through to the prototype, and assigning +* "__proto__" would hit the setter instead of creating a key. */ +function node(obj, key, make) { + if (!Object.prototype.hasOwnProperty.call(obj, key)) { + if (key === "__proto__") Object.defineProperty(obj, key, { + value: make(), + writable: true, + enumerable: true, + configurable: true + }); + else obj[key] = make(); + } + return obj[key]; +} +function flattenError(error, mapper = (issue) => issue.message) { + const fieldErrors = {}; + const formErrors = []; + for (const sub of error.issues) if (sub.path.length > 0) node(fieldErrors, sub.path[0], () => []).push(mapper(sub)); + else formErrors.push(mapper(sub)); + return { + formErrors, + fieldErrors + }; +} +function formatError(error, mapper = (issue) => issue.message) { + const fieldErrors = { _errors: [] }; + const processError = (error, path = []) => { + for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path])); + else if (issue.code === "invalid_key") processError({ issues: issue.issues }, [...path, ...issue.path]); + else if (issue.code === "invalid_element") processError({ issues: issue.issues }, [...path, ...issue.path]); + else { + const fullpath = [...path, ...issue.path]; + if (fullpath.length === 0) fieldErrors._errors.push(mapper(issue)); + else { + let curr = fieldErrors; + let i = 0; + while (i < fullpath.length) { + const el = fullpath[i]; + const terminal = i === fullpath.length - 1; + if (el === "_errors") { + if (terminal) curr._errors.push(mapper(issue)); + i++; + continue; + } + if (!Object.prototype.hasOwnProperty.call(curr, el)) Object.defineProperty(curr, el, { + value: { _errors: [] }, + enumerable: true, + writable: true, + configurable: true + }); + const node = curr[el]; + if (terminal) node._errors.push(mapper(issue)); + curr = node; + i++; + } + } + } + }; + processError(error); + return fieldErrors; +} +//#endregion +//#region node_modules/zod/v4/core/parse.js +function finalizeParams(callee, params) { + return { + callee: params?.callee ?? callee, + Err: params?.Err + }; +} +var _parse = (_Err) => { + const fn = (schema, value, _ctx, _params) => { + const ctx = _ctx ? { + ..._ctx, + async: false + } : { async: false }; + const result = schema._zod.run({ + value, + issues: [] + }, ctx); + if (result instanceof Promise) throw new $ZodAsyncError(); + if (result.issues.length) { + const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))); + captureStackTrace(e, _params?.callee ?? fn); + throw e; + } + return result.value; + }; + return fn; +}; +var _parseAsync = (_Err) => { + const fn = async (schema, value, _ctx, params) => { + const ctx = _ctx ? { + ..._ctx, + async: true + } : { async: true }; + let result = schema._zod.run({ + value, + issues: [] + }, ctx); + if (result instanceof Promise) result = await result; + if (result.issues.length) { + const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))); + captureStackTrace(e, params?.callee ?? fn); + throw e; + } + return result.value; + }; + return fn; +}; +var _safeParse = (_Err) => (schema, value, _ctx) => { + const ctx = _ctx ? { + ..._ctx, + async: false + } : { async: false }; + const result = schema._zod.run({ + value, + issues: [] + }, ctx); + if (result instanceof Promise) throw new $ZodAsyncError(); + return result.issues.length ? { + success: false, + error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))) + } : { + success: true, + data: result.value + }; +}; +var safeParse$1 = /* @__PURE__*/ _safeParse($ZodRealError); +var _safeParseAsync = (_Err) => async (schema, value, _ctx) => { + const ctx = _ctx ? { + ..._ctx, + async: true + } : { async: true }; + let result = schema._zod.run({ + value, + issues: [] + }, ctx); + if (result instanceof Promise) result = await result; + return result.issues.length ? { + success: false, + error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))) + } : { + success: true, + data: result.value + }; +}; +var safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError); +var _encode = (_Err) => { + const parse = _parse(_Err); + const fn = (schema, value, _ctx, _params) => { + const ctx = _ctx ? { + ..._ctx, + direction: "backward" + } : { direction: "backward" }; + return parse(schema, value, ctx, finalizeParams(fn, _params)); + }; + return fn; +}; +var _decode = (_Err) => { + const parse = _parse(_Err); + const fn = (schema, value, _ctx, _params) => { + return parse(schema, value, _ctx, finalizeParams(fn, _params)); + }; + return fn; +}; +var _encodeAsync = (_Err) => { + const parseAsync = _parseAsync(_Err); + const fn = async (schema, value, _ctx, _params) => { + const ctx = _ctx ? { + ..._ctx, + direction: "backward" + } : { direction: "backward" }; + return await parseAsync(schema, value, ctx, finalizeParams(fn, _params)); + }; + return fn; +}; +var _decodeAsync = (_Err) => { + const parseAsync = _parseAsync(_Err); + const fn = async (schema, value, _ctx, _params) => { + return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params)); + }; + return fn; +}; +var _safeEncode = (_Err) => (schema, value, _ctx) => { + const ctx = _ctx ? { + ..._ctx, + direction: "backward" + } : { direction: "backward" }; + return _safeParse(_Err)(schema, value, ctx); +}; +var _safeDecode = (_Err) => (schema, value, _ctx) => { + return _safeParse(_Err)(schema, value, _ctx); +}; +var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => { + const ctx = _ctx ? { + ..._ctx, + direction: "backward" + } : { direction: "backward" }; + return _safeParseAsync(_Err)(schema, value, ctx); +}; +var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => { + return _safeParseAsync(_Err)(schema, value, _ctx); +}; +//#endregion +//#region node_modules/zod/v4/core/regexes.js +/** +* @deprecated CUID v1 is deprecated by its authors due to information leakage +* (timestamps embedded in the id). Use {@link cuid2} instead. +* See https://github.com/paralleldrive/cuid. +*/ +var cuid = /^[cC][0-9a-z]{6,}$/; +var cuid2 = /^[0-9a-z]+$/; +var ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/; +var xid = /^[0-9a-vA-V]{20}$/; +var ksuid = /^[A-Za-z0-9]{27}$/; +var nanoid = /^[a-zA-Z0-9_-]{21}$/; +function nanoidOfLength(length) { + return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`); +} +/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */ +var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/; +/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */ +var guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/; +/** Returns a regex for validating an RFC 9562/4122 UUID. +* +* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */ +var uuid = (version) => { + if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/; + return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`); +}; +/** Practical email validation */ +var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/; +var _emoji$1 = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`; +function emoji() { + return new RegExp(_emoji$1, "u"); +} +var ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/; +var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/; +var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/; +var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/; +var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/; +var base64url = /^[A-Za-z0-9_-]*$/; +var httpProtocol = /^https?$/; +var e164 = /^\+[1-9]\d{6,14}$/; +var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`; +/** Anchors a pattern source. The interpolation lives here rather than at the call site because +* esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it +* will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle. */ +function anchor(source) { + return new RegExp(`^${source}$`); +} +var date = /*@__PURE__*/ anchor(dateSource); +function timeSource(args) { + const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`; + return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : args.seconds ? `${hhmm}:[0-5]\\d(?:\\.\\d+)?` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`; +} +function time(args) { + return new RegExp(`^${timeSource(args)}$`); +} +function datetime(args) { + const opts = ["Z"]; + if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`); + const qualified = `${timeSource({ + precision: args.precision, + seconds: true + })}(?:${opts.join("|")})`; + const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified; + return new RegExp(`^${dateSource}T(?:${timeRegex})$`); +} +var string$1 = (params) => { + const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`; + return new RegExp(`^${regex}$`); +}; +var integer = /^-?\d+$/; +var number$1 = /^-?\d+(?:\.\d+)?$/; +var boolean$1 = /^(?:true|false)$/i; +var lowercase = /^[^A-Z]*$/; +var uppercase = /^[^a-z]*$/; +//#endregion +//#region node_modules/zod/v4/core/checks.js +var $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => { + var _a; + inst._zod ?? (inst._zod = {}); + inst._zod.def = def; + (_a = inst._zod).onattach ?? (_a.onattach = []); +}); +/** Default `when` for length-based checks: run only on non-nullish values with a `length`. */ +var _whenHasLength = (payload) => { + const val = payload.value; + return !nullish(val) && val.length !== void 0; +}; +var numericOriginMap = { + number: "number", + bigint: "bigint", + object: "date" +}; +var $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => { + $ZodCheck.init(inst, def); + const origin = numericOriginMap[typeof def.value]; + inst._zod.onattach.push((inst) => { + const bag = inst._zod.bag; + const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY; + if (def.value < curr) { + if (def.inclusive) bag.maximum = def.value; + else bag.exclusiveMaximum = def.value; + } + }); + inst._zod.check = (payload) => { + if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return; + payload.issues.push({ + origin: numericOriginMap[typeof payload.value] ?? origin, + code: "too_big", + maximum: typeof def.value === "object" ? def.value.getTime() : def.value, + input: payload.value, + inclusive: def.inclusive, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => { + $ZodCheck.init(inst, def); + const origin = numericOriginMap[typeof def.value]; + inst._zod.onattach.push((inst) => { + const bag = inst._zod.bag; + const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY; + if (def.value > curr) { + if (def.inclusive) bag.minimum = def.value; + else bag.exclusiveMinimum = def.value; + } + }); + inst._zod.check = (payload) => { + if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return; + payload.issues.push({ + origin: numericOriginMap[typeof payload.value] ?? origin, + code: "too_small", + minimum: typeof def.value === "object" ? def.value.getTime() : def.value, + input: payload.value, + inclusive: def.inclusive, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => { + $ZodCheck.init(inst, def); + inst._zod.onattach.push((inst) => { + var _a; + (_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value); + }); + inst._zod.check = (payload) => { + if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check."); + if (typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return; + payload.issues.push({ + origin: typeof payload.value, + code: "not_multiple_of", + divisor: def.value, + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat", (inst, def) => { + $ZodCheck.init(inst, def); + def.format = def.format || "float64"; + const isInt = def.format?.includes("int"); + const origin = isInt ? "int" : "number"; + const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format]; + inst._zod.onattach.push((inst) => { + const bag = inst._zod.bag; + bag.format = def.format; + bag.minimum = minimum; + bag.maximum = maximum; + if (isInt) bag.pattern = integer; + }); + inst._zod.check = (payload) => { + const input = payload.value; + if (isInt) { + if (!Number.isInteger(input)) { + payload.issues.push({ + expected: origin, + format: def.format, + code: "invalid_type", + continue: false, + input, + inst + }); + return; + } + if (!Number.isSafeInteger(input)) { + if (input > 0) payload.issues.push({ + input, + code: "too_big", + maximum: Number.MAX_SAFE_INTEGER, + note: "Integers must be within the safe integer range.", + inst, + origin, + inclusive: true, + continue: !def.abort + }); + else payload.issues.push({ + input, + code: "too_small", + minimum: Number.MIN_SAFE_INTEGER, + note: "Integers must be within the safe integer range.", + inst, + origin, + inclusive: true, + continue: !def.abort + }); + return; + } + } + if (input < minimum) payload.issues.push({ + origin: "number", + input, + code: "too_small", + minimum, + inclusive: true, + inst, + continue: !def.abort + }); + if (input > maximum) payload.issues.push({ + origin: "number", + input, + code: "too_big", + maximum, + inclusive: true, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => { + var _a; + $ZodCheck.init(inst, def); + (_a = inst._zod.def).when ?? (_a.when = _whenHasLength); + inst._zod.onattach.push((inst) => { + const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY; + if (def.maximum < curr) inst._zod.bag.maximum = def.maximum; + }); + inst._zod.check = (payload) => { + const input = payload.value; + const units = input.length; + if ((typeof input === "string" && units > def.maximum ? codePointLength(input) : units) <= def.maximum) return; + const origin = getLengthableOrigin(input); + payload.issues.push({ + origin, + code: "too_big", + maximum: def.maximum, + inclusive: true, + input, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => { + var _a; + $ZodCheck.init(inst, def); + (_a = inst._zod.def).when ?? (_a.when = _whenHasLength); + inst._zod.onattach.push((inst) => { + const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY; + if (def.minimum > curr) inst._zod.bag.minimum = def.minimum; + }); + inst._zod.check = (payload) => { + const input = payload.value; + const units = input.length; + if ((typeof input === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input) : units) >= def.minimum) return; + const origin = getLengthableOrigin(input); + payload.issues.push({ + origin, + code: "too_small", + minimum: def.minimum, + inclusive: true, + input, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => { + var _a; + $ZodCheck.init(inst, def); + (_a = inst._zod.def).when ?? (_a.when = _whenHasLength); + inst._zod.onattach.push((inst) => { + const bag = inst._zod.bag; + bag.minimum = def.length; + bag.maximum = def.length; + bag.length = def.length; + }); + inst._zod.check = (payload) => { + const input = payload.value; + const units = input.length; + const length = typeof input === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input) : units; + if (length === def.length) return; + const origin = getLengthableOrigin(input); + const tooBig = length > def.length; + payload.issues.push({ + origin, + ...tooBig ? { + code: "too_big", + maximum: def.length + } : { + code: "too_small", + minimum: def.length + }, + inclusive: true, + exact: true, + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => { + var _a, _b; + $ZodCheck.init(inst, def); + inst._zod.onattach.push((inst) => { + const bag = inst._zod.bag; + bag.format = def.format; + if (def.pattern) { + bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set()); + bag.patterns.add(def.pattern); + } + }); + if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => { + def.pattern.lastIndex = 0; + if (def.pattern.test(payload.value)) return; + payload.issues.push({ + origin: "string", + code: "invalid_format", + format: def.format, + input: payload.value, + ...def.pattern ? { pattern: def.pattern.toString() } : {}, + inst, + continue: !def.abort + }); + }); + else (_b = inst._zod).check ?? (_b.check = () => {}); +}); +var $ZodCheckRegex = /*@__PURE__*/ $constructor("$ZodCheckRegex", (inst, def) => { + $ZodCheckStringFormat.init(inst, def); + inst._zod.check = (payload) => { + def.pattern.lastIndex = 0; + if (def.pattern.test(payload.value)) return; + payload.issues.push({ + origin: "string", + code: "invalid_format", + format: "regex", + input: payload.value, + pattern: def.pattern.toString(), + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckLowerCase = /*@__PURE__*/ $constructor("$ZodCheckLowerCase", (inst, def) => { + def.pattern ?? (def.pattern = lowercase); + $ZodCheckStringFormat.init(inst, def); +}); +var $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (inst, def) => { + def.pattern ?? (def.pattern = uppercase); + $ZodCheckStringFormat.init(inst, def); +}); +var $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => { + $ZodCheck.init(inst, def); + const escapedRegex = escapeRegex(def.includes); + const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex); + def.pattern = pattern; + inst._zod.onattach.push((inst) => { + const bag = inst._zod.bag; + bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set()); + bag.patterns.add(pattern); + }); + inst._zod.check = (payload) => { + if (payload.value.includes(def.includes, def.position)) return; + payload.issues.push({ + origin: "string", + code: "invalid_format", + format: "includes", + includes: def.includes, + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckStartsWith = /*@__PURE__*/ $constructor("$ZodCheckStartsWith", (inst, def) => { + $ZodCheck.init(inst, def); + const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`); + def.pattern ?? (def.pattern = pattern); + inst._zod.onattach.push((inst) => { + const bag = inst._zod.bag; + bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set()); + bag.patterns.add(pattern); + }); + inst._zod.check = (payload) => { + if (payload.value.startsWith(def.prefix)) return; + payload.issues.push({ + origin: "string", + code: "invalid_format", + format: "starts_with", + prefix: def.prefix, + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst, def) => { + $ZodCheck.init(inst, def); + const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`); + def.pattern ?? (def.pattern = pattern); + inst._zod.onattach.push((inst) => { + const bag = inst._zod.bag; + bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set()); + bag.patterns.add(pattern); + }); + inst._zod.check = (payload) => { + if (payload.value.endsWith(def.suffix)) return; + payload.issues.push({ + origin: "string", + code: "invalid_format", + format: "ends_with", + suffix: def.suffix, + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (inst, def) => { + $ZodCheck.init(inst, def); + inst._zod.check = (payload) => { + payload.value = def.tx(payload.value); + }; +}); +//#endregion +//#region node_modules/zod/v4/core/doc.js +var Doc = class { + constructor(args = [], closed = {}) { + this.content = []; + this.indent = 0; + this.args = args; + this.closed = closed; + } + indented(fn) { + this.indent += 1; + fn(this); + this.indent -= 1; + } + write(arg) { + if (typeof arg === "function") { + arg(this, { execution: "sync" }); + arg(this, { execution: "async" }); + return; + } + const lines = arg.split("\n").filter((x) => x); + const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length)); + const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x); + for (const line of dedented) this.content.push(line); + } + compile() { + const F = Function; + const content = this?.content ?? [``]; + return new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`)(...Object.values(this.closed)); + } +}; +//#endregion +//#region node_modules/zod/v4/core/versions.js +var version = { + major: 4, + minor: 5, + patch: 4 +}; +//#endregion +//#region node_modules/zod/v4/core/schemas.js +var $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => { + var _a; + inst ?? (inst = {}); + inst._zod.def = def; + inst._zod.bag = inst._zod.bag || {}; + inst._zod.version = version; + const defChecks = inst._zod.def.checks; + const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : []; + for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst); + if (checks.length === 0) { + (_a = inst._zod).deferred ?? (_a.deferred = []); + inst._zod.deferred?.push(() => { + inst._zod.run = inst._zod.parse; + }); + } else { + const runChecks = (payload, checks, ctx) => { + if (payload.memo) return payload; + let isAborted = aborted(payload); + let asyncResult; + for (const ch of checks) { + if (ch._zod.def.when) { + if (explicitlyAborted(payload)) continue; + if (!ch._zod.def.when(payload)) continue; + } else if (isAborted) continue; + const currLen = payload.issues.length; + const _ = ch._zod.check(payload); + if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError(); + if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => { + await _; + if (payload.issues.length === currLen) return; + attachSchema(payload.issues, currLen, inst); + if (!isAborted) isAborted = aborted(payload, currLen); + }); + else { + if (payload.issues.length === currLen) continue; + attachSchema(payload.issues, currLen, inst); + if (!isAborted) isAborted = aborted(payload, currLen); + } + } + if (asyncResult) return asyncResult.then(() => { + return payload; + }); + return payload; + }; + const handleCanaryResult = (canary, payload, ctx) => { + if (aborted(canary)) { + canary.aborted = true; + return canary; + } + const checkResult = runChecks(payload, checks, ctx); + if (checkResult instanceof Promise) { + if (ctx.async === false) throw new $ZodAsyncError(); + return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx)); + } + return inst._zod.parse(checkResult, ctx); + }; + inst._zod.run = (payload, ctx) => { + if (ctx.skipChecks) return inst._zod.parse(payload, ctx); + if (ctx.direction === "backward") { + const canary = inst._zod.parse({ + value: payload.value, + issues: [] + }, { + ...ctx, + skipChecks: true + }); + if (canary instanceof Promise) return canary.then((canary) => { + return handleCanaryResult(canary, payload, ctx); + }); + return handleCanaryResult(canary, payload, ctx); + } + const result = inst._zod.parse(payload, ctx); + if (result instanceof Promise) { + if (ctx.async === false) throw new $ZodAsyncError(); + return result.then((result) => runChecks(result, checks, ctx)); + } + return runChecks(result, checks, ctx); + }; + } +}, { + get "~standard"() { + return hide(this, "~standard", standardProps(this)); + }, + set "~standard"(value) { + own(this, "~standard", value); + } +}); +/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */ +var toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues }; +function standardProps(inst) { + return { + validate: (value) => { + try { + return toStandardResult(safeParse$1(inst, value)); + } catch (_) { + return safeParseAsync$1(inst, value).then(toStandardResult); + } + }, + vendor: "zod", + version: 1 + }; +} +var $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag); + inst._zod.parse = (payload, _) => { + if (def.coerce) try { + payload.value = String(payload.value); + } catch (_) {} + if (typeof payload.value === "string") return payload; + payload.issues.push({ + expected: "string", + code: "invalid_type", + input: payload.value, + inst + }); + return payload; + }; +}); +var $ZodStringFormat = /*@__PURE__*/ $constructor("$ZodStringFormat", (inst, def) => { + $ZodCheckStringFormat.init(inst, def); + $ZodString.init(inst, def); +}); +var $ZodGUID = /*@__PURE__*/ $constructor("$ZodGUID", (inst, def) => { + def.pattern ?? (def.pattern = guid); + $ZodStringFormat.init(inst, def); +}); +var $ZodUUID = /*@__PURE__*/ $constructor("$ZodUUID", (inst, def) => { + if (def.version) { + const v = { + v1: 1, + v2: 2, + v3: 3, + v4: 4, + v5: 5, + v6: 6, + v7: 7, + v8: 8 + }[def.version]; + if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`); + def.pattern ?? (def.pattern = uuid(v)); + } else def.pattern ?? (def.pattern = uuid()); + $ZodStringFormat.init(inst, def); +}); +var $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => { + def.pattern ?? (def.pattern = email); + $ZodStringFormat.init(inst, def); +}); +/** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */ +function parseURLObject(trimmed, def) { + if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1; + try { + return new URL(trimmed); + } catch { + return 2; + } +} +var asciiTabOrNewline = /[\t\n\r]/g; +/** The URL parser deletes every ASCII tab, LF and CR from its input before it parses, so `new URL("https://exa\nmple.com")` reports on `example.com`. Applying the same deletion to the returned value closes the half of that divergence which can move the host; the parser's other rewrite, stripping C0 controls at the edges, cannot. */ +function stripTabAndNewline(value) { + return value.replace(asciiTabOrNewline, ""); +} +function urlHostnameOk(url, hostname) { + hostname.lastIndex = 0; + return hostname.test(url.hostname); +} +function urlProtocolOk(url, protocol) { + protocol.lastIndex = 0; + return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol); +} +var $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => { + $ZodStringFormat.init(inst, def); + inst._zod.check = (payload) => { + try { + const trimmed = payload.value.trim(); + const url = parseURLObject(trimmed, def); + if (url === 1) { + payload.issues.push({ + code: "invalid_format", + format: "url", + note: "Invalid URL format", + input: payload.value, + inst, + continue: !def.abort + }); + return; + } + if (url === 2) { + payload.issues.push({ + code: "invalid_format", + format: "url", + input: payload.value, + inst, + continue: !def.abort + }); + return; + } + if (def.hostname && !urlHostnameOk(url, def.hostname)) payload.issues.push({ + code: "invalid_format", + format: "url", + note: "Invalid hostname", + pattern: def.hostname.source, + input: payload.value, + inst, + continue: !def.abort + }); + if (def.protocol && !urlProtocolOk(url, def.protocol)) payload.issues.push({ + code: "invalid_format", + format: "url", + note: "Invalid protocol", + pattern: def.protocol.source, + input: payload.value, + inst, + continue: !def.abort + }); + payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed); + return; + } catch (_) { + payload.issues.push({ + code: "invalid_format", + format: "url", + input: payload.value, + inst, + continue: !def.abort + }); + } + }; +}); +var $ZodEmoji = /*@__PURE__*/ $constructor("$ZodEmoji", (inst, def) => { + def.pattern ?? (def.pattern = emoji()); + $ZodStringFormat.init(inst, def); +}); +var $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => { + if (def.length !== void 0 && (!Number.isInteger(def.length) || def.length < 1)) throw new Error(`Invalid nanoid length: ${def.length}`); + def.pattern ?? (def.pattern = def.length === void 0 ? nanoid : nanoidOfLength(def.length)); + $ZodStringFormat.init(inst, def); +}); +/** +* @deprecated CUID v1 is deprecated by its authors due to information leakage +* (timestamps embedded in the id). Use {@link $ZodCUID2} instead. +* See https://github.com/paralleldrive/cuid. +*/ +var $ZodCUID = /*@__PURE__*/ $constructor("$ZodCUID", (inst, def) => { + def.pattern ?? (def.pattern = cuid); + $ZodStringFormat.init(inst, def); +}); +var $ZodCUID2 = /*@__PURE__*/ $constructor("$ZodCUID2", (inst, def) => { + def.pattern ?? (def.pattern = cuid2); + $ZodStringFormat.init(inst, def); +}); +var $ZodULID = /*@__PURE__*/ $constructor("$ZodULID", (inst, def) => { + def.pattern ?? (def.pattern = ulid); + $ZodStringFormat.init(inst, def); +}); +var $ZodXID = /*@__PURE__*/ $constructor("$ZodXID", (inst, def) => { + def.pattern ?? (def.pattern = xid); + $ZodStringFormat.init(inst, def); +}); +var $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => { + def.pattern ?? (def.pattern = ksuid); + $ZodStringFormat.init(inst, def); +}); +var $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => { + def.pattern ?? (def.pattern = datetime(def)); + $ZodStringFormat.init(inst, def); + if (def.local || def.precision === -1) { + inst._zod.bag.laxFormat = true; + inst._zod.onattach.push((s) => { + s._zod.bag.laxFormat = true; + }); + } +}); +var $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => { + def.pattern ?? (def.pattern = date); + $ZodStringFormat.init(inst, def); +}); +var $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => { + def.pattern ?? (def.pattern = time(def)); + $ZodStringFormat.init(inst, def); +}); +var $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => { + def.pattern ?? (def.pattern = duration); + $ZodStringFormat.init(inst, def); +}); +var $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => { + def.pattern ?? (def.pattern = ipv4); + $ZodStringFormat.init(inst, def); + inst._zod.bag.format = `ipv4`; +}); +/** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */ +var ipv6Alphabet = /^[0-9a-fA-F:.]+$/; +function isValidIPv6(value) { + if (!ipv6Alphabet.test(value)) return false; + try { + new URL(`http://[${value}]`); + return true; + } catch { + return false; + } +} +var $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => { + def.pattern ?? (def.pattern = ipv6); + $ZodStringFormat.init(inst, def); + inst._zod.bag.format = `ipv6`; + inst._zod.check = (payload) => { + if (!isValidIPv6(payload.value)) payload.issues.push({ + code: "invalid_format", + format: "ipv6", + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +var $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => { + def.pattern ?? (def.pattern = cidrv4); + $ZodStringFormat.init(inst, def); +}); +function isValidCIDRv6(value) { + const parts = value.split("/"); + if (parts.length !== 2) return false; + const [address, prefix] = parts; + if (!prefix) return false; + const prefixNum = Number(prefix); + if (`${prefixNum}` !== prefix) return false; + if (prefixNum < 0 || prefixNum > 128) return false; + return isValidIPv6(address); +} +var $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => { + def.pattern ?? (def.pattern = cidrv6); + $ZodStringFormat.init(inst, def); + inst._zod.check = (payload) => { + if (!isValidCIDRv6(payload.value)) payload.issues.push({ + code: "invalid_format", + format: "cidrv6", + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +function isValidBase64(data) { + if (data === "") return true; + if (/\s/.test(data)) return false; + if (data.length % 4 !== 0) return false; + try { + atob(data); + return true; + } catch { + return false; + } +} +var $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => { + def.pattern ?? (def.pattern = base64); + $ZodStringFormat.init(inst, def); + inst._zod.bag.contentEncoding = "base64"; + inst._zod.check = (payload) => { + if (isValidBase64(payload.value)) return; + payload.issues.push({ + code: "invalid_format", + format: "base64", + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +function isValidBase64URL(data) { + if (!base64url.test(data)) return false; + const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/"); + return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "=")); +} +var $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => { + def.pattern ?? (def.pattern = base64url); + $ZodStringFormat.init(inst, def); + inst._zod.bag.contentEncoding = "base64url"; + inst._zod.check = (payload) => { + if (isValidBase64URL(payload.value)) return; + payload.issues.push({ + code: "invalid_format", + format: "base64url", + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +var $ZodE164 = /*@__PURE__*/ $constructor("$ZodE164", (inst, def) => { + def.pattern ?? (def.pattern = e164); + $ZodStringFormat.init(inst, def); +}); +function isValidJWT(token, algorithm = null) { + try { + const tokensParts = token.split("."); + if (tokensParts.length !== 3) return false; + const [header] = tokensParts; + if (!header) return false; + const parsedHeader = JSON.parse(atob(header)); + if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false; + if (!parsedHeader.alg) return false; + if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false; + return true; + } catch { + return false; + } +} +var $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def) => { + $ZodStringFormat.init(inst, def); + inst._zod.check = (payload) => { + if (isValidJWT(payload.value, def.alg)) return; + payload.issues.push({ + code: "invalid_format", + format: "jwt", + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); +var $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.pattern = inst._zod.bag.pattern ?? number$1; + inst._zod.parse = (payload, _ctx) => { + if (def.coerce) try { + payload.value = Number(payload.value); + } catch (_) {} + const input = payload.value; + if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload; + const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? String(input) : void 0 : void 0; + payload.issues.push({ + expected: "number", + code: "invalid_type", + input, + inst, + ...received ? { received } : {} + }); + return payload; + }; +}); +var $ZodNumberFormat = /*@__PURE__*/ $constructor("$ZodNumberFormat", (inst, def) => { + $ZodCheckNumberFormat.init(inst, def); + $ZodNumber.init(inst, def); +}); +var $ZodBoolean = /*@__PURE__*/ $constructor("$ZodBoolean", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.pattern = boolean$1; + inst._zod.parse = (payload, _ctx) => { + if (def.coerce) try { + payload.value = Boolean(payload.value); + } catch (_) {} + const input = payload.value; + if (typeof input === "boolean") return payload; + payload.issues.push({ + expected: "boolean", + code: "invalid_type", + input, + inst + }); + return payload; + }; +}); +var $ZodUnknown = /*@__PURE__*/ $constructor("$ZodUnknown", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload) => payload; +}); +var $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload, _ctx) => { + payload.issues.push({ + expected: "never", + code: "invalid_type", + input: payload.value, + inst + }); + return payload; + }; +}); +function handleArrayResult(result, final, index) { + if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues)); + final.value[index] = result.value; +} +var $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => { + $ZodType.init(inst, def); + const memo = globalConfig.memoizer; + memo?.attach(inst); + inst._zod.parse = (payload, ctx) => { + const input = payload.value; + if (!Array.isArray(input)) { + payload.issues.push({ + expected: "array", + code: "invalid_type", + input, + inst + }); + return payload; + } + payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length); + const proms = []; + for (let i = 0; i < input.length; i++) { + const item = input[i]; + const result = def.element._zod.run({ + value: item, + issues: [] + }, ctx); + if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i))); + else handleArrayResult(result, payload, i); + } + if (proms.length) return Promise.all(proms).then(() => payload); + return payload; + }; +}); +function handlePropertyResult(result, final, key, input, optin, optout) { + const isPresent = key in input; + const isOptionalOut = optout === "optional"; + if (!isPresent && isOptionalOut && optin === "optional") return; + if (result.issues.length) { + if (optin !== void 0 && isOptionalOut && !isPresent) return; + final.issues.push(...prefixIssues(key, result.issues)); + } + if (!isPresent && optin === void 0) { + if (!result.issues.length) final.issues.push({ + code: "invalid_type", + expected: "nonoptional", + input: void 0, + path: [key] + }); + return; + } + if (result.value === void 0) { + if (isPresent) final.value[key] = void 0; + } else final.value[key] = result.value; +} +var NO_SYMBOL_KEYS = []; +function normalizeDef(def) { + const keys = Object.keys(def.shape); + const ownSymbols = Object.getOwnPropertySymbols(def.shape); + const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS; + const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys; + for (const k of allKeys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`); + const okeys = optionalKeys(def.shape); + return { + ...def, + allKeys, + symbolKeys, + keySet: new Set(keys), + numKeys: keys.length, + optionalKeys: new Set(okeys) + }; +} +function handleCatchall(proms, input, payload, ctx, def, inst) { + const unrecognized = []; + const keySet = def.keySet; + const _catchall = def.catchall._zod; + const t = _catchall.def.type; + const optin = _catchall.optin; + const optout = _catchall.optout; + for (const key in input) { + if (keySet.has(key)) continue; + if (key === "__proto__") { + if (t === "never") unrecognized.push(key); + continue; + } + if (t === "never") { + unrecognized.push(key); + continue; + } + const r = _catchall.run({ + value: input[key], + issues: [] + }, ctx); + if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout))); + else handlePropertyResult(r, payload, key, input, optin, optout); + } + if (unrecognized.length) payload.issues.push({ + code: "unrecognized_keys", + keys: unrecognized, + input, + inst, + continue: true + }); + if (!proms.length) return payload; + return Promise.all(proms).then(() => { + return payload; + }); +} +var propShapes = /* @__PURE__ */ new WeakMap(); +var $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => { + $ZodType.init(inst, def); + if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) { + const sh = def.shape; + propShapes.set(def, sh); + Object.defineProperty(def, "shape", { get: () => { + const newSh = { ...sh }; + Object.defineProperty(def, "shape", { value: newSh }); + propShapes.set(def, newSh); + return newSh; + } }); + } + const _normalized = cached(() => normalizeDef(def)); + defineLazyInternal(inst, "propValues", (zod) => { + const shape = zod.def.shape; + const propValues = {}; + for (const key in shape) { + const field = shape[key]._zod; + if (field.values) { + if (!Object.prototype.hasOwnProperty.call(propValues, key)) assignProp(propValues, key, /* @__PURE__ */ new Set()); + for (const v of field.values) propValues[key].add(v); + if (field.optin !== void 0) propValues[key].add(void 0); + } + } + return propValues; + }); + const isObject$1 = isObject; + const catchall = def.catchall; + let value; + const memo = globalConfig.memoizer; + memo?.attach(inst); + inst._zod.parse = (payload, ctx) => { + value ?? (value = _normalized.value); + const input = payload.value; + if (!isObject$1(input)) { + payload.issues.push({ + expected: "object", + code: "invalid_type", + input, + inst + }); + return payload; + } + payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {}; + const proms = []; + const shape = value.shape; + for (const key of value.allKeys) { + if (key === "__proto__") continue; + const el = shape[key]; + const optin = el._zod.optin; + const optout = el._zod.optout; + const r = el._zod.run({ + value: input[key], + issues: [] + }, ctx); + if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout))); + else handlePropertyResult(r, payload, key, input, optin, optout); + } + if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload; + return handleCatchall(proms, input, payload, ctx, _normalized.value, inst); + }; +}); +var $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => { + $ZodObject.init(inst, def); + const superParse = inst._zod.parse; + const _normalized = cached(() => normalizeDef(def)); + const memo = globalConfig.memoizer; + const generateFastpass = (shape) => { + const normalized = _normalized.value; + const syms = normalized.symbolKeys; + const doc = new Doc(["payload", "ctx"], { + shape, + inst, + memo, + syms + }); + const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`; + const prefixStr = (id, k) => ` + for (let i = 0; i < ${id}.issues.length; i++) { + const iss = ${id}.issues[i]; + iss.path = iss.path ? [${k}, ...iss.path] : [${k}]; + payload.issues.push(iss); + }`; + doc.write(`const input = payload.value;`); + const ids = Object.create(null); + let counter = 0; + for (const key of normalized.allKeys) ids[key] = `key_${counter++}`; + doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`); + for (const key of normalized.allKeys) { + if (key === "__proto__") continue; + const id = ids[key]; + const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key); + const isPresent = `${k} in input`; + const schema = shape[key]; + const optin = schema?._zod?.optin; + const isOptionalIn = optin !== void 0; + const isOptionalOut = schema?._zod?.optout === "optional"; + doc.write(`const ${id} = ${parseStr(k)};`); + if (isOptionalIn && isOptionalOut) { + const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`; + doc.write(` + const ${id}_present = ${isPresent}; + if (!${id}.issues.length || ${id}_present) { + if (${id}.issues.length) {${prefixStr(id, k)} + } + + if (${assign}) { + newResult[${k}] = ${id}.value; + } + } + + `); + } else if (!isOptionalIn) doc.write(` + const ${id}_present = ${isPresent}; + if (${id}.issues.length) {${prefixStr(id, k)} + } + if (!${id}_present && !${id}.issues.length) { + payload.issues.push({ + code: "invalid_type", + expected: "nonoptional", + input: undefined, + path: [${k}] + }); + } + + if (${id}_present) { + newResult[${k}] = ${id}.value; + } + + `); + else doc.write(` + if (${id}.issues.length) {${prefixStr(id, k)} + } + + if (${id}.value === undefined) { + if (${isPresent}) { + newResult[${k}] = undefined; + } + } else { + newResult[${k}] = ${id}.value; + } + + `); + } + doc.write(`payload.value = newResult;`); + doc.write(`return payload;`); + return doc.compile(); + }; + let fastpass; + const isObject$2 = isObject; + const jit = !globalConfig.jitless; + const fastEnabled = jit && allowsEval.value; + const catchall = def.catchall; + let value; + inst._zod.parse = (payload, ctx) => { + value ?? (value = _normalized.value); + const input = payload.value; + if (!isObject$2(input)) { + payload.issues.push({ + expected: "object", + code: "invalid_type", + input, + inst + }); + return payload; + } + if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) { + if (!fastpass) fastpass = generateFastpass(def.shape); + payload = fastpass(payload, ctx); + if (!catchall) return payload; + return handleCatchall([], input, payload, ctx, value, inst); + } + return superParse(payload, ctx); + }; +}); +function handleUnionResults(results, final, inst, ctx) { + for (const result of results) if (result.issues.length === 0) { + final.value = result.value; + return final; + } + const nonaborted = results.filter((r) => !aborted(r)); + if (nonaborted.length === 1) { + final.value = nonaborted[0].value; + return nonaborted[0]; + } + final.issues.push({ + code: "invalid_union", + input: final.value, + inst, + errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config()))) + }); + return final; +} +var $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => { + $ZodType.init(inst, def); + defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted") ? "defaulted" : zod.def.options.some((o) => o._zod.optin !== void 0) ? "optional" : void 0); + defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0); + defineLazyInternal(inst, "values", (zod) => { + if (zod.def.options.every((o) => o._zod.values)) return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values))); + }); + defineLazyInternal(inst, "pattern", (zod) => { + if (zod.def.options.every((o) => o._zod.pattern)) { + const patterns = zod.def.options.map((o) => o._zod.pattern); + return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`); + } + }); + const first = def.options.length === 1 ? def.options[0]._zod.run : null; + inst._zod.parse = (payload, ctx) => { + if (first) return first(payload, ctx); + let async = false; + const results = []; + for (const option of def.options) { + const result = option._zod.run({ + value: payload.value, + issues: [] + }, ctx); + if (result instanceof Promise) { + results.push(result); + async = true; + } else { + if (result.issues.length === 0) return result; + results.push(result); + } + } + if (!async) return handleUnionResults(results, payload, inst, ctx); + return Promise.all(results).then((results) => { + return handleUnionResults(results, payload, inst, ctx); + }); + }; +}); +var $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.parse = (payload, ctx) => { + const input = payload.value; + const left = def.left._zod.run({ + value: input, + issues: [] + }, ctx); + const right = def.right._zod.run({ + value: input, + issues: [] + }, ctx); + if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left, right]) => { + return handleIntersectionResults(payload, left, right); + }); + return handleIntersectionResults(payload, left, right); + }; +}); +function mergeValues(a, b) { + if (a === b) return { + valid: true, + data: a + }; + if (a instanceof Date && b instanceof Date && +a === +b) return { + valid: true, + data: a + }; + if (isPlainObject(a) && isPlainObject(b)) { + const bKeys = Object.keys(b); + const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1); + const newObj = { + ...a, + ...b + }; + if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) delete newObj.__proto__; + for (const key of sharedKeys) { + if (key === "__proto__") continue; + const sharedValue = mergeValues(a[key], b[key]); + if (!sharedValue.valid) return { + valid: false, + mergeErrorPath: [key, ...sharedValue.mergeErrorPath] + }; + newObj[key] = sharedValue.data; + } + return { + valid: true, + data: newObj + }; + } + if (Array.isArray(a) && Array.isArray(b)) { + if (a.length !== b.length) return { + valid: false, + mergeErrorPath: [] + }; + const newArray = []; + for (let index = 0; index < a.length; index++) { + const itemA = a[index]; + const itemB = b[index]; + const sharedValue = mergeValues(itemA, itemB); + if (!sharedValue.valid) return { + valid: false, + mergeErrorPath: [index, ...sharedValue.mergeErrorPath] + }; + newArray.push(sharedValue.data); + } + return { + valid: true, + data: newArray + }; + } + return { + valid: false, + mergeErrorPath: [] + }; +} +function handleIntersectionResults(result, left, right) { + const unrecKeys = /* @__PURE__ */ new Map(); + let unrecIssue; + const keyIssues = /* @__PURE__ */ new Map(); + const collect = (iss, side) => { + let keys; + if (iss.code === "unrecognized_keys" && !iss.path?.length) { + unrecIssue ?? (unrecIssue = iss); + keys = iss.keys; + } else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) { + const k = String(iss.path[0]); + if (!keyIssues.has(k)) keyIssues.set(k, iss); + keys = [k]; + } else return false; + for (const k of keys) { + if (!unrecKeys.has(k)) unrecKeys.set(k, {}); + unrecKeys.get(k)[side] = true; + } + return true; + }; + for (const iss of left.issues) if (!collect(iss, "l")) result.issues.push(iss); + for (const iss of right.issues) if (!collect(iss, "r")) result.issues.push(iss); + const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k); + if (bothKeys.length) { + const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : []; + if (aggregated.length) result.issues.push({ + ...unrecIssue, + keys: aggregated + }); + for (const k of bothKeys) if (!aggregated.includes(k) && keyIssues.has(k)) result.issues.push(keyIssues.get(k)); + } + const merged = mergeValues(left.value, right.value); + if (!merged.valid) { + if (aborted(result)) return result; + throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`); + } + result.value = merged.data; + return result; +} +var $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => { + $ZodType.init(inst, def); + const values = getEnumValues(def.entries); + const valuesSet = new Set(values); + inst._zod.values = valuesSet; + const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k)); + inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$"); + inst._zod.parse = (payload, _ctx) => { + const input = payload.value; + if (valuesSet.has(input)) return payload; + payload.issues.push({ + code: "invalid_value", + values, + input, + inst + }); + return payload; + }; +}); +var $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.optin = "optional"; + globalConfig.memoizer?.guard(inst); + inst._zod.parse = (payload, ctx) => { + if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name); + const _out = def.transform(payload.value, payload); + if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => { + payload.value = output; + return payload; + }); + if (_out instanceof Promise) throw new $ZodAsyncError(); + payload.value = _out; + return payload; + }; +}); +function handleOptionalResult(payload, result) { + payload.value = result.issues.length ? void 0 : result.value; + return payload; +} +var $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => { + $ZodType.init(inst, def); + defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional"); + inst._zod.optout = "optional"; + defineLazyInternal(inst, "values", (zod) => { + const values = zod.def.innerType._zod.values; + return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0; + }); + defineLazyInternal(inst, "pattern", (zod) => { + const pattern = zod.def.innerType._zod.pattern; + return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0; + }); + inst._zod.parse = (payload, ctx) => { + if (payload.value === void 0) { + if (def.innerType._zod.optin !== "defaulted") return payload; + const result = def.innerType._zod.run({ + value: payload.value, + issues: [] + }, ctx); + if (result instanceof Promise) return result.then((result) => handleOptionalResult(payload, result)); + return handleOptionalResult(payload, result); + } + return def.innerType._zod.run(payload, ctx); + }; +}); +var $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => { + $ZodOptional.init(inst, def); + defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values); + defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern); + inst._zod.parse = (payload, ctx) => { + return def.innerType._zod.run(payload, ctx); + }; +}); +var $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => { + $ZodType.init(inst, def); + defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin); + defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout); + defineLazyInternal(inst, "pattern", (zod) => { + const pattern = zod.def.innerType._zod.pattern; + return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0; + }); + defineLazyInternal(inst, "values", (zod) => { + return zod.def.innerType._zod.values ? /* @__PURE__ */ new Set([...zod.def.innerType._zod.values, null]) : void 0; + }); + inst._zod.parse = (payload, ctx) => { + if (payload.value === null) return payload; + return def.innerType._zod.run(payload, ctx); + }; +}); +var $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.optin = "defaulted"; + defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values); + inst._zod.parse = (payload, ctx) => { + if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx); + if (payload.value === void 0) { + payload.value = def.defaultValue; + /** + * $ZodDefault returns the default value immediately in forward direction. + * It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */ + return payload; + } + const result = def.innerType._zod.run(payload, ctx); + if (result instanceof Promise) return result.then((result) => handleDefaultResult(result, def)); + return handleDefaultResult(result, def); + }; +}); +function handleDefaultResult(payload, def) { + if (payload.value === void 0) payload.value = def.defaultValue; + return payload; +} +var $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => { + $ZodType.init(inst, def); + inst._zod.optin = "defaulted"; + defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values); + inst._zod.parse = (payload, ctx) => { + if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx); + if (payload.value === void 0) payload.value = def.defaultValue; + return def.innerType._zod.run(payload, ctx); + }; +}); +var $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => { + $ZodType.init(inst, def); + defineLazyInternal(inst, "values", (zod) => { + const v = zod.def.innerType._zod.values; + return v ? new Set([...v].filter((x) => x !== void 0)) : void 0; + }); + inst._zod.parse = (payload, ctx) => { + const result = def.innerType._zod.run(payload, ctx); + if (result instanceof Promise) return result.then((result) => handleNonOptionalResult(result, inst)); + return handleNonOptionalResult(result, inst); + }; +}); +function handleNonOptionalResult(payload, inst) { + if (!payload.issues.length && payload.value === void 0) payload.issues.push({ + code: "invalid_type", + expected: "nonoptional", + input: payload.value, + inst + }); + return payload; +} +function handleCatchResult(payload, result, def, ctx) { + if (!result.issues.length) { + payload.value = result.value; + if (result.memo) payload.memo = true; + return payload; + } + payload.value = def.catchValue({ + ...result, + value: payload.value, + error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) }, + input: payload.value + }); + return payload; +} +var $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => { + $ZodType.init(inst, def); + defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional"); + defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout); + defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values); + inst._zod.parse = (payload, ctx) => { + if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx); + const result = def.innerType._zod.run({ + value: payload.value, + issues: [] + }, ctx); + if (result instanceof Promise) return result.then((result) => handleCatchResult(payload, result, def, ctx)); + return handleCatchResult(payload, result, def, ctx); + }; +}); +var $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => { + $ZodType.init(inst, def); + defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values); + defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin); + defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout); + defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues); + inst._zod.parse = (payload, ctx) => { + if (ctx.direction === "backward") { + const right = def.out._zod.run(payload, ctx); + if (right instanceof Promise) return right.then((right) => handlePipeResult(right, def.in, ctx)); + return handlePipeResult(right, def.in, ctx); + } + const left = def.in._zod.run(payload, ctx); + if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def.out, ctx)); + return handlePipeResult(left, def.out, ctx); + }; +}); +function handlePipeResult(left, next, ctx) { + if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) { + left.aborted = true; + return left; + } + return next._zod.run({ + value: left.value, + issues: left.issues + }, ctx); +} +var $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => { + $ZodType.init(inst, def); + defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues); + defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values); + defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin); + defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout); + inst._zod.parse = (payload, ctx) => { + if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx); + const result = def.innerType._zod.run(payload, ctx); + if (result instanceof Promise) return result.then(handleReadonlyResult); + return handleReadonlyResult(result); + }; +}); +function handleReadonlyResult(payload) { + if (!payload.memo) payload.value = Object.freeze(payload.value); + return payload; +} +var $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => { + $ZodCheck.init(inst, def); + $ZodType.init(inst, def); + inst._zod.parse = (payload, _) => { + return payload; + }; + inst._zod.check = (payload) => { + const input = payload.value; + const r = def.fn(input); + if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst)); + handleRefineResult(r, payload, input, inst); + }; +}); +function handleRefineResult(result, payload, input, inst) { + if (!result) { + const _iss = { + code: "custom", + input, + inst, + path: [...inst._zod.def.path ?? []], + continue: !inst._zod.def.abort + }; + if (inst._zod.def.params) _iss.params = inst._zod.def.params; + payload.issues.push(issue(_iss)); + } +} +//#endregion +//#region node_modules/zod/v4/core/memoizer.js +var $ZodCyclicError = class extends Error { + constructor() { + super(`Cannot parse a reference cycle that closes through a transform`); + this.name = "ZodCyclicError"; + } +}; +/** Keyed off the context object every schema in one parse call already shares. */ +var STATE = "~memo"; +var NO_ISSUES = []; +function cloneIssues(issues) { + return issues.map((iss) => iss.path ? { + ...iss, + path: iss.path.slice() + } : { ...iss }); +} +var recursive = /*@__PURE__*/ new WeakMap(); +/** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */ +function isRecursive(inst, stack) { + const cached = recursive.get(inst); + if (cached !== void 0) return cached; + if (stack.has(inst)) return true; + stack.add(inst); + let result = false; + const check = (child) => { + if (!result && child?._zod && isRecursive(child, stack)) result = true; + }; + const def = inst._zod.def; + switch (def.type) { + case "object": + for (const key of Reflect.ownKeys(def.shape)) check(def.shape[key]); + check(def.catchall); + break; + case "array": + check(def.element); + break; + case "tuple": + for (const el of def.items) check(el); + check(def.rest); + break; + case "record": + case "map": + check(def.keyType); + check(def.valueType); + break; + case "set": + check(def.valueType); + break; + case "union": + for (const el of def.options) check(el); + break; + case "intersection": + check(def.left); + check(def.right); + break; + case "optional": + case "nullable": + case "default": + case "prefault": + case "catch": + case "readonly": + case "nonoptional": + case "promise": + case "success": + check(def.innerType); + break; + case "pipe": + check(def.in); + check(def.out); + break; + case "function": + check(def.input); + check(def.output); + break; + case "lazy": + check(inst._zod.innerType); + break; + case "template_literal": + case "string": + case "number": + case "int": + case "boolean": + case "bigint": + case "symbol": + case "undefined": + case "null": + case "void": + case "never": + case "any": + case "unknown": + case "date": + case "nan": + case "enum": + case "literal": + case "file": + case "transform": + case "custom": break; + default: for (const key in def) { + const desc = Object.getOwnPropertyDescriptor(def, key); + if (!desc || desc.get) continue; + const value = desc.value; + if (!value || typeof value !== "object") continue; + if (value._zod) check(value); + else if (Array.isArray(value)) for (const el of value) check(el); + } + } + stack.delete(inst); + recursive.set(inst, result); + return result; +} +function bucketFor(state, inst) { + let bucket = state.buckets.get(inst); + if (!bucket) { + bucket = /* @__PURE__ */ new Map(); + state.buckets.set(inst, bucket); + } + return bucket; +} +var handoff; +var open = []; +var memo = { + alloc(_inst, payload, empty) { + const bucket = handoff; + if (!bucket) return empty; + handoff = void 0; + const entry = { + value: empty, + issues: null + }; + bucket.set(payload.value, entry); + open.push(entry); + return empty; + }, + guard(inst) { + var _a; + (_a = inst._zod).deferred ?? (_a.deferred = []); + inst._zod.deferred.push(() => { + const base = inst._zod.parse; + const wrapped = (payload, ctx) => { + if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value)) throw new $ZodCyclicError(); + return base(payload, ctx); + }; + inst._zod.parse = wrapped; + if (inst._zod.run === base) inst._zod.run = wrapped; + }); + }, + attach(inst) { + var _a; + let isRecursiveInst; + let lastCtx; + let lastBucket; + (_a = inst._zod).deferred ?? (_a.deferred = []); + inst._zod.deferred.push(() => { + const base = inst._zod.parse; + const wrapped = (payload, ctx) => { + if (isRecursiveInst === void 0) { + isRecursiveInst = isRecursive(inst, /* @__PURE__ */ new Set()); + if (!isRecursiveInst) { + inst._zod.parse = base; + if (inst._zod.run === wrapped) inst._zod.run = base; + return base(payload, ctx); + } + } + const input = payload.value; + if (input === null || typeof input !== "object") return base(payload, ctx); + let state = ctx[STATE]; + if (!state) { + state = { + buckets: /* @__PURE__ */ new Map(), + backEdges: void 0 + }; + ctx[STATE] = state; + } + let bucket; + if (lastCtx === ctx) bucket = lastBucket; + else { + bucket = bucketFor(state, inst); + lastCtx = ctx; + lastBucket = bucket; + } + const hit = bucket.get(input); + if (hit) { + payload.value = hit.value; + if (hit.issues) { + if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues)); + } else { + payload.memo = true; + state.backEdges ?? (state.backEdges = /* @__PURE__ */ new Set()); + state.backEdges.add(hit.value); + } + return payload; + } + handoff = bucket; + const depth = open.length; + const result = base(payload, ctx); + handoff = void 0; + const entry = open.length > depth ? open.pop() : void 0; + if (result instanceof Promise) return result.then((r) => { + if (entry) entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES; + return r; + }); + if (entry) entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES; + return result; + }; + inst._zod.parse = wrapped; + if (inst._zod.run === base) inst._zod.run = wrapped; + }); + } +}; +/** The memoizer that gives containers cycle support. `zod` installs it by default; `zod/mini` opts in with `config({ memoizer: memoizer() })`. */ +function memoizer() { + return memo; +} +/** Whether this value is a node a back-edge resolved to before it finished. */ +function isBackEdge(ctx, value) { + const backEdges = ctx[STATE]?.backEdges; + return backEdges !== void 0 && value !== null && typeof value === "object" && backEdges.has(value); +} +//#endregion +//#region node_modules/zod/v4/locales/en.js +var error = () => { + const Sizable = { + string: { + unit: "characters", + verb: "to have" + }, + file: { + unit: "bytes", + verb: "to have" + }, + array: { + unit: "items", + verb: "to have" + }, + set: { + unit: "items", + verb: "to have" + }, + map: { + unit: "entries", + verb: "to have" + } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const FormatDictionary = { + regex: "input", + email: "email address", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO datetime", + date: "ISO date", + time: "ISO time", + duration: "ISO duration", + ipv4: "IPv4 address", + ipv6: "IPv6 address", + mac: "MAC address", + cidrv4: "IPv4 range", + cidrv6: "IPv6 range", + base64: "base64-encoded string", + base64url: "base64url-encoded string", + json_string: "JSON string", + e164: "E.164 number", + credit_card: "credit card number", + jwt: "JWT", + template_literal: "input" + }; + const TypeDictionary = { nan: "NaN" }; + function getTypeName(type, input) { + if (type === "number" && typeof input === "number" && !Number.isFinite(input)) return String(input); + return TypeDictionary[type] ?? type; + } + return (issue) => { + switch (issue.code) { + case "invalid_type": return `Invalid input: expected ${getTypeName(issue.expected)}, received ${getTypeName(parsedType(issue.input), issue.input)}`; + case "invalid_value": + if (issue.values.length === 1) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`; + return `Invalid option: expected one of ${joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`; + return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.exact ? "exactly " : issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`; + return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue; + if (_issue.format === "starts_with") return `Invalid string: must start with "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`; + if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`; + if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`; + return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": return `Invalid number: must be a multiple of ${issue.divisor}`; + case "unrecognized_keys": return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`; + case "invalid_key": return `Invalid key in ${issue.origin}`; + case "invalid_union": + if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) return `Invalid discriminator value. Expected ${issue.options.map((o) => `'${o}'`).join(" | ")}`; + if (issue.inclusive === false) return "Invalid input: more than one option matched"; + return "Invalid input"; + case "invalid_element": return `Invalid value in ${issue.origin}`; + default: return `Invalid input`; + } + }; +}; +function en_default() { + return { localeError: error() }; +} +//#endregion +//#region node_modules/zod/v4/core/registries.js +var _a; +var $ZodRegistry = class { + constructor() { + this._map = /* @__PURE__ */ new WeakMap(); + this._idmap = /* @__PURE__ */ new Map(); + } + add(schema, ..._meta) { + const meta = _meta[0]; + this._map.set(schema, meta); + if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema); + return this; + } + clear() { + this._map = /* @__PURE__ */ new WeakMap(); + this._idmap = /* @__PURE__ */ new Map(); + return this; + } + remove(schema) { + const meta = this._map.get(schema); + if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id); + this._map.delete(schema); + return this; + } + get(schema) { + const p = schema._zod.parent; + if (p) { + const pm = { ...this.get(p) ?? {} }; + delete pm.id; + const f = { + ...pm, + ...this._map.get(schema) + }; + return Object.keys(f).length ? f : void 0; + } + return this._map.get(schema); + } + has(schema) { + return this._map.has(schema); + } +}; +function registry() { + return new $ZodRegistry(); +} +(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry()); +var globalRegistry = globalThis.__zod_globalRegistry; +//#endregion +//#region node_modules/zod/v4/core/api.js +// @__NO_SIDE_EFFECTS__ +function _string(Class, params) { + return new Class({ + type: "string", + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _email(Class, params) { + return new Class({ + type: "string", + format: "email", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _guid(Class, params) { + return new Class({ + type: "string", + format: "guid", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _uuid(Class, params) { + return new Class({ + type: "string", + format: "uuid", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _uuidv4(Class, params) { + return new Class({ + type: "string", + format: "uuid", + check: "string_format", + abort: false, + version: "v4", + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _uuidv6(Class, params) { + return new Class({ + type: "string", + format: "uuid", + check: "string_format", + abort: false, + version: "v6", + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _uuidv7(Class, params) { + return new Class({ + type: "string", + format: "uuid", + check: "string_format", + abort: false, + version: "v7", + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _url(Class, params) { + return new Class({ + type: "string", + format: "url", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _emoji(Class, params) { + return new Class({ + type: "string", + format: "emoji", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _nanoid(Class, params) { + return new Class({ + type: "string", + format: "nanoid", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +/** +* @deprecated CUID v1 is deprecated by its authors due to information leakage +* (timestamps embedded in the id). Use {@link _cuid2} instead. +* See https://github.com/paralleldrive/cuid. +*/ +// @__NO_SIDE_EFFECTS__ +function _cuid(Class, params) { + return new Class({ + type: "string", + format: "cuid", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _cuid2(Class, params) { + return new Class({ + type: "string", + format: "cuid2", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _ulid(Class, params) { + return new Class({ + type: "string", + format: "ulid", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _xid(Class, params) { + return new Class({ + type: "string", + format: "xid", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _ksuid(Class, params) { + return new Class({ + type: "string", + format: "ksuid", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _ipv4(Class, params) { + return new Class({ + type: "string", + format: "ipv4", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _ipv6(Class, params) { + return new Class({ + type: "string", + format: "ipv6", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _cidrv4(Class, params) { + return new Class({ + type: "string", + format: "cidrv4", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _cidrv6(Class, params) { + return new Class({ + type: "string", + format: "cidrv6", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _base64(Class, params) { + return new Class({ + type: "string", + format: "base64", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _base64url(Class, params) { + return new Class({ + type: "string", + format: "base64url", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _e164(Class, params) { + return new Class({ + type: "string", + format: "e164", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _jwt(Class, params) { + return new Class({ + type: "string", + format: "jwt", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _isoDateTime(Class, params) { + return new Class({ + type: "string", + format: "datetime", + check: "string_format", + offset: false, + local: false, + precision: null, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _isoDate(Class, params) { + return new Class({ + type: "string", + format: "date", + check: "string_format", + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _isoTime(Class, params) { + return new Class({ + type: "string", + format: "time", + check: "string_format", + precision: null, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _isoDuration(Class, params) { + return new Class({ + type: "string", + format: "duration", + check: "string_format", + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _number(Class, params) { + return new Class({ + type: "number", + checks: [], + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _int(Class, params) { + return new Class({ + type: "number", + check: "number_format", + abort: false, + format: "safeint", + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _float32(Class, params) { + return new Class({ + type: "number", + check: "number_format", + abort: false, + format: "float32", + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _boolean(Class, params) { + return new Class({ + type: "boolean", + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _unknown(Class) { + return new Class({ type: "unknown" }); +} +// @__NO_SIDE_EFFECTS__ +function _never(Class, params) { + return new Class({ + type: "never", + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _lt(value, params) { + return new $ZodCheckLessThan({ + check: "less_than", + ...normalizeParams(params), + value, + inclusive: false + }); +} +// @__NO_SIDE_EFFECTS__ +function _lte(value, params) { + return new $ZodCheckLessThan({ + check: "less_than", + ...normalizeParams(params), + value, + inclusive: true + }); +} +// @__NO_SIDE_EFFECTS__ +function _gt(value, params) { + return new $ZodCheckGreaterThan({ + check: "greater_than", + ...normalizeParams(params), + value, + inclusive: false + }); +} +// @__NO_SIDE_EFFECTS__ +function _gte(value, params) { + return new $ZodCheckGreaterThan({ + check: "greater_than", + ...normalizeParams(params), + value, + inclusive: true + }); +} +// @__NO_SIDE_EFFECTS__ +function _multipleOf(value, params) { + return new $ZodCheckMultipleOf({ + check: "multiple_of", + ...normalizeParams(params), + value + }); +} +// @__NO_SIDE_EFFECTS__ +function _maxLength(maximum, params) { + return new $ZodCheckMaxLength({ + check: "max_length", + ...normalizeParams(params), + maximum + }); +} +// @__NO_SIDE_EFFECTS__ +function _minLength(minimum, params) { + return new $ZodCheckMinLength({ + check: "min_length", + ...normalizeParams(params), + minimum + }); +} +// @__NO_SIDE_EFFECTS__ +function _length(length, params) { + return new $ZodCheckLengthEquals({ + check: "length_equals", + ...normalizeParams(params), + length + }); +} +// @__NO_SIDE_EFFECTS__ +function _regex(pattern, params) { + return new $ZodCheckRegex({ + check: "string_format", + format: "regex", + ...normalizeParams(params), + pattern + }); +} +// @__NO_SIDE_EFFECTS__ +function _lowercase(params) { + return new $ZodCheckLowerCase({ + check: "string_format", + format: "lowercase", + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _uppercase(params) { + return new $ZodCheckUpperCase({ + check: "string_format", + format: "uppercase", + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _includes(includes, params) { + return new $ZodCheckIncludes({ + check: "string_format", + format: "includes", + ...normalizeParams(params), + includes + }); +} +// @__NO_SIDE_EFFECTS__ +function _startsWith(prefix, params) { + return new $ZodCheckStartsWith({ + check: "string_format", + format: "starts_with", + ...normalizeParams(params), + prefix + }); +} +// @__NO_SIDE_EFFECTS__ +function _endsWith(suffix, params) { + return new $ZodCheckEndsWith({ + check: "string_format", + format: "ends_with", + ...normalizeParams(params), + suffix + }); +} +// @__NO_SIDE_EFFECTS__ +function _overwrite(tx) { + return new $ZodCheckOverwrite({ + check: "overwrite", + tx + }); +} +// @__NO_SIDE_EFFECTS__ +function _normalize(form) { + return /* @__PURE__ */ _overwrite((input) => input.normalize(form)); +} +// @__NO_SIDE_EFFECTS__ +function _trim() { + return /* @__PURE__ */ _overwrite((input) => input.trim()); +} +// @__NO_SIDE_EFFECTS__ +function _toLowerCase() { + return /* @__PURE__ */ _overwrite((input) => input.toLowerCase()); +} +// @__NO_SIDE_EFFECTS__ +function _toUpperCase() { + return /* @__PURE__ */ _overwrite((input) => input.toUpperCase()); +} +// @__NO_SIDE_EFFECTS__ +function _slugify() { + return /* @__PURE__ */ _overwrite((input) => slugify(input)); +} +// @__NO_SIDE_EFFECTS__ +function _array(Class, element, params) { + return new Class({ + type: "array", + element, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _refine(Class, fn, _params) { + return new Class({ + type: "custom", + check: "custom", + fn, + ...normalizeParams(_params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _superRefine(fn, params) { + const ch = /* @__PURE__ */ _check((payload) => { + payload.addIssue = (issue$2) => { + if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, ch._zod.def)); + else { + const _issue = issue$2; + if (_issue.fatal) _issue.continue = false; + _issue.code ?? (_issue.code = "custom"); + if (!("input" in _issue)) _issue.input = payload.value; + _issue.inst ?? (_issue.inst = ch); + _issue.continue ?? (_issue.continue = !ch._zod.def.abort); + payload.issues.push(issue(_issue)); + } + }; + return fn(payload.value, payload); + }, params); + return ch; +} +// @__NO_SIDE_EFFECTS__ +function _check(fn, params) { + const ch = new $ZodCheck({ + check: "custom", + ...normalizeParams(params) + }); + ch._zod.check = fn; + return ch; +} +//#endregion +//#region node_modules/zod/v4/core/to-json-schema.js +function assignProps(target, ...sources) { + for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]); + return target; +} +function initializeContext(params) { + let target = params?.target ?? "draft-2020-12"; + if (target === "draft-4") target = "draft-04"; + if (target === "draft-7") target = "draft-07"; + return { + processors: params.processors ?? {}, + metadataRegistry: params?.metadata ?? globalRegistry, + target, + unrepresentable: params?.unrepresentable ?? "throw", + override: params?.override ?? (() => {}), + io: params?.io ?? "output", + counter: 0, + seen: /* @__PURE__ */ new Map(), + sharedDefsExtractedFor: void 0, + sharedEmitDoneFor: void 0, + cycles: params?.cycles ?? "ref", + reused: params?.reused ?? "inline", + intersections: [], + deferred: [], + external: params?.external ?? void 0 + }; +} +/** +* Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws +* `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a +* custom JSON Schema was written into `json`, in which case the caller must not write its own. +*/ +function handleUnrepresentable(schema, ctx, json, params, message) { + const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ + zodSchema: schema, + path: params.path, + message + }) : ctx.unrepresentable; + if (result === "any") return false; + if (result === void 0 || result === "throw") throw new Error(message); + Object.assign(json, result); + return true; +} +function process(schema, ctx, _params = { + path: [], + schemaPath: [] +}) { + var _a; + const def = schema._zod.def; + const seen = ctx.seen.get(schema); + if (seen) { + seen.count++; + if (_params.schemaPath.includes(schema)) seen.cycle = _params.path; + return seen.schema; + } + const result = { + schema: {}, + count: 1, + cycle: void 0, + path: _params.path + }; + ctx.seen.set(schema, result); + ctx.sharedDefsExtractedFor = void 0; + ctx.sharedEmitDoneFor = void 0; + const overrideSchema = schema._zod.toJSONSchema?.(); + if (overrideSchema) result.schema = overrideSchema; + else { + const params = { + ..._params, + schemaPath: [..._params.schemaPath, schema], + path: _params.path + }; + if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params); + else { + const _json = result.schema; + const processor = ctx.processors[def.type]; + if (!processor) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`); + processor(schema, ctx, _json, params); + } + const parent = schema._zod.parent; + if (parent) { + if (!result.ref) result.ref = parent; + process(parent, ctx, params); + ctx.seen.get(parent).isParent = true; + } + } + const meta = ctx.metadataRegistry.get(schema); + if (meta) assignProps(result.schema, meta); + if (ctx.io === "input" && isTransforming(schema)) { + delete result.schema.examples; + delete result.schema.default; + } + if (ctx.io === "input" && "_prefault" in result.schema) (_a = result.schema).default ?? (_a.default = result.schema._prefault); + delete result.schema._prefault; + return ctx.seen.get(schema).schema; +} +function encodeJSONPointerSegment(segment) { + return segment.replace(/~/g, "~0").replace(/\//g, "~1"); +} +function extractDefs(ctx, schema) { + const root = ctx.seen.get(schema); + if (!root) throw new Error("Unprocessed schema. This is a bug in Zod."); + if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external) return; + const idToSchema = /* @__PURE__ */ new Map(); + for (const entry of ctx.seen.entries()) { + const id = ctx.metadataRegistry.get(entry[0])?.id; + if (id) { + const existing = idToSchema.get(id); + if (existing && existing !== entry[0]) throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`); + idToSchema.set(id, entry[0]); + } + } + const makeURI = (entry) => { + const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions"; + if (ctx.external) { + const externalId = ctx.external.registry.get(entry[0])?.id; + const uriGenerator = ctx.external.uri ?? ((id) => id); + if (externalId) return { ref: uriGenerator(externalId) }; + const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`; + entry[1].defId = id; + return { + defId: id, + ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}` + }; + } + const uriPrefix = `#`; + const defUriPrefix = `${uriPrefix}/${defsSegment}/`; + if (entry[1] === root && !entry[1].schema.id) return { ref: uriPrefix }; + const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`; + return { + defId, + ref: defUriPrefix + encodeJSONPointerSegment(defId) + }; + }; + const extractToDef = (entry) => { + if (entry[1].schema.$ref) return; + const seen = entry[1]; + const { ref, defId } = makeURI(entry); + seen.def = { ...seen.schema }; + if (defId) seen.defId = defId; + const schema = seen.schema; + for (const key in schema) delete schema[key]; + schema.$ref = ref; + }; + if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) { + const seen = entry[1]; + if (seen.cycle) throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/ + +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`); + } + for (const entry of ctx.seen.entries()) { + const seen = entry[1]; + if (schema === entry[0]) { + extractToDef(entry); + continue; + } + if (ctx.external) { + const ext = ctx.external.registry.get(entry[0])?.id; + if (schema !== entry[0] && ext) { + extractToDef(entry); + continue; + } + } + if (ctx.metadataRegistry.get(entry[0])?.id) { + extractToDef(entry); + continue; + } + if (seen.cycle) { + extractToDef(entry); + continue; + } + if (seen.count > 1) { + if (ctx.reused === "ref") { + extractToDef(entry); + continue; + } + } + } + if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external; +} +/** Rewrites `anyOf: [{type: "a"}, {type: "b"}]` to `type: ["a", "b"]`, which every JSON Schema draft treats as equivalent and most consumers render far better for the nullable case. Only branches that are a bare type assertion qualify — anything carrying a constraint, `$ref`, `const` or metadata is left alone. Runs after `flattenRef`, so a branch an override decorated or `$defs` extraction turned into a `$ref` is no longer bare and correctly stays in `anyOf`. `oneOf` is excluded: `integer` and `number` overlap, so "exactly one" and "at least one" are not the same there. OpenAPI 3.0 is excluded: its `type` must be a single string. */ +function compactTypeUnion(schema) { + const options = schema.anyOf; + if (!Array.isArray(options) || options.length === 0 || schema.type !== void 0) return; + const types = []; + for (const option of options) { + if (!option || typeof option !== "object") return; + compactTypeUnion(option); + const keys = Object.keys(option); + if (keys.length !== 1 || keys[0] !== "type") return; + const type = option.type; + for (const member of Array.isArray(type) ? type : [type]) { + if (typeof member !== "string") return; + if (!types.includes(member)) types.push(member); + } + } + delete schema.anyOf; + schema.type = types.length === 1 ? types[0] : types; +} +/** Keywords `foldIntersection` knows how to combine. Anything else — `$ref`, `patternProperties`, +* an annotation like `description` — makes a member unfoldable, so a constraint this does not +* understand leaves the `allOf` alone instead of being silently dropped or misattributed. */ +var FOLDABLE_KEYS = /* @__PURE__ */ new Set([ + "type", + "properties", + "required", + "additionalProperties" +]); +var UNION_KEYS = ["oneOf", "anyOf"]; +/** A member's constraint on a key it does not declare itself. A `catchall` states one; `false`, an absent `additionalProperties`, and the empty schema a loose object emits state nothing. */ +function undeclaredConstraint(member) { + const extra = member.additionalProperties; + if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null) return null; + return Object.keys(extra).length ? extra : null; +} +/** Combines object members into the single object they describe together, or returns `null` if any of them carries a keyword outside {@link FOLDABLE_KEYS}. */ +function foldObjects(members) { + const objects = []; + for (const member of members) { + if (typeof member !== "object" || member.type !== "object") return null; + for (const key in member) if (!FOLDABLE_KEYS.has(key)) return null; + objects.push(member); + } + const properties = {}; + const required = /* @__PURE__ */ new Set(); + for (const object of objects) { + for (const key in object.properties) { + if (Object.prototype.hasOwnProperty.call(properties, key)) continue; + const parts = []; + for (const other of objects) { + const part = other.properties?.[key] ?? undeclaredConstraint(other); + if (part === null || part === void 0) continue; + if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part))) parts.push(part); + } + assignProp(properties, key, parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts }); + } + for (const key of object.required ?? []) required.add(key); + } + const folded = { + type: "object", + properties + }; + if (required.size) folded.required = [...required]; + if (objects.every((object) => object.additionalProperties === false)) folded.additionalProperties = false; + else { + const constraints = []; + for (const object of objects) { + const constraint = undeclaredConstraint(object); + if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint))) constraints.push(constraint); + } + if (constraints.length === 1) folded.additionalProperties = constraints[0]; + else if (constraints.length > 1) folded.additionalProperties = { allOf: constraints }; + } + return folded; +} +/** `additionalProperties` in an `allOf` member sees only that member's own `properties`, so two +* closed object members reject each other's keys and the schema validates nothing. Zod's parser +* pools the key sets instead — `handleIntersectionResults` reports a key as unrecognized only when +* *every* side rejects it — so the emitted schema has to pool them too, and folding the members +* into one object is the encoding that says so on every target. +* +* This runs from `finalize`, after `extractDefs`, which is what keeps it clear of the `$ref` +* machinery: a member extracted into `$defs` is already a `$ref` by now and declines to fold, so it +* keeps its reference and its own closedness rather than being inlined as a stale copy. */ +function foldIntersection(json) { + const allOf = json.allOf; + if (!Array.isArray(allOf) || allOf.length < 2) return; + for (const key of FOLDABLE_KEYS) if (key in json) return; + const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k]))); + let folded = null; + if (!unions.length) folded = foldObjects(allOf); + else { + const union = unions[0]; + const keyword = UNION_KEYS.find((k) => Array.isArray(union[k])); + if (Object.keys(union).length !== 1) return; + const rest = allOf.filter((m) => m !== union); + const branches = union[keyword].map((branch) => foldObjects([...rest, branch])); + if (branches.some((b) => !b)) return; + folded = { [keyword]: branches }; + } + if (!folded) return; + delete json.allOf; + assignProps(json, folded); +} +function finalize(ctx, schema) { + const root = ctx.seen.get(schema); + if (!root) throw new Error("Unprocessed schema. This is a bug in Zod."); + const flattenRef = (zodSchema) => { + const seen = ctx.seen.get(zodSchema); + if (seen.ref === null) return; + const schema = seen.def ?? seen.schema; + const _cached = { ...schema }; + const ref = seen.ref; + seen.ref = null; + if (ref) { + flattenRef(ref); + const refSeen = ctx.seen.get(ref); + const refSchema = refSeen.schema; + if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) { + schema.allOf = schema.allOf ?? []; + schema.allOf.push(refSchema); + } else assignProps(schema, refSchema); + assignProps(schema, _cached); + if (zodSchema._zod.parent === ref) for (const key in schema) { + if (key === "$ref" || key === "allOf") continue; + if (!(key in _cached)) delete schema[key]; + } + if (refSchema.$ref && refSeen.def) for (const key in schema) { + if (key === "$ref" || key === "allOf") continue; + if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) delete schema[key]; + } + } + const parent = zodSchema._zod.parent; + if (parent && parent !== ref) { + flattenRef(parent); + const parentSeen = ctx.seen.get(parent); + if (parentSeen?.schema.$ref) { + schema.$ref = parentSeen.schema.$ref; + if (parentSeen.def) for (const key in schema) { + if (key === "$ref" || key === "allOf") continue; + if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) delete schema[key]; + } + } + } + ctx.override({ + zodSchema, + jsonSchema: schema, + path: seen.path ?? [] + }); + }; + if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) { + for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]); + if (ctx.target !== "openapi-3.0") for (const entry of ctx.seen.entries()) compactTypeUnion(entry[1].def ?? entry[1].schema); + for (const rewrite of ctx.deferred) rewrite(); + if (ctx.intersections.length) { + const carriers = /* @__PURE__ */ new Map(); + for (const seen of ctx.seen.values()) for (const json of [seen.schema, seen.def]) { + const allOf = json?.allOf; + if (!Array.isArray(allOf)) continue; + const existing = carriers.get(allOf); + if (existing) existing.push(json); + else carriers.set(allOf, [json]); + } + for (const allOf of ctx.intersections) for (const json of carriers.get(allOf) ?? []) foldIntersection(json); + } + } + const result = {}; + if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema"; + else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#"; + else if (ctx.target === "draft-04") result.$schema = "http://json-schema.org/draft-04/schema#"; + else if (ctx.target === "openapi-3.0") {} + if (ctx.external?.uri) { + const id = ctx.external.registry.get(schema)?.id; + if (!id) throw new Error("Schema is missing an `id` property"); + result.$id = ctx.external.uri(id); + } + assignProps(result, root.defId ? root.schema : root.def ?? root.schema); + const rootMetaId = ctx.metadataRegistry.get(schema)?.id; + if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id; + const defs = ctx.external?.defs ?? {}; + if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) for (const entry of ctx.seen.entries()) { + const seen = entry[1]; + if (seen.def && seen.defId) { + if (seen.def.id === seen.defId) delete seen.def.id; + assignProp(defs, seen.defId, seen.def); + } + } + if (ctx.external) ctx.sharedEmitDoneFor = ctx.external; + if (ctx.external) {} else if (Object.keys(defs).length > 0) { + if (ctx.target === "draft-2020-12") result.$defs = defs; + else result.definitions = defs; + } + try { + const finalized = JSON.parse(JSON.stringify(result)); + Object.defineProperty(finalized, "~standard", { + value: { + ...schema["~standard"], + jsonSchema: { + input: createStandardJSONSchemaMethod(schema, "input", ctx.processors), + output: createStandardJSONSchemaMethod(schema, "output", ctx.processors) + } + }, + enumerable: false, + writable: false + }); + return finalized; + } catch (_err) { + throw new Error("Error converting schema to JSON."); + } +} +function isTransforming(_schema, _ctx) { + const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() }; + if (ctx.seen.has(_schema)) return false; + ctx.seen.add(_schema); + const def = _schema._zod.def; + if (def.type === "transform") return true; + if (def.type === "array") return isTransforming(def.element, ctx); + if (def.type === "set") return isTransforming(def.valueType, ctx); + if (def.type === "lazy") return isTransforming(def.getter(), ctx); + if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault" || def.type === "catch") return isTransforming(def.innerType, ctx); + if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx); + if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx); + if (def.type === "pipe") { + if (_schema._zod.traits.has("$ZodCodec")) return true; + return isTransforming(def.in, ctx) || isTransforming(def.out, ctx); + } + if (def.type === "object") { + for (const key in def.shape) if (isTransforming(def.shape[key], ctx)) return true; + return false; + } + if (def.type === "union") { + for (const option of def.options) if (isTransforming(option, ctx)) return true; + return false; + } + if (def.type === "tuple") { + for (const item of def.items) if (isTransforming(item, ctx)) return true; + if (def.rest && isTransforming(def.rest, ctx)) return true; + return false; + } + return false; +} +/** +* Creates a toJSONSchema method for a schema instance. +* This encapsulates the logic of initializing context, processing, extracting defs, and finalizing. +*/ +var createToJSONSchemaMethod = (schema, processors = {}) => (params) => { + const ctx = initializeContext({ + ...params, + processors + }); + process(schema, ctx); + extractDefs(ctx, schema); + return finalize(ctx, schema); +}; +var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => { + const { libraryOptions, target } = params ?? {}; + const ctx = initializeContext({ + ...libraryOptions ?? {}, + target, + io, + processors + }); + process(schema, ctx); + extractDefs(ctx, schema); + return finalize(ctx, schema); +}; +//#endregion +//#region node_modules/zod/v4/core/json-schema-processors.js +var formatMap = { + guid: "uuid", + url: "uri", + datetime: "date-time", + json_string: "json-string", + regex: "" +}; +var stringProcessor = (schema, ctx, _json, _params) => { + const json = _json; + json.type = "string"; + const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag; + if (typeof minimum === "number") json.minLength = minimum; + if (typeof maximum === "number") json.maxLength = maximum; + if (format) { + json.format = formatMap[format] ?? format; + if (json.format === "") delete json.format; + if (format === "time" || laxFormat) delete json.format; + } + if (contentEncoding) json.contentEncoding = contentEncoding; + if (patterns && patterns.size > 0) { + const patternList = [...patterns]; + if (patternList.length === 1) json.pattern = patternList[0].source; + else if (patternList.length > 1) json.allOf = [...patternList.map((regex) => ({ + ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {}, + pattern: regex.source + }))]; + } +}; +var numberProcessor = (schema, ctx, _json, params) => { + const json = _json; + const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag; + if (typeof format === "string" && format.includes("int")) json.type = "integer"; + else json.type = "number"; + const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY); + const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY); + const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0"; + if (exMin) { + if (legacy) { + json.minimum = exclusiveMinimum; + json.exclusiveMinimum = true; + } else json.exclusiveMinimum = exclusiveMinimum; + } else if (typeof minimum === "number") json.minimum = minimum; + if (exMax) { + if (legacy) { + json.maximum = exclusiveMaximum; + json.exclusiveMaximum = true; + } else json.exclusiveMaximum = exclusiveMaximum; + } else if (typeof maximum === "number") json.maximum = maximum; + if (typeof multipleOf === "number") { + if (Number.isFinite(multipleOf) && multipleOf !== 0) json.multipleOf = Math.abs(multipleOf); + else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`); + } +}; +var booleanProcessor = (_schema, _ctx, json, _params) => { + json.type = "boolean"; +}; +var neverProcessor = (_schema, _ctx, json, _params) => { + json.not = {}; +}; +var enumProcessor = (schema, _ctx, json, _params) => { + const def = schema._zod.def; + const values = getEnumValues(def.entries); + if (values.length === 0) { + json.not = {}; + return; + } + if (values.every((v) => typeof v === "number")) json.type = "number"; + if (values.every((v) => typeof v === "string")) json.type = "string"; + json.enum = values; +}; +var customProcessor = (schema, ctx, json, params) => { + handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema"); +}; +var transformProcessor = (schema, ctx, json, params) => { + handleUnrepresentable(schema, ctx, json, params, "Transforms cannot be represented in JSON Schema"); +}; +var arrayProcessor = (schema, ctx, _json, params) => { + const json = _json; + const def = schema._zod.def; + const { minimum, maximum } = schema._zod.bag; + if (typeof minimum === "number") json.minItems = minimum; + if (typeof maximum === "number") json.maxItems = maximum; + json.type = "array"; + json.items = process(def.element, ctx, { + ...params, + path: [...params.path, "items"] + }); +}; +function inputOptin(schema) { + const def = schema._zod.def; + if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) return inputOptin(def.out); + if (def.type === "catch") return inputOptin(def.innerType); + return schema._zod.optin; +} +var objectProcessor = (schema, ctx, _json, params) => { + const json = _json; + const def = schema._zod.def; + const shape = def.shape; + if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return; + json.type = "object"; + json.properties = {}; + for (const key in shape) assignProp(json.properties, key, process(shape[key], ctx, { + ...params, + path: [ + ...params.path, + "properties", + key + ] + })); + const allKeys = new Set(Object.keys(shape)); + const requiredKeys = new Set([...allKeys].filter((key) => { + const field = def.shape[key]; + if (ctx.io === "input") return inputOptin(field) === void 0; + else return field._zod.optout === void 0; + })); + if (requiredKeys.size > 0) json.required = Array.from(requiredKeys); + if (def.catchall?._zod.def.type === "never") json.additionalProperties = false; + else if (!def.catchall) { + if (ctx.io === "output") json.additionalProperties = false; + } else if (def.catchall) json.additionalProperties = process(def.catchall, ctx, { + ...params, + path: [...params.path, "additionalProperties"] + }); +}; +var unionProcessor = (schema, ctx, json, params) => { + const def = schema._zod.def; + const isExclusive = def.inclusive === false; + const options = def.options.map((x, i) => process(x, ctx, { + ...params, + path: [ + ...params.path, + isExclusive ? "oneOf" : "anyOf", + i + ] + })); + if (isExclusive) json.oneOf = options; + else json.anyOf = options; +}; +var intersectionProcessor = (schema, ctx, json, params) => { + const def = schema._zod.def; + const a = process(def.left, ctx, { + ...params, + path: [ + ...params.path, + "allOf", + 0 + ] + }); + const b = process(def.right, ctx, { + ...params, + path: [ + ...params.path, + "allOf", + 1 + ] + }); + const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1; + const allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]]; + json.allOf = allOf; + ctx.intersections.push(allOf); +}; +var nullableProcessor = (schema, ctx, json, params) => { + const def = schema._zod.def; + const inner = process(def.innerType, ctx, params); + const seen = ctx.seen.get(schema); + if (ctx.target === "openapi-3.0") { + seen.ref = def.innerType; + json.nullable = true; + } else json.anyOf = [inner, { type: "null" }]; +}; +var nonoptionalProcessor = (schema, ctx, _json, params) => { + const def = schema._zod.def; + process(def.innerType, ctx, params); + const seen = ctx.seen.get(schema); + seen.ref = def.innerType; +}; +/** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON. +* A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other +* unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */ +var UNREPRESENTABLE_DEFAULT = Symbol(); +function serializeDefaultValue(value, schema, ctx, json, params) { + let unrepresentable = false; + const serialized = JSON.stringify(value, (_, val) => { + if (typeof val !== "bigint") return val; + unrepresentable = true; + return null; + }); + if (!unrepresentable) return JSON.parse(serialized); + handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema"); + return UNREPRESENTABLE_DEFAULT; +} +var defaultProcessor = (schema, ctx, json, params) => { + const def = schema._zod.def; + process(def.innerType, ctx, params); + const seen = ctx.seen.get(schema); + seen.ref = def.innerType; + const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params); + if (value !== UNREPRESENTABLE_DEFAULT) json.default = value; +}; +var prefaultProcessor = (schema, ctx, json, params) => { + const def = schema._zod.def; + process(def.innerType, ctx, params); + const seen = ctx.seen.get(schema); + seen.ref = def.innerType; + if (ctx.io !== "input") return; + const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params); + if (value !== UNREPRESENTABLE_DEFAULT) json._prefault = value; +}; +var catchProcessor = (schema, ctx, json, params) => { + const def = schema._zod.def; + process(def.innerType, ctx, params); + const seen = ctx.seen.get(schema); + seen.ref = def.innerType; + let catchValue; + try { + catchValue = def.catchValue(void 0); + } catch { + handleUnrepresentable(schema, ctx, json, params, "Dynamic catch values are not supported in JSON Schema"); + return; + } + json.default = catchValue; +}; +var pipeProcessor = (schema, ctx, _json, params) => { + const def = schema._zod.def; + const inIsTransform = def.in._zod.traits.has("$ZodTransform"); + const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out; + process(innerType, ctx, params); + const seen = ctx.seen.get(schema); + seen.ref = innerType; +}; +var readonlyProcessor = (schema, ctx, json, params) => { + const def = schema._zod.def; + process(def.innerType, ctx, params); + const seen = ctx.seen.get(schema); + seen.ref = def.innerType; + json.readOnly = true; +}; +var optionalProcessor = (schema, ctx, _json, params) => { + const def = schema._zod.def; + process(def.innerType, ctx, params); + const seen = ctx.seen.get(schema); + seen.ref = def.innerType; +}; +//#endregion +//#region node_modules/zod/v4/classic/errors.js +var _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]); +function _lazyMethod(proto, key, make) { + Object.defineProperty(proto, key, { + configurable: true, + enumerable: false, + get() { + const value = make(this); + Object.defineProperty(this, key, { + value, + configurable: true, + writable: true + }); + return value; + }, + set(value) { + Object.defineProperty(this, key, { + value, + configurable: true, + writable: true + }); + } + }); +} +var initializer = (inst, issues) => { + $ZodError.init(inst, issues); + inst.name = "ZodError"; + const proto = Object.getPrototypeOf(inst); + if (_installedErrorProtos.has(proto)) return; + _installedErrorProtos.add(proto); + _lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper)); + _lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper)); + _lazyMethod(proto, "addIssue", (self) => (issue) => { + self.issues.push(issue); + self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2); + }); + _lazyMethod(proto, "addIssues", (self) => (issues) => { + self.issues.push(...issues); + self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2); + }); + Object.defineProperty(proto, "isEmpty", { + configurable: true, + enumerable: false, + get() { + return this.issues.length === 0; + } + }); +}; +var ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error }); +//#endregion +//#region node_modules/zod/v4/classic/parse.js +var parse = /* @__PURE__ */ _parse(ZodRealError); +var parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError); +var safeParse = /* @__PURE__ */ _safeParse(ZodRealError); +var safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError); +var encode = /* @__PURE__ */ _encode(ZodRealError); +var decode = /* @__PURE__ */ _decode(ZodRealError); +var encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError); +var decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError); +var safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError); +var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError); +var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError); +var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError); +//#endregion +//#region node_modules/zod/v4/classic/schemas.js +function _ensureDefaultLocale() { + if (!globalConfig.localeError) config(en_default()); +} +function _ensureDefaultMemoizer() { + if (!globalConfig.memoizer) config({ memoizer: memoizer() }); +} +var ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => { + _ensureDefaultLocale(); + $ZodType.init(inst, def); + inst.def = def; + inst.type = def.type; + return inst; +}, { + check(...chks) { + const def = this.def; + return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: { + check: ch, + def: { check: "custom" }, + onattach: [] + } } : ch)] }), { parent: true }); + }, + with(...chks) { + return this.check(...chks); + }, + clone(def, params) { + return clone(this, def, params); + }, + brand() { + return this; + }, + register(reg, meta) { + reg.add(this, meta); + return this; + }, + refine(check, params) { + return this.check(refine(check, params)); + }, + superRefine(refinement, params) { + return this.check(superRefine(refinement, params)); + }, + overwrite(fn) { + return this.check(/* @__PURE__ */ _overwrite(fn)); + }, + optional() { + return optional(this); + }, + exactOptional() { + return exactOptional(this); + }, + nullable() { + return nullable(this); + }, + nullish() { + return optional(nullable(this)); + }, + nonoptional(params) { + return nonoptional(this, params); + }, + array() { + return array(this); + }, + or(arg) { + return union([this, arg]); + }, + and(arg) { + return intersection(this, arg); + }, + transform(tx) { + return pipe(this, transform(tx)); + }, + default(d) { + return _default(this, d); + }, + prefault(d) { + return prefault(this, d); + }, + catch(params) { + return _catch(this, params); + }, + pipe(target) { + return pipe(this, target); + }, + readonly() { + return readonly(this); + }, + describe(description) { + const cl = this.clone(); + globalRegistry.add(cl, { description }); + return cl; + }, + meta(...args) { + if (args.length === 0) return globalRegistry.get(this); + const cl = this.clone(); + globalRegistry.add(cl, args[0]); + return cl; + }, + isOptional() { + return this.safeParse(void 0).success; + }, + isNullable() { + return this.safeParse(null).success; + }, + apply(fn, ...args) { + return args.length === 0 ? fn(this) : fn(this, ...args); + }, + get "~standard"() { + return hide(this, "~standard", { + ...standardProps(this), + jsonSchema: { + input: createStandardJSONSchemaMethod(this, "input"), + output: createStandardJSONSchemaMethod(this, "output") + } + }); + }, + set "~standard"(value) { + own(this, "~standard", value); + }, + parse: function _parse(data, params) { + return parse(this, data, params, { callee: _parse }); + }, + parseAsync: async function _parseAsync(data, params) { + return await parseAsync(this, data, params, { callee: _parseAsync }); + }, + safeParse(data, params) { + return safeParse(this, data, params); + }, + async safeParseAsync(data, params) { + return safeParseAsync(this, data, params); + }, + get spa() { + return this?.safeParseAsync; + }, + set spa(value) { + own(this, "spa", value); + }, + encode: function _encode(data, params) { + return encode(this, data, params, { callee: _encode }); + }, + decode: function _decode(data, params) { + return decode(this, data, params, { callee: _decode }); + }, + encodeAsync: async function _encodeAsync(data, params) { + return await encodeAsync(this, data, params, { callee: _encodeAsync }); + }, + decodeAsync: async function _decodeAsync(data, params) { + return await decodeAsync(this, data, params, { callee: _decodeAsync }); + }, + safeEncode(data, params) { + return safeEncode(this, data, params); + }, + safeDecode(data, params) { + return safeDecode(this, data, params); + }, + async safeEncodeAsync(data, params) { + return safeEncodeAsync(this, data, params); + }, + async safeDecodeAsync(data, params) { + return safeDecodeAsync(this, data, params); + }, + toJSONSchema(params) { + return createToJSONSchemaMethod(this, {})(params); + }, + get description() { + return globalRegistry.get(this)?.description; + }, + get _def() { + return this._zod.def; + } +}); +/** @internal */ +var _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => { + $ZodString.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params); + const bag = inst._zod.bag; + inst.format = bag.format ?? null; + inst.minLength = bag.minimum ?? null; + inst.maxLength = bag.maximum ?? null; +}, { + regex(...args) { + return this.check(/* @__PURE__ */ _regex(...args)); + }, + includes(...args) { + return this.check(/* @__PURE__ */ _includes(...args)); + }, + startsWith(...args) { + return this.check(/* @__PURE__ */ _startsWith(...args)); + }, + endsWith(...args) { + return this.check(/* @__PURE__ */ _endsWith(...args)); + }, + min(...args) { + return this.check(/* @__PURE__ */ _minLength(...args)); + }, + max(...args) { + return this.check(/* @__PURE__ */ _maxLength(...args)); + }, + length(...args) { + return this.check(/* @__PURE__ */ _length(...args)); + }, + nonempty(...args) { + return this.check(/* @__PURE__ */ _minLength(1, ...args)); + }, + lowercase(params) { + return this.check(/* @__PURE__ */ _lowercase(params)); + }, + uppercase(params) { + return this.check(/* @__PURE__ */ _uppercase(params)); + }, + trim() { + return this.check(/* @__PURE__ */ _trim()); + }, + normalize(...args) { + return this.check(/* @__PURE__ */ _normalize(...args)); + }, + toLowerCase() { + return this.check(/* @__PURE__ */ _toLowerCase()); + }, + toUpperCase() { + return this.check(/* @__PURE__ */ _toUpperCase()); + }, + slugify() { + return this.check(/* @__PURE__ */ _slugify()); + } +}); +var ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => { + $ZodString.init(inst, def); + _ZodString.init(inst, def); +}, { + email(params) { + return this.check(/* @__PURE__ */ _email(ZodEmail, params)); + }, + url(params) { + return this.check(/* @__PURE__ */ _url(ZodURL, params)); + }, + jwt(params) { + return this.check(/* @__PURE__ */ _jwt(ZodJWT, params)); + }, + emoji(params) { + return this.check(/* @__PURE__ */ _emoji(ZodEmoji, params)); + }, + guid(params) { + return this.check(/* @__PURE__ */ _guid(ZodGUID, params)); + }, + uuid(params) { + return this.check(/* @__PURE__ */ _uuid(ZodUUID, params)); + }, + uuidv4(params) { + return this.check(/* @__PURE__ */ _uuidv4(ZodUUID, params)); + }, + uuidv6(params) { + return this.check(/* @__PURE__ */ _uuidv6(ZodUUID, params)); + }, + uuidv7(params) { + return this.check(/* @__PURE__ */ _uuidv7(ZodUUID, params)); + }, + nanoid(params) { + return this.check(/* @__PURE__ */ _nanoid(ZodNanoID, params)); + }, + cuid(params) { + return this.check(/* @__PURE__ */ _cuid(ZodCUID, params)); + }, + cuid2(params) { + return this.check(/* @__PURE__ */ _cuid2(ZodCUID2, params)); + }, + ulid(params) { + return this.check(/* @__PURE__ */ _ulid(ZodULID, params)); + }, + base64(params) { + return this.check(/* @__PURE__ */ _base64(ZodBase64, params)); + }, + base64url(params) { + return this.check(/* @__PURE__ */ _base64url(ZodBase64URL, params)); + }, + xid(params) { + return this.check(/* @__PURE__ */ _xid(ZodXID, params)); + }, + ksuid(params) { + return this.check(/* @__PURE__ */ _ksuid(ZodKSUID, params)); + }, + ipv4(params) { + return this.check(/* @__PURE__ */ _ipv4(ZodIPv4, params)); + }, + ipv6(params) { + return this.check(/* @__PURE__ */ _ipv6(ZodIPv6, params)); + }, + cidrv4(params) { + return this.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params)); + }, + cidrv6(params) { + return this.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params)); + }, + e164(params) { + return this.check(/* @__PURE__ */ _e164(ZodE164, params)); + }, + datetime(params) { + return this.check(/* @__PURE__ */ _isoDateTime(ZodISODateTime, params)); + }, + date(params) { + return this.check(/* @__PURE__ */ _isoDate(ZodISODate, params)); + }, + time(params) { + return this.check(/* @__PURE__ */ _isoTime(ZodISOTime, params)); + }, + duration(params) { + return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params)); + } +}); +function string(params) { + return /* @__PURE__ */ _string(ZodString, params); +} +var ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def) => { + $ZodStringFormat.init(inst, def); + _ZodString.init(inst, def); +}); +var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => { + $ZodISODateTime.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => { + $ZodISODate.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => { + $ZodISOTime.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => { + $ZodISODuration.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => { + $ZodEmail.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodGUID = /*@__PURE__*/ $constructor("ZodGUID", (inst, def) => { + $ZodGUID.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodUUID = /*@__PURE__*/ $constructor("ZodUUID", (inst, def) => { + $ZodUUID.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodURL = /*@__PURE__*/ $constructor("ZodURL", (inst, def) => { + $ZodURL.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodEmoji = /*@__PURE__*/ $constructor("ZodEmoji", (inst, def) => { + $ZodEmoji.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodNanoID = /*@__PURE__*/ $constructor("ZodNanoID", (inst, def) => { + $ZodNanoID.init(inst, def); + ZodStringFormat.init(inst, def); +}); +/** +* @deprecated CUID v1 is deprecated by its authors due to information leakage +* (timestamps embedded in the id). Use {@link ZodCUID2} instead. +* See https://github.com/paralleldrive/cuid. +*/ +var ZodCUID = /*@__PURE__*/ $constructor("ZodCUID", (inst, def) => { + $ZodCUID.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodCUID2 = /*@__PURE__*/ $constructor("ZodCUID2", (inst, def) => { + $ZodCUID2.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodULID = /*@__PURE__*/ $constructor("ZodULID", (inst, def) => { + $ZodULID.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodXID = /*@__PURE__*/ $constructor("ZodXID", (inst, def) => { + $ZodXID.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodKSUID = /*@__PURE__*/ $constructor("ZodKSUID", (inst, def) => { + $ZodKSUID.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodIPv4 = /*@__PURE__*/ $constructor("ZodIPv4", (inst, def) => { + $ZodIPv4.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodIPv6 = /*@__PURE__*/ $constructor("ZodIPv6", (inst, def) => { + $ZodIPv6.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodCIDRv4 = /*@__PURE__*/ $constructor("ZodCIDRv4", (inst, def) => { + $ZodCIDRv4.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodCIDRv6 = /*@__PURE__*/ $constructor("ZodCIDRv6", (inst, def) => { + $ZodCIDRv6.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodBase64 = /*@__PURE__*/ $constructor("ZodBase64", (inst, def) => { + $ZodBase64.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodBase64URL = /*@__PURE__*/ $constructor("ZodBase64URL", (inst, def) => { + $ZodBase64URL.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodE164 = /*@__PURE__*/ $constructor("ZodE164", (inst, def) => { + $ZodE164.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodJWT = /*@__PURE__*/ $constructor("ZodJWT", (inst, def) => { + $ZodJWT.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => { + $ZodNumber.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params); + const bag = inst._zod.bag; + inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null; + inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null; + inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5); + inst.isFinite = true; + inst.format = bag.format ?? null; +}, { + gt(value, params) { + return this.check(/* @__PURE__ */ _gt(value, params)); + }, + gte(value, params) { + return this.check(/* @__PURE__ */ _gte(value, params)); + }, + min(value, params) { + return this.check(/* @__PURE__ */ _gte(value, params)); + }, + lt(value, params) { + return this.check(/* @__PURE__ */ _lt(value, params)); + }, + lte(value, params) { + return this.check(/* @__PURE__ */ _lte(value, params)); + }, + max(value, params) { + return this.check(/* @__PURE__ */ _lte(value, params)); + }, + int(params) { + return this.check(int(params)); + }, + safe(params) { + return this.check(int(params)); + }, + positive(params) { + return this.check(/* @__PURE__ */ _gt(0, params)); + }, + nonnegative(params) { + return this.check(/* @__PURE__ */ _gte(0, params)); + }, + negative(params) { + return this.check(/* @__PURE__ */ _lt(0, params)); + }, + nonpositive(params) { + return this.check(/* @__PURE__ */ _lte(0, params)); + }, + multipleOf(value, params) { + return this.check(/* @__PURE__ */ _multipleOf(value, params)); + }, + step(value, params) { + return this.check(/* @__PURE__ */ _multipleOf(value, params)); + }, + finite() { + return this; + } +}); +function number(params) { + return /* @__PURE__ */ _number(ZodNumber, params); +} +var ZodNumberFormat = /*@__PURE__*/ $constructor("ZodNumberFormat", (inst, def) => { + $ZodNumberFormat.init(inst, def); + ZodNumber.init(inst, def); +}); +function int(params) { + return /* @__PURE__ */ _int(ZodNumberFormat, params); +} +function float32(params) { + return /* @__PURE__ */ _float32(ZodNumberFormat, params); +} +var ZodBoolean = /*@__PURE__*/ $constructor("ZodBoolean", (inst, def) => { + $ZodBoolean.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params); +}); +function boolean(params) { + return /* @__PURE__ */ _boolean(ZodBoolean, params); +} +var ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def) => { + $ZodUnknown.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => void 0; +}); +function unknown() { + return /* @__PURE__ */ _unknown(ZodUnknown); +} +var ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def) => { + $ZodNever.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params); +}); +function never(params) { + return /* @__PURE__ */ _never(ZodNever, params); +} +var ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => { + _ensureDefaultMemoizer(); + $ZodArray.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params); + inst.element = def.element; +}, { + min(n, params) { + return this.check(/* @__PURE__ */ _minLength(n, params)); + }, + nonempty(params) { + return this.check(/* @__PURE__ */ _minLength(1, params)); + }, + max(n, params) { + return this.check(/* @__PURE__ */ _maxLength(n, params)); + }, + length(n, params) { + return this.check(/* @__PURE__ */ _length(n, params)); + }, + unwrap() { + return this.element; + } +}); +function array(element, params) { + return /* @__PURE__ */ _array(ZodArray, element, params); +} +var ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => { + _ensureDefaultMemoizer(); + $ZodObjectJIT.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params); + installLazyProp(inst, "shape", (self) => self._zod.def.shape, false); +}, { + keyof() { + return _enum(Object.keys(this._zod.def.shape)); + }, + catchall(catchall) { + return this.clone({ + ...this._zod.def, + catchall + }); + }, + passthrough() { + return this.clone({ + ...this._zod.def, + catchall: unknown() + }); + }, + loose() { + return this.clone({ + ...this._zod.def, + catchall: unknown() + }); + }, + strict() { + return this.clone({ + ...this._zod.def, + catchall: never() + }); + }, + strip() { + return this.clone({ + ...this._zod.def, + catchall: void 0 + }); + }, + extend(incoming) { + return extend(this, incoming); + }, + safeExtend(incoming) { + return safeExtend(this, incoming); + }, + merge(other) { + return merge(this, other); + }, + pick(mask) { + return pick(this, mask); + }, + omit(mask) { + return omit(this, mask); + }, + partial(...args) { + return partial(ZodOptional, this, args[0]); + }, + exactPartial(...args) { + return partial(ZodExactOptional, this, args[0], "exactPartial"); + }, + required(...args) { + return required(ZodNonOptional, this, args[0]); + } +}); +function object(shape, params) { + return new ZodObject({ + type: "object", + shape: shape ?? {}, + ...normalizeParams(params) + }); +} +var ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => { + $ZodUnion.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params); + inst.options = def.options; +}); +function union(options, params) { + return new ZodUnion({ + type: "union", + options, + ...normalizeParams(params) + }); +} +var ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def) => { + $ZodIntersection.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params); +}); +function intersection(left, right) { + return new ZodIntersection({ + type: "intersection", + left, + right + }); +} +var ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => { + $ZodEnum.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params); + inst.enum = def.entries; + inst.options = Object.values(def.entries); + const keys = new Set(Object.keys(def.entries)); + inst.extract = (values, params) => { + const newEntries = {}; + for (const value of values) if (keys.has(value)) newEntries[value] = def.entries[value]; + else throw new Error(`Key ${value} not found in enum`); + return new ZodEnum({ + ...def, + checks: [], + ...normalizeParams(params), + entries: newEntries + }); + }; + inst.exclude = (values, params) => { + const newEntries = { ...def.entries }; + for (const value of values) if (keys.has(value)) delete newEntries[value]; + else throw new Error(`Key ${value} not found in enum`); + return new ZodEnum({ + ...def, + checks: [], + ...normalizeParams(params), + entries: newEntries + }); + }; +}); +function _enum(values, params) { + return new ZodEnum({ + type: "enum", + entries: Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values, + ...normalizeParams(params) + }); +} +var ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => { + _ensureDefaultMemoizer(); + $ZodTransform.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params); + inst._zod.parse = (payload, _ctx) => { + if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name); + payload.addIssue = (issue$1) => { + if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def)); + else { + const _issue = issue$1; + if (_issue.fatal) _issue.continue = false; + _issue.code ?? (_issue.code = "custom"); + if (!("input" in _issue)) _issue.input = payload.value; + _issue.inst ?? (_issue.inst = inst); + payload.issues.push(issue(_issue)); + } + }; + const output = def.transform(payload.value, payload); + if (output instanceof Promise) return output.then((output) => { + payload.value = output; + return payload; + }); + payload.value = output; + return payload; + }; +}); +function transform(fn) { + return new ZodTransform({ + type: "transform", + transform: fn + }); +} +var ZodOptional = /*@__PURE__*/ $constructor("ZodOptional", (inst, def) => { + $ZodOptional.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params); + inst.unwrap = () => inst._zod.def.innerType; +}); +function optional(innerType) { + return new ZodOptional({ + type: "optional", + innerType + }); +} +var ZodExactOptional = /*@__PURE__*/ $constructor("ZodExactOptional", (inst, def) => { + $ZodExactOptional.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params); + inst.unwrap = () => inst._zod.def.innerType; +}); +function exactOptional(innerType) { + return new ZodExactOptional({ + type: "optional", + innerType + }); +} +var ZodNullable = /*@__PURE__*/ $constructor("ZodNullable", (inst, def) => { + $ZodNullable.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params); + inst.unwrap = () => inst._zod.def.innerType; +}); +function nullable(innerType) { + return new ZodNullable({ + type: "nullable", + innerType + }); +} +var ZodDefault = /*@__PURE__*/ $constructor("ZodDefault", (inst, def) => { + $ZodDefault.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params); + inst.unwrap = () => inst._zod.def.innerType; + inst.removeDefault = inst.unwrap; +}); +function _default(innerType, defaultValue) { + return new ZodDefault({ + type: "default", + innerType, + get defaultValue() { + return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue); + } + }); +} +var ZodPrefault = /*@__PURE__*/ $constructor("ZodPrefault", (inst, def) => { + $ZodPrefault.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params); + inst.unwrap = () => inst._zod.def.innerType; +}); +function prefault(innerType, defaultValue) { + return new ZodPrefault({ + type: "prefault", + innerType, + get defaultValue() { + return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue); + } + }); +} +var ZodNonOptional = /*@__PURE__*/ $constructor("ZodNonOptional", (inst, def) => { + $ZodNonOptional.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params); + inst.unwrap = () => inst._zod.def.innerType; +}); +function nonoptional(innerType, params) { + return new ZodNonOptional({ + type: "nonoptional", + innerType, + ...normalizeParams(params) + }); +} +var ZodCatch = /*@__PURE__*/ $constructor("ZodCatch", (inst, def) => { + $ZodCatch.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params); + inst.unwrap = () => inst._zod.def.innerType; + inst.removeCatch = inst.unwrap; +}); +function _catch(innerType, catchValue) { + return new ZodCatch({ + type: "catch", + innerType, + catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue) + }); +} +var ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => { + $ZodPipe.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params); + inst.in = def.in; + inst.out = def.out; +}); +function pipe(in_, out) { + return new ZodPipe({ + type: "pipe", + in: in_, + out + }); +} +var ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => { + $ZodReadonly.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params); + inst.unwrap = () => inst._zod.def.innerType; +}); +function readonly(innerType) { + return new ZodReadonly({ + type: "readonly", + innerType + }); +} +var ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def) => { + $ZodCustom.init(inst, def); + ZodType.init(inst, def); + inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params); +}); +function refine(fn, _params = {}) { + return /* @__PURE__ */ _refine(ZodCustom, fn, _params); +} +function superRefine(fn, params) { + return /* @__PURE__ */ _superRefine(fn, params); +} +//#endregion +//#region node_modules/@hookform/resolvers/dist/resolvers.mjs +var t$1 = (r, t, s) => { + if (r && "reportValidity" in r) { + const o = get(s, t); + r.setCustomValidity(o && o.message || ""), r.reportValidity(); + } +}; +var s$1 = (e, r) => { + for (const s in r.fields) { + const o = r.fields[s]; + o && o.ref && "reportValidity" in o.ref ? t$1(o.ref, s, e) : o && o.refs && o.refs.forEach((r) => t$1(r, s, e)); + } +}; +var o$1 = (t, o) => { + o.shouldUseNativeValidation && s$1(t, o); + const n = {}; + for (const s in t) { + const f = get(o.fields, s), c = Object.assign(t[s] || {}, { ref: f && f.refs ? f.refs[0] : f && f.ref }); + if (i$1(o.names || Object.keys(t), s)) { + const t = Object.assign({}, get(n, s)); + set(t, "root", c), set(n, s, t); + } else set(n, s, c); + } + return n; +}; +var i$1 = (e, r) => { + const t = n(r).replace(/[.*+?^${}()|\\]/g, "\\$&"); + return e.some((e) => n(e).match(`^${t}\\.\\d+`)); +}; +function n(e) { + return e.replace(/\[(\d+)]/g, ".$1").replace(/[[\]]/g, ""); +} +//#endregion +//#region node_modules/@hookform/resolvers/zod/dist/zod.mjs +function o() { + return o = Object.assign ? Object.assign.bind() : function(r) { + for (var e = 1; e < arguments.length; e++) { + var n = arguments[e]; + for (var o in n) ({}).hasOwnProperty.call(n, o) && (r[o] = n[o]); + } + return r; + }, o.apply(null, arguments); +} +function t(r, e) { + try { + var n = r(); + } catch (r) { + return e(r); + } + return n && n.then ? n.then(void 0, e) : n; +} +function s(r, e) { + for (var o = Object.create(null); r.length;) { + var t = r[0], s = t.code, i = t.message, u = t.path.join("."); + if (!o[u]) if ("unionErrors" in t) { + var a, c, l = t.unionErrors.reduce(function(r, e) { + return e.errors.length < r.errors.length ? e : r; + }).errors[0]; + o[u] = { + message: null != (a = null == l ? void 0 : l.message) ? a : i, + type: null != (c = null == l ? void 0 : l.code) ? c : s + }; + } else o[u] = { + message: i, + type: s + }; + if ("unionErrors" in t && t.unionErrors.forEach(function(e) { + return e.errors.forEach(function(e) { + return r.push(e); + }); + }), e) { + var f = o[u].types, d = f && f[t.code]; + o[u] = appendErrors(u, e, o, s, d ? [].concat(d, t.message) : t.message); + } + r.shift(); + } + return o; +} +function i(r, e) { + for (var t = Object.create(null), s = function() { + var s = r[0], i = s.code, u = s.message, a = s.path.join("."); + if (!t[a]) if ("invalid_union" === s.code && s.errors.length > 0) { + var c, l, f = s.errors.reduce(function(r, e) { + return e.length < r.length ? e : r; + })[0]; + t[a] = { + message: null != (c = null == f ? void 0 : f.message) ? c : u, + type: null != (l = null == f ? void 0 : f.code) ? l : i + }; + } else t[a] = { + message: u, + type: i + }; + if ("invalid_union" === s.code && s.errors.forEach(function(e) { + return e.forEach(function(e) { + return r.push(o({}, e, { path: [].concat(s.path, e.path) })); + }); + }), e) { + var d = t[a].types, h = d && d[s.code]; + t[a] = appendErrors(a, e, t, i, h ? [].concat(h, s.message) : s.message); + } + r.shift(); + }; r.length;) s(); + return t; +} +function u(n, o, u) { + if (void 0 === u && (u = {}), function(r) { + return "_zod" in r && "object" == typeof r._zod; + }(n)) return function(s, a, c) { + try { + return Promise.resolve(t(function() { + function e(e) { + return c.shouldUseNativeValidation && s$1({}, c), { + errors: {}, + values: u.raw ? Object.assign({}, s) : e + }; + } + var t = n; + return "sync" === u.mode ? e(t.parse(s, o)) : Promise.resolve(t.parseAsync(s, o)).then(e); + }, function(r) { + if (function(r) { + var e; + return !(null == r || null == (e = r._zod) || null == (e = e.traits) || !e.has("$ZodError")); + }(r)) return { + values: {}, + errors: o$1(i(r.issues, !c.shouldUseNativeValidation && "all" === c.criteriaMode), c) + }; + throw r; + })); + } catch (r) { + return Promise.reject(r); + } + }; + if (function(r) { + return "_def" in r && "object" == typeof r._def; + }(n)) return function(i, a, c) { + try { + return Promise.resolve(t(function() { + return Promise.resolve(n["sync" === u.mode ? "parse" : "parseAsync"](i, o)).then(function(e) { + return c.shouldUseNativeValidation && s$1({}, c), { + errors: {}, + values: u.raw ? Object.assign({}, i) : e + }; + }); + }, function(r) { + if (function(r) { + return Array.isArray(null == r ? void 0 : r.issues); + }(r)) return { + values: {}, + errors: o$1(s(r.errors, !c.shouldUseNativeValidation && "all" === c.criteriaMode), c) + }; + throw r; + })); + } catch (r) { + return Promise.reject(r); + } + }; + throw new Error("Invalid input: not a Zod schema"); +} +//#endregion +//#region src/stores/AvailableEntitiesStore.ts +function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; +} +function getOptionsFromItems(items) { + const options = []; + for (const item of items) { + let mdi_icon = "mdi-help"; + if (item.item_id.startsWith("light")) mdi_icon = "mdi-lightbulb"; + else if (item.item_id.startsWith("input_boolean")) mdi_icon = "mdi-toggle-switch-variant"; + else if (item.item_id.startsWith("sensor.")) mdi_icon = "mdi-access-point"; + else if (item.item_id.startsWith("switch")) mdi_icon = "mdi-toggle-switch-variant"; + else if (item.item_id.startsWith("button") || item.item_id.startsWith("input_button")) mdi_icon = "mdi-gesture-tap-button"; + else if (item.item_id.startsWith("climate")) mdi_icon = "mdi-thermostat"; + else if (item.item_id.startsWith("scene")) mdi_icon = "mdi-palette"; + else if (item.item_id.startsWith("script")) mdi_icon = "mdi-code-json"; + else if (item.item_id.startsWith("media_player")) mdi_icon = "mdi-speaker"; + else if (item.item_id.startsWith("cover")) mdi_icon = "mdi-window-shutter"; + options.push({ + value: item.item_id, + label: item.label, + icon: mdi_icon, + type: item.type + }); + } + return options; +} +var useAvailableEntitiesStore = create((set) => ({ + status: "none", + home_assistant_entities: [], + home_assistant_options: [], + openhab_items: [], + openhab_options: [], + fetchEntities: async () => { + set({ status: "loading" }); + fetch(`/rest/home_assistant/entities`, { + credentials: "same-origin", + method: "GET", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + } + }).then((response) => response.json()).then((data) => { + set((state) => ({ + ...state, + status: "loading", + home_assistant_entities: data.items + })); + set((state) => ({ + ...state, + home_assistant_options: getOptionsFromItems(data.items) + })); + fetch(`/rest/openhab/items`, { + credentials: "same-origin", + method: "GET", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + } + }).then((response) => response.json()).then((data) => { + set((state) => ({ + ...state, + status: "loaded", + openhab_items: data.items, + openhab_options: getOptionsFromItems(data.items) + })); + }); + }); + } +})); +//#endregion +//#region src/components/MultiStep_AddEditEntity/entity_types/step3_edit_light.tsx +var schema$6 = object({ + id: number().nullable(), + type: string(), + entity_type: string(), + room_id: number(), + entities_page_id: number(), + room_view_position: number(), + friendly_name: string().min(1), + controller: string(), + can_color_temperature: boolean().optional(), + can_dim: boolean().optional(), + can_rgb: boolean().optional(), + controlled_by_nspanel_main_page: boolean().optional(), + home_assistant_name: string().optional(), + is_ceiling_light: boolean().optional(), + openhab_item_color_temp: string().optional(), + openhab_item_dimmer: string().optional(), + openhab_item_switch: string().optional(), + openhab_item_rgb: string().optional() +}); +var CustomOption$6 = ({ innerProps, isDisabled, isFocused, isSelected, children, data }) => { + if (isDisabled) return null; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + ...innerProps, + className: `p-1 ${isSelected ? "bg-primary/20 rounded-sm" : ""} ${isFocused ? "bg-primary/20 rounded-sm" : ""}`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi ${data.icon} me-2` }), children] + }); +}; +var select_components$6 = { Option: CustomOption$6 }; +var MultiStep_AddEditEntity_Step3_Light = ({ controller, room_id, entities_page_id, room_view_position, id, onComplete }) => { + const { handleSubmit, register, reset, getValues, setValue, formState: { isValid } } = useForm({ + resolver: u(schema$6), + defaultValues: { + id: id ?? null, + controller, + type: "entity", + entity_type: "light", + room_id: room_id ?? -1, + entities_page_id, + room_view_position, + can_color_temperature: false, + can_dim: false, + can_rgb: false, + controlled_by_nspanel_main_page: true, + is_ceiling_light: false, + home_assistant_name: "", + openhab_item_color_temp: "", + openhab_item_dimmer: "", + openhab_item_switch: "", + openhab_item_rgb: "" + } + }); + function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + (0, import_react.useEffect)(() => { + if (id != null) { + const entityData = useEntitiesPagesStore.getState().entities.find((entity) => entity.id == id); + reset(entityData); + } + }, [id, useEntitiesPagesStore.getState().entities]); + function onSave(values) { + fetch("/rest/entities/lights", { + credentials: "same-origin", + method: "PUT", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + }, + body: JSON.stringify({ values }) + }).then(async (response) => { + const data = await response.json(); + if (!response.ok) { + const error = data && data.message || response.status; + return Promise.reject(error); + } + onComplete?.(); + }).catch((error) => { + Notify({ + message: `Error saving entity. Error: ${error}`, + level: "error", + duration: 1e4 + }); + }); + } + const classNames = { + control: (state) => `${state.isFocused ? "border" : "border-0"} border-accent p-2.5 text-sm rounded-box bg-base-300 rounded-md`, + menu: () => "bg-base-300 p-2.5 rounded-box", + option: (state) => `p-1 ${state.isSelected ? "bg-primary/20 rounded-sm" : ""} ${state.isFocused ? "bg-primary/20 rounded-sm" : ""}` + }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { + onSubmit: handleSubmit(onSave), + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("controller") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("type") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("entity_type") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("room_id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("entities_page_id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("room_view_position") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "add_new_light_name", + className: "block mb-2 text-sm font-medium", + children: "Name" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex flex-row-reverse", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text", + type: "text", + id: "add_new_light_name", + ...register("friendly_name"), + required: true + }) + })] + }) + }), + controller == "home_assistant" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "Home Assistant entity" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().home_assistant_options.filter((option) => option.value.startsWith("light.") || option.value.startsWith("switch.")), + classNames, + onChange: (newValue) => setValue("home_assistant_name", newValue ? newValue.value : "", { + shouldValidate: true, + shouldDirty: true + }), + unstyled: true, + components: select_components$6, + value: useAvailableEntitiesStore.getState().home_assistant_options.find((option) => option.value === getValues("home_assistant_name")), + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("fieldset", { + className: "fieldset mt-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("controlled_by_nspanel_main_page") + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { + className: `label ${getValues("controlled_by_nspanel_main_page") ? "text-base-content" : "text-base-content/50"}`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "checkbox", + className: "toggle toggle-accent", + checked: getValues("controlled_by_nspanel_main_page"), + onClick: () => { + setValue("controlled_by_nspanel_main_page", !getValues("controlled_by_nspanel_main_page"), { + shouldValidate: true, + shouldDirty: true + }); + } + }), getValues("controlled_by_nspanel_main_page") ? "Controlled by NSPanel main page" : "Not controlled by NSPanel main page"] + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 mt-4 text-sm font-medium", + children: "Light type" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("is_ceiling_light") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "grid grid-cols-2 gap-4 w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10", + onClick: () => setValue("is_ceiling_light", false, { + shouldValidate: true, + shouldDirty: true + }), + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center p-4", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi mdi-lamp text-5xl text-neutral-content/50 group-hover:text-yellow-500 ${getValues("is_ceiling_light") ? "" : "text-yellow-500"}` }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-base-content/50 group-hover:text-base-content text-center", + children: "Table light" + }) + })] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10", + onClick: () => setValue("is_ceiling_light", true, { + shouldValidate: true, + shouldDirty: true + }), + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center p-4", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi mdi-ceiling-light text-5xl text-neutral-content/50 group-hover:text-yellow-500 ${getValues("is_ceiling_light") ? "text-yellow-500" : ""}` }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-base-content/50 group-hover:text-base-content text-center", + children: "Ceiling light" + }) + })] + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 mt-4 text-sm font-medium", + children: "Light capabilities" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("can_dim") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "grid grid-cols-3 gap-4 w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10", + onClick: () => { + setValue("can_dim", !getValues("can_dim"), { + shouldValidate: true, + shouldDirty: true + }); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center p-4", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi mdi-lightbulb-on-50 text-5xl text-neutral-content/50 group-hover:text-yellow-500 ${getValues("can_dim") ? "text-yellow-500" : ""}` }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-base-content/50 group-hover:text-base-content text-center", + children: "Dimmable" + }) + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("can_color_temperature") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10", + onClick: () => { + setValue("can_color_temperature", !getValues("can_color_temperature"), { + shouldValidate: true, + shouldDirty: true + }); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center p-4", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi mdi-temperature-kelvin text-5xl text-neutral-content/50 group-hover:text-yellow-500 ${getValues("can_color_temperature") ? "text-yellow-500" : ""}` }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-base-content/50 group-hover:text-base-content text-center", + children: "Color temp" + }) + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("can_rgb") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "group bg-base-100 rounded-box border border-neutral border-dashed p-6 cursor-pointer hover:bg-yellow-500/10", + onClick: () => { + setValue("can_rgb", !getValues("can_rgb"), { + shouldValidate: true, + shouldDirty: true + }); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center p-4", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi mdi-palette text-5xl text-neutral-content/50 group-hover:text-yellow-500 ${getValues("can_rgb") ? "text-yellow-500" : ""}` }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-base-content/50 group-hover:text-base-content text-center", + children: "Color" + }) + })] + }) + ] + }), + controller == "openhab" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 mt-4 text-sm font-medium", + children: "Brightness item" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().openhab_options, + classNames, + onChange: (newValue) => { + setValue("openhab_item_dimmer", newValue ? newValue.value : "", { + shouldValidate: true, + shouldDirty: true + }); + setValue("openhab_item_switch", newValue ? newValue.value : "", { + shouldValidate: true, + shouldDirty: true + }); + }, + value: useAvailableEntitiesStore.getState().openhab_options.find((option) => option.value === getValues("openhab_item_dimmer")), + unstyled: true, + components: select_components$6, + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] }), + controller == "openhab" && getValues("can_color_temperature") == true && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 mt-4 text-sm font-medium", + children: "Color temperature item" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().openhab_options, + classNames, + onChange: (newValue) => { + setValue("openhab_item_color_temp", newValue ? newValue.value : "", { + shouldValidate: true, + shouldDirty: true + }); + }, + value: useAvailableEntitiesStore.getState().openhab_options.find((option) => option.value === getValues("openhab_item_color_temp")), + components: select_components$6, + unstyled: true, + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] }), + controller == "openhab" && getValues("can_rgb") == true && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 mt-4 text-sm font-medium", + children: "RGB item" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().openhab_options, + classNames, + onChange: (newValue) => setValue("openhab_item_rgb", newValue ? newValue.value : "", { + shouldValidate: true, + shouldDirty: true + }), + value: useAvailableEntitiesStore.getState().openhab_options.find((option) => option.value === getValues("openhab_item_rgb")), + components: select_components$6, + unstyled: true, + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex mt-4 justify-end items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + className: "btn btn-info", + disabled: !isValid, + children: "Save" + }) + }) + ] + }); +}; +//#endregion +//#region src/components/MultiStep_AddEditEntity/entity_types/step3_edit_switch.tsx +var schema$5 = object({ + id: number().nullable(), + type: string(), + entity_type: string(), + room_id: number(), + entities_page_id: number(), + room_view_position: number(), + friendly_name: string().min(1), + controller: string(), + home_assistant_name: string().optional(), + openhab_item_switch: string().optional() +}); +var CustomOption$5 = ({ innerProps, isDisabled, isFocused, isSelected, children, data }) => { + if (isDisabled) return null; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + ...innerProps, + className: `p-1 ${isSelected ? "bg-primary/20 rounded-sm" : ""} ${isFocused ? "bg-primary/20 rounded-sm" : ""}`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi ${data.icon} me-2` }), children] + }); +}; +var select_components$5 = { Option: CustomOption$5 }; +var MultiStep_AddEditEntity_Step3_Switch = ({ controller, room_id, entities_page_id, room_view_position, id, onComplete }) => { + const { handleSubmit, register, reset, getValues, setValue, formState: { isValid } } = useForm({ + resolver: u(schema$5), + defaultValues: { + id: id ?? null, + controller, + type: "entity", + entity_type: "light", + room_id, + entities_page_id, + room_view_position, + openhab_item_switch: "", + home_assistant_name: "" + } + }); + function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + (0, import_react.useEffect)(() => { + if (id != null) { + const entityData = useEntitiesPagesStore.getState().entities.find((entity) => entity.id == id); + reset(entityData); + } + }, [id, useEntitiesPagesStore.getState().entities]); + function saveEntity(data) { + fetch("/rest/entities/switches", { + credentials: "same-origin", + method: "PUT", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + }, + body: JSON.stringify(data) + }).then(async (response) => { + const data = await response.json(); + if (!response.ok) { + const error = data && data.message || response.status; + return Promise.reject(error); + } + onComplete?.(); + }).catch((error) => { + Notify({ + message: `Error saving entity. Error: ${error}`, + level: "error", + duration: 1e4 + }); + }); + } + const classNames = { + control: (state) => `${state.isFocused ? "border" : "border-0"} border-accent p-2.5 text-sm rounded-box bg-base-300 rounded-md`, + menu: () => "bg-base-300 p-2.5 rounded-box", + option: (state) => `p-1 ${state.isSelected ? "bg-primary/20 rounded-sm" : ""} ${state.isFocused ? "bg-primary/20 rounded-sm" : ""}` + }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { + onSubmit: handleSubmit(saveEntity), + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("controller") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("type") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("entity_type") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("room_id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("entities_page_id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("room_view_position") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "add_new_switch_name", + className: "block mb-2 text-sm font-medium", + children: "Name" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex flex-row-reverse", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text", + type: "text", + id: "add_new_switch_name", + ...register("friendly_name"), + required: true + }) + })] + }) + }), + controller == "home_assistant" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "Home Assistant entity" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().home_assistant_options.filter((option) => option.value.startsWith("switch.") || option.value.startsWith("input_boolean.")), + classNames, + onChange: (newValue) => { + setValue("home_assistant_name", newValue ? newValue.value : ""); + }, + unstyled: true, + components: select_components$5, + value: useAvailableEntitiesStore.getState().home_assistant_options.find((option) => option.value === getValues("home_assistant_name")), + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] }), + controller == "openhab" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 mt-4 text-sm font-medium", + children: "OpenHAB item" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().openhab_options, + classNames, + onChange: (newValue) => setValue("openhab_item_switch", newValue ? newValue.value : ""), + value: useAvailableEntitiesStore.getState().openhab_options.find((option) => option.value === getValues("openhab_item_switch")), + unstyled: true, + components: select_components$5, + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex mt-4 justify-end items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "submit", + className: "btn btn-info", + disabled: !isValid, + children: "Save" + }) + }) + ] + }); +}; +//#endregion +//#region src/components/MultiStep_AddEditEntity/entity_types/step3_edit_button.tsx +var schema$4 = object({ + id: number().nullable(), + type: string(), + entity_type: string(), + room_id: number(), + entities_page_id: number(), + room_view_position: number(), + friendly_name: string().min(1), + controller: string(), + home_assistant_name: string().optional(), + mqtt_topic: string().optional(), + mqtt_payload: string().optional() +}); +var CustomOption$4 = ({ innerProps, isDisabled, isFocused, isSelected, children, data }) => { + if (isDisabled) return null; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + ...innerProps, + className: `p-1 ${isSelected ? "bg-primary/20 rounded-sm" : ""} ${isFocused ? "bg-primary/20 rounded-sm" : ""}`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi ${data.icon} me-2` }), children] + }); +}; +var select_components$4 = { Option: CustomOption$4 }; +var MultiStep_AddEditEntity_Step3_Button = ({ controller, room_id, entities_page_id, room_view_position, id, onComplete }) => { + const { handleSubmit, register, reset, getValues, setValue, formState: { isValid } } = useForm({ + resolver: u(schema$4), + defaultValues: { + id: null, + controller, + type: "entity", + entity_type: "light", + room_id: room_id ?? -1, + entities_page_id, + room_view_position, + home_assistant_name: "", + mqtt_topic: "", + mqtt_payload: "" + } + }); + function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + (0, import_react.useEffect)(() => { + if (id != null) { + const entityData = useEntitiesPagesStore.getState().entities.find((entity) => entity.id == id); + reset(entityData); + } + }, [id, useEntitiesPagesStore.getState().entities]); + function saveEntity(data) { + fetch("/rest/entities/buttons", { + credentials: "same-origin", + method: "PUT", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + }, + body: JSON.stringify(data) + }).then(async (response) => { + const data = await response.json(); + if (!response.ok) { + const error = data && data.message || response.status; + return Promise.reject(error); + } + onComplete?.(); + }).catch((error) => { + Notify({ + message: `Error saving entity. Error: ${error}`, + level: "error", + duration: 1e4 + }); + }); + } + const classNames = { + control: (state) => `${state.isFocused ? "border" : "border-0"} border-accent p-2.5 text-sm rounded-box bg-base-300 rounded-md`, + menu: () => "bg-base-300 p-2.5 rounded-box", + option: (state) => `p-1 ${state.isSelected ? "bg-primary/20 rounded-sm" : ""} ${state.isFocused ? "bg-primary/20 rounded-sm" : ""}` + }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { + onSubmit: handleSubmit(saveEntity), + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("controller") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("type") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("entity_type") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("room_id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("entities_page_id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("room_view_position") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "add_new_button_name", + className: "block mb-2 text-sm font-medium", + children: "Name" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex flex-row-reverse", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text", + type: "text", + id: "add_new_button_name", + ...register("friendly_name"), + required: true + }) + })] + }) + }), + controller == "home_assistant" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "Home Assistant entity" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().home_assistant_options.filter((option) => option.value.startsWith("button.") || option.value.startsWith("input_button.")), + classNames, + onChange: (newValue) => { + setValue("home_assistant_name", newValue ? newValue.value : ""); + }, + unstyled: true, + components: select_components$4, + value: useAvailableEntitiesStore.getState().home_assistant_options.find((option) => option.value === getValues("home_assistant_name")), + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] }), + controller == "nspm" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "MQTT Topic" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex flex-row-reverse", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text", + type: "text", + ...register("mqtt_topic"), + required: true + }) + })] + }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "MQTT Payload" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex flex-row-reverse", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text", + type: "text", + ...register("mqtt_payload"), + required: true + }) + })] + }) + })] }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex mt-4 justify-end items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "submit", + className: "btn btn-info", + disabled: !isValid, + children: "Save" + }) + }) + ] + }); +}; +//#endregion +//#region src/components/MultiStep_AddEditEntity/entity_types/step3_edit_thermostat.tsx +var schema$3 = object({ + id: number().nullable(), + type: string(), + entity_type: string(), + room_id: number(), + entities_page_id: number(), + room_view_position: number(), + friendly_name: string().min(1), + step_size: float32(), + controller: string(), + use_current_temperature: string(), + home_assistant_name: string().optional(), + openhab_fan_mode_item: string().optional(), + openhab_hvac_mode_item: string().optional(), + openhab_preset_mode_item: string().optional(), + openhab_swing_mode_item: string().optional(), + openhab_swingh_mode_item: string().optional(), + openhab_temperature_item: string().optional(), + openhab_current_temperature_item: string().optional(), + fan_modes: array(object({ + icon: string(), + label: string().min(1), + value: string().min(1) + }).optional()), + hvac_modes: array(object({ + icon: string(), + label: string().min(1), + value: string().min(1) + }).optional()), + preset_modes: array(object({ + icon: string(), + label: string().min(1), + value: string().min(1) + })).optional(), + swing_modes: array(object({ + icon: string(), + label: string().min(1), + value: string().min(1) + })).optional(), + swingh_modes: array(object({ + icon: string(), + label: string().min(1), + value: string().min(1) + })).optional() +}); +var CustomOption$3 = ({ innerProps, isDisabled, isFocused, isSelected, children, data }) => { + if (isDisabled) return null; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + ...innerProps, + className: `p-1 ${isSelected ? "bg-primary/20 rounded-sm" : ""} ${isFocused ? "bg-primary/20 rounded-sm" : ""}`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi ${data.icon} me-2` }), children] + }); +}; +var select_components$3 = { Option: CustomOption$3 }; +var IconSelector = ({ value, onChange }) => { + const climateIcons = [ + { + name: "Off", + icon: "h" + }, + { + name: "Heating", + icon: "!" + }, + { + name: "Cooling", + icon: "8" + }, + { + name: "Hot/Cold", + icon: "#" + }, + { + name: "Thermostat", + icon: "7" + }, + { + name: "Thermostat Auto", + icon: "$" + }, + { + name: "Dry", + icon: "%" + }, + { + name: "Eco", + icon: "&" + }, + { + name: "Away", + icon: "'" + }, + { + name: "Home", + icon: "(" + }, + { + name: "Sleep", + icon: ")" + }, + { + name: "Boost", + icon: "*" + }, + { + name: "Comfort", + icon: "+" + }, + { + name: "Activity", + icon: "," + }, + { + name: "Defrosting", + icon: "-" + }, + { + name: "Swing Both", + icon: "." + }, + { + name: "Swing Horizontal", + icon: "/" + }, + { + name: "Swing Vertical", + icon: "0" + }, + { + name: "Fan Off", + icon: "1" + }, + { + name: "Fan Auto", + icon: "2" + }, + { + name: "Fan", + icon: "3" + }, + { + name: "Fan 1", + icon: "4" + }, + { + name: "Fan 2", + icon: "5" + }, + { + name: "Fan 3", + icon: "6" + } + ]; + const [selectedIcon, setSelectedIcon] = (0, import_react.useState)(value); + const [detailsOpen, setDetailsOpen] = (0, import_react.useState)(false); + const ref = (0, import_react.useRef)(null); + const select_icon = (icon) => { + setSelectedIcon(icon); + onChange(icon); + setDetailsOpen(false); + }; + (0, import_react.useEffect)(() => { + const listener = (event) => { + if (ref.current && !ref.current.contains(event.target)) setDetailsOpen(false); + }; + window.addEventListener("click", listener); + return () => { + window.removeEventListener("click", listener); + }; + }, [ref, detailsOpen]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { + open: detailsOpen, + onToggle: (e) => setDetailsOpen(e.currentTarget.open), + className: "dropdown dropdown-end h-auto", + id: "dropdown_icon_selector", + ref, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { + id: "icon_selector_button", + title: "Select icon", + className: "btn rounded-box h-full border-neutral border-y border-x-0 font-nspm-mdi w-full", + children: selectedIcon + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "dropdown-content bg-base-100 text-base-content rounded-box rounded-tr-none w-56 border border-primary", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center pb-1 mb-2 mt-1 border-b border-primary", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm", + children: "Select Icon" + }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "grid grid-cols-4 w-full", + children: climateIcons.map((icon) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + title: icon.name, + className: "btn btn-ghost rounded-none hover:btn-info icon-select-button", + "data-icon_value": icon.icon, + onClick: () => { + select_icon(icon.icon); + }, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "font-nspm-mdi", + children: icon.icon + }) + })) + })] + })] + }); +}; +var MultiStep_AddEditEntity_Step3_Thermostat = ({ controller, room_id, entities_page_id, room_view_position, id, onComplete }) => { + const { control, handleSubmit, register, reset, getValues, setValue, formState: { isValid }, watch } = useForm({ + resolver: u(schema$3), + defaultValues: { + id: id ?? null, + controller, + type: "entity", + entity_type: "thermostat", + room_id, + entities_page_id, + room_view_position, + use_current_temperature: "True", + home_assistant_name: "", + openhab_fan_mode_item: "", + openhab_hvac_mode_item: "", + openhab_preset_mode_item: "", + openhab_swing_mode_item: "", + openhab_swingh_mode_item: "", + openhab_temperature_item: "", + openhab_current_temperature_item: "", + step_size: .5, + fan_modes: [], + hvac_modes: [], + preset_modes: [], + swing_modes: [], + swingh_modes: [] + } + }); + const { entities } = useEntitiesPagesStore.getState(); + watch("use_current_temperature"); + const { fields: fanModeFields, append: appendFanModeField, remove: removeFanModeField } = useFieldArray({ + control, + name: "fan_modes" + }); + const { fields: hvacModeFields, append: appendHvacModeField, remove: removeHvacModeField } = useFieldArray({ + control, + name: "hvac_modes" + }); + const { fields: presetModeFields, append: appendPresetModeField, remove: removePresetModeField } = useFieldArray({ + control, + name: "preset_modes" + }); + const { fields: swingModeFields, append: appendSwingModeField, remove: removeSwingModeField } = useFieldArray({ + control, + name: "swing_modes" + }); + const { fields: swinghModeFields, append: appendSwinghModeField, remove: removeSwinghModeField } = useFieldArray({ + control, + name: "swingh_modes" + }); + function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + (0, import_react.useEffect)(() => { + if (id != null) { + const entityData = entities.find((entity) => entity.id == id); + console.log("Found entity data:", entityData); + reset(entityData); + if (entityData?.step_size) setValue("step_size", parseFloat(String(entityData.step_size))); + } + }, [ + id, + entities, + reset, + setValue + ]); + function saveEntity(data) { + fetch("/rest/entities/thermostats", { + credentials: "same-origin", + method: "PUT", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + }, + body: JSON.stringify(data) + }).then(async (response) => { + const data = await response.json(); + if (!response.ok) { + const error = data && data.message || response.status; + return Promise.reject(error); + } + onComplete?.(); + }).catch((error) => { + Notify({ + message: `Error saving entity. Error: ${error}`, + level: "error", + duration: 1e4 + }); + }); + } + function loadHaEntitySettings() { + const selected_entity = useAvailableEntitiesStore.getState().home_assistant_entities.find((entity) => entity.item_id == getValues("home_assistant_name")); + if (!selected_entity) return; + for (let i = fanModeFields.length - 1; i >= 0; i--) removeFanModeField(i); + for (let i = hvacModeFields.length - 1; i >= 0; i--) removeHvacModeField(i); + for (let i = presetModeFields.length - 1; i >= 0; i--) removePresetModeField(i); + for (let i = swingModeFields.length - 1; i >= 0; i--) removeSwingModeField(i); + for (let i = swinghModeFields.length - 1; i >= 0; i--) removeSwinghModeField(i); + const attributes = selected_entity.item.attributes; + if ("fan_modes" in attributes) attributes["fan_modes"].forEach((mode) => { + appendFanModeField({ + icon: "", + label: mode, + value: mode + }); + }); + if ("hvac_modes" in attributes) attributes["hvac_modes"].forEach((mode) => { + appendHvacModeField({ + icon: "", + label: mode, + value: mode + }); + }); + if ("preset_modes" in attributes) attributes["preset_modes"].forEach((mode) => { + appendPresetModeField({ + icon: "", + label: mode, + value: mode + }); + }); + if ("swing_modes" in attributes) attributes["swing_modes"].forEach((mode) => { + appendSwingModeField({ + icon: "", + label: mode, + value: mode + }); + }); + if ("swing_horizontal_modes" in attributes) attributes["swing_horizontal_modes"].forEach((mode) => { + appendSwinghModeField({ + icon: "", + label: mode, + value: mode + }); + }); + } + const classNames = { + control: (state) => `${state.isFocused ? "border" : "border-0"} border-accent p-2.5 text-sm rounded-box bg-base-300 text-base-content rounded-md`, + menu: () => "bg-base-300 p-2.5 rounded-box text-base-content", + option: (state) => `p-1 ${state.isSelected ? "bg-primary/20 rounded-sm" : ""} ${state.isFocused ? "bg-primary/20 rounded-sm" : ""}` + }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { + onSubmit: handleSubmit(saveEntity), + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("controller") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("type") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("entity_type") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("room_id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("entities_page_id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("room_view_position") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "add_new_switch_name", + className: "block mb-2 text-sm font-medium", + children: "Name" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex flex-row-reverse", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 text-base-content border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text", + type: "text", + id: "add_new_switch_name", + ...register("friendly_name"), + required: true + }) + })] + }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mb-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "Step size" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "join w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + onClick: () => { + if (getValues("step_size") > 10) setValue("step_size", 10); + else if (getValues("step_size") > .1) setValue("step_size", Math.round(getValues("step_size") * 10 - 1) / 10); + else setValue("step_size", .1); + }, + className: "btn h-auto rounded-l-md border-neutral border border-r-0 ", + children: "-" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "number", + className: "join-item number-apperance-none outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block min-w-0 w-full text-sm p-2.5", + step: "0.1", + min: "0.1", + max: "10", + ...register("step_size") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + onClick: () => { + if (getValues("step_size") < .1) setValue("step_size", .1); + else if (getValues("step_size") < 10) setValue("step_size", Math.round(getValues("step_size") * 10 + 1) / 10); + else setValue("step_size", 10); + }, + className: "btn h-auto rounded-r-md border-neutral border border-l-0", + children: "+" + }) + ] + })] + }), + controller == "home_assistant" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mb-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "Home Assistant entity" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().home_assistant_options.filter((option) => option.value.startsWith("climate.")), + classNames, + onChange: (newValue) => { + setValue("home_assistant_name", newValue ? newValue.value : "", { + shouldValidate: true, + shouldDirty: true + }); + }, + unstyled: true, + components: select_components$3, + value: useAvailableEntitiesStore.getState().home_assistant_options.find((option) => option.value === getValues("home_assistant_name")), + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "mt-1", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + onClick: loadHaEntitySettings, + className: "btn btn-xs w-full btn-info", + children: "Load settings from HA entity" + }) + })] + }), + controller == "openhab" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mt-4 border border-primary rounded-box p-4 pt-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-lg mb-4", + children: "Temperature" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "OpenHAB target temperature item" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().openhab_options, + classNames, + onChange: (newValue) => setValue("openhab_temperature_item", newValue ? newValue.value : ""), + value: useAvailableEntitiesStore.getState().openhab_options.find((option) => option.value === getValues("openhab_temperature_item")), + unstyled: true, + components: select_components$3, + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mt-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "OpenHAB current temperature item" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().openhab_options, + classNames, + onChange: (newValue) => setValue("openhab_current_temperature_item", newValue ? newValue.value : ""), + value: useAvailableEntitiesStore.getState().openhab_options.find((option) => option.value === getValues("openhab_current_temperature_item")), + unstyled: true, + components: select_components$3, + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] + }) + ] + }) }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "mr-1", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full text-sm font-medium border border-neutral rounded-lg bg-base-300", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center ps-3 w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "radio", + value: "False", + ...register("use_current_temperature"), + checked: getValues("use_current_temperature") == "False", + className: "w-4 h-4 radio radio-accent" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "relay1_off", + className: "w-full py-3 ms-2 text-sm font-medium", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block mb-2 text-sm font-medium", + children: "Use current temperature from room or internal thermistor" + }) + })] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center ps-3 w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "radio", + value: "True", + ...register("use_current_temperature"), + checked: getValues("use_current_temperature") == "True", + className: "w-4 h-4 radio radio-accent" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { + htmlFor: "relay1_on", + className: "w-full py-3 ms-2 text-sm font-medium", + children: [controller == "home_assistant" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block mb-2 text-sm font-medium", + children: "Use current temperature from thermostat entity if available" + }), controller == "openhab" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block mb-2 text-sm font-medium", + children: "Use current temperature from OpenHAB item" + })] + })] + })] + }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mt-4 border border-primary rounded-box p-4 pt-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-lg mb-4", + children: "Fan modes" + }), + controller == "openhab" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mb-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "OpenHAB fan mode item" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().openhab_options, + classNames, + onChange: (newValue) => setValue("openhab_fan_mode_item", newValue ? newValue.value : ""), + value: useAvailableEntitiesStore.getState().openhab_options.find((option) => option.value === getValues("openhab_fan_mode_item")), + unstyled: true, + components: select_components$3, + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + id: `fan_mode_options`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "grid grid-cols-[1fr_1fr_3rem_3rem] items-stretch justify-center w-full mb-1 gap-1 mt-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm ml-2", + children: "Label" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm ml-2", + children: "Value" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm ml-2", + children: "Icon" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-sm ml-2" }), + (() => { + const elements = []; + fanModeFields.forEach((field, index) => { + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "text", + ...register(`fan_modes.${index}.label`), + className: "rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5", + title: "Label" + })); + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "text", + ...register(`fan_modes.${index}.value`), + className: "rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5", + title: "Value" + })); + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconSelector, { + value: field.icon, + onChange: (icon) => setValue(`fan_modes.${index}.icon`, icon) + })); + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn h-auto rounded-box border border-neutral border-l-0 text-base-content bg-error/20 hover:bg-error/70 join-item ring-0 inset-ring-0 focus:ring-0", + title: "Remove fan mode", + onClick: () => removeFanModeField(index), + children: "✕" + })); + }); + return elements; + })() + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-xs w-full btn-success", + title: "Add fan mode", + onClick: () => appendFanModeField({ + icon: "", + label: "", + value: "" + }), + children: "Add fan mode" + })] + }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mt-4 border border-primary rounded-box p-4 pt-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "input_field_label block mb-2 text-sm font-medium", + children: "HVAC modes" + }), + controller == "openhab" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mb-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "OpenHAB HVAC mode item" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().openhab_options, + classNames, + onChange: (newValue) => setValue("openhab_hvac_mode_item", newValue ? newValue.value : ""), + value: useAvailableEntitiesStore.getState().openhab_options.find((option) => option.value === getValues("openhab_hvac_mode_item")), + unstyled: true, + components: select_components$3, + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + id: `hvac_mode_options`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "grid grid-cols-[1fr_1fr_3rem_3rem] items-stretch justify-center w-full mb-1 gap-1 mt-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm ml-2", + children: "Label" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm ml-2", + children: "Value" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm ml-2", + children: "Icon" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-sm ml-2" }), + (() => { + const elements = []; + hvacModeFields.forEach((field, index) => { + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "text", + ...register(`hvac_modes.${index}.label`), + className: "rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5", + title: "Label" + })); + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "text", + ...register(`hvac_modes.${index}.value`), + className: "rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5", + title: "Value" + })); + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconSelector, { + value: field.icon, + onChange: (icon) => setValue(`hvac_modes.${index}.icon`, icon) + })); + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn h-auto rounded-box border border-neutral border-l-0 text-base-content bg-error/20 hover:bg-error/70 join-item ring-0 inset-ring-0 focus:ring-0", + title: "Remove HVAC mode", + onClick: () => removeHvacModeField(index), + children: "✕" + })); + }); + return elements; + })() + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-xs w-full btn-success", + title: "Add HVAC mode", + onClick: () => appendHvacModeField({ + icon: "", + label: "", + value: "" + }), + children: "Add HVAC mode" + })] + }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mt-4 border border-primary rounded-box p-4 pt-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "input_field_label block mb-2 text-sm font-medium", + children: "Presets" + }), + controller == "openhab" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mb-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "OpenHAB preset item" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().openhab_options, + classNames, + onChange: (newValue) => setValue("openhab_preset_mode_item", newValue ? newValue.value : ""), + value: useAvailableEntitiesStore.getState().openhab_options.find((option) => option.value === getValues("openhab_preset_mode_item")), + unstyled: true, + components: select_components$3, + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + id: `preset_mode_options`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "grid grid-cols-[1fr_1fr_3rem_3rem] items-stretch justify-center w-full mb-1 gap-1 mt-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm ml-2", + children: "Label" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm ml-2", + children: "Value" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm ml-2", + children: "Icon" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-sm ml-2" }), + (() => { + const elements = []; + presetModeFields.forEach((field, index) => { + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "text", + ...register(`preset_modes.${index}.label`), + className: "rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5", + title: "Label" + })); + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "text", + ...register(`preset_modes.${index}.value`), + className: "rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5", + title: "Value" + })); + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconSelector, { + value: field.icon, + onChange: (icon) => setValue(`preset_modes.${index}.icon`, icon) + })); + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn h-auto rounded-box border border-neutral border-l-0 text-base-content bg-error/20 hover:bg-error/70 join-item ring-0 inset-ring-0 focus:ring-0", + title: "Remove preset mode", + onClick: () => removePresetModeField(index), + children: "✕" + })); + }); + return elements; + })() + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-xs w-full btn-success", + title: "Add preset mode", + onClick: () => appendPresetModeField({ + icon: "", + label: "", + value: "" + }), + children: "Add preset" + })] + }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mt-4 border border-primary rounded-box p-4 pt-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "input_field_label block mb-2 text-sm font-medium", + children: "Swing modes" + }), + controller == "openhab" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mb-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "OpenHAB swing item" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().openhab_options, + classNames, + onChange: (newValue) => setValue("openhab_swing_mode_item", newValue ? newValue.value : ""), + value: useAvailableEntitiesStore.getState().openhab_options.find((option) => option.value === getValues("openhab_swing_mode_item")), + unstyled: true, + components: select_components$3, + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + id: `swing_mode_options`, + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "grid grid-cols-[1fr_1fr_3rem_3rem] items-stretch justify-center w-full mb-1 gap-1 mt-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm ml-2", + children: "Label" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm ml-2", + children: "Value" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm ml-2", + children: "Icon" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-sm ml-2" }), + (() => { + const elements = []; + swingModeFields.forEach((field, index) => { + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "text", + ...register(`swing_modes.${index}.label`), + className: "rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5", + title: "Label" + })); + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "text", + ...register(`swing_modes.${index}.value`), + className: "rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5", + title: "Value" + })); + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconSelector, { + value: field.icon, + onChange: (icon) => setValue(`swing_modes.${index}.icon`, icon) + })); + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn h-auto rounded-box border border-neutral border-l-0 text-base-content bg-error/20 hover:bg-error/70 join-item ring-0 inset-ring-0 focus:ring-0", + title: "Remove swing mode", + onClick: () => removeSwingModeField(index), + children: "✕" + })); + }); + return elements; + })() + ] + }), + "min-content", + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-xs w-full btn-success", + title: "Add swing mode", + onClick: () => appendSwingModeField({ + icon: "", + label: "", + value: "" + }), + children: "Add swing mode" + }) + ] + }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mt-4 border border-primary rounded-box p-4 pt-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "input_field_label block mb-2 text-sm font-medium", + children: "Horizontal swing modes" + }), + controller == "openhab" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mb-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "OpenHAB horizontal swing item" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().openhab_options, + classNames, + onChange: (newValue) => setValue("openhab_swingh_mode_item", newValue ? newValue.value : ""), + value: useAvailableEntitiesStore.getState().openhab_options.find((option) => option.value === getValues("openhab_swingh_mode_item")), + unstyled: true, + components: select_components$3, + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + id: `swing_mode_options`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "grid grid-cols-[1fr_1fr_3rem_3rem] items-stretch justify-center w-full mb-1 gap-1 mt-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm ml-2", + children: "Label" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm ml-2", + children: "Value" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-sm ml-2", + children: "Icon" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-sm ml-2" }), + (() => { + const elements = []; + swinghModeFields.forEach((field, index) => { + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "text", + ...register(`swingh_modes.${index}.label`), + className: "rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5", + title: "Label" + })); + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "text", + ...register(`swingh_modes.${index}.value`), + className: "rounded-box outline-none bg-base-300 text-base-content border-neutral border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5", + title: "Value" + })); + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconSelector, { + value: field.icon, + onChange: (icon) => setValue(`swingh_modes.${index}.icon`, icon) + })); + elements.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn h-auto rounded-box border border-neutral border-l-0 text-base-content bg-error/20 hover:bg-error/70 join-item ring-0 inset-ring-0 focus:ring-0", + title: "Remove horizontal swing mode", + onClick: () => removeSwinghModeField(index), + children: "✕" + })); + }); + return elements; + })() + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-xs w-full btn-success", + title: "Add horizontal swing mode", + onClick: () => appendSwinghModeField({ + icon: "", + label: "", + value: "" + }), + children: "Add horizontal swing mode" + })] + }) + ] + }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex mt-4 justify-end items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "submit", + className: "btn btn-info", + disabled: !isValid, + children: "Save" + }) + }) + ] + }); +}; +//#endregion +//#region src/components/MultiStep_AddEditEntity/entity_types/step3_edit_scene.tsx +var schema$2 = object({ + id: number().nullable(), + type: string(), + controller: string(), + scene_type: string(), + room_id: number().nullable(), + entities_page_id: number(), + room_view_position: number(), + friendly_name: string().min(1), + backend_name: string().optional() +}); +var CustomOption$2 = ({ innerProps, isDisabled, isFocused, isSelected, children, data }) => { + if (isDisabled) return null; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + ...innerProps, + className: `p-1 ${isSelected ? "bg-primary/20 rounded-sm" : ""} ${isFocused ? "bg-primary/20 rounded-sm" : ""}`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi ${data.icon} me-2` }), children] + }); +}; +var select_components$2 = { Option: CustomOption$2 }; +var MultiStep_AddEditEntity_Step3_Scene = ({ controller, room_id, entities_page_id, room_view_position, id, onComplete }) => { + const { handleSubmit, register, reset, getValues, setValue, formState: { isValid } } = useForm({ + resolver: u(schema$2), + defaultValues: { + id: id ?? null, + type: "scene", + scene_type: "", + controller, + room_id, + entities_page_id, + room_view_position, + friendly_name: "", + backend_name: "" + } + }); + if (controller == "home_assistant") setValue("scene_type", "home_assistant"); + else if (controller == "openhab") setValue("scene_type", "openhab"); + else if (controller == "nspm") setValue("scene_type", "nspm_scene"); + function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + (0, import_react.useEffect)(() => { + if (id != null) { + const sceneData = useEntitiesPagesStore.getState().scenes.find((scene) => scene.id == id); + reset(sceneData); + } + }, [id, useEntitiesPagesStore.getState().scenes]); + function saveEntity(data) { + fetch("/rest/entities/scenes", { + credentials: "same-origin", + method: "PUT", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + }, + body: JSON.stringify(data) + }).then(async (response) => { + const data = await response.json(); + if (!response.ok) { + const error = data && data.message || response.status; + return Promise.reject(error); + } + onComplete?.(); + }).catch((error) => { + Notify({ + message: `Error saving entity. Error: ${error}`, + level: "error", + duration: 1e4 + }); + }); + } + const classNames = { + control: (state) => `${state.isFocused ? "border" : "border-0"} border-accent p-2.5 text-sm rounded-box bg-base-300 rounded-md`, + menu: () => "bg-base-300 p-2.5 rounded-box", + option: (state) => `p-1 ${state.isSelected ? "bg-primary/20 rounded-sm" : ""} ${state.isFocused ? "bg-primary/20 rounded-sm" : ""}` + }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { + onSubmit: handleSubmit(saveEntity), + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("type") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("scene_type") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("room_id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("entities_page_id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("room_view_position") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "add_new_switch_name", + className: "block mb-2 text-sm font-medium", + children: "Name" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex flex-row-reverse", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/search_text", + type: "text", + ...register("friendly_name"), + required: true + }) + })] + }) + }), + controller == "home_assistant" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "Home Assistant scene" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().home_assistant_options.filter((option) => option.value.startsWith("scene.") || option.value.startsWith("script.")), + classNames, + onChange: (newValue) => { + setValue("backend_name", newValue ? newValue.value : ""); + }, + unstyled: true, + components: select_components$2, + value: useAvailableEntitiesStore.getState().home_assistant_options.find((option) => option.value === getValues("backend_name")), + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] }), + controller == "openhab" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 mt-4 text-sm font-medium", + children: "OpenHAB item" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().openhab_options, + classNames, + onChange: (newValue) => setValue("backend_name", newValue ? newValue.value : ""), + value: useAvailableEntitiesStore.getState().openhab_options.find((option) => option.value === getValues("backend_name")), + unstyled: true, + components: select_components$2, + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex mt-4 justify-end items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "submit", + className: "btn btn-info", + disabled: !isValid, + children: "Save" + }) + }) + ] + }); +}; +//#endregion +//#region src/components/MultiStep_AddEditEntity/entity_types/step3_edit_media_player.tsx +var schema$1 = object({ + id: number().nullable(), + type: string(), + entity_type: string(), + room_id: number(), + entities_page_id: number(), + room_view_position: number(), + friendly_name: string().min(1), + controller: string(), + home_assistant_name: string().min(1), + volume_step: number().int().min(1).max(100), + source_volume_strategy: _enum([ + "none", + "player_attributes", + "source_entity" + ]), + source_entity_attribute: string(), + source_volume_attribute: string() +}).superRefine((data, ctx) => { + if (data.source_volume_strategy != "none" && data.source_entity_attribute.trim() == "") ctx.addIssue({ + code: "custom", + path: ["source_entity_attribute"], + message: "Required for this multi-room setup" + }); + if (data.source_volume_strategy == "player_attributes" && data.source_volume_attribute.trim() == "") ctx.addIssue({ + code: "custom", + path: ["source_volume_attribute"], + message: "Required for this multi-room setup" + }); +}); +var CustomOption$1 = ({ innerProps, isDisabled, isFocused, isSelected, children, data }) => { + if (isDisabled) return null; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + ...innerProps, + className: `p-1 ${isSelected ? "bg-primary/20 rounded-sm" : ""} ${isFocused ? "bg-primary/20 rounded-sm" : ""}`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi ${data.icon} me-2` }), children] + }); +}; +var select_components$1 = { Option: CustomOption$1 }; +var multi_room_strategies = [{ + value: "source_entity", + label: "The room player says which player feeds it", + description: "An attribute on the room player holds the entity ID of the source player currently feeding it. The panel follows that player and uses its own volume and sources, even when the source changes." +}, { + value: "player_attributes", + label: "The room player reports the source player and its volume", + description: "Attributes on the room player hold both the entity ID of the source player and the source volume. Use this when the integration reports the source volume on the room player itself." +}]; +var MultiStep_AddEditEntity_Step3_MediaPlayer = ({ controller, room_id, entities_page_id, room_view_position, id, onComplete }) => { + const defaultValues = { + id: id ?? null, + controller, + type: "entity", + entity_type: "media_player", + friendly_name: "", + room_id, + entities_page_id, + room_view_position, + home_assistant_name: "", + volume_step: 5, + source_volume_strategy: "none", + source_entity_attribute: "", + source_volume_attribute: "" + }; + const { handleSubmit, register, reset, setValue, watch, formState: { isValid, errors } } = useForm({ + resolver: u(schema$1), + mode: "onChange", + defaultValues + }); + const home_assistant_name = watch("home_assistant_name"); + const source_volume_strategy = watch("source_volume_strategy"); + const [multiRoom, setMultiRoom] = (0, import_react.useState)(false); + const selectMultiRoom = (multi_room) => { + setMultiRoom(multi_room); + setValue("source_volume_strategy", multi_room ? "source_entity" : "none", { shouldValidate: true }); + }; + function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + (0, import_react.useEffect)(() => { + if (id != null) { + const entityData = useEntitiesPagesStore.getState().entities.find((entity) => entity.id == id); + const values = { + ...defaultValues, + ...entityData + }; + reset(values); + setMultiRoom(values.source_volume_strategy != "none"); + } + }, [id, useEntitiesPagesStore.getState().entities]); + function saveEntity(data) { + if (data.source_volume_strategy == "none") data = { + ...data, + source_entity_attribute: "", + source_volume_attribute: "" + }; + else if (data.source_volume_strategy == "source_entity") data = { + ...data, + source_volume_attribute: "" + }; + fetch("/rest/entities/media_players", { + credentials: "same-origin", + method: "PUT", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + }, + body: JSON.stringify(data) + }).then(async (response) => { + const data = await response.json(); + if (!response.ok) { + const error = data && data.message || response.status; + return Promise.reject(error); + } + onComplete?.(); + }).catch((error) => { + Notify({ + message: `Error saving entity. Error: ${error}`, + level: "error", + duration: 1e4 + }); + }); + } + const selected_entity = useAvailableEntitiesStore.getState().home_assistant_entities.find((entity) => entity.item_id == home_assistant_name); + const attribute_names = Object.keys(selected_entity?.item?.attributes ?? {}).sort(); + const classNames = { + control: (state) => `${state.isFocused ? "border" : "border-0"} border-accent p-2.5 text-sm rounded-box bg-base-300 rounded-md`, + menu: () => "bg-base-300 p-2.5 rounded-box", + option: (state) => `p-1 ${state.isSelected ? "bg-primary/20 rounded-sm" : ""} ${state.isFocused ? "bg-primary/20 rounded-sm" : ""}` + }; + const text_input_class = "outline-none bg-base-300 border-neutral rounded-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5"; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { + onSubmit: handleSubmit(saveEntity), + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("controller") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("type") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("entity_type") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("room_id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("entities_page_id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("room_view_position") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "add_new_media_player_name", + className: "block mb-2 text-sm font-medium", + children: "Name" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex flex-row-reverse", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: text_input_class, + type: "text", + id: "add_new_media_player_name", + ...register("friendly_name"), + required: true + }) + })] + }) + }), + controller == "home_assistant" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mb-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "Home Assistant entity" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().home_assistant_options.filter((option) => option.value.startsWith("media_player.")), + classNames, + onChange: (newValue) => { + setValue("home_assistant_name", newValue ? newValue.value : "", { shouldValidate: true }); + }, + unstyled: true, + components: select_components$1, + value: useAvailableEntitiesStore.getState().home_assistant_options.find((option) => option.value === home_assistant_name) ?? null, + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mb-4", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "add_new_media_player_volume_step", + className: "block mb-2 text-sm font-medium", + children: "Volume step (%)" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "number", + id: "add_new_media_player_volume_step", + className: text_input_class, + step: "1", + min: "1", + max: "100", + ...register("volume_step", { valueAsNumber: true }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block mt-1 text-xs text-base-content/50", + children: "How much one volume up/down press on the panel changes the volume." + }), + errors.volume_step && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block mt-1 text-xs text-error", + children: "Must be a whole number between 1 and 100." + }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mt-4 border border-primary rounded-box p-4 pt-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-lg", + children: "Setup" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mt-2 w-full text-sm font-medium border border-neutral rounded-lg bg-base-300", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center ps-3 w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "radio", + id: "media_player_setup_standalone", + name: "media_player_setup", + checked: !multiRoom, + onChange: () => selectMultiRoom(false), + className: "w-4 h-4 radio radio-accent" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { + htmlFor: "media_player_setup_standalone", + className: "w-full py-3 ms-2 text-sm font-medium cursor-pointer", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block text-sm font-medium", + children: "Standalone device" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block text-xs text-base-content/50", + children: "The panel controls this media player's own volume and sources." + })] + })] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center ps-3 w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "radio", + id: "media_player_setup_multi_room", + name: "media_player_setup", + checked: multiRoom, + onChange: () => selectMultiRoom(true), + className: "w-4 h-4 radio radio-accent" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { + htmlFor: "media_player_setup_multi_room", + className: "w-full py-3 ms-2 text-sm font-medium cursor-pointer", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block text-sm font-medium", + children: "Part of a multi-room audio setup" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block text-xs text-base-content/50", + children: "Another media player, the source player, feeds this room, for example through an audio matrix. The panel can also control the source player's volume and select between its sources." + })] + })] + })] + }), + multiRoom && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mt-4 mb-2 text-sm font-medium", + children: "How does Home Assistant tell which source player feeds this room?" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "w-full text-sm font-medium border border-neutral rounded-lg bg-base-300", + children: multi_room_strategies.map((strategy) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center ps-3 w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "radio", + id: `media_player_source_volume_${strategy.value}`, + value: strategy.value, + ...register("source_volume_strategy"), + className: "w-4 h-4 radio radio-accent" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { + htmlFor: `media_player_source_volume_${strategy.value}`, + className: "w-full py-3 ms-2 text-sm font-medium cursor-pointer", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block text-sm font-medium", + children: strategy.label + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block text-xs text-base-content/50", + children: strategy.description + })] + })] + }, strategy.value)) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("datalist", { + id: "media_player_attribute_names", + children: attribute_names.map((attribute) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: attribute }, attribute)) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mt-4", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "add_new_media_player_source_entity_attribute", + className: "block mb-2 text-sm font-medium", + children: "Source player attribute" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "text", + id: "add_new_media_player_source_entity_attribute", + className: text_input_class, + list: "media_player_attribute_names", + ...register("source_entity_attribute") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "block mt-1 text-xs text-base-content/50", + children: [ + "Name of the attribute on the room player holding the entity ID of the source player, for example ", + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: "source_entity_id" }), + "." + ] + }), + errors.source_entity_attribute && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block mt-1 text-xs text-error", + children: errors.source_entity_attribute.message + }) + ] + }), + source_volume_strategy == "player_attributes" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mt-4", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "add_new_media_player_source_volume_attribute", + className: "block mb-2 text-sm font-medium", + children: "Source volume attribute" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "text", + id: "add_new_media_player_source_volume_attribute", + className: text_input_class, + list: "media_player_attribute_names", + ...register("source_volume_attribute") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block mt-1 text-xs text-base-content/50", + children: "Name of the attribute on the room player holding the source volume, from 0.0 to 1.0. Volume changes are sent to the source player." + }), + errors.source_volume_attribute && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block mt-1 text-xs text-error", + children: errors.source_volume_attribute.message + }) + ] + }) + ] }) + ] + }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex mt-4 justify-end items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "submit", + className: "btn btn-info", + disabled: !isValid, + children: "Save" + }) + }) + ] + }); +}; +//#endregion +//#region src/components/MultiStep_AddEditEntity/entity_types/step3_edit_cover.tsx +var schema = object({ + id: number().nullable(), + type: string(), + entity_type: string(), + room_id: number(), + entities_page_id: number(), + room_view_position: number(), + friendly_name: string().min(1), + controller: string(), + home_assistant_name: string(), + openhab_item: string(), + openhab_tilt_item: string(), + invert_positions: boolean().optional(), + position_preset1: number(), + position_preset2: number(), + position_preset3: number(), + tilt_preset1: number(), + tilt_preset2: number(), + tilt_preset3: number() +}).superRefine((data, ctx) => { + if (data.controller == "home_assistant") { + if (!data.home_assistant_name.startsWith("cover.")) ctx.addIssue({ + code: "custom", + path: ["home_assistant_name"], + message: "Select a Home Assistant cover entity" + }); + } else if (data.controller == "openhab") { + if (data.openhab_item.trim() == "") ctx.addIssue({ + code: "custom", + path: ["openhab_item"], + message: "Select an OpenHAB Rollershutter item" + }); + } +}); +var CustomOption = ({ innerProps, isDisabled, isFocused, isSelected, children, data }) => { + if (isDisabled) return null; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + ...innerProps, + className: `p-1 ${isSelected ? "bg-primary/20 rounded-sm" : ""} ${isFocused ? "bg-primary/20 rounded-sm" : ""}`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi ${data.icon} me-2` }), children] + }); +}; +var select_components = { Option: CustomOption }; +var selectStyles = { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) +}; +var MultiStep_AddEditEntity_Step3_Cover = ({ controller, room_id, entities_page_id, room_view_position, id, onComplete }) => { + const defaultValues = { + id: id ?? null, + controller, + type: "entity", + entity_type: "cover", + friendly_name: "", + room_id, + entities_page_id, + room_view_position, + home_assistant_name: "", + openhab_item: "", + openhab_tilt_item: "", + invert_positions: false, + position_preset1: 0, + position_preset2: 0, + position_preset3: 0, + tilt_preset1: 0, + tilt_preset2: 0, + tilt_preset3: 0 + }; + const { handleSubmit, register, reset, setValue, watch, formState: { isValid, errors } } = useForm({ + resolver: u(schema), + mode: "onChange", + defaultValues + }); + const home_assistant_name = watch("home_assistant_name"); + const openhab_item = watch("openhab_item"); + const openhab_tilt_item = watch("openhab_tilt_item"); + watch("position_preset1"); + watch("position_preset2"); + watch("position_preset3"); + watch("tilt_preset1"); + watch("tilt_preset2"); + watch("tilt_preset3"); + function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + const entity = useEntitiesPagesStore((s) => s.entities.find((e) => e.id == id)); + (0, import_react.useEffect)(() => { + if (!entity) return; + reset({ + ...defaultValues, + ...entity + }); + }, [entity?.id]); + function saveEntity(data) { + fetch("/rest/entities/covers", { + credentials: "same-origin", + method: "PUT", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + }, + body: JSON.stringify(data) + }).then(async (response) => { + const data = await response.json(); + if (!response.ok) { + const error = data && data.message || response.status; + return Promise.reject(error); + } + onComplete?.(); + }).catch((error) => { + Notify({ + message: `Error saving entity. Error: ${error}`, + level: "error", + duration: 1e4 + }); + }); + } + const ha_entity = useAvailableEntitiesStore.getState().home_assistant_entities.find((entity) => entity.item_id == home_assistant_name); + const supported_features = Number(ha_entity?.item?.attributes?.supported_features ?? 0); + const supports_position = (supported_features & 4) !== 0; + const supports_tilt = (supported_features & 128) !== 0; + const openhab_cover_options = useAvailableEntitiesStore.getState().openhab_items.filter((item) => item.item?.type === "Rollershutter").map((item) => ({ + value: item.item_id, + label: item.label, + icon: "mdi-window-shutter", + type: item.type + })); + const classNames = { + control: (state) => `${state.isFocused ? "border" : "border-0"} border-accent p-2.5 text-sm rounded-box bg-base-300 rounded-md`, + menu: () => "bg-base-300 p-2.5 rounded-box", + option: (state) => `p-1 ${state.isSelected ? "bg-primary/20 rounded-sm" : ""} ${state.isFocused ? "bg-primary/20 rounded-sm" : ""}` + }; + const text_input_class = "outline-none bg-base-300 border-neutral first:rounded-l-md last:rounded-r-md border focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5"; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { + onSubmit: handleSubmit(saveEntity), + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("controller") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("type") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("entity_type") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("room_id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("entities_page_id") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + ...register("room_view_position") + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 duration-500 transition-transform ease-linear", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "add_new_cover_name", + className: "block mb-2 text-sm font-medium", + children: "Name" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex flex-row-reverse", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: text_input_class, + type: "text", + id: "add_new_cover_name", + ...register("friendly_name"), + required: true + }) + })] + }) + }), + controller == "home_assistant" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "Home Assistant entity" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: useAvailableEntitiesStore.getState().home_assistant_options.filter((option) => option.value.startsWith("cover.")), + classNames, + onChange: (newValue) => { + setValue("home_assistant_name", newValue ? newValue.value : "", { shouldValidate: true }); + }, + unstyled: true, + components: select_components, + value: useAvailableEntitiesStore.getState().home_assistant_options.find((option) => option.value === home_assistant_name) ?? null, + styles: selectStyles + }), + ha_entity && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "block mt-2 text-xs text-base-content/50", + children: [ + "Detected: ", + supports_position ? "position" : "open/close only", + supports_tilt ? ", tilt" : "" + ] + }), + errors.home_assistant_name && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block mt-1 text-xs text-error", + children: "Select a Home Assistant cover entity." + }) + ] }), + controller == "openhab" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "OpenHAB Rollershutter item" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: openhab_cover_options, + classNames, + onChange: (newValue) => setValue("openhab_item", newValue ? newValue.value : "", { shouldValidate: true }), + unstyled: true, + components: select_components, + value: openhab_cover_options.find((option) => option.value === openhab_item) ?? null, + styles: selectStyles + }), + errors.openhab_item && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block mt-1 text-xs text-error", + children: "Select an OpenHAB Rollershutter item." + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "OpenHAB Tilt item" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: openhab_cover_options, + classNames, + onChange: (newValue) => setValue("openhab_tilt_item", newValue ? newValue.value : "", { shouldValidate: true }), + unstyled: true, + components: select_components, + value: openhab_cover_options.find((option) => option.value === openhab_tilt_item) ?? null, + styles: selectStyles + }), + errors.openhab_tilt_item && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block mt-1 text-xs text-error", + children: "Select an OpenHAB Rollershutter item." + }) + ] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "form-control mt-4", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { + className: "label cursor-pointer justify-start gap-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "checkbox", + className: "checkbox checkbox-sm checkbox-accent", + ...register("invert_positions") + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "label-text", + children: "Invert positions" + })] + }) + }), + (controller == "home_assistant" && supports_position || controller == "openhab") && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mt-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "label", + children: "Position presets" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "join w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "number", + ...register("position_preset1", { valueAsNumber: true }), + min: 0, + max: 100, + className: `join-item ${text_input_class}` + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "number", + ...register("position_preset2", { valueAsNumber: true }), + min: 0, + max: 100, + className: `join-item ${text_input_class}` + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "number", + ...register("position_preset3", { valueAsNumber: true }), + min: 0, + max: 100, + className: `join-item ${text_input_class}` + }) + ] + })] + }), + (controller == "home_assistant" && supports_tilt || controller == "openhab" && openhab_tilt_item != "") && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mt-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "label", + children: "Tilt presets" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "join w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "number", + ...register("tilt_preset1", { valueAsNumber: true }), + min: 0, + max: 100, + className: `join-item ${text_input_class}` + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "number", + ...register("tilt_preset2", { valueAsNumber: true }), + min: 0, + max: 100, + className: `join-item ${text_input_class}` + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "number", + ...register("tilt_preset3", { valueAsNumber: true }), + min: 0, + max: 100, + className: `join-item ${text_input_class}` + }) + ] + })] + }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex mt-4 justify-end items-center", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "submit", + className: "btn btn-info", + disabled: !isValid, + children: "Save" + }) + }) + ] + }); +}; +//#endregion +//#region src/components/MultiStep_AddEditEntity/MultiStep_AddEditEntity.tsx +var MultiStep_AddEditEntity_exports = /* @__PURE__ */ __exportAll({ default: () => MultiStep_AddOrEditEntity }); +var MultiStep_AddOrEditEntity = ({ room_id, entities_page_id, room_view_position, type, id, onComplete, onClose, opened, setOpened }) => { + const [step, setStep] = (0, import_react.useState)(1); + const [formData, setFormData] = (0, import_react.useState)({ + room_id, + entities_page_id, + room_view_position, + controller: "", + type, + entity_type: "", + friendly_name: "", + id: null + }); + const [entitiesPageType, setEntitiesPageType] = (0, import_react.useState)(""); + (0, import_react.useEffect)(() => { + if (useAvailableEntitiesStore.getState().status == "none") useAvailableEntitiesStore.getState().fetchEntities(); + if (useSettingsStore.getState().status == "none") useSettingsStore.getState().fetchData(); + }, []); + const nextStep = () => setStep((prev) => prev + 1); + const dialogRef = (0, import_react.useRef)(null); + const contentRef = (0, import_react.useRef)(null); + const handleButtonSelectEvent = (input, value) => () => { + setFormData({ + ...formData, + [input]: value + }); + }; + (0, import_react.useEffect)(() => { + if (id != null) { + const entityData = useEntitiesPagesStore.getState().entities.find((entity) => entity.id == id); + setFormData({ + ...formData, + ...entityData + }); + setStep(3); + } + const entityPage = useEntitiesPagesStore.getState().entities_pages.find((page) => page.id == entities_page_id); + setEntitiesPageType(entityPage?.type ?? ""); + }, [ + id, + useEntitiesPagesStore.getState().entities, + useEntitiesPagesStore.getState().entities_pages + ]); + const onDialogClose = () => { + dialogRef.current?.close(); + setTimeout(() => { + setOpened(false); + if (onClose) onClose(); + if (id != null) { + const entityData = useEntitiesPagesStore.getState().entities.find((entity) => entity.id == id); + setFormData({ + ...formData, + ...entityData + }); + } + setStep(1); + }, 220); + }; + const checkOverflow = () => { + if (contentRef.current) { + const maxHeightString = window.getComputedStyle(contentRef.current).maxHeight; + let maxHeight = parseFloat(maxHeightString); + if (maxHeightString.endsWith("%")) maxHeight = Math.trunc(window.innerHeight * maxHeight / 100); + contentRef.current.classList.toggle("overflow-y-auto", contentRef.current.scrollHeight > maxHeight); + contentRef.current.classList.toggle("overflow-y-visible", contentRef.current.scrollHeight <= maxHeight); + } + }; + (0, import_react.useEffect)(() => { + const observer = new ResizeObserver((entries) => { + entries.forEach(() => { + checkOverflow(); + }); + }); + if (contentRef.current) observer.observe(contentRef.current); + }, [contentRef]); + (0, import_react.useEffect)(() => { + if (id == null && step == 1 && entitiesPageType == "scene") { + setFormData({ + ...formData, + entity_type: "scene" + }); + setStep(2); + } else if (id != null && entitiesPageType == "scene") { + setFormData({ + ...formData, + entity_type: "scene" + }); + setStep(3); + } + }, [ + id, + step, + entitiesPageType + ]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("dialog", { + ref: dialogRef, + open: opened ?? false, + onClose: onDialogClose, + className: "modal duration-200", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + ref: contentRef, + className: `modal-box max-h-11/12 bg-base-100 text-base-content`, + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + className: "btn btn-sm btn-circle btn-ghost absolute right-2 top-2", + onClick: () => { + setOpened(false); + onDialogClose(); + }, + children: "✕" + }), + (() => { + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-center mb-4 w-full", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ul", { + className: "steps w-full", + children: [ + id == null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { + className: `step ${step >= 1 ? "step-primary cursor-pointer" : ""}`, + onClick: () => { + setStep(1); + }, + children: "Type" + }), + id == null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { + className: `step ${step >= 2 ? "step-primary" : ""} ${formData.entity_type == "" ? "cursor-not-allowed" : "cursor-pointer"}`, + onClick: () => { + if (formData.entity_type != "") setStep(2); + }, + children: "Controller" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { + className: `step ${step >= 3 ? "step-primary" : ""} ${formData.entity_type == "" ? "cursor-not-allowed" : "cursor-pointer"}`, + onClick: () => { + if (formData.entity_type != "") setStep(3); + }, + children: ["Configure ", formData.entity_type] + }) + ] + }) + }); + })(), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnimatePresence, { + mode: "wait", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(motion.div, { + layout: true, + initial: { + opacity: 0, + x: 30 + }, + animate: { + opacity: 1, + x: 0 + }, + exit: { + opacity: 0, + x: -30 + }, + transition: { duration: .1 }, + children: (() => { + if (id == null && step == 1 && entitiesPageType == "entity") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MultiStep_AddEditEntity_Step1, { + handleButtonSelectEvent, + next_step: nextStep + }); + if (id == null && step == 2) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MultiStep_AddEditEntity_Step2, { + handleButtonSelectEvent, + entity_type: String(formData.entity_type), + next_step: nextStep + }); + else if (formData.entity_type != "") switch (formData.entity_type) { + case "light": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MultiStep_AddEditEntity_Step3_Light, { + controller: String(formData.controller), + room_id, + entities_page_id, + room_view_position, + id, + onComplete + }); + case "switch": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MultiStep_AddEditEntity_Step3_Switch, { + controller: String(formData.controller), + room_id, + id, + entities_page_id, + room_view_position, + onComplete + }); + case "button": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MultiStep_AddEditEntity_Step3_Button, { + controller: String(formData.controller), + room_id, + id, + entities_page_id, + room_view_position, + onComplete + }); + case "thermostat": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MultiStep_AddEditEntity_Step3_Thermostat, { + controller: String(formData.controller), + room_id, + id, + entities_page_id, + room_view_position, + onComplete + }); + case "media_player": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MultiStep_AddEditEntity_Step3_MediaPlayer, { + controller: String(formData.controller), + room_id, + id, + entities_page_id, + room_view_position, + onComplete + }); + case "cover": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MultiStep_AddEditEntity_Step3_Cover, { + controller: String(formData.controller), + room_id, + id, + entities_page_id, + room_view_position, + onComplete + }); + case "scene": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MultiStep_AddEditEntity_Step3_Scene, { + controller: String(formData.controller), + room_id, + id, + entities_page_id, + room_view_position, + onComplete + }); + default: + Notify({ + message: `Unknown entity type while trying to edit entity. Type: ${formData.entity_type}`, + level: "error", + duration: 1e4 + }); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "text-lg text-error", + children: ["Unknown entity type: ", formData.entity_type] + }); + } + })() + }, `step.${step}`) + }) + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { + method: "dialog", + className: "modal-backdrop", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => { + setOpened(false); + onDialogClose(); + }, + children: "close" + }) + })] + }); +}; +//#endregion +export { useEntitiesPagesStore as i, MultiStep_AddOrEditEntity as n, useAvailableEntitiesStore as r, MultiStep_AddEditEntity_exports as t }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/NSPanelToastContainer-D677tDZJ.js b/docker/web/nspanelmanager/web/react-components/dist/NSPanelToastContainer-D677tDZJ.js new file mode 100644 index 000000000..4748dc376 --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/NSPanelToastContainer-D677tDZJ.js @@ -0,0 +1,1562 @@ +import { c as __toESM, o as __exportAll, r as require_react, t as require_jsx_runtime } from "./main-FKp56mKw.js"; +//#region node_modules/clsx/dist/clsx.mjs +var import_react = /* @__PURE__ */ __toESM(require_react(), 1); +function r(e) { + var t, f, n = ""; + if ("string" == typeof e || "number" == typeof e) n += e; + else if ("object" == typeof e) if (Array.isArray(e)) { + var o = e.length; + for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); + } else for (f in e) e[f] && (n && (n += " "), n += f); + return n; +} +function clsx() { + for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); + return n; +} +//#endregion +//#region node_modules/react-toastify/dist/index.mjs +var L = (t) => typeof t == "number" && !isNaN(t); +var N = (t) => typeof t == "string"; +var P = (t) => typeof t == "function"; +var ut = (t) => N(t) || L(t); +var z = (t) => N(t) || P(t) ? t : null; +var yt = (t, o) => t === !1 || L(t) && t > 0 ? t : o; +var F = (t) => (0, import_react.isValidElement)(t) || N(t) || P(t) || L(t); +function J(t, o, e = 300) { + let { scrollHeight: r, style: a } = t; + requestAnimationFrame(() => { + a.minHeight = "initial", a.height = r + "px", a.transition = `all ${e}ms`, requestAnimationFrame(() => { + a.height = "0", a.padding = "0", a.margin = "0", setTimeout(o, e); + }); + }); +} +function R({ enter: t, exit: o, appendPosition: e = !1, collapse: r = !0, collapseDuration: a = 300 }) { + return function({ children: s, position: f, preventExitTransition: c, done: T, nodeRef: g, isIn: v, playToast: x }) { + let C = e ? `${t}--${f}` : t, S = e ? `${o}--${f}` : o, E = (0, import_react.useRef)(0); + return (0, import_react.useLayoutEffect)(() => { + let d = g.current, p = C.split(" "), b = (n) => { + n.target === g.current && (x(), d.removeEventListener("animationend", b), d.removeEventListener("animationcancel", b), E.current === 0 && n.type !== "animationcancel" && d.classList.remove(...p)); + }; + d.classList.add(...p), d.addEventListener("animationend", b), d.addEventListener("animationcancel", b); + }, []), (0, import_react.useEffect)(() => { + let d = g.current, p = () => { + d.removeEventListener("animationend", p), r ? J(d, T, a) : T(); + }; + v || (c ? p() : (E.current = 1, d.className += ` ${S}`, d.addEventListener("animationend", p))); + }, [v]), import_react.createElement(import_react.Fragment, null, s); + }; +} +function tt(t, o) { + return { + content: ot(t.content, t.props), + containerId: t.props.containerId, + id: t.props.toastId, + theme: t.props.theme, + type: t.props.type, + data: t.props.data || {}, + isLoading: t.props.isLoading, + icon: t.props.icon, + reason: t.removalReason, + status: o + }; +} +function ot(t, o, e = !1) { + return (0, import_react.isValidElement)(t) && !N(t.type) ? (0, import_react.cloneElement)(t, { + closeToast: o.closeToast, + toastProps: o, + data: o.data, + isPaused: e + }) : P(t) ? t({ + closeToast: o.closeToast, + toastProps: o, + data: o.data, + isPaused: e + }) : t; +} +function gt({ closeToast: t, theme: o, ariaLabel: e = "close" }) { + return import_react.createElement("button", { + className: `Toastify__close-button Toastify__close-button--${o}`, + type: "button", + onClick: (r) => { + r.stopPropagation(), t(!0); + }, + "aria-label": e + }, import_react.createElement("svg", { + "aria-hidden": "true", + viewBox: "0 0 14 16" + }, import_react.createElement("path", { + fillRule: "evenodd", + d: "M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z" + }))); +} +function bt({ delay: t, isRunning: o, closeToast: e, type: r = "default", hide: a, className: l, controlledProgress: s, progress: f, rtl: c, isIn: T, theme: g }) { + let v = a || s && f === 0, x = { + animationDuration: `${t}ms`, + animationPlayState: o ? "running" : "paused" + }; + s && (x.transform = `scaleX(${f})`); + let C = clsx("Toastify__progress-bar", s ? "Toastify__progress-bar--controlled" : "Toastify__progress-bar--animated", `Toastify__progress-bar-theme--${g}`, `Toastify__progress-bar--${r}`, { ["Toastify__progress-bar--rtl"]: c }), S = P(l) ? l({ + rtl: c, + type: r, + defaultClassName: C + }) : clsx(C, l), E = { [s && f >= 1 ? "onTransitionEnd" : "onAnimationEnd"]: s && f < 1 ? null : () => { + T && e(); + } }; + return import_react.createElement("div", { + className: "Toastify__progress-bar--wrp", + "data-hidden": v + }, import_react.createElement("div", { className: `Toastify__progress-bar--bg Toastify__progress-bar-theme--${g} Toastify__progress-bar--${r}` }), import_react.createElement("div", { + role: "progressbar", + "aria-hidden": v ? "true" : "false", + "aria-label": "notification timer", + "aria-valuenow": s ? Math.round(f * 100) : void 0, + "aria-valuemin": 0, + "aria-valuemax": 100, + className: S, + style: x, + ...E + })); +} +var Qt = 1; +var st = () => `${Qt++}`; +function vt(t, o, e) { + let r = 1, a = 0, l = [], s = [], f = o, c = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Set(), g = (i) => (T.add(i), () => T.delete(i)), v = () => { + s = Array.from(c.values()), T.forEach((i) => i()); + }, x = ({ containerId: i, toastId: n, updateId: u }) => { + let h = i ? i !== t : t !== 1, m = c.has(n) && u == null; + return h || m; + }, C = (i, n) => { + c.forEach((u) => { + var h; + (n == null || n === u.props.toastId) && ((h = u.toggle) == null || h.call(u, i)); + }); + }, S = (i) => { + var n, u; + i.isActive && ((u = (n = i.props) == null ? void 0 : n.onClose) == null || u.call(n, i.removalReason), i.isActive = !1, e(tt(i, "removed"))); + }, E = (i) => { + if (i == null) c.forEach(S); + else { + let n = c.get(i); + n && S(n); + } + v(); + }, d = () => { + a -= l.length, l = []; + }, p = (i) => { + var m, _; + let { toastId: n, updateId: u } = i.props, h = u == null; + i.staleId && c.delete(i.staleId), i.isActive = !0, c.set(n, i), v(), e(tt(i, h ? "added" : "updated")), h && ((_ = (m = i.props).onOpen) == null || _.call(m)); + }; + return { + id: t, + props: f, + observe: g, + toggle: C, + removeToast: E, + toasts: c, + clearQueue: d, + buildToast: (i, n) => { + if (x(n)) return; + let { toastId: u, updateId: h, data: m, staleId: _, delay: k } = n, D = h == null; + D && a++; + let A = { + ...f, + style: f.toastStyle, + key: r++, + ...Object.fromEntries(Object.entries(n).filter(([M, $]) => $ != null)), + toastId: u, + updateId: h, + data: m, + isIn: !1, + className: z(n.className || f.toastClassName), + progressClassName: z(n.progressClassName || f.progressClassName), + autoClose: n.isLoading ? !1 : yt(n.autoClose, f.autoClose), + closeToast(M) { + let $ = c.get(u); + $ && ($.removalReason = M, E(u)); + }, + deleteToast() { + if (c.get(u) != null) { + if (c.delete(u), a--, a < 0 && (a = 0), l.length > 0) { + p(l.shift()); + return; + } + v(); + } + } + }; + A.closeButton = f.closeButton, n.closeButton === !1 || F(n.closeButton) ? A.closeButton = n.closeButton : n.closeButton === !0 && (A.closeButton = F(f.closeButton) ? f.closeButton : !0); + let B = { + content: i, + props: A, + staleId: _ + }; + f.limit && f.limit > 0 && a > f.limit && D ? l.push(B) : L(k) ? setTimeout(() => { + p(B); + }, k) : p(B); + }, + setProps(i) { + f = i; + }, + setToggle: (i, n) => { + let u = c.get(i); + u && (u.toggle = n); + }, + isToastActive: (i) => { + var n; + return (n = c.get(i)) == null ? void 0 : n.isActive; + }, + getSnapshot: () => s + }; +} +var I = /* @__PURE__ */ new Map(); +var U = []; +var rt = /* @__PURE__ */ new Set(); +var Wt = (t) => rt.forEach((o) => o(t)); +var ht = () => I.size > 0; +function Gt() { + U.forEach((t) => nt(t.content, t.options)), U = []; +} +var Ct = (t, { containerId: o }) => { + var e; + return (e = I.get(o || 1)) == null ? void 0 : e.toasts.get(t); +}; +function X(t, o) { + var r; + if (o) return !!((r = I.get(o)) != null && r.isToastActive(t)); + let e = !1; + return I.forEach((a) => { + a.isToastActive(t) && (e = !0); + }), e; +} +function xt(t) { + if (!ht()) { + U = U.filter((o) => t != null && o.options.toastId !== t); + return; + } + if (t == null || ut(t)) I.forEach((o) => { + o.removeToast(t); + }); + else if (t && ("containerId" in t || "id" in t)) { + let o = I.get(t.containerId); + o ? o.removeToast(t.id) : I.forEach((e) => { + e.removeToast(t.id); + }); + } +} +var Et = (t = {}) => { + I.forEach((o) => { + o.props.limit && (!t.containerId || o.id === t.containerId) && o.clearQueue(); + }); +}; +function nt(t, o) { + F(t) && (ht() || U.push({ + content: t, + options: o + }), I.forEach((e) => { + e.buildToast(t, o); + })); +} +function Pt(t) { + var o; + (o = I.get(t.containerId || 1)) == null || o.setToggle(t.id, t.fn); +} +function it(t, o) { + I.forEach((e) => { + (o == null || !(o != null && o.containerId) || (o == null ? void 0 : o.containerId) === e.id) && e.toggle(t, o == null ? void 0 : o.id); + }); +} +function It(t) { + let o = t.containerId || 1; + return { + subscribe(e) { + let r = vt(o, t, Wt); + I.set(o, r); + let a = r.observe(e); + return Gt(), () => { + a(), I.delete(o); + }; + }, + setProps(e) { + var r; + (r = I.get(o)) == null || r.setProps(e); + }, + getSnapshot() { + var e; + return (e = I.get(o)) == null ? void 0 : e.getSnapshot(); + } + }; +} +function St(t) { + return rt.add(t), () => { + rt.delete(t); + }; +} +function qt(t) { + return t && (N(t.toastId) || L(t.toastId)) ? t.toastId : st(); +} +function H(t, o) { + return nt(t, o), o.toastId; +} +function Q(t, o) { + return { + ...o, + type: o && o.type || t, + toastId: qt(o) + }; +} +function W(t) { + return (o, e) => H(o, Q(t, e)); +} +function y(t, o) { + return H(t, Q("default", o)); +} +y.loading = (t, o) => H(t, Q("default", { + isLoading: !0, + autoClose: !1, + closeOnClick: !1, + closeButton: !1, + draggable: !1, + ...o +})); +function Kt(t, { pending: o, error: e, success: r }, a) { + let l; + o && (l = N(o) ? y.loading(o, a) : y.loading(o.render, { + ...a, + ...o + })); + let s = { + isLoading: null, + autoClose: null, + closeOnClick: null, + closeButton: null, + draggable: null + }, f = (T, g, v) => { + if (g == null) { + y.dismiss(l); + return; + } + let x = { + type: T, + ...s, + ...a, + data: v + }, C = N(g) ? { render: g } : g; + return l ? y.update(l, { + ...x, + ...C + }) : y(C.render, { + ...x, + ...C + }), v; + }, c = P(t) ? t() : t; + return c.then((T) => f("success", r, T)).catch((T) => f("error", e, T)), c; +} +y.promise = Kt; +y.success = W("success"); +y.info = W("info"); +y.error = W("error"); +y.warning = W("warning"); +y.warn = y.warning; +y.dark = (t, o) => H(t, Q("default", { + theme: "dark", + ...o +})); +function Yt(t) { + xt(t); +} +y.dismiss = Yt; +y.clearWaitingQueue = Et; +y.isActive = X; +y.update = (t, o = {}) => { + let e = Ct(t, o); + if (e) { + let { props: r, content: a } = e, l = { + delay: 100, + ...r, + ...o, + toastId: o.toastId || t, + updateId: st() + }; + l.toastId !== t && (l.staleId = t); + let s = l.render || a; + delete l.render, H(s, l); + } +}; +y.done = (t) => { + y.update(t, { progress: 1 }); +}; +y.onChange = St; +y.play = (t) => it(!0, t); +y.pause = (t) => it(!1, t); +function kt(t) { + var s; + let { subscribe: o, getSnapshot: e, setProps: r } = (0, import_react.useRef)(It(t)).current; + r(t); + let a = (s = (0, import_react.useSyncExternalStore)(o, e, e)) == null ? void 0 : s.slice(); + function l(f) { + if (!a) return []; + let c = /* @__PURE__ */ new Map(); + return t.newestOnTop && a.reverse(), a.forEach((T) => { + let { position: g } = T.props; + c.has(g) || c.set(g, []), c.get(g).push(T); + }), Array.from(c, (T) => f(T[0], T[1])); + } + return { + getToastToRender: l, + isToastActive: X, + count: a == null ? void 0 : a.length + }; +} +function Nt(t) { + let [o, e] = (0, import_react.useState)(!1), [r, a] = (0, import_react.useState)(!1), l = (0, import_react.useRef)(null), s = (0, import_react.useRef)({ + start: 0, + delta: 0, + removalDistance: 0, + canCloseOnClick: !0, + canDrag: !1, + didMove: !1 + }).current, { autoClose: f, pauseOnHover: c, closeToast: T, onClick: g, closeOnClick: v } = t; + Pt({ + id: t.toastId, + containerId: t.containerId, + fn: e + }), (0, import_react.useEffect)(() => { + if (t.pauseOnFocusLoss) return x(), () => { + C(); + }; + }, [t.pauseOnFocusLoss]); + function x() { + document.hasFocus() || p(), window.addEventListener("focus", d), window.addEventListener("blur", p); + } + function C() { + window.removeEventListener("focus", d), window.removeEventListener("blur", p); + } + function S(m) { + if (t.draggable === !0 || t.draggable === m.pointerType) { + b(); + let _ = l.current; + s.canCloseOnClick = !0, s.canDrag = !0, _.style.transition = "none", t.draggableDirection === "x" ? (s.start = m.clientX, s.removalDistance = _.offsetWidth * (t.draggablePercent / 100)) : (s.start = m.clientY, s.removalDistance = _.offsetHeight * (t.draggablePercent === 80 ? t.draggablePercent * 1.5 : t.draggablePercent) / 100); + } + } + function E(m) { + let { top: _, bottom: k, left: D, right: A } = l.current.getBoundingClientRect(); + m.pointerType === "mouse" && t.pauseOnHover && m.clientX >= D && m.clientX <= A && m.clientY >= _ && m.clientY <= k ? p() : d(); + } + function d() { + e(!0); + } + function p() { + e(!1); + } + function b() { + s.didMove = !1, document.addEventListener("pointermove", n), document.addEventListener("pointerup", u); + } + function i() { + document.removeEventListener("pointermove", n), document.removeEventListener("pointerup", u); + } + function n(m) { + let _ = l.current; + if (s.canDrag && _) { + s.didMove = !0, o && p(), t.draggableDirection === "x" ? s.delta = m.clientX - s.start : s.delta = m.clientY - s.start, s.start !== m.clientX && (s.canCloseOnClick = !1); + let k = t.draggableDirection === "x" ? `${s.delta}px, var(--y)` : `0, calc(${s.delta}px + var(--y))`; + _.style.transform = `translate3d(${k},0)`, _.style.opacity = `${1 - Math.abs(s.delta / s.removalDistance)}`; + } + } + function u() { + i(); + let m = l.current; + if (s.canDrag && s.didMove && m) { + if (s.canDrag = !1, Math.abs(s.delta) > s.removalDistance) { + a(!0), t.closeToast(!0), t.collapseAll(); + return; + } + m.style.transition = "transform 0.2s, opacity 0.2s", m.style.removeProperty("transform"), m.style.removeProperty("opacity"); + } + } + let h = { + onPointerDown: S, + onPointerUp: E + }; + return f && c && (h.onMouseEnter = p, t.stacked || (h.onMouseLeave = d)), v && (h.onClick = (m) => { + g && g(m), s.canCloseOnClick && T(!0); + }), { + playToast: d, + pauseToast: p, + isRunning: o, + preventExitTransition: r, + toastRef: l, + eventHandlers: h + }; +} +var G = typeof window != "undefined" ? import_react.useLayoutEffect : import_react.useEffect; +var K = ({ theme: t, type: o, isLoading: e, ...r }) => import_react.createElement("svg", { + viewBox: "0 0 24 24", + width: "100%", + height: "100%", + fill: t === "colored" ? "currentColor" : `var(--toastify-icon-color-${o})`, + ...r +}); +function ro(t) { + return import_react.createElement(K, { ...t }, import_react.createElement("path", { d: "M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z" })); +} +function no(t) { + return import_react.createElement(K, { ...t }, import_react.createElement("path", { d: "M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z" })); +} +function io(t) { + return import_react.createElement(K, { ...t }, import_react.createElement("path", { d: "M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z" })); +} +function lo(t) { + return import_react.createElement(K, { ...t }, import_react.createElement("path", { d: "M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z" })); +} +function fo() { + return import_react.createElement("div", { className: "Toastify__spinner" }); +} +var q = { + info: no, + warning: ro, + success: io, + error: lo, + spinner: fo +}; +var co = (t) => t in q; +function wt({ theme: t, type: o, isLoading: e, icon: r }) { + let a = null, l = { + theme: t, + type: o + }; + return r === !1 || (P(r) ? a = r({ + ...l, + isLoading: e + }) : (0, import_react.isValidElement)(r) ? a = (0, import_react.cloneElement)(r, l) : e ? a = q.spinner() : co(o) && (a = q[o](l))), a; +} +var Dt = (t) => { + let { isRunning: o, preventExitTransition: e, toastRef: r, eventHandlers: a, playToast: l } = Nt(t), { closeButton: s, children: f, autoClose: c, onClick: T, type: g, hideProgressBar: v, closeToast: x, transition: C, position: S, className: E, style: d, progressClassName: p, updateId: b, role: i, progress: n, rtl: u, toastId: h, deleteToast: m, isIn: _, isLoading: k, closeOnClick: D, theme: A, ariaLabel: B } = t, M = clsx("Toastify__toast", `Toastify__toast-theme--${A}`, `Toastify__toast--${g}`, { ["Toastify__toast--rtl"]: u }, { ["Toastify__toast--close-on-click"]: D }), $ = P(E) ? E({ + rtl: u, + position: S, + type: g, + defaultClassName: M + }) : clsx(M, E), mt = wt(t), pt = !!n || !c, Z = { + closeToast: x, + type: g, + theme: A + }, V = null; + return s === !1 || (P(s) ? V = s(Z) : (0, import_react.isValidElement)(s) ? V = (0, import_react.cloneElement)(s, Z) : V = gt(Z)), import_react.createElement(C, { + isIn: _, + done: m, + position: S, + preventExitTransition: e, + nodeRef: r, + playToast: l + }, import_react.createElement("div", { + id: h, + tabIndex: 0, + onClick: T, + "data-in": _, + className: $, + ...a, + style: d, + ref: r, + ..._ && { + role: i, + "aria-label": B + } + }, mt != null && import_react.createElement("div", { className: clsx("Toastify__toast-icon", { ["Toastify--animate-icon Toastify__zoom-enter"]: !k }) }, mt), ot(f, t, !o), V, !t.customProgressBar && import_react.createElement(bt, { + ...b && !pt ? { key: `p-${b}` } : {}, + rtl: u, + theme: A, + delay: c, + isRunning: o, + isIn: _, + closeToast: x, + hide: v, + type: g, + className: p, + controlledProgress: pt, + progress: n || 0 + }))); +}; +var j = (t, o = !1) => ({ + enter: `Toastify--animate Toastify__${t}-enter`, + exit: `Toastify--animate Toastify__${t}-exit`, + appendPosition: o +}); +var ft = R(j("bounce", !0)); +R(j("slide", !0)); +R(j("zoom")); +R(j("flip")); +var vo = { + position: "top-right", + transition: ft, + autoClose: 5e3, + closeButton: !0, + pauseOnHover: !0, + pauseOnFocusLoss: !0, + draggable: "touch", + draggablePercent: 80, + draggableDirection: "x", + role: "alert", + theme: "light", + "aria-label": "Notifications Alt+T", + hotKeys: (t) => t.altKey && t.code === "KeyT" +}; +function dt(t) { + let o = { + ...vo, + ...t + }, e = t.stacked, [r, a] = (0, import_react.useState)(!0), l = (0, import_react.useRef)(null), { getToastToRender: s, isToastActive: f, count: c } = kt(o), { className: T, style: g, rtl: v, containerId: x, hotKeys: C } = o; + function S(d) { + let p = clsx("Toastify__toast-container", `Toastify__toast-container--${d}`, { ["Toastify__toast-container--rtl"]: v }); + return P(T) ? T({ + position: d, + rtl: v, + defaultClassName: p + }) : clsx(p, z(T)); + } + function E() { + e && (a(!0), y.play()); + } + return G(() => { + var d; + if (e) { + let p = l.current.querySelectorAll("[data-in=\"true\"]"), b = 12, i = (d = o.position) == null ? void 0 : d.includes("top"), n = 0, u = 0; + Array.from(p).reverse().forEach((h, m) => { + let _ = h; + _.classList.add("Toastify__toast--stacked"), m > 0 && (_.dataset.collapsed = `${r}`), _.dataset.pos || (_.dataset.pos = i ? "top" : "bot"); + let k = n * (r ? .2 : 1) + (r ? 0 : b * m), D = Math.max(.5, 1 - (r ? u : 0)); + _.style.setProperty("--y", `${i ? k : k * -1}px`), _.style.setProperty("--g", `${b}`), _.style.setProperty("--s", `${D}`), n += _.offsetHeight, u += .025; + }); + } + }, [ + r, + c, + e + ]), (0, import_react.useEffect)(() => { + function d(p) { + var i; + let b = l.current; + C(p) && ((i = b == null ? void 0 : b.querySelector("[tabIndex=\"0\"]")) == null || i.focus(), a(!1), y.pause()), p.key === "Escape" && (document.activeElement === b || b != null && b.contains(document.activeElement)) && (a(!0), y.play()); + } + return document.addEventListener("keydown", d), () => { + document.removeEventListener("keydown", d); + }; + }, [C]), import_react.createElement("section", { + ref: l, + className: "Toastify", + id: x, + onMouseEnter: () => { + e && (a(!1), y.pause()); + }, + onMouseLeave: E, + "aria-live": "polite", + "aria-atomic": "false", + "aria-relevant": "additions text", + "aria-label": o["aria-label"] + }, s((d, p) => { + let b = p.length ? { ...g } : { + ...g, + pointerEvents: "none" + }; + return import_react.createElement("div", { + tabIndex: -1, + className: S(d), + "data-stacked": e, + style: b, + key: `c-${d}` + }, p.map(({ content: i, props: n }) => import_react.createElement(Dt, { + ...n, + stacked: e, + collapseAll: E, + isIn: f(n.toastId, n.containerId), + key: `t-${n.key}` + }, i))); + })); +} +var Mt = `:root { + --toastify-color-light: #fff; + --toastify-color-dark: #121212; + --toastify-color-info: #3498db; + --toastify-color-success: #07bc0c; + --toastify-color-warning: #f1c40f; + --toastify-color-error: hsl(6, 78%, 57%); + --toastify-color-transparent: rgba(255, 255, 255, 0.7); + + --toastify-icon-color-info: var(--toastify-color-info); + --toastify-icon-color-success: var(--toastify-color-success); + --toastify-icon-color-warning: var(--toastify-color-warning); + --toastify-icon-color-error: var(--toastify-color-error); + + --toastify-container-width: fit-content; + --toastify-toast-width: 320px; + --toastify-toast-offset: 16px; + --toastify-toast-top: max(var(--toastify-toast-offset), env(safe-area-inset-top)); + --toastify-toast-right: max(var(--toastify-toast-offset), env(safe-area-inset-right)); + --toastify-toast-left: max(var(--toastify-toast-offset), env(safe-area-inset-left)); + --toastify-toast-bottom: max(var(--toastify-toast-offset), env(safe-area-inset-bottom)); + --toastify-toast-background: #fff; + --toastify-toast-padding: 14px; + --toastify-toast-min-height: 64px; + --toastify-toast-max-height: 800px; + --toastify-toast-bd-radius: 6px; + --toastify-toast-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1); + --toastify-font-family: sans-serif; + --toastify-z-index: 9999; + --toastify-text-color-light: #757575; + --toastify-text-color-dark: #fff; + + /* Used only for colored theme */ + --toastify-text-color-info: #fff; + --toastify-text-color-success: #fff; + --toastify-text-color-warning: #fff; + --toastify-text-color-error: #fff; + + --toastify-spinner-color: #616161; + --toastify-spinner-color-empty-area: #e0e0e0; + --toastify-color-progress-light: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55); + --toastify-color-progress-dark: #bb86fc; + --toastify-color-progress-info: var(--toastify-color-info); + --toastify-color-progress-success: var(--toastify-color-success); + --toastify-color-progress-warning: var(--toastify-color-warning); + --toastify-color-progress-error: var(--toastify-color-error); + /* used to control the opacity of the progress trail */ + --toastify-color-progress-bgo: 0.2; +} + +.Toastify__toast-container { + z-index: var(--toastify-z-index); + -webkit-transform: translate3d(0, 0, var(--toastify-z-index)); + position: fixed; + width: var(--toastify-container-width); + box-sizing: border-box; + color: #fff; + display: flex; + flex-direction: column; +} + +.Toastify__toast-container--top-left { + top: var(--toastify-toast-top); + left: var(--toastify-toast-left); +} +.Toastify__toast-container--top-center { + top: var(--toastify-toast-top); + left: 50%; + transform: translateX(-50%); + align-items: center; +} +.Toastify__toast-container--top-right { + top: var(--toastify-toast-top); + right: var(--toastify-toast-right); + align-items: end; +} +.Toastify__toast-container--bottom-left { + bottom: var(--toastify-toast-bottom); + left: var(--toastify-toast-left); +} +.Toastify__toast-container--bottom-center { + bottom: var(--toastify-toast-bottom); + left: 50%; + transform: translateX(-50%); + align-items: center; +} +.Toastify__toast-container--bottom-right { + bottom: var(--toastify-toast-bottom); + right: var(--toastify-toast-right); + align-items: end; +} + +.Toastify__toast { + --y: 0px; + position: relative; + touch-action: none; + width: var(--toastify-toast-width); + min-height: var(--toastify-toast-min-height); + box-sizing: border-box; + margin-bottom: 1rem; + padding: var(--toastify-toast-padding); + border-radius: var(--toastify-toast-bd-radius); + box-shadow: var(--toastify-toast-shadow); + max-height: var(--toastify-toast-max-height); + font-family: var(--toastify-font-family); + /* webkit only issue #791 */ + z-index: 0; + /* inner swag */ + display: flex; + flex: 1 auto; + align-items: center; + word-break: break-word; +} + +@media only screen and (max-width: 480px) { + .Toastify__toast-container { + width: 100vw; + left: env(safe-area-inset-left); + margin: 0; + } + .Toastify__toast-container--top-left, + .Toastify__toast-container--top-center, + .Toastify__toast-container--top-right { + top: env(safe-area-inset-top); + transform: translateX(0); + } + .Toastify__toast-container--bottom-left, + .Toastify__toast-container--bottom-center, + .Toastify__toast-container--bottom-right { + bottom: env(safe-area-inset-bottom); + transform: translateX(0); + } + .Toastify__toast-container--rtl { + right: env(safe-area-inset-right); + left: initial; + } + .Toastify__toast { + --toastify-toast-width: 100%; + margin-bottom: 0; + border-radius: 0; + } +} + +.Toastify__toast-container[data-stacked='true'] { + width: var(--toastify-toast-width); +} + +@media only screen and (max-width: 480px) { + .Toastify__toast-container[data-stacked='true'] { + width: 100vw; + } +} + +.Toastify__toast--stacked { + position: absolute; + width: 100%; + transform: translate3d(0, var(--y), 0) scale(var(--s)); + transition: transform 0.3s; +} + +.Toastify__toast--stacked[data-collapsed] .Toastify__toast-body, +.Toastify__toast--stacked[data-collapsed] .Toastify__close-button { + transition: opacity 0.1s; +} + +.Toastify__toast--stacked[data-collapsed='false'] { + overflow: visible; +} + +.Toastify__toast--stacked[data-collapsed='true']:not(:last-child) > * { + opacity: 0; +} + +.Toastify__toast--stacked:after { + content: ''; + position: absolute; + left: 0; + right: 0; + height: calc(var(--g) * 1px); + bottom: 100%; +} + +.Toastify__toast--stacked[data-pos='top'] { + top: 0; +} + +.Toastify__toast--stacked[data-pos='bot'] { + bottom: 0; +} + +.Toastify__toast--stacked[data-pos='bot'].Toastify__toast--stacked:before { + transform-origin: top; +} + +.Toastify__toast--stacked[data-pos='top'].Toastify__toast--stacked:before { + transform-origin: bottom; +} + +.Toastify__toast--stacked:before { + content: ''; + position: absolute; + left: 0; + right: 0; + bottom: 0; + height: 100%; + transform: scaleY(3); + z-index: -1; +} + +.Toastify__toast--rtl { + direction: rtl; +} + +.Toastify__toast--close-on-click { + cursor: pointer; +} + +.Toastify__toast-icon { + margin-inline-end: 10px; + width: 22px; + flex-shrink: 0; + display: flex; +} + +.Toastify--animate { + animation-fill-mode: both; + animation-duration: 0.5s; +} + +.Toastify--animate-icon { + animation-fill-mode: both; + animation-duration: 0.3s; +} + +.Toastify__toast-theme--dark { + background: var(--toastify-color-dark); + color: var(--toastify-text-color-dark); +} + +.Toastify__toast-theme--light { + background: var(--toastify-color-light); + color: var(--toastify-text-color-light); +} + +.Toastify__toast-theme--colored.Toastify__toast--default { + background: var(--toastify-color-light); + color: var(--toastify-text-color-light); +} + +.Toastify__toast-theme--colored.Toastify__toast--info { + color: var(--toastify-text-color-info); + background: var(--toastify-color-info); +} + +.Toastify__toast-theme--colored.Toastify__toast--success { + color: var(--toastify-text-color-success); + background: var(--toastify-color-success); +} + +.Toastify__toast-theme--colored.Toastify__toast--warning { + color: var(--toastify-text-color-warning); + background: var(--toastify-color-warning); +} + +.Toastify__toast-theme--colored.Toastify__toast--error { + color: var(--toastify-text-color-error); + background: var(--toastify-color-error); +} + +.Toastify__progress-bar-theme--light { + background: var(--toastify-color-progress-light); +} + +.Toastify__progress-bar-theme--dark { + background: var(--toastify-color-progress-dark); +} + +.Toastify__progress-bar--info { + background: var(--toastify-color-progress-info); +} + +.Toastify__progress-bar--success { + background: var(--toastify-color-progress-success); +} + +.Toastify__progress-bar--warning { + background: var(--toastify-color-progress-warning); +} + +.Toastify__progress-bar--error { + background: var(--toastify-color-progress-error); +} + +.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info, +.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success, +.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning, +.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error { + background: var(--toastify-color-transparent); +} + +.Toastify__close-button { + color: #fff; + position: absolute; + top: 6px; + right: 6px; + background: transparent; + outline: none; + border: none; + padding: 0; + cursor: pointer; + opacity: 0.7; + transition: 0.3s ease; + z-index: 1; +} + +.Toastify__toast--rtl .Toastify__close-button { + left: 6px; + right: unset; +} + +.Toastify__close-button--light { + color: #000; + opacity: 0.3; +} + +.Toastify__close-button > svg { + fill: currentColor; + height: 16px; + width: 14px; +} + +.Toastify__close-button:hover, +.Toastify__close-button:focus { + opacity: 1; +} + +@keyframes Toastify__trackProgress { + 0% { + transform: scaleX(1); + } + 100% { + transform: scaleX(0); + } +} + +.Toastify__progress-bar { + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 1; + opacity: 0.7; + transform-origin: left; +} + +.Toastify__progress-bar--animated { + animation: Toastify__trackProgress linear 1 forwards; +} + +.Toastify__progress-bar--controlled { + transition: transform 0.2s; +} + +.Toastify__progress-bar--rtl { + right: 0; + left: initial; + transform-origin: right; + border-bottom-left-radius: initial; +} + +.Toastify__progress-bar--wrp { + position: absolute; + overflow: hidden; + bottom: 0; + left: 0; + width: 100%; + height: 5px; + border-bottom-left-radius: var(--toastify-toast-bd-radius); + border-bottom-right-radius: var(--toastify-toast-bd-radius); +} + +.Toastify__progress-bar--wrp[data-hidden='true'] { + opacity: 0; +} + +.Toastify__progress-bar--bg { + opacity: var(--toastify-color-progress-bgo); + width: 100%; + height: 100%; +} + +.Toastify__spinner { + width: 20px; + height: 20px; + box-sizing: border-box; + border: 2px solid; + border-radius: 100%; + border-color: var(--toastify-spinner-color-empty-area); + border-right-color: var(--toastify-spinner-color); + animation: Toastify__spin 0.65s linear infinite; +} + +@keyframes Toastify__bounceInRight { + from, + 60%, + 75%, + 90%, + to { + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + from { + opacity: 0; + transform: translate3d(3000px, 0, 0); + } + 60% { + opacity: 1; + transform: translate3d(-25px, 0, 0); + } + 75% { + transform: translate3d(10px, 0, 0); + } + 90% { + transform: translate3d(-5px, 0, 0); + } + to { + transform: none; + } +} + +@keyframes Toastify__bounceOutRight { + 20% { + opacity: 1; + transform: translate3d(-20px, var(--y), 0); + } + to { + opacity: 0; + transform: translate3d(2000px, var(--y), 0); + } +} + +@keyframes Toastify__bounceInLeft { + from, + 60%, + 75%, + 90%, + to { + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + 0% { + opacity: 0; + transform: translate3d(-3000px, 0, 0); + } + 60% { + opacity: 1; + transform: translate3d(25px, 0, 0); + } + 75% { + transform: translate3d(-10px, 0, 0); + } + 90% { + transform: translate3d(5px, 0, 0); + } + to { + transform: none; + } +} + +@keyframes Toastify__bounceOutLeft { + 20% { + opacity: 1; + transform: translate3d(20px, var(--y), 0); + } + to { + opacity: 0; + transform: translate3d(-2000px, var(--y), 0); + } +} + +@keyframes Toastify__bounceInUp { + from, + 60%, + 75%, + 90%, + to { + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + from { + opacity: 0; + transform: translate3d(0, 3000px, 0); + } + 60% { + opacity: 1; + transform: translate3d(0, -20px, 0); + } + 75% { + transform: translate3d(0, 10px, 0); + } + 90% { + transform: translate3d(0, -5px, 0); + } + to { + transform: translate3d(0, 0, 0); + } +} + +@keyframes Toastify__bounceOutUp { + 20% { + transform: translate3d(0, calc(var(--y) - 10px), 0); + } + 40%, + 45% { + opacity: 1; + transform: translate3d(0, calc(var(--y) + 20px), 0); + } + to { + opacity: 0; + transform: translate3d(0, -2000px, 0); + } +} + +@keyframes Toastify__bounceInDown { + from, + 60%, + 75%, + 90%, + to { + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + 0% { + opacity: 0; + transform: translate3d(0, -3000px, 0); + } + 60% { + opacity: 1; + transform: translate3d(0, 25px, 0); + } + 75% { + transform: translate3d(0, -10px, 0); + } + 90% { + transform: translate3d(0, 5px, 0); + } + to { + transform: none; + } +} + +@keyframes Toastify__bounceOutDown { + 20% { + transform: translate3d(0, calc(var(--y) - 10px), 0); + } + 40%, + 45% { + opacity: 1; + transform: translate3d(0, calc(var(--y) + 20px), 0); + } + to { + opacity: 0; + transform: translate3d(0, 2000px, 0); + } +} + +.Toastify__bounce-enter--top-left, +.Toastify__bounce-enter--bottom-left { + animation-name: Toastify__bounceInLeft; +} + +.Toastify__bounce-enter--top-right, +.Toastify__bounce-enter--bottom-right { + animation-name: Toastify__bounceInRight; +} + +.Toastify__bounce-enter--top-center { + animation-name: Toastify__bounceInDown; +} + +.Toastify__bounce-enter--bottom-center { + animation-name: Toastify__bounceInUp; +} + +.Toastify__bounce-exit--top-left, +.Toastify__bounce-exit--bottom-left { + animation-name: Toastify__bounceOutLeft; +} + +.Toastify__bounce-exit--top-right, +.Toastify__bounce-exit--bottom-right { + animation-name: Toastify__bounceOutRight; +} + +.Toastify__bounce-exit--top-center { + animation-name: Toastify__bounceOutUp; +} + +.Toastify__bounce-exit--bottom-center { + animation-name: Toastify__bounceOutDown; +} + +@keyframes Toastify__zoomIn { + from { + opacity: 0; + transform: scale3d(0.3, 0.3, 0.3); + } + 50% { + opacity: 1; + } +} + +@keyframes Toastify__zoomOut { + from { + opacity: 1; + } + 50% { + opacity: 0; + transform: translate3d(0, var(--y), 0) scale3d(0.3, 0.3, 0.3); + } + to { + opacity: 0; + } +} + +.Toastify__zoom-enter { + animation-name: Toastify__zoomIn; +} + +.Toastify__zoom-exit { + animation-name: Toastify__zoomOut; +} + +@keyframes Toastify__flipIn { + from { + transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + animation-timing-function: ease-in; + opacity: 0; + } + 40% { + transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + animation-timing-function: ease-in; + } + 60% { + transform: perspective(400px) rotate3d(1, 0, 0, 10deg); + opacity: 1; + } + 80% { + transform: perspective(400px) rotate3d(1, 0, 0, -5deg); + } + to { + transform: perspective(400px); + } +} + +@keyframes Toastify__flipOut { + from { + transform: translate3d(0, var(--y), 0) perspective(400px); + } + 30% { + transform: translate3d(0, var(--y), 0) perspective(400px) rotate3d(1, 0, 0, -20deg); + opacity: 1; + } + to { + transform: translate3d(0, var(--y), 0) perspective(400px) rotate3d(1, 0, 0, 90deg); + opacity: 0; + } +} + +.Toastify__flip-enter { + animation-name: Toastify__flipIn; +} + +.Toastify__flip-exit { + animation-name: Toastify__flipOut; +} + +@keyframes Toastify__slideInRight { + from { + transform: translate3d(110%, 0, 0); + visibility: visible; + } + to { + transform: translate3d(0, var(--y), 0); + } +} + +@keyframes Toastify__slideInLeft { + from { + transform: translate3d(-110%, 0, 0); + visibility: visible; + } + to { + transform: translate3d(0, var(--y), 0); + } +} + +@keyframes Toastify__slideInUp { + from { + transform: translate3d(0, 110%, 0); + visibility: visible; + } + to { + transform: translate3d(0, var(--y), 0); + } +} + +@keyframes Toastify__slideInDown { + from { + transform: translate3d(0, -110%, 0); + visibility: visible; + } + to { + transform: translate3d(0, var(--y), 0); + } +} + +@keyframes Toastify__slideOutRight { + from { + transform: translate3d(0, var(--y), 0); + } + to { + visibility: hidden; + transform: translate3d(110%, var(--y), 0); + } +} + +@keyframes Toastify__slideOutLeft { + from { + transform: translate3d(0, var(--y), 0); + } + to { + visibility: hidden; + transform: translate3d(-110%, var(--y), 0); + } +} + +@keyframes Toastify__slideOutDown { + from { + transform: translate3d(0, var(--y), 0); + } + to { + visibility: hidden; + transform: translate3d(0, 500px, 0); + } +} + +@keyframes Toastify__slideOutUp { + from { + transform: translate3d(0, var(--y), 0); + } + to { + visibility: hidden; + transform: translate3d(0, -500px, 0); + } +} + +.Toastify__slide-enter--top-left, +.Toastify__slide-enter--bottom-left { + animation-name: Toastify__slideInLeft; +} + +.Toastify__slide-enter--top-right, +.Toastify__slide-enter--bottom-right { + animation-name: Toastify__slideInRight; +} + +.Toastify__slide-enter--top-center { + animation-name: Toastify__slideInDown; +} + +.Toastify__slide-enter--bottom-center { + animation-name: Toastify__slideInUp; +} + +.Toastify__slide-exit--top-left, +.Toastify__slide-exit--bottom-left { + animation-name: Toastify__slideOutLeft; + animation-timing-function: ease-in; + animation-duration: 0.3s; +} + +.Toastify__slide-exit--top-right, +.Toastify__slide-exit--bottom-right { + animation-name: Toastify__slideOutRight; + animation-timing-function: ease-in; + animation-duration: 0.3s; +} + +.Toastify__slide-exit--top-center { + animation-name: Toastify__slideOutUp; + animation-timing-function: ease-in; + animation-duration: 0.3s; +} + +.Toastify__slide-exit--bottom-center { + animation-name: Toastify__slideOutDown; + animation-timing-function: ease-in; + animation-duration: 0.3s; +} + +@keyframes Toastify__spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} +`; +var $t = /* @__PURE__ */ new Map(); +var Rt = (t, o) => { + G(() => { + if (!t || typeof document == "undefined") return; + let e = document, r = $t.get(e); + if (r) { + o && r.setAttribute("nonce", o); + return; + } + let a = e.createElement("style"); + a.textContent = t, o && a.setAttribute("nonce", o), e.head.appendChild(a), $t.set(e, a); + }, [o]); +}; +function xo(t) { + return Rt(Mt, t.nonce), import_react.createElement(dt, { ...t }); +} +//#endregion +//#region src/components/NSPanelToastContainer.tsx +var NSPanelToastContainer_exports = /* @__PURE__ */ __exportAll({ + CustomToast: () => CustomToast, + Notify: () => Notify, + RemoveNotification: () => RemoveNotification, + default: () => NSPanelToastContainer +}); +var import_jsx_runtime = require_jsx_runtime(); +var RemoveNotification = (toast_id) => { + y.dismiss(toast_id); +}; +var Notify = ({ message, level, duration, toast_id }) => { + let toastType = "default"; + if (level === "error") toastType = "error"; + if (level === "warning") toastType = "warning"; + if (level === "info") toastType = "info"; + if (level === "debug") toastType = "default"; + if (level === "success") toastType = "success"; + y(CustomToast, { + autoClose: duration ?? false, + type: toastType, + theme: "colored", + icon: false, + data: { + message, + level + }, + toastId: toast_id + }); +}; +var CustomToast = ({ data }) => { + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "pl-1 py-2 me-6", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: data.message }) + }); +}; +var contextClass = { + success: "bg-success text-success-content", + error: "bg-error text-error-content", + info: "bg-info text-info-content", + warning: "bg-warning text-warning-content", + default: "bg-neutral text-neutral-content" +}; +function NSPanelToastContainer() { + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(xo, { + position: "bottom-right", + autoClose: 5e3, + hideProgressBar: false, + newestOnTop: false, + closeOnClick: false, + rtl: false, + pauseOnFocusLoss: true, + draggable: true, + pauseOnHover: true, + theme: "light", + transition: ft, + toastClassName: (context) => contextClass[context?.type || "default"] + " relative flex min-w-84 p-1 min-h-10 rounded-md justify-between overflow-hidden cursor-pointer my-2", + progressClassName: "progress", + className: "" + }); +} +//#endregion +export { Notify as n, RemoveNotification as r, NSPanelToastContainer_exports as t }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/NSPanelsView-1YvY26NZ.js b/docker/web/nspanelmanager/web/react-components/dist/NSPanelsView-1YvY26NZ.js new file mode 100644 index 000000000..bc4e2451f --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/NSPanelsView-1YvY26NZ.js @@ -0,0 +1,950 @@ +import { c as __toESM, r as require_react, t as require_jsx_runtime } from "./main-FKp56mKw.js"; +import { t as StateManagedSelect$1 } from "./react-select.esm-CbdimKhg.js"; +import { n as Notify } from "./NSPanelToastContainer-D677tDZJ.js"; +import { t as motion } from "./proxy-BQYsYRjY.js"; +import { n as useMotionTemplate, r as useMotionValue, t as useSpring } from "./use-spring-BsypnnSW.js"; +import { t as useStompStore } from "./StompStore-Bh-Guhla.js"; +import { t as useEntityStatesStore } from "./EntityStore-CHE3-bsC.js"; +import { _ as mdiWifiStrength2, a as mdiMemory, b as mdiWifiStrengthAlertOutline, c as mdiMinusCircle, f as mdiThermometer, g as mdiWifiStrength1Alert, h as mdiWeb, l as mdiRestart, n as mdiCog, p as mdiUpload, s as mdiMenuDownOutline, u as mdiTableArrowUp, v as mdiWifiStrength3, x as require_Icon, y as mdiWifiStrength4 } from "./mdi-Cr6PIsRR.js"; +//#region src/components/IndexPage/NSPanelBox.tsx +var import_react = /* @__PURE__ */ __toESM(require_react(), 1); +var import_Icon = require_Icon(); +var import_jsx_runtime = require_jsx_runtime(); +function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; +} +var delete_nspanel = (nspanel_id) => { + fetch(`/rest/nspanel/${nspanel_id}`, { + method: "DELETE", + headers: { "X-CSRFToken": getCookie("csrftoken") } + }).then((response) => { + console.log(response); + }).catch((error) => { + Notify({ + message: `Failed to delete NSPanel: ${error}`, + level: "error", + duration: 1e4 + }); + }); +}; +var DeleteNSPanelConfirmDialog = (0, import_react.forwardRef)(({ status, delete_nspanel_dialog_ref }, ref) => { + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("dialog", { + ref, + className: "modal", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "modal-box", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { + className: "text-lg font-bold", + children: "Delete NSPanel" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { + className: "py-4", + children: [ + "Are you sure you want to delete NSPanel '", + status.name, + "'?" + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex justify-end join", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => delete_nspanel_dialog_ref.current?.close(), + className: "btn btn-neutral join-item", + children: "Cancel" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => { + delete_nspanel_dialog_ref.current?.close(); + delete_nspanel(status.id); + }, + className: "btn btn-error join-item", + children: "Delete" + })] + }) + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { + method: "dialog", + className: "modal-backdrop", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { children: "close" }) + })] + }); +}); +var NSPanelStatusHeader = ({ state, update_progress }) => { + if (state == "online") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "min-h-1 overflow-hidden w-full transition-all ease-linear duration-300 bg-success rounded-t-field", + id: "panel_header-${id}" + }); + else if (state == "offline") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "min-h-1 overflow-hidden w-full transition-all ease-linear duration-300 bg-error rounded-t-field", + id: "panel_header-${id}" + }); + else if (state == "rebooting") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "min-h-1 overflow-hidden w-full bg-info rounded-t-field animate-progress-indeterminate origin-left-right", + id: "panel_header-${id}" + }); + else if (state == "waiting") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "min-h-1 overflow-hidden w-full transition-all ease-linear duration-300 bg-info animate-pulse rounded-t-field", + id: "panel_header-${id}" + }); + else if (state == "updating_fw" || state == "updating_fs" || state == "updating_tft") { + if (update_progress == 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "min-h-1 overflow-hidden w-full transition-all ease-linear duration-300 bg-info animate-pulse rounded-t-field", + id: "panel_header-${id}" + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "min-h-1 overflow-hidden w-full transition-all ease-linear duration-1000 bg-info rounded-t-field", + style: { width: `${update_progress}%` }, + id: "panel_header-${id}" + }); + } else if (state == "awaiting_accept") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "min-h-1 overflow-hidden w-full transition-all ease-linear duration-300 bg-accent animate-pulse rounded-t-field", + id: "panel_header-${id}" + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "min-h-1 overflow-hidden w-full transition-all ease-linear duration-300 bg-warning text-warning-content animate-pulse rounded-t-field", + id: "panel_header-${id}", + children: ["Unknown state: ", state] + }); +}; +var NSPanelWarnings = ({ warnings }) => { + if (warnings.length === 0) return null; + let highest_warning_level = 5; + let badge_color = "status-base-content"; + warnings.forEach((warning) => { + switch (warning.level) { + case "error": + highest_warning_level = 1; + badge_color = "status-error"; + break; + case "warning": + if (highest_warning_level > 2) highest_warning_level = 2; + badge_color = "status-warning"; + break; + case "info": + if (highest_warning_level > 3) highest_warning_level = 3; + badge_color = "status-info"; + break; + case "debug": + if (highest_warning_level > 4) highest_warning_level = 4; + badge_color = "status-base-content"; + } + }); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "dropdown dropdown-hover dropdown-end p-0 m-0", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex items-end justify-end px-1", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: `status ${badge_color} status-lg`, + tabIndex: 1, + role: "button" + }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { + tabIndex: -1, + className: "dropdown-content list backdrop-blur-md backdrop-brightness-80 border border-warning/50 w-92 rounded-box shadow-md", + children: warnings.map((warning, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { + className: "list-row", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [ + warning.level == "error" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z", + className: "w-4 h-4 text-error" + }), + warning.level == "warning" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z", + className: "w-4 h-4 text-warning" + }), + warning.level == "info" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z", + className: "w-4 h-4 text-info" + }), + warning.level == "debug" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z", + className: "w-4 h-4 text-base-content" + }) + ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: warning.text }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "text-xs uppercase font-semibold opacity-60", + children: warning.level.charAt(0).toUpperCase() + warning.level.slice(1) + })] })] + }, index)) + })] + }); +}; +var AcceptedNSPanelContent = ({ status }) => { + const popoverRef = (0, import_react.useRef)(null); + const boxRef = (0, import_react.useRef)(null); + const delete_nspanel_dialog_ref = (0, import_react.useRef)(null); + const mouseX = useMotionValue(0); + const mouseY = useMotionValue(0); + const springX = useSpring(mouseX, { + stiffness: 300, + damping: 30 + }); + const springY = useSpring(mouseY, { + stiffness: 300, + damping: 30 + }); + const clipPath = useMotionTemplate`radial-gradient(circle at ${springX}px ${springY}px, black 0%, black 15%, transparent 50%)`; + (0, import_react.useEffect)(() => { + const handleMouseMove = (e) => { + const boundingRect = boxRef.current?.getBoundingClientRect(); + if (!boundingRect) return; + mouseX.set(e.clientX - boundingRect.left); + mouseY.set(e.clientY - boundingRect.top); + }; + window.addEventListener("mousemove", handleMouseMove); + return () => { + window.removeEventListener("mousemove", handleMouseMove); + }; + }, [mouseX, mouseY]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "relative h-full group/box", + ref: boxRef, + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(motion.div, { + style: { + WebkitMaskImage: clipPath, + maskImage: clipPath, + pointerEvents: "none" + }, + className: "absolute tile-background w-full h-full group overflow-hidden mb-1 opacity-0 group-hover/box:opacity-5", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "grid grid-cols-8 w-full h-full inset-0", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-2s] tile-1 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-6s] tile-2 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-4s] tile-3 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-8s] tile-4 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-4s] tile-1 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-2s] tile-2 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-8s] tile-3 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-2s] tile-4 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-4s] tile-1 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-8s] tile-2 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-6s] tile-3 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-4s] tile-4 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-8s] tile-1 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-6s] tile-2 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-2s] tile-3 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-4s] tile-4 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full col-span-4 ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-6s] tile-1 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full col-span-4 ${status.state == "offline" ? "bg-error" : "bg-accent"} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-2s] tile-2 group/box:opacity-50` }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-1/8 top-0 w-px h-full bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-2/8 top-0 w-px h-full bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-3/8 top-0 w-px h-full bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-4/8 top-0 w-px h-full bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-5/8 top-0 w-px h-full bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-6/8 top-0 w-px h-full bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-7/8 top-0 w-px h-full bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-8/8 top-0 w-px h-full bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-0 top-1/3 w-full h-px bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-0 top-2/3 w-full h-px bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-0 top-3/3 w-full h-px bg-base-content" }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DeleteNSPanelConfirmDialog, { + status, + ref: delete_nspanel_dialog_ref, + delete_nspanel_dialog_ref + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "p-2 h-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex justify-between mx-auto", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { + href: `/nspanel/${status.id}`, + className: "font-medium text-lg", + children: status.name + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center justify-end", + children: [(() => { + if (status.state === "online") return null; + else if (status.state === "offline") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "flex items-end justify-end text-right italic font-light text-sm", + children: "Offline" + }); + else if (status.state === "rebooting") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "flex items-end justify-end text-right italic font-light text-sm", + children: "Rebooting" + }); + else if (status.state === "waiting") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "flex items-end justify-end text-right italic font-light text-sm", + children: "Waiting" + }); + else if (status.state === "updating_fw") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "flex items-end justify-end text-right italic font-light text-sm", + children: [ + "Updating firmware, ", + status.update_progress, + "%" + ] + }); + else if (status.state === "updating_fs") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "flex items-end justify-end text-right italic font-light text-sm", + children: [ + "Updating filesystem, ", + status.update_progress, + "%" + ] + }); + else if (status.state === "updating_tft") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "flex items-end justify-end text-right italic font-light text-sm", + children: [ + "Updating GUI, ", + status.update_progress, + "%" + ] + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "flex items-end justify-end text-right italic font-light text-sm text-warning", + children: ["Unknown status: ", status.state] + }); + })(), status.state != "offline" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelWarnings, { warnings: status.warnings })] + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex justify-between items-end", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "my-1", + children: (() => { + if (status.model != "sonoff" && status.model != "custom") return null; + if (status.state == "offline" || status.state == "unknown" || status.state == "waiting" || status.state == "rebooting") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "icon-text text-sm text-base-content/50", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiWifiStrengthAlertOutline, + className: "w-4 h-4 inline-block me-1" + }), "-"] + }); + else if (status.rssi <= -80) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "icon-text text-sm", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiWifiStrength1Alert, + className: "w-4 h-4 inline-block me-1" + }), + status.rssi, + " dBm" + ] + }); + else if (status.rssi <= -70) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "icon-text text-sm", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiWifiStrength2, + className: "w-4 h-4 inline-block me-1" + }), + status.rssi, + " dBm" + ] + }); + else if (status.rssi <= -55) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "icon-text text-sm", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiWifiStrength3, + className: "w-4 h-4 inline-block me-1" + }), + status.rssi, + " dBm" + ] + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "icon-text text-sm", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiWifiStrength4, + className: "w-4 h-4 inline-block me-1" + }), + status.rssi, + " dBm" + ] + }); + })() + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "my-1", + children: (() => { + if (status.model != "sonoff" && status.model != "custom") return null; + if (status.state == "offline" || status.state == "unknown" || status.state == "waiting" || status.state == "rebooting") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center justify-start text-base-content/50", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "icon-text", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiThermometer, + className: "w-4 h-4 inline-block me-1" + }), + "-", + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + id: "temperature-${nspanel_id}", + className: "text-sm", + children: "-" + }) + ] + }), status.model == "custom" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "mx-1", + children: "|" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "icon-text text-base-content/50", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: "M12,3.25C12,3.25 6,10 6,14C6,17.32 8.69,20 12,20A6,6 0 0,0 18,14C18,10 12,3.25 12,3.25M14.47,9.97L15.53,11.03L9.53,17.03L8.47,15.97M9.75,10A1.25,1.25 0 0,1 11,11.25A1.25,1.25 0 0,1 9.75,12.5A1.25,1.25 0 0,1 8.5,11.25A1.25,1.25 0 0,1 9.75,10M14.25,14.5A1.25,1.25 0 0,1 15.5,15.75A1.25,1.25 0 0,1 14.25,17A1.25,1.25 0 0,1 13,15.75A1.25,1.25 0 0,1 14.25,14.5Z", + className: "w-4 h-4 inline-block me-1" + }), + "-", + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + id: "humidity-${nspanel_id}", + className: "text-sm", + children: "-" + }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "mx-1", + children: "|" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "icon-text text-base-content/50", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: "M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,4A8,8 0 0,1 20,12C20,14.4 19,16.5 17.3,18C15.9,16.7 14,16 12,16C10,16 8.2,16.7 6.7,18C5,16.5 4,14.4 4,12A8,8 0 0,1 12,4M14,5.89C13.62,5.9 13.26,6.15 13.1,6.54L11.81,9.77L11.71,10C11,10.13 10.41,10.6 10.14,11.26C9.73,12.29 10.23,13.45 11.26,13.86C12.29,14.27 13.45,13.77 13.86,12.74C14.12,12.08 14,11.32 13.57,10.76L13.67,10.5L14.96,7.29L14.97,7.26C15.17,6.75 14.92,6.17 14.41,5.96C14.28,5.91 14.15,5.89 14,5.89M10,6A1,1 0 0,0 9,7A1,1 0 0,0 10,8A1,1 0 0,0 11,7A1,1 0 0,0 10,6M7,9A1,1 0 0,0 6,10A1,1 0 0,0 7,11A1,1 0 0,0 8,10A1,1 0 0,0 7,9M17,9A1,1 0 0,0 16,10A1,1 0 0,0 17,11A1,1 0 0,0 18,10A1,1 0 0,0 17,9Z", + className: "w-4 h-4 inline-block me-1" + }), + "-", + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + id: "pressure-${nspanel_id}", + className: "text-sm", + children: "-" + }) + ] + }) + ] })] + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center justify-start", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "icon-text", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiThermometer, + className: "w-4 h-4 inline-block me-1" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + id: "temperature-${nspanel_id}", + className: "text-sm", + children: [status.temperature ? status.temperature.toFixed(1) : "?", status.temperature_unit] + })] + }), status.model == "custom" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "mx-1", + children: "|" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "icon-text", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: "M12,3.25C12,3.25 6,10 6,14C6,17.32 8.69,20 12,20A6,6 0 0,0 18,14C18,10 12,3.25 12,3.25M14.47,9.97L15.53,11.03L9.53,17.03L8.47,15.97M9.75,10A1.25,1.25 0 0,1 11,11.25A1.25,1.25 0 0,1 9.75,12.5A1.25,1.25 0 0,1 8.5,11.25A1.25,1.25 0 0,1 9.75,10M14.25,14.5A1.25,1.25 0 0,1 15.5,15.75A1.25,1.25 0 0,1 14.25,17A1.25,1.25 0 0,1 13,15.75A1.25,1.25 0 0,1 14.25,14.5Z", + className: "w-4 h-4 inline-block me-1" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + id: "humidity-${nspanel_id}", + className: "text-sm", + children: status.humidity && `${status.humidity.toFixed(1)}%` || "-" + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "mx-1", + children: "|" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "icon-text", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: "M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,4A8,8 0 0,1 20,12C20,14.4 19,16.5 17.3,18C15.9,16.7 14,16 12,16C10,16 8.2,16.7 6.7,18C5,16.5 4,14.4 4,12A8,8 0 0,1 12,4M14,5.89C13.62,5.9 13.26,6.15 13.1,6.54L11.81,9.77L11.71,10C11,10.13 10.41,10.6 10.14,11.26C9.73,12.29 10.23,13.45 11.26,13.86C12.29,14.27 13.45,13.77 13.86,12.74C14.12,12.08 14,11.32 13.57,10.76L13.67,10.5L14.96,7.29L14.97,7.26C15.17,6.75 14.92,6.17 14.41,5.96C14.28,5.91 14.15,5.89 14,5.89M10,6A1,1 0 0,0 9,7A1,1 0 0,0 10,8A1,1 0 0,0 11,7A1,1 0 0,0 10,6M7,9A1,1 0 0,0 6,10A1,1 0 0,0 7,11A1,1 0 0,0 8,10A1,1 0 0,0 7,9M17,9A1,1 0 0,0 16,10A1,1 0 0,0 17,11A1,1 0 0,0 18,10A1,1 0 0,0 17,9Z", + className: "w-4 h-4 inline-block me-1" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + id: "pressure-${nspanel_id}", + className: "text-sm", + children: status.pressure && `${(status.pressure / 100).toFixed(1)} hPa` || "-" + })] + }) + ] })] + }); + })() + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "my-1", + children: (() => { + if (status.model != "sonoff" && status.model != "custom") return null; + if (status.state == "offline" || status.state == "unknown" || status.state == "waiting" || status.state == "rebooting") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "icon-text text-base-content/50", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiMemory, + className: "w-4 h-4 inline-block me-1" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + id: "ram-${nspanel_id}", + className: "text-sm", + children: "-" + })] + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "icon-text", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiMemory, + className: "w-4 h-4 inline-block me-1" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + id: "ram-${nspanel_id}", + className: "text-sm", + children: [status.ram_usage.toFixed(0), "%"] + })] + }); + })() + }) + ] }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "absolute right-2 bottom-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + className: "font-medium text-sm px-1 py-2 text-center inline-flex items-center cursor-pointer", + popoverTarget: `nspanel-actions-${status.id}`, + style: { anchorName: `--anchor-nspanel-actions-${status.id}` }, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiCog, + className: "w-4 h-4" + }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ul", { + className: "dropdown menu w-52 rounded-box bg-base-100 shadow-sm", + popover: "auto", + id: `nspanel-actions-${status.id}`, + style: { anchorName: `--anchor-nspanel-actions-${status.id}` }, + ref: popoverRef, + children: [status.model === "sonoff" || status.model === "custom" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { + onClick: () => { + useStompStore.getState().send(`nspanel/${status.mac}/command`, "reboot"); + Notify({ + message: `Sent reboot command to ${status.name}.`, + level: "success", + duration: 2e3 + }); + popoverRef.current?.hidePopover(); + }, + id: "reboot-{{ id }}", + "hx-swap": "none", + className: "block px-4 py-2 cursor-pointer nspanel-reboot-button group", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiRestart, + className: "w-4 h-4 inline-block me-1 group-hover:text-warning" + }), "Reboot"] + }) }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { + href: status.state === "offline" ? "#" : `http://${status.ip_address}/`, + onClick: () => status.state != "offline" ? popoverRef.current?.hidePopover() : null, + id: "visit-{{ id }}", + "hx-swap": "none", + className: `block px-4 py-2 cursor-pointer nspanel-visit-button group ${status.state === "offline" ? "line-through" : ""}`, + target: "_blank", + "aria-disabled": status.state === "offline", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiWeb, + className: "w-4 h-4 inline-block me-1 group-hover:text-info" + }), "Visit"] + }) }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "border-t border-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { + onClick: () => { + if (status.state !== "offline") { + useStompStore.getState().send(`nspanel/${status.mac}/command`, "firmware_update"); + Notify({ + message: `Sent firmware update command to ${status.name}.`, + level: "success", + duration: 2e3 + }); + popoverRef.current?.hidePopover(); + } + }, + id: "firmware-update-{{ nspanel.data.id }}", + className: `block px-4 py-2 cursor-pointer group ${status.state === "offline" ? "line-through" : ""}`, + "aria-disabled": status.state === "offline", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiUpload, + className: "w-4 h-4 inline-block me-1 group-hover:text-success" + }), "Update firmware"] + }) }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { + onClick: () => { + if (status.state !== "offline") { + useStompStore.getState().send(`nspanel/${status.mac}/command`, "gui_update"); + Notify({ + message: `Sent GUI update command to ${status.name}.`, + level: "success", + duration: 2e3 + }); + popoverRef.current?.hidePopover(); + } + }, + id: "screen-update-{{ nspanel.data.id }}", + className: `block px-4 py-2 cursor-pointer group ${status.state === "offline" ? "line-through" : ""}`, + "aria-disabled": status.state === "offline", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiTableArrowUp, + className: "w-4 h-4 inline-block me-1 group-hover:text-success" + }), "Update GUI"] + }) }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "border-t border-base-content" }) + ] }) : null, /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { + onClick: () => { + delete_nspanel_dialog_ref.current?.showModal(); + popoverRef.current?.hidePopover(); + }, + id: "delete-{{ id }}", + "hx-swap": "none", + className: "block px-4 py-2 cursor-pointer group", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiMinusCircle, + className: "w-4 h-4 inline-block me-1 group-hover:text-error" + }), "Delete"] + }) })] + })] + }) + ] + }) + ] + }) }); +}; +var deny_nspanel = (nspanel_id) => { + fetch(`/rest/nspanel/${nspanel_id}/deny`, { + method: "POST", + headers: { "X-CSRFToken": getCookie("csrftoken") } + }).then((response) => response.json()).then((data) => { + console.log(data); + }); +}; +var accept_nspanel = ({ nspanel_id, room_id }) => { + fetch(`/rest/nspanel/${nspanel_id}/accept`, { + method: "POST", + headers: { "X-CSRFToken": getCookie("csrftoken") }, + body: JSON.stringify({ room_id }) + }).then((response) => response.json()).then((data) => { + console.log(data); + }); +}; +var AcceptNewNSPanelDialog = (0, import_react.forwardRef)(({ status, accept_new_nspanel_dialog_ref }, ref) => { + const [selectedRoom, setSelectedRoom] = (0, import_react.useState)(null); + const [availableRooms, setAvailableRooms] = (0, import_react.useState)([]); + const classNames = { + control: (state) => `${state.isFocused ? "border" : "border-0"} border-accent p-2.5 text-sm rounded-box bg-base-300 rounded-md`, + menu: () => "bg-base-300 p-2.5 rounded-box", + option: (state) => `p-1 ${state.isSelected ? "bg-primary/20 rounded-sm" : ""} ${state.isFocused ? "bg-primary/20 rounded-sm" : ""}` + }; + const CustomOption = ({ innerProps, isDisabled, isFocused, isSelected, children }) => { + if (isDisabled) return null; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + ...innerProps, + className: `p-1 ${isSelected ? "bg-primary/20 rounded-sm" : ""} ${isFocused ? "bg-primary/20 rounded-sm" : ""}`, + children + }); + }; + if (availableRooms.length === 0) { + const rooms = useEntityStatesStore.getState().rooms; + for (const room of Object.values(rooms)) setAvailableRooms((prev) => [...prev, { + value: room.id, + label: room.friendly_name + }]); + } + const contentRef = (0, import_react.useRef)(null); + const checkOverflow = () => { + if (contentRef.current) { + const maxHeightString = window.getComputedStyle(contentRef.current).maxHeight; + let maxHeight = parseFloat(maxHeightString); + if (maxHeightString.endsWith("%")) maxHeight = Math.trunc(window.innerHeight * maxHeight / 100); + contentRef.current.classList.toggle("overflow-y-auto", contentRef.current.scrollHeight > maxHeight); + contentRef.current.classList.toggle("overflow-y-visible", contentRef.current.scrollHeight <= maxHeight); + } + }; + (0, import_react.useEffect)(() => { + const observer = new ResizeObserver((entries) => { + entries.forEach(() => { + checkOverflow(); + }); + }); + if (contentRef.current) observer.observe(contentRef.current); + }, [contentRef]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("dialog", { + ref, + className: "modal", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "modal-box", + ref: contentRef, + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { + className: "text-lg font-bold", + children: "Accept NSPanel" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "Select room" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: availableRooms, + classNames, + onChange: (newValue) => { + setSelectedRoom(newValue); + }, + value: selectedRoom, + unstyled: true, + components: { Option: CustomOption }, + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex justify-end join pt-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => accept_new_nspanel_dialog_ref.current?.close(), + className: "btn btn-neutral join-item", + children: "Cancel" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => { + if (!selectedRoom) return; + accept_new_nspanel_dialog_ref.current?.close(); + accept_nspanel({ + nspanel_id: status.id, + room_id: selectedRoom.value + }); + }, + className: "btn btn-success join-item", + children: "Accept" + })] + }) + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { + method: "dialog", + className: "modal-backdrop", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { children: "close" }) + })] + }); +}); +var NewNSPanelContent = ({ status }) => { + const accept_new_nspanel_dialog_ref = (0, import_react.useRef)(null); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center justify-center h-full w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AcceptNewNSPanelDialog, { + status, + ref: accept_new_nspanel_dialog_ref, + accept_new_nspanel_dialog_ref + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex w-full items-/center justify-center pt-2", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "nspanel-name", + children: [ + "NSPanel '", + status.name, + "' is awaiting accept." + ] + }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex w-full items-center justify-center pt-2 pb-4", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + className: "btn btn-soft btn-error m-1 rounded-btn", + onClick: () => deny_nspanel(status.id), + children: "Deny" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + className: "btn btn-soft btn-info m-1 rounded-btn", + onClick: () => accept_new_nspanel_dialog_ref.current?.showModal(), + children: "Accept" + })] }) + })] })] + }); +}; +var NSPanelBox = ({ mac }) => { + const nspanel_status = useEntityStatesStore.getState().nspanels[mac]; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "text-base-content rounded-b-box rounded-t-field nspanel-box bg-base-200 hover:bg-base-100 transition-all duration-200 shadow-xl shadow-neutral/3 hover:shadow-neutral/10 overflow-visible h-34", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "overflow-hidden", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelStatusHeader, { + state: nspanel_status?.state ?? "", + update_progress: nspanel_status?.update_progress ?? 0 + }) + }), nspanel_status?.accepted && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AcceptedNSPanelContent, { status: nspanel_status }) || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NewNSPanelContent, { status: nspanel_status })] + }); +}; +//#endregion +//#region src/components/IndexPage/NSPanelsView.tsx +var NSPanelsIndexView = () => { + const { nspanels, status, fetchData } = useEntityStatesStore(); + const popoverRef = (0, import_react.useRef)(null); + (0, import_react.useEffect)(() => { + if (status === "none") fetchData(); + }, [status, fetchData]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center justify-between", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-2xl", + children: "NSPanels" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { + className: "btn btn-soft font-medium", + popoverTarget: `nspanels-actions`, + style: { anchorName: `--anchor-nspanels-actions` }, + children: ["Actions", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiMenuDownOutline, + className: "w-4" + })] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ul", { + className: "dropdown menu w-52 rounded-box bg-base-100 shadow-sm", + popover: "auto", + id: `nspanels-actions`, + style: { anchorName: `--anchor-nspanels-actions` }, + ref: popoverRef, + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { + onClick: () => { + const nspanels = useEntityStatesStore.getState().nspanels; + for (const [mac, status] of Object.entries(nspanels)) if (status.accepted) useStompStore.getState().send(`nspanel/${mac}/command`, "reboot"); + Notify({ + message: `Sent reboot command to all NSPanels.`, + level: "success", + duration: 2e3 + }); + popoverRef.current?.hidePopover(); + }, + id: "reboot-{{ id }}", + "hx-swap": "none", + className: "block px-4 py-2 group", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiRestart, + className: "w-6 h-6 inline-block pr-2 group-hover:text-warning" + }), "Reboot all NSPanels"] + }) }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "border-t border-neutral-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { + onClick: () => { + const nspanels = useEntityStatesStore.getState().nspanels; + for (const [mac, status] of Object.entries(nspanels)) if (status.state == "online" && status.accepted) { + useStompStore.getState().send(`nspanel/${mac}/command`, "firmware_update"); + Notify({ + message: `Sent FW update command to ${status.name}.`, + level: "success", + duration: 2e3 + }); + } + popoverRef.current?.hidePopover(); + }, + id: "firmware-update-all", + className: `block px-4 py-2 cursor-pointer group`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiUpload, + className: "w-6 h-6 inline-block pr-2 group-hover:text-success" + }), "Update firmware on all NSPanels"] + }) }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { + onClick: () => { + const nspanels = useEntityStatesStore.getState().nspanels; + for (const [mac, status] of Object.entries(nspanels)) if (status.state == "online" && status.accepted) { + useStompStore.getState().send(`nspanel/${mac}/command`, "gui_update"); + Notify({ + message: `Sent GUI update command to ${status.name}.`, + level: "success", + duration: 2e3 + }); + } + popoverRef.current?.hidePopover(); + }, + id: "screen-update-all", + className: `block px-4 py-2 cursor-pointer group`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiTableArrowUp, + className: "w-6 h-6 inline-block pr-2 group-hover:text-success" + }), "Update GUI on all NSPanels"] + }) }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "border-t border-neutral-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { + onClick: () => { + fetch("/api/restart_mqtt_manager", { method: "POST" }).then((response) => { + if (response.ok) Notify({ + message: `MQTTManager restarted successfully.`, + level: "success", + duration: 2e3 + }); + else Notify({ + message: `Failed to restart MQTTManager.`, + level: "error", + duration: 2e3 + }); + }).catch((error) => { + Notify({ + message: `Failed to restart MQTTManager.`, + level: "error", + duration: 2e3 + }); + console.error("Got error while trying to restart MQTTManager process. Error:", error); + }); + popoverRef.current?.hidePopover(); + }, + id: "restart-mqtt-manager", + className: "block px-4 py-2 cursor-pointer group", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiRestart, + className: "w-6 h-6 inline-block pr-2 group-hover:text-warning" + }), "Restart MQTTManager"] + }) }) + ] + })] })] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: (() => { + if (status != "loaded") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex w-full items-center justify-center text-2xl", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "loading loading-spinner loading-sm mr-2" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "font-medium", + children: "Loading NSPanels..." + })] + }); + if (nspanels && Object.keys(nspanels).length > 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "grid md:grid-cols-3 gap-4 mt-4 items-stretch", + id: "nspanels_container", + children: Object.entries(nspanels).filter(([_mac, status]) => !status.denied).map(([mac, status]) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelBox, { mac: String(status.mac) }, mac)) + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "grid md:grid-cols-3 gap-4 mt-4 items-start", + id: "nspanels_container", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "col-span-3 w-full text-center text-xl text-base-content", + children: [ + "No NSPanels found. Getting started?", + " ", + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { + href: "https://nspanelmanager.com/docs/getting-started/flash-nspanel", + target: "_blank", + className: "text-accent", + children: "Read the documentation." + }) + ] + }) + }); + })() })] }); +}; +//#endregion +export { NSPanelsIndexView as default }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/RoomPage-CMRDvbEM.js b/docker/web/nspanelmanager/web/react-components/dist/RoomPage-CMRDvbEM.js new file mode 100644 index 000000000..8d7037eae --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/RoomPage-CMRDvbEM.js @@ -0,0 +1,336 @@ +import { c as __toESM, r as require_react, t as require_jsx_runtime } from "./main-FKp56mKw.js"; +import { r as useAvailableEntitiesStore } from "./MultiStep_AddEditEntity-xcopfTe5.js"; +import { t as StateManagedSelect$1 } from "./react-select.esm-CbdimKhg.js"; +import { l as useWatch, s as useForm } from "./index.esm-CnTf2rLv.js"; +import { n as Notify } from "./NSPanelToastContainer-D677tDZJ.js"; +import EntitiesPagesView from "./EntitiesPagesView-DShidmI8.js"; +import { t as useStompStore } from "./StompStore-Bh-Guhla.js"; +import { t as useEntityStatesStore } from "./EntityStore-CHE3-bsC.js"; +import { d as mdiTextShort, x as require_Icon } from "./mdi-Cr6PIsRR.js"; +//#region src/components/RoomPage/RoomPage.tsx +var import_react = /* @__PURE__ */ __toESM(require_react(), 1); +var import_Icon = require_Icon(); +var import_jsx_runtime = require_jsx_runtime(); +function RoomPage({ room_id }) { + const { status: stompStatus } = useStompStore(); + const { status: entityStatus, rooms, _nspanels } = useEntityStatesStore(); + const home_assistant_options = useAvailableEntitiesStore((s) => s.home_assistant_options); + const openhab_options = useAvailableEntitiesStore((s) => s.openhab_options); + const all_options = [...home_assistant_options.filter((option) => option.value.startsWith("sensor.")), ...openhab_options]; + const room = rooms[room_id]; + const [hasLoadedValues, setHasLoadedValues] = (0, import_react.useState)(false); + const delete_confirm_dialog_ref = (0, import_react.useRef)(null); + const can_delete = Object.keys(rooms).length > 1 || _nspanels.length === 0; + const { control, register, getValues, setValue, reset, handleSubmit } = useForm({ defaultValues: { + id: room?.id, + friendly_name: room?.friendly_name, + room_temp_provider: room?.room_temp_provider, + room_temp_sensor: room?.room_temp_sensor + } }); + useWatch({ + control, + name: "room_temp_sensor" + }); + const current_friendly_name = useWatch({ + control, + name: "friendly_name" + }); + function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } + const onSubmit = (data) => { + fetch("/rest/rooms", { + credentials: "same-origin", + method: "PUT", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + }, + body: JSON.stringify(data) + }).then(async (response) => { + const data = await response.json(); + if (!response.ok) { + const error = data && data.message || response.status; + return Promise.reject(error); + } + Notify({ + message: `Saved room setting successfully.`, + level: "success", + duration: 5e3 + }); + }).catch((error) => { + Notify({ + message: `Error saving entity. Error: ${error}`, + level: "error", + duration: 1e4 + }); + }); + }; + const deleteRoom = () => { + fetch(`/rest/rooms/${room_id}`, { + method: "DELETE", + headers: { "X-CSRFToken": getCookie("csrftoken") } + }).then(async (response) => { + const data = await response.json(); + if (!response.ok) return Promise.reject(data && data.message || response.status); + window.location.href = "/rooms"; + }).catch((error) => { + delete_confirm_dialog_ref.current?.close(); + Notify({ + message: `Failed to delete room: ${error}`, + level: "error", + duration: 1e4 + }); + }); + }; + (0, import_react.useEffect)(() => { + if (stompStatus == "none") useStompStore.getState().connect(); + }, [stompStatus]); + (0, import_react.useEffect)(() => { + if (entityStatus == "none") useEntityStatesStore.getState().fetchData(); + }, [entityStatus]); + (0, import_react.useEffect)(() => { + if (useAvailableEntitiesStore.getState().status == "none") useAvailableEntitiesStore.getState().fetchEntities(); + }, []); + (0, import_react.useEffect)(() => { + if (room && !hasLoadedValues) { + reset({ + id: room.id, + friendly_name: room.friendly_name, + room_temp_provider: room.room_temp_provider, + room_temp_sensor: room.room_temp_sensor + }); + setHasLoadedValues(true); + } + }, [ + room, + reset, + hasLoadedValues, + setHasLoadedValues + ]); + if (entityStatus != "loaded") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex w-full items-center justify-center text-2xl", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "loading loading-spinner loading-sm mr-2" }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "font-medium", + children: [ + "Loading data (", + entityStatus, + ")..." + ] + })] + }); + if (room_id && !rooms[room_id]) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex w-full items-center justify-center text-2xl", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "font-medium text-error text-lg", + children: [ + "Room with ID ", + room_id, + " not found." + ] + }) + }); + const classNames = { + control: (state) => `${state.isFocused ? "border" : "border-0"} border-accent p-2.5 text-sm rounded-box bg-base-300 text-base-content rounded-md`, + menu: () => "bg-base-300 p-2.5 rounded-box text-base-content", + option: (state) => `p-1 ${state.isSelected ? "bg-primary/20 rounded-sm" : ""} ${state.isFocused ? "bg-primary/20 rounded-sm" : ""}` + }; + const CustomOption = ({ innerProps, isDisabled, isFocused, isSelected, children, data }) => { + if (isDisabled) return null; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + ...innerProps, + className: `p-1 ${isSelected ? "bg-primary/20 rounded-sm" : ""} ${isFocused ? "bg-primary/20 rounded-sm" : ""}`, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi ${data.icon} me-2` }), children] + }); + }; + const select_components = { Option: CustomOption }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("dialog", { + ref: delete_confirm_dialog_ref, + className: "modal", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "modal-box", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { + className: "text-lg font-bold", + children: "Delete room" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { + className: "py-4", + children: [ + "Are you sure you want to delete room '", + room.friendly_name, + "'? Its entities, scenes and pages will be deleted. Any panels in it will be moved to another room." + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex justify-end join", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => delete_confirm_dialog_ref.current?.close(), + className: "btn btn-neutral join-item", + children: "Cancel" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: deleteRoom, + className: "btn btn-error join-item", + children: "Delete" + })] + }) + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { + method: "dialog", + className: "modal-backdrop", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { children: "close" }) + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { + onSubmit: handleSubmit(onSubmit), + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center justify-between", + id: "nspanel_settings_container", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h2", { + className: "font-medium text-2xl", + id: "nspanel_name", + children: [ + "Settings for room '", + current_friendly_name, + "'" + ] + }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { + href: "https://nspanelmanager.com/docs/web-interface#room-page", + target: "_blank", + className: "btn btn-outline btn-info", + children: "Help" + })] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "md:flex md:justify-between md:items-start mt-2", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "p-4 bg-base-100 rounded-md shadow-lg w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "block mb-2 text-xl", + children: "General" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: "friendly_name", + className: "block mb-2 text-sm font-medium", + children: "Name" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex flex-row-reverse", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + className: "outline-none rounded-none bg-base-300 border-neutral rounded-e-md border border-l-0 focus:ring-0 focus:border-accent block flex-1 min-w-0 w-full text-sm p-2.5 peer/name", + type: "text", + ...register("friendly_name") + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "inline-flex items-center px-3 text-sm border border-neutral rounded-e-0 rounded-s-md peer-focus/name:border-accent", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiTextShort, + className: "w-4 h-4" + }), " "] + })] + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "hidden", + name: "room_temp_provider", + id: "room_temp_provider", + readOnly: true, + value: "{{ room.room_temp_provider }}" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "my-2 w-full md:ms-1", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + className: "block mb-2 text-sm font-medium", + children: "Room temperature sensor" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StateManagedSelect$1, { + options: all_options, + classNames, + onChange: (newValue) => { + if (newValue) { + setValue("room_temp_provider", newValue.type, { shouldDirty: true }); + setValue("room_temp_sensor", newValue.value, { shouldDirty: true }); + } else { + setValue("room_temp_provider", "", { shouldDirty: true }); + setValue("room_temp_sensor", "", { shouldDirty: true }); + } + }, + unstyled: true, + components: select_components, + value: all_options.find((option) => option.value === getValues("room_temp_sensor")), + styles: { + input: (base) => ({ + ...base, + "input:focus": { boxShadow: "none" } + }), + multiValueLabel: (base) => ({ + ...base, + whiteSpace: "normal", + overflow: "visible" + }), + control: (base) => ({ + ...base, + transition: "none" + }) + } + })] + }), + !can_delete && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + role: "alert", + className: "alert alert-info my-4", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "The last room cannot be deleted while panels are assigned to it. Create another room or remove the panels first." }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "text-right mt-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-error", + disabled: !can_delete, + onClick: () => delete_confirm_dialog_ref.current?.showModal(), + children: "Delete" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "submit", + className: "btn btn-success", + children: "Save" + })] + }) + ] + }) + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "md:flex md:justify-between md:items-start mt-2", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "p-4 bg-base-100 rounded-md shadow-lg w-full", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EntitiesPagesView, { + room_id: room.id, + type: "scene" + }) + }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "md:flex md:justify-between md:items-start mt-2 mb-4", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "p-4 bg-base-100 rounded-md shadow-lg w-full", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EntitiesPagesView, { + room_id: room.id, + type: "entity" + }) + }) + }) + ] }); +} +//#endregion +export { RoomPage as default }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/RoomsView-qN1A3y9X.js b/docker/web/nspanelmanager/web/react-components/dist/RoomsView-qN1A3y9X.js new file mode 100644 index 000000000..d0c9fb41c --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/RoomsView-qN1A3y9X.js @@ -0,0 +1,563 @@ +import { c as __toESM, r as require_react, t as require_jsx_runtime } from "./main-FKp56mKw.js"; +import { r as DragDropProvider, t as useSortable } from "./sortable-Ke3drO00.js"; +import { n as FormProvider, s as useForm } from "./index.esm-CnTf2rLv.js"; +import { n as Notify } from "./NSPanelToastContainer-D677tDZJ.js"; +import { t as motion } from "./proxy-BQYsYRjY.js"; +import { n as useMotionTemplate, r as useMotionValue, t as useSpring } from "./use-spring-BsypnnSW.js"; +import { t as useEntityStatesStore } from "./EntityStore-CHE3-bsC.js"; +import { o as mdiMenu, x as require_Icon } from "./mdi-Cr6PIsRR.js"; +import { i as api, t as Alert } from "./layout-HS0oHCMJ.js"; +import { a as TextInput } from "./fields-Dr1KI0Cj.js"; +//#region src/components/RoomsPage/RoomBox.tsx +var import_react = /* @__PURE__ */ __toESM(require_react(), 1); +var import_Icon = require_Icon(); +var import_jsx_runtime = require_jsx_runtime(); +var NSPanelBox = ({ nspanel }) => { + const state = nspanel.state; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "badge badge-md bg-base-300", + children: [(() => { + if (state == "online") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "indicator-item status status-success" }); + else if (state == "offline") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "indicator-item status status-error" }); + else if (state == "rebooting") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "indicator-item status status-info animate-pulse" }); + else if (state == "waiting") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "indicator-item status status-info animate-pulse" }); + else if (state == "updating_fw" || state == "updating_fs" || state == "updating_tft") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "indicator-item status status-info animate-pulse" }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "indicator-item status status-error animate-ping", + children: ["Unknown state: ", state] + }); + })(), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { + href: `/nspanel/${nspanel.id}`, + children: nspanel.name + })] + }); +}; +var StatusHeader = ({ room }) => { + const { nspanels, status, fetchData } = useEntityStatesStore(); + (0, import_react.useEffect)(() => { + if (status === "none") fetchData(); + }, [status, fetchData]); + const room_nspanels = []; + let any_panel_online = false; + Object.values(nspanels).forEach((nspanel) => { + if (nspanel.default_room_id == room.id) { + room_nspanels.push(nspanel); + if (nspanel.state == "online" || nspanel.state == "rebooting" || nspanel.state == "updating_fs" || nspanel.state == "updating_fw" || nspanel.state == "updating_tft") any_panel_online = true; + } + }); + if (any_panel_online) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "min-h-1 overflow-hidden w-full transition-all ease-linear duration-300 bg-success rounded-t-field", + id: "panel_header-${id}" + }); + else if (room_nspanels.length > 0 && !any_panel_online) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "min-h-1 overflow-hidden w-full transition-all ease-linear duration-300 bg-error rounded-t-field", + id: "panel_header-${id}" + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "min-h-1 overflow-hidden w-full transition-all ease-linear duration-300 bg-base-100 rounded-t-field", + id: "panel_header-${id}" + }); +}; +var RoomBoxContent = ({ room, setHandle }) => { + const boxRef = (0, import_react.useRef)(null); + const mouseX = useMotionValue(0); + const mouseY = useMotionValue(0); + const springX = useSpring(mouseX, { + stiffness: 300, + damping: 30 + }); + const springY = useSpring(mouseY, { + stiffness: 300, + damping: 30 + }); + const clipPath = useMotionTemplate`radial-gradient(circle at ${springX}px ${springY}px, black 0%, black 15%, transparent 50%)`; + (0, import_react.useEffect)(() => { + const handleMouseMove = (e) => { + const boundingRect = boxRef.current?.getBoundingClientRect(); + if (!boundingRect) return; + mouseX.set(e.clientX - boundingRect.left); + mouseY.set(e.clientY - boundingRect.top); + }; + window.addEventListener("mousemove", handleMouseMove); + return () => { + window.removeEventListener("mousemove", handleMouseMove); + }; + }, [mouseX, mouseY]); + const { nspanels, status, fetchData } = useEntityStatesStore(); + (0, import_react.useEffect)(() => { + if (status === "none") fetchData(); + }, [status, fetchData]); + const room_nspanels = []; + let number_panels_online = 0; + let bg_class = "bg-base-100"; + Object.values(nspanels).forEach((nspanel) => { + if (nspanel.default_room_id == room.id) { + room_nspanels.push(nspanel); + if (nspanel.state == "online" || nspanel.state == "rebooting" || nspanel.state == "updating_fs" || nspanel.state == "updating_fw" || nspanel.state == "updating_tft") number_panels_online++; + } + }); + if (room_nspanels.length > 0 && number_panels_online > 0) bg_class = "bg-success"; + else if (room_nspanels.length > 0 && number_panels_online <= 0) bg_class = "bg-error"; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "relative h-full group/box", + ref: boxRef, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(motion.div, { + style: { + WebkitMaskImage: clipPath, + maskImage: clipPath, + pointerEvents: "none" + }, + className: "absolute tile-background w-full h-full group overflow-hidden mb-1 opacity-0 group-hover/box:opacity-5", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "grid grid-cols-8 w-full h-full inset-0", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-2s] tile-1 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-6s] tile-2 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-4s] tile-3 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-8s] tile-4 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-4s] tile-1 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-2s] tile-2 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-8s] tile-3 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-2s] tile-4 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-4s] tile-1 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-8s] tile-2 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-6s] tile-3 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-4s] tile-4 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-8s] tile-1 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-6s] tile-2 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-2s] tile-3 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-4s] tile-4 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full col-span-4 ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-6s] tile-1 group/box:opacity-50` }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-full h-full col-span-4 ${bg_class} [animation-name:tile-background] [animation-duration:8s] [animation-iteration-count:infinite] opacity-0 [animation-delay:-2s] tile-2 group/box:opacity-50` }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-1/8 top-0 w-px h-full bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-2/8 top-0 w-px h-full bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-3/8 top-0 w-px h-full bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-4/8 top-0 w-px h-full bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-5/8 top-0 w-px h-full bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-6/8 top-0 w-px h-full bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-7/8 top-0 w-px h-full bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-8/8 top-0 w-px h-full bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-0 top-1/3 w-full h-px bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-0 top-2/3 w-full h-px bg-base-content" }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-0 top-3/3 w-full h-px bg-base-content" }) + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "p-2 h-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex justify-between mx-auto", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + ref: setHandle, + className: "flex", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiMenu, + className: "w-5 h-5 inline-block me-1 cursor-grab" + }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { + href: `/rooms/${room.id}`, + className: "font-medium text-lg flex items-center", + children: room.friendly_name + })] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex items-center justify-end", + children: (() => { + if (room_nspanels.length <= 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "flex items-end justify-end text-right italic font-light text-sm", + children: "No panels" + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "flex items-end justify-end text-right italic font-light text-xs", + children: [ + number_panels_online, + " of ", + room_nspanels.length, + " online" + ] + }); + })() + })] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex flex-wrap gap-1 mt-2", + children: room_nspanels.map((nspanel) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelBox, { nspanel })) + })] + })] + }) }); +}; +var RoomBox = ({ room, index }) => { + const id = room.id; + const [handle, setHandle] = (0, import_react.useState)(null); + const { ref } = useSortable({ + id, + index, + data: { + type: "room", + room + }, + handle, + disabled: false + }); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { + ref, + className: "text-base-content rounded-b-box rounded-t-field nspanel-box bg-base-200 hover:bg-base-100 transition-all duration-200 shadow-xl shadow-neutral/3 hover:shadow-neutral/10 overflow-visible h-34", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "overflow-hidden", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusHeader, { room }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RoomBoxContent, { + room, + setHandle + })] + }); +}; +//#endregion +//#region node_modules/@dnd-kit/helpers/dist/index.js +var __defProp = Object.defineProperty; +var __defProps = Object.defineProperties; +var __getOwnPropDescs = Object.getOwnPropertyDescriptors; +var __getOwnPropSymbols = Object.getOwnPropertySymbols; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __propIsEnum = Object.prototype.propertyIsEnumerable; +var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { + enumerable: true, + configurable: true, + writable: true, + value +}) : obj[key] = value; +var __spreadValues = (a, b) => { + for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); + if (__getOwnPropSymbols) { + for (var prop of __getOwnPropSymbols(b)) if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); + } + return a; +}; +var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); +function arrayMove(array, from, to) { + if (from === to) return array; + const newArray = array.slice(); + newArray.splice(to, 0, newArray.splice(from, 1)[0]); + return newArray; +} +function hasSortableIndices(source) { + return "initialIndex" in source && typeof source.initialIndex === "number" && "index" in source && typeof source.index === "number"; +} +function mutate(items, event, mutation) { + var _a, _b, _c; + const { source, target, canceled } = event.operation; + if (!source || !target || canceled) { + if ("preventDefault" in event) event.preventDefault(); + return items; + } + const findIndex = (item, id) => item === id || typeof item === "object" && "id" in item && item.id === id; + if (Array.isArray(items)) { + const sourceIndex2 = items.findIndex((item) => findIndex(item, source.id)); + const targetIndex2 = items.findIndex((item) => findIndex(item, target.id)); + if (sourceIndex2 === -1 || targetIndex2 === -1) { + if (hasSortableIndices(source)) { + const from = source.initialIndex; + const to = source.index; + if (from === to || from < 0 || from >= items.length) { + if ("preventDefault" in event) event.preventDefault(); + return items; + } + return mutation(items, from, to); + } + return items; + } + if (!canceled && "index" in source && typeof source.index === "number") { + const projectedSourceIndex = source.index; + if (projectedSourceIndex !== sourceIndex2) return mutation(items, sourceIndex2, projectedSourceIndex); + } + return mutation(items, sourceIndex2, targetIndex2); + } + const entries = Object.entries(items); + let sourceIndex = -1; + let sourceParent; + let targetIndex = -1; + let targetParent; + for (const [id, children] of entries) { + if (sourceIndex === -1) { + sourceIndex = children.findIndex((item) => findIndex(item, source.id)); + if (sourceIndex !== -1) sourceParent = id; + } + if (targetIndex === -1) { + targetIndex = children.findIndex((item) => findIndex(item, target.id)); + if (targetIndex !== -1) targetParent = id; + } + if (sourceIndex !== -1 && targetIndex !== -1) break; + } + if (sourceIndex === -1 && hasSortableIndices(source)) { + const srcParent = source.initialGroup; + const srcIndex = source.initialIndex; + const tgtParent = source.group; + const tgtIndex = source.index; + if (srcParent == null || tgtParent == null || !(srcParent in items) || !(tgtParent in items)) { + if ("preventDefault" in event) event.preventDefault(); + return items; + } + if (srcParent === tgtParent && srcIndex === tgtIndex) { + if ("preventDefault" in event) event.preventDefault(); + return items; + } + if (srcParent === tgtParent) return __spreadProps(__spreadValues({}, items), { [srcParent]: mutation(items[srcParent], srcIndex, tgtIndex) }); + const sourceItem2 = items[srcParent][srcIndex]; + return __spreadProps(__spreadValues({}, items), { + [srcParent]: [...items[srcParent].slice(0, srcIndex), ...items[srcParent].slice(srcIndex + 1)], + [tgtParent]: [ + ...items[tgtParent].slice(0, tgtIndex), + sourceItem2, + ...items[tgtParent].slice(tgtIndex) + ] + }); + } + if (!source.manager) return items; + const { dragOperation } = source.manager; + const position = (_b = (_a = dragOperation.shape) == null ? void 0 : _a.current.center) != null ? _b : dragOperation.position.current; + if (targetParent == null) { + if (target.id in items) { + const insertionIndex = target.shape && position.y > target.shape.center.y ? items[target.id].length : 0; + targetParent = target.id; + targetIndex = insertionIndex; + } + } + if (sourceParent == null || targetParent == null || sourceParent === targetParent && sourceIndex === targetIndex) { + if (sourceParent != null && sourceParent === targetParent && sourceIndex === targetIndex && hasSortableIndices(source)) { + const hasGroupChanged = source.group != null && source.group !== sourceParent; + const hasIndexChanged = source.index !== sourceIndex; + if (hasGroupChanged || hasIndexChanged) { + const reconciledTargetParent = (_c = source.group) != null ? _c : sourceParent; + if (reconciledTargetParent in items) { + if (sourceParent === reconciledTargetParent) return __spreadProps(__spreadValues({}, items), { [sourceParent]: mutation(items[sourceParent], sourceIndex, source.index) }); + const sourceItem2 = items[sourceParent][sourceIndex]; + return __spreadProps(__spreadValues({}, items), { + [sourceParent]: [...items[sourceParent].slice(0, sourceIndex), ...items[sourceParent].slice(sourceIndex + 1)], + [reconciledTargetParent]: [ + ...items[reconciledTargetParent].slice(0, source.index), + sourceItem2, + ...items[reconciledTargetParent].slice(source.index) + ] + }); + } + } + } + if ("preventDefault" in event) event.preventDefault(); + return items; + } + if (sourceParent === targetParent) return __spreadProps(__spreadValues({}, items), { [sourceParent]: mutation(items[sourceParent], sourceIndex, targetIndex) }); + const modifier = target.shape && Math.round(position.y) > Math.round(target.shape.center.y) ? 1 : 0; + const sourceItem = items[sourceParent][sourceIndex]; + return __spreadProps(__spreadValues({}, items), { + [sourceParent]: [...items[sourceParent].slice(0, sourceIndex), ...items[sourceParent].slice(sourceIndex + 1)], + [targetParent]: [ + ...items[targetParent].slice(0, targetIndex + modifier), + sourceItem, + ...items[targetParent].slice(targetIndex + modifier) + ] + }); +} +function move(items, event) { + return mutate(items, event, arrayMove); +} +//#endregion +//#region src/components/RoomsPage/NewRoomDialog.tsx +var NewRoomDialog = ({ dialogRef, onCreated }) => { + const [errorMessage, setErrorMessage] = (0, import_react.useState)(null); + const form = useForm({ defaultValues: { friendly_name: "" } }); + const { handleSubmit, reset: formReset, formState: { isSubmitting } } = form; + const reset = () => { + setErrorMessage(null); + formReset(); + }; + const onSubmit = async (values) => { + setErrorMessage(null); + try { + const { data, error, response } = await api.POST("/rest/v2/rooms", { body: { friendly_name: values.friendly_name.trim() } }); + if (data) { + dialogRef.current?.close(); + Notify({ + message: `Room "${data.friendly_name}" created`, + level: "success", + duration: 3e3 + }); + onCreated(); + return; + } + console.log("Failed to create room, error: ", error); + setErrorMessage(`Failed to create room (HTTP ${response.status})`); + } catch (failure) { + setErrorMessage(failure instanceof Error ? failure.message : String(failure)); + } + }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("dialog", { + ref: dialogRef, + className: "modal", + onClose: reset, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "modal-box", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { + className: "text-lg font-bold", + children: "New room" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormProvider, { + ...form, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { + onSubmit: (event) => void handleSubmit(onSubmit)(event), + noValidate: true, + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextInput, { + name: "friendly_name", + label: "Name" + }), + errorMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Alert, { + level: "error", + children: errorMessage + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "modal-action", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn", + disabled: isSubmitting, + onClick: () => dialogRef.current?.close(), + children: "Cancel" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { + type: "submit", + className: "btn btn-info", + disabled: isSubmitting, + children: [isSubmitting && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "loading loading-spinner loading-xs" }), "Create"] + })] + }) + ] + }) + })] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { + method: "dialog", + className: "modal-backdrop", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { children: "close" }) + })] + }); +}; +//#endregion +//#region src/components/RoomsPage/RoomsView.tsx +var RoomsView = () => { + const [state, setState] = (0, import_react.useState)({ status: "loading" }); + const { status: entityStatesStatus, fetchData } = useEntityStatesStore(); + const newRoomDialogRef = (0, import_react.useRef)(null); + const fetchSettings = (0, import_react.useCallback)(() => { + api.GET("/rest/v2/rooms").then(({ data, response }) => setState(data ? { + status: "loaded", + rooms: data + } : { + status: "error", + message: `HTTP ${response.status}` + })).catch((error) => setState({ + status: "error", + message: error instanceof Error ? error.message : String(error) + })); + }, []); + (0, import_react.useEffect)(() => { + if (entityStatesStatus === "none") fetchData(); + }, [entityStatesStatus, fetchData]); + (0, import_react.useEffect)(fetchSettings, [fetchSettings]); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NewRoomDialog, { + dialogRef: newRoomDialogRef, + onCreated: fetchSettings + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center justify-between", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center justify-start gap-1", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-2xl", + children: "Rooms" + }), (() => { + if (entityStatesStatus != "loaded") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "loading loading-spinner loading-sm mr-2" }); + return null; + })()] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + className: "btn btn-info font-medium", + onClick: () => newRoomDialogRef.current?.showModal(), + children: "New room" + }) })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: (() => { + if (state.status != "loaded") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex w-full items-center justify-center text-2xl", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "loading loading-spinner loading-sm mr-2" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "font-medium", + children: "Loading rooms..." + })] + }); + if (state.status == "loaded" && state.rooms.length > 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DragDropProvider, { + onDragStart: (event) => { + console.log("Drag start: ", event); + }, + onDragEnd: (event) => { + if (event.canceled) return; + const previousState = state; + const reordered = move(state.rooms, event).map((room, index) => ({ + ...room, + displayOrder: index + })); + api.PATCH("/rest/v2/rooms", { body: { rooms: reordered.map((room, index) => ({ + id: room.id, + displayOrder: index + 1 + })) } }).then(({ data, error, response }) => { + if (data) { + setState({ + status: "loaded", + rooms: data + }); + return; + } + setState(previousState); + console.error("Failed to save room", error); + Notify({ + message: `Failed to save room order (HTTP ${response.status})`, + level: "error", + duration: 5e3 + }); + }).catch((error) => { + setState(previousState); + Notify({ + message: error instanceof Error ? error.message : String(error), + level: "error", + duration: 5e3 + }); + }); + }, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { + className: "grid md:grid-cols-3 gap-4 mt-4 items-stretch", + id: "rooms_container", + children: state.rooms.map((room, index) => { + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RoomBox, { + room, + index + }, `room-id-${room.id}`); + }) + }) + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "grid md:grid-cols-3 gap-4 mt-4 items-start", + id: "rooms_container", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "col-span-3 w-full text-center text-xl text-base-content", + children: [ + "No Rooms found. Getting started?", + " ", + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { + href: "https://nspanelmanager.com/docs/getting-started/flash-nspanel", + target: "_blank", + className: "text-accent", + children: "Read the documentation." + }) + ] + }) + }); + })() }) + ] }); +}; +//#endregion +export { RoomsView as default }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/SettingsPage-CzrUBqYz.js b/docker/web/nspanelmanager/web/react-components/dist/SettingsPage-CzrUBqYz.js new file mode 100644 index 000000000..b94b6cb76 --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/SettingsPage-CzrUBqYz.js @@ -0,0 +1,1111 @@ +import { c as __toESM, r as require_react, t as require_jsx_runtime } from "./main-FKp56mKw.js"; +import { c as useFormContext, i as get, l as useWatch, n as FormProvider, s as useForm } from "./index.esm-CnTf2rLv.js"; +import { n as Notify } from "./NSPanelToastContainer-D677tDZJ.js"; +import { a as getCookie, i as api, n as Card, r as Row, t as Alert } from "./layout-HS0oHCMJ.js"; +import { a as TextInput$1, i as Select$1, n as RadioGroup$1, r as SecretInput$1, t as NumberInput$1 } from "./fields-Dr1KI0Cj.js"; +//#region src/api/connectionTests.ts +var import_react = /* @__PURE__ */ __toESM(require_react(), 1); +async function errorMessage(response) { + try { + const data = await response.json(); + return data.message || data.error || `HTTP ${response.status}`; + } catch { + return `HTTP ${response.status}`; + } +} +async function runTest(url, params) { + try { + const response = await fetch(`${url}?${new URLSearchParams(params).toString()}`, { + method: "GET", + credentials: "same-origin" + }); + return response.ok ? null : await errorMessage(response); + } catch (error) { + return error instanceof Error ? error.message : String(error); + } +} +/** The manager's IP address for a hostname, as the server resolves it. */ +async function getIpByHostname(hostname) { + const response = await fetch("/rest/get_ip_by_hostname", { + method: "POST", + credentials: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + }, + body: JSON.stringify({ hostname }) + }); + if (!response.ok) throw new Error(await errorMessage(response)); + const data = await response.json(); + if (!data.ip) throw new Error("No \"ip\" in the response."); + return data.ip; +} +function testManager(address, port) { + return runTest("/rest/mqttmanager/test", { + address, + port: String(port) + }); +} +function testHomeAssistant(address, token) { + return runTest("/rest/home_assistant/test", { + address, + token + }); +} +function testOpenhab(address, token) { + return runTest("/rest/openhab/test", { + address, + token + }); +} +var MAX_TOTAL_DURATION_MS = 3e4; +var ARTICULATION_GAP_MS = 10; +var OCTAVE8_FREQUENCIES = [ + 66976, + 70959, + 75178, + 79649, + 84385, + 89402, + 94719, + 100351, + 106318, + 112640, + 119338, + 126434 +]; +var SEMITONES = { + c: 0, + d: 2, + e: 4, + f: 5, + g: 7, + a: 9, + b: 11, + h: 11, + p: -1 +}; +var VALID_DURATIONS = [ + 1, + 2, + 4, + 8, + 16, + 32, + 64 +]; +var WHITESPACE = " \n\v\f\r"; +var isDigit = (c) => c !== void 0 && c >= "0" && c <= "9"; +var RtttlError = class extends Error { + tooLong; + constructor(message, tooLong = false) { + super(message); + this.tooLong = tooLong; + } +}; +/** Parse an RTTTL string, ie. "tick:d=64,o=7,b=625:b", the way the panel does. */ +function parseRtttl(rtttl) { + try { + const steps = parse$1(rtttl); + return { + ok: true, + steps, + durationMs: steps.reduce((total, [, ms]) => total + ms, 0) + }; + } catch (error) { + if (error instanceof RtttlError) return { + ok: false, + error: error.message, + tooLong: error.tooLong + }; + throw error; + } +} +function parse$1(rtttl) { + let text = ""; + for (const c of rtttl) if (!WHITESPACE.includes(c)) text += c >= "A" && c <= "Z" ? c.toLowerCase() : c; + const sections = text.split(":"); + if (sections.length !== 3) throw new RtttlError("Expected name:defaults:notes, for example tick:d=64,o=7,b=625:b."); + const [, defaults, notes] = sections; + const [duration, octave, bpm] = parseDefaults(defaults); + const steps = []; + let totalDurationMs = 0; + const noteTexts = notes.split(","); + for (let index = 0; index < noteTexts.length; index++) { + const note = noteTexts[index]; + if (note === "" && index === noteTexts.length - 1 && steps.length > 0) break; + const step = parseNote(note, duration, octave, bpm, index + 1); + const last = steps[steps.length - 1]; + if (last && step[0] > 0 && last[0] === step[0] && last[1] > 20) { + last[1] -= ARTICULATION_GAP_MS; + steps.push([0, ARTICULATION_GAP_MS]); + } + steps.push(step); + totalDurationMs += step[1]; + if (steps.length > 256) throw new RtttlError(`Too many notes: the panel plays at most 256 steps.`, true); + if (totalDurationMs > 3e4) throw new RtttlError(`Too long: the panel plays at most ${MAX_TOTAL_DURATION_MS / 1e3} seconds.`, true); + } + return steps; +} +function parseDefaults(section) { + let [duration, octave, bpm] = [ + 4, + 6, + 63 + ]; + const malformed = () => new RtttlError("Defaults must look like d=4,o=6,b=63."); + let pos = 0; + while (pos < section.length) { + if (pos + 2 > section.length || section[pos + 1] !== "=") throw malformed(); + const key = section[pos]; + pos += 2; + const [next, value] = parseNumber(section, pos, 999); + if (value === null) throw malformed(); + pos = next; + if (key === "d" && VALID_DURATIONS.includes(value)) duration = value; + else if (key === "o" && value >= 1 && value <= 8) octave = value; + else if (key === "b" && value >= 1 && value <= 900) bpm = value; + else if (key === "d") throw new RtttlError("d must be 1, 2, 4, 8, 16, 32 or 64."); + else if (key === "o") throw new RtttlError("o must be 1 to 8."); + else if (key === "b") throw new RtttlError("b must be 1 to 900."); + else throw new RtttlError(`Unknown default '${key}': only d, o and b are allowed.`); + if (pos < section.length) { + if (section[pos] !== ",") throw malformed(); + pos++; + } + } + return [ + duration, + octave, + bpm + ]; +} +function parseNote(note, defaultDuration, defaultOctave, bpm, position) { + const invalid = () => new RtttlError(`Note ${position} ('${note}') is not valid.`); + let pos = 0; + let duration = defaultDuration; + if (isDigit(note[pos])) { + const [next, value] = parseNumber(note, pos, 64); + if (value === null || !VALID_DURATIONS.includes(value)) throw invalid(); + [pos, duration] = [next, value]; + } + if (pos >= note.length || !Object.hasOwn(SEMITONES, note[pos])) throw invalid(); + let semitone = SEMITONES[note[pos]]; + pos++; + if (note[pos] === "#") { + if (semitone < 0) throw invalid(); + semitone++; + pos++; + } + let dotted = false; + if (note[pos] === ".") { + dotted = true; + pos++; + } + let octave = defaultOctave; + if (isDigit(note[pos])) { + octave = Number(note[pos]); + if (octave < 1 || octave > 8) throw invalid(); + pos++; + } + if (!dotted && note[pos] === ".") { + dotted = true; + pos++; + } + if (pos !== note.length) throw invalid(); + const numerator = 24e4 * (dotted ? 3 : 2); + const denominator = bpm * duration * 2; + const durationMs = Math.floor((numerator + Math.floor(denominator / 2)) / denominator); + if (semitone < 0) return [0, durationMs]; + if (semitone === 12) { + semitone = 0; + octave++; + } + const shift = 12 - octave; + return [OCTAVE8_FREQUENCIES[semitone] + (1 << shift - 1) >> shift, durationMs]; +} +/** Read the digits at pos: [new pos, value], value null if there were none or it exceeds maxValue. */ +function parseNumber(text, pos, maxValue) { + const start = pos; + let value = 0; + while (isDigit(text[pos])) { + value = value * 10 + Number(text[pos]); + if (value > maxValue) return [pos, null]; + pos++; + } + return pos === start ? [pos, null] : [pos, value]; +} +//#endregion +//#region src/lib/rtttlPlayer.ts +var VOLUME = .15; +var RAMP_S = .001; +var PIEZO_RESONANCE_HZ = 4e3; +var PIEZO_Q = 2.5; +var PIEZO_MAKEUP_GAIN = 2; +var START_DELAY_S = .02; +var sharedContext = null; +function isAudioSupported() { + return typeof window !== "undefined" && typeof window.AudioContext === "function"; +} +function audioContext() { + sharedContext ??= new AudioContext(); + if (sharedContext.state === "suspended") sharedContext.resume(); + return sharedContext; +} +/** Play the steps; done resolves when they finish or stop() is called. */ +function playSteps(steps, { piezo }) { + const context = audioContext(); + const oscillator = context.createOscillator(); + oscillator.type = "square"; + const gain = context.createGain(); + gain.gain.value = 0; + const nodes = [oscillator, gain]; + if (piezo) { + const filter = context.createBiquadFilter(); + filter.type = "bandpass"; + filter.frequency.value = PIEZO_RESONANCE_HZ; + filter.Q.value = PIEZO_Q; + oscillator.connect(filter).connect(gain); + nodes.push(filter); + } else oscillator.connect(gain); + gain.connect(context.destination); + const volume = VOLUME * (piezo ? PIEZO_MAKEUP_GAIN : 1); + const start = context.currentTime + START_DELAY_S; + let time = start; + for (const [frequency, ms] of steps) { + const seconds = ms / 1e3; + if (frequency > 0) { + const ramp = Math.min(RAMP_S, seconds / 2); + oscillator.frequency.setValueAtTime(frequency, time); + gain.gain.setValueAtTime(0, time); + gain.gain.linearRampToValueAtTime(volume, time + ramp); + gain.gain.setValueAtTime(volume, time + seconds - ramp); + gain.gain.linearRampToValueAtTime(0, time + seconds); + } + time += seconds; + } + const done = new Promise((resolve) => { + oscillator.onended = () => { + nodes.forEach((node) => node.disconnect()); + resolve(); + }; + }); + oscillator.start(start); + oscillator.stop(time); + return { + stop: () => { + try { + oscillator.stop(); + } catch {} + }, + done + }; +} +/** +* One preview at a time for a page: starting one stops the one playing. playing is the key of the +* preview playing, so its button can show a stop symbol. +*/ +function useRtttlPlayer() { + const [playing, setPlaying] = (0, import_react.useState)(null); + const current = (0, import_react.useRef)(null); + const stop = (0, import_react.useCallback)(() => { + current.current?.playback.stop(); + current.current = null; + setPlaying(null); + }, []); + const play = (0, import_react.useCallback)((key, steps, options) => { + stop(); + const playback = playSteps(steps, options); + const entry = { + key, + playback + }; + current.current = entry; + setPlaying(key); + playback.done.then(() => { + if (current.current === entry) { + current.current = null; + setPlaying(null); + } + }); + }, [stop]); + (0, import_react.useEffect)(() => () => current.current?.playback.stop(), []); + return { + playing, + play, + stop + }; +} +//#endregion +//#region src/components/SettingsPage/buzzer.ts +var PRESETS = { + tick: { + id: "tick", + name: "Tick", + rtttl: "tick:d=64,o=7,b=625:b" + }, + pip: { + id: "pip", + name: "Pip", + rtttl: "pip:d=64,o=7,b=900:c" + }, + midTick: { + id: "midTick", + name: "Mid tick", + rtttl: "mtick:d=64,o=6,b=625:g" + }, + tuk: { + id: "tuk", + name: "Tuk", + rtttl: "tuk:d=64,o=6,b=900:e,c" + }, + tock: { + id: "tock", + name: "Tock", + rtttl: "tock:d=64,o=5,b=900:a" + }, + chime: { + id: "chime", + name: "Chime", + rtttl: "chime:d=32,o=6,b=190:g6,16p,32c7" + }, + confirm: { + id: "confirm", + name: "Confirm", + rtttl: "confirm:d=16,o=6,b=357:e,g" + }, + rising: { + id: "rising", + name: "Rising", + rtttl: "rising:d=16,o=6,b=180:c,e,g" + }, + saved: { + id: "saved", + name: "Saved", + rtttl: "saved:d=16,o=6,b=200:c,e,g,8c7" + }, + silent: { + id: "silent", + name: "Silent", + rtttl: "silent:d=64,o=6,b=900:p" + } +}; +var BUZZER_EVENTS = [ + { + name: "buzzer_sound_touch", + label: "Screen touch", + blankLabel: "Off", + hint: "Played on every press of the screen.", + presets: [ + PRESETS.tick, + PRESETS.pip, + PRESETS.midTick, + PRESETS.tuk, + PRESETS.tock, + PRESETS.chime, + PRESETS.confirm, + PRESETS.rising, + PRESETS.saved + ] + }, + { + name: "buzzer_sound_scene_activated", + label: "Scene activated", + blankLabel: "Same as screen touch", + hint: "Played instead of the touch sound when a scene is activated from the panel.", + presets: [ + PRESETS.silent, + PRESETS.confirm, + PRESETS.rising, + PRESETS.chime, + PRESETS.tick, + PRESETS.pip, + PRESETS.midTick, + PRESETS.tuk, + PRESETS.tock, + PRESETS.saved + ] + }, + { + name: "buzzer_sound_scene_saved", + label: "Scene saved", + blankLabel: "Off", + hint: "Played when a scene is saved with a long press on the panel.", + presets: [ + PRESETS.saved, + PRESETS.rising, + PRESETS.confirm, + PRESETS.chime, + PRESETS.tick, + PRESETS.pip, + PRESETS.midTick, + PRESETS.tuk, + PRESETS.tock + ] + } +]; +var BLANK = "blank"; +var CUSTOM = "custom"; +/** The dropdown choice for a stored value: BLANK, CUSTOM or a preset id. */ +function choiceFor(event, rtttl) { + if (rtttl === "") return BLANK; + return event.presets.find((preset) => preset.rtttl === rtttl)?.id ?? "custom"; +} +//#endregion +//#region src/components/SettingsPage/BuzzerCard.tsx +var import_jsx_runtime = require_jsx_runtime(); +/** The buzzer sound for each panel event, with presets and a preview played in the browser. */ +function BuzzerCard() { + const player = useRtttlPlayer(); + const [piezo, setPiezo] = (0, import_react.useState)(true); + const { control } = useFormContext(); + const touch = useWatch({ + control, + name: "buzzer_sound_touch" + }) ?? ""; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, { + title: "Buzzer sounds", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { + className: "mb-2 text-sm opacity-80", + children: "Sonoff NSPanels only. Panels make no sound unless you choose one here. Each panel also has a buzzer mute switch in Home Assistant." + }), + BUZZER_EVENTS.map((event) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BuzzerSoundField, { + event, + player, + piezo, + touch + }, event.name)), + isAudioSupported() ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { + className: "label text-sm", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "checkbox", + className: "checkbox checkbox-accent checkbox-sm", + checked: piezo, + onChange: (event) => setPiezo(event.target.checked) + }), "Make the preview sound like the panel's buzzer (approximate)"] + }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { + className: "text-sm opacity-60", + children: "This browser can't play the preview." + }) + ] + }); +} +var parse = (rtttl) => rtttl === "" ? null : parseRtttl(rtttl); +function BuzzerSoundField({ event, player, piezo, touch }) { + const { name, label } = event; + const { register, setValue, setFocus, control, formState: { errors } } = useFormContext(); + const value = useWatch({ + control, + name + }) ?? ""; + const [custom, setCustom] = (0, import_react.useState)(false); + const choice = custom ? CUSTOM : choiceFor(event, value); + const parsed = parse(value); + const error = parsed && !parsed.ok ? parsed.error : get(errors, name)?.message; + const preview = value === "" && name === "buzzer_sound_scene_activated" ? parse(touch) : parsed; + const steps = preview?.ok ? preview.steps : null; + const choose = (selected) => { + setCustom(selected === CUSTOM); + if (selected === "custom") { + setFocus(name); + return; + } + const rtttl = selected === "blank" ? "" : event.presets.find((preset) => preset.id === selected)?.rtttl ?? ""; + setValue(name, rtttl, { + shouldDirty: true, + shouldValidate: true + }); + if (player.playing === name) player.stop(); + }; + const playing = player.playing === name; + const previewLabel = playing ? `Stop the ${label.toLowerCase()} preview` : `Preview the ${label.toLowerCase()} sound`; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mb-3 w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: `${name}-choice`, + className: "block mb-1 text-sm font-medium", + children: label + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex flex-wrap md:flex-nowrap gap-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { + id: `${name}-choice`, + className: "select md:w-56 shrink-0", + value: choice, + onChange: (change) => choose(change.target.value), + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { + value: BLANK, + children: event.blankLabel + }), + event.presets.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { + value: preset.id, + children: preset.name + }, preset.id)), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { + value: CUSTOM, + children: "Custom…" + }) + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "join w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + id: name, + type: "text", + "aria-label": `${label} RTTTL`, + className: "input w-full join-item font-mono", + maxLength: 255, + spellCheck: false, + autoComplete: "off", + placeholder: choice === "custom" ? "name:d=4,o=6,b=63:c,e,g" : "", + "aria-invalid": error !== void 0, + "aria-describedby": `${name}-message`, + ...register(name, { + setValueAs: (raw) => raw ?? "", + validate: (raw) => { + const result = parse(raw ?? ""); + return result === null || result.ok || result.error; + } + }) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-accent join-item", + "aria-label": previewLabel, + title: previewLabel, + disabled: !steps || !isAudioSupported(), + onClick: () => playing ? player.stop() : steps && player.play(name, steps, { piezo }), + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `mdi ${playing ? "mdi-stop" : "mdi-play"}` }) + })] + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { + id: `${name}-message`, + className: `mt-1 text-sm ${error ? "text-error" : "opacity-60"}`, + children: error ?? `${event.hint}${parsed?.ok ? ` ${describe(parsed.steps, parsed.durationMs)}` : ""}` + }) + ] + }); +} +function describe(steps, durationMs) { + return steps.every(([frequency]) => frequency === 0) ? "Silent." : `Plays for ${formatDuration(durationMs)}.`; +} +function formatDuration(ms) { + return ms < 1e3 ? `${ms} ms` : `${(ms / 1e3).toFixed(ms < 1e4 ? 2 : 1)} s`; +} +//#endregion +//#region src/components/SettingsPage/choices.ts +var LOG_LEVELS = { + error: "Error", + warning: "Warning", + info: "Info", + debug: "Debug", + trace: "Trace" +}; +var NSPANEL_TYPES = { + eu: "EU", + us: "US" +}; +var TURN_ON_BEHAVIORS = { + color_temp: "Color temperature", + restore: "Restore" +}; +var SCREENSAVER_MODES = { + with_background: "Show with background (clock, date and weather)", + without_background: "Show without background (clock, date and weather)", + datetime_with_background: "Show with background (no weather)", + datetime_without_background: "Show without background (no weather)", + no_screensaver: "No screensaver (turn off screen)" +}; +var options = (choices) => Object.entries(choices); +//#endregion +//#region src/components/common/buttons.tsx +/** A button joined to the end of an input: pass it as the input's `button`. */ +function JoinButton({ onClick, children }) { + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-info join-item", + onClick, + children + }); +} +/** Runs a connection test and reports the result as a toast. With a disabledReason it is disabled, and shows why. */ +function TestButton({ label, run, disabledReason }) { + const [running, setRunning] = (0, import_react.useState)(false); + const onClick = async () => { + setRunning(true); + const error = await run(); + setRunning(false); + if (error) Notify({ + message: `${label} failed: ${error}`, + level: "error", + duration: 8e3 + }); + else Notify({ + message: `${label}: OK.`, + level: "success", + duration: 5e3 + }); + }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mt-1", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { + type: "button", + className: "btn btn-accent btn-sm", + onClick, + disabled: running || disabledReason !== void 0, + children: [running && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "loading loading-spinner loading-sm" }), label] + }), disabledReason && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { + className: "mt-1 text-sm opacity-60", + children: disabledReason + })] + }); +} +//#endregion +//#region src/components/common/typedFields.ts +/** The inputs in ./fields with their field names checked against the form T. Call it once, at module level. */ +function typedFields() { + return { + TextInput: TextInput$1, + NumberInput: NumberInput$1, + Select: Select$1, + RadioGroup: RadioGroup$1, + SecretInput: SecretInput$1 + }; +} +//#endregion +//#region src/components/SettingsPage/form.ts +var PAGE_FIELDS = [ + "manager_address", + "manager_port", + "mqttmanager_log_level", + "max_live_log_messages", + "max_log_buffer_size", + "default_nspanel_type", + "color_temp_min", + "color_temp_max", + "reverse_color_temp", + "turn_on_behavior", + "raise_to_100_light_level", + "min_button_push_time", + "button_long_press_time", + "special_mode_trigger_time", + "special_mode_release_time", + "screen_dim_level", + "screensaver_dim_level", + "screensaver_activation_timeout", + "screensaver_mode", + "show_screensaver_inside_temperature", + "show_screensaver_outside_temperature", + "optimistic_mode", + "room_status_backoff_time", + "all_rooms_status_backoff_time", + "light_turn_on_brightness", + "mqtt_server", + "mqtt_port", + "mqtt_username", + "home_assistant_address", + "openhab_address", + "buzzer_sound_touch", + "buzzer_sound_scene_activated", + "buzzer_sound_scene_saved" +]; +var SECRETS = [ + "mqtt_password", + "home_assistant_token", + "openhab_token" +]; +var ADDON_MANAGED = ["home_assistant_address", "home_assistant_token"]; +var MODES_WITH_OUTSIDE_TEMPERATURE = ["datetime_with_background", "datetime_without_background"]; +function toFormValues(settings) { + const values = {}; + for (const name of PAGE_FIELDS) values[name] = settings[name]; + for (const secret of SECRETS) { + values[secret] = ""; + values[`clear_${secret}`] = false; + } + return values; +} +/** +* The PATCH body for a submitted form: only the settings that changed. Secrets are sent when a new +* value is typed, or as "" when "clear" is ticked. Add-on managed settings are never sent in the add-on. +*/ +function buildPatch(values, dirty, isHomeAssistantAddon) { + const body = {}; + const allowed = (name) => !(isHomeAssistantAddon && ADDON_MANAGED.includes(name)); + for (const name of PAGE_FIELDS) if (dirty[name] && allowed(name)) body[name] = values[name]; + for (const secret of SECRETS) { + if (!allowed(secret)) continue; + if (values[`clear_${secret}`]) body[secret] = ""; + else if (values[secret]) body[secret] = values[secret]; + } + return body; +} +//#endregion +//#region src/components/SettingsPage/SettingsPage.tsx +var { NumberInput, RadioGroup, SecretInput, Select, TextInput } = typedFields(); +/** The global settings page (/settings), backed by /rest/v2/settings. */ +function SettingsPage({ logDownloadUrl = "/download_mqttmanager_log" }) { + const [state, setState] = (0, import_react.useState)({ status: "loading" }); + const fetchSettings = (0, import_react.useCallback)(() => { + api.GET("/rest/v2/settings").then(({ data, response }) => setState(data ? { + status: "loaded", + settings: data + } : { + status: "error", + message: `HTTP ${response.status}` + })).catch((error) => setState({ + status: "error", + message: error instanceof Error ? error.message : String(error) + })); + }, []); + (0, import_react.useEffect)(fetchSettings, [fetchSettings]); + const retry = () => { + setState({ status: "loading" }); + fetchSettings(); + }; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center justify-between mb-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { + className: "font-medium text-2xl", + children: "Settings" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { + href: "https://nspanelmanager.com/docs/web-interface/#global-settings", + target: "_blank", + rel: "noreferrer", + className: "btn btn-outline btn-info", + children: "Help" + })] + }), + state.status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "loading loading-spinner", + "aria-label": "Loading settings" + }), + state.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Alert, { + level: "error", + children: ["Couldn't load the settings: ", state.message] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn", + onClick: retry, + children: "Retry" + })] }), + state.status === "loaded" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SettingsForm, { + settings: state.settings, + logDownloadUrl + }) + ] }); +} +function SettingsForm({ settings: loaded, logDownloadUrl }) { + const [settings, setSettings] = (0, import_react.useState)(loaded); + const form = useForm({ defaultValues: toFormValues(loaded) }); + const { handleSubmit, reset, setError, setValue, getValues, control, formState: { isDirty, isSubmitting, dirtyFields } } = form; + const addon = settings.is_home_assistant_addon; + const onSubmit = async (values) => { + const body = buildPatch(values, dirtyFields, addon); + if (Object.keys(body).length === 0) { + reset(values); + return; + } + try { + const { data, error, response } = await api.PATCH("/rest/v2/settings", { body }); + if (data) { + setSettings(data); + reset(toFormValues(data)); + Notify({ + message: "Settings saved. Reboot the panels for panel settings to take effect.", + level: "success", + duration: 5e3 + }); + return; + } + if (response.status === 400 && error && !("detail" in error && error.detail)) { + const unplaced = applyFieldErrors(error, values, setError); + Notify({ + message: `Nothing was saved. ${unplaced.length ? unplaced.join(" ") : "Fix the highlighted settings."}`, + level: "error", + duration: 8e3 + }); + } else { + const detail = error && "detail" in error ? error.detail : `HTTP ${response.status}`; + Notify({ + message: `Couldn't save the settings: ${detail}`, + level: "error" + }); + } + } catch (failure) { + Notify({ + message: `Couldn't save the settings: ${failure instanceof Error ? failure.message : String(failure)}`, + level: "error" + }); + } + }; + const loadAddressFromUrl = async () => { + try { + setValue("manager_address", await getIpByHostname(window.location.hostname), { shouldDirty: true }); + } catch (error) { + Notify({ + message: `Couldn't get the manager's IP address from ${window.location.hostname}: ${error instanceof Error ? error.message : error}`, + level: "error" + }); + } + }; + const loadPortFromUrl = () => { + const port = window.location.port || (window.location.protocol === "https:" ? "443" : "80"); + setValue("manager_port", Number(port), { shouldDirty: true }); + }; + const [screensaverMode, typedHomeAssistantToken, typedOpenhabToken] = useWatch({ + control, + name: [ + "screensaver_mode", + "home_assistant_token", + "openhab_token" + ] + }); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormProvider, { + ...form, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { + onSubmit: handleSubmit(onSubmit), + noValidate: true, + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Alert, { + level: "info", + children: "Changes to NSPanel settings on this page require a reboot of all NSPanels to take effect." + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, { + title: "NSPanel Manager", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Alert, { + level: "warning", + children: "The manager address must be an IP address only: not a hostname, and without http://." + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextInput, { + name: "manager_address", + label: "Manager address", + button: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(JoinButton, { + onClick: loadAddressFromUrl, + children: "Load from URL" + }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "manager_port", + label: "Manager port", + button: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(JoinButton, { + onClick: loadPortFromUrl, + children: "Load from URL" + }) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TestButton, { + label: "Test manager address", + run: () => testManager(getValues("manager_address") ?? "", getValues("manager_port") ?? "") + }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, { + title: "Logging", + actions: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { + href: logDownloadUrl, + title: "Download MQTTManager log", + className: "btn btn-outline btn-info", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mdi mdi-download" }), " Download"] + }), + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Select, { + name: "mqttmanager_log_level", + label: "MQTTManager log level", + options: options(LOG_LEVELS) + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Row, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "max_live_log_messages", + label: "Messages shown in the live log" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "max_log_buffer_size", + label: "Messages kept in the buffer" + })] })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, { + title: "Global NSPanel settings", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Select, { + name: "default_nspanel_type", + label: "Default NSPanel type", + options: options(NSPANEL_TYPES) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Row, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "color_temp_min", + label: "Minimum color temperature (K)" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "color_temp_max", + label: "Maximum color temperature (K)" + })] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroup, { + name: "reverse_color_temp", + label: "Color temperature slider", + options: [[false, "Keep default"], [true, "Reverse"]] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroup, { + name: "turn_on_behavior", + label: "Turn on behavior", + options: options(TURN_ON_BEHAVIORS) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Row, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "raise_to_100_light_level", + label: "Raise lights to 100% above (%)" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "light_turn_on_brightness", + label: "Default light turn on brightness (%)" + })] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Row, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "min_button_push_time", + label: "Minimum button push time (ms)" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "button_long_press_time", + label: "Minimum long press time (ms)" + })] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Row, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "special_mode_trigger_time", + label: "Special mode activation time (ms)" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "special_mode_release_time", + label: "Special mode timeout (ms)" + })] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Row, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "screen_dim_level", + label: "Screen brightness (%)" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "screensaver_dim_level", + label: "Screensaver brightness (%)" + })] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "screensaver_activation_timeout", + label: "Screensaver activation timeout (ms)" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Select, { + name: "screensaver_mode", + label: "Screensaver mode", + options: options(SCREENSAVER_MODES) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroup, { + name: "show_screensaver_inside_temperature", + label: "Screensaver inside temperature", + options: [[true, "Show inside temperature"], [false, "Hide inside temperature"]] + }), + MODES_WITH_OUTSIDE_TEMPERATURE.includes(screensaverMode ?? "") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroup, { + name: "show_screensaver_outside_temperature", + label: "Screensaver outside temperature", + options: [[true, "Show outside temperature"], [false, "Hide outside temperature"]] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroup, { + name: "optimistic_mode", + label: "Entity update mode", + options: [[true, "Optimistic"], [false, "Wait"]] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Row, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "room_status_backoff_time", + label: "Room status backoff time (ms)" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "all_rooms_status_backoff_time", + label: "\"All rooms\" status backoff time (ms)" + })] }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BuzzerCard, {}), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, { + title: "MQTT", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Row, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextInput, { + name: "mqtt_server", + label: "MQTT server" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NumberInput, { + name: "mqtt_port", + label: "MQTT port" + })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Row, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextInput, { + name: "mqtt_username", + label: "MQTT username", + hint: "Blank for anonymous login." + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SecretInput, { + name: "mqtt_password", + clearName: "clear_mqtt_password", + label: "MQTT password", + isSet: settings.mqtt_password_set + })] })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, { + title: "Home Assistant API", + children: [ + addon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Alert, { + level: "info", + children: "You are running NSPanel Manager as a Home Assistant add-on. These settings are managed by Home Assistant and are locked." + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextInput, { + name: "home_assistant_address", + label: "Home Assistant address", + hint: "For example http://homeassistant.local:8123", + disabled: addon + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SecretInput, { + name: "home_assistant_token", + clearName: "clear_home_assistant_token", + label: "Home Assistant token", + isSet: settings.home_assistant_token_set, + disabled: addon + }), + !addon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TestButton, { + label: "Test Home Assistant", + disabledReason: typedHomeAssistantToken ? void 0 : "Enter a token to test the connection. For security, the saved token is never sent back to the browser, so it can't be used here.", + run: () => testHomeAssistant(getValues("home_assistant_address") ?? "", typedHomeAssistantToken) + }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, { + title: "OpenHAB API", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextInput, { + name: "openhab_address", + label: "OpenHAB address" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SecretInput, { + name: "openhab_token", + clearName: "clear_openhab_token", + label: "OpenHAB token", + isSet: settings.openhab_token_set + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TestButton, { + label: "Test OpenHAB", + disabledReason: typedOpenhabToken ? void 0 : "Enter a token to test the connection. For security, the saved token is never sent back to the browser, so it can't be used here.", + run: () => testOpenhab(getValues("openhab_address") ?? "", typedOpenhabToken) + }) + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex justify-end gap-2 mt-4 mb-4", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + type: "button", + className: "btn btn-ghost", + disabled: !isDirty || isSubmitting, + onClick: () => reset(), + children: "Discard changes" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { + type: "submit", + className: "btn btn-success", + disabled: !isDirty || isSubmitting, + children: [isSubmitting && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "loading loading-spinner loading-sm" }), "Save"] + })] + }) + ] + }) + }); +} +function applyFieldErrors(errors, values, setError) { + const unplaced = []; + for (const [name, messages] of Object.entries(errors)) { + const message = Array.isArray(messages) ? messages.join(" ") : String(messages); + if (name in values) setError(name, { + type: "server", + message + }); + else unplaced.push(name === "non_field_errors" ? message : `${name}: ${message}`); + } + return unplaced; +} +//#endregion +export { SettingsPage as default }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/SettingsStore-msVzBcHM.js b/docker/web/nspanelmanager/web/react-components/dist/SettingsStore-msVzBcHM.js new file mode 100644 index 000000000..3a6bb5b8b --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/SettingsStore-msVzBcHM.js @@ -0,0 +1,43 @@ +import { t as create } from "./react-Cm4z11-B.js"; +//#region src/stores/SettingsStore.ts +function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; +} +var useSettingsStore = create((set) => ({ + status: "none", + settings: null, + fetchData: async () => { + set({ status: "loading" }); + fetch(`/rest/settings`, { + credentials: "same-origin", + method: "GET", + mode: "same-origin", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") + } + }).then((response) => response.json()).then((data) => { + set((state) => ({ + ...state, + settings: data.settings + })); + set((state) => ({ + ...state, + status: "loaded" + })); + }); + } +})); +//#endregion +export { useSettingsStore as t }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/Sidebar-CHcoOcQs.js b/docker/web/nspanelmanager/web/react-components/dist/Sidebar-CHcoOcQs.js new file mode 100644 index 000000000..5dc337f04 --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/Sidebar-CHcoOcQs.js @@ -0,0 +1,501 @@ +import { c as __toESM, r as require_react, t as require_jsx_runtime } from "./main-FKp56mKw.js"; +import { n as Notify } from "./NSPanelToastContainer-D677tDZJ.js"; +import { t as useStompStore } from "./StompStore-Bh-Guhla.js"; +import { t as useEntityStatesStore } from "./EntityStore-CHE3-bsC.js"; +import { _ as mdiWifiStrength2, a as mdiMemory, b as mdiWifiStrengthAlertOutline, c as mdiMinusCircle, f as mdiThermometer, g as mdiWifiStrength1Alert, h as mdiWeb, i as mdiInformationOutline, l as mdiRestart, m as mdiWaterPercent, p as mdiUpload, u as mdiTableArrowUp, v as mdiWifiStrength3, x as require_Icon, y as mdiWifiStrength4 } from "./mdi-Cr6PIsRR.js"; +//#region src/components/NSPanelPage/Sidebar.tsx +var import_react = /* @__PURE__ */ __toESM(require_react(), 1); +var import_Icon = require_Icon(); +var import_jsx_runtime = require_jsx_runtime(); +var NSPanelStatus = ({ status }) => { + if (status.state == "online") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 py-3 px-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiInformationOutline, + className: "ms-2 w-4 h-4 inline-block" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "text-base", + children: ["State: ", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-success", + children: "Online" + })] + })] + }, `nspanel-status-${status.id}`); + else if (status.state == "offline") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 py-3 px-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiInformationOutline, + className: "ms-2 w-4 h-4 inline-block" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "text-base", + children: ["State: ", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-error", + children: "Offline" + })] + })] + }, `nspanel-status-${status.id}`); + else if (status.state == "rebooting") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 py-3 px-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiInformationOutline, + className: "ms-2 w-4 h-4 inline-block" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "text-base", + children: ["State: ", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-info", + children: "Rebooting" + })] + })] + }, `nspanel-status-${status.id}`); + else if (status.state == "updating_fw") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 py-3 px-2 relative", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiInformationOutline, + className: "ms-2 w-4 h-4 inline-block" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "text-base", + children: ["State: ", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-primary", + children: "Updating firmware" + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "absolute left-0 bottom-0 w-full px-2", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "min-h-1 w-full bg-primary transition-all ease-linear duration-1000 rounded-full", + style: { width: `${status.update_progress}%` } + }) + }) + ] + }, `nspanel-status-${status.id}`); + else if (status.state == "updating_fs") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 py-3 px-2 relative", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiInformationOutline, + className: "ms-2 w-4 h-4 inline-block" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "text-base", + children: ["State: ", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-primary", + children: "Updating filesystem" + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "absolute left-0 bottom-0 w-full", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "min-h-1 bg-primary mx-2 transition-all ease-linear duration-1000 rounded-full", + style: { width: `${status.update_progress}%` } + }) + }) + ] + }, `nspanel-status-${status.id}`); + else if (status.state == "updating_tft") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 py-3 px-2 relative", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiInformationOutline, + className: "ms-2 w-4 h-4 inline-block" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "text-base", + children: ["State: ", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-primary", + children: "Updating GUI" + })] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "absolute left-0 bottom-0 w-full", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "min-h-1 bg-primary mx-2 transition-all ease-linear duration-1000 rounded-full", + style: { width: `${status.update_progress}%` } + }) + }) + ] + }, `nspanel-status-${status.id}`); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 py-3 px-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiInformationOutline, + className: "ms-2 w-4 h-4 inline-block" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "text-base", + children: ["UNKNOWN STATE! ", status.state] + })] + }, `nspanel-status-${status.id}`); +}; +var NSPanelWiFiStatus = ({ status }) => { + if (status.model != "sonoff" && status.model != "custom") return null; + if (status.state == "offline" || status.state == "unknown" || status.state == "waiting" || status.state == "rebooting") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 text-base py-3 px-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiWifiStrengthAlertOutline, + className: "ms-2 w-4 h-4 inline-block me-1" + }), "Wifi: -"] + }); + else if (status.rssi <= -80) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 text-base py-3 px-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiWifiStrength1Alert, + className: "ms-2 w-4 h-4 inline-block" + }), + "Wifi: ", + status.rssi, + " dBm" + ] + }); + else if (status.rssi <= -70) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 text-base py-3 px-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiWifiStrength2, + className: "ms-2 w-4 h-4 inline-block" + }), + "Wifi: ", + status.rssi, + " dBm" + ] + }); + else if (status.rssi <= -55) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 text-base py-3 px-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiWifiStrength3, + className: "ms-2 w-4 h-4 inline-block" + }), + "Wifi: ", + status.rssi, + " dBm" + ] + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 text-base py-3 px-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiWifiStrength4, + className: "ms-2 w-4 h-4 inline-block" + }), + "Wifi: ", + status.rssi, + " dBm" + ] + }); +}; +var NSPanelRamStatus = ({ status }) => { + if (status.model != "sonoff" && status.model != "custom") return null; + if (status.state == "offline" || status.state == "unknown" || status.state == "waiting" || status.state == "rebooting") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 text-base py-3 px-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiMemory, + className: "ms-2 w-4 h-4 inline-block me-1" + }), "RAM: -"] + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 text-base py-3 px-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiMemory, + className: "ms-2 w-4 h-4 inline-block" + }), + "RAM: ", + status.ram_usage, + "%" + ] + }); +}; +var NSPanelTemperatureStatus = ({ status }) => { + if (status.model != "sonoff" && status.model != "custom") return null; + if (status.state == "offline" || status.state == "unknown" || status.state == "waiting" || status.state == "rebooting") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 text-base py-3 px-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiThermometer, + className: "ms-2 w-4 h-4 inline-block me-1" + }), "Temperature: -"] + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 text-base py-3 px-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiThermometer, + className: "ms-2 w-4 h-4 inline-block" + }), + "Temp: ", + status.temperature ? status.temperature.toFixed(1) : "?", + status.temperature_unit + ] + }); +}; +var NSPanelHumidityStatus = ({ status }) => { + if (status.model != "custom") return null; + if (status.state == "offline" || status.state == "unknown" || status.state == "waiting" || status.state == "rebooting") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 text-base py-3 px-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiWaterPercent, + className: "ms-2 w-4 h-4 inline-block me-1" + }), "Humidity: -"] + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 text-base py-3 px-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiWaterPercent, + className: "ms-2 w-4 h-4 inline-block" + }), + "Humidity: ", + status.humidity?.toFixed(1), + "%" + ] + }); +}; +var NSPanelPressureStatus = ({ status }) => { + if (status.model != "custom") return null; + if (status.state == "offline" || status.state == "unknown" || status.state == "waiting" || status.state == "rebooting") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 text-base py-3 px-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiWaterPercent, + className: "ms-2 w-4 h-4 inline-block me-1" + }), "Pressure: -"] + }); + else return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 text-base py-3 px-2", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiWaterPercent, + className: "ms-2 w-4 h-4 inline-block" + }), + "Pressure: ", + status.pressure && `${(status.pressure / 100).toFixed(1)} hPa` || "-" + ] + }); +}; +var NSPanelRebootButton = ({ status }) => { + if (status.model != "sonoff" && status.model != "custom") return null; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 py-3 px-2 group cursor-pointer hover:bg-base-300", + onClick: () => { + useStompStore.getState().send(`nspanel/${status.mac}/command`, "reboot"); + Notify({ + message: `Sent reboot command to ${status.name}.`, + level: "success", + duration: 2e3 + }); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiRestart, + className: "ms-2 w-4 h-4 inline-block group-hover:text-warning" + }), "Reboot"] + }); +}; +var NSPanelVisitButton = ({ status }) => { + if (status.model != "sonoff" && status.model != "custom") return null; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { + className: `list-row flex items-center justify-start gap-1 py-3 px-2 group cursor-pointer hover:bg-base-300 ${status.state === "offline" ? "line-through" : ""}`, + href: status.state === "offline" ? "#" : `http://${status.ip_address}/`, + target: "_blank", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiWeb, + className: "ms-2 w-4 h-4 inline-block group-hover:text-info" + }), "Visit"] + }); +}; +var NSPanelFirmwareUpdateButton = ({ status }) => { + if (status.model != "sonoff" && status.model != "custom") return; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 py-3 px-2 group cursor-pointer hover:bg-base-300", + onClick: () => { + if (status.state === "offline") return; + useStompStore.getState().send(`nspanel/${status.mac}/command`, "firmware_update"); + Notify({ + message: `Sent firmware update command.`, + level: "success", + duration: 2e3 + }); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiUpload, + className: `ms-2 w-4 h-4 inline-block group-hover:text-success ${status.state === "offline" ? "line-through" : ""}` + }), "Update firmware"] + }); +}; +var NSPanelForceFirmwareUpdateButton = ({ status }) => { + if (status.model != "sonoff" && status.model != "custom") return; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 py-3 px-2 group cursor-pointer hover:bg-base-300", + onClick: () => { + if (status.state === "offline") return; + useStompStore.getState().send(`nspanel/${status.mac}/command`, "firmware_update_force"); + Notify({ + message: `Sent force firmware update command.`, + level: "success", + duration: 2e3 + }); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiUpload, + className: `ms-2 w-4 h-4 inline-block group-hover:text-success ${status.state === "offline" ? "line-through" : ""}` + }), "Force update firmware"] + }); +}; +var NSPanelGuiUpdateButton = ({ status }) => { + if (status.model != "sonoff" && status.model != "custom") return; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 py-3 px-2 group cursor-pointer hover:bg-base-300", + onClick: () => { + if (status.state === "offline") return; + useStompStore.getState().send(`nspanel/${status.mac}/command`, "gui_update"); + Notify({ + message: `Sent GUI update command.`, + level: "success", + duration: 2e3 + }); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiTableArrowUp, + className: `ms-2 w-4 h-4 inline-block group-hover:text-success ${status.state === "offline" ? "line-through" : ""}` + }), "Update GUI"] + }); +}; +var NSPanelDeleteButton = ({ delete_confirm_dialog_ref }) => { + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "list-row flex items-center justify-start gap-1 py-3 px-2 group cursor-pointer hover:bg-base-300", + onClick: () => { + if (delete_confirm_dialog_ref.current) delete_confirm_dialog_ref.current.showModal(); + }, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: mdiMinusCircle, + className: `ms-2 w-4 h-4 inline-block group-hover:text-error` + }), "Delete"] + }); +}; +function getCookie(name) { + let cookieValue = ""; + if (document.cookie && document.cookie !== "") { + const cookies = document.cookie.split(";"); + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].trim(); + if (cookie.substring(0, name.length + 1) === name + "=") { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; +} +var NSPanelDeleteConfirmDialog = (0, import_react.forwardRef)(({ status, delete_nspanel_dialog_ref }, ref) => { + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("dialog", { + ref, + className: "modal", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "modal-box", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { + className: "text-lg font-bold", + children: "Delete NSPanel" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { + className: "py-4", + children: [ + "Are you sure you want to delete NSPanel '", + status.name, + "'?" + ] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex justify-end join", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => delete_nspanel_dialog_ref.current?.close(), + className: "btn btn-neutral join-item", + children: "Cancel" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { + onClick: () => { + fetch(`/rest/nspanel/${status.id}`, { + method: "DELETE", + headers: { "X-CSRFToken": getCookie("csrftoken") } + }).then(() => { + window.location.href = "/"; + }).catch((error) => { + Notify({ + message: `Failed to delete NSPanel: ${error}`, + level: "error", + duration: 1e4 + }); + }); + }, + className: "btn btn-error join-item", + children: "Delete" + })] + }) + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { + method: "dialog", + className: "modal-backdrop", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { children: "close" }) + })] + }); +}); +function Sidebar({ nspanel_mac }) { + const { nspanels, status, fetchData } = useEntityStatesStore(); + (0, import_react.useEffect)(() => { + if (status === "none") fetchData(); + }, [status, fetchData]); + const delete_confirm_dialog_ref = (0, import_react.useRef)(null); + if (status == "loading" || status == "none") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "border-base-300 bg-base-100 p-2 rounded-box list", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "text-lg", + children: "Loading..." + }) + }); + else if (status == "loaded" && !nspanels[nspanel_mac]) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "text-error text-md", + children: [ + "NSPanel state not found for panel with MAC: ", + nspanel_mac, + "!" + ] + }); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelDeleteConfirmDialog, { + ref: delete_confirm_dialog_ref, + delete_nspanel_dialog_ref: delete_confirm_dialog_ref, + status: nspanels[nspanel_mac] + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "font-medium text-lg", + children: "Status" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "border-base-300 bg-base-100 rounded-box list", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelStatus, { status: nspanels[nspanel_mac] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelWiFiStatus, { status: nspanels[nspanel_mac] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelRamStatus, { status: nspanels[nspanel_mac] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelTemperatureStatus, { status: nspanels[nspanel_mac] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelHumidityStatus, { status: nspanels[nspanel_mac] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelPressureStatus, { status: nspanels[nspanel_mac] }) + ] + })] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mt-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { + className: "font-medium text-lg", + children: "Actions" + }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ul", { + className: "border-base-300 bg-base-100 rounded-box list w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelRebootButton, { status: nspanels[nspanel_mac] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelVisitButton, { status: nspanels[nspanel_mac] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelFirmwareUpdateButton, { status: nspanels[nspanel_mac] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelForceFirmwareUpdateButton, { status: nspanels[nspanel_mac] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelGuiUpdateButton, { status: nspanels[nspanel_mac] }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelDeleteButton, { delete_confirm_dialog_ref }) + ] + })] + }) + ] }); +} +//#endregion +export { Sidebar as default }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/StompStore-Bh-Guhla.js b/docker/web/nspanelmanager/web/react-components/dist/StompStore-Bh-Guhla.js new file mode 100644 index 000000000..1b04cd103 --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/StompStore-Bh-Guhla.js @@ -0,0 +1,3798 @@ +import { i as __commonJSMin } from "./main-FKp56mKw.js"; +import { t as create } from "./react-Cm4z11-B.js"; +import { n as Notify, r as RemoveNotification } from "./NSPanelToastContainer-D677tDZJ.js"; +//#region node_modules/tslib/tslib.es6.mjs +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) { + d.__proto__ = b; + } || function(d, b) { + for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; + }; + return extendStatics(d, b); +}; +function __extends(d, b) { + if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} +function __generator(thisArg, body) { + var _ = { + label: 0, + sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, + trys: [], + ops: [] + }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); + return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { + value: op[1], + done: false + }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { + value: op[0] ? op[1] : void 0, + done: true + }; + } +} +function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { next: function() { + if (o && i >= o.length) o = void 0; + return { + value: o && o[i++], + done: !o + }; + } }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} +function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { + e = { error }; + } finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } finally { + if (e) throw e.error; + } + } + return ar; +} +function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) { + for (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} +function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() { + return this; + }, i; + function awaitReturn(f) { + return function(v) { + return Promise.resolve(v).then(f, reject); + }; + } + function verb(n, f) { + if (g[n]) { + i[n] = function(v) { + return new Promise(function(a, b) { + q.push([ + n, + v, + a, + b + ]) > 1 || resume(n, v); + }); + }; + if (f) i[n] = f(i[n]); + } + } + function resume(n, v) { + try { + step(g[n](v)); + } catch (e) { + settle(q[0][3], e); + } + } + function step(r) { + r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); + } + function fulfill(value) { + resume("next", value); + } + function reject(value) { + resume("throw", value); + } + function settle(f, v) { + if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); + } +} +function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i); + function verb(n) { + i[n] = o[n] && function(v) { + return new Promise(function(resolve, reject) { + v = o[n](v), settle(resolve, reject, v.done, v.value); + }); + }; + } + function settle(resolve, reject, d, v) { + Promise.resolve(v).then(function(v) { + resolve({ + value: v, + done: d + }); + }, reject); + } +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/isFunction.js +function isFunction(value) { + return typeof value === "function"; +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +function createErrorClass(createImpl) { + var _super = function(instance) { + Error.call(instance); + instance.stack = (/* @__PURE__ */ new Error()).stack; + }; + var ctorFunc = createImpl(_super); + ctorFunc.prototype = Object.create(Error.prototype); + ctorFunc.prototype.constructor = ctorFunc; + return ctorFunc; +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +var UnsubscriptionError = createErrorClass(function(_super) { + return function UnsubscriptionErrorImpl(errors) { + _super(this); + this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err, i) { + return i + 1 + ") " + err.toString(); + }).join("\n ") : ""; + this.name = "UnsubscriptionError"; + this.errors = errors; + }; +}); +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +function arrRemove(arr, item) { + if (arr) { + var index = arr.indexOf(item); + 0 <= index && arr.splice(index, 1); + } +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/Subscription.js +var Subscription = function() { + function Subscription(initialTeardown) { + this.initialTeardown = initialTeardown; + this.closed = false; + this._parentage = null; + this._finalizers = null; + } + Subscription.prototype.unsubscribe = function() { + var e_1, _a, e_2, _b; + var errors; + if (!this.closed) { + this.closed = true; + var _parentage = this._parentage; + if (_parentage) { + this._parentage = null; + if (Array.isArray(_parentage)) try { + for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) _parentage_1_1.value.remove(this); + } catch (e_1_1) { + e_1 = { error: e_1_1 }; + } finally { + try { + if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1); + } finally { + if (e_1) throw e_1.error; + } + } + else _parentage.remove(this); + } + var initialFinalizer = this.initialTeardown; + if (isFunction(initialFinalizer)) try { + initialFinalizer(); + } catch (e) { + errors = e instanceof UnsubscriptionError ? e.errors : [e]; + } + var _finalizers = this._finalizers; + if (_finalizers) { + this._finalizers = null; + try { + for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) { + var finalizer = _finalizers_1_1.value; + try { + execFinalizer(finalizer); + } catch (err) { + errors = errors !== null && errors !== void 0 ? errors : []; + if (err instanceof UnsubscriptionError) errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors)); + else errors.push(err); + } + } + } catch (e_2_1) { + e_2 = { error: e_2_1 }; + } finally { + try { + if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1); + } finally { + if (e_2) throw e_2.error; + } + } + } + if (errors) throw new UnsubscriptionError(errors); + } + }; + Subscription.prototype.add = function(teardown) { + var _a; + if (teardown && teardown !== this) { + if (this.closed) execFinalizer(teardown); + else { + if (teardown instanceof Subscription) { + if (teardown.closed || teardown._hasParent(this)) return; + teardown._addParent(this); + } + (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown); + } + } + }; + Subscription.prototype._hasParent = function(parent) { + var _parentage = this._parentage; + return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent); + }; + Subscription.prototype._addParent = function(parent) { + var _parentage = this._parentage; + this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent; + }; + Subscription.prototype._removeParent = function(parent) { + var _parentage = this._parentage; + if (_parentage === parent) this._parentage = null; + else if (Array.isArray(_parentage)) arrRemove(_parentage, parent); + }; + Subscription.prototype.remove = function(teardown) { + var _finalizers = this._finalizers; + _finalizers && arrRemove(_finalizers, teardown); + if (teardown instanceof Subscription) teardown._removeParent(this); + }; + Subscription.EMPTY = (function() { + var empty = new Subscription(); + empty.closed = true; + return empty; + })(); + return Subscription; +}(); +var EMPTY_SUBSCRIPTION = Subscription.EMPTY; +function isSubscription(value) { + return value instanceof Subscription || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe); +} +function execFinalizer(finalizer) { + if (isFunction(finalizer)) finalizer(); + else finalizer.unsubscribe(); +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/config.js +var config = { + onUnhandledError: null, + onStoppedNotification: null, + Promise: void 0, + useDeprecatedSynchronousErrorHandling: false, + useDeprecatedNextContext: false +}; +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +var timeoutProvider = { + setTimeout: function(handler, timeout) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) args[_i - 2] = arguments[_i]; + var delegate = timeoutProvider.delegate; + if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args))); + return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args))); + }, + clearTimeout: function(handle) { + var delegate = timeoutProvider.delegate; + return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle); + }, + delegate: void 0 +}; +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +function reportUnhandledError(err) { + timeoutProvider.setTimeout(function() { + var onUnhandledError = config.onUnhandledError; + if (onUnhandledError) onUnhandledError(err); + else throw err; + }); +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/noop.js +function noop() {} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/NotificationFactories.js +var COMPLETE_NOTIFICATION = (function() { + return createNotification("C", void 0, void 0); +})(); +function errorNotification(error) { + return createNotification("E", void 0, error); +} +function nextNotification(value) { + return createNotification("N", value, void 0); +} +function createNotification(kind, value, error) { + return { + kind, + value, + error + }; +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/errorContext.js +var context = null; +function errorContext(cb) { + if (config.useDeprecatedSynchronousErrorHandling) { + var isRoot = !context; + if (isRoot) context = { + errorThrown: false, + error: null + }; + cb(); + if (isRoot) { + var _a = context, errorThrown = _a.errorThrown, error = _a.error; + context = null; + if (errorThrown) throw error; + } + } else cb(); +} +function captureError(err) { + if (config.useDeprecatedSynchronousErrorHandling && context) { + context.errorThrown = true; + context.error = err; + } +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/Subscriber.js +var Subscriber = function(_super) { + __extends(Subscriber, _super); + function Subscriber(destination) { + var _this = _super.call(this) || this; + _this.isStopped = false; + if (destination) { + _this.destination = destination; + if (isSubscription(destination)) destination.add(_this); + } else _this.destination = EMPTY_OBSERVER; + return _this; + } + Subscriber.create = function(next, error, complete) { + return new SafeSubscriber(next, error, complete); + }; + Subscriber.prototype.next = function(value) { + if (this.isStopped) handleStoppedNotification(nextNotification(value), this); + else this._next(value); + }; + Subscriber.prototype.error = function(err) { + if (this.isStopped) handleStoppedNotification(errorNotification(err), this); + else { + this.isStopped = true; + this._error(err); + } + }; + Subscriber.prototype.complete = function() { + if (this.isStopped) handleStoppedNotification(COMPLETE_NOTIFICATION, this); + else { + this.isStopped = true; + this._complete(); + } + }; + Subscriber.prototype.unsubscribe = function() { + if (!this.closed) { + this.isStopped = true; + _super.prototype.unsubscribe.call(this); + this.destination = null; + } + }; + Subscriber.prototype._next = function(value) { + this.destination.next(value); + }; + Subscriber.prototype._error = function(err) { + try { + this.destination.error(err); + } finally { + this.unsubscribe(); + } + }; + Subscriber.prototype._complete = function() { + try { + this.destination.complete(); + } finally { + this.unsubscribe(); + } + }; + return Subscriber; +}(Subscription); +var _bind = Function.prototype.bind; +function bind(fn, thisArg) { + return _bind.call(fn, thisArg); +} +var ConsumerObserver = function() { + function ConsumerObserver(partialObserver) { + this.partialObserver = partialObserver; + } + ConsumerObserver.prototype.next = function(value) { + var partialObserver = this.partialObserver; + if (partialObserver.next) try { + partialObserver.next(value); + } catch (error) { + handleUnhandledError(error); + } + }; + ConsumerObserver.prototype.error = function(err) { + var partialObserver = this.partialObserver; + if (partialObserver.error) try { + partialObserver.error(err); + } catch (error) { + handleUnhandledError(error); + } + else handleUnhandledError(err); + }; + ConsumerObserver.prototype.complete = function() { + var partialObserver = this.partialObserver; + if (partialObserver.complete) try { + partialObserver.complete(); + } catch (error) { + handleUnhandledError(error); + } + }; + return ConsumerObserver; +}(); +var SafeSubscriber = function(_super) { + __extends(SafeSubscriber, _super); + function SafeSubscriber(observerOrNext, error, complete) { + var _this = _super.call(this) || this; + var partialObserver; + if (isFunction(observerOrNext) || !observerOrNext) partialObserver = { + next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0, + error: error !== null && error !== void 0 ? error : void 0, + complete: complete !== null && complete !== void 0 ? complete : void 0 + }; + else { + var context_1; + if (_this && config.useDeprecatedNextContext) { + context_1 = Object.create(observerOrNext); + context_1.unsubscribe = function() { + return _this.unsubscribe(); + }; + partialObserver = { + next: observerOrNext.next && bind(observerOrNext.next, context_1), + error: observerOrNext.error && bind(observerOrNext.error, context_1), + complete: observerOrNext.complete && bind(observerOrNext.complete, context_1) + }; + } else partialObserver = observerOrNext; + } + _this.destination = new ConsumerObserver(partialObserver); + return _this; + } + return SafeSubscriber; +}(Subscriber); +function handleUnhandledError(error) { + if (config.useDeprecatedSynchronousErrorHandling) captureError(error); + else reportUnhandledError(error); +} +function defaultErrorHandler(err) { + throw err; +} +function handleStoppedNotification(notification, subscriber) { + var onStoppedNotification = config.onStoppedNotification; + onStoppedNotification && timeoutProvider.setTimeout(function() { + return onStoppedNotification(notification, subscriber); + }); +} +var EMPTY_OBSERVER = { + closed: true, + next: noop, + error: defaultErrorHandler, + complete: noop +}; +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/symbol/observable.js +var observable = (function() { + return typeof Symbol === "function" && Symbol.observable || "@@observable"; +})(); +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/identity.js +function identity(x) { + return x; +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/pipe.js +function pipeFromArray(fns) { + if (fns.length === 0) return identity; + if (fns.length === 1) return fns[0]; + return function piped(input) { + return fns.reduce(function(prev, fn) { + return fn(prev); + }, input); + }; +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/Observable.js +var Observable = function() { + function Observable(subscribe) { + if (subscribe) this._subscribe = subscribe; + } + Observable.prototype.lift = function(operator) { + var observable = new Observable(); + observable.source = this; + observable.operator = operator; + return observable; + }; + Observable.prototype.subscribe = function(observerOrNext, error, complete) { + var _this = this; + var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete); + errorContext(function() { + var _a = _this, operator = _a.operator, source = _a.source; + subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber)); + }); + return subscriber; + }; + Observable.prototype._trySubscribe = function(sink) { + try { + return this._subscribe(sink); + } catch (err) { + sink.error(err); + } + }; + Observable.prototype.forEach = function(next, promiseCtor) { + var _this = this; + promiseCtor = getPromiseCtor(promiseCtor); + return new promiseCtor(function(resolve, reject) { + var subscriber = new SafeSubscriber({ + next: function(value) { + try { + next(value); + } catch (err) { + reject(err); + subscriber.unsubscribe(); + } + }, + error: reject, + complete: resolve + }); + _this.subscribe(subscriber); + }); + }; + Observable.prototype._subscribe = function(subscriber) { + var _a; + return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber); + }; + Observable.prototype[observable] = function() { + return this; + }; + Observable.prototype.pipe = function() { + var operations = []; + for (var _i = 0; _i < arguments.length; _i++) operations[_i] = arguments[_i]; + return pipeFromArray(operations)(this); + }; + Observable.prototype.toPromise = function(promiseCtor) { + var _this = this; + promiseCtor = getPromiseCtor(promiseCtor); + return new promiseCtor(function(resolve, reject) { + var value; + _this.subscribe(function(x) { + return value = x; + }, function(err) { + return reject(err); + }, function() { + return resolve(value); + }); + }); + }; + Observable.create = function(subscribe) { + return new Observable(subscribe); + }; + return Observable; +}(); +function getPromiseCtor(promiseCtor) { + var _a; + return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise; +} +function isObserver(value) { + return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete); +} +function isSubscriber(value) { + return value && value instanceof Subscriber || isObserver(value) && isSubscription(value); +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/lift.js +function hasLift(source) { + return isFunction(source === null || source === void 0 ? void 0 : source.lift); +} +function operate(init) { + return function(source) { + if (hasLift(source)) return source.lift(function(liftedSource) { + try { + return init(liftedSource, this); + } catch (err) { + this.error(err); + } + }); + throw new TypeError("Unable to lift unknown Observable type"); + }; +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js +function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) { + return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize); +} +var OperatorSubscriber = function(_super) { + __extends(OperatorSubscriber, _super); + function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) { + var _this = _super.call(this, destination) || this; + _this.onFinalize = onFinalize; + _this.shouldUnsubscribe = shouldUnsubscribe; + _this._next = onNext ? function(value) { + try { + onNext(value); + } catch (err) { + destination.error(err); + } + } : _super.prototype._next; + _this._error = onError ? function(err) { + try { + onError(err); + } catch (err) { + destination.error(err); + } finally { + this.unsubscribe(); + } + } : _super.prototype._error; + _this._complete = onComplete ? function() { + try { + onComplete(); + } catch (err) { + destination.error(err); + } finally { + this.unsubscribe(); + } + } : _super.prototype._complete; + return _this; + } + OperatorSubscriber.prototype.unsubscribe = function() { + var _a; + if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) { + var closed_1 = this.closed; + _super.prototype.unsubscribe.call(this); + !closed_1 && ((_a = this.onFinalize) === null || _a === void 0 || _a.call(this)); + } + }; + return OperatorSubscriber; +}(Subscriber); +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/ObjectUnsubscribedError.js +var ObjectUnsubscribedError = createErrorClass(function(_super) { + return function ObjectUnsubscribedErrorImpl() { + _super(this); + this.name = "ObjectUnsubscribedError"; + this.message = "object unsubscribed"; + }; +}); +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/Subject.js +var Subject = function(_super) { + __extends(Subject, _super); + function Subject() { + var _this = _super.call(this) || this; + _this.closed = false; + _this.currentObservers = null; + _this.observers = []; + _this.isStopped = false; + _this.hasError = false; + _this.thrownError = null; + return _this; + } + Subject.prototype.lift = function(operator) { + var subject = new AnonymousSubject(this, this); + subject.operator = operator; + return subject; + }; + Subject.prototype._throwIfClosed = function() { + if (this.closed) throw new ObjectUnsubscribedError(); + }; + Subject.prototype.next = function(value) { + var _this = this; + errorContext(function() { + var e_1, _a; + _this._throwIfClosed(); + if (!_this.isStopped) { + if (!_this.currentObservers) _this.currentObservers = Array.from(_this.observers); + try { + for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) _c.value.next(value); + } catch (e_1_1) { + e_1 = { error: e_1_1 }; + } finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } finally { + if (e_1) throw e_1.error; + } + } + } + }); + }; + Subject.prototype.error = function(err) { + var _this = this; + errorContext(function() { + _this._throwIfClosed(); + if (!_this.isStopped) { + _this.hasError = _this.isStopped = true; + _this.thrownError = err; + var observers = _this.observers; + while (observers.length) observers.shift().error(err); + } + }); + }; + Subject.prototype.complete = function() { + var _this = this; + errorContext(function() { + _this._throwIfClosed(); + if (!_this.isStopped) { + _this.isStopped = true; + var observers = _this.observers; + while (observers.length) observers.shift().complete(); + } + }); + }; + Subject.prototype.unsubscribe = function() { + this.isStopped = this.closed = true; + this.observers = this.currentObservers = null; + }; + Object.defineProperty(Subject.prototype, "observed", { + get: function() { + var _a; + return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0; + }, + enumerable: false, + configurable: true + }); + Subject.prototype._trySubscribe = function(subscriber) { + this._throwIfClosed(); + return _super.prototype._trySubscribe.call(this, subscriber); + }; + Subject.prototype._subscribe = function(subscriber) { + this._throwIfClosed(); + this._checkFinalizedStatuses(subscriber); + return this._innerSubscribe(subscriber); + }; + Subject.prototype._innerSubscribe = function(subscriber) { + var _this = this; + var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers; + if (hasError || isStopped) return EMPTY_SUBSCRIPTION; + this.currentObservers = null; + observers.push(subscriber); + return new Subscription(function() { + _this.currentObservers = null; + arrRemove(observers, subscriber); + }); + }; + Subject.prototype._checkFinalizedStatuses = function(subscriber) { + var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped; + if (hasError) subscriber.error(thrownError); + else if (isStopped) subscriber.complete(); + }; + Subject.prototype.asObservable = function() { + var observable = new Observable(); + observable.source = this; + return observable; + }; + Subject.create = function(destination, source) { + return new AnonymousSubject(destination, source); + }; + return Subject; +}(Observable); +var AnonymousSubject = function(_super) { + __extends(AnonymousSubject, _super); + function AnonymousSubject(destination, source) { + var _this = _super.call(this) || this; + _this.destination = destination; + _this.source = source; + return _this; + } + AnonymousSubject.prototype.next = function(value) { + var _a, _b; + (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 || _b.call(_a, value); + }; + AnonymousSubject.prototype.error = function(err) { + var _a, _b; + (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 || _b.call(_a, err); + }; + AnonymousSubject.prototype.complete = function() { + var _a, _b; + (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 || _b.call(_a); + }; + AnonymousSubject.prototype._subscribe = function(subscriber) { + var _a, _b; + return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION; + }; + return AnonymousSubject; +}(Subject); +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/BehaviorSubject.js +var BehaviorSubject = function(_super) { + __extends(BehaviorSubject, _super); + function BehaviorSubject(_value) { + var _this = _super.call(this) || this; + _this._value = _value; + return _this; + } + Object.defineProperty(BehaviorSubject.prototype, "value", { + get: function() { + return this.getValue(); + }, + enumerable: false, + configurable: true + }); + BehaviorSubject.prototype._subscribe = function(subscriber) { + var subscription = _super.prototype._subscribe.call(this, subscriber); + !subscription.closed && subscriber.next(this._value); + return subscription; + }; + BehaviorSubject.prototype.getValue = function() { + var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, _value = _a._value; + if (hasError) throw thrownError; + this._throwIfClosed(); + return _value; + }; + BehaviorSubject.prototype.next = function(value) { + _super.prototype.next.call(this, this._value = value); + }; + return BehaviorSubject; +}(Subject); +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/observable/empty.js +var EMPTY = new Observable(function(subscriber) { + return subscriber.complete(); +}); +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/isArrayLike.js +var isArrayLike = (function(x) { + return x && typeof x.length === "number" && typeof x !== "function"; +}); +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/isPromise.js +function isPromise(value) { + return isFunction(value === null || value === void 0 ? void 0 : value.then); +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/isInteropObservable.js +function isInteropObservable(input) { + return isFunction(input[observable]); +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/isAsyncIterable.js +function isAsyncIterable(obj) { + return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]); +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/throwUnobservableError.js +function createInvalidObservableTypeError(input) { + return /* @__PURE__ */ new TypeError("You provided " + (input !== null && typeof input === "object" ? "an invalid object" : "'" + input + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable."); +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/symbol/iterator.js +function getSymbolIterator() { + if (typeof Symbol !== "function" || !Symbol.iterator) return "@@iterator"; + return Symbol.iterator; +} +var iterator = getSymbolIterator(); +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/isIterable.js +function isIterable(input) { + return isFunction(input === null || input === void 0 ? void 0 : input[iterator]); +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/isReadableStreamLike.js +function readableStreamLikeToAsyncGenerator(readableStream) { + return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() { + var reader, _a, value, done; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + reader = readableStream.getReader(); + _b.label = 1; + case 1: + _b.trys.push([ + 1, + , + 9, + 10 + ]); + _b.label = 2; + case 2: return [4, __await(reader.read())]; + case 3: + _a = _b.sent(), value = _a.value, done = _a.done; + if (!done) return [3, 5]; + return [4, __await(void 0)]; + case 4: return [2, _b.sent()]; + case 5: return [4, __await(value)]; + case 6: return [4, _b.sent()]; + case 7: + _b.sent(); + return [3, 2]; + case 8: return [3, 10]; + case 9: + reader.releaseLock(); + return [7]; + case 10: return [2]; + } + }); + }); +} +function isReadableStreamLike(obj) { + return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader); +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/observable/innerFrom.js +function innerFrom(input) { + if (input instanceof Observable) return input; + if (input != null) { + if (isInteropObservable(input)) return fromInteropObservable(input); + if (isArrayLike(input)) return fromArrayLike(input); + if (isPromise(input)) return fromPromise(input); + if (isAsyncIterable(input)) return fromAsyncIterable(input); + if (isIterable(input)) return fromIterable(input); + if (isReadableStreamLike(input)) return fromReadableStreamLike(input); + } + throw createInvalidObservableTypeError(input); +} +function fromInteropObservable(obj) { + return new Observable(function(subscriber) { + var obs = obj[observable](); + if (isFunction(obs.subscribe)) return obs.subscribe(subscriber); + throw new TypeError("Provided object does not correctly implement Symbol.observable"); + }); +} +function fromArrayLike(array) { + return new Observable(function(subscriber) { + for (var i = 0; i < array.length && !subscriber.closed; i++) subscriber.next(array[i]); + subscriber.complete(); + }); +} +function fromPromise(promise) { + return new Observable(function(subscriber) { + promise.then(function(value) { + if (!subscriber.closed) { + subscriber.next(value); + subscriber.complete(); + } + }, function(err) { + return subscriber.error(err); + }).then(null, reportUnhandledError); + }); +} +function fromIterable(iterable) { + return new Observable(function(subscriber) { + var e_1, _a; + try { + for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) { + var value = iterable_1_1.value; + subscriber.next(value); + if (subscriber.closed) return; + } + } catch (e_1_1) { + e_1 = { error: e_1_1 }; + } finally { + try { + if (iterable_1_1 && !iterable_1_1.done && (_a = iterable_1.return)) _a.call(iterable_1); + } finally { + if (e_1) throw e_1.error; + } + } + subscriber.complete(); + }); +} +function fromAsyncIterable(asyncIterable) { + return new Observable(function(subscriber) { + process(asyncIterable, subscriber).catch(function(err) { + return subscriber.error(err); + }); + }); +} +function fromReadableStreamLike(readableStream) { + return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream)); +} +function process(asyncIterable, subscriber) { + var asyncIterable_1, asyncIterable_1_1; + var e_2, _a; + return __awaiter(this, void 0, void 0, function() { + var value, e_2_1; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + _b.trys.push([ + 0, + 5, + 6, + 11 + ]); + asyncIterable_1 = __asyncValues(asyncIterable); + _b.label = 1; + case 1: return [4, asyncIterable_1.next()]; + case 2: + if (!(asyncIterable_1_1 = _b.sent(), !asyncIterable_1_1.done)) return [3, 4]; + value = asyncIterable_1_1.value; + subscriber.next(value); + if (subscriber.closed) return [2]; + _b.label = 3; + case 3: return [3, 1]; + case 4: return [3, 11]; + case 5: + e_2_1 = _b.sent(); + e_2 = { error: e_2_1 }; + return [3, 11]; + case 6: + _b.trys.push([ + 6, + , + 9, + 10 + ]); + if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return))) return [3, 8]; + return [4, _a.call(asyncIterable_1)]; + case 7: + _b.sent(); + _b.label = 8; + case 8: return [3, 10]; + case 9: + if (e_2) throw e_2.error; + return [7]; + case 10: return [7]; + case 11: + subscriber.complete(); + return [2]; + } + }); + }); +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/util/EmptyError.js +var EmptyError = createErrorClass(function(_super) { + return function EmptyErrorImpl() { + _super(this); + this.name = "EmptyError"; + this.message = "no elements in sequence"; + }; +}); +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/firstValueFrom.js +function firstValueFrom(source, config) { + var hasConfig = typeof config === "object"; + return new Promise(function(resolve, reject) { + var subscriber = new SafeSubscriber({ + next: function(value) { + resolve(value); + subscriber.unsubscribe(); + }, + error: reject, + complete: function() { + if (hasConfig) resolve(config.defaultValue); + else reject(new EmptyError()); + } + }); + source.subscribe(subscriber); + }); +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/operators/filter.js +function filter(predicate, thisArg) { + return operate(function(source, subscriber) { + var index = 0; + source.subscribe(createOperatorSubscriber(subscriber, function(value) { + return predicate.call(thisArg, value, index++) && subscriber.next(value); + })); + }); +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/operators/take.js +function take(count) { + return count <= 0 ? function() { + return EMPTY; + } : operate(function(source, subscriber) { + var seen = 0; + source.subscribe(createOperatorSubscriber(subscriber, function(value) { + if (++seen <= count) { + subscriber.next(value); + if (count <= seen) subscriber.complete(); + } + })); + }); +} +//#endregion +//#region node_modules/rxjs/dist/esm5/internal/operators/share.js +function share(options) { + if (options === void 0) options = {}; + var _a = options.connector, connector = _a === void 0 ? function() { + return new Subject(); + } : _a, _b = options.resetOnError, resetOnError = _b === void 0 ? true : _b, _c = options.resetOnComplete, resetOnComplete = _c === void 0 ? true : _c, _d = options.resetOnRefCountZero, resetOnRefCountZero = _d === void 0 ? true : _d; + return function(wrapperSource) { + var connection; + var resetConnection; + var subject; + var refCount = 0; + var hasCompleted = false; + var hasErrored = false; + var cancelReset = function() { + resetConnection === null || resetConnection === void 0 || resetConnection.unsubscribe(); + resetConnection = void 0; + }; + var reset = function() { + cancelReset(); + connection = subject = void 0; + hasCompleted = hasErrored = false; + }; + var resetAndUnsubscribe = function() { + var conn = connection; + reset(); + conn === null || conn === void 0 || conn.unsubscribe(); + }; + return operate(function(source, subscriber) { + refCount++; + if (!hasErrored && !hasCompleted) cancelReset(); + var dest = subject = subject !== null && subject !== void 0 ? subject : connector(); + subscriber.add(function() { + refCount--; + if (refCount === 0 && !hasErrored && !hasCompleted) resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero); + }); + dest.subscribe(subscriber); + if (!connection && refCount > 0) { + connection = new SafeSubscriber({ + next: function(value) { + return dest.next(value); + }, + error: function(err) { + hasErrored = true; + cancelReset(); + resetConnection = handleReset(reset, resetOnError, err); + dest.error(err); + }, + complete: function() { + hasCompleted = true; + cancelReset(); + resetConnection = handleReset(reset, resetOnComplete); + dest.complete(); + } + }); + innerFrom(source).subscribe(connection); + } + })(wrapperSource); + }; +} +function handleReset(reset, on) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) args[_i - 2] = arguments[_i]; + if (on === true) { + reset(); + return; + } + if (on === false) return; + var onSubscriber = new SafeSubscriber({ next: function() { + onSubscriber.unsubscribe(); + reset(); + } }); + return innerFrom(on.apply(void 0, __spreadArray([], __read(args)))).subscribe(onSubscriber); +} +//#endregion +//#region node_modules/@stomp/rx-stomp/esm6/rx-stomp-state.js +var import_stomp_umd = (/* @__PURE__ */ __commonJSMin(((exports, module) => { + (function(global, factory) { + typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.StompJs = {})); + })(exports, (function(exports$1) { + "use strict"; + /** + * @internal + */ + function augmentWebsocket(webSocket, debug) { + webSocket.terminate = function() { + const noOp = () => {}; + this.onerror = noOp; + this.onmessage = noOp; + this.onopen = noOp; + const ts = /* @__PURE__ */ new Date(); + const id = Math.random().toString().substring(2, 8); + const origOnClose = this.onclose; + this.onclose = (closeEvent) => { + const delay = (/* @__PURE__ */ new Date()).getTime() - ts.getTime(); + debug(`Discarded socket (#${id}) closed after ${delay}ms, with code/reason: ${closeEvent.code}/${closeEvent.reason}`); + }; + this.close(); + origOnClose?.call(webSocket, { + code: 4001, + reason: `Quick discarding socket (#${id}) without waiting for the shutdown sequence.`, + wasClean: false + }); + }; + } + /** + * Some byte values, used as per STOMP specifications. + * + * Part of `@stomp/stompjs`. + * + * @internal + */ + const BYTE = { + LF: "\n", + NULL: "\0" + }; + /** + * Frame class represents a STOMP frame. + * + * @internal + */ + class FrameImpl { + /** + * body of the frame + */ + get body() { + if (!this._body && this.isBinaryBody) this._body = new TextDecoder().decode(this._binaryBody); + return this._body || ""; + } + /** + * body as Uint8Array + */ + get binaryBody() { + if (!this._binaryBody && !this.isBinaryBody) this._binaryBody = new TextEncoder().encode(this._body); + return this._binaryBody; + } + /** + * Frame constructor. `command`, `headers` and `body` are available as properties. + * + * @internal + */ + constructor(params) { + const { command, headers, body, binaryBody, escapeHeaderValues, skipContentLengthHeader } = params; + this.command = command; + this.headers = Object.assign({}, headers || {}); + if (binaryBody) { + this._binaryBody = binaryBody; + this.isBinaryBody = true; + } else { + this._body = body || ""; + this.isBinaryBody = false; + } + this.escapeHeaderValues = escapeHeaderValues || false; + this.skipContentLengthHeader = skipContentLengthHeader || false; + } + /** + * deserialize a STOMP Frame from raw data. + * + * @internal + */ + static fromRawFrame(rawFrame, escapeHeaderValues) { + const headers = {}; + const trim = (str) => str.replace(/^\s+|\s+$/g, ""); + for (const header of rawFrame.headers.reverse()) { + header.indexOf(":"); + const key = trim(header[0]); + let value = trim(header[1]); + if (escapeHeaderValues && rawFrame.command !== "CONNECT" && rawFrame.command !== "CONNECTED") value = FrameImpl.hdrValueUnEscape(value); + headers[key] = value; + } + return new FrameImpl({ + command: rawFrame.command, + headers, + binaryBody: rawFrame.binaryBody, + escapeHeaderValues + }); + } + /** + * @internal + */ + toString() { + return this.serializeCmdAndHeaders(); + } + /** + * serialize this Frame in a format suitable to be passed to WebSocket. + * If the body is string the output will be string. + * If the body is binary (i.e. of type Unit8Array) it will be serialized to ArrayBuffer. + * + * @internal + */ + serialize() { + const cmdAndHeaders = this.serializeCmdAndHeaders(); + if (this.isBinaryBody) return FrameImpl.toUnit8Array(cmdAndHeaders, this._binaryBody).buffer; + else return cmdAndHeaders + this._body + BYTE.NULL; + } + serializeCmdAndHeaders() { + const lines = [this.command]; + if (this.skipContentLengthHeader) delete this.headers["content-length"]; + for (const name of Object.keys(this.headers || {})) { + const value = this.headers[name]; + if (this.escapeHeaderValues && this.command !== "CONNECT" && this.command !== "CONNECTED") lines.push(`${name}:${FrameImpl.hdrValueEscape(`${value}`)}`); + else lines.push(`${name}:${value}`); + } + if (this.isBinaryBody || !this.isBodyEmpty() && !this.skipContentLengthHeader) lines.push(`content-length:${this.bodyLength()}`); + return lines.join(BYTE.LF) + BYTE.LF + BYTE.LF; + } + isBodyEmpty() { + return this.bodyLength() === 0; + } + bodyLength() { + const binaryBody = this.binaryBody; + return binaryBody ? binaryBody.length : 0; + } + /** + * Compute the size of a UTF-8 string by counting its number of bytes + * (and not the number of characters composing the string) + */ + static sizeOfUTF8(s) { + return s ? new TextEncoder().encode(s).length : 0; + } + static toUnit8Array(cmdAndHeaders, binaryBody) { + const uint8CmdAndHeaders = new TextEncoder().encode(cmdAndHeaders); + const nullTerminator = new Uint8Array([0]); + const uint8Frame = new Uint8Array(uint8CmdAndHeaders.length + binaryBody.length + nullTerminator.length); + uint8Frame.set(uint8CmdAndHeaders); + uint8Frame.set(binaryBody, uint8CmdAndHeaders.length); + uint8Frame.set(nullTerminator, uint8CmdAndHeaders.length + binaryBody.length); + return uint8Frame; + } + /** + * Serialize a STOMP frame as per STOMP standards, suitable to be sent to the STOMP broker. + * + * @internal + */ + static marshall(params) { + return new FrameImpl(params).serialize(); + } + /** + * Escape header values + */ + static hdrValueEscape(str) { + return str.replace(/\\/g, "\\\\").replace(/\r/g, "\\r").replace(/\n/g, "\\n").replace(/:/g, "\\c"); + } + /** + * UnEscape header values + */ + static hdrValueUnEscape(str) { + return str.replace(/\\r/g, "\r").replace(/\\n/g, "\n").replace(/\\c/g, ":").replace(/\\\\/g, "\\"); + } + } + /** + * @internal + */ + const NULL = 0; + /** + * @internal + */ + const LF = 10; + /** + * @internal + */ + const CR = 13; + /** + * @internal + */ + const COLON = 58; + /** + * This is an evented, rec descent parser. + * A stream of Octets can be passed and whenever it recognizes + * a complete Frame or an incoming ping it will invoke the registered callbacks. + * + * All incoming Octets are fed into _onByte function. + * Depending on current state the _onByte function keeps changing. + * Depending on the state it keeps accumulating into _token and _results. + * State is indicated by current value of _onByte, all states are named as _collect. + * + * STOMP standards https://stomp.github.io/stomp-specification-1.2.html + * imply that all lengths are considered in bytes (instead of string lengths). + * So, before actual parsing, if the incoming data is String it is converted to Octets. + * This allows faithful implementation of the protocol and allows NULL Octets to be present in the body. + * + * There is no peek function on the incoming data. + * When a state change occurs based on an Octet without consuming the Octet, + * the Octet, after state change, is fed again (_reinjectByte). + * This became possible as the state change can be determined by inspecting just one Octet. + * + * There are two modes to collect the body, if content-length header is there then it by counting Octets + * otherwise it is determined by NULL terminator. + * + * Following the standards, the command and headers are converted to Strings + * and the body is returned as Octets. + * Headers are returned as an array and not as Hash - to allow multiple occurrence of an header. + * + * This parser does not use Regular Expressions as that can only operate on Strings. + * + * It handles if multiple STOMP frames are given as one chunk, a frame is split into multiple chunks, or + * any combination there of. The parser remembers its state (any partial frame) and continues when a new chunk + * is pushed. + * + * Typically the higher level function will convert headers to Hash, handle unescaping of header values + * (which is protocol version specific), and convert body to text. + * + * Check the parser.spec.js to understand cases that this parser is supposed to handle. + * + * Part of `@stomp/stompjs`. + * + * @internal + */ + class Parser { + constructor(onFrame, onIncomingPing) { + this.onFrame = onFrame; + this.onIncomingPing = onIncomingPing; + this._encoder = new TextEncoder(); + this._decoder = new TextDecoder(); + this._token = []; + this._initState(); + } + parseChunk(segment, appendMissingNULLonIncoming = false) { + let chunk; + if (typeof segment === "string") chunk = this._encoder.encode(segment); + else chunk = new Uint8Array(segment); + if (appendMissingNULLonIncoming && chunk[chunk.length - 1] !== 0) { + const chunkWithNull = new Uint8Array(chunk.length + 1); + chunkWithNull.set(chunk, 0); + chunkWithNull[chunk.length] = 0; + chunk = chunkWithNull; + } + for (let i = 0; i < chunk.length; i++) { + const byte = chunk[i]; + this._onByte(byte); + } + } + _collectFrame(byte) { + if (byte === NULL) return; + if (byte === CR) return; + if (byte === LF) { + this.onIncomingPing(); + return; + } + this._onByte = this._collectCommand; + this._reinjectByte(byte); + } + _collectCommand(byte) { + if (byte === CR) return; + if (byte === LF) { + this._results.command = this._consumeTokenAsUTF8(); + this._onByte = this._collectHeaders; + return; + } + this._consumeByte(byte); + } + _collectHeaders(byte) { + if (byte === CR) return; + if (byte === LF) { + this._setupCollectBody(); + return; + } + this._onByte = this._collectHeaderKey; + this._reinjectByte(byte); + } + _reinjectByte(byte) { + this._onByte(byte); + } + _collectHeaderKey(byte) { + if (byte === COLON) { + this._headerKey = this._consumeTokenAsUTF8(); + this._onByte = this._collectHeaderValue; + return; + } + this._consumeByte(byte); + } + _collectHeaderValue(byte) { + if (byte === CR) return; + if (byte === LF) { + this._results.headers.push([this._headerKey, this._consumeTokenAsUTF8()]); + this._headerKey = void 0; + this._onByte = this._collectHeaders; + return; + } + this._consumeByte(byte); + } + _setupCollectBody() { + const contentLengthHeader = this._results.headers.filter((header) => { + return header[0] === "content-length"; + })[0]; + if (contentLengthHeader) { + this._bodyBytesRemaining = parseInt(contentLengthHeader[1], 10); + this._onByte = this._collectBodyFixedSize; + } else this._onByte = this._collectBodyNullTerminated; + } + _collectBodyNullTerminated(byte) { + if (byte === NULL) { + this._retrievedBody(); + return; + } + this._consumeByte(byte); + } + _collectBodyFixedSize(byte) { + if (this._bodyBytesRemaining-- === 0) { + this._retrievedBody(); + return; + } + this._consumeByte(byte); + } + _retrievedBody() { + this._results.binaryBody = this._consumeTokenAsRaw(); + try { + this.onFrame(this._results); + } catch (e) { + console.log(`Ignoring an exception thrown by a frame handler. Original exception: `, e); + } + this._initState(); + } + _consumeByte(byte) { + this._token.push(byte); + } + _consumeTokenAsUTF8() { + return this._decoder.decode(this._consumeTokenAsRaw()); + } + _consumeTokenAsRaw() { + const rawResult = new Uint8Array(this._token); + this._token = []; + return rawResult; + } + _initState() { + this._results = { + command: void 0, + headers: [], + binaryBody: void 0 + }; + this._token = []; + this._headerKey = void 0; + this._onByte = this._collectFrame; + } + } + /** + * Possible states for the IStompSocket + */ + exports$1.StompSocketState = void 0; + (function(StompSocketState) { + StompSocketState[StompSocketState["CONNECTING"] = 0] = "CONNECTING"; + StompSocketState[StompSocketState["OPEN"] = 1] = "OPEN"; + StompSocketState[StompSocketState["CLOSING"] = 2] = "CLOSING"; + StompSocketState[StompSocketState["CLOSED"] = 3] = "CLOSED"; + })(exports$1.StompSocketState || (exports$1.StompSocketState = {})); + /** + * Possible activation state + */ + exports$1.ActivationState = void 0; + (function(ActivationState) { + ActivationState[ActivationState["ACTIVE"] = 0] = "ACTIVE"; + ActivationState[ActivationState["DEACTIVATING"] = 1] = "DEACTIVATING"; + ActivationState[ActivationState["INACTIVE"] = 2] = "INACTIVE"; + })(exports$1.ActivationState || (exports$1.ActivationState = {})); + /** + * Possible reconnection wait time modes + */ + exports$1.ReconnectionTimeMode = void 0; + (function(ReconnectionTimeMode) { + ReconnectionTimeMode[ReconnectionTimeMode["LINEAR"] = 0] = "LINEAR"; + ReconnectionTimeMode[ReconnectionTimeMode["EXPONENTIAL"] = 1] = "EXPONENTIAL"; + })(exports$1.ReconnectionTimeMode || (exports$1.ReconnectionTimeMode = {})); + /** + * Possible ticker strategies for outgoing heartbeat ping + */ + exports$1.TickerStrategy = void 0; + (function(TickerStrategy) { + TickerStrategy["Interval"] = "interval"; + TickerStrategy["Worker"] = "worker"; + })(exports$1.TickerStrategy || (exports$1.TickerStrategy = {})); + class Ticker { + constructor(_interval, _strategy = exports$1.TickerStrategy.Interval, _debug) { + this._interval = _interval; + this._strategy = _strategy; + this._debug = _debug; + this._workerScript = ` + var startTime = Date.now(); + setInterval(function() { + self.postMessage(Date.now() - startTime); + }, ${this._interval}); + `; + } + start(tick) { + this.stop(); + if (this.shouldUseWorker()) this.runWorker(tick); + else this.runInterval(tick); + } + stop() { + this.disposeWorker(); + this.disposeInterval(); + } + shouldUseWorker() { + return typeof Worker !== "undefined" && this._strategy === exports$1.TickerStrategy.Worker; + } + runWorker(tick) { + this._debug("Using runWorker for outgoing pings"); + if (!this._worker) { + this._worker = new Worker(URL.createObjectURL(new Blob([this._workerScript], { type: "text/javascript" }))); + this._worker.onmessage = (message) => tick(message.data); + } + } + runInterval(tick) { + this._debug("Using runInterval for outgoing pings"); + if (!this._timer) { + const startTime = Date.now(); + this._timer = setInterval(() => { + tick(Date.now() - startTime); + }, this._interval); + } + } + disposeWorker() { + if (this._worker) { + this._worker.terminate(); + delete this._worker; + this._debug("Outgoing ping disposeWorker"); + } + } + disposeInterval() { + if (this._timer) { + clearInterval(this._timer); + delete this._timer; + this._debug("Outgoing ping disposeInterval"); + } + } + } + /** + * Supported STOMP versions + * + * Part of `@stomp/stompjs`. + */ + class Versions { + /** + * Takes an array of versions, typical elements '1.2', '1.1', or '1.0' + * + * You will be creating an instance of this class if you want to override + * supported versions to be declared during STOMP handshake. + */ + constructor(versions) { + this.versions = versions; + } + /** + * Used as part of CONNECT STOMP Frame + */ + supportedVersions() { + return this.versions.join(","); + } + /** + * Used while creating a WebSocket + */ + protocolVersions() { + return this.versions.map((x) => `v${x.replace(".", "")}.stomp`); + } + } + /** + * Indicates protocol version 1.0 + */ + Versions.V1_0 = "1.0"; + /** + * Indicates protocol version 1.1 + */ + Versions.V1_1 = "1.1"; + /** + * Indicates protocol version 1.2 + */ + Versions.V1_2 = "1.2"; + /** + * @internal + */ + Versions.default = new Versions([ + Versions.V1_2, + Versions.V1_1, + Versions.V1_0 + ]); + /** + * The STOMP protocol handler + * + * Part of `@stomp/stompjs`. + * + * @internal + */ + class StompHandler { + get connectedVersion() { + return this._connectedVersion; + } + get connected() { + return this._connected; + } + constructor(_client, _webSocket, config) { + this._client = _client; + this._webSocket = _webSocket; + this._connected = false; + this._serverFrameHandlers = { + CONNECTED: (frame) => { + this.debug(`connected to server ${frame.headers.server}`); + this._connected = true; + this._connectedVersion = frame.headers.version; + if (this._connectedVersion === Versions.V1_2) this._escapeHeaderValues = true; + this._setupHeartbeat(frame.headers); + this.onConnect(frame); + }, + MESSAGE: (frame) => { + const subscription = frame.headers.subscription; + const onReceive = this._subscriptions[subscription] || this.onUnhandledMessage; + const message = frame; + const client = this; + const messageId = this._connectedVersion === Versions.V1_2 ? message.headers.ack : message.headers["message-id"]; + message.ack = (headers = {}) => { + return client.ack(messageId, subscription, headers); + }; + message.nack = (headers = {}) => { + return client.nack(messageId, subscription, headers); + }; + onReceive(message); + }, + RECEIPT: (frame) => { + const callback = this._receiptWatchers[frame.headers["receipt-id"]]; + if (callback) { + callback(frame); + delete this._receiptWatchers[frame.headers["receipt-id"]]; + } else this.onUnhandledReceipt(frame); + }, + ERROR: (frame) => { + this.onStompError(frame); + } + }; + this._counter = 0; + this._subscriptions = {}; + this._receiptWatchers = {}; + this._partialData = ""; + this._escapeHeaderValues = false; + this._lastServerActivityTS = Date.now(); + this.debug = config.debug; + this.stompVersions = config.stompVersions; + this.connectHeaders = config.connectHeaders; + this.disconnectHeaders = config.disconnectHeaders; + this.heartbeatIncoming = config.heartbeatIncoming; + this.heartbeatToleranceMultiplier = config.heartbeatGracePeriods; + this.heartbeatOutgoing = config.heartbeatOutgoing; + this.splitLargeFrames = config.splitLargeFrames; + this.maxWebSocketChunkSize = config.maxWebSocketChunkSize; + this.forceBinaryWSFrames = config.forceBinaryWSFrames; + this.logRawCommunication = config.logRawCommunication; + this.appendMissingNULLonIncoming = config.appendMissingNULLonIncoming; + this.discardWebsocketOnCommFailure = config.discardWebsocketOnCommFailure; + this.onConnect = config.onConnect; + this.onDisconnect = config.onDisconnect; + this.onStompError = config.onStompError; + this.onWebSocketClose = config.onWebSocketClose; + this.onWebSocketError = config.onWebSocketError; + this.onUnhandledMessage = config.onUnhandledMessage; + this.onUnhandledReceipt = config.onUnhandledReceipt; + this.onUnhandledFrame = config.onUnhandledFrame; + this.onHeartbeatReceived = config.onHeartbeatReceived; + this.onHeartbeatLost = config.onHeartbeatLost; + } + start() { + const parser = new Parser((rawFrame) => { + const frame = FrameImpl.fromRawFrame(rawFrame, this._escapeHeaderValues); + if (!this.logRawCommunication) this.debug(`<<< ${frame}`); + (this._serverFrameHandlers[frame.command] || this.onUnhandledFrame)(frame); + }, () => { + this.debug("<<< PONG"); + this.onHeartbeatReceived(); + }); + this._webSocket.onmessage = (evt) => { + this.debug("Received data"); + this._lastServerActivityTS = Date.now(); + if (this.logRawCommunication) { + const rawChunkAsString = evt.data instanceof ArrayBuffer ? new TextDecoder().decode(evt.data) : evt.data; + this.debug(`<<< ${rawChunkAsString}`); + } + parser.parseChunk(evt.data, this.appendMissingNULLonIncoming); + }; + this._webSocket.onclose = (closeEvent) => { + this.debug(`Connection closed to ${this._webSocket.url}`); + this._cleanUp(); + this.onWebSocketClose(closeEvent); + }; + this._webSocket.onerror = (errorEvent) => { + this.onWebSocketError(errorEvent); + }; + const onOpen = () => { + const connectHeaders = Object.assign({}, this.connectHeaders); + this.debug("Web Socket Opened..."); + connectHeaders["accept-version"] = this.stompVersions.supportedVersions(); + connectHeaders["heart-beat"] = [this.heartbeatOutgoing, this.heartbeatIncoming].join(","); + this._transmit({ + command: "CONNECT", + headers: connectHeaders + }); + }; + if (this._webSocket.readyState === exports$1.StompSocketState.OPEN) onOpen(); + else this._webSocket.onopen = onOpen; + } + _setupHeartbeat(headers) { + if (headers.version !== Versions.V1_1 && headers.version !== Versions.V1_2) return; + if (!headers["heart-beat"]) return; + const [serverOutgoing, serverIncoming] = headers["heart-beat"].split(",").map((v) => parseInt(v, 10)); + if (this.heartbeatOutgoing !== 0 && serverIncoming !== 0) { + const ttl = Math.max(this.heartbeatOutgoing, serverIncoming); + this.debug(`send PING every ${ttl}ms`); + this._pinger = new Ticker(ttl, this._client.heartbeatStrategy, this.debug); + this._pinger.start(() => { + if (this._webSocket.readyState === exports$1.StompSocketState.OPEN) { + this._webSocket.send(BYTE.LF); + this.debug(">>> PING"); + } + }); + } + if (this.heartbeatIncoming !== 0 && serverOutgoing !== 0) { + const ttl = Math.max(this.heartbeatIncoming, serverOutgoing); + this.debug(`check PONG every ${ttl}ms`); + this._ponger = setInterval(() => { + const delta = Date.now() - this._lastServerActivityTS; + if (delta > ttl * this.heartbeatToleranceMultiplier) { + this.debug(`did not receive server activity for the last ${delta}ms`); + this.onHeartbeatLost(); + this._closeOrDiscardWebsocket(); + } + }, ttl); + } + } + _closeOrDiscardWebsocket() { + if (this.discardWebsocketOnCommFailure) { + this.debug("Discarding websocket, the underlying socket may linger for a while"); + this.discardWebsocket(); + } else { + this.debug("Issuing close on the websocket"); + this._closeWebsocket(); + } + } + forceDisconnect() { + if (this._webSocket) { + if (this._webSocket.readyState === exports$1.StompSocketState.CONNECTING || this._webSocket.readyState === exports$1.StompSocketState.OPEN) this._closeOrDiscardWebsocket(); + } + } + _closeWebsocket() { + this._webSocket.onmessage = () => {}; + this._webSocket.close(); + } + discardWebsocket() { + if (typeof this._webSocket.terminate !== "function") augmentWebsocket(this._webSocket, (msg) => this.debug(msg)); + this._webSocket.terminate(); + } + _transmit(params) { + const { command, headers, body, binaryBody, skipContentLengthHeader } = params; + const frame = new FrameImpl({ + command, + headers, + body, + binaryBody, + escapeHeaderValues: this._escapeHeaderValues, + skipContentLengthHeader + }); + let rawChunk = frame.serialize(); + if (this.logRawCommunication) this.debug(`>>> ${rawChunk}`); + else this.debug(`>>> ${frame}`); + if (this.forceBinaryWSFrames && typeof rawChunk === "string") rawChunk = new TextEncoder().encode(rawChunk); + if (typeof rawChunk !== "string" || !this.splitLargeFrames) this._webSocket.send(rawChunk); + else { + let out = rawChunk; + while (out.length > 0) { + const chunk = out.substring(0, this.maxWebSocketChunkSize); + out = out.substring(this.maxWebSocketChunkSize); + this._webSocket.send(chunk); + this.debug(`chunk sent = ${chunk.length}, remaining = ${out.length}`); + } + } + } + dispose() { + if (this.connected) try { + const disconnectHeaders = Object.assign({}, this.disconnectHeaders); + if (!disconnectHeaders.receipt) disconnectHeaders.receipt = `close-${this._counter++}`; + this.watchForReceipt(disconnectHeaders.receipt, (frame) => { + this._closeWebsocket(); + this._cleanUp(); + this.onDisconnect(frame); + }); + this._transmit({ + command: "DISCONNECT", + headers: disconnectHeaders + }); + } catch (error) { + this.debug(`Ignoring error during disconnect ${error}`); + } + else if (this._webSocket.readyState === exports$1.StompSocketState.CONNECTING || this._webSocket.readyState === exports$1.StompSocketState.OPEN) this._closeWebsocket(); + } + _cleanUp() { + this._connected = false; + if (this._pinger) { + this._pinger.stop(); + this._pinger = void 0; + } + if (this._ponger) { + clearInterval(this._ponger); + this._ponger = void 0; + } + } + publish(params) { + const { destination, headers, body, binaryBody, skipContentLengthHeader } = params; + const hdrs = Object.assign({ destination }, headers); + this._transmit({ + command: "SEND", + headers: hdrs, + body, + binaryBody, + skipContentLengthHeader + }); + } + watchForReceipt(receiptId, callback) { + this._receiptWatchers[receiptId] = callback; + } + subscribe(destination, callback, headers = {}) { + headers = Object.assign({}, headers); + if (!headers.id) headers.id = `sub-${this._counter++}`; + headers.destination = destination; + this._subscriptions[headers.id] = callback; + this._transmit({ + command: "SUBSCRIBE", + headers + }); + const client = this; + return { + id: headers.id, + unsubscribe(hdrs) { + return client.unsubscribe(headers.id, hdrs); + } + }; + } + unsubscribe(id, headers = {}) { + headers = Object.assign({}, headers); + delete this._subscriptions[id]; + headers.id = id; + this._transmit({ + command: "UNSUBSCRIBE", + headers + }); + } + begin(transactionId) { + const txId = transactionId || `tx-${this._counter++}`; + this._transmit({ + command: "BEGIN", + headers: { transaction: txId } + }); + const client = this; + return { + id: txId, + commit() { + client.commit(txId); + }, + abort() { + client.abort(txId); + } + }; + } + commit(transactionId) { + this._transmit({ + command: "COMMIT", + headers: { transaction: transactionId } + }); + } + abort(transactionId) { + this._transmit({ + command: "ABORT", + headers: { transaction: transactionId } + }); + } + ack(messageId, subscriptionId, headers = {}) { + headers = Object.assign({}, headers); + if (this._connectedVersion === Versions.V1_2) headers.id = messageId; + else headers["message-id"] = messageId; + headers.subscription = subscriptionId; + this._transmit({ + command: "ACK", + headers + }); + } + nack(messageId, subscriptionId, headers = {}) { + headers = Object.assign({}, headers); + if (this._connectedVersion === Versions.V1_2) headers.id = messageId; + else headers["message-id"] = messageId; + headers.subscription = subscriptionId; + return this._transmit({ + command: "NACK", + headers + }); + } + } + /** + * STOMP Client Class. + * + * Part of `@stomp/stompjs`. + * + * This class provides a robust implementation for connecting to and interacting with a + * STOMP-compliant messaging broker over WebSocket. It supports STOMP versions 1.2, 1.1, and 1.0. + * + * Features: + * - Handles automatic reconnections. + * - Supports heartbeat mechanisms to detect and report communication failures. + * - Allows customization of connection and WebSocket behaviors through configurations. + * - Compatible with both browser environments and Node.js with polyfill support for WebSocket. + */ + class Client { + /** + * Provides access to the underlying WebSocket instance. + * This property is **read-only**. + * + * Example: + * ```javascript + * const webSocket = client.webSocket; + * if (webSocket) { + * console.log('WebSocket is connected:', webSocket.readyState === WebSocket.OPEN); + * } + * ``` + * + * **Caution:** + * Directly interacting with the WebSocket instance (e.g., sending or receiving frames) + * can interfere with the proper functioning of this library. Such actions may cause + * unexpected behavior, disconnections, or invalid state in the library's internal mechanisms. + * + * Instead, use the library's provided methods to manage STOMP communication. + * + * @returns The WebSocket instance used by the STOMP handler, or `undefined` if not connected. + */ + get webSocket() { + return this._stompHandler?._webSocket; + } + /** + * Allows customization of the disconnection headers. + * + * Any changes made during an active session will also be applied immediately. + * + * Example: + * ```javascript + * client.disconnectHeaders = { + * receipt: 'custom-receipt-id' + * }; + * ``` + */ + get disconnectHeaders() { + return this._disconnectHeaders; + } + set disconnectHeaders(value) { + this._disconnectHeaders = value; + if (this._stompHandler) this._stompHandler.disconnectHeaders = this._disconnectHeaders; + } + /** + * Indicates whether there is an active connection to the STOMP broker. + * + * Usage: + * ```javascript + * if (client.connected) { + * console.log('Client is connected to the broker.'); + * } else { + * console.log('No connection to the broker.'); + * } + * ``` + * + * @returns `true` if the client is currently connected, `false` otherwise. + */ + get connected() { + return !!this._stompHandler && this._stompHandler.connected; + } + /** + * The version of the STOMP protocol negotiated with the server during connection. + * + * This is a **read-only** property and reflects the negotiated protocol version after + * a successful connection. + * + * Example: + * ```javascript + * console.log('Connected STOMP version:', client.connectedVersion); + * ``` + * + * @returns The negotiated STOMP protocol version or `undefined` if not connected. + */ + get connectedVersion() { + return this._stompHandler ? this._stompHandler.connectedVersion : void 0; + } + /** + * Indicates whether the client is currently active. + * + * A client is considered active if it is connected or actively attempting to reconnect. + * + * Example: + * ```javascript + * if (client.active) { + * console.log('The client is active.'); + * } else { + * console.log('The client is inactive.'); + * } + * ``` + * + * @returns `true` if the client is active, otherwise `false`. + */ + get active() { + return this.state === exports$1.ActivationState.ACTIVE; + } + _changeState(state) { + this.state = state; + this.onChangeState(state); + } + /** + * Constructs a new STOMP client instance. + * + * The constructor initializes default values and sets up no-op callbacks for all events. + * Configuration can be passed during construction, or updated later using `configure`. + * + * Example: + * ```javascript + * const client = new Client({ + * brokerURL: 'wss://broker.example.com', + * reconnectDelay: 5000 + * }); + * ``` + * + * @param conf Optional configuration object to initialize the client with. + */ + constructor(conf = {}) { + /** + * STOMP protocol versions to use during the handshake. By default, the client will attempt + * versions `1.2`, `1.1`, and `1.0` in descending order of preference. + * + * Example: + * ```javascript + * // Configure the client to only use versions 1.1 and 1.0 + * client.stompVersions = new Versions(['1.1', '1.0']); + * ``` + */ + this.stompVersions = Versions.default; + /** + * Timeout for establishing STOMP connection, in milliseconds. + * + * If the connection is not established within this period, the attempt will fail. + * The default is `0`, meaning no timeout is set for connection attempts. + * + * Example: + * ```javascript + * client.connectionTimeout = 5000; // Fail connection if not established in 5 seconds + * ``` + */ + this.connectionTimeout = 0; + /** + * Delay (in milliseconds) between reconnection attempts if the connection drops. + * + * Set to `0` to disable automatic reconnections. The default value is `5000` ms (5 seconds). + * + * Example: + * ```javascript + * client.reconnectDelay = 3000; // Attempt reconnection every 3 seconds + * client.reconnectDelay = 0; // Disable automatic reconnection + * ``` + */ + this.reconnectDelay = 5e3; + /** + * The next reconnection delay, used internally. + * Initialized to the value of [Client#reconnectDelay]{@link Client#reconnectDelay}, and it may + * dynamically change based on [Client#reconnectTimeMode]{@link Client#reconnectTimeMode}. + */ + this._nextReconnectDelay = 0; + /** + * Maximum delay (in milliseconds) between reconnection attempts when using exponential backoff. + * + * Default is 15 minutes (`15 * 60 * 1000` milliseconds). If `0`, there will be no upper limit. + * + * Example: + * ```javascript + * client.maxReconnectDelay = 10000; // Maximum wait time is 10 seconds + * ``` + */ + this.maxReconnectDelay = 9e5; + /** + * Mode for determining the time interval between reconnection attempts. + * + * Available modes: + * - `ReconnectionTimeMode.LINEAR` (default): Fixed delays between reconnection attempts. + * - `ReconnectionTimeMode.EXPONENTIAL`: Delay doubles after each attempt, capped by [maxReconnectDelay]{@link Client#maxReconnectDelay}. + * + * Example: + * ```javascript + * client.reconnectTimeMode = ReconnectionTimeMode.EXPONENTIAL; + * client.reconnectDelay = 200; // Initial delay of 200 ms, doubles with each attempt + * client.maxReconnectDelay = 2 * 60 * 1000; // Cap delay at 10 minutes + * ``` + */ + this.reconnectTimeMode = exports$1.ReconnectionTimeMode.LINEAR; + /** + * Interval (in milliseconds) for receiving heartbeat signals from the server. + * + * Specifies the expected frequency of heartbeats sent by the server. Set to `0` to disable. + * + * Example: + * ```javascript + * client.heartbeatIncoming = 10000; // Expect a heartbeat every 10 seconds + * ``` + */ + this.heartbeatIncoming = 1e4; + /** + * Multiplier for adjusting tolerance when processing heartbeat signals. + * + * Tolerance level is calculated using the multiplier: + * `tolerance = heartbeatIncoming * heartbeatToleranceMultiplier`. + * This helps account for delays in network communication or variations in timings. + * + * Default value is `2`. + * + * Example: + * ```javascript + * client.heartbeatToleranceMultiplier = 2.5; // Tolerates longer delays + * ``` + */ + this.heartbeatToleranceMultiplier = 2; + /** + * Interval (in milliseconds) for sending heartbeat signals to the server. + * + * Specifies how frequently heartbeats should be sent to the server. Set to `0` to disable. + * + * Example: + * ```javascript + * client.heartbeatOutgoing = 5000; // Send a heartbeat every 5 seconds + * ``` + */ + this.heartbeatOutgoing = 1e4; + /** + * Strategy for sending outgoing heartbeats. + * + * Options: + * - `TickerStrategy.Worker`: Uses Web Workers for sending heartbeats (recommended for long-running or background sessions). + * - `TickerStrategy.Interval`: Uses standard JavaScript `setInterval` (default). + * + * Note: + * - If Web Workers are unavailable (e.g., in Node.js), the `Interval` strategy is used automatically. + * - Web Workers are preferable in browsers for reducing disconnects when tabs are in the background. + * + * Example: + * ```javascript + * client.heartbeatStrategy = TickerStrategy.Worker; + * ``` + */ + this.heartbeatStrategy = exports$1.TickerStrategy.Interval; + /** + * Enables splitting of large text WebSocket frames into smaller chunks. + * + * This setting is enabled for brokers that support only chunked messages (e.g., Java Spring-based brokers). + * Default is `false`. + * + * Warning: + * - Should not be used with WebSocket-compliant brokers, as chunking may cause large message failures. + * - Binary WebSocket frames are never split. + * + * Example: + * ```javascript + * client.splitLargeFrames = true; + * client.maxWebSocketChunkSize = 4096; // Allow chunks of 4 KB + * ``` + */ + this.splitLargeFrames = false; + /** + * Maximum size (in bytes) for individual WebSocket chunks if [splitLargeFrames]{@link Client#splitLargeFrames} is enabled. + * + * Default is 8 KB (`8 * 1024` bytes). This value has no effect if [splitLargeFrames]{@link Client#splitLargeFrames} is `false`. + */ + this.maxWebSocketChunkSize = 8192; + /** + * Forces all WebSocket frames to use binary transport, irrespective of payload type. + * + * Default behavior determines frame type based on payload (e.g., binary data for ArrayBuffers). + * + * Example: + * ```javascript + * client.forceBinaryWSFrames = true; + * ``` + */ + this.forceBinaryWSFrames = false; + /** + * Workaround for a React Native WebSocket bug, where messages containing `NULL` are chopped. + * + * Enabling this appends a `NULL` character to incoming frames to ensure they remain valid STOMP packets. + * + * Warning: + * - For brokers that split large messages, this may cause data loss or connection termination. + * + * Example: + * ```javascript + * client.appendMissingNULLonIncoming = true; + * ``` + */ + this.appendMissingNULLonIncoming = false; + /** + * Instruct the library to immediately terminate the socket on communication failures, even + * before the WebSocket is completely closed. + * + * This is particularly useful in browser environments where WebSocket closure may get delayed, + * causing prolonged reconnection intervals under certain failure conditions. + * + * + * Example: + * ```javascript + * client.discardWebsocketOnCommFailure = true; // Enable aggressive closing of WebSocket + * ``` + * + * Default value: `false`. + */ + this.discardWebsocketOnCommFailure = false; + /** + * Current activation state of the client. + * + * Possible states: + * - `ActivationState.ACTIVE`: Client is connected or actively attempting to connect. + * - `ActivationState.INACTIVE`: Client is disconnected and not attempting to reconnect. + * - `ActivationState.DEACTIVATING`: Client is in the process of disconnecting. + * + * Note: The client may transition directly from `ACTIVE` to `INACTIVE` without entering + * the `DEACTIVATING` state. + */ + this.state = exports$1.ActivationState.INACTIVE; + const noOp = () => {}; + this.debug = noOp; + this.beforeConnect = noOp; + this.onConnect = noOp; + this.onDisconnect = noOp; + this.onUnhandledMessage = noOp; + this.onUnhandledReceipt = noOp; + this.onUnhandledFrame = noOp; + this.onHeartbeatReceived = noOp; + this.onHeartbeatLost = noOp; + this.onStompError = noOp; + this.onWebSocketClose = noOp; + this.onWebSocketError = noOp; + this.logRawCommunication = false; + this.onChangeState = noOp; + this.connectHeaders = {}; + this._disconnectHeaders = {}; + this.configure(conf); + } + /** + * Updates the client's configuration. + * + * All properties in the provided configuration object will override the current settings. + * + * Additionally, a warning is logged if `maxReconnectDelay` is configured to a + * value lower than `reconnectDelay`, and `maxReconnectDelay` is adjusted to match `reconnectDelay`. + * + * Example: + * ```javascript + * client.configure({ + * reconnectDelay: 3000, + * maxReconnectDelay: 10000 + * }); + * ``` + * + * @param conf Configuration object containing the new settings. + */ + configure(conf) { + Object.assign(this, conf); + if (this.maxReconnectDelay > 0 && this.maxReconnectDelay < this.reconnectDelay) { + this.debug(`Warning: maxReconnectDelay (${this.maxReconnectDelay}ms) is less than reconnectDelay (${this.reconnectDelay}ms). Using reconnectDelay as the maxReconnectDelay delay.`); + this.maxReconnectDelay = this.reconnectDelay; + } + } + /** + * Activates the client, initiating a connection to the STOMP broker. + * + * On activation, the client attempts to connect and sets its state to `ACTIVE`. If the connection + * is lost, it will automatically retry based on `reconnectDelay` or `maxReconnectDelay`. If + * `reconnectTimeMode` is set to `EXPONENTIAL`, the reconnect delay increases exponentially. + * + * To stop reconnection attempts and disconnect, call [Client#deactivate]{@link Client#deactivate}. + * + * Example: + * ```javascript + * client.activate(); // Connect to the broker + * ``` + * + * If the client is currently `DEACTIVATING`, connection is delayed until the deactivation process completes. + */ + activate() { + const _activate = () => { + if (this.active) { + this.debug("Already ACTIVE, ignoring request to activate"); + return; + } + this._changeState(exports$1.ActivationState.ACTIVE); + this._nextReconnectDelay = this.reconnectDelay; + this._connect(); + }; + if (this.state === exports$1.ActivationState.DEACTIVATING) { + this.debug("Waiting for deactivation to finish before activating"); + this.deactivate().then(() => { + _activate(); + }); + } else _activate(); + } + async _connect() { + await this.beforeConnect(this); + if (this._stompHandler) { + this.debug("There is already a stompHandler, skipping the call to connect"); + return; + } + if (!this.active) { + this.debug("Client has been marked inactive, will not attempt to connect"); + return; + } + if (this.connectionTimeout > 0) { + if (this._connectionWatcher) clearTimeout(this._connectionWatcher); + this._connectionWatcher = setTimeout(() => { + if (this.connected) return; + this.debug(`Connection not established in ${this.connectionTimeout}ms, closing socket`); + this.forceDisconnect(); + }, this.connectionTimeout); + } + this.debug("Opening Web Socket..."); + const webSocket = this._createWebSocket(); + this._stompHandler = new StompHandler(this, webSocket, { + debug: this.debug, + stompVersions: this.stompVersions, + connectHeaders: this.connectHeaders, + disconnectHeaders: this._disconnectHeaders, + heartbeatIncoming: this.heartbeatIncoming, + heartbeatGracePeriods: this.heartbeatToleranceMultiplier, + heartbeatOutgoing: this.heartbeatOutgoing, + heartbeatStrategy: this.heartbeatStrategy, + splitLargeFrames: this.splitLargeFrames, + maxWebSocketChunkSize: this.maxWebSocketChunkSize, + forceBinaryWSFrames: this.forceBinaryWSFrames, + logRawCommunication: this.logRawCommunication, + appendMissingNULLonIncoming: this.appendMissingNULLonIncoming, + discardWebsocketOnCommFailure: this.discardWebsocketOnCommFailure, + onConnect: (frame) => { + if (this._connectionWatcher) { + clearTimeout(this._connectionWatcher); + this._connectionWatcher = void 0; + } + this._nextReconnectDelay = this.reconnectDelay; + if (!this.active) { + this.debug("STOMP got connected while deactivate was issued, will disconnect now"); + this._disposeStompHandler(); + return; + } + this.onConnect(frame); + }, + onDisconnect: (frame) => { + this.onDisconnect(frame); + }, + onStompError: (frame) => { + this.onStompError(frame); + }, + onWebSocketClose: (evt) => { + this._stompHandler = void 0; + if (this.state === exports$1.ActivationState.DEACTIVATING) this._changeState(exports$1.ActivationState.INACTIVE); + this.onWebSocketClose(evt); + if (this.active) this._schedule_reconnect(); + }, + onWebSocketError: (evt) => { + this.onWebSocketError(evt); + }, + onUnhandledMessage: (message) => { + this.onUnhandledMessage(message); + }, + onUnhandledReceipt: (frame) => { + this.onUnhandledReceipt(frame); + }, + onUnhandledFrame: (frame) => { + this.onUnhandledFrame(frame); + }, + onHeartbeatReceived: () => { + this.onHeartbeatReceived(); + }, + onHeartbeatLost: () => { + this.onHeartbeatLost(); + } + }); + this._stompHandler.start(); + } + _createWebSocket() { + let webSocket; + if (this.webSocketFactory) webSocket = this.webSocketFactory(); + else if (this.brokerURL) webSocket = new WebSocket(this.brokerURL, this.stompVersions.protocolVersions()); + else throw new Error("Either brokerURL or webSocketFactory must be provided"); + webSocket.binaryType = "arraybuffer"; + return webSocket; + } + _schedule_reconnect() { + if (this._nextReconnectDelay > 0) { + this.debug(`STOMP: scheduling reconnection in ${this._nextReconnectDelay}ms`); + this._reconnector = setTimeout(() => { + if (this.reconnectTimeMode === exports$1.ReconnectionTimeMode.EXPONENTIAL) { + this._nextReconnectDelay = this._nextReconnectDelay * 2; + if (this.maxReconnectDelay !== 0) this._nextReconnectDelay = Math.min(this._nextReconnectDelay, this.maxReconnectDelay); + } + this._connect(); + }, this._nextReconnectDelay); + } + } + /** + * Disconnects the client and stops the automatic reconnection loop. + * + * If there is an active STOMP connection at the time of invocation, the appropriate callbacks + * will be triggered during the shutdown sequence. Once deactivated, the client will enter the + * `INACTIVE` state, and no further reconnection attempts will be made. + * + * **Behavior**: + * - If there is no active WebSocket connection, this method resolves immediately. + * - If there is an active connection, the method waits for the underlying WebSocket + * to properly close before resolving. + * - Multiple calls to this method are safe. Each invocation resolves upon completion. + * - To reactivate, call [Client#activate]{@link Client#activate}. + * + * **Experimental Option:** + * - By specifying the `force: true` option, the WebSocket connection is discarded immediately, + * bypassing both the STOMP and WebSocket shutdown sequences. + * - **Caution:** Using `force: true` may leave the WebSocket in an inconsistent state, + * and brokers may not immediately detect the termination. + * + * Example: + * ```javascript + * // Graceful disconnect + * await client.deactivate(); + * + * // Forced disconnect to speed up shutdown when the connection is stale + * await client.deactivate({ force: true }); + * ``` + * + * @param options Configuration options for deactivation. Use `force: true` for immediate shutdown. + * @returns A Promise that resolves when the deactivation process completes. + */ + async deactivate(options = {}) { + const force = options.force || false; + const needToDispose = this.active; + let retPromise; + if (this.state === exports$1.ActivationState.INACTIVE) { + this.debug(`Already INACTIVE, nothing more to do`); + return Promise.resolve(); + } + this._changeState(exports$1.ActivationState.DEACTIVATING); + this._nextReconnectDelay = 0; + if (this._reconnector) { + clearTimeout(this._reconnector); + this._reconnector = void 0; + } + if (this._stompHandler && this.webSocket.readyState !== exports$1.StompSocketState.CLOSED) { + const origOnWebSocketClose = this._stompHandler.onWebSocketClose; + retPromise = new Promise((resolve, reject) => { + this._stompHandler.onWebSocketClose = (evt) => { + origOnWebSocketClose(evt); + resolve(); + }; + }); + } else { + this._changeState(exports$1.ActivationState.INACTIVE); + return Promise.resolve(); + } + if (force) this._stompHandler?.discardWebsocket(); + else if (needToDispose) this._disposeStompHandler(); + return retPromise; + } + /** + * Forces a disconnect by directly closing the WebSocket. + * + * Unlike a normal disconnect, this does not send a DISCONNECT sequence to the broker but + * instead closes the WebSocket connection directly. After forcing a disconnect, the client + * will automatically attempt to reconnect based on its `reconnectDelay` configuration. + * + * **Note:** To prevent further reconnect attempts, call [Client#deactivate]{@link Client#deactivate}. + * + * Example: + * ```javascript + * client.forceDisconnect(); + * ``` + */ + forceDisconnect() { + if (this._stompHandler) this._stompHandler.forceDisconnect(); + } + _disposeStompHandler() { + if (this._stompHandler) this._stompHandler.dispose(); + } + /** + * Sends a message to the specified destination on the STOMP broker. + * + * The `body` must be a `string`. For non-string payloads (e.g., JSON), encode it as a string before sending. + * If sending binary data, use the `binaryBody` parameter as a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array). + * + * **Content-Length Behavior**: + * - For non-binary messages, the `content-length` header is added by default. + * - The `content-length` header can be skipped for text frames by setting `skipContentLengthHeader: true` in the parameters. + * - For binary messages, the `content-length` header is always included. + * + * **Notes**: + * - Ensure that brokers support binary frames before using `binaryBody`. + * - Sending messages with NULL octets and missing `content-length` headers can cause brokers to disconnect and throw errors. + * + * Example: + * ```javascript + * // Basic text message + * client.publish({ destination: "/queue/test", body: "Hello, STOMP" }); + * + * // Text message with additional headers + * client.publish({ destination: "/queue/test", headers: { priority: 9 }, body: "Hello, STOMP" }); + * + * // Skip content-length header + * client.publish({ destination: "/queue/test", body: "Hello, STOMP", skipContentLengthHeader: true }); + * + * // Binary message + * const binaryData = new Uint8Array([1, 2, 3, 4]); + * client.publish({ + * destination: '/topic/special', + * binaryBody: binaryData, + * headers: { 'content-type': 'application/octet-stream' } + * }); + * ``` + */ + publish(params) { + this._checkConnection(); + this._stompHandler.publish(params); + } + _checkConnection() { + if (!this.connected) throw new TypeError("There is no underlying STOMP connection"); + } + /** + * Monitors for a receipt acknowledgment from the broker for specific operations. + * + * Add a `receipt` header to the operation (like subscribe or publish), and use this method with + * the same receipt ID to detect when the broker has acknowledged the operation's completion. + * + * The callback is invoked with the corresponding {@link IFrame} when the receipt is received. + * + * Example: + * ```javascript + * const receiptId = "unique-receipt-id"; + * + * client.watchForReceipt(receiptId, (frame) => { + * console.log("Operation acknowledged by the broker:", frame); + * }); + * + * // Attach the receipt header to an operation + * client.publish({ destination: "/queue/test", headers: { receipt: receiptId }, body: "Hello" }); + * ``` + * + * @param receiptId Unique identifier for the receipt. + * @param callback Callback function invoked on receiving the RECEIPT frame. + */ + watchForReceipt(receiptId, callback) { + this._checkConnection(); + this._stompHandler.watchForReceipt(receiptId, callback); + } + /** + * Subscribes to a destination on the STOMP broker. + * + * The callback is triggered for each message received from the subscribed destination. The message + * is passed as an {@link IMessage} instance. + * + * **Subscription ID**: + * - If no `id` is provided in `headers`, the library generates a unique subscription ID automatically. + * - Provide an explicit `id` in `headers` if you wish to manage the subscription ID manually. + * + * Example: + * ```javascript + * const callback = (message) => { + * console.log("Received message:", message.body); + * }; + * + * // Auto-generated subscription ID + * const subscription = client.subscribe("/queue/test", callback); + * + * // Explicit subscription ID + * const mySubId = "my-subscription-id"; + * const subscription = client.subscribe("/queue/test", callback, { id: mySubId }); + * ``` + * + * @param destination Destination to subscribe to. + * @param callback Function invoked for each received message. + * @param headers Optional headers for subscription, such as `id`. + * @returns A {@link StompSubscription} which can be used to manage the subscription. + */ + subscribe(destination, callback, headers = {}) { + this._checkConnection(); + return this._stompHandler.subscribe(destination, callback, headers); + } + /** + * Unsubscribes from a subscription on the STOMP broker. + * + * Prefer using the `unsubscribe` method directly on the {@link StompSubscription} returned from `subscribe` for cleaner management: + * ```javascript + * const subscription = client.subscribe("/queue/test", callback); + * // Unsubscribe using the subscription object + * subscription.unsubscribe(); + * ``` + * + * This method can also be used directly with the subscription ID. + * + * Example: + * ```javascript + * client.unsubscribe("my-subscription-id"); + * ``` + * + * @param id Subscription ID to unsubscribe. + * @param headers Optional headers to pass for the UNSUBSCRIBE frame. + */ + unsubscribe(id, headers = {}) { + this._checkConnection(); + this._stompHandler.unsubscribe(id, headers); + } + /** + * Starts a new transaction. The returned {@link ITransaction} object provides + * methods for [commit]{@link ITransaction#commit} and [abort]{@link ITransaction#abort}. + * + * If `transactionId` is not provided, the library generates a unique ID internally. + * + * Example: + * ```javascript + * const tx = client.begin(); // Auto-generated ID + * + * // Or explicitly specify a transaction ID + * const tx = client.begin("my-transaction-id"); + * ``` + * + * @param transactionId Optional transaction ID. + * @returns An instance of {@link ITransaction}. + */ + begin(transactionId) { + this._checkConnection(); + return this._stompHandler.begin(transactionId); + } + /** + * Commits a transaction. + * + * It is strongly recommended to call [commit]{@link ITransaction#commit} on + * the transaction object returned by [client#begin]{@link Client#begin}. + * + * Example: + * ```javascript + * const tx = client.begin(); + * // Perform operations under this transaction + * tx.commit(); + * ``` + * + * @param transactionId The ID of the transaction to commit. + */ + commit(transactionId) { + this._checkConnection(); + this._stompHandler.commit(transactionId); + } + /** + * Aborts a transaction. + * + * It is strongly recommended to call [abort]{@link ITransaction#abort} directly + * on the transaction object returned by [client#begin]{@link Client#begin}. + * + * Example: + * ```javascript + * const tx = client.begin(); + * // Perform operations under this transaction + * tx.abort(); // Abort the transaction + * ``` + * + * @param transactionId The ID of the transaction to abort. + */ + abort(transactionId) { + this._checkConnection(); + this._stompHandler.abort(transactionId); + } + /** + * Acknowledges receipt of a message. Typically, this should be done by calling + * [ack]{@link IMessage#ack} directly on the {@link IMessage} instance passed + * to the subscription callback. + * + * Example: + * ```javascript + * const callback = (message) => { + * // Process the message + * message.ack(); // Acknowledge the message + * }; + * + * client.subscribe("/queue/example", callback, { ack: "client" }); + * ``` + * + * @param messageId The ID of the message to acknowledge. + * @param subscriptionId The ID of the subscription. + * @param headers Optional headers for the acknowledgment frame. + */ + ack(messageId, subscriptionId, headers = {}) { + this._checkConnection(); + this._stompHandler.ack(messageId, subscriptionId, headers); + } + /** + * Rejects a message (negative acknowledgment). Like acknowledgments, this should + * typically be done by calling [nack]{@link IMessage#nack} directly on the {@link IMessage} + * instance passed to the subscription callback. + * + * Example: + * ```javascript + * const callback = (message) => { + * // Process the message + * if (isError(message)) { + * message.nack(); // Reject the message + * } + * }; + * + * client.subscribe("/queue/example", callback, { ack: "client" }); + * ``` + * + * @param messageId The ID of the message to negatively acknowledge. + * @param subscriptionId The ID of the subscription. + * @param headers Optional headers for the NACK frame. + */ + nack(messageId, subscriptionId, headers = {}) { + this._checkConnection(); + this._stompHandler.nack(messageId, subscriptionId, headers); + } + } + /** + * Configuration options for STOMP Client, each key corresponds to + * field by the same name in {@link Client}. This can be passed to + * the constructor of {@link Client} or to [Client#configure]{@link Client#configure}. + * + * Part of `@stomp/stompjs`. + */ + class StompConfig {} + /** + * STOMP headers. Many function calls will accept headers as parameters. + * The headers sent by Broker will be available as [IFrame#headers]{@link IFrame#headers}. + * + * `key` and `value` must be valid strings. + * In addition, `key` must not contain `CR`, `LF`, or `:`. + * + * Part of `@stomp/stompjs`. + */ + class StompHeaders {} + /** + * Part of `@stomp/stompjs`. + * + * @internal + */ + class HeartbeatInfo { + constructor(client) { + this.client = client; + } + get outgoing() { + return this.client.heartbeatOutgoing; + } + set outgoing(value) { + this.client.heartbeatOutgoing = value; + } + get incoming() { + return this.client.heartbeatIncoming; + } + set incoming(value) { + this.client.heartbeatIncoming = value; + } + } + /** + * Available for backward compatibility, please shift to using {@link Client}. + * + * **Deprecated** + * + * Part of `@stomp/stompjs`. + * + * To upgrade, please follow the [Upgrade Guide](https://stomp-js.github.io/guide/stompjs/upgrading-stompjs.html) + */ + class CompatClient extends Client { + /** + * Available for backward compatibility, please shift to using {@link Client} + * and [Client#webSocketFactory]{@link Client#webSocketFactory}. + * + * **Deprecated** + * + * @internal + */ + constructor(webSocketFactory) { + super(); + /** + * It is no op now. No longer needed. Large packets work out of the box. + */ + this.maxWebSocketFrameSize = 16384; + this._heartbeatInfo = new HeartbeatInfo(this); + this.reconnect_delay = 0; + this.webSocketFactory = webSocketFactory; + this.debug = (...message) => { + console.log(...message); + }; + } + _parseConnect(...args) { + let closeEventCallback; + let connectCallback; + let errorCallback; + let headers = {}; + if (args.length < 2) throw new Error("Connect requires at least 2 arguments"); + if (typeof args[1] === "function") [headers, connectCallback, errorCallback, closeEventCallback] = args; + else switch (args.length) { + case 6: + [headers.login, headers.passcode, connectCallback, errorCallback, closeEventCallback, headers.host] = args; + break; + default: [headers.login, headers.passcode, connectCallback, errorCallback, closeEventCallback] = args; + } + return [ + headers, + connectCallback, + errorCallback, + closeEventCallback + ]; + } + /** + * Available for backward compatibility, please shift to using [Client#activate]{@link Client#activate}. + * + * **Deprecated** + * + * The `connect` method accepts different number of arguments and types. See the Overloads list. Use the + * version with headers to pass your broker specific options. + * + * overloads: + * - connect(headers, connectCallback) + * - connect(headers, connectCallback, errorCallback) + * - connect(login, passcode, connectCallback) + * - connect(login, passcode, connectCallback, errorCallback) + * - connect(login, passcode, connectCallback, errorCallback, closeEventCallback) + * - connect(login, passcode, connectCallback, errorCallback, closeEventCallback, host) + * + * params: + * - headers, see [Client#connectHeaders]{@link Client#connectHeaders} + * - connectCallback, see [Client#onConnect]{@link Client#onConnect} + * - errorCallback, see [Client#onStompError]{@link Client#onStompError} + * - closeEventCallback, see [Client#onWebSocketClose]{@link Client#onWebSocketClose} + * - login [String], see [Client#connectHeaders](../classes/Client.html#connectHeaders) + * - passcode [String], [Client#connectHeaders](../classes/Client.html#connectHeaders) + * - host [String], see [Client#connectHeaders](../classes/Client.html#connectHeaders) + * + * To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html) + */ + connect(...args) { + const out = this._parseConnect(...args); + if (out[0]) this.connectHeaders = out[0]; + if (out[1]) this.onConnect = out[1]; + if (out[2]) this.onStompError = out[2]; + if (out[3]) this.onWebSocketClose = out[3]; + super.activate(); + } + /** + * Available for backward compatibility, please shift to using [Client#deactivate]{@link Client#deactivate}. + * + * **Deprecated** + * + * See: + * [Client#onDisconnect]{@link Client#onDisconnect}, and + * [Client#disconnectHeaders]{@link Client#disconnectHeaders} + * + * To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html) + */ + disconnect(disconnectCallback, headers = {}) { + if (disconnectCallback) this.onDisconnect = disconnectCallback; + this.disconnectHeaders = headers; + super.deactivate(); + } + /** + * Available for backward compatibility, use [Client#publish]{@link Client#publish}. + * + * Send a message to a named destination. Refer to your STOMP broker documentation for types + * and naming of destinations. The headers will, typically, be available to the subscriber. + * However, there may be special purpose headers corresponding to your STOMP broker. + * + * **Deprecated**, use [Client#publish]{@link Client#publish} + * + * Note: Body must be String. You will need to covert the payload to string in case it is not string (e.g. JSON) + * + * ```javascript + * client.send("/queue/test", {priority: 9}, "Hello, STOMP"); + * + * // If you want to send a message with a body, you must also pass the headers argument. + * client.send("/queue/test", {}, "Hello, STOMP"); + * ``` + * + * To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html) + */ + send(destination, headers = {}, body = "") { + headers = Object.assign({}, headers); + const skipContentLengthHeader = headers["content-length"] === false; + if (skipContentLengthHeader) delete headers["content-length"]; + this.publish({ + destination, + headers, + body, + skipContentLengthHeader + }); + } + /** + * Available for backward compatibility, renamed to [Client#reconnectDelay]{@link Client#reconnectDelay}. + * + * **Deprecated** + */ + set reconnect_delay(value) { + this.reconnectDelay = value; + } + /** + * Available for backward compatibility, renamed to [Client#webSocket]{@link Client#webSocket}. + * + * **Deprecated** + */ + get ws() { + return this.webSocket; + } + /** + * Available for backward compatibility, renamed to [Client#connectedVersion]{@link Client#connectedVersion}. + * + * **Deprecated** + */ + get version() { + return this.connectedVersion; + } + /** + * Available for backward compatibility, renamed to [Client#onUnhandledMessage]{@link Client#onUnhandledMessage}. + * + * **Deprecated** + */ + get onreceive() { + return this.onUnhandledMessage; + } + /** + * Available for backward compatibility, renamed to [Client#onUnhandledMessage]{@link Client#onUnhandledMessage}. + * + * **Deprecated** + */ + set onreceive(value) { + this.onUnhandledMessage = value; + } + /** + * Available for backward compatibility, renamed to [Client#onUnhandledReceipt]{@link Client#onUnhandledReceipt}. + * Prefer using [Client#watchForReceipt]{@link Client#watchForReceipt}. + * + * **Deprecated** + */ + get onreceipt() { + return this.onUnhandledReceipt; + } + /** + * Available for backward compatibility, renamed to [Client#onUnhandledReceipt]{@link Client#onUnhandledReceipt}. + * + * **Deprecated** + */ + set onreceipt(value) { + this.onUnhandledReceipt = value; + } + /** + * Available for backward compatibility, renamed to [Client#heartbeatIncoming]{@link Client#heartbeatIncoming} + * [Client#heartbeatOutgoing]{@link Client#heartbeatOutgoing}. + * + * **Deprecated** + */ + get heartbeat() { + return this._heartbeatInfo; + } + /** + * Available for backward compatibility, renamed to [Client#heartbeatIncoming]{@link Client#heartbeatIncoming} + * [Client#heartbeatOutgoing]{@link Client#heartbeatOutgoing}. + * + * **Deprecated** + */ + set heartbeat(value) { + this.heartbeatIncoming = value.incoming; + this.heartbeatOutgoing = value.outgoing; + } + } + /** + * STOMP Class, acts like a factory to create {@link Client}. + * + * Part of `@stomp/stompjs`. + * + * **Deprecated** + * + * It will be removed in next major version. Please switch to {@link Client}. + */ + class Stomp { + /** + * This method creates a WebSocket client that is connected to + * the STOMP server located at the url. + * + * ```javascript + * var url = "ws://localhost:61614/stomp"; + * var client = Stomp.client(url); + * ``` + * + * **Deprecated** + * + * It will be removed in next major version. Please switch to {@link Client} + * using [Client#brokerURL]{@link Client#brokerURL}. + */ + static client(url, protocols) { + if (protocols == null) protocols = Versions.default.protocolVersions(); + const wsFn = () => { + return new (Stomp.WebSocketClass || WebSocket)(url, protocols); + }; + return new CompatClient(wsFn); + } + /** + * This method is an alternative to [Stomp#client]{@link Stomp#client} to let the user + * specify the WebSocket to use (either a standard HTML5 WebSocket or + * a similar object). + * + * In order to support reconnection, the function Client._connect should be callable more than once. + * While reconnecting + * a new instance of underlying transport (TCP Socket, WebSocket or SockJS) will be needed. So, this function + * alternatively allows passing a function that should return a new instance of the underlying socket. + * + * ```javascript + * var client = Stomp.over(function(){ + * return new WebSocket('ws://localhost:15674/ws') + * }); + * ``` + * + * **Deprecated** + * + * It will be removed in next major version. Please switch to {@link Client} + * using [Client#webSocketFactory]{@link Client#webSocketFactory}. + */ + static over(ws) { + let wsFn; + if (typeof ws === "function") wsFn = ws; + else { + console.warn("Stomp.over did not receive a factory, auto reconnect will not work. Please see https://stomp-js.github.io/api-docs/latest/classes/Stomp.html#over"); + wsFn = () => ws; + } + return new CompatClient(wsFn); + } + } + /** + * In case you need to use a non standard class for WebSocket. + * + * For example when using within NodeJS environment: + * + * ```javascript + * StompJs = require('../../esm5/'); + * Stomp = StompJs.Stomp; + * Stomp.WebSocketClass = require('websocket').w3cwebsocket; + * ``` + * + * **Deprecated** + * + * + * It will be removed in next major version. Please switch to {@link Client} + * using [Client#webSocketFactory]{@link Client#webSocketFactory}. + */ + Stomp.WebSocketClass = null; + exports$1.Client = Client; + exports$1.CompatClient = CompatClient; + exports$1.FrameImpl = FrameImpl; + exports$1.Parser = Parser; + exports$1.Stomp = Stomp; + exports$1.StompConfig = StompConfig; + exports$1.StompHeaders = StompHeaders; + exports$1.Versions = Versions; + })); +})))(); +/** +* Connection lifecycle states for RxStomp. +* +* These states reflect the status of the underlying STOMP-over-WebSocket connection +* as well as the client's activation/deactivation lifecycle. +* +* Common usage: +* ```typescript +* rxStomp.connectionState$.subscribe((state) => { +* switch (state) { +* case RxStompState.CONNECTING: +* console.log('Attempting to connect...'); +* break; +* case RxStompState.OPEN: +* console.log('Connected'); +* break; +* case RxStompState.CLOSING: +* console.log('Disconnecting...'); +* break; +* case RxStompState.CLOSED: +* console.log('Disconnected'); +* break; +* } +* }); +* ``` +* +* Part of `@stomp/rx-stomp` +*/ +var RxStompState; +(function(RxStompState) { + /** + * A connection attempt is in progress. This includes the WebSocket opening + * and the STOMP CONNECT handshake phase. + */ + RxStompState[RxStompState["CONNECTING"] = 0] = "CONNECTING"; + /** + * The STOMP session is fully established and operational. + * Messages can be published, and subscriptions will receive messages. + */ + RxStompState[RxStompState["OPEN"] = 1] = "OPEN"; + /** + * A graceful shutdown has been requested and is underway. + * New subscriptions/publishes should be avoided during this phase. + */ + RxStompState[RxStompState["CLOSING"] = 2] = "CLOSING"; + /** + * There is no active connection to the broker. + * The client may be inactive or waiting to retry based on reconnection settings. + */ + RxStompState[RxStompState["CLOSED"] = 3] = "CLOSED"; +})(RxStompState || (RxStompState = {})); +//#endregion +//#region node_modules/@stomp/rx-stomp/esm6/rx-stomp.js +/** +* Main RxJS-friendly STOMP client for browsers and Node.js. +* +* RxStomp wraps {@link Client} from @stomp/stompjs and exposes key interactions +* (connection lifecycle, subscriptions, frames, and errors) as RxJS streams. +* +* What RxStomp adds: +* - Simple, observable-based API for consuming messages. +* - Connection lifecycle as BehaviorSubjects/Observables for easy UI binding. +* - Transparent reconnection support (configurable through {@link RxStompConfig}). +* - Convenience helpers for receipts and server headers. +* +* Typical lifecycle: +* - Instantiate: `const rxStomp = new RxStomp();` +* - Configure: `rxStomp.configure({...});` +* - Activate: `rxStomp.activate();` +* - Consume: `rxStomp.watch({ destination: '/topic/foo' }).subscribe(...)` +* - Publish: `rxStomp.publish({ destination: '/topic/foo', body: '...' })` +* - Deactivate when done: `await rxStomp.deactivate();` +* +* Notes: +* - Except for `beforeConnect`, all callbacks from @stomp/stompjs are exposed +* as RxJS Subjects/Observables here. +* - RxStomp tries to transparently handle connection failures. +* +* Part of `@stomp/rx-stomp`. +*/ +var RxStomp = class { + /** + * Instance of actual + * [@stomp/stompjs]{@link https://github.com/stomp-js/stompjs} + * {@link Client}. + * + * **Be careful in calling methods on it directly - you may get unintended consequences.** + */ + get stompClient() { + return this._stompClient; + } + /** + * Constructor + * + * @param stompClient Optional existing {@link Client} to wrap. If omitted, a new instance + * will be created internally. + * + * Tip: Injecting a pre-configured Client is useful for advanced customization or testing. + */ + constructor(stompClient) { + /** + * Internal array to hold locally queued messages when STOMP broker is not connected. + */ + this._queuedMessages = []; + this._stompClient = stompClient ? stompClient : new import_stomp_umd.Client(); + const noOp = () => {}; + this._beforeConnect = noOp; + this._correlateErrors = () => void 0; + this._debug = noOp; + this._connectionStatePre$ = new BehaviorSubject(RxStompState.CLOSED); + this._connectedPre$ = this._connectionStatePre$.pipe(filter((currentState) => { + return currentState === RxStompState.OPEN; + })); + this.connectionState$ = new BehaviorSubject(RxStompState.CLOSED); + this.connected$ = this.connectionState$.pipe(filter((currentState) => { + return currentState === RxStompState.OPEN; + })); + this.connected$.subscribe(() => { + this._sendQueuedMessages(); + }); + this._serverHeadersBehaviourSubject$ = new BehaviorSubject(null); + this.serverHeaders$ = this._serverHeadersBehaviourSubject$.pipe(filter((headers) => { + return headers !== null; + })); + this.stompErrors$ = new Subject(); + this.unhandledMessage$ = new Subject(); + this.unhandledReceipts$ = new Subject(); + this.unhandledFrame$ = new Subject(); + this.webSocketErrors$ = new Subject(); + } + /** + * Apply configuration to the underlying STOMP client. + * + * - Safe to call multiple times; each call merges with existing configuration. + * - `beforeConnect` and `correlateErrors` are handled by RxStomp and removed + * from the object passed to the underlying {@link Client}. + * - Unless otherwise documented by @stomp/stompjs, most options take effect + * on the next (re)connection. + * + * Example: + * ```typescript + * const rxStomp = new RxStomp(); + * rxStomp.configure({ + * brokerURL: 'ws://127.0.0.1:15674/ws', + * connectHeaders: { + * login: 'guest', + * passcode: 'guest' + * }, + * heartbeatIncoming: 0, + * heartbeatOutgoing: 20000, + * reconnectDelay: 200, + * debug: (msg) => console.log(new Date(), msg), + * }); + * rxStomp.activate(); + * ``` + * + * Maps to: [Client#configure]{@link Client#configure}. + */ + configure(rxStompConfig) { + const stompConfig = Object.assign({}, rxStompConfig); + if (stompConfig.beforeConnect) { + this._beforeConnect = stompConfig.beforeConnect; + delete stompConfig.beforeConnect; + } + if (stompConfig.correlateErrors) { + this._correlateErrors = stompConfig.correlateErrors; + delete stompConfig.correlateErrors; + } + this._stompClient.configure(stompConfig); + if (stompConfig.debug) this._debug = stompConfig.debug; + } + /** + * Activate the client and initiate connection attempts. + * + * - Emits `CONNECTING` followed by `OPEN` on successful connect. + * - Automatically reconnects, according to configuration. + * + * To stop auto-reconnect and close the connection, call {@link deactivate}. + * + * Maps to: [Client#activate]{@link Client#activate}. + */ + activate() { + this._stompClient.configure({ + beforeConnect: async () => { + this._changeState(RxStompState.CONNECTING); + await this._beforeConnect(this); + }, + onConnect: (frame) => { + this._serverHeadersBehaviourSubject$.next(frame.headers); + this._changeState(RxStompState.OPEN); + }, + onStompError: (frame) => { + this.stompErrors$.next(frame); + }, + onWebSocketClose: () => { + this._changeState(RxStompState.CLOSED); + }, + onUnhandledMessage: (message) => { + this.unhandledMessage$.next(message); + }, + onUnhandledReceipt: (frame) => { + this.unhandledReceipts$.next(frame); + }, + onUnhandledFrame: (frame) => { + this.unhandledFrame$.next(frame); + }, + onWebSocketError: (evt) => { + this.webSocketErrors$.next(evt); + } + }); + this._stompClient.activate(); + } + /** + * Gracefully disconnect (if connected) and stop auto-reconnect. + * + * Behavior: + * - Emits `CLOSING` then `CLOSED`. + * - If no active WebSocket exists, resolves immediately. + * - If a WebSocket is active, resolves after it is properly closed. + * + * Experimental: + * - `options.force === true` immediately discards the underlying connection. + * See [Client#deactivate]{@link Client#deactivate}. + * + * You can call {@link activate} again after awa. + * + * Maps to: [Client#deactivate]{@link Client#deactivate}. + */ + async deactivate(options = {}) { + this._changeState(RxStompState.CLOSING); + await this._stompClient.deactivate(options); + this._changeState(RxStompState.CLOSED); + } + /** + * Whether the broker connection is currently OPEN. + * + * Equivalent to checking `connectionState$.value === RxStompState.OPEN`. + */ + connected() { + return this.connectionState$.getValue() === RxStompState.OPEN; + } + /** + * True if the client is ACTIVE — i.e., connected or attempting reconnection. + * + * Maps to: [Client#active]{@link Client#active}. + */ + get active() { + return this.stompClient.active; + } + /** + * Publish a message to a destination on the broker. + * + * Destination semantics and supported headers are broker-specific; consult your broker’s docs + * for naming conventions (queues, topics, exchanges) and header support. + * + * Payload + * - Text: provide `body` as a string. Convert non-strings yourself (e.g., JSON.stringify). + * - Binary: provide `binaryBody` as a Uint8Array and set an appropriate `content-type` header. + * Some brokers may require explicit configuration for binary frames. + * + * Frame sizing and content-length + * - For text messages, a `content-length` header is added by default. + * Set `skipContentLengthHeader: true` to omit it for text frames. + * - For binary messages, `content-length` is always included. + * + * Caution + * - If a message body contains NULL octets and the `content-length` header is omitted, + * many brokers will report an error and disconnect. + * + * Offline/queueing behavior + * - If not connected, messages are queued locally and sent upon reconnection. + * - To disable this behavior, set `retryIfDisconnected: false` in the parameters. + * In that case, this method throws if it cannot send immediately. + * + * Related + * - Broker acknowledgment (receipt) can be tracked using `receipt` headers together with {@link asyncReceipt}. + * + * Maps to: [Client#publish]{@link Client#publish} + * + * See: {@link IRxStompPublishParams} and {@link IPublishParams} + * + * Examples: + * ```javascript + * // Text with custom headers + * rxStomp.publish({ destination: "/queue/test", headers: { priority: 9 }, body: "Hello, STOMP" }); + * + * // Minimal (destination is required) + * rxStomp.publish({ destination: "/queue/test", body: "Hello, STOMP" }); + * + * // Skip content-length header for text + * rxStomp.publish({ destination: "/queue/test", body: "Hello, STOMP", skipContentLengthHeader: true }); + * + * // Binary payload + * const binaryData = generateBinaryData(); // Uint8Array + * rxStomp.publish({ + * destination: "/topic/special", + * binaryBody: binaryData, + * headers: { "content-type": "application/octet-stream" } + * }); + * ``` + */ + publish(parameters) { + const shouldRetry = parameters.retryIfDisconnected == null ? true : parameters.retryIfDisconnected; + if (this.connected()) this._stompClient.publish(parameters); + else if (shouldRetry) { + this._debug(`Not connected, queueing`); + this._queuedMessages.push(parameters); + } else throw new Error("Cannot publish while broker is not connected"); + } + /** It will send queued messages. */ + _sendQueuedMessages() { + const queuedMessages = this._queuedMessages; + this._queuedMessages = []; + if (queuedMessages.length === 0) return; + this._debug(`Will try sending ${queuedMessages.length} queued message(s)`); + for (const queuedMessage of queuedMessages) { + this._debug(`Attempting to send ${queuedMessage}`); + this.publish(queuedMessage); + } + } + watch(opts, headers = {}) { + const defaults = { + subHeaders: {}, + unsubHeaders: {}, + subscribeOnlyOnce: false + }; + let params; + if (typeof opts === "string") params = Object.assign({}, defaults, { + destination: opts, + subHeaders: headers + }); + else params = Object.assign({}, defaults, opts); + this._debug(`Request to subscribe ${params.destination}`); + /** + * Important - convert it to hot Observable - otherwise, if the user code subscribes + * to this observable twice, it will subscribe twice to Stomp broker. (This was happening in the current example). + * A long but good explanatory article at https://medium.com/@benlesh/hot-vs-cold-observables-f8094ed53339 + */ + return Observable.create((messages) => { + let stompSubscription; + let stompConnectedSubscription; + let connectedPre$ = this._connectedPre$; + if (params.subscribeOnlyOnce) connectedPre$ = connectedPre$.pipe(take(1)); + const stompErrorsSubscription = this.stompErrors$.subscribe((error) => { + if (this._correlateErrors(error) === params.destination) messages.error(error); + }); + stompConnectedSubscription = connectedPre$.subscribe(() => { + this._debug(`Will subscribe to ${params.destination}`); + let subHeaders = params.subHeaders; + if (typeof subHeaders === "function") subHeaders = subHeaders(); + stompSubscription = this._stompClient.subscribe(params.destination, (message) => { + messages.next(message); + }, subHeaders); + }); + return () => { + this._debug(`Stop watching connection state (for ${params.destination})`); + stompConnectedSubscription.unsubscribe(); + stompErrorsSubscription.unsubscribe(); + if (this.connected()) { + this._debug(`Will unsubscribe from ${params.destination} at Stomp`); + let unsubHeaders = params.unsubHeaders; + if (typeof unsubHeaders === "function") unsubHeaders = unsubHeaders(); + stompSubscription.unsubscribe(unsubHeaders); + } else this._debug(`Stomp not connected, no need to unsubscribe from ${params.destination} at Stomp`); + }; + }).pipe(share()); + } + /** + * **Deprecated** Please use {@link asyncReceipt}. + */ + watchForReceipt(receiptId, callback) { + this._stompClient.watchForReceipt(receiptId, callback); + } + /** + * Wait for a broker RECEIPT matching the provided receipt-id. + * + * How it works + * - To request an acknowledgment for an operation (e.g., publish, subscribe, unsubscribe), + * include a `receipt` header in that operation with a unique value. + * - A compliant broker will respond with a `RECEIPT` frame whose `receipt-id` header equals + * the value you sent in the `receipt` header. + * - This method returns a Promise that resolves with the matching {@link IFrame} when the + * corresponding `RECEIPT` arrives. + * + * Receipt identifiers + * - Must be unique per request; generating a UUID or monotonic sequence is typical. + * + * Notes + * - The Promise resolves once for the first matching receipt and then completes. + * - No timeout is enforced by default; to add one, wrap with your own timeout logic (e.g., Promise.race). + * + * Example: + * ```javascript + * // Publish with receipt tracking + * const receiptId = randomText(); + * rxStomp.publish({ + * destination: "/topic/special", + * headers: { receipt: receiptId }, + * body: msg + * }); + * const receiptFrame = await rxStomp.asyncReceipt(receiptId); // resolves with the RECEIPT frame + * ``` + * + * Maps to: [Client#watchForReceipt]{@link Client#watchForReceipt} + */ + asyncReceipt(receiptId) { + return firstValueFrom(this.unhandledReceipts$.pipe(filter((frame) => frame.headers["receipt-id"] === receiptId))); + } + _changeState(state) { + this._connectionStatePre$.next(state); + this.connectionState$.next(state); + } +}; +//#endregion +//#region src/stores/StompStore.tsx +var rxStompConfig = { + brokerURL: "/websocket/stomp", + connectHeaders: { + login: "", + passcode: "" + }, + heartbeatIncoming: 1e3, + heartbeatOutgoing: 1e3, + reconnectDelay: 1e3, + stompVersions: new import_stomp_umd.Versions([]) +}; +var useStompStore = create((set, get) => ({ + status: "none", + stompClient: null, + mqttmanager_warnings: [], + connect: () => { + set({ status: "connecting" }); + if (!get().stompClient) set({ stompClient: new RxStomp() }); + get().stompClient?.configure(rxStompConfig); + get().stompClient?.activate(); + get().stompClient?.connected$.subscribe(() => { + set({ status: "connected" }); + RemoveNotification("stomp_disconnected"); + }); + get().stompClient?.webSocketErrors$.subscribe(() => { + set({ status: "disconnected" }); + Notify({ + message: "Disconnected from MQTTManager.", + level: "error", + toast_id: "stomp_disconnected" + }); + }); + get().subscribe("mqttmanager/warnings", (message) => { + const data = JSON.parse(message.body); + const warnings = data.warnings; + const resolvedWarnings = get().mqttmanager_warnings.filter((warning) => { + return !warnings.some((new_warning) => new_warning.text == warning.text); + }); + for (const warning of resolvedWarnings) RemoveNotification(warning.text); + for (const warning of warnings) Notify({ + message: warning.text, + level: warning.level, + toast_id: warning.text + }); + set({ mqttmanager_warnings: data.warnings }); + }); + }, + subscribe: (topic, callback) => { + if (!get()._subscriptions.has(topic)) { + const stompClient = get().stompClient; + if (stompClient) { + const subscription = stompClient.watch(topic).subscribe((message) => { + if (!get()._subscriptions.has(topic)) get()._subscriptions.set(topic, { + topic, + callbacks: [], + subscription + }); + const topicData = get()._subscriptions.get(topic); + if (topicData) { + topicData.last_message = message; + for (const cb of topicData.callbacks) cb(message); + } + }); + get()._subscriptions.set(topic, { + topic, + callbacks: [callback], + subscription + }); + } else console.error("Tried to subscribe to ", topic, " but stompClient is null"); + } else { + const subscription = get()._subscriptions.get(topic); + if (subscription) { + subscription.callbacks.push(callback); + if (subscription.last_message) callback(subscription.last_message); + } + } + }, + unsubscribe: (topic, callback) => { + if (get()._subscriptions.has(topic)) { + const subscription = get()._subscriptions.get(topic); + if (subscription) { + const index = subscription.callbacks.indexOf(callback); + if (index !== -1) { + subscription.callbacks.splice(index, 1); + if (subscription.callbacks.length === 0) { + subscription.subscription?.unsubscribe(); + get()._subscriptions.delete(topic); + } + } + } + } + }, + send: (topic, body) => { + get().stompClient?.publish({ + destination: topic, + body + }); + }, + _subscriptions: /* @__PURE__ */ new Map() +})); +//#endregion +export { useStompStore as t }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/Warnings-D5nCet1X.js b/docker/web/nspanelmanager/web/react-components/dist/Warnings-D5nCet1X.js new file mode 100644 index 000000000..282d50e9c --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/Warnings-D5nCet1X.js @@ -0,0 +1,70 @@ +import { c as __toESM, r as require_react, t as require_jsx_runtime } from "./main-FKp56mKw.js"; +import { t as useEntityStatesStore } from "./EntityStore-CHE3-bsC.js"; +import { x as require_Icon } from "./mdi-Cr6PIsRR.js"; +//#region src/components/NSPanelPage/Warnings.tsx +var import_react = /* @__PURE__ */ __toESM(require_react(), 1); +var import_Icon = require_Icon(); +var import_jsx_runtime = require_jsx_runtime(); +var NSPanelWarning = ({ warning }) => { + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "block p-3", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "grid grid-cols-[auto_1fr] items-start justify-start gap-2 w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "grid-cols-subgrid col-span-2 flex items-center justify-start", + children: [ + warning.level == "error" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z", + className: "w-4 h-4 text-error mr-2" + }), + warning.level == "warning" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z", + className: "w-4 h-4 text-warning mr-2" + }), + warning.level == "info" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z", + className: "w-4 h-4 text-info mr-2" + }), + warning.level == "debug" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { + path: "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z", + className: "w-4 h-4 text-base-content mr-2" + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex", + children: warning.text + }) + ] + }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "grid-cols-subgrid col-span-2 col-start-2", + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "text-xs pl-4 uppercase font-semibold opacity-60", + children: warning.level.charAt(0).toUpperCase() + warning.level.slice(1) + }) + })] + }) + }, warning.text); +}; +function NSPanelWarnings({ nspanel_mac }) { + const { nspanels, status, fetchData } = useEntityStatesStore(); + (0, import_react.useEffect)(() => { + if (status === "none") fetchData(); + }, [status, fetchData]); + if (status == "loading" || status == "none") return null; + else if (status == "loaded" && !nspanels[nspanel_mac]) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { + className: "text-error text-md", + children: [ + "NSPanel state not found for panel with MAC: ", + nspanel_mac, + "!" + ] + }); + if (nspanels[nspanel_mac].warnings.length == 0) return null; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "divide-y divide-neutral w-full backdrop-blur-none backdrop-brightness-75 rounded-box border border-warning/50", + children: nspanels[nspanel_mac].warnings.map((warning) => { + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NSPanelWarning, { warning }); + }) + }); +} +//#endregion +export { NSPanelWarnings as default }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/fields-Dr1KI0Cj.js b/docker/web/nspanelmanager/web/react-components/dist/fields-Dr1KI0Cj.js new file mode 100644 index 000000000..7f147bb62 --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/fields-Dr1KI0Cj.js @@ -0,0 +1,183 @@ +import { r as require_react, t as require_jsx_runtime } from "./main-FKp56mKw.js"; +import { c as useFormContext, i as get, l as useWatch, t as Controller } from "./index.esm-CnTf2rLv.js"; +require_react(); +var import_jsx_runtime = require_jsx_runtime(); +function Field({ name, label, hint, children }) { + const { formState: { errors, defaultValues } } = useFormContext(); + const error = get(errors, name)?.message; + const unreadable = get(defaultValues, name) === null; + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "mb-2 w-full", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { + htmlFor: name, + className: "block mb-1 text-sm font-medium", + children: label + }), + children, + error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { + className: "mt-1 text-sm text-error", + id: `${name}-error`, + children: error + }) : unreadable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { + className: "mt-1 text-sm text-warning", + children: "No valid value is stored. Enter one." + }) : hint ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { + className: "mt-1 text-sm opacity-60", + children: hint + }) : null + ] + }); +} +var inputClass = "input w-full"; +function useInvalid(name) { + const { formState: { errors } } = useFormContext(); + const invalid = get(errors, name) !== void 0; + return { + "aria-invalid": invalid, + "aria-describedby": invalid ? `${name}-error` : void 0 + }; +} +function TextInput({ name, label, hint, disabled, button }) { + const { register } = useFormContext(); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { + name, + label, + hint, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "join w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + id: name, + type: "text", + className: `${inputClass} join-item`, + disabled, + ...useInvalid(name), + ...register(name) + }), button] + }) + }); +} +var toNumber = (value) => value === "" || value === null || value === void 0 ? null : Number(value); +function NumberInput({ name, label, hint, button }) { + const { register } = useFormContext(); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { + name, + label, + hint, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "join w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + id: name, + type: "number", + step: 1, + className: `${inputClass} join-item`, + ...useInvalid(name), + ...register(name, { setValueAs: toNumber }) + }), button] + }) + }); +} +function Select({ name, label, options }) { + const { register } = useFormContext(); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { + name, + label, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { + id: name, + className: "select w-full", + ...useInvalid(name), + ...register(name), + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { + value: "", + disabled: true, + children: "Choose…" + }), options.map(([value, text]) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { + value, + children: text + }, value))] + }) + }); +} +function RadioGroup({ name, label, options }) { + const { control } = useFormContext(); + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { + control, + name, + render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("fieldset", { + className: "mb-2 w-full", + "aria-label": label, + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("legend", { + className: "block mb-1 text-sm font-medium", + children: label + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex flex-wrap border border-neutral rounded-lg", + children: options.map(([value, text]) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { + className: "flex items-center gap-2 flex-1 px-3 py-3 text-sm font-medium cursor-pointer", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "radio", + className: "radio radio-accent radio-sm", + name, + checked: field.value === value, + onChange: () => field.onChange(value), + onBlur: field.onBlur + }), text] + }, String(value))) + }), + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldMessage, { name }) + ] + }) + }); +} +function FieldMessage({ name }) { + const { formState: { errors, defaultValues } } = useFormContext(); + const error = get(errors, name)?.message; + if (error) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { + className: "mt-1 text-sm text-error", + children: error + }); + if (get(defaultValues, name) === null) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { + className: "mt-1 text-sm text-warning", + children: "No valid value is stored. Choose one." + }); + return null; +} +function SecretInput({ name, clearName, label, isSet, disabled, button }) { + const { register, control } = useFormContext(); + const clear = useWatch({ + control, + name: clearName + }); + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Field, { + name, + label, + hint: isSet && !disabled ? "Stored, and not shown. Leave blank to keep it." : void 0, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "join w-full", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + id: name, + type: "password", + autoComplete: "new-password", + className: `${inputClass} join-item`, + placeholder: isSet ? "••••••••" : "", + disabled: disabled || clear, + ...useInvalid(name), + ...register(name) + }), button] + }), isSet && !disabled && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { + className: "label mt-1 text-sm", + children: [ + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { + type: "checkbox", + className: "checkbox checkbox-accent checkbox-sm", + ...register(clearName) + }), + "Clear the stored ", + label.toLowerCase() + ] + })] + }); +} +//#endregion +export { TextInput as a, Select as i, RadioGroup as n, SecretInput as r, NumberInput as t }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/index.esm-CnTf2rLv.js b/docker/web/nspanelmanager/web/react-components/dist/index.esm-CnTf2rLv.js new file mode 100644 index 000000000..475295e7c --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/index.esm-CnTf2rLv.js @@ -0,0 +1,2651 @@ +import { c as __toESM, r as require_react } from "./main-FKp56mKw.js"; +//#region node_modules/react-hook-form/dist/index.esm.mjs +var import_react = /* @__PURE__ */ __toESM(require_react(), 1); +var isCheckBoxInput = (element) => element.type === "checkbox"; +var isFileInput = (element) => element.type === "file"; +var isDateObject = (value) => value instanceof Date; +var isNullOrUndefined = (value) => value == null; +var isObjectType = (value) => typeof value === "object"; +var isObject = (value) => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value); +var getEventValue = (event) => isObject(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : isFileInput(event.target) ? event.target.files : event.target.value : event; +var FIELD_PATH_RE = /[.[\]'"]/; +var stringToPath = (input) => input.split(FIELD_PATH_RE).filter(Boolean); +function getNullAncestorValue(control, name) { + const segments = stringToPath(name); + let formValues = control._formValues; + let defaultValues = control._defaultValues; + for (let i = 0; i < segments.length - 1; i++) { + const key = segments[i]; + formValues = formValues == null ? formValues : formValues[key]; + defaultValues = defaultValues == null ? defaultValues : defaultValues[key]; + if (formValues === null || defaultValues === null) return null; + } +} +var isNameInFieldArray = (names, name) => name.split(".").some((part, index, arr) => !isNaN(Number(part)) && names.has(arr.slice(0, index).join("."))); +var isWeb = typeof window !== "undefined" && typeof window.HTMLElement !== "undefined" && typeof document !== "undefined"; +function cloneObject(data) { + if (data === null || typeof data !== "object") return data; + if (data instanceof Date) return new Date(data); + const isFileListInstance = typeof FileList !== "undefined" && data instanceof FileList; + if (isWeb && (data instanceof Blob || isFileListInstance)) return data; + const isArray = Array.isArray(data); + if (!isArray && data.constructor !== Object) return data; + const copy = isArray ? [] : Object.create(Object.getPrototypeOf(data)); + for (const key in data) if (Object.prototype.hasOwnProperty.call(data, key)) copy[key] = cloneObject(data[key]); + return copy; +} +var EVENTS = { + BLUR: "blur", + FOCUS_OUT: "focusout", + CHANGE: "change", + SUBMIT: "submit", + TRIGGER: "trigger", + VALID: "valid" +}; +var VALIDATION_MODE = { + onBlur: "onBlur", + onChange: "onChange", + onSubmit: "onSubmit", + onTouched: "onTouched", + all: "all" +}; +var INPUT_VALIDATION_RULES = { + max: "max", + min: "min", + maxLength: "maxLength", + minLength: "minLength", + pattern: "pattern", + required: "required", + validate: "validate" +}; +var ROOT_ERROR_TYPE = "root"; +var PROTOTYPE_KEYWORDS = [ + "__proto__", + "constructor", + "prototype" +]; +var IS_KEY_RE = /^\w*$/; +var isKey = (value) => IS_KEY_RE.test(value); +var isUndefined = (val) => val === void 0; +var get = (object, path, defaultValue) => { + if (!path || !isObject(object)) return defaultValue; + const paths = isKey(path) ? [path] : stringToPath(path); + if (paths.some((key) => PROTOTYPE_KEYWORDS.includes(key))) return defaultValue; + const result = paths.reduce((result, key) => { + return isNullOrUndefined(result) ? void 0 : result[key]; + }, object); + return isUndefined(result) || result === object ? isUndefined(object[path]) ? defaultValue : object[path] : result; +}; +var isBoolean = (value) => typeof value === "boolean"; +var isFunction = (value) => typeof value === "function"; +var set = (object, path, value) => { + let index = -1; + const tempPath = isKey(path) ? [path] : stringToPath(path); + const length = tempPath.length; + const lastIndex = length - 1; + while (++index < length) { + const key = tempPath[index]; + let newValue = value; + if (index !== lastIndex) { + const objValue = object[key]; + newValue = isObject(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index + 1]) ? [] : {}; + } + if (PROTOTYPE_KEYWORDS.includes(key)) return; + object[key] = newValue; + object = object[key]; + } +}; +/** +* Separate context for `control` to prevent unnecessary rerenders. +* Internal hooks that only need control use this instead of full form context. +*/ +var HookFormControlContext = import_react.createContext(null); +HookFormControlContext.displayName = "HookFormControlContext"; +/** +* @internal Internal hook to access only control from context. +*/ +var useFormControlContext = () => import_react.useContext(HookFormControlContext); +var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => { + const result = {}; + for (const key in formState) Object.defineProperty(result, key, { get: () => { + const _key = key; + if (control._proxyFormState[_key] !== VALIDATION_MODE.all) control._proxyFormState[_key] = !isRoot || VALIDATION_MODE.all; + localProxyFormState && (localProxyFormState[_key] = true); + return formState[_key]; + } }); + return result; +}; +var useIsomorphicLayoutEffect = isWeb ? import_react.useLayoutEffect : import_react.useEffect; +var isPlainObject = (tempObject) => { + const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype; + return isObject(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf"); +}; +var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value); +var isEmptyObjectWithCustomPrototype = (object, keys) => keys.length === 0 && !Array.isArray(object) && !isPlainObject(object); +function deepEqual(object1, object2, visited = /* @__PURE__ */ new WeakMap()) { + if (object1 === object2) return true; + if (isPrimitive(object1) || isPrimitive(object2)) return Object.is(object1, object2); + if (isDateObject(object1) && isDateObject(object2)) return Object.is(object1.getTime(), object2.getTime()); + const keys1 = Object.keys(object1); + const keys2 = Object.keys(object2); + if (keys1.length !== keys2.length) return false; + if (isEmptyObjectWithCustomPrototype(object1, keys1) || isEmptyObjectWithCustomPrototype(object2, keys2)) return Object.is(object1, object2); + if (!keys1.length && Array.isArray(object1) !== Array.isArray(object2)) return false; + const visitedPairs = visited.get(object1); + if (visitedPairs && visitedPairs.has(object2)) return true; + if (visitedPairs) visitedPairs.add(object2); + else { + const ws = /* @__PURE__ */ new WeakSet(); + ws.add(object2); + visited.set(object1, ws); + } + for (const key of keys1) { + const val1 = object1[key]; + if (!(key in object2)) return false; + if (key !== "ref") { + const val2 = object2[key]; + if (isDateObject(val1) && isDateObject(val2) || (isObject(val1) || Array.isArray(val1)) && (isObject(val2) || Array.isArray(val2)) ? !deepEqual(val1, val2, visited) : !Object.is(val1, val2)) return false; + } + } + return true; +} +function useResyncOnReconnect(getInitialValue) { + const _connected = import_react.useRef(false); + const _initialized = import_react.useRef(false); + const _prevValue = import_react.useRef(void 0); + const _renderCount = import_react.useRef(0); + _renderCount.current++; + if (!_initialized.current && getInitialValue) { + _initialized.current = true; + _prevValue.current = cloneObject(getInitialValue()); + } + return { + resyncIfNeeded: import_react.useCallback((enabled, getCurrentValue, setValue) => { + if (enabled && (_connected.current || _initialized.current && _renderCount.current > 1)) { + const currentValue = getCurrentValue(); + if (!deepEqual(_prevValue.current, currentValue)) setValue(currentValue); + } + _connected.current = true; + }, []), + snapshot: import_react.useCallback((enabled, getCurrentValue) => { + if (enabled) _prevValue.current = cloneObject(getCurrentValue()); + }, []) + }; +} +/** +* Subscribes to each form state and isolates re-renders at the custom hook level. It has its own scope for form state subscriptions, so it will not affect other useFormState or useForm instances. Using this hook can reduce the re-render impact on large and complex form applications. +* +* @remarks +* [API](https://react-hook-form.com/docs/useformstate) • [Demo](https://codesandbox.io/s/useformstate-75xly) +* +* @param props - Include options to specify fields to subscribe to. {@link UseFormStateReturn} +* +* @example +* ```tsx +* function App() { +* const { register, handleSubmit, control } = useForm({ +* defaultValues: { +* firstName: "firstName" +* }}); +* const { dirtyFields } = useFormState({ +* control +* }); +* const onSubmit = (data) => console.log(data); +* +* return ( +*
+* +* {dirtyFields.firstName &&

Field is dirty.

} +* +*
+* ); +* } +* ``` +*/ +function useFormState(props) { + const formControl = useFormControlContext(); + const { control = formControl, disabled, name, exact } = props || {}; + const getCurrentFormState = () => ({ + ...control._formState, + defaultValues: control._defaultValues + }); + const [formState, updateFormState] = import_react.useState(getCurrentFormState); + const _localProxyFormState = import_react.useRef({ + isDirty: false, + isLoading: false, + dirtyFields: false, + touchedFields: false, + validatingFields: false, + isValidating: false, + isValid: false, + errors: false + }); + const { resyncIfNeeded, snapshot } = useResyncOnReconnect(getCurrentFormState); + useIsomorphicLayoutEffect(() => { + resyncIfNeeded(!disabled, getCurrentFormState, updateFormState); + const unsubscribe = control._subscribe({ + name, + formState: _localProxyFormState.current, + exact, + callback: (formState) => { + !disabled && updateFormState({ + ...control._formState, + ...formState, + defaultValues: control._defaultValues + }); + } + }); + return () => { + unsubscribe(); + snapshot(!disabled, getCurrentFormState); + }; + }, [ + name, + disabled, + exact, + resyncIfNeeded, + snapshot + ]); + import_react.useEffect(() => { + _localProxyFormState.current.isValid && control._setValid(true); + }, [control]); + return import_react.useMemo(() => getProxyFormState(formState, control, _localProxyFormState.current, false), [formState, control]); +} +var isString = (value) => typeof value === "string"; +var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => { + if (isString(names)) { + isGlobal && _names.watch.add(names); + return get(formValues, names, defaultValue); + } + if (Array.isArray(names)) return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName), get(formValues, fieldName, get(defaultValue, fieldName)))); + isGlobal && (_names.watchAll = true); + return formValues; +}; +/** +* Custom hook to subscribe to field changes and isolate re-rendering at the component level. +* +* @remarks +* +* [API](https://react-hook-form.com/docs/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e) +* +* @example +* ```tsx +* const { control } = useForm(); +* const values = useWatch({ +* name: "fieldName", +* control, +* }) +* ``` +*/ +function useWatch(props) { + const formControl = useFormControlContext(); + const { control = formControl, name, defaultValue, disabled, exact, compute } = props || {}; + const _defaultValue = import_react.useRef(defaultValue); + const _compute = import_react.useRef(compute); + const _computeFormValues = import_react.useRef(void 0); + const _prevControl = import_react.useRef(control); + const _prevName = import_react.useRef(name); + _compute.current = compute; + const getInitialOutput = () => { + const defaultValue = control._getWatch(name, _defaultValue.current); + return _compute.current ? _compute.current(defaultValue) : defaultValue; + }; + const [value, updateValue] = import_react.useState(getInitialOutput); + const getCurrentOutput = import_react.useCallback((values) => { + const formValues = generateWatchOutput(name, control._names, values || control._formValues, false, _defaultValue.current); + return _compute.current ? _compute.current(formValues) : formValues; + }, [ + control._formValues, + control._names, + name + ]); + const refreshValue = import_react.useCallback((values) => { + if (!disabled) { + const formValues = generateWatchOutput(name, control._names, values || control._formValues, false, _defaultValue.current); + if (_compute.current) { + const computedFormValues = _compute.current(formValues); + if (!deepEqual(computedFormValues, _computeFormValues.current)) { + updateValue(computedFormValues); + _computeFormValues.current = computedFormValues; + } + } else updateValue(formValues); + } + }, [ + control._formValues, + control._names, + disabled, + name + ]); + const { resyncIfNeeded, snapshot } = useResyncOnReconnect(getInitialOutput); + const _refreshValue = import_react.useRef(refreshValue); + _refreshValue.current = refreshValue; + const _getCurrentOutput = import_react.useRef(getCurrentOutput); + _getCurrentOutput.current = getCurrentOutput; + useIsomorphicLayoutEffect(() => { + if (_prevControl.current !== control || !deepEqual(_prevName.current, name)) { + _prevControl.current = control; + _prevName.current = name; + _refreshValue.current(); + } else resyncIfNeeded(!disabled, () => _getCurrentOutput.current(), (currentValue) => { + updateValue(currentValue); + _computeFormValues.current = currentValue; + }); + const unsubscribe = control._subscribe({ + name, + formState: { values: true }, + exact, + callback: (formState) => { + _refreshValue.current(formState.values); + } + }); + return () => { + unsubscribe(); + snapshot(!disabled, () => _getCurrentOutput.current()); + }; + }, [ + control, + exact, + name, + disabled, + resyncIfNeeded, + snapshot + ]); + import_react.useEffect(() => control._removeUnmounted()); + const controlChanged = _prevControl.current !== control; + const prevName = _prevName.current; + return import_react.useMemo(() => { + if (disabled) return false; + const nameChanged = !controlChanged && !deepEqual(prevName, name); + return controlChanged || nameChanged; + }, [ + disabled, + controlChanged, + name, + prevName + ]) ? getCurrentOutput() : value; +} +/** +* Custom hook to work with controlled component, this function provide you with both form and field level state. Re-render is isolated at the hook level. +* +* @remarks +* [API](https://react-hook-form.com/docs/usecontroller) • [Demo](https://codesandbox.io/s/usecontroller-0o8px) +* +* @param props - the path name to the form field value, and validation rules. +* +* @returns field properties, field and form state. {@link UseControllerReturn} +* +* @example +* ```tsx +* function Input(props) { +* const { field, fieldState, formState } = useController(props); +* return ( +*
+* +*

{fieldState.isTouched && "Touched"}

+*

{formState.isSubmitted ? "submitted" : ""}

+*
+* ); +* } +* ``` +*/ +function useController(props) { + const formControl = useFormControlContext(); + const { name, disabled, control = formControl, shouldUnregister, defaultValue, exact = true } = props; + const isArrayField = isNameInFieldArray(control._names.array, name); + const value = useWatch({ + control, + name, + defaultValue: import_react.useMemo(() => { + const resolved = get(control._formValues, name, get(control._defaultValues, name, defaultValue)); + return isUndefined(resolved) ? getNullAncestorValue(control, name) : resolved; + }, [ + control, + name, + defaultValue + ]), + exact + }); + const formState = useFormState({ + control, + name, + exact + }); + const _props = import_react.useRef(props); + const _proxyRef = import_react.useRef(null); + const _registerProps = import_react.useRef(control.register(name, { + ...props.rules, + value, + ...isBoolean(props.disabled) ? { disabled: props.disabled } : {} + })); + _props.current = props; + const fieldState = import_react.useMemo(() => Object.defineProperties({}, { + invalid: { + enumerable: true, + get: () => !!get(formState.errors, name) + }, + isDirty: { + enumerable: true, + get: () => !!get(formState.dirtyFields, name) + }, + isTouched: { + enumerable: true, + get: () => !!get(formState.touchedFields, name) + }, + isValidating: { + enumerable: true, + get: () => !!get(formState.validatingFields, name) + }, + error: { + enumerable: true, + get: () => get(formState.errors, name) + } + }), [formState, name]); + const onChange = import_react.useCallback((event) => { + const value = getEventValue(event); + if (!get(control._fields, name)) _registerProps.current = control.register(name, { + ..._props.current.rules, + value + }); + return _registerProps.current.onChange({ + target: { + value: getEventValue(event), + name + }, + type: EVENTS.CHANGE + }); + }, [name, control]); + const onBlur = import_react.useCallback(() => _registerProps.current.onBlur({ + target: { + value: get(control._formValues, name), + name + }, + type: EVENTS.BLUR + }), [name, control._formValues]); + const ref = import_react.useCallback((elm) => { + if (elm) _proxyRef.current = { + focus: () => isFunction(elm.focus) && elm.focus(), + select: () => isFunction(elm.select) && elm.select(), + setCustomValidity: (message) => isFunction(elm.setCustomValidity) && elm.setCustomValidity(message), + reportValidity: () => isFunction(elm.reportValidity) && elm.reportValidity() + }; + const field = get(control._fields, name); + if (field && field._f && elm) field._f.ref = _proxyRef.current; + }, [control._fields, name]); + const field = import_react.useMemo(() => ({ + name, + value, + ...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {}, + onChange, + onBlur, + ref + }), [ + name, + disabled, + formState.disabled, + onChange, + onBlur, + ref, + value + ]); + import_react.useEffect(() => { + const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister; + _registerProps.current = control.register(name, { + ..._props.current.rules, + ...isBoolean(_props.current.disabled) ? { disabled: _props.current.disabled } : {} + }); + const updateMounted = (name, value) => { + const field = get(control._fields, name); + if (field && field._f) field._f.mount = value; + }; + updateMounted(name, true); + if (_shouldUnregisterField) { + const value = cloneObject(get(shouldUnregister ? control._defaultValues : control._options.values || control._defaultValues, name, get(control._options.defaultValues, name, _props.current.defaultValue))); + set(control._defaultValues, name, value); + if (isUndefined(get(control._formValues, name))) set(control._formValues, name, value); + } + !isArrayField && control.register(name); + if (_proxyRef.current) { + const field = get(control._fields, name); + if (field && field._f) field._f.ref = _proxyRef.current; + } + return () => { + (isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false); + }; + }, [ + name, + control, + isArrayField, + shouldUnregister + ]); + import_react.useEffect(() => { + control._setDisabledField({ + disabled, + name + }); + }, [ + disabled, + name, + control + ]); + return import_react.useMemo(() => ({ + field, + formState, + fieldState + }), [ + field, + formState, + fieldState + ]); +} +/** +* Component based on `useController` hook to work with controlled component. +* +* @remarks +* [API](https://react-hook-form.com/docs/usecontroller/controller) • [Demo](https://codesandbox.io/s/react-hook-form-v6-controller-ts-jwyzw) • [Video](https://www.youtube.com/watch?v=N2UNk_UCVyA) +* +* @param props - the path name to the form field value, and validation rules. +* +* @returns provide field handler functions, field and form state. +* +* @example +* ```tsx +* function App() { +* const { control } = useForm({ +* defaultValues: { +* test: "" +* } +* }); +* +* return ( +*
+* ( +* <> +* +*

{formState.isSubmitted ? "submitted" : ""}

+*

{fieldState.isTouched ? "touched" : ""}

+* +* )} +* /> +* +* ); +* } +* ``` +*/ +var Controller = (props) => props.render(useController(props)); +var generateId = () => typeof crypto !== "undefined" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => { + const r = Math.random() * 16 | 0; + return (c === "x" ? r : r & 3 | 8).toString(16); +}); +var getFocusFieldName = (name, index, options = {}) => options.shouldFocus || isUndefined(options.shouldFocus) ? options.focusName || `${name}.${isUndefined(options.focusIndex) ? index : options.focusIndex}.` : ""; +var getValidationModes = (mode) => ({ + isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit, + isOnBlur: mode === VALIDATION_MODE.onBlur, + isOnChange: mode === VALIDATION_MODE.onChange, + isOnAll: mode === VALIDATION_MODE.all, + isOnTouch: mode === VALIDATION_MODE.onTouched +}); +var isWatched = (name, _names, isBlurEvent) => { + if (isBlurEvent) return false; + if (_names.watchAll || _names.watch.has(name)) return true; + for (const watchName of _names.watch) if (name.startsWith(watchName) && name.charAt(watchName.length) === ".") return true; + return false; +}; +var iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => { + for (const key of fieldsNames || Object.keys(fields)) { + if (key === "_f") continue; + const field = fieldsNames ? get(fields, key) : fields[key]; + if (field) { + const { _f } = field; + if (_f) { + if (_f.refs && _f.refs[0] && action(_f.refs[0], key) && !abortEarly) return true; + else if (_f.ref && action(_f.ref, _f.name) && !abortEarly) return true; + else if (iterateFieldsByAction(field, action)) break; + } else if (isObject(field) || Array.isArray(field)) { + if (iterateFieldsByAction(field, action)) break; + } + } + } +}; +var updateFieldArrayRootError = (errors, error, name) => { + const existingErrors = get(errors, name); + const fieldArrayErrors = Array.isArray(existingErrors) ? existingErrors : []; + set(fieldArrayErrors, ROOT_ERROR_TYPE, error[name]); + set(errors, name, fieldArrayErrors); + return errors; +}; +var isEmptyObject = (value) => isObject(value) && !Object.keys(value).length; +var isHTMLElement = (value) => { + if (!isWeb) return false; + const owner = value ? value.ownerDocument : 0; + return value instanceof (owner && owner.defaultView ? owner.defaultView.HTMLElement : HTMLElement); +}; +var isRadioInput = (element) => element.type === "radio"; +var isRegex = (value) => value instanceof RegExp; +var appendErrors = (name, validateAllFieldCriteria, errors, type, message) => validateAllFieldCriteria ? { + ...errors[name], + types: { + ...errors[name] && errors[name].types ? errors[name].types : {}, + [type]: message || true + } +} : {}; +var defaultResult = { + value: false, + isValid: false +}; +var validResult = { + value: true, + isValid: true +}; +var getCheckboxValue = (options) => { + if (!Array.isArray(options)) return defaultResult; + if (options.length > 1) { + const values = options.filter((option) => option && option.checked && !option.disabled).map((option) => option.value); + return { + value: values, + isValid: !!values.length + }; + } + const option = options[0]; + if (!option || !option.checked || option.disabled) return defaultResult; + if (!option.attributes || !("value" in option.attributes)) return validResult; + return isUndefined(option.value) || option.value === "" ? validResult : { + value: option.value, + isValid: true + }; +}; +var defaultReturn = { + isValid: false, + value: null +}; +var getRadioValue = (options) => Array.isArray(options) ? options.reduce((previous, option) => option && option.checked && !option.disabled ? { + isValid: true, + value: option.value +} : previous, defaultReturn) : defaultReturn; +function getValidateError(result, ref, type = "validate") { + if (isString(result) || Array.isArray(result) && result.every(isString) || isBoolean(result) && !result) return { + type, + message: isString(result) ? result : "", + ref + }; +} +var getValueAndMessage = (validationData) => isObject(validationData) && !isRegex(validationData) ? validationData : { + value: validationData, + message: "" +}; +var validateField = async (field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => { + const { ref, refs, required, maxLength, minLength, min, max, pattern, validate, name, valueAsNumber, mount } = field._f; + const inputValue = get(formValues, name); + if (!mount || disabledFieldNames.has(name)) return {}; + const inputRef = refs ? refs[0] : ref; + const setCustomValidity = (message) => { + if (shouldUseNativeValidation && inputRef.reportValidity) { + const validityMessage = isBoolean(message) ? "" : message || ""; + if (refs) refs.forEach((ref) => ref.setCustomValidity(validityMessage)); + else inputRef.setCustomValidity(validityMessage); + inputRef.reportValidity(); + } + }; + const error = {}; + const isRadio = isRadioInput(ref); + const isCheckBox = isCheckBoxInput(ref); + const isRadioOrCheckbox = isRadio || isCheckBox; + const isEmpty = (valueAsNumber || isFileInput(ref)) && isUndefined(ref.value) && isUndefined(inputValue) || isHTMLElement(ref) && ref.value === "" || inputValue === "" || Array.isArray(inputValue) && !inputValue.length; + const appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error); + const getMinMaxMessage = (exceedMax, maxLengthMessage, minLengthMessage, maxType = INPUT_VALIDATION_RULES.maxLength, minType = INPUT_VALIDATION_RULES.minLength) => { + const message = exceedMax ? maxLengthMessage : minLengthMessage; + error[name] = { + type: exceedMax ? maxType : minType, + message, + ref, + ...appendErrorsCurry(exceedMax ? maxType : minType, message) + }; + }; + if (isFieldArray ? !Array.isArray(inputValue) || !inputValue.length : required && (!isRadioOrCheckbox && (isEmpty || isNullOrUndefined(inputValue)) || isBoolean(inputValue) && !inputValue || isCheckBox && !getCheckboxValue(refs).isValid || isRadio && !getRadioValue(refs).isValid)) { + const { value, message } = isString(required) ? { + value: !!required, + message: required + } : getValueAndMessage(required); + if (value) { + error[name] = { + type: INPUT_VALIDATION_RULES.required, + message, + ref: inputRef, + ...appendErrorsCurry(INPUT_VALIDATION_RULES.required, message) + }; + if (!validateAllFieldCriteria) { + setCustomValidity(message); + return error; + } + } + } + if (!isEmpty && (!isNullOrUndefined(min) || !isNullOrUndefined(max))) { + let exceedMax; + let exceedMin; + const maxOutput = getValueAndMessage(max); + const minOutput = getValueAndMessage(min); + if (!isNullOrUndefined(inputValue) && !isDateObject(inputValue) && !isNaN(inputValue)) { + const valueNumber = ref.valueAsNumber || (inputValue ? +inputValue : inputValue); + if (!isNullOrUndefined(maxOutput.value)) exceedMax = valueNumber > maxOutput.value; + if (!isNullOrUndefined(minOutput.value)) exceedMin = valueNumber < minOutput.value; + } else { + const valueDate = ref.valueAsDate || new Date(inputValue); + const convertTimeToDate = (time) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + time); + const isTime = ref.type == "time"; + const isWeek = ref.type == "week"; + if (isString(maxOutput.value) && inputValue) exceedMax = isTime ? convertTimeToDate(inputValue) > convertTimeToDate(maxOutput.value) : isWeek ? inputValue > maxOutput.value : valueDate > new Date(maxOutput.value); + if (isString(minOutput.value) && inputValue) exceedMin = isTime ? convertTimeToDate(inputValue) < convertTimeToDate(minOutput.value) : isWeek ? inputValue < minOutput.value : valueDate < new Date(minOutput.value); + } + if (exceedMax || exceedMin) { + getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min); + if (!validateAllFieldCriteria) { + setCustomValidity(error[name].message); + return error; + } + } + } + if ((maxLength || minLength) && !isEmpty && (isString(inputValue) || isFieldArray && Array.isArray(inputValue))) { + const maxLengthOutput = getValueAndMessage(maxLength); + const minLengthOutput = getValueAndMessage(minLength); + const exceedMax = !isNullOrUndefined(maxLengthOutput.value) && inputValue.length > +maxLengthOutput.value; + const exceedMin = !isNullOrUndefined(minLengthOutput.value) && inputValue.length < +minLengthOutput.value; + if (exceedMax || exceedMin) { + getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message); + if (!validateAllFieldCriteria) { + setCustomValidity(error[name].message); + return error; + } + } + } + if (pattern && !isEmpty && isString(inputValue)) { + const { value: patternValue, message } = getValueAndMessage(pattern); + if (isRegex(patternValue) && !inputValue.match(patternValue)) { + error[name] = { + type: INPUT_VALIDATION_RULES.pattern, + message, + ref, + ...appendErrorsCurry(INPUT_VALIDATION_RULES.pattern, message) + }; + if (!validateAllFieldCriteria) { + setCustomValidity(message); + return error; + } + } + } + if (validate) { + if (isFunction(validate)) { + const validateError = getValidateError(await validate(inputValue, formValues), inputRef); + if (validateError) { + error[name] = { + ...validateError, + ...appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message) + }; + if (!validateAllFieldCriteria) { + setCustomValidity(validateError.message); + return error; + } + } + } else if (isObject(validate)) { + let validationResult = {}; + for (const key in validate) { + if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) break; + const validateError = getValidateError(await validate[key](inputValue, formValues), inputRef, key); + if (validateError) { + validationResult = { + ...validateError, + ...appendErrorsCurry(key, validateError.message) + }; + setCustomValidity(validateError.message); + if (validateAllFieldCriteria) error[name] = validationResult; + } + } + if (!isEmptyObject(validationResult)) { + error[name] = { + ref: inputRef, + ...validationResult + }; + if (!validateAllFieldCriteria) return error; + } + } + } + const fieldError = error[name]; + setCustomValidity(fieldError ? fieldError.message : true); + return error; +}; +var convertToArrayPayload = (value) => Array.isArray(value) ? value : [value]; +var appendAt = (data, value) => [...data, ...convertToArrayPayload(value)]; +var fillEmptyArray = (value) => Array.isArray(value) ? value.map(() => void 0) : void 0; +function insert(data, index, value) { + return [ + ...data.slice(0, index), + ...convertToArrayPayload(value), + ...data.slice(index) + ]; +} +var moveArrayAt = (data, from, to) => { + if (!Array.isArray(data)) return []; + if (isUndefined(data[to])) data[to] = void 0; + data.splice(to, 0, data.splice(from, 1)[0]); + return data; +}; +var prependAt = (data, value) => [...convertToArrayPayload(value), ...convertToArrayPayload(data)]; +var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : []; +function removeAtIndexes(data, indexes) { + let i = 0; + const temp = [...data]; + for (const index of indexes) { + temp.splice(index - i, 1); + i++; + } + return compact(temp).length ? temp : []; +} +var removeArrayAt = (data, index) => isUndefined(index) ? [] : removeAtIndexes(data, convertToArrayPayload(index).sort((a, b) => a - b)); +var swapArrayAt = (data, indexA, indexB) => { + [data[indexA], data[indexB]] = [data[indexB], data[indexA]]; +}; +function baseGet(object, updatePath) { + const length = updatePath.length - 1; + let index = 0; + while (index < length) { + if (isNullOrUndefined(object)) { + object = void 0; + break; + } + object = object[updatePath[index]]; + index++; + } + return object; +} +function isEmptyArray(obj) { + for (const key in obj) if (obj.hasOwnProperty(key) && !isUndefined(obj[key])) return false; + return true; +} +function unset(object, path) { + if (isString(path) && Object.prototype.hasOwnProperty.call(object, path)) { + delete object[path]; + return object; + } + const paths = Array.isArray(path) ? path : isKey(path) ? [path] : stringToPath(path); + if (paths.some((segment) => PROTOTYPE_KEYWORDS.includes(String(segment)))) return object; + const childObject = paths.length === 1 ? object : baseGet(object, paths); + const index = paths.length - 1; + const key = paths[index]; + if (childObject) delete childObject[key]; + if (index !== 0 && (isObject(childObject) && isEmptyObject(childObject) || Array.isArray(childObject) && isEmptyArray(childObject))) unset(object, paths.slice(0, -1)); + return object; +} +var updateAt = (fieldValues, index, value) => { + fieldValues[index] = value; + return fieldValues; +}; +/** +* A custom hook that exposes convenient methods to perform operations with a list of dynamic inputs that need to be appended, updated, removed etc. • [Demo](https://codesandbox.io/s/react-hook-form-usefieldarray-ssugn) • [Video](https://youtu.be/4MrbfGSFY2A) +* +* @remarks +* [API](https://react-hook-form.com/docs/usefieldarray) • [Demo](https://codesandbox.io/s/react-hook-form-usefieldarray-ssugn) +* +* @param props - useFieldArray props +* +* @returns methods - functions to manipulate with the Field Arrays (dynamic inputs) {@link UseFieldArrayReturn} +* +* @example +* ```tsx +* function App() { +* const { register, control, handleSubmit, reset, trigger, setError } = useForm({ +* defaultValues: { +* test: [] +* } +* }); +* const { fields, append } = useFieldArray({ +* control, +* name: "test" +* }); +* +* return ( +*
console.log(data))}> +* {fields.map((item, index) => ( +* +* ))} +* +* +*
+* ); +* } +* ``` +*/ +function useFieldArray(props) { + const formControl = useFormControlContext(); + const { control = formControl, name, keyName = "id", disabled, shouldUnregister, rules } = props; + const [fields, setFields] = import_react.useState(control._getFieldArray(name)); + const ids = import_react.useRef(control._getFieldArray(name).map(generateId)); + const _actioned = import_react.useRef(false); + if (!disabled) control._names.array.add(name); + import_react.useMemo(() => !disabled && rules && fields.length >= 0 && control.register(name, rules), [ + control, + name, + fields.length, + rules, + disabled + ]); + useIsomorphicLayoutEffect(() => { + if (disabled) return; + return control._subjects.array.subscribe({ next: ({ values, name: fieldArrayName }) => { + if (fieldArrayName === name || !fieldArrayName) { + const fieldValues = get(values, name); + if (Array.isArray(fieldValues)) { + setFields(fieldValues); + ids.current = fieldValues.map(generateId); + } else if (!fieldArrayName) { + setFields([]); + ids.current = []; + } + } + } }).unsubscribe; + }, [ + control, + name, + disabled + ]); + const updateValues = import_react.useCallback((updatedFieldArrayValues) => { + _actioned.current = true; + control._setFieldArray(name, updatedFieldArrayValues); + }, [control, name]); + const append = (value, options) => { + if (disabled) return; + const appendValue = convertToArrayPayload(cloneObject(value)); + const updatedFieldArrayValues = appendAt(control._getFieldArray(name), appendValue); + control._names.focus = getFocusFieldName(name, updatedFieldArrayValues.length - 1, options); + ids.current = appendAt(ids.current, appendValue.map(generateId)); + updateValues(updatedFieldArrayValues); + setFields(updatedFieldArrayValues); + control._setFieldArray(name, updatedFieldArrayValues, appendAt, { argA: fillEmptyArray(value) }); + }; + const prepend = (value, options) => { + if (disabled) return; + const prependValue = convertToArrayPayload(cloneObject(value)); + const updatedFieldArrayValues = prependAt(control._getFieldArray(name), prependValue); + control._names.focus = getFocusFieldName(name, 0, options); + ids.current = prependAt(ids.current, prependValue.map(generateId)); + updateValues(updatedFieldArrayValues); + setFields(updatedFieldArrayValues); + control._setFieldArray(name, updatedFieldArrayValues, prependAt, { argA: fillEmptyArray(value) }); + }; + const remove = (index) => { + if (disabled) return; + const updatedFieldArrayValues = removeArrayAt(control._getFieldArray(name), index); + ids.current = removeArrayAt(ids.current, index); + updateValues(updatedFieldArrayValues); + setFields(updatedFieldArrayValues); + !Array.isArray(get(control._fields, name)) && set(control._fields, name, void 0); + control._setFieldArray(name, updatedFieldArrayValues, removeArrayAt, { argA: index }); + }; + const insert$1 = (index, value, options) => { + if (disabled) return; + const insertValue = convertToArrayPayload(cloneObject(value)); + const updatedFieldArrayValues = insert(control._getFieldArray(name), index, insertValue); + control._names.focus = getFocusFieldName(name, index, options); + ids.current = insert(ids.current, index, insertValue.map(generateId)); + updateValues(updatedFieldArrayValues); + setFields(updatedFieldArrayValues); + control._setFieldArray(name, updatedFieldArrayValues, insert, { + argA: index, + argB: fillEmptyArray(value) + }); + }; + const swap = (indexA, indexB) => { + if (disabled) return; + const updatedFieldArrayValues = control._getFieldArray(name); + swapArrayAt(updatedFieldArrayValues, indexA, indexB); + swapArrayAt(ids.current, indexA, indexB); + updateValues(updatedFieldArrayValues); + setFields(updatedFieldArrayValues); + control._setFieldArray(name, updatedFieldArrayValues, swapArrayAt, { + argA: indexA, + argB: indexB + }, false); + }; + const move = (from, to) => { + if (disabled) return; + const updatedFieldArrayValues = control._getFieldArray(name); + moveArrayAt(updatedFieldArrayValues, from, to); + moveArrayAt(ids.current, from, to); + updateValues(updatedFieldArrayValues); + setFields(updatedFieldArrayValues); + control._setFieldArray(name, updatedFieldArrayValues, moveArrayAt, { + argA: from, + argB: to + }, false); + }; + const update = (index, value) => { + if (disabled) return; + const updateValue = cloneObject(value); + const updatedFieldArrayValues = updateAt(control._getFieldArray(name), index, updateValue); + ids.current = [...updatedFieldArrayValues].map((item, i) => !item || i === index ? generateId() : ids.current[i]); + updateValues(updatedFieldArrayValues); + setFields([...updatedFieldArrayValues]); + control._setFieldArray(name, updatedFieldArrayValues, updateAt, { + argA: index, + argB: fillEmptyArray(value) + }); + }; + const replace = (value) => { + if (disabled) return; + const updatedFieldArrayValues = convertToArrayPayload(cloneObject(value)); + ids.current = updatedFieldArrayValues.map(generateId); + updateValues([...updatedFieldArrayValues]); + setFields([...updatedFieldArrayValues]); + control._setFieldArray(name, [...updatedFieldArrayValues], (data) => data, {}, true, false); + }; + import_react.useEffect(() => { + if (disabled) { + control._state.actionArrayLengths.delete(name); + return; + } + control._state.action = false; + control._state.actionArrayLengths.delete(name); + isWatched(name, control._names) && control._subjects.state.next({ ...control._formState }); + const validationModes = getValidationModes(control._options.mode); + if (_actioned.current && (!validationModes.isOnSubmit || control._formState.isSubmitted) && !getValidationModes(control._options.reValidateMode).isOnSubmit && !validationModes.isOnBlur) { + if (control._options.resolver) control._runSchema([name]).then((result) => { + var _a, _b; + control._updateIsValidating([name]); + const error = get(result.errors, name); + const existingError = get(control._formState.errors, name); + const existingErrorType = existingError && (existingError.type || ((_a = existingError.root) === null || _a === void 0 ? void 0 : _a.type)); + const existingErrorMessage = existingError && (existingError.message || ((_b = existingError.root) === null || _b === void 0 ? void 0 : _b.message)); + if (existingError ? !error && existingErrorType || error && (existingErrorType !== error.type || existingErrorMessage !== error.message) : error && error.type) { + if (error) isObject(error) && !Object.keys(error).some((key) => !Number.isNaN(+key)) ? updateFieldArrayRootError(control._formState.errors, { [name]: error }, name) : set(control._formState.errors, name, error); + else unset(control._formState.errors, name); + control._subjects.state.next({ errors: control._formState.errors }); + } + }); + else { + const field = get(control._fields, name); + if (field && field._f) validateField(field, control._names.disabled, control._formValues, control._options.criteriaMode === VALIDATION_MODE.all, control._options.shouldUseNativeValidation, true).then((error) => !isEmptyObject(error) && control._subjects.state.next({ errors: updateFieldArrayRootError(control._formState.errors, error, name) })); + } + } + _actioned.current && control._subjects.state.next({ + name, + values: cloneObject(control._formValues) + }); + control._names.focus && iterateFieldsByAction(control._fields, (ref, key) => { + if (control._names.focus && key.startsWith(control._names.focus) && ref.focus) { + ref.focus(); + return 1; + } + }); + control._names.focus = ""; + control._setValid(); + _actioned.current = false; + }, [ + fields, + name, + control, + disabled + ]); + import_react.useEffect(() => { + if (!disabled) !get(control._formValues, name) && control._setFieldArray(name); + return () => { + control._state.actionArrayLengths.delete(name); + if (disabled) return; + const shouldKeepFieldArrayValues = !(control._options.shouldUnregister || shouldUnregister); + const updateMounted = (name, value) => { + const field = get(control._fields, name); + if (field && field._f) field._f.mount = value; + }; + if (_actioned.current && shouldKeepFieldArrayValues) control._subjects.state.next({ + name, + values: cloneObject(control._formValues) + }); + shouldKeepFieldArrayValues ? updateMounted(name, false) : control.unregister(name); + }; + }, [ + name, + control, + keyName, + shouldUnregister, + disabled + ]); + return { + swap: import_react.useCallback(swap, [ + updateValues, + name, + control, + disabled + ]), + move: import_react.useCallback(move, [ + updateValues, + name, + control, + disabled + ]), + prepend: import_react.useCallback(prepend, [ + updateValues, + name, + control, + disabled + ]), + append: import_react.useCallback(append, [ + updateValues, + name, + control, + disabled + ]), + remove: import_react.useCallback(remove, [ + updateValues, + name, + control, + disabled + ]), + insert: import_react.useCallback(insert$1, [ + updateValues, + name, + control, + disabled + ]), + update: import_react.useCallback(update, [ + updateValues, + name, + control, + disabled + ]), + replace: import_react.useCallback(replace, [ + updateValues, + name, + control, + disabled + ]), + fields: import_react.useMemo(() => fields.map((field, index) => ({ + ...field, + ...isBoolean(disabled) ? { disabled } : {}, + [keyName]: ids.current[index] || generateId() + })), [ + fields, + keyName, + disabled + ]) + }; +} +var HookFormContext = import_react.createContext(null); +HookFormContext.displayName = "HookFormContext"; +/** +* This custom hook allows you to access the form context. useFormContext is intended to be used in deeply nested structures, where it would become inconvenient to pass the context as a prop. To be used with {@link FormProvider}. +* +* @remarks +* [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi) +* +* @returns return all useForm methods +* +* @example +* ```tsx +* function App() { +* const methods = useForm(); +* const onSubmit = data => console.log(data); +* +* return ( +* +*
+* +* +* +*
+* ); +* } +* +* function NestedInput() { +* const { register } = useFormContext(); // retrieve all hook methods +* return ; +* } +* ``` +*/ +var useFormContext = () => import_react.useContext(HookFormContext); +/** +* A provider component that propagates the `useForm` methods to all children components via [React Context](https://react.dev/reference/react/useContext) API. To be used with {@link useFormContext}. +* +* @remarks +* [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi) +* +* @param props - all useForm methods +* +* @example +* ```tsx +* function App() { +* const methods = useForm(); +* const onSubmit = data => console.log(data); +* +* return ( +* +*
+* +* +* +*
+* ); +* } +* +* function NestedInput() { +* const { register } = useFormContext(); // retrieve all hook methods +* return ; +* } +* ``` +*/ +var FormProvider = ({ children, watch, getValues, getErrors, getFieldState, setError, clearErrors, setValue, setValues, trigger, formState, resetField, reset, resetDefaultValues, handleSubmit, unregister, control, register, setFocus, subscribe }) => { + const memoizedValue = import_react.useMemo(() => ({ + watch, + getValues, + getErrors, + getFieldState, + setError, + clearErrors, + setValue, + setValues, + trigger, + formState, + resetField, + reset, + resetDefaultValues, + handleSubmit, + unregister, + control, + register, + setFocus, + subscribe + }), [ + clearErrors, + control, + formState, + getErrors, + getFieldState, + getValues, + handleSubmit, + register, + reset, + resetDefaultValues, + resetField, + setError, + setFocus, + setValue, + setValues, + subscribe, + trigger, + unregister, + watch + ]); + return import_react.createElement(HookFormContext.Provider, { value: memoizedValue }, import_react.createElement(HookFormControlContext.Provider, { value: memoizedValue.control }, children)); +}; +var createSubject = () => { + let _observers = []; + const next = (value) => { + for (const observer of _observers) observer.next && observer.next(value); + }; + const subscribe = (observer) => { + _observers.push(observer); + return { unsubscribe: () => { + _observers = _observers.filter((o) => o !== observer); + } }; + }; + const unsubscribe = () => { + _observers = []; + }; + return { + get observers() { + return _observers; + }, + next, + subscribe, + unsubscribe + }; +}; +function extractFormValues(fieldsState, formValues) { + const values = {}; + for (const key in fieldsState) if (fieldsState.hasOwnProperty(key)) { + const fieldState = fieldsState[key]; + const fieldValue = formValues[key]; + if (fieldState && isObject(fieldState) && fieldValue) { + const nestedFieldsState = extractFormValues(fieldState, fieldValue); + if (isObject(nestedFieldsState)) values[key] = nestedFieldsState; + } else if (fieldsState[key]) values[key] = fieldValue; + } + return values; +} +var hasOwn = (value, key) => value !== null && isObjectType(value) && Object.prototype.hasOwnProperty.call(value, key); +var has = (object, path) => { + if (!path) return false; + let result = object; + for (const key of isKey(path) ? [path] : stringToPath(path)) { + if (!hasOwn(result, key)) return hasOwn(object, path); + result = result[key]; + } + return true; +}; +var isMultipleSelect = (element) => element.type === `select-multiple`; +var isRadioOrCheckbox = (ref) => isRadioInput(ref) || isCheckBoxInput(ref); +var live = (ref) => isHTMLElement(ref) && ref.isConnected; +function isDirtyContainer(value) { + return Array.isArray(value) || isObject(value); +} +function collectDirtyFieldNames(dirtyTree, cachedDirtyFields, prefix = "", names = []) { + for (const key in dirtyTree) { + const path = prefix ? `${prefix}.${key}` : key; + const value = dirtyTree[key]; + if (isDirtyContainer(value) && isDirtyContainer(get(cachedDirtyFields, path))) collectDirtyFieldNames(value, cachedDirtyFields, path, names); + else names.push(path); + } + return names; +} +var objectHasFunction = (data) => { + for (const key in data) if (isFunction(data[key])) return true; + return false; +}; +function isTraversable(value) { + return Array.isArray(value) || isObject(value) && !objectHasFunction(value); +} +function isRegisteredLeaf(fieldRef) { + return !!(fieldRef && "_f" in fieldRef); +} +function isEmptyDirtyContainer(value) { + return Array.isArray(value) ? !value.some((item) => !isUndefined(item)) : !Object.keys(value).length; +} +function clearDirtyField(container, key) { + if (Array.isArray(container)) container[key] = void 0; + else delete container[key]; +} +function markFieldsDirty(data, fields = {}, fieldRefs) { + for (const key in data) { + const value = data[key]; + const fieldRef = fieldRefs && fieldRefs[key]; + if (isTraversable(value) && (!Array.isArray(value) || !isRegisteredLeaf(fieldRef))) { + fields[key] = Array.isArray(value) ? [] : {}; + markFieldsDirty(value, fields[key], fieldRef); + if (isEmptyDirtyContainer(fields[key])) clearDirtyField(fields, key); + } else if (!isUndefined(value)) fields[key] = true; + } + return fields; +} +function getDirtyFields(data, formValues, dirtyFieldsFromValues, fieldRefs) { + if (!dirtyFieldsFromValues) dirtyFieldsFromValues = markFieldsDirty(formValues, {}, fieldRefs); + for (const key in data) { + const value = data[key]; + const fieldRef = fieldRefs && fieldRefs[key]; + if (isTraversable(value) && (!Array.isArray(value) || !isRegisteredLeaf(fieldRef))) { + if (isUndefined(formValues) || isPrimitive(dirtyFieldsFromValues[key])) dirtyFieldsFromValues[key] = markFieldsDirty(value, Array.isArray(value) ? [] : {}, fieldRef); + else getDirtyFields(value, isNullOrUndefined(formValues) ? {} : formValues[key], dirtyFieldsFromValues[key], fieldRef); + if (isEmptyDirtyContainer(dirtyFieldsFromValues[key])) clearDirtyField(dirtyFieldsFromValues, key); + } else if (deepEqual(value, formValues[key])) clearDirtyField(dirtyFieldsFromValues, key); + else dirtyFieldsFromValues[key] = true; + } + return dirtyFieldsFromValues; +} +var getFieldArrayItemNames = (names, name) => { + const segments = name.split("."); + const matches = []; + let prefix = segments[0]; + for (let i = 1; i < segments.length; prefix += "." + segments[i++]) if (!isNaN(+segments[i]) && names.has(prefix)) matches.push(`${prefix}.${segments[i]}`); + return matches; +}; +var getFieldValueAs = (value, { valueAsNumber, valueAsDate, setValueAs }) => isUndefined(value) ? value : valueAsNumber ? value === "" ? NaN : value ? +value : value : valueAsDate && isString(value) ? new Date(value) : setValueAs ? setValueAs(value) : value; +function getFieldValue(_f) { + const ref = _f.ref; + if (isFileInput(ref)) return ref.files; + if (isRadioInput(ref)) return getRadioValue(_f.refs).value; + if (isMultipleSelect(ref)) return [...ref.selectedOptions].map(({ value }) => value); + if (isCheckBoxInput(ref)) return getCheckboxValue(_f.refs).value; + return getFieldValueAs(ref.value, _f); +} +var getResolverOptions = (fieldsNames, _fields, criteriaMode, shouldUseNativeValidation) => { + const fields = {}; + for (const name of fieldsNames) { + const field = get(_fields, name); + field && set(fields, name, field._f); + } + return { + criteriaMode, + names: [...fieldsNames], + fields, + shouldUseNativeValidation + }; +}; +var getRuleValue = (rule) => isUndefined(rule) ? rule : isRegex(rule) ? rule.source : isObject(rule) ? isRegex(rule.value) ? rule.value.source : rule.value : rule; +var ASYNC_FUNCTION = "AsyncFunction"; +var hasPromiseValidation = (fieldReference) => { + if (!fieldReference || !fieldReference.validate) return false; + if (isFunction(fieldReference.validate)) return fieldReference.validate.constructor.name === ASYNC_FUNCTION; + if (isObject(fieldReference.validate)) { + for (const key in fieldReference.validate) if (fieldReference.validate[key].constructor.name === ASYNC_FUNCTION) return true; + } + return false; +}; +var hasValidation = (options) => options.mount && (options.required || !isUndefined(options.required) && options.required !== false || !isUndefined(options.min) || !isUndefined(options.max) || !isUndefined(options.maxLength) || !isUndefined(options.minLength) || options.pattern || options.validate); +function schemaErrorLookup(errors, _fields, name) { + const error = get(errors, name); + if (error || isKey(name)) return { + error, + name + }; + const names = name.split("."); + while (names.length) { + const fieldName = names.join("."); + const field = get(_fields, fieldName); + const foundError = get(errors, fieldName); + if (field && !Array.isArray(field) && name !== fieldName) return { name }; + if (foundError && foundError.type) return { + name: fieldName, + error: foundError + }; + if (foundError && foundError.root && foundError.root.type) return { + name: `${fieldName}.root`, + error: foundError.root + }; + names.pop(); + } + return { name }; +} +var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => { + updateFormState(formStateData); + const keys = Object.keys(formStateData).filter((key) => key !== "name"); + return !keys.length || isRoot && keys.length >= Object.keys(_proxyFormState).length || keys.find((key) => _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all)); +}; +var shouldSubscribeByName = (name, signalName, exact) => !name || !signalName || name === signalName || convertToArrayPayload(name).some((currentName) => currentName && (exact ? currentName === signalName || currentName.startsWith(signalName + ".") : currentName.startsWith(signalName) || signalName.startsWith(currentName))); +var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode) => { + if (mode.isOnAll) return false; + else if (!isSubmitted && mode.isOnTouch) return !(isTouched || isBlurEvent); + else if (isSubmitted ? reValidateMode.isOnBlur : mode.isOnBlur) return !isBlurEvent; + else if (isSubmitted ? reValidateMode.isOnChange : mode.isOnChange) return isBlurEvent; + return true; +}; +var unsetEmptyArray = (ref, name) => { + const array = get(ref, name); + !compact(array).length && !(array !== null && array !== void 0 && array.root) && unset(ref, name); +}; +var defaultOptions = { + mode: VALIDATION_MODE.onSubmit, + reValidateMode: VALIDATION_MODE.onChange, + shouldFocusError: true +}; +var FORM_ERROR_TYPE = "form"; +var updateDirtyFields = (dirtyFields, nextDirtyFields) => { + for (const key in dirtyFields) if (!(key in nextDirtyFields)) delete dirtyFields[key]; + Object.assign(dirtyFields, nextDirtyFields); +}; +var DEFAULT_FORM_STATE = { + submitCount: 0, + isDirty: false, + isReady: false, + isValidating: false, + isSubmitted: false, + isSubmitting: false, + isSubmitSuccessful: false, + isValid: false, + touchedFields: {}, + dirtyFields: {}, + validatingFields: {} +}; +function createFormControl(props = {}) { + let _options = { + ...defaultOptions, + ...props + }; + let _formState = { + ...cloneObject(DEFAULT_FORM_STATE), + isLoading: isFunction(_options.defaultValues), + errors: _options.errors || {}, + disabled: _options.disabled || false + }; + let _fields = {}; + let _defaultValues = isObject(_options.defaultValues) || isObject(_options.values) ? cloneObject(_options.defaultValues || _options.values) || {} : {}; + let _formValues = _options.shouldUnregister ? {} : cloneObject(_defaultValues); + let _state = { + action: false, + actionArrayLengths: /* @__PURE__ */ new Map(), + mount: false, + watch: false, + keepIsValid: false + }; + let _names = { + mount: /* @__PURE__ */ new Set(), + disabled: /* @__PURE__ */ new Set(), + unMount: /* @__PURE__ */ new Set(), + array: /* @__PURE__ */ new Set(), + watch: /* @__PURE__ */ new Set(), + registerName: /* @__PURE__ */ new Set() + }; + const delayErrorCallbacks = {}; + const timers = {}; + let _valuesSubscriberCount = 0; + let _validationModeBeforeSubmit = getValidationModes(_options.mode); + let _validationModeAfterSubmit = getValidationModes(_options.reValidateMode); + const defaultProxyFormState = { + isDirty: false, + dirtyFields: false, + validatingFields: false, + touchedFields: false, + isValidating: false, + isValid: false, + errors: false + }; + const _proxyFormState = { ...defaultProxyFormState }; + let _proxySubscribeFormState = { ..._proxyFormState }; + const _subjects = { + array: createSubject(), + state: createSubject() + }; + let _setValidCallId = 0; + const shouldDisplayAllAssociatedErrors = _options.criteriaMode === VALIDATION_MODE.all; + const debounce = (name, callback) => (wait) => { + clearTimeout(timers[name]); + timers[name] = setTimeout(callback, wait); + }; + const _setValid = async (shouldUpdateValid) => { + if (_state.keepIsValid) return; + if (!_options.disabled && (_proxyFormState.isValid || _proxySubscribeFormState.isValid || shouldUpdateValid)) { + const callId = ++_setValidCallId; + let isValid; + if (_options.resolver) { + isValid = isEmptyObject((await _runSchema()).errors); + callId === _setValidCallId && _updateIsValidating(); + } else isValid = await executeBuiltInValidation({ + fields: _fields, + onlyCheckValid: true, + eventType: EVENTS.VALID + }); + if (callId === _setValidCallId && isValid !== _formState.isValid) _subjects.state.next({ isValid }); + } + }; + const _updateIsValidating = (names, isValidating) => { + if (!_options.disabled && (_proxyFormState.isValidating || _proxyFormState.validatingFields || _proxySubscribeFormState.isValidating || _proxySubscribeFormState.validatingFields)) { + (names || _names.mount).forEach((name) => { + if (name) isValidating ? set(_formState.validatingFields, name, isValidating) : unset(_formState.validatingFields, name); + }); + _subjects.state.next({ + validatingFields: _formState.validatingFields, + isValidating: !isEmptyObject(_formState.validatingFields) + }); + } + }; + const _updateDirtyFields = () => { + _formState.dirtyFields = getDirtyFields(_defaultValues, _formValues, void 0, _fields); + }; + const _setFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => { + if (args && method && !_options.disabled) { + _state.action = true; + const fields = get(_fields, name); + if (!_state.actionArrayLengths.has(name)) _state.actionArrayLengths.set(name, Array.isArray(fields) ? fields.length : 0); + if (shouldUpdateFieldsAndState && Array.isArray(fields)) { + const fieldValues = method(fields, args.argA, args.argB); + shouldSetValues && set(_fields, name, fieldValues); + } + const fieldArrayErrors = get(_formState.errors, name); + if (shouldUpdateFieldsAndState && Array.isArray(fieldArrayErrors)) { + const rootError = fieldArrayErrors.root; + const errors = method(fieldArrayErrors, args.argA, args.argB) || fieldArrayErrors; + if (rootError) errors.root = rootError; + shouldSetValues && set(_formState.errors, name, errors); + unsetEmptyArray(_formState.errors, name); + } + const touchedFieldsArray = get(_formState.touchedFields, name); + if ((_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && shouldUpdateFieldsAndState && Array.isArray(touchedFieldsArray)) { + const touchedFields = method(touchedFieldsArray, args.argA, args.argB); + shouldSetValues && set(_formState.touchedFields, name, touchedFields); + } + if (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) _updateDirtyFields(); + _subjects.state.next({ + name, + isDirty: _getDirty(name, values), + dirtyFields: _formState.dirtyFields, + errors: _formState.errors, + isValid: _formState.isValid + }); + } else set(_formValues, name, values); + }; + const updateErrors = (name, error) => { + set(_formState.errors, name, error); + _formState.errors = { ..._formState.errors }; + _subjects.state.next({ errors: _formState.errors }); + }; + const _setErrors = (errors) => { + _formState.errors = errors; + _subjects.state.next({ + errors: _formState.errors, + isValid: false + }); + }; + const hasExplicitNullIntermediate = (name) => { + const segments = isKey(name) ? [name] : stringToPath(name); + let formValues = _formValues; + let defaultValues = _defaultValues; + for (let i = 0; i < segments.length - 1; i++) { + const key = segments[i]; + formValues = isNullOrUndefined(formValues) ? formValues : formValues[key]; + defaultValues = isNullOrUndefined(defaultValues) ? defaultValues : defaultValues[key]; + if (formValues === null && defaultValues !== null) return true; + } + return false; + }; + const isStaleArrayIndex = (name) => { + if (!_state.actionArrayLengths.size) return false; + const segments = isKey(name) ? [name] : stringToPath(name); + let node = _formValues; + let path = ""; + let ownerDepth = -1; + let ownerPreActionLength = 0; + for (let i = 0; i < segments.length; i++) { + if (isNullOrUndefined(node)) return false; + const key = segments[i]; + path = path ? `${path}.${key}` : key; + if (Array.isArray(node) && +key >= node.length) return ownerDepth === -1 ? false : i === ownerDepth ? +key < ownerPreActionLength : true; + if (_state.actionArrayLengths.has(path)) { + ownerDepth = i + 1; + ownerPreActionLength = _state.actionArrayLengths.get(path); + } + node = node[key]; + } + return false; + }; + const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => { + const field = get(_fields, name); + if (field) { + if (hasExplicitNullIntermediate(name) || isStaleArrayIndex(name)) return; + const wasUnsetInFormValues = isUndefined(get(_formValues, name)); + const defaultValue = get(_formValues, name, isUndefined(value) ? get(_defaultValues, name) : value); + isUndefined(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f)) : setFieldValue(name, defaultValue); + if (_state.mount && !_state.action) { + _setValid(); + if (wasUnsetInFormValues && _formState.isDirty && (_proxyFormState.isDirty || _proxySubscribeFormState.isDirty)) { + if (!_getDirty()) { + _formState.isDirty = false; + _subjects.state.next({ ..._formState }); + } + } + if (props.shouldUnregister && wasUnsetInFormValues && !isUndefined(get(_formValues, name)) && isWatched(name, _names)) _state.watch = true; + } + } + }; + const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => { + let shouldUpdateField = false; + let isPreviousDirty = false; + const output = { name }; + if (!_options.disabled || shouldDirty === true) { + if (!isBlurEvent || shouldDirty) { + const isCurrentFieldPristine = deepEqual(get(_defaultValues, name), fieldValue); + if (_proxyFormState.isDirty || _proxySubscribeFormState.isDirty) { + isPreviousDirty = _formState.isDirty; + _formState.isDirty = output.isDirty = !isCurrentFieldPristine || _getDirty(); + shouldUpdateField = isPreviousDirty !== output.isDirty; + } + isPreviousDirty = !!get(_formState.dirtyFields, name); + if (isCurrentFieldPristine !== _formState.isDirty) updateDirtyFields(_formState.dirtyFields, getDirtyFields(_defaultValues, _formValues, void 0, _fields)); + else isCurrentFieldPristine ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true); + output.dirtyFields = _formState.dirtyFields; + shouldUpdateField = shouldUpdateField || (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) && isPreviousDirty !== !isCurrentFieldPristine; + } + if (isBlurEvent) { + const isPreviousFieldTouched = get(_formState.touchedFields, name); + if (!isPreviousFieldTouched) { + set(_formState.touchedFields, name, isBlurEvent); + output.touchedFields = _formState.touchedFields; + shouldUpdateField = shouldUpdateField || (_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && isPreviousFieldTouched !== isBlurEvent; + } + } + shouldUpdateField && shouldRender && _subjects.state.next(output); + } + return shouldUpdateField ? output : {}; + }; + const shouldRenderByError = (name, isValid, error, fieldState) => { + const previousFieldError = get(_formState.errors, name); + const shouldUpdateValid = (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isBoolean(isValid) && _formState.isValid !== isValid; + if (_options.delayError && error) { + delayErrorCallbacks[name] = debounce(name, () => updateErrors(name, error)); + delayErrorCallbacks[name](_options.delayError); + } else { + clearTimeout(timers[name]); + delete delayErrorCallbacks[name]; + error ? set(_formState.errors, name, error) : unset(_formState.errors, name); + _formState.errors = { ..._formState.errors }; + } + if ((error ? !deepEqual(previousFieldError, error) : previousFieldError) || !isEmptyObject(fieldState) || shouldUpdateValid) { + const updatedFormState = { + ...fieldState, + ...shouldUpdateValid && isBoolean(isValid) ? { isValid } : {}, + errors: _formState.errors, + name + }; + _subjects.state.next(updatedFormState); + } + }; + const _runSchema = async (name) => { + _updateIsValidating(name, true); + return await _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation)); + }; + const executeSchemaAndUpdateState = async (names) => { + const { errors } = await _runSchema(names); + _updateIsValidating(names); + if (names) { + for (const name of names) { + const error = get(errors, name); + error ? _names.array.has(name) && isObject(error) && !Object.keys(error).some((key) => !Number.isNaN(Number(key))) ? updateFieldArrayRootError(_formState.errors, { [name]: error }, name) : set(_formState.errors, name, error) : unset(_formState.errors, name); + } + _formState.errors = { ..._formState.errors }; + } else _formState.errors = errors; + return errors; + }; + const validateForm = async ({ name, eventType }) => { + if (props.validate) { + const result = await props.validate({ + formValues: _formValues, + formState: _formState, + name, + eventType + }); + if (isObject(result)) for (const key in result) { + const error = result[key]; + if (error) setError(`${FORM_ERROR_TYPE}.${key}`, { + message: isString(error.message) ? error.message : "", + type: error.type || INPUT_VALIDATION_RULES.validate + }); + } + else if (isString(result) || !result) setError(FORM_ERROR_TYPE, { + message: result || "", + type: INPUT_VALIDATION_RULES.validate + }); + else clearErrors(FORM_ERROR_TYPE); + return result; + } + return true; + }; + const executeBuiltInValidation = async ({ fields, onlyCheckValid, name, eventType, context = { + valid: true, + runRootValidation: false + } }) => { + if (props.validate) { + context.runRootValidation = true; + if (!await validateForm({ + name, + eventType + })) { + context.valid = false; + if (onlyCheckValid) return context.valid; + } + } + for (const name in fields) { + const field = fields[name]; + if (field) { + const { _f, ...fieldValue } = field; + if (_f) { + const isFieldArrayRoot = _names.array.has(_f.name); + const isPromiseFunction = field._f && hasPromiseValidation(field._f); + const shouldTrackIsValidatingState = _proxyFormState.validatingFields || _proxyFormState.isValidating || _proxySubscribeFormState.validatingFields || _proxySubscribeFormState.isValidating; + if (isPromiseFunction && shouldTrackIsValidatingState) _updateIsValidating([_f.name], true); + const fieldError = await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !onlyCheckValid, isFieldArrayRoot); + if (isPromiseFunction && shouldTrackIsValidatingState) _updateIsValidating([_f.name]); + if (fieldError[_f.name]) { + context.valid = false; + if (onlyCheckValid) break; + } + !onlyCheckValid && (get(fieldError, _f.name) ? isFieldArrayRoot ? updateFieldArrayRootError(_formState.errors, fieldError, _f.name) : set(_formState.errors, _f.name, fieldError[_f.name]) : unset(_formState.errors, _f.name)); + if (props.shouldUseNativeValidation && fieldError[_f.name]) break; + } + !isEmptyObject(fieldValue) && await executeBuiltInValidation({ + context, + onlyCheckValid, + fields: fieldValue, + name, + eventType + }); + } + } + return context.valid; + }; + const _removeUnmounted = () => { + for (const name of _names.unMount) { + const field = get(_fields, name); + field && (field._f.refs ? field._f.refs.every((ref) => !live(ref)) : !live(field._f.ref)) && unregister(name); + } + _names.unMount = /* @__PURE__ */ new Set(); + }; + const _getDirty = (name, data) => (name && data && set(_formValues, name, data), !deepEqual(_state.mount ? _formValues : _defaultValues, _defaultValues)); + const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, { ..._state.mount ? _formValues : isUndefined(defaultValue) || isString(names) ? _defaultValues : defaultValue }, isGlobal, defaultValue); + const _getFieldArray = (name) => compact(get(_state.mount ? _formValues : _defaultValues, name, _options.shouldUnregister ? get(_defaultValues, name, []) : [])); + const setFieldValue = (name, value, options = {}, skipClone = false, skipRender = false, skipValueRender = false) => { + const field = get(_fields, name); + let fieldValue = value; + if (field) { + const fieldReference = field._f; + if (fieldReference) { + !fieldReference.disabled && set(_formValues, name, getFieldValueAs(value, fieldReference)); + fieldValue = isHTMLElement(fieldReference.ref) && isNullOrUndefined(value) ? "" : value; + if (isMultipleSelect(fieldReference.ref)) [...fieldReference.ref.options].forEach((optionRef) => optionRef.selected = fieldValue.includes(optionRef.value)); + else if (fieldReference.refs) { + if (isCheckBoxInput(fieldReference.ref)) fieldReference.refs.forEach((checkboxRef) => { + if (!checkboxRef.defaultChecked || !checkboxRef.disabled) { + if (Array.isArray(fieldValue)) checkboxRef.checked = !!fieldValue.find((data) => data === checkboxRef.value); + else checkboxRef.checked = fieldValue === checkboxRef.value || !!fieldValue; + } + }); + else fieldReference.refs.forEach((radioRef) => radioRef.checked = radioRef.value === fieldValue); + } else if (isFileInput(fieldReference.ref)) fieldReference.ref.value = ""; + else { + fieldReference.ref.value = fieldValue; + if (!fieldReference.ref.type && !skipRender && !skipValueRender) _subjects.state.next({ + name, + values: skipClone ? _formValues : cloneObject(_formValues) + }); + } + } + } + (options.shouldDirty || options.shouldTouch) && updateTouchAndDirty(name, fieldValue, options.shouldTouch, options.shouldDirty, !skipRender); + options.shouldValidate && trigger(name, { delayError: options.delayError }); + }; + const setFieldValues = (name, value, options, skipClone = false, skipRender = false, skipValueRender = false) => { + if (_names.array.has(name)) _subjects.array.next({ + name, + values: skipClone ? _formValues : cloneObject(_formValues) + }); + for (const fieldKey in value) { + if (!value.hasOwnProperty(fieldKey)) continue; + const fieldValue = value[fieldKey]; + const fieldName = name + "." + fieldKey; + const field = get(_fields, fieldName); + (_names.array.has(name) || isObject(fieldValue) || field && !field._f) && !isDateObject(fieldValue) ? setFieldValues(fieldName, fieldValue, options, skipClone, skipRender, skipValueRender) : setFieldValue(fieldName, fieldValue, options, skipClone, skipRender, skipValueRender); + } + }; + const _setValue = (name, value, options, skipClone, skipStateEmit = false) => { + const field = get(_fields, name); + const isFieldArray = _names.array.has(name); + const cloneValue = skipClone ? value : cloneObject(value); + const isValueUnchanged = deepEqual(get(_formValues, name), cloneValue); + if (!isValueUnchanged) set(_formValues, name, cloneValue); + if (isFieldArray) { + _subjects.array.next({ + name, + values: skipClone ? _formValues : cloneObject(_formValues) + }); + if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields || _proxySubscribeFormState.isDirty || _proxySubscribeFormState.dirtyFields) && options.shouldDirty) { + _updateDirtyFields(); + if (!skipStateEmit) _subjects.state.next({ + name, + dirtyFields: _formState.dirtyFields, + isDirty: _getDirty(name, cloneValue) + }); + } + } else { + const isEmpty = Array.isArray(cloneValue) && !cloneValue.length || isEmptyObject(cloneValue); + const skipValueRender = !isValueUnchanged && !skipStateEmit; + if (!field || field._f || isNullOrUndefined(cloneValue) || isEmpty) setFieldValue(name, cloneValue, options, skipClone, skipStateEmit, skipValueRender); + else setFieldValues(name, cloneValue, options, skipClone, skipStateEmit, skipValueRender); + } + if (!isValueUnchanged && !skipStateEmit) { + const watched = isWatched(name, _names); + const values = skipClone ? _formValues : cloneObject(_formValues); + _subjects.state.next({ + ...watched && _formState, + name: _state.mount || watched ? name : void 0, + values + }); + if (!isFieldArray) for (const itemName of getFieldArrayItemNames(_names.array, name)) _subjects.state.next({ + name: itemName, + values + }); + } + }; + const setValue = (name, value, options = {}) => _setValue(name, value, options, false); + const setValues = (formValues, options = {}) => { + const updatedFormValues = isFunction(formValues) ? formValues(_formValues) : formValues; + if (!deepEqual(_formValues, updatedFormValues)) { + _formValues = { + ..._formValues, + ...updatedFormValues + }; + for (const fieldName of _names.mount) if (has(updatedFormValues, fieldName)) _setValue(fieldName, get(updatedFormValues, fieldName), options, true, true); + _subjects.state.next({ + ..._formState, + name: void 0, + type: void 0, + ..._valuesSubscriberCount ? { values: _formValues } : {} + }); + if (options.shouldValidate) _setValid(); + } + }; + const onChange = async (event) => { + _state.mount = true; + const target = event.target; + let name = target.name; + let isFieldValueUpdated = true; + const field = get(_fields, name); + const _updateIsFieldValueUpdated = (fieldValue) => { + isFieldValueUpdated = Number.isNaN(fieldValue) || isDateObject(fieldValue) && isNaN(fieldValue.getTime()) || deepEqual(fieldValue, get(_formValues, name, fieldValue)); + }; + if (field) { + let error; + let isValid; + const fieldValue = target.type ? getFieldValue(field._f) : getEventValue(event); + const isBlurEvent = event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT; + const hasNoValidationEffect = !hasValidation(field._f) && !props.validate && !_options.resolver && !get(_formState.errors, name) && !field._f.deps; + const shouldSkipValidation = hasNoValidationEffect || skipValidation(isBlurEvent, get(_formState.touchedFields, name), _formState.isSubmitted, _validationModeAfterSubmit, _validationModeBeforeSubmit); + const watched = isWatched(name, _names, isBlurEvent); + set(_formValues, name, cloneObject(fieldValue)); + if (isBlurEvent) { + if (!target || !target.readOnly) { + field._f.onBlur && field._f.onBlur(event); + const pendingDelayError = delayErrorCallbacks[name]; + pendingDelayError && pendingDelayError(0); + } + } else if (field._f.onChange) field._f.onChange(event); + const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent); + const shouldRender = !isEmptyObject(fieldState) || watched; + !isBlurEvent && _subjects.state.next({ + name, + type: event.type, + ..._valuesSubscriberCount ? { values: cloneObject(_formValues) } : {} + }); + if (shouldSkipValidation) { + if ((!hasNoValidationEffect || !_formState.isValid) && (_proxyFormState.isValid || _proxySubscribeFormState.isValid)) { + if (_options.mode === "onBlur") { + if (isBlurEvent) _setValid(); + } else if (!isBlurEvent) _setValid(); + } + return shouldRender && _subjects.state.next({ + name, + ...watched ? {} : fieldState + }); + } + if (!_options.resolver && props.validate) await validateForm({ + name, + eventType: event.type + }); + !isBlurEvent && watched && _subjects.state.next({ ..._formState }); + if (_options.resolver) { + const { errors } = await _runSchema([name]); + _updateIsValidating([name]); + _updateIsFieldValueUpdated(fieldValue); + if (!isFieldValueUpdated) { + !isEmptyObject(fieldState) && _subjects.state.next(fieldState); + return; + } + const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name); + const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name); + error = errorLookupResult.error; + name = errorLookupResult.name; + isValid = isEmptyObject(errors); + } else { + _updateIsValidating([name], true); + error = (await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name]; + _updateIsValidating([name]); + _updateIsFieldValueUpdated(fieldValue); + if (isFieldValueUpdated) { + if (error) isValid = false; + else if (_proxyFormState.isValid || _proxySubscribeFormState.isValid) isValid = await executeBuiltInValidation({ + fields: _fields, + onlyCheckValid: true, + name, + eventType: event.type + }); + } + } + if (isFieldValueUpdated) { + field._f.deps && (!Array.isArray(field._f.deps) || field._f.deps.length > 0) && trigger(field._f.deps); + shouldRenderByError(name, isValid, error, fieldState); + } + } + }; + const _focusInput = (ref, key) => { + if (get(_formState.errors, key) && ref.focus) { + ref.focus(); + return 1; + } + }; + const trigger = async (name, options = {}) => { + let isValid; + let validationResult; + const fieldNames = convertToArrayPayload(name); + if (_options.resolver) { + const errors = await executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames); + isValid = isEmptyObject(errors); + validationResult = name ? !fieldNames.some((name) => get(errors, name)) : isValid; + } else if (name) { + validationResult = (await Promise.all(fieldNames.map(async (fieldName) => { + const field = get(_fields, fieldName); + return await executeBuiltInValidation({ + fields: field && field._f ? { [fieldName]: field } : field, + eventType: EVENTS.TRIGGER + }); + }))).every(Boolean); + !(!validationResult && !_formState.isValid) && _setValid(); + } else validationResult = isValid = await executeBuiltInValidation({ + fields: _fields, + name, + eventType: EVENTS.TRIGGER + }); + if (options.delayError && _options.delayError && isString(name)) { + const error = get(_formState.errors, name); + if (error) { + unset(_formState.errors, name); + delayErrorCallbacks[name] = debounce(name, () => updateErrors(name, error)); + delayErrorCallbacks[name](_options.delayError); + } else { + clearTimeout(timers[name]); + delete delayErrorCallbacks[name]; + } + } + if (options.shouldTouch) for (const fieldName of name ? fieldNames : _names.mount) !_names.array.has(fieldName) && set(_formState.touchedFields, fieldName, true); + _subjects.state.next({ + ...!isString(name) || (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isValid !== _formState.isValid ? {} : { name }, + ..._options.resolver || !name ? { isValid } : {}, + ...options.shouldTouch && (_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) ? { touchedFields: _formState.touchedFields } : {}, + errors: _formState.errors + }); + options.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount); + return validationResult; + }; + const getValues = (fieldNames, config) => { + let values = { ..._state.mount ? _formValues : _defaultValues }; + if (config) values = extractFormValues(config.dirtyFields ? _formState.dirtyFields : _formState.touchedFields, values); + return isUndefined(fieldNames) ? values : isString(fieldNames) ? get(values, fieldNames) : fieldNames.map((name) => get(values, name)); + }; + const getErrors = (fieldNames) => isUndefined(fieldNames) ? { ..._formState.errors } : isString(fieldNames) ? get(_formState.errors, fieldNames) : fieldNames.map((name) => get(_formState.errors, name)); + const getFieldState = (name, formState) => { + const targetFormState = formState || _formState; + const error = get(targetFormState.errors, name); + return { + invalid: !!error, + isDirty: !!get(targetFormState.dirtyFields, name), + error, + isValidating: !!get(_formState.validatingFields, name), + isTouched: !!get(targetFormState.touchedFields, name) + }; + }; + const clearErrors = (name) => { + const names = name ? convertToArrayPayload(name) : void 0; + names === null || names === void 0 || names.forEach((inputName) => unset(_formState.errors, inputName)); + if (names) names.forEach((inputName) => { + _subjects.state.next({ + name: inputName, + errors: _formState.errors + }); + }); + else { + _formState.errors = {}; + _subjects.state.next({ errors: _formState.errors }); + } + }; + const setError = (name, error, options) => { + const ref = (get(_fields, name, { _f: {} })._f || {}).ref; + const { ref: currentRef, message, type, ...restOfErrorTree } = get(_formState.errors, name) || {}; + set(_formState.errors, name, { + ...restOfErrorTree, + ...error, + ref + }); + _subjects.state.next({ + name, + errors: _formState.errors, + isValid: false + }); + options && options.shouldFocus && ref && ref.focus && ref.focus(); + }; + const watch = (name, defaultValue) => { + if (isFunction(name)) { + _valuesSubscriberCount++; + const { unsubscribe } = _subjects.state.subscribe({ next: (payload) => "values" in payload && name(payload.values || _getWatch(void 0, defaultValue), payload) }); + let called = false; + return { unsubscribe: () => { + if (called) return; + called = true; + _valuesSubscriberCount--; + unsubscribe(); + } }; + } + return _getWatch(name, defaultValue, true); + }; + const _subscribe = (props) => { + var _a; + const needsValues = !!((_a = props.formState) === null || _a === void 0 ? void 0 : _a.values); + if (needsValues) _valuesSubscriberCount++; + const { unsubscribe } = _subjects.state.subscribe({ next: (formState) => { + if (shouldSubscribeByName(props.name, formState.name, props.exact) && shouldRenderFormState(formState, props.formState || _proxyFormState, _setFormState, props.reRenderRoot)) { + const snapshot = { ..._formValues }; + props.callback({ + values: snapshot, + ..._formState, + ...formState, + defaultValues: _defaultValues + }); + } + } }); + if (!needsValues) return unsubscribe; + let called = false; + return () => { + if (called) return; + called = true; + _valuesSubscriberCount--; + unsubscribe(); + }; + }; + const subscribe = (props) => { + _state.mount = true; + _proxySubscribeFormState = { + ..._proxySubscribeFormState, + ...props.formState + }; + return _subscribe({ + ...props, + formState: { + ...defaultProxyFormState, + ...props.formState + } + }); + }; + const unregister = (name, options = {}) => { + for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) { + _names.mount.delete(fieldName); + _names.array.delete(fieldName); + if (!options.keepValue) { + unset(_fields, fieldName); + unset(_formValues, fieldName); + } + !options.keepError && unset(_formState.errors, fieldName); + !options.keepDirty && unset(_formState.dirtyFields, fieldName); + !options.keepTouched && unset(_formState.touchedFields, fieldName); + !options.keepIsValidating && unset(_formState.validatingFields, fieldName); + !_options.shouldUnregister && !options.keepDefaultValue && unset(_defaultValues, fieldName); + } + _valuesSubscriberCount && _subjects.state.next({ values: cloneObject(_formValues) }); + _subjects.state.next({ + ..._formState, + ...options.keepDirty ? {} : { isDirty: _getDirty() } + }); + !options.keepIsValid && _setValid(); + }; + const _setDisabledField = ({ disabled, name }) => { + if (isBoolean(disabled) && _state.mount || !!disabled || _names.disabled.has(name)) { + const disabledStateChanged = _names.disabled.has(name) !== !!disabled; + disabled ? _names.disabled.add(name) : _names.disabled.delete(name); + disabledStateChanged && _state.mount && !_state.action && _setValid(); + } + }; + const register = (name, options = {}) => { + let field = get(_fields, name); + const disabledIsDefined = isBoolean(options.disabled) || isBoolean(_options.disabled); + const shouldRevalidateRemount = !_names.registerName.has(name) && field && field._f && !field._f.mount; + set(_fields, name, { + ...field || {}, + _f: { + ...field && field._f ? field._f : { ref: { name } }, + name, + mount: true, + ...options + } + }); + _names.mount.add(name); + if (field && !shouldRevalidateRemount) _setDisabledField({ + disabled: isBoolean(options.disabled) ? options.disabled : _options.disabled, + name + }); + else updateValidAndValue(name, true, options.value); + return { + ...disabledIsDefined ? { disabled: options.disabled || _options.disabled } : {}, + ..._options.progressive ? { + required: !!options.required, + min: getRuleValue(options.min), + max: getRuleValue(options.max), + minLength: getRuleValue(options.minLength), + maxLength: getRuleValue(options.maxLength), + pattern: getRuleValue(options.pattern) + } : {}, + name, + onChange, + onBlur: onChange, + ref: (ref) => { + if (ref) { + _names.registerName.add(name); + register(name, options); + _names.registerName.delete(name); + field = get(_fields, name); + const fieldRef = isUndefined(ref.value) ? ref.querySelectorAll ? ref.querySelectorAll("input,select,textarea")[0] || ref : ref : ref; + const radioOrCheckbox = isRadioOrCheckbox(fieldRef); + const refs = field._f.refs || []; + if (radioOrCheckbox ? refs.find((option) => option === fieldRef) : fieldRef === field._f.ref) return; + const newField = { ...field._f }; + if (radioOrCheckbox) { + newField.refs = [ + ...refs.filter(live), + fieldRef, + ...Array.isArray(get(_defaultValues, name)) ? [{}] : [] + ]; + newField.ref = { + type: fieldRef.type, + name + }; + } else { + newField.ref = fieldRef; + delete newField.refs; + } + set(_fields, name, { _f: newField }); + updateValidAndValue(name, false, void 0, fieldRef); + } else { + field = get(_fields, name, {}); + if (field._f) field._f.mount = false; + (_options.shouldUnregister || options.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _state.action) && _names.unMount.add(name); + } + } + }; + }; + const _focusError = () => _options.shouldFocusError && !_options.shouldUseNativeValidation && iterateFieldsByAction(_fields, _focusInput, _names.mount); + const _disableForm = (disabled) => { + if (isBoolean(disabled)) { + _subjects.state.next({ disabled }); + iterateFieldsByAction(_fields, (ref, name) => { + const currentField = get(_fields, name); + if (currentField) { + ref.disabled = currentField._f.disabled || disabled; + if (Array.isArray(currentField._f.refs)) currentField._f.refs.forEach((inputRef) => { + inputRef.disabled = currentField._f.disabled || disabled; + }); + } + }, 0, false); + } + }; + const handleSubmit = (onValid, onInvalid) => async (e) => { + let result = void 0; + let onValidError = void 0; + if (e) { + e.preventDefault && e.preventDefault(); + e.persist && e.persist(); + } + let fieldValues = cloneObject(_formValues); + _subjects.state.next({ isSubmitting: true }); + if (_options.resolver) { + const { errors, values } = await _runSchema(); + _updateIsValidating(); + _formState.errors = errors; + fieldValues = cloneObject(values); + } else await executeBuiltInValidation({ + fields: _fields, + eventType: EVENTS.SUBMIT + }); + if (_names.disabled.size) for (const name of _names.disabled) unset(fieldValues, name); + unset(_formState.errors, ROOT_ERROR_TYPE); + if (isEmptyObject(_formState.errors)) { + _subjects.state.next({ errors: {} }); + try { + result = await onValid(fieldValues, e); + } catch (error) { + onValidError = error; + } + } else { + if (onInvalid) await onInvalid({ ..._formState.errors }, e); + _focusError(); + setTimeout(_focusError); + } + _subjects.state.next({ + isSubmitted: true, + isSubmitting: false, + isSubmitSuccessful: isEmptyObject(_formState.errors) && !onValidError, + submitCount: _formState.submitCount + 1, + errors: _formState.errors + }); + if (onValidError) throw onValidError; + return result; + }; + const resetField = (name, options = {}) => { + if (get(_fields, name)) { + if (isUndefined(options.defaultValue)) setValue(name, cloneObject(get(_defaultValues, name))); + else { + setValue(name, options.defaultValue); + set(_defaultValues, name, cloneObject(options.defaultValue)); + } + if (!options.keepTouched) unset(_formState.touchedFields, name); + if (!options.keepDirty) { + unset(_formState.dirtyFields, name); + _formState.isDirty = options.defaultValue ? _getDirty(name, cloneObject(get(_defaultValues, name))) : _getDirty(); + } + if (!options.keepError) { + unset(_formState.errors, name); + _setValid(); + } + _subjects.state.next({ ..._formState }); + } + }; + const _reset = (formValues, keepStateOptions = {}) => { + const updatedValues = formValues ? cloneObject(formValues) : _defaultValues; + const cloneUpdatedValues = cloneObject(updatedValues); + const isEmptyResetValues = isEmptyObject(formValues); + const values = cloneUpdatedValues; + const fieldRefs = _fields; + if (!keepStateOptions.keepDefaultValues) _defaultValues = updatedValues; + if (!keepStateOptions.keepValues) { + if (keepStateOptions.keepDirtyValues) { + const fieldsToCheck = /* @__PURE__ */ new Set([..._names.mount, ...collectDirtyFieldNames(getDirtyFields(_defaultValues, _formValues, void 0, fieldRefs), _formState.dirtyFields)]); + for (const fieldName of fieldsToCheck) { + const isDirty = get(_formState.dirtyFields, fieldName); + const existingValue = get(_formValues, fieldName); + const newValue = get(values, fieldName); + if (isDirty && !isUndefined(existingValue)) set(values, fieldName, existingValue); + else if (!isDirty && !isUndefined(newValue)) setValue(fieldName, newValue); + } + } else { + if (isWeb && isUndefined(formValues)) for (const name of _names.mount) { + const field = get(_fields, name); + if (field && field._f) { + const fieldReference = Array.isArray(field._f.refs) ? field._f.refs[0] : field._f.ref; + if (isHTMLElement(fieldReference)) { + const form = fieldReference.closest("form"); + if (form) { + form.reset(); + break; + } + } + } + } + if (keepStateOptions.keepFieldsRef) for (const fieldName of _names.mount) setValue(fieldName, get(values, fieldName)); + else _fields = {}; + } + if (_options.shouldUnregister) { + _formValues = keepStateOptions.keepDefaultValues ? cloneObject(_defaultValues) : {}; + if (keepStateOptions.keepFieldsRef) for (const fieldName of _names.mount) set(_formValues, fieldName, get(values, fieldName)); + } else _formValues = cloneObject(values); + _subjects.array.next({ values: { ...values } }); + _subjects.state.next({ + name: void 0, + type: void 0, + values: { ...values } + }); + } + _names = { + mount: keepStateOptions.keepDirtyValues ? _names.mount : /* @__PURE__ */ new Set(), + unMount: /* @__PURE__ */ new Set(), + array: /* @__PURE__ */ new Set(), + registerName: /* @__PURE__ */ new Set(), + disabled: /* @__PURE__ */ new Set(), + watch: /* @__PURE__ */ new Set(), + watchAll: false, + focus: "" + }; + _state.mount = !_proxyFormState.isValid || !!keepStateOptions.keepIsValid || !!keepStateOptions.keepDirtyValues || !_options.shouldUnregister && !isEmptyObject(values); + _state.watch = !!_options.shouldUnregister; + _state.keepIsValid = !!keepStateOptions.keepIsValid; + _state.action = false; + _state.actionArrayLengths.clear(); + if (!keepStateOptions.keepErrors) _formState.errors = {}; + _subjects.state.next({ + submitCount: keepStateOptions.keepSubmitCount ? _formState.submitCount : 0, + isDirty: isEmptyResetValues ? false : keepStateOptions.keepDirty ? _formState.isDirty : keepStateOptions.keepValues ? _getDirty() : !!(keepStateOptions.keepDefaultValues && !deepEqual(formValues, _defaultValues)), + isSubmitted: keepStateOptions.keepIsSubmitted ? _formState.isSubmitted : false, + dirtyFields: isEmptyResetValues ? {} : keepStateOptions.keepDirtyValues ? keepStateOptions.keepDefaultValues && _formValues ? getDirtyFields(_defaultValues, _formValues, void 0, fieldRefs) : _formState.dirtyFields : keepStateOptions.keepDefaultValues && formValues ? getDirtyFields(_defaultValues, formValues, void 0, fieldRefs) : keepStateOptions.keepDirty ? _formState.dirtyFields : {}, + touchedFields: keepStateOptions.keepTouched ? _formState.touchedFields : {}, + errors: keepStateOptions.keepErrors ? _formState.errors : {}, + isSubmitSuccessful: keepStateOptions.keepIsSubmitSuccessful ? _formState.isSubmitSuccessful : false, + isSubmitting: false, + defaultValues: _defaultValues + }); + }; + const reset = (formValues, keepStateOptions) => _reset(isFunction(formValues) ? formValues(_formValues) : formValues, { + ..._options.resetOptions, + ...keepStateOptions + }); + const setFocus = (name, options = {}) => { + const field = get(_fields, name); + const fieldReference = field && field._f; + if (fieldReference) { + const fieldRef = fieldReference.refs ? fieldReference.refs[0] : fieldReference.ref; + if (fieldRef.focus) setTimeout(() => { + fieldRef.focus(); + options.shouldSelect && isFunction(fieldRef.select) && fieldRef.select(); + }); + } + }; + const _setFormState = (updatedFormState) => { + const { name, type, values, ...formState } = updatedFormState; + _formState = { + ..._formState, + ...formState + }; + }; + _subjects.state.subscribe({ next: _setFormState }); + const _resetDefaultValues = () => isFunction(_options.defaultValues) && _options.defaultValues().then((values) => { + reset(values, _options.resetOptions); + _subjects.state.next({ isLoading: false }); + }); + const resetDefaultValues = (values, options = {}) => { + _defaultValues = cloneObject(values); + if (!options.keepDirty) { + const newDirtyFields = getDirtyFields(_defaultValues, _formValues, void 0, _fields); + _formState.dirtyFields = newDirtyFields; + _formState.isDirty = !isEmptyObject(newDirtyFields); + } + if (!options.keepIsValid) _setValid(); + _subjects.state.next({ + ..._formState, + defaultValues: _defaultValues + }); + }; + const methods = { + control: { + register, + unregister, + getFieldState, + handleSubmit, + setError, + _subscribe, + _runSchema, + _updateIsValidating, + _focusError, + _getWatch, + _getDirty, + _setValid, + _setFieldArray, + _setDisabledField, + _setErrors, + _getFieldArray, + _reset, + _resetDefaultValues, + _removeUnmounted, + _disableForm, + _subjects, + _proxyFormState, + get _fields() { + return _fields; + }, + get _formValues() { + return _formValues; + }, + get _state() { + return _state; + }, + set _state(value) { + _state = value; + }, + get _defaultValues() { + return _defaultValues; + }, + get _names() { + return _names; + }, + set _names(value) { + _names = value; + }, + get _formState() { + return _formState; + }, + get _options() { + return _options; + }, + set _options(value) { + _options = { + ..._options, + ...value + }; + _validationModeBeforeSubmit = getValidationModes(_options.mode); + _validationModeAfterSubmit = getValidationModes(_options.reValidateMode); + } + }, + subscribe, + trigger, + register, + handleSubmit, + watch, + setValue, + setValues, + getValues, + getErrors, + reset, + resetField, + resetDefaultValues, + clearErrors, + unregister, + setError, + setFocus, + getFieldState + }; + return { + ...methods, + formControl: methods + }; +} +/** +* Custom hook to manage the entire form. +* +* @remarks +* [API](https://react-hook-form.com/docs/useform) • [Demo](https://codesandbox.io/s/react-hook-form-get-started-ts-5ksmm) • [Video](https://www.youtube.com/watch?v=RkXv4AXXC_4) +* +* @param props - form configuration and validation parameters. +* +* @returns methods - individual functions to manage the form state. {@link UseFormReturn} +* +* @example +* ```tsx +* function App() { +* const { register, handleSubmit, watch, formState: { errors } } = useForm(); +* const onSubmit = data => console.log(data); +* +* console.log(watch("example")); +* +* return ( +*
+* +* +* {errors.exampleRequired && This field is required} +* +*
+* ); +* } +* ``` +*/ +function useForm(props = {}) { + const _formControl = import_react.useRef(void 0); + const _values = import_react.useRef(void 0); + const _formControlProp = import_react.useRef(props.formControl); + const [formState, updateFormState] = import_react.useState(() => ({ + ...cloneObject(DEFAULT_FORM_STATE), + isLoading: isFunction(props.defaultValues), + errors: props.errors || {}, + disabled: props.disabled || false, + defaultValues: isFunction(props.defaultValues) ? void 0 : props.defaultValues + })); + if (!_formControl.current || props.formControl && _formControlProp.current !== props.formControl) { + _formControlProp.current = props.formControl; + if (props.formControl) { + _formControl.current = { + ...props.formControl, + formState + }; + if (props.defaultValues && !isFunction(props.defaultValues)) props.formControl.reset(props.defaultValues, props.resetOptions); + } else { + const { formControl, ...rest } = createFormControl(props); + _formControl.current = { + ...rest, + formState + }; + } + } + const control = _formControl.current.control; + control._options = props; + const { resyncIfNeeded, snapshot } = useResyncOnReconnect(); + useIsomorphicLayoutEffect(() => { + const getCurrentFormState = () => ({ + ...control._formState, + defaultValues: control._defaultValues + }); + resyncIfNeeded(true, getCurrentFormState, updateFormState); + const unsubscribe = control._subscribe({ + formState: control._proxyFormState, + callback: () => updateFormState({ + ...control._formState, + defaultValues: control._defaultValues + }), + reRenderRoot: true + }); + updateFormState((data) => ({ + ...data, + isReady: true + })); + control._formState.isReady = true; + return () => { + unsubscribe(); + snapshot(true, getCurrentFormState); + }; + }, [ + control, + resyncIfNeeded, + snapshot + ]); + import_react.useEffect(() => control._disableForm(props.disabled), [control, props.disabled]); + import_react.useEffect(() => { + if (props.mode) control._options.mode = props.mode; + if (props.reValidateMode) control._options.reValidateMode = props.reValidateMode; + }, [ + control, + props.mode, + props.reValidateMode + ]); + import_react.useEffect(() => { + if (props.errors) { + control._setErrors(props.errors); + control._focusError(); + } + }, [control, props.errors]); + import_react.useEffect(() => { + props.shouldUnregister && control._subjects.state.next({ values: control._getWatch() }); + }, [control, props.shouldUnregister]); + import_react.useEffect(() => { + if (control._proxyFormState.isDirty) { + const isDirty = control._getDirty(); + if (isDirty !== formState.isDirty) control._subjects.state.next({ isDirty }); + } + }, [control, formState.isDirty]); + import_react.useEffect(() => { + var _a; + if (props.values && !deepEqual(props.values, _values.current)) { + control._reset(props.values, { + keepFieldsRef: true, + ...control._options.resetOptions + }); + if (!((_a = control._options.resetOptions) === null || _a === void 0 ? void 0 : _a.keepIsValid)) control._setValid(); + _values.current = props.values; + updateFormState((state) => ({ ...state })); + } else control._resetDefaultValues(); + }, [control, props.values]); + import_react.useEffect(() => { + if (!control._state.mount) { + control._setValid(); + control._state.mount = true; + } + if (control._state.watch) { + control._state.watch = false; + control._subjects.state.next({ ...control._formState }); + } + control._removeUnmounted(); + }); + _formControl.current.formState = import_react.useMemo(() => getProxyFormState(formState, control), [control, formState]); + return _formControl.current; +} +//#endregion +export { set as a, useFormContext as c, get as i, useWatch as l, FormProvider as n, useFieldArray as o, appendErrors as r, useForm as s, Controller as t }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/layout-HS0oHCMJ.js b/docker/web/nspanelmanager/web/react-components/dist/layout-HS0oHCMJ.js new file mode 100644 index 000000000..f131b10be --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/layout-HS0oHCMJ.js @@ -0,0 +1,448 @@ +import { r as require_react, t as require_jsx_runtime } from "./main-FKp56mKw.js"; +//#region node_modules/openapi-fetch/dist/index.mjs +var PATH_PARAM_RE = /\{[^{}]+\}/g; +var supportsRequestInitExt = () => { + return typeof process === "object" && Number.parseInt(process?.versions?.node?.substring(0, 2)) >= 18 && process.versions.undici; +}; +function randomID() { + return Math.random().toString(36).slice(2, 11); +} +function createClient(clientOptions) { + let { baseUrl = "", Request: CustomRequest = globalThis.Request, fetch: baseFetch = globalThis.fetch, querySerializer: globalQuerySerializer, bodySerializer: globalBodySerializer, pathSerializer: globalPathSerializer, headers: baseHeaders, requestInitExt = void 0, ...baseOptions } = { ...clientOptions }; + requestInitExt = supportsRequestInitExt() ? requestInitExt : void 0; + baseUrl = removeTrailingSlash(baseUrl); + const globalMiddlewares = []; + async function coreFetch(schemaPath, fetchOptions) { + const { baseUrl: localBaseUrl, fetch = baseFetch, Request = CustomRequest, headers, params = {}, parseAs = "json", querySerializer: requestQuerySerializer, bodySerializer = globalBodySerializer ?? defaultBodySerializer, pathSerializer: requestPathSerializer, body, middleware: requestMiddlewares = [], ...init } = fetchOptions || {}; + let finalBaseUrl = baseUrl; + if (localBaseUrl) finalBaseUrl = removeTrailingSlash(localBaseUrl) ?? baseUrl; + let querySerializer = typeof globalQuerySerializer === "function" ? globalQuerySerializer : createQuerySerializer(globalQuerySerializer); + if (requestQuerySerializer) querySerializer = typeof requestQuerySerializer === "function" ? requestQuerySerializer : createQuerySerializer({ + ...typeof globalQuerySerializer === "object" ? globalQuerySerializer : {}, + ...requestQuerySerializer + }); + const pathSerializer = requestPathSerializer || globalPathSerializer || defaultPathSerializer; + const serializedBody = body === void 0 ? void 0 : bodySerializer(body, mergeHeaders(baseHeaders, headers, params.header)); + const finalHeaders = mergeHeaders(serializedBody === void 0 || serializedBody instanceof FormData ? {} : { "Content-Type": "application/json" }, baseHeaders, headers, params.header); + const finalMiddlewares = [...globalMiddlewares, ...requestMiddlewares]; + const requestInit = { + redirect: "follow", + ...baseOptions, + ...init, + body: serializedBody, + headers: finalHeaders + }; + let id; + let options; + let request = new Request(createFinalURL(schemaPath, { + baseUrl: finalBaseUrl, + params, + querySerializer, + pathSerializer + }), requestInit); + let response; + for (const key in init) if (!(key in request)) request[key] = init[key]; + if (finalMiddlewares.length) { + id = randomID(); + options = Object.freeze({ + baseUrl: finalBaseUrl, + fetch, + parseAs, + querySerializer, + bodySerializer, + pathSerializer + }); + for (const m of finalMiddlewares) if (m && typeof m === "object" && typeof m.onRequest === "function") { + const result = await m.onRequest({ + request, + schemaPath, + params, + options, + id + }); + if (result) { + if (result instanceof Request) request = result; + else if (result instanceof Response) { + response = result; + break; + } else throw new Error("onRequest: must return new Request() or Response() when modifying the request"); + } + } + } + if (!response) { + try { + response = await fetch(request, requestInitExt); + } catch (error2) { + let errorAfterMiddleware = error2; + if (finalMiddlewares.length) for (let i = finalMiddlewares.length - 1; i >= 0; i--) { + const m = finalMiddlewares[i]; + if (m && typeof m === "object" && typeof m.onError === "function") { + const result = await m.onError({ + request, + error: errorAfterMiddleware, + schemaPath, + params, + options, + id + }); + if (result) { + if (result instanceof Response) { + errorAfterMiddleware = void 0; + response = result; + break; + } + if (result instanceof Error) { + errorAfterMiddleware = result; + continue; + } + throw new Error("onError: must return new Response() or instance of Error"); + } + } + } + if (errorAfterMiddleware) throw errorAfterMiddleware; + } + if (finalMiddlewares.length) for (let i = finalMiddlewares.length - 1; i >= 0; i--) { + const m = finalMiddlewares[i]; + if (m && typeof m === "object" && typeof m.onResponse === "function") { + const result = await m.onResponse({ + request, + response, + schemaPath, + params, + options, + id + }); + if (result) { + if (!(result instanceof Response)) throw new Error("onResponse: must return new Response() when modifying the response"); + response = result; + } + } + } + } + const contentLength = response.headers.get("Content-Length"); + if (response.status === 204 || request.method === "HEAD" || contentLength === "0" && !response.headers.get("Transfer-Encoding")?.includes("chunked")) return response.ok ? { + data: void 0, + response + } : { + error: void 0, + response + }; + if (response.ok) { + const getResponseData = async () => { + if (parseAs === "stream") return response.body; + if (parseAs === "json" && !contentLength) { + const raw = await response.text(); + return raw ? JSON.parse(raw) : void 0; + } + return await response[parseAs](); + }; + return { + data: await getResponseData(), + response + }; + } + let error = await response.text(); + try { + error = JSON.parse(error); + } catch {} + return { + error, + response + }; + } + return { + request(method, url, init) { + return coreFetch(url, { + ...init, + method: method.toUpperCase() + }); + }, + /** Call a GET endpoint */ + GET(url, init) { + return coreFetch(url, { + ...init, + method: "GET" + }); + }, + /** Call a PUT endpoint */ + PUT(url, init) { + return coreFetch(url, { + ...init, + method: "PUT" + }); + }, + /** Call a POST endpoint */ + POST(url, init) { + return coreFetch(url, { + ...init, + method: "POST" + }); + }, + /** Call a DELETE endpoint */ + DELETE(url, init) { + return coreFetch(url, { + ...init, + method: "DELETE" + }); + }, + /** Call a OPTIONS endpoint */ + OPTIONS(url, init) { + return coreFetch(url, { + ...init, + method: "OPTIONS" + }); + }, + /** Call a HEAD endpoint */ + HEAD(url, init) { + return coreFetch(url, { + ...init, + method: "HEAD" + }); + }, + /** Call a PATCH endpoint */ + PATCH(url, init) { + return coreFetch(url, { + ...init, + method: "PATCH" + }); + }, + /** Call a TRACE endpoint */ + TRACE(url, init) { + return coreFetch(url, { + ...init, + method: "TRACE" + }); + }, + /** Register middleware */ + use(...middleware) { + for (const m of middleware) { + if (!m) continue; + if (typeof m !== "object" || !("onRequest" in m || "onResponse" in m || "onError" in m)) throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`"); + globalMiddlewares.push(m); + } + }, + /** Unregister middleware */ + eject(...middleware) { + for (const m of middleware) { + const i = globalMiddlewares.indexOf(m); + if (i !== -1) globalMiddlewares.splice(i, 1); + } + } + }; +} +function serializePrimitiveParam(name, value, options) { + if (value === void 0 || value === null) return ""; + if (typeof value === "object") throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these."); + return `${name}=${options?.allowReserved === true ? value : encodeURIComponent(value)}`; +} +function serializeObjectParam(name, value, options) { + if (!value || typeof value !== "object") return ""; + const values = []; + const joiner = { + simple: ",", + label: ".", + matrix: ";" + }[options.style] || "&"; + if (options.style !== "deepObject" && options.explode === false) { + for (const k in value) values.push(k, options.allowReserved === true ? value[k] : encodeURIComponent(value[k])); + const final2 = values.join(","); + switch (options.style) { + case "form": return `${name}=${final2}`; + case "label": return `.${final2}`; + case "matrix": return `;${name}=${final2}`; + default: return final2; + } + } + for (const k in value) { + const finalName = options.style === "deepObject" ? `${name}[${k}]` : k; + values.push(serializePrimitiveParam(finalName, value[k], options)); + } + const final = values.join(joiner); + return options.style === "label" || options.style === "matrix" ? `${joiner}${final}` : final; +} +function serializeArrayParam(name, value, options) { + if (!Array.isArray(value)) return ""; + if (options.explode === false) { + const joiner2 = { + form: ",", + spaceDelimited: "%20", + pipeDelimited: "|" + }[options.style] || ","; + const final = (options.allowReserved === true ? value : value.map((v) => encodeURIComponent(v))).join(joiner2); + switch (options.style) { + case "simple": return final; + case "label": return `.${final}`; + case "matrix": return `;${name}=${final}`; + default: return `${name}=${final}`; + } + } + const joiner = { + simple: ",", + label: ".", + matrix: ";" + }[options.style] || "&"; + const values = []; + for (const v of value) if (options.style === "simple" || options.style === "label") values.push(options.allowReserved === true ? v : encodeURIComponent(v)); + else values.push(serializePrimitiveParam(name, v, options)); + return options.style === "label" || options.style === "matrix" ? `${joiner}${values.join(joiner)}` : values.join(joiner); +} +function createQuerySerializer(options) { + return function querySerializer(queryParams) { + const search = []; + if (queryParams && typeof queryParams === "object") for (const name in queryParams) { + const value = queryParams[name]; + if (value === void 0 || value === null) continue; + if (Array.isArray(value)) { + if (value.length === 0) continue; + search.push(serializeArrayParam(name, value, { + style: "form", + explode: true, + ...options?.array, + allowReserved: options?.allowReserved || false + })); + continue; + } + if (typeof value === "object") { + search.push(serializeObjectParam(name, value, { + style: "deepObject", + explode: true, + ...options?.object, + allowReserved: options?.allowReserved || false + })); + continue; + } + search.push(serializePrimitiveParam(name, value, options)); + } + return search.join("&"); + }; +} +function defaultPathSerializer(pathname, pathParams) { + let nextURL = pathname; + for (const match of pathname.match(PATH_PARAM_RE) ?? []) { + let name = match.substring(1, match.length - 1); + let explode = false; + let style = "simple"; + if (name.endsWith("*")) { + explode = true; + name = name.substring(0, name.length - 1); + } + if (name.startsWith(".")) { + style = "label"; + name = name.substring(1); + } else if (name.startsWith(";")) { + style = "matrix"; + name = name.substring(1); + } + if (!pathParams || pathParams[name] === void 0 || pathParams[name] === null) continue; + const value = pathParams[name]; + if (Array.isArray(value)) { + nextURL = nextURL.replace(match, serializeArrayParam(name, value, { + style, + explode + })); + continue; + } + if (typeof value === "object") { + nextURL = nextURL.replace(match, serializeObjectParam(name, value, { + style, + explode + })); + continue; + } + if (style === "matrix") { + nextURL = nextURL.replace(match, `;${serializePrimitiveParam(name, value)}`); + continue; + } + nextURL = nextURL.replace(match, style === "label" ? `.${encodeURIComponent(value)}` : encodeURIComponent(value)); + } + return nextURL; +} +function defaultBodySerializer(body, headers) { + if (body instanceof FormData) return body; + if (headers) { + if ((headers.get instanceof Function ? headers.get("Content-Type") ?? headers.get("content-type") : headers["Content-Type"] ?? headers["content-type"]) === "application/x-www-form-urlencoded") return new URLSearchParams(body).toString(); + } + return JSON.stringify(body); +} +function createFinalURL(pathname, options) { + let finalURL = `${options.baseUrl}${pathname}`; + if (options.params?.path) finalURL = options.pathSerializer(finalURL, options.params.path); + let search = options.querySerializer(options.params.query ?? {}); + if (search.startsWith("?")) search = search.substring(1); + if (search) finalURL += `?${search}`; + return finalURL; +} +function mergeHeaders(...allHeaders) { + const finalHeaders = new Headers(); + for (const h of allHeaders) { + if (!h || typeof h !== "object") continue; + const iterator = h instanceof Headers ? h.entries() : Object.entries(h); + for (const [k, v] of iterator) if (v === null) finalHeaders.delete(k); + else if (Array.isArray(v)) for (const v2 of v) finalHeaders.append(k, v2); + else if (v !== void 0) finalHeaders.set(k, v); + } + return finalHeaders; +} +function removeTrailingSlash(url) { + if (url.endsWith("/")) return url.substring(0, url.length - 1); + return url; +} +//#endregion +//#region src/api/client.ts +function getCookie(name) { + for (const cookie of document.cookie ? document.cookie.split(";") : []) { + const [key, ...value] = cookie.trim().split("="); + if (key === name) return decodeURIComponent(value.join("=")); + } + return ""; +} +var csrf = { onRequest({ request }) { + if (![ + "GET", + "HEAD", + "OPTIONS", + "TRACE" + ].includes(request.method)) request.headers.set("X-CSRFToken", getCookie("csrftoken")); + return request; +} }; +var api = createClient({ + baseUrl: globalThis.location?.origin ?? "", + credentials: "same-origin", + fetch: (request) => globalThis.fetch(request) +}); +api.use(csrf); +require_react(); +var import_jsx_runtime = require_jsx_runtime(); +function Card({ title, actions, children }) { + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { + className: "p-4 mt-2 bg-base-100 rounded-box shadow-lg w-full", + "aria-label": title, + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { + className: "flex items-center justify-between mb-2", + children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { + className: "text-xl", + children: title + }), actions] + }), children] + }); +} +function Row({ children }) { + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + className: "flex flex-wrap md:flex-nowrap gap-2", + children + }); +} +function Alert({ level, children }) { + const className = { + info: "alert-info", + warning: "alert-warning", + error: "alert-error" + }[level]; + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { + role: level === "error" ? "alert" : "status", + className: `alert ${className} my-2`, + children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children }) + }); +} +//#endregion +export { getCookie as a, api as i, Card as n, Row as r, Alert as t }; diff --git a/docker/web/nspanelmanager/web/react-components/dist/main-DGNrK5qb.css b/docker/web/nspanelmanager/web/react-components/dist/main-DGNrK5qb.css deleted file mode 100644 index fc3301af6..000000000 --- a/docker/web/nspanelmanager/web/react-components/dist/main-DGNrK5qb.css +++ /dev/null @@ -1 +0,0 @@ -:root{--text:#6b6375;--text-h:#08060d;--bg:#fff;--border:#e5e4e7;--code-bg:#f4f3ec;--accent:#aa3bff;--accent-bg:#aa3bff1a;--accent-border:#aa3bff80;--social-bg:#f4f3ec80;--shadow:#0000001a 0 10px 15px -3px, #0000000d 0 4px 6px -2px;--sans:system-ui, "Segoe UI", Roboto, sans-serif;--heading:system-ui, "Segoe UI", Roboto, sans-serif;--mono:ui-monospace, Consolas, monospace;font:18px/145% var(--sans);letter-spacing:.18px;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light dark;color:var(--text);background:var(--bg);font-synthesis:none;text-rendering:optimizelegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){:root{--lightningcss-light: ;--lightningcss-dark:initial}}@media (width<=1024px){:root{font-size:16px}}@media (prefers-color-scheme:dark){:root{--text:#9ca3af;--text-h:#f3f4f6;--bg:#16171d;--border:#2e303a;--code-bg:#1f2028;--accent:#c084fc;--accent-bg:#c084fc26;--accent-border:#c084fc80;--social-bg:#2f303a80;--shadow:#0006 0 10px 15px -3px, #00000040 0 4px 6px -2px}#social .button-icon{filter:invert()brightness(2)}}#root{text-align:center;border-inline:1px solid var(--border);box-sizing:border-box;flex-direction:column;width:1126px;max-width:100%;min-height:100svh;margin:0 auto;display:flex}body{margin:0}h1,h2{font-family:var(--heading);color:var(--text-h);font-weight:500}h1{letter-spacing:-1.68px;margin:32px 0;font-size:56px}@media (width<=1024px){h1{margin:20px 0;font-size:36px}}h2{letter-spacing:-.24px;margin:0 0 8px;font-size:24px;line-height:118%}@media (width<=1024px){h2{font-size:20px}}p{margin:0}code,.counter{font-family:var(--mono);color:var(--text-h);border-radius:4px;display:inline-flex}code{background:var(--code-bg);padding:4px 8px;font-size:15px;line-height:135%} diff --git a/docker/web/nspanelmanager/web/react-components/dist/main-FKp56mKw.js b/docker/web/nspanelmanager/web/react-components/dist/main-FKp56mKw.js new file mode 100644 index 000000000..71dff9542 --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/dist/main-FKp56mKw.js @@ -0,0 +1,10286 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["MultiStep_AddEditEntity-xcopfTe5.js","react-Cm4z11-B.js","SettingsStore-msVzBcHM.js","react-select.esm-CbdimKhg.js","index.esm-CnTf2rLv.js","NSPanelToastContainer-D677tDZJ.js","proxy-BQYsYRjY.js","AnimatePresence-CpnHckGS.js","EntitiesPagesView-DShidmI8.js","sortable-Ke3drO00.js","NSPanelsView-1YvY26NZ.js","use-spring-BsypnnSW.js","StompStore-Bh-Guhla.js","EntityStore-CHE3-bsC.js","mdi-Cr6PIsRR.js","InitialSetup-p38u0OlE.js","layout-HS0oHCMJ.js","Sidebar-CHcoOcQs.js","Warnings-D5nCet1X.js","Logs-B094dObe.js","RoomPage-CMRDvbEM.js","SettingsPage-CzrUBqYz.js","fields-Dr1KI0Cj.js","RoomsView-qN1A3y9X.js"])))=>i.map(i=>d[i]); +//#region \0rolldown/runtime.js +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __esmMin = (fn, res, err) => () => { + if (err) throw err[0]; + try { + return fn && (res = fn(fn = 0)), res; + } catch (e) { + throw err = [e], e; + } +}; +var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports); +var __exportAll = (all, no_symbols) => { + let target = {}; + for (var name in all) __defProp(target, name, { + get: all[name], + enumerable: true + }); + if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" }); + return target; +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { + key = keys[i]; + if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { + get: ((k) => from[k]).bind(null, key), + enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable + }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { + value: mod, + enumerable: true +}) : target, mod)); +var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod); +//#endregion +//#region node_modules/react/cjs/react.production.js +/** +* @license React +* react.production.js +* +* Copyright (c) Meta Platforms, Inc. and affiliates. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ +var require_react_production = /* @__PURE__ */ __commonJSMin(((exports) => { + var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"); + var REACT_PORTAL_TYPE = Symbol.for("react.portal"); + var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); + var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"); + var REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"); + var REACT_CONTEXT_TYPE = Symbol.for("react.context"); + var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"); + var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"); + var REACT_MEMO_TYPE = Symbol.for("react.memo"); + var REACT_LAZY_TYPE = Symbol.for("react.lazy"); + var REACT_ACTIVITY_TYPE = Symbol.for("react.activity"); + var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; + function getIteratorFn(maybeIterable) { + if (null === maybeIterable || "object" !== typeof maybeIterable) return null; + maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"]; + return "function" === typeof maybeIterable ? maybeIterable : null; + } + var ReactNoopUpdateQueue = { + isMounted: function() { + return !1; + }, + enqueueForceUpdate: function() {}, + enqueueReplaceState: function() {}, + enqueueSetState: function() {} + }; + var assign = Object.assign; + var emptyObject = {}; + function Component(props, context, updater) { + this.props = props; + this.context = context; + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; + } + Component.prototype.isReactComponent = {}; + Component.prototype.setState = function(partialState, callback) { + if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState) throw Error("takes an object of state variables to update or a function which returns an object of state variables."); + this.updater.enqueueSetState(this, partialState, callback, "setState"); + }; + Component.prototype.forceUpdate = function(callback) { + this.updater.enqueueForceUpdate(this, callback, "forceUpdate"); + }; + function ComponentDummy() {} + ComponentDummy.prototype = Component.prototype; + function PureComponent(props, context, updater) { + this.props = props; + this.context = context; + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; + } + var pureComponentPrototype = PureComponent.prototype = new ComponentDummy(); + pureComponentPrototype.constructor = PureComponent; + assign(pureComponentPrototype, Component.prototype); + pureComponentPrototype.isPureReactComponent = !0; + var isArrayImpl = Array.isArray; + function noop() {} + var ReactSharedInternals = { + H: null, + A: null, + T: null, + S: null + }; + var hasOwnProperty = Object.prototype.hasOwnProperty; + function ReactElement(type, key, props) { + var refProp = props.ref; + return { + $$typeof: REACT_ELEMENT_TYPE, + type, + key, + ref: void 0 !== refProp ? refProp : null, + props + }; + } + function cloneAndReplaceKey(oldElement, newKey) { + return ReactElement(oldElement.type, newKey, oldElement.props); + } + function isValidElement(object) { + return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE; + } + function escape(key) { + var escaperLookup = { + "=": "=0", + ":": "=2" + }; + return "$" + key.replace(/[=:]/g, function(match) { + return escaperLookup[match]; + }); + } + var userProvidedKeyEscapeRegex = /\/+/g; + function getElementKey(element, index) { + return "object" === typeof element && null !== element && null != element.key ? escape("" + element.key) : index.toString(36); + } + function resolveThenable(thenable) { + switch (thenable.status) { + case "fulfilled": return thenable.value; + case "rejected": throw thenable.reason; + default: switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(function(fulfilledValue) { + "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue); + }, function(error) { + "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error); + })), thenable.status) { + case "fulfilled": return thenable.value; + case "rejected": throw thenable.reason; + } + } + throw thenable; + } + function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { + var type = typeof children; + if ("undefined" === type || "boolean" === type) children = null; + var invokeCallback = !1; + if (null === children) invokeCallback = !0; + else switch (type) { + case "bigint": + case "string": + case "number": + invokeCallback = !0; + break; + case "object": switch (children.$$typeof) { + case REACT_ELEMENT_TYPE: + case REACT_PORTAL_TYPE: + invokeCallback = !0; + break; + case REACT_LAZY_TYPE: return invokeCallback = children._init, mapIntoArray(invokeCallback(children._payload), array, escapedPrefix, nameSoFar, callback); + } + } + if (invokeCallback) return callback = callback(children), invokeCallback = "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar, isArrayImpl(callback) ? (escapedPrefix = "", null != invokeCallback && (escapedPrefix = invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) { + return c; + })) : null != callback && (isValidElement(callback) && (callback = cloneAndReplaceKey(callback, escapedPrefix + (null == callback.key || children && children.key === callback.key ? "" : ("" + callback.key).replace(userProvidedKeyEscapeRegex, "$&/") + "/") + invokeCallback)), array.push(callback)), 1; + invokeCallback = 0; + var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":"; + if (isArrayImpl(children)) for (var i = 0; i < children.length; i++) nameSoFar = children[i], type = nextNamePrefix + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback); + else if (i = getIteratorFn(children), "function" === typeof i) for (children = i.call(children), i = 0; !(nameSoFar = children.next()).done;) nameSoFar = nameSoFar.value, type = nextNamePrefix + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback); + else if ("object" === type) { + if ("function" === typeof children.then) return mapIntoArray(resolveThenable(children), array, escapedPrefix, nameSoFar, callback); + array = String(children); + throw Error("Objects are not valid as a React child (found: " + ("[object Object]" === array ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead."); + } + return invokeCallback; + } + function mapChildren(children, func, context) { + if (null == children) return children; + var result = [], count = 0; + mapIntoArray(children, result, "", "", function(child) { + return func.call(context, child, count++); + }); + return result; + } + function lazyInitializer(payload) { + if (-1 === payload._status) { + var ctor = payload._result; + ctor = ctor(); + ctor.then(function(moduleObject) { + if (0 === payload._status || -1 === payload._status) payload._status = 1, payload._result = moduleObject; + }, function(error) { + if (0 === payload._status || -1 === payload._status) payload._status = 2, payload._result = error; + }); + -1 === payload._status && (payload._status = 0, payload._result = ctor); + } + if (1 === payload._status) return payload._result.default; + throw payload._result; + } + var reportGlobalError = "function" === typeof reportError ? reportError : function(error) { + if ("object" === typeof window && "function" === typeof window.ErrorEvent) { + var event = new window.ErrorEvent("error", { + bubbles: !0, + cancelable: !0, + message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error), + error + }); + if (!window.dispatchEvent(event)) return; + } else if ("object" === typeof process && "function" === typeof process.emit) { + process.emit("uncaughtException", error); + return; + } + console.error(error); + }; + var Children = { + map: mapChildren, + forEach: function(children, forEachFunc, forEachContext) { + mapChildren(children, function() { + forEachFunc.apply(this, arguments); + }, forEachContext); + }, + count: function(children) { + var n = 0; + mapChildren(children, function() { + n++; + }); + return n; + }, + toArray: function(children) { + return mapChildren(children, function(child) { + return child; + }) || []; + }, + only: function(children) { + if (!isValidElement(children)) throw Error("React.Children.only expected to receive a single React element child."); + return children; + } + }; + exports.Activity = REACT_ACTIVITY_TYPE; + exports.Children = Children; + exports.Component = Component; + exports.Fragment = REACT_FRAGMENT_TYPE; + exports.Profiler = REACT_PROFILER_TYPE; + exports.PureComponent = PureComponent; + exports.StrictMode = REACT_STRICT_MODE_TYPE; + exports.Suspense = REACT_SUSPENSE_TYPE; + exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals; + exports.__COMPILER_RUNTIME = { + __proto__: null, + c: function(size) { + return ReactSharedInternals.H.useMemoCache(size); + } + }; + exports.cache = function(fn) { + return function() { + return fn.apply(null, arguments); + }; + }; + exports.cacheSignal = function() { + return null; + }; + exports.cloneElement = function(element, config, children) { + if (null === element || void 0 === element) throw Error("The argument must be a React element, but you passed " + element + "."); + var props = assign({}, element.props), key = element.key; + if (null != config) for (propName in void 0 !== config.key && (key = "" + config.key), config) !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]); + var propName = arguments.length - 2; + if (1 === propName) props.children = children; + else if (1 < propName) { + for (var childArray = Array(propName), i = 0; i < propName; i++) childArray[i] = arguments[i + 2]; + props.children = childArray; + } + return ReactElement(element.type, key, props); + }; + exports.createContext = function(defaultValue) { + defaultValue = { + $$typeof: REACT_CONTEXT_TYPE, + _currentValue: defaultValue, + _currentValue2: defaultValue, + _threadCount: 0, + Provider: null, + Consumer: null + }; + defaultValue.Provider = defaultValue; + defaultValue.Consumer = { + $$typeof: REACT_CONSUMER_TYPE, + _context: defaultValue + }; + return defaultValue; + }; + exports.createElement = function(type, config, children) { + var propName, props = {}, key = null; + if (null != config) for (propName in void 0 !== config.key && (key = "" + config.key), config) hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (props[propName] = config[propName]); + var childrenLength = arguments.length - 2; + if (1 === childrenLength) props.children = children; + else if (1 < childrenLength) { + for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 2]; + props.children = childArray; + } + if (type && type.defaultProps) for (propName in childrenLength = type.defaultProps, childrenLength) void 0 === props[propName] && (props[propName] = childrenLength[propName]); + return ReactElement(type, key, props); + }; + exports.createRef = function() { + return { current: null }; + }; + exports.forwardRef = function(render) { + return { + $$typeof: REACT_FORWARD_REF_TYPE, + render + }; + }; + exports.isValidElement = isValidElement; + exports.lazy = function(ctor) { + return { + $$typeof: REACT_LAZY_TYPE, + _payload: { + _status: -1, + _result: ctor + }, + _init: lazyInitializer + }; + }; + exports.memo = function(type, compare) { + return { + $$typeof: REACT_MEMO_TYPE, + type, + compare: void 0 === compare ? null : compare + }; + }; + exports.startTransition = function(scope) { + var prevTransition = ReactSharedInternals.T, currentTransition = {}; + ReactSharedInternals.T = currentTransition; + try { + var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S; + null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue); + "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && returnValue.then(noop, reportGlobalError); + } catch (error) { + reportGlobalError(error); + } finally { + null !== prevTransition && null !== currentTransition.types && (prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition; + } + }; + exports.unstable_useCacheRefresh = function() { + return ReactSharedInternals.H.useCacheRefresh(); + }; + exports.use = function(usable) { + return ReactSharedInternals.H.use(usable); + }; + exports.useActionState = function(action, initialState, permalink) { + return ReactSharedInternals.H.useActionState(action, initialState, permalink); + }; + exports.useCallback = function(callback, deps) { + return ReactSharedInternals.H.useCallback(callback, deps); + }; + exports.useContext = function(Context) { + return ReactSharedInternals.H.useContext(Context); + }; + exports.useDebugValue = function() {}; + exports.useDeferredValue = function(value, initialValue) { + return ReactSharedInternals.H.useDeferredValue(value, initialValue); + }; + exports.useEffect = function(create, deps) { + return ReactSharedInternals.H.useEffect(create, deps); + }; + exports.useEffectEvent = function(callback) { + return ReactSharedInternals.H.useEffectEvent(callback); + }; + exports.useId = function() { + return ReactSharedInternals.H.useId(); + }; + exports.useImperativeHandle = function(ref, create, deps) { + return ReactSharedInternals.H.useImperativeHandle(ref, create, deps); + }; + exports.useInsertionEffect = function(create, deps) { + return ReactSharedInternals.H.useInsertionEffect(create, deps); + }; + exports.useLayoutEffect = function(create, deps) { + return ReactSharedInternals.H.useLayoutEffect(create, deps); + }; + exports.useMemo = function(create, deps) { + return ReactSharedInternals.H.useMemo(create, deps); + }; + exports.useOptimistic = function(passthrough, reducer) { + return ReactSharedInternals.H.useOptimistic(passthrough, reducer); + }; + exports.useReducer = function(reducer, initialArg, init) { + return ReactSharedInternals.H.useReducer(reducer, initialArg, init); + }; + exports.useRef = function(initialValue) { + return ReactSharedInternals.H.useRef(initialValue); + }; + exports.useState = function(initialState) { + return ReactSharedInternals.H.useState(initialState); + }; + exports.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) { + return ReactSharedInternals.H.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); + }; + exports.useTransition = function() { + return ReactSharedInternals.H.useTransition(); + }; + exports.version = "19.2.8"; +})); +//#endregion +//#region node_modules/react/index.js +var require_react = /* @__PURE__ */ __commonJSMin(((exports, module) => { + module.exports = require_react_production(); +})); +//#endregion +//#region node_modules/scheduler/cjs/scheduler.production.js +/** +* @license React +* scheduler.production.js +* +* Copyright (c) Meta Platforms, Inc. and affiliates. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ +var require_scheduler_production = /* @__PURE__ */ __commonJSMin(((exports) => { + function push(heap, node) { + var index = heap.length; + heap.push(node); + a: for (; 0 < index;) { + var parentIndex = index - 1 >>> 1, parent = heap[parentIndex]; + if (0 < compare(parent, node)) heap[parentIndex] = node, heap[index] = parent, index = parentIndex; + else break a; + } + } + function peek(heap) { + return 0 === heap.length ? null : heap[0]; + } + function pop(heap) { + if (0 === heap.length) return null; + var first = heap[0], last = heap.pop(); + if (last !== first) { + heap[0] = last; + a: for (var index = 0, length = heap.length, halfLength = length >>> 1; index < halfLength;) { + var leftIndex = 2 * (index + 1) - 1, left = heap[leftIndex], rightIndex = leftIndex + 1, right = heap[rightIndex]; + if (0 > compare(left, last)) rightIndex < length && 0 > compare(right, left) ? (heap[index] = right, heap[rightIndex] = last, index = rightIndex) : (heap[index] = left, heap[leftIndex] = last, index = leftIndex); + else if (rightIndex < length && 0 > compare(right, last)) heap[index] = right, heap[rightIndex] = last, index = rightIndex; + else break a; + } + } + return first; + } + function compare(a, b) { + var diff = a.sortIndex - b.sortIndex; + return 0 !== diff ? diff : a.id - b.id; + } + exports.unstable_now = void 0; + if ("object" === typeof performance && "function" === typeof performance.now) { + var localPerformance = performance; + exports.unstable_now = function() { + return localPerformance.now(); + }; + } else { + var localDate = Date, initialTime = localDate.now(); + exports.unstable_now = function() { + return localDate.now() - initialTime; + }; + } + var taskQueue = []; + var timerQueue = []; + var taskIdCounter = 1; + var currentTask = null; + var currentPriorityLevel = 3; + var isPerformingWork = !1; + var isHostCallbackScheduled = !1; + var isHostTimeoutScheduled = !1; + var needsPaint = !1; + var localSetTimeout = "function" === typeof setTimeout ? setTimeout : null; + var localClearTimeout = "function" === typeof clearTimeout ? clearTimeout : null; + var localSetImmediate = "undefined" !== typeof setImmediate ? setImmediate : null; + function advanceTimers(currentTime) { + for (var timer = peek(timerQueue); null !== timer;) { + if (null === timer.callback) pop(timerQueue); + else if (timer.startTime <= currentTime) pop(timerQueue), timer.sortIndex = timer.expirationTime, push(taskQueue, timer); + else break; + timer = peek(timerQueue); + } + } + function handleTimeout(currentTime) { + isHostTimeoutScheduled = !1; + advanceTimers(currentTime); + if (!isHostCallbackScheduled) if (null !== peek(taskQueue)) isHostCallbackScheduled = !0, isMessageLoopRunning || (isMessageLoopRunning = !0, schedulePerformWorkUntilDeadline()); + else { + var firstTimer = peek(timerQueue); + null !== firstTimer && requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); + } + } + var isMessageLoopRunning = !1; + var taskTimeoutID = -1; + var frameInterval = 5; + var startTime = -1; + function shouldYieldToHost() { + return needsPaint ? !0 : exports.unstable_now() - startTime < frameInterval ? !1 : !0; + } + function performWorkUntilDeadline() { + needsPaint = !1; + if (isMessageLoopRunning) { + var currentTime = exports.unstable_now(); + startTime = currentTime; + var hasMoreWork = !0; + try { + a: { + isHostCallbackScheduled = !1; + isHostTimeoutScheduled && (isHostTimeoutScheduled = !1, localClearTimeout(taskTimeoutID), taskTimeoutID = -1); + isPerformingWork = !0; + var previousPriorityLevel = currentPriorityLevel; + try { + b: { + advanceTimers(currentTime); + for (currentTask = peek(taskQueue); null !== currentTask && !(currentTask.expirationTime > currentTime && shouldYieldToHost());) { + var callback = currentTask.callback; + if ("function" === typeof callback) { + currentTask.callback = null; + currentPriorityLevel = currentTask.priorityLevel; + var continuationCallback = callback(currentTask.expirationTime <= currentTime); + currentTime = exports.unstable_now(); + if ("function" === typeof continuationCallback) { + currentTask.callback = continuationCallback; + advanceTimers(currentTime); + hasMoreWork = !0; + break b; + } + currentTask === peek(taskQueue) && pop(taskQueue); + advanceTimers(currentTime); + } else pop(taskQueue); + currentTask = peek(taskQueue); + } + if (null !== currentTask) hasMoreWork = !0; + else { + var firstTimer = peek(timerQueue); + null !== firstTimer && requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); + hasMoreWork = !1; + } + } + break a; + } finally { + currentTask = null, currentPriorityLevel = previousPriorityLevel, isPerformingWork = !1; + } + hasMoreWork = void 0; + } + } finally { + hasMoreWork ? schedulePerformWorkUntilDeadline() : isMessageLoopRunning = !1; + } + } + } + var schedulePerformWorkUntilDeadline; + if ("function" === typeof localSetImmediate) schedulePerformWorkUntilDeadline = function() { + localSetImmediate(performWorkUntilDeadline); + }; + else if ("undefined" !== typeof MessageChannel) { + var channel = new MessageChannel(), port = channel.port2; + channel.port1.onmessage = performWorkUntilDeadline; + schedulePerformWorkUntilDeadline = function() { + port.postMessage(null); + }; + } else schedulePerformWorkUntilDeadline = function() { + localSetTimeout(performWorkUntilDeadline, 0); + }; + function requestHostTimeout(callback, ms) { + taskTimeoutID = localSetTimeout(function() { + callback(exports.unstable_now()); + }, ms); + } + exports.unstable_IdlePriority = 5; + exports.unstable_ImmediatePriority = 1; + exports.unstable_LowPriority = 4; + exports.unstable_NormalPriority = 3; + exports.unstable_Profiling = null; + exports.unstable_UserBlockingPriority = 2; + exports.unstable_cancelCallback = function(task) { + task.callback = null; + }; + exports.unstable_forceFrameRate = function(fps) { + 0 > fps || 125 < fps ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported") : frameInterval = 0 < fps ? Math.floor(1e3 / fps) : 5; + }; + exports.unstable_getCurrentPriorityLevel = function() { + return currentPriorityLevel; + }; + exports.unstable_next = function(eventHandler) { + switch (currentPriorityLevel) { + case 1: + case 2: + case 3: + var priorityLevel = 3; + break; + default: priorityLevel = currentPriorityLevel; + } + var previousPriorityLevel = currentPriorityLevel; + currentPriorityLevel = priorityLevel; + try { + return eventHandler(); + } finally { + currentPriorityLevel = previousPriorityLevel; + } + }; + exports.unstable_requestPaint = function() { + needsPaint = !0; + }; + exports.unstable_runWithPriority = function(priorityLevel, eventHandler) { + switch (priorityLevel) { + case 1: + case 2: + case 3: + case 4: + case 5: break; + default: priorityLevel = 3; + } + var previousPriorityLevel = currentPriorityLevel; + currentPriorityLevel = priorityLevel; + try { + return eventHandler(); + } finally { + currentPriorityLevel = previousPriorityLevel; + } + }; + exports.unstable_scheduleCallback = function(priorityLevel, callback, options) { + var currentTime = exports.unstable_now(); + "object" === typeof options && null !== options ? (options = options.delay, options = "number" === typeof options && 0 < options ? currentTime + options : currentTime) : options = currentTime; + switch (priorityLevel) { + case 1: + var timeout = -1; + break; + case 2: + timeout = 250; + break; + case 5: + timeout = 1073741823; + break; + case 4: + timeout = 1e4; + break; + default: timeout = 5e3; + } + timeout = options + timeout; + priorityLevel = { + id: taskIdCounter++, + callback, + priorityLevel, + startTime: options, + expirationTime: timeout, + sortIndex: -1 + }; + options > currentTime ? (priorityLevel.sortIndex = options, push(timerQueue, priorityLevel), null === peek(taskQueue) && priorityLevel === peek(timerQueue) && (isHostTimeoutScheduled ? (localClearTimeout(taskTimeoutID), taskTimeoutID = -1) : isHostTimeoutScheduled = !0, requestHostTimeout(handleTimeout, options - currentTime))) : (priorityLevel.sortIndex = timeout, push(taskQueue, priorityLevel), isHostCallbackScheduled || isPerformingWork || (isHostCallbackScheduled = !0, isMessageLoopRunning || (isMessageLoopRunning = !0, schedulePerformWorkUntilDeadline()))); + return priorityLevel; + }; + exports.unstable_shouldYield = shouldYieldToHost; + exports.unstable_wrapCallback = function(callback) { + var parentPriorityLevel = currentPriorityLevel; + return function() { + var previousPriorityLevel = currentPriorityLevel; + currentPriorityLevel = parentPriorityLevel; + try { + return callback.apply(this, arguments); + } finally { + currentPriorityLevel = previousPriorityLevel; + } + }; + }; +})); +//#endregion +//#region node_modules/scheduler/index.js +var require_scheduler = /* @__PURE__ */ __commonJSMin(((exports, module) => { + module.exports = require_scheduler_production(); +})); +//#endregion +//#region node_modules/react-dom/cjs/react-dom.production.js +/** +* @license React +* react-dom.production.js +* +* Copyright (c) Meta Platforms, Inc. and affiliates. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ +var require_react_dom_production = /* @__PURE__ */ __commonJSMin(((exports) => { + var React = require_react(); + function formatProdErrorMessage(code) { + var url = "https://react.dev/errors/" + code; + if (1 < arguments.length) { + url += "?args[]=" + encodeURIComponent(arguments[1]); + for (var i = 2; i < arguments.length; i++) url += "&args[]=" + encodeURIComponent(arguments[i]); + } + return "Minified React error #" + code + "; visit " + url + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings."; + } + function noop() {} + var Internals = { + d: { + f: noop, + r: function() { + throw Error(formatProdErrorMessage(522)); + }, + D: noop, + C: noop, + L: noop, + m: noop, + X: noop, + S: noop, + M: noop + }, + p: 0, + findDOMNode: null + }; + var REACT_PORTAL_TYPE = Symbol.for("react.portal"); + function createPortal$1(children, containerInfo, implementation) { + var key = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null; + return { + $$typeof: REACT_PORTAL_TYPE, + key: null == key ? null : "" + key, + children, + containerInfo, + implementation + }; + } + var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; + function getCrossOriginStringAs(as, input) { + if ("font" === as) return ""; + if ("string" === typeof input) return "use-credentials" === input ? input : ""; + } + exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = Internals; + exports.createPortal = function(children, container) { + var key = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null; + if (!container || 1 !== container.nodeType && 9 !== container.nodeType && 11 !== container.nodeType) throw Error(formatProdErrorMessage(299)); + return createPortal$1(children, container, null, key); + }; + exports.flushSync = function(fn) { + var previousTransition = ReactSharedInternals.T, previousUpdatePriority = Internals.p; + try { + if (ReactSharedInternals.T = null, Internals.p = 2, fn) return fn(); + } finally { + ReactSharedInternals.T = previousTransition, Internals.p = previousUpdatePriority, Internals.d.f(); + } + }; + exports.preconnect = function(href, options) { + "string" === typeof href && (options ? (options = options.crossOrigin, options = "string" === typeof options ? "use-credentials" === options ? options : "" : void 0) : options = null, Internals.d.C(href, options)); + }; + exports.prefetchDNS = function(href) { + "string" === typeof href && Internals.d.D(href); + }; + exports.preinit = function(href, options) { + if ("string" === typeof href && options && "string" === typeof options.as) { + var as = options.as, crossOrigin = getCrossOriginStringAs(as, options.crossOrigin), integrity = "string" === typeof options.integrity ? options.integrity : void 0, fetchPriority = "string" === typeof options.fetchPriority ? options.fetchPriority : void 0; + "style" === as ? Internals.d.S(href, "string" === typeof options.precedence ? options.precedence : void 0, { + crossOrigin, + integrity, + fetchPriority + }) : "script" === as && Internals.d.X(href, { + crossOrigin, + integrity, + fetchPriority, + nonce: "string" === typeof options.nonce ? options.nonce : void 0 + }); + } + }; + exports.preinitModule = function(href, options) { + if ("string" === typeof href) if ("object" === typeof options && null !== options) { + if (null == options.as || "script" === options.as) { + var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin); + Internals.d.M(href, { + crossOrigin, + integrity: "string" === typeof options.integrity ? options.integrity : void 0, + nonce: "string" === typeof options.nonce ? options.nonce : void 0 + }); + } + } else options ?? Internals.d.M(href); + }; + exports.preload = function(href, options) { + if ("string" === typeof href && "object" === typeof options && null !== options && "string" === typeof options.as) { + var as = options.as, crossOrigin = getCrossOriginStringAs(as, options.crossOrigin); + Internals.d.L(href, as, { + crossOrigin, + integrity: "string" === typeof options.integrity ? options.integrity : void 0, + nonce: "string" === typeof options.nonce ? options.nonce : void 0, + type: "string" === typeof options.type ? options.type : void 0, + fetchPriority: "string" === typeof options.fetchPriority ? options.fetchPriority : void 0, + referrerPolicy: "string" === typeof options.referrerPolicy ? options.referrerPolicy : void 0, + imageSrcSet: "string" === typeof options.imageSrcSet ? options.imageSrcSet : void 0, + imageSizes: "string" === typeof options.imageSizes ? options.imageSizes : void 0, + media: "string" === typeof options.media ? options.media : void 0 + }); + } + }; + exports.preloadModule = function(href, options) { + if ("string" === typeof href) if (options) { + var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin); + Internals.d.m(href, { + as: "string" === typeof options.as && "script" !== options.as ? options.as : void 0, + crossOrigin, + integrity: "string" === typeof options.integrity ? options.integrity : void 0 + }); + } else Internals.d.m(href); + }; + exports.requestFormReset = function(form) { + Internals.d.r(form); + }; + exports.unstable_batchedUpdates = function(fn, a) { + return fn(a); + }; + exports.useFormState = function(action, initialState, permalink) { + return ReactSharedInternals.H.useFormState(action, initialState, permalink); + }; + exports.useFormStatus = function() { + return ReactSharedInternals.H.useHostTransitionStatus(); + }; + exports.version = "19.2.8"; +})); +//#endregion +//#region node_modules/react-dom/index.js +var require_react_dom = /* @__PURE__ */ __commonJSMin(((exports, module) => { + function checkDCE() { + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined" || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== "function") return; + try { + __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE); + } catch (err) { + console.error(err); + } + } + checkDCE(); + module.exports = require_react_dom_production(); +})); +//#endregion +//#region node_modules/react-dom/cjs/react-dom-client.production.js +/** +* @license React +* react-dom-client.production.js +* +* Copyright (c) Meta Platforms, Inc. and affiliates. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ +var require_react_dom_client_production = /* @__PURE__ */ __commonJSMin(((exports) => { + var Scheduler = require_scheduler(); + var React = require_react(); + var ReactDOM = require_react_dom(); + function formatProdErrorMessage(code) { + var url = "https://react.dev/errors/" + code; + if (1 < arguments.length) { + url += "?args[]=" + encodeURIComponent(arguments[1]); + for (var i = 2; i < arguments.length; i++) url += "&args[]=" + encodeURIComponent(arguments[i]); + } + return "Minified React error #" + code + "; visit " + url + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings."; + } + function isValidContainer(node) { + return !(!node || 1 !== node.nodeType && 9 !== node.nodeType && 11 !== node.nodeType); + } + function getNearestMountedFiber(fiber) { + var node = fiber, nearestMounted = fiber; + if (fiber.alternate) for (; node.return;) node = node.return; + else { + fiber = node; + do + node = fiber, 0 !== (node.flags & 4098) && (nearestMounted = node.return), fiber = node.return; + while (fiber); + } + return 3 === node.tag ? nearestMounted : null; + } + function getSuspenseInstanceFromFiber(fiber) { + if (13 === fiber.tag) { + var suspenseState = fiber.memoizedState; + null === suspenseState && (fiber = fiber.alternate, null !== fiber && (suspenseState = fiber.memoizedState)); + if (null !== suspenseState) return suspenseState.dehydrated; + } + return null; + } + function getActivityInstanceFromFiber(fiber) { + if (31 === fiber.tag) { + var activityState = fiber.memoizedState; + null === activityState && (fiber = fiber.alternate, null !== fiber && (activityState = fiber.memoizedState)); + if (null !== activityState) return activityState.dehydrated; + } + return null; + } + function assertIsMounted(fiber) { + if (getNearestMountedFiber(fiber) !== fiber) throw Error(formatProdErrorMessage(188)); + } + function findCurrentFiberUsingSlowPath(fiber) { + var alternate = fiber.alternate; + if (!alternate) { + alternate = getNearestMountedFiber(fiber); + if (null === alternate) throw Error(formatProdErrorMessage(188)); + return alternate !== fiber ? null : fiber; + } + for (var a = fiber, b = alternate;;) { + var parentA = a.return; + if (null === parentA) break; + var parentB = parentA.alternate; + if (null === parentB) { + b = parentA.return; + if (null !== b) { + a = b; + continue; + } + break; + } + if (parentA.child === parentB.child) { + for (parentB = parentA.child; parentB;) { + if (parentB === a) return assertIsMounted(parentA), fiber; + if (parentB === b) return assertIsMounted(parentA), alternate; + parentB = parentB.sibling; + } + throw Error(formatProdErrorMessage(188)); + } + if (a.return !== b.return) a = parentA, b = parentB; + else { + for (var didFindChild = !1, child$0 = parentA.child; child$0;) { + if (child$0 === a) { + didFindChild = !0; + a = parentA; + b = parentB; + break; + } + if (child$0 === b) { + didFindChild = !0; + b = parentA; + a = parentB; + break; + } + child$0 = child$0.sibling; + } + if (!didFindChild) { + for (child$0 = parentB.child; child$0;) { + if (child$0 === a) { + didFindChild = !0; + a = parentB; + b = parentA; + break; + } + if (child$0 === b) { + didFindChild = !0; + b = parentB; + a = parentA; + break; + } + child$0 = child$0.sibling; + } + if (!didFindChild) throw Error(formatProdErrorMessage(189)); + } + } + if (a.alternate !== b) throw Error(formatProdErrorMessage(190)); + } + if (3 !== a.tag) throw Error(formatProdErrorMessage(188)); + return a.stateNode.current === a ? fiber : alternate; + } + function findCurrentHostFiberImpl(node) { + var tag = node.tag; + if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return node; + for (node = node.child; null !== node;) { + tag = findCurrentHostFiberImpl(node); + if (null !== tag) return tag; + node = node.sibling; + } + return null; + } + var assign = Object.assign; + var REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"); + var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"); + var REACT_PORTAL_TYPE = Symbol.for("react.portal"); + var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); + var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"); + var REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"); + var REACT_CONTEXT_TYPE = Symbol.for("react.context"); + var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"); + var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"); + var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"); + var REACT_MEMO_TYPE = Symbol.for("react.memo"); + var REACT_LAZY_TYPE = Symbol.for("react.lazy"); + var REACT_ACTIVITY_TYPE = Symbol.for("react.activity"); + var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"); + var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; + function getIteratorFn(maybeIterable) { + if (null === maybeIterable || "object" !== typeof maybeIterable) return null; + maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"]; + return "function" === typeof maybeIterable ? maybeIterable : null; + } + var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: return "Fragment"; + case REACT_PROFILER_TYPE: return "Profiler"; + case REACT_STRICT_MODE_TYPE: return "StrictMode"; + case REACT_SUSPENSE_TYPE: return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList"; + case REACT_ACTIVITY_TYPE: return "Activity"; + } + if ("object" === typeof type) switch (type.$$typeof) { + case REACT_PORTAL_TYPE: return "Portal"; + case REACT_CONTEXT_TYPE: return type.displayName || "Context"; + case REACT_CONSUMER_TYPE: return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"); + return type; + case REACT_MEMO_TYPE: return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo"; + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } + var isArrayImpl = Array.isArray; + var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; + var ReactDOMSharedInternals = ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; + var sharedNotPendingObject = { + pending: !1, + data: null, + method: null, + action: null + }; + var valueStack = []; + var index = -1; + function createCursor(defaultValue) { + return { current: defaultValue }; + } + function pop(cursor) { + 0 > index || (cursor.current = valueStack[index], valueStack[index] = null, index--); + } + function push(cursor, value) { + index++; + valueStack[index] = cursor.current; + cursor.current = value; + } + var contextStackCursor = createCursor(null); + var contextFiberStackCursor = createCursor(null); + var rootInstanceStackCursor = createCursor(null); + var hostTransitionProviderCursor = createCursor(null); + function pushHostContainer(fiber, nextRootInstance) { + push(rootInstanceStackCursor, nextRootInstance); + push(contextFiberStackCursor, fiber); + push(contextStackCursor, null); + switch (nextRootInstance.nodeType) { + case 9: + case 11: + fiber = (fiber = nextRootInstance.documentElement) ? (fiber = fiber.namespaceURI) ? getOwnHostContext(fiber) : 0 : 0; + break; + default: if (fiber = nextRootInstance.tagName, nextRootInstance = nextRootInstance.namespaceURI) nextRootInstance = getOwnHostContext(nextRootInstance), fiber = getChildHostContextProd(nextRootInstance, fiber); + else switch (fiber) { + case "svg": + fiber = 1; + break; + case "math": + fiber = 2; + break; + default: fiber = 0; + } + } + pop(contextStackCursor); + push(contextStackCursor, fiber); + } + function popHostContainer() { + pop(contextStackCursor); + pop(contextFiberStackCursor); + pop(rootInstanceStackCursor); + } + function pushHostContext(fiber) { + null !== fiber.memoizedState && push(hostTransitionProviderCursor, fiber); + var context = contextStackCursor.current; + var JSCompiler_inline_result = getChildHostContextProd(context, fiber.type); + context !== JSCompiler_inline_result && (push(contextFiberStackCursor, fiber), push(contextStackCursor, JSCompiler_inline_result)); + } + function popHostContext(fiber) { + contextFiberStackCursor.current === fiber && (pop(contextStackCursor), pop(contextFiberStackCursor)); + hostTransitionProviderCursor.current === fiber && (pop(hostTransitionProviderCursor), HostTransitionContext._currentValue = sharedNotPendingObject); + } + var prefix; + var suffix; + function describeBuiltInComponentFrame(name) { + if (void 0 === prefix) try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = match && match[1] || ""; + suffix = -1 < x.stack.indexOf("\n at") ? " ()" : -1 < x.stack.indexOf("@") ? "@unknown:0:0" : ""; + } + return "\n" + prefix + name + suffix; + } + var reentry = !1; + function describeNativeComponentFrame(fn, construct) { + if (!fn || reentry) return ""; + reentry = !0; + var previousPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = void 0; + try { + var RunInRootFrame = { DetermineComponentFrameRoot: function() { + try { + if (construct) { + var Fake = function() { + throw Error(); + }; + Object.defineProperty(Fake.prototype, "props", { set: function() { + throw Error(); + } }); + if ("object" === typeof Reflect && Reflect.construct) { + try { + Reflect.construct(Fake, []); + } catch (x) { + var control = x; + } + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x$1) { + control = x$1; + } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x$2) { + control = x$2; + } + (Fake = fn()) && "function" === typeof Fake.catch && Fake.catch(function() {}); + } + } catch (sample) { + if (sample && control && "string" === typeof sample.stack) return [sample.stack, control.stack]; + } + return [null, null]; + } }; + RunInRootFrame.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot"; + var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, "name"); + namePropDescriptor && namePropDescriptor.configurable && Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, "name", { value: "DetermineComponentFrameRoot" }); + var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), sampleStack = _RunInRootFrame$Deter[0], controlStack = _RunInRootFrame$Deter[1]; + if (sampleStack && controlStack) { + var sampleLines = sampleStack.split("\n"), controlLines = controlStack.split("\n"); + for (namePropDescriptor = RunInRootFrame = 0; RunInRootFrame < sampleLines.length && !sampleLines[RunInRootFrame].includes("DetermineComponentFrameRoot");) RunInRootFrame++; + for (; namePropDescriptor < controlLines.length && !controlLines[namePropDescriptor].includes("DetermineComponentFrameRoot");) namePropDescriptor++; + if (RunInRootFrame === sampleLines.length || namePropDescriptor === controlLines.length) for (RunInRootFrame = sampleLines.length - 1, namePropDescriptor = controlLines.length - 1; 1 <= RunInRootFrame && 0 <= namePropDescriptor && sampleLines[RunInRootFrame] !== controlLines[namePropDescriptor];) namePropDescriptor--; + for (; 1 <= RunInRootFrame && 0 <= namePropDescriptor; RunInRootFrame--, namePropDescriptor--) if (sampleLines[RunInRootFrame] !== controlLines[namePropDescriptor]) { + if (1 !== RunInRootFrame || 1 !== namePropDescriptor) do + if (RunInRootFrame--, namePropDescriptor--, 0 > namePropDescriptor || sampleLines[RunInRootFrame] !== controlLines[namePropDescriptor]) { + var frame = "\n" + sampleLines[RunInRootFrame].replace(" at new ", " at "); + fn.displayName && frame.includes("") && (frame = frame.replace("", fn.displayName)); + return frame; + } + while (1 <= RunInRootFrame && 0 <= namePropDescriptor); + break; + } + } + } finally { + reentry = !1, Error.prepareStackTrace = previousPrepareStackTrace; + } + return (previousPrepareStackTrace = fn ? fn.displayName || fn.name : "") ? describeBuiltInComponentFrame(previousPrepareStackTrace) : ""; + } + function describeFiber(fiber, childFiber) { + switch (fiber.tag) { + case 26: + case 27: + case 5: return describeBuiltInComponentFrame(fiber.type); + case 16: return describeBuiltInComponentFrame("Lazy"); + case 13: return fiber.child !== childFiber && null !== childFiber ? describeBuiltInComponentFrame("Suspense Fallback") : describeBuiltInComponentFrame("Suspense"); + case 19: return describeBuiltInComponentFrame("SuspenseList"); + case 0: + case 15: return describeNativeComponentFrame(fiber.type, !1); + case 11: return describeNativeComponentFrame(fiber.type.render, !1); + case 1: return describeNativeComponentFrame(fiber.type, !0); + case 31: return describeBuiltInComponentFrame("Activity"); + default: return ""; + } + } + function getStackByFiberInDevAndProd(workInProgress) { + try { + var info = "", previous = null; + do + info += describeFiber(workInProgress, previous), previous = workInProgress, workInProgress = workInProgress.return; + while (workInProgress); + return info; + } catch (x) { + return "\nError generating stack: " + x.message + "\n" + x.stack; + } + } + var hasOwnProperty = Object.prototype.hasOwnProperty; + var scheduleCallback$3 = Scheduler.unstable_scheduleCallback; + var cancelCallback$1 = Scheduler.unstable_cancelCallback; + var shouldYield = Scheduler.unstable_shouldYield; + var requestPaint = Scheduler.unstable_requestPaint; + var now = Scheduler.unstable_now; + var getCurrentPriorityLevel = Scheduler.unstable_getCurrentPriorityLevel; + var ImmediatePriority = Scheduler.unstable_ImmediatePriority; + var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; + var NormalPriority$1 = Scheduler.unstable_NormalPriority; + var LowPriority = Scheduler.unstable_LowPriority; + var IdlePriority = Scheduler.unstable_IdlePriority; + var log$1 = Scheduler.log; + var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue; + var rendererID = null; + var injectedHook = null; + function setIsStrictModeForDevtools(newIsStrictMode) { + "function" === typeof log$1 && unstable_setDisableYieldValue(newIsStrictMode); + if (injectedHook && "function" === typeof injectedHook.setStrictMode) try { + injectedHook.setStrictMode(rendererID, newIsStrictMode); + } catch (err) {} + } + var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; + var log = Math.log; + var LN2 = Math.LN2; + function clz32Fallback(x) { + x >>>= 0; + return 0 === x ? 32 : 31 - (log(x) / LN2 | 0) | 0; + } + var nextTransitionUpdateLane = 256; + var nextTransitionDeferredLane = 262144; + var nextRetryLane = 4194304; + function getHighestPriorityLanes(lanes) { + var pendingSyncLanes = lanes & 42; + if (0 !== pendingSyncLanes) return pendingSyncLanes; + switch (lanes & -lanes) { + 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 lanes & 261888; + case 262144: + case 524288: + case 1048576: + case 2097152: return lanes & 3932160; + case 4194304: + case 8388608: + case 16777216: + case 33554432: return lanes & 62914560; + case 67108864: return 67108864; + case 134217728: return 134217728; + case 268435456: return 268435456; + case 536870912: return 536870912; + case 1073741824: return 0; + default: return lanes; + } + } + function getNextLanes(root, wipLanes, rootHasPendingCommit) { + var pendingLanes = root.pendingLanes; + if (0 === pendingLanes) return 0; + var nextLanes = 0, suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes; + root = root.warmLanes; + var nonIdlePendingLanes = pendingLanes & 134217727; + 0 !== nonIdlePendingLanes ? (pendingLanes = nonIdlePendingLanes & ~suspendedLanes, 0 !== pendingLanes ? nextLanes = getHighestPriorityLanes(pendingLanes) : (pingedLanes &= nonIdlePendingLanes, 0 !== pingedLanes ? nextLanes = getHighestPriorityLanes(pingedLanes) : rootHasPendingCommit || (rootHasPendingCommit = nonIdlePendingLanes & ~root, 0 !== rootHasPendingCommit && (nextLanes = getHighestPriorityLanes(rootHasPendingCommit))))) : (nonIdlePendingLanes = pendingLanes & ~suspendedLanes, 0 !== nonIdlePendingLanes ? nextLanes = getHighestPriorityLanes(nonIdlePendingLanes) : 0 !== pingedLanes ? nextLanes = getHighestPriorityLanes(pingedLanes) : rootHasPendingCommit || (rootHasPendingCommit = pendingLanes & ~root, 0 !== rootHasPendingCommit && (nextLanes = getHighestPriorityLanes(rootHasPendingCommit)))); + return 0 === nextLanes ? 0 : 0 !== wipLanes && wipLanes !== nextLanes && 0 === (wipLanes & suspendedLanes) && (suspendedLanes = nextLanes & -nextLanes, rootHasPendingCommit = wipLanes & -wipLanes, suspendedLanes >= rootHasPendingCommit || 32 === suspendedLanes && 0 !== (rootHasPendingCommit & 4194048)) ? wipLanes : nextLanes; + } + function checkIfRootIsPrerendering(root, renderLanes) { + return 0 === (root.pendingLanes & ~(root.suspendedLanes & ~root.pingedLanes) & renderLanes); + } + function computeExpirationTime(lane, currentTime) { + switch (lane) { + case 1: + case 2: + case 4: + case 8: + case 64: return currentTime + 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 currentTime + 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 claimNextRetryLane() { + var lane = nextRetryLane; + nextRetryLane <<= 1; + 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304); + return lane; + } + function createLaneMap(initial) { + for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); + return laneMap; + } + function markRootUpdated$1(root, updateLane) { + root.pendingLanes |= updateLane; + 268435456 !== updateLane && (root.suspendedLanes = 0, root.pingedLanes = 0, root.warmLanes = 0); + } + function markRootFinished(root, finishedLanes, remainingLanes, spawnedLane, updatedLanes, suspendedRetryLanes) { + var previouslyPendingLanes = root.pendingLanes; + root.pendingLanes = remainingLanes; + root.suspendedLanes = 0; + root.pingedLanes = 0; + root.warmLanes = 0; + root.expiredLanes &= remainingLanes; + root.entangledLanes &= remainingLanes; + root.errorRecoveryDisabledLanes &= remainingLanes; + root.shellSuspendCounter = 0; + var entanglements = root.entanglements, expirationTimes = root.expirationTimes, hiddenUpdates = root.hiddenUpdates; + for (remainingLanes = previouslyPendingLanes & ~remainingLanes; 0 < remainingLanes;) { + var index$7 = 31 - clz32(remainingLanes), lane = 1 << index$7; + entanglements[index$7] = 0; + expirationTimes[index$7] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index$7]; + if (null !== hiddenUpdatesForLane) for (hiddenUpdates[index$7] = null, index$7 = 0; index$7 < hiddenUpdatesForLane.length; index$7++) { + var update = hiddenUpdatesForLane[index$7]; + null !== update && (update.lane &= -536870913); + } + remainingLanes &= ~lane; + } + 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); + 0 !== suspendedRetryLanes && 0 === updatedLanes && 0 !== root.tag && (root.suspendedLanes |= suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes)); + } + function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; + var spawnedLaneIndex = 31 - clz32(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] = root.entanglements[spawnedLaneIndex] | 1073741824 | entangledLanes & 261930; + } + function markRootEntangled(root, entangledLanes) { + var rootEntangledLanes = root.entangledLanes |= entangledLanes; + for (root = root.entanglements; rootEntangledLanes;) { + var index$8 = 31 - clz32(rootEntangledLanes), lane = 1 << index$8; + lane & entangledLanes | root[index$8] & entangledLanes && (root[index$8] |= entangledLanes); + rootEntangledLanes &= ~lane; + } + } + function getBumpedLaneForHydration(root, renderLanes) { + var renderLane = renderLanes & -renderLanes; + renderLane = 0 !== (renderLane & 42) ? 1 : getBumpedLaneForHydrationByLane(renderLane); + return 0 !== (renderLane & (root.suspendedLanes | renderLanes)) ? 0 : renderLane; + } + function getBumpedLaneForHydrationByLane(lane) { + switch (lane) { + case 2: + lane = 1; + break; + case 8: + lane = 4; + break; + case 32: + lane = 16; + break; + 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: + case 4194304: + case 8388608: + case 16777216: + case 33554432: + lane = 128; + break; + case 268435456: + lane = 134217728; + break; + default: lane = 0; + } + return lane; + } + function lanesToEventPriority(lanes) { + lanes &= -lanes; + return 2 < lanes ? 8 < lanes ? 0 !== (lanes & 134217727) ? 32 : 268435456 : 8 : 2; + } + function resolveUpdatePriority() { + var updatePriority = ReactDOMSharedInternals.p; + if (0 !== updatePriority) return updatePriority; + updatePriority = window.event; + return void 0 === updatePriority ? 32 : getEventPriority(updatePriority.type); + } + function runWithPriority(priority, fn) { + var previousPriority = ReactDOMSharedInternals.p; + try { + return ReactDOMSharedInternals.p = priority, fn(); + } finally { + ReactDOMSharedInternals.p = previousPriority; + } + } + var randomKey = Math.random().toString(36).slice(2); + var internalInstanceKey = "__reactFiber$" + randomKey; + var internalPropsKey = "__reactProps$" + randomKey; + var internalContainerInstanceKey = "__reactContainer$" + randomKey; + var internalEventHandlersKey = "__reactEvents$" + randomKey; + var internalEventHandlerListenersKey = "__reactListeners$" + randomKey; + var internalEventHandlesSetKey = "__reactHandles$" + randomKey; + var internalRootNodeResourcesKey = "__reactResources$" + randomKey; + var internalHoistableMarker = "__reactMarker$" + randomKey; + function detachDeletedInstance(node) { + delete node[internalInstanceKey]; + delete node[internalPropsKey]; + delete node[internalEventHandlersKey]; + delete node[internalEventHandlerListenersKey]; + delete node[internalEventHandlesSetKey]; + } + function getClosestInstanceFromNode(targetNode) { + var targetInst = targetNode[internalInstanceKey]; + if (targetInst) return targetInst; + for (var parentNode = targetNode.parentNode; parentNode;) { + if (targetInst = parentNode[internalContainerInstanceKey] || parentNode[internalInstanceKey]) { + parentNode = targetInst.alternate; + if (null !== targetInst.child || null !== parentNode && null !== parentNode.child) for (targetNode = getParentHydrationBoundary(targetNode); null !== targetNode;) { + if (parentNode = targetNode[internalInstanceKey]) return parentNode; + targetNode = getParentHydrationBoundary(targetNode); + } + return targetInst; + } + targetNode = parentNode; + parentNode = targetNode.parentNode; + } + return null; + } + function getInstanceFromNode(node) { + if (node = node[internalInstanceKey] || node[internalContainerInstanceKey]) { + var tag = node.tag; + if (5 === tag || 6 === tag || 13 === tag || 31 === tag || 26 === tag || 27 === tag || 3 === tag) return node; + } + return null; + } + function getNodeFromInstance(inst) { + var tag = inst.tag; + if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return inst.stateNode; + throw Error(formatProdErrorMessage(33)); + } + function getResourcesFromRoot(root) { + var resources = root[internalRootNodeResourcesKey]; + resources || (resources = root[internalRootNodeResourcesKey] = { + hoistableStyles: /* @__PURE__ */ new Map(), + hoistableScripts: /* @__PURE__ */ new Map() + }); + return resources; + } + function markNodeAsHoistable(node) { + node[internalHoistableMarker] = !0; + } + var allNativeEvents = /* @__PURE__ */ new Set(); + var registrationNameDependencies = {}; + function registerTwoPhaseEvent(registrationName, dependencies) { + registerDirectEvent(registrationName, dependencies); + registerDirectEvent(registrationName + "Capture", dependencies); + } + function registerDirectEvent(registrationName, dependencies) { + registrationNameDependencies[registrationName] = dependencies; + for (registrationName = 0; registrationName < dependencies.length; registrationName++) allNativeEvents.add(dependencies[registrationName]); + } + var VALID_ATTRIBUTE_NAME_REGEX = RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"); + var illegalAttributeNameCache = {}; + var validatedAttributeNameCache = {}; + function isAttributeNameSafe(attributeName) { + if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) return !0; + if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) return !1; + if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) return validatedAttributeNameCache[attributeName] = !0; + illegalAttributeNameCache[attributeName] = !0; + return !1; + } + function setValueForAttribute(node, name, value) { + if (isAttributeNameSafe(name)) if (null === value) node.removeAttribute(name); + else { + switch (typeof value) { + case "undefined": + case "function": + case "symbol": + node.removeAttribute(name); + return; + case "boolean": + var prefix$10 = name.toLowerCase().slice(0, 5); + if ("data-" !== prefix$10 && "aria-" !== prefix$10) { + node.removeAttribute(name); + return; + } + } + node.setAttribute(name, "" + value); + } + } + function setValueForKnownAttribute(node, name, value) { + if (null === value) node.removeAttribute(name); + else { + switch (typeof value) { + case "undefined": + case "function": + case "symbol": + case "boolean": + node.removeAttribute(name); + return; + } + node.setAttribute(name, "" + value); + } + } + function setValueForNamespacedAttribute(node, namespace, name, value) { + if (null === value) node.removeAttribute(name); + else { + switch (typeof value) { + case "undefined": + case "function": + case "symbol": + case "boolean": + node.removeAttribute(name); + return; + } + node.setAttributeNS(namespace, name, "" + value); + } + } + function getToStringValue(value) { + switch (typeof value) { + case "bigint": + case "boolean": + case "number": + case "string": + case "undefined": return value; + case "object": return value; + default: return ""; + } + } + function isCheckable(elem) { + var type = elem.type; + return (elem = elem.nodeName) && "input" === elem.toLowerCase() && ("checkbox" === type || "radio" === type); + } + function trackValueOnNode(node, valueField, currentValue) { + var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField); + if (!node.hasOwnProperty(valueField) && "undefined" !== typeof descriptor && "function" === typeof descriptor.get && "function" === typeof descriptor.set) { + var get = descriptor.get, set = descriptor.set; + Object.defineProperty(node, valueField, { + configurable: !0, + get: function() { + return get.call(this); + }, + set: function(value) { + currentValue = "" + value; + set.call(this, value); + } + }); + Object.defineProperty(node, valueField, { enumerable: descriptor.enumerable }); + return { + getValue: function() { + return currentValue; + }, + setValue: function(value) { + currentValue = "" + value; + }, + stopTracking: function() { + node._valueTracker = null; + delete node[valueField]; + } + }; + } + } + function track(node) { + if (!node._valueTracker) { + var valueField = isCheckable(node) ? "checked" : "value"; + node._valueTracker = trackValueOnNode(node, valueField, "" + node[valueField]); + } + } + function updateValueIfChanged(node) { + if (!node) return !1; + var tracker = node._valueTracker; + if (!tracker) return !0; + var lastValue = tracker.getValue(); + var value = ""; + node && (value = isCheckable(node) ? node.checked ? "true" : "false" : node.value); + node = value; + return node !== lastValue ? (tracker.setValue(node), !0) : !1; + } + function getActiveElement(doc) { + doc = doc || ("undefined" !== typeof document ? document : void 0); + if ("undefined" === typeof doc) return null; + try { + return doc.activeElement || doc.body; + } catch (e) { + return doc.body; + } + } + var escapeSelectorAttributeValueInsideDoubleQuotesRegex = /[\n"\\]/g; + function escapeSelectorAttributeValueInsideDoubleQuotes(value) { + return value.replace(escapeSelectorAttributeValueInsideDoubleQuotesRegex, function(ch) { + return "\\" + ch.charCodeAt(0).toString(16) + " "; + }); + } + function updateInput(element, value, defaultValue, lastDefaultValue, checked, defaultChecked, type, name) { + element.name = ""; + null != type && "function" !== typeof type && "symbol" !== typeof type && "boolean" !== typeof type ? element.type = type : element.removeAttribute("type"); + if (null != value) if ("number" === type) { + if (0 === value && "" === element.value || element.value != value) element.value = "" + getToStringValue(value); + } else element.value !== "" + getToStringValue(value) && (element.value = "" + getToStringValue(value)); + else "submit" !== type && "reset" !== type || element.removeAttribute("value"); + null != value ? setDefaultValue(element, type, getToStringValue(value)) : null != defaultValue ? setDefaultValue(element, type, getToStringValue(defaultValue)) : null != lastDefaultValue && element.removeAttribute("value"); + null == checked && null != defaultChecked && (element.defaultChecked = !!defaultChecked); + null != checked && (element.checked = checked && "function" !== typeof checked && "symbol" !== typeof checked); + null != name && "function" !== typeof name && "symbol" !== typeof name && "boolean" !== typeof name ? element.name = "" + getToStringValue(name) : element.removeAttribute("name"); + } + function initInput(element, value, defaultValue, checked, defaultChecked, type, name, isHydrating) { + null != type && "function" !== typeof type && "symbol" !== typeof type && "boolean" !== typeof type && (element.type = type); + if (null != value || null != defaultValue) { + if (!("submit" !== type && "reset" !== type || void 0 !== value && null !== value)) { + track(element); + return; + } + defaultValue = null != defaultValue ? "" + getToStringValue(defaultValue) : ""; + value = null != value ? "" + getToStringValue(value) : defaultValue; + isHydrating || value === element.value || (element.value = value); + element.defaultValue = value; + } + checked = null != checked ? checked : defaultChecked; + checked = "function" !== typeof checked && "symbol" !== typeof checked && !!checked; + element.checked = isHydrating ? element.checked : !!checked; + element.defaultChecked = !!checked; + null != name && "function" !== typeof name && "symbol" !== typeof name && "boolean" !== typeof name && (element.name = name); + track(element); + } + function setDefaultValue(node, type, value) { + "number" === type && getActiveElement(node.ownerDocument) === node || node.defaultValue === "" + value || (node.defaultValue = "" + value); + } + function updateOptions(node, multiple, propValue, setDefaultSelected) { + node = node.options; + if (multiple) { + multiple = {}; + for (var i = 0; i < propValue.length; i++) multiple["$" + propValue[i]] = !0; + for (propValue = 0; propValue < node.length; propValue++) i = multiple.hasOwnProperty("$" + node[propValue].value), node[propValue].selected !== i && (node[propValue].selected = i), i && setDefaultSelected && (node[propValue].defaultSelected = !0); + } else { + propValue = "" + getToStringValue(propValue); + multiple = null; + for (i = 0; i < node.length; i++) { + if (node[i].value === propValue) { + node[i].selected = !0; + setDefaultSelected && (node[i].defaultSelected = !0); + return; + } + null !== multiple || node[i].disabled || (multiple = node[i]); + } + null !== multiple && (multiple.selected = !0); + } + } + function updateTextarea(element, value, defaultValue) { + if (null != value && (value = "" + getToStringValue(value), value !== element.value && (element.value = value), null == defaultValue)) { + element.defaultValue !== value && (element.defaultValue = value); + return; + } + element.defaultValue = null != defaultValue ? "" + getToStringValue(defaultValue) : ""; + } + function initTextarea(element, value, defaultValue, children) { + if (null == value) { + if (null != children) { + if (null != defaultValue) throw Error(formatProdErrorMessage(92)); + if (isArrayImpl(children)) { + if (1 < children.length) throw Error(formatProdErrorMessage(93)); + children = children[0]; + } + defaultValue = children; + } + defaultValue ??= ""; + value = defaultValue; + } + defaultValue = getToStringValue(value); + element.defaultValue = defaultValue; + children = element.textContent; + children === defaultValue && "" !== children && null !== children && (element.value = children); + track(element); + } + function setTextContent(node, text) { + if (text) { + var firstChild = node.firstChild; + if (firstChild && firstChild === node.lastChild && 3 === firstChild.nodeType) { + firstChild.nodeValue = text; + return; + } + } + node.textContent = text; + } + var unitlessNumbers = new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" ")); + function setValueForStyle(style, styleName, value) { + var isCustomProperty = 0 === styleName.indexOf("--"); + null == value || "boolean" === typeof value || "" === value ? isCustomProperty ? style.setProperty(styleName, "") : "float" === styleName ? style.cssFloat = "" : style[styleName] = "" : isCustomProperty ? style.setProperty(styleName, value) : "number" !== typeof value || 0 === value || unitlessNumbers.has(styleName) ? "float" === styleName ? style.cssFloat = value : style[styleName] = ("" + value).trim() : style[styleName] = value + "px"; + } + function setValueForStyles(node, styles, prevStyles) { + if (null != styles && "object" !== typeof styles) throw Error(formatProdErrorMessage(62)); + node = node.style; + if (null != prevStyles) { + for (var styleName in prevStyles) !prevStyles.hasOwnProperty(styleName) || null != styles && styles.hasOwnProperty(styleName) || (0 === styleName.indexOf("--") ? node.setProperty(styleName, "") : "float" === styleName ? node.cssFloat = "" : node[styleName] = ""); + for (var styleName$16 in styles) styleName = styles[styleName$16], styles.hasOwnProperty(styleName$16) && prevStyles[styleName$16] !== styleName && setValueForStyle(node, styleName$16, styleName); + } else for (var styleName$17 in styles) styles.hasOwnProperty(styleName$17) && setValueForStyle(node, styleName$17, styles[styleName$17]); + } + function isCustomElement(tagName) { + if (-1 === tagName.indexOf("-")) return !1; + switch (tagName) { + case "annotation-xml": + case "color-profile": + case "font-face": + case "font-face-src": + case "font-face-uri": + case "font-face-format": + case "font-face-name": + case "missing-glyph": return !1; + default: return !0; + } + } + var aliases = /* @__PURE__ */ new Map([ + ["acceptCharset", "accept-charset"], + ["htmlFor", "for"], + ["httpEquiv", "http-equiv"], + ["crossOrigin", "crossorigin"], + ["accentHeight", "accent-height"], + ["alignmentBaseline", "alignment-baseline"], + ["arabicForm", "arabic-form"], + ["baselineShift", "baseline-shift"], + ["capHeight", "cap-height"], + ["clipPath", "clip-path"], + ["clipRule", "clip-rule"], + ["colorInterpolation", "color-interpolation"], + ["colorInterpolationFilters", "color-interpolation-filters"], + ["colorProfile", "color-profile"], + ["colorRendering", "color-rendering"], + ["dominantBaseline", "dominant-baseline"], + ["enableBackground", "enable-background"], + ["fillOpacity", "fill-opacity"], + ["fillRule", "fill-rule"], + ["floodColor", "flood-color"], + ["floodOpacity", "flood-opacity"], + ["fontFamily", "font-family"], + ["fontSize", "font-size"], + ["fontSizeAdjust", "font-size-adjust"], + ["fontStretch", "font-stretch"], + ["fontStyle", "font-style"], + ["fontVariant", "font-variant"], + ["fontWeight", "font-weight"], + ["glyphName", "glyph-name"], + ["glyphOrientationHorizontal", "glyph-orientation-horizontal"], + ["glyphOrientationVertical", "glyph-orientation-vertical"], + ["horizAdvX", "horiz-adv-x"], + ["horizOriginX", "horiz-origin-x"], + ["imageRendering", "image-rendering"], + ["letterSpacing", "letter-spacing"], + ["lightingColor", "lighting-color"], + ["markerEnd", "marker-end"], + ["markerMid", "marker-mid"], + ["markerStart", "marker-start"], + ["overlinePosition", "overline-position"], + ["overlineThickness", "overline-thickness"], + ["paintOrder", "paint-order"], + ["panose-1", "panose-1"], + ["pointerEvents", "pointer-events"], + ["renderingIntent", "rendering-intent"], + ["shapeRendering", "shape-rendering"], + ["stopColor", "stop-color"], + ["stopOpacity", "stop-opacity"], + ["strikethroughPosition", "strikethrough-position"], + ["strikethroughThickness", "strikethrough-thickness"], + ["strokeDasharray", "stroke-dasharray"], + ["strokeDashoffset", "stroke-dashoffset"], + ["strokeLinecap", "stroke-linecap"], + ["strokeLinejoin", "stroke-linejoin"], + ["strokeMiterlimit", "stroke-miterlimit"], + ["strokeOpacity", "stroke-opacity"], + ["strokeWidth", "stroke-width"], + ["textAnchor", "text-anchor"], + ["textDecoration", "text-decoration"], + ["textRendering", "text-rendering"], + ["transformOrigin", "transform-origin"], + ["underlinePosition", "underline-position"], + ["underlineThickness", "underline-thickness"], + ["unicodeBidi", "unicode-bidi"], + ["unicodeRange", "unicode-range"], + ["unitsPerEm", "units-per-em"], + ["vAlphabetic", "v-alphabetic"], + ["vHanging", "v-hanging"], + ["vIdeographic", "v-ideographic"], + ["vMathematical", "v-mathematical"], + ["vectorEffect", "vector-effect"], + ["vertAdvY", "vert-adv-y"], + ["vertOriginX", "vert-origin-x"], + ["vertOriginY", "vert-origin-y"], + ["wordSpacing", "word-spacing"], + ["writingMode", "writing-mode"], + ["xmlnsXlink", "xmlns:xlink"], + ["xHeight", "x-height"] + ]); + var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i; + function sanitizeURL(url) { + return isJavaScriptProtocol.test("" + url) ? "javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')" : url; + } + function noop$1() {} + var currentReplayingEvent = null; + function getEventTarget(nativeEvent) { + nativeEvent = nativeEvent.target || nativeEvent.srcElement || window; + nativeEvent.correspondingUseElement && (nativeEvent = nativeEvent.correspondingUseElement); + return 3 === nativeEvent.nodeType ? nativeEvent.parentNode : nativeEvent; + } + var restoreTarget = null; + var restoreQueue = null; + function restoreStateOfTarget(target) { + var internalInstance = getInstanceFromNode(target); + if (internalInstance && (target = internalInstance.stateNode)) { + var props = target[internalPropsKey] || null; + a: switch (target = internalInstance.stateNode, internalInstance.type) { + case "input": + updateInput(target, props.value, props.defaultValue, props.defaultValue, props.checked, props.defaultChecked, props.type, props.name); + internalInstance = props.name; + if ("radio" === props.type && null != internalInstance) { + for (props = target; props.parentNode;) props = props.parentNode; + props = props.querySelectorAll("input[name=\"" + escapeSelectorAttributeValueInsideDoubleQuotes("" + internalInstance) + "\"][type=\"radio\"]"); + for (internalInstance = 0; internalInstance < props.length; internalInstance++) { + var otherNode = props[internalInstance]; + if (otherNode !== target && otherNode.form === target.form) { + var otherProps = otherNode[internalPropsKey] || null; + if (!otherProps) throw Error(formatProdErrorMessage(90)); + updateInput(otherNode, otherProps.value, otherProps.defaultValue, otherProps.defaultValue, otherProps.checked, otherProps.defaultChecked, otherProps.type, otherProps.name); + } + } + for (internalInstance = 0; internalInstance < props.length; internalInstance++) otherNode = props[internalInstance], otherNode.form === target.form && updateValueIfChanged(otherNode); + } + break a; + case "textarea": + updateTextarea(target, props.value, props.defaultValue); + break a; + case "select": internalInstance = props.value, null != internalInstance && updateOptions(target, !!props.multiple, internalInstance, !1); + } + } + } + var isInsideEventHandler = !1; + function batchedUpdates$1(fn, a, b) { + if (isInsideEventHandler) return fn(a, b); + isInsideEventHandler = !0; + try { + return fn(a); + } finally { + if (isInsideEventHandler = !1, null !== restoreTarget || null !== restoreQueue) { + if (flushSyncWork$1(), restoreTarget && (a = restoreTarget, fn = restoreQueue, restoreQueue = restoreTarget = null, restoreStateOfTarget(a), fn)) for (a = 0; a < fn.length; a++) restoreStateOfTarget(fn[a]); + } + } + } + function getListener(inst, registrationName) { + var stateNode = inst.stateNode; + if (null === stateNode) return null; + var props = stateNode[internalPropsKey] || null; + if (null === props) return null; + stateNode = props[registrationName]; + a: switch (registrationName) { + case "onClick": + case "onClickCapture": + case "onDoubleClick": + case "onDoubleClickCapture": + case "onMouseDown": + case "onMouseDownCapture": + case "onMouseMove": + case "onMouseMoveCapture": + case "onMouseUp": + case "onMouseUpCapture": + case "onMouseEnter": + (props = !props.disabled) || (inst = inst.type, props = !("button" === inst || "input" === inst || "select" === inst || "textarea" === inst)); + inst = !props; + break a; + default: inst = !1; + } + if (inst) return null; + if (stateNode && "function" !== typeof stateNode) throw Error(formatProdErrorMessage(231, registrationName, typeof stateNode)); + return stateNode; + } + var canUseDOM = !("undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement); + var passiveBrowserEventsSupported = !1; + if (canUseDOM) try { + var options = {}; + Object.defineProperty(options, "passive", { get: function() { + passiveBrowserEventsSupported = !0; + } }); + window.addEventListener("test", options, options); + window.removeEventListener("test", options, options); + } catch (e) { + passiveBrowserEventsSupported = !1; + } + var root = null; + var startText = null; + var fallbackText = null; + function getData() { + if (fallbackText) return fallbackText; + var start, startValue = startText, startLength = startValue.length, end, endValue = "value" in root ? root.value : root.textContent, endLength = endValue.length; + for (start = 0; start < startLength && startValue[start] === endValue[start]; start++); + var minEnd = startLength - start; + for (end = 1; end <= minEnd && startValue[startLength - end] === endValue[endLength - end]; end++); + return fallbackText = endValue.slice(start, 1 < end ? 1 - end : void 0); + } + function getEventCharCode(nativeEvent) { + var keyCode = nativeEvent.keyCode; + "charCode" in nativeEvent ? (nativeEvent = nativeEvent.charCode, 0 === nativeEvent && 13 === keyCode && (nativeEvent = 13)) : nativeEvent = keyCode; + 10 === nativeEvent && (nativeEvent = 13); + return 32 <= nativeEvent || 13 === nativeEvent ? nativeEvent : 0; + } + function functionThatReturnsTrue() { + return !0; + } + function functionThatReturnsFalse() { + return !1; + } + function createSyntheticEvent(Interface) { + function SyntheticBaseEvent(reactName, reactEventType, targetInst, nativeEvent, nativeEventTarget) { + this._reactName = reactName; + this._targetInst = targetInst; + this.type = reactEventType; + this.nativeEvent = nativeEvent; + this.target = nativeEventTarget; + this.currentTarget = null; + for (var propName in Interface) Interface.hasOwnProperty(propName) && (reactName = Interface[propName], this[propName] = reactName ? reactName(nativeEvent) : nativeEvent[propName]); + this.isDefaultPrevented = (null != nativeEvent.defaultPrevented ? nativeEvent.defaultPrevented : !1 === nativeEvent.returnValue) ? functionThatReturnsTrue : functionThatReturnsFalse; + this.isPropagationStopped = functionThatReturnsFalse; + return this; + } + assign(SyntheticBaseEvent.prototype, { + preventDefault: function() { + this.defaultPrevented = !0; + var event = this.nativeEvent; + event && (event.preventDefault ? event.preventDefault() : "unknown" !== typeof event.returnValue && (event.returnValue = !1), this.isDefaultPrevented = functionThatReturnsTrue); + }, + stopPropagation: function() { + var event = this.nativeEvent; + event && (event.stopPropagation ? event.stopPropagation() : "unknown" !== typeof event.cancelBubble && (event.cancelBubble = !0), this.isPropagationStopped = functionThatReturnsTrue); + }, + persist: function() {}, + isPersistent: functionThatReturnsTrue + }); + return SyntheticBaseEvent; + } + var EventInterface = { + eventPhase: 0, + bubbles: 0, + cancelable: 0, + timeStamp: function(event) { + return event.timeStamp || Date.now(); + }, + defaultPrevented: 0, + isTrusted: 0 + }; + var SyntheticEvent = createSyntheticEvent(EventInterface); + var UIEventInterface = assign({}, EventInterface, { + view: 0, + detail: 0 + }); + var SyntheticUIEvent = createSyntheticEvent(UIEventInterface); + var lastMovementX; + var lastMovementY; + var lastMouseEvent; + var MouseEventInterface = assign({}, UIEventInterface, { + screenX: 0, + screenY: 0, + clientX: 0, + clientY: 0, + pageX: 0, + pageY: 0, + ctrlKey: 0, + shiftKey: 0, + altKey: 0, + metaKey: 0, + getModifierState: getEventModifierState, + button: 0, + buttons: 0, + relatedTarget: function(event) { + return void 0 === event.relatedTarget ? event.fromElement === event.srcElement ? event.toElement : event.fromElement : event.relatedTarget; + }, + movementX: function(event) { + if ("movementX" in event) return event.movementX; + event !== lastMouseEvent && (lastMouseEvent && "mousemove" === event.type ? (lastMovementX = event.screenX - lastMouseEvent.screenX, lastMovementY = event.screenY - lastMouseEvent.screenY) : lastMovementY = lastMovementX = 0, lastMouseEvent = event); + return lastMovementX; + }, + movementY: function(event) { + return "movementY" in event ? event.movementY : lastMovementY; + } + }); + var SyntheticMouseEvent = createSyntheticEvent(MouseEventInterface); + var SyntheticDragEvent = createSyntheticEvent(assign({}, MouseEventInterface, { dataTransfer: 0 })); + var SyntheticFocusEvent = createSyntheticEvent(assign({}, UIEventInterface, { relatedTarget: 0 })); + var SyntheticAnimationEvent = createSyntheticEvent(assign({}, EventInterface, { + animationName: 0, + elapsedTime: 0, + pseudoElement: 0 + })); + var SyntheticClipboardEvent = createSyntheticEvent(assign({}, EventInterface, { clipboardData: function(event) { + return "clipboardData" in event ? event.clipboardData : window.clipboardData; + } })); + var SyntheticCompositionEvent = createSyntheticEvent(assign({}, EventInterface, { data: 0 })); + var normalizeKey = { + Esc: "Escape", + Spacebar: " ", + Left: "ArrowLeft", + Up: "ArrowUp", + Right: "ArrowRight", + Down: "ArrowDown", + Del: "Delete", + Win: "OS", + Menu: "ContextMenu", + Apps: "ContextMenu", + Scroll: "ScrollLock", + MozPrintableKey: "Unidentified" + }; + var translateToKey = { + 8: "Backspace", + 9: "Tab", + 12: "Clear", + 13: "Enter", + 16: "Shift", + 17: "Control", + 18: "Alt", + 19: "Pause", + 20: "CapsLock", + 27: "Escape", + 32: " ", + 33: "PageUp", + 34: "PageDown", + 35: "End", + 36: "Home", + 37: "ArrowLeft", + 38: "ArrowUp", + 39: "ArrowRight", + 40: "ArrowDown", + 45: "Insert", + 46: "Delete", + 112: "F1", + 113: "F2", + 114: "F3", + 115: "F4", + 116: "F5", + 117: "F6", + 118: "F7", + 119: "F8", + 120: "F9", + 121: "F10", + 122: "F11", + 123: "F12", + 144: "NumLock", + 145: "ScrollLock", + 224: "Meta" + }; + var modifierKeyToProp = { + Alt: "altKey", + Control: "ctrlKey", + Meta: "metaKey", + Shift: "shiftKey" + }; + function modifierStateGetter(keyArg) { + var nativeEvent = this.nativeEvent; + return nativeEvent.getModifierState ? nativeEvent.getModifierState(keyArg) : (keyArg = modifierKeyToProp[keyArg]) ? !!nativeEvent[keyArg] : !1; + } + function getEventModifierState() { + return modifierStateGetter; + } + var SyntheticKeyboardEvent = createSyntheticEvent(assign({}, UIEventInterface, { + key: function(nativeEvent) { + if (nativeEvent.key) { + var key = normalizeKey[nativeEvent.key] || nativeEvent.key; + if ("Unidentified" !== key) return key; + } + return "keypress" === nativeEvent.type ? (nativeEvent = getEventCharCode(nativeEvent), 13 === nativeEvent ? "Enter" : String.fromCharCode(nativeEvent)) : "keydown" === nativeEvent.type || "keyup" === nativeEvent.type ? translateToKey[nativeEvent.keyCode] || "Unidentified" : ""; + }, + code: 0, + location: 0, + ctrlKey: 0, + shiftKey: 0, + altKey: 0, + metaKey: 0, + repeat: 0, + locale: 0, + getModifierState: getEventModifierState, + charCode: function(event) { + return "keypress" === event.type ? getEventCharCode(event) : 0; + }, + keyCode: function(event) { + return "keydown" === event.type || "keyup" === event.type ? event.keyCode : 0; + }, + which: function(event) { + return "keypress" === event.type ? getEventCharCode(event) : "keydown" === event.type || "keyup" === event.type ? event.keyCode : 0; + } + })); + var SyntheticPointerEvent = createSyntheticEvent(assign({}, MouseEventInterface, { + pointerId: 0, + width: 0, + height: 0, + pressure: 0, + tangentialPressure: 0, + tiltX: 0, + tiltY: 0, + twist: 0, + pointerType: 0, + isPrimary: 0 + })); + var SyntheticTouchEvent = createSyntheticEvent(assign({}, UIEventInterface, { + touches: 0, + targetTouches: 0, + changedTouches: 0, + altKey: 0, + metaKey: 0, + ctrlKey: 0, + shiftKey: 0, + getModifierState: getEventModifierState + })); + var SyntheticTransitionEvent = createSyntheticEvent(assign({}, EventInterface, { + propertyName: 0, + elapsedTime: 0, + pseudoElement: 0 + })); + var SyntheticWheelEvent = createSyntheticEvent(assign({}, MouseEventInterface, { + deltaX: function(event) { + return "deltaX" in event ? event.deltaX : "wheelDeltaX" in event ? -event.wheelDeltaX : 0; + }, + deltaY: function(event) { + return "deltaY" in event ? event.deltaY : "wheelDeltaY" in event ? -event.wheelDeltaY : "wheelDelta" in event ? -event.wheelDelta : 0; + }, + deltaZ: 0, + deltaMode: 0 + })); + var SyntheticToggleEvent = createSyntheticEvent(assign({}, EventInterface, { + newState: 0, + oldState: 0 + })); + var END_KEYCODES = [ + 9, + 13, + 27, + 32 + ]; + var canUseCompositionEvent = canUseDOM && "CompositionEvent" in window; + var documentMode = null; + canUseDOM && "documentMode" in document && (documentMode = document.documentMode); + var canUseTextInputEvent = canUseDOM && "TextEvent" in window && !documentMode; + var useFallbackCompositionData = canUseDOM && (!canUseCompositionEvent || documentMode && 8 < documentMode && 11 >= documentMode); + var SPACEBAR_CHAR = String.fromCharCode(32); + var hasSpaceKeypress = !1; + function isFallbackCompositionEnd(domEventName, nativeEvent) { + switch (domEventName) { + case "keyup": return -1 !== END_KEYCODES.indexOf(nativeEvent.keyCode); + case "keydown": return 229 !== nativeEvent.keyCode; + case "keypress": + case "mousedown": + case "focusout": return !0; + default: return !1; + } + } + function getDataFromCustomEvent(nativeEvent) { + nativeEvent = nativeEvent.detail; + return "object" === typeof nativeEvent && "data" in nativeEvent ? nativeEvent.data : null; + } + var isComposing = !1; + function getNativeBeforeInputChars(domEventName, nativeEvent) { + switch (domEventName) { + case "compositionend": return getDataFromCustomEvent(nativeEvent); + case "keypress": + if (32 !== nativeEvent.which) return null; + hasSpaceKeypress = !0; + return SPACEBAR_CHAR; + case "textInput": return domEventName = nativeEvent.data, domEventName === SPACEBAR_CHAR && hasSpaceKeypress ? null : domEventName; + default: return null; + } + } + function getFallbackBeforeInputChars(domEventName, nativeEvent) { + if (isComposing) return "compositionend" === domEventName || !canUseCompositionEvent && isFallbackCompositionEnd(domEventName, nativeEvent) ? (domEventName = getData(), fallbackText = startText = root = null, isComposing = !1, domEventName) : null; + switch (domEventName) { + case "paste": return null; + case "keypress": + if (!(nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) || nativeEvent.ctrlKey && nativeEvent.altKey) { + if (nativeEvent.char && 1 < nativeEvent.char.length) return nativeEvent.char; + if (nativeEvent.which) return String.fromCharCode(nativeEvent.which); + } + return null; + case "compositionend": return useFallbackCompositionData && "ko" !== nativeEvent.locale ? null : nativeEvent.data; + default: return null; + } + } + var supportedInputTypes = { + color: !0, + date: !0, + datetime: !0, + "datetime-local": !0, + email: !0, + month: !0, + number: !0, + password: !0, + range: !0, + search: !0, + tel: !0, + text: !0, + time: !0, + url: !0, + week: !0 + }; + function isTextInputElement(elem) { + var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); + return "input" === nodeName ? !!supportedInputTypes[elem.type] : "textarea" === nodeName ? !0 : !1; + } + function createAndAccumulateChangeEvent(dispatchQueue, inst, nativeEvent, target) { + restoreTarget ? restoreQueue ? restoreQueue.push(target) : restoreQueue = [target] : restoreTarget = target; + inst = accumulateTwoPhaseListeners(inst, "onChange"); + 0 < inst.length && (nativeEvent = new SyntheticEvent("onChange", "change", null, nativeEvent, target), dispatchQueue.push({ + event: nativeEvent, + listeners: inst + })); + } + var activeElement$1 = null; + var activeElementInst$1 = null; + function runEventInBatch(dispatchQueue) { + processDispatchQueue(dispatchQueue, 0); + } + function getInstIfValueChanged(targetInst) { + if (updateValueIfChanged(getNodeFromInstance(targetInst))) return targetInst; + } + function getTargetInstForChangeEvent(domEventName, targetInst) { + if ("change" === domEventName) return targetInst; + } + var isInputEventSupported = !1; + if (canUseDOM) { + var JSCompiler_inline_result$jscomp$286; + if (canUseDOM) { + var isSupported$jscomp$inline_427 = "oninput" in document; + if (!isSupported$jscomp$inline_427) { + var element$jscomp$inline_428 = document.createElement("div"); + element$jscomp$inline_428.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_427 = "function" === typeof element$jscomp$inline_428.oninput; + } + JSCompiler_inline_result$jscomp$286 = isSupported$jscomp$inline_427; + } else JSCompiler_inline_result$jscomp$286 = !1; + isInputEventSupported = JSCompiler_inline_result$jscomp$286 && (!document.documentMode || 9 < document.documentMode); + } + function stopWatchingForValueChange() { + activeElement$1 && (activeElement$1.detachEvent("onpropertychange", handlePropertyChange), activeElementInst$1 = activeElement$1 = null); + } + function handlePropertyChange(nativeEvent) { + if ("value" === nativeEvent.propertyName && getInstIfValueChanged(activeElementInst$1)) { + var dispatchQueue = []; + createAndAccumulateChangeEvent(dispatchQueue, activeElementInst$1, nativeEvent, getEventTarget(nativeEvent)); + batchedUpdates$1(runEventInBatch, dispatchQueue); + } + } + function handleEventsForInputEventPolyfill(domEventName, target, targetInst) { + "focusin" === domEventName ? (stopWatchingForValueChange(), activeElement$1 = target, activeElementInst$1 = targetInst, activeElement$1.attachEvent("onpropertychange", handlePropertyChange)) : "focusout" === domEventName && stopWatchingForValueChange(); + } + function getTargetInstForInputEventPolyfill(domEventName) { + if ("selectionchange" === domEventName || "keyup" === domEventName || "keydown" === domEventName) return getInstIfValueChanged(activeElementInst$1); + } + function getTargetInstForClickEvent(domEventName, targetInst) { + if ("click" === domEventName) return getInstIfValueChanged(targetInst); + } + function getTargetInstForInputOrChangeEvent(domEventName, targetInst) { + if ("input" === domEventName || "change" === domEventName) return getInstIfValueChanged(targetInst); + } + function is(x, y) { + return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; + } + var objectIs = "function" === typeof Object.is ? Object.is : is; + function shallowEqual(objA, objB) { + if (objectIs(objA, objB)) return !0; + if ("object" !== typeof objA || null === objA || "object" !== typeof objB || null === objB) return !1; + var keysA = Object.keys(objA), keysB = Object.keys(objB); + if (keysA.length !== keysB.length) return !1; + for (keysB = 0; keysB < keysA.length; keysB++) { + var currentKey = keysA[keysB]; + if (!hasOwnProperty.call(objB, currentKey) || !objectIs(objA[currentKey], objB[currentKey])) return !1; + } + return !0; + } + function getLeafNode(node) { + for (; node && node.firstChild;) node = node.firstChild; + return node; + } + function getNodeForCharacterOffset(root, offset) { + var node = getLeafNode(root); + root = 0; + for (var nodeEnd; node;) { + if (3 === node.nodeType) { + nodeEnd = root + node.textContent.length; + if (root <= offset && nodeEnd >= offset) return { + node, + offset: offset - root + }; + root = nodeEnd; + } + a: { + for (; node;) { + if (node.nextSibling) { + node = node.nextSibling; + break a; + } + node = node.parentNode; + } + node = void 0; + } + node = getLeafNode(node); + } + } + function containsNode(outerNode, innerNode) { + return outerNode && innerNode ? outerNode === innerNode ? !0 : outerNode && 3 === outerNode.nodeType ? !1 : innerNode && 3 === innerNode.nodeType ? containsNode(outerNode, innerNode.parentNode) : "contains" in outerNode ? outerNode.contains(innerNode) : outerNode.compareDocumentPosition ? !!(outerNode.compareDocumentPosition(innerNode) & 16) : !1 : !1; + } + function getActiveElementDeep(containerInfo) { + containerInfo = null != containerInfo && null != containerInfo.ownerDocument && null != containerInfo.ownerDocument.defaultView ? containerInfo.ownerDocument.defaultView : window; + for (var element = getActiveElement(containerInfo.document); element instanceof containerInfo.HTMLIFrameElement;) { + try { + var JSCompiler_inline_result = "string" === typeof element.contentWindow.location.href; + } catch (err) { + JSCompiler_inline_result = !1; + } + if (JSCompiler_inline_result) containerInfo = element.contentWindow; + else break; + element = getActiveElement(containerInfo.document); + } + return element; + } + function hasSelectionCapabilities(elem) { + var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); + return nodeName && ("input" === nodeName && ("text" === elem.type || "search" === elem.type || "tel" === elem.type || "url" === elem.type || "password" === elem.type) || "textarea" === nodeName || "true" === elem.contentEditable); + } + var skipSelectionChangeEvent = canUseDOM && "documentMode" in document && 11 >= document.documentMode; + var activeElement = null; + var activeElementInst = null; + var lastSelection = null; + var mouseDown = !1; + function constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget) { + var doc = nativeEventTarget.window === nativeEventTarget ? nativeEventTarget.document : 9 === nativeEventTarget.nodeType ? nativeEventTarget : nativeEventTarget.ownerDocument; + mouseDown || null == activeElement || activeElement !== getActiveElement(doc) || (doc = activeElement, "selectionStart" in doc && hasSelectionCapabilities(doc) ? doc = { + start: doc.selectionStart, + end: doc.selectionEnd + } : (doc = (doc.ownerDocument && doc.ownerDocument.defaultView || window).getSelection(), doc = { + anchorNode: doc.anchorNode, + anchorOffset: doc.anchorOffset, + focusNode: doc.focusNode, + focusOffset: doc.focusOffset + }), lastSelection && shallowEqual(lastSelection, doc) || (lastSelection = doc, doc = accumulateTwoPhaseListeners(activeElementInst, "onSelect"), 0 < doc.length && (nativeEvent = new SyntheticEvent("onSelect", "select", null, nativeEvent, nativeEventTarget), dispatchQueue.push({ + event: nativeEvent, + listeners: doc + }), nativeEvent.target = activeElement))); + } + function makePrefixMap(styleProp, eventName) { + var prefixes = {}; + prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); + prefixes["Webkit" + styleProp] = "webkit" + eventName; + prefixes["Moz" + styleProp] = "moz" + eventName; + return prefixes; + } + var vendorPrefixes = { + animationend: makePrefixMap("Animation", "AnimationEnd"), + animationiteration: makePrefixMap("Animation", "AnimationIteration"), + animationstart: makePrefixMap("Animation", "AnimationStart"), + transitionrun: makePrefixMap("Transition", "TransitionRun"), + transitionstart: makePrefixMap("Transition", "TransitionStart"), + transitioncancel: makePrefixMap("Transition", "TransitionCancel"), + transitionend: makePrefixMap("Transition", "TransitionEnd") + }; + var prefixedEventNames = {}; + var style = {}; + canUseDOM && (style = document.createElement("div").style, "AnimationEvent" in window || (delete vendorPrefixes.animationend.animation, delete vendorPrefixes.animationiteration.animation, delete vendorPrefixes.animationstart.animation), "TransitionEvent" in window || delete vendorPrefixes.transitionend.transition); + function getVendorPrefixedEventName(eventName) { + if (prefixedEventNames[eventName]) return prefixedEventNames[eventName]; + if (!vendorPrefixes[eventName]) return eventName; + var prefixMap = vendorPrefixes[eventName], styleProp; + for (styleProp in prefixMap) if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) return prefixedEventNames[eventName] = prefixMap[styleProp]; + return eventName; + } + var ANIMATION_END = getVendorPrefixedEventName("animationend"); + var ANIMATION_ITERATION = getVendorPrefixedEventName("animationiteration"); + var ANIMATION_START = getVendorPrefixedEventName("animationstart"); + var TRANSITION_RUN = getVendorPrefixedEventName("transitionrun"); + var TRANSITION_START = getVendorPrefixedEventName("transitionstart"); + var TRANSITION_CANCEL = getVendorPrefixedEventName("transitioncancel"); + var TRANSITION_END = getVendorPrefixedEventName("transitionend"); + var topLevelEventsToReactNames = /* @__PURE__ */ new Map(); + var simpleEventPluginEvents = "abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" "); + simpleEventPluginEvents.push("scrollEnd"); + function registerSimpleEvent(domEventName, reactName) { + topLevelEventsToReactNames.set(domEventName, reactName); + registerTwoPhaseEvent(reactName, [domEventName]); + } + var reportGlobalError = "function" === typeof reportError ? reportError : function(error) { + if ("object" === typeof window && "function" === typeof window.ErrorEvent) { + var event = new window.ErrorEvent("error", { + bubbles: !0, + cancelable: !0, + message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error), + error + }); + if (!window.dispatchEvent(event)) return; + } else if ("object" === typeof process && "function" === typeof process.emit) { + process.emit("uncaughtException", error); + return; + } + console.error(error); + }; + var concurrentQueues = []; + var concurrentQueuesIndex = 0; + var concurrentlyUpdatedLanes = 0; + function finishQueueingConcurrentUpdates() { + for (var endIndex = concurrentQueuesIndex, i = concurrentlyUpdatedLanes = concurrentQueuesIndex = 0; i < endIndex;) { + var fiber = concurrentQueues[i]; + concurrentQueues[i++] = null; + var queue = concurrentQueues[i]; + concurrentQueues[i++] = null; + var update = concurrentQueues[i]; + concurrentQueues[i++] = null; + var lane = concurrentQueues[i]; + concurrentQueues[i++] = null; + if (null !== queue && null !== update) { + var pending = queue.pending; + null === pending ? update.next = update : (update.next = pending.next, pending.next = update); + queue.pending = update; + } + 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); + } + } + function enqueueUpdate$1(fiber, queue, update, lane) { + concurrentQueues[concurrentQueuesIndex++] = fiber; + concurrentQueues[concurrentQueuesIndex++] = queue; + concurrentQueues[concurrentQueuesIndex++] = update; + concurrentQueues[concurrentQueuesIndex++] = lane; + concurrentlyUpdatedLanes |= lane; + fiber.lanes |= lane; + fiber = fiber.alternate; + null !== fiber && (fiber.lanes |= lane); + } + function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + enqueueUpdate$1(fiber, queue, update, lane); + return getRootForUpdatedFiber(fiber); + } + function enqueueConcurrentRenderForLane(fiber, lane) { + enqueueUpdate$1(fiber, null, null, lane); + return getRootForUpdatedFiber(fiber); + } + function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + for (var isHidden = !1, parent = sourceFiber.return; null !== parent;) parent.childLanes |= lane, alternate = parent.alternate, null !== alternate && (alternate.childLanes |= lane), 22 === parent.tag && (sourceFiber = parent.stateNode, null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), sourceFiber = parent, parent = parent.return; + return 3 === sourceFiber.tag ? (parent = sourceFiber.stateNode, isHidden && null !== update && (isHidden = 31 - clz32(lane), sourceFiber = parent.hiddenUpdates, alternate = sourceFiber[isHidden], null === alternate ? sourceFiber[isHidden] = [update] : alternate.push(update), update.lane = lane | 536870912), parent) : null; + } + function getRootForUpdatedFiber(sourceFiber) { + if (50 < nestedUpdateCount) throw nestedUpdateCount = 0, rootWithNestedUpdates = null, Error(formatProdErrorMessage(185)); + for (var parent = sourceFiber.return; null !== parent;) sourceFiber = parent, parent = sourceFiber.return; + return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; + } + var emptyContextObject = {}; + function FiberNode(tag, pendingProps, key, mode) { + this.tag = tag; + this.key = key; + this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null; + this.index = 0; + this.refCleanup = this.ref = null; + this.pendingProps = pendingProps; + this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null; + this.mode = mode; + this.subtreeFlags = this.flags = 0; + this.deletions = null; + this.childLanes = this.lanes = 0; + this.alternate = null; + } + function createFiberImplClass(tag, pendingProps, key, mode) { + return new FiberNode(tag, pendingProps, key, mode); + } + function shouldConstruct(Component) { + Component = Component.prototype; + return !(!Component || !Component.isReactComponent); + } + function createWorkInProgress(current, pendingProps) { + var workInProgress = current.alternate; + null === workInProgress ? (workInProgress = createFiberImplClass(current.tag, pendingProps, current.key, current.mode), workInProgress.elementType = current.elementType, workInProgress.type = current.type, workInProgress.stateNode = current.stateNode, workInProgress.alternate = current, current.alternate = workInProgress) : (workInProgress.pendingProps = pendingProps, workInProgress.type = current.type, workInProgress.flags = 0, workInProgress.subtreeFlags = 0, workInProgress.deletions = null); + workInProgress.flags = current.flags & 65011712; + workInProgress.childLanes = current.childLanes; + workInProgress.lanes = current.lanes; + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; + pendingProps = current.dependencies; + workInProgress.dependencies = null === pendingProps ? null : { + lanes: pendingProps.lanes, + firstContext: pendingProps.firstContext + }; + workInProgress.sibling = current.sibling; + workInProgress.index = current.index; + workInProgress.ref = current.ref; + workInProgress.refCleanup = current.refCleanup; + return workInProgress; + } + function resetWorkInProgress(workInProgress, renderLanes) { + workInProgress.flags &= 65011714; + var current = workInProgress.alternate; + null === current ? (workInProgress.childLanes = 0, workInProgress.lanes = renderLanes, workInProgress.child = null, workInProgress.subtreeFlags = 0, workInProgress.memoizedProps = null, workInProgress.memoizedState = null, workInProgress.updateQueue = null, workInProgress.dependencies = null, workInProgress.stateNode = null) : (workInProgress.childLanes = current.childLanes, workInProgress.lanes = current.lanes, workInProgress.child = current.child, workInProgress.subtreeFlags = 0, workInProgress.deletions = null, workInProgress.memoizedProps = current.memoizedProps, workInProgress.memoizedState = current.memoizedState, workInProgress.updateQueue = current.updateQueue, workInProgress.type = current.type, renderLanes = current.dependencies, workInProgress.dependencies = null === renderLanes ? null : { + lanes: renderLanes.lanes, + firstContext: renderLanes.firstContext + }); + return workInProgress; + } + function createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, lanes) { + var fiberTag = 0; + owner = type; + if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); + else if ("string" === typeof type) fiberTag = isHostHoistableType(type, pendingProps, contextStackCursor.current) ? 26 : "html" === type || "head" === type || "body" === type ? 27 : 5; + else a: switch (type) { + case REACT_ACTIVITY_TYPE: return type = createFiberImplClass(31, pendingProps, key, mode), type.elementType = REACT_ACTIVITY_TYPE, type.lanes = lanes, type; + case REACT_FRAGMENT_TYPE: return createFiberFromFragment(pendingProps.children, mode, lanes, key); + case REACT_STRICT_MODE_TYPE: + fiberTag = 8; + mode |= 24; + break; + case REACT_PROFILER_TYPE: return type = createFiberImplClass(12, pendingProps, key, mode | 2), type.elementType = REACT_PROFILER_TYPE, type.lanes = lanes, type; + case REACT_SUSPENSE_TYPE: return type = createFiberImplClass(13, pendingProps, key, mode), type.elementType = REACT_SUSPENSE_TYPE, type.lanes = lanes, type; + case REACT_SUSPENSE_LIST_TYPE: return type = createFiberImplClass(19, pendingProps, key, mode), type.elementType = REACT_SUSPENSE_LIST_TYPE, type.lanes = lanes, type; + default: + if ("object" === typeof type && null !== type) switch (type.$$typeof) { + case REACT_CONTEXT_TYPE: + fiberTag = 10; + break a; + case REACT_CONSUMER_TYPE: + fiberTag = 9; + break a; + case REACT_FORWARD_REF_TYPE: + fiberTag = 11; + break a; + case REACT_MEMO_TYPE: + fiberTag = 14; + break a; + case REACT_LAZY_TYPE: + fiberTag = 16; + owner = null; + break a; + } + fiberTag = 29; + pendingProps = Error(formatProdErrorMessage(130, null === type ? "null" : typeof type, "")); + owner = null; + } + key = createFiberImplClass(fiberTag, pendingProps, key, mode); + key.elementType = type; + key.type = owner; + key.lanes = lanes; + return key; + } + function createFiberFromFragment(elements, mode, lanes, key) { + elements = createFiberImplClass(7, elements, key, mode); + elements.lanes = lanes; + return elements; + } + function createFiberFromText(content, mode, lanes) { + content = createFiberImplClass(6, content, null, mode); + content.lanes = lanes; + return content; + } + function createFiberFromDehydratedFragment(dehydratedNode) { + var fiber = createFiberImplClass(18, null, null, 0); + fiber.stateNode = dehydratedNode; + return fiber; + } + function createFiberFromPortal(portal, mode, lanes) { + mode = createFiberImplClass(4, null !== portal.children ? portal.children : [], portal.key, mode); + mode.lanes = lanes; + mode.stateNode = { + containerInfo: portal.containerInfo, + pendingChildren: null, + implementation: portal.implementation + }; + return mode; + } + var CapturedStacks = /* @__PURE__ */ new WeakMap(); + function createCapturedValueAtFiber(value, source) { + if ("object" === typeof value && null !== value) { + var existing = CapturedStacks.get(value); + if (void 0 !== existing) return existing; + source = { + value, + source, + stack: getStackByFiberInDevAndProd(source) + }; + CapturedStacks.set(value, source); + return source; + } + return { + value, + source, + stack: getStackByFiberInDevAndProd(source) + }; + } + var forkStack = []; + var forkStackIndex = 0; + var treeForkProvider = null; + var treeForkCount = 0; + var idStack = []; + var idStackIndex = 0; + var treeContextProvider = null; + var treeContextId = 1; + var treeContextOverflow = ""; + function pushTreeFork(workInProgress, totalChildren) { + forkStack[forkStackIndex++] = treeForkCount; + forkStack[forkStackIndex++] = treeForkProvider; + treeForkProvider = workInProgress; + treeForkCount = totalChildren; + } + function pushTreeId(workInProgress, totalChildren, index) { + idStack[idStackIndex++] = treeContextId; + idStack[idStackIndex++] = treeContextOverflow; + idStack[idStackIndex++] = treeContextProvider; + treeContextProvider = workInProgress; + var baseIdWithLeadingBit = treeContextId; + workInProgress = treeContextOverflow; + var baseLength = 32 - clz32(baseIdWithLeadingBit) - 1; + baseIdWithLeadingBit &= ~(1 << baseLength); + index += 1; + var length = 32 - clz32(totalChildren) + baseLength; + if (30 < length) { + var numberOfOverflowBits = baseLength - baseLength % 5; + length = (baseIdWithLeadingBit & (1 << numberOfOverflowBits) - 1).toString(32); + baseIdWithLeadingBit >>= numberOfOverflowBits; + baseLength -= numberOfOverflowBits; + treeContextId = 1 << 32 - clz32(totalChildren) + baseLength | index << baseLength | baseIdWithLeadingBit; + treeContextOverflow = length + workInProgress; + } else treeContextId = 1 << length | index << baseLength | baseIdWithLeadingBit, treeContextOverflow = workInProgress; + } + function pushMaterializedTreeId(workInProgress) { + null !== workInProgress.return && (pushTreeFork(workInProgress, 1), pushTreeId(workInProgress, 1, 0)); + } + function popTreeContext(workInProgress) { + for (; workInProgress === treeForkProvider;) treeForkProvider = forkStack[--forkStackIndex], forkStack[forkStackIndex] = null, treeForkCount = forkStack[--forkStackIndex], forkStack[forkStackIndex] = null; + for (; workInProgress === treeContextProvider;) treeContextProvider = idStack[--idStackIndex], idStack[idStackIndex] = null, treeContextOverflow = idStack[--idStackIndex], idStack[idStackIndex] = null, treeContextId = idStack[--idStackIndex], idStack[idStackIndex] = null; + } + function restoreSuspendedTreeContext(workInProgress, suspendedContext) { + idStack[idStackIndex++] = treeContextId; + idStack[idStackIndex++] = treeContextOverflow; + idStack[idStackIndex++] = treeContextProvider; + treeContextId = suspendedContext.id; + treeContextOverflow = suspendedContext.overflow; + treeContextProvider = workInProgress; + } + var hydrationParentFiber = null; + var nextHydratableInstance = null; + var isHydrating = !1; + var hydrationErrors = null; + var rootOrSingletonContext = !1; + var HydrationMismatchException = Error(formatProdErrorMessage(519)); + function throwOnHydrationMismatch(fiber) { + queueHydrationError(createCapturedValueAtFiber(Error(formatProdErrorMessage(418, 1 < arguments.length && void 0 !== arguments[1] && arguments[1] ? "text" : "HTML", "")), fiber)); + throw HydrationMismatchException; + } + function prepareToHydrateHostInstance(fiber) { + var instance = fiber.stateNode, type = fiber.type, props = fiber.memoizedProps; + instance[internalInstanceKey] = fiber; + instance[internalPropsKey] = props; + switch (type) { + case "dialog": + listenToNonDelegatedEvent("cancel", instance); + listenToNonDelegatedEvent("close", instance); + break; + case "iframe": + case "object": + case "embed": + listenToNonDelegatedEvent("load", instance); + break; + case "video": + case "audio": + for (type = 0; type < mediaEventTypes.length; type++) listenToNonDelegatedEvent(mediaEventTypes[type], instance); + break; + case "source": + listenToNonDelegatedEvent("error", instance); + break; + case "img": + case "image": + case "link": + listenToNonDelegatedEvent("error", instance); + listenToNonDelegatedEvent("load", instance); + break; + case "details": + listenToNonDelegatedEvent("toggle", instance); + break; + case "input": + listenToNonDelegatedEvent("invalid", instance); + initInput(instance, props.value, props.defaultValue, props.checked, props.defaultChecked, props.type, props.name, !0); + break; + case "select": + listenToNonDelegatedEvent("invalid", instance); + break; + case "textarea": listenToNonDelegatedEvent("invalid", instance), initTextarea(instance, props.value, props.defaultValue, props.children); + } + type = props.children; + "string" !== typeof type && "number" !== typeof type && "bigint" !== typeof type || instance.textContent === "" + type || !0 === props.suppressHydrationWarning || checkForUnmatchedText(instance.textContent, type) ? (null != props.popover && (listenToNonDelegatedEvent("beforetoggle", instance), listenToNonDelegatedEvent("toggle", instance)), null != props.onScroll && listenToNonDelegatedEvent("scroll", instance), null != props.onScrollEnd && listenToNonDelegatedEvent("scrollend", instance), null != props.onClick && (instance.onclick = noop$1), instance = !0) : instance = !1; + instance || throwOnHydrationMismatch(fiber, !0); + } + function popToNextHostParent(fiber) { + for (hydrationParentFiber = fiber.return; hydrationParentFiber;) switch (hydrationParentFiber.tag) { + case 5: + case 31: + case 13: + rootOrSingletonContext = !1; + return; + case 27: + case 3: + rootOrSingletonContext = !0; + return; + default: hydrationParentFiber = hydrationParentFiber.return; + } + } + function popHydrationState(fiber) { + if (fiber !== hydrationParentFiber) return !1; + if (!isHydrating) return popToNextHostParent(fiber), isHydrating = !0, !1; + var tag = fiber.tag, JSCompiler_temp; + if (JSCompiler_temp = 3 !== tag && 27 !== tag) { + if (JSCompiler_temp = 5 === tag) JSCompiler_temp = fiber.type, JSCompiler_temp = !("form" !== JSCompiler_temp && "button" !== JSCompiler_temp) || shouldSetTextContent(fiber.type, fiber.memoizedProps); + JSCompiler_temp = !JSCompiler_temp; + } + JSCompiler_temp && nextHydratableInstance && throwOnHydrationMismatch(fiber); + popToNextHostParent(fiber); + if (13 === tag) { + fiber = fiber.memoizedState; + fiber = null !== fiber ? fiber.dehydrated : null; + if (!fiber) throw Error(formatProdErrorMessage(317)); + nextHydratableInstance = getNextHydratableInstanceAfterHydrationBoundary(fiber); + } else if (31 === tag) { + fiber = fiber.memoizedState; + fiber = null !== fiber ? fiber.dehydrated : null; + if (!fiber) throw Error(formatProdErrorMessage(317)); + nextHydratableInstance = getNextHydratableInstanceAfterHydrationBoundary(fiber); + } else 27 === tag ? (tag = nextHydratableInstance, isSingletonScope(fiber.type) ? (fiber = previousHydratableOnEnteringScopedSingleton, previousHydratableOnEnteringScopedSingleton = null, nextHydratableInstance = fiber) : nextHydratableInstance = tag) : nextHydratableInstance = hydrationParentFiber ? getNextHydratable(fiber.stateNode.nextSibling) : null; + return !0; + } + function resetHydrationState() { + nextHydratableInstance = hydrationParentFiber = null; + isHydrating = !1; + } + function upgradeHydrationErrorsToRecoverable() { + var queuedErrors = hydrationErrors; + null !== queuedErrors && (null === workInProgressRootRecoverableErrors ? workInProgressRootRecoverableErrors = queuedErrors : workInProgressRootRecoverableErrors.push.apply(workInProgressRootRecoverableErrors, queuedErrors), hydrationErrors = null); + return queuedErrors; + } + function queueHydrationError(error) { + null === hydrationErrors ? hydrationErrors = [error] : hydrationErrors.push(error); + } + var valueCursor = createCursor(null); + var currentlyRenderingFiber$1 = null; + var lastContextDependency = null; + function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue); + context._currentValue = nextValue; + } + function popProvider(context) { + context._currentValue = valueCursor.current; + pop(valueCursor); + } + function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { + for (; null !== parent;) { + var alternate = parent.alternate; + (parent.childLanes & renderLanes) !== renderLanes ? (parent.childLanes |= renderLanes, null !== alternate && (alternate.childLanes |= renderLanes)) : null !== alternate && (alternate.childLanes & renderLanes) !== renderLanes && (alternate.childLanes |= renderLanes); + if (parent === propagationRoot) break; + parent = parent.return; + } + } + function propagateContextChanges(workInProgress, contexts, renderLanes, forcePropagateEntireTree) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber;) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + list = list.firstContext; + a: for (; null !== list;) { + var dependency = list; + list = fiber; + for (var i = 0; i < contexts.length; i++) if (dependency.context === contexts[i]) { + list.lanes |= renderLanes; + dependency = list.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath(list.return, renderLanes, workInProgress); + forcePropagateEntireTree || (nextFiber = null); + break a; + } + list = dependency.next; + } + } else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) throw Error(formatProdErrorMessage(341)); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = null; + } else nextFiber = fiber.child; + if (null !== nextFiber) nextFiber.return = fiber; + else for (nextFiber = fiber; null !== nextFiber;) { + if (nextFiber === workInProgress) { + nextFiber = null; + break; + } + fiber = nextFiber.sibling; + if (null !== fiber) { + fiber.return = nextFiber.return; + nextFiber = fiber; + break; + } + nextFiber = nextFiber.return; + } + fiber = nextFiber; + } + } + function propagateParentContextChanges(current, workInProgress, renderLanes, forcePropagateEntireTree) { + current = null; + for (var parent = workInProgress, isInsidePropagationBailout = !1; null !== parent;) { + if (!isInsidePropagationBailout) { + if (0 !== (parent.flags & 524288)) isInsidePropagationBailout = !0; + else if (0 !== (parent.flags & 262144)) break; + } + if (10 === parent.tag) { + var currentParent = parent.alternate; + if (null === currentParent) throw Error(formatProdErrorMessage(387)); + currentParent = currentParent.memoizedProps; + if (null !== currentParent) { + var context = parent.type; + objectIs(parent.pendingProps.value, currentParent.value) || (null !== current ? current.push(context) : current = [context]); + } + } else if (parent === hostTransitionProviderCursor.current) { + currentParent = parent.alternate; + if (null === currentParent) throw Error(formatProdErrorMessage(387)); + currentParent.memoizedState.memoizedState !== parent.memoizedState.memoizedState && (null !== current ? current.push(HostTransitionContext) : current = [HostTransitionContext]); + } + parent = parent.return; + } + null !== current && propagateContextChanges(workInProgress, current, renderLanes, forcePropagateEntireTree); + workInProgress.flags |= 262144; + } + function checkIfContextChanged(currentDependencies) { + for (currentDependencies = currentDependencies.firstContext; null !== currentDependencies;) { + if (!objectIs(currentDependencies.context._currentValue, currentDependencies.memoizedValue)) return !0; + currentDependencies = currentDependencies.next; + } + return !1; + } + function prepareToReadContext(workInProgress) { + currentlyRenderingFiber$1 = workInProgress; + lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && (workInProgress.firstContext = null); + } + function readContext(context) { + return readContextForConsumer(currentlyRenderingFiber$1, context); + } + function readContextDuringReconciliation(consumer, context) { + null === currentlyRenderingFiber$1 && prepareToReadContext(consumer); + return readContextForConsumer(consumer, context); + } + function readContextForConsumer(consumer, context) { + var value = context._currentValue; + context = { + context, + memoizedValue: value, + next: null + }; + if (null === lastContextDependency) { + if (null === consumer) throw Error(formatProdErrorMessage(308)); + lastContextDependency = context; + consumer.dependencies = { + lanes: 0, + firstContext: context + }; + consumer.flags |= 524288; + } else lastContextDependency = lastContextDependency.next = context; + return value; + } + var AbortControllerLocal = "undefined" !== typeof AbortController ? AbortController : function() { + var listeners = [], signal = this.signal = { + aborted: !1, + addEventListener: function(type, listener) { + listeners.push(listener); + } + }; + this.abort = function() { + signal.aborted = !0; + listeners.forEach(function(listener) { + return listener(); + }); + }; + }; + var scheduleCallback$2 = Scheduler.unstable_scheduleCallback; + var NormalPriority = Scheduler.unstable_NormalPriority; + var CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0 + }; + function createCache() { + return { + controller: new AbortControllerLocal(), + data: /* @__PURE__ */ new Map(), + refCount: 0 + }; + } + function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && scheduleCallback$2(NormalPriority, function() { + cache.controller.abort(); + }); + } + var currentEntangledListeners = null; + var currentEntangledPendingCount = 0; + var currentEntangledLane = 0; + var currentEntangledActionThenable = null; + function entangleAsyncAction(transition, thenable) { + if (null === currentEntangledListeners) { + var entangledListeners = currentEntangledListeners = []; + currentEntangledPendingCount = 0; + currentEntangledLane = requestTransitionLane(); + currentEntangledActionThenable = { + status: "pending", + value: void 0, + then: function(resolve) { + entangledListeners.push(resolve); + } + }; + } + currentEntangledPendingCount++; + thenable.then(pingEngtangledActionScope, pingEngtangledActionScope); + return thenable; + } + function pingEngtangledActionScope() { + if (0 === --currentEntangledPendingCount && null !== currentEntangledListeners) { + null !== currentEntangledActionThenable && (currentEntangledActionThenable.status = "fulfilled"); + var listeners = currentEntangledListeners; + currentEntangledListeners = null; + currentEntangledLane = 0; + currentEntangledActionThenable = null; + for (var i = 0; i < listeners.length; i++) (0, listeners[i])(); + } + } + function chainThenableValue(thenable, result) { + var listeners = [], thenableWithOverride = { + status: "pending", + value: null, + reason: null, + then: function(resolve) { + listeners.push(resolve); + } + }; + thenable.then(function() { + thenableWithOverride.status = "fulfilled"; + thenableWithOverride.value = result; + for (var i = 0; i < listeners.length; i++) (0, listeners[i])(result); + }, function(error) { + thenableWithOverride.status = "rejected"; + thenableWithOverride.reason = error; + for (error = 0; error < listeners.length; error++) (0, listeners[error])(void 0); + }); + return thenableWithOverride; + } + var prevOnStartTransitionFinish = ReactSharedInternals.S; + ReactSharedInternals.S = function(transition, returnValue) { + globalMostRecentTransitionTime = now(); + "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && entangleAsyncAction(transition, returnValue); + null !== prevOnStartTransitionFinish && prevOnStartTransitionFinish(transition, returnValue); + }; + var resumedCache = createCursor(null); + function peekCacheFromPool() { + var cacheResumedFromPreviousRender = resumedCache.current; + return null !== cacheResumedFromPreviousRender ? cacheResumedFromPreviousRender : workInProgressRoot.pooledCache; + } + function pushTransition(offscreenWorkInProgress, prevCachePool) { + null === prevCachePool ? push(resumedCache, resumedCache.current) : push(resumedCache, prevCachePool.pool); + } + function getSuspendedCache() { + var cacheFromPool = peekCacheFromPool(); + return null === cacheFromPool ? null : { + parent: CacheContext._currentValue, + pool: cacheFromPool + }; + } + var SuspenseException = Error(formatProdErrorMessage(460)); + var SuspenseyCommitException = Error(formatProdErrorMessage(474)); + var SuspenseActionException = Error(formatProdErrorMessage(542)); + var noopSuspenseyCommitThenable = { then: function() {} }; + function isThenableResolved(thenable) { + thenable = thenable.status; + return "fulfilled" === thenable || "rejected" === thenable; + } + function trackUsedThenable(thenableState, thenable, index) { + index = thenableState[index]; + void 0 === index ? thenableState.push(thenable) : index !== thenable && (thenable.then(noop$1, noop$1), thenable = index); + switch (thenable.status) { + case "fulfilled": return thenable.value; + case "rejected": throw thenableState = thenable.reason, checkIfUseWrappedInAsyncCatch(thenableState), thenableState; + default: + if ("string" === typeof thenable.status) thenable.then(noop$1, noop$1); + else { + thenableState = workInProgressRoot; + if (null !== thenableState && 100 < thenableState.shellSuspendCounter) throw Error(formatProdErrorMessage(482)); + thenableState = thenable; + thenableState.status = "pending"; + thenableState.then(function(fulfilledValue) { + if ("pending" === thenable.status) { + var fulfilledThenable = thenable; + fulfilledThenable.status = "fulfilled"; + fulfilledThenable.value = fulfilledValue; + } + }, function(error) { + if ("pending" === thenable.status) { + var rejectedThenable = thenable; + rejectedThenable.status = "rejected"; + rejectedThenable.reason = error; + } + }); + } + switch (thenable.status) { + case "fulfilled": return thenable.value; + case "rejected": throw thenableState = thenable.reason, checkIfUseWrappedInAsyncCatch(thenableState), thenableState; + } + suspendedThenable = thenable; + throw SuspenseException; + } + } + function resolveLazy(lazyType) { + try { + var init = lazyType._init; + return init(lazyType._payload); + } catch (x) { + if (null !== x && "object" === typeof x && "function" === typeof x.then) throw suspendedThenable = x, SuspenseException; + throw x; + } + } + var suspendedThenable = null; + function getSuspendedThenable() { + if (null === suspendedThenable) throw Error(formatProdErrorMessage(459)); + var thenable = suspendedThenable; + suspendedThenable = null; + return thenable; + } + function checkIfUseWrappedInAsyncCatch(rejectedReason) { + if (rejectedReason === SuspenseException || rejectedReason === SuspenseActionException) throw Error(formatProdErrorMessage(483)); + } + var thenableState$1 = null; + var thenableIndexCounter$1 = 0; + function unwrapThenable(thenable) { + var index = thenableIndexCounter$1; + thenableIndexCounter$1 += 1; + null === thenableState$1 && (thenableState$1 = []); + return trackUsedThenable(thenableState$1, thenable, index); + } + function coerceRef(workInProgress, element) { + element = element.props.ref; + workInProgress.ref = void 0 !== element ? element : null; + } + function throwOnInvalidObjectTypeImpl(returnFiber, newChild) { + if (newChild.$$typeof === REACT_LEGACY_ELEMENT_TYPE) throw Error(formatProdErrorMessage(525)); + returnFiber = Object.prototype.toString.call(newChild); + throw Error(formatProdErrorMessage(31, "[object Object]" === returnFiber ? "object with keys {" + Object.keys(newChild).join(", ") + "}" : returnFiber)); + } + function createChildReconciler(shouldTrackSideEffects) { + function deleteChild(returnFiber, childToDelete) { + if (shouldTrackSideEffects) { + var deletions = returnFiber.deletions; + null === deletions ? (returnFiber.deletions = [childToDelete], returnFiber.flags |= 16) : deletions.push(childToDelete); + } + } + function deleteRemainingChildren(returnFiber, currentFirstChild) { + if (!shouldTrackSideEffects) return null; + for (; null !== currentFirstChild;) deleteChild(returnFiber, currentFirstChild), currentFirstChild = currentFirstChild.sibling; + return null; + } + function mapRemainingChildren(currentFirstChild) { + for (var existingChildren = /* @__PURE__ */ new Map(); null !== currentFirstChild;) null !== currentFirstChild.key ? existingChildren.set(currentFirstChild.key, currentFirstChild) : existingChildren.set(currentFirstChild.index, currentFirstChild), currentFirstChild = currentFirstChild.sibling; + return existingChildren; + } + function useFiber(fiber, pendingProps) { + fiber = createWorkInProgress(fiber, pendingProps); + fiber.index = 0; + fiber.sibling = null; + return fiber; + } + function placeChild(newFiber, lastPlacedIndex, newIndex) { + newFiber.index = newIndex; + if (!shouldTrackSideEffects) return newFiber.flags |= 1048576, lastPlacedIndex; + newIndex = newFiber.alternate; + if (null !== newIndex) return newIndex = newIndex.index, newIndex < lastPlacedIndex ? (newFiber.flags |= 67108866, lastPlacedIndex) : newIndex; + newFiber.flags |= 67108866; + return lastPlacedIndex; + } + function placeSingleChild(newFiber) { + shouldTrackSideEffects && null === newFiber.alternate && (newFiber.flags |= 67108866); + return newFiber; + } + function updateTextNode(returnFiber, current, textContent, lanes) { + if (null === current || 6 !== current.tag) return current = createFiberFromText(textContent, returnFiber.mode, lanes), current.return = returnFiber, current; + current = useFiber(current, textContent); + current.return = returnFiber; + return current; + } + function updateElement(returnFiber, current, element, lanes) { + var elementType = element.type; + if (elementType === REACT_FRAGMENT_TYPE) return updateFragment(returnFiber, current, element.props.children, lanes, element.key); + if (null !== current && (current.elementType === elementType || "object" === typeof elementType && null !== elementType && elementType.$$typeof === REACT_LAZY_TYPE && resolveLazy(elementType) === current.type)) return current = useFiber(current, element.props), coerceRef(current, element), current.return = returnFiber, current; + current = createFiberFromTypeAndProps(element.type, element.key, element.props, null, returnFiber.mode, lanes); + coerceRef(current, element); + current.return = returnFiber; + return current; + } + function updatePortal(returnFiber, current, portal, lanes) { + if (null === current || 4 !== current.tag || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) return current = createFiberFromPortal(portal, returnFiber.mode, lanes), current.return = returnFiber, current; + current = useFiber(current, portal.children || []); + current.return = returnFiber; + return current; + } + function updateFragment(returnFiber, current, fragment, lanes, key) { + if (null === current || 7 !== current.tag) return current = createFiberFromFragment(fragment, returnFiber.mode, lanes, key), current.return = returnFiber, current; + current = useFiber(current, fragment); + current.return = returnFiber; + return current; + } + function createChild(returnFiber, newChild, lanes) { + if ("string" === typeof newChild && "" !== newChild || "number" === typeof newChild || "bigint" === typeof newChild) return newChild = createFiberFromText("" + newChild, returnFiber.mode, lanes), newChild.return = returnFiber, newChild; + if ("object" === typeof newChild && null !== newChild) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: return lanes = createFiberFromTypeAndProps(newChild.type, newChild.key, newChild.props, null, returnFiber.mode, lanes), coerceRef(lanes, newChild), lanes.return = returnFiber, lanes; + case REACT_PORTAL_TYPE: return newChild = createFiberFromPortal(newChild, returnFiber.mode, lanes), newChild.return = returnFiber, newChild; + case REACT_LAZY_TYPE: return newChild = resolveLazy(newChild), createChild(returnFiber, newChild, lanes); + } + if (isArrayImpl(newChild) || getIteratorFn(newChild)) return newChild = createFiberFromFragment(newChild, returnFiber.mode, lanes, null), newChild.return = returnFiber, newChild; + if ("function" === typeof newChild.then) return createChild(returnFiber, unwrapThenable(newChild), lanes); + if (newChild.$$typeof === REACT_CONTEXT_TYPE) return createChild(returnFiber, readContextDuringReconciliation(returnFiber, newChild), lanes); + throwOnInvalidObjectTypeImpl(returnFiber, newChild); + } + return null; + } + function updateSlot(returnFiber, oldFiber, newChild, lanes) { + var key = null !== oldFiber ? oldFiber.key : null; + if ("string" === typeof newChild && "" !== newChild || "number" === typeof newChild || "bigint" === typeof newChild) return null !== key ? null : updateTextNode(returnFiber, oldFiber, "" + newChild, lanes); + if ("object" === typeof newChild && null !== newChild) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: return newChild.key === key ? updateElement(returnFiber, oldFiber, newChild, lanes) : null; + case REACT_PORTAL_TYPE: return newChild.key === key ? updatePortal(returnFiber, oldFiber, newChild, lanes) : null; + case REACT_LAZY_TYPE: return newChild = resolveLazy(newChild), updateSlot(returnFiber, oldFiber, newChild, lanes); + } + if (isArrayImpl(newChild) || getIteratorFn(newChild)) return null !== key ? null : updateFragment(returnFiber, oldFiber, newChild, lanes, null); + if ("function" === typeof newChild.then) return updateSlot(returnFiber, oldFiber, unwrapThenable(newChild), lanes); + if (newChild.$$typeof === REACT_CONTEXT_TYPE) return updateSlot(returnFiber, oldFiber, readContextDuringReconciliation(returnFiber, newChild), lanes); + throwOnInvalidObjectTypeImpl(returnFiber, newChild); + } + return null; + } + function updateFromMap(existingChildren, returnFiber, newIdx, newChild, lanes) { + if ("string" === typeof newChild && "" !== newChild || "number" === typeof newChild || "bigint" === typeof newChild) return existingChildren = existingChildren.get(newIdx) || null, updateTextNode(returnFiber, existingChildren, "" + newChild, lanes); + if ("object" === typeof newChild && null !== newChild) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: return existingChildren = existingChildren.get(null === newChild.key ? newIdx : newChild.key) || null, updateElement(returnFiber, existingChildren, newChild, lanes); + case REACT_PORTAL_TYPE: return existingChildren = existingChildren.get(null === newChild.key ? newIdx : newChild.key) || null, updatePortal(returnFiber, existingChildren, newChild, lanes); + case REACT_LAZY_TYPE: return newChild = resolveLazy(newChild), updateFromMap(existingChildren, returnFiber, newIdx, newChild, lanes); + } + if (isArrayImpl(newChild) || getIteratorFn(newChild)) return existingChildren = existingChildren.get(newIdx) || null, updateFragment(returnFiber, existingChildren, newChild, lanes, null); + if ("function" === typeof newChild.then) return updateFromMap(existingChildren, returnFiber, newIdx, unwrapThenable(newChild), lanes); + if (newChild.$$typeof === REACT_CONTEXT_TYPE) return updateFromMap(existingChildren, returnFiber, newIdx, readContextDuringReconciliation(returnFiber, newChild), lanes); + throwOnInvalidObjectTypeImpl(returnFiber, newChild); + } + return null; + } + function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, lanes) { + for (var resultingFirstChild = null, previousNewFiber = null, oldFiber = currentFirstChild, newIdx = currentFirstChild = 0, nextOldFiber = null; null !== oldFiber && newIdx < newChildren.length; newIdx++) { + oldFiber.index > newIdx ? (nextOldFiber = oldFiber, oldFiber = null) : nextOldFiber = oldFiber.sibling; + var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], lanes); + if (null === newFiber) { + null === oldFiber && (oldFiber = nextOldFiber); + break; + } + shouldTrackSideEffects && oldFiber && null === newFiber.alternate && deleteChild(returnFiber, oldFiber); + currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx); + null === previousNewFiber ? resultingFirstChild = newFiber : previousNewFiber.sibling = newFiber; + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } + if (newIdx === newChildren.length) return deleteRemainingChildren(returnFiber, oldFiber), isHydrating && pushTreeFork(returnFiber, newIdx), resultingFirstChild; + if (null === oldFiber) { + for (; newIdx < newChildren.length; newIdx++) oldFiber = createChild(returnFiber, newChildren[newIdx], lanes), null !== oldFiber && (currentFirstChild = placeChild(oldFiber, currentFirstChild, newIdx), null === previousNewFiber ? resultingFirstChild = oldFiber : previousNewFiber.sibling = oldFiber, previousNewFiber = oldFiber); + isHydrating && pushTreeFork(returnFiber, newIdx); + return resultingFirstChild; + } + for (oldFiber = mapRemainingChildren(oldFiber); newIdx < newChildren.length; newIdx++) nextOldFiber = updateFromMap(oldFiber, returnFiber, newIdx, newChildren[newIdx], lanes), null !== nextOldFiber && (shouldTrackSideEffects && null !== nextOldFiber.alternate && oldFiber.delete(null === nextOldFiber.key ? newIdx : nextOldFiber.key), currentFirstChild = placeChild(nextOldFiber, currentFirstChild, newIdx), null === previousNewFiber ? resultingFirstChild = nextOldFiber : previousNewFiber.sibling = nextOldFiber, previousNewFiber = nextOldFiber); + shouldTrackSideEffects && oldFiber.forEach(function(child) { + return deleteChild(returnFiber, child); + }); + isHydrating && pushTreeFork(returnFiber, newIdx); + return resultingFirstChild; + } + function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildren, lanes) { + if (null == newChildren) throw Error(formatProdErrorMessage(151)); + for (var resultingFirstChild = null, previousNewFiber = null, oldFiber = currentFirstChild, newIdx = currentFirstChild = 0, nextOldFiber = null, step = newChildren.next(); null !== oldFiber && !step.done; newIdx++, step = newChildren.next()) { + oldFiber.index > newIdx ? (nextOldFiber = oldFiber, oldFiber = null) : nextOldFiber = oldFiber.sibling; + var newFiber = updateSlot(returnFiber, oldFiber, step.value, lanes); + if (null === newFiber) { + null === oldFiber && (oldFiber = nextOldFiber); + break; + } + shouldTrackSideEffects && oldFiber && null === newFiber.alternate && deleteChild(returnFiber, oldFiber); + currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx); + null === previousNewFiber ? resultingFirstChild = newFiber : previousNewFiber.sibling = newFiber; + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } + if (step.done) return deleteRemainingChildren(returnFiber, oldFiber), isHydrating && pushTreeFork(returnFiber, newIdx), resultingFirstChild; + if (null === oldFiber) { + for (; !step.done; newIdx++, step = newChildren.next()) step = createChild(returnFiber, step.value, lanes), null !== step && (currentFirstChild = placeChild(step, currentFirstChild, newIdx), null === previousNewFiber ? resultingFirstChild = step : previousNewFiber.sibling = step, previousNewFiber = step); + isHydrating && pushTreeFork(returnFiber, newIdx); + return resultingFirstChild; + } + for (oldFiber = mapRemainingChildren(oldFiber); !step.done; newIdx++, step = newChildren.next()) step = updateFromMap(oldFiber, returnFiber, newIdx, step.value, lanes), null !== step && (shouldTrackSideEffects && null !== step.alternate && oldFiber.delete(null === step.key ? newIdx : step.key), currentFirstChild = placeChild(step, currentFirstChild, newIdx), null === previousNewFiber ? resultingFirstChild = step : previousNewFiber.sibling = step, previousNewFiber = step); + shouldTrackSideEffects && oldFiber.forEach(function(child) { + return deleteChild(returnFiber, child); + }); + isHydrating && pushTreeFork(returnFiber, newIdx); + return resultingFirstChild; + } + function reconcileChildFibersImpl(returnFiber, currentFirstChild, newChild, lanes) { + "object" === typeof newChild && null !== newChild && newChild.type === REACT_FRAGMENT_TYPE && null === newChild.key && (newChild = newChild.props.children); + if ("object" === typeof newChild && null !== newChild) { + switch (newChild.$$typeof) { + case REACT_ELEMENT_TYPE: + a: { + for (var key = newChild.key; null !== currentFirstChild;) { + if (currentFirstChild.key === key) { + key = newChild.type; + if (key === REACT_FRAGMENT_TYPE) { + if (7 === currentFirstChild.tag) { + deleteRemainingChildren(returnFiber, currentFirstChild.sibling); + lanes = useFiber(currentFirstChild, newChild.props.children); + lanes.return = returnFiber; + returnFiber = lanes; + break a; + } + } else if (currentFirstChild.elementType === key || "object" === typeof key && null !== key && key.$$typeof === REACT_LAZY_TYPE && resolveLazy(key) === currentFirstChild.type) { + deleteRemainingChildren(returnFiber, currentFirstChild.sibling); + lanes = useFiber(currentFirstChild, newChild.props); + coerceRef(lanes, newChild); + lanes.return = returnFiber; + returnFiber = lanes; + break a; + } + deleteRemainingChildren(returnFiber, currentFirstChild); + break; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; + } + newChild.type === REACT_FRAGMENT_TYPE ? (lanes = createFiberFromFragment(newChild.props.children, returnFiber.mode, lanes, newChild.key), lanes.return = returnFiber, returnFiber = lanes) : (lanes = createFiberFromTypeAndProps(newChild.type, newChild.key, newChild.props, null, returnFiber.mode, lanes), coerceRef(lanes, newChild), lanes.return = returnFiber, returnFiber = lanes); + } + return placeSingleChild(returnFiber); + case REACT_PORTAL_TYPE: + a: { + for (key = newChild.key; null !== currentFirstChild;) { + if (currentFirstChild.key === key) if (4 === currentFirstChild.tag && currentFirstChild.stateNode.containerInfo === newChild.containerInfo && currentFirstChild.stateNode.implementation === newChild.implementation) { + deleteRemainingChildren(returnFiber, currentFirstChild.sibling); + lanes = useFiber(currentFirstChild, newChild.children || []); + lanes.return = returnFiber; + returnFiber = lanes; + break a; + } else { + deleteRemainingChildren(returnFiber, currentFirstChild); + break; + } + else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; + } + lanes = createFiberFromPortal(newChild, returnFiber.mode, lanes); + lanes.return = returnFiber; + returnFiber = lanes; + } + return placeSingleChild(returnFiber); + case REACT_LAZY_TYPE: return newChild = resolveLazy(newChild), reconcileChildFibersImpl(returnFiber, currentFirstChild, newChild, lanes); + } + if (isArrayImpl(newChild)) return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, lanes); + if (getIteratorFn(newChild)) { + key = getIteratorFn(newChild); + if ("function" !== typeof key) throw Error(formatProdErrorMessage(150)); + newChild = key.call(newChild); + return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, lanes); + } + if ("function" === typeof newChild.then) return reconcileChildFibersImpl(returnFiber, currentFirstChild, unwrapThenable(newChild), lanes); + if (newChild.$$typeof === REACT_CONTEXT_TYPE) return reconcileChildFibersImpl(returnFiber, currentFirstChild, readContextDuringReconciliation(returnFiber, newChild), lanes); + throwOnInvalidObjectTypeImpl(returnFiber, newChild); + } + return "string" === typeof newChild && "" !== newChild || "number" === typeof newChild || "bigint" === typeof newChild ? (newChild = "" + newChild, null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), lanes = useFiber(currentFirstChild, newChild), lanes.return = returnFiber, returnFiber = lanes) : (deleteRemainingChildren(returnFiber, currentFirstChild), lanes = createFiberFromText(newChild, returnFiber.mode, lanes), lanes.return = returnFiber, returnFiber = lanes), placeSingleChild(returnFiber)) : deleteRemainingChildren(returnFiber, currentFirstChild); + } + return function(returnFiber, currentFirstChild, newChild, lanes) { + try { + thenableIndexCounter$1 = 0; + var firstChildFiber = reconcileChildFibersImpl(returnFiber, currentFirstChild, newChild, lanes); + thenableState$1 = null; + return firstChildFiber; + } catch (x) { + if (x === SuspenseException || x === SuspenseActionException) throw x; + var fiber = createFiberImplClass(29, x, null, returnFiber.mode); + fiber.lanes = lanes; + fiber.return = returnFiber; + return fiber; + } + }; + } + var reconcileChildFibers = createChildReconciler(!0); + var mountChildFibers = createChildReconciler(!1); + var hasForceUpdate = !1; + function initializeUpdateQueue(fiber) { + fiber.updateQueue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { + pending: null, + lanes: 0, + hiddenCallbacks: null + }, + callbacks: null + }; + } + function cloneUpdateQueue(current, workInProgress) { + current = current.updateQueue; + workInProgress.updateQueue === current && (workInProgress.updateQueue = { + baseState: current.baseState, + firstBaseUpdate: current.firstBaseUpdate, + lastBaseUpdate: current.lastBaseUpdate, + shared: current.shared, + callbacks: null + }); + } + function createUpdate(lane) { + return { + lane, + tag: 0, + payload: null, + callback: null, + next: null + }; + } + function enqueueUpdate(fiber, update, lane) { + var updateQueue = fiber.updateQueue; + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if (0 !== (executionContext & 2)) { + var pending = updateQueue.pending; + null === pending ? update.next = update : (update.next = pending.next, pending.next = update); + updateQueue.pending = update; + update = getRootForUpdatedFiber(fiber); + markUpdateLaneFromFiberToRoot(fiber, null, lane); + return update; + } + enqueueUpdate$1(fiber, updateQueue, update, lane); + return getRootForUpdatedFiber(fiber); + } + function entangleTransitions(root, fiber, lane) { + fiber = fiber.updateQueue; + if (null !== fiber && (fiber = fiber.shared, 0 !== (lane & 4194048))) { + var queueLanes = fiber.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + fiber.lanes = lane; + markRootEntangled(root, lane); + } + } + function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + var queue = workInProgress.updateQueue, current = workInProgress.alternate; + if (null !== current && (current = current.updateQueue, queue === current)) { + var newFirst = null, newLast = null; + queue = queue.firstBaseUpdate; + if (null !== queue) { + do { + var clone = { + lane: queue.lane, + tag: queue.tag, + payload: queue.payload, + callback: null, + next: null + }; + null === newLast ? newFirst = newLast = clone : newLast = newLast.next = clone; + queue = queue.next; + } while (null !== queue); + null === newLast ? newFirst = newLast = capturedUpdate : newLast = newLast.next = capturedUpdate; + } else newFirst = newLast = capturedUpdate; + queue = { + baseState: current.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: current.shared, + callbacks: current.callbacks + }; + workInProgress.updateQueue = queue; + return; + } + workInProgress = queue.lastBaseUpdate; + null === workInProgress ? queue.firstBaseUpdate = capturedUpdate : workInProgress.next = capturedUpdate; + queue.lastBaseUpdate = capturedUpdate; + } + var didReadFromEntangledAsyncAction = !1; + function suspendIfUpdateReadFromEntangledAsyncAction() { + if (didReadFromEntangledAsyncAction) { + var entangledActionThenable = currentEntangledActionThenable; + if (null !== entangledActionThenable) throw entangledActionThenable; + } + } + function processUpdateQueue(workInProgress$jscomp$0, props, instance$jscomp$0, renderLanes) { + didReadFromEntangledAsyncAction = !1; + var queue = workInProgress$jscomp$0.updateQueue; + hasForceUpdate = !1; + var firstBaseUpdate = queue.firstBaseUpdate, lastBaseUpdate = queue.lastBaseUpdate, pendingQueue = queue.shared.pending; + if (null !== pendingQueue) { + queue.shared.pending = null; + var lastPendingUpdate = pendingQueue, firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; + null === lastBaseUpdate ? firstBaseUpdate = firstPendingUpdate : lastBaseUpdate.next = firstPendingUpdate; + lastBaseUpdate = lastPendingUpdate; + var current = workInProgress$jscomp$0.alternate; + null !== current && (current = current.updateQueue, pendingQueue = current.lastBaseUpdate, pendingQueue !== lastBaseUpdate && (null === pendingQueue ? current.firstBaseUpdate = firstPendingUpdate : pendingQueue.next = firstPendingUpdate, current.lastBaseUpdate = lastPendingUpdate)); + } + if (null !== firstBaseUpdate) { + var newState = queue.baseState; + lastBaseUpdate = 0; + current = firstPendingUpdate = lastPendingUpdate = null; + pendingQueue = firstBaseUpdate; + do { + var updateLane = pendingQueue.lane & -536870913, isHiddenUpdate = updateLane !== pendingQueue.lane; + if (isHiddenUpdate ? (workInProgressRootRenderLanes & updateLane) === updateLane : (renderLanes & updateLane) === updateLane) { + 0 !== updateLane && updateLane === currentEntangledLane && (didReadFromEntangledAsyncAction = !0); + null !== current && (current = current.next = { + lane: 0, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: null, + next: null + }); + a: { + var workInProgress = workInProgress$jscomp$0, update = pendingQueue; + updateLane = props; + var instance = instance$jscomp$0; + switch (update.tag) { + case 1: + workInProgress = update.payload; + if ("function" === typeof workInProgress) { + newState = workInProgress.call(instance, newState, updateLane); + break a; + } + newState = workInProgress; + break a; + case 3: workInProgress.flags = workInProgress.flags & -65537 | 128; + case 0: + workInProgress = update.payload; + updateLane = "function" === typeof workInProgress ? workInProgress.call(instance, newState, updateLane) : workInProgress; + if (null === updateLane || void 0 === updateLane) break a; + newState = assign({}, newState, updateLane); + break a; + case 2: hasForceUpdate = !0; + } + } + updateLane = pendingQueue.callback; + null !== updateLane && (workInProgress$jscomp$0.flags |= 64, isHiddenUpdate && (workInProgress$jscomp$0.flags |= 8192), isHiddenUpdate = queue.callbacks, null === isHiddenUpdate ? queue.callbacks = [updateLane] : isHiddenUpdate.push(updateLane)); + } else isHiddenUpdate = { + lane: updateLane, + tag: pendingQueue.tag, + payload: pendingQueue.payload, + callback: pendingQueue.callback, + next: null + }, null === current ? (firstPendingUpdate = current = isHiddenUpdate, lastPendingUpdate = newState) : current = current.next = isHiddenUpdate, lastBaseUpdate |= updateLane; + pendingQueue = pendingQueue.next; + if (null === pendingQueue) if (pendingQueue = queue.shared.pending, null === pendingQueue) break; + else isHiddenUpdate = pendingQueue, pendingQueue = isHiddenUpdate.next, isHiddenUpdate.next = null, queue.lastBaseUpdate = isHiddenUpdate, queue.shared.pending = null; + } while (1); + null === current && (lastPendingUpdate = newState); + queue.baseState = lastPendingUpdate; + queue.firstBaseUpdate = firstPendingUpdate; + queue.lastBaseUpdate = current; + null === firstBaseUpdate && (queue.shared.lanes = 0); + workInProgressRootSkippedLanes |= lastBaseUpdate; + workInProgress$jscomp$0.lanes = lastBaseUpdate; + workInProgress$jscomp$0.memoizedState = newState; + } + } + function callCallback(callback, context) { + if ("function" !== typeof callback) throw Error(formatProdErrorMessage(191, callback)); + callback.call(context); + } + function commitCallbacks(updateQueue, context) { + var callbacks = updateQueue.callbacks; + if (null !== callbacks) for (updateQueue.callbacks = null, updateQueue = 0; updateQueue < callbacks.length; updateQueue++) callCallback(callbacks[updateQueue], context); + } + var currentTreeHiddenStackCursor = createCursor(null); + var prevEntangledRenderLanesCursor = createCursor(0); + function pushHiddenContext(fiber, context) { + fiber = entangledRenderLanes; + push(prevEntangledRenderLanesCursor, fiber); + push(currentTreeHiddenStackCursor, context); + entangledRenderLanes = fiber | context.baseLanes; + } + function reuseHiddenContextOnStack() { + push(prevEntangledRenderLanesCursor, entangledRenderLanes); + push(currentTreeHiddenStackCursor, currentTreeHiddenStackCursor.current); + } + function popHiddenContext() { + entangledRenderLanes = prevEntangledRenderLanesCursor.current; + pop(currentTreeHiddenStackCursor); + pop(prevEntangledRenderLanesCursor); + } + var suspenseHandlerStackCursor = createCursor(null); + var shellBoundary = null; + function pushPrimaryTreeSuspenseHandler(handler) { + var current = handler.alternate; + push(suspenseStackCursor, suspenseStackCursor.current & 1); + push(suspenseHandlerStackCursor, handler); + null === shellBoundary && (null === current || null !== currentTreeHiddenStackCursor.current ? shellBoundary = handler : null !== current.memoizedState && (shellBoundary = handler)); + } + function pushDehydratedActivitySuspenseHandler(fiber) { + push(suspenseStackCursor, suspenseStackCursor.current); + push(suspenseHandlerStackCursor, fiber); + null === shellBoundary && (shellBoundary = fiber); + } + function pushOffscreenSuspenseHandler(fiber) { + 22 === fiber.tag ? (push(suspenseStackCursor, suspenseStackCursor.current), push(suspenseHandlerStackCursor, fiber), null === shellBoundary && (shellBoundary = fiber)) : reuseSuspenseHandlerOnStack(fiber); + } + function reuseSuspenseHandlerOnStack() { + push(suspenseStackCursor, suspenseStackCursor.current); + push(suspenseHandlerStackCursor, suspenseHandlerStackCursor.current); + } + function popSuspenseHandler(fiber) { + pop(suspenseHandlerStackCursor); + shellBoundary === fiber && (shellBoundary = null); + pop(suspenseStackCursor); + } + var suspenseStackCursor = createCursor(0); + function findFirstSuspended(row) { + for (var node = row; null !== node;) { + if (13 === node.tag) { + var state = node.memoizedState; + if (null !== state && (state = state.dehydrated, null === state || isSuspenseInstancePending(state) || isSuspenseInstanceFallback(state))) return node; + } else if (19 === node.tag && ("forwards" === node.memoizedProps.revealOrder || "backwards" === node.memoizedProps.revealOrder || "unstable_legacy-backwards" === node.memoizedProps.revealOrder || "together" === node.memoizedProps.revealOrder)) { + if (0 !== (node.flags & 128)) return node; + } else if (null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === row) break; + for (; null === node.sibling;) { + if (null === node.return || node.return === row) return null; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + return null; + } + var renderLanes = 0; + var currentlyRenderingFiber = null; + var currentHook = null; + var workInProgressHook = null; + var didScheduleRenderPhaseUpdate = !1; + var didScheduleRenderPhaseUpdateDuringThisPass = !1; + var shouldDoubleInvokeUserFnsInHooksDEV = !1; + var localIdCounter = 0; + var thenableIndexCounter = 0; + var thenableState = null; + var globalClientIdCounter = 0; + function throwInvalidHookError() { + throw Error(formatProdErrorMessage(321)); + } + function areHookInputsEqual(nextDeps, prevDeps) { + if (null === prevDeps) return !1; + for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) if (!objectIs(nextDeps[i], prevDeps[i])) return !1; + return !0; + } + function renderWithHooks(current, workInProgress, Component, props, secondArg, nextRenderLanes) { + renderLanes = nextRenderLanes; + currentlyRenderingFiber = workInProgress; + workInProgress.memoizedState = null; + workInProgress.updateQueue = null; + workInProgress.lanes = 0; + ReactSharedInternals.H = null === current || null === current.memoizedState ? HooksDispatcherOnMount : HooksDispatcherOnUpdate; + shouldDoubleInvokeUserFnsInHooksDEV = !1; + nextRenderLanes = Component(props, secondArg); + shouldDoubleInvokeUserFnsInHooksDEV = !1; + didScheduleRenderPhaseUpdateDuringThisPass && (nextRenderLanes = renderWithHooksAgain(workInProgress, Component, props, secondArg)); + finishRenderingHooks(current); + return nextRenderLanes; + } + function finishRenderingHooks(current) { + ReactSharedInternals.H = ContextOnlyDispatcher; + var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; + renderLanes = 0; + workInProgressHook = currentHook = currentlyRenderingFiber = null; + didScheduleRenderPhaseUpdate = !1; + thenableIndexCounter = 0; + thenableState = null; + if (didRenderTooFewHooks) throw Error(formatProdErrorMessage(300)); + null === current || didReceiveUpdate || (current = current.dependencies, null !== current && checkIfContextChanged(current) && (didReceiveUpdate = !0)); + } + function renderWithHooksAgain(workInProgress, Component, props, secondArg) { + currentlyRenderingFiber = workInProgress; + var numberOfReRenders = 0; + do { + didScheduleRenderPhaseUpdateDuringThisPass && (thenableState = null); + thenableIndexCounter = 0; + didScheduleRenderPhaseUpdateDuringThisPass = !1; + if (25 <= numberOfReRenders) throw Error(formatProdErrorMessage(301)); + numberOfReRenders += 1; + workInProgressHook = currentHook = null; + if (null != workInProgress.updateQueue) { + var children = workInProgress.updateQueue; + children.lastEffect = null; + children.events = null; + children.stores = null; + null != children.memoCache && (children.memoCache.index = 0); + } + ReactSharedInternals.H = HooksDispatcherOnRerender; + children = Component(props, secondArg); + } while (didScheduleRenderPhaseUpdateDuringThisPass); + return children; + } + function TransitionAwareHostComponent() { + var dispatcher = ReactSharedInternals.H, maybeThenable = dispatcher.useState()[0]; + maybeThenable = "function" === typeof maybeThenable.then ? useThenable(maybeThenable) : maybeThenable; + dispatcher = dispatcher.useState()[0]; + (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher && (currentlyRenderingFiber.flags |= 1024); + return maybeThenable; + } + function checkDidRenderIdHook() { + var didRenderIdHook = 0 !== localIdCounter; + localIdCounter = 0; + return didRenderIdHook; + } + function bailoutHooks(current, workInProgress, lanes) { + workInProgress.updateQueue = current.updateQueue; + workInProgress.flags &= -2053; + current.lanes &= ~lanes; + } + function resetHooksOnUnwind(workInProgress) { + if (didScheduleRenderPhaseUpdate) { + for (workInProgress = workInProgress.memoizedState; null !== workInProgress;) { + var queue = workInProgress.queue; + null !== queue && (queue.pending = null); + workInProgress = workInProgress.next; + } + didScheduleRenderPhaseUpdate = !1; + } + renderLanes = 0; + workInProgressHook = currentHook = currentlyRenderingFiber = null; + didScheduleRenderPhaseUpdateDuringThisPass = !1; + thenableIndexCounter = localIdCounter = 0; + thenableState = null; + } + function mountWorkInProgressHook() { + var hook = { + memoizedState: null, + baseState: null, + baseQueue: null, + queue: null, + next: null + }; + null === workInProgressHook ? currentlyRenderingFiber.memoizedState = workInProgressHook = hook : workInProgressHook = workInProgressHook.next = hook; + return workInProgressHook; + } + function updateWorkInProgressHook() { + if (null === currentHook) { + var nextCurrentHook = currentlyRenderingFiber.alternate; + nextCurrentHook = null !== nextCurrentHook ? nextCurrentHook.memoizedState : null; + } else nextCurrentHook = currentHook.next; + var nextWorkInProgressHook = null === workInProgressHook ? currentlyRenderingFiber.memoizedState : workInProgressHook.next; + if (null !== nextWorkInProgressHook) workInProgressHook = nextWorkInProgressHook, currentHook = nextCurrentHook; + else { + if (null === nextCurrentHook) { + if (null === currentlyRenderingFiber.alternate) throw Error(formatProdErrorMessage(467)); + throw Error(formatProdErrorMessage(310)); + } + currentHook = nextCurrentHook; + nextCurrentHook = { + memoizedState: currentHook.memoizedState, + baseState: currentHook.baseState, + baseQueue: currentHook.baseQueue, + queue: currentHook.queue, + next: null + }; + null === workInProgressHook ? currentlyRenderingFiber.memoizedState = workInProgressHook = nextCurrentHook : workInProgressHook = workInProgressHook.next = nextCurrentHook; + } + return workInProgressHook; + } + function createFunctionComponentUpdateQueue() { + return { + lastEffect: null, + events: null, + stores: null, + memoCache: null + }; + } + function useThenable(thenable) { + var index = thenableIndexCounter; + thenableIndexCounter += 1; + null === thenableState && (thenableState = []); + thenable = trackUsedThenable(thenableState, thenable, index); + index = currentlyRenderingFiber; + null === (null === workInProgressHook ? index.memoizedState : workInProgressHook.next) && (index = index.alternate, ReactSharedInternals.H = null === index || null === index.memoizedState ? HooksDispatcherOnMount : HooksDispatcherOnUpdate); + return thenable; + } + function use(usable) { + if (null !== usable && "object" === typeof usable) { + if ("function" === typeof usable.then) return useThenable(usable); + if (usable.$$typeof === REACT_CONTEXT_TYPE) return readContext(usable); + } + throw Error(formatProdErrorMessage(438, String(usable))); + } + function useMemoCache(size) { + var memoCache = null, updateQueue = currentlyRenderingFiber.updateQueue; + null !== updateQueue && (memoCache = updateQueue.memoCache); + if (null == memoCache) { + var current = currentlyRenderingFiber.alternate; + null !== current && (current = current.updateQueue, null !== current && (current = current.memoCache, null != current && (memoCache = { + data: current.data.map(function(array) { + return array.slice(); + }), + index: 0 + }))); + } + memoCache ??= { + data: [], + index: 0 + }; + null === updateQueue && (updateQueue = createFunctionComponentUpdateQueue(), currentlyRenderingFiber.updateQueue = updateQueue); + updateQueue.memoCache = memoCache; + updateQueue = memoCache.data[memoCache.index]; + if (void 0 === updateQueue) for (updateQueue = memoCache.data[memoCache.index] = Array(size), current = 0; current < size; current++) updateQueue[current] = REACT_MEMO_CACHE_SENTINEL; + memoCache.index++; + return updateQueue; + } + function basicStateReducer(state, action) { + return "function" === typeof action ? action(state) : action; + } + function updateReducer(reducer) { + return updateReducerImpl(updateWorkInProgressHook(), currentHook, reducer); + } + function updateReducerImpl(hook, current, reducer) { + var queue = hook.queue; + if (null === queue) throw Error(formatProdErrorMessage(311)); + queue.lastRenderedReducer = reducer; + var baseQueue = hook.baseQueue, pendingQueue = queue.pending; + if (null !== pendingQueue) { + if (null !== baseQueue) { + var baseFirst = baseQueue.next; + baseQueue.next = pendingQueue.next; + pendingQueue.next = baseFirst; + } + current.baseQueue = baseQueue = pendingQueue; + queue.pending = null; + } + pendingQueue = hook.baseState; + if (null === baseQueue) hook.memoizedState = pendingQueue; + else { + current = baseQueue.next; + var newBaseQueueFirst = baseFirst = null, newBaseQueueLast = null, update = current, didReadFromEntangledAsyncAction$60 = !1; + do { + var updateLane = update.lane & -536870913; + if (updateLane !== update.lane ? (workInProgressRootRenderLanes & updateLane) === updateLane : (renderLanes & updateLane) === updateLane) { + var revertLane = update.revertLane; + if (0 === revertLane) null !== newBaseQueueLast && (newBaseQueueLast = newBaseQueueLast.next = { + lane: 0, + revertLane: 0, + gesture: null, + action: update.action, + hasEagerState: update.hasEagerState, + eagerState: update.eagerState, + next: null + }), updateLane === currentEntangledLane && (didReadFromEntangledAsyncAction$60 = !0); + else if ((renderLanes & revertLane) === revertLane) { + update = update.next; + revertLane === currentEntangledLane && (didReadFromEntangledAsyncAction$60 = !0); + continue; + } else updateLane = { + lane: 0, + revertLane: update.revertLane, + gesture: null, + action: update.action, + hasEagerState: update.hasEagerState, + eagerState: update.eagerState, + next: null + }, null === newBaseQueueLast ? (newBaseQueueFirst = newBaseQueueLast = updateLane, baseFirst = pendingQueue) : newBaseQueueLast = newBaseQueueLast.next = updateLane, currentlyRenderingFiber.lanes |= revertLane, workInProgressRootSkippedLanes |= revertLane; + updateLane = update.action; + shouldDoubleInvokeUserFnsInHooksDEV && reducer(pendingQueue, updateLane); + pendingQueue = update.hasEagerState ? update.eagerState : reducer(pendingQueue, updateLane); + } else revertLane = { + lane: updateLane, + revertLane: update.revertLane, + gesture: update.gesture, + action: update.action, + hasEagerState: update.hasEagerState, + eagerState: update.eagerState, + next: null + }, null === newBaseQueueLast ? (newBaseQueueFirst = newBaseQueueLast = revertLane, baseFirst = pendingQueue) : newBaseQueueLast = newBaseQueueLast.next = revertLane, currentlyRenderingFiber.lanes |= updateLane, workInProgressRootSkippedLanes |= updateLane; + update = update.next; + } while (null !== update && update !== current); + null === newBaseQueueLast ? baseFirst = pendingQueue : newBaseQueueLast.next = newBaseQueueFirst; + if (!objectIs(pendingQueue, hook.memoizedState) && (didReceiveUpdate = !0, didReadFromEntangledAsyncAction$60 && (reducer = currentEntangledActionThenable, null !== reducer))) throw reducer; + hook.memoizedState = pendingQueue; + hook.baseState = baseFirst; + hook.baseQueue = newBaseQueueLast; + queue.lastRenderedState = pendingQueue; + } + null === baseQueue && (queue.lanes = 0); + return [hook.memoizedState, queue.dispatch]; + } + function rerenderReducer(reducer) { + var hook = updateWorkInProgressHook(), queue = hook.queue; + if (null === queue) throw Error(formatProdErrorMessage(311)); + queue.lastRenderedReducer = reducer; + var dispatch = queue.dispatch, lastRenderPhaseUpdate = queue.pending, newState = hook.memoizedState; + if (null !== lastRenderPhaseUpdate) { + queue.pending = null; + var update = lastRenderPhaseUpdate = lastRenderPhaseUpdate.next; + do + newState = reducer(newState, update.action), update = update.next; + while (update !== lastRenderPhaseUpdate); + objectIs(newState, hook.memoizedState) || (didReceiveUpdate = !0); + hook.memoizedState = newState; + null === hook.baseQueue && (hook.baseState = newState); + queue.lastRenderedState = newState; + } + return [newState, dispatch]; + } + function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { + var fiber = currentlyRenderingFiber, hook = updateWorkInProgressHook(), isHydrating$jscomp$0 = isHydrating; + if (isHydrating$jscomp$0) { + if (void 0 === getServerSnapshot) throw Error(formatProdErrorMessage(407)); + getServerSnapshot = getServerSnapshot(); + } else getServerSnapshot = getSnapshot(); + var snapshotChanged = !objectIs((currentHook || hook).memoizedState, getServerSnapshot); + snapshotChanged && (hook.memoizedState = getServerSnapshot, didReceiveUpdate = !0); + hook = hook.queue; + updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [subscribe]); + if (hook.getSnapshot !== getSnapshot || snapshotChanged || null !== workInProgressHook && workInProgressHook.memoizedState.tag & 1) { + fiber.flags |= 2048; + pushSimpleEffect(9, { destroy: void 0 }, updateStoreInstance.bind(null, fiber, hook, getServerSnapshot, getSnapshot), null); + if (null === workInProgressRoot) throw Error(formatProdErrorMessage(349)); + isHydrating$jscomp$0 || 0 !== (renderLanes & 127) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); + } + return getServerSnapshot; + } + function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { + fiber.flags |= 16384; + fiber = { + getSnapshot, + value: renderedSnapshot + }; + getSnapshot = currentlyRenderingFiber.updateQueue; + null === getSnapshot ? (getSnapshot = createFunctionComponentUpdateQueue(), currentlyRenderingFiber.updateQueue = getSnapshot, getSnapshot.stores = [fiber]) : (renderedSnapshot = getSnapshot.stores, null === renderedSnapshot ? getSnapshot.stores = [fiber] : renderedSnapshot.push(fiber)); + } + function updateStoreInstance(fiber, inst, nextSnapshot, getSnapshot) { + inst.value = nextSnapshot; + inst.getSnapshot = getSnapshot; + checkIfSnapshotChanged(inst) && forceStoreRerender(fiber); + } + function subscribeToStore(fiber, inst, subscribe) { + return subscribe(function() { + checkIfSnapshotChanged(inst) && forceStoreRerender(fiber); + }); + } + function checkIfSnapshotChanged(inst) { + var latestGetSnapshot = inst.getSnapshot; + inst = inst.value; + try { + var nextValue = latestGetSnapshot(); + return !objectIs(inst, nextValue); + } catch (error) { + return !0; + } + } + function forceStoreRerender(fiber) { + var root = enqueueConcurrentRenderForLane(fiber, 2); + null !== root && scheduleUpdateOnFiber(root, fiber, 2); + } + function mountStateImpl(initialState) { + var hook = mountWorkInProgressHook(); + if ("function" === typeof initialState) { + var initialStateInitializer = initialState; + initialState = initialStateInitializer(); + if (shouldDoubleInvokeUserFnsInHooksDEV) { + setIsStrictModeForDevtools(!0); + try { + initialStateInitializer(); + } finally { + setIsStrictModeForDevtools(!1); + } + } + } + hook.memoizedState = hook.baseState = initialState; + hook.queue = { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialState + }; + return hook; + } + function updateOptimisticImpl(hook, current, passthrough, reducer) { + hook.baseState = passthrough; + return updateReducerImpl(hook, currentHook, "function" === typeof reducer ? reducer : basicStateReducer); + } + function dispatchActionState(fiber, actionQueue, setPendingState, setState, payload) { + if (isRenderPhaseUpdate(fiber)) throw Error(formatProdErrorMessage(485)); + fiber = actionQueue.action; + if (null !== fiber) { + var actionNode = { + payload, + action: fiber, + next: null, + isTransition: !0, + status: "pending", + value: null, + reason: null, + listeners: [], + then: function(listener) { + actionNode.listeners.push(listener); + } + }; + null !== ReactSharedInternals.T ? setPendingState(!0) : actionNode.isTransition = !1; + setState(actionNode); + setPendingState = actionQueue.pending; + null === setPendingState ? (actionNode.next = actionQueue.pending = actionNode, runActionStateAction(actionQueue, actionNode)) : (actionNode.next = setPendingState.next, actionQueue.pending = setPendingState.next = actionNode); + } + } + function runActionStateAction(actionQueue, node) { + var action = node.action, payload = node.payload, prevState = actionQueue.state; + if (node.isTransition) { + var prevTransition = ReactSharedInternals.T, currentTransition = {}; + ReactSharedInternals.T = currentTransition; + try { + var returnValue = action(prevState, payload), onStartTransitionFinish = ReactSharedInternals.S; + null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue); + handleActionReturnValue(actionQueue, node, returnValue); + } catch (error) { + onActionError(actionQueue, node, error); + } finally { + null !== prevTransition && null !== currentTransition.types && (prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition; + } + } else try { + prevTransition = action(prevState, payload), handleActionReturnValue(actionQueue, node, prevTransition); + } catch (error$66) { + onActionError(actionQueue, node, error$66); + } + } + function handleActionReturnValue(actionQueue, node, returnValue) { + null !== returnValue && "object" === typeof returnValue && "function" === typeof returnValue.then ? returnValue.then(function(nextState) { + onActionSuccess(actionQueue, node, nextState); + }, function(error) { + return onActionError(actionQueue, node, error); + }) : onActionSuccess(actionQueue, node, returnValue); + } + function onActionSuccess(actionQueue, actionNode, nextState) { + actionNode.status = "fulfilled"; + actionNode.value = nextState; + notifyActionListeners(actionNode); + actionQueue.state = nextState; + actionNode = actionQueue.pending; + null !== actionNode && (nextState = actionNode.next, nextState === actionNode ? actionQueue.pending = null : (nextState = nextState.next, actionNode.next = nextState, runActionStateAction(actionQueue, nextState))); + } + function onActionError(actionQueue, actionNode, error) { + var last = actionQueue.pending; + actionQueue.pending = null; + if (null !== last) { + last = last.next; + do + actionNode.status = "rejected", actionNode.reason = error, notifyActionListeners(actionNode), actionNode = actionNode.next; + while (actionNode !== last); + } + actionQueue.action = null; + } + function notifyActionListeners(actionNode) { + actionNode = actionNode.listeners; + for (var i = 0; i < actionNode.length; i++) (0, actionNode[i])(); + } + function actionStateReducer(oldState, newState) { + return newState; + } + function mountActionState(action, initialStateProp) { + if (isHydrating) { + var ssrFormState = workInProgressRoot.formState; + if (null !== ssrFormState) { + a: { + var JSCompiler_inline_result = currentlyRenderingFiber; + if (isHydrating) { + if (nextHydratableInstance) { + b: { + var JSCompiler_inline_result$jscomp$0 = nextHydratableInstance; + for (var inRootOrSingleton = rootOrSingletonContext; 8 !== JSCompiler_inline_result$jscomp$0.nodeType;) { + if (!inRootOrSingleton) { + JSCompiler_inline_result$jscomp$0 = null; + break b; + } + JSCompiler_inline_result$jscomp$0 = getNextHydratable(JSCompiler_inline_result$jscomp$0.nextSibling); + if (null === JSCompiler_inline_result$jscomp$0) { + JSCompiler_inline_result$jscomp$0 = null; + break b; + } + } + inRootOrSingleton = JSCompiler_inline_result$jscomp$0.data; + JSCompiler_inline_result$jscomp$0 = "F!" === inRootOrSingleton || "F" === inRootOrSingleton ? JSCompiler_inline_result$jscomp$0 : null; + } + if (JSCompiler_inline_result$jscomp$0) { + nextHydratableInstance = getNextHydratable(JSCompiler_inline_result$jscomp$0.nextSibling); + JSCompiler_inline_result = "F!" === JSCompiler_inline_result$jscomp$0.data; + break a; + } + } + throwOnHydrationMismatch(JSCompiler_inline_result); + } + JSCompiler_inline_result = !1; + } + JSCompiler_inline_result && (initialStateProp = ssrFormState[0]); + } + } + ssrFormState = mountWorkInProgressHook(); + ssrFormState.memoizedState = ssrFormState.baseState = initialStateProp; + JSCompiler_inline_result = { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: actionStateReducer, + lastRenderedState: initialStateProp + }; + ssrFormState.queue = JSCompiler_inline_result; + ssrFormState = dispatchSetState.bind(null, currentlyRenderingFiber, JSCompiler_inline_result); + JSCompiler_inline_result.dispatch = ssrFormState; + JSCompiler_inline_result = mountStateImpl(!1); + inRootOrSingleton = dispatchOptimisticSetState.bind(null, currentlyRenderingFiber, !1, JSCompiler_inline_result.queue); + JSCompiler_inline_result = mountWorkInProgressHook(); + JSCompiler_inline_result$jscomp$0 = { + state: initialStateProp, + dispatch: null, + action, + pending: null + }; + JSCompiler_inline_result.queue = JSCompiler_inline_result$jscomp$0; + ssrFormState = dispatchActionState.bind(null, currentlyRenderingFiber, JSCompiler_inline_result$jscomp$0, inRootOrSingleton, ssrFormState); + JSCompiler_inline_result$jscomp$0.dispatch = ssrFormState; + JSCompiler_inline_result.memoizedState = action; + return [ + initialStateProp, + ssrFormState, + !1 + ]; + } + function updateActionState(action) { + return updateActionStateImpl(updateWorkInProgressHook(), currentHook, action); + } + function updateActionStateImpl(stateHook, currentStateHook, action) { + currentStateHook = updateReducerImpl(stateHook, currentStateHook, actionStateReducer)[0]; + stateHook = updateReducer(basicStateReducer)[0]; + if ("object" === typeof currentStateHook && null !== currentStateHook && "function" === typeof currentStateHook.then) try { + var state = useThenable(currentStateHook); + } catch (x) { + if (x === SuspenseException) throw SuspenseActionException; + throw x; + } + else state = currentStateHook; + currentStateHook = updateWorkInProgressHook(); + var actionQueue = currentStateHook.queue, dispatch = actionQueue.dispatch; + action !== currentStateHook.memoizedState && (currentlyRenderingFiber.flags |= 2048, pushSimpleEffect(9, { destroy: void 0 }, actionStateActionEffect.bind(null, actionQueue, action), null)); + return [ + state, + dispatch, + stateHook + ]; + } + function actionStateActionEffect(actionQueue, action) { + actionQueue.action = action; + } + function rerenderActionState(action) { + var stateHook = updateWorkInProgressHook(), currentStateHook = currentHook; + if (null !== currentStateHook) return updateActionStateImpl(stateHook, currentStateHook, action); + updateWorkInProgressHook(); + stateHook = stateHook.memoizedState; + currentStateHook = updateWorkInProgressHook(); + var dispatch = currentStateHook.queue.dispatch; + currentStateHook.memoizedState = action; + return [ + stateHook, + dispatch, + !1 + ]; + } + function pushSimpleEffect(tag, inst, create, deps) { + tag = { + tag, + create, + deps, + inst, + next: null + }; + inst = currentlyRenderingFiber.updateQueue; + null === inst && (inst = createFunctionComponentUpdateQueue(), currentlyRenderingFiber.updateQueue = inst); + create = inst.lastEffect; + null === create ? inst.lastEffect = tag.next = tag : (deps = create.next, create.next = tag, tag.next = deps, inst.lastEffect = tag); + return tag; + } + function updateRef() { + return updateWorkInProgressHook().memoizedState; + } + function mountEffectImpl(fiberFlags, hookFlags, create, deps) { + var hook = mountWorkInProgressHook(); + currentlyRenderingFiber.flags |= fiberFlags; + hook.memoizedState = pushSimpleEffect(1 | hookFlags, { destroy: void 0 }, create, void 0 === deps ? null : deps); + } + function updateEffectImpl(fiberFlags, hookFlags, create, deps) { + var hook = updateWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + var inst = hook.memoizedState.inst; + null !== currentHook && null !== deps && areHookInputsEqual(deps, currentHook.memoizedState.deps) ? hook.memoizedState = pushSimpleEffect(hookFlags, inst, create, deps) : (currentlyRenderingFiber.flags |= fiberFlags, hook.memoizedState = pushSimpleEffect(1 | hookFlags, inst, create, deps)); + } + function mountEffect(create, deps) { + mountEffectImpl(8390656, 8, create, deps); + } + function updateEffect(create, deps) { + updateEffectImpl(2048, 8, create, deps); + } + function useEffectEventImpl(payload) { + currentlyRenderingFiber.flags |= 4; + var componentUpdateQueue = currentlyRenderingFiber.updateQueue; + if (null === componentUpdateQueue) componentUpdateQueue = createFunctionComponentUpdateQueue(), currentlyRenderingFiber.updateQueue = componentUpdateQueue, componentUpdateQueue.events = [payload]; + else { + var events = componentUpdateQueue.events; + null === events ? componentUpdateQueue.events = [payload] : events.push(payload); + } + } + function updateEvent(callback) { + var ref = updateWorkInProgressHook().memoizedState; + useEffectEventImpl({ + ref, + nextImpl: callback + }); + return function() { + if (0 !== (executionContext & 2)) throw Error(formatProdErrorMessage(440)); + return ref.impl.apply(void 0, arguments); + }; + } + function updateInsertionEffect(create, deps) { + return updateEffectImpl(4, 2, create, deps); + } + function updateLayoutEffect(create, deps) { + return updateEffectImpl(4, 4, create, deps); + } + function imperativeHandleEffect(create, ref) { + if ("function" === typeof ref) { + create = create(); + var refCleanup = ref(create); + return function() { + "function" === typeof refCleanup ? refCleanup() : ref(null); + }; + } + if (null !== ref && void 0 !== ref) return create = create(), ref.current = create, function() { + ref.current = null; + }; + } + function updateImperativeHandle(ref, create, deps) { + deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null; + updateEffectImpl(4, 4, imperativeHandleEffect.bind(null, create, ref), deps); + } + function mountDebugValue() {} + function updateCallback(callback, deps) { + var hook = updateWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + var prevState = hook.memoizedState; + if (null !== deps && areHookInputsEqual(deps, prevState[1])) return prevState[0]; + hook.memoizedState = [callback, deps]; + return callback; + } + function updateMemo(nextCreate, deps) { + var hook = updateWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + var prevState = hook.memoizedState; + if (null !== deps && areHookInputsEqual(deps, prevState[1])) return prevState[0]; + prevState = nextCreate(); + if (shouldDoubleInvokeUserFnsInHooksDEV) { + setIsStrictModeForDevtools(!0); + try { + nextCreate(); + } finally { + setIsStrictModeForDevtools(!1); + } + } + hook.memoizedState = [prevState, deps]; + return prevState; + } + function mountDeferredValueImpl(hook, value, initialValue) { + if (void 0 === initialValue || 0 !== (renderLanes & 1073741824) && 0 === (workInProgressRootRenderLanes & 261930)) return hook.memoizedState = value; + hook.memoizedState = initialValue; + hook = requestDeferredLane(); + currentlyRenderingFiber.lanes |= hook; + workInProgressRootSkippedLanes |= hook; + return initialValue; + } + function updateDeferredValueImpl(hook, prevValue, value, initialValue) { + if (objectIs(value, prevValue)) return value; + if (null !== currentTreeHiddenStackCursor.current) return hook = mountDeferredValueImpl(hook, value, initialValue), objectIs(hook, prevValue) || (didReceiveUpdate = !0), hook; + if (0 === (renderLanes & 42) || 0 !== (renderLanes & 1073741824) && 0 === (workInProgressRootRenderLanes & 261930)) return didReceiveUpdate = !0, hook.memoizedState = value; + hook = requestDeferredLane(); + currentlyRenderingFiber.lanes |= hook; + workInProgressRootSkippedLanes |= hook; + return prevValue; + } + function startTransition(fiber, queue, pendingState, finishedState, callback) { + var previousPriority = ReactDOMSharedInternals.p; + ReactDOMSharedInternals.p = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; + var prevTransition = ReactSharedInternals.T, currentTransition = {}; + ReactSharedInternals.T = currentTransition; + dispatchOptimisticSetState(fiber, !1, queue, pendingState); + try { + var returnValue = callback(), onStartTransitionFinish = ReactSharedInternals.S; + null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue); + if (null !== returnValue && "object" === typeof returnValue && "function" === typeof returnValue.then) dispatchSetStateInternal(fiber, queue, chainThenableValue(returnValue, finishedState), requestUpdateLane(fiber)); + else dispatchSetStateInternal(fiber, queue, finishedState, requestUpdateLane(fiber)); + } catch (error) { + dispatchSetStateInternal(fiber, queue, { + then: function() {}, + status: "rejected", + reason: error + }, requestUpdateLane()); + } finally { + ReactDOMSharedInternals.p = previousPriority, null !== prevTransition && null !== currentTransition.types && (prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition; + } + } + function noop() {} + function startHostTransition(formFiber, pendingState, action, formData) { + if (5 !== formFiber.tag) throw Error(formatProdErrorMessage(476)); + var queue = ensureFormComponentIsStateful(formFiber).queue; + startTransition(formFiber, queue, pendingState, sharedNotPendingObject, null === action ? noop : function() { + requestFormReset$1(formFiber); + return action(formData); + }); + } + function ensureFormComponentIsStateful(formFiber) { + var existingStateHook = formFiber.memoizedState; + if (null !== existingStateHook) return existingStateHook; + existingStateHook = { + memoizedState: sharedNotPendingObject, + baseState: sharedNotPendingObject, + baseQueue: null, + queue: { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: sharedNotPendingObject + }, + next: null + }; + var initialResetState = {}; + existingStateHook.next = { + memoizedState: initialResetState, + baseState: initialResetState, + baseQueue: null, + queue: { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialResetState + }, + next: null + }; + formFiber.memoizedState = existingStateHook; + formFiber = formFiber.alternate; + null !== formFiber && (formFiber.memoizedState = existingStateHook); + return existingStateHook; + } + function requestFormReset$1(formFiber) { + var stateHook = ensureFormComponentIsStateful(formFiber); + null === stateHook.next && (stateHook = formFiber.alternate.memoizedState); + dispatchSetStateInternal(formFiber, stateHook.next.queue, {}, requestUpdateLane()); + } + function useHostTransitionStatus() { + return readContext(HostTransitionContext); + } + function updateId() { + return updateWorkInProgressHook().memoizedState; + } + function updateRefresh() { + return updateWorkInProgressHook().memoizedState; + } + function refreshCache(fiber) { + for (var provider = fiber.return; null !== provider;) { + switch (provider.tag) { + case 24: + case 3: + var lane = requestUpdateLane(); + fiber = createUpdate(lane); + var root$69 = enqueueUpdate(provider, fiber, lane); + null !== root$69 && (scheduleUpdateOnFiber(root$69, provider, lane), entangleTransitions(root$69, provider, lane)); + provider = { cache: createCache() }; + fiber.payload = provider; + return; + } + provider = provider.return; + } + } + function dispatchReducerAction(fiber, queue, action) { + var lane = requestUpdateLane(); + action = { + lane, + revertLane: 0, + gesture: null, + action, + hasEagerState: !1, + eagerState: null, + next: null + }; + isRenderPhaseUpdate(fiber) ? enqueueRenderPhaseUpdate(queue, action) : (action = enqueueConcurrentHookUpdate(fiber, queue, action, lane), null !== action && (scheduleUpdateOnFiber(action, fiber, lane), entangleTransitionUpdate(action, queue, lane))); + } + function dispatchSetState(fiber, queue, action) { + dispatchSetStateInternal(fiber, queue, action, requestUpdateLane()); + } + function dispatchSetStateInternal(fiber, queue, action, lane) { + var update = { + lane, + revertLane: 0, + gesture: null, + action, + hasEagerState: !1, + eagerState: null, + next: null + }; + if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, update); + else { + var alternate = fiber.alternate; + if (0 === fiber.lanes && (null === alternate || 0 === alternate.lanes) && (alternate = queue.lastRenderedReducer, null !== alternate)) try { + var currentState = queue.lastRenderedState, eagerState = alternate(currentState, action); + update.hasEagerState = !0; + update.eagerState = eagerState; + if (objectIs(eagerState, currentState)) return enqueueUpdate$1(fiber, queue, update, 0), null === workInProgressRoot && finishQueueingConcurrentUpdates(), !1; + } catch (error) {} + action = enqueueConcurrentHookUpdate(fiber, queue, update, lane); + if (null !== action) return scheduleUpdateOnFiber(action, fiber, lane), entangleTransitionUpdate(action, queue, lane), !0; + } + return !1; + } + function dispatchOptimisticSetState(fiber, throwIfDuringRender, queue, action) { + action = { + lane: 2, + revertLane: requestTransitionLane(), + gesture: null, + action, + hasEagerState: !1, + eagerState: null, + next: null + }; + if (isRenderPhaseUpdate(fiber)) { + if (throwIfDuringRender) throw Error(formatProdErrorMessage(479)); + } else throwIfDuringRender = enqueueConcurrentHookUpdate(fiber, queue, action, 2), null !== throwIfDuringRender && scheduleUpdateOnFiber(throwIfDuringRender, fiber, 2); + } + function isRenderPhaseUpdate(fiber) { + var alternate = fiber.alternate; + return fiber === currentlyRenderingFiber || null !== alternate && alternate === currentlyRenderingFiber; + } + function enqueueRenderPhaseUpdate(queue, update) { + didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = !0; + var pending = queue.pending; + null === pending ? update.next = update : (update.next = pending.next, pending.next = update); + queue.pending = update; + } + function entangleTransitionUpdate(root, queue, lane) { + if (0 !== (lane & 4194048)) { + var queueLanes = queue.lanes; + queueLanes &= root.pendingLanes; + lane |= queueLanes; + queue.lanes = lane; + markRootEntangled(root, lane); + } + } + var ContextOnlyDispatcher = { + readContext, + use, + useCallback: throwInvalidHookError, + useContext: throwInvalidHookError, + useEffect: throwInvalidHookError, + useImperativeHandle: throwInvalidHookError, + useLayoutEffect: throwInvalidHookError, + useInsertionEffect: throwInvalidHookError, + useMemo: throwInvalidHookError, + useReducer: throwInvalidHookError, + useRef: throwInvalidHookError, + useState: throwInvalidHookError, + useDebugValue: throwInvalidHookError, + useDeferredValue: throwInvalidHookError, + useTransition: throwInvalidHookError, + useSyncExternalStore: throwInvalidHookError, + useId: throwInvalidHookError, + useHostTransitionStatus: throwInvalidHookError, + useFormState: throwInvalidHookError, + useActionState: throwInvalidHookError, + useOptimistic: throwInvalidHookError, + useMemoCache: throwInvalidHookError, + useCacheRefresh: throwInvalidHookError + }; + ContextOnlyDispatcher.useEffectEvent = throwInvalidHookError; + var HooksDispatcherOnMount = { + readContext, + use, + useCallback: function(callback, deps) { + mountWorkInProgressHook().memoizedState = [callback, void 0 === deps ? null : deps]; + return callback; + }, + useContext: readContext, + useEffect: mountEffect, + useImperativeHandle: function(ref, create, deps) { + deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null; + mountEffectImpl(4194308, 4, imperativeHandleEffect.bind(null, create, ref), deps); + }, + useLayoutEffect: function(create, deps) { + return mountEffectImpl(4194308, 4, create, deps); + }, + useInsertionEffect: function(create, deps) { + mountEffectImpl(4, 2, create, deps); + }, + useMemo: function(nextCreate, deps) { + var hook = mountWorkInProgressHook(); + deps = void 0 === deps ? null : deps; + var nextValue = nextCreate(); + if (shouldDoubleInvokeUserFnsInHooksDEV) { + setIsStrictModeForDevtools(!0); + try { + nextCreate(); + } finally { + setIsStrictModeForDevtools(!1); + } + } + hook.memoizedState = [nextValue, deps]; + return nextValue; + }, + useReducer: function(reducer, initialArg, init) { + var hook = mountWorkInProgressHook(); + if (void 0 !== init) { + var initialState = init(initialArg); + if (shouldDoubleInvokeUserFnsInHooksDEV) { + setIsStrictModeForDevtools(!0); + try { + init(initialArg); + } finally { + setIsStrictModeForDevtools(!1); + } + } + } else initialState = initialArg; + hook.memoizedState = hook.baseState = initialState; + reducer = { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: reducer, + lastRenderedState: initialState + }; + hook.queue = reducer; + reducer = reducer.dispatch = dispatchReducerAction.bind(null, currentlyRenderingFiber, reducer); + return [hook.memoizedState, reducer]; + }, + useRef: function(initialValue) { + var hook = mountWorkInProgressHook(); + initialValue = { current: initialValue }; + return hook.memoizedState = initialValue; + }, + useState: function(initialState) { + initialState = mountStateImpl(initialState); + var queue = initialState.queue, dispatch = dispatchSetState.bind(null, currentlyRenderingFiber, queue); + queue.dispatch = dispatch; + return [initialState.memoizedState, dispatch]; + }, + useDebugValue: mountDebugValue, + useDeferredValue: function(value, initialValue) { + return mountDeferredValueImpl(mountWorkInProgressHook(), value, initialValue); + }, + useTransition: function() { + var stateHook = mountStateImpl(!1); + stateHook = startTransition.bind(null, currentlyRenderingFiber, stateHook.queue, !0, !1); + mountWorkInProgressHook().memoizedState = stateHook; + return [!1, stateHook]; + }, + useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) { + var fiber = currentlyRenderingFiber, hook = mountWorkInProgressHook(); + if (isHydrating) { + if (void 0 === getServerSnapshot) throw Error(formatProdErrorMessage(407)); + getServerSnapshot = getServerSnapshot(); + } else { + getServerSnapshot = getSnapshot(); + if (null === workInProgressRoot) throw Error(formatProdErrorMessage(349)); + 0 !== (workInProgressRootRenderLanes & 127) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); + } + hook.memoizedState = getServerSnapshot; + var inst = { + value: getServerSnapshot, + getSnapshot + }; + hook.queue = inst; + mountEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [subscribe]); + fiber.flags |= 2048; + pushSimpleEffect(9, { destroy: void 0 }, updateStoreInstance.bind(null, fiber, inst, getServerSnapshot, getSnapshot), null); + return getServerSnapshot; + }, + useId: function() { + var hook = mountWorkInProgressHook(), identifierPrefix = workInProgressRoot.identifierPrefix; + if (isHydrating) { + var JSCompiler_inline_result = treeContextOverflow; + var idWithLeadingBit = treeContextId; + JSCompiler_inline_result = (idWithLeadingBit & ~(1 << 32 - clz32(idWithLeadingBit) - 1)).toString(32) + JSCompiler_inline_result; + identifierPrefix = "_" + identifierPrefix + "R_" + JSCompiler_inline_result; + JSCompiler_inline_result = localIdCounter++; + 0 < JSCompiler_inline_result && (identifierPrefix += "H" + JSCompiler_inline_result.toString(32)); + identifierPrefix += "_"; + } else JSCompiler_inline_result = globalClientIdCounter++, identifierPrefix = "_" + identifierPrefix + "r_" + JSCompiler_inline_result.toString(32) + "_"; + return hook.memoizedState = identifierPrefix; + }, + useHostTransitionStatus, + useFormState: mountActionState, + useActionState: mountActionState, + useOptimistic: function(passthrough) { + var hook = mountWorkInProgressHook(); + hook.memoizedState = hook.baseState = passthrough; + var queue = { + pending: null, + lanes: 0, + dispatch: null, + lastRenderedReducer: null, + lastRenderedState: null + }; + hook.queue = queue; + hook = dispatchOptimisticSetState.bind(null, currentlyRenderingFiber, !0, queue); + queue.dispatch = hook; + return [passthrough, hook]; + }, + useMemoCache, + useCacheRefresh: function() { + return mountWorkInProgressHook().memoizedState = refreshCache.bind(null, currentlyRenderingFiber); + }, + useEffectEvent: function(callback) { + var hook = mountWorkInProgressHook(), ref = { impl: callback }; + hook.memoizedState = ref; + return function() { + if (0 !== (executionContext & 2)) throw Error(formatProdErrorMessage(440)); + return ref.impl.apply(void 0, arguments); + }; + } + }; + var HooksDispatcherOnUpdate = { + readContext, + use, + useCallback: updateCallback, + useContext: readContext, + useEffect: updateEffect, + useImperativeHandle: updateImperativeHandle, + useInsertionEffect: updateInsertionEffect, + useLayoutEffect: updateLayoutEffect, + useMemo: updateMemo, + useReducer: updateReducer, + useRef: updateRef, + useState: function() { + return updateReducer(basicStateReducer); + }, + useDebugValue: mountDebugValue, + useDeferredValue: function(value, initialValue) { + return updateDeferredValueImpl(updateWorkInProgressHook(), currentHook.memoizedState, value, initialValue); + }, + useTransition: function() { + var booleanOrThenable = updateReducer(basicStateReducer)[0], start = updateWorkInProgressHook().memoizedState; + return ["boolean" === typeof booleanOrThenable ? booleanOrThenable : useThenable(booleanOrThenable), start]; + }, + useSyncExternalStore: updateSyncExternalStore, + useId: updateId, + useHostTransitionStatus, + useFormState: updateActionState, + useActionState: updateActionState, + useOptimistic: function(passthrough, reducer) { + return updateOptimisticImpl(updateWorkInProgressHook(), currentHook, passthrough, reducer); + }, + useMemoCache, + useCacheRefresh: updateRefresh + }; + HooksDispatcherOnUpdate.useEffectEvent = updateEvent; + var HooksDispatcherOnRerender = { + readContext, + use, + useCallback: updateCallback, + useContext: readContext, + useEffect: updateEffect, + useImperativeHandle: updateImperativeHandle, + useInsertionEffect: updateInsertionEffect, + useLayoutEffect: updateLayoutEffect, + useMemo: updateMemo, + useReducer: rerenderReducer, + useRef: updateRef, + useState: function() { + return rerenderReducer(basicStateReducer); + }, + useDebugValue: mountDebugValue, + useDeferredValue: function(value, initialValue) { + var hook = updateWorkInProgressHook(); + return null === currentHook ? mountDeferredValueImpl(hook, value, initialValue) : updateDeferredValueImpl(hook, currentHook.memoizedState, value, initialValue); + }, + useTransition: function() { + var booleanOrThenable = rerenderReducer(basicStateReducer)[0], start = updateWorkInProgressHook().memoizedState; + return ["boolean" === typeof booleanOrThenable ? booleanOrThenable : useThenable(booleanOrThenable), start]; + }, + useSyncExternalStore: updateSyncExternalStore, + useId: updateId, + useHostTransitionStatus, + useFormState: rerenderActionState, + useActionState: rerenderActionState, + useOptimistic: function(passthrough, reducer) { + var hook = updateWorkInProgressHook(); + if (null !== currentHook) return updateOptimisticImpl(hook, currentHook, passthrough, reducer); + hook.baseState = passthrough; + return [passthrough, hook.queue.dispatch]; + }, + useMemoCache, + useCacheRefresh: updateRefresh + }; + HooksDispatcherOnRerender.useEffectEvent = updateEvent; + function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) { + ctor = workInProgress.memoizedState; + getDerivedStateFromProps = getDerivedStateFromProps(nextProps, ctor); + getDerivedStateFromProps = null === getDerivedStateFromProps || void 0 === getDerivedStateFromProps ? ctor : assign({}, ctor, getDerivedStateFromProps); + workInProgress.memoizedState = getDerivedStateFromProps; + 0 === workInProgress.lanes && (workInProgress.updateQueue.baseState = getDerivedStateFromProps); + } + var classComponentUpdater = { + enqueueSetState: function(inst, payload, callback) { + inst = inst._reactInternals; + var lane = requestUpdateLane(), update = createUpdate(lane); + update.payload = payload; + void 0 !== callback && null !== callback && (update.callback = callback); + payload = enqueueUpdate(inst, update, lane); + null !== payload && (scheduleUpdateOnFiber(payload, inst, lane), entangleTransitions(payload, inst, lane)); + }, + enqueueReplaceState: function(inst, payload, callback) { + inst = inst._reactInternals; + var lane = requestUpdateLane(), update = createUpdate(lane); + update.tag = 1; + update.payload = payload; + void 0 !== callback && null !== callback && (update.callback = callback); + payload = enqueueUpdate(inst, update, lane); + null !== payload && (scheduleUpdateOnFiber(payload, inst, lane), entangleTransitions(payload, inst, lane)); + }, + enqueueForceUpdate: function(inst, callback) { + inst = inst._reactInternals; + var lane = requestUpdateLane(), update = createUpdate(lane); + update.tag = 2; + void 0 !== callback && null !== callback && (update.callback = callback); + callback = enqueueUpdate(inst, update, lane); + null !== callback && (scheduleUpdateOnFiber(callback, inst, lane), entangleTransitions(callback, inst, lane)); + } + }; + function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) { + workInProgress = workInProgress.stateNode; + return "function" === typeof workInProgress.shouldComponentUpdate ? workInProgress.shouldComponentUpdate(newProps, newState, nextContext) : ctor.prototype && ctor.prototype.isPureReactComponent ? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState) : !0; + } + function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) { + workInProgress = instance.state; + "function" === typeof instance.componentWillReceiveProps && instance.componentWillReceiveProps(newProps, nextContext); + "function" === typeof instance.UNSAFE_componentWillReceiveProps && instance.UNSAFE_componentWillReceiveProps(newProps, nextContext); + instance.state !== workInProgress && classComponentUpdater.enqueueReplaceState(instance, instance.state, null); + } + function resolveClassComponentProps(Component, baseProps) { + var newProps = baseProps; + if ("ref" in baseProps) { + newProps = {}; + for (var propName in baseProps) "ref" !== propName && (newProps[propName] = baseProps[propName]); + } + if (Component = Component.defaultProps) { + newProps === baseProps && (newProps = assign({}, newProps)); + for (var propName$73 in Component) void 0 === newProps[propName$73] && (newProps[propName$73] = Component[propName$73]); + } + return newProps; + } + function defaultOnUncaughtError(error) { + reportGlobalError(error); + } + function defaultOnCaughtError(error) { + console.error(error); + } + function defaultOnRecoverableError(error) { + reportGlobalError(error); + } + function logUncaughtError(root, errorInfo) { + try { + var onUncaughtError = root.onUncaughtError; + onUncaughtError(errorInfo.value, { componentStack: errorInfo.stack }); + } catch (e$74) { + setTimeout(function() { + throw e$74; + }); + } + } + function logCaughtError(root, boundary, errorInfo) { + try { + var onCaughtError = root.onCaughtError; + onCaughtError(errorInfo.value, { + componentStack: errorInfo.stack, + errorBoundary: 1 === boundary.tag ? boundary.stateNode : null + }); + } catch (e$75) { + setTimeout(function() { + throw e$75; + }); + } + } + function createRootErrorUpdate(root, errorInfo, lane) { + lane = createUpdate(lane); + lane.tag = 3; + lane.payload = { element: null }; + lane.callback = function() { + logUncaughtError(root, errorInfo); + }; + return lane; + } + function createClassErrorUpdate(lane) { + lane = createUpdate(lane); + lane.tag = 3; + return lane; + } + function initializeClassErrorUpdate(update, root, fiber, errorInfo) { + var getDerivedStateFromError = fiber.type.getDerivedStateFromError; + if ("function" === typeof getDerivedStateFromError) { + var error = errorInfo.value; + update.payload = function() { + return getDerivedStateFromError(error); + }; + update.callback = function() { + logCaughtError(root, fiber, errorInfo); + }; + } + var inst = fiber.stateNode; + null !== inst && "function" === typeof inst.componentDidCatch && (update.callback = function() { + logCaughtError(root, fiber, errorInfo); + "function" !== typeof getDerivedStateFromError && (null === legacyErrorBoundariesThatAlreadyFailed ? legacyErrorBoundariesThatAlreadyFailed = /* @__PURE__ */ new Set([this]) : legacyErrorBoundariesThatAlreadyFailed.add(this)); + var stack = errorInfo.stack; + this.componentDidCatch(errorInfo.value, { componentStack: null !== stack ? stack : "" }); + }); + } + function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes) { + sourceFiber.flags |= 32768; + if (null !== value && "object" === typeof value && "function" === typeof value.then) { + returnFiber = sourceFiber.alternate; + null !== returnFiber && propagateParentContextChanges(returnFiber, sourceFiber, rootRenderLanes, !0); + sourceFiber = suspenseHandlerStackCursor.current; + if (null !== sourceFiber) { + switch (sourceFiber.tag) { + case 31: + case 13: return null === shellBoundary ? renderDidSuspendDelayIfPossible() : null === sourceFiber.alternate && 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 3), sourceFiber.flags &= -257, sourceFiber.flags |= 65536, sourceFiber.lanes = rootRenderLanes, value === noopSuspenseyCommitThenable ? sourceFiber.flags |= 16384 : (returnFiber = sourceFiber.updateQueue, null === returnFiber ? sourceFiber.updateQueue = /* @__PURE__ */ new Set([value]) : returnFiber.add(value), attachPingListener(root, value, rootRenderLanes)), !1; + case 22: return sourceFiber.flags |= 65536, value === noopSuspenseyCommitThenable ? sourceFiber.flags |= 16384 : (returnFiber = sourceFiber.updateQueue, null === returnFiber ? (returnFiber = { + transitions: null, + markerInstances: null, + retryQueue: /* @__PURE__ */ new Set([value]) + }, sourceFiber.updateQueue = returnFiber) : (sourceFiber = returnFiber.retryQueue, null === sourceFiber ? returnFiber.retryQueue = /* @__PURE__ */ new Set([value]) : sourceFiber.add(value)), attachPingListener(root, value, rootRenderLanes)), !1; + } + throw Error(formatProdErrorMessage(435, sourceFiber.tag)); + } + attachPingListener(root, value, rootRenderLanes); + renderDidSuspendDelayIfPossible(); + return !1; + } + if (isHydrating) return returnFiber = suspenseHandlerStackCursor.current, null !== returnFiber ? (0 === (returnFiber.flags & 65536) && (returnFiber.flags |= 256), returnFiber.flags |= 65536, returnFiber.lanes = rootRenderLanes, value !== HydrationMismatchException && (root = Error(formatProdErrorMessage(422), { cause: value }), queueHydrationError(createCapturedValueAtFiber(root, sourceFiber)))) : (value !== HydrationMismatchException && (returnFiber = Error(formatProdErrorMessage(423), { cause: value }), queueHydrationError(createCapturedValueAtFiber(returnFiber, sourceFiber))), root = root.current.alternate, root.flags |= 65536, rootRenderLanes &= -rootRenderLanes, root.lanes |= rootRenderLanes, value = createCapturedValueAtFiber(value, sourceFiber), rootRenderLanes = createRootErrorUpdate(root.stateNode, value, rootRenderLanes), enqueueCapturedUpdate(root, rootRenderLanes), 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2)), !1; + var wrapperError = Error(formatProdErrorMessage(520), { cause: value }); + wrapperError = createCapturedValueAtFiber(wrapperError, sourceFiber); + null === workInProgressRootConcurrentErrors ? workInProgressRootConcurrentErrors = [wrapperError] : workInProgressRootConcurrentErrors.push(wrapperError); + 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2); + if (null === returnFiber) return !0; + value = createCapturedValueAtFiber(value, sourceFiber); + sourceFiber = returnFiber; + do { + switch (sourceFiber.tag) { + case 3: return sourceFiber.flags |= 65536, root = rootRenderLanes & -rootRenderLanes, sourceFiber.lanes |= root, root = createRootErrorUpdate(sourceFiber.stateNode, value, root), enqueueCapturedUpdate(sourceFiber, root), !1; + case 1: if (returnFiber = sourceFiber.type, wrapperError = sourceFiber.stateNode, 0 === (sourceFiber.flags & 128) && ("function" === typeof returnFiber.getDerivedStateFromError || null !== wrapperError && "function" === typeof wrapperError.componentDidCatch && (null === legacyErrorBoundariesThatAlreadyFailed || !legacyErrorBoundariesThatAlreadyFailed.has(wrapperError)))) return sourceFiber.flags |= 65536, rootRenderLanes &= -rootRenderLanes, sourceFiber.lanes |= rootRenderLanes, rootRenderLanes = createClassErrorUpdate(rootRenderLanes), initializeClassErrorUpdate(rootRenderLanes, root, sourceFiber, value), enqueueCapturedUpdate(sourceFiber, rootRenderLanes), !1; + } + sourceFiber = sourceFiber.return; + } while (null !== sourceFiber); + return !1; + } + var SelectiveHydrationException = Error(formatProdErrorMessage(461)); + var didReceiveUpdate = !1; + function reconcileChildren(current, workInProgress, nextChildren, renderLanes) { + workInProgress.child = null === current ? mountChildFibers(workInProgress, null, nextChildren, renderLanes) : reconcileChildFibers(workInProgress, current.child, nextChildren, renderLanes); + } + function updateForwardRef(current, workInProgress, Component, nextProps, renderLanes) { + Component = Component.render; + var ref = workInProgress.ref; + if ("ref" in nextProps) { + var propsWithoutRef = {}; + for (var key in nextProps) "ref" !== key && (propsWithoutRef[key] = nextProps[key]); + } else propsWithoutRef = nextProps; + prepareToReadContext(workInProgress); + nextProps = renderWithHooks(current, workInProgress, Component, propsWithoutRef, ref, renderLanes); + key = checkDidRenderIdHook(); + if (null !== current && !didReceiveUpdate) return bailoutHooks(current, workInProgress, renderLanes), bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + isHydrating && key && pushMaterializedTreeId(workInProgress); + workInProgress.flags |= 1; + reconcileChildren(current, workInProgress, nextProps, renderLanes); + return workInProgress.child; + } + function updateMemoComponent(current, workInProgress, Component, nextProps, renderLanes) { + if (null === current) { + var type = Component.type; + if ("function" === typeof type && !shouldConstruct(type) && void 0 === type.defaultProps && null === Component.compare) return workInProgress.tag = 15, workInProgress.type = type, updateSimpleMemoComponent(current, workInProgress, type, nextProps, renderLanes); + current = createFiberFromTypeAndProps(Component.type, null, nextProps, workInProgress, workInProgress.mode, renderLanes); + current.ref = workInProgress.ref; + current.return = workInProgress; + return workInProgress.child = current; + } + type = current.child; + if (!checkScheduledUpdateOrContext(current, renderLanes)) { + var prevProps = type.memoizedProps; + Component = Component.compare; + Component = null !== Component ? Component : shallowEqual; + if (Component(prevProps, nextProps) && current.ref === workInProgress.ref) return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + } + workInProgress.flags |= 1; + current = createWorkInProgress(type, nextProps); + current.ref = workInProgress.ref; + current.return = workInProgress; + return workInProgress.child = current; + } + function updateSimpleMemoComponent(current, workInProgress, Component, nextProps, renderLanes) { + if (null !== current) { + var prevProps = current.memoizedProps; + if (shallowEqual(prevProps, nextProps) && current.ref === workInProgress.ref) if (didReceiveUpdate = !1, workInProgress.pendingProps = nextProps = prevProps, checkScheduledUpdateOrContext(current, renderLanes)) 0 !== (current.flags & 131072) && (didReceiveUpdate = !0); + else return workInProgress.lanes = current.lanes, bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + } + return updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes); + } + function updateOffscreenComponent(current, workInProgress, renderLanes, nextProps) { + var nextChildren = nextProps.children, prevState = null !== current ? current.memoizedState : null; + null === current && null === workInProgress.stateNode && (workInProgress.stateNode = { + _visibility: 1, + _pendingMarkers: null, + _retryCache: null, + _transitions: null + }); + if ("hidden" === nextProps.mode) { + if (0 !== (workInProgress.flags & 128)) { + prevState = null !== prevState ? prevState.baseLanes | renderLanes : renderLanes; + if (null !== current) { + nextProps = workInProgress.child = current.child; + for (nextChildren = 0; null !== nextProps;) nextChildren = nextChildren | nextProps.lanes | nextProps.childLanes, nextProps = nextProps.sibling; + nextProps = nextChildren & ~prevState; + } else nextProps = 0, workInProgress.child = null; + return deferHiddenOffscreenComponent(current, workInProgress, prevState, renderLanes, nextProps); + } + if (0 !== (renderLanes & 536870912)) workInProgress.memoizedState = { + baseLanes: 0, + cachePool: null + }, null !== current && pushTransition(workInProgress, null !== prevState ? prevState.cachePool : null), null !== prevState ? pushHiddenContext(workInProgress, prevState) : reuseHiddenContextOnStack(), pushOffscreenSuspenseHandler(workInProgress); + else return nextProps = workInProgress.lanes = 536870912, deferHiddenOffscreenComponent(current, workInProgress, null !== prevState ? prevState.baseLanes | renderLanes : renderLanes, renderLanes, nextProps); + } else null !== prevState ? (pushTransition(workInProgress, prevState.cachePool), pushHiddenContext(workInProgress, prevState), reuseSuspenseHandlerOnStack(workInProgress), workInProgress.memoizedState = null) : (null !== current && pushTransition(workInProgress, null), reuseHiddenContextOnStack(), reuseSuspenseHandlerOnStack(workInProgress)); + reconcileChildren(current, workInProgress, nextChildren, renderLanes); + return workInProgress.child; + } + function bailoutOffscreenComponent(current, workInProgress) { + null !== current && 22 === current.tag || null !== workInProgress.stateNode || (workInProgress.stateNode = { + _visibility: 1, + _pendingMarkers: null, + _retryCache: null, + _transitions: null + }); + return workInProgress.sibling; + } + function deferHiddenOffscreenComponent(current, workInProgress, nextBaseLanes, renderLanes, remainingChildLanes) { + var JSCompiler_inline_result = peekCacheFromPool(); + JSCompiler_inline_result = null === JSCompiler_inline_result ? null : { + parent: CacheContext._currentValue, + pool: JSCompiler_inline_result + }; + workInProgress.memoizedState = { + baseLanes: nextBaseLanes, + cachePool: JSCompiler_inline_result + }; + null !== current && pushTransition(workInProgress, null); + reuseHiddenContextOnStack(); + pushOffscreenSuspenseHandler(workInProgress); + null !== current && propagateParentContextChanges(current, workInProgress, renderLanes, !0); + workInProgress.childLanes = remainingChildLanes; + return null; + } + function mountActivityChildren(workInProgress, nextProps) { + nextProps = mountWorkInProgressOffscreenFiber({ + mode: nextProps.mode, + children: nextProps.children + }, workInProgress.mode); + nextProps.ref = workInProgress.ref; + workInProgress.child = nextProps; + nextProps.return = workInProgress; + return nextProps; + } + function retryActivityComponentWithoutHydrating(current, workInProgress, renderLanes) { + reconcileChildFibers(workInProgress, current.child, null, renderLanes); + current = mountActivityChildren(workInProgress, workInProgress.pendingProps); + current.flags |= 2; + popSuspenseHandler(workInProgress); + workInProgress.memoizedState = null; + return current; + } + function updateActivityComponent(current, workInProgress, renderLanes) { + var nextProps = workInProgress.pendingProps, didSuspend = 0 !== (workInProgress.flags & 128); + workInProgress.flags &= -129; + if (null === current) { + if (isHydrating) { + if ("hidden" === nextProps.mode) return current = mountActivityChildren(workInProgress, nextProps), workInProgress.lanes = 536870912, bailoutOffscreenComponent(null, current); + pushDehydratedActivitySuspenseHandler(workInProgress); + (current = nextHydratableInstance) ? (current = canHydrateHydrationBoundary(current, rootOrSingletonContext), current = null !== current && "&" === current.data ? current : null, null !== current && (workInProgress.memoizedState = { + dehydrated: current, + treeContext: null !== treeContextProvider ? { + id: treeContextId, + overflow: treeContextOverflow + } : null, + retryLane: 536870912, + hydrationErrors: null + }, renderLanes = createFiberFromDehydratedFragment(current), renderLanes.return = workInProgress, workInProgress.child = renderLanes, hydrationParentFiber = workInProgress, nextHydratableInstance = null)) : current = null; + if (null === current) throw throwOnHydrationMismatch(workInProgress); + workInProgress.lanes = 536870912; + return null; + } + return mountActivityChildren(workInProgress, nextProps); + } + var prevState = current.memoizedState; + if (null !== prevState) { + var dehydrated = prevState.dehydrated; + pushDehydratedActivitySuspenseHandler(workInProgress); + if (didSuspend) if (workInProgress.flags & 256) workInProgress.flags &= -257, workInProgress = retryActivityComponentWithoutHydrating(current, workInProgress, renderLanes); + else if (null !== workInProgress.memoizedState) workInProgress.child = current.child, workInProgress.flags |= 128, workInProgress = null; + else throw Error(formatProdErrorMessage(558)); + else if (didReceiveUpdate || propagateParentContextChanges(current, workInProgress, renderLanes, !1), didSuspend = 0 !== (renderLanes & current.childLanes), didReceiveUpdate || didSuspend) { + nextProps = workInProgressRoot; + if (null !== nextProps && (dehydrated = getBumpedLaneForHydration(nextProps, renderLanes), 0 !== dehydrated && dehydrated !== prevState.retryLane)) throw prevState.retryLane = dehydrated, enqueueConcurrentRenderForLane(current, dehydrated), scheduleUpdateOnFiber(nextProps, current, dehydrated), SelectiveHydrationException; + renderDidSuspendDelayIfPossible(); + workInProgress = retryActivityComponentWithoutHydrating(current, workInProgress, renderLanes); + } else current = prevState.treeContext, nextHydratableInstance = getNextHydratable(dehydrated.nextSibling), hydrationParentFiber = workInProgress, isHydrating = !0, hydrationErrors = null, rootOrSingletonContext = !1, null !== current && restoreSuspendedTreeContext(workInProgress, current), workInProgress = mountActivityChildren(workInProgress, nextProps), workInProgress.flags |= 4096; + return workInProgress; + } + current = createWorkInProgress(current.child, { + mode: nextProps.mode, + children: nextProps.children + }); + current.ref = workInProgress.ref; + workInProgress.child = current; + current.return = workInProgress; + return current; + } + function markRef(current, workInProgress) { + var ref = workInProgress.ref; + if (null === ref) null !== current && null !== current.ref && (workInProgress.flags |= 4194816); + else { + if ("function" !== typeof ref && "object" !== typeof ref) throw Error(formatProdErrorMessage(284)); + if (null === current || current.ref !== ref) workInProgress.flags |= 4194816; + } + } + function updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes) { + prepareToReadContext(workInProgress); + Component = renderWithHooks(current, workInProgress, Component, nextProps, void 0, renderLanes); + nextProps = checkDidRenderIdHook(); + if (null !== current && !didReceiveUpdate) return bailoutHooks(current, workInProgress, renderLanes), bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + isHydrating && nextProps && pushMaterializedTreeId(workInProgress); + workInProgress.flags |= 1; + reconcileChildren(current, workInProgress, Component, renderLanes); + return workInProgress.child; + } + function replayFunctionComponent(current, workInProgress, nextProps, Component, secondArg, renderLanes) { + prepareToReadContext(workInProgress); + workInProgress.updateQueue = null; + nextProps = renderWithHooksAgain(workInProgress, Component, nextProps, secondArg); + finishRenderingHooks(current); + Component = checkDidRenderIdHook(); + if (null !== current && !didReceiveUpdate) return bailoutHooks(current, workInProgress, renderLanes), bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + isHydrating && Component && pushMaterializedTreeId(workInProgress); + workInProgress.flags |= 1; + reconcileChildren(current, workInProgress, nextProps, renderLanes); + return workInProgress.child; + } + function updateClassComponent(current, workInProgress, Component, nextProps, renderLanes) { + prepareToReadContext(workInProgress); + if (null === workInProgress.stateNode) { + var context = emptyContextObject, contextType = Component.contextType; + "object" === typeof contextType && null !== contextType && (context = readContext(contextType)); + context = new Component(nextProps, context); + workInProgress.memoizedState = null !== context.state && void 0 !== context.state ? context.state : null; + context.updater = classComponentUpdater; + workInProgress.stateNode = context; + context._reactInternals = workInProgress; + context = workInProgress.stateNode; + context.props = nextProps; + context.state = workInProgress.memoizedState; + context.refs = {}; + initializeUpdateQueue(workInProgress); + contextType = Component.contextType; + context.context = "object" === typeof contextType && null !== contextType ? readContext(contextType) : emptyContextObject; + context.state = workInProgress.memoizedState; + contextType = Component.getDerivedStateFromProps; + "function" === typeof contextType && (applyDerivedStateFromProps(workInProgress, Component, contextType, nextProps), context.state = workInProgress.memoizedState); + "function" === typeof Component.getDerivedStateFromProps || "function" === typeof context.getSnapshotBeforeUpdate || "function" !== typeof context.UNSAFE_componentWillMount && "function" !== typeof context.componentWillMount || (contextType = context.state, "function" === typeof context.componentWillMount && context.componentWillMount(), "function" === typeof context.UNSAFE_componentWillMount && context.UNSAFE_componentWillMount(), contextType !== context.state && classComponentUpdater.enqueueReplaceState(context, context.state, null), processUpdateQueue(workInProgress, nextProps, context, renderLanes), suspendIfUpdateReadFromEntangledAsyncAction(), context.state = workInProgress.memoizedState); + "function" === typeof context.componentDidMount && (workInProgress.flags |= 4194308); + nextProps = !0; + } else if (null === current) { + context = workInProgress.stateNode; + var unresolvedOldProps = workInProgress.memoizedProps, oldProps = resolveClassComponentProps(Component, unresolvedOldProps); + context.props = oldProps; + var oldContext = context.context, contextType$jscomp$0 = Component.contextType; + contextType = emptyContextObject; + "object" === typeof contextType$jscomp$0 && null !== contextType$jscomp$0 && (contextType = readContext(contextType$jscomp$0)); + var getDerivedStateFromProps = Component.getDerivedStateFromProps; + contextType$jscomp$0 = "function" === typeof getDerivedStateFromProps || "function" === typeof context.getSnapshotBeforeUpdate; + unresolvedOldProps = workInProgress.pendingProps !== unresolvedOldProps; + contextType$jscomp$0 || "function" !== typeof context.UNSAFE_componentWillReceiveProps && "function" !== typeof context.componentWillReceiveProps || (unresolvedOldProps || oldContext !== contextType) && callComponentWillReceiveProps(workInProgress, context, nextProps, contextType); + hasForceUpdate = !1; + var oldState = workInProgress.memoizedState; + context.state = oldState; + processUpdateQueue(workInProgress, nextProps, context, renderLanes); + suspendIfUpdateReadFromEntangledAsyncAction(); + oldContext = workInProgress.memoizedState; + unresolvedOldProps || oldState !== oldContext || hasForceUpdate ? ("function" === typeof getDerivedStateFromProps && (applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, nextProps), oldContext = workInProgress.memoizedState), (oldProps = hasForceUpdate || checkShouldComponentUpdate(workInProgress, Component, oldProps, nextProps, oldState, oldContext, contextType)) ? (contextType$jscomp$0 || "function" !== typeof context.UNSAFE_componentWillMount && "function" !== typeof context.componentWillMount || ("function" === typeof context.componentWillMount && context.componentWillMount(), "function" === typeof context.UNSAFE_componentWillMount && context.UNSAFE_componentWillMount()), "function" === typeof context.componentDidMount && (workInProgress.flags |= 4194308)) : ("function" === typeof context.componentDidMount && (workInProgress.flags |= 4194308), workInProgress.memoizedProps = nextProps, workInProgress.memoizedState = oldContext), context.props = nextProps, context.state = oldContext, context.context = contextType, nextProps = oldProps) : ("function" === typeof context.componentDidMount && (workInProgress.flags |= 4194308), nextProps = !1); + } else { + context = workInProgress.stateNode; + cloneUpdateQueue(current, workInProgress); + contextType = workInProgress.memoizedProps; + contextType$jscomp$0 = resolveClassComponentProps(Component, contextType); + context.props = contextType$jscomp$0; + getDerivedStateFromProps = workInProgress.pendingProps; + oldState = context.context; + oldContext = Component.contextType; + oldProps = emptyContextObject; + "object" === typeof oldContext && null !== oldContext && (oldProps = readContext(oldContext)); + unresolvedOldProps = Component.getDerivedStateFromProps; + (oldContext = "function" === typeof unresolvedOldProps || "function" === typeof context.getSnapshotBeforeUpdate) || "function" !== typeof context.UNSAFE_componentWillReceiveProps && "function" !== typeof context.componentWillReceiveProps || (contextType !== getDerivedStateFromProps || oldState !== oldProps) && callComponentWillReceiveProps(workInProgress, context, nextProps, oldProps); + hasForceUpdate = !1; + oldState = workInProgress.memoizedState; + context.state = oldState; + processUpdateQueue(workInProgress, nextProps, context, renderLanes); + suspendIfUpdateReadFromEntangledAsyncAction(); + var newState = workInProgress.memoizedState; + contextType !== getDerivedStateFromProps || oldState !== newState || hasForceUpdate || null !== current && null !== current.dependencies && checkIfContextChanged(current.dependencies) ? ("function" === typeof unresolvedOldProps && (applyDerivedStateFromProps(workInProgress, Component, unresolvedOldProps, nextProps), newState = workInProgress.memoizedState), (contextType$jscomp$0 = hasForceUpdate || checkShouldComponentUpdate(workInProgress, Component, contextType$jscomp$0, nextProps, oldState, newState, oldProps) || null !== current && null !== current.dependencies && checkIfContextChanged(current.dependencies)) ? (oldContext || "function" !== typeof context.UNSAFE_componentWillUpdate && "function" !== typeof context.componentWillUpdate || ("function" === typeof context.componentWillUpdate && context.componentWillUpdate(nextProps, newState, oldProps), "function" === typeof context.UNSAFE_componentWillUpdate && context.UNSAFE_componentWillUpdate(nextProps, newState, oldProps)), "function" === typeof context.componentDidUpdate && (workInProgress.flags |= 4), "function" === typeof context.getSnapshotBeforeUpdate && (workInProgress.flags |= 1024)) : ("function" !== typeof context.componentDidUpdate || contextType === current.memoizedProps && oldState === current.memoizedState || (workInProgress.flags |= 4), "function" !== typeof context.getSnapshotBeforeUpdate || contextType === current.memoizedProps && oldState === current.memoizedState || (workInProgress.flags |= 1024), workInProgress.memoizedProps = nextProps, workInProgress.memoizedState = newState), context.props = nextProps, context.state = newState, context.context = oldProps, nextProps = contextType$jscomp$0) : ("function" !== typeof context.componentDidUpdate || contextType === current.memoizedProps && oldState === current.memoizedState || (workInProgress.flags |= 4), "function" !== typeof context.getSnapshotBeforeUpdate || contextType === current.memoizedProps && oldState === current.memoizedState || (workInProgress.flags |= 1024), nextProps = !1); + } + context = nextProps; + markRef(current, workInProgress); + nextProps = 0 !== (workInProgress.flags & 128); + context || nextProps ? (context = workInProgress.stateNode, Component = nextProps && "function" !== typeof Component.getDerivedStateFromError ? null : context.render(), workInProgress.flags |= 1, null !== current && nextProps ? (workInProgress.child = reconcileChildFibers(workInProgress, current.child, null, renderLanes), workInProgress.child = reconcileChildFibers(workInProgress, null, Component, renderLanes)) : reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.memoizedState = context.state, current = workInProgress.child) : current = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + return current; + } + function mountHostRootWithoutHydrating(current, workInProgress, nextChildren, renderLanes) { + resetHydrationState(); + workInProgress.flags |= 256; + reconcileChildren(current, workInProgress, nextChildren, renderLanes); + return workInProgress.child; + } + var SUSPENDED_MARKER = { + dehydrated: null, + treeContext: null, + retryLane: 0, + hydrationErrors: null + }; + function mountSuspenseOffscreenState(renderLanes) { + return { + baseLanes: renderLanes, + cachePool: getSuspendedCache() + }; + } + function getRemainingWorkInPrimaryTree(current, primaryTreeDidDefer, renderLanes) { + current = null !== current ? current.childLanes & ~renderLanes : 0; + primaryTreeDidDefer && (current |= workInProgressDeferredLane); + return current; + } + function updateSuspenseComponent(current, workInProgress, renderLanes) { + var nextProps = workInProgress.pendingProps, showFallback = !1, didSuspend = 0 !== (workInProgress.flags & 128), JSCompiler_temp; + (JSCompiler_temp = didSuspend) || (JSCompiler_temp = null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseStackCursor.current & 2)); + JSCompiler_temp && (showFallback = !0, workInProgress.flags &= -129); + JSCompiler_temp = 0 !== (workInProgress.flags & 32); + workInProgress.flags &= -33; + if (null === current) { + if (isHydrating) { + showFallback ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); + (current = nextHydratableInstance) ? (current = canHydrateHydrationBoundary(current, rootOrSingletonContext), current = null !== current && "&" !== current.data ? current : null, null !== current && (workInProgress.memoizedState = { + dehydrated: current, + treeContext: null !== treeContextProvider ? { + id: treeContextId, + overflow: treeContextOverflow + } : null, + retryLane: 536870912, + hydrationErrors: null + }, renderLanes = createFiberFromDehydratedFragment(current), renderLanes.return = workInProgress, workInProgress.child = renderLanes, hydrationParentFiber = workInProgress, nextHydratableInstance = null)) : current = null; + if (null === current) throw throwOnHydrationMismatch(workInProgress); + isSuspenseInstanceFallback(current) ? workInProgress.lanes = 32 : workInProgress.lanes = 536870912; + return null; + } + var nextPrimaryChildren = nextProps.children; + nextProps = nextProps.fallback; + if (showFallback) return reuseSuspenseHandlerOnStack(workInProgress), showFallback = workInProgress.mode, nextPrimaryChildren = mountWorkInProgressOffscreenFiber({ + mode: "hidden", + children: nextPrimaryChildren + }, showFallback), nextProps = createFiberFromFragment(nextProps, showFallback, renderLanes, null), nextPrimaryChildren.return = workInProgress, nextProps.return = workInProgress, nextPrimaryChildren.sibling = nextProps, workInProgress.child = nextPrimaryChildren, nextProps = workInProgress.child, nextProps.memoizedState = mountSuspenseOffscreenState(renderLanes), nextProps.childLanes = getRemainingWorkInPrimaryTree(current, JSCompiler_temp, renderLanes), workInProgress.memoizedState = SUSPENDED_MARKER, bailoutOffscreenComponent(null, nextProps); + pushPrimaryTreeSuspenseHandler(workInProgress); + return mountSuspensePrimaryChildren(workInProgress, nextPrimaryChildren); + } + var prevState = current.memoizedState; + if (null !== prevState && (nextPrimaryChildren = prevState.dehydrated, null !== nextPrimaryChildren)) { + if (didSuspend) workInProgress.flags & 256 ? (pushPrimaryTreeSuspenseHandler(workInProgress), workInProgress.flags &= -257, workInProgress = retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes)) : null !== workInProgress.memoizedState ? (reuseSuspenseHandlerOnStack(workInProgress), workInProgress.child = current.child, workInProgress.flags |= 128, workInProgress = null) : (reuseSuspenseHandlerOnStack(workInProgress), nextPrimaryChildren = nextProps.fallback, showFallback = workInProgress.mode, nextProps = mountWorkInProgressOffscreenFiber({ + mode: "visible", + children: nextProps.children + }, showFallback), nextPrimaryChildren = createFiberFromFragment(nextPrimaryChildren, showFallback, renderLanes, null), nextPrimaryChildren.flags |= 2, nextProps.return = workInProgress, nextPrimaryChildren.return = workInProgress, nextProps.sibling = nextPrimaryChildren, workInProgress.child = nextProps, reconcileChildFibers(workInProgress, current.child, null, renderLanes), nextProps = workInProgress.child, nextProps.memoizedState = mountSuspenseOffscreenState(renderLanes), nextProps.childLanes = getRemainingWorkInPrimaryTree(current, JSCompiler_temp, renderLanes), workInProgress.memoizedState = SUSPENDED_MARKER, workInProgress = bailoutOffscreenComponent(null, nextProps)); + else if (pushPrimaryTreeSuspenseHandler(workInProgress), isSuspenseInstanceFallback(nextPrimaryChildren)) { + JSCompiler_temp = nextPrimaryChildren.nextSibling && nextPrimaryChildren.nextSibling.dataset; + if (JSCompiler_temp) var digest = JSCompiler_temp.dgst; + JSCompiler_temp = digest; + nextProps = Error(formatProdErrorMessage(419)); + nextProps.stack = ""; + nextProps.digest = JSCompiler_temp; + queueHydrationError({ + value: nextProps, + source: null, + stack: null + }); + workInProgress = retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes); + } else if (didReceiveUpdate || propagateParentContextChanges(current, workInProgress, renderLanes, !1), JSCompiler_temp = 0 !== (renderLanes & current.childLanes), didReceiveUpdate || JSCompiler_temp) { + JSCompiler_temp = workInProgressRoot; + if (null !== JSCompiler_temp && (nextProps = getBumpedLaneForHydration(JSCompiler_temp, renderLanes), 0 !== nextProps && nextProps !== prevState.retryLane)) throw prevState.retryLane = nextProps, enqueueConcurrentRenderForLane(current, nextProps), scheduleUpdateOnFiber(JSCompiler_temp, current, nextProps), SelectiveHydrationException; + isSuspenseInstancePending(nextPrimaryChildren) || renderDidSuspendDelayIfPossible(); + workInProgress = retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes); + } else isSuspenseInstancePending(nextPrimaryChildren) ? (workInProgress.flags |= 192, workInProgress.child = current.child, workInProgress = null) : (current = prevState.treeContext, nextHydratableInstance = getNextHydratable(nextPrimaryChildren.nextSibling), hydrationParentFiber = workInProgress, isHydrating = !0, hydrationErrors = null, rootOrSingletonContext = !1, null !== current && restoreSuspendedTreeContext(workInProgress, current), workInProgress = mountSuspensePrimaryChildren(workInProgress, nextProps.children), workInProgress.flags |= 4096); + return workInProgress; + } + if (showFallback) return reuseSuspenseHandlerOnStack(workInProgress), nextPrimaryChildren = nextProps.fallback, showFallback = workInProgress.mode, prevState = current.child, digest = prevState.sibling, nextProps = createWorkInProgress(prevState, { + mode: "hidden", + children: nextProps.children + }), nextProps.subtreeFlags = prevState.subtreeFlags & 65011712, null !== digest ? nextPrimaryChildren = createWorkInProgress(digest, nextPrimaryChildren) : (nextPrimaryChildren = createFiberFromFragment(nextPrimaryChildren, showFallback, renderLanes, null), nextPrimaryChildren.flags |= 2), nextPrimaryChildren.return = workInProgress, nextProps.return = workInProgress, nextProps.sibling = nextPrimaryChildren, workInProgress.child = nextProps, bailoutOffscreenComponent(null, nextProps), nextProps = workInProgress.child, nextPrimaryChildren = current.child.memoizedState, null === nextPrimaryChildren ? nextPrimaryChildren = mountSuspenseOffscreenState(renderLanes) : (showFallback = nextPrimaryChildren.cachePool, null !== showFallback ? (prevState = CacheContext._currentValue, showFallback = showFallback.parent !== prevState ? { + parent: prevState, + pool: prevState + } : showFallback) : showFallback = getSuspendedCache(), nextPrimaryChildren = { + baseLanes: nextPrimaryChildren.baseLanes | renderLanes, + cachePool: showFallback + }), nextProps.memoizedState = nextPrimaryChildren, nextProps.childLanes = getRemainingWorkInPrimaryTree(current, JSCompiler_temp, renderLanes), workInProgress.memoizedState = SUSPENDED_MARKER, bailoutOffscreenComponent(current.child, nextProps); + pushPrimaryTreeSuspenseHandler(workInProgress); + renderLanes = current.child; + current = renderLanes.sibling; + renderLanes = createWorkInProgress(renderLanes, { + mode: "visible", + children: nextProps.children + }); + renderLanes.return = workInProgress; + renderLanes.sibling = null; + null !== current && (JSCompiler_temp = workInProgress.deletions, null === JSCompiler_temp ? (workInProgress.deletions = [current], workInProgress.flags |= 16) : JSCompiler_temp.push(current)); + workInProgress.child = renderLanes; + workInProgress.memoizedState = null; + return renderLanes; + } + function mountSuspensePrimaryChildren(workInProgress, primaryChildren) { + primaryChildren = mountWorkInProgressOffscreenFiber({ + mode: "visible", + children: primaryChildren + }, workInProgress.mode); + primaryChildren.return = workInProgress; + return workInProgress.child = primaryChildren; + } + function mountWorkInProgressOffscreenFiber(offscreenProps, mode) { + offscreenProps = createFiberImplClass(22, offscreenProps, null, mode); + offscreenProps.lanes = 0; + return offscreenProps; + } + function retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes) { + reconcileChildFibers(workInProgress, current.child, null, renderLanes); + current = mountSuspensePrimaryChildren(workInProgress, workInProgress.pendingProps.children); + current.flags |= 2; + workInProgress.memoizedState = null; + return current; + } + function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) { + fiber.lanes |= renderLanes; + var alternate = fiber.alternate; + null !== alternate && (alternate.lanes |= renderLanes); + scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot); + } + function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, treeForkCount) { + var renderState = workInProgress.memoizedState; + null === renderState ? workInProgress.memoizedState = { + isBackwards, + rendering: null, + renderingStartTime: 0, + last: lastContentRow, + tail, + tailMode, + treeForkCount + } : (renderState.isBackwards = isBackwards, renderState.rendering = null, renderState.renderingStartTime = 0, renderState.last = lastContentRow, renderState.tail = tail, renderState.tailMode = tailMode, renderState.treeForkCount = treeForkCount); + } + function updateSuspenseListComponent(current, workInProgress, renderLanes) { + var nextProps = workInProgress.pendingProps, revealOrder = nextProps.revealOrder, tailMode = nextProps.tail; + nextProps = nextProps.children; + var suspenseContext = suspenseStackCursor.current, shouldForceFallback = 0 !== (suspenseContext & 2); + shouldForceFallback ? (suspenseContext = suspenseContext & 1 | 2, workInProgress.flags |= 128) : suspenseContext &= 1; + push(suspenseStackCursor, suspenseContext); + reconcileChildren(current, workInProgress, nextProps, renderLanes); + nextProps = isHydrating ? treeForkCount : 0; + if (!shouldForceFallback && null !== current && 0 !== (current.flags & 128)) a: for (current = workInProgress.child; null !== current;) { + if (13 === current.tag) null !== current.memoizedState && scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress); + else if (19 === current.tag) scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress); + else if (null !== current.child) { + current.child.return = current; + current = current.child; + continue; + } + if (current === workInProgress) break a; + for (; null === current.sibling;) { + if (null === current.return || current.return === workInProgress) break a; + current = current.return; + } + current.sibling.return = current.return; + current = current.sibling; + } + switch (revealOrder) { + case "forwards": + renderLanes = workInProgress.child; + for (revealOrder = null; null !== renderLanes;) current = renderLanes.alternate, null !== current && null === findFirstSuspended(current) && (revealOrder = renderLanes), renderLanes = renderLanes.sibling; + renderLanes = revealOrder; + null === renderLanes ? (revealOrder = workInProgress.child, workInProgress.child = null) : (revealOrder = renderLanes.sibling, renderLanes.sibling = null); + initSuspenseListRenderState(workInProgress, !1, revealOrder, renderLanes, tailMode, nextProps); + break; + case "backwards": + case "unstable_legacy-backwards": + renderLanes = null; + revealOrder = workInProgress.child; + for (workInProgress.child = null; null !== revealOrder;) { + current = revealOrder.alternate; + if (null !== current && null === findFirstSuspended(current)) { + workInProgress.child = revealOrder; + break; + } + current = revealOrder.sibling; + revealOrder.sibling = renderLanes; + renderLanes = revealOrder; + revealOrder = current; + } + initSuspenseListRenderState(workInProgress, !0, renderLanes, null, tailMode, nextProps); + break; + case "together": + initSuspenseListRenderState(workInProgress, !1, null, null, void 0, nextProps); + break; + default: workInProgress.memoizedState = null; + } + return workInProgress.child; + } + function bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) { + null !== current && (workInProgress.dependencies = current.dependencies); + workInProgressRootSkippedLanes |= workInProgress.lanes; + if (0 === (renderLanes & workInProgress.childLanes)) if (null !== current) { + if (propagateParentContextChanges(current, workInProgress, renderLanes, !1), 0 === (renderLanes & workInProgress.childLanes)) return null; + } else return null; + if (null !== current && workInProgress.child !== current.child) throw Error(formatProdErrorMessage(153)); + if (null !== workInProgress.child) { + current = workInProgress.child; + renderLanes = createWorkInProgress(current, current.pendingProps); + workInProgress.child = renderLanes; + for (renderLanes.return = workInProgress; null !== current.sibling;) current = current.sibling, renderLanes = renderLanes.sibling = createWorkInProgress(current, current.pendingProps), renderLanes.return = workInProgress; + renderLanes.sibling = null; + } + return workInProgress.child; + } + function checkScheduledUpdateOrContext(current, renderLanes) { + if (0 !== (current.lanes & renderLanes)) return !0; + current = current.dependencies; + return null !== current && checkIfContextChanged(current) ? !0 : !1; + } + function attemptEarlyBailoutIfNoScheduledUpdate(current, workInProgress, renderLanes) { + switch (workInProgress.tag) { + case 3: + pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); + pushProvider(workInProgress, CacheContext, current.memoizedState.cache); + resetHydrationState(); + break; + case 27: + case 5: + pushHostContext(workInProgress); + break; + case 4: + pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); + break; + case 10: + pushProvider(workInProgress, workInProgress.type, workInProgress.memoizedProps.value); + break; + case 31: + if (null !== workInProgress.memoizedState) return workInProgress.flags |= 128, pushDehydratedActivitySuspenseHandler(workInProgress), null; + break; + case 13: + var state$102 = workInProgress.memoizedState; + if (null !== state$102) { + if (null !== state$102.dehydrated) return pushPrimaryTreeSuspenseHandler(workInProgress), workInProgress.flags |= 128, null; + if (0 !== (renderLanes & workInProgress.child.childLanes)) return updateSuspenseComponent(current, workInProgress, renderLanes); + pushPrimaryTreeSuspenseHandler(workInProgress); + current = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + return null !== current ? current.sibling : null; + } + pushPrimaryTreeSuspenseHandler(workInProgress); + break; + case 19: + var didSuspendBefore = 0 !== (current.flags & 128); + state$102 = 0 !== (renderLanes & workInProgress.childLanes); + state$102 || (propagateParentContextChanges(current, workInProgress, renderLanes, !1), state$102 = 0 !== (renderLanes & workInProgress.childLanes)); + if (didSuspendBefore) { + if (state$102) return updateSuspenseListComponent(current, workInProgress, renderLanes); + workInProgress.flags |= 128; + } + didSuspendBefore = workInProgress.memoizedState; + null !== didSuspendBefore && (didSuspendBefore.rendering = null, didSuspendBefore.tail = null, didSuspendBefore.lastEffect = null); + push(suspenseStackCursor, suspenseStackCursor.current); + if (state$102) break; + else return null; + case 22: return workInProgress.lanes = 0, updateOffscreenComponent(current, workInProgress, renderLanes, workInProgress.pendingProps); + case 24: pushProvider(workInProgress, CacheContext, current.memoizedState.cache); + } + return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + } + function beginWork(current, workInProgress, renderLanes) { + if (null !== current) if (current.memoizedProps !== workInProgress.pendingProps) didReceiveUpdate = !0; + else { + if (!checkScheduledUpdateOrContext(current, renderLanes) && 0 === (workInProgress.flags & 128)) return didReceiveUpdate = !1, attemptEarlyBailoutIfNoScheduledUpdate(current, workInProgress, renderLanes); + didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; + } + else didReceiveUpdate = !1, isHydrating && 0 !== (workInProgress.flags & 1048576) && pushTreeId(workInProgress, treeForkCount, workInProgress.index); + workInProgress.lanes = 0; + switch (workInProgress.tag) { + case 16: + a: { + var props = workInProgress.pendingProps; + current = resolveLazy(workInProgress.elementType); + workInProgress.type = current; + if ("function" === typeof current) shouldConstruct(current) ? (props = resolveClassComponentProps(current, props), workInProgress.tag = 1, workInProgress = updateClassComponent(null, workInProgress, current, props, renderLanes)) : (workInProgress.tag = 0, workInProgress = updateFunctionComponent(null, workInProgress, current, props, renderLanes)); + else { + if (void 0 !== current && null !== current) { + var $$typeof = current.$$typeof; + if ($$typeof === REACT_FORWARD_REF_TYPE) { + workInProgress.tag = 11; + workInProgress = updateForwardRef(null, workInProgress, current, props, renderLanes); + break a; + } else if ($$typeof === REACT_MEMO_TYPE) { + workInProgress.tag = 14; + workInProgress = updateMemoComponent(null, workInProgress, current, props, renderLanes); + break a; + } + } + workInProgress = getComponentNameFromType(current) || current; + throw Error(formatProdErrorMessage(306, workInProgress, "")); + } + } + return workInProgress; + case 0: return updateFunctionComponent(current, workInProgress, workInProgress.type, workInProgress.pendingProps, renderLanes); + case 1: return props = workInProgress.type, $$typeof = resolveClassComponentProps(props, workInProgress.pendingProps), updateClassComponent(current, workInProgress, props, $$typeof, renderLanes); + case 3: + a: { + pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); + if (null === current) throw Error(formatProdErrorMessage(387)); + props = workInProgress.pendingProps; + var prevState = workInProgress.memoizedState; + $$typeof = prevState.element; + cloneUpdateQueue(current, workInProgress); + processUpdateQueue(workInProgress, props, null, renderLanes); + var nextState = workInProgress.memoizedState; + props = nextState.cache; + pushProvider(workInProgress, CacheContext, props); + props !== prevState.cache && propagateContextChanges(workInProgress, [CacheContext], renderLanes, !0); + suspendIfUpdateReadFromEntangledAsyncAction(); + props = nextState.element; + if (prevState.isDehydrated) if (prevState = { + element: props, + isDehydrated: !1, + cache: nextState.cache + }, workInProgress.updateQueue.baseState = prevState, workInProgress.memoizedState = prevState, workInProgress.flags & 256) { + workInProgress = mountHostRootWithoutHydrating(current, workInProgress, props, renderLanes); + break a; + } else if (props !== $$typeof) { + $$typeof = createCapturedValueAtFiber(Error(formatProdErrorMessage(424)), workInProgress); + queueHydrationError($$typeof); + workInProgress = mountHostRootWithoutHydrating(current, workInProgress, props, renderLanes); + break a; + } else { + current = workInProgress.stateNode.containerInfo; + switch (current.nodeType) { + case 9: + current = current.body; + break; + default: current = "HTML" === current.nodeName ? current.ownerDocument.body : current; + } + nextHydratableInstance = getNextHydratable(current.firstChild); + hydrationParentFiber = workInProgress; + isHydrating = !0; + hydrationErrors = null; + rootOrSingletonContext = !0; + renderLanes = mountChildFibers(workInProgress, null, props, renderLanes); + for (workInProgress.child = renderLanes; renderLanes;) renderLanes.flags = renderLanes.flags & -3 | 4096, renderLanes = renderLanes.sibling; + } + else { + resetHydrationState(); + if (props === $$typeof) { + workInProgress = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + break a; + } + reconcileChildren(current, workInProgress, props, renderLanes); + } + workInProgress = workInProgress.child; + } + return workInProgress; + case 26: return markRef(current, workInProgress), null === current ? (renderLanes = getResource(workInProgress.type, null, workInProgress.pendingProps, null)) ? workInProgress.memoizedState = renderLanes : isHydrating || (renderLanes = workInProgress.type, current = workInProgress.pendingProps, props = getOwnerDocumentFromRootContainer(rootInstanceStackCursor.current).createElement(renderLanes), props[internalInstanceKey] = workInProgress, props[internalPropsKey] = current, setInitialProperties(props, renderLanes, current), markNodeAsHoistable(props), workInProgress.stateNode = props) : workInProgress.memoizedState = getResource(workInProgress.type, current.memoizedProps, workInProgress.pendingProps, current.memoizedState), null; + case 27: return pushHostContext(workInProgress), null === current && isHydrating && (props = workInProgress.stateNode = resolveSingletonInstance(workInProgress.type, workInProgress.pendingProps, rootInstanceStackCursor.current), hydrationParentFiber = workInProgress, rootOrSingletonContext = !0, $$typeof = nextHydratableInstance, isSingletonScope(workInProgress.type) ? (previousHydratableOnEnteringScopedSingleton = $$typeof, nextHydratableInstance = getNextHydratable(props.firstChild)) : nextHydratableInstance = $$typeof), reconcileChildren(current, workInProgress, workInProgress.pendingProps.children, renderLanes), markRef(current, workInProgress), null === current && (workInProgress.flags |= 4194304), workInProgress.child; + case 5: + if (null === current && isHydrating) { + if ($$typeof = props = nextHydratableInstance) props = canHydrateInstance(props, workInProgress.type, workInProgress.pendingProps, rootOrSingletonContext), null !== props ? (workInProgress.stateNode = props, hydrationParentFiber = workInProgress, nextHydratableInstance = getNextHydratable(props.firstChild), rootOrSingletonContext = !1, $$typeof = !0) : $$typeof = !1; + $$typeof || throwOnHydrationMismatch(workInProgress); + } + pushHostContext(workInProgress); + $$typeof = workInProgress.type; + prevState = workInProgress.pendingProps; + nextState = null !== current ? current.memoizedProps : null; + props = prevState.children; + shouldSetTextContent($$typeof, prevState) ? props = null : null !== nextState && shouldSetTextContent($$typeof, nextState) && (workInProgress.flags |= 32); + null !== workInProgress.memoizedState && ($$typeof = renderWithHooks(current, workInProgress, TransitionAwareHostComponent, null, null, renderLanes), HostTransitionContext._currentValue = $$typeof); + markRef(current, workInProgress); + reconcileChildren(current, workInProgress, props, renderLanes); + return workInProgress.child; + case 6: + if (null === current && isHydrating) { + if (current = renderLanes = nextHydratableInstance) renderLanes = canHydrateTextInstance(renderLanes, workInProgress.pendingProps, rootOrSingletonContext), null !== renderLanes ? (workInProgress.stateNode = renderLanes, hydrationParentFiber = workInProgress, nextHydratableInstance = null, current = !0) : current = !1; + current || throwOnHydrationMismatch(workInProgress); + } + return null; + case 13: return updateSuspenseComponent(current, workInProgress, renderLanes); + case 4: return pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo), props = workInProgress.pendingProps, null === current ? workInProgress.child = reconcileChildFibers(workInProgress, null, props, renderLanes) : reconcileChildren(current, workInProgress, props, renderLanes), workInProgress.child; + case 11: return updateForwardRef(current, workInProgress, workInProgress.type, workInProgress.pendingProps, renderLanes); + case 7: return reconcileChildren(current, workInProgress, workInProgress.pendingProps, renderLanes), workInProgress.child; + case 8: return reconcileChildren(current, workInProgress, workInProgress.pendingProps.children, renderLanes), workInProgress.child; + case 12: return reconcileChildren(current, workInProgress, workInProgress.pendingProps.children, renderLanes), workInProgress.child; + case 10: return props = workInProgress.pendingProps, pushProvider(workInProgress, workInProgress.type, props.value), reconcileChildren(current, workInProgress, props.children, renderLanes), workInProgress.child; + case 9: return $$typeof = workInProgress.type._context, props = workInProgress.pendingProps.children, prepareToReadContext(workInProgress), $$typeof = readContext($$typeof), props = props($$typeof), workInProgress.flags |= 1, reconcileChildren(current, workInProgress, props, renderLanes), workInProgress.child; + case 14: return updateMemoComponent(current, workInProgress, workInProgress.type, workInProgress.pendingProps, renderLanes); + case 15: return updateSimpleMemoComponent(current, workInProgress, workInProgress.type, workInProgress.pendingProps, renderLanes); + case 19: return updateSuspenseListComponent(current, workInProgress, renderLanes); + case 31: return updateActivityComponent(current, workInProgress, renderLanes); + case 22: return updateOffscreenComponent(current, workInProgress, renderLanes, workInProgress.pendingProps); + case 24: return prepareToReadContext(workInProgress), props = readContext(CacheContext), null === current ? ($$typeof = peekCacheFromPool(), null === $$typeof && ($$typeof = workInProgressRoot, prevState = createCache(), $$typeof.pooledCache = prevState, prevState.refCount++, null !== prevState && ($$typeof.pooledCacheLanes |= renderLanes), $$typeof = prevState), workInProgress.memoizedState = { + parent: props, + cache: $$typeof + }, initializeUpdateQueue(workInProgress), pushProvider(workInProgress, CacheContext, $$typeof)) : (0 !== (current.lanes & renderLanes) && (cloneUpdateQueue(current, workInProgress), processUpdateQueue(workInProgress, null, null, renderLanes), suspendIfUpdateReadFromEntangledAsyncAction()), $$typeof = current.memoizedState, prevState = workInProgress.memoizedState, $$typeof.parent !== props ? ($$typeof = { + parent: props, + cache: props + }, workInProgress.memoizedState = $$typeof, 0 === workInProgress.lanes && (workInProgress.memoizedState = workInProgress.updateQueue.baseState = $$typeof), pushProvider(workInProgress, CacheContext, props)) : (props = prevState.cache, pushProvider(workInProgress, CacheContext, props), props !== $$typeof.cache && propagateContextChanges(workInProgress, [CacheContext], renderLanes, !0))), reconcileChildren(current, workInProgress, workInProgress.pendingProps.children, renderLanes), workInProgress.child; + case 29: throw workInProgress.pendingProps; + } + throw Error(formatProdErrorMessage(156, workInProgress.tag)); + } + function markUpdate(workInProgress) { + workInProgress.flags |= 4; + } + function preloadInstanceAndSuspendIfNeeded(workInProgress, type, oldProps, newProps, renderLanes) { + if (type = 0 !== (workInProgress.mode & 32)) type = !1; + if (type) { + if (workInProgress.flags |= 16777216, (renderLanes & 335544128) === renderLanes) if (workInProgress.stateNode.complete) workInProgress.flags |= 8192; + else if (shouldRemainOnPreviousScreen()) workInProgress.flags |= 8192; + else throw suspendedThenable = noopSuspenseyCommitThenable, SuspenseyCommitException; + } else workInProgress.flags &= -16777217; + } + function preloadResourceAndSuspendIfNeeded(workInProgress, resource) { + if ("stylesheet" !== resource.type || 0 !== (resource.state.loading & 4)) workInProgress.flags &= -16777217; + else if (workInProgress.flags |= 16777216, !preloadResource(resource)) if (shouldRemainOnPreviousScreen()) workInProgress.flags |= 8192; + else throw suspendedThenable = noopSuspenseyCommitThenable, SuspenseyCommitException; + } + function scheduleRetryEffect(workInProgress, retryQueue) { + null !== retryQueue && (workInProgress.flags |= 4); + workInProgress.flags & 16384 && (retryQueue = 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912, workInProgress.lanes |= retryQueue, workInProgressSuspendedRetryLanes |= retryQueue); + } + function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + if (!isHydrating) switch (renderState.tailMode) { + case "hidden": + hasRenderedATailFallback = renderState.tail; + for (var lastTailNode = null; null !== hasRenderedATailFallback;) null !== hasRenderedATailFallback.alternate && (lastTailNode = hasRenderedATailFallback), hasRenderedATailFallback = hasRenderedATailFallback.sibling; + null === lastTailNode ? renderState.tail = null : lastTailNode.sibling = null; + break; + case "collapsed": + lastTailNode = renderState.tail; + for (var lastTailNode$106 = null; null !== lastTailNode;) null !== lastTailNode.alternate && (lastTailNode$106 = lastTailNode), lastTailNode = lastTailNode.sibling; + null === lastTailNode$106 ? hasRenderedATailFallback || null === renderState.tail ? renderState.tail = null : renderState.tail.sibling = null : lastTailNode$106.sibling = null; + } + } + function bubbleProperties(completedWork) { + var didBailout = null !== completedWork.alternate && completedWork.alternate.child === completedWork.child, newChildLanes = 0, subtreeFlags = 0; + if (didBailout) for (var child$107 = completedWork.child; null !== child$107;) newChildLanes |= child$107.lanes | child$107.childLanes, subtreeFlags |= child$107.subtreeFlags & 65011712, subtreeFlags |= child$107.flags & 65011712, child$107.return = completedWork, child$107 = child$107.sibling; + else for (child$107 = completedWork.child; null !== child$107;) newChildLanes |= child$107.lanes | child$107.childLanes, subtreeFlags |= child$107.subtreeFlags, subtreeFlags |= child$107.flags, child$107.return = completedWork, child$107 = child$107.sibling; + completedWork.subtreeFlags |= subtreeFlags; + completedWork.childLanes = newChildLanes; + return didBailout; + } + function completeWork(current, workInProgress, renderLanes) { + var newProps = workInProgress.pendingProps; + popTreeContext(workInProgress); + switch (workInProgress.tag) { + case 16: + case 15: + case 0: + case 11: + case 7: + case 8: + case 12: + case 9: + case 14: return bubbleProperties(workInProgress), null; + case 1: return bubbleProperties(workInProgress), null; + case 3: + renderLanes = workInProgress.stateNode; + newProps = null; + null !== current && (newProps = current.memoizedState.cache); + workInProgress.memoizedState.cache !== newProps && (workInProgress.flags |= 2048); + popProvider(CacheContext); + popHostContainer(); + renderLanes.pendingContext && (renderLanes.context = renderLanes.pendingContext, renderLanes.pendingContext = null); + if (null === current || null === current.child) popHydrationState(workInProgress) ? markUpdate(workInProgress) : null === current || current.memoizedState.isDehydrated && 0 === (workInProgress.flags & 256) || (workInProgress.flags |= 1024, upgradeHydrationErrorsToRecoverable()); + bubbleProperties(workInProgress); + return null; + case 26: + var type = workInProgress.type, nextResource = workInProgress.memoizedState; + null === current ? (markUpdate(workInProgress), null !== nextResource ? (bubbleProperties(workInProgress), preloadResourceAndSuspendIfNeeded(workInProgress, nextResource)) : (bubbleProperties(workInProgress), preloadInstanceAndSuspendIfNeeded(workInProgress, type, null, newProps, renderLanes))) : nextResource ? nextResource !== current.memoizedState ? (markUpdate(workInProgress), bubbleProperties(workInProgress), preloadResourceAndSuspendIfNeeded(workInProgress, nextResource)) : (bubbleProperties(workInProgress), workInProgress.flags &= -16777217) : (current = current.memoizedProps, current !== newProps && markUpdate(workInProgress), bubbleProperties(workInProgress), preloadInstanceAndSuspendIfNeeded(workInProgress, type, current, newProps, renderLanes)); + return null; + case 27: + popHostContext(workInProgress); + renderLanes = rootInstanceStackCursor.current; + type = workInProgress.type; + if (null !== current && null != workInProgress.stateNode) current.memoizedProps !== newProps && markUpdate(workInProgress); + else { + if (!newProps) { + if (null === workInProgress.stateNode) throw Error(formatProdErrorMessage(166)); + bubbleProperties(workInProgress); + return null; + } + current = contextStackCursor.current; + popHydrationState(workInProgress) ? prepareToHydrateHostInstance(workInProgress, current) : (current = resolveSingletonInstance(type, newProps, renderLanes), workInProgress.stateNode = current, markUpdate(workInProgress)); + } + bubbleProperties(workInProgress); + return null; + case 5: + popHostContext(workInProgress); + type = workInProgress.type; + if (null !== current && null != workInProgress.stateNode) current.memoizedProps !== newProps && markUpdate(workInProgress); + else { + if (!newProps) { + if (null === workInProgress.stateNode) throw Error(formatProdErrorMessage(166)); + bubbleProperties(workInProgress); + return null; + } + nextResource = contextStackCursor.current; + if (popHydrationState(workInProgress)) prepareToHydrateHostInstance(workInProgress, nextResource); + else { + var ownerDocument = getOwnerDocumentFromRootContainer(rootInstanceStackCursor.current); + switch (nextResource) { + case 1: + nextResource = ownerDocument.createElementNS("http://www.w3.org/2000/svg", type); + break; + case 2: + nextResource = ownerDocument.createElementNS("http://www.w3.org/1998/Math/MathML", type); + break; + default: switch (type) { + case "svg": + nextResource = ownerDocument.createElementNS("http://www.w3.org/2000/svg", type); + break; + case "math": + nextResource = ownerDocument.createElementNS("http://www.w3.org/1998/Math/MathML", type); + break; + case "script": + nextResource = ownerDocument.createElement("div"); + nextResource.innerHTML = " + diff --git a/docker/web/nspanelmanager/web/react-components/tsconfig.node.json b/docker/web/nspanelmanager/web/react-components/tsconfig.node.json index 950efe51c..eed391bcc 100644 --- a/docker/web/nspanelmanager/web/react-components/tsconfig.node.json +++ b/docker/web/nspanelmanager/web/react-components/tsconfig.node.json @@ -21,5 +21,5 @@ "erasableSyntaxOnly": true, "noFallthroughCasesInSwitch": true, }, - "include": ["vite.config.ts"], + "include": ["vite.config.ts", "vitest.config.ts"], } diff --git a/docker/web/nspanelmanager/web/react-components/vite.config.ts b/docker/web/nspanelmanager/web/react-components/vite.config.ts index eca37be7d..53f72e753 100644 --- a/docker/web/nspanelmanager/web/react-components/vite.config.ts +++ b/docker/web/nspanelmanager/web/react-components/vite.config.ts @@ -14,7 +14,8 @@ export default defineConfig({ base: "/static/", build: { sourcemap: false, - minify: "esbuild", + // minify: "esbuild", + minify: false, outDir: "dist", assetsDir: "", assetsInlineLimit: 0, diff --git a/docker/web/nspanelmanager/web/react-components/vitest.config.ts b/docker/web/nspanelmanager/web/react-components/vitest.config.ts new file mode 100644 index 000000000..b511d9321 --- /dev/null +++ b/docker/web/nspanelmanager/web/react-components/vitest.config.ts @@ -0,0 +1,13 @@ +// Unit tests for the React components. Kept apart from vite.config.ts so tests never run the +// Django script tag generator or any other build-only plugin. +import { defineConfig } from "vitest/config"; +import react from "@vitejs/plugin-react"; + +export default defineConfig({ + plugins: [react()], + test: { + environment: "jsdom", + setupFiles: ["./src/test/setup.ts"], + include: ["src/**/*.test.{ts,tsx}"], + }, +}); diff --git a/docker/web/nspanelmanager/web/rest.py b/docker/web/nspanelmanager/web/rest.py index 9301850ab..8da7442f1 100644 --- a/docker/web/nspanelmanager/web/rest.py +++ b/docker/web/nspanelmanager/web/rest.py @@ -5,7 +5,9 @@ from pprint import pprint from re import A +import requests from django.core.files.storage import FileSystemStorage +from django.db import transaction from django.http import HttpResponse, JsonResponse from django.views.decorators.csrf import csrf_exempt @@ -13,11 +15,10 @@ import web.openhab_api from web.settings_helper import ( get_nspanel_setting_with_default, - get_setting_with_default, set_setting_value, ) -from .apps import send_mqttmanager_reload_command +from .apps import create_entity_pages_for_room, send_mqttmanager_reload_command from .models import Entity, LightState, NSPanel, RelayGroup, Room, RoomEntitiesPage, Scene, Settings ######################## @@ -33,6 +34,25 @@ def get_home_assistant_entities(request): return JsonResponse(web.home_assistant_api.get_all_home_assistant_items(filter_params)) +def test_home_assistant(request): + if request.method != "GET": + return JsonResponse({"status": "error"}, status=405) + + address = request.GET.get("address") + token = request.GET.get("token") + if not address or not token: + return JsonResponse({"status": "error", "message": "address and token are required"}, status=400) + + try: + response = requests.get(f"{address}/api/states", headers={"Authorization": f"Bearer {token}"}) + if response.ok: + return JsonResponse({"status": "success"}) + else: + return JsonResponse({"status": "error", "message": response.text}, status=response.status_code) + except Exception as e: + return JsonResponse({"status": "error", "message": str(e)}, status=500) + + def get_openhab_items(request): if request.method != "GET": return JsonResponse({"status": "error"}, status=405) @@ -45,70 +65,49 @@ def get_openhab_items(request): return JsonResponse(openhab_items) -########################## -## MQTTManager section ### -########################## - -# Keys that are not allowed to be pulled though the REST API beacuse of security concerns. -banned_setting_keys = [ - "MQTT_SERVER", - "MQTT_PORT", - "MQTT_USERNAME", - "MQTT_PASSWORD", - "HOME_ASSISTANT_ADDRESS", - "HOME_ASSISTANT_TOKEN", - "OPENHAB_ADDRESS", - "OPENHAB_TOKEN", - "OPENHAB_TOKEN", -] - +def test_openhab(request): + if request.method != "GET": + return JsonResponse({"status": "error"}, status=405) -def mqttmanager_get_setting(request, setting_key): - if setting_key in banned_setting_keys: - return JsonResponse({"status": "error"}, status=403) # Return error forbidden + address = request.GET.get("address") + token = request.GET.get("token") + if not address or not token: + return JsonResponse({"status": "error", "message": "address and token are required"}, status=400) try: - settings = {} - if request.method == "GET": - settings[setting_key] = get_setting_with_default(setting_key) + response = requests.get(f"{address}/rest/items", headers={"Authorization": f"Bearer {token}"}) + if response.ok: + return JsonResponse({"status": "success"}) else: - return JsonResponse({"status": "error"}, status=405) + return JsonResponse({"status": "error", "message": response.text}, status=response.status_code) + except Exception as e: + return JsonResponse({"status": "error", "message": str(e)}, status=500) - return JsonResponse( - { - "status": "ok", - "settings": settings, - } - ) - except Exception as ex: - logging.exception(ex) - return JsonResponse({"status": "error"}, status=500) - return JsonResponse({"status": "error"}, status=500) + +########################## +## MQTTManager section ### +########################## @csrf_exempt -def mqttmanager_settings_post(request): +def test_mqttmanager(request): + if request.method != "GET": + return JsonResponse({"status": "error"}, status=405) + + address = request.GET.get("address") + port = request.GET.get("port") + if not address or not port: + return JsonResponse({"status": "error", "message": "address and port are required"}, status=400) + try: - settings = {} - if request.method == "POST": - data = json.loads(request.body) - for setting_key in data["settings"]: - if setting_key in banned_setting_keys: - return JsonResponse({"status": "error"}, status=403) # Return error forbidden - settings[setting_key] = get_setting_with_default(setting_key) + response = requests.get(f"http://{address}:{port}/rest/settings") + if response.ok: + return JsonResponse({"status": "success"}) else: - return JsonResponse({"status": "error"}, status=405) - - return JsonResponse( - { - "status": "ok", - "settings": settings, - } - ) + return JsonResponse({"status": "error", "message": response.text}, status=response.status_code) except Exception as ex: logging.exception(ex) return JsonResponse({"status": "error"}, status=500) - return JsonResponse({"status": "error"}, status=500) ###################### @@ -164,6 +163,8 @@ def relay_groups(request): def rooms(request): if request.method == "GET": return rooms_get(request) + elif request.method == "PUT": + return room_put(request) elif request.method == "POST": return room_create(request) else: @@ -173,6 +174,8 @@ def rooms(request): def settings(request): if request.method == "GET": return settings_get(request) + elif request.method == "POST": + return settings_post(request) else: return JsonResponse({"status": "error"}, status=405) @@ -181,15 +184,33 @@ def settings_get(request): settings = {} for setting in Settings.objects.all(): settings[setting.name] = setting.value - settings["home_assistant_token_set"] = settings.get("home_assistant_token", "") != "" - del settings["home_assistant_token"] - settings["openhab_token_set"] = settings.get("openhab_token", "") != "" - del settings["openhab_token"] - settings["mqtt_password_set"] = settings.get("mqtt_password", "") != "" - del settings["mqtt_password"] + # Never return secrets, only whether they are set. Any of them may never have been saved. + for secret in ("home_assistant_token", "openhab_token", "mqtt_password"): + settings[f"{secret}_set"] = settings.pop(secret, "") != "" return JsonResponse({"status": "ok", "settings": settings}, status=200) +def settings_post(request): + try: + if request.method == "POST": + data = json.loads(request.body) + if "settings" not in data: + return JsonResponse({"status": "error", "message": "No settings provided"}, status=400) + elif not isinstance(data["settings"], dict): + return JsonResponse({"status": "error", "message": "Settings must be a dictionary"}, status=400) + + for setting_key in data["settings"]: + set_setting_value(setting_key, data["settings"][setting_key]) + + send_mqttmanager_reload_command() + return JsonResponse({"status": "ok"}) + else: + return JsonResponse({"status": "error"}, status=405) + except Exception as ex: + logging.exception(ex) + return JsonResponse({"status": "error"}, status=500) + + def rooms_get(request): try: rooms = list() @@ -201,7 +222,10 @@ def rooms_get(request): rooms.append( { "id": room.id, - "name": room.friendly_name, + "friendly_name": room.friendly_name, + "display_order": room.displayOrder, + "room_temp_provider": room.room_temp_provider, + "room_temp_sensor": room.room_temp_sensor, } ) return JsonResponse({"status": "ok", "rooms": rooms}, status=200) @@ -210,20 +234,36 @@ def rooms_get(request): return JsonResponse({"status": "error"}, status=500) +# The entities page layouts the panel GUI has. +PAGE_SIZES = (4, 8, 12) + + +def get_page_size_error(page_type): + if page_type not in PAGE_SIZES: + return f"Unsupported page size {page_type!r}. Expected one of: {', '.join(map(str, PAGE_SIZES))}." + return None + + def put_room_entities_order(request, room_id): if request.method == "PUT": try: data = json.loads(request.body) - for entity in data["entities"]: - db_entity = Entity.objects.get(id=entity["id"]) - db_entity.room_view_position = entity["room_view_position"] - db_entity.entities_page_id = entity["entities_page_id"] - db_entity.save() - for scene in data["scenes"]: - db_scene = Scene.objects.get(id=scene["id"]) - db_scene.room_view_position = scene["room_view_position"] - db_scene.entities_page_id = scene["entities_page_id"] - db_scene.save() + for item in data["entities"] + data["scenes"]: + page = RoomEntitiesPage.objects.get(id=item["entities_page_id"]) + if not 0 <= item["room_view_position"] < page.page_type: + return JsonResponse({"status": "error", "message": f"room_view_position must be between 0 and {page.page_type - 1} on page {page.id}."}, status=400) + # All or nothing: a bad entry must not leave the entries before it already moved. + with transaction.atomic(): + for entity in data["entities"]: + db_entity = Entity.objects.get(id=entity["id"]) + db_entity.room_view_position = entity["room_view_position"] + db_entity.entities_page_id = entity["entities_page_id"] + db_entity.save() + for scene in data["scenes"]: + db_scene = Scene.objects.get(id=scene["id"]) + db_scene.room_view_position = scene["room_view_position"] + db_scene.entities_page_id = scene["entities_page_id"] + db_scene.save() send_mqttmanager_reload_command() return JsonResponse({"status": "ok"}, status=200) except Exception as ex: @@ -262,6 +302,9 @@ def room_entities_pages(request, room_id): for field in required_fields: if field not in data: return JsonResponse({"status": "error", "message": f"Missing required field: {field}"}, status=400) + page_size_error = get_page_size_error(data["type"]) + if page_size_error: + return JsonResponse({"status": "error", "message": page_size_error}, status=400) room = Room.objects.get(id=room_id) pages = RoomEntitiesPage.objects.filter(room=room).order_by("display_order") @@ -302,9 +345,18 @@ def room_entities_page(request, page_id): try: data = json.loads(request.body) db_page = RoomEntitiesPage.objects.get(id=page_id) - db_page.page_type = data.get("number_of_entities", db_page.page_type) + new_page_type = data.get("number_of_entities", db_page.page_type) + if new_page_type != db_page.page_type: + page_size_error = get_page_size_error(new_page_type) + if page_size_error: + return JsonResponse({"status": "error", "message": page_size_error}, status=400) + # Shrinking must not leave entities in slots the panel no longer shows. + if db_page.entity_set.filter(room_view_position__gte=new_page_type).exists() or db_page.scene_set.filter(room_view_position__gte=new_page_type).exists(): + return JsonResponse({"status": "error", "message": f"Move or remove the entities in slots {new_page_type + 1} and above before shrinking this page."}, status=400) + db_page.page_type = new_page_type db_page.display_order = data.get("display_order", db_page.display_order) db_page.save() + send_mqttmanager_reload_command() return JsonResponse({"status": "ok"}, status=200) except Exception as ex: logging.exception(ex) @@ -341,6 +393,64 @@ def room_entities_pages_order(request): return JsonResponse({"status": "error"}, status=405) +#################### +# NSPanel REST API # +#################### + + +def nspanel_delete(request, nspanel_id): + try: + if request.method == "DELETE": + nspanel = NSPanel.objects.get(id=nspanel_id) + nspanel.delete() + response = JsonResponse({"status": "ok"}, status=200) + send_mqttmanager_reload_command() + return response + else: + return JsonResponse({"status": "error"}, status=405) + except Exception as ex: + logging.exception(ex) + return JsonResponse({"status": "error"}, status=500) + + +def nspanel_accept(request, nspanel_id): + try: + if request.method == "POST": + data = json.loads(request.body) + if "room_id" not in data: + return JsonResponse({"status": "error", "message": "room_id is required"}, status=400) + nspanel = NSPanel.objects.get(id=nspanel_id) + nspanel.denied = False + nspanel.accepted = True + nspanel.room = Room.objects.get(id=data["room_id"]) + nspanel.save() + response = JsonResponse({"status": "ok", "id": nspanel.id}, status=200) + send_mqttmanager_reload_command() + return response + else: + return JsonResponse({"status": "error"}, status=405) + except Exception as ex: + logging.exception(ex) + return JsonResponse({"status": "error"}, status=500) + + +def nspanel_deny(request, nspanel_id): + try: + if request.method == "POST": + nspanel = NSPanel.objects.get(id=nspanel_id) + nspanel.denied = True + nspanel.accepted = False + nspanel.save() + response = JsonResponse({"status": "ok", "id": nspanel.id}, status=200) + send_mqttmanager_reload_command() + return response + else: + return JsonResponse({"status": "error"}, status=405) + except Exception as ex: + logging.exception(ex) + return JsonResponse({"status": "error"}, status=500) + + ######################## ### Global functions ### ######################## @@ -374,6 +484,9 @@ def global_entities_pages(request): for field in required_fields: if field not in data: return JsonResponse({"status": "error", "message": f"Missing required field: {field}"}, status=400) + page_size_error = get_page_size_error(data["type"]) + if page_size_error: + return JsonResponse({"status": "error", "message": page_size_error}, status=400) pages = RoomEntitiesPage.objects.filter(room=None).order_by("display_order") new_display_order = 0 # Default to zero of no pages exists @@ -402,7 +515,15 @@ def room_delete(request, room_id): if request.method == "DELETE": try: room = Room.objects.get(id=room_id) + # Panels are not deleted with their room; move them to another room. + new_room = Room.objects.exclude(id=room.id).first() + if new_room: + NSPanel.objects.filter(room=room).update(room=new_room) + elif NSPanel.objects.filter(room=room).exists(): + # Panels must belong to a room, so the last room can only be deleted once it has no panels. + return JsonResponse({"status": "error", "message": "The last room cannot be deleted while panels are assigned to it."}, status=400) room.delete() + send_mqttmanager_reload_command() return JsonResponse({"status": "ok", "room_id": room_id}, status=200) except Exception as ex: logging.exception(ex) @@ -423,14 +544,45 @@ def room_entities(request, room_id): return JsonResponse({"status": "error"}, status=405) +def room_put(request): + if request.method == "PUT": + try: + data = json.loads(request.body) + room_id = data["id"] + room = Room.objects.get(id=room_id) + + if "friendly_name" in data: + room.friendly_name = data["friendly_name"] + if "display_order" in data: + room.displayOrder = data["display_order"] + if "room_temp_provider" in data: + room.room_temp_provider = data["room_temp_provider"] + if "room_temp_sensor" in data: + room.room_temp_sensor = data["room_temp_sensor"] + room.save() + send_mqttmanager_reload_command() + return JsonResponse({"status": "ok", "room_id": room.id}, status=200) + except Exception as ex: + logging.exception(ex) + return JsonResponse({"status": "error", "message": str(ex)}, status=500) + else: + return JsonResponse({"status": "error"}, status=405) + + @csrf_exempt def room_create(request): if request.method == "POST": try: data = json.loads(request.body) - new_room = Room() - new_room.friendly_name = data["name"] - new_room.save() + max_length = Room._meta.get_field("friendly_name").max_length + if not data["name"] or len(data["name"]) > max_length: + return JsonResponse({"status": "error", "message": f"Room name must be 1 to {max_length} characters"}, status=400) + with transaction.atomic(): + new_room = Room() + new_room.friendly_name = data["name"] + new_room.save() + create_entity_pages_for_room(new_room) + send_mqttmanager_reload_command() return JsonResponse({"status": "ok", "room_id": new_room.id}, status=200) except Exception as ex: logging.exception(ex) @@ -482,7 +634,7 @@ def scenes(request): def scenes_get(request): try: scenes = [] - if request.GET.get("light_id"): + if request.GET.get("scene_id"): scenes_objects = Scene.objects.filter(id=request.GET.get("scene_id")) elif request.GET.get("room_id"): scenes_objects = Scene.objects.filter(room_id=request.GET.get("room_id")) @@ -530,7 +682,7 @@ def scenes_post(request): scene.lightstate_set.all().delete() # Remove all old states # TODO: Convert light states to JSON fields in DB. for light_state in data["light_states"]: - light = Light.objects.filter(id=light_state["light_id"]).first() + light = Entity.objects.filter(id=light_state["light_id"], entity_type=Entity.EntityType.LIGHT).first() if light: new_state = LightState() new_state.light = light @@ -586,6 +738,7 @@ def get_scene(request, scene_id): elif request.method == "DELETE": scene = Scene.objects.get(id=scene_id) scene.delete() + send_mqttmanager_reload_command() return JsonResponse({"status": "success"}) except Exception as ex: logging.exception(ex) @@ -594,6 +747,45 @@ def get_scene(request, scene_id): ### Generic Entity section ### +# The controllers MQTTManager's entity classes (docker/MQTTManager/include/{light,switch,button,thermostat}/) +# accept for each entity type. Anything else is logged as an error when it loads the entity. +ENTITY_CONTROLLERS = { + Entity.EntityType.LIGHT: ("home_assistant", "openhab"), + Entity.EntityType.SWITCH: ("home_assistant", "openhab"), + Entity.EntityType.BUTTON: ("home_assistant", "nspm"), + Entity.EntityType.THERMOSTAT: ("home_assistant", "openhab"), + Entity.EntityType.MEDIA_PLAYER: ("home_assistant",), + Entity.EntityType.COVER: ("home_assistant", "openhab"), +} + +# The scene types MQTTManager's EntityManager loads. It ignores scenes of any other type. +SCENE_TYPES = ("home_assistant", "openhab", "nspm_scene") + + +def get_controller_error(entity_type, controller): + if controller not in ENTITY_CONTROLLERS[entity_type]: + return f"Unknown controller {controller!r}. Expected one of: {', '.join(ENTITY_CONTROLLERS[entity_type])}." + return None + + +def get_placement_error(obj, room, entities_page, room_view_position): + """Return why obj (an Entity or Scene) cannot go in that slot, or None if it can. + + Only a new or changed placement is checked, so entities saved before these checks + existed can still be edited without being moved. + """ + room_id = room.id if room else None + if obj.pk is not None and (obj.room_id, obj.entities_page_id, obj.room_view_position) == (room_id, entities_page.id, room_view_position): + return None + if entities_page.room_id != room_id: + return "The entities page belongs to a different room." + if not 0 <= room_view_position < entities_page.page_type: + return f"room_view_position must be between 0 and {entities_page.page_type - 1} on this page." + if type(obj).objects.filter(entities_page=entities_page, room_view_position=room_view_position).exclude(pk=obj.pk).exists(): + return "That position on the page is already taken." + return None + + def get_rest_entitiy_representation(entity_id): entity = Entity.objects.get(id=entity_id) return { @@ -641,7 +833,7 @@ def entities_lights(request): except Exception as ex: logging.exception(ex) return JsonResponse({"status": "error"}, status=500) - return JsonResponse({"status": "error", "error": "Unsupported method"}, status=403) + return JsonResponse({"status": "error", "error": "Unsupported method"}, status=405) def put_light_entity(request): @@ -661,6 +853,7 @@ def put_light_entity(request): "is_ceiling_light", "openhab_item_color_temp", "openhab_item_dimmer", + "openhab_item_switch", "openhab_item_rgb", ] data = json.loads(request.body)["values"] @@ -668,11 +861,16 @@ def put_light_entity(request): if field not in data: return JsonResponse({"status": "error", "message": f"Missing required field: {field}"}, status=400) + controller_error = get_controller_error(Entity.EntityType.LIGHT, data["controller"]) + if controller_error: + return JsonResponse({"status": "error", "message": controller_error}, status=400) + entity_data = { "controller": data["controller"], "home_assistant_name": data.get("home_assistant_name", ""), "openhab_control_mode": "dimmer" if data.get("can_dim", False) else "switch", "openhab_item_dimmer": data.get("openhab_item_dimmer", ""), + "openhab_item_switch": data.get("openhab_item_switch", ""), "openhab_item_color_temp": data.get("openhab_item_color_temp", ""), "openhab_item_rgb": data.get("openhab_item_rgb", ""), "can_dim": str(data["can_dim"]).lower() == "true", @@ -687,10 +885,17 @@ def put_light_entity(request): new_light = Entity() new_light.entity_type = Entity.EntityType.LIGHT + room = Room.objects.get(id=int(data["room_id"])) + entities_page = RoomEntitiesPage.objects.get(id=int(data["entities_page_id"])) + room_view_position = int(data["room_view_position"]) + placement_error = get_placement_error(new_light, room, entities_page, room_view_position) + if placement_error: + return JsonResponse({"status": "error", "message": placement_error}, status=400) + new_light.friendly_name = data["friendly_name"] - new_light.room = Room.objects.get(id=int(data["room_id"])) - new_light.entities_page = RoomEntitiesPage.objects.get(id=int(data["entities_page_id"])) - new_light.room_view_position = int(data["room_view_position"]) + new_light.room = room + new_light.entities_page = entities_page + new_light.room_view_position = room_view_position new_light.entity_data = entity_data new_light.save() @@ -714,7 +919,7 @@ def entities_switches(request): except Exception as ex: logging.exception(ex) return JsonResponse({"status": "error"}, status=500) - return JsonResponse({"status": "error", "error": "Unsupported method"}, status=403) + return JsonResponse({"status": "error", "error": "Unsupported method"}, status=405) def put_switch_entity(request): @@ -734,6 +939,10 @@ def put_switch_entity(request): if field not in data: return JsonResponse({"status": "error", "message": f"Missing required field: {field}"}, status=400) + controller_error = get_controller_error(Entity.EntityType.SWITCH, data["controller"]) + if controller_error: + return JsonResponse({"status": "error", "message": controller_error}, status=400) + entity_data = { "openhab_item_switch": data.get("openhab_item_switch", ""), "home_assistant_name": data.get("home_assistant_name", ""), @@ -745,10 +954,17 @@ def put_switch_entity(request): new_switch = Entity() new_switch.entity_type = Entity.EntityType.SWITCH + room = Room.objects.get(id=int(data["room_id"])) + entities_page = RoomEntitiesPage.objects.get(id=int(data["entities_page_id"])) + room_view_position = int(data["room_view_position"]) + placement_error = get_placement_error(new_switch, room, entities_page, room_view_position) + if placement_error: + return JsonResponse({"status": "error", "message": placement_error}, status=400) + new_switch.friendly_name = data["friendly_name"] - new_switch.room = Room.objects.get(id=int(data["room_id"])) - new_switch.entities_page = RoomEntitiesPage.objects.get(id=int(data["entities_page_id"])) - new_switch.room_view_position = int(data["room_view_position"]) + new_switch.room = room + new_switch.entities_page = entities_page + new_switch.room_view_position = room_view_position new_switch.entity_data = entity_data new_switch.save() @@ -772,7 +988,7 @@ def entities_buttons(request): except Exception as ex: logging.exception(ex) return JsonResponse({"status": "error"}, status=500) - return JsonResponse({"status": "error", "error": "Unsupported method"}, status=403) + return JsonResponse({"status": "error", "error": "Unsupported method"}, status=405) def put_button_entity(request): @@ -793,6 +1009,10 @@ def put_button_entity(request): if field not in data: return JsonResponse({"status": "error", "message": f"Missing required field: {field}"}, status=400) + controller_error = get_controller_error(Entity.EntityType.BUTTON, data["controller"]) + if controller_error: + return JsonResponse({"status": "error", "message": controller_error}, status=400) + entity_data = { "mqtt_topic": data.get("mqtt_topic", ""), "mqtt_payload": data.get("mqtt_payload", ""), @@ -805,10 +1025,17 @@ def put_button_entity(request): new_button = Entity() new_button.entity_type = Entity.EntityType.BUTTON + room = Room.objects.get(id=int(data["room_id"])) + entities_page = RoomEntitiesPage.objects.get(id=int(data["entities_page_id"])) + room_view_position = int(data["room_view_position"]) + placement_error = get_placement_error(new_button, room, entities_page, room_view_position) + if placement_error: + return JsonResponse({"status": "error", "message": placement_error}, status=400) + new_button.friendly_name = data["friendly_name"] - new_button.room = Room.objects.get(id=int(data["room_id"])) - new_button.entities_page = RoomEntitiesPage.objects.get(id=int(data["entities_page_id"])) - new_button.room_view_position = int(data["room_view_position"]) + new_button.room = room + new_button.entities_page = entities_page + new_button.room_view_position = room_view_position new_button.entity_data = entity_data new_button.save() @@ -827,12 +1054,12 @@ def put_button_entity(request): def entities_thermostats(request): try: - # if request.method == "PUT": - return put_thermostat_entity(request) + if request.method == "PUT": + return put_thermostat_entity(request) except Exception as ex: logging.exception(ex) return JsonResponse({"status": "error"}, status=500) - return JsonResponse({"status": "error", "error": "Unsupported method"}, status=403) + return JsonResponse({"status": "error", "error": "Unsupported method"}, status=405) def put_thermostat_entity(request): @@ -845,6 +1072,7 @@ def put_thermostat_entity(request): "type", "friendly_name", "step_size", + "use_current_temperature", "home_assistant_name", "openhab_fan_mode_item", "openhab_hvac_mode_item", @@ -872,6 +1100,10 @@ def put_thermostat_entity(request): if field not in item: return JsonResponse({"status": "error", "message": f"Missing required field in {mode}. Missing field: {field}"}, status=400) + controller_error = get_controller_error(Entity.EntityType.THERMOSTAT, data["controller"]) + if controller_error: + return JsonResponse({"status": "error", "message": controller_error}, status=400) + entity_data = { "controller": data.get("controller", ""), "fan_modes": data.get("fan_modes", []), @@ -879,6 +1111,7 @@ def put_thermostat_entity(request): "preset_modes": data.get("preset_modes", []), "swing_modes": data.get("swing_modes", []), "swingh_modes": data.get("swingh_modes", []), + "use_current_temperature": data.get("use_current_temperature", "True") == "True", "home_assistant_name": data.get("home_assistant_name", ""), "openhab_fan_mode_item": data.get("openhab_fan_mode_item", ""), "openhab_hvac_mode_item": data.get("openhab_hvac_mode_item", ""), @@ -886,6 +1119,7 @@ def put_thermostat_entity(request): "openhab_swing_mode_item": data.get("openhab_swing_mode_item", ""), "openhab_swingh_mode_item": data.get("openhab_swingh_mode_item", ""), "openhab_temperature_item": data.get("openhab_temperature_item", ""), + "openhab_current_temperature_item": data.get("openhab_current_temperature_item", ""), "step_size": float(data.get("step_size", 1)), } if "id" in data and data["id"]: @@ -894,10 +1128,17 @@ def put_thermostat_entity(request): new_thermostat = Entity() new_thermostat.entity_type = Entity.EntityType.THERMOSTAT + room = Room.objects.get(id=int(data["room_id"])) + entities_page = RoomEntitiesPage.objects.get(id=int(data["entities_page_id"])) + room_view_position = int(data["room_view_position"]) + placement_error = get_placement_error(new_thermostat, room, entities_page, room_view_position) + if placement_error: + return JsonResponse({"status": "error", "message": placement_error}, status=400) + new_thermostat.friendly_name = data["friendly_name"] - new_thermostat.room = Room.objects.get(id=int(data["room_id"])) - new_thermostat.entities_page = RoomEntitiesPage.objects.get(id=int(data["entities_page_id"])) - new_thermostat.room_view_position = int(data["room_view_position"]) + new_thermostat.room = room + new_thermostat.entities_page = entities_page + new_thermostat.room_view_position = room_view_position new_thermostat.entity_data = entity_data new_thermostat.save() @@ -909,6 +1150,258 @@ def put_thermostat_entity(request): return JsonResponse({"status": "error"}, status=500) +######################## +# Media player section # +######################## + + +# How the volume of the source feeding a media player is found in Home Assistant. +# See HomeAssistantSourceVolumeStrategy in the MQTTManager for what each one expects. +MEDIA_PLAYER_SOURCE_VOLUME_STRATEGIES = ["none", "player_attributes", "source_entity"] + +# Volume in % that one volume up/down press on the panel changes, unless set per media player. +MEDIA_PLAYER_DEFAULT_VOLUME_STEP = 5 + + +def entities_media_players(request): + try: + if request.method == "PUT": + return put_media_player_entity(request) + except Exception as ex: + logging.exception(ex) + return JsonResponse({"status": "error"}, status=500) + return JsonResponse({"status": "error", "error": "Unsupported method"}, status=405) + + +def put_media_player_entity(request): + try: + required_fields = [ # Fields required for media player entities + "room_id", + "entities_page_id", + "room_view_position", + "controller", + "friendly_name", + "home_assistant_name", + ] + + data = json.loads(request.body) + for field in required_fields: + if field not in data: + return JsonResponse({"status": "error", "message": f"Missing required field: {field}"}, status=400) + + if data["controller"] != "home_assistant": + return JsonResponse({"status": "error", "message": f"Unsupported controller for media player: {data['controller']}"}, status=400) + + # Source volume is optional, a media player without it only has its own volume. + source_volume_strategy = data.get("source_volume_strategy", "none") + source_entity_attribute = data.get("source_entity_attribute", "") + source_volume_attribute = data.get("source_volume_attribute", "") + if not all(isinstance(value, str) for value in [source_volume_strategy, source_entity_attribute, source_volume_attribute]): + return JsonResponse({"status": "error", "message": "source_volume_strategy, source_entity_attribute and source_volume_attribute must be strings."}, status=400) + source_entity_attribute = source_entity_attribute.strip() + source_volume_attribute = source_volume_attribute.strip() + + # Each strategy needs different attributes on the media player in Home Assistant. Reject a combination + # here rather than leaving the manager to log an error and silently fall back to no source volume. + if source_volume_strategy not in MEDIA_PLAYER_SOURCE_VOLUME_STRATEGIES: + return JsonResponse({"status": "error", "message": f"Unknown source volume strategy: {source_volume_strategy}. Expected one of {', '.join(MEDIA_PLAYER_SOURCE_VOLUME_STRATEGIES)}."}, status=400) + if source_volume_strategy != "none" and not source_entity_attribute: + return JsonResponse({"status": "error", "message": f"Source volume strategy '{source_volume_strategy}' requires source_entity_attribute."}, status=400) + if source_volume_strategy == "player_attributes" and not source_volume_attribute: + return JsonResponse({"status": "error", "message": "Source volume strategy 'player_attributes' requires source_volume_attribute."}, status=400) + + # How much one volume up/down press on the panel changes the volume. Optional, see below for the default. + volume_step = data.get("volume_step") + if volume_step is not None and (isinstance(volume_step, bool) or not isinstance(volume_step, int) or volume_step < 1 or volume_step > 100): + return JsonResponse({"status": "error", "message": "volume_step must be an integer between 1 and 100."}, status=400) + + try: + room_id = int(data["room_id"]) + entities_page_id = int(data["entities_page_id"]) + room_view_position = int(data["room_view_position"]) + media_player_id = int(data["id"]) if data.get("id") else None + except (TypeError, ValueError): + return JsonResponse({"status": "error", "message": "room_id, entities_page_id, room_view_position and id must be integers."}, status=400) + + if media_player_id is not None: + # Only update existing media players, never another type of entity that happens to have this ID. + new_media_player = Entity.objects.filter(id=media_player_id).first() + if new_media_player is None: + return JsonResponse({"status": "error", "message": f"No entity with id {media_player_id}."}, status=404) + if new_media_player.entity_type != Entity.EntityType.MEDIA_PLAYER: + return JsonResponse({"status": "error", "message": f"Entity {media_player_id} is a {new_media_player.entity_type}, not a media player."}, status=409) + else: + new_media_player = Entity() + new_media_player.entity_type = Entity.EntityType.MEDIA_PLAYER + + room = Room.objects.filter(id=room_id).first() + if room is None: + return JsonResponse({"status": "error", "message": f"No room with id {room_id}."}, status=404) + + # The media player is shown in a slot on one of the room's entities pages. + entities_page = RoomEntitiesPage.objects.filter(id=entities_page_id).first() + if entities_page is None: + return JsonResponse({"status": "error", "message": f"No entities page with id {entities_page_id}."}, status=404) + if entities_page.room_id != room.id or entities_page.is_scenes_page: + return JsonResponse({"status": "error", "message": f"Entities page {entities_page_id} is not an entities page in room {room_id}."}, status=400) + if room_view_position < 0 or room_view_position >= entities_page.page_type: + return JsonResponse({"status": "error", "message": f"room_view_position must be between 0 and {entities_page.page_type - 1} for entities page {entities_page_id}."}, status=400) + + # The slot must be free. Updating a media player in place keeps its own slot. + slot_taken = Entity.objects.filter(entities_page=entities_page, room_view_position=room_view_position).exclude(id=new_media_player.id).exists() or Scene.objects.filter(entities_page=entities_page, room_view_position=room_view_position).exists() + if slot_taken: + return JsonResponse({"status": "error", "message": f"Slot {room_view_position} on entities page {entities_page_id} is already in use."}, status=409) + + # Without a volume step in the request, an existing media player keeps its step and a new one gets 5%. + if volume_step is None: + volume_step = new_media_player.entity_data.get("volume_step", MEDIA_PLAYER_DEFAULT_VOLUME_STEP) + + entity_data = { + "controller": data["controller"], + "home_assistant_name": data["home_assistant_name"], + "source_volume_strategy": source_volume_strategy, + "source_entity_attribute": source_entity_attribute, + "source_volume_attribute": source_volume_attribute, + "volume_step": volume_step, + } + new_media_player.friendly_name = data["friendly_name"] + new_media_player.room = room + new_media_player.entities_page = entities_page + new_media_player.room_view_position = room_view_position + new_media_player.entity_data = entity_data + new_media_player.save() + send_mqttmanager_reload_command() + + return JsonResponse({"status": "ok"}, status=200) + except Exception as ex: + logging.exception(ex) + return JsonResponse({"status": "error"}, status=500) + + +#################### +# Covers section # +#################### + + +def entities_covers(request): + try: + if request.method == "PUT": + return put_cover_entity(request) + except Exception as ex: + logging.exception(ex) + return JsonResponse({"status": "error"}, status=500) + return JsonResponse({"status": "error", "error": "Unsupported method"}, status=405) + + +def put_cover_entity(request): + try: + required_fields = [ + "room_id", + "entities_page_id", + "room_view_position", + "controller", + "friendly_name", + "invert_positions", + "home_assistant_name", + "openhab_item", + "openhab_tilt_item", + "position_preset1", + "position_preset2", + "position_preset3", + "tilt_preset1", + "tilt_preset2", + "tilt_preset3", + ] + + data = json.loads(request.body) + for field in required_fields: + if field not in data: + return JsonResponse({"status": "error", "message": f"Missing required field: {field}"}, status=400) + + for field in ("controller", "friendly_name", "home_assistant_name", "openhab_item", "openhab_tilt_item"): + if not isinstance(data[field], str): + return JsonResponse({"status": "error", "message": f"{field} must be a string."}, status=400) + + controller_error = get_controller_error(Entity.EntityType.COVER, data["controller"]) + if controller_error: + return JsonResponse({"status": "error", "message": controller_error}, status=400) + + home_assistant_name = data["home_assistant_name"].strip() + openhab_item = data["openhab_item"].strip() + openhab_tilt_item = data["openhab_tilt_item"].strip() + invert_positions = data["invert_positions"] if "invert_positions" in data else False + if data["controller"] == "home_assistant": + if not home_assistant_name: + return JsonResponse({"status": "error", "message": "home_assistant_name is required for a Home Assistant cover."}, status=400) + if not home_assistant_name.startswith("cover."): + return JsonResponse({"status": "error", "message": "home_assistant_name must be a cover.* entity."}, status=400) + else: + if not openhab_item: + return JsonResponse({"status": "error", "message": "openhab_item is required for an OpenHAB cover."}, status=400) + + try: + room_id = int(data["room_id"]) + entities_page_id = int(data["entities_page_id"]) + room_view_position = int(data["room_view_position"]) + cover_id = int(data["id"]) if data.get("id") else None + except (TypeError, ValueError): + return JsonResponse({"status": "error", "message": "room_id, entities_page_id, room_view_position and id must be integers."}, status=400) + + if cover_id is not None: + new_cover = Entity.objects.filter(id=cover_id).first() + if new_cover is None: + return JsonResponse({"status": "error", "message": f"No entity with id {cover_id}."}, status=404) + if new_cover.entity_type != Entity.EntityType.COVER: + return JsonResponse({"status": "error", "message": f"Entity {cover_id} is a {new_cover.entity_type}, not a cover."}, status=409) + else: + new_cover = Entity() + new_cover.entity_type = Entity.EntityType.COVER + + room = Room.objects.filter(id=room_id).first() + if room is None: + return JsonResponse({"status": "error", "message": f"No room with id {room_id}."}, status=404) + + entities_page = RoomEntitiesPage.objects.filter(id=entities_page_id).first() + if entities_page is None: + return JsonResponse({"status": "error", "message": f"No entities page with id {entities_page_id}."}, status=404) + if entities_page.room_id != room.id: + return JsonResponse({"status": "error", "message": f"Entities page {entities_page_id} belongs to another room."}, status=400) + if entities_page.is_scenes_page: + return JsonResponse({"status": "error", "message": "Covers cannot be placed on a scenes page."}, status=400) + + placement_error = get_placement_error(new_cover, room, entities_page, room_view_position) + if placement_error: + return JsonResponse({"status": "error", "message": placement_error}, status=400) + + entity_data = { + "controller": data["controller"], + "home_assistant_name": home_assistant_name, + "openhab_item": openhab_item, + "openhab_tilt_item": openhab_tilt_item, + "invert_positions": invert_positions, + "position_preset1": int(data["position_preset1"]), + "position_preset2": int(data["position_preset2"]), + "position_preset3": int(data["position_preset3"]), + "tilt_preset1": int(data["tilt_preset1"]), + "tilt_preset2": int(data["tilt_preset2"]), + "tilt_preset3": int(data["tilt_preset3"]), + } + new_cover.friendly_name = data["friendly_name"].strip() + if not new_cover.friendly_name: + return JsonResponse({"status": "error", "message": "friendly_name must not be empty."}, status=400) + new_cover.room = room + new_cover.entities_page = entities_page + new_cover.room_view_position = room_view_position + new_cover.entity_data = entity_data + new_cover.save() + send_mqttmanager_reload_command() + + return JsonResponse({"status": "ok"}, status=200) + except Exception as ex: + logging.exception(ex) + return JsonResponse({"status": "error"}, status=500) + + ################# # Scene section # ################# @@ -916,12 +1409,12 @@ def put_thermostat_entity(request): def entities_scenes(request): try: - # if request.method == "PUT": - return put_scene_entity(request) + if request.method == "PUT": + return put_scene_entity(request) except Exception as ex: logging.exception(ex) return JsonResponse({"status": "error"}, status=500) - return JsonResponse({"status": "error", "error": "Unsupported method"}, status=403) + return JsonResponse({"status": "error", "error": "Unsupported method"}, status=405) def put_scene_entity(request): @@ -942,15 +1435,27 @@ def put_scene_entity(request): if field not in data: return JsonResponse({"status": "error", "message": f"Missing required field: {field}"}, status=400) + if data["scene_type"] not in SCENE_TYPES: + return JsonResponse({"status": "error", "message": f"Unknown scene_type {data['scene_type']!r}. Expected one of: {', '.join(SCENE_TYPES)}."}, status=400) + if data["scene_type"] != "nspm_scene" and not data["backend_name"]: + return JsonResponse({"status": "error", "message": "backend_name is required for Home Assistant and OpenHAB scenes."}, status=400) + if "id" in data and data["id"]: new_scene = Scene.objects.get(id=int(data["id"])) else: new_scene = Scene() + room = Room.objects.get(id=int(data["room_id"])) if data["room_id"] else None + entities_page = RoomEntitiesPage.objects.get(id=int(data["entities_page_id"])) + room_view_position = int(data["room_view_position"]) + placement_error = get_placement_error(new_scene, room, entities_page, room_view_position) + if placement_error: + return JsonResponse({"status": "error", "message": placement_error}, status=400) + new_scene.friendly_name = data["friendly_name"] - new_scene.room = Room.objects.get(id=int(data["room_id"])) if data["room_id"] else None - new_scene.entities_page = RoomEntitiesPage.objects.get(id=int(data["entities_page_id"])) - new_scene.room_view_position = int(data["room_view_position"]) + new_scene.room = room + new_scene.entities_page = entities_page + new_scene.room_view_position = room_view_position new_scene.scene_type = data.get("scene_type", "") new_scene.backend_name = data.get("backend_name", "") diff --git a/docker/web/nspanelmanager/web/rest_v2/__init__.py b/docker/web/nspanelmanager/web/rest_v2/__init__.py new file mode 100644 index 000000000..1ee75307e --- /dev/null +++ b/docker/web/nspanelmanager/web/rest_v2/__init__.py @@ -0,0 +1,7 @@ +""" +The /rest/v2/* API: Django REST Framework views with a typed contract. + +drf-spectacular (development/CI only) generates docker/web/openapi.yaml from these views, and the +React UI's TypeScript types are generated from that file; see docker/web/generate_api.sh and +"Changing the REST API" in CONTRIBUTING.md. The older /rest/* views (web/rest.py) are unchanged. +""" diff --git a/docker/web/nspanelmanager/web/rest_v2/auth.py b/docker/web/nspanelmanager/web/rest_v2/auth.py new file mode 100644 index 000000000..1fe3d1280 --- /dev/null +++ b/docker/web/nspanelmanager/web/rest_v2/auth.py @@ -0,0 +1,20 @@ +from rest_framework import exceptions +from rest_framework.authentication import BaseAuthentication, CSRFCheck + + +class CsrfOnlyAuthentication(BaseAuthentication): + """Authenticates nobody, but rejects unsafe requests that fail Django's CSRF check. + + DRF marks its views csrf_exempt and leaves the CSRF check to SessionAuthentication, which only + runs it for logged-in users. NSPanelManager has no user accounts, so without this the /rest/v2/ + views would accept cross-site requests that CsrfViewMiddleware rejects for the plain views. + This is the same check SessionAuthentication.enforce_csrf() makes. + """ + + def authenticate(self, request): + check = CSRFCheck(lambda _request: None) + check.process_request(request) + reason = check.process_view(request, None, (), {}) + if reason: + raise exceptions.PermissionDenied(f"CSRF Failed: {reason}") + return None diff --git a/docker/web/nspanelmanager/web/rest_v2/global_settings.py b/docker/web/nspanelmanager/web/rest_v2/global_settings.py new file mode 100644 index 000000000..be9129729 --- /dev/null +++ b/docker/web/nspanelmanager/web/rest_v2/global_settings.py @@ -0,0 +1,390 @@ +""" +/rest/v2/settings: the global settings (web.models.Settings), typed. + +Storage is unchanged from the older /rest/settings and the settings page: one Settings row per key, its +value a string. MQTTManager reads the same rows (MqttManagerConfig::get_setting_with_default) and, at +startup, deletes any key missing from its _setting_key_map and adds missing keys with their defaults. So: + + * Values are written exactly as the legacy views write them: booleans as "True"/"False", integers as + str(int), everything else as given. + * Values are read the way MQTTManager reads them, e.g. a boolean is true only if it lower-cases to "true". + * A key is written only when its value changes, so a stored "true" (rather than "True") is left as it is + when a client sends back the value it was given. + * SettingsUpdateSerializer's fields are the keys this API knows. web/tests/test_rest_v2_settings.py checks + they match _setting_key_map in docker/MQTTManager/include/mqtt_manager_config/mqtt_manager_config.hpp. + +Per-panel settings (web.models.NSPanelSettings) are not part of this endpoint. +""" + +import logging +import re +from decimal import Decimal, InvalidOperation + +import environ +from django.db import transaction +from rest_framework import serializers +from rest_framework.response import Response +from rest_framework.views import APIView + +from web.apps import send_mqttmanager_reload_command +from web.models import Settings + +from . import rtttl +from .schema import extend_schema + +logger = logging.getLogger(__name__) + +# MQTTManager parses integers with std::stoi. +INT32_MAX = 2**31 - 1 + +# Never returned. GET reports "_set" instead; PATCH "" clears one. +SECRETS = ("home_assistant_token", "openhab_token", "mqtt_password") + +# Set by the add-on (web/apps.py) when running as a Home Assistant add-on, so not editable then. +ADDON_MANAGED = ("home_assistant_address", "home_assistant_token") + +ADDRESSES = ("home_assistant_address", "openhab_address") + + +def is_home_assistant_addon(): + # The same test views.get_base_data uses. The is_home_assistant_addon DB row is written by MQTTManager + # at startup, so it can lag behind the environment. + environment = environ.Env() + return "IS_HOME_ASSISTANT_ADDON" in environment and environment("IS_HOME_ASSISTANT_ADDON") == "true" + + +# The Strict* fields accept only the matching JSON type: DRF's own fields also take "5000" for an +# integer, "yes" or 1 for a boolean and 5 for a string, which would hide a client sending the wrong type. + + +class StrictBooleanField(serializers.BooleanField): + def to_internal_value(self, data): + if not isinstance(data, bool): + self.fail("invalid", input=data) + return data + + +class StrictIntegerField(serializers.IntegerField): + def to_internal_value(self, data): + if isinstance(data, bool) or not isinstance(data, int): + self.fail("invalid") + return super().to_internal_value(data) + + +class StrictCharField(serializers.CharField): + def __init__(self, **kwargs): + # Stored exactly as sent, as the legacy views do (a date format may end in a space). + kwargs.setdefault("trim_whitespace", False) + kwargs.setdefault("max_length", Settings._meta.get_field("value").max_length) + super().__init__(**kwargs) + + def to_internal_value(self, data): + if not isinstance(data, str): + self.fail("invalid") + return super().to_internal_value(data) + + +class TrimmedCharField(StrictCharField): + """Leading and trailing whitespace is removed, for values that are usually pasted (addresses, tokens): a + stray space would otherwise be stored and break the connection. Only whitespace is an error, not blank, + since blank clears a token.""" + + default_error_messages = {"whitespace": "Only whitespace was entered."} + + def to_internal_value(self, data): + value = super().to_internal_value(data) + trimmed = value.strip() + if value and not trimmed: + self.fail("whitespace") + return trimmed + + +class StrictChoiceField(serializers.ChoiceField): + def to_internal_value(self, data): + if not isinstance(data, str): + self.fail("invalid_choice", input=data) + return super().to_internal_value(data) + + +def _int(min_value=0, max_value=INT32_MAX, **kwargs): + return StrictIntegerField(min_value=min_value, max_value=max_value, **kwargs) + + +def _text(**kwargs): + kwargs.setdefault("allow_blank", True) + return StrictCharField(**kwargs) + + +_TRIMMED = "Leading and trailing whitespace is removed." + + +def _trimmed(help_text=None, **kwargs): + kwargs.setdefault("allow_blank", True) + return TrimmedCharField(help_text=f"{_TRIMMED} {help_text}" if help_text else _TRIMMED, **kwargs) + + +def _validate_rtttl(value): + # The panel plays nothing for RTTTL its parser rejects, and says so only in its own log. + try: + rtttl.parse(value) + except rtttl.RtttlError as error: + raise serializers.ValidationError(str(error)) + + +def _rtttl(help_text): + return _text(validators=[_validate_rtttl], help_text=help_text) + + +def _coordinate(limit): + def validate(value): + if value == "": + return + try: + number = Decimal(value) + except InvalidOperation: + raise serializers.ValidationError("Must be a decimal number.") from None + if not number.is_finite() or not -limit <= number <= limit: + raise serializers.ValidationError(f"Must be between -{limit} and {limit}.") + + return _trimmed(validators=[validate]) + + +# Whether a stored integer is one this API reports. MQTTManager's std::stoi would also accept " 50" or +# "50abc"; those are reported as null so the UI asks for a proper value instead of showing a guess. +# Used with fullmatch(), so the whole string must match (unlike ^...$, which also accepts "50\n"). +_INTEGER = re.compile(r"-?[0-9]+") + + +class SettingsUpdateSerializer(serializers.Serializer): + """A PATCH /rest/v2/settings body. Send only the settings that change.""" + + # Manager + manager_address = _trimmed() + manager_port = _int(1, 65535, allow_null=True, help_text="null (stored blank) until set.") + + # Logging + mqttmanager_log_level = StrictChoiceField(choices=["error", "warning", "info", "debug", "trace"]) + max_live_log_messages = _int() + max_log_buffer_size = _int() + + # Panels and lights + default_nspanel_type = StrictChoiceField(choices=["eu", "us"]) + color_temp_min = _int(1) + color_temp_max = _int(1) + reverse_color_temp = StrictBooleanField() + turn_on_behavior = StrictChoiceField(choices=["color_temp", "restore"]) + raise_to_100_light_level = _int(0, 100) + light_turn_on_brightness = _int(1, 100) + min_button_push_time = _int() + button_long_press_time = _int() + special_mode_trigger_time = _int() + special_mode_release_time = _int() + optimistic_mode = StrictBooleanField() + room_status_backoff_time = _int() + all_rooms_status_backoff_time = _int() + mqtt_wait_time = _int() + + # Screen and screensaver + screen_dim_level = _int(1, 100) + screensaver_dim_level = _int(0, 100) + screensaver_activation_timeout = _int() + screensaver_mode = StrictChoiceField(choices=["with_background", "without_background", "datetime_with_background", "datetime_without_background", "no_screensaver"]) + show_screensaver_inside_temperature = StrictBooleanField() + show_screensaver_outside_temperature = StrictBooleanField() + + # Weather and time + location_latitude = _coordinate(90) + location_longitude = _coordinate(180) + weather_update_interval = _int(1, help_text="Minutes between weather updates.") + weather_wind_speed_format = StrictChoiceField(choices=["kmh", "ms", "mph", "knots"]) + weather_precipitation_format = StrictChoiceField(choices=["mm", "inch"]) + outside_temp_sensor_provider = StrictChoiceField(choices=["home_assistant", "openhab"], allow_blank=True, help_text="Blank for no sensor.") + outside_temp_sensor_entity_id = _trimmed() + date_format = _text(allow_blank=False, help_text="strftime() format.") + clock_us_style = StrictBooleanField() + use_fahrenheit = StrictBooleanField() + + # Web interface + theme = _text(allow_blank=False) + + # Buzzer, as RTTTL. Checked with the panel firmware's parser rules (rest_v2/rtttl.py). + buzzer_sound_touch = _rtttl("RTTTL played on a screen touch. Blank for no sound.") + buzzer_sound_scene_activated = _rtttl("RTTTL played when a scene is activated from the panel. Blank plays the touch sound instead.") + buzzer_sound_scene_saved = _rtttl("RTTTL played when a scene is saved from the panel. Blank for no sound.") + + # MQTT + mqtt_server = _trimmed() + mqtt_port = _int(1, 65535) + mqtt_username = _text() + mqtt_password = _text(write_only=True, help_text="Blank clears the password.") + + # Home Assistant (read-only when running as the Home Assistant add-on) + home_assistant_address = _trimmed(help_text="A trailing / is removed.") + home_assistant_token = _trimmed(write_only=True, help_text="Blank clears the token.") + + # OpenHAB + openhab_address = _trimmed(help_text="A trailing / is removed.") + openhab_token = _trimmed(write_only=True, help_text="Blank clears the token.") + + def to_internal_value(self, data): + # Unknown keys are an error rather than ignored: the UI is built with the server, so one it + # doesn't know is a bug (or a typo) that a 200 would hide. + if isinstance(data, dict): + errors = {key: ["This setting is read-only."] if key in READ_ONLY else ["Unknown setting."] for key in data if key not in self.fields} + if errors: + raise serializers.ValidationError(errors) + return super().to_internal_value(data) + + def validate_home_assistant_address(self, value): + return value[:-1] if value.endswith("/") else value + + def validate_openhab_address(self, value): + return value[:-1] if value.endswith("/") else value + + def validate(self, attrs): + errors = {} + if is_home_assistant_addon(): + for key in ADDON_MANAGED: + if key in attrs: + errors[key] = ["Set by the Home Assistant add-on."] + + # Pairs are checked against the stored value of whichever half isn't being changed. + merged = {**read_settings(), **attrs} + for low, high in (("color_temp_min", "color_temp_max"),): + if (low in attrs or high in attrs) and merged.get(low) is not None and merged.get(high) is not None and merged[low] >= merged[high]: + errors[low if low in attrs else high] = [f"{low} must be less than {high}."] + + if errors: + raise serializers.ValidationError(errors) + return attrs + + +def _response_field(field): + # Every value can be null: a key MQTTManager hasn't written yet, or one stored in a form this API + # doesn't recognise (e.g. "abc" for an integer). + if isinstance(field, serializers.BooleanField): + return serializers.BooleanField(allow_null=True) + if isinstance(field, serializers.IntegerField): + return serializers.IntegerField(allow_null=True) + if isinstance(field, serializers.ChoiceField): + return serializers.ChoiceField(choices=list(field.choices), allow_blank=field.allow_blank, allow_null=True) + return serializers.CharField(allow_null=True) + + +def _build_settings_serializer(): + fields = {"__module__": __name__, "__doc__": "The global settings. Secrets are never returned, only whether each is set."} + for name, field in SettingsUpdateSerializer().get_fields().items(): + if name in SECRETS: + fields[f"{name}_set"] = serializers.BooleanField(help_text=f"Whether {name} is set.") + else: + fields[name] = _response_field(field) + fields["is_home_assistant_addon"] = serializers.BooleanField(help_text="Running as the Home Assistant add-on; home_assistant_* are read-only.") + return type("SettingsSerializer", (serializers.Serializer,), fields) + + +# GET and PATCH response: SettingsUpdateSerializer's fields, typed for reading. +SettingsSerializer = _build_settings_serializer() + +_FIELDS = SettingsUpdateSerializer().get_fields() + +# In GET responses but not writable: the secrets' *_set flags and is_home_assistant_addon. +READ_ONLY = frozenset(SettingsSerializer().fields) - frozenset(_FIELDS) + + +def _decode(name, raw): + """A stored string as the value this API reports, or None.""" + if raw is None: + return None + field = _FIELDS[name] + if isinstance(field, serializers.BooleanField): + # MqttManagerConfig::get_setting_with_default: boost::to_lower, then == "true". + return raw.lower() == "true" + if isinstance(field, serializers.IntegerField): + if field.allow_null and raw == "": + return None + return int(raw) if _INTEGER.fullmatch(raw) else None + if isinstance(field, serializers.ChoiceField): + return raw if raw in field.choices or (field.allow_blank and raw == "") else None + return raw + + +def _encode(name, value): + """A validated value as the string the legacy views store.""" + if value is None: + return "" + if isinstance(value, bool): + return "True" if value else "False" + return str(value) + + +def _stored_rows(): + return dict(Settings.objects.values_list("name", "value")) + + +def read_settings(): + """Every setting this API knows, decoded. Secrets are included (callers must not return them).""" + rows = _stored_rows() + return {name: (rows.get(name) if name in SECRETS else _decode(name, rows.get(name))) for name in _FIELDS} + + +def representation(): + values = read_settings() + for secret in SECRETS: + values[f"{secret}_set"] = (values.pop(secret) or "") != "" + values["is_home_assistant_addon"] = is_home_assistant_addon() + return SettingsSerializer(values).data + + +def write_settings(validated): + """Store the validated settings that differ from what is stored. Returns the names written.""" + changed = [] + with transaction.atomic(): + rows = _stored_rows() + for name, value in validated.items(): + raw = rows.get(name) + current = raw if name in SECRETS else _decode(name, raw) + if raw is not None and current == value: + continue + encoded = _encode(name, value) + if raw == encoded: + continue + if not Settings.objects.filter(name=name).update(value=encoded): + Settings.objects.create(name=name, value=encoded) + changed.append(name) + return changed + + +def _build_errors_serializer(): + messages = {"__module__": __name__, "__doc__": "A 400 from PATCH: error messages by setting name. Maps onto react-hook-form's setError()."} + for name in [*SettingsSerializer().fields, *_FIELDS, "non_field_errors"]: + messages[name] = serializers.ListField(child=serializers.CharField(), required=False) + # Instead of the above, for a body that isn't valid JSON. + messages["detail"] = serializers.CharField(required=False) + return type("SettingsErrorsSerializer", (serializers.Serializer,), messages) + + +SettingsErrorsSerializer = _build_errors_serializer() + + +class DetailSerializer(serializers.Serializer): + """DRF's error body for a request it rejects before validation, e.g. invalid JSON or a failed CSRF check.""" + + detail = serializers.CharField() + + +class SettingsView(APIView): + http_method_names = ["get", "patch", "head"] + + @extend_schema(responses=SettingsSerializer) + def get(self, request): + return Response(representation()) + + @extend_schema(request=SettingsUpdateSerializer, responses={200: SettingsSerializer, 400: SettingsErrorsSerializer, 403: DetailSerializer, 415: DetailSerializer}) + def patch(self, request): + serializer = SettingsUpdateSerializer(data=request.data, partial=True) + serializer.is_valid(raise_exception=True) + changed = write_settings(serializer.validated_data) + if changed: + logger.info("Settings changed: %s", ", ".join(changed)) + send_mqttmanager_reload_command() + return Response(representation()) diff --git a/docker/web/nspanelmanager/web/rest_v2/rooms.py b/docker/web/nspanelmanager/web/rest_v2/rooms.py new file mode 100644 index 000000000..3f400d2fa --- /dev/null +++ b/docker/web/nspanelmanager/web/rest_v2/rooms.py @@ -0,0 +1,267 @@ +import logging + +from django.db import transaction +from django.shortcuts import get_object_or_404 +from rest_framework import serializers, status +from rest_framework.response import Response +from rest_framework.views import APIView, exception_handler + +from web.apps import send_mqttmanager_reload_command +from web.models import NSPanel, Room + +from .schema import extend_schema + +logger = logging.getLogger(__name__) + +# The Strict* fields accept only the matching JSON type: DRF's own fields also take "5000" for an +# integer, "yes" or 1 for a boolean and 5 for a string, which would hide a client sending the wrong type. + + +class StrictIntegerField(serializers.IntegerField): + def to_internal_value(self, data): + if isinstance(data, bool) or not isinstance(data, int): + self.fail("invalid") + return super().to_internal_value(data) + + +class StrictCharField(serializers.CharField): + def __init__(self, **kwargs): + # Stored exactly as sent; TrimmedCharField below overrides this for the fields that want trimming. + kwargs.setdefault("trim_whitespace", False) + super().__init__(**kwargs) + + def to_internal_value(self, data): + if not isinstance(data, str): + self.fail("invalid") + return super().to_internal_value(data) + + +class TrimmedCharField(StrictCharField): + """Leading and trailing whitespace is removed. Only-whitespace input is an error, not blank, so a + stray space can't be stored in place of a real value. max_length applies to the trimmed value.""" + + default_error_messages = {"whitespace": "Only whitespace was entered."} + + def to_internal_value(self, data): + value = super().to_internal_value(data) + trimmed = value.strip() + if value and not trimmed: + self.fail("whitespace") + return trimmed + + +def _max_length(name): + return Room._meta.get_field(name).max_length + + +_TRIMMED = "Leading and trailing whitespace is removed." + + +class RoomSerializer(serializers.ModelSerializer): + """A room, for reading and (with partial=True) for PATCH.""" + + # Declared rather than left to ModelSerializer so they use the strict field classes. + friendly_name = TrimmedCharField(allow_blank=False, max_length=_max_length("friendly_name"), help_text=_TRIMMED) + # Not required on create: the model's default picks the next free number. + displayOrder = StrictIntegerField(min_value=1, max_value=65535, required=False) + room_temp_provider = TrimmedCharField(allow_blank=True, max_length=_max_length("room_temp_provider"), required=False, help_text=_TRIMMED) + room_temp_sensor = TrimmedCharField(allow_blank=True, max_length=_max_length("room_temp_sensor"), required=False, help_text=_TRIMMED) + + class Meta: + model = Room + fields = ["id", "friendly_name", "displayOrder", "room_temp_provider", "room_temp_sensor"] + read_only_fields = ["id"] + + def to_internal_value(self, data): + # Unknown keys are an error rather than ignored: the UI is built with the server, so one it + # doesn't know is a bug (or a typo) that a 200 would hide. + if isinstance(data, dict): + writable = {name for name, field in self.fields.items() if not field.read_only} + errors = {key: ["This field is read-only."] if key in self.fields else ["Unknown field."] for key in data if key not in writable} + if errors: + raise serializers.ValidationError(errors) + return super().to_internal_value(data) + + +def _build_errors_serializer(): + messages = {"__module__": __name__, "__doc__": "A 400 from POST/PATCH: error messages by field name. Maps onto react-hook-form's setError()."} + for name in [*RoomSerializer().fields, "non_field_errors"]: + messages[name] = serializers.ListField(child=serializers.CharField(), required=False) + # Instead of the above, for a body that isn't valid JSON. + messages["detail"] = serializers.CharField(required=False) + return type("RoomErrorsSerializer", (serializers.Serializer,), messages) + + +RoomErrorsSerializer = _build_errors_serializer() + + +def create_entity_pages_for_room(room): + from web.models import RoomEntitiesPage + + # Check if an existing scenes page exists, if it does not, create one + existing_pages = RoomEntitiesPage.objects.filter(room=room, is_scenes_page=True) + if not existing_pages.exists(): + page = RoomEntitiesPage() + page.room = room + page.display_order = 0 + page.page_type = 4 + page.is_scenes_page = True + page.save() + + # Check if an existing entities page exists, if it doesn not, create one. + existing_pages = RoomEntitiesPage.objects.filter(room=room, is_scenes_page=False) + if not existing_pages.exists(): + page = RoomEntitiesPage() + page.room = room + page.display_order = 0 + page.page_type = 4 + page.is_scenes_page = False + page.save() + + +class RoomDetailSerializer(serializers.Serializer): + """DRF's error body for a request it rejects before validation, e.g. invalid JSON or a failed CSRF check.""" + + detail = serializers.CharField() + + +def _error_message(data): + """Flatten DRF's error body ({"detail": ...}, {"field": [...]}, or a list) into one string.""" + if isinstance(data, dict): + parts = [] + for field, messages in data.items(): + if isinstance(messages, (list, tuple)): + messages = " ".join(str(m) for m in messages) + parts.append(str(messages) if field in ("detail", "non_field_errors") else f"{field}: {messages}") + return "; ".join(parts) + if isinstance(data, (list, tuple)): + return " ".join(str(m) for m in data) + return str(data) + + +def error_exception_handler(exc, context): + response = exception_handler(exc, context) + if response is not None: + response.data = {"status": "error", "message": _error_message(response.data)} + return response + + +class JsonErrorAPIView(APIView): + """An APIView whose errors are {"status": "error", "message": ...} instead of {"detail": ...}.""" + + def get_exception_handler(self): + return error_exception_handler + + +class RoomOrderItemSerializer(serializers.Serializer): + id = StrictIntegerField() + displayOrder = StrictIntegerField(min_value=0, max_value=65535) + + +class RoomOrderSerializer(serializers.Serializer): + # Wrapping in an object leaves room to add fields later, + # but you could also use many=True directly on RoomOrderItemSerializer. + rooms = RoomOrderItemSerializer(many=True, allow_empty=False) + + def validate_rooms(self, items): + ids = [item["id"] for item in items] + if len(ids) != len(set(ids)): + raise serializers.ValidationError("Duplicate room ids in request.") + + existing = set(Room.objects.filter(id__in=ids).values_list("id", flat=True)) + missing = set(ids) - existing + if missing: + raise serializers.ValidationError(f"Unknown room ids: {sorted(missing)}") + return items + + +class RoomListView(JsonErrorAPIView): + http_method_names = ["get", "post", "head", "patch"] + + @extend_schema(responses=RoomSerializer(many=True)) + def get(self, request): + rooms = Room.objects.order_by("displayOrder", "id") + return Response(RoomSerializer(rooms, many=True).data) + + @extend_schema( + request=RoomSerializer, + responses={201: RoomSerializer, 400: RoomErrorsSerializer, 403: RoomDetailSerializer, 415: RoomDetailSerializer}, + ) + def post(self, request): + serializer = RoomSerializer(data=request.data) + serializer.is_valid(raise_exception=True) + + room = serializer.save() + logger.info("Room created: %s", room) + + with transaction.atomic(): + create_entity_pages_for_room(room) + + send_mqttmanager_reload_command() + return Response(RoomSerializer(room).data, status=status.HTTP_201_CREATED) + + @extend_schema(request=RoomOrderSerializer, responses={200: RoomSerializer(many=True), 400: RoomErrorsSerializer, 403: RoomDetailSerializer, 415: RoomDetailSerializer}, operation_id="reorder_rooms") + def patch(self, request): + serializer = RoomOrderSerializer(data=request.data) + serializer.is_valid(raise_exception=True) + + new_orders = {item["id"]: item["displayOrder"] for item in serializer.validated_data["rooms"]} + + with transaction.atomic(): + rooms = list(Room.objects.select_for_update().filter(id__in=new_orders)) + for room in rooms: + room.displayOrder = new_orders[room.id] + Room.objects.bulk_update(rooms, ["displayOrder"]) + + logger.info("Room display order updated for ids: %s", sorted(new_orders)) + send_mqttmanager_reload_command() + + rooms = Room.objects.order_by("displayOrder", "id") + return Response(RoomSerializer(rooms, many=True).data) + + +class RoomDetailView(JsonErrorAPIView): + http_method_names = ["get", "patch", "delete", "head"] + + @extend_schema(responses={200: RoomSerializer, 404: RoomDetailSerializer}) + def get(self, request, pk): + return Response(RoomSerializer(get_object_or_404(Room, pk=pk)).data) + + @extend_schema( + request=RoomSerializer, + responses={200: RoomSerializer, 400: RoomErrorsSerializer, 403: RoomDetailSerializer, 404: RoomDetailSerializer, 415: RoomDetailSerializer}, + ) + def patch(self, request, pk): + with transaction.atomic(): + room = get_object_or_404(Room.objects.select_for_update(), pk=pk) + serializer = RoomSerializer(room, data=request.data, partial=True) + serializer.is_valid(raise_exception=True) + + # Write only what differs, so a client sending back the values it was given changes nothing. + changed = [name for name, value in serializer.validated_data.items() if getattr(room, name) != value] + if changed: + serializer.save() + if changed: + logger.info("Room %s changed: %s", room.id, ", ".join(changed)) + send_mqttmanager_reload_command() + return Response(RoomSerializer(room).data) + + @extend_schema(responses={204: None, 404: RoomDetailSerializer}) + def delete(self, request, pk): + room = get_object_or_404(Room, pk=pk) + try: + # Panels are not deleted with their room; move them to another room. + new_room = Room.objects.exclude(id=room.id).first() + if new_room: + NSPanel.objects.filter(room=room).update(room=new_room) + elif Room.objects.count() <= 1: + # Panels must belong to a room, so the last room can not be deleted. + return Response(status=status.HTTP_400_BAD_REQUEST, data={"status": "error", "message": "The last room cannot be deleted."}) + + logger.info("Room deleted: %s", room) + room.delete() + send_mqttmanager_reload_command() + return Response(status=status.HTTP_204_NO_CONTENT) + except Exception as ex: + logging.exception(ex) + return Response(status=status.HTTP_400_BAD_REQUEST, data={"status": "error", "message": ex}) diff --git a/docker/web/nspanelmanager/web/rest_v2/rtttl.py b/docker/web/nspanelmanager/web/rest_v2/rtttl.py new file mode 100644 index 000000000..5105d82ab --- /dev/null +++ b/docker/web/nspanelmanager/web/rest_v2/rtttl.py @@ -0,0 +1,178 @@ +""" +RTTTL parsing, a port of the panel firmware's RtttlParser (NSPanelManager-firmware, +firmware_espidf/lib/BuzzerManager/RtttlParser.cpp). The buzzer_sound_* settings are sent to the panels as +they are, and a panel plays nothing for a string its parser rejects, logging the error only in the panel's +own log. Parsing here lets the API reject such a string with a field error instead. + +It has to accept and reject exactly what the firmware does, and produce the same steps, so it follows the +C++ step by step, integer arithmetic included. web/tests/rtttl_vectors.json holds the firmware's output for +a set of inputs; both this module and the UI's src/lib/rtttl.ts are tested against it. +""" + +MAX_STEPS = 256 +MAX_TOTAL_DURATION_MS = 30000 + +_ARTICULATION_GAP_MS = 10 + +# Equal temperament frequencies (A4 = 440 Hz) of C8 through B8, in fixed point with 4 fractional bits. +_OCTAVE8_FRACTION_BITS = 4 +_OCTAVE8_FREQUENCIES = (66976, 70959, 75178, 79649, 84385, 89402, 94719, 100351, 106318, 112640, 119338, 126434) + +_SEMITONES = {"c": 0, "d": 2, "e": 4, "f": 5, "g": 7, "a": 9, "b": 11, "h": 11, "p": -1} +_VALID_DURATIONS = (1, 2, 4, 8, 16, 32, 64) + +# The firmware uses C's isspace/tolower/isdigit, which only know ASCII. str.isspace(), str.lower() and +# str.isdigit() know Unicode, so they aren't used. +_WHITESPACE = " \t\n\v\f\r" +_DIGITS = "0123456789" + + +class RtttlError(ValueError): + """The string can't be played. str() is a message for the user.""" + + +class RtttlTooLong(RtttlError): + """Valid RTTTL, but longer than MAX_STEPS or MAX_TOTAL_DURATION_MS.""" + + +def parse(rtttl): + """Parse an RTTTL string into a list of (frequency_hz, duration_ms), 0 Hz being a pause. + + Raises RtttlError (or its subclass RtttlTooLong) for any string the firmware would reject. + """ + text = "".join(c.lower() if "A" <= c <= "Z" else c for c in rtttl if c not in _WHITESPACE) + + sections = text.split(":") + if len(sections) != 3: + raise RtttlError("Expected name:defaults:notes, for example tick:d=64,o=7,b=625:b.") + _, defaults, notes = sections + + duration, octave, bpm = _parse_defaults(defaults) + + steps = [] + total_duration_ms = 0 + position = 1 + note_texts = notes.split(",") + for index, note in enumerate(note_texts): + if note == "" and index == len(note_texts) - 1 and steps: + break # Trailing comma + + step = _parse_note(note, duration, octave, bpm, position) + + # Two notes of the same pitch back to back would sound like one long note, so the firmware cuts + # a short gap from the end of the first. + if steps and step[0] > 0 and steps[-1][0] == step[0] and steps[-1][1] > _ARTICULATION_GAP_MS * 2: + steps[-1] = (steps[-1][0], steps[-1][1] - _ARTICULATION_GAP_MS) + steps.append((0, _ARTICULATION_GAP_MS)) + + steps.append(step) + total_duration_ms += step[1] + if len(steps) > MAX_STEPS: + raise RtttlTooLong(f"Too many notes: the panel plays at most {MAX_STEPS} steps.") + if total_duration_ms > MAX_TOTAL_DURATION_MS: + raise RtttlTooLong(f"Too long: the panel plays at most {MAX_TOTAL_DURATION_MS // 1000} seconds.") + position += 1 + + return steps + + +def _parse_defaults(section): + duration, octave, bpm = 4, 6, 63 + pos = 0 + while pos < len(section): + if pos + 2 > len(section) or section[pos + 1] != "=": + raise RtttlError("Defaults must look like d=4,o=6,b=63.") + key = section[pos] + pos += 2 + + pos, value = _parse_number(section, pos, 999) + if value is None: + raise RtttlError("Defaults must look like d=4,o=6,b=63.") + + if key == "d" and value in _VALID_DURATIONS: + duration = value + elif key == "o" and 1 <= value <= 8: + octave = value + elif key == "b" and 1 <= value <= 900: + bpm = value + elif key in "dob": + raise RtttlError({"d": "d must be 1, 2, 4, 8, 16, 32 or 64.", "o": "o must be 1 to 8.", "b": "b must be 1 to 900."}[key]) + else: + raise RtttlError(f"Unknown default '{key}': only d, o and b are allowed.") + + if pos < len(section): + if section[pos] != ",": + raise RtttlError("Defaults must look like d=4,o=6,b=63.") + pos += 1 + return duration, octave, bpm + + +def _parse_note(note, default_duration, default_octave, bpm, position): + def invalid(): + return RtttlError(f"Note {position} ('{note}') is not valid.") + + pos = 0 + duration = default_duration + if pos < len(note) and note[pos] in _DIGITS: + pos, duration = _parse_number(note, pos, 64) + if duration not in _VALID_DURATIONS: + raise invalid() + + if pos >= len(note) or note[pos] not in _SEMITONES: + raise invalid() + semitone = _SEMITONES[note[pos]] + pos += 1 + + if pos < len(note) and note[pos] == "#": + if semitone < 0: + raise invalid() + semitone += 1 + pos += 1 + + # The dot goes either before or after the octave, depending on who wrote the string. + dotted = False + if pos < len(note) and note[pos] == ".": + dotted = True + pos += 1 + + octave = default_octave + if pos < len(note) and note[pos] in _DIGITS: + octave = int(note[pos]) + if not 1 <= octave <= 8: + raise invalid() + pos += 1 + + if not dotted and pos < len(note) and note[pos] == ".": + dotted = True + pos += 1 + + if pos != len(note): + raise invalid() + + # A whole note lasts 4 beats. Dotted notes last 1.5 times as long. Round to the nearest ms. + numerator = 240000 * (3 if dotted else 2) + denominator = bpm * duration * 2 + duration_ms = (numerator + denominator // 2) // denominator + + if semitone < 0: + return (0, duration_ms) + + if semitone == 12: # B# is C in the next octave + semitone = 0 + octave += 1 + shift = _OCTAVE8_FRACTION_BITS + 8 - octave + return ((_OCTAVE8_FREQUENCIES[semitone] + (1 << (shift - 1))) >> shift, duration_ms) + + +def _parse_number(text, pos, max_value): + """Read the digits at pos. Returns (new pos, value), value None if there were none or it exceeds max_value.""" + start = pos + value = 0 + while pos < len(text) and text[pos] in _DIGITS: + value = value * 10 + int(text[pos]) + if value > max_value: + return pos, None + pos += 1 + if pos == start: + return pos, None + return pos, value diff --git a/docker/web/nspanelmanager/web/rest_v2/schema.py b/docker/web/nspanelmanager/web/rest_v2/schema.py new file mode 100644 index 000000000..8132a0a58 --- /dev/null +++ b/docker/web/nspanelmanager/web/rest_v2/schema.py @@ -0,0 +1,18 @@ +""" +drf-spectacular is installed for development and CI only (docker/web/requirements-dev.txt): it depends +on rpds-py, which has no wheel for every architecture the release image is built for. Views import its +decorators from here, and in the release image they do nothing. +""" + +try: + from drf_spectacular.utils import extend_schema +except ImportError: + + def extend_schema(*args, **kwargs): + def decorator(view): + return view + + return decorator + + +__all__ = ["extend_schema"] diff --git a/docker/web/nspanelmanager/web/settings_helper.py b/docker/web/nspanelmanager/web/settings_helper.py index d3f323444..f617ee6cb 100644 --- a/docker/web/nspanelmanager/web/settings_helper.py +++ b/docker/web/nspanelmanager/web/settings_helper.py @@ -3,7 +3,7 @@ from .models import NSPanel, NSPanelSettings, Settings -def get_setting_with_default(name) -> str: +def get_setting_with_default(name: str) -> str: objects = Settings.objects.filter(name=name) if objects.count() > 0: return str(objects.first().value) @@ -12,12 +12,12 @@ def get_setting_with_default(name) -> str: return "" -def does_setting_exist(name): +def does_setting_exist(name: str) -> bool: objects = Settings.objects.filter(name=name) return objects.count() > 0 -def set_setting_value(name, value): +def set_setting_value(name: str, value): Settings.objects.update_or_create(name=name, defaults={"value": value}) diff --git a/docker/web/nspanelmanager/web/static/base.js b/docker/web/nspanelmanager/web/static/base.js index 1738eb04a..241487255 100644 --- a/docker/web/nspanelmanager/web/static/base.js +++ b/docker/web/nspanelmanager/web/static/base.js @@ -16,25 +16,12 @@ function attach_cursor_change_events() { $(document).ready(function () { console.log("Document ready, attaching functions."); - stomp_subscribe("mqttmanager/events", (frame) => { - var json_data = JSON.parse(frame.body); - if (json_data.event_type) { - console.log("Triggering custom event: " + json_data.event_type); - const trigger_event = new CustomEvent(json_data.event_type, { - detail: json_data, - }); - document.getElementsByTagName("body")[0].dispatchEvent(trigger_event); - } - }); - // Listen for warnings from MQTTManager stomp_subscribe("mqttmanager/warnings", (data) => { var json = JSON.parse(data.body); var warnings = json.warnings; // Remove any removed warnings - $( - `#error_toast_container > .alert[data-error-source='${ERROR_TOAST_SOURCE_MANAGER}']`, - ).each(function () { + $(`#error_toast_container > .alert[data-error-source='${ERROR_TOAST_SOURCE_MANAGER}']`).each(function () { let found = false; let match_text = $(this).find(".toast-text").text(); for (let i = 0; i < warnings.length; i++) { @@ -60,11 +47,7 @@ $(document).ready(function () { }); if (!found) { - show_error_toast( - warnings[i].level, - warnings[i].text, - ERROR_TOAST_SOURCE_MANAGER, - ); + show_error_toast(warnings[i].level, warnings[i].text, ERROR_TOAST_SOURCE_MANAGER); } } }); @@ -81,32 +64,16 @@ $(document).ready(function () { if ("text" in obj) { show_error_toast(0, obj["text"], ERROR_TOAST_SOURCE_MANAGER); } else { - show_error_toast( - 0, - "Request error but no message specified.", - ERROR_TOAST_SOURCE_MANAGER, - ); + show_error_toast(0, "Request error but no message specified.", ERROR_TOAST_SOURCE_MANAGER); } } else { - show_error_toast( - 0, - "Unknown request error.", - ERROR_TOAST_SOURCE_MANAGER, - ); + show_error_toast(0, "Unknown request error.", ERROR_TOAST_SOURCE_MANAGER); } } else { - show_error_toast( - 0, - "Unknown request error.", - ERROR_TOAST_SOURCE_MANAGER, - ); + show_error_toast(0, "Unknown request error.", ERROR_TOAST_SOURCE_MANAGER); } } catch (error) { - show_error_toast( - 0, - "Error while processing error response from server.", - ERROR_TOAST_SOURCE_WEB_INTERFACE, - ); + show_error_toast(0, "Error while processing error response from server.", ERROR_TOAST_SOURCE_WEB_INTERFACE); } }); @@ -120,25 +87,18 @@ $(document).ready(function () { e.preventDefault(); dialog = document.getElementById("modal_confirm"); - document - .getElementById("modal_confirm_button") - .addEventListener("click", function handle_confirm_click(event) { - // Remove this event listener so that it doesn't trigger multiple times - event.currentTarget.removeEventListener("click", handle_confirm_click); - console.log("Sending request"); - document.getElementById("modal_confirm").close(); - e.detail.issueRequest(true); - }); + document.getElementById("modal_confirm_button").addEventListener("click", function handle_confirm_click(event) { + // Remove this event listener so that it doesn't trigger multiple times + event.currentTarget.removeEventListener("click", handle_confirm_click); + console.log("Sending request"); + document.getElementById("modal_confirm").close(); + e.detail.issueRequest(true); + }); - document - .getElementById("modal_confirm_cancel_button") - .addEventListener("click", function handle_confirm_cancel_click(event) { - event.currentTarget.removeEventListener( - "click", - handle_confirm_cancel_click, - ); - document.getElementById("modal_confirm").close(); - }); + document.getElementById("modal_confirm_cancel_button").addEventListener("click", function handle_confirm_cancel_click(event) { + event.currentTarget.removeEventListener("click", handle_confirm_cancel_click); + document.getElementById("modal_confirm").close(); + }); document.getElementById("modal_confirm_text").innerHTML = e.detail.question; dialog.showModal(); @@ -146,10 +106,7 @@ $(document).ready(function () { $("[data-dropdown-toggle]").click(function (e) { var toggle_id = $(this).data("dropdown-toggle"); - if ( - _last_dropdown_id_activated != "" && - _last_dropdown_id_activated != toggle_id - ) { + if (_last_dropdown_id_activated != "" && _last_dropdown_id_activated != toggle_id) { $("#" + _last_dropdown_id_activated).addClass("hidden"); } $("#" + toggle_id).toggleClass("hidden"); @@ -159,10 +116,7 @@ $(document).ready(function () { $("[data-collapse-toggle]").click(function (e) { var toggle_id = $(this).data("collapse-toggle"); - if ( - _last_collapse_id_activated != "" && - _last_collapse_id_activated != toggle_id - ) { + if (_last_collapse_id_activated != "" && _last_collapse_id_activated != toggle_id) { $("#" + _last_collapse_id_activated).addClass("max-md:hidden"); } $("#" + toggle_id).toggleClass("max-md:hidden"); @@ -181,9 +135,7 @@ $(document).ready(function () { var filename = $("#firmware") .val() .replace(/C:\\fakepath\\/i, ""); - $("#save_new_firmware_modal_subtext").html( - "Selected file: '" + filename + "'.", - ); + $("#save_new_firmware_modal_subtext").html("Selected file: '" + filename + "'."); $("#firmware_upload_submit_button").removeClass("btn-disabled"); }); @@ -191,9 +143,7 @@ $(document).ready(function () { var filename = $("#data_file") .val() .replace(/C:\\fakepath\\/i, ""); - $("#save_new_data_file_modal_subtext").html( - "Selected file: '" + filename + "'.", - ); + $("#save_new_data_file_modal_subtext").html("Selected file: '" + filename + "'."); $("#data_file_upload_submit_button").removeClass("btn-disabled"); }); @@ -201,9 +151,7 @@ $(document).ready(function () { var filename = $("#tft_file") .val() .replace(/C:\\fakepath\\/i, ""); - $("#save_new_tft_file_modal_subtext").html( - "Selected file: '" + filename + "'.", - ); + $("#save_new_tft_file_modal_subtext").html("Selected file: '" + filename + "'."); $("#tft_upload_submit_button").removeClass("btn-disabled"); }); @@ -234,46 +182,33 @@ $(document).ready(function () { }); $("#firmware_dragdrop_target").on("drop", (e) => { - if ( - e.originalEvent.dataTransfer && - e.originalEvent.dataTransfer.files.length - ) { + if (e.originalEvent.dataTransfer && e.originalEvent.dataTransfer.files.length) { e.preventDefault(); e.stopPropagation(); $("#firmware").prop("files", e.originalEvent.dataTransfer.files); var filename = $("#firmware") .val() .replace(/C:\\fakepath\\/i, ""); - $("#save_new_firmware_modal_subtext").html( - "Selected file: '" + filename + "'.", - ); + $("#save_new_firmware_modal_subtext").html("Selected file: '" + filename + "'."); $("#firmware_upload_submit_button").removeClass("btn-disabled"); } }); $("#data_file_dragdrop_target").on("drop", (e) => { - if ( - e.originalEvent.dataTransfer && - e.originalEvent.dataTransfer.files.length - ) { + if (e.originalEvent.dataTransfer && e.originalEvent.dataTransfer.files.length) { e.preventDefault(); e.stopPropagation(); $("#data_file").prop("files", e.originalEvent.dataTransfer.files); var filename = $("#data_file") .val() .replace(/C:\\fakepath\\/i, ""); - $("#save_new_data_file_modal_subtext").html( - "Selected file: '" + filename + "'.", - ); + $("#save_new_data_file_modal_subtext").html("Selected file: '" + filename + "'."); $("#data_file_upload_submit_button").removeClass("btn-disabled"); } }); $("#tft_dragdrop_target").on("drop", (e) => { - if ( - e.originalEvent.dataTransfer && - e.originalEvent.dataTransfer.files.length - ) { + if (e.originalEvent.dataTransfer && e.originalEvent.dataTransfer.files.length) { e.preventDefault(); e.stopPropagation(); $("#tft_file").prop("files", e.originalEvent.dataTransfer.files); diff --git a/docker/web/nspanelmanager/web/static/css/build.css b/docker/web/nspanelmanager/web/static/css/build.css index e03d1469c..f7c416209 100644 --- a/docker/web/nspanelmanager/web/static/css/build.css +++ b/docker/web/nspanelmanager/web/static/css/build.css @@ -30,9 +30,9 @@ default: false; prefersdark: false; color-scheme: "dark"; - --color-base-100: #111827; - --color-base-200: #0c111c; - --color-base-300: #06090e; + --color-base-100: #131c2e; + --color-base-200: #101624; + --color-base-300: #0a0e17; --color-base-content: oklch(96% 0.007 247.896); --color-primary: #01baef; --color-primary-content: oklch(14% 0.005 285.823); @@ -40,7 +40,7 @@ --color-secondary-content: oklch(14% 0.005 285.823); --color-accent: oklch(79% 0.209 151.711); --color-accent-content: oklch(14% 0.005 285.823); - --color-neutral: oklch(27% 0.041 260.031); + --color-neutral: #0d1014; --color-neutral-content: oklch(98% 0.003 247.858); --color-info: #0091ff; --color-info-content: oklch(14% 0.005 285.823); @@ -72,6 +72,40 @@ -moz-appearance: textfield; } +.animate-progress-indeterminate { + transform-origin: 0% 50%; + animation: progress-indeterminate 1s linear infinite; +} +@keyframes progress-indeterminate { + 0% { + transform: translateX(0) scaleX(0); + } + 40% { + transform: translateX(0) scaleX(0.4); + } + 100% { + transform: translateX(100%) scaleX(0.5); + } +} + +/*.tile-background { + -webkit-mask-image: radial-gradient(circle at 60% 5%, black 0%, black 15%, transparent 70%); + mask-image: radial-gradient(circle at 60% 5%, black 0%, black 15%, transparent 70%); +}*/ + +@keyframes tile-background { + 0%, + 12.5%, + 100% { + opacity: 1; + } + + 25%, + 82.5% { + opacity: 0; + } +} + /* @plugin "daisyui/theme" { name: "nspmwip"; default: false; @@ -106,3 +140,82 @@ --depth: 0; --noise: 0; } */ + +/*React Toastify classes*/ +/** Used to define container behavior: width, position: fixed etc... **/ +/*.Toastify__toast-container { +}*/ +/* +/** Used to define the position of the ToastContainer **/ +/*.Toastify__toast-container--top-left { +} +.Toastify__toast-container--top-center { +} +.Toastify__toast-container--top-right { +} +.Toastify__toast-container--bottom-left { +} +.Toastify__toast-container--bottom-center { +} +.Toastify__toast-container--bottom-right { +}*/ + +/** Classes for the displayed toast **/ +/*.Toastify__toast { +} +.Toastify__toast--rtl { +}*/ + +/** Used to position the icon **/ +/*.Toastify__toast-icon { +}*/ + +/** handle the notification color and the text color based on the theme **/ +/*.Toastify__toast-theme--dark { +} +.Toastify__toast-theme--light { +} +.Toastify__toast-theme--colored.Toastify__toast--default { +} +.Toastify__toast-theme--colored.Toastify__toast--info { +} +.Toastify__toast-theme--colored.Toastify__toast--success { +} +.Toastify__toast-theme--colored.Toastify__toast--warning { +} +.Toastify__toast-theme--colored.Toastify__toast--error { +} + +.Toastify__progress-bar { +} +.Toastify__progress-bar--rtl { +} +.Toastify__progress-bar-theme--light { +} +.Toastify__progress-bar-theme--dark { +} +.Toastify__progress-bar--info { +} +.Toastify__progress-bar--success { +} +.Toastify__progress-bar--warning { +} +.Toastify__progress-bar--error { +} +/** colored notifications share the same progress bar color **/ +/*.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info, +.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success, +.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning, +.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error { +}*/ + +/** Classes for the close button. Better use your own closeButton **/ +/*.Toastify__close-button { +} +.Toastify__close-button--default { +} +.Toastify__close-button > svg { +} +.Toastify__close-button:hover, +.Toastify__close-button:focus { +}*/ diff --git a/docker/web/nspanelmanager/web/static/css/main.css b/docker/web/nspanelmanager/web/static/css/main.css index 8fc9964fb..9007eb758 100644 --- a/docker/web/nspanelmanager/web/static/css/main.css +++ b/docker/web/nspanelmanager/web/static/css/main.css @@ -8,7 +8,6 @@ "Courier New", monospace; --color-red-50: oklch(97.1% 0.013 17.38); --color-red-500: oklch(63.7% 0.237 25.331); - --color-red-600: oklch(57.7% 0.245 27.325); --color-red-700: oklch(50.5% 0.213 27.518); --color-red-800: oklch(44.4% 0.177 26.899); --color-yellow-50: oklch(98.7% 0.026 102.212); @@ -17,7 +16,6 @@ --color-yellow-800: oklch(47.6% 0.114 61.907); --color-green-500: oklch(72.3% 0.219 149.579); --color-blue-50: oklch(97% 0.014 254.604); - --color-blue-100: oklch(93.2% 0.032 255.585); --color-blue-300: oklch(80.9% 0.105 251.813); --color-blue-500: oklch(62.3% 0.214 259.815); --color-blue-600: oklch(54.6% 0.245 262.881); @@ -51,6 +49,8 @@ --text-xs--line-height: calc(1 / 0.75); --text-sm: 0.875rem; --text-sm--line-height: calc(1.25 / 0.875); + --text-base: 1rem; + --text-base--line-height: calc(1.5 / 1); --text-lg: 1.125rem; --text-lg--line-height: calc(1.75 / 1.125); --text-xl: 1.25rem; @@ -78,6 +78,7 @@ --animate-ping: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; --animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; --blur-sm: 8px; + --blur-md: 12px; --default-transition-duration: 150ms; --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); --default-font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", @@ -2304,6 +2305,110 @@ right: 7%; } } + .\!steps { + display: inline-grid !important; + grid-auto-flow: column !important; + overflow: hidden !important; + overflow-x: auto !important; + counter-reset: step !important; + grid-auto-columns: 1fr !important; + .step { + display: grid !important; + grid-template-columns: repeat(1, minmax(0, 1fr)) !important; + grid-template-columns: auto !important; + grid-template-rows: repeat(2, minmax(0, 1fr)) !important; + grid-template-rows: 40px 1fr !important; + place-items: center !important; + text-align: center !important; + min-width: 4rem !important; + --step-bg: var(--color-base-300) !important; + --step-fg: var(--color-base-content) !important; + &:before { + top: calc(0.25rem * 0) !important; + grid-column-start: 1 !important; + grid-row-start: 1 !important; + height: calc(0.25rem * 2) !important; + width: 100% !important; + border: 1px solid !important; + color: var(--step-bg) !important; + background-color: var(--step-bg) !important; + --tw-content: "" !important; + content: var(--tw-content) !important; + margin-inline-start: -100% !important; + } + > .step-icon, &:not(:has(.step-icon)):after { + content: counter(step) !important; + counter-increment: step !important; + z-index: 1 !important; + color: var(--step-fg) !important; + background-color: var(--step-bg) !important; + border: 1px solid var(--step-bg) !important; + position: relative !important; + grid-column-start: 1 !important; + grid-row-start: 1 !important; + display: grid !important; + height: calc(0.25rem * 8) !important; + width: calc(0.25rem * 8) !important; + place-items: center !important; + place-self: center !important; + border-radius: calc(infinity * 1px) !important; + } + &:first-child:before { + content: none !important; + } + &[data-content]:after { + content: attr(data-content) !important; + } + } + .step-neutral { + + .step-neutral:before, &:after, > .step-icon { + --step-bg: var(--color-neutral) !important; + --step-fg: var(--color-neutral-content) !important; + } + } + .step-primary { + + .step-primary:before, &:after, > .step-icon { + --step-bg: var(--color-primary) !important; + --step-fg: var(--color-primary-content) !important; + } + } + .step-secondary { + + .step-secondary:before, &:after, > .step-icon { + --step-bg: var(--color-secondary) !important; + --step-fg: var(--color-secondary-content) !important; + } + } + .step-accent { + + .step-accent:before, &:after, > .step-icon { + --step-bg: var(--color-accent) !important; + --step-fg: var(--color-accent-content) !important; + } + } + .step-info { + + .step-info:before, &:after, > .step-icon { + --step-bg: var(--color-info) !important; + --step-fg: var(--color-info-content) !important; + } + } + .step-success { + + .step-success:before, &:after, > .step-icon { + --step-bg: var(--color-success) !important; + --step-fg: var(--color-success-content) !important; + } + } + .step-warning { + + .step-warning:before, &:after, > .step-icon { + --step-bg: var(--color-warning) !important; + --step-fg: var(--color-warning-content) !important; + } + } + .step-error { + + .step-error:before, &:after, > .step-icon { + --step-bg: var(--color-error) !important; + --step-fg: var(--color-error-content) !important; + } + } + } .steps { display: inline-grid; grid-auto-flow: column; @@ -3501,12 +3606,27 @@ .top-0 { top: calc(var(--spacing) * 0); } + .top-1 { + top: calc(var(--spacing) * 1); + } + .top-1\/3 { + top: calc(1/3 * 100%); + } .top-2 { top: calc(var(--spacing) * 2); } + .top-2\/3 { + top: calc(2/3 * 100%); + } + .top-3\/3 { + top: calc(3/3 * 100%); + } .right-0 { right: calc(var(--spacing) * 0); } + .right-1 { + right: calc(var(--spacing) * 1); + } .right-2 { right: calc(var(--spacing) * 2); } @@ -3562,12 +3682,39 @@ .bottom-0 { bottom: calc(var(--spacing) * 0); } + .bottom-2 { + bottom: calc(var(--spacing) * 2); + } .left-0 { left: calc(var(--spacing) * 0); } + .left-1\/8 { + left: calc(1/8 * 100%); + } .left-2 { left: calc(var(--spacing) * 2); } + .left-2\/8 { + left: calc(2/8 * 100%); + } + .left-3\/8 { + left: calc(3/8 * 100%); + } + .left-4\/8 { + left: calc(4/8 * 100%); + } + .left-5\/8 { + left: calc(5/8 * 100%); + } + .left-6\/8 { + left: calc(6/8 * 100%); + } + .left-7\/8 { + left: calc(7/8 * 100%); + } + .left-8\/8 { + left: calc(8/8 * 100%); + } .file-input { cursor: pointer; cursor: pointer; @@ -3729,6 +3876,83 @@ z-index: 1; margin-top: 6px; } + .\!stack { + display: inline-grid !important; + grid-template-columns: 3px 4px 1fr 4px 3px !important; + grid-template-rows: 3px 4px 1fr 4px 3px !important; + & > * { + height: 100% !important; + width: 100% !important; + &:nth-child(n + 2) { + width: 100% !important; + opacity: 70% !important; + } + &:nth-child(2) { + z-index: 2 !important; + opacity: 90% !important; + } + &:nth-child(1) { + z-index: 3 !important; + width: 100% !important; + } + } + &, &.stack-bottom { + > * { + grid-column: 3 / 4 !important; + grid-row: 3 / 6 !important; + &:nth-child(2) { + grid-column: 2 / 5 !important; + grid-row: 2 / 5 !important; + } + &:nth-child(1) { + grid-column: 1 / 6 !important; + grid-row: 1 / 4 !important; + } + } + } + &.stack-top { + > * { + grid-column: 3 / 4 !important; + grid-row: 1 / 4 !important; + &:nth-child(2) { + grid-column: 2 / 5 !important; + grid-row: 2 / 5 !important; + } + &:nth-child(1) { + grid-column: 1 / 6 !important; + grid-row: 3 / 6 !important; + } + } + } + &.stack-start { + > * { + grid-column: 1 / 4 !important; + grid-row: 3 / 4 !important; + &:nth-child(2) { + grid-column: 2 / 5 !important; + grid-row: 2 / 5 !important; + } + &:nth-child(1) { + grid-column: 3 / 6 !important; + grid-row: 1 / 6 !important; + } + } + } + &.stack-end { + > * { + grid-column: 3 / 6 !important; + grid-row: 3 / 4 !important; + &:nth-child(2) { + grid-column: 2 / 5 !important; + grid-row: 2 / 5 !important; + } + &:nth-child(1) { + grid-column: 1 / 4 !important; + grid-row: 1 / 6 !important; + } + } + } + } .stack { display: inline-grid; grid-template-columns: 3px 4px 1fr 4px 3px; @@ -3873,9 +4097,15 @@ .col-auto { grid-column: auto; } + .col-span-2 { + grid-column: span 2 / span 2; + } .col-span-3 { grid-column: span 3 / span 3; } + .col-span-4 { + grid-column: span 4 / span 4; + } .col-span-full { grid-column: 1 / -1; } @@ -4181,6 +4411,9 @@ grid-column-start: 1; white-space: nowrap; } + .col-start-2 { + grid-column-start: 2; + } .col-start-auto { grid-column-start: auto; } @@ -4738,6 +4971,9 @@ .me-2 { margin-inline-end: calc(var(--spacing) * 2); } + .me-6 { + margin-inline-end: calc(var(--spacing) * 6); + } .me-8 { margin-inline-end: calc(var(--spacing) * 8); } @@ -4853,6 +5089,9 @@ .mb-2 { margin-bottom: calc(var(--spacing) * 2); } + .mb-3 { + margin-bottom: calc(var(--spacing) * 3); + } .mb-4 { margin-bottom: calc(var(--spacing) * 4); } @@ -5516,8 +5755,8 @@ .h-12 { height: calc(var(--spacing) * 12); } - .h-14 { - height: calc(var(--spacing) * 14); + .h-20 { + height: calc(var(--spacing) * 20); } .h-24 { height: calc(var(--spacing) * 24); @@ -5525,6 +5764,9 @@ .h-28 { height: calc(var(--spacing) * 28); } + .h-34 { + height: calc(var(--spacing) * 34); + } .h-64 { height: calc(var(--spacing) * 64); } @@ -5555,6 +5797,9 @@ .h-full { height: 100%; } + .h-px { + height: 1px; + } .h-screen { height: 100vh; } @@ -5579,6 +5824,15 @@ .min-h-1 { min-height: calc(var(--spacing) * 1); } + .min-h-1\/3 { + min-height: calc(1/3 * 100%); + } + .min-h-10 { + min-height: calc(var(--spacing) * 10); + } + .min-h-60 { + min-height: calc(var(--spacing) * 60); + } .min-h-auto { min-height: auto; } @@ -5694,9 +5948,6 @@ .loading-xs { width: calc(var(--size-selector, 0.25rem) * 4); } - .w-1 { - width: calc(var(--spacing) * 1); - } .w-1\/2 { width: calc(1/2 * 100%); } @@ -5730,14 +5981,14 @@ .w-12 { width: calc(var(--spacing) * 12); } - .w-44 { - width: calc(var(--spacing) * 44); + .w-52 { + width: calc(var(--spacing) * 52); } .w-56 { width: calc(var(--spacing) * 56); } - .w-60 { - width: calc(var(--spacing) * 60); + .w-92 { + width: calc(var(--spacing) * 92); } .w-98 { width: calc(var(--spacing) * 98); @@ -5763,6 +6014,9 @@ .w-full { width: 100%; } + .w-px { + width: 1px; + } .w-screen { width: 100vw; } @@ -5802,6 +6056,12 @@ .min-w-0 { min-width: calc(var(--spacing) * 0); } + .min-w-84 { + min-width: calc(var(--spacing) * 84); + } + .min-w-180 { + min-width: calc(var(--spacing) * 180); + } .min-w-auto { min-width: auto; } @@ -6200,9 +6460,15 @@ .grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } + .grid-cols-8 { + grid-template-columns: repeat(8, minmax(0, 1fr)); + } .grid-cols-\[1fr_1fr_3rem_3rem\] { grid-template-columns: 1fr 1fr 3rem 3rem; } + .grid-cols-\[auto_1fr\] { + grid-template-columns: auto 1fr; + } .grid-cols-none { grid-template-columns: none; } @@ -6380,9 +6646,6 @@ .gap-6 { gap: calc(var(--spacing) * 6); } - .gap-12 { - gap: calc(var(--spacing) * 12); - } .space-y-4 { :where(& > :not(:last-child)) { --tw-space-y-reverse: 0; @@ -6450,14 +6713,9 @@ --tw-divide-y-reverse: 1; } } - .divide-gray-100 { + .divide-neutral { :where(& > :not(:last-child)) { - border-color: var(--color-gray-100); - } - } - .divide-neutral-content { - :where(& > :not(:last-child)) { - border-color: var(--color-neutral-content); + border-color: var(--color-neutral); } } .place-self-auto { @@ -6516,6 +6774,12 @@ .overflow-hidden { overflow: hidden; } + .overflow-visible { + overflow: visible; + } + .overflow-x-auto { + overflow-x: auto; + } .overflow-x-clip { overflow-x: clip; } @@ -6726,10 +6990,6 @@ border-top-left-radius: var(--radius-field); border-top-right-radius: var(--radius-field); } - .rounded-t-lg { - border-top-left-radius: var(--radius-lg); - border-top-right-radius: var(--radius-lg); - } .rounded-t-selector { border-top-left-radius: var(--radius-selector); border-top-right-radius: var(--radius-selector); @@ -6819,6 +7079,10 @@ border-top-right-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); } + .rounded-r-none { + border-top-right-radius: 0; + border-bottom-right-radius: 0; + } .rounded-r-selector { border-top-right-radius: var(--radius-selector); border-bottom-right-radius: var(--radius-selector); @@ -6871,10 +7135,6 @@ border-bottom-right-radius: var(--radius-field); border-bottom-left-radius: var(--radius-field); } - .rounded-b-lg { - border-bottom-right-radius: var(--radius-lg); - border-bottom-left-radius: var(--radius-lg); - } .rounded-b-selector { border-bottom-left-radius: var(--radius-selector); border-bottom-right-radius: var(--radius-selector); @@ -7128,9 +7388,6 @@ .border-black { border-color: var(--color-black); } - .border-error { - border-color: var(--color-error); - } .border-gray-200 { border-color: var(--color-gray-200); } @@ -7140,12 +7397,12 @@ .border-gray-700 { border-color: var(--color-gray-700); } - .border-info { - border-color: var(--color-info); - } .border-neutral { border-color: var(--color-neutral); } + .border-neutral-content { + border-color: var(--color-neutral-content); + } .border-neutral\/50 { border-color: color-mix(in oklab, var(--color-neutral) 50%, transparent); } @@ -7155,11 +7412,8 @@ .border-transparent { border-color: transparent; } - .border-warning { - border-color: var(--color-warning); - } - .border-t-base-300 { - border-top-color: var(--color-base-300); + .border-warning\/50 { + border-color: color-mix(in oklab, var(--color-warning) 50%, transparent); } .glass { border: none; @@ -7269,6 +7523,9 @@ .bg-\[var\(--my_variable\)\] { background-color: var(--my_variable); } + .bg-accent { + background-color: var(--color-accent); + } .bg-base-100 { background-color: var(--color-base-100); } @@ -7278,6 +7535,9 @@ .bg-base-300 { background-color: var(--color-base-300); } + .bg-base-content { + background-color: var(--color-base-content); + } .bg-black { background-color: var(--color-black); } @@ -7287,9 +7547,6 @@ .bg-blue-50 { background-color: var(--color-blue-50); } - .bg-blue-100 { - background-color: var(--color-blue-100); - } .bg-blue-700 { background-color: var(--color-blue-700); } @@ -7308,9 +7565,6 @@ .bg-gray-200 { background-color: var(--color-gray-200); } - .bg-green-500 { - background-color: var(--color-green-500); - } .bg-info { background-color: var(--color-info); } @@ -7638,6 +7892,9 @@ --size: calc(var(--size-selector, 0.25rem) * 4); } } + .p-0 { + padding: calc(var(--spacing) * 0); + } .p-1 { padding: calc(var(--spacing) * 1); } @@ -7656,6 +7913,9 @@ .p-6 { padding: calc(var(--spacing) * 6); } + .p-8 { + padding: calc(var(--spacing) * 8); + } .p-\[22\.2px\] { padding: 22.2px; } @@ -7805,9 +8065,6 @@ .pr-2 { padding-right: calc(var(--spacing) * 2); } - .pb-0 { - padding-bottom: calc(var(--spacing) * 0); - } .pb-1 { padding-bottom: calc(var(--spacing) * 1); } @@ -7817,6 +8074,12 @@ .pb-6 { padding-bottom: calc(var(--spacing) * 6); } + .pl-1 { + padding-left: calc(var(--spacing) * 1); + } + .pl-4 { + padding-left: calc(var(--spacing) * 4); + } .text-center { text-align: center; } @@ -7859,6 +8122,9 @@ .align-top { vertical-align: top; } + .font-mono { + font-family: var(--font-mono); + } .file-input-lg { --size: calc(var(--size-field, 0.25rem) * 12); font-size: 1.125rem; @@ -7907,6 +8173,10 @@ font-size: var(--text-5xl); line-height: var(--tw-leading, var(--text-5xl--line-height)); } + .text-base { + font-size: var(--text-base); + line-height: var(--tw-leading, var(--text-base--line-height)); + } .text-lg { font-size: var(--text-lg); line-height: var(--tw-leading, var(--text-lg--line-height)); @@ -8397,9 +8667,6 @@ .text-black { color: var(--color-black); } - .text-blue-600 { - color: var(--color-blue-600); - } .text-blue-800 { color: var(--color-blue-800); } @@ -8421,9 +8688,6 @@ .text-gray-700 { color: var(--color-gray-700); } - .text-gray-800 { - color: var(--color-gray-800); - } .text-gray-900 { color: var(--color-gray-900); } @@ -8454,24 +8718,30 @@ .text-pink-800 { color: var(--color-pink-800); } + .text-primary { + color: var(--color-primary); + } .text-primary-content { color: var(--color-primary-content); } .text-red-500 { color: var(--color-red-500); } - .text-red-600 { - color: var(--color-red-600); - } .text-red-800 { color: var(--color-red-800); } .text-success { color: var(--color-success); } + .text-success-content { + color: var(--color-success-content); + } .text-warning { color: var(--color-warning); } + .text-warning-content { + color: var(--color-warning-content); + } .text-white { color: var(--color-white); } @@ -8667,6 +8937,9 @@ .opacity-60 { opacity: 60%; } + .opacity-80 { + opacity: 80%; + } .mix-blend-plus-darker { mix-blend-mode: plus-darker; } @@ -8685,6 +8958,10 @@ --tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1)); box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); } + .shadow-md { + --tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 2px 4px -2px var(--tw-shadow-color, rgb(0 0 0 / 0.1)); + box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); + } .shadow-none { --tw-shadow: 0 0 #0000; box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); @@ -8720,6 +8997,9 @@ .shadow-initial { --tw-shadow-color: initial; } + .shadow-neutral\/3 { + --tw-shadow-color: color-mix(in oklab, var(--color-neutral) 3%, transparent); + } .inset-shadow-initial { --tw-inset-shadow-color: initial; } @@ -8799,6 +9079,11 @@ -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-md { + --tw-backdrop-blur: blur(var(--blur-md)); + -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-none { --tw-backdrop-blur: ; -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,); @@ -8809,6 +9094,16 @@ -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-brightness-75 { + --tw-backdrop-brightness: brightness(75%); + -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-brightness-80 { + --tw-backdrop-brightness: brightness(80%); + -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-grayscale { --tw-backdrop-grayscale: grayscale(100%); -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,); @@ -8828,6 +9123,11 @@ -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, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter !important; + transition-timing-function: var(--tw-ease, var(--default-transition-timing-function)) !important; + transition-duration: var(--tw-duration, var(--default-transition-duration)) !important; + } .transition { transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter; transition-timing-function: var(--tw-ease, var(--default-transition-timing-function)); @@ -8883,6 +9183,10 @@ --tw-duration: 500ms; transition-duration: 500ms; } + .duration-1000 { + --tw-duration: 1000ms; + transition-duration: 1000ms; + } .duration-\[20ms\] { --tw-duration: 20ms; transition-duration: 20ms; @@ -9347,6 +9651,27 @@ --timeline-row-start: minmax(0, 1fr); } } + .\[animation-delay\:-2s\] { + animation-delay: -2s; + } + .\[animation-delay\:-4s\] { + animation-delay: -4s; + } + .\[animation-delay\:-6s\] { + animation-delay: -6s; + } + .\[animation-delay\:-8s\] { + animation-delay: -8s; + } + .\[animation-duration\:8s\] { + animation-duration: 8s; + } + .\[animation-iteration-count\:infinite\] { + animation-iteration-count: infinite; + } + .\[animation-name\:tile-background\] { + animation-name: tile-background; + } .backface-hidden { backface-visibility: hidden; } @@ -9735,6 +10060,34 @@ } } } + .group-hover\:text-error { + &:is(:where(.group):hover *) { + @media (hover: hover) { + color: var(--color-error); + } + } + } + .group-hover\:text-info { + &:is(:where(.group):hover *) { + @media (hover: hover) { + color: var(--color-info); + } + } + } + .group-hover\:text-success { + &:is(:where(.group):hover *) { + @media (hover: hover) { + color: var(--color-success); + } + } + } + .group-hover\:text-warning { + &:is(:where(.group):hover *) { + @media (hover: hover) { + color: var(--color-warning); + } + } + } .group-hover\:text-yellow-500 { &:is(:where(.group):hover *) { @media (hover: hover) { @@ -9742,6 +10095,13 @@ } } } + .group-hover\/box\:opacity-5 { + &:is(:where(.group\/box):hover *) { + @media (hover: hover) { + opacity: 5%; + } + } + } .peer-focus\/default_page\:border-accent { &:is(:where(.peer\/default_page):focus ~ *) { border-color: var(--color-accent); @@ -9800,12 +10160,6 @@ border-bottom-width: 1px; } } - .after\:border-blue-100 { - &::after { - content: var(--tw-content); - border-color: var(--color-blue-100); - } - } .after\:border-gray-100 { &::after { content: var(--tw-content); @@ -9819,6 +10173,18 @@ content: var(--tw-content); } } + .first\:rounded-l-md { + &:first-child { + border-top-left-radius: var(--radius-md); + border-bottom-left-radius: var(--radius-md); + } + } + .last\:rounded-r-md { + &:last-child { + border-top-right-radius: var(--radius-md); + border-bottom-right-radius: var(--radius-md); + } + } .checked\:bg-success { &:checked { background-color: var(--color-success); @@ -9939,6 +10305,13 @@ } } } + .hover\:shadow-neutral\/10 { + &:hover { + @media (hover: hover) { + --tw-shadow-color: color-mix(in oklab, var(--color-neutral) 10%, transparent); + } + } + } .hover\:outline-1 { &:hover { @media (hover: hover) { @@ -10336,9 +10709,9 @@ width: calc(var(--spacing) * 44); } } - .md\:w-96 { + .md\:w-56 { @media (width >= 48rem) { - width: calc(var(--spacing) * 96); + width: calc(var(--spacing) * 56); } } .md\:w-\[22rem\] { @@ -10463,11 +10836,6 @@ width: calc(var(--spacing) * 12); } } - .lg\:grid-cols-3 { - @media (width >= 64rem) { - grid-template-columns: repeat(3, minmax(0, 1fr)); - } - } .rtl\:space-x-reverse { &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) { :where(& > :not(:last-child)) { @@ -10475,13 +10843,6 @@ } } } - .dark\:divide-gray-600 { - @media (prefers-color-scheme: dark) { - :where(& > :not(:last-child)) { - border-color: var(--color-gray-600); - } - } - } .dark\:border-gray-600 { @media (prefers-color-scheme: dark) { border-color: var(--color-gray-600); @@ -10497,11 +10858,6 @@ background-color: var(--color-blue-700); } } - .dark\:bg-blue-800 { - @media (prefers-color-scheme: dark) { - background-color: var(--color-blue-800); - } - } .dark\:bg-gray-500 { @media (prefers-color-scheme: dark) { background-color: var(--color-gray-500); @@ -10532,11 +10888,6 @@ background-color: var(--color-yellow-300); } } - .dark\:text-blue-500 { - @media (prefers-color-scheme: dark) { - color: var(--color-blue-500); - } - } .dark\:text-gray-50 { @media (prefers-color-scheme: dark) { color: var(--color-gray-50); @@ -10567,14 +10918,6 @@ color: var(--color-white); } } - .dark\:after\:border-blue-800 { - @media (prefers-color-scheme: dark) { - &::after { - content: var(--tw-content); - border-color: var(--color-blue-800); - } - } - } .dark\:after\:border-gray-500 { @media (prefers-color-scheme: dark) { &::after { @@ -10677,6 +11020,29 @@ } -moz-appearance: textfield; } +.animate-progress-indeterminate { + transform-origin: 0% 50%; + animation: progress-indeterminate 1s linear infinite; +} +@keyframes progress-indeterminate { + 0% { + transform: translateX(0) scaleX(0); + } + 40% { + transform: translateX(0) scaleX(0.4); + } + 100% { + transform: translateX(100%) scaleX(0.5); + } +} +@keyframes tile-background { + 0%, 12.5%, 100% { + opacity: 1; + } + 25%, 82.5% { + opacity: 0; + } +} @layer base { :where(:root),:root:has(input.theme-controller[value=light]:checked),[data-theme=light] { color-scheme: light; @@ -11983,9 +12349,9 @@ @layer base { :root:has(input.theme-controller[value=nspmwip]:checked),[data-theme="nspmwip"] { color-scheme: dark; - --color-base-100: #111827; - --color-base-200: #0c111c; - --color-base-300: #06090e; + --color-base-100: #131c2e; + --color-base-200: #101624; + --color-base-300: #0a0e17; --color-base-content: oklch(96% 0.007 247.896); --color-primary: #01baef; --color-primary-content: oklch(14% 0.005 285.823); @@ -11993,7 +12359,7 @@ --color-secondary-content: oklch(14% 0.005 285.823); --color-accent: oklch(79% 0.209 151.711); --color-accent-content: oklch(14% 0.005 285.823); - --color-neutral: oklch(27% 0.041 260.031); + --color-neutral: #0d1014; --color-neutral-content: oklch(98% 0.003 247.858); --color-info: #0091ff; --color-info-content: oklch(14% 0.005 285.823); diff --git a/docker/web/nspanelmanager/web/static/edit_nspanel.js b/docker/web/nspanelmanager/web/static/edit_nspanel.js index e75e41c80..4def9c193 100644 --- a/docker/web/nspanelmanager/web/static/edit_nspanel.js +++ b/docker/web/nspanelmanager/web/static/edit_nspanel.js @@ -1,44 +1,6 @@ var mac_address; var nspanel_id; -function push_log_message_to_view(data) { - var add_html = ""; - add_html += data.time; - var level_tag; - var level_tag_background; - if (data.level == "ERROR") { - level_tag_background = "bg-error"; - level_tag = 'ERROR'; - } else if (data.level == "WARNING") { - level_tag_background = "bg-warning"; - level_tag = 'WARNING'; - } else if (data.level == "INFO") { - level_tag_background = "bg-info"; - level_tag = 'INFO'; - } else if (data.level == "DEBUG") { - level_tag_background = "bg-neutral"; - level_tag = 'DEBUG'; - } else if (data.level == "TRACE") { - level_tag = 'TRACE'; - } else { - level_tag = '???UNKNOWN???'; - } - add_html += ``; - add_html += level_tag; - add_html += ""; - add_html += ""; - add_html += data.message; - add_html += ""; - add_html += ""; - - var row_count = $("#log_body tr").length; - if (row_count >= $("#max_live_log_messages").text()) { - $("#log_body tr:last-child").remove(); - } - - $("#log_body").prepend(add_html); -} - function update_shown_elements() { $("#button1_detached_mode_controls").addClass("hidden"); $("#button2_detached_mode_controls").addClass("hidden"); @@ -95,78 +57,38 @@ function update_shown_elements() { // Update shown lights depending on selected room var button1_selected_room_id = $("#button1_detached_mode_room").val(); - $( - ".button1_detached_mode_light_option[data-room-id='" + - button1_selected_room_id + - "']", - ).show(); - $( - ".button1_detached_mode_light_option[data-room-id!='" + - button1_selected_room_id + - "']", - ).hide(); + $(".button1_detached_mode_light_option[data-room-id='" + button1_selected_room_id + "']").show(); + $(".button1_detached_mode_light_option[data-room-id!='" + button1_selected_room_id + "']").hide(); // Check if selected button1_detached_mode_light option is visible, if not, select the first of the options. - if ( - $( - ".button1_detached_mode_light_option[data-room-id='" + - button1_selected_room_id + - "']:selected", - ).length == 0 - ) { - var button1_detached_light_first_value = $( - ".button1_detached_mode_light_option[data-room-id='" + - button1_selected_room_id + - "']:first", - ).val(); + if ($(".button1_detached_mode_light_option[data-room-id='" + button1_selected_room_id + "']:selected").length == 0) { + var button1_detached_light_first_value = $(".button1_detached_mode_light_option[data-room-id='" + button1_selected_room_id + "']:first").val(); if (button1_detached_light_first_value) { console.log( "Selected option for button1 detached light is no longer accessible in selected room, will select '", button1_detached_light_first_value, "' instead.", ); - $("#button1_detached_mode_light") - .val(button1_detached_light_first_value) - .change(); + $("#button1_detached_mode_light").val(button1_detached_light_first_value).change(); } else { $("#button1_detached_mode_light").val("").change(); } } var button2_selected_room_id = $("#button2_detached_mode_room").val(); - $( - ".button2_detached_mode_light_option[data-room-id='" + - button2_selected_room_id + - "']", - ).show(); - $( - ".button2_detached_mode_light_option[data-room-id!='" + - button2_selected_room_id + - "']", - ).hide(); + $(".button2_detached_mode_light_option[data-room-id='" + button2_selected_room_id + "']").show(); + $(".button2_detached_mode_light_option[data-room-id!='" + button2_selected_room_id + "']").hide(); // Check if selected button2_detached_mode_light option is visible, if not, select the first of the options. - if ( - $( - ".button2_detached_mode_light_option[data-room-id='" + - button2_selected_room_id + - "']:selected", - ).length == 0 - ) { - var button2_detached_light_first_value = $( - ".button2_detached_mode_light_option[data-room-id='" + - button2_selected_room_id + - "']:first", - ).val(); + if ($(".button2_detached_mode_light_option[data-room-id='" + button2_selected_room_id + "']:selected").length == 0) { + var button2_detached_light_first_value = $(".button2_detached_mode_light_option[data-room-id='" + button2_selected_room_id + "']:first").val(); if (button2_detached_light_first_value) { console.log( "Selected option for button2 detached light is no longer accessible in selected room, will select '", button2_detached_light_first_value, "' instead.", ); - $("#button2_detached_mode_light") - .val(button2_detached_light_first_value) - .change(); + $("#button2_detached_mode_light").val(button2_detached_light_first_value).change(); } else { $("#button2_detached_mode_light").val("").change(); } @@ -177,10 +99,7 @@ function update_shown_elements() { if (screensaver_mode == "global") { screensaver_mode = global_screensaver_mode; } - if ( - screensaver_mode == "datetime_with_background" || - screensaver_mode == "datetime_without_background" - ) { + if (screensaver_mode == "datetime_with_background" || screensaver_mode == "datetime_without_background") { $("#screensaver_outside_temperature_setting").removeClass("hidden"); } else { $("#screensaver_outside_temperature_setting").addClass("hidden"); @@ -216,16 +135,14 @@ function update_nspanel_example_view() { } $(document).ready(() => { - document - .querySelectorAll(".nspanel_settings_container") - .forEach((element) => { - // On message from manager on websocket. - element.addEventListener("htmx:afterRequest", (event) => { - if (event.detail.successful) { - window.Location = "/"; - } - }); + document.querySelectorAll(".nspanel_settings_container").forEach((element) => { + // On message from manager on websocket. + element.addEventListener("htmx:afterRequest", (event) => { + if (event.detail.successful) { + window.Location = "/"; + } }); + }); update_shown_elements(); $("#button1_mode").change(update_shown_elements); @@ -236,17 +153,4 @@ $(document).ready(() => { $("#panel_type").on("change", update_nspanel_example_view); update_nspanel_example_view(); // Update once manually depending on selected choice. - - stomp_subscribe("nspanel/" + nspanel_mac + "/log", (message) => { - push_log_message_to_view(JSON.parse(message.body)); - }); - - // Fetch log backtrace once. - stomp_subscribe("nspanel/" + nspanel_mac + "/log_backlog", (message) => { - JSON.parse(message.body).logs.forEach((message) => { - push_log_message_to_view(message); - }); - - stomp_unsubscribe("nspanel/" + nspanel_mac + "/log_backlog"); - }); }); diff --git a/docker/web/nspanelmanager/web/static/edit_room.css b/docker/web/nspanelmanager/web/static/edit_room.css deleted file mode 100644 index b31a364bf..000000000 --- a/docker/web/nspanelmanager/web/static/edit_room.css +++ /dev/null @@ -1,77 +0,0 @@ -.nspanel_view { - width: 455px; - height: 320px; - color: white; -} - -.add_item_icon { - padding-right: 1rem; -} - -#add_new_light_modal_panel { - overflow: scroll; -} - -#nspanel_room_view { - background-image: url('/static/panel_views/nspanel_room_view.png'); - position: relative; -} - -#nspanel_room_view>#room_name { - position: absolute; - font-size: x-large; - left: 125px; - top: 6px; -} - -#nspanel_room_view>.light_r1 { - position: absolute; - display: block; - font-size: large; - left: 4px; - width: 200px; - height: 27px; - cursor: pointer; - overflow: hidden; -} - -#nspanel_room_view>.light_r2 { - position: absolute; - display: block; - font-size: large; - left: 227px; - width: 200px; - height: 27px; - cursor: pointer; - overflow: hidden; -} - -#nspanel_room_view>#light1, -#light7 { - top: 55px; -} - -#nspanel_room_view>#light2, -#light8 { - top: 99px; -} - -#nspanel_room_view>#light3, -#light9 { - top: 142px; -} - -#nspanel_room_view>#light4, -#light10 { - top: 187px; -} - -#nspanel_room_view>#light5, -#light11 { - top: 232px; -} - -#nspanel_room_view>#light6, -#light12 { - top: 277px; -} diff --git a/docker/web/nspanelmanager/web/static/index_htmx.js b/docker/web/nspanelmanager/web/static/index_htmx.js deleted file mode 100644 index a57f1107f..000000000 --- a/docker/web/nspanelmanager/web/static/index_htmx.js +++ /dev/null @@ -1,65 +0,0 @@ -function show_dropdown_menu(e, element) { - var dropdown_id = $(element).attr("data-nspanel-dropdown-toggle"); - if (dropdown_id != "") { - $("#" + dropdown_id).toggleClass("hidden"); - if (e.stopPropagation) e.stopPropagation(); - } -} - -function show_popover(e) { - var popover_target = $(e).data("popover-target"); - if (popover_target) { - $("#" + popover_target).removeClass("invisible opacity-0"); - } -} - -function hide_popover(e) { - var popover_target = $(e).data("popover-target"); - if (popover_target) { - $("#" + popover_target).addClass("invisible opacity-0"); - } -} - -$(window).click(function () { - $(".nspanel-actions-menu-dropdown").addClass("hidden"); -}); - -function get_all_online_panel_macs() { - var panel_macs = []; - $(".nspanel_mac_container").each((index, obj) => { - var panel_mac = $(obj).data("nspanel-mac"); - let mac_selector = panel_mac.replaceAll(":", "\\:"); - console.log(panel_mac); - if ($("#panel_header_" + mac_selector).hasClass("bg-green-500")) { - panel_macs.push(panel_mac); - } - }); - return panel_macs; -} - -// Send a reboot command to all NSPanels -function reboot_all_nspanels() { - $(".nspanel_info_tag").each((index, obj) => { - stomp_send("nspanel/" + $(obj).data("nspanel-mac") + "/command", "reboot"); - }); -} - -// Send a firmware update command to all online NSPanels -function start_all_nspanels_firmware_update_ota() { - $(".nspanel_info_tag[data-nspanel-state='online']").each((index, obj) => { - stomp_send( - "nspanel/" + $(obj).data("nspanel-mac") + "/command", - "firmware_update", - ); - }); -} - -// Send a GUI update command to all online NSPanels -function start_all_nspanels_gui_update_ota() { - $(".nspanel_info_tag[data-nspanel-state='online']").each((index, obj) => { - stomp_send( - "nspanel/" + $(obj).data("nspanel-mac") + "/command", - "gui_update", - ); - }); -} diff --git a/docker/web/nspanelmanager/web/static/initial_setup.js b/docker/web/nspanelmanager/web/static/initial_setup.js deleted file mode 100644 index 4f35c71f7..000000000 --- a/docker/web/nspanelmanager/web/static/initial_setup.js +++ /dev/null @@ -1,100 +0,0 @@ -var current_step = "welcome"; - -var classes_step_completed = "flex w-full items-center text-blue-600 dark:text-blue-500 after:content-[''] after:w-full after:h-1 after:border-b after:border-blue-100 after:border-4 after:inline-block dark:after:border-blue-800"; -var classes_last_step_completed = "flex items-center text-blue-600 dark:text-blue-500"; -var classes_step_not_completed = "flex w-full items-center after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-100 after:border-4 after:inline-block dark:after:border-gray-500"; - -var classes_step_icon_completed = "flex items-center justify-center w-10 h-10 bg-blue-100 rounded-full lg:h-12 lg:w-12 dark:bg-blue-800 shrink-0"; -var classes_step_icon_not_completed = "flex items-center justify-center w-10 h-10 bg-gray-100 rounded-full lg:h-12 lg:w-12 dark:bg-gray-500 shrink-0"; - -function slideLeftOut(selector) { - var initial_height = $(selector).height(); - $(selector).css("height", initial_height); - $(selector).css("overflow", "hidden"); - $(selector).animate({width: 0, padding: 0, margin: 0, height: 0}, {duration: 500, queue: false}); -} - -function slideLeftIn(selector) { - $(selector).height("0px"); - $(selector).width("0px"); - $(selector).animate({width: "100%", height: "100%"}, {duration: 500, queue: false}); -} - -function initial_setup_next() { - if(current_step == "welcome") { - $("#welcome_screen").addClass("hidden"); - $("#initial_setup_manager_config").removeClass("hidden"); - $("#initial_step_welcome").attr("class", classes_step_completed); - $("#initial_step_welcome_icon").attr("class", classes_step_icon_completed); - current_step = "manager_config"; - } else if (current_step == "manager_config") { - if($("#manager_address").val() == "" || $("#manager_port").val() == "") { - alert("Both address and port are required."); - return false; - } - - $.post("/initial_setup_manager_config", { - manager_address: $("#manager_address").val(), - manager_port: $("#manager_port").val() - }); - - $("#initial_setup_manager_config").addClass("hidden"); - $("#mqtt_screen").removeClass("hidden"); - $("#initial_step_manager_config").attr("class", classes_step_completed); - $("#initial_step_manager_config_icon").attr("class", classes_step_icon_completed); - current_step = "mqtt_config"; - } else if (current_step == "mqtt_config") { - if($("#mqtt_server").val() == "" || $("#mqtt_port").val() == "") { - alert("Both address and port are required."); - return false; - } - - $.post("/initial_setup_mqtt_config", { - mqtt_server: $("#mqtt_server").val(), - mqtt_port: $("#mqtt_port").val(), - mqtt_username: $("#mqtt_username").val(), - mqtt_password: $("#mqtt_password").val() - }); - - $("#mqtt_screen").addClass("hidden"); - $("#home_assistant_screen").removeClass("hidden"); - $("#initial_step_mqtt_config").attr("class", classes_step_completed); - $("#initial_step_mqtt_config_icon").attr("class", classes_step_icon_completed); - current_step = "home_assistant_config"; - } else if (current_step == "home_assistant_config") { - if($("#home_assistant_address").val() != "" && $("#home_assistant_token").val() != "") { - $.post("/initial_setup_home_assistant_config", { - home_assistant_address: $("#home_assistant_address").val(), - home_assistant_token: $("#home_assistant_token").val() - }); - } - - $("#home_assistant_screen").addClass("hidden"); - $("#openhab_screen").removeClass("hidden"); - $("#initial_step_home_assistant_config").attr("class", classes_step_completed); - $("#initial_step_home_assistant_config_icon").attr("class", classes_step_icon_completed); - current_step = "openhab_config"; - } else if (current_step == "openhab_config") { - if($("#openhab_address").val() != "" && $("#openhab_token").val() != "") { - $.post("/initial_setup_openhab_config", { - openhab_address: $("#openhab_address").val(), - openhab_token: $("#openhab_token").val() - }); - } - - $("#openhab_screen").addClass("hidden"); - $("#finish_screen").removeClass("hidden"); - $("#initial_step_openhab_config").attr("class", classes_step_completed); - $("#initial_step_openhab_config_icon").attr("class", classes_step_icon_completed); - - // Also finish the last item on the list. - $("#initial_step_finished").attr("class", classes_last_step_completed); - $("#initial_step_finished_icon").attr("class", classes_step_icon_completed); - $("#next_button").html("Finish"); - current_step = "finish"; - } else if (current_step == "finish") { - $(".modal").addClass("hidden"); - } else { - console.error("Unknown step: " + current_step); - } -} \ No newline at end of file diff --git a/docker/web/nspanelmanager/web/static/settings.js b/docker/web/nspanelmanager/web/static/settings.js deleted file mode 100644 index 0bd8fb566..000000000 --- a/docker/web/nspanelmanager/web/static/settings.js +++ /dev/null @@ -1,21 +0,0 @@ -function update_shown_elements() { - // Update if screensaver outside temperature setting is available or not. - var screensaver_mode = $("#screensaver_mode").val(); - if (screensaver_mode == "global") { - screensaver_mode = global_screensaver_mode; - } - if ( - screensaver_mode == "datetime_with_background" || - screensaver_mode == "datetime_without_background" - ) { - $("#screensaver_outside_temperature_setting").removeClass("hidden"); - } else { - $("#screensaver_outside_temperature_setting").addClass("hidden"); - } -} - -$(document).ready(() => { - update_shown_elements(); - - $("#screensaver_mode").change(update_shown_elements); -}); diff --git a/docker/web/nspanelmanager/web/static/stomp_wrapper.js b/docker/web/nspanelmanager/web/static/stomp_wrapper.js index db9aa2812..06330e289 100644 --- a/docker/web/nspanelmanager/web/static/stomp_wrapper.js +++ b/docker/web/nspanelmanager/web/static/stomp_wrapper.js @@ -1,5 +1,6 @@ var stomp_subscription_callbacks = {}; var stomp_subscription_destinations = {}; +var last_stomp_messages = {}; function stomp_connected_callback() { console.log("Connected to STOMP. Resubscribing..."); $("#ws_connection_in_progress_notification").addClass("hidden"); @@ -46,6 +47,10 @@ function stomp_subscribe(topic, callback) { if (!stomp_subscription_callbacks[topic]["callbacks"].includes(callback)) { console.log("Attaching callback to existing subscription"); stomp_subscription_callbacks[topic]["callbacks"].push(callback); + + if (topic in last_stomp_messages) { + callback(last_stomp_messages[topic]); + } } } else { stomp_subscription_callbacks[topic] = { @@ -71,6 +76,7 @@ function stomp_subscribe(topic, callback) { } function stomp_unsubscribe(topic, callback) { + if (!stomp_subscription_callbacks[topic]) return; stomp_subscription_callbacks[topic]["callbacks"].splice(stomp_subscription_callbacks[topic]["callbacks"].indexOf(callback), 1); if (stomp_subscription_callbacks[topic]["callbacks"].length === 0) { @@ -81,6 +87,7 @@ function stomp_unsubscribe(topic, callback) { } function stomp_message_callback(message) { + last_stomp_messages[message.headers.destination] = message; stomp_subscription_callbacks[message.headers.destination]["callbacks"].forEach(function (callback) { callback(message); }); diff --git a/docker/web/nspanelmanager/web/templates/about.html b/docker/web/nspanelmanager/web/templates/about.html index bdc9f92e2..4f2ee526b 100644 --- a/docker/web/nspanelmanager/web/templates/about.html +++ b/docker/web/nspanelmanager/web/templates/about.html @@ -15,7 +15,7 @@ Version: %version% - NSPanel Manager is a software for easy management of multiple Sonoff NSPanels and intuitive use for all family members for the whole house. + NSPanel Manager is a software for easy management of multiple Sonoff NSPanels and intuitive use for all family members in the household. Thank you for your support and trust! - -
- Logs - - - - - - - - - - - -
TimeLevelMessage
-
+{% RC "NSPanelLogs" nspanel_mac=panel_info.data.mac_address %} {% endblock %} diff --git a/docker/web/nspanelmanager/web/templates/edit_room.html b/docker/web/nspanelmanager/web/templates/edit_room.html index b625fc31f..f28d6da92 100644 --- a/docker/web/nspanelmanager/web/templates/edit_room.html +++ b/docker/web/nspanelmanager/web/templates/edit_room.html @@ -7,107 +7,10 @@ {% block head %} {% load static %} - - - {% endblock %} {% block content %} {% load static %} - -
- {% csrf_token %} -
-
-

Settings for room '{{ room.friendly_name }}'

- {% for nspanel in nspanels %} - - {{ nspanel.status }} - {% component "nspanel_status_badge" id=nspanel.id %}{% endcomponent %} - - {% endfor %} -
- Help -
-
-
- General - -
- -
- - - - -
-
- - - -
- -
- - - - - - -
-
- {% component "alert" level="info" text="A specific temperature sensor is not a requirement but it can be used to provide a more accurate value on the screensaver. If no sensor is selected the temperature will be read using the built-in NTC thermistor. If a sensor is selected the panel will still report its temperature over MQTT to Home Assistant and OpenHAB." %}{% endcomponent %} - - {% if total_num_rooms <= 1 %} -
- {% component "alert" level="info" text="The last room cannot be deleted. Rename this or create another room before removing this one." %}{% endcomponent %} -
- {% endif %} -
- Delete - -
-
-
-
- -
-
- {% RC "EntitiesPagesView" room_id=room.id type="scene" %} -
-
- -
-
- {% RC "EntitiesPagesView" room_id=room.id type="entity" %} -
-
+{% RC "RoomPage" room_id=room.id %} {% endblock %} diff --git a/docker/web/nspanelmanager/web/templates/index.html b/docker/web/nspanelmanager/web/templates/index.html new file mode 100644 index 000000000..9951689f8 --- /dev/null +++ b/docker/web/nspanelmanager/web/templates/index.html @@ -0,0 +1,17 @@ +{% extends 'base.html' %} +{% load react_tags %} + +{% block head %} +{% load static %} + +{% endblock %} + +{% block content %} + + +{% if manager_address == "" %} + {% RC 'InitialSetup' opened=True isHomeAssistantAddon=is_home_assistant_addon %} +{% endif %} + +{% RC 'NSPanelsIndexView' %} +{% endblock %} diff --git a/docker/web/nspanelmanager/web/templates/index_htmx.html b/docker/web/nspanelmanager/web/templates/index_htmx.html deleted file mode 100644 index 628a399a1..000000000 --- a/docker/web/nspanelmanager/web/templates/index_htmx.html +++ /dev/null @@ -1,54 +0,0 @@ -{% extends 'base.html' %} - -{% block head %} -{% load static %} - - -{% if manager_address == "" %}{% endif %} -{% endblock %} - -{% block content %} - - -
-
- NSPanels -
-
- - - -
-
-
- {% include 'index_htmx_nspanels_section.html' %} -
-{% endblock %} diff --git a/docker/web/nspanelmanager/web/templates/index_htmx_nspanels_section.html b/docker/web/nspanelmanager/web/templates/index_htmx_nspanels_section.html deleted file mode 100644 index cc9881b2d..000000000 --- a/docker/web/nspanelmanager/web/templates/index_htmx_nspanels_section.html +++ /dev/null @@ -1,16 +0,0 @@ -
- {% if nspanels|length > 0 %} - -
- {% for nspanel in nspanels %} - {% include 'partial/nspanel_index_view_htmx.html' %} - {% endfor %} -
- {% else %} -
-
No NSPanel added to the manager. Getting started? Read the documentation. -
- {% endif %} -
diff --git a/docker/web/nspanelmanager/web/templates/modal-initial-setup.html b/docker/web/nspanelmanager/web/templates/modal-initial-setup.html index eb3c0d4b9..fa91058d8 100644 --- a/docker/web/nspanelmanager/web/templates/modal-initial-setup.html +++ b/docker/web/nspanelmanager/web/templates/modal-initial-setup.html @@ -288,7 +288,6 @@

You have successfully entered the values needed to get the manager up and running. The next step is to flash a panel and connect it. Good luck!

- diff --git a/docker/web/nspanelmanager/web/templates/modals/initial_setup/finished.html b/docker/web/nspanelmanager/web/templates/modals/initial_setup/finished.html deleted file mode 100644 index f611b63fe..000000000 --- a/docker/web/nspanelmanager/web/templates/modals/initial_setup/finished.html +++ /dev/null @@ -1,61 +0,0 @@ -{% load static %} - - - - - - - - diff --git a/docker/web/nspanelmanager/web/templates/modals/initial_setup/home_assistant.html b/docker/web/nspanelmanager/web/templates/modals/initial_setup/home_assistant.html deleted file mode 100644 index 87f90def8..000000000 --- a/docker/web/nspanelmanager/web/templates/modals/initial_setup/home_assistant.html +++ /dev/null @@ -1,74 +0,0 @@ -{% load static %} - - - - - - - - diff --git a/docker/web/nspanelmanager/web/templates/modals/initial_setup/manager_settings.html b/docker/web/nspanelmanager/web/templates/modals/initial_setup/manager_settings.html deleted file mode 100644 index 15aad28e7..000000000 --- a/docker/web/nspanelmanager/web/templates/modals/initial_setup/manager_settings.html +++ /dev/null @@ -1,99 +0,0 @@ -{% load static %} - - - - - - - - - diff --git a/docker/web/nspanelmanager/web/templates/modals/initial_setup/mqtt.html b/docker/web/nspanelmanager/web/templates/modals/initial_setup/mqtt.html deleted file mode 100644 index 60e65169c..000000000 --- a/docker/web/nspanelmanager/web/templates/modals/initial_setup/mqtt.html +++ /dev/null @@ -1,95 +0,0 @@ -{% load static %} - - - - - - - - diff --git a/docker/web/nspanelmanager/web/templates/modals/initial_setup/openhab.html b/docker/web/nspanelmanager/web/templates/modals/initial_setup/openhab.html deleted file mode 100644 index ca0f144da..000000000 --- a/docker/web/nspanelmanager/web/templates/modals/initial_setup/openhab.html +++ /dev/null @@ -1,70 +0,0 @@ -{% load static %} - - - - - - - - diff --git a/docker/web/nspanelmanager/web/templates/modals/initial_setup/welcome.html b/docker/web/nspanelmanager/web/templates/modals/initial_setup/welcome.html deleted file mode 100644 index 3f7313f38..000000000 --- a/docker/web/nspanelmanager/web/templates/modals/initial_setup/welcome.html +++ /dev/null @@ -1,59 +0,0 @@ -{% load static %} - - - - - - - - diff --git a/docker/web/nspanelmanager/web/templates/navbar.html b/docker/web/nspanelmanager/web/templates/navbar.html index 79785b7ba..0d13a76b8 100644 --- a/docker/web/nspanelmanager/web/templates/navbar.html +++ b/docker/web/nspanelmanager/web/templates/navbar.html @@ -36,6 +36,7 @@ -stomp_subscribe("nspanel/{{ nspanel.data.mac_address }}/status", (frame) => { - var data = JSON.parse(frame.body); - var info_tag = $(".nspanel_info_tag[data-nspanel-mac='{{ nspanel.data.mac_address }}']"); - info_tag.attr("data-nspanel-state", data.state); -}); - - -
-
-
- {% component "nspanel_status_header" id=nspanel.data.id %}{% endcomponent %} -
-
- - - - - - - {% if not nspanel.data.denied and not nspanel.data.accepted %} -
-
- NSPanel '{{ nspanel.data.friendly_name }}' is requesting access. -
-
-
- - -
-
-
- {% else %} - - -
- -
- -
- - {% component "nspanel_name" id=nspanel.data.id name=nspanel.data.friendly_name %}{% endcomponent %} - -
- -
- {% component "nspanel_status_text" id=nspanel.data.id %}{% endcomponent %} -
- {% component "nspanel_warnings" id=nspanel.data.id %}{% endcomponent %} - -
- -
-
-
- -
- {% component "nspanel_status_wifi_signal_strength" id=nspanel.data.id %}{% endcomponent %} -
-
-
- -
- {% component "nspanel_status_temperature" id=nspanel.data.id %}{% endcomponent %} - -
-
-
- -
- {% component "nspanel_status_ram_usage" id=nspanel.data.id %}{% endcomponent %} -
-
-
-
- - - -
-
-
- {% endif %} -
-
- -
diff --git a/docker/web/nspanelmanager/web/templates/partial/show_messages.html b/docker/web/nspanelmanager/web/templates/partial/show_messages.html index 6f8ec69e4..0de5e2be4 100644 --- a/docker/web/nspanelmanager/web/templates/partial/show_messages.html +++ b/docker/web/nspanelmanager/web/templates/partial/show_messages.html @@ -10,7 +10,9 @@
  • {{ message.title }}

    + {% autoescape off %} {{ message.message }} + {% endautoescape %}

    - - -
    - {% component "rooms_list" %}{% endcomponent %} -
    +{% RC "RoomsView" %} {% endblock %} diff --git a/docker/web/nspanelmanager/web/templates/settings.html b/docker/web/nspanelmanager/web/templates/settings.html index 896b25afe..d047f5961 100644 --- a/docker/web/nspanelmanager/web/templates/settings.html +++ b/docker/web/nspanelmanager/web/templates/settings.html @@ -1,619 +1,7 @@ {% extends 'base.html' %} - -{% block head %} -{% load static %} - - - - -{% endblock head %} +{% load react_tags %} {% block content %} - -
    - {% csrf_token %} -
    -

    Settings

    - Help -
    - {% component "alert" level="info" text="Changes to NSPanel settings on this page requires a reboot of all NSPanels to take effect." %}{% endcomponent %} -
    -
    - NSPanel Manager settings - - {% component "alert" level="warning" text="Manager address needs to be the IP address and only the IP address. Not hostname of the manager and not with http://." %}{% endcomponent %} - - -
    - -
    - - - - - -
    -
    - - -
    - -
    - - - - - -
    -
    - - -
    -
    -
    -
    - -
    - Logging options - - - Download - -
    - - -
    - -
    - - - - -
    -
    - - -
    - -
    - - - - -
    -
    - - -
    - -
    - - - - -
    -
    - - -
    -
    -
    -
    - Global NSPanel settings - - -
    - -
    - - - - -
    -
    - -
    - -
    - -
    - - - - -
    -
    - - -
    - -
    - - - - -
    -
    -
    - - -
    -

    Reverse color temperature slider

    -
      -
    • -
      - - -
      -
    • -
    • -
      - - -
      -
    • -
    -
    - - -
    -

    Turn on behavior

    -
      -
    • -
      - - -
      -
    • -
    • -
      - - -
      -
    • -
    -
    - - -
    - -
    - - - - -
    -
    - - -
    - -
    - -
    - - - - -
    -
    - - -
    - -
    - - - - -
    -
    -
    - - - -
    - -
    - -
    - - - - -
    -
    - - -
    - -
    - - - - -
    -
    -
    - - -
    - -
    - -
    - - - - -
    -
    - - -
    - -
    - - - - -
    -
    -
    - - -
    - -
    - - - - -
    -
    - - -
    - -
    - - - - -
    -
    - - -
    -

    Screensaver inside temperature

    -
      -
    • -
      - - -
      -
    • - -
    • -
      - - -
      -
    • -
    -
    - - -
    -

    Screensaver outside temperature

    -
      -
    • -
      - - -
      -
    • - -
    • -
      - - -
      -
    • -
    -
    - - -
    -

    Entity update mode

    -
      - -
    • -
      - - -
      -
    • - - -
    • -
      - - -
      -
    • -
    -
    - - - -
    - -
    - - - - -
    -
    - - -
    - -
    - - - - -
    -
    - - -
    - -
    - - - - -
    -
    - - -
    -
    -
    -
    - MQTT - - -
    - -
    - - - - -
    -
    - - -
    - -
    - - - - -
    -
    - -
    - -
    - -
    - - - - -
    -
    - - -
    - -
    - - - - -
    -
    -
    - - {% if mqtt_password.strip %} -
    - {% component "alert" level="info" text="MQTT password is configured but is not shown for security reasons. Enter a new password to change it or leave blank to keep the current password. If you wish to clear the stored password use the checkbox below." %}{% endcomponent %} -
    - - -
    -
    - {% endif %} - - -
    -
    -
    -
    - Home Assistant API - - {% if is_home_assistant_addon %} - {% component "alert" level="info" text="You are running NSPanel Manager as a Home Assistant addon. These settings are managed by Home Assistant for you and are therefore locked." %}{% endcomponent %} - {% endif %} - - - -
    - -
    - - - - -
    -
    - - -
    - -
    - - - - -
    -
    - - {% if home_assistant_token.strip and not is_home_assistant_addon %} -
    - {% component "alert" level="info" text="Home Assistant token is configured but is not shown for security reasons. Enter a new token to change it or leave blank to keep the current token. If you wish to clear the stored token use the checkbox below." %}{% endcomponent %} -
    - - -
    -
    - {% endif %} - - -
    -
    -
    -
    - OpenHAB API - - -
    - -
    - - - - -
    -
    - - -
    - -
    - - - - -
    -
    - - {% if openhab_token.strip %} -
    - {% component "alert" level="info" text="OpenHAB token is configured but is not shown for security reasons. Enter a new token to change it or leave blank to keep the current token. If you wish to clear the stored token use the checkbox below." %}{% endcomponent %} -
    - - -
    -
    - {% endif %} -
    -
    - -
    - -
    -
    +{% url 'download_mqttmanager_log' as log_url %} +{% RC "SettingsPage" logDownloadUrl=ingress_path|add:log_url %} {% endblock %} diff --git a/docker/web/nspanelmanager/web/tests.py b/docker/web/nspanelmanager/web/tests.py deleted file mode 100755 index 7ce503c2d..000000000 --- a/docker/web/nspanelmanager/web/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/docker/web/nspanelmanager/web/tests/__init__.py b/docker/web/nspanelmanager/web/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/docker/web/nspanelmanager/web/tests/harness.py b/docker/web/nspanelmanager/web/tests/harness.py new file mode 100644 index 000000000..f6d7d84e4 --- /dev/null +++ b/docker/web/nspanelmanager/web/tests/harness.py @@ -0,0 +1,271 @@ +""" +Shared test harness for the NSPanelManager Django app. + +Every test should inherit from NSPMTestCase. It gives you: + + * An isolated in-memory database per test (via django.test.TestCase). + * self.mqttmanager -- a stand-in for the MQTTManager process. Views that change + config call send_mqttmanager_reload_command(); here that is recorded instead of + SIGUSR1-ing whatever nspm_mqttmanager happens to be running on the host. Use + self.assertManagerReloaded() / self.assertManagerNotReloaded() to verify the + manager would have been told to pick up the change. + * self.home_assistant -- a fake Home Assistant /api/states endpoint. Add states with + self.home_assistant.add("light.kitchen", friendly_name="Kitchen"). + self.openhab_items -- the item list returned by the (faked) OpenHAB API. + * assertLoadableByManager(obj) -- checks a saved Entity/Scene has the shape MQTTManager + parses when it reads the database, e.g. entity_data["controller"] is a known string. + * snapshot(obj) / assertOnlyChanged(obj, before, {...}) -- checks an edit changed the + named fields (entity_data keys as "entity_data.") and nothing else. + * self.client -- a Django test client that returns 500 responses instead of raising, + so tests can assert that bad input is rejected the same way a browser would see it. + * Builders for common fixtures (make_room, make_light, make_scene, ...) and put_json / + post_json helpers that send requests the way the React UI does. +""" + +import json +import sys +from typing import ClassVar +from unittest import mock + +from django.db import connection +from django.test import Client, TestCase + +import web.apps +from web.models import Entity, NSPanel, Room, RoomEntitiesPage, Scene +from web.settings_helper import get_setting_with_default, set_setting_value + +# MQTTManager process-control helpers in web.apps. Modules import these by name +# (`from .apps import x`), which binds a separate reference, so every web.* module holding +# one is patched -- found at runtime so that adding or removing an import needs no change here. +_MANAGER_HOOKS = ("send_mqttmanager_reload_command", "restart_mqtt_manager_process", "start_mqtt_manager") + + +def _modules_holding(name): + original = getattr(web.apps, name) + return [module_name for module_name, module in list(sys.modules.items()) if (module_name == "web" or module_name.startswith("web.")) and getattr(module, name, None) is original] + + +class FakeMQTTManager: + """Records the process-control calls the web app makes towards MQTTManager.""" + + def __init__(self): + self.reloads = 0 + self.restarts = 0 + + def _reload(self): + self.reloads += 1 + + def _restart(self): + self.restarts += 1 + + def reset(self): + self.reloads = 0 + self.restarts = 0 + + +class FakeHomeAssistant: + """Serves a canned /api/states response to web.home_assistant_api.""" + + def __init__(self): + self.states = [] + self.fail = False + + def add(self, entity_id, friendly_name=None, state="off", **attributes): + if friendly_name is not None: + attributes["friendly_name"] = friendly_name + self.states.append({"entity_id": entity_id, "state": state, "attributes": attributes}) + + def _get(self, url, *args, **kwargs): + response = mock.Mock() + if self.fail or not url.endswith("/api/states"): + response.status_code = 500 + response.json.return_value = {} + else: + response.status_code = 200 + response.json.return_value = self.states + return response + + +class NSPMTestCase(TestCase): + def setUp(self): + super().setUp() + self.client = Client(raise_request_exception=False) + + # Data migrations seed a "Dummy room" (and pages for it). Start every test from an + # empty configuration so tests only see what they create themselves. + Room.objects.all().delete() + RoomEntitiesPage.objects.all().delete() + + self.mqttmanager = FakeMQTTManager() + hooks = { + "send_mqttmanager_reload_command": self.mqttmanager._reload, + "restart_mqtt_manager_process": self.mqttmanager._restart, + "start_mqtt_manager": self.mqttmanager._restart, + } + for name in _MANAGER_HOOKS: + for module in _modules_holding(name): + self._patch(f"{module}.{name}", side_effect=hooks[name]) + # Safety net: even if a new code path finds another way to reach these, never + # let a test signal or spawn a real MQTTManager on the host. + self._patch("web.apps.psutil.process_iter", return_value=[]) + self._patch("web.apps.subprocess.Popen", side_effect=AssertionError("Tests must not start MQTTManager")) + + self.home_assistant = FakeHomeAssistant() + set_setting_value("home_assistant_address", "http://home-assistant.test") + set_setting_value("home_assistant_token", "test-token") + + # OpenHAB is faked one level higher, at its item-listing functions. + self.openhab_items = [] + self._patch("web.openhab_api.get_all_openhab_items", side_effect=lambda *args, **kwargs: {"items": self.openhab_items, "errors": []}) + self._patch("web.openhab_api.get_all_openhab_scenes", side_effect=lambda *args, **kwargs: {"items": self.openhab_items, "errors": []}) + + # Every module shares the one `requests` module, so route all HTTP through here: + # Home Assistant goes to the fake, anything else fails the test. + self._patch("requests.get", side_effect=self._fake_http_get) + + self.client.get("/") + self.csrf_token = self.client.cookies["csrftoken"].value + + def _fake_http_get(self, url, *args, **kwargs): + if url.startswith(get_setting_with_default("home_assistant_address")): + return self.home_assistant._get(url, *args, **kwargs) + raise AssertionError(f"Unexpected network request from test: GET {url}") + + def _patch(self, target, **kwargs): + patcher = mock.patch(target, **kwargs) + patcher.start() + self.addCleanup(patcher.stop) + + # ---------------------------------------------------------------- assertions + + def assertManagerReloaded(self, times=None): + if times is None: + self.assertGreater(self.mqttmanager.reloads, 0, "Expected MQTTManager to be told to reload its config") + else: + self.assertEqual(self.mqttmanager.reloads, times, f"Expected MQTTManager to be told to reload {times} time(s)") + + def assertManagerNotReloaded(self): + self.assertEqual(self.mqttmanager.reloads, 0, "MQTTManager was told to reload although nothing should have changed") + + # MQTTManager reads entities straight from the SQLite database. These are the values its + # entity classes (docker/MQTTManager/include/{light,switch,button,thermostat,media_player,cover}/) + # accept for entity_data["controller"]; anything else is logged as an error, and a non-string throws. + MANAGER_CONTROLLERS: ClassVar = { + Entity.EntityType.LIGHT: {"home_assistant", "openhab"}, + Entity.EntityType.SWITCH: {"home_assistant", "openhab"}, + Entity.EntityType.BUTTON: {"home_assistant", "nspm"}, + Entity.EntityType.THERMOSTAT: {"home_assistant", "openhab"}, + Entity.EntityType.MEDIA_PLAYER: {"home_assistant"}, + Entity.EntityType.COVER: {"home_assistant", "openhab"}, + } + MANAGER_SCENE_TYPES: ClassVar = {"home_assistant", "openhab", "nspm_scene"} + + def assertLoadableByManager(self, obj): + """Check a saved Entity/Scene row has the shape MQTTManager expects to parse.""" + obj.refresh_from_db() + if isinstance(obj, Scene): + self.assertIn(obj.scene_type, self.MANAGER_SCENE_TYPES) + if obj.scene_type != "nspm_scene": + self.assertTrue(obj.backend_name, "Home Assistant/OpenHAB scenes need a backend_name to activate") + else: + # The ORM decodes the column for us, so check the stored text itself: that is what + # MQTTManager parses. A string that was JSON-encoded twice also fails here. + with connection.cursor() as cursor: + cursor.execute(f"SELECT entity_data FROM {Entity._meta.db_table} WHERE id = %s", [obj.id]) + (raw,) = cursor.fetchone() + try: + stored = json.loads(raw) + except (TypeError, ValueError): + self.fail(f"entity_data is not valid JSON: {raw!r}") + self.assertIsInstance(stored, dict, f"entity_data must be a JSON object, got {raw!r}") + controller = obj.entity_data.get("controller") + self.assertIsInstance(controller, str, f"entity_data['controller'] must be a string, got {controller!r}") + self.assertIn(controller, self.MANAGER_CONTROLLERS[obj.entity_type]) + self.assertIsNotNone(obj.entities_page_id) + self.assertLess(obj.room_view_position, obj.entities_page.page_type, "Entity is placed in a slot outside its page") + + def snapshot(self, obj): + """Every stored field of obj, with entity_data flattened to "entity_data.".""" + obj.refresh_from_db() + fields = {} + for field in obj._meta.concrete_fields: + value = getattr(obj, field.attname) + if field.attname == "entity_data": + fields.update({f"entity_data.{key}": item for key, item in value.items()}) + else: + fields[field.attname] = value + return fields + + def assertOnlyChanged(self, obj, before, expected): + """obj now differs from the snapshot before by exactly the fields in expected.""" + after = self.snapshot(obj) + changed = {key: after.get(key, "") for key in before.keys() | after.keys() if before.get(key, "") != after.get(key, "")} + self.assertEqual(changed, expected, "The edit changed fields other than the ones it was meant to") + + def assertRejected(self, response): + """The request was refused, however the view chose to signal it.""" + if response.status_code >= 400: + return + if response.get("Content-Type", "").startswith("application/json"): + self.assertEqual(response.json().get("status"), "error", f"Expected an error response, got: {response.content!r}") + return + self.fail(f"Expected request to be rejected, got HTTP {response.status_code}") + + # ---------------------------------------------------------------- builders + + def make_room(self, name="Room"): + """Create a room the way the UI does: with one entities page and one scenes page.""" + room = Room.objects.create(friendly_name=name) + RoomEntitiesPage.objects.create(room=room, page_type=4, is_scenes_page=True, display_order=0) + RoomEntitiesPage.objects.create(room=room, page_type=4, is_scenes_page=False, display_order=0) + return room + + def entities_page(self, room, index=0): + return RoomEntitiesPage.objects.filter(room=room, is_scenes_page=False).order_by("display_order")[index] + + def scenes_page(self, room, index=0): + return RoomEntitiesPage.objects.filter(room=room, is_scenes_page=True).order_by("display_order")[index] + + def global_scenes_page(self): + page, _ = RoomEntitiesPage.objects.get_or_create(room=None, is_scenes_page=True, defaults={"page_type": 4, "display_order": 0}) + return page + + def make_entity(self, room, entity_type=Entity.EntityType.LIGHT, name="Entity", page=None, slot=0, **entity_data): + entity_data.setdefault("controller", "home_assistant") + return Entity.objects.create( + room=room, + friendly_name=name, + entity_type=entity_type, + entities_page=page or self.entities_page(room), + room_view_position=slot, + entity_data=entity_data, + ) + + def make_light(self, room, name="Light", **kwargs): + return self.make_entity(room, Entity.EntityType.LIGHT, name, **kwargs) + + def make_scene(self, room, name="Scene", page=None, slot=0, scene_type="home_assistant", backend_name="scene.test"): + return Scene.objects.create( + room=room, + friendly_name=name, + scene_type=scene_type, + backend_name=backend_name, + entities_page=page or (self.scenes_page(room) if room else self.global_scenes_page()), + room_view_position=slot, + ) + + def make_panel(self, room, name="Panel", mac="AA:BB:CC:DD:EE:FF", **fields): + return NSPanel.objects.create(room=room, friendly_name=name, mac_address=mac, model=NSPanel.NSPanelModel.SONOFF, **fields) + + # ---------------------------------------------------------------- REST helpers + + def put_json(self, url, data): + """Send JSON the way the React UI does (fetch with a JSON body).""" + return self.client.put(url, json.dumps(data) if not isinstance(data, str) else data, content_type="application/json", HTTP_X_CSRFTOKEN=self.csrf_token) + + def patch_json(self, url, data): + """Send JSON the way the React UI does (fetch with a JSON body).""" + return self.client.patch(url, json.dumps(data) if not isinstance(data, str) else data, content_type="application/json", HTTP_X_CSRFTOKEN=self.csrf_token) + + def post_json(self, url, data): + return self.client.post(url, json.dumps(data) if not isinstance(data, str) else data, content_type="application/json", HTTP_X_CSRFTOKEN=self.csrf_token) diff --git a/docker/web/nspanelmanager/web/tests/rtttl_vectors.json b/docker/web/nspanelmanager/web/tests/rtttl_vectors.json new file mode 100644 index 000000000..7e1f51770 --- /dev/null +++ b/docker/web/nspanelmanager/web/tests/rtttl_vectors.json @@ -0,0 +1,2860 @@ +{ + "_comment": [ + "Expected output of the panel firmware's RtttlParser::parse() (NSPanelManager-firmware,", + "firmware_espidf/lib/BuzzerManager/RtttlParser.cpp as of #29), compiled on the host and run on each input.", + "steps are [frequency_hz, duration_ms], 0 Hz is a pause. error is 'invalid' (ESP_ERR_INVALID_ARG) or", + "'too_long' (ESP_ERR_INVALID_SIZE). Both the Python (web/rest_v2/rtttl.py) and TypeScript (src/lib/rtttl.ts)", + "ports are tested against this file. Regenerate it whenever the firmware parser changes." + ], + "vectors": [ + { + "rtttl": "tick:d=64,o=7,b=625:b", + "steps": [ + [ + 3951, + 6 + ] + ] + }, + { + "rtttl": "chime:d=32,o=6,b=190:g6,16p,32c7", + "steps": [ + [ + 1568, + 39 + ], + [ + 0, + 79 + ], + [ + 2093, + 39 + ] + ] + }, + { + "rtttl": "confirm:d=16,o=6,b=357:e,g", + "steps": [ + [ + 1319, + 42 + ], + [ + 1568, + 42 + ] + ] + }, + { + "rtttl": "rising:d=16,o=6,b=180:c,e,g", + "steps": [ + [ + 1047, + 83 + ], + [ + 1319, + 83 + ], + [ + 1568, + 83 + ] + ] + }, + { + "rtttl": "saved:d=16,o=6,b=200:c,e,g,8c7", + "steps": [ + [ + 1047, + 75 + ], + [ + 1319, + 75 + ], + [ + 1568, + 75 + ], + [ + 2093, + 150 + ] + ] + }, + { + "rtttl": "silent:d=64,o=6,b=900:p", + "steps": [ + [ + 0, + 4 + ] + ] + }, + { + "rtttl": "::c", + "steps": [ + [ + 1047, + 952 + ] + ] + }, + { + "rtttl": "name::c", + "steps": [ + [ + 1047, + 952 + ] + ] + }, + { + "rtttl": ":d=8:c", + "steps": [ + [ + 1047, + 476 + ] + ] + }, + { + "rtttl": ":o=4:c", + "steps": [ + [ + 262, + 952 + ] + ] + }, + { + "rtttl": ":b=120:c", + "steps": [ + [ + 1047, + 500 + ] + ] + }, + { + "rtttl": ":d=8,o=5,b=200:c", + "steps": [ + [ + 523, + 150 + ] + ] + }, + { + "rtttl": ":b=900:c", + "steps": [ + [ + 1047, + 67 + ] + ] + }, + { + "rtttl": ":b=1:c", + "error": "too_long" + }, + { + "rtttl": ":d=4,o=6,b=63:8c,8p,16e.7", + "steps": [ + [ + 1047, + 476 + ], + [ + 0, + 476 + ], + [ + 2637, + 357 + ] + ] + }, + { + "rtttl": ":d=4,o=6,b=63:8c,8p,16e7.", + "steps": [ + [ + 1047, + 476 + ], + [ + 0, + 476 + ], + [ + 2637, + 357 + ] + ] + }, + { + "rtttl": "::c#", + "steps": [ + [ + 1109, + 952 + ] + ] + }, + { + "rtttl": "::d#5", + "steps": [ + [ + 622, + 952 + ] + ] + }, + { + "rtttl": "::f#.", + "steps": [ + [ + 1480, + 1429 + ] + ] + }, + { + "rtttl": "::a#8", + "steps": [ + [ + 7459, + 952 + ] + ] + }, + { + "rtttl": "::h", + "steps": [ + [ + 1976, + 952 + ] + ] + }, + { + "rtttl": "::h5", + "steps": [ + [ + 988, + 952 + ] + ] + }, + { + "rtttl": "::b#", + "steps": [ + [ + 2093, + 952 + ] + ] + }, + { + "rtttl": "::b#8", + "steps": [ + [ + 8372, + 952 + ] + ] + }, + { + "rtttl": "::e#", + "steps": [ + [ + 1397, + 952 + ] + ] + }, + { + "rtttl": "::1c", + "steps": [ + [ + 1047, + 3810 + ] + ] + }, + { + "rtttl": "::2c", + "steps": [ + [ + 1047, + 1905 + ] + ] + }, + { + "rtttl": "::32c", + "steps": [ + [ + 1047, + 119 + ] + ] + }, + { + "rtttl": "::64c", + "steps": [ + [ + 1047, + 60 + ] + ] + }, + { + "rtttl": "::c1", + "steps": [ + [ + 33, + 952 + ] + ] + }, + { + "rtttl": "::c8", + "steps": [ + [ + 4186, + 952 + ] + ] + }, + { + "rtttl": "::p", + "steps": [ + [ + 0, + 952 + ] + ] + }, + { + "rtttl": "::4p.", + "steps": [ + [ + 0, + 1429 + ] + ] + }, + { + "rtttl": "::c.", + "steps": [ + [ + 1047, + 1429 + ] + ] + }, + { + "rtttl": "::c.6", + "steps": [ + [ + 1047, + 1429 + ] + ] + }, + { + "rtttl": "::c6.", + "steps": [ + [ + 1047, + 1429 + ] + ] + }, + { + "rtttl": "::8c#.5", + "steps": [ + [ + 554, + 714 + ] + ] + }, + { + "rtttl": "::8c#5.", + "steps": [ + [ + 554, + 714 + ] + ] + }, + { + "rtttl": "::c,c", + "steps": [ + [ + 1047, + 942 + ], + [ + 0, + 10 + ], + [ + 1047, + 952 + ] + ] + }, + { + "rtttl": "::c,c,c", + "steps": [ + [ + 1047, + 942 + ], + [ + 0, + 10 + ], + [ + 1047, + 942 + ], + [ + 0, + 10 + ], + [ + 1047, + 952 + ] + ] + }, + { + "rtttl": "::64c,64c", + "steps": [ + [ + 1047, + 50 + ], + [ + 0, + 10 + ], + [ + 1047, + 60 + ] + ] + }, + { + "rtttl": ":b=900:64c,64c", + "steps": [ + [ + 1047, + 4 + ], + [ + 1047, + 4 + ] + ] + }, + { + "rtttl": "::c,p,c", + "steps": [ + [ + 1047, + 952 + ], + [ + 0, + 952 + ], + [ + 1047, + 952 + ] + ] + }, + { + "rtttl": "::c,d,c", + "steps": [ + [ + 1047, + 952 + ], + [ + 1175, + 952 + ], + [ + 1047, + 952 + ] + ] + }, + { + "rtttl": "::c,c6", + "steps": [ + [ + 1047, + 942 + ], + [ + 0, + 10 + ], + [ + 1047, + 952 + ] + ] + }, + { + "rtttl": "::c5,c6", + "steps": [ + [ + 523, + 952 + ], + [ + 1047, + 952 + ] + ] + }, + { + "rtttl": ":d=32,b=900:c,c", + "steps": [ + [ + 1047, + 8 + ], + [ + 1047, + 8 + ] + ] + }, + { + "rtttl": " Tick : D=64, O=7, B=625 : B ", + "steps": [ + [ + 3951, + 6 + ] + ] + }, + { + "rtttl": "::C#,E", + "steps": [ + [ + 1109, + 952 + ], + [ + 1319, + 952 + ] + ] + }, + { + "rtttl": "::c,", + "steps": [ + [ + 1047, + 952 + ] + ] + }, + { + "rtttl": "::c,d,", + "steps": [ + [ + 1047, + 952 + ], + [ + 1175, + 952 + ] + ] + }, + { + "rtttl": "\tx:\td=8:\tc\n", + "steps": [ + [ + 1047, + 476 + ] + ] + }, + { + "rtttl": "x:d=64,o=6,b=900:c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d", + "steps": [ + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ], + [ + 1047, + 4 + ], + [ + 1175, + 4 + ] + ] + }, + { + "rtttl": "x:d=64,o=6,b=900:c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,c,d,e", + "error": "too_long" + }, + { + "rtttl": "x:d=1,o=6,b=8:c,d", + "error": "too_long" + }, + { + "rtttl": "x:d=1,o=6,b=8:c", + "steps": [ + [ + 1047, + 30000 + ] + ] + }, + { + "rtttl": "x:d=16,o=6,b=600:c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c", + "steps": [ + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 15 + ], + [ + 0, + 10 + ], + [ + 1047, + 25 + ] + ] + }, + { + "rtttl": "x:d=16,o=6,b=600:c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c", + "error": "too_long" + }, + { + "rtttl": "a,b=1::c", + "steps": [ + [ + 1047, + 952 + ] + ] + }, + { + "rtttl": "", + "error": "invalid" + }, + { + "rtttl": " ", + "error": "invalid" + }, + { + "rtttl": "c,d", + "error": "invalid" + }, + { + "rtttl": ":c", + "error": "invalid" + }, + { + "rtttl": "a:b:c:d", + "error": "invalid" + }, + { + "rtttl": "::", + "error": "invalid" + }, + { + "rtttl": "::,", + "error": "invalid" + }, + { + "rtttl": "::c,,d", + "error": "invalid" + }, + { + "rtttl": "::,c", + "error": "invalid" + }, + { + "rtttl": "::c,,", + "error": "invalid" + }, + { + "rtttl": "::x", + "error": "invalid" + }, + { + "rtttl": "::cc", + "error": "invalid" + }, + { + "rtttl": "::c##", + "error": "invalid" + }, + { + "rtttl": "::p#", + "error": "invalid" + }, + { + "rtttl": "::c9", + "error": "invalid" + }, + { + "rtttl": "::c0", + "error": "invalid" + }, + { + "rtttl": "::3c", + "error": "invalid" + }, + { + "rtttl": "::128c", + "error": "invalid" + }, + { + "rtttl": "::0c", + "error": "invalid" + }, + { + "rtttl": "::c..", + "error": "invalid" + }, + { + "rtttl": "::c.6.", + "error": "invalid" + }, + { + "rtttl": "::c66", + "error": "invalid" + }, + { + "rtttl": "::-c", + "error": "invalid" + }, + { + "rtttl": ":d=3:c", + "error": "invalid" + }, + { + "rtttl": ":d=128:c", + "error": "invalid" + }, + { + "rtttl": ":o=0:c", + "error": "invalid" + }, + { + "rtttl": ":o=9:c", + "error": "invalid" + }, + { + "rtttl": ":b=0:c", + "error": "invalid" + }, + { + "rtttl": ":b=901:c", + "error": "invalid" + }, + { + "rtttl": ":b=999:c", + "error": "invalid" + }, + { + "rtttl": ":b=1000:c", + "error": "invalid" + }, + { + "rtttl": ":x=1:c", + "error": "invalid" + }, + { + "rtttl": ":d:c", + "error": "invalid" + }, + { + "rtttl": ":d=:c", + "error": "invalid" + }, + { + "rtttl": ":d=4,:c", + "steps": [ + [ + 1047, + 952 + ] + ] + }, + { + "rtttl": ":d=4,,o=5:c", + "error": "invalid" + }, + { + "rtttl": ":d=4;o=5:c", + "error": "invalid" + }, + { + "rtttl": ":d=4o=5:c", + "error": "invalid" + }, + { + "rtttl": ":=4:c", + "error": "invalid" + }, + { + "rtttl": ":dd=4:c", + "error": "invalid" + }, + { + "rtttl": "::cé", + "error": "invalid" + }, + { + "rtttl": "é::c", + "steps": [ + [ + 1047, + 952 + ] + ] + } + ] +} diff --git a/docker/web/nspanelmanager/web/tests/test_entities.py b/docker/web/nspanelmanager/web/tests/test_entities.py new file mode 100644 index 000000000..05217cda4 --- /dev/null +++ b/docker/web/nspanelmanager/web/tests/test_entities.py @@ -0,0 +1,672 @@ +""" +Creating and editing entities through the /rest/entities/* endpoints, using the same +payloads the React "add/edit entity" modal sends. +""" + +from django.urls import reverse + +from web.models import Entity, Scene + +from .harness import NSPMTestCase + + +def placement(page, slot): + return {"room_id": page.room_id, "entities_page_id": page.id, "room_view_position": slot} + + +class EntityRESTTestCase(NSPMTestCase): + """Base for the per-type entity endpoints. Subclasses define url and payload().""" + + url = None + model = Entity + + def setUp(self): + super().setUp() + self.room = self.make_room("Kitchen") + self.page = self.entities_page(self.room) + + def payload(self, slot=0, **overrides): + raise NotImplementedError + + def fields(self, payload): + """The dict holding the entity fields (lights wrap them in "values").""" + return payload + + def save(self, payload): + return self.put_json(reverse(self.url), payload) + + def assertCreatesNothing(self, response): + self.assertRejected(response) + self.assertFalse(self.model.objects.exists()) + self.assertManagerNotReloaded() + + +class EntityRESTCommonTests: + """Checks shared by every entity type. A mixin so it is not collected and run on its own.""" + + def test_every_required_field_is_enforced(self): + for field in list(self.fields(self.payload())): + with self.subTest(missing=field): + payload = self.payload() + del self.fields(payload)[field] + response = self.save(payload) + self.assertEqual(response.status_code, 400) + self.assertIn(field, response.json()["message"]) + self.assertFalse(self.model.objects.exists()) + self.assertManagerNotReloaded() + + def test_unknown_room_or_page_is_rejected(self): + for field in ("room_id", "entities_page_id"): + with self.subTest(field=field): + self.assertRejected(self.save(self.payload(**{field: 999}))) + self.assertFalse(self.model.objects.exists()) + self.assertManagerNotReloaded() + + def test_malformed_body_is_rejected(self): + self.assertCreatesNothing(self.put_json(reverse(self.url), "not json")) + + def test_edit_updates_in_place(self): + self.save(self.payload(slot=1)) + obj = self.model.objects.get() + before = self.snapshot(obj) + self.mqttmanager.reset() + + response = self.save(self.payload(slot=1, id=obj.id, friendly_name="Renamed")) + + self.assertEqual(response.status_code, 200) + self.assertEqual(self.model.objects.count(), 1) + self.assertOnlyChanged(obj, before, {"friendly_name": "Renamed"}) + self.assertLoadableByManager(obj) + self.assertManagerReloaded(times=1) + + def test_edit_unknown_id_is_rejected(self): + self.assertCreatesNothing(self.save(self.payload(id=999))) + + def test_other_methods_are_rejected(self): + # POST carries a valid payload, so only the method check can stop it being saved. + self.assertEqual(self.client.get(reverse(self.url)).status_code, 405) + self.assertCreatesNothing(self.post_json(reverse(self.url), self.payload())) + + def test_add_to_occupied_slot_is_rejected(self): + self.save(self.payload(slot=0)) + + self.assertRejected(self.save(self.payload(slot=0))) + self.assertEqual(self.model.objects.count(), 1) + + def test_add_to_slot_outside_page_is_rejected(self): + self.assertCreatesNothing(self.save(self.payload(slot=7))) + + +class LightTests(EntityRESTCommonTests, EntityRESTTestCase): + url = "rest_entities_lights" + + def payload(self, slot=0, **overrides): + values = { + **placement(self.page, slot), + "controller": "home_assistant", + "type": "light", + "friendly_name": "Ceiling", + "can_color_temperature": True, + "can_dim": True, + "can_rgb": False, + "controlled_by_nspanel_main_page": True, + "home_assistant_name": "light.kitchen_ceiling", + "is_ceiling_light": True, + "openhab_item_color_temp": "", + "openhab_item_dimmer": "", + "openhab_item_switch": "", + "openhab_item_rgb": "", + } + return {"values": values | overrides} + + def fields(self, payload): + return payload["values"] + + def test_add_home_assistant_light(self): + response = self.save(self.payload(slot=2)) + + self.assertEqual(response.status_code, 200) + light = Entity.objects.get() + self.assertEqual(light.entity_type, Entity.EntityType.LIGHT) + self.assertEqual(light.friendly_name, "Ceiling") + self.assertEqual((light.room, light.entities_page, light.room_view_position), (self.room, self.page, 2)) + self.assertEqual(light.entity_data["home_assistant_name"], "light.kitchen_ceiling") + self.assertTrue(light.entity_data["can_dim"]) + self.assertTrue(light.entity_data["can_color_temperature"]) + self.assertFalse(light.entity_data["can_rgb"]) + self.assertTrue(light.entity_data["is_ceiling_light"]) + self.assertLoadableByManager(light) + self.assertManagerReloaded(times=1) + + def test_add_openhab_light(self): + payload = self.payload(controller="openhab", home_assistant_name="", can_dim=False, openhab_item_dimmer="Lamp_Switch") + + self.assertEqual(self.save(payload).status_code, 200) + + light = Entity.objects.get() + self.assertEqual(light.entity_data["openhab_control_mode"], "switch") + self.assertEqual(light.entity_data["openhab_item_dimmer"], "Lamp_Switch") + self.assertLoadableByManager(light) + + def test_boolean_flags_accept_strings(self): + self.save(self.payload(can_dim="false", can_rgb="true", is_ceiling_light="False")) + + data = Entity.objects.get().entity_data + self.assertEqual((data["can_dim"], data["can_rgb"], data["is_ceiling_light"]), (False, True, False)) + + def test_unknown_controller_is_rejected(self): + self.assertCreatesNothing(self.save(self.payload(controller="zigbee"))) + + def test_page_from_another_room_is_rejected(self): + other_page = self.entities_page(self.make_room("Lounge")) + + self.assertCreatesNothing(self.save(self.payload(entities_page_id=other_page.id))) + + def test_entity_saved_before_placement_checks_can_still_be_edited(self): + # Only a changed placement is validated, so rows already in a bad slot stay editable. + light = self.make_light(self.room, slot=7) + self.save(self.payload(slot=7, id=light.id)) + before = self.snapshot(light) + + response = self.save(self.payload(slot=7, id=light.id, friendly_name="Renamed")) + + self.assertEqual(response.status_code, 200) + self.assertOnlyChanged(light, before, {"friendly_name": "Renamed"}) + + +class SwitchTests(EntityRESTCommonTests, EntityRESTTestCase): + url = "rest_entities_switches" + + def payload(self, slot=0, **overrides): + return { + **placement(self.page, slot), + "controller": "home_assistant", + "type": "switch", + "friendly_name": "Fan", + "home_assistant_name": "switch.kitchen_fan", + "openhab_item_switch": "", + } | overrides + + def test_add_switch(self): + self.assertEqual(self.save(self.payload()).status_code, 200) + + switch = Entity.objects.get() + self.assertEqual(switch.entity_type, Entity.EntityType.SWITCH) + self.assertEqual(switch.entity_data["home_assistant_name"], "switch.kitchen_fan") + self.assertLoadableByManager(switch) + self.assertManagerReloaded(times=1) + + def test_add_openhab_switch(self): + self.save(self.payload(controller="openhab", home_assistant_name="", openhab_item_switch="Kitchen_Fan")) + + switch = Entity.objects.get() + self.assertEqual(switch.entity_data["openhab_item_switch"], "Kitchen_Fan") + self.assertLoadableByManager(switch) + + +class ButtonTests(EntityRESTCommonTests, EntityRESTTestCase): + url = "rest_entities_buttons" + + def payload(self, slot=0, **overrides): + return { + **placement(self.page, slot), + "controller": "nspm", + "type": "button", + "friendly_name": "Gate", + "home_assistant_name": "", + "mqtt_topic": "gate/cmd", + "mqtt_payload": "open", + } | overrides + + def test_add_mqtt_button(self): + self.assertEqual(self.save(self.payload()).status_code, 200) + + button = Entity.objects.get() + self.assertEqual(button.entity_type, Entity.EntityType.BUTTON) + self.assertEqual((button.entity_data["mqtt_topic"], button.entity_data["mqtt_payload"]), ("gate/cmd", "open")) + self.assertLoadableByManager(button) + self.assertManagerReloaded(times=1) + + def test_add_home_assistant_button(self): + self.save(self.payload(controller="home_assistant", home_assistant_name="input_button.doorbell", mqtt_topic="", mqtt_payload="")) + + button = Entity.objects.get() + self.assertEqual(button.entity_data["home_assistant_name"], "input_button.doorbell") + self.assertLoadableByManager(button) + + def test_openhab_controller_is_rejected(self): + # MQTTManager only has Home Assistant and MQTT ("nspm") buttons. + self.assertCreatesNothing(self.save(self.payload(controller="openhab"))) + + +class ThermostatTests(EntityRESTCommonTests, EntityRESTTestCase): + url = "rest_entities_thermostats" + + def payload(self, slot=0, **overrides): + return { + **placement(self.page, slot), + "controller": "home_assistant", + "type": "thermostat", + "friendly_name": "Heat pump", + "step_size": "0.5", + "use_current_temperature": "True", + "home_assistant_name": "climate.kitchen", + "openhab_fan_mode_item": "", + "openhab_hvac_mode_item": "", + "openhab_preset_mode_item": "", + "openhab_swing_mode_item": "", + "openhab_swingh_mode_item": "", + "openhab_temperature_item": "", + "fan_modes": [], + "hvac_modes": [{"value": "heat", "icon": "fire", "label": "Heat"}, {"value": "cool", "icon": "snow", "label": "Cool"}], + "preset_modes": [], + "swing_modes": [], + "swingh_modes": [], + } | overrides + + def test_add_thermostat(self): + self.assertEqual(self.save(self.payload()).status_code, 200) + + thermostat = Entity.objects.get() + self.assertEqual(thermostat.entity_type, Entity.EntityType.THERMOSTAT) + self.assertEqual(thermostat.entity_data["step_size"], 0.5) + self.assertEqual([m["value"] for m in thermostat.entity_data["hvac_modes"]], ["heat", "cool"]) + self.assertEqual(thermostat.entity_data["home_assistant_name"], "climate.kitchen") + self.assertIs(thermostat.entity_data["use_current_temperature"], True) + self.assertLoadableByManager(thermostat) + self.assertManagerReloaded(times=1) + + def test_mode_missing_a_field_is_rejected(self): + for field in ("value", "icon", "label"): + with self.subTest(missing=field): + mode = {"value": "heat", "icon": "fire", "label": "Heat"} + del mode[field] + self.assertEqual(self.save(self.payload(hvac_modes=[mode])).status_code, 400) + self.assertFalse(Entity.objects.exists()) + + def test_non_numeric_step_size_is_rejected(self): + self.assertCreatesNothing(self.save(self.payload(step_size="lots"))) + + +class MediaPlayerTests(EntityRESTCommonTests, EntityRESTTestCase): + url = "rest_entities_media_players" + + def payload(self, slot=0, **overrides): + # Only the required fields, so test_every_required_field_is_enforced covers exactly those. + return { + **placement(self.page, slot), + "controller": "home_assistant", + "friendly_name": "Kitchen speakers", + "home_assistant_name": "media_player.kitchen_zone", + } | overrides + + def form_payload(self, **overrides): + """Everything the React media player form sends.""" + return ( + self.payload() + | { + "id": None, + "type": "entity", + "entity_type": "media_player", + "volume_step": 5, + "source_volume_strategy": "none", + "source_entity_attribute": "", + "source_volume_attribute": "", + } + | overrides + ) + + def test_add_standalone_media_player(self): + self.assertEqual(self.save(self.payload()).status_code, 200) + + media_player = Entity.objects.get() + self.assertEqual(media_player.entity_type, Entity.EntityType.MEDIA_PLAYER) + self.assertEqual( + media_player.entity_data, + { + "controller": "home_assistant", + "home_assistant_name": "media_player.kitchen_zone", + "source_volume_strategy": "none", + "source_entity_attribute": "", + "source_volume_attribute": "", + "volume_step": 5, + }, + ) + self.assertLoadableByManager(media_player) + self.assertManagerReloaded(times=1) + + def test_add_with_the_payload_the_form_sends(self): + self.assertEqual(self.save(self.form_payload(volume_step=10)).status_code, 200) + + media_player = Entity.objects.get() + self.assertEqual(media_player.friendly_name, "Kitchen speakers") + self.assertEqual(media_player.entity_data["volume_step"], 10) + self.assertLoadableByManager(media_player) + + def test_add_room_player_that_says_which_player_feeds_it(self): + response = self.save(self.form_payload(source_volume_strategy="source_entity", source_entity_attribute="source_entity_id")) + + self.assertEqual(response.status_code, 200) + entity_data = Entity.objects.get().entity_data + self.assertEqual(entity_data["source_volume_strategy"], "source_entity") + self.assertEqual(entity_data["source_entity_attribute"], "source_entity_id") + + def test_add_room_player_that_reports_the_source_player_and_its_volume(self): + response = self.save(self.form_payload(source_volume_strategy="player_attributes", source_entity_attribute="source_entity_id", source_volume_attribute="source_volume")) + + self.assertEqual(response.status_code, 200) + entity_data = Entity.objects.get().entity_data + self.assertEqual(entity_data["source_volume_strategy"], "player_attributes") + self.assertEqual(entity_data["source_entity_attribute"], "source_entity_id") + self.assertEqual(entity_data["source_volume_attribute"], "source_volume") + + def test_source_attributes_are_trimmed(self): + self.save(self.form_payload(source_volume_strategy="player_attributes", source_entity_attribute=" source_entity_id ", source_volume_attribute="\tsource_volume\n")) + + entity_data = Entity.objects.get().entity_data + self.assertEqual(entity_data["source_entity_attribute"], "source_entity_id") + self.assertEqual(entity_data["source_volume_attribute"], "source_volume") + + def test_multi_room_setup_without_its_attributes_is_rejected(self): + cases = { + "source_entity without a source player attribute": {"source_volume_strategy": "source_entity"}, + "source_entity with a blank source player attribute": {"source_volume_strategy": "source_entity", "source_entity_attribute": " "}, + "player_attributes without a source player attribute": {"source_volume_strategy": "player_attributes", "source_volume_attribute": "source_volume"}, + "player_attributes without a source volume attribute": {"source_volume_strategy": "player_attributes", "source_entity_attribute": "source_entity_id"}, + } + for case, overrides in cases.items(): + with self.subTest(case): + self.assertEqual(self.save(self.form_payload(**overrides)).status_code, 400) + self.assertFalse(Entity.objects.exists()) + self.assertManagerNotReloaded() + + def test_unknown_source_volume_strategy_is_rejected(self): + self.assertCreatesNothing(self.save(self.form_payload(source_volume_strategy="matrix", source_entity_attribute="source_entity_id"))) + + def test_non_string_source_settings_are_rejected(self): + for field in ("source_volume_strategy", "source_entity_attribute", "source_volume_attribute"): + with self.subTest(field=field): + self.assertEqual(self.save(self.form_payload(**{field: 1})).status_code, 400) + self.assertFalse(Entity.objects.exists()) + + def test_volume_step_must_be_a_whole_percentage(self): + for volume_step in (0, 101, -5, 2.5, "5", True, None): + with self.subTest(volume_step=volume_step): + response = self.save(self.form_payload(volume_step=volume_step)) + if volume_step is None: + # null means "not given" and falls back to the default, like leaving it out. + self.assertEqual(response.status_code, 200) + Entity.objects.all().delete() + else: + self.assertEqual(response.status_code, 400) + self.assertFalse(Entity.objects.exists()) + + def test_volume_step_limits_are_accepted(self): + for slot, volume_step in enumerate((1, 100)): + with self.subTest(volume_step=volume_step): + self.assertEqual(self.save(self.form_payload(volume_step=volume_step) | placement(self.page, slot)).status_code, 200) + self.assertEqual(sorted(e.entity_data["volume_step"] for e in Entity.objects.all()), [1, 100]) + + def test_edit_without_volume_step_keeps_it(self): + self.save(self.form_payload(volume_step=20)) + media_player = Entity.objects.get() + + self.assertEqual(self.save(self.payload(id=media_player.id, friendly_name="Renamed")).status_code, 200) + + media_player.refresh_from_db() + self.assertEqual(media_player.entity_data["volume_step"], 20) + + def test_switching_to_standalone_drops_the_source_settings(self): + # The form clears attributes the selected setup doesn't use, the API stores what it gets. + self.save(self.form_payload(source_volume_strategy="player_attributes", source_entity_attribute="source_entity_id", source_volume_attribute="source_volume")) + media_player = Entity.objects.get() + + self.save(self.form_payload(id=media_player.id)) + + media_player.refresh_from_db() + self.assertEqual(media_player.entity_data["source_volume_strategy"], "none") + self.assertEqual(media_player.entity_data["source_entity_attribute"], "") + self.assertEqual(media_player.entity_data["source_volume_attribute"], "") + + def test_only_home_assistant_is_supported(self): + for controller in ("openhab", "nspm"): + with self.subTest(controller=controller): + self.assertEqual(self.save(self.payload(controller=controller)).status_code, 400) + self.assertFalse(Entity.objects.exists()) + + def test_editing_another_entity_type_is_rejected(self): + switch = Entity.objects.create(entity_type=Entity.EntityType.SWITCH, friendly_name="Fan", room=self.room, entities_page=self.page, room_view_position=1, entity_data={"controller": "home_assistant", "home_assistant_name": "switch.fan"}) + + response = self.save(self.payload(id=switch.id, slot=1)) + + self.assertEqual(response.status_code, 409) + switch.refresh_from_db() + self.assertEqual(switch.entity_type, Entity.EntityType.SWITCH) + self.assertManagerNotReloaded() + + def test_page_that_is_not_an_entities_page_of_the_room_is_rejected(self): + other_room = self.make_room("Lounge") + for page in (self.scenes_page(self.room), self.entities_page(other_room)): + with self.subTest(page=page.id): + self.assertEqual(self.save(self.payload() | {"entities_page_id": page.id}).status_code, 400) + self.assertFalse(Entity.objects.exists()) + + +class CoverTests(EntityRESTCommonTests, EntityRESTTestCase): + url = "rest_entities_covers" + + def payload(self, slot=0, **overrides): + return { + **placement(self.page, slot), + "controller": "home_assistant", + "friendly_name": "Living room blind", + "home_assistant_name": "cover.living_room_blind", + "openhab_item": "", + "openhab_tilt_item": "", + "invert_positions": False, + "position_preset1": 25, + "position_preset2": 30, + "position_preset3": 35, + "tilt_preset1": 50, + "tilt_preset2": 55, + "tilt_preset3": 60, + } | overrides + + def form_payload(self, **overrides): + return self.payload() | {"id": None, "type": "entity", "entity_type": "cover"} | overrides + + def test_add_home_assistant_cover(self): + response = self.save(self.payload(slot=2)) + + self.assertEqual(response.status_code, 200) + cover = Entity.objects.get() + self.assertEqual(cover.entity_type, Entity.EntityType.COVER) + self.assertEqual(cover.friendly_name, "Living room blind") + self.assertEqual((cover.room, cover.entities_page, cover.room_view_position), (self.room, self.page, 2)) + self.assertEqual( + cover.entity_data, + { + "controller": "home_assistant", + "home_assistant_name": "cover.living_room_blind", + "openhab_item": "", + "openhab_tilt_item": "", + "invert_positions": False, + "position_preset1": 25, + "position_preset2": 30, + "position_preset3": 35, + "tilt_preset1": 50, + "tilt_preset2": 55, + "tilt_preset3": 60, + }, + ) + self.assertLoadableByManager(cover) + self.assertManagerReloaded(times=1) + + def test_add_openhab_cover(self): + response = self.save(self.payload(controller="openhab", home_assistant_name="", openhab_item="LivingRoom_Shutter", openhab_tilt_item="LivingRoom_Tilt_Shutter")) + + self.assertEqual(response.status_code, 200) + cover = Entity.objects.get() + self.assertEqual( + cover.entity_data, + { + "controller": "openhab", + "home_assistant_name": "", + "openhab_item": "LivingRoom_Shutter", + "openhab_tilt_item": "LivingRoom_Tilt_Shutter", + "invert_positions": False, + "position_preset1": 25, + "position_preset2": 30, + "position_preset3": 35, + "tilt_preset1": 50, + "tilt_preset2": 55, + "tilt_preset3": 60, + }, + ) + self.assertLoadableByManager(cover) + + def test_add_with_the_payload_the_form_sends(self): + self.assertEqual(self.save(self.form_payload()).status_code, 200) + + cover = Entity.objects.get() + self.assertEqual(cover.entity_type, Entity.EntityType.COVER) + self.assertEqual(cover.entity_data["home_assistant_name"], "cover.living_room_blind") + self.assertLoadableByManager(cover) + + def test_names_are_trimmed(self): + self.save(self.payload(friendly_name=" Blind ", home_assistant_name=" cover.blind ")) + + cover = Entity.objects.get() + self.assertEqual(cover.friendly_name, "Blind") + self.assertEqual(cover.entity_data["home_assistant_name"], "cover.blind") + + def test_blank_name_is_rejected(self): + self.assertCreatesNothing(self.save(self.payload(friendly_name=" "))) + + def test_unknown_controller_is_rejected(self): + for controller in ("nspm", "zigbee"): + with self.subTest(controller=controller): + self.assertEqual(self.save(self.payload(controller=controller)).status_code, 400) + self.assertFalse(Entity.objects.exists()) + + def test_selected_controller_needs_its_entity(self): + cases = { + "home assistant without an entity": {"home_assistant_name": ""}, + "openhab without an item": {"controller": "openhab", "home_assistant_name": ""}, + } + for case, overrides in cases.items(): + with self.subTest(case): + self.assertEqual(self.save(self.payload(**overrides)).status_code, 400) + self.assertFalse(Entity.objects.exists()) + self.assertManagerNotReloaded() + + def test_home_assistant_name_must_be_a_cover_entity(self): + for name in ("light.kitchen", "switch.fan", "living_room_blind"): + with self.subTest(name=name): + self.assertEqual(self.save(self.payload(home_assistant_name=name)).status_code, 400) + self.assertFalse(Entity.objects.exists()) + + def test_non_string_fields_are_rejected(self): + for field in ("controller", "friendly_name", "home_assistant_name", "openhab_item"): + with self.subTest(field=field): + self.assertEqual(self.save(self.payload(**{field: 1})).status_code, 400) + self.assertFalse(Entity.objects.exists()) + + def test_editing_another_entity_type_is_rejected(self): + switch = Entity.objects.create( + entity_type=Entity.EntityType.SWITCH, + friendly_name="Fan", + room=self.room, + entities_page=self.page, + room_view_position=1, + entity_data={"controller": "home_assistant", "home_assistant_name": "switch.fan"}, + ) + + response = self.save(self.payload(id=switch.id, slot=1)) + + self.assertEqual(response.status_code, 409) + switch.refresh_from_db() + self.assertEqual(switch.entity_type, Entity.EntityType.SWITCH) + self.assertManagerNotReloaded() + + def test_page_that_is_not_an_entities_page_of_the_room_is_rejected(self): + other_room = self.make_room("Lounge") + for page in (self.scenes_page(self.room), self.entities_page(other_room)): + with self.subTest(page=page.id): + self.assertEqual(self.save(self.payload() | {"entities_page_id": page.id}).status_code, 400) + self.assertFalse(Entity.objects.exists()) + + def test_switching_controller_drops_the_other_controller_name(self): + self.save(self.payload()) + cover = Entity.objects.get() + + self.save(self.payload(id=cover.id, controller="openhab", home_assistant_name="", openhab_item="Blind_Item")) + + cover.refresh_from_db() + self.assertEqual(cover.entity_data["controller"], "openhab") + self.assertEqual(cover.entity_data["home_assistant_name"], "") + self.assertEqual(cover.entity_data["openhab_item"], "Blind_Item") + + +class SceneTests(EntityRESTCommonTests, EntityRESTTestCase): + url = "rest_entities_scenes" + model = Scene + + def setUp(self): + super().setUp() + self.page = self.scenes_page(self.room) + + def payload(self, slot=0, **overrides): + return { + **placement(self.page, slot), + "controller": "home_assistant", + "type": "scene", + "friendly_name": "Movie", + "scene_type": "home_assistant", + "backend_name": "scene.movie_time", + } | overrides + + def test_add_room_scene(self): + self.assertEqual(self.save(self.payload(slot=1)).status_code, 200) + + scene = Scene.objects.get() + self.assertEqual((scene.room, scene.entities_page, scene.room_view_position), (self.room, self.page, 1)) + self.assertEqual(scene.backend_name, "scene.movie_time") + self.assertLoadableByManager(scene) + self.assertManagerReloaded(times=1) + + def test_add_global_nspm_scene(self): + page = self.global_scenes_page() + + response = self.save(self.payload(room_id=None, entities_page_id=page.id, controller="nspm", scene_type="nspm_scene", backend_name="")) + + self.assertEqual(response.status_code, 200) + scene = Scene.objects.get() + self.assertIsNone(scene.room) + self.assertLoadableByManager(scene) + + def test_add_home_assistant_script_as_a_room_scene(self): + self.assertEqual(self.save(self.payload(friendly_name="Lights out", backend_name="script.lights_out")).status_code, 200) + + scene = Scene.objects.get() + self.assertEqual((scene.scene_type, scene.backend_name), ("home_assistant", "script.lights_out")) + self.assertEqual(scene.room, self.room) + self.assertLoadableByManager(scene) + self.assertManagerReloaded(times=1) + + def test_add_home_assistant_script_as_a_global_scene(self): + page = self.global_scenes_page() + + response = self.save(self.payload(room_id=None, entities_page_id=page.id, friendly_name="All off", backend_name="script.all_off")) + + self.assertEqual(response.status_code, 200) + scene = Scene.objects.get() + self.assertIsNone(scene.room) + self.assertEqual(scene.backend_name, "script.all_off") + self.assertLoadableByManager(scene) + + def test_home_assistant_scene_without_backend_name_is_rejected(self): + self.assertCreatesNothing(self.save(self.payload(backend_name=""))) + + def test_unknown_scene_type_is_rejected(self): + self.assertCreatesNothing(self.save(self.payload(scene_type="zigbee"))) diff --git a/docker/web/nspanelmanager/web/tests/test_files.py b/docker/web/nspanelmanager/web/tests/test_files.py new file mode 100644 index 000000000..0b3ef7711 --- /dev/null +++ b/docker/web/nspanelmanager/web/tests/test_files.py @@ -0,0 +1,162 @@ +""" +Firmware, LittleFS and TFT images: uploading from the UI, and the checksum and download +endpoints panels use to decide whether to update and to fetch the image. +""" + +import hashlib +import shutil +import tempfile + +from django.core.files.uploadedfile import SimpleUploadedFile +from django.test import override_settings +from django.urls import reverse + +from web.settings_helper import set_nspanel_setting_value + +from .harness import NSPMTestCase + +FIRMWARE = bytes(range(256)) * 4 # 1 KiB with a recognisable pattern + + +def md5(data): + return hashlib.md5(data).hexdigest() + + +class FileTestCase(NSPMTestCase): + def setUp(self): + super().setUp() + media_root = tempfile.mkdtemp(prefix="nspm-media-") + self.addCleanup(shutil.rmtree, media_root, ignore_errors=True) + override = override_settings(MEDIA_ROOT=media_root) + override.enable() + self.addCleanup(override.disable) + + def upload(self, url_name, field, data, **form): + return self.client.post(reverse(url_name), {field: SimpleUploadedFile("upload.bin", data), **form}) + + +class FirmwareTests(FileTestCase): + def test_upload_then_checksum_and_download(self): + response = self.upload("save_new_firmware", "firmware", FIRMWARE, model="sonoff") + + self.assertRedirects(response, "/", fetch_redirect_response=False) + self.assertEqual(self.client.get(reverse("checksum_firmware")).content.decode(), md5(FIRMWARE)) + self.assertEqual(self.client.get(reverse("download_firmware")).content, FIRMWARE) + self.assertManagerReloaded(times=1) + + def test_models_are_stored_separately(self): + self.upload("save_new_firmware", "firmware", b"sonoff", model="sonoff") + self.upload("save_new_firmware", "firmware", b"custom", model="custom") + + self.assertEqual(self.client.get(reverse("download_firmware"), {"model": "custom"}).content, b"custom") + self.assertEqual(self.client.get(reverse("download_firmware"), {"model": "sonoff"}).content, b"sonoff") + self.assertEqual(self.client.get(reverse("checksum_firmware"), {"model": "custom"}).content.decode(), md5(b"custom")) + + def test_upload_replaces_previous_image(self): + self.upload("save_new_firmware", "firmware", b"old", model="sonoff") + self.upload("save_new_firmware", "firmware", b"new", model="sonoff") + + self.assertEqual(self.client.get(reverse("download_firmware")).content, b"new") + + def test_upload_without_model_is_ignored(self): + self.upload("save_new_firmware", "firmware", FIRMWARE) + + self.assertManagerNotReloaded() + self.assertRejected(self.client.get(reverse("download_firmware"))) + + def test_unknown_model_is_rejected(self): + for url_name in ("download_firmware", "checksum_firmware", "download_data_file", "checksum_data_file"): + with self.subTest(url_name=url_name): + self.assertEqual(self.client.get(reverse(url_name), {"model": "../../etc"}).status_code, 400) + + def test_range_requests_use_an_exclusive_end(self): + # CONTRACT with the panel firmware (NSPanelManager-firmware, UpdateManager.cpp): the + # "bytes=start-end" end is treated as EXCLUSIVE (Python slice), not inclusive as RFC 7233 + # says. The firmware deliberately sends ranges in the same convention. Changing either + # side alone corrupts OTA updates. + self.upload("save_new_firmware", "firmware", FIRMWARE, model="sonoff") + + response = self.client.get(reverse("download_firmware"), HTTP_RANGE="bytes=100-200") + + self.assertEqual(response.content, FIRMWARE[100:200]) + self.assertEqual(len(response.content), 100) + + def test_open_ended_range(self): + self.upload("save_new_firmware", "firmware", FIRMWARE, model="sonoff") + + self.assertEqual(self.client.get(reverse("download_firmware"), HTTP_RANGE="bytes=1000-").content, FIRMWARE[1000:]) + + def test_merged_flash_upload_does_not_reload_manager(self): + # MQTTManager does not track the merged image's checksum, so there is nothing to reload. + self.upload("save_new_merged_flash", "bin", FIRMWARE, model="sonoff") + + self.assertManagerNotReloaded() + + def test_checksum_of_missing_image_is_not_found(self): + panel = self.make_panel(self.make_room()) + for url in (reverse("checksum_firmware"), reverse("checksum_data_file"), reverse("checksum_tft_file", kwargs={"panel_id": panel.id})): + with self.subTest(url=url): + response = self.client.get(url) + self.assertEqual(response.status_code, 404) + self.assertEqual(response.content, b"") + + +class DataFileTests(FileTestCase): + def test_upload_then_checksum_and_download(self): + self.upload("save_new_data_file", "data_file", FIRMWARE, model="sonoff") + + self.assertEqual(self.client.get(reverse("checksum_data_file")).content.decode(), md5(FIRMWARE)) + self.assertEqual(self.client.get(reverse("download_data_file")).content, FIRMWARE) + self.assertEqual(self.client.get(reverse("download_data_file"), HTTP_RANGE="bytes=0-16").content, FIRMWARE[:16]) + self.assertManagerReloaded(times=1) + + +class TFTTests(FileTestCase): + def setUp(self): + super().setUp() + self.room = self.make_room() + self.panel = self.make_panel(self.room) + + def upload_tft(self, tft_file_type, data): + return self.upload("save_new_tft_file", "tft_file", data, tft_file_type=tft_file_type) + + def panel_tft(self, **headers): + return self.client.get(reverse("download_tft", kwargs={"panel_id": self.panel.id}), **headers).content + + def configure_panel(self, is_us_panel="False", orientation=None, tft="tft1"): + set_nspanel_setting_value(self.panel.id, "is_us_panel", is_us_panel) + set_nspanel_setting_value(self.panel.id, "selected_tft", tft) + if orientation: + set_nspanel_setting_value(self.panel.id, "us_panel_orientation", orientation) + + def test_each_panel_gets_the_image_for_its_type_and_selected_tft(self): + for tft_file_type in ("eu1", "eu3", "us2", "us4_horizontal_mirrored"): + self.upload_tft(tft_file_type, tft_file_type.encode()) + + cases = [ + ({}, b"eu1"), # defaults: EU panel, tft1 + ({"tft": "tft3"}, b"eu3"), + ({"is_us_panel": "True", "orientation": "vertical", "tft": "tft2"}, b"us2"), + # A horizontal US panel has the same screen orientation as an EU panel. + ({"is_us_panel": "True", "orientation": "horizontal", "tft": "tft3"}, b"eu3"), + ({"is_us_panel": "True", "orientation": "horizontal_mirrored", "tft": "tft4"}, b"us4_horizontal_mirrored"), + ] + for config, expected in cases: + with self.subTest(config=config): + self.configure_panel(**config) + self.assertEqual(self.panel_tft(), expected) + self.assertEqual(self.client.get(reverse("checksum_tft_file", kwargs={"panel_id": self.panel.id})).content.decode(), md5(expected)) + + def test_tft_range_download(self): + self.upload_tft("eu1", FIRMWARE) + + self.assertEqual(self.panel_tft(HTTP_RANGE="bytes=10-20"), FIRMWARE[10:20]) + + def test_upload_reloads_manager(self): + self.upload_tft("eu1", FIRMWARE) + + self.assertManagerReloaded(times=1) + + def test_unknown_tft_type_is_rejected(self): + self.assertEqual(self.upload_tft("eu9", FIRMWARE).status_code, 500) + self.assertManagerNotReloaded() diff --git a/docker/web/nspanelmanager/web/tests/test_layout.py b/docker/web/nspanelmanager/web/tests/test_layout.py new file mode 100644 index 000000000..91aa2e9d6 --- /dev/null +++ b/docker/web/nspanelmanager/web/tests/test_layout.py @@ -0,0 +1,286 @@ +""" +Moving and deleting entities and managing entities pages, through the REST endpoints the +React entities-page view calls. +""" + +from django.urls import reverse + +from web.models import Entity, RoomEntitiesPage, Scene + +from .harness import NSPMTestCase + + +def position(obj, page, slot): + return {"id": obj.id, "entities_page_id": page.id, "room_view_position": slot} + + +class ReadEntityTests(NSPMTestCase): + def test_get_entity(self): + room = self.make_room("Kitchen") + light = self.make_light(room, "Ceiling", slot=2, home_assistant_name="light.ceiling") + + response = self.client.get(reverse("rest_get_entity", kwargs={"entity_id": light.id})) + + self.assertEqual(response.status_code, 200) + body = response.json() + self.assertEqual((body["id"], body["friendly_name"], body["room_view_position"]), (light.id, "Ceiling", 2)) + self.assertEqual((body["controller"], body["home_assistant_name"]), ("home_assistant", "light.ceiling")) + + def test_get_room_pages_lists_entities_and_scenes(self): + room = self.make_room("Kitchen") + light = self.make_light(room) + scene = self.make_scene(room) + + response = self.client.get(reverse("rest_room_entities_pages", kwargs={"room_id": room.id})) + + self.assertEqual(response.status_code, 200) + pages = {page["type"]: page for page in response.json()["entities_pages"]} + self.assertEqual([e["id"] for e in pages["entity"]["entities"]], [light.id]) + self.assertEqual([s["id"] for s in pages["scene"]["scenes"]], [scene.id]) + + +class MoveEntityTests(NSPMTestCase): + def setUp(self): + super().setUp() + self.room = self.make_room("Kitchen") + self.page = self.entities_page(self.room) + self.second_page = RoomEntitiesPage.objects.create(room=self.room, page_type=8, is_scenes_page=False, display_order=1) + + def save_order(self, entities=(), scenes=()): + return self.put_json(reverse("rest_put_room_entities_order", kwargs={"room_id": self.room.id}), {"entities": list(entities), "scenes": list(scenes)}) + + def assertAt(self, obj, page, slot): + obj.refresh_from_db() + self.assertEqual((obj.entities_page_id, obj.room_view_position), (page.id, slot)) + + def test_move_entity(self): + light = self.make_light(self.room, slot=0) + + response = self.save_order([position(light, self.page, 3)]) + + self.assertEqual(response.status_code, 200) + self.assertAt(light, self.page, 3) + self.assertManagerReloaded(times=1) + + def test_swap_entities_across_pages(self): + ceiling = self.make_light(self.room, "Ceiling", slot=0) + lamp = self.make_light(self.room, "Lamp", page=self.second_page, slot=5) + + response = self.save_order([position(ceiling, self.second_page, 5), position(lamp, self.page, 0)]) + + self.assertEqual(response.status_code, 200) + self.assertAt(ceiling, self.second_page, 5) + self.assertAt(lamp, self.page, 0) + + def test_move_scenes(self): + scenes_page = self.scenes_page(self.room) + movie = self.make_scene(self.room, "Movie", slot=0) + dinner = self.make_scene(self.room, "Dinner", slot=1) + + response = self.save_order(scenes=[position(movie, scenes_page, 1), position(dinner, scenes_page, 0)]) + + self.assertEqual(response.status_code, 200) + self.assertAt(movie, scenes_page, 1) + self.assertAt(dinner, scenes_page, 0) + self.assertManagerReloaded(times=1) + + def test_bad_payloads_are_rejected(self): + light = self.make_light(self.room, slot=0) + url = reverse("rest_put_room_entities_order", kwargs={"room_id": self.room.id}) + for body in ({"entities": []}, {"scenes": []}, {"entities": [{"id": light.id}], "scenes": []}, "not json"): + with self.subTest(body=body): + self.assertRejected(self.put_json(url, body)) + self.assertAt(light, self.page, 0) + self.assertManagerNotReloaded() + + def test_unknown_entity_is_rejected(self): + self.assertRejected(self.save_order([{"id": 999, "entities_page_id": self.page.id, "room_view_position": 0}])) + self.assertManagerNotReloaded() + + def test_other_methods_are_rejected(self): + self.assertEqual(self.client.get(reverse("rest_put_room_entities_order", kwargs={"room_id": self.room.id})).status_code, 405) + + def test_failed_reorder_changes_nothing(self): + light = self.make_light(self.room, slot=0) + + response = self.save_order([position(light, self.page, 3), {"id": 999, "entities_page_id": self.page.id, "room_view_position": 0}]) + + self.assertRejected(response) + self.assertAt(light, self.page, 0) + self.assertManagerNotReloaded() + + def test_move_to_slot_outside_page_is_rejected(self): + light = self.make_light(self.room, slot=0) + + self.assertRejected(self.save_order([position(light, self.page, 11)])) + self.assertAt(light, self.page, 0) + + +class DeleteEntityTests(NSPMTestCase): + def setUp(self): + super().setUp() + self.room = self.make_room("Kitchen") + + def test_delete_entity(self): + doomed = self.make_light(self.room, "Ceiling", slot=1) + kept = self.make_light(self.room, "Lamp", slot=2) + + response = self.client.delete(reverse("rest_get_entity", kwargs={"entity_id": doomed.id})) + + self.assertEqual(response.status_code, 200) + self.assertEqual(list(Entity.objects.values_list("id", flat=True)), [kept.id]) + self.assertManagerReloaded(times=1) + + def test_delete_unknown_entity_is_rejected(self): + self.make_light(self.room) + + self.assertRejected(self.client.delete(reverse("rest_get_entity", kwargs={"entity_id": 999}))) + self.assertEqual(Entity.objects.count(), 1) + self.assertManagerNotReloaded() + + def test_delete_scene(self): + scene = self.make_scene(self.room) + + response = self.client.delete(reverse("rest_get_scene", kwargs={"scene_id": scene.id})) + + self.assertEqual(response.status_code, 200) + self.assertFalse(Scene.objects.exists()) + + def test_delete_scene_reloads_manager(self): + scene = self.make_scene(self.room) + + self.client.delete(reverse("rest_get_scene", kwargs={"scene_id": scene.id})) + + self.assertManagerReloaded(times=1) + + def test_delete_unknown_scene_is_rejected(self): + self.assertRejected(self.client.delete(reverse("rest_get_scene", kwargs={"scene_id": 999}))) + + +class EntitiesPageTests(NSPMTestCase): + def setUp(self): + super().setUp() + self.room = self.make_room("Kitchen") + + def pages(self, room, is_scenes_page=False): + return list(RoomEntitiesPage.objects.filter(room=room, is_scenes_page=is_scenes_page).order_by("display_order")) + + def create_page(self, page_type, is_scenes_page=False, room=None): + room = room or self.room + return self.put_json(reverse("rest_room_entities_pages", kwargs={"room_id": room.id}), {"type": page_type, "is_scenes_page": is_scenes_page}) + + def test_create_pages(self): + for page_type in (8, 12): + self.assertEqual(self.create_page(page_type).status_code, 200) + + pages = self.pages(self.room) + self.assertEqual([p.page_type for p in pages], [4, 8, 12]) + self.assertManagerReloaded(times=2) + + def test_create_global_scenes_page(self): + self.global_scenes_page() + + response = self.put_json(reverse("rest_global_entities_pages"), {"type": 4, "is_scenes_page": True}) + + self.assertEqual(response.status_code, 200) + self.assertEqual(len(self.pages(None, is_scenes_page=True)), 2) + + def test_create_page_missing_field_is_rejected(self): + before = RoomEntitiesPage.objects.count() + for body in ({"type": 4}, {"is_scenes_page": False}): + with self.subTest(body=body): + self.assertEqual(self.put_json(reverse("rest_room_entities_pages", kwargs={"room_id": self.room.id}), body).status_code, 400) + self.assertEqual(RoomEntitiesPage.objects.count(), before) + self.assertManagerNotReloaded() + + def test_create_page_in_unknown_room_is_rejected(self): + before = RoomEntitiesPage.objects.count() + + self.assertRejected(self.put_json(reverse("rest_room_entities_pages", kwargs={"room_id": 999}), {"type": 4, "is_scenes_page": False})) + + self.assertEqual(RoomEntitiesPage.objects.count(), before) + self.assertManagerNotReloaded() + + def test_create_page_with_unsupported_size_is_rejected(self): + before = RoomEntitiesPage.objects.count() + + self.assertRejected(self.create_page(6)) + self.assertEqual(RoomEntitiesPage.objects.count(), before) + + def test_delete_page_removes_its_entities(self): + second = RoomEntitiesPage.objects.create(room=self.room, page_type=8, is_scenes_page=False, display_order=2) + on_first = self.make_light(self.room, slot=0) + on_second = self.make_light(self.room, page=second, slot=0) + + response = self.client.delete(reverse("rest_room_entities_page", kwargs={"page_id": second.id})) + + self.assertEqual(response.status_code, 200) + self.assertFalse(RoomEntitiesPage.objects.filter(id=second.id).exists()) + self.assertEqual(list(Entity.objects.values_list("id", flat=True)), [on_first.id]) + self.assertNotEqual(on_second.id, on_first.id) + self.assertManagerReloaded(times=1) + + def test_delete_unknown_page_is_rejected(self): + self.assertRejected(self.client.delete(reverse("rest_room_entities_page", kwargs={"page_id": 999}))) + self.assertManagerNotReloaded() + + def test_reorder_pages(self): + first = self.entities_page(self.room) + second = RoomEntitiesPage.objects.create(room=self.room, page_type=8, is_scenes_page=False, display_order=2) + + response = self.put_json(reverse("rest_room_entities_pages_order"), {"order": [[second.id, 0], [first.id, 1]]}) + + self.assertEqual(response.status_code, 200) + self.assertEqual(self.pages(self.room), [second, first]) + self.assertManagerReloaded(times=1) + + def test_reorder_pages_bad_payload_is_rejected(self): + url = reverse("rest_room_entities_pages_order") + self.assertEqual(self.put_json(url, {}).status_code, 400) + self.assertRejected(self.put_json(url, {"order": [[999, 0]]})) + self.assertRejected(self.put_json(url, "not json")) + self.assertManagerNotReloaded() + + def test_resize_page(self): + page = self.entities_page(self.room) + + response = self.put_json(reverse("rest_room_entities_page", kwargs={"page_id": page.id}), {"id": page.id, "number_of_entities": 12}) + + self.assertEqual(response.status_code, 200) + page.refresh_from_db() + self.assertEqual(page.page_type, 12) + + def test_resize_page_reloads_manager(self): + page = self.entities_page(self.room) + + self.put_json(reverse("rest_room_entities_page", kwargs={"page_id": page.id}), {"number_of_entities": 12}) + + self.assertManagerReloaded(times=1) + + def test_shrinking_page_does_not_strand_entities(self): + page = RoomEntitiesPage.objects.create(room=self.room, page_type=12, is_scenes_page=False, display_order=2) + light = self.make_light(self.room, page=page, slot=9) + + response = self.put_json(reverse("rest_room_entities_page", kwargs={"page_id": page.id}), {"number_of_entities": 4}) + + self.assertRejected(response) + page.refresh_from_db() + self.assertEqual(page.page_type, 12) + self.assertLoadableByManager(light) + self.assertManagerNotReloaded() + + def test_shrinking_page_with_free_trailing_slots(self): + page = RoomEntitiesPage.objects.create(room=self.room, page_type=12, is_scenes_page=False, display_order=2) + light = self.make_light(self.room, page=page, slot=3) + + response = self.put_json(reverse("rest_room_entities_page", kwargs={"page_id": page.id}), {"number_of_entities": 4}) + + self.assertEqual(response.status_code, 200) + self.assertLoadableByManager(light) + + def test_resize_to_unsupported_size_is_rejected(self): + page = self.entities_page(self.room) + + self.assertRejected(self.put_json(reverse("rest_room_entities_page", kwargs={"page_id": page.id}), {"number_of_entities": 6})) + page.refresh_from_db() + self.assertEqual(page.page_type, 4) diff --git a/docker/web/nspanelmanager/web/tests/test_misc.py b/docker/web/nspanelmanager/web/tests/test_misc.py new file mode 100644 index 000000000..14faf28b7 --- /dev/null +++ b/docker/web/nspanelmanager/web/tests/test_misc.py @@ -0,0 +1,175 @@ +""" +Smaller endpoints: messages, Home Assistant / OpenHAB entity lookups used by the entity +modal, hostname lookup and read-only listings. +""" + +import json +import socket +from unittest import mock + +from django.urls import reverse + +from web.models import Message + +from .harness import NSPMTestCase + + +class MessageTests(NSPMTestCase): + def test_unread_messages_are_flagged_and_can_be_marked_read(self): + Message.objects.all().delete() # Migrations add their own messages (e.g. 0071). + message = Message.objects.create(title="Update available", message="v2.1 is out") + self.assertTrue(self.client.get(reverse("index")).context["has_unread_messages"]) + + response = self.client.get(reverse("htmx_mark_message_read", kwargs={"message_id": message.id})) + + self.assertContains(response, "Update available") + message.refresh_from_db() + self.assertTrue(message.read) + self.assertFalse(self.client.get(reverse("index")).context["has_unread_messages"]) + + def test_mark_unknown_message_is_rejected(self): + self.assertEqual(self.client.get(reverse("htmx_mark_message_read", kwargs={"message_id": 999})).status_code, 500) + + +class EntitySourceLookupTests(NSPMTestCase): + """The lists the React entity modal offers when picking a Home Assistant / OpenHAB item.""" + + def test_home_assistant_entities(self): + self.home_assistant.add("light.kitchen", friendly_name="Kitchen") + self.home_assistant.add("switch.fan", friendly_name="Fan") + + response = self.client.get(reverse("rest_get_home_assistant_entities")) + + self.assertEqual(response.status_code, 200) + self.assertEqual([(i["item_id"], i["label"]) for i in response.json()["items"]], [("light.kitchen", "Kitchen"), ("switch.fan", "Fan")]) + + def test_home_assistant_entities_filtered_by_domain(self): + self.home_assistant.add("light.kitchen") + self.home_assistant.add("switch.fan") + self.home_assistant.add("climate.lounge") + + response = self.client.get(reverse("rest_get_home_assistant_entities"), {"filter": json.dumps({"type": ["switch", "climate"]})}) + + self.assertEqual([i["item_id"] for i in response.json()["items"]], ["switch.fan", "climate.lounge"]) + + def test_home_assistant_scripts_are_offered_with_scenes(self): + # The React scene picker fetches every entity and keeps scene.* and script.* itself. + self.home_assistant.add("scene.movie_time", friendly_name="Movie time") + self.home_assistant.add("script.lights_out", friendly_name="Lights out") + self.home_assistant.add("light.kitchen") + + response = self.client.get(reverse("rest_get_home_assistant_entities")) + + items = {i["item_id"]: i["label"] for i in response.json()["items"]} + self.assertEqual(items["scene.movie_time"], "Movie time") + self.assertEqual(items["script.lights_out"], "Lights out") + + def test_entity_without_friendly_name_is_labelled_by_id(self): + self.home_assistant.add("light.unnamed") + + self.assertEqual(self.client.get(reverse("rest_get_home_assistant_entities")).json()["items"][0]["label"], "light.unnamed") + + def test_home_assistant_error_is_reported(self): + self.home_assistant.fail = True + + response = self.client.get(reverse("rest_get_home_assistant_entities")) + + self.assertEqual(response.json()["items"], []) + self.assertTrue(response.json()["errors"]) + + def test_home_assistant_not_configured_is_reported(self): + from web.settings_helper import set_setting_value + + set_setting_value("home_assistant_token", "") + + self.assertTrue(self.client.get(reverse("rest_get_home_assistant_entities")).json()["errors"]) + + def test_openhab_items_include_scenes(self): + self.openhab_items = [{"type": "openhab", "label": "Lamp", "item_id": "Lamp"}] + + response = self.client.get(reverse("rest_get_openhab_items")) + + # The fake returns the same list for items and for scenes (rules), so both are merged in. + self.assertEqual([i["item_id"] for i in response.json()["items"]], ["Lamp", "Lamp"]) + + def test_lookups_are_read_only(self): + self.assertEqual(self.client.post(reverse("rest_get_home_assistant_entities")).status_code, 405) + self.assertEqual(self.client.post(reverse("rest_get_openhab_items")).status_code, 405) + + +class HostnameLookupTests(NSPMTestCase): + def test_resolves_hostname(self): + with mock.patch("web.rest.socket.gethostbyname", return_value="192.168.1.20") as lookup: + response = self.post_json(reverse("get_ip_by_hostname"), {"hostname": "mqtt.local"}) + + lookup.assert_called_once_with("mqtt.local") + self.assertEqual(response.json(), {"ip": "192.168.1.20"}) + + def test_unknown_hostname_is_404(self): + with mock.patch("web.rest.socket.gethostbyname", side_effect=socket.gaierror): + self.assertEqual(self.post_json(reverse("get_ip_by_hostname"), {"hostname": "nope.invalid"}).status_code, 404) + + def test_missing_hostname_is_rejected(self): + with mock.patch("web.rest.socket.gethostbyname") as lookup: + self.assertEqual(self.post_json(reverse("get_ip_by_hostname"), {}).status_code, 500) + lookup.assert_not_called() + + +class ReadOnlyListingTests(NSPMTestCase): + def setUp(self): + super().setUp() + self.room = self.make_room("Kitchen") + + def test_room_entities(self): + light = self.make_light(self.room, "Ceiling") + self.make_light(self.make_room("Lounge"), "Lamp") + + response = self.client.get(reverse("rest_room_entities", kwargs={"room_id": self.room.id})) + + self.assertEqual([e["id"] for e in response.json()["entities"]], [light.id]) + + def test_global_entities_pages(self): + page = self.global_scenes_page() + scene = self.make_scene(None, "Goodnight") + + response = self.client.get(reverse("rest_global_entities_pages")) + + pages = response.json()["entities_pages"] + self.assertEqual([(p["id"], p["room_id"]) for p in pages], [(page.id, None)]) + self.assertEqual([s["id"] for s in pages[0]["scenes"]], [scene.id]) + + def test_single_entities_page(self): + light = self.make_light(self.room, slot=1) + + response = self.client.get(reverse("rest_room_entities_page", kwargs={"page_id": self.entities_page(self.room).id})) + + self.assertEqual([e["id"] for e in response.json()["entities"]], [light.id]) + + def test_get_scene(self): + scene = self.make_scene(self.room, "Dinner", backend_name="scene.dinner") + + result = self.client.get(reverse("rest_get_scene", kwargs={"scene_id": scene.id})).json()["result"] + + self.assertEqual((result["friendly_name"], result["backend_name"], result["room_id"]), ("Dinner", "scene.dinner", self.room.id)) + + def test_scenes_listing(self): + scene = self.make_scene(self.room, "Dinner") + self.make_scene(None, "Goodnight") + + response = self.client.get(reverse("rest_lights"), {"room_id": self.room.id}) + + self.assertEqual([s["scene_id"] for s in response.json()["scenes"]], [scene.id]) + + def test_legacy_scene_and_room_config(self): + scene = self.make_scene(self.room, "Dinner") + + self.assertEqual(self.client.get(reverse("get_scenes")).json()["scenes"][0]["scene_id"], scene.id) + self.assertEqual(self.client.get(reverse("get_nspanel_config", kwargs={"room_id": self.room.id})).json()["name"], "Kitchen") + + def test_scenes_listing_filters_by_scene_id(self): + scene = self.make_scene(self.room, "Dinner") + self.make_scene(self.room, "Breakfast") + + response = self.client.get(reverse("rest_lights"), {"scene_id": scene.id}) + + self.assertEqual([s["scene_id"] for s in response.json()["scenes"]], [scene.id]) diff --git a/docker/web/nspanelmanager/web/tests/test_openapi.py b/docker/web/nspanelmanager/web/tests/test_openapi.py new file mode 100644 index 000000000..1808c523b --- /dev/null +++ b/docker/web/nspanelmanager/web/tests/test_openapi.py @@ -0,0 +1,21 @@ +import importlib.util +import tempfile +from io import StringIO +from pathlib import Path +from unittest import skipUnless + +from django.core.management import call_command +from django.test import SimpleTestCase + +# Committed so the UI can generate its types without running Django, and so API changes show up in review. +SCHEMA_FILE = Path(__file__).resolve().parents[3] / "openapi.yaml" + + +# drf-spectacular is a development/CI-only dependency (docker/web/requirements-dev.txt). +@skipUnless(importlib.util.find_spec("drf_spectacular"), "drf-spectacular is not installed (see docker/web/requirements-dev.txt)") +class OpenAPISchemaTests(SimpleTestCase): + def test_committed_schema_is_up_to_date(self): + # --fail-on-warn: a view drf-spectacular can't describe fails here instead of producing a loose type. + with tempfile.NamedTemporaryFile(suffix=".yaml") as generated: + call_command("spectacular", "--validate", "--fail-on-warn", "--file", generated.name, stderr=StringIO()) + self.assertEqual(Path(generated.name).read_text(), SCHEMA_FILE.read_text(), "docker/web/openapi.yaml is out of date. Run docker/web/generate_api.sh and commit the result (see CONTRIBUTING.md).") diff --git a/docker/web/nspanelmanager/web/tests/test_pages.py b/docker/web/nspanelmanager/web/tests/test_pages.py new file mode 100644 index 000000000..41aaf033b --- /dev/null +++ b/docker/web/nspanelmanager/web/tests/test_pages.py @@ -0,0 +1,120 @@ +""" +Every page and htmx partial renders. These catch broken templates, template tags and +view context (e.g. a renamed model field referenced from a template), which otherwise +only show up when someone opens the page. +""" + +from django.urls import reverse + +from web.models import Message, RelayGroup +from web.settings_helper import set_setting_value + +from .harness import NSPMTestCase + + +class PageRenderTests(NSPMTestCase): + def setUp(self): + super().setUp() + self.room = self.make_room("Kitchen") + self.make_light(self.room, "Ceiling") + self.make_scene(self.room, "Dinner") + self.make_scene(None, "Goodnight", scene_type="nspm_scene", backend_name="") + self.panel = self.make_panel(self.room, "Kitchen panel", accepted=True) + self.denied_panel = self.make_panel(self.room, "Denied panel", mac="AA:BB:CC:DD:EE:01", denied=True) + self.relay_group = RelayGroup.objects.create(friendly_name="Hall lights") + Message.objects.create(title="Hello", message="World") + + def assertRenders(self, url): + response = self.client.get(url) + self.assertEqual(response.status_code, 200, f"GET {url} returned {response.status_code}") + return response + + def test_full_pages(self): + pages = [ + reverse("index"), + reverse("rooms"), + reverse("edit_room", kwargs={"room_id": self.room.id}), + reverse("edit_nspanel", kwargs={"panel_id": self.panel.id}), + reverse("settings"), + reverse("relay_groups"), + reverse("global_scenes"), + reverse("weather_and_time"), + reverse("denied_nspanels"), + ] + for url in pages: + with self.subTest(url=url): + self.assertRenders(url) + + def test_pages_render_with_no_configuration(self): + # A fresh install: no settings, no rooms, no panels. + self.room.delete() + for url in (reverse("index"), reverse("rooms"), reverse("settings"), reverse("weather_and_time"), reverse("global_scenes"), reverse("relay_groups")): + with self.subTest(url=url): + self.assertRenders(url) + + def test_index_shows_initial_setup_until_manager_address_is_configured(self): + self.assertContains(self.assertRenders(reverse("index")), "data-react-component='InitialSetup'") + + set_setting_value("manager_address", "192.168.1.10") + + self.assertNotContains(self.assertRenders(reverse("index")), "data-react-component='InitialSetup'") + + def test_htmx_partials(self): + partials = [ + reverse("htmx_partial_select_new_entity_type_react", kwargs={"entities_page_id": self.entities_page(self.room).id, "room_view_position": 1}), + reverse("htmx_partial_select_weather_location"), + reverse("htmx_partial_select_weather_outside_temperature_sensor"), + reverse("htmx_show_messages"), + reverse("htmx_modal_create_new_relay_group"), + reverse("htmx_modal_edit_relay_group", kwargs={"relay_group_id": self.relay_group.id}), + reverse("htmx_modal_add_relay_to_relay_group", kwargs={"relay_group_id": self.relay_group.id}), + ] + for url in partials: + with self.subTest(url=url): + self.assertRenders(url) + + def test_sensor_pickers_list_home_assistant_entities(self): + self.home_assistant.add("sensor.kitchen_temperature", friendly_name="Kitchen temperature") + + for url in ( + reverse("htmx_partial_select_room_temperature_sensor_from_list", kwargs={"entity_source": "home_assistant", "room_id": self.room.id}), + reverse("htmx_partial_select_weather_outside_temperature_sensor_from_list", kwargs={"entity_source": "home_assistant"}), + ): + with self.subTest(url=url): + self.assertContains(self.assertRenders(url), "Kitchen temperature") + + def test_sensor_provider_picker_skips_straight_to_the_only_configured_source(self): + room_list = reverse("htmx_partial_select_room_temperature_sensor_from_list", kwargs={"entity_source": "home_assistant", "room_id": self.room.id}) + weather_list = reverse("htmx_partial_select_weather_outside_temperature_sensor_from_list", kwargs={"entity_source": "home_assistant"}) + + self.assertRedirects(self.client.get(reverse("htmx_partial_select_room_temperature_sensor_provider", kwargs={"room_id": self.room.id})), room_list, fetch_redirect_response=False) + self.assertRedirects(self.client.get(reverse("htmx_partial_select_weather_outside_temperature_sensor_provider")), weather_list, fetch_redirect_response=False) + + set_setting_value("home_assistant_token", "") + set_setting_value("openhab_address", "http://openhab.test") + set_setting_value("openhab_token", "token") + self.assertRedirects( + self.client.get(reverse("htmx_partial_select_weather_outside_temperature_sensor_provider")), + reverse("htmx_partial_select_weather_outside_temperature_sensor_from_list", kwargs={"entity_source": "openhab"}), + fetch_redirect_response=False, + ) + + def test_sensor_provider_picker_offers_a_choice_when_both_are_configured(self): + set_setting_value("openhab_address", "http://openhab.test") + set_setting_value("openhab_token", "token") + + self.assertRenders(reverse("htmx_partial_select_room_temperature_sensor_provider", kwargs={"room_id": self.room.id})) + self.assertRenders(reverse("htmx_partial_select_weather_outside_temperature_sensor_provider")) + + def test_sensor_provider_picker_with_nothing_configured_is_an_error(self): + set_setting_value("home_assistant_token", "") + + self.assertRejected(self.client.get(reverse("htmx_partial_select_weather_outside_temperature_sensor_provider"))) + + def test_unknown_objects_are_rejected(self): + for url in ( + reverse("edit_nspanel", kwargs={"panel_id": 999}), + reverse("htmx_modal_edit_relay_group", kwargs={"relay_group_id": 999}), + ): + with self.subTest(url=url): + self.assertRejected(self.client.get(url)) diff --git a/docker/web/nspanelmanager/web/tests/test_panels.py b/docker/web/nspanelmanager/web/tests/test_panels.py new file mode 100644 index 000000000..d1559352d --- /dev/null +++ b/docker/web/nspanelmanager/web/tests/test_panels.py @@ -0,0 +1,318 @@ +""" +Panel lifecycle (accept, deny, delete, unblock), the per-panel settings form, and the +legacy panel-facing api/ endpoints. +""" + +from django.urls import reverse + +from web.models import Entity, NSPanel +from web.settings_helper import get_nspanel_setting_with_default, set_nspanel_setting_value + +from .harness import NSPMTestCase + + +class PanelLifecycleTests(NSPMTestCase): + def setUp(self): + super().setUp() + self.room = self.make_room("Kitchen") + self.panel = self.make_panel(self.room, "New panel") + + def test_accept_register_request(self): + lounge = self.make_room("Lounge") + self.panel.denied = True + self.panel.save() + + response = self.post_json(reverse("nspanel_accept", kwargs={"nspanel_id": self.panel.id}), {"room_id": lounge.id}) + + self.assertEqual(response.json(), {"status": "ok", "id": self.panel.id}) + self.panel.refresh_from_db() + self.assertEqual((self.panel.accepted, self.panel.denied, self.panel.room), (True, False, lounge)) + self.assertManagerReloaded(times=1) + + def test_accept_without_room_is_rejected(self): + self.assertRejected(self.post_json(reverse("nspanel_accept", kwargs={"nspanel_id": self.panel.id}), {})) + self.panel.refresh_from_db() + self.assertFalse(self.panel.accepted) + self.assertManagerNotReloaded() + + def test_deny_register_request(self): + response = self.client.post(reverse("nspanel_deny", kwargs={"nspanel_id": self.panel.id})) + + self.assertEqual(response.json(), {"status": "ok", "id": self.panel.id}) + self.panel.refresh_from_db() + self.assertEqual((self.panel.accepted, self.panel.denied), (False, True)) + self.assertManagerReloaded(times=1) + + def test_denied_panels_page_lists_denied_panel(self): + self.make_panel(self.room, "Blocked panel", mac="AA:BB:CC:DD:EE:01", denied=True) + + response = self.client.get(reverse("denied_nspanels")) + + self.assertContains(response, "Blocked panel") + self.assertNotContains(response, "New panel") + + def test_accept_and_deny_require_post(self): + for name in ("nspanel_accept", "nspanel_deny"): + with self.subTest(name=name): + self.assertEqual(self.client.get(reverse(name, kwargs={"nspanel_id": self.panel.id})).status_code, 405) + self.panel.refresh_from_db() + self.assertEqual((self.panel.accepted, self.panel.denied), (False, False)) + self.assertManagerNotReloaded() + + def test_accept_unknown_panel_is_rejected(self): + self.assertRejected(self.post_json(reverse("nspanel_accept", kwargs={"nspanel_id": 999}), {"room_id": self.room.id})) + self.assertManagerNotReloaded() + + def test_delete_panel(self): + set_nspanel_setting_value(self.panel.id, "screen_dim_level", "50") + + response = self.client.delete(reverse("delete_nspanel", kwargs={"nspanel_id": self.panel.id})) + + self.assertEqual(response.json(), {"status": "ok"}) + self.assertFalse(NSPanel.objects.exists()) + self.assertEqual(get_nspanel_setting_with_default(self.panel.id, "screen_dim_level", "gone"), "gone") + self.assertManagerReloaded(times=1) + + def test_delete_requires_delete_method(self): + self.assertEqual(self.client.post(reverse("delete_nspanel", kwargs={"nspanel_id": self.panel.id})).status_code, 405) + self.assertTrue(NSPanel.objects.exists()) + self.assertManagerNotReloaded() + + def test_delete_unknown_panel_is_rejected(self): + self.assertRejected(self.client.delete(reverse("delete_nspanel", kwargs={"nspanel_id": 999}))) + self.assertManagerNotReloaded() + + def test_unblock_removes_the_panel_so_it_can_register_again(self): + for url_name, method in (("htmx_unblock_nspanel", "delete"), ("unblock_nspanel", "get")): + with self.subTest(url_name=url_name): + panel = self.make_panel(self.room, "Blocked", mac=f"AA:BB:CC:DD:EE:{len(url_name):02d}", denied=True) + getattr(self.client, method)(reverse(url_name, kwargs={"nspanel_id": panel.id})) + self.assertFalse(NSPanel.objects.filter(id=panel.id).exists()) + self.assertManagerReloaded(times=2) + + def test_deleting_a_room_keeps_its_panels(self): + other = self.make_room("Lounge") + + self.client.delete(reverse("rest_room_delete", kwargs={"room_id": self.room.id})) + + self.panel.refresh_from_db() + self.assertEqual(self.panel.room, other) + + +# Every field the panel settings form submits, with "use global default" choices. +PANEL_FORM = { + "name": "Kitchen panel", + "button1_mode": "0", + "button1_detached_mode_light": "", + "button1_custom_mqtt_topic": "", + "button1_custom_mqtt_payload": "", + "button2_mode": "0", + "button2_detached_mode_light": "", + "button2_custom_mqtt_topic": "", + "button2_custom_mqtt_payload": "", + "screen_dim_level": "", + "screensaver_dim_level": "", + "screensaver_activation_timeout": "", + "screensaver_mode": "global", + "show_screensaver_inside_temperature": "global", + "show_screensaver_outside_temperature": "global", + "temperature_calibration": "", + "relay1_default_mode": "False", + "relay2_default_mode": "False", + "default_page": "0", + "lock_to_default_room": "False", + "reverse_relays": "False", + "button1_relay_lower_temperature": "", + "button1_relay_upper_temperature": "", + "button2_relay_lower_temperature": "", + "button2_relay_upper_temperature": "", + "panel_type": "eu", + "selected_tft": "tft1", + "relay1_is_light": "False", + "relay2_is_light": "False", +} + + +class PanelSettingsFormTests(NSPMTestCase): + def setUp(self): + super().setUp() + self.room = self.make_room("Kitchen") + self.panel = self.make_panel(self.room, "Panel", accepted=True) + + def save(self, **overrides): + return self.client.post(reverse("save_panel_settings", kwargs={"panel_id": self.panel.id}), PANEL_FORM | {"room_id": self.room.id} | overrides) + + def panel_setting(self, name, default=None): + return get_nspanel_setting_with_default(self.panel.id, name, default) + + def test_save_basic_settings(self): + lounge = self.make_room("Lounge") + + response = self.save(room_id=lounge.id, name="Renamed", default_page="2", temperature_calibration="-1.5") + + self.assertRedirects(response, reverse("edit_nspanel", kwargs={"panel_id": self.panel.id}), fetch_redirect_response=False) + self.panel.refresh_from_db() + self.assertEqual((self.panel.friendly_name, self.panel.room), ("Renamed", lounge)) + self.assertEqual(self.panel_setting("default_page"), "2") + self.assertEqual(self.panel_setting("temperature_calibration"), "-1.5") + self.assertManagerReloaded(times=1) + + def test_blank_overrides_fall_back_to_global_settings(self): + # Start with per-panel overrides, then submit the form with those fields blank + # ("use global default"): saving must delete the overrides, not keep them. + set_nspanel_setting_value(self.panel.id, "screen_dim_level", "40") + set_nspanel_setting_value(self.panel.id, "screensaver_mode", "no_background") + + self.save() + + self.assertIsNone(self.panel_setting("screen_dim_level")) + self.assertIsNone(self.panel_setting("screensaver_mode")) + self.assertEqual(self.panel_setting("temperature_calibration"), "0.0") + + def test_per_panel_overrides_are_stored(self): + self.save(screen_dim_level="40", screensaver_mode="no_background", show_screensaver_inside_temperature="False") + + self.assertEqual(self.panel_setting("screen_dim_level"), "40") + self.assertEqual(self.panel_setting("screensaver_mode"), "no_background") + self.assertEqual(self.panel_setting("show_screensaver_inside_temperature"), "False") + + def test_panel_types(self): + cases = { + "eu": ("False", None), + "us_vertical": ("True", "vertical"), + "us_horizontal": ("True", "horizontal"), + "us_horizontal_mirrored": ("True", "horizontal_mirrored"), + } + for panel_type, expected in cases.items(): + with self.subTest(panel_type=panel_type): + self.save(panel_type=panel_type) + is_us = self.panel_setting("is_us_panel") + self.assertEqual(is_us, expected[0]) + if expected[1]: + self.assertEqual(self.panel_setting("us_panel_orientation"), expected[1]) + + def test_button_detached_mode_links_an_entity(self): + light = self.make_light(self.room, "Ceiling") + + self.save(button1_mode="1", button1_detached_mode_light=str(light.id)) + + self.panel.refresh_from_db() + self.assertEqual(self.panel.button1_mode, 1) + self.assertEqual(self.panel.button1_detached_mode_entity, light) + + self.save(button1_mode="0") + + self.panel.refresh_from_db() + self.assertIsNone(self.panel.button1_detached_mode_entity) + + def test_detached_mode_without_an_entity_is_saved(self): + # Issue #80: with no entities yet, the entity field is empty, or missing entirely as the browser leaves out an empty 1.0 -
  • -
  • - -
  • - -

    - -

    - - - - - \ No newline at end of file diff --git a/docs/static/images/doc/add_new_light.png b/docs/static/images/doc/add_new_light.png deleted file mode 100644 index 47de8d52e..000000000 Binary files a/docs/static/images/doc/add_new_light.png and /dev/null differ diff --git a/docs/static/images/doc/edit_new_light_ha.png b/docs/static/images/doc/edit_new_light_ha.png deleted file mode 100644 index 41729b225..000000000 Binary files a/docs/static/images/doc/edit_new_light_ha.png and /dev/null differ diff --git a/docs/static/images/doc/edit_new_light_openhab.png b/docs/static/images/doc/edit_new_light_openhab.png deleted file mode 100644 index b1056fc92..000000000 Binary files a/docs/static/images/doc/edit_new_light_openhab.png and /dev/null differ diff --git a/docs/static/images/doc/esp_flash_download_tool.png b/docs/static/images/doc/esp_flash_download_tool.png deleted file mode 100644 index 2b928b7c7..000000000 Binary files a/docs/static/images/doc/esp_flash_download_tool.png and /dev/null differ diff --git a/docs/static/images/doc/flash/esphomeweb.jpg b/docs/static/images/doc/flash/esphomeweb.jpg deleted file mode 100644 index cacada57e..000000000 Binary files a/docs/static/images/doc/flash/esphomeweb.jpg and /dev/null differ diff --git a/docs/static/images/doc/flash/extraground.JPG b/docs/static/images/doc/flash/extraground.JPG deleted file mode 100644 index 0de89b119..000000000 Binary files a/docs/static/images/doc/flash/extraground.JPG and /dev/null differ diff --git a/docs/static/images/doc/flash/step1-output.png b/docs/static/images/doc/flash/step1-output.png deleted file mode 100644 index 87e1082b5..000000000 Binary files a/docs/static/images/doc/flash/step1-output.png and /dev/null differ diff --git a/docs/static/images/doc/flash/step1.png b/docs/static/images/doc/flash/step1.png deleted file mode 100644 index add96f641..000000000 Binary files a/docs/static/images/doc/flash/step1.png and /dev/null differ diff --git a/docs/static/images/doc/flash/step2.png b/docs/static/images/doc/flash/step2.png deleted file mode 100644 index 56ee93808..000000000 Binary files a/docs/static/images/doc/flash/step2.png and /dev/null differ diff --git a/docs/static/images/doc/flash/step3.png b/docs/static/images/doc/flash/step3.png deleted file mode 100644 index e31fc7ea7..000000000 Binary files a/docs/static/images/doc/flash/step3.png and /dev/null differ diff --git a/docs/static/images/doc/flash/step4-pinout.png b/docs/static/images/doc/flash/step4-pinout.png deleted file mode 100644 index 7cb5de5f2..000000000 Binary files a/docs/static/images/doc/flash/step4-pinout.png and /dev/null differ diff --git a/docs/static/images/doc/flash/step4.png b/docs/static/images/doc/flash/step4.png deleted file mode 100644 index f728814a3..000000000 Binary files a/docs/static/images/doc/flash/step4.png and /dev/null differ diff --git a/docs/static/images/doc/flash/tiltpanel.gif b/docs/static/images/doc/flash/tiltpanel.gif deleted file mode 100644 index 652231bd0..000000000 Binary files a/docs/static/images/doc/flash/tiltpanel.gif and /dev/null differ diff --git a/docs/static/images/doc/ha/check-auto-start.png b/docs/static/images/doc/ha/check-auto-start.png deleted file mode 100644 index c5bfce423..000000000 Binary files a/docs/static/images/doc/ha/check-auto-start.png and /dev/null differ diff --git a/docs/static/images/doc/hardware/nspanel-vs-nspanelpro.png b/docs/static/images/doc/hardware/nspanel-vs-nspanelpro.png deleted file mode 100644 index 03e77afc6..000000000 Binary files a/docs/static/images/doc/hardware/nspanel-vs-nspanelpro.png and /dev/null differ diff --git a/docs/static/images/doc/hardware/supported/nspanel-eu-black.png b/docs/static/images/doc/hardware/supported/nspanel-eu-black.png deleted file mode 100644 index 3c7c5f58d..000000000 Binary files a/docs/static/images/doc/hardware/supported/nspanel-eu-black.png and /dev/null differ diff --git a/docs/static/images/doc/hardware/supported/nspanel-eu-white.png b/docs/static/images/doc/hardware/supported/nspanel-eu-white.png deleted file mode 100644 index caa702648..000000000 Binary files a/docs/static/images/doc/hardware/supported/nspanel-eu-white.png and /dev/null differ diff --git a/docs/static/images/doc/hardware/supported/nspanel-us-black.png b/docs/static/images/doc/hardware/supported/nspanel-us-black.png deleted file mode 100644 index c80485fa6..000000000 Binary files a/docs/static/images/doc/hardware/supported/nspanel-us-black.png and /dev/null differ diff --git a/docs/static/images/doc/hardware/supported/nspanel-us-white.png b/docs/static/images/doc/hardware/supported/nspanel-us-white.png deleted file mode 100644 index 7de03c339..000000000 Binary files a/docs/static/images/doc/hardware/supported/nspanel-us-white.png and /dev/null differ diff --git a/docs/static/images/doc/index_page.png b/docs/static/images/doc/index_page.png deleted file mode 100644 index 6ee526b7a..000000000 Binary files a/docs/static/images/doc/index_page.png and /dev/null differ diff --git a/docs/static/images/doc/initial_setup_popup.png b/docs/static/images/doc/initial_setup_popup.png deleted file mode 100644 index 7e8d5eced..000000000 Binary files a/docs/static/images/doc/initial_setup_popup.png and /dev/null differ diff --git a/docs/static/images/doc/logo.png b/docs/static/images/doc/logo.png deleted file mode 100644 index 0f1bb2cdf..000000000 Binary files a/docs/static/images/doc/logo.png and /dev/null differ diff --git a/docs/static/images/doc/main_page_numbers.png b/docs/static/images/doc/main_page_numbers.png deleted file mode 100644 index 613d2f6ab..000000000 Binary files a/docs/static/images/doc/main_page_numbers.png and /dev/null differ diff --git a/docs/static/images/doc/nspanel_page.png b/docs/static/images/doc/nspanel_page.png deleted file mode 100644 index e6090d620..000000000 Binary files a/docs/static/images/doc/nspanel_page.png and /dev/null differ diff --git a/docs/static/images/doc/panel_setup_page.png b/docs/static/images/doc/panel_setup_page.png deleted file mode 100644 index f2915767c..000000000 Binary files a/docs/static/images/doc/panel_setup_page.png and /dev/null differ diff --git a/docs/static/images/doc/putty_serial.png b/docs/static/images/doc/putty_serial.png deleted file mode 100644 index d73357504..000000000 Binary files a/docs/static/images/doc/putty_serial.png and /dev/null differ diff --git a/docs/static/images/doc/room_page.png b/docs/static/images/doc/room_page.png deleted file mode 100644 index cfa7203b5..000000000 Binary files a/docs/static/images/doc/room_page.png and /dev/null differ diff --git a/docs/static/images/doc/settings_page.png b/docs/static/images/doc/settings_page.png deleted file mode 100644 index 348e640df..000000000 Binary files a/docs/static/images/doc/settings_page.png and /dev/null differ diff --git a/docs/static/images/doc/weather_and_time.png b/docs/static/images/doc/weather_and_time.png deleted file mode 100644 index 05b0050b2..000000000 Binary files a/docs/static/images/doc/weather_and_time.png and /dev/null differ diff --git a/docs/static/images/favicon.ico b/docs/static/images/favicon.ico deleted file mode 100644 index a99835288..000000000 Binary files a/docs/static/images/favicon.ico and /dev/null differ diff --git a/docs/static/images/logo-dark.svg b/docs/static/images/logo-dark.svg deleted file mode 100644 index 005cb1ada..000000000 --- a/docs/static/images/logo-dark.svg +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/static/images/logo-light.svg b/docs/static/images/logo-light.svg deleted file mode 100644 index 5c5725057..000000000 --- a/docs/static/images/logo-light.svg +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/static/images/nspanelmanager-social-card.jpg b/docs/static/images/nspanelmanager-social-card.jpg deleted file mode 100644 index 67d3a850f..000000000 Binary files a/docs/static/images/nspanelmanager-social-card.jpg and /dev/null differ diff --git a/docs/static/images/screenshots/10EU_screensaver_time_black.png b/docs/static/images/screenshots/10EU_screensaver_time_black.png deleted file mode 100644 index 5aa9474c6..000000000 Binary files a/docs/static/images/screenshots/10EU_screensaver_time_black.png and /dev/null differ diff --git a/docs/static/images/screenshots/11EU_mainpage_soundmode.png b/docs/static/images/screenshots/11EU_mainpage_soundmode.png deleted file mode 100644 index 4be59ae75..000000000 Binary files a/docs/static/images/screenshots/11EU_mainpage_soundmode.png and /dev/null differ diff --git a/docs/static/images/screenshots/12EU_itempage_blinds.png b/docs/static/images/screenshots/12EU_itempage_blinds.png deleted file mode 100644 index b15f57edf..000000000 Binary files a/docs/static/images/screenshots/12EU_itempage_blinds.png and /dev/null differ diff --git a/docs/static/images/screenshots/13EU_dropdown.png b/docs/static/images/screenshots/13EU_dropdown.png deleted file mode 100644 index 6e48c6b73..000000000 Binary files a/docs/static/images/screenshots/13EU_dropdown.png and /dev/null differ diff --git a/docs/static/images/screenshots/14EU_alarmpage.png b/docs/static/images/screenshots/14EU_alarmpage.png deleted file mode 100644 index af154dfc9..000000000 Binary files a/docs/static/images/screenshots/14EU_alarmpage.png and /dev/null differ diff --git a/docs/static/images/screenshots/1EU_mainpage.png b/docs/static/images/screenshots/1EU_mainpage.png deleted file mode 100644 index cb0ac084c..000000000 Binary files a/docs/static/images/screenshots/1EU_mainpage.png and /dev/null differ diff --git a/docs/static/images/screenshots/1EU_mainpage_alllightsmode.png b/docs/static/images/screenshots/1EU_mainpage_alllightsmode.png deleted file mode 100644 index 00800681a..000000000 Binary files a/docs/static/images/screenshots/1EU_mainpage_alllightsmode.png and /dev/null differ diff --git a/docs/static/images/screenshots/3EU_roompage.png b/docs/static/images/screenshots/3EU_roompage.png deleted file mode 100644 index df1f7350e..000000000 Binary files a/docs/static/images/screenshots/3EU_roompage.png and /dev/null differ diff --git a/docs/static/images/screenshots/4EU_itempage_lights.png b/docs/static/images/screenshots/4EU_itempage_lights.png deleted file mode 100644 index 619679edc..000000000 Binary files a/docs/static/images/screenshots/4EU_itempage_lights.png and /dev/null differ diff --git a/docs/static/images/screenshots/6EU-scenespage.png b/docs/static/images/screenshots/6EU-scenespage.png deleted file mode 100644 index 7a0c90e2e..000000000 Binary files a/docs/static/images/screenshots/6EU-scenespage.png and /dev/null differ diff --git a/docs/static/images/screenshots/7EU_screensaver_weather.png b/docs/static/images/screenshots/7EU_screensaver_weather.png deleted file mode 100644 index 73df0fe63..000000000 Binary files a/docs/static/images/screenshots/7EU_screensaver_weather.png and /dev/null differ diff --git a/docs/static/images/screenshots/8EU_screensaver_weather_black.png b/docs/static/images/screenshots/8EU_screensaver_weather_black.png deleted file mode 100644 index 1930c4d33..000000000 Binary files a/docs/static/images/screenshots/8EU_screensaver_weather_black.png and /dev/null differ diff --git a/docs/static/images/screenshots/9EU_screensaver_time.png b/docs/static/images/screenshots/9EU_screensaver_time.png deleted file mode 100644 index 45ab0a58e..000000000 Binary files a/docs/static/images/screenshots/9EU_screensaver_time.png and /dev/null differ diff --git a/docs/static/images/screenshots/US1_mainpage.png b/docs/static/images/screenshots/US1_mainpage.png deleted file mode 100644 index 12a33bdcc..000000000 Binary files a/docs/static/images/screenshots/US1_mainpage.png and /dev/null differ diff --git a/docs/static/images/screenshots/US2_roompage.png b/docs/static/images/screenshots/US2_roompage.png deleted file mode 100644 index 1f4ae1073..000000000 Binary files a/docs/static/images/screenshots/US2_roompage.png and /dev/null differ diff --git a/docs/static/images/screenshots/US3_itempage_lights.png b/docs/static/images/screenshots/US3_itempage_lights.png deleted file mode 100644 index 3b9efbd4d..000000000 Binary files a/docs/static/images/screenshots/US3_itempage_lights.png and /dev/null differ diff --git a/docs/static/images/screenshots/US4_scenepage.png b/docs/static/images/screenshots/US4_scenepage.png deleted file mode 100644 index 3767f313e..000000000 Binary files a/docs/static/images/screenshots/US4_scenepage.png and /dev/null differ diff --git a/docs/static/images/screenshots/US5_screensaver_weather.png b/docs/static/images/screenshots/US5_screensaver_weather.png deleted file mode 100644 index fa4ef328f..000000000 Binary files a/docs/static/images/screenshots/US5_screensaver_weather.png and /dev/null differ diff --git a/docs/static/images/screenshots/US6_screensaver_weather_black.png b/docs/static/images/screenshots/US6_screensaver_weather_black.png deleted file mode 100644 index ea5ce742a..000000000 Binary files a/docs/static/images/screenshots/US6_screensaver_weather_black.png and /dev/null differ diff --git a/docs/static/images/screenshots/US7_screensaver_time.png b/docs/static/images/screenshots/US7_screensaver_time.png deleted file mode 100644 index ba5a90d0d..000000000 Binary files a/docs/static/images/screenshots/US7_screensaver_time.png and /dev/null differ diff --git a/docs/static/images/screenshots/US8_screensaver_time_black.png b/docs/static/images/screenshots/US8_screensaver_time_black.png deleted file mode 100644 index 423655b9f..000000000 Binary files a/docs/static/images/screenshots/US8_screensaver_time_black.png and /dev/null differ diff --git a/docs/static/images/screenshots/US9_dropdown.png b/docs/static/images/screenshots/US9_dropdown.png deleted file mode 100644 index e30e9fbc5..000000000 Binary files a/docs/static/images/screenshots/US9_dropdown.png and /dev/null differ diff --git a/docs/static/manifests/manifest_1.0.json b/docs/static/manifests/manifest_1.0.json deleted file mode 100644 index 474ddc57f..000000000 --- a/docs/static/manifests/manifest_1.0.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "NSPanelManager NSPanel Firmware", - "version": "1.0", - "builds": [ - { - "chipFamily": "ESP32", - "parts": [{ "path": "../firmwares/1.0/merged_flash.bin", "offset": 0 }] - } - ] -} \ No newline at end of file diff --git a/docs/static/manifests/manifest_beta.json b/docs/static/manifests/manifest_beta.json deleted file mode 100644 index 1cc05164a..000000000 --- a/docs/static/manifests/manifest_beta.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "NSPanelManager NSPanel Firmware", - "version": "beta", - "builds": [ - { - "chipFamily": "ESP32", - "parts": [{ "path": "../firmwares/beta/merged_flash.bin", "offset": 0 }] - } - ] -} \ No newline at end of file diff --git a/docs/tsconfig.json b/docs/tsconfig.json deleted file mode 100644 index 314eab8a4..000000000 --- a/docs/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - // This file is not used in compilation. It is here just for a nice editor experience. - "extends": "@docusaurus/tsconfig", - "compilerOptions": { - "baseUrl": "." - } -} diff --git a/protobuf_firmware/protobuf_nspanel.pb-c.c b/protobuf_firmware/protobuf_nspanel.pb-c.c index 5a9f5531d..ac3a82763 100644 --- a/protobuf_firmware/protobuf_nspanel.pb-c.c +++ b/protobuf_firmware/protobuf_nspanel.pb-c.c @@ -13,6 +13,12 @@ void nspanel_config__room_info__init static const NSPanelConfig__RoomInfo init_value = NSPANEL_CONFIG__ROOM_INFO__INIT; *message = init_value; } +void nspanel_config__sound__init + (NSPanelConfig__Sound *message) +{ + static const NSPanelConfig__Sound init_value = NSPANEL_CONFIG__SOUND__INIT; + *message = init_value; +} void nspanel_config__init (NSPanelConfig *message) { @@ -343,6 +349,18 @@ void nspanel_mqttmanager_command__thermostat_command__init static const NSPanelMQTTManagerCommand__ThermostatCommand init_value = NSPANEL_MQTTMANAGER_COMMAND__THERMOSTAT_COMMAND__INIT; *message = init_value; } +void nspanel_mqttmanager_command__media_player_command__init + (NSPanelMQTTManagerCommand__MediaPlayerCommand *message) +{ + static const NSPanelMQTTManagerCommand__MediaPlayerCommand init_value = NSPANEL_MQTTMANAGER_COMMAND__MEDIA_PLAYER_COMMAND__INIT; + *message = init_value; +} +void nspanel_mqttmanager_command__cover_command__init + (NSPanelMQTTManagerCommand__CoverCommand *message) +{ + static const NSPanelMQTTManagerCommand__CoverCommand init_value = NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__INIT; + *message = init_value; +} void nspanel_mqttmanager_command__init (NSPanelMQTTManagerCommand *message) { @@ -452,6 +470,57 @@ const ProtobufCMessageDescriptor nspanel_config__room_info__descriptor = (ProtobufCMessageInit) nspanel_config__room_info__init, NULL,NULL,NULL /* reserved[123] */ }; +static const ProtobufCFieldDescriptor nspanel_config__sound__field_descriptors[2] = +{ + { + "event", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(NSPanelConfig__Sound, event), + &nspanel_config__nspanel_sound_event__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "rtttl", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(NSPanelConfig__Sound, rtttl), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nspanel_config__sound__field_indices_by_name[] = { + 0, /* field[0] = event */ + 1, /* field[1] = rtttl */ +}; +static const ProtobufCIntRange nspanel_config__sound__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor nspanel_config__sound__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "NSPanelConfig.Sound", + "Sound", + "NSPanelConfig__Sound", + "", + sizeof(NSPanelConfig__Sound), + 2, + nspanel_config__sound__field_descriptors, + nspanel_config__sound__field_indices_by_name, + 1, nspanel_config__sound__number_ranges, + (ProtobufCMessageInit) nspanel_config__sound__init, + NULL,NULL,NULL /* reserved[123] */ +}; static const ProtobufCEnumValue nspanel_config__nspanel_default_page__enum_values_by_number[3] = { { "HOME", "NSPANEL_CONFIG__NSPANEL_DEFAULT_PAGE__HOME", 0 }, @@ -516,22 +585,24 @@ const ProtobufCEnumDescriptor nspanel_config__nspanel_screensaver_mode__descript nspanel_config__nspanel_screensaver_mode__value_ranges, NULL,NULL,NULL,NULL /* reserved[1234] */ }; -static const ProtobufCEnumValue nspanel_config__nspanel_button_mode__enum_values_by_number[5] = +static const ProtobufCEnumValue nspanel_config__nspanel_button_mode__enum_values_by_number[6] = { { "DIRECT", "NSPANEL_CONFIG__NSPANEL_BUTTON_MODE__DIRECT", 0 }, { "FOLLOW", "NSPANEL_CONFIG__NSPANEL_BUTTON_MODE__FOLLOW", 1 }, { "NOTIFY_MANAGER", "NSPANEL_CONFIG__NSPANEL_BUTTON_MODE__NOTIFY_MANAGER", 2 }, { "THERMOSTAT_HEAT", "NSPANEL_CONFIG__NSPANEL_BUTTON_MODE__THERMOSTAT_HEAT", 3 }, { "THERMOSTAT_COOL", "NSPANEL_CONFIG__NSPANEL_BUTTON_MODE__THERMOSTAT_COOL", 4 }, + { "OPEN_ENTITY_PAGE", "NSPANEL_CONFIG__NSPANEL_BUTTON_MODE__OPEN_ENTITY_PAGE", 5 }, }; static const ProtobufCIntRange nspanel_config__nspanel_button_mode__value_ranges[] = { -{0, 0},{0, 5} +{0, 0},{0, 6} }; -static const ProtobufCEnumValueIndex nspanel_config__nspanel_button_mode__enum_values_by_name[5] = +static const ProtobufCEnumValueIndex nspanel_config__nspanel_button_mode__enum_values_by_name[6] = { { "DIRECT", 0 }, { "FOLLOW", 1 }, { "NOTIFY_MANAGER", 2 }, + { "OPEN_ENTITY_PAGE", 5 }, { "THERMOSTAT_COOL", 4 }, { "THERMOSTAT_HEAT", 3 }, }; @@ -542,15 +613,45 @@ const ProtobufCEnumDescriptor nspanel_config__nspanel_button_mode__descriptor = "NSPanelButtonMode", "NSPanelConfig__NSPanelButtonMode", "", - 5, + 6, nspanel_config__nspanel_button_mode__enum_values_by_number, - 5, + 6, nspanel_config__nspanel_button_mode__enum_values_by_name, 1, nspanel_config__nspanel_button_mode__value_ranges, NULL,NULL,NULL,NULL /* reserved[1234] */ }; -static const ProtobufCFieldDescriptor nspanel_config__field_descriptors[36] = +static const ProtobufCEnumValue nspanel_config__nspanel_sound_event__enum_values_by_number[3] = +{ + { "TOUCH", "NSPANEL_CONFIG__NSPANEL_SOUND_EVENT__TOUCH", 0 }, + { "SCENE_ACTIVATED", "NSPANEL_CONFIG__NSPANEL_SOUND_EVENT__SCENE_ACTIVATED", 1 }, + { "SCENE_SAVED", "NSPANEL_CONFIG__NSPANEL_SOUND_EVENT__SCENE_SAVED", 2 }, +}; +static const ProtobufCIntRange nspanel_config__nspanel_sound_event__value_ranges[] = { +{0, 0},{0, 3} +}; +static const ProtobufCEnumValueIndex nspanel_config__nspanel_sound_event__enum_values_by_name[3] = +{ + { "SCENE_ACTIVATED", 1 }, + { "SCENE_SAVED", 2 }, + { "TOUCH", 0 }, +}; +const ProtobufCEnumDescriptor nspanel_config__nspanel_sound_event__descriptor = +{ + PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, + "NSPanelConfig.NSPanelSoundEvent", + "NSPanelSoundEvent", + "NSPanelConfig__NSPanelSoundEvent", + "", + 3, + nspanel_config__nspanel_sound_event__enum_values_by_number, + 3, + nspanel_config__nspanel_sound_event__enum_values_by_name, + 1, + nspanel_config__nspanel_sound_event__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor nspanel_config__field_descriptors[40] = { { "name", @@ -984,11 +1085,61 @@ static const ProtobufCFieldDescriptor nspanel_config__field_descriptors[36] = 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, + { + "sounds", + 45, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(NSPanelConfig, n_sounds), + offsetof(NSPanelConfig, sounds), + &nspanel_config__sound__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "tz_posix", + 46, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(NSPanelConfig, tz_posix), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "button1_entity_page_topic", + 47, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(NSPanelConfig, button1_entity_page_topic), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "button2_entity_page_topic", + 48, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(NSPanelConfig, button2_entity_page_topic), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, }; static const unsigned nspanel_config__field_indices_by_name[] = { + 38, /* field[38] = button1_entity_page_topic */ 32, /* field[32] = button1_lower_temperature */ 21, /* field[21] = button1_mode */ 33, /* field[33] = button1_upper_temperature */ + 39, /* field[39] = button2_entity_page_topic */ 34, /* field[34] = button2_lower_temperature */ 22, /* field[22] = button2_mode */ 35, /* field[35] = button2_upper_temperature */ @@ -1018,9 +1169,11 @@ static const unsigned nspanel_config__field_indices_by_name[] = { 10, /* field[10] = screensaver_mode */ 11, /* field[11] = show_screensaver_inside_temperature */ 12, /* field[12] = show_screensaver_outside_temperature */ + 36, /* field[36] = sounds */ 7, /* field[7] = special_mode_release_time */ 6, /* field[6] = special_mode_trigger_time */ 20, /* field[20] = temperature_calibration */ + 37, /* field[37] = tz_posix */ 14, /* field[14] = use_fahrenheit */ }; static const ProtobufCIntRange nspanel_config__number_ranges[5 + 1] = @@ -1030,7 +1183,7 @@ static const ProtobufCIntRange nspanel_config__number_ranges[5 + 1] = { 30, 23 }, { 35, 27 }, { 37, 28 }, - { 0, 36 } + { 0, 40 } }; const ProtobufCMessageDescriptor nspanel_config__descriptor = { @@ -1040,7 +1193,7 @@ const ProtobufCMessageDescriptor nspanel_config__descriptor = "NSPanelConfig", "", sizeof(NSPanelConfig), - 36, + 40, nspanel_config__field_descriptors, nspanel_config__field_indices_by_name, 5, nspanel_config__number_ranges, @@ -1098,21 +1251,23 @@ const ProtobufCMessageDescriptor nspanel_warning__descriptor = (ProtobufCMessageInit) nspanel_warning__init, NULL,NULL,NULL /* reserved[123] */ }; -static const ProtobufCEnumValue nspanel_status_report__state__enum_values_by_number[5] = +static const ProtobufCEnumValue nspanel_status_report__state__enum_values_by_number[6] = { { "ONLINE", "NSPANEL_STATUS_REPORT__STATE__ONLINE", 0 }, { "OFFLINE", "NSPANEL_STATUS_REPORT__STATE__OFFLINE", 1 }, { "UPDATING_TFT", "NSPANEL_STATUS_REPORT__STATE__UPDATING_TFT", 2 }, { "UPDATING_FIRMWARE", "NSPANEL_STATUS_REPORT__STATE__UPDATING_FIRMWARE", 3 }, { "UPDATING_LITTLEFS", "NSPANEL_STATUS_REPORT__STATE__UPDATING_LITTLEFS", 4 }, + { "REBOOTING", "NSPANEL_STATUS_REPORT__STATE__REBOOTING", 5 }, }; static const ProtobufCIntRange nspanel_status_report__state__value_ranges[] = { -{0, 0},{0, 5} +{0, 0},{0, 6} }; -static const ProtobufCEnumValueIndex nspanel_status_report__state__enum_values_by_name[5] = +static const ProtobufCEnumValueIndex nspanel_status_report__state__enum_values_by_name[6] = { { "OFFLINE", 1 }, { "ONLINE", 0 }, + { "REBOOTING", 5 }, { "UPDATING_FIRMWARE", 3 }, { "UPDATING_LITTLEFS", 4 }, { "UPDATING_TFT", 2 }, @@ -1124,9 +1279,9 @@ const ProtobufCEnumDescriptor nspanel_status_report__state__descriptor = "state", "NSPanelStatusReport__State", "", - 5, + 6, nspanel_status_report__state__enum_values_by_number, - 5, + 6, nspanel_status_report__state__enum_values_by_name, 1, nspanel_status_report__state__value_ranges, @@ -1352,7 +1507,47 @@ const ProtobufCMessageDescriptor nspanel_status_report__descriptor = (ProtobufCMessageInit) nspanel_status_report__init, NULL,NULL,NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor nspanel_room_entities_page__entity_slot__field_descriptors[7] = +static const ProtobufCEnumValue nspanel_room_entities_page__entity_slot__entity_type__enum_values_by_number[8] = +{ + { "ENTITY_TYPE_UNSPECIFIED", "NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_UNSPECIFIED", 0 }, + { "ENTITY_TYPE_LIGHT", "NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_LIGHT", 1 }, + { "ENTITY_TYPE_SWITCH", "NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_SWITCH", 2 }, + { "ENTITY_TYPE_BUTTON", "NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_BUTTON", 3 }, + { "ENTITY_TYPE_THERMOSTAT", "NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_THERMOSTAT", 4 }, + { "ENTITY_TYPE_SCENE", "NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_SCENE", 5 }, + { "ENTITY_TYPE_MEDIA_PLAYER", "NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_MEDIA_PLAYER", 6 }, + { "ENTITY_TYPE_COVER", "NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_COVER", 7 }, +}; +static const ProtobufCIntRange nspanel_room_entities_page__entity_slot__entity_type__value_ranges[] = { +{0, 0},{0, 8} +}; +static const ProtobufCEnumValueIndex nspanel_room_entities_page__entity_slot__entity_type__enum_values_by_name[8] = +{ + { "ENTITY_TYPE_BUTTON", 3 }, + { "ENTITY_TYPE_COVER", 7 }, + { "ENTITY_TYPE_LIGHT", 1 }, + { "ENTITY_TYPE_MEDIA_PLAYER", 6 }, + { "ENTITY_TYPE_SCENE", 5 }, + { "ENTITY_TYPE_SWITCH", 2 }, + { "ENTITY_TYPE_THERMOSTAT", 4 }, + { "ENTITY_TYPE_UNSPECIFIED", 0 }, +}; +const ProtobufCEnumDescriptor nspanel_room_entities_page__entity_slot__entity_type__descriptor = +{ + PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, + "NSPanelRoomEntitiesPage.EntitySlot.EntityType", + "EntityType", + "NSPanelRoomEntitiesPage__EntitySlot__EntityType", + "", + 8, + nspanel_room_entities_page__entity_slot__entity_type__enum_values_by_number, + 8, + nspanel_room_entities_page__entity_slot__entity_type__enum_values_by_name, + 1, + nspanel_room_entities_page__entity_slot__entity_type__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor nspanel_room_entities_page__entity_slot__field_descriptors[9] = { { "room_view_position", @@ -1438,20 +1633,46 @@ static const ProtobufCFieldDescriptor nspanel_room_entities_page__entity_slot__f 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, + { + "type", + 8, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(NSPanelRoomEntitiesPage__EntitySlot, type), + &nspanel_room_entities_page__entity_slot__entity_type__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "id", + 9, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelRoomEntitiesPage__EntitySlot, id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, }; static const unsigned nspanel_room_entities_page__entity_slot__field_indices_by_name[] = { 5, /* field[5] = can_save_scene */ 2, /* field[2] = icon */ + 8, /* field[8] = id */ 6, /* field[6] = mqtt_state_topic */ 1, /* field[1] = name */ 3, /* field[3] = pco */ 4, /* field[4] = pco2 */ 0, /* field[0] = room_view_position */ + 7, /* field[7] = type */ }; static const ProtobufCIntRange nspanel_room_entities_page__entity_slot__number_ranges[1 + 1] = { { 1, 0 }, - { 0, 7 } + { 0, 9 } }; const ProtobufCMessageDescriptor nspanel_room_entities_page__entity_slot__descriptor = { @@ -1461,7 +1682,7 @@ const ProtobufCMessageDescriptor nspanel_room_entities_page__entity_slot__descri "NSPanelRoomEntitiesPage__EntitySlot", "", sizeof(NSPanelRoomEntitiesPage__EntitySlot), - 7, + 9, nspanel_room_entities_page__entity_slot__field_descriptors, nspanel_room_entities_page__entity_slot__field_indices_by_name, 1, nspanel_room_entities_page__entity_slot__number_ranges, @@ -2522,6 +2743,336 @@ const ProtobufCMessageDescriptor nspanel_mqttmanager_command__thermostat_command (ProtobufCMessageInit) nspanel_mqttmanager_command__thermostat_command__init, NULL,NULL,NULL /* reserved[123] */ }; +static const ProtobufCEnumValue nspanel_mqttmanager_command__media_player_command__playback_action__enum_values_by_number[5] = +{ + { "NONE", "NSPANEL_MQTTMANAGER_COMMAND__MEDIA_PLAYER_COMMAND__PLAYBACK_ACTION__NONE", 0 }, + { "PLAY", "NSPANEL_MQTTMANAGER_COMMAND__MEDIA_PLAYER_COMMAND__PLAYBACK_ACTION__PLAY", 1 }, + { "PAUSE", "NSPANEL_MQTTMANAGER_COMMAND__MEDIA_PLAYER_COMMAND__PLAYBACK_ACTION__PAUSE", 2 }, + { "NEXT_TRACK", "NSPANEL_MQTTMANAGER_COMMAND__MEDIA_PLAYER_COMMAND__PLAYBACK_ACTION__NEXT_TRACK", 3 }, + { "PREVIOUS_TRACK", "NSPANEL_MQTTMANAGER_COMMAND__MEDIA_PLAYER_COMMAND__PLAYBACK_ACTION__PREVIOUS_TRACK", 4 }, +}; +static const ProtobufCIntRange nspanel_mqttmanager_command__media_player_command__playback_action__value_ranges[] = { +{0, 0},{0, 5} +}; +static const ProtobufCEnumValueIndex nspanel_mqttmanager_command__media_player_command__playback_action__enum_values_by_name[5] = +{ + { "NEXT_TRACK", 3 }, + { "NONE", 0 }, + { "PAUSE", 2 }, + { "PLAY", 1 }, + { "PREVIOUS_TRACK", 4 }, +}; +const ProtobufCEnumDescriptor nspanel_mqttmanager_command__media_player_command__playback_action__descriptor = +{ + PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, + "NSPanelMQTTManagerCommand.MediaPlayerCommand.PlaybackAction", + "PlaybackAction", + "NSPanelMQTTManagerCommand__MediaPlayerCommand__PlaybackAction", + "", + 5, + nspanel_mqttmanager_command__media_player_command__playback_action__enum_values_by_number, + 5, + nspanel_mqttmanager_command__media_player_command__playback_action__enum_values_by_name, + 1, + nspanel_mqttmanager_command__media_player_command__playback_action__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor nspanel_mqttmanager_command__media_player_command__field_descriptors[10] = +{ + { + "media_player_id", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelMQTTManagerCommand__MediaPlayerCommand, media_player_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "playback_action", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(NSPanelMQTTManagerCommand__MediaPlayerCommand, playback_action), + &nspanel_mqttmanager_command__media_player_command__playback_action__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "has_volume", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelMQTTManagerCommand__MediaPlayerCommand, has_volume), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "volume", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelMQTTManagerCommand__MediaPlayerCommand, volume), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "has_source_volume", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelMQTTManagerCommand__MediaPlayerCommand, has_source_volume), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "source_volume", + 6, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelMQTTManagerCommand__MediaPlayerCommand, source_volume), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "has_muted", + 7, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelMQTTManagerCommand__MediaPlayerCommand, has_muted), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "muted", + 8, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelMQTTManagerCommand__MediaPlayerCommand, muted), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "select_player_source", + 9, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(NSPanelMQTTManagerCommand__MediaPlayerCommand, select_player_source), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "select_source_player_source", + 10, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(NSPanelMQTTManagerCommand__MediaPlayerCommand, select_source_player_source), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nspanel_mqttmanager_command__media_player_command__field_indices_by_name[] = { + 6, /* field[6] = has_muted */ + 4, /* field[4] = has_source_volume */ + 2, /* field[2] = has_volume */ + 0, /* field[0] = media_player_id */ + 7, /* field[7] = muted */ + 1, /* field[1] = playback_action */ + 8, /* field[8] = select_player_source */ + 9, /* field[9] = select_source_player_source */ + 5, /* field[5] = source_volume */ + 3, /* field[3] = volume */ +}; +static const ProtobufCIntRange nspanel_mqttmanager_command__media_player_command__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 10 } +}; +const ProtobufCMessageDescriptor nspanel_mqttmanager_command__media_player_command__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "NSPanelMQTTManagerCommand.MediaPlayerCommand", + "MediaPlayerCommand", + "NSPanelMQTTManagerCommand__MediaPlayerCommand", + "", + sizeof(NSPanelMQTTManagerCommand__MediaPlayerCommand), + 10, + nspanel_mqttmanager_command__media_player_command__field_descriptors, + nspanel_mqttmanager_command__media_player_command__field_indices_by_name, + 1, nspanel_mqttmanager_command__media_player_command__number_ranges, + (ProtobufCMessageInit) nspanel_mqttmanager_command__media_player_command__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCEnumValue nspanel_mqttmanager_command__cover_command__action__enum_values_by_number[7] = +{ + { "NONE", "NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__ACTION__NONE", 0 }, + { "OPEN", "NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__ACTION__OPEN", 1 }, + { "CLOSE", "NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__ACTION__CLOSE", 2 }, + { "STOP", "NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__ACTION__STOP", 3 }, + { "OPEN_TILT", "NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__ACTION__OPEN_TILT", 4 }, + { "CLOSE_TILT", "NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__ACTION__CLOSE_TILT", 5 }, + { "STOP_TILT", "NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__ACTION__STOP_TILT", 6 }, +}; +static const ProtobufCIntRange nspanel_mqttmanager_command__cover_command__action__value_ranges[] = { +{0, 0},{0, 7} +}; +static const ProtobufCEnumValueIndex nspanel_mqttmanager_command__cover_command__action__enum_values_by_name[7] = +{ + { "CLOSE", 2 }, + { "CLOSE_TILT", 5 }, + { "NONE", 0 }, + { "OPEN", 1 }, + { "OPEN_TILT", 4 }, + { "STOP", 3 }, + { "STOP_TILT", 6 }, +}; +const ProtobufCEnumDescriptor nspanel_mqttmanager_command__cover_command__action__descriptor = +{ + PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, + "NSPanelMQTTManagerCommand.CoverCommand.Action", + "Action", + "NSPanelMQTTManagerCommand__CoverCommand__Action", + "", + 7, + nspanel_mqttmanager_command__cover_command__action__enum_values_by_number, + 7, + nspanel_mqttmanager_command__cover_command__action__enum_values_by_name, + 1, + nspanel_mqttmanager_command__cover_command__action__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor nspanel_mqttmanager_command__cover_command__field_descriptors[6] = +{ + { + "cover_id", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelMQTTManagerCommand__CoverCommand, cover_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "action", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(NSPanelMQTTManagerCommand__CoverCommand, action), + &nspanel_mqttmanager_command__cover_command__action__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "has_position", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelMQTTManagerCommand__CoverCommand, has_position), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "position", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelMQTTManagerCommand__CoverCommand, position), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "has_tilt_position", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelMQTTManagerCommand__CoverCommand, has_tilt_position), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "tilt_position", + 6, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelMQTTManagerCommand__CoverCommand, tilt_position), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nspanel_mqttmanager_command__cover_command__field_indices_by_name[] = { + 1, /* field[1] = action */ + 0, /* field[0] = cover_id */ + 2, /* field[2] = has_position */ + 4, /* field[4] = has_tilt_position */ + 3, /* field[3] = position */ + 5, /* field[5] = tilt_position */ +}; +static const ProtobufCIntRange nspanel_mqttmanager_command__cover_command__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 6 } +}; +const ProtobufCMessageDescriptor nspanel_mqttmanager_command__cover_command__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "NSPanelMQTTManagerCommand.CoverCommand", + "CoverCommand", + "NSPanelMQTTManagerCommand__CoverCommand", + "", + sizeof(NSPanelMQTTManagerCommand__CoverCommand), + 6, + nspanel_mqttmanager_command__cover_command__field_descriptors, + nspanel_mqttmanager_command__cover_command__field_indices_by_name, + 1, nspanel_mqttmanager_command__cover_command__number_ranges, + (ProtobufCMessageInit) nspanel_mqttmanager_command__cover_command__init, + NULL,NULL,NULL /* reserved[123] */ +}; static const ProtobufCEnumValue nspanel_mqttmanager_command__affect_lights_options__enum_values_by_number[3] = { { "ALL", "NSPANEL_MQTTMANAGER_COMMAND__AFFECT_LIGHTS_OPTIONS__ALL", 0 }, @@ -2552,7 +3103,7 @@ const ProtobufCEnumDescriptor nspanel_mqttmanager_command__affect_lights_options nspanel_mqttmanager_command__affect_lights_options__value_ranges, NULL,NULL,NULL,NULL /* reserved[1234] */ }; -static const ProtobufCFieldDescriptor nspanel_mqttmanager_command__field_descriptors[9] = +static const ProtobufCFieldDescriptor nspanel_mqttmanager_command__field_descriptors[11] = { { "first_page_turn_on", @@ -2650,6 +3201,30 @@ static const ProtobufCFieldDescriptor nspanel_mqttmanager_command__field_descrip 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, + { + "media_player_command", + 9, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(NSPanelMQTTManagerCommand, command_data_case), + offsetof(NSPanelMQTTManagerCommand, media_player_command), + &nspanel_mqttmanager_command__media_player_command__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "cover_command", + 10, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(NSPanelMQTTManagerCommand, command_data_case), + offsetof(NSPanelMQTTManagerCommand, cover_command), + &nspanel_mqttmanager_command__cover_command__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, { "nspanel_id", 100, @@ -2665,10 +3240,12 @@ static const ProtobufCFieldDescriptor nspanel_mqttmanager_command__field_descrip }; static const unsigned nspanel_mqttmanager_command__field_indices_by_name[] = { 5, /* field[5] = button_pressed */ + 9, /* field[9] = cover_command */ 1, /* field[1] = first_page_turn_off */ 0, /* field[0] = first_page_turn_on */ 2, /* field[2] = light_command */ - 8, /* field[8] = nspanel_id */ + 8, /* field[8] = media_player_command */ + 10, /* field[10] = nspanel_id */ 4, /* field[4] = save_scene_command */ 7, /* field[7] = thermostat_command */ 6, /* field[6] = thermostat_temperature_command */ @@ -2677,8 +3254,8 @@ static const unsigned nspanel_mqttmanager_command__field_indices_by_name[] = { static const ProtobufCIntRange nspanel_mqttmanager_command__number_ranges[2 + 1] = { { 1, 0 }, - { 100, 8 }, - { 0, 9 } + { 100, 10 }, + { 0, 11 } }; const ProtobufCMessageDescriptor nspanel_mqttmanager_command__descriptor = { @@ -2688,7 +3265,7 @@ const ProtobufCMessageDescriptor nspanel_mqttmanager_command__descriptor = "NSPanelMQTTManagerCommand", "", sizeof(NSPanelMQTTManagerCommand), - 9, + 11, nspanel_mqttmanager_command__field_descriptors, nspanel_mqttmanager_command__field_indices_by_name, 2, nspanel_mqttmanager_command__number_ranges, diff --git a/protobuf_firmware/protobuf_nspanel.pb-c.h b/protobuf_firmware/protobuf_nspanel.pb-c.h index 69cfa57f4..378695951 100644 --- a/protobuf_firmware/protobuf_nspanel.pb-c.h +++ b/protobuf_firmware/protobuf_nspanel.pb-c.h @@ -17,6 +17,7 @@ PROTOBUF_C__BEGIN_DECLS typedef struct NSPanelConfig NSPanelConfig; typedef struct NSPanelConfig__RoomInfo NSPanelConfig__RoomInfo; +typedef struct NSPanelConfig__Sound NSPanelConfig__Sound; typedef struct NSPanelWarning NSPanelWarning; typedef struct NSPanelStatusReport NSPanelStatusReport; typedef struct NSPanelRoomEntitiesPage NSPanelRoomEntitiesPage; @@ -33,6 +34,8 @@ typedef struct NSPanelMQTTManagerCommand__SaveSceneCommand NSPanelMQTTManagerCom typedef struct NSPanelMQTTManagerCommand__ButtonPressed NSPanelMQTTManagerCommand__ButtonPressed; typedef struct NSPanelMQTTManagerCommand__ThermostatTemperatureCommand NSPanelMQTTManagerCommand__ThermostatTemperatureCommand; typedef struct NSPanelMQTTManagerCommand__ThermostatCommand NSPanelMQTTManagerCommand__ThermostatCommand; +typedef struct NSPanelMQTTManagerCommand__MediaPlayerCommand NSPanelMQTTManagerCommand__MediaPlayerCommand; +typedef struct NSPanelMQTTManagerCommand__CoverCommand NSPanelMQTTManagerCommand__CoverCommand; /* --- enums --- */ @@ -63,17 +66,70 @@ typedef enum _NSPanelConfig__NSPanelButtonMode { NSPANEL_CONFIG__NSPANEL_BUTTON_MODE__FOLLOW = 1, NSPANEL_CONFIG__NSPANEL_BUTTON_MODE__NOTIFY_MANAGER = 2, NSPANEL_CONFIG__NSPANEL_BUTTON_MODE__THERMOSTAT_HEAT = 3, - NSPANEL_CONFIG__NSPANEL_BUTTON_MODE__THERMOSTAT_COOL = 4 + NSPANEL_CONFIG__NSPANEL_BUTTON_MODE__THERMOSTAT_COOL = 4, + /* + * Open the entity page for buttonN_entity_page_topic. The relay is left alone. + */ + NSPANEL_CONFIG__NSPANEL_BUTTON_MODE__OPEN_ENTITY_PAGE = 5 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(NSPANEL_CONFIG__NSPANEL_BUTTON_MODE) } NSPanelConfig__NSPanelButtonMode; +/* + * Sounds played by the panel buzzer, one entry per event. An event without an entry, or with an empty rtttl, is silent. + * Panels ignore events they do not know about. + */ +typedef enum _NSPanelConfig__NSPanelSoundEvent { + /* + * The screen was touched + */ + NSPANEL_CONFIG__NSPANEL_SOUND_EVENT__TOUCH = 0, + /* + * A scene was triggered from the panel. Played instead of the TOUCH sound for that touch. + */ + NSPANEL_CONFIG__NSPANEL_SOUND_EVENT__SCENE_ACTIVATED = 1, + /* + * A scene was saved from the panel + */ + NSPANEL_CONFIG__NSPANEL_SOUND_EVENT__SCENE_SAVED = 2 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(NSPANEL_CONFIG__NSPANEL_SOUND_EVENT) +} NSPanelConfig__NSPanelSoundEvent; typedef enum _NSPanelStatusReport__State { NSPANEL_STATUS_REPORT__STATE__ONLINE = 0, NSPANEL_STATUS_REPORT__STATE__OFFLINE = 1, NSPANEL_STATUS_REPORT__STATE__UPDATING_TFT = 2, NSPANEL_STATUS_REPORT__STATE__UPDATING_FIRMWARE = 3, - NSPANEL_STATUS_REPORT__STATE__UPDATING_LITTLEFS = 4 + NSPANEL_STATUS_REPORT__STATE__UPDATING_LITTLEFS = 4, + NSPANEL_STATUS_REPORT__STATE__REBOOTING = 5 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(NSPANEL_STATUS_REPORT__STATE) } NSPanelStatusReport__State; +typedef enum _NSPanelRoomEntitiesPage__EntitySlot__EntityType { + NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_UNSPECIFIED = 0, + NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_LIGHT = 1, + NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_SWITCH = 2, + NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_BUTTON = 3, + NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_THERMOSTAT = 4, + NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_SCENE = 5, + NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_MEDIA_PLAYER = 6, + NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_COVER = 7 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE) +} NSPanelRoomEntitiesPage__EntitySlot__EntityType; +typedef enum _NSPanelMQTTManagerCommand__MediaPlayerCommand__PlaybackAction { + NSPANEL_MQTTMANAGER_COMMAND__MEDIA_PLAYER_COMMAND__PLAYBACK_ACTION__NONE = 0, + NSPANEL_MQTTMANAGER_COMMAND__MEDIA_PLAYER_COMMAND__PLAYBACK_ACTION__PLAY = 1, + NSPANEL_MQTTMANAGER_COMMAND__MEDIA_PLAYER_COMMAND__PLAYBACK_ACTION__PAUSE = 2, + NSPANEL_MQTTMANAGER_COMMAND__MEDIA_PLAYER_COMMAND__PLAYBACK_ACTION__NEXT_TRACK = 3, + NSPANEL_MQTTMANAGER_COMMAND__MEDIA_PLAYER_COMMAND__PLAYBACK_ACTION__PREVIOUS_TRACK = 4 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(NSPANEL_MQTTMANAGER_COMMAND__MEDIA_PLAYER_COMMAND__PLAYBACK_ACTION) +} NSPanelMQTTManagerCommand__MediaPlayerCommand__PlaybackAction; +typedef enum _NSPanelMQTTManagerCommand__CoverCommand__Action { + NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__ACTION__NONE = 0, + NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__ACTION__OPEN = 1, + NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__ACTION__CLOSE = 2, + NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__ACTION__STOP = 3, + NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__ACTION__OPEN_TILT = 4, + NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__ACTION__CLOSE_TILT = 5, + NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__ACTION__STOP_TILT = 6 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__ACTION) +} NSPanelMQTTManagerCommand__CoverCommand__Action; typedef enum _NSPanelMQTTManagerCommand__AffectLightsOptions { NSPANEL_MQTTMANAGER_COMMAND__AFFECT_LIGHTS_OPTIONS__ALL = 0, NSPANEL_MQTTMANAGER_COMMAND__AFFECT_LIGHTS_OPTIONS__TABLE_LIGHTS = 1, @@ -106,6 +162,20 @@ struct NSPanelConfig__RoomInfo , 0, 0,NULL, 0,NULL } +struct NSPanelConfig__Sound +{ + ProtobufCMessage base; + NSPanelConfig__NSPanelSoundEvent event; + /* + * Melody in RTTTL format, ex. "touch:d=32,o=6,b=190:g6,16p,32c7" + */ + char *rtttl; +}; +#define NSPANEL_CONFIG__SOUND__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nspanel_config__sound__descriptor) \ + , NSPANEL_CONFIG__NSPANEL_SOUND_EVENT__TOUCH, (char *)protobuf_c_empty_string } + + struct NSPanelConfig { ProtobufCMessage base; @@ -170,10 +240,22 @@ struct NSPanelConfig * At what temperature should relay2 turn off (heating) or on (cooling) when in thermostat mode. */ int32_t button2_upper_temperature; + size_t n_sounds; + NSPanelConfig__Sound **sounds; + /* + * POSIX TZ rule for the manager's timezone, ex. "CET-1CEST,M3.5.0,M10.5.0/3", for setenv("TZ", ...) and tzset(). + * Empty if the manager could not work it out, in which case show the time from the manager's status/time topic. + */ + char *tz_posix; + /* + * State topic of the entity whose page a button opens when buttonN_mode is OPEN_ENTITY_PAGE. Empty otherwise. + */ + char *button1_entity_page_topic; + char *button2_entity_page_topic; }; #define NSPANEL_CONFIG__INIT \ { PROTOBUF_C_MESSAGE_INIT (&nspanel_config__descriptor) \ - , (char *)protobuf_c_empty_string, 0, NSPANEL_CONFIG__NSPANEL_DEFAULT_PAGE__HOME, 0, 0, 0, 0, 0, 0, 0, NSPANEL_CONFIG__NSPANEL_SCREENSAVER_MODE__WEATHER_WITH_BACKGROUND, 0, 0, 0, 0, 0, 0,NULL, 0, 0, 0, 0, NSPANEL_CONFIG__NSPANEL_BUTTON_MODE__DIRECT, NSPANEL_CONFIG__NSPANEL_BUTTON_MODE__DIRECT, 0,NULL, 0, 0, 0, 0,NULL, 0,NULL, 0, 0, (char *)protobuf_c_empty_string, 0, 0, 0, 0 } + , (char *)protobuf_c_empty_string, 0, NSPANEL_CONFIG__NSPANEL_DEFAULT_PAGE__HOME, 0, 0, 0, 0, 0, 0, 0, NSPANEL_CONFIG__NSPANEL_SCREENSAVER_MODE__WEATHER_WITH_BACKGROUND, 0, 0, 0, 0, 0, 0,NULL, 0, 0, 0, 0, NSPANEL_CONFIG__NSPANEL_BUTTON_MODE__DIRECT, NSPANEL_CONFIG__NSPANEL_BUTTON_MODE__DIRECT, 0,NULL, 0, 0, 0, 0,NULL, 0,NULL, 0, 0, (char *)protobuf_c_empty_string, 0, 0, 0, 0, 0,NULL, (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string } struct NSPanelWarning @@ -225,10 +307,12 @@ struct NSPanelRoomEntitiesPage__EntitySlot * MQTT topic where NSPanelEntityState is sent for control of individual entity. Empty if not controllable individually. */ char *mqtt_state_topic; + NSPanelRoomEntitiesPage__EntitySlot__EntityType type; + int32_t id; }; #define NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__INIT \ { PROTOBUF_C_MESSAGE_INIT (&nspanel_room_entities_page__entity_slot__descriptor) \ - , 0, (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string, 0, 0, 0, (char *)protobuf_c_empty_string } + , 0, (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string, 0, 0, 0, (char *)protobuf_c_empty_string, NSPANEL_ROOM_ENTITIES_PAGE__ENTITY_SLOT__ENTITY_TYPE__ENTITY_TYPE_UNSPECIFIED, 0 } /* @@ -422,6 +506,55 @@ struct NSPanelMQTTManagerCommand__ThermostatCommand , 0, (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string } +struct NSPanelMQTTManagerCommand__MediaPlayerCommand +{ + ProtobufCMessage base; + int32_t media_player_id; + NSPanelMQTTManagerCommand__MediaPlayerCommand__PlaybackAction playback_action; + protobuf_c_boolean has_volume; + /* + * Volume in 0-100% + */ + int32_t volume; + protobuf_c_boolean has_source_volume; + /* + * Volume in 0-100% + */ + int32_t source_volume; + protobuf_c_boolean has_muted; + protobuf_c_boolean muted; + /* + * Name of a source to select, as sent in the state's source lists. Empty means no change. + */ + char *select_player_source; + char *select_source_player_source; +}; +#define NSPANEL_MQTTMANAGER_COMMAND__MEDIA_PLAYER_COMMAND__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nspanel_mqttmanager_command__media_player_command__descriptor) \ + , 0, NSPANEL_MQTTMANAGER_COMMAND__MEDIA_PLAYER_COMMAND__PLAYBACK_ACTION__NONE, 0, 0, 0, 0, 0, 0, (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string } + + +struct NSPanelMQTTManagerCommand__CoverCommand +{ + ProtobufCMessage base; + int32_t cover_id; + NSPanelMQTTManagerCommand__CoverCommand__Action action; + protobuf_c_boolean has_position; + /* + * 0 = closed, 100 = open + */ + int32_t position; + protobuf_c_boolean has_tilt_position; + /* + * 0-100 + */ + int32_t tilt_position; +}; +#define NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nspanel_mqttmanager_command__cover_command__descriptor) \ + , 0, NSPANEL_MQTTMANAGER_COMMAND__COVER_COMMAND__ACTION__NONE, 0, 0, 0, 0 } + + typedef enum { NSPANEL_MQTTMANAGER_COMMAND__COMMAND_DATA__NOT_SET = 0, NSPANEL_MQTTMANAGER_COMMAND__COMMAND_DATA_FIRST_PAGE_TURN_ON = 1, @@ -431,7 +564,9 @@ typedef enum { NSPANEL_MQTTMANAGER_COMMAND__COMMAND_DATA_SAVE_SCENE_COMMAND = 5, NSPANEL_MQTTMANAGER_COMMAND__COMMAND_DATA_BUTTON_PRESSED = 6, NSPANEL_MQTTMANAGER_COMMAND__COMMAND_DATA_THERMOSTAT_TEMPERATURE_COMMAND = 7, - NSPANEL_MQTTMANAGER_COMMAND__COMMAND_DATA_THERMOSTAT_COMMAND = 8 + NSPANEL_MQTTMANAGER_COMMAND__COMMAND_DATA_THERMOSTAT_COMMAND = 8, + NSPANEL_MQTTMANAGER_COMMAND__COMMAND_DATA_MEDIA_PLAYER_COMMAND = 9, + NSPANEL_MQTTMANAGER_COMMAND__COMMAND_DATA_COVER_COMMAND = 10 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(NSPANEL_MQTTMANAGER_COMMAND__COMMAND_DATA__CASE) } NSPanelMQTTManagerCommand__CommandDataCase; @@ -452,6 +587,8 @@ struct NSPanelMQTTManagerCommand NSPanelMQTTManagerCommand__ButtonPressed *button_pressed; NSPanelMQTTManagerCommand__ThermostatTemperatureCommand *thermostat_temperature_command; NSPanelMQTTManagerCommand__ThermostatCommand *thermostat_command; + NSPanelMQTTManagerCommand__MediaPlayerCommand *media_player_command; + NSPanelMQTTManagerCommand__CoverCommand *cover_command; }; }; #define NSPANEL_MQTTMANAGER_COMMAND__INIT \ @@ -462,6 +599,9 @@ struct NSPanelMQTTManagerCommand /* NSPanelConfig__RoomInfo methods */ void nspanel_config__room_info__init (NSPanelConfig__RoomInfo *message); +/* NSPanelConfig__Sound methods */ +void nspanel_config__sound__init + (NSPanelConfig__Sound *message); /* NSPanelConfig methods */ void nspanel_config__init (NSPanelConfig *message); @@ -606,6 +746,12 @@ void nspanel_mqttmanager_command__thermostat_temperature_command__init /* NSPanelMQTTManagerCommand__ThermostatCommand methods */ void nspanel_mqttmanager_command__thermostat_command__init (NSPanelMQTTManagerCommand__ThermostatCommand *message); +/* NSPanelMQTTManagerCommand__MediaPlayerCommand methods */ +void nspanel_mqttmanager_command__media_player_command__init + (NSPanelMQTTManagerCommand__MediaPlayerCommand *message); +/* NSPanelMQTTManagerCommand__CoverCommand methods */ +void nspanel_mqttmanager_command__cover_command__init + (NSPanelMQTTManagerCommand__CoverCommand *message); /* NSPanelMQTTManagerCommand methods */ void nspanel_mqttmanager_command__init (NSPanelMQTTManagerCommand *message); @@ -630,6 +776,9 @@ void nspanel_mqttmanager_command__free_unpacked typedef void (*NSPanelConfig__RoomInfo_Closure) (const NSPanelConfig__RoomInfo *message, void *closure_data); +typedef void (*NSPanelConfig__Sound_Closure) + (const NSPanelConfig__Sound *message, + void *closure_data); typedef void (*NSPanelConfig_Closure) (const NSPanelConfig *message, void *closure_data); @@ -678,6 +827,12 @@ typedef void (*NSPanelMQTTManagerCommand__ThermostatTemperatureCommand_Closure) typedef void (*NSPanelMQTTManagerCommand__ThermostatCommand_Closure) (const NSPanelMQTTManagerCommand__ThermostatCommand *message, void *closure_data); +typedef void (*NSPanelMQTTManagerCommand__MediaPlayerCommand_Closure) + (const NSPanelMQTTManagerCommand__MediaPlayerCommand *message, + void *closure_data); +typedef void (*NSPanelMQTTManagerCommand__CoverCommand_Closure) + (const NSPanelMQTTManagerCommand__CoverCommand *message, + void *closure_data); typedef void (*NSPanelMQTTManagerCommand_Closure) (const NSPanelMQTTManagerCommand *message, void *closure_data); @@ -690,14 +845,17 @@ typedef void (*NSPanelMQTTManagerCommand_Closure) extern const ProtobufCEnumDescriptor nspanel_warning_level__descriptor; extern const ProtobufCMessageDescriptor nspanel_config__descriptor; extern const ProtobufCMessageDescriptor nspanel_config__room_info__descriptor; +extern const ProtobufCMessageDescriptor nspanel_config__sound__descriptor; extern const ProtobufCEnumDescriptor nspanel_config__nspanel_default_page__descriptor; extern const ProtobufCEnumDescriptor nspanel_config__nspanel_screensaver_mode__descriptor; extern const ProtobufCEnumDescriptor nspanel_config__nspanel_button_mode__descriptor; +extern const ProtobufCEnumDescriptor nspanel_config__nspanel_sound_event__descriptor; extern const ProtobufCMessageDescriptor nspanel_warning__descriptor; extern const ProtobufCMessageDescriptor nspanel_status_report__descriptor; extern const ProtobufCEnumDescriptor nspanel_status_report__state__descriptor; extern const ProtobufCMessageDescriptor nspanel_room_entities_page__descriptor; extern const ProtobufCMessageDescriptor nspanel_room_entities_page__entity_slot__descriptor; +extern const ProtobufCEnumDescriptor nspanel_room_entities_page__entity_slot__entity_type__descriptor; extern const ProtobufCMessageDescriptor nspanel_room_status__descriptor; extern const ProtobufCMessageDescriptor nspanel_weather_update__descriptor; extern const ProtobufCMessageDescriptor nspanel_weather_update__forecast_item__descriptor; @@ -710,6 +868,10 @@ extern const ProtobufCMessageDescriptor nspanel_mqttmanager_command__save_scene_ extern const ProtobufCMessageDescriptor nspanel_mqttmanager_command__button_pressed__descriptor; extern const ProtobufCMessageDescriptor nspanel_mqttmanager_command__thermostat_temperature_command__descriptor; extern const ProtobufCMessageDescriptor nspanel_mqttmanager_command__thermostat_command__descriptor; +extern const ProtobufCMessageDescriptor nspanel_mqttmanager_command__media_player_command__descriptor; +extern const ProtobufCEnumDescriptor nspanel_mqttmanager_command__media_player_command__playback_action__descriptor; +extern const ProtobufCMessageDescriptor nspanel_mqttmanager_command__cover_command__descriptor; +extern const ProtobufCEnumDescriptor nspanel_mqttmanager_command__cover_command__action__descriptor; extern const ProtobufCEnumDescriptor nspanel_mqttmanager_command__affect_lights_options__descriptor; PROTOBUF_C__END_DECLS diff --git a/protobuf_firmware/protobuf_nspanel_entity.pb-c.c b/protobuf_firmware/protobuf_nspanel_entity.pb-c.c index 4ec8c05c0..6abe97b75 100644 --- a/protobuf_firmware/protobuf_nspanel_entity.pb-c.c +++ b/protobuf_firmware/protobuf_nspanel_entity.pb-c.c @@ -31,6 +31,24 @@ void nspanel_entity_state__thermostat__init static const NSPanelEntityState__Thermostat init_value = NSPANEL_ENTITY_STATE__THERMOSTAT__INIT; *message = init_value; } +void nspanel_entity_state__media_player__source_selection__init + (NSPanelEntityState__MediaPlayer__SourceSelection *message) +{ + static const NSPanelEntityState__MediaPlayer__SourceSelection init_value = NSPANEL_ENTITY_STATE__MEDIA_PLAYER__SOURCE_SELECTION__INIT; + *message = init_value; +} +void nspanel_entity_state__media_player__init + (NSPanelEntityState__MediaPlayer *message) +{ + static const NSPanelEntityState__MediaPlayer init_value = NSPANEL_ENTITY_STATE__MEDIA_PLAYER__INIT; + *message = init_value; +} +void nspanel_entity_state__cover__init + (NSPanelEntityState__Cover *message) +{ + static const NSPanelEntityState__Cover init_value = NSPANEL_ENTITY_STATE__COVER__INIT; + *message = init_value; +} void nspanel_entity_state__init (NSPanelEntityState *message) { @@ -503,51 +521,850 @@ const ProtobufCMessageDescriptor nspanel_entity_state__thermostat__descriptor = (ProtobufCMessageInit) nspanel_entity_state__thermostat__init, NULL,NULL,NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor nspanel_entity_state__field_descriptors[2] = +static const ProtobufCFieldDescriptor nspanel_entity_state__media_player__source_selection__field_descriptors[3] = { { - "light", + "sources", 1, - PROTOBUF_C_LABEL_NONE, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(NSPanelEntityState, entity_case), - offsetof(NSPanelEntityState, light), - &nspanel_entity_state__light__descriptor, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_STRING, + offsetof(NSPanelEntityState__MediaPlayer__SourceSelection, n_sources), + offsetof(NSPanelEntityState__MediaPlayer__SourceSelection, sources), NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + &protobuf_c_empty_string, + 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, { - "thermostat", + "current_source", 2, PROTOBUF_C_LABEL_NONE, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(NSPanelEntityState, entity_case), - offsetof(NSPanelEntityState, thermostat), - &nspanel_entity_state__thermostat__descriptor, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer__SourceSelection, current_source), NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "can_select", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer__SourceSelection, can_select), + NULL, + NULL, + 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, }; -static const unsigned nspanel_entity_state__field_indices_by_name[] = { - 0, /* field[0] = light */ - 1, /* field[1] = thermostat */ +static const unsigned nspanel_entity_state__media_player__source_selection__field_indices_by_name[] = { + 2, /* field[2] = can_select */ + 1, /* field[1] = current_source */ + 0, /* field[0] = sources */ }; -static const ProtobufCIntRange nspanel_entity_state__number_ranges[1 + 1] = +static const ProtobufCIntRange nspanel_entity_state__media_player__source_selection__number_ranges[1 + 1] = { { 1, 0 }, - { 0, 2 } + { 0, 3 } }; -const ProtobufCMessageDescriptor nspanel_entity_state__descriptor = +const ProtobufCMessageDescriptor nspanel_entity_state__media_player__source_selection__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "NSPanelEntityState", - "NSPanelEntityState", - "NSPanelEntityState", + "NSPanelEntityState.MediaPlayer.SourceSelection", + "SourceSelection", + "NSPanelEntityState__MediaPlayer__SourceSelection", "", - sizeof(NSPanelEntityState), - 2, + sizeof(NSPanelEntityState__MediaPlayer__SourceSelection), + 3, + nspanel_entity_state__media_player__source_selection__field_descriptors, + nspanel_entity_state__media_player__source_selection__field_indices_by_name, + 1, nspanel_entity_state__media_player__source_selection__number_ranges, + (ProtobufCMessageInit) nspanel_entity_state__media_player__source_selection__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCEnumValue nspanel_entity_state__media_player__playback_state__enum_values_by_number[7] = +{ + { "UNKNOWN", "NSPANEL_ENTITY_STATE__MEDIA_PLAYER__PLAYBACK_STATE__UNKNOWN", 0 }, + { "OFF", "NSPANEL_ENTITY_STATE__MEDIA_PLAYER__PLAYBACK_STATE__OFF", 1 }, + { "ON", "NSPANEL_ENTITY_STATE__MEDIA_PLAYER__PLAYBACK_STATE__ON", 2 }, + { "IDLE", "NSPANEL_ENTITY_STATE__MEDIA_PLAYER__PLAYBACK_STATE__IDLE", 3 }, + { "PLAYING", "NSPANEL_ENTITY_STATE__MEDIA_PLAYER__PLAYBACK_STATE__PLAYING", 4 }, + { "PAUSED", "NSPANEL_ENTITY_STATE__MEDIA_PLAYER__PLAYBACK_STATE__PAUSED", 5 }, + { "BUFFERING", "NSPANEL_ENTITY_STATE__MEDIA_PLAYER__PLAYBACK_STATE__BUFFERING", 6 }, +}; +static const ProtobufCIntRange nspanel_entity_state__media_player__playback_state__value_ranges[] = { +{0, 0},{0, 7} +}; +static const ProtobufCEnumValueIndex nspanel_entity_state__media_player__playback_state__enum_values_by_name[7] = +{ + { "BUFFERING", 6 }, + { "IDLE", 3 }, + { "OFF", 1 }, + { "ON", 2 }, + { "PAUSED", 5 }, + { "PLAYING", 4 }, + { "UNKNOWN", 0 }, +}; +const ProtobufCEnumDescriptor nspanel_entity_state__media_player__playback_state__descriptor = +{ + PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, + "NSPanelEntityState.MediaPlayer.PlaybackState", + "PlaybackState", + "NSPanelEntityState__MediaPlayer__PlaybackState", + "", + 7, + nspanel_entity_state__media_player__playback_state__enum_values_by_number, + 7, + nspanel_entity_state__media_player__playback_state__enum_values_by_name, + 1, + nspanel_entity_state__media_player__playback_state__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor nspanel_entity_state__media_player__field_descriptors[23] = +{ + { + "media_player_id", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, media_player_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "name", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, name), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "state", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, state), + &nspanel_entity_state__media_player__playback_state__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "media_title", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, media_title), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "media_artist", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, media_artist), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "volume", + 6, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, volume), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "is_muted", + 7, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, is_muted), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "has_source_volume", + 8, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, has_source_volume), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "source_volume", + 9, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, source_volume), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "can_play", + 10, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, can_play), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "can_pause", + 11, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, can_pause), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "can_next_track", + 12, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, can_next_track), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "can_previous_track", + 13, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, can_previous_track), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "can_set_volume", + 14, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, can_set_volume), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "can_mute", + 15, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, can_mute), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "album_art_url", + 16, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, album_art_url), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "volume_step", + 17, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, volume_step), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "player_sources", + 18, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, player_sources), + &nspanel_entity_state__media_player__source_selection__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "source_player_sources", + 19, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, source_player_sources), + &nspanel_entity_state__media_player__source_selection__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "has_media_position", + 20, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, has_media_position), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "media_position", + 21, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, media_position), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "media_position_updated_at", + 22, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT64, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, media_position_updated_at), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "media_duration", + 23, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__MediaPlayer, media_duration), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nspanel_entity_state__media_player__field_indices_by_name[] = { + 15, /* field[15] = album_art_url */ + 14, /* field[14] = can_mute */ + 11, /* field[11] = can_next_track */ + 10, /* field[10] = can_pause */ + 9, /* field[9] = can_play */ + 12, /* field[12] = can_previous_track */ + 13, /* field[13] = can_set_volume */ + 19, /* field[19] = has_media_position */ + 7, /* field[7] = has_source_volume */ + 6, /* field[6] = is_muted */ + 4, /* field[4] = media_artist */ + 22, /* field[22] = media_duration */ + 0, /* field[0] = media_player_id */ + 20, /* field[20] = media_position */ + 21, /* field[21] = media_position_updated_at */ + 3, /* field[3] = media_title */ + 1, /* field[1] = name */ + 17, /* field[17] = player_sources */ + 18, /* field[18] = source_player_sources */ + 8, /* field[8] = source_volume */ + 2, /* field[2] = state */ + 5, /* field[5] = volume */ + 16, /* field[16] = volume_step */ +}; +static const ProtobufCIntRange nspanel_entity_state__media_player__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 23 } +}; +const ProtobufCMessageDescriptor nspanel_entity_state__media_player__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "NSPanelEntityState.MediaPlayer", + "MediaPlayer", + "NSPanelEntityState__MediaPlayer", + "", + sizeof(NSPanelEntityState__MediaPlayer), + 23, + nspanel_entity_state__media_player__field_descriptors, + nspanel_entity_state__media_player__field_indices_by_name, + 1, nspanel_entity_state__media_player__number_ranges, + (ProtobufCMessageInit) nspanel_entity_state__media_player__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCEnumValue nspanel_entity_state__cover__cover_state__enum_values_by_number[6] = +{ + { "UNKNOWN", "NSPANEL_ENTITY_STATE__COVER__COVER_STATE__UNKNOWN", 0 }, + { "OPEN", "NSPANEL_ENTITY_STATE__COVER__COVER_STATE__OPEN", 1 }, + { "CLOSED", "NSPANEL_ENTITY_STATE__COVER__COVER_STATE__CLOSED", 2 }, + { "OPENING", "NSPANEL_ENTITY_STATE__COVER__COVER_STATE__OPENING", 3 }, + { "CLOSING", "NSPANEL_ENTITY_STATE__COVER__COVER_STATE__CLOSING", 4 }, + { "UNAVAILABLE", "NSPANEL_ENTITY_STATE__COVER__COVER_STATE__UNAVAILABLE", 5 }, +}; +static const ProtobufCIntRange nspanel_entity_state__cover__cover_state__value_ranges[] = { +{0, 0},{0, 6} +}; +static const ProtobufCEnumValueIndex nspanel_entity_state__cover__cover_state__enum_values_by_name[6] = +{ + { "CLOSED", 2 }, + { "CLOSING", 4 }, + { "OPEN", 1 }, + { "OPENING", 3 }, + { "UNAVAILABLE", 5 }, + { "UNKNOWN", 0 }, +}; +const ProtobufCEnumDescriptor nspanel_entity_state__cover__cover_state__descriptor = +{ + PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, + "NSPanelEntityState.Cover.CoverState", + "CoverState", + "NSPanelEntityState__Cover__CoverState", + "", + 6, + nspanel_entity_state__cover__cover_state__enum_values_by_number, + 6, + nspanel_entity_state__cover__cover_state__enum_values_by_name, + 1, + nspanel_entity_state__cover__cover_state__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor nspanel_entity_state__cover__field_descriptors[22] = +{ + { + "cover_id", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, cover_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "name", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, name), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "state", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, state), + &nspanel_entity_state__cover__cover_state__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "has_position", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, has_position), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "position", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, position), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "has_tilt_position", + 6, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, has_tilt_position), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "tilt_position", + 7, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, tilt_position), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "can_open", + 8, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, can_open), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "can_close", + 9, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, can_close), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "can_stop", + 10, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, can_stop), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "can_set_position", + 11, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, can_set_position), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "can_open_tilt", + 12, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, can_open_tilt), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "can_close_tilt", + 13, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, can_close_tilt), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "can_stop_tilt", + 14, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, can_stop_tilt), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "can_set_tilt_position", + 15, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, can_set_tilt_position), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "device_class", + 16, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, device_class), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "position_preset1", + 17, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, position_preset1), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "position_preset2", + 18, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, position_preset2), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "position_preset3", + 19, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, position_preset3), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "tilt_preset1", + 20, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, tilt_preset1), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "tilt_preset2", + 21, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, tilt_preset2), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "tilt_preset3", + 22, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(NSPanelEntityState__Cover, tilt_preset3), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nspanel_entity_state__cover__field_indices_by_name[] = { + 8, /* field[8] = can_close */ + 12, /* field[12] = can_close_tilt */ + 7, /* field[7] = can_open */ + 11, /* field[11] = can_open_tilt */ + 10, /* field[10] = can_set_position */ + 14, /* field[14] = can_set_tilt_position */ + 9, /* field[9] = can_stop */ + 13, /* field[13] = can_stop_tilt */ + 0, /* field[0] = cover_id */ + 15, /* field[15] = device_class */ + 3, /* field[3] = has_position */ + 5, /* field[5] = has_tilt_position */ + 1, /* field[1] = name */ + 4, /* field[4] = position */ + 16, /* field[16] = position_preset1 */ + 17, /* field[17] = position_preset2 */ + 18, /* field[18] = position_preset3 */ + 2, /* field[2] = state */ + 6, /* field[6] = tilt_position */ + 19, /* field[19] = tilt_preset1 */ + 20, /* field[20] = tilt_preset2 */ + 21, /* field[21] = tilt_preset3 */ +}; +static const ProtobufCIntRange nspanel_entity_state__cover__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 22 } +}; +const ProtobufCMessageDescriptor nspanel_entity_state__cover__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "NSPanelEntityState.Cover", + "Cover", + "NSPanelEntityState__Cover", + "", + sizeof(NSPanelEntityState__Cover), + 22, + nspanel_entity_state__cover__field_descriptors, + nspanel_entity_state__cover__field_indices_by_name, + 1, nspanel_entity_state__cover__number_ranges, + (ProtobufCMessageInit) nspanel_entity_state__cover__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nspanel_entity_state__field_descriptors[4] = +{ + { + "light", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(NSPanelEntityState, entity_case), + offsetof(NSPanelEntityState, light), + &nspanel_entity_state__light__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "thermostat", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(NSPanelEntityState, entity_case), + offsetof(NSPanelEntityState, thermostat), + &nspanel_entity_state__thermostat__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "media_player", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(NSPanelEntityState, entity_case), + offsetof(NSPanelEntityState, media_player), + &nspanel_entity_state__media_player__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "cover", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(NSPanelEntityState, entity_case), + offsetof(NSPanelEntityState, cover), + &nspanel_entity_state__cover__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nspanel_entity_state__field_indices_by_name[] = { + 3, /* field[3] = cover */ + 0, /* field[0] = light */ + 2, /* field[2] = media_player */ + 1, /* field[1] = thermostat */ +}; +static const ProtobufCIntRange nspanel_entity_state__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 4 } +}; +const ProtobufCMessageDescriptor nspanel_entity_state__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "NSPanelEntityState", + "NSPanelEntityState", + "NSPanelEntityState", + "", + sizeof(NSPanelEntityState), + 4, nspanel_entity_state__field_descriptors, nspanel_entity_state__field_indices_by_name, 1, nspanel_entity_state__number_ranges, diff --git a/protobuf_firmware/protobuf_nspanel_entity.pb-c.h b/protobuf_firmware/protobuf_nspanel_entity.pb-c.h index 5254e3a9c..5b6885d7e 100644 --- a/protobuf_firmware/protobuf_nspanel_entity.pb-c.h +++ b/protobuf_firmware/protobuf_nspanel_entity.pb-c.h @@ -20,6 +20,9 @@ typedef struct NSPanelEntityState__Light NSPanelEntityState__Light; typedef struct NSPanelEntityState__Thermostat NSPanelEntityState__Thermostat; typedef struct NSPanelEntityState__Thermostat__ThermostatOption NSPanelEntityState__Thermostat__ThermostatOption; typedef struct NSPanelEntityState__Thermostat__ThermostatOption__ThermostatOptionValue NSPanelEntityState__Thermostat__ThermostatOption__ThermostatOptionValue; +typedef struct NSPanelEntityState__MediaPlayer NSPanelEntityState__MediaPlayer; +typedef struct NSPanelEntityState__MediaPlayer__SourceSelection NSPanelEntityState__MediaPlayer__SourceSelection; +typedef struct NSPanelEntityState__Cover NSPanelEntityState__Cover; /* --- enums --- */ @@ -29,6 +32,25 @@ typedef enum _NSPanelEntityState__Light__LightMode { NSPANEL_ENTITY_STATE__LIGHT__LIGHT_MODE__RGB = 1 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(NSPANEL_ENTITY_STATE__LIGHT__LIGHT_MODE) } NSPanelEntityState__Light__LightMode; +typedef enum _NSPanelEntityState__MediaPlayer__PlaybackState { + NSPANEL_ENTITY_STATE__MEDIA_PLAYER__PLAYBACK_STATE__UNKNOWN = 0, + NSPANEL_ENTITY_STATE__MEDIA_PLAYER__PLAYBACK_STATE__OFF = 1, + NSPANEL_ENTITY_STATE__MEDIA_PLAYER__PLAYBACK_STATE__ON = 2, + NSPANEL_ENTITY_STATE__MEDIA_PLAYER__PLAYBACK_STATE__IDLE = 3, + NSPANEL_ENTITY_STATE__MEDIA_PLAYER__PLAYBACK_STATE__PLAYING = 4, + NSPANEL_ENTITY_STATE__MEDIA_PLAYER__PLAYBACK_STATE__PAUSED = 5, + NSPANEL_ENTITY_STATE__MEDIA_PLAYER__PLAYBACK_STATE__BUFFERING = 6 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(NSPANEL_ENTITY_STATE__MEDIA_PLAYER__PLAYBACK_STATE) +} NSPanelEntityState__MediaPlayer__PlaybackState; +typedef enum _NSPanelEntityState__Cover__CoverState { + NSPANEL_ENTITY_STATE__COVER__COVER_STATE__UNKNOWN = 0, + NSPANEL_ENTITY_STATE__COVER__COVER_STATE__OPEN = 1, + NSPANEL_ENTITY_STATE__COVER__COVER_STATE__CLOSED = 2, + NSPANEL_ENTITY_STATE__COVER__COVER_STATE__OPENING = 3, + NSPANEL_ENTITY_STATE__COVER__COVER_STATE__CLOSING = 4, + NSPANEL_ENTITY_STATE__COVER__COVER_STATE__UNAVAILABLE = 5 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(NSPANEL_ENTITY_STATE__COVER__COVER_STATE) +} NSPanelEntityState__Cover__CoverState; /* --- messages --- */ @@ -93,10 +115,152 @@ struct NSPanelEntityState__Thermostat , 0, (char *)protobuf_c_empty_string, 0, 0, 0, 0, 0,NULL } +struct NSPanelEntityState__MediaPlayer__SourceSelection +{ + ProtobufCMessage base; + size_t n_sources; + char **sources; + /* + * Empty if unknown. Not every player reports its current source, and it + * is not always one of the listed sources. + */ + char *current_source; + protobuf_c_boolean can_select; +}; +#define NSPANEL_ENTITY_STATE__MEDIA_PLAYER__SOURCE_SELECTION__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nspanel_entity_state__media_player__source_selection__descriptor) \ + , 0,NULL, (char *)protobuf_c_empty_string, 0 } + + +struct NSPanelEntityState__MediaPlayer +{ + ProtobufCMessage base; + int32_t media_player_id; + char *name; + NSPanelEntityState__MediaPlayer__PlaybackState state; + char *media_title; + char *media_artist; + /* + * Volume in 0-100% + */ + int32_t volume; + protobuf_c_boolean is_muted; + /* + * Some setups (for example multi-room audio matrices) have a separate volume + * for the source feeding this player. Only valid if has_source_volume is set. + */ + protobuf_c_boolean has_source_volume; + /* + * Volume in 0-100% + */ + int32_t source_volume; + protobuf_c_boolean can_play; + protobuf_c_boolean can_pause; + protobuf_c_boolean can_next_track; + protobuf_c_boolean can_previous_track; + protobuf_c_boolean can_set_volume; + protobuf_c_boolean can_mute; + /* + * URL to fetch the current album art from, normally served by the manager. + * Empty when there is no art. The URL changes whenever the art changes, so + * the panel can compare it with the last URL to tell when to fetch again. + */ + char *album_art_url; + /* + * How much one volume up/down press changes the volume and source volume, in 1-100%. + */ + int32_t volume_step; + /* + * Sources (inputs) of this player. + */ + NSPanelEntityState__MediaPlayer__SourceSelection *player_sources; + /* + * Sources of the source player feeding this player, if it has one (see + * source_volume). Unset when there is no source player. Changes completely + * when the player switches to another source. + */ + NSPanelEntityState__MediaPlayer__SourceSelection *source_player_sources; + /* + * Playback position of the current media. Only valid if has_media_position is set. + * The controller only reports the position when playback starts, stops or seeks, + * not continuously. While playing, the current position is + * media_position + (now - media_position_updated_at). As the state is retained, + * a panel may receive it long after it was sent, so it must not count from when + * the state arrived. + */ + protobuf_c_boolean has_media_position; + /* + * In seconds, at media_position_updated_at + */ + int32_t media_position; + /* + * Unix time in seconds + */ + int64_t media_position_updated_at; + /* + * In seconds, 0 if unknown (for example a live stream) + */ + int32_t media_duration; +}; +#define NSPANEL_ENTITY_STATE__MEDIA_PLAYER__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nspanel_entity_state__media_player__descriptor) \ + , 0, (char *)protobuf_c_empty_string, NSPANEL_ENTITY_STATE__MEDIA_PLAYER__PLAYBACK_STATE__UNKNOWN, (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (char *)protobuf_c_empty_string, 0, NULL, NULL, 0, 0, 0, 0 } + + +struct NSPanelEntityState__Cover +{ + ProtobufCMessage base; + int32_t cover_id; + char *name; + NSPanelEntityState__Cover__CoverState state; + /* + * The controller currently reports a position. Some covers accept a target + * position but do not report their current position, so this is separate + * from can_set_position. + */ + protobuf_c_boolean has_position; + /* + * 0 = closed, 100 = open + */ + int32_t position; + protobuf_c_boolean has_tilt_position; + /* + * 0-100 + */ + int32_t tilt_position; + protobuf_c_boolean can_open; + protobuf_c_boolean can_close; + protobuf_c_boolean can_stop; + protobuf_c_boolean can_set_position; + protobuf_c_boolean can_open_tilt; + protobuf_c_boolean can_close_tilt; + protobuf_c_boolean can_stop_tilt; + protobuf_c_boolean can_set_tilt_position; + /* + * Optional hint for the panel icon, for example "blind" or "garage". + */ + char *device_class; + /* + * Preset position numbers. + */ + int32_t position_preset1; + int32_t position_preset2; + int32_t position_preset3; + int32_t tilt_preset1; + int32_t tilt_preset2; + int32_t tilt_preset3; +}; +#define NSPANEL_ENTITY_STATE__COVER__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nspanel_entity_state__cover__descriptor) \ + , 0, (char *)protobuf_c_empty_string, NSPANEL_ENTITY_STATE__COVER__COVER_STATE__UNKNOWN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (char *)protobuf_c_empty_string, 0, 0, 0, 0, 0, 0 } + + typedef enum { NSPANEL_ENTITY_STATE__ENTITY__NOT_SET = 0, NSPANEL_ENTITY_STATE__ENTITY_LIGHT = 1, - NSPANEL_ENTITY_STATE__ENTITY_THERMOSTAT = 2 + NSPANEL_ENTITY_STATE__ENTITY_THERMOSTAT = 2, + NSPANEL_ENTITY_STATE__ENTITY_MEDIA_PLAYER = 3, + NSPANEL_ENTITY_STATE__ENTITY_COVER = 4 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(NSPANEL_ENTITY_STATE__ENTITY__CASE) } NSPanelEntityState__EntityCase; @@ -107,6 +271,8 @@ struct NSPanelEntityState union { NSPanelEntityState__Light *light; NSPanelEntityState__Thermostat *thermostat; + NSPanelEntityState__MediaPlayer *media_player; + NSPanelEntityState__Cover *cover; }; }; #define NSPANEL_ENTITY_STATE__INIT \ @@ -126,6 +292,15 @@ void nspanel_entity_state__thermostat__thermostat_option__init /* NSPanelEntityState__Thermostat methods */ void nspanel_entity_state__thermostat__init (NSPanelEntityState__Thermostat *message); +/* NSPanelEntityState__MediaPlayer__SourceSelection methods */ +void nspanel_entity_state__media_player__source_selection__init + (NSPanelEntityState__MediaPlayer__SourceSelection *message); +/* NSPanelEntityState__MediaPlayer methods */ +void nspanel_entity_state__media_player__init + (NSPanelEntityState__MediaPlayer *message); +/* NSPanelEntityState__Cover methods */ +void nspanel_entity_state__cover__init + (NSPanelEntityState__Cover *message); /* NSPanelEntityState methods */ void nspanel_entity_state__init (NSPanelEntityState *message); @@ -159,6 +334,15 @@ typedef void (*NSPanelEntityState__Thermostat__ThermostatOption_Closure) typedef void (*NSPanelEntityState__Thermostat_Closure) (const NSPanelEntityState__Thermostat *message, void *closure_data); +typedef void (*NSPanelEntityState__MediaPlayer__SourceSelection_Closure) + (const NSPanelEntityState__MediaPlayer__SourceSelection *message, + void *closure_data); +typedef void (*NSPanelEntityState__MediaPlayer_Closure) + (const NSPanelEntityState__MediaPlayer *message, + void *closure_data); +typedef void (*NSPanelEntityState__Cover_Closure) + (const NSPanelEntityState__Cover *message, + void *closure_data); typedef void (*NSPanelEntityState_Closure) (const NSPanelEntityState *message, void *closure_data); @@ -174,6 +358,11 @@ extern const ProtobufCEnumDescriptor nspanel_entity_state__light__light_mode_ extern const ProtobufCMessageDescriptor nspanel_entity_state__thermostat__descriptor; extern const ProtobufCMessageDescriptor nspanel_entity_state__thermostat__thermostat_option__descriptor; extern const ProtobufCMessageDescriptor nspanel_entity_state__thermostat__thermostat_option__thermostat_option_value__descriptor; +extern const ProtobufCMessageDescriptor nspanel_entity_state__media_player__descriptor; +extern const ProtobufCMessageDescriptor nspanel_entity_state__media_player__source_selection__descriptor; +extern const ProtobufCEnumDescriptor nspanel_entity_state__media_player__playback_state__descriptor; +extern const ProtobufCMessageDescriptor nspanel_entity_state__cover__descriptor; +extern const ProtobufCEnumDescriptor nspanel_entity_state__cover__cover_state__descriptor; PROTOBUF_C__END_DECLS