From 258896cb6f716b5467eb1bcd1e43346c81ebbd54 Mon Sep 17 00:00:00 2001 From: Sergey Matyunin Date: Mon, 14 Sep 2026 15:28:18 +0300 Subject: [PATCH] feat: refine hidden isometric Stage 4 (#570) Issue: #570 User-Visible: no --- .../houseplan/frontend/houseplan-assets.json | 286 ++-- ...-DCbvGxY2.js => backdrop-pick-CGON6yBi.js} | 2 +- .../{de-CqAe7_tE.js => de-CguB1iyB.js} | 2 +- .../houseplan-assets/editor-Bj456-QF.js | 14 - .../houseplan-assets/editor-CrFGSaM9.js | 14 + .../frontend/houseplan-assets/fr-C84z_afh.js | 2 +- .../furniture-plan-art.generated-C_WDX48s.js | 2 +- .../houseplan-assets/guard-DBKIUfbp.js | 1 - ...DqlR1H6U.js => houseplan-card-CrTmJZ8b.js} | 14 +- ...s => houseplan-editor-runtime-CJrrYe2p.js} | 1502 ++++++++--------- ... houseplan-onboarding-runtime-B9DTOO67.js} | 2 +- ...=> hp-zigbee-topology-overlay-D4ABn_qu.js} | 12 +- .../iso-scene-render-Bgw9qRET.js | 56 + .../iso-scene-render-ByC7EDVa.js | 73 - ...s => live-interaction-runtime-rsvGGxyc.js} | 2 +- ...ort-DtC_EPb5.js => pdf-export-BYCIg7JD.js} | 4 +- ...OD.js => summary-panel-editor-B4-T9x1R.js} | 2 +- .../summary-panel-metrics-BO0KhesH.js | 1 - .../summary-panel-metrics-oqhGKlnp.js | 1 + .../summary-panel-runtime-loaded-DQykYOsg.js | 4 +- .../zigbee-topology-CQT90rCw.js | 2 +- ...js => zigbee-topology-runtime-Db3SaXOn.js} | 2 +- .../houseplan/frontend/houseplan-card.js | 2 +- .../houseplan/frontend/houseplan-panel.js | 2 +- demo/benchmark_large_house.mjs | 18 +- demo/golden/harness.mjs | 52 +- demo/golden/matrix.mjs | 8 +- demo/performance/evaluate.mjs | 10 +- demo/smoke_isometric_contract.mjs | 58 +- demo/smoke_isometric_live_touch.mjs | 39 +- demo/smoke_live_pan_coverage.mjs | 2 +- dist/houseplan-assets.json | 286 ++-- ...-DCbvGxY2.js => backdrop-pick-CGON6yBi.js} | 2 +- .../{de-CqAe7_tE.js => de-CguB1iyB.js} | 2 +- dist/houseplan-assets/editor-Bj456-QF.js | 14 - dist/houseplan-assets/editor-CrFGSaM9.js | 14 + .../houseplan-assets/fr-C84z_afh.js | 2 +- .../furniture-plan-art.generated-C_WDX48s.js | 2 +- dist/houseplan-assets/guard-DBKIUfbp.js | 1 - ...DqlR1H6U.js => houseplan-card-CrTmJZ8b.js} | 14 +- ...s => houseplan-editor-runtime-CJrrYe2p.js} | 1502 ++++++++--------- ... houseplan-onboarding-runtime-B9DTOO67.js} | 2 +- ...=> hp-zigbee-topology-overlay-D4ABn_qu.js} | 12 +- .../iso-scene-render-Bgw9qRET.js | 56 + .../iso-scene-render-ByC7EDVa.js | 73 - ...s => live-interaction-runtime-rsvGGxyc.js} | 2 +- ...ort-DtC_EPb5.js => pdf-export-BYCIg7JD.js} | 4 +- ...OD.js => summary-panel-editor-B4-T9x1R.js} | 2 +- .../summary-panel-metrics-BO0KhesH.js | 1 - .../summary-panel-metrics-oqhGKlnp.js | 1 + .../summary-panel-runtime-loaded-DQykYOsg.js | 4 +- .../zigbee-topology-CQT90rCw.js | 2 +- ...js => zigbee-topology-runtime-Db3SaXOn.js} | 2 +- dist/houseplan-card.js | 2 +- dist/houseplan-panel.js | 2 +- docs/ARCHITECTURE.md | 51 +- docs/ISOMETRIC.md | 116 +- docs/STATUS.md | 2 +- scripts/mutation-registry.mjs | 53 +- src/houseplan-card.ts | 17 +- src/iso-openings.ts | 140 +- src/iso-overlays.ts | 14 +- src/iso-projection.ts | 19 +- src/iso-scene-render.ts | 101 +- src/iso-walls.ts | 4 +- src/styles/plan.styles.ts | 64 +- test/golden-matrix.test.mjs | 26 +- test/iso-openings.test.mjs | 68 +- test/iso-overlays.test.mjs | 40 +- test/iso-projection.test.mjs | 24 +- test/iso-scene-render.test.mjs | 66 +- test/isometric-contract.test.mjs | 60 +- test/performance-budget.test.mjs | 8 +- test/performance-workflow.test.mjs | 14 +- 74 files changed, 2588 insertions(+), 2494 deletions(-) rename custom_components/houseplan/frontend/houseplan-assets/{backdrop-pick-DCbvGxY2.js => backdrop-pick-CGON6yBi.js} (99%) rename custom_components/houseplan/frontend/houseplan-assets/{de-CqAe7_tE.js => de-CguB1iyB.js} (99%) delete mode 100644 custom_components/houseplan/frontend/houseplan-assets/editor-Bj456-QF.js create mode 100644 custom_components/houseplan/frontend/houseplan-assets/editor-CrFGSaM9.js rename dist/houseplan-assets/fr-6DtT8TWD.js => custom_components/houseplan/frontend/houseplan-assets/fr-C84z_afh.js (99%) rename dist/houseplan-assets/furniture-plan-art.generated-CrvWoAvu.js => custom_components/houseplan/frontend/houseplan-assets/furniture-plan-art.generated-C_WDX48s.js (99%) delete mode 100644 custom_components/houseplan/frontend/houseplan-assets/guard-DBKIUfbp.js rename custom_components/houseplan/frontend/houseplan-assets/{houseplan-card-DqlR1H6U.js => houseplan-card-CrTmJZ8b.js} (64%) rename custom_components/houseplan/frontend/houseplan-assets/{houseplan-editor-runtime-BjAw4ds1.js => houseplan-editor-runtime-CJrrYe2p.js} (65%) rename custom_components/houseplan/frontend/houseplan-assets/{houseplan-onboarding-runtime-BtzaN0OP.js => houseplan-onboarding-runtime-B9DTOO67.js} (97%) rename custom_components/houseplan/frontend/houseplan-assets/{hp-zigbee-topology-overlay-CX3rLqEO.js => hp-zigbee-topology-overlay-D4ABn_qu.js} (86%) create mode 100644 custom_components/houseplan/frontend/houseplan-assets/iso-scene-render-Bgw9qRET.js delete mode 100644 custom_components/houseplan/frontend/houseplan-assets/iso-scene-render-ByC7EDVa.js rename custom_components/houseplan/frontend/houseplan-assets/{live-interaction-runtime-CO9GuTnQ.js => live-interaction-runtime-rsvGGxyc.js} (72%) rename custom_components/houseplan/frontend/houseplan-assets/{pdf-export-DtC_EPb5.js => pdf-export-BYCIg7JD.js} (99%) rename custom_components/houseplan/frontend/houseplan-assets/{summary-panel-editor-CWqNlMOD.js => summary-panel-editor-B4-T9x1R.js} (97%) delete mode 100644 custom_components/houseplan/frontend/houseplan-assets/summary-panel-metrics-BO0KhesH.js create mode 100644 custom_components/houseplan/frontend/houseplan-assets/summary-panel-metrics-oqhGKlnp.js rename dist/houseplan-assets/summary-panel-runtime-loaded-ospbRm0g.js => custom_components/houseplan/frontend/houseplan-assets/summary-panel-runtime-loaded-DQykYOsg.js (97%) rename dist/houseplan-assets/zigbee-topology-torI07nL.js => custom_components/houseplan/frontend/houseplan-assets/zigbee-topology-CQT90rCw.js (98%) rename custom_components/houseplan/frontend/houseplan-assets/{zigbee-topology-runtime-sByomcRQ.js => zigbee-topology-runtime-Db3SaXOn.js} (80%) rename dist/houseplan-assets/{backdrop-pick-DCbvGxY2.js => backdrop-pick-CGON6yBi.js} (99%) rename dist/houseplan-assets/{de-CqAe7_tE.js => de-CguB1iyB.js} (99%) delete mode 100644 dist/houseplan-assets/editor-Bj456-QF.js create mode 100644 dist/houseplan-assets/editor-CrFGSaM9.js rename custom_components/houseplan/frontend/houseplan-assets/fr-6DtT8TWD.js => dist/houseplan-assets/fr-C84z_afh.js (99%) rename custom_components/houseplan/frontend/houseplan-assets/furniture-plan-art.generated-CrvWoAvu.js => dist/houseplan-assets/furniture-plan-art.generated-C_WDX48s.js (99%) delete mode 100644 dist/houseplan-assets/guard-DBKIUfbp.js rename dist/houseplan-assets/{houseplan-card-DqlR1H6U.js => houseplan-card-CrTmJZ8b.js} (64%) rename dist/houseplan-assets/{houseplan-editor-runtime-BjAw4ds1.js => houseplan-editor-runtime-CJrrYe2p.js} (65%) rename dist/houseplan-assets/{houseplan-onboarding-runtime-BtzaN0OP.js => houseplan-onboarding-runtime-B9DTOO67.js} (97%) rename dist/houseplan-assets/{hp-zigbee-topology-overlay-CX3rLqEO.js => hp-zigbee-topology-overlay-D4ABn_qu.js} (86%) create mode 100644 dist/houseplan-assets/iso-scene-render-Bgw9qRET.js delete mode 100644 dist/houseplan-assets/iso-scene-render-ByC7EDVa.js rename dist/houseplan-assets/{live-interaction-runtime-CO9GuTnQ.js => live-interaction-runtime-rsvGGxyc.js} (72%) rename dist/houseplan-assets/{pdf-export-DtC_EPb5.js => pdf-export-BYCIg7JD.js} (99%) rename dist/houseplan-assets/{summary-panel-editor-CWqNlMOD.js => summary-panel-editor-B4-T9x1R.js} (97%) delete mode 100644 dist/houseplan-assets/summary-panel-metrics-BO0KhesH.js create mode 100644 dist/houseplan-assets/summary-panel-metrics-oqhGKlnp.js rename custom_components/houseplan/frontend/houseplan-assets/summary-panel-runtime-loaded-ospbRm0g.js => dist/houseplan-assets/summary-panel-runtime-loaded-DQykYOsg.js (97%) rename custom_components/houseplan/frontend/houseplan-assets/zigbee-topology-torI07nL.js => dist/houseplan-assets/zigbee-topology-CQT90rCw.js (98%) rename dist/houseplan-assets/{zigbee-topology-runtime-sByomcRQ.js => zigbee-topology-runtime-Db3SaXOn.js} (80%) diff --git a/custom_components/houseplan/frontend/houseplan-assets.json b/custom_components/houseplan/frontend/houseplan-assets.json index c6cbe518..37220d1a 100644 --- a/custom_components/houseplan/frontend/houseplan-assets.json +++ b/custom_components/houseplan/frontend/houseplan-assets.json @@ -1,311 +1,295 @@ { "schema": 1, - "fingerprint": "74cbeb9792716ab64cfbcf339d3044c6e8ae33533bdef7216a6d7d513ae04091", + "fingerprint": "012abf4b3924ad03971870eb8085ab1ac1a66b0d9b6676fe095285a8b0f201ab", "entry": "houseplan-card.js", "panelEntry": "houseplan-panel.js", "initialViewFiles": [ - "houseplan-assets/houseplan-card-DqlR1H6U.js", + "houseplan-assets/houseplan-card-CrTmJZ8b.js", "houseplan-card.js" ], - "initialViewGzipBytes": 290264, + "initialViewGzipBytes": 290253, "initialPanelFiles": [ - "houseplan-assets/houseplan-card-DqlR1H6U.js", + "houseplan-assets/houseplan-card-CrTmJZ8b.js", "houseplan-panel.js" ], - "initialPanelGzipBytes": 291787, + "initialPanelGzipBytes": 291775, "initialPanelOnlyFiles": [ "houseplan-panel.js" ], "initialPanelOnlyGzipBytes": 2326, "lazyFiles": [ - "houseplan-assets/backdrop-pick-DCbvGxY2.js", - "houseplan-assets/de-CqAe7_tE.js", - "houseplan-assets/editor-Bj456-QF.js", - "houseplan-assets/fr-6DtT8TWD.js", - "houseplan-assets/furniture-plan-art.generated-CrvWoAvu.js", - "houseplan-assets/guard-DBKIUfbp.js", - "houseplan-assets/houseplan-editor-runtime-BjAw4ds1.js", - "houseplan-assets/houseplan-onboarding-runtime-BtzaN0OP.js", - "houseplan-assets/hp-zigbee-topology-overlay-CX3rLqEO.js", - "houseplan-assets/iso-scene-render-ByC7EDVa.js", - "houseplan-assets/live-interaction-runtime-CO9GuTnQ.js", - "houseplan-assets/pdf-export-DtC_EPb5.js", - "houseplan-assets/summary-panel-runtime-loaded-ospbRm0g.js", - "houseplan-assets/zigbee-topology-runtime-sByomcRQ.js", - "houseplan-assets/zigbee-topology-torI07nL.js" + "houseplan-assets/backdrop-pick-CGON6yBi.js", + "houseplan-assets/de-CguB1iyB.js", + "houseplan-assets/editor-CrFGSaM9.js", + "houseplan-assets/fr-C84z_afh.js", + "houseplan-assets/furniture-plan-art.generated-C_WDX48s.js", + "houseplan-assets/houseplan-editor-runtime-CJrrYe2p.js", + "houseplan-assets/houseplan-onboarding-runtime-B9DTOO67.js", + "houseplan-assets/hp-zigbee-topology-overlay-D4ABn_qu.js", + "houseplan-assets/iso-scene-render-Bgw9qRET.js", + "houseplan-assets/live-interaction-runtime-rsvGGxyc.js", + "houseplan-assets/pdf-export-BYCIg7JD.js", + "houseplan-assets/summary-panel-runtime-loaded-DQykYOsg.js", + "houseplan-assets/zigbee-topology-CQT90rCw.js", + "houseplan-assets/zigbee-topology-runtime-Db3SaXOn.js" ], - "lazyGzipBytes": 418580, + "lazyGzipBytes": 418485, "lazyEditorFiles": [ - "houseplan-assets/backdrop-pick-DCbvGxY2.js", - "houseplan-assets/editor-Bj456-QF.js", - "houseplan-assets/furniture-plan-art.generated-CrvWoAvu.js", - "houseplan-assets/guard-DBKIUfbp.js", - "houseplan-assets/houseplan-editor-runtime-BjAw4ds1.js", - "houseplan-assets/zigbee-topology-torI07nL.js" + "houseplan-assets/backdrop-pick-CGON6yBi.js", + "houseplan-assets/editor-CrFGSaM9.js", + "houseplan-assets/furniture-plan-art.generated-C_WDX48s.js", + "houseplan-assets/houseplan-editor-runtime-CJrrYe2p.js", + "houseplan-assets/zigbee-topology-CQT90rCw.js" ], - "lazyEditorGzipBytes": 205043, + "lazyEditorGzipBytes": 204789, "lazyOnboardingFiles": [ - "houseplan-assets/backdrop-pick-DCbvGxY2.js", - "houseplan-assets/houseplan-onboarding-runtime-BtzaN0OP.js" + "houseplan-assets/backdrop-pick-CGON6yBi.js", + "houseplan-assets/houseplan-onboarding-runtime-B9DTOO67.js" ], - "lazyOnboardingGzipBytes": 13916, + "lazyOnboardingGzipBytes": 13918, "lazyLocaleFiles": [ - "houseplan-assets/de-CqAe7_tE.js", - "houseplan-assets/fr-6DtT8TWD.js" + "houseplan-assets/de-CguB1iyB.js", + "houseplan-assets/fr-C84z_afh.js" ], - "lazyLocaleGzipBytes": 54845, + "lazyLocaleGzipBytes": 54850, "lazyIsometricFiles": [ - "houseplan-assets/guard-DBKIUfbp.js", - "houseplan-assets/iso-scene-render-ByC7EDVa.js" + "houseplan-assets/iso-scene-render-Bgw9qRET.js" ], - "lazyIsometricGzipBytes": 13455, + "lazyIsometricGzipBytes": 13232, "lazyFurnitureArtFiles": [ - "houseplan-assets/furniture-plan-art.generated-CrvWoAvu.js" + "houseplan-assets/furniture-plan-art.generated-C_WDX48s.js" ], - "lazyFurnitureArtGzipBytes": 10254, + "lazyFurnitureArtGzipBytes": 10253, "lazyPdfFiles": [ - "houseplan-assets/furniture-plan-art.generated-CrvWoAvu.js", - "houseplan-assets/pdf-export-DtC_EPb5.js" + "houseplan-assets/furniture-plan-art.generated-C_WDX48s.js", + "houseplan-assets/pdf-export-BYCIg7JD.js" ], "lazyPdfGzipBytes": 120126, "files": [ { - "path": "houseplan-assets/backdrop-pick-DCbvGxY2.js", - "sha256": "78f118c030ea12bf7100b0bfbdd6fed33c5dc05bf7995ad22a39ec8f7e8f270b", + "path": "houseplan-assets/backdrop-pick-CGON6yBi.js", + "sha256": "ffe795a2734eb89097af8091262b51382147585e78e15f12aab94ae2f499fa06", "rawBytes": 19956, - "gzipBytes": 6879, + "gzipBytes": 6882, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-DqlR1H6U.js" + "houseplan-assets/houseplan-card-CrTmJZ8b.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/de-CqAe7_tE.js", - "sha256": "75472ecaf81e38bda8863c4e33a1eb0df92dbfda73e404d9bc1f3425ba227185", + "path": "houseplan-assets/de-CguB1iyB.js", + "sha256": "5a0f753ecbc4e88ca984827b000347caa31c258afd78199e0d1763238ff1cfc4", "rawBytes": 91437, - "gzipBytes": 27708, + "gzipBytes": 27712, "isEntry": false, "imports": [], "dynamicImports": [] }, { - "path": "houseplan-assets/editor-Bj456-QF.js", - "sha256": "2f72cb7b627b545f2b064b4d7681f8100fef5d20923114fb98a96601281c6cf2", - "rawBytes": 3832, - "gzipBytes": 1583, + "path": "houseplan-assets/editor-CrFGSaM9.js", + "sha256": "5bac1e3c7e6ad73e3118a35eb921af07dc8a80b2fa65ea6dd7225aa168d32992", + "rawBytes": 3831, + "gzipBytes": 1584, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-DqlR1H6U.js" + "houseplan-assets/houseplan-card-CrTmJZ8b.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/fr-6DtT8TWD.js", - "sha256": "f54edff32a74fcd97767e5b3ae0bbfd04e13c38b08e1cb535067699172b6ca27", + "path": "houseplan-assets/fr-C84z_afh.js", + "sha256": "4afd0630204be56ece7a382bc60242443f225d32caddff64536d0815443d9da0", "rawBytes": 93701, - "gzipBytes": 27137, + "gzipBytes": 27138, "isEntry": false, "imports": [], "dynamicImports": [] }, { - "path": "houseplan-assets/furniture-plan-art.generated-CrvWoAvu.js", - "sha256": "12f42b30b0d2c72681bad2928c9d847d31cec487bdb490544e2f1dcaeaad875a", + "path": "houseplan-assets/furniture-plan-art.generated-C_WDX48s.js", + "sha256": "f50864c15117dcb83594bbe996bd9cddb1ab9c6c2f286ca4c33b2bfb8d03597f", "rawBytes": 33655, - "gzipBytes": 10254, + "gzipBytes": 10253, "isEntry": false, "imports": [], "dynamicImports": [] }, { - "path": "houseplan-assets/guard-DBKIUfbp.js", - "sha256": "42e87d66b74ad024880fc0aff319092b8539a19b27f6163363514c05a55921ff", - "rawBytes": 518, - "gzipBytes": 369, - "isEntry": false, - "imports": [ - "houseplan-assets/houseplan-card-DqlR1H6U.js" - ], - "dynamicImports": [] - }, - { - "path": "houseplan-assets/houseplan-card-DqlR1H6U.js", - "sha256": "8c136c1fe9a35e06f0547fd196eac3d050eab295a8709e47ea1539c7da8cc774", - "rawBytes": 1031164, - "gzipBytes": 289461, + "path": "houseplan-assets/houseplan-card-CrTmJZ8b.js", + "sha256": "d9b0cfd20b712bdb93d448b49d73a6cbd7293e694335663595a84987ffc30f48", + "rawBytes": 1031295, + "gzipBytes": 289449, "isEntry": false, "imports": [], "dynamicImports": [ - "houseplan-assets/de-CqAe7_tE.js", - "houseplan-assets/editor-Bj456-QF.js", - "houseplan-assets/fr-6DtT8TWD.js", - "houseplan-assets/furniture-plan-art.generated-CrvWoAvu.js", - "houseplan-assets/houseplan-editor-runtime-BjAw4ds1.js", - "houseplan-assets/houseplan-onboarding-runtime-BtzaN0OP.js", - "houseplan-assets/hp-zigbee-topology-overlay-CX3rLqEO.js", - "houseplan-assets/iso-scene-render-ByC7EDVa.js", - "houseplan-assets/live-interaction-runtime-CO9GuTnQ.js", - "houseplan-assets/pdf-export-DtC_EPb5.js", - "houseplan-assets/summary-panel-runtime-loaded-ospbRm0g.js" + "houseplan-assets/de-CguB1iyB.js", + "houseplan-assets/editor-CrFGSaM9.js", + "houseplan-assets/fr-C84z_afh.js", + "houseplan-assets/furniture-plan-art.generated-C_WDX48s.js", + "houseplan-assets/houseplan-editor-runtime-CJrrYe2p.js", + "houseplan-assets/houseplan-onboarding-runtime-B9DTOO67.js", + "houseplan-assets/hp-zigbee-topology-overlay-D4ABn_qu.js", + "houseplan-assets/iso-scene-render-Bgw9qRET.js", + "houseplan-assets/live-interaction-runtime-rsvGGxyc.js", + "houseplan-assets/pdf-export-BYCIg7JD.js", + "houseplan-assets/summary-panel-runtime-loaded-DQykYOsg.js" ] }, { - "path": "houseplan-assets/houseplan-editor-runtime-BjAw4ds1.js", - "sha256": "1fe3d26ea0cca0ebc832ce613252e07dac376a695c0d301d1445443b3757ac53", - "rawBytes": 668940, - "gzipBytes": 178530, + "path": "houseplan-assets/houseplan-editor-runtime-CJrrYe2p.js", + "sha256": "c2a2ccf2fcb2d537d38392cd57518b7ea9a83b74b82fe032301af959d2b0b963", + "rawBytes": 669271, + "gzipBytes": 178646, "isEntry": false, "imports": [ - "houseplan-assets/backdrop-pick-DCbvGxY2.js", - "houseplan-assets/furniture-plan-art.generated-CrvWoAvu.js", - "houseplan-assets/guard-DBKIUfbp.js", - "houseplan-assets/houseplan-card-DqlR1H6U.js", - "houseplan-assets/zigbee-topology-torI07nL.js" + "houseplan-assets/backdrop-pick-CGON6yBi.js", + "houseplan-assets/furniture-plan-art.generated-C_WDX48s.js", + "houseplan-assets/houseplan-card-CrTmJZ8b.js", + "houseplan-assets/zigbee-topology-CQT90rCw.js" ], "dynamicImports": [ - "houseplan-assets/zigbee-topology-runtime-sByomcRQ.js" + "houseplan-assets/zigbee-topology-runtime-Db3SaXOn.js" ] }, { - "path": "houseplan-assets/houseplan-onboarding-runtime-BtzaN0OP.js", - "sha256": "1645f0de954897116fe118bd5401620787de2a534cc1ee63031b527d8b53d189", + "path": "houseplan-assets/houseplan-onboarding-runtime-B9DTOO67.js", + "sha256": "097b862d0e93a3acce33966099626b5f881c61a8f9319d53a5c6ab3781620383", "rawBytes": 28287, - "gzipBytes": 7037, + "gzipBytes": 7036, "isEntry": false, "imports": [ - "houseplan-assets/backdrop-pick-DCbvGxY2.js", - "houseplan-assets/houseplan-card-DqlR1H6U.js" + "houseplan-assets/backdrop-pick-CGON6yBi.js", + "houseplan-assets/houseplan-card-CrTmJZ8b.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/hp-zigbee-topology-overlay-CX3rLqEO.js", - "sha256": "436d728f938f6c10c6b5e1b1811630b206c4f288ae095030587c6f89c0e34906", + "path": "houseplan-assets/hp-zigbee-topology-overlay-D4ABn_qu.js", + "sha256": "e57a90d6682635233d5ec5c4c09d4821b6d4608507d08cf33a174ad0fbc320a7", "rawBytes": 10756, - "gzipBytes": 3679, + "gzipBytes": 3686, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-DqlR1H6U.js", - "houseplan-assets/zigbee-topology-runtime-sByomcRQ.js", - "houseplan-assets/zigbee-topology-torI07nL.js" + "houseplan-assets/houseplan-card-CrTmJZ8b.js", + "houseplan-assets/zigbee-topology-CQT90rCw.js", + "houseplan-assets/zigbee-topology-runtime-Db3SaXOn.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/iso-scene-render-ByC7EDVa.js", - "sha256": "eef97bc8600452c8879051e86055efefae1a4577567db70f462776c100eea579", - "rawBytes": 38562, - "gzipBytes": 13086, + "path": "houseplan-assets/iso-scene-render-Bgw9qRET.js", + "sha256": "ad4c67e51d68d05452d872a67705ef12fc2f89f580c589ebb3923275b73ce278", + "rawBytes": 39206, + "gzipBytes": 13232, "isEntry": false, "imports": [ - "houseplan-assets/guard-DBKIUfbp.js", - "houseplan-assets/houseplan-card-DqlR1H6U.js" + "houseplan-assets/houseplan-card-CrTmJZ8b.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/live-interaction-runtime-CO9GuTnQ.js", - "sha256": "88f116dd07bce29f0803bfcaaf12db5d633c9eba4908bdcb889a5dabe1d4d838", + "path": "houseplan-assets/live-interaction-runtime-rsvGGxyc.js", + "sha256": "fa87403a675bc45b8ccc3b4ff1ba0ee190c2968cbf4285ddf3259c2a96e1962f", "rawBytes": 8018, - "gzipBytes": 3168, + "gzipBytes": 3169, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-DqlR1H6U.js" + "houseplan-assets/houseplan-card-CrTmJZ8b.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/pdf-export-DtC_EPb5.js", - "sha256": "9709712290440090599d72ee1f9c6259adc3cba09d09f5d96e519020c3663102", + "path": "houseplan-assets/pdf-export-BYCIg7JD.js", + "sha256": "8ac5283781427724de92d360c57433c3e98a4ece3268c479c2107c8802905fc1", "rawBytes": 236244, - "gzipBytes": 109872, + "gzipBytes": 109873, "isEntry": false, "imports": [ - "houseplan-assets/furniture-plan-art.generated-CrvWoAvu.js", - "houseplan-assets/houseplan-card-DqlR1H6U.js" + "houseplan-assets/furniture-plan-art.generated-C_WDX48s.js", + "houseplan-assets/houseplan-card-CrTmJZ8b.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/summary-panel-editor-CWqNlMOD.js", - "sha256": "1364e8033b275cde43cc53a68b9aac6d4c2707d661b0b8dd1bb2a8be550dfab2", + "path": "houseplan-assets/summary-panel-editor-B4-T9x1R.js", + "sha256": "cfa0ccfa1189264d53ae836ef84bb83d7649648a3ae70bf2b5a3e214f964e85c", "rawBytes": 14824, - "gzipBytes": 3398, + "gzipBytes": 3402, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-DqlR1H6U.js", - "houseplan-assets/summary-panel-runtime-loaded-ospbRm0g.js" + "houseplan-assets/houseplan-card-CrTmJZ8b.js", + "houseplan-assets/summary-panel-runtime-loaded-DQykYOsg.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/summary-panel-metrics-BO0KhesH.js", - "sha256": "97b014aab427c7472d8f465891e866f8b1488155c45d2435dff00f60cbb3255d", + "path": "houseplan-assets/summary-panel-metrics-oqhGKlnp.js", + "sha256": "5d9d0a660d1203d03f30360b3d04dc61403e5cd26dd3dd447b1b8866123bd91e", "rawBytes": 2610, "gzipBytes": 1306, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-DqlR1H6U.js" + "houseplan-assets/houseplan-card-CrTmJZ8b.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/summary-panel-runtime-loaded-ospbRm0g.js", - "sha256": "fff8b723ebc1912effbd81d167cd4f8b98517ca9295a8819663d54d5d69acb51", + "path": "houseplan-assets/summary-panel-runtime-loaded-DQykYOsg.js", + "sha256": "3a0c8369150e7e947166f7647407fb7dbb7541423bcdd474840357b293e4ef1b", "rawBytes": 73366, - "gzipBytes": 20088, + "gzipBytes": 20087, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-DqlR1H6U.js" + "houseplan-assets/houseplan-card-CrTmJZ8b.js" ], "dynamicImports": [ - "houseplan-assets/summary-panel-editor-CWqNlMOD.js", - "houseplan-assets/summary-panel-metrics-BO0KhesH.js" + "houseplan-assets/summary-panel-editor-B4-T9x1R.js", + "houseplan-assets/summary-panel-metrics-oqhGKlnp.js" ] }, { - "path": "houseplan-assets/zigbee-topology-runtime-sByomcRQ.js", - "sha256": "13d44dea277a6bb984abbdfa1a9246369e4ef9886c0d28e38ef3ab98327e576d", - "rawBytes": 3941, - "gzipBytes": 1762, + "path": "houseplan-assets/zigbee-topology-CQT90rCw.js", + "sha256": "c14a3d5b913760cb1bf8797bf8cfe5653e54afee030406bab0ebad771a34c06c", + "rawBytes": 18961, + "gzipBytes": 7424, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-DqlR1H6U.js", - "houseplan-assets/zigbee-topology-torI07nL.js" + "houseplan-assets/houseplan-card-CrTmJZ8b.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/zigbee-topology-torI07nL.js", - "sha256": "7ac30adae966053bc84d05634b32069221b4f8cd58bfe5c6a3ab7da50335e1f6", - "rawBytes": 18961, - "gzipBytes": 7428, + "path": "houseplan-assets/zigbee-topology-runtime-Db3SaXOn.js", + "sha256": "a1020eb9133af9fcb6eee0d7630f128b2ef5c3b92596b36072e0543f5fd869d3", + "rawBytes": 3941, + "gzipBytes": 1763, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-DqlR1H6U.js" + "houseplan-assets/houseplan-card-CrTmJZ8b.js", + "houseplan-assets/zigbee-topology-CQT90rCw.js" ], "dynamicImports": [] }, { "path": "houseplan-card.js", - "sha256": "bbcf3569a6edaf8475bebc56429c65d49802923dde9d1fba487068171f6eb9be", + "sha256": "c534e03d98617267f28c02c9283c5826cdbc228a895a3be012ea7e58086d4441", "rawBytes": 1205, - "gzipBytes": 803, + "gzipBytes": 804, "isEntry": true, "imports": [ - "houseplan-assets/houseplan-card-DqlR1H6U.js" + "houseplan-assets/houseplan-card-CrTmJZ8b.js" ], "dynamicImports": [] }, { "path": "houseplan-panel.js", - "sha256": "db358c8fd55babc928f9acb6abe341bc33cd7642e8e60b8ff7894f5c67255c2c", + "sha256": "49d5d19ce2cda3a4255946bf4316c8344a1dff48aaaa42a8cd7698a675b6ba21", "rawBytes": 6165, "gzipBytes": 2326, "isEntry": true, "imports": [ - "houseplan-assets/houseplan-card-DqlR1H6U.js" + "houseplan-assets/houseplan-card-CrTmJZ8b.js" ], "dynamicImports": [] } diff --git a/custom_components/houseplan/frontend/houseplan-assets/backdrop-pick-DCbvGxY2.js b/custom_components/houseplan/frontend/houseplan-assets/backdrop-pick-CGON6yBi.js similarity index 99% rename from custom_components/houseplan/frontend/houseplan-assets/backdrop-pick-DCbvGxY2.js rename to custom_components/houseplan/frontend/houseplan-assets/backdrop-pick-CGON6yBi.js index 1db11849..792377bc 100644 --- a/custom_components/houseplan/frontend/houseplan-assets/backdrop-pick-DCbvGxY2.js +++ b/custom_components/houseplan/frontend/houseplan-assets/backdrop-pick-CGON6yBi.js @@ -1,4 +1,4 @@ -globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae33533bdef7216a6d7d513ae04091";import{D as e,b as t,A as i,k as o,m as n,dA as r}from"./houseplan-card-DqlR1H6U.js";function s(e){const t=e.visualViewport;return t&&Number.isFinite(t.width)&&Number.isFinite(t.height)?{left:Number(t.offsetLeft)||0,top:Number(t.offsetTop)||0,width:Math.max(0,Number(t.width)||0),height:Math.max(0,Number(t.height)||0)}:{left:0,top:0,width:e.innerWidth,height:e.innerHeight}}function a(e,t,i,o=7,n=8){const r=i.left+n,s=i.top+n,a=Math.max(r,i.left+i.width-n),l=Math.max(s,i.top+i.height-n),h=Math.max(0,a-r),d=Math.max(0,l-s),c=Math.min(Math.max(0,t.width),h),u=Math.min(Math.max(0,t.height),d);let p=e.left;p+c>a&&(p=e.right-c),p=Math.min(Math.max(r,p),Math.max(r,a-c));const g=e.bottom+o,_=e.top-o-u;let m="bottom",f=g;return g+u>l&&_>=s?(m="top",f=Math.min(Math.max(s,_),Math.max(s,l-u))):f=Math.min(Math.max(s,g),Math.max(s,l-u)),{left:Math.round(p),top:Math.round(f),side:m,maxWidth:Math.round(h),maxHeight:Math.round(d)}}class l{constructor(e,t,i){this.owner=e,this.name=t,this.keydown=i,this.host=null,this.root=null}window(){return this.owner.ownerDocument.defaultView}dialog(){return this.owner.closest("hp-dialog")}usesPopover(e=!1){const t=this.window();return!e&&!!t&&function(e){const t=e.HTMLElement?.prototype;return"function"==typeof t?.showPopover&&"function"==typeof t?.hidePopover}(t)}get hasFallback(){return!!this.host}containsPath(e){return e.includes(this.owner)||!!this.host&&e.includes(this.host)}ownsActiveElement(){let e=this.owner.ownerDocument.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return!(!e||e!==this.owner&&!this.owner.shadowRoot?.contains(e)&&!this.root?.contains(e))}renderFallback(i,o){const n=this.ensureFallback();return n?(e(t`${i}`,n),n):null}surface(e,t){return t?this.owner.shadowRoot?.querySelector(e)||null:this.root?.querySelector(e)||null}destroy(){this.root&&e(i,this.root),this.host?.remove(),this.host=null,this.root=null}ensureFallback(){if(this.root?.isConnected)return this.root;const e=this.dialog()?.overlayPortal()||this.owner.ownerDocument.body;if(!e)return null;const t=this.owner.ownerDocument.createElement("div");return t.dataset.hpOverlay=this.name,t.style.display="contents",this.keydown&&t.addEventListener("keydown",this.keydown,!0),e.append(t),this.host=t,this.root=t.attachShadow({mode:"open"}),this.root}}let h=0;class d extends n{constructor(){super(...arguments),this.text="",this.ariaLabel="",this.pointerHover=!1,this._open=!1,this._openTimer=0,this._closeTimer=0,this._positionRaf=0,this._forceFallback=!1,this._hoverOwned=!1,this._overlayDispose=null,this._scrollDialog=null,this._descriptionId="hp-help-description-"+ ++h,this._surfacePointerEnter=()=>{const e=this._window();this._closeTimer&&e?.clearTimeout(this._closeTimer),this._closeTimer=0},this._surfacePointerLeave=()=>{this._scheduleClose()},this._outsidePointerDown=e=>{if(!this._open)return;const t=e.composedPath();this._floating.containsPath(t)||this._closeHelp(!1,"outside")},this._dialogScroll=e=>{const t=this._floating.containsPath(e.composedPath()),i=e.target,o=this._dialog(),n=i instanceof Node&&(i===o||i instanceof Element&&i.contains(this));var r;this._open&&(r=n,!t&&r)&&this._closeHelp(!1,"scroll")},this._keyDown=e=>{if(!this._open||e.defaultPrevented)return;if("Escape"===e.key)return e.preventDefault(),e.stopImmediatePropagation(),void this._closeHelp(this._floating.ownsActiveElement(),"escape");const t=this.renderRoot.querySelector(".trigger");if(!t||!e.composedPath().includes(t))return;const i=this._surface();if(!i||i.scrollHeight<=i.clientHeight)return;const o=Math.max(40,.8*i.clientHeight),n={ArrowDown:40,ArrowUp:-40,PageDown:o,PageUp:-o};if("Home"===e.key)i.scrollTop=0;else if("End"===e.key)i.scrollTop=i.scrollHeight;else{if(!(e.key in n))return;i.scrollBy({top:n[e.key],behavior:"auto"})}e.preventDefault(),e.stopImmediatePropagation()},this._floating=new l(this,"help",this._keyDown),this._queuePosition=()=>{if(!this._open||this._positionRaf)return;const e=this._window();e&&(this._positionRaf=e.requestAnimationFrame(()=>{this._positionRaf=0,this._position()||this._closeHelp()}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._keyDown,!0)}willUpdate(){this.toggleAttribute("data-has-content",this._hasContent())}disconnectedCallback(){const e=this.ownerDocument.defaultView;this._unsubscribeOpenListeners(),this.removeEventListener("keydown",this._keyDown,!0),this._clearTimers(),this._positionRaf&&e?.cancelAnimationFrame(this._positionRaf),this._positionRaf=0,this._closeHelp(!1,"disconnect"),super.disconnectedCallback()}updated(e){if(e.has("pointerHover")&&!this.pointerHover){const e=this._window();this._openTimer&&e?.clearTimeout(this._openTimer),this._openTimer=0,this._hoverOwned&&this._closeHelp(!1,"outside")}this._hasContent()||!this._open?this._open&&e.has("text")&&(this._usesPopover()||this._renderFallback(),this._queuePosition()):this._closeHelp()}_window(){return this._floating.window()}_dialog(){return this._floating.dialog()}_usesPopover(){return this._floating.usesPopover(this._forceFallback)}_hasContent(){return e=this.text,t=this.ariaLabel,"string"==typeof e&&e.trim().length>0&&"string"==typeof t&&t.trim().length>0;var e,t}_clearTimers(){const e=this._window();this._openTimer&&e?.clearTimeout(this._openTimer),this._closeTimer&&e?.clearTimeout(this._closeTimer),this._openTimer=0,this._closeTimer=0}_scheduleOpen(){const e=this._window();this.pointerHover&&e&&!this._open&&!this._openTimer&&(this._closeTimer&&e.clearTimeout(this._closeTimer),this._closeTimer=0,this._openTimer=e.setTimeout(()=>{this._openTimer=0,this.isConnected&&(this._hoverOwned=!0,this._openHelp())},300))}_scheduleClose(){const e=this._window(),t=this.renderRoot.querySelector(".trigger");e&&!t?.matches(":focus-visible")&&(this._openTimer&&e.clearTimeout(this._openTimer),this._closeTimer&&e.clearTimeout(this._closeTimer),this._openTimer=0,this._closeTimer=e.setTimeout(()=>{this._closeTimer=0,this.isConnected&&this._closeHelp()},150))}_triggerPointerEnter(e){this.pointerHover&&"mouse"===e.pointerType&&this._scheduleOpen()}_triggerPointerLeave(e){"mouse"===e.pointerType&&this._scheduleClose()}_triggerFocus(){queueMicrotask(()=>{const e=this.renderRoot.querySelector(".trigger");e?.matches(":focus-visible")&&(this._hoverOwned=!1,this._openHelp())})}_triggerBlur(){this._scheduleClose()}_triggerClick(){this._open?this._closeHelp():(this._hoverOwned=!1,this._openHelp())}_subscribeOpenListeners(){this.ownerDocument.addEventListener("pointerdown",this._outsidePointerDown,!0),this.ownerDocument.addEventListener("keydown",this._keyDown,!0);const e=this._window();e?.addEventListener("resize",this._queuePosition),e?.addEventListener("orientationchange",this._queuePosition),e?.visualViewport?.addEventListener("resize",this._queuePosition),e?.visualViewport?.addEventListener("scroll",this._queuePosition),this._scrollDialog=this._dialog(),this._scrollDialog?.addEventListener("scroll",this._dialogScroll,!0)}_unsubscribeOpenListeners(){this.ownerDocument.removeEventListener("pointerdown",this._outsidePointerDown,!0),this.ownerDocument.removeEventListener("keydown",this._keyDown,!0);const e=this._window();e?.removeEventListener("resize",this._queuePosition),e?.removeEventListener("orientationchange",this._queuePosition),e?.visualViewport?.removeEventListener("resize",this._queuePosition),e?.visualViewport?.removeEventListener("scroll",this._queuePosition),this._scrollDialog?.removeEventListener("scroll",this._dialogScroll,!0),this._scrollDialog=null}async _openHelp(){!this._open&&this._hasContent()&&(this._clearTimers(),this._forceFallback=!1,this._open=!0,this._subscribeOpenListeners(),await this.updateComplete,this._open&&(this._usesPopover()||this._renderFallback(),this._position()?this._overlayDispose=this._dialog()?.registerOverlay({owner:this,group:"transient",close:e=>this._closeHelp("escape"===e&&this._floating.ownsActiveElement(),e)})||null:this._closeHelp()))}_closeHelp(e=!1,t="exclusive"){if(!this._open&&!this._floating.hasFallback)return;this._clearTimers();const i=this._overlayDispose;this._overlayDispose=null,i?.();const o=this.renderRoot.querySelector(".tooltip");if(o?.hidePopover)try{o.matches(":popover-open")&&o.hidePopover()}catch{}this._open=!1,this._hoverOwned=!1,this._unsubscribeOpenListeners(),this._floating.destroy(),e&&this.updateComplete.then(()=>this.renderRoot.querySelector(".trigger")?.focus())}_tooltipTemplate(e){return t`
a&&(p=e.right-c),p=Math.min(Math.max(r,p),Math.max(r,a-c));const g=e.bottom+o,_=e.top-o-u;let m="bottom",f=g;return g+u>l&&_>=s?(m="top",f=Math.min(Math.max(s,_),Math.max(s,l-u))):f=Math.min(Math.max(s,g),Math.max(s,l-u)),{left:Math.round(p),top:Math.round(f),side:m,maxWidth:Math.round(h),maxHeight:Math.round(d)}}class l{constructor(e,t,i){this.owner=e,this.name=t,this.keydown=i,this.host=null,this.root=null}window(){return this.owner.ownerDocument.defaultView}dialog(){return this.owner.closest("hp-dialog")}usesPopover(e=!1){const t=this.window();return!e&&!!t&&function(e){const t=e.HTMLElement?.prototype;return"function"==typeof t?.showPopover&&"function"==typeof t?.hidePopover}(t)}get hasFallback(){return!!this.host}containsPath(e){return e.includes(this.owner)||!!this.host&&e.includes(this.host)}ownsActiveElement(){let e=this.owner.ownerDocument.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return!(!e||e!==this.owner&&!this.owner.shadowRoot?.contains(e)&&!this.root?.contains(e))}renderFallback(i,o){const n=this.ensureFallback();return n?(e(t`${i}`,n),n):null}surface(e,t){return t?this.owner.shadowRoot?.querySelector(e)||null:this.root?.querySelector(e)||null}destroy(){this.root&&e(i,this.root),this.host?.remove(),this.host=null,this.root=null}ensureFallback(){if(this.root?.isConnected)return this.root;const e=this.dialog()?.overlayPortal()||this.owner.ownerDocument.body;if(!e)return null;const t=this.owner.ownerDocument.createElement("div");return t.dataset.hpOverlay=this.name,t.style.display="contents",this.keydown&&t.addEventListener("keydown",this.keydown,!0),e.append(t),this.host=t,this.root=t.attachShadow({mode:"open"}),this.root}}let h=0;class d extends n{constructor(){super(...arguments),this.text="",this.ariaLabel="",this.pointerHover=!1,this._open=!1,this._openTimer=0,this._closeTimer=0,this._positionRaf=0,this._forceFallback=!1,this._hoverOwned=!1,this._overlayDispose=null,this._scrollDialog=null,this._descriptionId="hp-help-description-"+ ++h,this._surfacePointerEnter=()=>{const e=this._window();this._closeTimer&&e?.clearTimeout(this._closeTimer),this._closeTimer=0},this._surfacePointerLeave=()=>{this._scheduleClose()},this._outsidePointerDown=e=>{if(!this._open)return;const t=e.composedPath();this._floating.containsPath(t)||this._closeHelp(!1,"outside")},this._dialogScroll=e=>{const t=this._floating.containsPath(e.composedPath()),i=e.target,o=this._dialog(),n=i instanceof Node&&(i===o||i instanceof Element&&i.contains(this));var r;this._open&&(r=n,!t&&r)&&this._closeHelp(!1,"scroll")},this._keyDown=e=>{if(!this._open||e.defaultPrevented)return;if("Escape"===e.key)return e.preventDefault(),e.stopImmediatePropagation(),void this._closeHelp(this._floating.ownsActiveElement(),"escape");const t=this.renderRoot.querySelector(".trigger");if(!t||!e.composedPath().includes(t))return;const i=this._surface();if(!i||i.scrollHeight<=i.clientHeight)return;const o=Math.max(40,.8*i.clientHeight),n={ArrowDown:40,ArrowUp:-40,PageDown:o,PageUp:-o};if("Home"===e.key)i.scrollTop=0;else if("End"===e.key)i.scrollTop=i.scrollHeight;else{if(!(e.key in n))return;i.scrollBy({top:n[e.key],behavior:"auto"})}e.preventDefault(),e.stopImmediatePropagation()},this._floating=new l(this,"help",this._keyDown),this._queuePosition=()=>{if(!this._open||this._positionRaf)return;const e=this._window();e&&(this._positionRaf=e.requestAnimationFrame(()=>{this._positionRaf=0,this._position()||this._closeHelp()}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._keyDown,!0)}willUpdate(){this.toggleAttribute("data-has-content",this._hasContent())}disconnectedCallback(){const e=this.ownerDocument.defaultView;this._unsubscribeOpenListeners(),this.removeEventListener("keydown",this._keyDown,!0),this._clearTimers(),this._positionRaf&&e?.cancelAnimationFrame(this._positionRaf),this._positionRaf=0,this._closeHelp(!1,"disconnect"),super.disconnectedCallback()}updated(e){if(e.has("pointerHover")&&!this.pointerHover){const e=this._window();this._openTimer&&e?.clearTimeout(this._openTimer),this._openTimer=0,this._hoverOwned&&this._closeHelp(!1,"outside")}this._hasContent()||!this._open?this._open&&e.has("text")&&(this._usesPopover()||this._renderFallback(),this._queuePosition()):this._closeHelp()}_window(){return this._floating.window()}_dialog(){return this._floating.dialog()}_usesPopover(){return this._floating.usesPopover(this._forceFallback)}_hasContent(){return e=this.text,t=this.ariaLabel,"string"==typeof e&&e.trim().length>0&&"string"==typeof t&&t.trim().length>0;var e,t}_clearTimers(){const e=this._window();this._openTimer&&e?.clearTimeout(this._openTimer),this._closeTimer&&e?.clearTimeout(this._closeTimer),this._openTimer=0,this._closeTimer=0}_scheduleOpen(){const e=this._window();this.pointerHover&&e&&!this._open&&!this._openTimer&&(this._closeTimer&&e.clearTimeout(this._closeTimer),this._closeTimer=0,this._openTimer=e.setTimeout(()=>{this._openTimer=0,this.isConnected&&(this._hoverOwned=!0,this._openHelp())},300))}_scheduleClose(){const e=this._window(),t=this.renderRoot.querySelector(".trigger");e&&!t?.matches(":focus-visible")&&(this._openTimer&&e.clearTimeout(this._openTimer),this._closeTimer&&e.clearTimeout(this._closeTimer),this._openTimer=0,this._closeTimer=e.setTimeout(()=>{this._closeTimer=0,this.isConnected&&this._closeHelp()},150))}_triggerPointerEnter(e){this.pointerHover&&"mouse"===e.pointerType&&this._scheduleOpen()}_triggerPointerLeave(e){"mouse"===e.pointerType&&this._scheduleClose()}_triggerFocus(){queueMicrotask(()=>{const e=this.renderRoot.querySelector(".trigger");e?.matches(":focus-visible")&&(this._hoverOwned=!1,this._openHelp())})}_triggerBlur(){this._scheduleClose()}_triggerClick(){this._open?this._closeHelp():(this._hoverOwned=!1,this._openHelp())}_subscribeOpenListeners(){this.ownerDocument.addEventListener("pointerdown",this._outsidePointerDown,!0),this.ownerDocument.addEventListener("keydown",this._keyDown,!0);const e=this._window();e?.addEventListener("resize",this._queuePosition),e?.addEventListener("orientationchange",this._queuePosition),e?.visualViewport?.addEventListener("resize",this._queuePosition),e?.visualViewport?.addEventListener("scroll",this._queuePosition),this._scrollDialog=this._dialog(),this._scrollDialog?.addEventListener("scroll",this._dialogScroll,!0)}_unsubscribeOpenListeners(){this.ownerDocument.removeEventListener("pointerdown",this._outsidePointerDown,!0),this.ownerDocument.removeEventListener("keydown",this._keyDown,!0);const e=this._window();e?.removeEventListener("resize",this._queuePosition),e?.removeEventListener("orientationchange",this._queuePosition),e?.visualViewport?.removeEventListener("resize",this._queuePosition),e?.visualViewport?.removeEventListener("scroll",this._queuePosition),this._scrollDialog?.removeEventListener("scroll",this._dialogScroll,!0),this._scrollDialog=null}async _openHelp(){!this._open&&this._hasContent()&&(this._clearTimers(),this._forceFallback=!1,this._open=!0,this._subscribeOpenListeners(),await this.updateComplete,this._open&&(this._usesPopover()||this._renderFallback(),this._position()?this._overlayDispose=this._dialog()?.registerOverlay({owner:this,group:"transient",close:e=>this._closeHelp("escape"===e&&this._floating.ownsActiveElement(),e)})||null:this._closeHelp()))}_closeHelp(e=!1,t="exclusive"){if(!this._open&&!this._floating.hasFallback)return;this._clearTimers();const i=this._overlayDispose;this._overlayDispose=null,i?.();const o=this.renderRoot.querySelector(".tooltip");if(o?.hidePopover)try{o.matches(":popover-open")&&o.hidePopover()}catch{}this._open=!1,this._hoverOwned=!1,this._unsubscribeOpenListeners(),this._floating.destroy(),e&&this.updateComplete.then(()=>this.renderRoot.querySelector(".trigger")?.focus())}_tooltipTemplate(e){return t``}_renderFallback(){const e=d.styles.cssText;this._floating.renderFallback(this._tooltipTemplate(!1),e)}_surface(){return this._floating.surface(".tooltip",this._usesPopover())}_position(){if(!this._open)return!1;const e=this._window(),t=this.renderRoot.querySelector(".trigger");let i=this._surface();if(!e||!t?.isConnected||!i?.isConnected)return!1;const o=s(e);if(i.style.maxWidth=`${Math.max(0,Math.min(320,o.width-16))}px`,i.style.maxHeight=`${Math.max(0,o.height-16)}px`,i.style.visibility="hidden",this._usesPopover()&&i.showPopover)try{i.matches(":popover-open")||i.showPopover()}catch{if(this._forceFallback=!0,this._renderFallback(),i=this._surface(),!i?.isConnected)return!1;i.style.visibility="hidden"}const n=t.getBoundingClientRect(),r=i.getBoundingClientRect();if(!(n.width&&n.height&&r.width&&r.height))return!1;const l=a(n,r,o);return i.style.left=`${l.left}px`,i.style.top=`${l.top}px`,i.dataset.side=l.side,i.style.visibility="",!0}render(){if(!this._hasContent())return i;const e=this.ariaLabel.trim();return t` ({value:e.id,label:e.title||e.id})),this._spacesAuthoritative=!0}catch{this._spaces=[],this._spacesAuthoritative=!1}finally{this._spacesLoading=!1}}}get _lang(){return o(this.hass,this._config?.language)}get _floorToken(){const e=this._config?.floor;return"number"==typeof e?`__houseplan_yaml_floor_index__:${String(e)}`:null}get _formData(){const e={...this._config},o=this._floorToken;return o?e.floor=o:Object.prototype.hasOwnProperty.call(e,"floor")||(e.floor=""),e}get _schema(){const e=this._spaces||[],o=this._lang,a=[{value:"",label:t(o,"editor.floor_none")}],i=this._floorToken;i&&a.push({value:i,label:t(o,"editor.floor_index",{index:String(this._config?.floor)})});const l="string"==typeof this._config?.floor?this._config.floor:"";l&&!e.some(e=>e.value===l)&&a.push({value:l,label:l}),a.push(...e);const n="string"==typeof this._config?.default_floor?this._config.default_floor:"",r=[...e];return n&&!e.some(e=>e.value===n)&&r.unshift({value:n,label:n}),[{name:"title",selector:{text:{}}},{name:"floor",selector:{select:{mode:"dropdown",options:a}}},e.length?{name:"default_floor",selector:{select:{mode:"dropdown",options:r}}}:{name:"default_floor",selector:{text:{}}},{name:"language",selector:{select:{mode:"dropdown",options:s(t(o,"editor.lang_auto"),this._config?.language)}}},{name:"icon_size",selector:{number:{min:1,max:6,step:.1,mode:"box"}}},{name:"show_temperature",selector:{boolean:{}}},{name:"live_states",selector:{boolean:{}}},{name:"show_signal",selector:{boolean:{}}},{name:"kiosk",selector:{boolean:{}}},{name:"cycle",selector:{number:{min:0,max:3600,step:5,mode:"box"}}}]}render(){if(!this.hass||!this._config)return a;const e=i(this,l,o(this.hass,this._config.language));if("cold"===e)return n();if("warm"===e)return r;this._loadSpaces();const s=this._lang,h={title:t(s,"editor.title"),floor:t(s,"editor.floor"),default_floor:t(s,"editor.default_floor"),language:t(s,"editor.language"),icon_size:t(s,"editor.icon_size"),show_temperature:t(s,"editor.show_temperature"),live_states:t(s,"editor.live_states"),show_signal:t(s,"editor.show_signal"),kiosk:t(s,"editor.kiosk"),cycle:t(s,"editor.cycle")},f=this._schema,_=function(e,o,t){if(!t||null===o)return null;const s="string"==typeof e?.default_floor?e.default_floor:"";return!s||o.some(e=>e.value===s)?null:s}(this._config,this._spaces,this._spacesAuthoritative),d=e=>c`h[e.name]||e.name} - @value-changed=${this._valueChanged} - >`;return c` - ${d(f.slice(0,3))} - ${_?c``:a} - ${d(f.slice(3))} - `}_valueChanged(e){const o={...this._config,...e.detail.value};""===o.floor?delete o.floor:o.floor===this._floorToken&&(o.floor=this._config?.floor);const t=new Event("config-changed",{bubbles:!0,composed:!0});t.detail={config:o},this.dispatchEvent(t)}}h.properties={hass:{attribute:!1},_config:{state:!0},_spaces:{state:!0}},customElements.get("houseplan-card-editor")||customElements.define("houseplan-card-editor",h); diff --git a/custom_components/houseplan/frontend/houseplan-assets/editor-CrFGSaM9.js b/custom_components/houseplan/frontend/houseplan-assets/editor-CrFGSaM9.js new file mode 100644 index 00000000..e70a3f59 --- /dev/null +++ b/custom_components/houseplan/frontend/houseplan-assets/editor-CrFGSaM9.js @@ -0,0 +1,14 @@ +globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="012abf4b3924ad03971870eb8085ab1ac1a66b0d9b6676fe095285a8b0f201ab";import{q as e,l as o,v as t,e3 as s,A as a,e4 as i,e5 as l,e6 as n,E as r,c}from"./houseplan-card-CrTmJZ8b.js";class h extends e{constructor(){super(...arguments),this._spaces=null,this._spacesLoading=!1,this._spacesAuthoritative=!1}setConfig(e){this._config=e}async _loadSpaces(){if(!this._spaces&&!this._spacesLoading&&this.hass){this._spacesLoading=!0;try{const e=await this.hass.callWS({type:"houseplan/config/get"});this._spaces=(e?.config?.spaces||[]).map(e=>({value:e.id,label:e.title||e.id})),this._spacesAuthoritative=!0}catch{this._spaces=[],this._spacesAuthoritative=!1}finally{this._spacesLoading=!1}}}get _lang(){return o(this.hass,this._config?.language)}get _floorToken(){const e=this._config?.floor;return"number"==typeof e?`__houseplan_yaml_floor_index__:${String(e)}`:null}get _formData(){const e={...this._config},o=this._floorToken;return o?e.floor=o:Object.prototype.hasOwnProperty.call(e,"floor")||(e.floor=""),e}get _schema(){const e=this._spaces||[],o=this._lang,a=[{value:"",label:t(o,"editor.floor_none")}],i=this._floorToken;i&&a.push({value:i,label:t(o,"editor.floor_index",{index:String(this._config?.floor)})});const l="string"==typeof this._config?.floor?this._config.floor:"";l&&!e.some(e=>e.value===l)&&a.push({value:l,label:l}),a.push(...e);const n="string"==typeof this._config?.default_floor?this._config.default_floor:"",r=[...e];return n&&!e.some(e=>e.value===n)&&r.unshift({value:n,label:n}),[{name:"title",selector:{text:{}}},{name:"floor",selector:{select:{mode:"dropdown",options:a}}},e.length?{name:"default_floor",selector:{select:{mode:"dropdown",options:r}}}:{name:"default_floor",selector:{text:{}}},{name:"language",selector:{select:{mode:"dropdown",options:s(t(o,"editor.lang_auto"),this._config?.language)}}},{name:"icon_size",selector:{number:{min:1,max:6,step:.1,mode:"box"}}},{name:"show_temperature",selector:{boolean:{}}},{name:"live_states",selector:{boolean:{}}},{name:"show_signal",selector:{boolean:{}}},{name:"kiosk",selector:{boolean:{}}},{name:"cycle",selector:{number:{min:0,max:3600,step:5,mode:"box"}}}]}render(){if(!this.hass||!this._config)return a;const e=i(this,l,o(this.hass,this._config.language));if("cold"===e)return n();if("warm"===e)return r;this._loadSpaces();const s=this._lang,h={title:t(s,"editor.title"),floor:t(s,"editor.floor"),default_floor:t(s,"editor.default_floor"),language:t(s,"editor.language"),icon_size:t(s,"editor.icon_size"),show_temperature:t(s,"editor.show_temperature"),live_states:t(s,"editor.live_states"),show_signal:t(s,"editor.show_signal"),kiosk:t(s,"editor.kiosk"),cycle:t(s,"editor.cycle")},f=this._schema,_=function(e,o,t){if(!t||null===o)return null;const s="string"==typeof e?.default_floor?e.default_floor:"";return!s||o.some(e=>e.value===s)?null:s}(this._config,this._spaces,this._spacesAuthoritative),d=e=>c`h[e.name]||e.name} + @value-changed=${this._valueChanged} + >`;return c` + ${d(f.slice(0,3))} + ${_?c``:a} + ${d(f.slice(3))} + `}_valueChanged(e){const o={...this._config,...e.detail.value};""===o.floor?delete o.floor:o.floor===this._floorToken&&(o.floor=this._config?.floor);const t=new Event("config-changed",{bubbles:!0,composed:!0});t.detail={config:o},this.dispatchEvent(t)}}h.properties={hass:{attribute:!1},_config:{state:!0},_spaces:{state:!0}},customElements.get("houseplan-card-editor")||customElements.define("houseplan-card-editor",h); diff --git a/dist/houseplan-assets/fr-6DtT8TWD.js b/custom_components/houseplan/frontend/houseplan-assets/fr-C84z_afh.js similarity index 99% rename from dist/houseplan-assets/fr-6DtT8TWD.js rename to custom_components/houseplan/frontend/houseplan-assets/fr-C84z_afh.js index f2ac8c87..02675166 100644 --- a/dist/houseplan-assets/fr-6DtT8TWD.js +++ b/custom_components/houseplan/frontend/houseplan-assets/fr-C84z_afh.js @@ -1 +1 @@ -globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae33533bdef7216a6d7d513ae04091";var e={"editor.context_actions":"Actions : {object}","editor.tool_options":"Options de l’outil : {tool}","editor.palette":"Palette : {tool}","editor.open_group":"Groupe d’outils : {group}","editor.group_active":"{group} — actif : {item}","editor.disabled_action":"{action} est indisponible : {reason}","editor.loading":"Chargement de l'éditeur…","editor.loading_aria":"L'éditeur de plan est en cours de chargement","editor.load_failed":"Impossible de charger l'éditeur.","editor.refresh_advice":"Actualisez la page et réessayez.","editor.retry_advice":"Vérifiez votre connexion et appuyez à nouveau.","version_mismatch.title":"Les versions de House Plan ne correspondent pas","version_mismatch.body":"Si Home Assistant redémarre encore, attendez la fin, puis rechargez cette page.","version_mismatch.frontend":"Carte","version_mismatch.backend":"Intégration","version_mismatch.reload":"Recharger la page","color_picker.title":"Sélecteur de couleur","color_picker.hue":"Teinte","color_picker.saturation":"Saturation","color_picker.value":"Luminosité","color_picker.hex":"Couleur hexadécimale","color_picker.invalid_hex":"Saisissez une couleur hexadécimale à 3 ou 6 chiffres","color_picker.confirm":"OK","btn.properties":"Propriétés","btn.keep_as_walls":"Conserver comme murs","btn.delete_room_keep_walls":"Supprimer la pièce, conserver les murs","btn.delete_room_with_walls":"Supprimer la pièce et les murs","title.markup_select":"Sélectionner et modifier les murs et les colonnes","title.markup_column":"Colonne : cliquez sur un point de la grille pour placer une colonne carrée","markup.partition":"Cloison","markup.column":"Colonne","markup.hint_column":"cliquez sur un point de la grille pour placer une colonne carrée","history.wall_segment":"Ajouter un segment de mur","history.column_add":"Ajouter une colonne","history.physical_edit":"Modifier l’objet physique","history.physical_delete":"Supprimer l’objet physique","history.physical_move":"Déplacer l’objet physique","history.wall_face_batch":"Créer des pièces à partir des murs","toast.column_duplicate":"Une colonne avec le même centre et la même dimension extérieure existe déjà","physical.partition_properties":"Propriétés de la cloison","physical.column_properties":"Propriétés de la colonne","physical.shape":"Forme","physical.square":"Carré","physical.circle":"Cercle","physical.diameter":"Diamètre","physical.side":"Côté","physical.rotation":"Angle de rotation","physical.length":"Longueur","physical.allowed_range":"Autorisé : {min}–{max} {unit}","physical.column_size_title":"Côté extérieur de la colonne carrée placée par le clic (1–150 cm).","card.title":"Plan de la maison","count.devices":"{n} app.","empty.no_spaces":"Aucun espace pour le moment.","nav.spaces":"Espaces House Plan","empty.add_first":"Ajoutez le premier espace et importez un plan.","empty.read_only":"Aucun espace n’est configuré. Demandez à un administrateur d’en ajouter un.","empty.install":"Installez l’intégration House Plan et ajoutez-la dans « Appareils et services ».","btn.add_space":"Ajouter un espace","btn.cancel":"Annuler","btn.save":"Enregistrer","btn.close":"Fermer","btn.delete":"Supprimer","btn.copy":"Copier","btn.edit":"Modifier","btn.open_in_ha":"Ouvrir dans HA","btn.reset":"Réinitialiser","btn.attach":"Joindre…","btn.upload":"Importer…","btn.replace":"Remplacer…","title.zoom_in":"Zoomer","title.zoom_out":"Dézoomer","title.zoom_fit":"Tout ajuster","title.configure_space":"Configurer l’espace","title.add_space":"Ajouter un espace","title.markup_add":"Murs : tracez une chaîne continue ; chaque segment accepté est enregistré séparément. Maj verrouille à 45°","title.markup_merge":"Fusionner : cliquez sur une pièce, puis sur la pièce voisine avec laquelle elle partage un mur","title.markup_split":"Diviser une pièce : cliquez sur la pièce, puis sur deux points de ses murs","title.markup_delroom":"Supprimer une pièce : cliquez à l’intérieur de la pièce puis confirmez","title.need_plan":"Importer une image de plan","markup.add":"Murs","markup.merge":"Fusionner","markup.split":"Diviser","markup.resize":"Redimensionner","title.markup_resize":"Redimensionner les pièces : faites glisser une poignée disponible sur un mur horizontal ou vertical","markup.hint_resize":"faites glisser une poignée de mur disponible · le mur s’arrête à la première position non sûre · Échap annule · Ctrl+Z — annuler","resize.disabled.diagonal":"Ce mur est incliné ; le redimensionnement ne prend en charge que les murs horizontaux et verticaux","resize.disabled.side-angle":"Un mur adjacent est incliné ; le redimensionnement exige que les deux murs adjacents rencontrent ce mur à angle droit","resize.disabled.duplicate-physical-wall":"Une cloison distincte ou une colonne chevauche ce mur ; supprimez-la ou déplacez-la avant de redimensionner","resize.disabled.partial-shared":"Une pièce voisine n’utilise qu’une partie de ce mur ; il ne peut donc pas être déplacé en toute sécurité comme un mur partagé unique","resize.disabled.unequal-shared":"La pièce voisine utilise des extrémités ou une longueur de mur différentes ; les murs ne peuvent donc pas être déplacés ensemble en toute sécurité","resize.disabled.multiple-rooms":"Déplacer ce mur affecterait plus de deux pièces","resize.disabled.thickness-conflict":"L’épaisseur du mur ne peut pas être conservée en toute sécurité","resize.disabled.opening-conflict":"Une ouverture sur ce mur ne peut pas être déplacée en toute sécurité","resize.disabled.invalid-geometry":"Ce mur ne peut pas être redimensionné sans modifier la structure du plan","resize.limit_stopped":"Mur arrêté : l'étape suivante enfreindrait une limite de jonction","resize.commit_failed":"Le redimensionnement a été annulé car le plan final n’a pas passé le contrôle de géométrie","resize.preview_failed":"Le redimensionnement s’est arrêté à la dernière position sûre car la géométrie du plan ne pouvait pas être préservée","markup.opening":"Ouverture","markup.delete_room":"Supprimer la pièce","history.undo":"Annuler","history.redo":"Rétablir","history.undo_named":"Annuler : {name} (Ctrl+Z)","history.redo_named":"Rétablir : {name} (Ctrl+Maj+Z / Ctrl+Y)","history.undo_empty":"Rien à annuler","history.redo_empty":"Rien à rétablir","history.undone":"Annulé : {name}","history.redone":"Rétabli : {name}","history.add_room":"Créer une pièce","history.split_room":"Diviser la pièce","history.merge_rooms":"Fusionner les pièces","history.resize_room":"Redimensionner la pièce","history.wall_thickness":"Modifier l’épaisseur du mur","history.add_opening":"Ajouter une ouverture de porte ou de fenêtre","history.edit_opening":"Modifier l’ouverture","history.move_opening":"Déplacer l’ouverture","history.delete_opening":"Supprimer l’ouverture","history.delete_room_keep_walls":"Supprimer la pièce, conserver les murs","history.delete_room_with_walls":"Supprimer la pièce et les murs","history.decor_add":"Ajouter un objet décoratif","history.decor_edit":"Modifier l’objet décoratif","history.decor_move":"Déplacer l’objet décoratif","history.decor_transform":"Transformer l’objet décoratif","history.decor_delete":"Supprimer l’objet décoratif","history.backdrop_transform":"Transformer l’arrière-plan du plan","history.device_move":"Déplacer {name}","history.device_stale":"L’historique des positions n’est plus applicable et a été effacé","opening.new":"Nouvelle ouverture","opening.edit":"Ouverture","opening.door":"Porte","opening.window":"Fenêtre","opening.gate":"Portail","opening.passage":"Passage ouvert","opening.passage_binding_warning":"L’enregistrement supprimera le capteur d’ouverture/fermeture et la serrure.","opening.invalid_passage_fields":"Le passage ouvert du plan « {room} » possède des paramètres non pris en charge : {fields}.","opening.type_label":"Type","opening.length_label":"Longueur, cm","opening.contact_label":"Capteur d’ouverture/fermeture","opening.lock_label":"Serrure","opening.none":"— aucun —","opening.search_ph":"Rechercher : nom ou ID d’entité…","opening.invert":"Inverser ouvert/fermé","opening.flip_h":"Charnière sur l’autre montant","opening.flip_v":"Ouverture de l’autre côté","opening.open":"Ouvert","opening.closed":"Fermé","opening.locked":"Verrouillé","opening.unlocked":"Déverrouillé","opening.state_unknown":"indisponible","opening.no_entities":"Aucun capteur associé — symbole statique sur le plan.","toast.opening_no_wall":"Cliquez près d’un mur de pièce ou d’un mur indépendant","opening.host_partition":"Mur indépendant","opening.partition_orphan":"Le mur indépendant de cette ouverture n’existe plus","opening.partition_jamb_margin":"Laissez au moins {distance} entre l’ouverture et l’extrémité du mur","opening.rebind_partition":"Associer à un autre mur indépendant","confirm.delete_partition_openings_title":"Supprimer le mur et les ouvertures ?","confirm.delete_partition_openings_body":"Ce mur contient {count} ouverture(s). Elles seront supprimées avec lui.","confirm.delete_partition_openings_item":"• {type}, {length}","markup.hint_points":"points : {n} · Maj — pas de 45° · Échap — terminer la chaîne · Ctrl+Z — annuler un point · fermer une zone propose de créer une pièce","markup.hint_start":"cliquez sur un point de la grille pour commencer une chaîne de murs","tip.lqi":"signal Zigbee moyen :","tip.area":"surface : {value}","info.device_header":"Appareil sur le plan","info.model":"Modèle","info.state":"État","info.link":"Lien","info.manuals":"Manuels","info.none":"Aucune information supplémentaire","marker.new_device":"Nouvel appareil","marker.name_label":"Nom (affiché sur le plan)","marker.name_ph":"Nom","marker.binding_label":"Associer à un appareil HA","marker.binding_disabled":"désactivé dans Home Assistant","marker.virtual_option":"Appareil virtuel (sans association)","marker.search_ph":"Rechercher un appareil / groupe…","marker.nothing_found":"aucun résultat","marker.room_label":"Pièce","marker.room_override":" (placement forcé)","marker.room_choose":"— sélectionner une pièce —","marker.room_auto":"— selon la zone de l’appareil (auto) —","marker.icon_label":"Icône","marker.icon_ph":"mdi:… (vide = auto)","marker.display_label":"Affichage","display.badge":"Icône + état","display.icon_ripple":"Icône + état et activité","display.static_icon":"Icône toujours statique","marker.display_hint_badge":"L’icône et le fond dynamique affichent l’état de l’appareil sans la pulsation d’activité habituelle. Les alarmes rouges restent visibles.","marker.display_hint_icon_ripple":"L’icône, le fond dynamique et la pulsation affichent une brève animation pour les événements et une animation continue pour le fonctionnement, le mouvement ou la présence. Les alarmes rouges restent prioritaires.","marker.display_hint_value":"Une valeur Home Assistant sélectionnée ou résolue automatiquement remplace l’icône tandis que le fond continue d’indiquer l’état. Les alarmes rouges restent visibles.","marker.display_hint_static_icon":"Le contour adapté au thème et l’icône restent toujours identiques. L’état, l’activité, l’indisponibilité et les alarmes ne modifient pas l’apparence.","marker.static_alarm_warning":"Cet appareil peut signaler des alarmes. L’affichage statique masque l’indication visuelle d’alarme du marqueur.","marker.preview.title":"Aperçu de l’affichage","marker.preview.actual":"Actuel","marker.preview.example":"Exemple","marker.preview.integration":"Fourni par","marker.preview.source":"Source d’affichage","marker.preview.current_state":"État actuel","marker.preview.result":"Sur le plan","marker.preview.details":"Détails de la source","marker.preview.select_source":"Choisissez un appareil ou une entité Home Assistant pour voir son affichage réel.","marker.preview.unknown_provider":"Intégration inconnue","marker.preview.virtual_provider":"House Plan · appareil virtuel","marker.preview.no_source":"Aucune source active","marker.preview.no_state":"Aucun état actuel","marker.preview.mixed_states":"Plusieurs états différents","marker.preview.multiple_sources":"{n} sources","marker.preview.more_sources":"+{n} de plus","marker.preview.scaled":"L’aperçu est redimensionné à {n}% pour tenir dans la zone. La taille enregistrée reste inchangée.","marker.preview.demo_short":"Afficher une activité brève","marker.preview.demo_continuous":"Afficher une activité continue","marker.preview.stop_continuous":"Arrêter l’activité continue","marker.preview.demo_short_notice":"Exemple d’activité brève ; l’état réel de l’appareil reste inchangé.","marker.preview.demo_continuous_notice":"Exemple d’activité continue ; l’état réel de l’appareil reste inchangé.","marker.preview.demo_already_visible":"L’état actuel affiche déjà un véritable effet d’activité ou d’alarme.","marker.preview.reduced_motion":"La réduction des animations est activée sur le système ; l’activité normale est donc affichée sous forme de point.","marker.preview.reason.neutral":"Fond sombre neutre","marker.preview.reason.working":"Fond jaune : l’appareil fonctionne actuellement","marker.preview.reason.working_activity":"Fond jaune et effet d’activité : l’appareil fonctionne actuellement","marker.preview.reason.open":"Fond orange : physiquement ouvert ou déverrouillé","marker.preview.reason.cover_icon_state":"Fond neutre ; l’entité de volet contrôle l’état et l’icône affichés","marker.preview.reason.presence":"Effet d’activité tant qu’une présence est détectée","marker.preview.reason.event":"Effet d’activité bref après un événement détecté","marker.preview.reason.transition":"Effet d’activité pendant que l’appareil se déplace ou change d’état","marker.preview.reason.media_neutral":"Les appareils multimédias restent sur un fond sombre neutre tant qu’ils sont disponibles","marker.preview.reason.unavailable":"Fond neutre atténué : indisponible ou éteint","marker.preview.reason.alarm":"Fond d’alarme rouge ; l’indication d’alarme est toujours affichée","marker.preview.reason.live_states_disabled":"Le style selon les états en direct est désactivé pour cette carte","marker.preview.reason.value_no_state":"Aucune valeur d’état exploitable ; l’icône est affichée à la place","marker.preview.reason.value_ambiguous_sources":"Plusieurs sources de valeur possibles ; l’icône est affichée à la place","marker.preview.reason.value_non_scalar":"La source n’a pas renvoyé de valeur simple ; l’icône est affichée à la place","marker.preview.reason.value_virtual":"Un appareil virtuel n’a aucune valeur Home Assistant ; l’icône est affichée à la place","marker.preview.reason.vacuum_live_plan_only":"La position et la trajectoire en direct de l’aspirateur ne sont disponibles que sur le plan complet","marker.preview.reason.hidden_design_preview":"L’appareil est masqué sur le plan ; cet aperçu de conception reste visible","marker.preview.reason.composite_power_source":"L’état provient de l’entité d’alimentation de l’appareil ; les interrupteurs auxiliaires sont ignorés","marker.preview.reason.activity_display_disabled":"Le mode d’affichage sélectionné n’affiche pas les effets d’activité habituels","marker.preview.reason.ha_disabled":"L’association Home Assistant est désactivée et sera masquée sur le plan","marker.preview.reason.orphaned":"L’association Home Assistant enregistrée est introuvable","marker.preview.reason.static_icon":"Mode statique : l’état de l’appareil ne modifie pas l’icône","marker.activity_color":"Couleur de la pulsation d’activité","marker.ripple_size":"Taille de la pulsation d’activité","marker.activity_alarm_note":"La couleur et la taille n’affectent que l’activité normale et ne modifient pas les alarmes rouges.","marker.pulse_a11y_alarm":"Alarme","marker.pulse_a11y_event":"Événement récent","marker.pulse_a11y_presence":"Présence détectée","marker.pulse_a11y_transition":"Changement d’état","marker.pulse_a11y_running":"En fonctionnement","marker.state_a11y_neutral":"État par défaut","marker.state_a11y_working":"En fonctionnement","marker.state_a11y_open":"Ouvert","marker.state_a11y_locked":"Verrouillé","marker.state_a11y_unlocked":"Déverrouillé","marker.state_a11y_alarm":"Alarme","marker.state_a11y_unavailable":"Indisponible","marker.lqi_a11y_low":"LQI {value}, signal faible","marker.lqi_a11y_mid":"LQI {value}, signal moyen","marker.lqi_a11y_high":"LQI {value}, signal fort","marker.size_label":"Taille / rotation de l’icône","marker.angle_label":"Rotation","marker.model_label":"Modèle","marker.model_ph":"ex. Aqara T&H","marker.link_label":"Lien","marker.desc_label":"Description","marker.desc_ph":"Notes, caractéristiques…","marker.manuals_label":"Manuels (PDF, etc.)","marker.sub_device":"appareil","marker.sub_z2m_group":" · groupe Z2M","marker.sub_group":"groupe","marker.sub_helper":"assistant","space.new":"Nouvel espace","space.copy_title":"Copier l’espace","space.copy_name":"Nom du nouvel espace","space.copy_fallback":"Espace","space.copy_create":"Créer la copie","space.copy_optimize_title":"Optimiser avant de copier ?","space.copy_optimize_body":"Avant de créer « {name} », House Plan doit optimiser tout le plan, y compris les autres espaces. Continuer ?","space.copy_optimize_confirm":"Optimiser et copier","space.copy_error_changed":"Le plan a changé pendant la confirmation. Vérifiez-le et réessayez.","space.copy_error_source_missing":"L’espace source n’existe plus. Rouvrez ses réglages et réessayez.","space.copy_error_source_invalid":"House Plan n’a pas pu valider tous les murs de cet espace. Corrigez l’espace source.","space.copy_error_spaces_limit":"House Plan contient déjà le nombre maximal d’espaces.","space.copy_error_partitions_limit":"Cet espace contient trop de murs pour être copié.","space.copy_error_openings_limit":"Cet espace contient trop d’ouvertures pour être copié.","space.copy_error_decor_limit":"Cet espace contient trop d’objets d’arrière-plan pour être copié.","space.copy_error_columns_limit":"Cet espace contient trop de colonnes pour être copié.","space.copy_error_opening_host":"Une ouverture n’est plus rattachée à un mur. Corrigez-la ou supprimez-la avant la copie.","space.copy_error_geometry":"La copie créerait une géométrie de murs non sûre. Corrigez l’espace source.","space.copy_error_optimize_geometry":"La copie est arrêtée car l’optimisation de tout le plan n’est pas sûre pour un espace.","space.header":"Espace","space.title_label":"Titre","space.title_ph":"ex. Garage","space.plan_label":"Plan (arrière-plan)","space.no_plan":"aucune image de plan","space.plan_alt":"plan","room.new":"Nouvelle pièce","room.name_label":"Nom affiché","room.name_ph":"ex. Terrasse","room.area_label":"Zone Home Assistant (non attribuée)","room.no_area_option":"— aucune zone —","room.default_name":"Pièce","device.unnamed":"sans nom","device.light_group":"groupe de lumières","device.fallback":"appareil","device.virtual":"appareil virtuel","confirm.delete_room_title":"Supprimer la pièce « {name} » ?","confirm.delete_room_body":"Choisissez si les murs physiques propres à la pièce doivent être conservés. Les murs partagés avec une autre pièce sont toujours conservés.","confirm.remove_marker_title":"Supprimer l’appareil du plan ?","confirm.remove_marker_body":"L’appareil disparaîtra complètement et ne contribuera plus aux données du plan. Vous pourrez l’ajouter de nouveau plus tard.","confirm.erase_decor":"Effacer l’objet {kind} ? Vous pouvez annuler cette action depuis l’historique de l’éditeur.","confirm.delete_space_title":"Supprimer l’espace ?","confirm.delete_space_body":"L’espace, toutes ses pièces et tout le tracé du plan seront supprimés.","confirm.delete_space_vac_routes":"Les affectations de cartes de robots seront aussi supprimées : {count}.","space.delete_blocked":"Cet espace est encore utilisé par {n} appareil(s). Déplacez-les vers un autre espace ou supprimez-les d’abord.","toast.pos_save_failed":"Échec de l’enregistrement de la position : {err}","toast.no_entity":"L’appareil n’a aucune entité adaptée","toast.ha_disabled_action":"Un objet Home Assistant désactivé ne peut pas être utilisé sur le plan.","toast.ha_disabled_show_device":"Un appareil désactivé dans Home Assistant ne peut pas être affiché sur le plan. Activez-le d’abord dans Home Assistant.","toast.ha_disabled_show_entity":"Une entité désactivée dans Home Assistant ne peut pas être affichée sur le plan. Activez-la d’abord dans Home Assistant.","toast.ha_disabled_add":"Un objet Home Assistant désactivé ne peut pas être ajouté au plan. Activez-le d’abord dans Home Assistant.","toast.ha_binding_unverified":"L’état de l’objet n’a pas pu être vérifié via le registre Home Assistant. L’affichage et les actions sont temporairement indisponibles.","toast.markup_needs_server":"Le tracé est disponible une fois la configuration déplacée sur le serveur","toast.space_order_changed":"L’ordre a changé. Si une carte fixe son étage par numéro, vérifiez ces tableaux de bord.","toast.conflict":"La configuration a été modifiée dans une autre fenêtre — données actualisées, répétez votre dernière action","toast.cfg_save_failed":"Échec de l’enregistrement de la configuration : {err}","toast.room_overlap":"Le contour chevauche la pièce « {name} » — les pièces ne doivent pas se chevaucher","toast.contour_cannot_close":"Le contour ne peut pas être fermé car il est dégénéré ou s’auto-intersecte","toast.merge_not_adjacent":"Seules les pièces partageant un mur peuvent être fusionnées","toast.rooms_merged":"Pièces fusionnées dans « {name} »","toast.split_pick_wall":"Commencez la découpe sur le mur de la pièce","toast.split_bad_cut":"La découpe doit aller d’un mur à l’autre à l’intérieur de la pièce, sans croiser de mur ni se croiser elle-même","merge.header":"Fusionner les pièces","merge.hint":"La pièce fusionnée conserve un nom et une zone. L’autre zone est libérée — ses appareils quittent le plan jusqu’à ce qu’une autre pièce la récupère.","merge.keep":"Conserver","merge.no_area":"aucune zone","toast.room_saved":"Pièce enregistrée ({n}). Appareils ajoutés : {added}. Tracez la suivante ou quittez le mode tracé.","toast.room_saved_no_area":"Pièce enregistrée ({n}, sans zone). Tracez la suivante ou quittez le mode tracé.","toast.marker_needs_server":"La modification des appareils est disponible une fois la configuration déplacée sur le serveur","toast.virtual_name_required":"Saisissez un nom pour l’appareil virtuel","toast.marker_saved":"Appareil enregistré","toast.marker_removed":"Appareil supprimé du plan","toast.integration_missing":"L’intégration House Plan n’est pas installée — gestion indisponible","toast.plan_formats":"Formats pris en charge : SVG, PNG, JPG, WebP","toast.plan_required":"Importez un plan — il est obligatoire","toast.space_added_onboard":"Espace ajouté. Tracez les pièces : cliquez sur les points de la grille et fermez le contour.","toast.space_added":"Espace ajouté","toast.space_copied":"Espace « {name} » créé","toast.space_saved":"Espace enregistré","toast.space_deleted":"Espace supprimé","toast.delete_failed":"Échec de la suppression : {err}","toast.error":"Erreur : {err}","toast.toggle_target_unavailable":"La cible « {name} » est indisponible — aucune action n’a été effectuée","toast.toggle_targets_unavailable":"Cibles indisponibles : {names}. Aucune action n’a été effectuée","toast.file_failed":"Le fichier « {name} » n’a pas été importé : {err}","toast.files_attached":"Fichiers joints : {n}","err.unknown":"erreur inconnue","err.code":"code {code}","err.too_large":"fichier supérieur à {mb} Mo","err.bad_ext":"type non pris en charge (PDF/image attendu)","err.unauthorized":"droits administrateur requis","editor.title":"Titre","editor.default_floor":"Espace initial","editor.default_floor_missing":"L’espace initial « {id} » n’existe plus. Choisissez un autre espace.","editor.floor":"Espace fixe","editor.floor_none":"— non fixé —","editor.floor_index":"Index YAML {index} (conservé)","fixed_floor.loading":"Chargement de l’espace fixe…","fixed_floor.invalid_title":"L’espace fixe est indisponible","fixed_floor.invalid_body":"Vérifiez floor dans la configuration de la carte. Valeur configurée : {value}","editor.icon_size":"Taille des icônes, % de la largeur du plan","editor.show_temperature":"Afficher la température","editor.live_states":"États en direct (on/off, ouvert…)","editor.light_pools":"Halos lumineux et ombres des murs","editor.show_signal":"Afficher le signal Zigbee (LQI)","editor.language":"Langue de l’interface","editor.lang_auto":"Auto (profil HA)","title.icon_rules":"Règles d’icônes : quelle icône MDI attribuer aux appareils selon leur nom","rules.title":"Règles d’icônes","rules.hint":"Les règles sont testées de haut en bas sur « nom de l’appareil + modèle » (expression régulière insensible à la casse) ; la première correspondance gagne. Si rien ne correspond, la classe d’appareil de l’entité est utilisée, puis l’icône générique.","rules.pattern_ph":"regex, ex. plug|socket","rules.icon_ph":"mdi:power-socket-de","rules.add":"Ajouter une règle","rules.reset":"Réinitialiser par défaut","rules.test_ph":"Tester un nom d’appareil…","rules.invalid":"expression régulière invalide","rules.saved":"Règles d’icônes enregistrées","btn.up":"Monter","btn.down":"Descendre","tap.info":"Fiche de l’appareil","tap.more_info":"Boîte de dialogue Plus d’infos de HA","tap.toggle":"Basculer l’état","marker.tap_label":"Action au toucher pour cet appareil","tap.toggle_note":"L’état déterminé est affiché ci-dessous. Les appareils sécurisés ne sont jamais basculés depuis le plan.","import.title":"Créer des espaces à partir des étages HA","import.hint":"Votre Home Assistant connaît déjà ces étages. Sélectionnez ceux à transformer en espaces du plan — vous importerez ensuite une image de plan pour chacun. Les pièces sont ensuite tracées manuellement sur le plan.","import.start":"Créer {n} espace(s)","import.manual":"Commencer de zéro","import.progress":"Étage {i} sur {n}","import.done":"Espaces créés. Tracez les pièces : cliquez sur les points de la grille et fermez le contour.","btn.skip":"Passer","space.scale_label":"Échelle (taille d’une cellule de grille)","space.cell_cm.help":"Relie la grille aux dimensions réelles : les longueurs, les surfaces, l’épaisseur des murs, la taille des ouvertures et le rayon du halo en dépendent. Une modification ultérieure change les dimensions calculées de tout l’espace sans déplacer ses points sur le plan.","space.cell_cm.help.aria":"Aide : échelle de l’espace","space.scale_unit":"cm par cellule","space.scale_unit_imperial":"po par cellule","space.display_section":"Affichage","space.show_borders":"Toujours afficher les contours des pièces","space.zero_wall_style":"Murs d’épaisseur nulle","space.zero_wall_style.help":"Les murs d’épaisseur nulle en pointillés laissent passer le halo et les rayons du soleil, tandis que les murs pleins les bloquent comme une barrière sans surface. Ce choix s’applique à tous ces murs de l’espace, même si leur ligne est masquée en mode Vue.","space.zero_wall_style.help.aria":"Aide : style des murs d’épaisseur nulle","space.zero_wall_dashed":"Pointillés","space.zero_wall_solid":"Plein","space.show_names":"Afficher les noms des pièces (faire glisser pour déplacer)","space.room_color":"Couleur du contour et du nom","space.opacity":"Opacité","space.fill_label":"Remplissage de la pièce","space.fill_mode.help":"« Couleur personnalisée » définit le style, tandis que « Lumière », « Température » et « LQI » utilisent les données actuelles de Home Assistant. Le halo s’active séparément.","space.fill_mode.help.aria":"Aide : mode de remplissage des pièces","fill.none":"Aucun","fill.lqi":"Signal Zigbee","fill.light":"Lumières","fill.custom":"Couleur personnalisée","space.custom_fill":"Couleur de remplissage","space.source_file":"J’ai une image de plan","space.source_draw":"Aucune image — je tracerai les pièces à la main","fill.temp":"Température","tip.temp_avg":"température moyenne :","tip.hum_avg":"humidité moyenne :","space_card.button":"Ouvrir le plan de l’espace","space_card.not_found":"Espace « {id} » introuvable","space_card.loading":"Chargement…","continuity.restore_plan":"Restauration du plan…","continuity.restore_connection":"Restauration de la connexion aux appareils…","continuity.retry":"Réessayer","editor.space":"Espace","editor.framing":"Cadrage","editor.fit_content":"Tout le contenu visible","editor.fit_house":"Ajusté à la géométrie de la maison","editor.show_button":"Afficher le bouton","editor.button_label":"Libellé du bouton","editor.button_target":"Chemin du tableau de bord cible","marker.sub_entity":"entité","title.general_settings":"Paramètres généraux","title.export_pdf":"Enregistrer en PDF","pdf.title":"Enregistrement en PDF","pdf.dimensions":"Afficher les dimensions et les surfaces","pdf.decor":"Afficher les meubles et les autres éléments","pdf.room_names":"Afficher les noms des pièces","pdf.backdrop":"Afficher le fond de plan","pdf.save":"Enregistrer","pdf.saving":"Création…","pdf.failed":"Impossible de créer le PDF.","pdf.too_large":"Les images dépassent la limite PDF de 25 Mo.","pdf.asset_failed":"Impossible de charger une image de fond ou de décoration.","pdf.scale":"Échelle 1:{n}","pdf.north":"Nord","gs.title":"Paramètres généraux","gs.light_group":"Remplissage : lumières","gs.light_on":"Lumières allumées","gs.light_off":"Toutes les lumières éteintes","gs.temp_group":"Remplissage : température","gs.temp_cold":"Froid","gs.temp_ok":"Confortable","gs.temp_hot":"Chaud","gs.lqi_group":"Remplissage : signal Zigbee","gs.lqi_low":"Signal faible","gs.lqi_high":"Signal fort","gs.reset":"Réinitialiser par défaut","gs.saved":"Paramètres généraux enregistrés","gs.radar_show_live":"Afficher la présence en direct sur le plan","gs.radar_show_live_hint":"Masque ou affiche toutes les cibles radar en direct. Cela ne démarre ni n’arrête l’enregistrement des observations.","radar.title":"Présence sur le plan","radar.help":"Reliez ce marqueur aux entités radar exactes de Home Assistant, placez le capteur et choisissez son profil de coordonnées. Les positions en direct sont limitées à la pièce sélectionnée.","radar.help.aria":"Aide : paramètres du radar de présence","radar.enabled":"Utiliser ce radar de présence","radar.show_live":"Afficher les cibles en direct","radar.configure":"Configurer le radar","radar.configure_on_plan":"Configurer sur le plan","radar.change_installation":"Changer l’installation","radar.no_contour":"Cette pièce n’a pas de contour. Les points radar ne seront pas limités.","radar.discard_setup_title":"Abandonner la configuration du radar ?","radar.discard_setup":"La configuration du radar non enregistrée sera perdue.","radar.step_place_mount":"Indiquez la position physique du capteur","radar.step_place_heading":"Indiquez un point droit devant le capteur","radar.step_reference":"Indiquez la position de référence {n}, puis lancez la mesure","radar.step_check_reference":"Indiquez une position de contrôle indépendante","radar.start_measure":"Lancer la mesure","radar.countdown":"Placez-vous sur le repère dans {seconds} s","radar.capturing":"Restez immobile et seul pendant la mesure…","radar.fit_ready":"Le calibrage est prêt","radar.check_third":"Vérifier à une autre position","radar.check_complete":"Contrôle indépendant terminé","radar.error_distance":"Écart de position : {distance}","radar.ambiguous_target":"Plusieurs cibles ont été signalées. Recommencez la mesure seul.","radar.insufficient_samples":"Coordonnées actuelles insuffisantes. Réessayez ou utilisez le réglage manuel.","radar.bad_references":"Choisissez des références espacées dans des directions différentes du capteur.","radar.ambiguous_sources":"Les mesures permettent deux directions également plausibles. Choisissez des repères distinguant la gauche de la droite.","radar.bad_fit":"Les mesures ne correspondent pas. Vérifiez les unités, la position du capteur et les références.","radar.desktop_hint":"Utilisez un ordinateur pour un réglage précis. L’édition sur appareils tactiles est prise en charge au mieux.","radar.detected":"House Plan a reconnu les métadonnées radar de cet appareil. Vérifiez les sources exactes avant d’enregistrer.","radar.detected_ld2450":"House Plan a trouvé un ensemble de coordonnées ESPHome LD2450. Vérifiez les sources X/Y exactes avant d’enregistrer.","radar.additional_actions":"Actions supplémentaires","radar.declare":"Ceci est un radar de présence","radar.profile":"Profil de données","radar.profile_esphome_ld2450_v1":"ESPHome LD2450 (cibles X/Y)","radar.profile_cartesian_v1":"Cibles cartésiennes (X/Y)","radar.profile_polar_v1":"Cible polaire (distance/angle)","radar.profile_range_v1":"Distance uniquement","radar.profile_zones_v1":"États des zones","radar.profile_presence_v1":"Présence uniquement","radar.room":"Pièce observée","radar.room_choose":"Choisir une pièce","radar.target":"Cible {n}","radar.axis_x":"Entité de coordonnée X","radar.axis_y":"Entité de coordonnée Y","radar.add_target":"Ajouter un emplacement de cible","radar.range_channel":"Canal de distance {n}","radar.add_range":"Ajouter un canal de distance","radar.presence_gate":"Entité de présence du canal","radar.swap_axes":"Permuter les axes X et Y","radar.axis_x_sign":"Direction X","radar.axis_y_sign":"Direction Y","radar.distance_source":"Entité de distance","radar.angle_source":"Entité d’angle","radar.angle_unit":"Unité d’angle","radar.degrees":"Degrés","radar.radians":"Radians","radar.angle_zero":"Direction de l’angle zéro","radar.angle_forward":"Vers l’avant","radar.angle_right":"Vers la droite","radar.angle_clockwise":"Les angles augmentent dans le sens horaire","radar.zone_source":"Entité de zone","radar.occupancy_source":"Entité de présence","radar.count_source":"Entité du nombre de cibles","radar.availability_source":"Entité de disponibilité","radar.source_choose":"Choisir une entité","radar.source_optional":"Facultatif","radar.source_missing":"actuellement indisponible","radar.saved_unsupported":"Cette configuration radar enregistrée est incomplète ou non prise en charge. Elle reste inactive ; supprimez-la ou mettez House Plan à jour avant de la reconfigurer.","radar.occupancy":"Présence (activée/désactivée)","radar.count":"Nombre","radar.mount":"Position et direction","radar.mount_hint":"Il s’agit de la position physique du capteur. Déplacer son marqueur décoratif ne la modifie pas.","radar.heading":"Direction, °","radar.range_cm":"Portée, cm","radar.fov_deg":"Champ de vision, °","radar.unit":"Unité de la source","radar.mirror":"Inverser l’axe gauche/droite","radar.remove":"Supprimer les paramètres radar","radar.invalid":"Renseignez la pièce, les sources et la position du radar avant d’enregistrer.","radar.check_sources":"Vérifier les données en direct","radar.checking":"Vérification…","radar.health":"État de la connexion","radar.live_summary":"Cibles actuelles : {targets} ; arcs de distance : {ranges}","radar.health_ok":"Données actuelles reçues","radar.health_off":"Aucune cible détectée","radar.health_stale":"Certaines coordonnées sont obsolètes","radar.health_partial":"Certaines sources sont à jour, d’autres sont obsolètes","radar.health_restricted":"L’accès à une ou plusieurs sources est limité","radar.health_incomplete":"Le rapport radar actuel est incomplet","radar.health_position_unavailable":"Présence signalée ; position actuelle indisponible","radar.health_unavailable":"Données du capteur indisponibles","radar.health_needs_setup":"L’installation doit être configurée","radar.health_inconsistent":"Les sources fournissent des valeurs contradictoires","radar.health_unknown":"L’état actuel est inconnu","radar.health_disabled":"Le radar est désactivé","radar.error_invalid_radar":"Vérifiez les paramètres radar.","radar.error_invalid_selection":"Sélectionnez une pièce existante et des sources valides.","radar.error_source_restricted":"Vous n’avez pas accès à toutes les sources sélectionnées.","radar.error_rate_limited":"Trop de demandes. Réessayez dans un instant.","radar.error_not_ready":"Le traitement radar n’est pas encore prêt.","radar.error_conflict":"Le plan a changé. Rouvrez la configuration radar et réessayez.","radar.error_source_unavailable":"Une ou plusieurs sources radar sélectionnées sont indisponibles.","radar.error_unsupported_capability":"Cette fonction radar n’est pas prise en charge par l’intégration installée.","radar.report_age":"il y a {seconds} s","space.show_lqi":"Afficher le signal Zigbee (LQI) à côté des appareils","space.hide_decor":"Masquer la couche décorative","space.hide_decor_tip":"Les lignes, formes, étiquettes et meubles restent à leur place — visibles dans l’éditeur d’arrière-plan, mais pas sur le plan.","space.hide_openings":"Masquer les ouvertures","space.hide_openings_tip":"Les symboles de portes, fenêtres et portails ne sont pas dessinés, mais les ouvertures continuent de fonctionner : la lumière les traverse, le soleil entre par les fenêtres et les capteurs de contact continuent de les ouvrir. L’éditeur de plan les affiche toujours.","gs.light_none":"Aucune source lumineuse","mode.plan":"Éditeur de plan","mode.devices":"Éditeur d’appareils","display.value":"Valeur + état","marker.subarea":"aucune zone, manuel","device.new":"Nouvel appareil — ouvrez son éditeur pour fermer","opening.unlock_action":"Déverrouiller","opening.lock_action":"Verrouiller","opening.lock_pending":"En cours…","title.close_editor":"Fermer l’éditeur (retour à la vue)","title.add_device":"Ajouter un appareil au plan","devbar.add":"Ajouter","devbar.rules":"Règles d’icônes","device_inbox.button":"Appareils","device_inbox.title":"Appareils sur le plan","device_inbox.search":"Rechercher appareils, entités et intégrations…","device_inbox.add_virtual":"Ajouter un appareil virtuel","device_inbox.tab_on_plan":"Sur le plan","device_inbox.tab_available":"Disponibles","device_inbox.tab_hidden":"Masqués","device_inbox.tab_readd":"De nouveau disponibles","device_inbox.only_new":"Nouveaux uniquement","device_inbox.show_entities":"Afficher les entités","device_inbox.show_hidden":"Afficher les masqués sur le plan","device_inbox.show_hidden.help":"Affiche temporairement les marqueurs masqués et désactivés sous forme de fantômes réservés à l’éditeur. La visibilité enregistrée des appareils ne change pas.","device_inbox.show_hidden.help.aria":"Aide : afficher les appareils masqués sur le plan","device_inbox.new":"Nouveau","device_inbox.find":"Trouver sur le plan","device_inbox.edit":"Modifier","device_inbox.hide":"Masquer","device_inbox.show":"Afficher","device_inbox.add":"Ajouter","device_inbox.readd":"Ajouter à nouveau","device_inbox.hide_available":"Masquer de la liste","device_inbox.show_more":"Afficher plus","device_inbox.more_actions":"Plus d'actions","device_inbox.find_hidden_hint":"Activez d'abord « Afficher les masqués sur le plan »","device_inbox.show_disabled":"Activez cette liaison dans Home Assistant avant de l'afficher","device_inbox.empty_on_plan":"Aucun appareil correspondant n'est encore sur le plan.","device_inbox.empty_available":"Aucun appareil disponible à ajouter.","device_inbox.empty_hidden":"Il n'y a aucun appareil masqué.","device_inbox.empty_readd":"Aucun appareil supprimé n'est disponible pour un nouvel ajout.","device_inbox.reason_visible_auto":"Découvert automatiquement","device_inbox.reason_visible_explicit":"Ajouté explicitement","device_inbox.reason_manual_hidden":"Masqué par l'utilisateur","device_inbox.reason_automatic_hidden":"Masqué automatiquement","device_inbox.reason_service_entry":"Entrée de registre de service uniquement","device_inbox.reason_excluded_integration":"Intégration « {integration} » exclue par les filtres de découverte","device_inbox.reason_excluded_domain":"Type d'entité non spatial","device_inbox.reason_grouped_light":"Représenté par un groupe de lumières de la pièce","device_inbox.reason_represented_by_parent":"Représenté par son appareil parent","device_inbox.reason_removed":"Précédemment retiré du plan","device_inbox.reason_available":"Disponible pour ajout au plan","device_inbox.reason_no_bound_room":"La zone HA n'est liée à aucune pièce du plan","device_inbox.status_ha_disabled":"Désactivé dans Home Assistant","device_inbox.status_orphaned":"La liaison n'existe plus dans Home Assistant","device_inbox.status_unverified":"Le registre Home Assistant est temporairement indisponible","device_inbox.saved":"Liste des appareils mise à jour","device_inbox.filters_excluded":"Intégrations exclues","device_inbox.filters_group_lights":"Regrouper les lumières de la pièce en un marqueur","device_inbox.filters_preview_appear":"apparaîtra : {count}","device_inbox.filters_preview_hide":"disparaîtra : {count}","device_inbox.filters_preview_lights":"lumières concernées : {count}","device_inbox.filters_reset":"Rétablir les recommandées","device_inbox.filters_save":"Enregistrer les filtres","device_inbox.filters_search_ph":"Ajouter une intégration…","device_inbox.filters_title":"Filtres de découverte","space.roomcard_section":"La carte de pièce affiche :","space.label_temp":"Température","space.label_hum":"Humidité","space.label_lqi":"Signal Zigbee moyen","space.label_light":"Lumières allumées/éteintes","roomcard.light_on":"Allumé","roomcard.light_off":"Éteint","roomcard.light_partial":"{on} sur {total}","toast.split_pick_inside":"Les points intermédiaires de découpe doivent se trouver à l’intérieur de la pièce","mode.decor":"Éditeur d’arrière-plan","decor.select":"Sélectionner","decor.line":"Ligne","decor.rect":"Rectangle","decor.ellipse":"Ovale","decor.text":"Texte","decor.erase":"Effacer","decor.erase_confirm_title":"Effacer l’objet ?","decor.color":"Couleur","decor.width":"Épaisseur de ligne","decor.line_style":"Style de ligne","decor.line_style_solid":"Plein","decor.line_style_dashed":"Pointillés","decor.fill":"Remplissage","decor.fill_color":"Couleur de remplissage","decor.length":"Longueur","decor.size":"Taille","decor.flip_h":"Retourner horizontalement","decor.flip_v":"Retourner verticalement","decor.angle":"Angle de rotation, °","decor.text_size":"Taille du texte","decor.backdrop_properties":"Propriétés de l’arrière-plan du plan","decor.text_title":"Étiquette de texte","decor.object_title":"Modifier {kind}","decor.text_label":"Texte","decor.live_group":"Insérer une variable HA","decor.live_entity":"Entité","decor.live_entity_ph":"choisir une entité","decor.live_attr":"Valeur","decor.live_attr_ph":"choisir l’état ou un attribut","decor.live_state":"État","decor.backdrop":"Image d’arrière-plan","decor.backdrop_hint":"Faites glisser pour déplacer ; tirez un coin pour redimensionner ; utilisez la poignée supérieure pour faire pivoter. Maj modifie les proportions ou libère l’angle.","decor.backdrop_reset":"Réinitialiser l’image","decor.backdrop_reset_done":"L’image a retrouvé sa position et sa taille d’origine","marker.icon_auto":"Auto : {icon} (selon les règles d’icônes ; choisissez-en une pour remplacer)","marker.icon_pin_auto":"Épingle","mode.plan_tip":"Éditeur de plan — la géométrie du logement : dessiner et diviser/fusionner les pièces, les associer aux zones HA, placer portes, fenêtres et portails, déplacer les cartes de pièces, régler l’échelle","mode.devices_tip":"Éditeur d’appareils — tout ce qui concerne les icônes : faire glisser pour positionner, cliquer pour modifier l’association/l’icône/l’affichage, ajouter des appareils virtuels, règles d’icônes","mode.decor_tip":"Éditeur d’arrière-plan — décoration purement visuelle sous le plan : lignes, rectangles, ovales et étiquettes de texte qui ne réagissent jamais aux clics","space.glow_enabled":"Halo des sources lumineuses","gs.glow_group":"Halo des sources lumineuses","gs.glow_base":"Obscurité de la maison","gs.glow_light":"Couleur / intensité de lumière par défaut","gs.wall_group":"Murs","gs.wall_fill":"Remplissage des murs","gs.glow_radius":"Rayon du halo","gs.glow_radius.help":"Définit le rayon général du halo en mètres ou en pieds ; le rayon propre à un appareil remplace cette valeur.","gs.glow_radius.help.aria":"Aide : rayon général du halo","gs.unit_m":"m","gs.unit_ft":"pi","marker.controls_label":"Contrôle d’autres sources lumineuses","marker.controls.help":"Avec l’action « Basculer l’état », les sources répertoriées basculent avec ce marqueur. Leur halo reste sur leurs propres marqueurs et ce lien ne transforme pas à lui seul le marqueur de contrôle en source lumineuse.","marker.controls.help.aria":"Aide : contrôler d’autres sources lumineuses","marker.controls_filter":"Rechercher des lumières et interrupteurs…","info.controls":"Contrôle","marker.glow_radius_label":"Rayon du halo","marker.glow_radius.help":"Définit le rayon du halo en mètres ou en pieds ; une valeur vide utilise le rayon des paramètres généraux.","marker.glow_radius.help.aria":"Aide : rayon du halo","markup.wallthick":"Épaisseur","markup.select":"Sélectionner","title.markup_wallthick":"Épaisseur — cliquez sur un mur pour définir son épaisseur de 0 à 100 cm.","markup.hint_wallthick":"cliquez sur un mur · Échap ferme sans appliquer","wallthick.field":"Épaisseur","wallthick.unit_cm":"cm","wallthick.unit_in":"po","wallthick.apply_room":"Appliquer à tous les murs de cette pièce","markup.draw_wall_title":"Épaisseur de chaque nouveau segment de mur (0–100 cm). Les murs partagés conservent la valeur existante.","room.queue_progress":"Pièce {current} sur {total}","toast.wall_rooms_saved":"Pièces créées : {n}","toast.wall_chain_saved":"Chaîne de murs enregistrée","toast.wallthick_pick":"Cliquez sur un mur","toast.wallthick_set":"Épaisseur du mur définie","toast.wallthick_cleared":"Épaisseur du mur supprimée","toast.physical_range":"Saisissez une valeur comprise entre {min} et {max} {unit}","toast.zero_wall_opening_conflict":"Supprimez d’abord l’ouverture sur ce segment de mur.","toast.zero_wall_ambiguous":"Le segment de mur est ambigu. Simplifiez ou ajustez la jonction.","toast.zero_wall_migration_blocked":"L’espace n’a pas été converti : {reason}. Aucune donnée n’a été modifiée.","toast.physical_angle":"Saisissez un angle de rotation compris entre 0° inclus et 90° exclu","toast.physical_limit":"L’espace a atteint la limite pour ce type de géométrie","toast.geometry_unsafe":"Modification annulée : la géométrie des murs n’a pas pu être construite en toute sécurité.","junction.limit_angle":"L'angle entre les murs est trop aigu : {actual}°, minimum {limit}°.","junction.limit_valence":"Trop de murs se rejoignent en un nœud : {actual}, maximum {limit}.","junction.limit_length":"Le segment de mur est trop court : {actual} cm, minimum {limit} cm.","junction.limit_distance":"Les murs et les nœuds sont trop proches : {actual} cm, minimum {limit} cm.","junction.limit_clearance":"Il ne reste plus d'intérieur de pièce : {actual} cm², minimum {limit} cm².","junction.limit_check_failed":"La vérification des jonctions n'a pas pu s'exécuter — la modification n'a pas été enregistrée","toast.wall_model_migration_blocked":"Le modèle de murs n’a pas pu être mis à jour : {reason}. Le plan n’a pas été modifié. Lancez « Optimiser les plans » ; si l’erreur se reproduit, corrigez la géométrie de mur conflictuelle.","toast.wall_model_client_outdated":"Mettez à jour la carte et rechargez la page avant de modifier le plan.","wall_model.reason.invalid-room":"contour de pièce invalide","wall_model.reason.zero-length":"segment de mur de longueur nulle","wall_model.reason.third-owner":"mur partagé par plus de deux pièces","wall_model.reason.duplicate-id":"identifiants de mur en conflit","wall_model.reason.thickness-conflict":"valeurs d’épaisseur de mur en conflit","wall_model.reason.opening-host":"l’ouverture ne peut pas être attribuée à un seul mur","toast.delete_room_pick":"Cliquez à l’intérieur de la pièce que vous souhaitez supprimer","toast.plan_snap_ambiguous":"Zoomez pour choisir le nœud du mur","toast.wall_repair_ambiguous":"Le contour de la pièce possède plusieurs connexions possibles. Zoomez et reliez-le explicitement.","toast.wall_repair_too_large":"L’écart dépasse 2 cm. Reliez les murs avant de créer la pièce.","toast.wall_repair_changed":"La géométrie des murs a changé. Essayez de créer de nouveau la pièce.","toast.opening_on_zero_wall":"Les ouvertures ne peuvent pas être placées sur un mur d’épaisseur nulle","marker.from_ha_option":"Choisir dans la liste HA","marker.show_entities":"Afficher les entités","marker.show_entities_tip":"Ajoute à la liste non seulement les appareils, mais aussi toutes leurs entités","marker.pick_ph":"Choisir un appareil…","room.open_area":"Ouvrir la zone HA","room.fit_action":"Ajuster la pièce {name}","view.volumetric":"Vue volumétrique","view.flat":"Vue plane","kiosk.title":"Tailles pour cet écran","kiosk.hint":"Enregistrées uniquement sur cet appareil — chaque tablette murale ou TV peut avoir ses propres tailles confortables.","kiosk.icon_scale":"Taille des icônes d’appareils","kiosk.font_scale":"Taille du texte des cartes de pièces","editor.kiosk":"Mode appareil mural (kiosque)","editor.cycle":"Changer automatiquement d’espace toutes les N secondes (kiosque, 0 = désactivé)","room.settings_title":"Paramètres de la pièce","room.settings_section":"Paramètres de la pièce (remplacent ceux de l’espace)","room.fill_label":"Remplissage de CETTE pièce","fill.inherit":"Comme l’espace","room.custom_fill_space":"Couleur de l’espace","room.custom_fill_own":"Couleur de la pièce","room.temp_range_label":"Plage de confort","room.temp_range_min":"Limite basse de température confortable","room.temp_range_max":"Limite haute de température confortable","room.temp_range_reset":"Comme l’espace","room.temp_range.help":"Cette plage s’applique uniquement à cette pièce. Un champ vide hérite de la limite correspondante de l’espace ; si les limites sont inversées, House Plan utilise la plus petite comme limite basse et la plus grande comme limite haute.","room.temp_range.help.aria":"À propos de la plage de confort de la pièce","room.temp_src_label":"Source de température","room.hum_src_label":"Source d’humidité","room.src_average":"Moyenne des capteurs de la pièce (par défaut)","room.src_pick":"Un appareil ou une entité HA spécifique","room.src_ph":"Choisir une source…","toast.room_updated":"Pièce mise à jour","space.card_font":"Taille de police des cartes de pièces (tout l’espace)","room.sizes_section":"Tailles de police","room.name_scale":"Taille du nom de la pièce","room.label_scale":"Taille des mesures","preview.room_name":"Salon","toast.cfg_reload_failed":"Impossible de recharger le plan depuis le serveur : {err}","toast.locale_load_failed":"Impossible de charger le pack de langue. L'anglais est utilisé jusqu'au rechargement de la page.","toast.furniture_art_load_failed":"Impossible de charger les dessins de meubles. Rechargez la page pour les afficher.","room.settings_short":"Paramètres de la pièce","room.unnamed":"Pièce sans nom","marker.use_climate_temp":"Inclure la température de l’appareil dans la pièce","marker.use_climate_temp_tip":"Ajoute la valeur current_temperature d’un climatiseur ou thermostat à la moyenne de la pièce. Configurez séparément le badge de valeur externe ci-dessous.","marker.value_badge_title":"Badge de valeur","marker.value_badge.help":"Affiche une valeur sélectionnée à côté de l’icône. Cela n’affecte pas les mesures de la pièce, la lumière, le halo ni l’action au toucher.","marker.value_badge.help.aria":"Aide : badge de valeur de l’appareil","marker.value_badge_enabled":"Afficher un badge de valeur","marker.value_badge_source":"Valeur","marker.value_badge_source.help":"Choisissez un état précis, un attribut pris en charge ou une valeur dérivée de cet appareil.","marker.value_badge_source.help.aria":"Aide : source du badge de valeur","marker.value_badge_position":"Position","marker.value_badge_position.help":"Le côté choisi reste fixe et ne bascule pas automatiquement au bord du plan.","marker.value_badge_position.help.aria":"Aide : position du badge de valeur","marker.value_badge_right":"À droite","marker.value_badge_bottom":"En dessous","marker.value_badge_left":"À gauche","marker.value_badge_top":"Au-dessus","marker.value_badge_empty":"Cet appareil n’a aucune valeur disponible","marker.value_badge_static":"Une icône statique n’affiche pas de valeurs en direct. Le paramètre est conservé.","marker.value_badge_missing":"Source indisponible","marker.value_badge_missing_hint":"La source enregistrée est actuellement indisponible. Conservez-la, désactivez le badge ou choisissez une autre valeur.","marker.value_badge_duplicate":"La même valeur est déjà affichée dans l’icône.","marker.value_badge_state":"État · {name}","marker.value_badge_marker_state":"État de la source lumineuse · {name}","marker.value_badge_lqi":"Qualité moyenne du signal Zigbee","marker.value_badge_attr_current_temperature":"Température actuelle · {name}","marker.value_badge_attr_temperature":"Température cible · {name}","marker.value_badge_attr_current_humidity":"Humidité actuelle · {name}","marker.value_badge_attr_humidity":"Humidité · {name}","marker.value_badge_attr_current_position":"Position · {name}","marker.value_badge_attr_percentage":"Vitesse · {name}","marker.value_badge_attr_brightness":"Luminosité · {name}","marker.value_badge_attr_volume_level":"Volume · {name}","marker.value_badge_attr_battery_level":"Batterie · {name}","marker.value_badge_attr_fan_speed":"Vitesse du ventilateur · {name}","marker.value_source":"Source de la valeur","marker.value_source.help":"Choisissez la valeur qui remplace l’icône. L’action au toucher ne change pas.","marker.value_source.help.aria":"Aide : source de la valeur dans le marqueur","marker.value_source_auto":"Automatique (comme avant)","marker.value_source_missing_hint":"La source enregistrée est indisponible. Le marqueur affiche — jusqu’à son retour ou jusqu’au choix d’une autre valeur.","marker.light_role_label":"Cet appareil est-il une source lumineuse ?","marker.light_role.help":"« Auto » utilise le rôle déterminé de l’appareil lié, « Toujours » force sa propre source et « Jamais » l’exclut ; les lumières liées ci-dessus restent indépendantes.","marker.light_role.help.aria":"Aide : cet appareil est-il une source lumineuse","marker.light_role_auto_yes":"Auto (source lumineuse)","marker.light_role_auto_no":"Auto (pas une source lumineuse)","marker.light_role_always":"Toujours une source lumineuse","marker.light_role_never":"Jamais une source lumineuse","marker.light_entity_label":"Entité lumineuse principale","marker.light_entity.help":"Pour un appareil composite, choisissez l’entité dont l’état, la couleur et la luminosité représentent cette source sur le plan. Le choix automatique reste compatible avec les anciens plans.","marker.light_entity.help.aria":"Aide : entité lumineuse principale","marker.light_entity_auto":"Automatique ({entity})","marker.light_entity_none":"aucune entité contrôlable","marker.light_entity_missing":"L’entité enregistrée {entity} est indisponible. House Plan utilise temporairement {fallback} ; le choix enregistré sera restauré si elle revient.","marker.toggle_entity_label":"Entité à basculer","marker.toggle_entity.help":"Pour un appareil composite, choisissez précisément la lumière ou l’interrupteur propre à actionner par un toucher. Automatique conserve les règles de cible précédentes et reste indépendant de l’entité lumineuse principale.","marker.toggle_entity.help.aria":"Aide : entité à basculer","marker.toggle_entity_auto":"Automatique ({entity})","marker.toggle_entity_none":"aucune entité propre contrôlable","marker.toggle_entity_missing":"L’entité enregistrée {entity} ne fait plus partie des canaux sélectionnables de ce marqueur. House Plan utilise temporairement {fallback} ; le choix enregistré sera restauré si elle revient.","marker.glow_color_label":"Couleur et luminosité du halo","marker.glow_mode.help":"Utilisez les valeurs en direct de la source, remplacez uniquement sa couleur ou fixez à la fois la couleur et la luminosité. Le minimum est 1 % ; pour désactiver la source, choisissez « Jamais ».","marker.glow_mode.help.aria":"Aide : couleur et luminosité du halo","marker.glow_mode_auto":"Depuis la source","marker.glow_mode_color":"Définir la couleur","marker.glow_mode_fixed":"Définir la couleur et la luminosité","marker.glow_color":"Couleur du halo","marker.glow_brightness":"Luminosité","marker.glow_disabled_never":"Les paramètres du halo sont indisponibles car ce marqueur est explicitement défini comme n’étant pas une source lumineuse.","marker.glow_disabled_auto":"Le mode Auto n’a trouvé aucune source lumineuse spatiale pour ce marqueur.","marker.glow_disabled_no_entity":"Aucune entité Home Assistant contrôlable et active n’est disponible pour cette source spatiale.","marker.glow_passive_hint":"Cette source ne possède aucune donnée Home Assistant propre. Définissez manuellement sa couleur et sa luminosité ; son rayon reste disponible.","marker.control_broken":"La source enregistrée est absente ou n’est plus marquée comme lumière","marker.control_missing_label":"Lumière du plan manquante","marker.control_passive":"source passive","toast.marker_control_cycle":"Ce lien créerait une chaîne circulaire de contrôles de lumière.","toast.marker_binding_required":"Choisissez un appareil Home Assistant avant de lier une autre source lumineuse.","confirm.unlock_title":"Déverrouiller ?","confirm.unlock_body":"House Plan enverra une commande de déverrouillage à cette serrure.","toast.files_migrate_failed":"Les pièces jointes n’ont pas pu être déplacées vers la nouvelle association ; les liens continuent de pointer vers les anciens fichiers : {err}","space.pick_saved":"Déjà importé","space.pick_saved_hint":"Plans stockés sur le serveur, y compris ceux que vous avez précédemment dissociés","space.no_saved":"Aucun plan n’est encore stocké sur le serveur.","space.loading":"Chargement…","space.used_by":"utilisé par : {list}","space.in_use":"Un espace utilise encore ce plan — dissociez-le d’abord","btn.use":"Utiliser","confirm.delete_plan_title":"Supprimer le fichier du plan ?","confirm.delete_plan_body":"Le fichier sera supprimé du serveur. Cette action est irréversible.","toast.plans_list_failed":"Impossible de lister les plans stockés : {err}","toast.plan_delete_failed":"Impossible de supprimer le plan : {err}","marker.hide":"Masquer","marker.hide_tip":"L’appareil disparaîtra du plan après l’enregistrement mais continuera de compter dans le signal de la pièce. Restaurez-le via « Masqués et désactivés » dans l’éditeur d’appareils.","marker.show":"Afficher","marker.show_tip":"L’appareil apparaîtra de nouveau sur le plan après l’enregistrement.","marker.hidden_ghost":"Appareil masqué par l’utilisateur","marker.ha_disabled_device":"L’appareil est désactivé dans Home Assistant et masqué du plan.","marker.ha_disabled_entity":"L’entité est désactivée dans Home Assistant et masquée du plan.","marker.ha_disabled_all_entities":"L’appareil n’a aucune entité Home Assistant active ; il est donc masqué du plan.","marker.ha_registry_limited":"Le registre Home Assistant complet n’est pas accessible à cet utilisateur. L’objet non vérifié ne peut pas être affiché ni utilisé pour le moment.","marker.delete_tip":"Supprimer complètement l’appareil du plan et de tous les agrégats. Vous pourrez l’ajouter de nouveau plus tard.","tap.run":"Exécuter une automatisation/un script/une scène","tap.none":"Ne rien faire","marker.run_target_label":"Élément à exécuter","marker.run_search_ph":"Rechercher : automatisation, script ou scène…","marker.run_target_gone":"Cible {id} introuvable — choisissez-en une autre","marker.tap_confirm":"Demander une confirmation","marker.tap_confirm_tip":"Afficher une boîte de dialogue de confirmation avant l’action — protection contre les appuis accidentels.","marker.toggle_hint_single":"Cible : {name} ({id}).","marker.virtual_light_target":"Lumière virtuelle : {name}.","marker.virtual_light_current":"État manuel : {state} → {effect}.","marker.virtual_light_state_on":"allumé","marker.virtual_light_state_off":"éteint","marker.toggle_hint_group":"Basculera {count} source(s) : {names}.","marker.toggle_hint_current":"Actuellement : {state} → {effect}.","marker.toggle_hint_group_current":"Actuellement allumées : {on} sur {count} → {effect}.","marker.toggle_hint_skipped":"Seront ignorées ({count}) : {targets}.","marker.toggle_effect_turn_on":"sera allumé","marker.toggle_effect_turn_off":"sera éteint","marker.toggle_effect_open":"sera ouvert","marker.toggle_effect_close":"sera fermé","marker.toggle_effect_stop":"sera arrêté","marker.toggle_effect_toggle":"l’état sera basculé","marker.toggle_skip_missing":"introuvable","marker.toggle_skip_ha_disabled":"désactivé dans HA","marker.toggle_skip_unavailable":"indisponible","marker.toggle_skip_unsupported":"basculement non pris en charge","marker.toggle_skip_secure":"bloqué pour des raisons de sécurité","marker.toggle_none_no_binding":"Cet appareil n’a aucune association ; il n’y a donc aucun état à basculer. Un toucher ne fera rien.","marker.toggle_none_no_actionable_entity":"Cet appareil n’a aucun état pouvant être basculé. Un toucher ne fera rien.","marker.toggle_none_configured_targets_missing":"Les cibles configurées sont indisponibles. L’entité propre de l’appareil ne leur sera pas substituée.","marker.toggle_none_ha_disabled":"La cible est désactivée dans Home Assistant et ne peut pas être utilisée sur le plan.","marker.toggle_none_unavailable":"La cible est actuellement indisponible. Un toucher ne fera rien.","marker.toggle_none_unsupported":"Home Assistant n’expose aucune opération de basculement sûre pour cette entité. Un toucher ne fera rien.","marker.toggle_none_secure":"Le basculement des serrures, alarmes et portails sécurisés depuis le plan est bloqué pour des raisons de sécurité.","run.automation":"automatisation","run.script":"script","run.scene":"scène","confirm.tap_run":"Exécuter « {name} » ?","confirm.tap_toggle":"Basculer « {name} » ?","confirm.current_state":"État actuel : {state}","confirm.expected_state":"Après basculement : {state}","confirm.group_current":"{on} allumé(s) sur {total}","confirm.group_all_on":"tout est allumé","confirm.group_all_off":"tout est éteint","confirm.unavailable_targets":"Indisponibles : {count}","confirm.expected_by_ha":"Home Assistant déterminera l’état","confirm.state_on":"Allumé","confirm.state_off":"Éteint","confirm.state_open":"Ouvert","confirm.state_closed":"Fermé","confirm.state_opening":"Ouverture en cours","confirm.state_closing":"Fermeture en cours","confirm.state_stopped":"Arrêté","confirm.state_unknown":"Inconnu","toast.run_started":"Démarré : {name}","toast.run_target_missing":"Cible d’exécution introuvable — vérifiez les paramètres de l’appareil","toast.run_target_required":"Choisissez une automatisation, un script ou une scène","toast.tap_target_changed":"La cible de l’action a changé. Réessayez.","toast.virtual_light_toggle_failed":"Impossible de basculer la lumière virtuelle : {err}","toast.value_badge_source_required":"Choisissez une valeur pour le badge","btn.run":"Exécuter","vac.section":"Robot aspirateur : position en direct","vac.autocal":"Configurer automatiquement","vac.live":"Position en direct sur le plan","vac.trail":"Afficher le trajet du robot","vac.autocal_no_rooms":"L’intégration ne fournit aucune liste de pièces — ouvrez « Ajuster manuellement »","vac.route_warn_unmapped":"Le robot nettoie une carte qui n'est assignée à aucun étage","vac.route_warn_needs_calibration":"La carte est assignée à un étage mais n'est pas calibrée","vac.route_warn_ambiguous":"Deux cartes sont indiscernables — aucun étage choisi","vac.route_warn_missing_space":"L'espace de cette carte a été supprimé","vac.autocal_no_match":"Les noms de pièces ne correspondent pas (il en faut ≥3 en commun) — ouvrez « Ajuster manuellement »","vac.autocal_done":"Terminé : association via {rooms} pièces. Lancez un nettoyage et vérifiez","vac.cal_need_pos":"Le robot ne transmet pas de coordonnées — lancez un nettoyage puis mettez-le en pause","vac.cal_done":"Calibration enregistrée. Lancez un nettoyage et vérifiez","vac.cal_cancelled":"Calibration annulée","vac.fit":"Ajuster manuellement","vac.fit_hint":"Faites glisser la carte du robot pour la positionner, étirez-la par les coins","vac.fit_rotate":"Rotation de 90°","vac.fit_mirror":"Miroir","vac.trail_never":"Jamais","vac.trail_cleaning":"Pendant le nettoyage","vac.trail_always":"Toujours","gs.bg_group":"Arrière-plan de la scène","gs.bg_color":"Arrière-plan autour du plan","gs.bg_default":"Valeur par défaut du thème","gs.bg_theme":"valeur par défaut du thème","gs.bg_mode":"Arrière-plan du plan","gs.bg_mode.help":"« Suit le soleil » utilise sun.sun ou, à défaut, l’heure locale du navigateur ; « Couleur statique » affiche toujours la couleur choisie.","gs.bg_mode.help.aria":"Aide : arrière-plan général du plan","gs.bg_static":"Couleur statique","gs.bg_daynight":"Suit le soleil","gs.sun_group":"Soleil","gs.sun_missing":"L’entité sun.sun est introuvable — l’arrière-plan suit votre heure locale ; les rayons de soleil par les fenêtres sont indisponibles.","gs.north":"Nord sur le plan","gs.north.help":"L’angle se mesure dans le sens horaire depuis la verticale supérieure du plan ; le nord sert aux rayons des fenêtres, pas à l’arrière-plan « Suit le soleil ».","gs.north.help.aria":"Aide : direction générale du nord","gs.north_ph":"non défini","gs.north_clear":"Effacer","gs.north_letter":"N","gs.sun_rays":"Lumière du soleil à travers les fenêtres","gs.about_version":"Houseplan Card v{v}","gs.about_github":"GitHub · documentation et problèmes","gs.about_telegram":"Discussion Telegram","support.title":"Aide et commentaires","space.bg_color":"Arrière-plan autour du plan","space.bg_inherit":"Hériter des paramètres généraux","space.bg_inherited":"hérite des paramètres généraux","space.bg_mode":"Arrière-plan du plan","space.bg_mode.help":"Héritez de l’arrière-plan général ou remplacez-le pour cet espace par une couleur statique ou le mode « Suit le soleil ».","space.bg_mode.help.aria":"Aide : arrière-plan de l’espace","space.north":"Nord sur le plan (remplacement)","space.north.help":"Remplace le nord général pour cet espace ; l’angle se mesure dans le sens horaire depuis la verticale supérieure du plan et sert aux rayons des fenêtres.","space.north.help.aria":"Aide : nord de cet espace","space.north_inherited":"hérité : {v}","space.sun_rays":"Lumière du soleil à travers les fenêtres","space.sun_inherit":"Hériter des paramètres généraux","space.sun_on":"Activé","space.sun_off":"Désactivé","canvas.far_objects":"{n} objet(s) éloigné(s) du plan","canvas.show_far":"Afficher","canvas.home_tip":"Le plan est là-bas — cliquez pour l’ajuster à l’écran","gs.grid_group":"Maintenance du plan","gs.grid_hint":"Met à jour les modèles de données, aligne les éléments du plan sur la grille et fusionne les fragments de murs redondants. Un rapport précis est affiché avant tout enregistrement.","gs.align_all":"Optimiser les plans","gs.align_title":"Optimiser les plans","gs.align_none":"Tous les plans utilisent déjà le modèle de données optimisé actuel.","gs.optimize_no_automatic_changes":"Aucune modification automatique n’est à appliquer. Vérifiez les éléments ci-dessous.","gs.align_count":"{n} élément(s) sur {total} seront déplacés, de {cm} cm au maximum.","gs.align_where":"Le plus grand déplacement se trouve dans « {s} ».","gs.align_turned":"Ouvertures dont l’angle est corrigé : {n}.","gs.align_preflight_failed":"Impossible de vérifier en toute sécurité la géométrie des espaces suivants : {spaces}{more}.","gs.align_preflight_hint":"Les plans n’ont pas été modifiés. Copiez les diagnostics avec le bouton ci-dessous et joignez-les au rapport de bug avec un export de l’espace.","gs.preflight_reason_prepare-exception":"Impossible de préparer la géométrie de l’espace (exception lors de la construction du modèle)","gs.preflight_reason_wall-null":"Le corps du mur n’a pas pu être construit (l’union a renvoyé un résultat vide)","gs.preflight_reason_wall-degraded-extra":"Le corps du mur s’est dégradé avec une géométrie supplémentaire","gs.preflight_reason_wall-failed-core":"Le noyau du corps du mur n’a pas pu être assemblé","gs.preflight_reason_wall-exception":"La construction du mur a déclenché une exception","gs.preflight_reason_floor-null":"Le contour du sol n’a pas pu être construit","gs.preflight_reason_floor-exception":"La construction du sol a déclenché une exception","gs.preflight_copy":"Copier les diagnostics","gs.preflight_copied":"Diagnostics copiés","gs.preflight_update_hint":"Les versions de la carte et de l’intégration diffèrent — mettez House Plan à jour puis réessayez.","gs.align_preflight_space":"Espace {n}","gs.align_preflight_more":", et {n} de plus","gs.optimize_changes":"Migrations de modèle : {m} ; espaces mis à jour : {c} ; valeurs de coordonnées parasites supprimées : {p} ; fragments de murs réels fusionnés : {w} ; fragments de murs d’épaisseur nulle fusionnés : {s} ; murs indépendants : {i}.","gs.zero_walls_migrated":"Portions de murs virtuels converties : {n}.","gs.wall_segments_migrated":"Segments de murs stabilisés : {n}.","gs.room_drafts_migrated":"Contours inachevés convertis en murs ordinaires : {drafts} ; segments : {segments}.","gs.optimize_lattice_summary":"Valeurs de coordonnées parasites normalisées : {n} ; déplacement maximal : {cm} cm.","gs.optimize_lattice_space":"{space} : valeurs de coordonnées normalisées : {n} ; valeurs hors grille laissées inchangées : {far}.","gs.optimize_coincident_partitions":"Sections de murs indépendants masquées absorbées dans les murs des pièces : {n}.","gs.optimize_openings_rehosted":"Ouvertures rattachées aux murs des pièces : {n}.","gs.optimize_walls_straightened":"Murs redressés : {n} ; déplacement maximal : {cm} cm.","gs.optimize_walls_straightened_where":"Plus grande correction de mur : {s}.","gs.optimize_walls_straighten_skipped":"Murs proches d’un axe laissés inchangés car ils ne pouvaient pas être réparés en toute sécurité : {n}.","gs.optimize_glow_migration":"Ancien mode Glow : {spaces} espaces → aucun remplissage de données + Glow indépendant ; {rooms} pièces → remplissage de données hérité + Glow indépendant.","gs.optimize_references":"Références réparées : espaces — {spaces} ; pièces — {rooms} ; positions — {positions} ; appareils dissociés des espaces manquants — {detached}.","gs.optimize_reference_more":", et {n} de plus","gs.optimize_orphans_removed":"Enregistrements oubliés supprimés : {total} — étiquettes de pièces : {rooms} ; appareils : {devices} ; marqueurs de groupe : {groups}. Ils appartenaient à des espaces supprimés précédemment.","gs.optimize_live_positions":"Anciennes positions dans des espaces supprimés appartenant à des objets existants : {n}{names}. Elles seront conservées.","gs.optimize_live_positions_remove":"Anciennes positions dans des espaces supprimés appartenant à des objets existants : {n}{names}. Elles sont sélectionnées pour suppression.","gs.optimize_live_names":" : {names}{more}","gs.optimize_live_remove":"Supprimer les anciennes positions","gs.optimize_live_keep":"Conserver les anciennes positions","gs.optimize_live_selected":"Les anciennes positions seront supprimées après l’application de l’optimisation.","gs.optimize_unverified":"Impossible de vérifier en toute sécurité les positions : {n}. Elles ont été laissées inchangées.","gs.optimize_registry_limited":"Un accès administrateur complet aux registres Home Assistant est requis pour une vérification sûre.","gs.optimize_vacuum_warning":"Associations de pièces d’aspirateur nécessitant encore une vérification : {n}.","gs.optimize_details":"Détails","gs.optimize_details_more":"Et {n} enregistrement(s) de plus.","gs.optimize_detail_removed":"sera supprimé","gs.optimize_detail_live":"sera conservé","gs.optimize_detail_unverified":"non vérifié","gs.optimize_detail_room_label":"étiquette de pièce","gs.optimize_detail_device":"appareil","gs.optimize_detail_group":"marqueur de groupe","gs.optimize_detail_unknown":"propriétaire inconnu","gs.optimize_detail_item":"{status} : {kind} {id} ; ancien espace {space}","gs.align_warn":"Les éléments volontairement placés entre les nœuds de la grille seront déplacés. Une seule annulation est disponible après l’opération, uniquement jusqu’à la prochaine modification du plan.","gs.align_run":"Optimiser","gs.align_done":"Plans optimisés : {n} élément(s) déplacé(s), {m} enregistrement(s) maintenu(s), {r} référence(s) réparée(s)","gs.optimize_undo":"Annuler la dernière optimisation","gs.optimize_undone":"La dernière optimisation a été annulée","decor.furniture":"Mobilier","decor.image":"Image","decor.image_title":"Images personnalisées","decor.image_upload":"Importer une image","decor.image_replace":"Remplacer l’image","decor.image_uploading":"Importation…","decor.image_asset":"Fichier image","decor.image_pick_hint":"Importez une image ou choisissez-en une existante.","decor.image_place_hint":"Cliquez sur le plan pour placer l’image.","decor.image_none":"Aucune image importée pour le moment.","decor.image_unavailable":"Image indisponible","decor.image_used":"Utilisée dans {n} objets","decor.image_upload_failed":"Impossible d’importer l’image : {err}","decor.image_error_capacity":"Le stockage des images personnalisées est plein.","decor.image_in_use":"Supprimez toutes les copies placées avant ce fichier.","decor.image_delete_title":"Supprimer le fichier image ?","decor.image_delete_message":"Supprimer « {name} » de House Plan ? Cette action est irréversible.","furn.title":"Bibliothèque de mobilier","furn.symbol":"Symbole","furn.group_furniture":"Mobilier","furn.group_appliance":"Électroménager","furn.group_sanitary":"Sanitaires","furn.group_other":"Autre","furn.width":"Largeur","furn.depth":"Profondeur","furn.back_to_categories":"Toutes les catégories","furn.pick_hint":"Choisissez un symbole, puis cliquez sur le plan.","furn.place_hint":"Cliquez sur le plan — le meuble se place contre le mur le plus proche. Maj permet un placement libre.","furn.cat_air_conditioner":"Climatiseurs","furn.cat_armchair":"Fauteuils","furn.cat_bathtub":"Baignoires","furn.cat_bed":"Lits","furn.cat_bidet":"Bidets","furn.cat_boiler":"Chauffe-eau","furn.cat_chair":"Chaises","furn.cat_coffee_table":"Tables basses","furn.cat_cooktop":"Plaques de cuisson","furn.cat_dining_table":"Tables à manger","furn.cat_dishwasher":"Lave-vaisselle","furn.cat_dryer":"Sèche-linge","furn.cat_fireplace":"Cheminées","furn.cat_fridge":"Réfrigérateurs","furn.cat_kitchen_cabinet":"Meubles de cuisine","furn.cat_kitchen_sink":"Éviers de cuisine","furn.cat_nightstand":"Meubles","furn.cat_plant":"Plantes","furn.cat_rug":"Tapis","furn.cat_shelving":"Étagères","furn.cat_shower":"Douches","furn.cat_sink":"Lavabos","furn.cat_sofa":"Canapés","furn.cat_stairs":"Escaliers","furn.cat_toilet":"Toilettes","furn.cat_tv":"Téléviseurs","furn.cat_wardrobe":"Armoires","furn.cat_washer":"Lave-linge","furn.cat_work_table":"Bureaux","furn.sym_sofa":"Canapé","furn.sym_sofa_three_seat":"Canapé trois places","furn.sym_sofa_corner_right":"Canapé d'angle droit","furn.sym_armchair":"Fauteuil","furn.sym_armchair_office":"Chaise de bureau","furn.sym_coffee_table":"Table basse","furn.sym_coffee_table_round":"Table basse ronde","furn.sym_coffee_table_oval":"Table basse ovale","furn.sym_coffee_table_rounded":"Table basse arrondie","furn.sym_table_dining":"Table à manger","furn.sym_table_round":"Table ronde","furn.sym_table_dining_oval":"Table à manger ovale","furn.sym_table_dining_rounded":"Table à manger arrondie","furn.sym_chair":"Chaise","furn.sym_chair_bar":"Tabouret de bar","furn.sym_desk":"Bureau","furn.sym_desk_corner":"Bureau d'angle","furn.sym_bed_double":"Lit double","furn.sym_bed_single":"Lit simple","furn.sym_nightstand":"Table de chevet","furn.sym_cabinet_tv":"Meuble TV","furn.sym_cabinet_shoe":"Meuble à chaussures","furn.sym_cabinet_sink":"Meuble sous lavabo","furn.sym_wardrobe":"Armoire","furn.sym_bookshelf":"Bibliothèque","furn.sym_wall_unit":"Élément mural","furn.sym_kitchen_floor":"Module de cuisine bas","furn.sym_kitchen_floor_corner":"Module de cuisine bas d'angle","furn.sym_kitchen_wall":"Module de cuisine haut","furn.sym_kitchen_wall_corner":"Module de cuisine haut d'angle","furn.sym_shelf_floor":"Étagère au sol","furn.sym_shelf_wall":"Étagère murale","furn.sym_fridge":"Réfrigérateur","furn.sym_stove":"Cuisinière","furn.sym_cooktop_two":"Plaque à deux feux","furn.sym_dishwasher":"Lave-vaisselle","furn.sym_washer":"Lave-linge","furn.sym_dryer":"Sèche-linge","furn.sym_tv":"Téléviseur","furn.sym_tv_wall":"Téléviseur mural","furn.sym_ac":"Climatiseur","furn.sym_water_heater":"Chauffe-eau","furn.sym_toilet":"Toilettes","furn.sym_toilet_built_in":"Toilettes suspendues","furn.sym_bathtub":"Baignoire","furn.sym_bathtub_corner":"Baignoire d'angle","furn.sym_shower":"Douche","furn.sym_sink":"Lavabo","furn.sym_kitchen_sink":"Évier de cuisine","furn.sym_kitchen_sink_double":"Évier de cuisine double","furn.sym_bidet":"Bidet","furn.sym_bidet_built_in":"Bidet suspendu","furn.sym_stairs":"Escalier","furn.sym_fireplace":"Cheminée","furn.sym_plant":"Plante","furn.sym_rug":"Tapis","common.yes":"Oui","common.no":"Non","vac.diag_source":"Source","vac.diag_platform":"Intégration","vac.diag_status":"État","vac.diag_position":"Position","vac.diag_rooms":"Pièces","vac.diag_rooms_value":"{total} · {matched} noms correspondent · {readiness}","vac.autocal_ready":"calibration automatique disponible","vac.autocal_not_ready":"3 noms correspondants requis","vac.diag_path":"Chemin de l’intégration","vac.diag_map":"ID de carte","vac.source_none":"non sélectionné","vac.source_status_ok":"Prêt","vac.source_status_missing":"Manquant","vac.source_status_disabled":"Désactivé dans Home Assistant","vac.source_status_unavailable":"Indisponible","vac.source_status_unverified":"Impossible à vérifier avec les autorisations actuelles","vac.source_status_unsupported":"Aucune donnée de position","vac.source_status_none":"Aucune source","vac.source_banner_missing":"La source enregistrée n’existe plus. Elle n’a pas été remplacée automatiquement ; choisissez une autre source ou restaurez-la dans Home Assistant.","vac.source_banner_disabled":"La source enregistrée est désactivée dans Home Assistant. Activez-la ou choisissez une autre source.","vac.source_banner_unverified":"Les autorisations Home Assistant actuelles ne permettent pas de vérifier cette source enregistrée. Elle reste épinglée et ne sera pas remplacée automatiquement.","vac.choose_source":"Choisir la source","vac.source_auto":"Automatique","vac.source_auto_hint":"Utiliser une entité compatible de cet appareil","vac.all_cameras":"Toutes les caméras","vac.all_cameras_warn":"Une caméra peut ne pas fournir de données du robot. Choisissez-en une uniquement s’il s’agit de la carte de votre aspirateur.","vac.all_cameras_empty":"Aucune autre entité caméra trouvée.","vac.platform_unknown":"intégration inconnue","vac.cap_position":"position","vac.cap_rooms_short":"pièces","vac.cap_path":"trajet","vac.cap_map":"ID de carte","vac.cap_none":"aucune donnée de robot détectée","vac.xcme_hint":"Activez ces attributs Xiaomi Cloud Map Extractor :","vac.documentation":"Documentation","vac.residual_title":"Vérifier la calibration automatique","vac.residual_message":"Les pièces correspondantes présentent un écart maximal de {error}. Appliquez cette calibration approximative, affinez-la manuellement ou annulez sans modifier la configuration enregistrée.","vac.apply_proposal":"Appliquer","gs.backup_group":"Sauvegarde et transfert","gs.backup_hint":"Téléchargez une sauvegarde JSON portable ou prévisualisez et importez une sauvegarde créée par House Plan.","backup.export_open":"Exporter","backup.import_open":"Importer","backup.export_title":"Exporter House Plan","backup.import_title":"Importer House Plan","backup.export_hint":"Choisissez si la sauvegarde doit contenir toute la configuration House Plan ou uniquement l’espace actuel.","backup.full":"Sauvegarde complète","backup.current_space":"Espace actuel","backup.current_space_title":"Espace actuel : {title}","backup.no_current_space":"Aucun espace actuel","backup.plan_only":"Plan uniquement","backup.plan_only_hint":"Conserver les pièces, murs, ouvertures, décorations et positions des étiquettes de pièces sans les appareils ni les associations Home Assistant.","backup.plan_only_preview":"Ce fichier contient uniquement le plan","backup.privacy_warning":"L’archive conserve les noms, identifiants Home Assistant et coordonnées exactes. Les plans internes et pièces jointes sont référencés, pas intégrés ; les états d’exécution et trajets d’aspirateur ne sont pas inclus.","backup.download":"Télécharger le JSON","backup.export_done":"Sauvegarde téléchargée","backup.reading":"Vérification de la sauvegarde…","backup.revalidated":"Le plan a changé depuis cet aperçu. Le résumé a été actualisé ; vérifiez-le et confirmez de nouveau.","backup.error.support_invalid_message":"Vérifiez le message d’assistance et réessayez.","backup.error.support_package_too_large":"Le paquet d’assistance anonymisé dépasse la limite de 8 Mio.","backup.error.support_preview_expired":"L’aperçu de la pièce jointe d’assistance a expiré ou n’est plus disponible.","backup.error.support_rate_limited":"Trop de rapports ou d’aperçus d’assistance ont été demandés. Réessayez plus tard.","backup.error.support_rejected":"Le rapport n’a pas passé la validation du service d’assistance.","backup.error.support_unavailable":"Le service d’assistance privé est temporairement indisponible.","backup.error.unauthorized":"Vous n’avez pas l’autorisation d’exporter ou d’importer ce plan.","backup.error.not_ready":"House Plan n’est pas encore prêt. Réessayez dans un instant.","backup.error.too_large":"La sauvegarde dépasse la limite de 8 Mio.","backup.error.invalid_json":"Le fichier sélectionné n’est pas un JSON valide.","backup.error.invalid_format":"Le fichier sélectionné n’est pas une sauvegarde House Plan.","backup.error.invalid_image":"L’image est endommagée ou ne correspond pas à son format.","backup.error.unsupported_export_version":"Ce format de sauvegarde n’est pas pris en charge par la version installée.","backup.error.unsupported_image":"Utilisez une image PNG, JPEG, WebP ou SVG prise en charge.","backup.error.future_model":"La sauvegarde a été créée avec un modèle de données House Plan plus récent.","backup.error.invalid_config":"La sauvegarde contient une configuration House Plan invalide.","backup.error.wall_model_migration_blocked":"Le modèle de murs de la sauvegarde n’a pas pu être mis à niveau en toute sécurité. Optimisez d’abord le plan source, puis exportez-le de nouveau.","backup.error.invalid_layout":"La sauvegarde contient des positions d’objets invalides.","backup.error.invalid_content":"La sauvegarde contient des références de contenu invalides ou incohérentes.","backup.error.space_not_found":"L’espace sélectionné n’existe plus.","backup.error.capacity_exceeded":"L’ajout de cette sauvegarde dépasserait les limites du plan.","backup.error.preview_expired":"L’aperçu a expiré. Sélectionnez de nouveau le fichier de sauvegarde.","backup.error.preview_owner_mismatch":"Cet aperçu appartient à un autre utilisateur Home Assistant.","backup.error.conflict":"Le plan a changé depuis l’aperçu. Vérifiez le résumé actualisé.","backup.error.content_confirmation_required":"Confirmez que le contenu local indisponible peut être dissocié.","backup.error.commit_failed":"La sauvegarde n’a pas pu être appliquée en toute sécurité. Le plan précédent a été restauré ou est en attente de récupération.","backup.error.missing_plan":"Un fichier de plan référencé a disparu depuis l’aperçu. Vérifiez de nouveau la sauvegarde.","backup.error.missing_content":"Une pièce jointe locale référencée a disparu depuis l’aperçu. Vérifiez de nouveau la sauvegarde.","backup.error.marker_control_missing":"Une lumière liée au plan est absente de la sauvegarde.","backup.error.marker_control_not_light":"Une cible liée au plan n’est plus marquée comme source lumineuse.","backup.error.marker_control_self":"Une source lumineuse ne peut pas se contrôler elle-même.","backup.error.marker_control_cycle":"La sauvegarde contient une chaîne circulaire de contrôles de lumière.","backup.error.duplicate_marker_control":"La sauvegarde contient un lien de lumière du plan en doublon.","backup.error.no_backup":"Aucun instantané d’importation ou d’optimisation n’est disponible à restaurer.","backup.error.in_use":"L'élément est encore utilisé","backup.error.invalid_data":"La requête contient des données invalides","backup.error.invalid_light_entity":"La lumière principale doit être une entité light.* ou switch.*","backup.error.invalid_marker_control":"Référence de contrôle de marqueur invalide","backup.error.invalid_name":"Le nom est invalide","backup.error.invalid_partition_opening_host":"L'ouverture doit conserver sa cloison porteuse","backup.error.invalid_partition_opening_jamb_margin":"L'ouverture ne laisse aucun jambage physique au bout du mur","backup.error.invalid_passage_fields":"Un passage ouvert ne peut pas porter de réglages de porte","backup.error.invalid_space_id":"Espace inconnu","backup.error.invalid_toggle_entity":"L'entité de bascule doit être light.* ou switch.*","backup.error.invalid_value_badge":"Réglages de badge de valeur invalides","backup.error.invalid_value_badge_attribute":"Attribut de badge de valeur invalide","backup.error.invalid_value_badge_position":"Position de badge de valeur invalide","backup.error.invalid_value_badge_source":"Source de badge de valeur invalide","backup.error.invalid_vacuum_map_route":"Vérifiez l'affectation des cartes du robot aux espaces.","backup.error.invalid_value_source":"Source de valeur invalide","backup.error.invalid_value_source_attribute":"Attribut de source de valeur invalide","backup.error.io_error":"Une opération de fichier a échoué sur le serveur","backup.error.not_toggleable":"Cet appareil ne peut pas être basculé","backup.error.nothing_to_repair":"Rien à réparer","backup.error.space_in_use":"L'espace est encore référencé","backup.error.value_badge_source_required":"Le badge de valeur nécessite une source","backup.error.wall_model_client_outdated":"Le plan a été mis à jour ailleurs — rechargez la page","backup.same_source":"Créée sur cette instance Home Assistant","backup.foreign_source":"Créée sur une autre instance Home Assistant","backup.created":"Créée : {value}","backup.versions":"Carte {card} ; intégration {integration} ; modèle de données {model}","backup.count_spaces":"Espaces : {n}","backup.count_rooms":"Pièces : {n}","backup.count_walls":"Murs : {n}","backup.count_openings":"Ouvertures : {n}","backup.count_decor":"Objets décoratifs : {n}","backup.count_markers":"Appareils : {n}","backup.count_layout":"Positions : {n}","backup.bindings":"Associations — appareils : {device}, entités : {entity}, virtuels : {virtual} ; positions sans espace : {legacy}","backup.binding_status":"État des cibles — actives : {active}, désactivées : {disabled}, manquantes : {missing}","backup.missing_areas":"Zones absentes sur la cible : {areas}","backup.dropped_marker_links":"Liens de lumières du plan hors de cet espace transféré omis : {n}.","backup.room_drafts_migrated":"Anciens contours inachevés convertis en murs ordinaires : {drafts} ; segments : {segments}.","backup.repaired_target_refs":"Références existantes restaurées par cet import d’espace : {n}.","backup.preserved_unresolved_refs":"Références qui n’ont pas pu être restaurées sans ambiguïté conservées : {n}.","backup.preserved_unresolved_hint":"Aucune donnée n’a été devinée ni supprimée. Après l’importation, lancez « Optimiser les plans » pour examiner les références restantes.","backup.import_details":"Détails des références d’importation","backup.import_detail.incoming_remapped":"Références mises à jour dans la copie importée : {n}","backup.import_detail.target_repaired":"Références existantes restaurées : {n}","backup.import_detail.preserved_unresolved":"Références non résolues conservées : {n}","backup.import_detail.collisions":"Conflits de destination conservés en toute sécurité : {n}","backup.import_detail.dropped_links":"Liens entrants omis selon les règles de transfert : {n}","backup.import_detail.bounded_lineages":"Identifiants trop imbriqués maintenus dans les limites : {n}","backup.replace_warning":"Cela remplace la configuration et la disposition actuelles. Les fichiers importés ne sont jamais supprimés. Une seule annulation reste disponible jusqu’à la prochaine modification du plan.","backup.foreign_bookkeeping":"Les données de suivi des appareils connus/nouveaux propres à l’instance ne seront pas importées.","backup.final_name":"Nom du nouvel espace","backup.target_settings":"Les paramètres généraux de l’instance cible restent inchangés.","backup.duplicates":"Associations déjà présentes : {n}","backup.skip":"Ignorer les appareils en doublon","backup.virtual_copy":"Ajouter des copies virtuelles statiques sûres","backup.content":"Contenu référencé","backup.decor_images_summary":"Images personnalisées : {objects} objets, {assets} fichiers ; fichiers absents : {missing}.","backup.content_available":"disponible localement","backup.content_external":"lien externe","backup.content_detach_required":"sera dissocié","backup.confirm_detach":"Je comprends que les plans internes et pièces jointes indisponibles seront dissociés de la configuration importée.","backup.confirm_missing_images":"Je comprends que les images personnalisées absentes resteront des espaces réservés réparables et que les autres fichiers locaux indisponibles seront dissociés.","backup.replace":"Remplacer","backup.add":"Ajouter un espace","backup.space_done":"Espace importé : {rooms} pièces, {markers} appareils, {refs} références existantes restaurées","backup.full_done":"Sauvegarde restaurée : {spaces} espaces, {rooms} pièces, {markers} appareils","backup.undo_import":"Annuler la dernière importation complète","backup.import_undone":"Importation complète annulée","backdrop.large_title":"Grande image","backdrop.large_body":"Cette image fait {w}×{h} (fichier de {fileMb} Mo) et nécessite environ {decodedMb} Mo de mémoire pour s'afficher. Sur tablette, cela peut faire planter la page.","backdrop.unknown_body":"Les dimensions de l'image n'ont pas pu être lues — le fichier est peut-être endommagé. Continuer peut faire planter la page sur tablette.","backdrop.reduced_dimensions":"Copie réduite : {w}×{h} px.","backdrop.use_downscaled":"Téléverser une copie réduite","backdrop.reducing":"Réduction…","backdrop.keep_original":"Conserver l'original","backdrop.too_large_title":"Image trop grande","backdrop.too_large_body":"Cette image dépasse ce que les navigateurs peuvent afficher ({w}×{h}, limite {limit} px par côté). Réduisez-la dans un éditeur de bureau puis téléversez-la à nouveau.","backdrop.downscale_failed":"Impossible de créer la copie réduite. Le plan actuel n'a pas été modifié."};const r="74cbeb9792716ab64cfbcf339d3044c6e8ae33533bdef7216a6d7d513ae04091";export{e as dictionary,r as fingerprint}; +globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="012abf4b3924ad03971870eb8085ab1ac1a66b0d9b6676fe095285a8b0f201ab";var e={"editor.context_actions":"Actions : {object}","editor.tool_options":"Options de l’outil : {tool}","editor.palette":"Palette : {tool}","editor.open_group":"Groupe d’outils : {group}","editor.group_active":"{group} — actif : {item}","editor.disabled_action":"{action} est indisponible : {reason}","editor.loading":"Chargement de l'éditeur…","editor.loading_aria":"L'éditeur de plan est en cours de chargement","editor.load_failed":"Impossible de charger l'éditeur.","editor.refresh_advice":"Actualisez la page et réessayez.","editor.retry_advice":"Vérifiez votre connexion et appuyez à nouveau.","version_mismatch.title":"Les versions de House Plan ne correspondent pas","version_mismatch.body":"Si Home Assistant redémarre encore, attendez la fin, puis rechargez cette page.","version_mismatch.frontend":"Carte","version_mismatch.backend":"Intégration","version_mismatch.reload":"Recharger la page","color_picker.title":"Sélecteur de couleur","color_picker.hue":"Teinte","color_picker.saturation":"Saturation","color_picker.value":"Luminosité","color_picker.hex":"Couleur hexadécimale","color_picker.invalid_hex":"Saisissez une couleur hexadécimale à 3 ou 6 chiffres","color_picker.confirm":"OK","btn.properties":"Propriétés","btn.keep_as_walls":"Conserver comme murs","btn.delete_room_keep_walls":"Supprimer la pièce, conserver les murs","btn.delete_room_with_walls":"Supprimer la pièce et les murs","title.markup_select":"Sélectionner et modifier les murs et les colonnes","title.markup_column":"Colonne : cliquez sur un point de la grille pour placer une colonne carrée","markup.partition":"Cloison","markup.column":"Colonne","markup.hint_column":"cliquez sur un point de la grille pour placer une colonne carrée","history.wall_segment":"Ajouter un segment de mur","history.column_add":"Ajouter une colonne","history.physical_edit":"Modifier l’objet physique","history.physical_delete":"Supprimer l’objet physique","history.physical_move":"Déplacer l’objet physique","history.wall_face_batch":"Créer des pièces à partir des murs","toast.column_duplicate":"Une colonne avec le même centre et la même dimension extérieure existe déjà","physical.partition_properties":"Propriétés de la cloison","physical.column_properties":"Propriétés de la colonne","physical.shape":"Forme","physical.square":"Carré","physical.circle":"Cercle","physical.diameter":"Diamètre","physical.side":"Côté","physical.rotation":"Angle de rotation","physical.length":"Longueur","physical.allowed_range":"Autorisé : {min}–{max} {unit}","physical.column_size_title":"Côté extérieur de la colonne carrée placée par le clic (1–150 cm).","card.title":"Plan de la maison","count.devices":"{n} app.","empty.no_spaces":"Aucun espace pour le moment.","nav.spaces":"Espaces House Plan","empty.add_first":"Ajoutez le premier espace et importez un plan.","empty.read_only":"Aucun espace n’est configuré. Demandez à un administrateur d’en ajouter un.","empty.install":"Installez l’intégration House Plan et ajoutez-la dans « Appareils et services ».","btn.add_space":"Ajouter un espace","btn.cancel":"Annuler","btn.save":"Enregistrer","btn.close":"Fermer","btn.delete":"Supprimer","btn.copy":"Copier","btn.edit":"Modifier","btn.open_in_ha":"Ouvrir dans HA","btn.reset":"Réinitialiser","btn.attach":"Joindre…","btn.upload":"Importer…","btn.replace":"Remplacer…","title.zoom_in":"Zoomer","title.zoom_out":"Dézoomer","title.zoom_fit":"Tout ajuster","title.configure_space":"Configurer l’espace","title.add_space":"Ajouter un espace","title.markup_add":"Murs : tracez une chaîne continue ; chaque segment accepté est enregistré séparément. Maj verrouille à 45°","title.markup_merge":"Fusionner : cliquez sur une pièce, puis sur la pièce voisine avec laquelle elle partage un mur","title.markup_split":"Diviser une pièce : cliquez sur la pièce, puis sur deux points de ses murs","title.markup_delroom":"Supprimer une pièce : cliquez à l’intérieur de la pièce puis confirmez","title.need_plan":"Importer une image de plan","markup.add":"Murs","markup.merge":"Fusionner","markup.split":"Diviser","markup.resize":"Redimensionner","title.markup_resize":"Redimensionner les pièces : faites glisser une poignée disponible sur un mur horizontal ou vertical","markup.hint_resize":"faites glisser une poignée de mur disponible · le mur s’arrête à la première position non sûre · Échap annule · Ctrl+Z — annuler","resize.disabled.diagonal":"Ce mur est incliné ; le redimensionnement ne prend en charge que les murs horizontaux et verticaux","resize.disabled.side-angle":"Un mur adjacent est incliné ; le redimensionnement exige que les deux murs adjacents rencontrent ce mur à angle droit","resize.disabled.duplicate-physical-wall":"Une cloison distincte ou une colonne chevauche ce mur ; supprimez-la ou déplacez-la avant de redimensionner","resize.disabled.partial-shared":"Une pièce voisine n’utilise qu’une partie de ce mur ; il ne peut donc pas être déplacé en toute sécurité comme un mur partagé unique","resize.disabled.unequal-shared":"La pièce voisine utilise des extrémités ou une longueur de mur différentes ; les murs ne peuvent donc pas être déplacés ensemble en toute sécurité","resize.disabled.multiple-rooms":"Déplacer ce mur affecterait plus de deux pièces","resize.disabled.thickness-conflict":"L’épaisseur du mur ne peut pas être conservée en toute sécurité","resize.disabled.opening-conflict":"Une ouverture sur ce mur ne peut pas être déplacée en toute sécurité","resize.disabled.invalid-geometry":"Ce mur ne peut pas être redimensionné sans modifier la structure du plan","resize.limit_stopped":"Mur arrêté : l'étape suivante enfreindrait une limite de jonction","resize.commit_failed":"Le redimensionnement a été annulé car le plan final n’a pas passé le contrôle de géométrie","resize.preview_failed":"Le redimensionnement s’est arrêté à la dernière position sûre car la géométrie du plan ne pouvait pas être préservée","markup.opening":"Ouverture","markup.delete_room":"Supprimer la pièce","history.undo":"Annuler","history.redo":"Rétablir","history.undo_named":"Annuler : {name} (Ctrl+Z)","history.redo_named":"Rétablir : {name} (Ctrl+Maj+Z / Ctrl+Y)","history.undo_empty":"Rien à annuler","history.redo_empty":"Rien à rétablir","history.undone":"Annulé : {name}","history.redone":"Rétabli : {name}","history.add_room":"Créer une pièce","history.split_room":"Diviser la pièce","history.merge_rooms":"Fusionner les pièces","history.resize_room":"Redimensionner la pièce","history.wall_thickness":"Modifier l’épaisseur du mur","history.add_opening":"Ajouter une ouverture de porte ou de fenêtre","history.edit_opening":"Modifier l’ouverture","history.move_opening":"Déplacer l’ouverture","history.delete_opening":"Supprimer l’ouverture","history.delete_room_keep_walls":"Supprimer la pièce, conserver les murs","history.delete_room_with_walls":"Supprimer la pièce et les murs","history.decor_add":"Ajouter un objet décoratif","history.decor_edit":"Modifier l’objet décoratif","history.decor_move":"Déplacer l’objet décoratif","history.decor_transform":"Transformer l’objet décoratif","history.decor_delete":"Supprimer l’objet décoratif","history.backdrop_transform":"Transformer l’arrière-plan du plan","history.device_move":"Déplacer {name}","history.device_stale":"L’historique des positions n’est plus applicable et a été effacé","opening.new":"Nouvelle ouverture","opening.edit":"Ouverture","opening.door":"Porte","opening.window":"Fenêtre","opening.gate":"Portail","opening.passage":"Passage ouvert","opening.passage_binding_warning":"L’enregistrement supprimera le capteur d’ouverture/fermeture et la serrure.","opening.invalid_passage_fields":"Le passage ouvert du plan « {room} » possède des paramètres non pris en charge : {fields}.","opening.type_label":"Type","opening.length_label":"Longueur, cm","opening.contact_label":"Capteur d’ouverture/fermeture","opening.lock_label":"Serrure","opening.none":"— aucun —","opening.search_ph":"Rechercher : nom ou ID d’entité…","opening.invert":"Inverser ouvert/fermé","opening.flip_h":"Charnière sur l’autre montant","opening.flip_v":"Ouverture de l’autre côté","opening.open":"Ouvert","opening.closed":"Fermé","opening.locked":"Verrouillé","opening.unlocked":"Déverrouillé","opening.state_unknown":"indisponible","opening.no_entities":"Aucun capteur associé — symbole statique sur le plan.","toast.opening_no_wall":"Cliquez près d’un mur de pièce ou d’un mur indépendant","opening.host_partition":"Mur indépendant","opening.partition_orphan":"Le mur indépendant de cette ouverture n’existe plus","opening.partition_jamb_margin":"Laissez au moins {distance} entre l’ouverture et l’extrémité du mur","opening.rebind_partition":"Associer à un autre mur indépendant","confirm.delete_partition_openings_title":"Supprimer le mur et les ouvertures ?","confirm.delete_partition_openings_body":"Ce mur contient {count} ouverture(s). Elles seront supprimées avec lui.","confirm.delete_partition_openings_item":"• {type}, {length}","markup.hint_points":"points : {n} · Maj — pas de 45° · Échap — terminer la chaîne · Ctrl+Z — annuler un point · fermer une zone propose de créer une pièce","markup.hint_start":"cliquez sur un point de la grille pour commencer une chaîne de murs","tip.lqi":"signal Zigbee moyen :","tip.area":"surface : {value}","info.device_header":"Appareil sur le plan","info.model":"Modèle","info.state":"État","info.link":"Lien","info.manuals":"Manuels","info.none":"Aucune information supplémentaire","marker.new_device":"Nouvel appareil","marker.name_label":"Nom (affiché sur le plan)","marker.name_ph":"Nom","marker.binding_label":"Associer à un appareil HA","marker.binding_disabled":"désactivé dans Home Assistant","marker.virtual_option":"Appareil virtuel (sans association)","marker.search_ph":"Rechercher un appareil / groupe…","marker.nothing_found":"aucun résultat","marker.room_label":"Pièce","marker.room_override":" (placement forcé)","marker.room_choose":"— sélectionner une pièce —","marker.room_auto":"— selon la zone de l’appareil (auto) —","marker.icon_label":"Icône","marker.icon_ph":"mdi:… (vide = auto)","marker.display_label":"Affichage","display.badge":"Icône + état","display.icon_ripple":"Icône + état et activité","display.static_icon":"Icône toujours statique","marker.display_hint_badge":"L’icône et le fond dynamique affichent l’état de l’appareil sans la pulsation d’activité habituelle. Les alarmes rouges restent visibles.","marker.display_hint_icon_ripple":"L’icône, le fond dynamique et la pulsation affichent une brève animation pour les événements et une animation continue pour le fonctionnement, le mouvement ou la présence. Les alarmes rouges restent prioritaires.","marker.display_hint_value":"Une valeur Home Assistant sélectionnée ou résolue automatiquement remplace l’icône tandis que le fond continue d’indiquer l’état. Les alarmes rouges restent visibles.","marker.display_hint_static_icon":"Le contour adapté au thème et l’icône restent toujours identiques. L’état, l’activité, l’indisponibilité et les alarmes ne modifient pas l’apparence.","marker.static_alarm_warning":"Cet appareil peut signaler des alarmes. L’affichage statique masque l’indication visuelle d’alarme du marqueur.","marker.preview.title":"Aperçu de l’affichage","marker.preview.actual":"Actuel","marker.preview.example":"Exemple","marker.preview.integration":"Fourni par","marker.preview.source":"Source d’affichage","marker.preview.current_state":"État actuel","marker.preview.result":"Sur le plan","marker.preview.details":"Détails de la source","marker.preview.select_source":"Choisissez un appareil ou une entité Home Assistant pour voir son affichage réel.","marker.preview.unknown_provider":"Intégration inconnue","marker.preview.virtual_provider":"House Plan · appareil virtuel","marker.preview.no_source":"Aucune source active","marker.preview.no_state":"Aucun état actuel","marker.preview.mixed_states":"Plusieurs états différents","marker.preview.multiple_sources":"{n} sources","marker.preview.more_sources":"+{n} de plus","marker.preview.scaled":"L’aperçu est redimensionné à {n}% pour tenir dans la zone. La taille enregistrée reste inchangée.","marker.preview.demo_short":"Afficher une activité brève","marker.preview.demo_continuous":"Afficher une activité continue","marker.preview.stop_continuous":"Arrêter l’activité continue","marker.preview.demo_short_notice":"Exemple d’activité brève ; l’état réel de l’appareil reste inchangé.","marker.preview.demo_continuous_notice":"Exemple d’activité continue ; l’état réel de l’appareil reste inchangé.","marker.preview.demo_already_visible":"L’état actuel affiche déjà un véritable effet d’activité ou d’alarme.","marker.preview.reduced_motion":"La réduction des animations est activée sur le système ; l’activité normale est donc affichée sous forme de point.","marker.preview.reason.neutral":"Fond sombre neutre","marker.preview.reason.working":"Fond jaune : l’appareil fonctionne actuellement","marker.preview.reason.working_activity":"Fond jaune et effet d’activité : l’appareil fonctionne actuellement","marker.preview.reason.open":"Fond orange : physiquement ouvert ou déverrouillé","marker.preview.reason.cover_icon_state":"Fond neutre ; l’entité de volet contrôle l’état et l’icône affichés","marker.preview.reason.presence":"Effet d’activité tant qu’une présence est détectée","marker.preview.reason.event":"Effet d’activité bref après un événement détecté","marker.preview.reason.transition":"Effet d’activité pendant que l’appareil se déplace ou change d’état","marker.preview.reason.media_neutral":"Les appareils multimédias restent sur un fond sombre neutre tant qu’ils sont disponibles","marker.preview.reason.unavailable":"Fond neutre atténué : indisponible ou éteint","marker.preview.reason.alarm":"Fond d’alarme rouge ; l’indication d’alarme est toujours affichée","marker.preview.reason.live_states_disabled":"Le style selon les états en direct est désactivé pour cette carte","marker.preview.reason.value_no_state":"Aucune valeur d’état exploitable ; l’icône est affichée à la place","marker.preview.reason.value_ambiguous_sources":"Plusieurs sources de valeur possibles ; l’icône est affichée à la place","marker.preview.reason.value_non_scalar":"La source n’a pas renvoyé de valeur simple ; l’icône est affichée à la place","marker.preview.reason.value_virtual":"Un appareil virtuel n’a aucune valeur Home Assistant ; l’icône est affichée à la place","marker.preview.reason.vacuum_live_plan_only":"La position et la trajectoire en direct de l’aspirateur ne sont disponibles que sur le plan complet","marker.preview.reason.hidden_design_preview":"L’appareil est masqué sur le plan ; cet aperçu de conception reste visible","marker.preview.reason.composite_power_source":"L’état provient de l’entité d’alimentation de l’appareil ; les interrupteurs auxiliaires sont ignorés","marker.preview.reason.activity_display_disabled":"Le mode d’affichage sélectionné n’affiche pas les effets d’activité habituels","marker.preview.reason.ha_disabled":"L’association Home Assistant est désactivée et sera masquée sur le plan","marker.preview.reason.orphaned":"L’association Home Assistant enregistrée est introuvable","marker.preview.reason.static_icon":"Mode statique : l’état de l’appareil ne modifie pas l’icône","marker.activity_color":"Couleur de la pulsation d’activité","marker.ripple_size":"Taille de la pulsation d’activité","marker.activity_alarm_note":"La couleur et la taille n’affectent que l’activité normale et ne modifient pas les alarmes rouges.","marker.pulse_a11y_alarm":"Alarme","marker.pulse_a11y_event":"Événement récent","marker.pulse_a11y_presence":"Présence détectée","marker.pulse_a11y_transition":"Changement d’état","marker.pulse_a11y_running":"En fonctionnement","marker.state_a11y_neutral":"État par défaut","marker.state_a11y_working":"En fonctionnement","marker.state_a11y_open":"Ouvert","marker.state_a11y_locked":"Verrouillé","marker.state_a11y_unlocked":"Déverrouillé","marker.state_a11y_alarm":"Alarme","marker.state_a11y_unavailable":"Indisponible","marker.lqi_a11y_low":"LQI {value}, signal faible","marker.lqi_a11y_mid":"LQI {value}, signal moyen","marker.lqi_a11y_high":"LQI {value}, signal fort","marker.size_label":"Taille / rotation de l’icône","marker.angle_label":"Rotation","marker.model_label":"Modèle","marker.model_ph":"ex. Aqara T&H","marker.link_label":"Lien","marker.desc_label":"Description","marker.desc_ph":"Notes, caractéristiques…","marker.manuals_label":"Manuels (PDF, etc.)","marker.sub_device":"appareil","marker.sub_z2m_group":" · groupe Z2M","marker.sub_group":"groupe","marker.sub_helper":"assistant","space.new":"Nouvel espace","space.copy_title":"Copier l’espace","space.copy_name":"Nom du nouvel espace","space.copy_fallback":"Espace","space.copy_create":"Créer la copie","space.copy_optimize_title":"Optimiser avant de copier ?","space.copy_optimize_body":"Avant de créer « {name} », House Plan doit optimiser tout le plan, y compris les autres espaces. Continuer ?","space.copy_optimize_confirm":"Optimiser et copier","space.copy_error_changed":"Le plan a changé pendant la confirmation. Vérifiez-le et réessayez.","space.copy_error_source_missing":"L’espace source n’existe plus. Rouvrez ses réglages et réessayez.","space.copy_error_source_invalid":"House Plan n’a pas pu valider tous les murs de cet espace. Corrigez l’espace source.","space.copy_error_spaces_limit":"House Plan contient déjà le nombre maximal d’espaces.","space.copy_error_partitions_limit":"Cet espace contient trop de murs pour être copié.","space.copy_error_openings_limit":"Cet espace contient trop d’ouvertures pour être copié.","space.copy_error_decor_limit":"Cet espace contient trop d’objets d’arrière-plan pour être copié.","space.copy_error_columns_limit":"Cet espace contient trop de colonnes pour être copié.","space.copy_error_opening_host":"Une ouverture n’est plus rattachée à un mur. Corrigez-la ou supprimez-la avant la copie.","space.copy_error_geometry":"La copie créerait une géométrie de murs non sûre. Corrigez l’espace source.","space.copy_error_optimize_geometry":"La copie est arrêtée car l’optimisation de tout le plan n’est pas sûre pour un espace.","space.header":"Espace","space.title_label":"Titre","space.title_ph":"ex. Garage","space.plan_label":"Plan (arrière-plan)","space.no_plan":"aucune image de plan","space.plan_alt":"plan","room.new":"Nouvelle pièce","room.name_label":"Nom affiché","room.name_ph":"ex. Terrasse","room.area_label":"Zone Home Assistant (non attribuée)","room.no_area_option":"— aucune zone —","room.default_name":"Pièce","device.unnamed":"sans nom","device.light_group":"groupe de lumières","device.fallback":"appareil","device.virtual":"appareil virtuel","confirm.delete_room_title":"Supprimer la pièce « {name} » ?","confirm.delete_room_body":"Choisissez si les murs physiques propres à la pièce doivent être conservés. Les murs partagés avec une autre pièce sont toujours conservés.","confirm.remove_marker_title":"Supprimer l’appareil du plan ?","confirm.remove_marker_body":"L’appareil disparaîtra complètement et ne contribuera plus aux données du plan. Vous pourrez l’ajouter de nouveau plus tard.","confirm.erase_decor":"Effacer l’objet {kind} ? Vous pouvez annuler cette action depuis l’historique de l’éditeur.","confirm.delete_space_title":"Supprimer l’espace ?","confirm.delete_space_body":"L’espace, toutes ses pièces et tout le tracé du plan seront supprimés.","confirm.delete_space_vac_routes":"Les affectations de cartes de robots seront aussi supprimées : {count}.","space.delete_blocked":"Cet espace est encore utilisé par {n} appareil(s). Déplacez-les vers un autre espace ou supprimez-les d’abord.","toast.pos_save_failed":"Échec de l’enregistrement de la position : {err}","toast.no_entity":"L’appareil n’a aucune entité adaptée","toast.ha_disabled_action":"Un objet Home Assistant désactivé ne peut pas être utilisé sur le plan.","toast.ha_disabled_show_device":"Un appareil désactivé dans Home Assistant ne peut pas être affiché sur le plan. Activez-le d’abord dans Home Assistant.","toast.ha_disabled_show_entity":"Une entité désactivée dans Home Assistant ne peut pas être affichée sur le plan. Activez-la d’abord dans Home Assistant.","toast.ha_disabled_add":"Un objet Home Assistant désactivé ne peut pas être ajouté au plan. Activez-le d’abord dans Home Assistant.","toast.ha_binding_unverified":"L’état de l’objet n’a pas pu être vérifié via le registre Home Assistant. L’affichage et les actions sont temporairement indisponibles.","toast.markup_needs_server":"Le tracé est disponible une fois la configuration déplacée sur le serveur","toast.space_order_changed":"L’ordre a changé. Si une carte fixe son étage par numéro, vérifiez ces tableaux de bord.","toast.conflict":"La configuration a été modifiée dans une autre fenêtre — données actualisées, répétez votre dernière action","toast.cfg_save_failed":"Échec de l’enregistrement de la configuration : {err}","toast.room_overlap":"Le contour chevauche la pièce « {name} » — les pièces ne doivent pas se chevaucher","toast.contour_cannot_close":"Le contour ne peut pas être fermé car il est dégénéré ou s’auto-intersecte","toast.merge_not_adjacent":"Seules les pièces partageant un mur peuvent être fusionnées","toast.rooms_merged":"Pièces fusionnées dans « {name} »","toast.split_pick_wall":"Commencez la découpe sur le mur de la pièce","toast.split_bad_cut":"La découpe doit aller d’un mur à l’autre à l’intérieur de la pièce, sans croiser de mur ni se croiser elle-même","merge.header":"Fusionner les pièces","merge.hint":"La pièce fusionnée conserve un nom et une zone. L’autre zone est libérée — ses appareils quittent le plan jusqu’à ce qu’une autre pièce la récupère.","merge.keep":"Conserver","merge.no_area":"aucune zone","toast.room_saved":"Pièce enregistrée ({n}). Appareils ajoutés : {added}. Tracez la suivante ou quittez le mode tracé.","toast.room_saved_no_area":"Pièce enregistrée ({n}, sans zone). Tracez la suivante ou quittez le mode tracé.","toast.marker_needs_server":"La modification des appareils est disponible une fois la configuration déplacée sur le serveur","toast.virtual_name_required":"Saisissez un nom pour l’appareil virtuel","toast.marker_saved":"Appareil enregistré","toast.marker_removed":"Appareil supprimé du plan","toast.integration_missing":"L’intégration House Plan n’est pas installée — gestion indisponible","toast.plan_formats":"Formats pris en charge : SVG, PNG, JPG, WebP","toast.plan_required":"Importez un plan — il est obligatoire","toast.space_added_onboard":"Espace ajouté. Tracez les pièces : cliquez sur les points de la grille et fermez le contour.","toast.space_added":"Espace ajouté","toast.space_copied":"Espace « {name} » créé","toast.space_saved":"Espace enregistré","toast.space_deleted":"Espace supprimé","toast.delete_failed":"Échec de la suppression : {err}","toast.error":"Erreur : {err}","toast.toggle_target_unavailable":"La cible « {name} » est indisponible — aucune action n’a été effectuée","toast.toggle_targets_unavailable":"Cibles indisponibles : {names}. Aucune action n’a été effectuée","toast.file_failed":"Le fichier « {name} » n’a pas été importé : {err}","toast.files_attached":"Fichiers joints : {n}","err.unknown":"erreur inconnue","err.code":"code {code}","err.too_large":"fichier supérieur à {mb} Mo","err.bad_ext":"type non pris en charge (PDF/image attendu)","err.unauthorized":"droits administrateur requis","editor.title":"Titre","editor.default_floor":"Espace initial","editor.default_floor_missing":"L’espace initial « {id} » n’existe plus. Choisissez un autre espace.","editor.floor":"Espace fixe","editor.floor_none":"— non fixé —","editor.floor_index":"Index YAML {index} (conservé)","fixed_floor.loading":"Chargement de l’espace fixe…","fixed_floor.invalid_title":"L’espace fixe est indisponible","fixed_floor.invalid_body":"Vérifiez floor dans la configuration de la carte. Valeur configurée : {value}","editor.icon_size":"Taille des icônes, % de la largeur du plan","editor.show_temperature":"Afficher la température","editor.live_states":"États en direct (on/off, ouvert…)","editor.light_pools":"Halos lumineux et ombres des murs","editor.show_signal":"Afficher le signal Zigbee (LQI)","editor.language":"Langue de l’interface","editor.lang_auto":"Auto (profil HA)","title.icon_rules":"Règles d’icônes : quelle icône MDI attribuer aux appareils selon leur nom","rules.title":"Règles d’icônes","rules.hint":"Les règles sont testées de haut en bas sur « nom de l’appareil + modèle » (expression régulière insensible à la casse) ; la première correspondance gagne. Si rien ne correspond, la classe d’appareil de l’entité est utilisée, puis l’icône générique.","rules.pattern_ph":"regex, ex. plug|socket","rules.icon_ph":"mdi:power-socket-de","rules.add":"Ajouter une règle","rules.reset":"Réinitialiser par défaut","rules.test_ph":"Tester un nom d’appareil…","rules.invalid":"expression régulière invalide","rules.saved":"Règles d’icônes enregistrées","btn.up":"Monter","btn.down":"Descendre","tap.info":"Fiche de l’appareil","tap.more_info":"Boîte de dialogue Plus d’infos de HA","tap.toggle":"Basculer l’état","marker.tap_label":"Action au toucher pour cet appareil","tap.toggle_note":"L’état déterminé est affiché ci-dessous. Les appareils sécurisés ne sont jamais basculés depuis le plan.","import.title":"Créer des espaces à partir des étages HA","import.hint":"Votre Home Assistant connaît déjà ces étages. Sélectionnez ceux à transformer en espaces du plan — vous importerez ensuite une image de plan pour chacun. Les pièces sont ensuite tracées manuellement sur le plan.","import.start":"Créer {n} espace(s)","import.manual":"Commencer de zéro","import.progress":"Étage {i} sur {n}","import.done":"Espaces créés. Tracez les pièces : cliquez sur les points de la grille et fermez le contour.","btn.skip":"Passer","space.scale_label":"Échelle (taille d’une cellule de grille)","space.cell_cm.help":"Relie la grille aux dimensions réelles : les longueurs, les surfaces, l’épaisseur des murs, la taille des ouvertures et le rayon du halo en dépendent. Une modification ultérieure change les dimensions calculées de tout l’espace sans déplacer ses points sur le plan.","space.cell_cm.help.aria":"Aide : échelle de l’espace","space.scale_unit":"cm par cellule","space.scale_unit_imperial":"po par cellule","space.display_section":"Affichage","space.show_borders":"Toujours afficher les contours des pièces","space.zero_wall_style":"Murs d’épaisseur nulle","space.zero_wall_style.help":"Les murs d’épaisseur nulle en pointillés laissent passer le halo et les rayons du soleil, tandis que les murs pleins les bloquent comme une barrière sans surface. Ce choix s’applique à tous ces murs de l’espace, même si leur ligne est masquée en mode Vue.","space.zero_wall_style.help.aria":"Aide : style des murs d’épaisseur nulle","space.zero_wall_dashed":"Pointillés","space.zero_wall_solid":"Plein","space.show_names":"Afficher les noms des pièces (faire glisser pour déplacer)","space.room_color":"Couleur du contour et du nom","space.opacity":"Opacité","space.fill_label":"Remplissage de la pièce","space.fill_mode.help":"« Couleur personnalisée » définit le style, tandis que « Lumière », « Température » et « LQI » utilisent les données actuelles de Home Assistant. Le halo s’active séparément.","space.fill_mode.help.aria":"Aide : mode de remplissage des pièces","fill.none":"Aucun","fill.lqi":"Signal Zigbee","fill.light":"Lumières","fill.custom":"Couleur personnalisée","space.custom_fill":"Couleur de remplissage","space.source_file":"J’ai une image de plan","space.source_draw":"Aucune image — je tracerai les pièces à la main","fill.temp":"Température","tip.temp_avg":"température moyenne :","tip.hum_avg":"humidité moyenne :","space_card.button":"Ouvrir le plan de l’espace","space_card.not_found":"Espace « {id} » introuvable","space_card.loading":"Chargement…","continuity.restore_plan":"Restauration du plan…","continuity.restore_connection":"Restauration de la connexion aux appareils…","continuity.retry":"Réessayer","editor.space":"Espace","editor.framing":"Cadrage","editor.fit_content":"Tout le contenu visible","editor.fit_house":"Ajusté à la géométrie de la maison","editor.show_button":"Afficher le bouton","editor.button_label":"Libellé du bouton","editor.button_target":"Chemin du tableau de bord cible","marker.sub_entity":"entité","title.general_settings":"Paramètres généraux","title.export_pdf":"Enregistrer en PDF","pdf.title":"Enregistrement en PDF","pdf.dimensions":"Afficher les dimensions et les surfaces","pdf.decor":"Afficher les meubles et les autres éléments","pdf.room_names":"Afficher les noms des pièces","pdf.backdrop":"Afficher le fond de plan","pdf.save":"Enregistrer","pdf.saving":"Création…","pdf.failed":"Impossible de créer le PDF.","pdf.too_large":"Les images dépassent la limite PDF de 25 Mo.","pdf.asset_failed":"Impossible de charger une image de fond ou de décoration.","pdf.scale":"Échelle 1:{n}","pdf.north":"Nord","gs.title":"Paramètres généraux","gs.light_group":"Remplissage : lumières","gs.light_on":"Lumières allumées","gs.light_off":"Toutes les lumières éteintes","gs.temp_group":"Remplissage : température","gs.temp_cold":"Froid","gs.temp_ok":"Confortable","gs.temp_hot":"Chaud","gs.lqi_group":"Remplissage : signal Zigbee","gs.lqi_low":"Signal faible","gs.lqi_high":"Signal fort","gs.reset":"Réinitialiser par défaut","gs.saved":"Paramètres généraux enregistrés","gs.radar_show_live":"Afficher la présence en direct sur le plan","gs.radar_show_live_hint":"Masque ou affiche toutes les cibles radar en direct. Cela ne démarre ni n’arrête l’enregistrement des observations.","radar.title":"Présence sur le plan","radar.help":"Reliez ce marqueur aux entités radar exactes de Home Assistant, placez le capteur et choisissez son profil de coordonnées. Les positions en direct sont limitées à la pièce sélectionnée.","radar.help.aria":"Aide : paramètres du radar de présence","radar.enabled":"Utiliser ce radar de présence","radar.show_live":"Afficher les cibles en direct","radar.configure":"Configurer le radar","radar.configure_on_plan":"Configurer sur le plan","radar.change_installation":"Changer l’installation","radar.no_contour":"Cette pièce n’a pas de contour. Les points radar ne seront pas limités.","radar.discard_setup_title":"Abandonner la configuration du radar ?","radar.discard_setup":"La configuration du radar non enregistrée sera perdue.","radar.step_place_mount":"Indiquez la position physique du capteur","radar.step_place_heading":"Indiquez un point droit devant le capteur","radar.step_reference":"Indiquez la position de référence {n}, puis lancez la mesure","radar.step_check_reference":"Indiquez une position de contrôle indépendante","radar.start_measure":"Lancer la mesure","radar.countdown":"Placez-vous sur le repère dans {seconds} s","radar.capturing":"Restez immobile et seul pendant la mesure…","radar.fit_ready":"Le calibrage est prêt","radar.check_third":"Vérifier à une autre position","radar.check_complete":"Contrôle indépendant terminé","radar.error_distance":"Écart de position : {distance}","radar.ambiguous_target":"Plusieurs cibles ont été signalées. Recommencez la mesure seul.","radar.insufficient_samples":"Coordonnées actuelles insuffisantes. Réessayez ou utilisez le réglage manuel.","radar.bad_references":"Choisissez des références espacées dans des directions différentes du capteur.","radar.ambiguous_sources":"Les mesures permettent deux directions également plausibles. Choisissez des repères distinguant la gauche de la droite.","radar.bad_fit":"Les mesures ne correspondent pas. Vérifiez les unités, la position du capteur et les références.","radar.desktop_hint":"Utilisez un ordinateur pour un réglage précis. L’édition sur appareils tactiles est prise en charge au mieux.","radar.detected":"House Plan a reconnu les métadonnées radar de cet appareil. Vérifiez les sources exactes avant d’enregistrer.","radar.detected_ld2450":"House Plan a trouvé un ensemble de coordonnées ESPHome LD2450. Vérifiez les sources X/Y exactes avant d’enregistrer.","radar.additional_actions":"Actions supplémentaires","radar.declare":"Ceci est un radar de présence","radar.profile":"Profil de données","radar.profile_esphome_ld2450_v1":"ESPHome LD2450 (cibles X/Y)","radar.profile_cartesian_v1":"Cibles cartésiennes (X/Y)","radar.profile_polar_v1":"Cible polaire (distance/angle)","radar.profile_range_v1":"Distance uniquement","radar.profile_zones_v1":"États des zones","radar.profile_presence_v1":"Présence uniquement","radar.room":"Pièce observée","radar.room_choose":"Choisir une pièce","radar.target":"Cible {n}","radar.axis_x":"Entité de coordonnée X","radar.axis_y":"Entité de coordonnée Y","radar.add_target":"Ajouter un emplacement de cible","radar.range_channel":"Canal de distance {n}","radar.add_range":"Ajouter un canal de distance","radar.presence_gate":"Entité de présence du canal","radar.swap_axes":"Permuter les axes X et Y","radar.axis_x_sign":"Direction X","radar.axis_y_sign":"Direction Y","radar.distance_source":"Entité de distance","radar.angle_source":"Entité d’angle","radar.angle_unit":"Unité d’angle","radar.degrees":"Degrés","radar.radians":"Radians","radar.angle_zero":"Direction de l’angle zéro","radar.angle_forward":"Vers l’avant","radar.angle_right":"Vers la droite","radar.angle_clockwise":"Les angles augmentent dans le sens horaire","radar.zone_source":"Entité de zone","radar.occupancy_source":"Entité de présence","radar.count_source":"Entité du nombre de cibles","radar.availability_source":"Entité de disponibilité","radar.source_choose":"Choisir une entité","radar.source_optional":"Facultatif","radar.source_missing":"actuellement indisponible","radar.saved_unsupported":"Cette configuration radar enregistrée est incomplète ou non prise en charge. Elle reste inactive ; supprimez-la ou mettez House Plan à jour avant de la reconfigurer.","radar.occupancy":"Présence (activée/désactivée)","radar.count":"Nombre","radar.mount":"Position et direction","radar.mount_hint":"Il s’agit de la position physique du capteur. Déplacer son marqueur décoratif ne la modifie pas.","radar.heading":"Direction, °","radar.range_cm":"Portée, cm","radar.fov_deg":"Champ de vision, °","radar.unit":"Unité de la source","radar.mirror":"Inverser l’axe gauche/droite","radar.remove":"Supprimer les paramètres radar","radar.invalid":"Renseignez la pièce, les sources et la position du radar avant d’enregistrer.","radar.check_sources":"Vérifier les données en direct","radar.checking":"Vérification…","radar.health":"État de la connexion","radar.live_summary":"Cibles actuelles : {targets} ; arcs de distance : {ranges}","radar.health_ok":"Données actuelles reçues","radar.health_off":"Aucune cible détectée","radar.health_stale":"Certaines coordonnées sont obsolètes","radar.health_partial":"Certaines sources sont à jour, d’autres sont obsolètes","radar.health_restricted":"L’accès à une ou plusieurs sources est limité","radar.health_incomplete":"Le rapport radar actuel est incomplet","radar.health_position_unavailable":"Présence signalée ; position actuelle indisponible","radar.health_unavailable":"Données du capteur indisponibles","radar.health_needs_setup":"L’installation doit être configurée","radar.health_inconsistent":"Les sources fournissent des valeurs contradictoires","radar.health_unknown":"L’état actuel est inconnu","radar.health_disabled":"Le radar est désactivé","radar.error_invalid_radar":"Vérifiez les paramètres radar.","radar.error_invalid_selection":"Sélectionnez une pièce existante et des sources valides.","radar.error_source_restricted":"Vous n’avez pas accès à toutes les sources sélectionnées.","radar.error_rate_limited":"Trop de demandes. Réessayez dans un instant.","radar.error_not_ready":"Le traitement radar n’est pas encore prêt.","radar.error_conflict":"Le plan a changé. Rouvrez la configuration radar et réessayez.","radar.error_source_unavailable":"Une ou plusieurs sources radar sélectionnées sont indisponibles.","radar.error_unsupported_capability":"Cette fonction radar n’est pas prise en charge par l’intégration installée.","radar.report_age":"il y a {seconds} s","space.show_lqi":"Afficher le signal Zigbee (LQI) à côté des appareils","space.hide_decor":"Masquer la couche décorative","space.hide_decor_tip":"Les lignes, formes, étiquettes et meubles restent à leur place — visibles dans l’éditeur d’arrière-plan, mais pas sur le plan.","space.hide_openings":"Masquer les ouvertures","space.hide_openings_tip":"Les symboles de portes, fenêtres et portails ne sont pas dessinés, mais les ouvertures continuent de fonctionner : la lumière les traverse, le soleil entre par les fenêtres et les capteurs de contact continuent de les ouvrir. L’éditeur de plan les affiche toujours.","gs.light_none":"Aucune source lumineuse","mode.plan":"Éditeur de plan","mode.devices":"Éditeur d’appareils","display.value":"Valeur + état","marker.subarea":"aucune zone, manuel","device.new":"Nouvel appareil — ouvrez son éditeur pour fermer","opening.unlock_action":"Déverrouiller","opening.lock_action":"Verrouiller","opening.lock_pending":"En cours…","title.close_editor":"Fermer l’éditeur (retour à la vue)","title.add_device":"Ajouter un appareil au plan","devbar.add":"Ajouter","devbar.rules":"Règles d’icônes","device_inbox.button":"Appareils","device_inbox.title":"Appareils sur le plan","device_inbox.search":"Rechercher appareils, entités et intégrations…","device_inbox.add_virtual":"Ajouter un appareil virtuel","device_inbox.tab_on_plan":"Sur le plan","device_inbox.tab_available":"Disponibles","device_inbox.tab_hidden":"Masqués","device_inbox.tab_readd":"De nouveau disponibles","device_inbox.only_new":"Nouveaux uniquement","device_inbox.show_entities":"Afficher les entités","device_inbox.show_hidden":"Afficher les masqués sur le plan","device_inbox.show_hidden.help":"Affiche temporairement les marqueurs masqués et désactivés sous forme de fantômes réservés à l’éditeur. La visibilité enregistrée des appareils ne change pas.","device_inbox.show_hidden.help.aria":"Aide : afficher les appareils masqués sur le plan","device_inbox.new":"Nouveau","device_inbox.find":"Trouver sur le plan","device_inbox.edit":"Modifier","device_inbox.hide":"Masquer","device_inbox.show":"Afficher","device_inbox.add":"Ajouter","device_inbox.readd":"Ajouter à nouveau","device_inbox.hide_available":"Masquer de la liste","device_inbox.show_more":"Afficher plus","device_inbox.more_actions":"Plus d'actions","device_inbox.find_hidden_hint":"Activez d'abord « Afficher les masqués sur le plan »","device_inbox.show_disabled":"Activez cette liaison dans Home Assistant avant de l'afficher","device_inbox.empty_on_plan":"Aucun appareil correspondant n'est encore sur le plan.","device_inbox.empty_available":"Aucun appareil disponible à ajouter.","device_inbox.empty_hidden":"Il n'y a aucun appareil masqué.","device_inbox.empty_readd":"Aucun appareil supprimé n'est disponible pour un nouvel ajout.","device_inbox.reason_visible_auto":"Découvert automatiquement","device_inbox.reason_visible_explicit":"Ajouté explicitement","device_inbox.reason_manual_hidden":"Masqué par l'utilisateur","device_inbox.reason_automatic_hidden":"Masqué automatiquement","device_inbox.reason_service_entry":"Entrée de registre de service uniquement","device_inbox.reason_excluded_integration":"Intégration « {integration} » exclue par les filtres de découverte","device_inbox.reason_excluded_domain":"Type d'entité non spatial","device_inbox.reason_grouped_light":"Représenté par un groupe de lumières de la pièce","device_inbox.reason_represented_by_parent":"Représenté par son appareil parent","device_inbox.reason_removed":"Précédemment retiré du plan","device_inbox.reason_available":"Disponible pour ajout au plan","device_inbox.reason_no_bound_room":"La zone HA n'est liée à aucune pièce du plan","device_inbox.status_ha_disabled":"Désactivé dans Home Assistant","device_inbox.status_orphaned":"La liaison n'existe plus dans Home Assistant","device_inbox.status_unverified":"Le registre Home Assistant est temporairement indisponible","device_inbox.saved":"Liste des appareils mise à jour","device_inbox.filters_excluded":"Intégrations exclues","device_inbox.filters_group_lights":"Regrouper les lumières de la pièce en un marqueur","device_inbox.filters_preview_appear":"apparaîtra : {count}","device_inbox.filters_preview_hide":"disparaîtra : {count}","device_inbox.filters_preview_lights":"lumières concernées : {count}","device_inbox.filters_reset":"Rétablir les recommandées","device_inbox.filters_save":"Enregistrer les filtres","device_inbox.filters_search_ph":"Ajouter une intégration…","device_inbox.filters_title":"Filtres de découverte","space.roomcard_section":"La carte de pièce affiche :","space.label_temp":"Température","space.label_hum":"Humidité","space.label_lqi":"Signal Zigbee moyen","space.label_light":"Lumières allumées/éteintes","roomcard.light_on":"Allumé","roomcard.light_off":"Éteint","roomcard.light_partial":"{on} sur {total}","toast.split_pick_inside":"Les points intermédiaires de découpe doivent se trouver à l’intérieur de la pièce","mode.decor":"Éditeur d’arrière-plan","decor.select":"Sélectionner","decor.line":"Ligne","decor.rect":"Rectangle","decor.ellipse":"Ovale","decor.text":"Texte","decor.erase":"Effacer","decor.erase_confirm_title":"Effacer l’objet ?","decor.color":"Couleur","decor.width":"Épaisseur de ligne","decor.line_style":"Style de ligne","decor.line_style_solid":"Plein","decor.line_style_dashed":"Pointillés","decor.fill":"Remplissage","decor.fill_color":"Couleur de remplissage","decor.length":"Longueur","decor.size":"Taille","decor.flip_h":"Retourner horizontalement","decor.flip_v":"Retourner verticalement","decor.angle":"Angle de rotation, °","decor.text_size":"Taille du texte","decor.backdrop_properties":"Propriétés de l’arrière-plan du plan","decor.text_title":"Étiquette de texte","decor.object_title":"Modifier {kind}","decor.text_label":"Texte","decor.live_group":"Insérer une variable HA","decor.live_entity":"Entité","decor.live_entity_ph":"choisir une entité","decor.live_attr":"Valeur","decor.live_attr_ph":"choisir l’état ou un attribut","decor.live_state":"État","decor.backdrop":"Image d’arrière-plan","decor.backdrop_hint":"Faites glisser pour déplacer ; tirez un coin pour redimensionner ; utilisez la poignée supérieure pour faire pivoter. Maj modifie les proportions ou libère l’angle.","decor.backdrop_reset":"Réinitialiser l’image","decor.backdrop_reset_done":"L’image a retrouvé sa position et sa taille d’origine","marker.icon_auto":"Auto : {icon} (selon les règles d’icônes ; choisissez-en une pour remplacer)","marker.icon_pin_auto":"Épingle","mode.plan_tip":"Éditeur de plan — la géométrie du logement : dessiner et diviser/fusionner les pièces, les associer aux zones HA, placer portes, fenêtres et portails, déplacer les cartes de pièces, régler l’échelle","mode.devices_tip":"Éditeur d’appareils — tout ce qui concerne les icônes : faire glisser pour positionner, cliquer pour modifier l’association/l’icône/l’affichage, ajouter des appareils virtuels, règles d’icônes","mode.decor_tip":"Éditeur d’arrière-plan — décoration purement visuelle sous le plan : lignes, rectangles, ovales et étiquettes de texte qui ne réagissent jamais aux clics","space.glow_enabled":"Halo des sources lumineuses","gs.glow_group":"Halo des sources lumineuses","gs.glow_base":"Obscurité de la maison","gs.glow_light":"Couleur / intensité de lumière par défaut","gs.wall_group":"Murs","gs.wall_fill":"Remplissage des murs","gs.glow_radius":"Rayon du halo","gs.glow_radius.help":"Définit le rayon général du halo en mètres ou en pieds ; le rayon propre à un appareil remplace cette valeur.","gs.glow_radius.help.aria":"Aide : rayon général du halo","gs.unit_m":"m","gs.unit_ft":"pi","marker.controls_label":"Contrôle d’autres sources lumineuses","marker.controls.help":"Avec l’action « Basculer l’état », les sources répertoriées basculent avec ce marqueur. Leur halo reste sur leurs propres marqueurs et ce lien ne transforme pas à lui seul le marqueur de contrôle en source lumineuse.","marker.controls.help.aria":"Aide : contrôler d’autres sources lumineuses","marker.controls_filter":"Rechercher des lumières et interrupteurs…","info.controls":"Contrôle","marker.glow_radius_label":"Rayon du halo","marker.glow_radius.help":"Définit le rayon du halo en mètres ou en pieds ; une valeur vide utilise le rayon des paramètres généraux.","marker.glow_radius.help.aria":"Aide : rayon du halo","markup.wallthick":"Épaisseur","markup.select":"Sélectionner","title.markup_wallthick":"Épaisseur — cliquez sur un mur pour définir son épaisseur de 0 à 100 cm.","markup.hint_wallthick":"cliquez sur un mur · Échap ferme sans appliquer","wallthick.field":"Épaisseur","wallthick.unit_cm":"cm","wallthick.unit_in":"po","wallthick.apply_room":"Appliquer à tous les murs de cette pièce","markup.draw_wall_title":"Épaisseur de chaque nouveau segment de mur (0–100 cm). Les murs partagés conservent la valeur existante.","room.queue_progress":"Pièce {current} sur {total}","toast.wall_rooms_saved":"Pièces créées : {n}","toast.wall_chain_saved":"Chaîne de murs enregistrée","toast.wallthick_pick":"Cliquez sur un mur","toast.wallthick_set":"Épaisseur du mur définie","toast.wallthick_cleared":"Épaisseur du mur supprimée","toast.physical_range":"Saisissez une valeur comprise entre {min} et {max} {unit}","toast.zero_wall_opening_conflict":"Supprimez d’abord l’ouverture sur ce segment de mur.","toast.zero_wall_ambiguous":"Le segment de mur est ambigu. Simplifiez ou ajustez la jonction.","toast.zero_wall_migration_blocked":"L’espace n’a pas été converti : {reason}. Aucune donnée n’a été modifiée.","toast.physical_angle":"Saisissez un angle de rotation compris entre 0° inclus et 90° exclu","toast.physical_limit":"L’espace a atteint la limite pour ce type de géométrie","toast.geometry_unsafe":"Modification annulée : la géométrie des murs n’a pas pu être construite en toute sécurité.","junction.limit_angle":"L'angle entre les murs est trop aigu : {actual}°, minimum {limit}°.","junction.limit_valence":"Trop de murs se rejoignent en un nœud : {actual}, maximum {limit}.","junction.limit_length":"Le segment de mur est trop court : {actual} cm, minimum {limit} cm.","junction.limit_distance":"Les murs et les nœuds sont trop proches : {actual} cm, minimum {limit} cm.","junction.limit_clearance":"Il ne reste plus d'intérieur de pièce : {actual} cm², minimum {limit} cm².","junction.limit_check_failed":"La vérification des jonctions n'a pas pu s'exécuter — la modification n'a pas été enregistrée","toast.wall_model_migration_blocked":"Le modèle de murs n’a pas pu être mis à jour : {reason}. Le plan n’a pas été modifié. Lancez « Optimiser les plans » ; si l’erreur se reproduit, corrigez la géométrie de mur conflictuelle.","toast.wall_model_client_outdated":"Mettez à jour la carte et rechargez la page avant de modifier le plan.","wall_model.reason.invalid-room":"contour de pièce invalide","wall_model.reason.zero-length":"segment de mur de longueur nulle","wall_model.reason.third-owner":"mur partagé par plus de deux pièces","wall_model.reason.duplicate-id":"identifiants de mur en conflit","wall_model.reason.thickness-conflict":"valeurs d’épaisseur de mur en conflit","wall_model.reason.opening-host":"l’ouverture ne peut pas être attribuée à un seul mur","toast.delete_room_pick":"Cliquez à l’intérieur de la pièce que vous souhaitez supprimer","toast.plan_snap_ambiguous":"Zoomez pour choisir le nœud du mur","toast.wall_repair_ambiguous":"Le contour de la pièce possède plusieurs connexions possibles. Zoomez et reliez-le explicitement.","toast.wall_repair_too_large":"L’écart dépasse 2 cm. Reliez les murs avant de créer la pièce.","toast.wall_repair_changed":"La géométrie des murs a changé. Essayez de créer de nouveau la pièce.","toast.opening_on_zero_wall":"Les ouvertures ne peuvent pas être placées sur un mur d’épaisseur nulle","marker.from_ha_option":"Choisir dans la liste HA","marker.show_entities":"Afficher les entités","marker.show_entities_tip":"Ajoute à la liste non seulement les appareils, mais aussi toutes leurs entités","marker.pick_ph":"Choisir un appareil…","room.open_area":"Ouvrir la zone HA","room.fit_action":"Ajuster la pièce {name}","view.volumetric":"Vue volumétrique","view.flat":"Vue plane","kiosk.title":"Tailles pour cet écran","kiosk.hint":"Enregistrées uniquement sur cet appareil — chaque tablette murale ou TV peut avoir ses propres tailles confortables.","kiosk.icon_scale":"Taille des icônes d’appareils","kiosk.font_scale":"Taille du texte des cartes de pièces","editor.kiosk":"Mode appareil mural (kiosque)","editor.cycle":"Changer automatiquement d’espace toutes les N secondes (kiosque, 0 = désactivé)","room.settings_title":"Paramètres de la pièce","room.settings_section":"Paramètres de la pièce (remplacent ceux de l’espace)","room.fill_label":"Remplissage de CETTE pièce","fill.inherit":"Comme l’espace","room.custom_fill_space":"Couleur de l’espace","room.custom_fill_own":"Couleur de la pièce","room.temp_range_label":"Plage de confort","room.temp_range_min":"Limite basse de température confortable","room.temp_range_max":"Limite haute de température confortable","room.temp_range_reset":"Comme l’espace","room.temp_range.help":"Cette plage s’applique uniquement à cette pièce. Un champ vide hérite de la limite correspondante de l’espace ; si les limites sont inversées, House Plan utilise la plus petite comme limite basse et la plus grande comme limite haute.","room.temp_range.help.aria":"À propos de la plage de confort de la pièce","room.temp_src_label":"Source de température","room.hum_src_label":"Source d’humidité","room.src_average":"Moyenne des capteurs de la pièce (par défaut)","room.src_pick":"Un appareil ou une entité HA spécifique","room.src_ph":"Choisir une source…","toast.room_updated":"Pièce mise à jour","space.card_font":"Taille de police des cartes de pièces (tout l’espace)","room.sizes_section":"Tailles de police","room.name_scale":"Taille du nom de la pièce","room.label_scale":"Taille des mesures","preview.room_name":"Salon","toast.cfg_reload_failed":"Impossible de recharger le plan depuis le serveur : {err}","toast.locale_load_failed":"Impossible de charger le pack de langue. L'anglais est utilisé jusqu'au rechargement de la page.","toast.furniture_art_load_failed":"Impossible de charger les dessins de meubles. Rechargez la page pour les afficher.","room.settings_short":"Paramètres de la pièce","room.unnamed":"Pièce sans nom","marker.use_climate_temp":"Inclure la température de l’appareil dans la pièce","marker.use_climate_temp_tip":"Ajoute la valeur current_temperature d’un climatiseur ou thermostat à la moyenne de la pièce. Configurez séparément le badge de valeur externe ci-dessous.","marker.value_badge_title":"Badge de valeur","marker.value_badge.help":"Affiche une valeur sélectionnée à côté de l’icône. Cela n’affecte pas les mesures de la pièce, la lumière, le halo ni l’action au toucher.","marker.value_badge.help.aria":"Aide : badge de valeur de l’appareil","marker.value_badge_enabled":"Afficher un badge de valeur","marker.value_badge_source":"Valeur","marker.value_badge_source.help":"Choisissez un état précis, un attribut pris en charge ou une valeur dérivée de cet appareil.","marker.value_badge_source.help.aria":"Aide : source du badge de valeur","marker.value_badge_position":"Position","marker.value_badge_position.help":"Le côté choisi reste fixe et ne bascule pas automatiquement au bord du plan.","marker.value_badge_position.help.aria":"Aide : position du badge de valeur","marker.value_badge_right":"À droite","marker.value_badge_bottom":"En dessous","marker.value_badge_left":"À gauche","marker.value_badge_top":"Au-dessus","marker.value_badge_empty":"Cet appareil n’a aucune valeur disponible","marker.value_badge_static":"Une icône statique n’affiche pas de valeurs en direct. Le paramètre est conservé.","marker.value_badge_missing":"Source indisponible","marker.value_badge_missing_hint":"La source enregistrée est actuellement indisponible. Conservez-la, désactivez le badge ou choisissez une autre valeur.","marker.value_badge_duplicate":"La même valeur est déjà affichée dans l’icône.","marker.value_badge_state":"État · {name}","marker.value_badge_marker_state":"État de la source lumineuse · {name}","marker.value_badge_lqi":"Qualité moyenne du signal Zigbee","marker.value_badge_attr_current_temperature":"Température actuelle · {name}","marker.value_badge_attr_temperature":"Température cible · {name}","marker.value_badge_attr_current_humidity":"Humidité actuelle · {name}","marker.value_badge_attr_humidity":"Humidité · {name}","marker.value_badge_attr_current_position":"Position · {name}","marker.value_badge_attr_percentage":"Vitesse · {name}","marker.value_badge_attr_brightness":"Luminosité · {name}","marker.value_badge_attr_volume_level":"Volume · {name}","marker.value_badge_attr_battery_level":"Batterie · {name}","marker.value_badge_attr_fan_speed":"Vitesse du ventilateur · {name}","marker.value_source":"Source de la valeur","marker.value_source.help":"Choisissez la valeur qui remplace l’icône. L’action au toucher ne change pas.","marker.value_source.help.aria":"Aide : source de la valeur dans le marqueur","marker.value_source_auto":"Automatique (comme avant)","marker.value_source_missing_hint":"La source enregistrée est indisponible. Le marqueur affiche — jusqu’à son retour ou jusqu’au choix d’une autre valeur.","marker.light_role_label":"Cet appareil est-il une source lumineuse ?","marker.light_role.help":"« Auto » utilise le rôle déterminé de l’appareil lié, « Toujours » force sa propre source et « Jamais » l’exclut ; les lumières liées ci-dessus restent indépendantes.","marker.light_role.help.aria":"Aide : cet appareil est-il une source lumineuse","marker.light_role_auto_yes":"Auto (source lumineuse)","marker.light_role_auto_no":"Auto (pas une source lumineuse)","marker.light_role_always":"Toujours une source lumineuse","marker.light_role_never":"Jamais une source lumineuse","marker.light_entity_label":"Entité lumineuse principale","marker.light_entity.help":"Pour un appareil composite, choisissez l’entité dont l’état, la couleur et la luminosité représentent cette source sur le plan. Le choix automatique reste compatible avec les anciens plans.","marker.light_entity.help.aria":"Aide : entité lumineuse principale","marker.light_entity_auto":"Automatique ({entity})","marker.light_entity_none":"aucune entité contrôlable","marker.light_entity_missing":"L’entité enregistrée {entity} est indisponible. House Plan utilise temporairement {fallback} ; le choix enregistré sera restauré si elle revient.","marker.toggle_entity_label":"Entité à basculer","marker.toggle_entity.help":"Pour un appareil composite, choisissez précisément la lumière ou l’interrupteur propre à actionner par un toucher. Automatique conserve les règles de cible précédentes et reste indépendant de l’entité lumineuse principale.","marker.toggle_entity.help.aria":"Aide : entité à basculer","marker.toggle_entity_auto":"Automatique ({entity})","marker.toggle_entity_none":"aucune entité propre contrôlable","marker.toggle_entity_missing":"L’entité enregistrée {entity} ne fait plus partie des canaux sélectionnables de ce marqueur. House Plan utilise temporairement {fallback} ; le choix enregistré sera restauré si elle revient.","marker.glow_color_label":"Couleur et luminosité du halo","marker.glow_mode.help":"Utilisez les valeurs en direct de la source, remplacez uniquement sa couleur ou fixez à la fois la couleur et la luminosité. Le minimum est 1 % ; pour désactiver la source, choisissez « Jamais ».","marker.glow_mode.help.aria":"Aide : couleur et luminosité du halo","marker.glow_mode_auto":"Depuis la source","marker.glow_mode_color":"Définir la couleur","marker.glow_mode_fixed":"Définir la couleur et la luminosité","marker.glow_color":"Couleur du halo","marker.glow_brightness":"Luminosité","marker.glow_disabled_never":"Les paramètres du halo sont indisponibles car ce marqueur est explicitement défini comme n’étant pas une source lumineuse.","marker.glow_disabled_auto":"Le mode Auto n’a trouvé aucune source lumineuse spatiale pour ce marqueur.","marker.glow_disabled_no_entity":"Aucune entité Home Assistant contrôlable et active n’est disponible pour cette source spatiale.","marker.glow_passive_hint":"Cette source ne possède aucune donnée Home Assistant propre. Définissez manuellement sa couleur et sa luminosité ; son rayon reste disponible.","marker.control_broken":"La source enregistrée est absente ou n’est plus marquée comme lumière","marker.control_missing_label":"Lumière du plan manquante","marker.control_passive":"source passive","toast.marker_control_cycle":"Ce lien créerait une chaîne circulaire de contrôles de lumière.","toast.marker_binding_required":"Choisissez un appareil Home Assistant avant de lier une autre source lumineuse.","confirm.unlock_title":"Déverrouiller ?","confirm.unlock_body":"House Plan enverra une commande de déverrouillage à cette serrure.","toast.files_migrate_failed":"Les pièces jointes n’ont pas pu être déplacées vers la nouvelle association ; les liens continuent de pointer vers les anciens fichiers : {err}","space.pick_saved":"Déjà importé","space.pick_saved_hint":"Plans stockés sur le serveur, y compris ceux que vous avez précédemment dissociés","space.no_saved":"Aucun plan n’est encore stocké sur le serveur.","space.loading":"Chargement…","space.used_by":"utilisé par : {list}","space.in_use":"Un espace utilise encore ce plan — dissociez-le d’abord","btn.use":"Utiliser","confirm.delete_plan_title":"Supprimer le fichier du plan ?","confirm.delete_plan_body":"Le fichier sera supprimé du serveur. Cette action est irréversible.","toast.plans_list_failed":"Impossible de lister les plans stockés : {err}","toast.plan_delete_failed":"Impossible de supprimer le plan : {err}","marker.hide":"Masquer","marker.hide_tip":"L’appareil disparaîtra du plan après l’enregistrement mais continuera de compter dans le signal de la pièce. Restaurez-le via « Masqués et désactivés » dans l’éditeur d’appareils.","marker.show":"Afficher","marker.show_tip":"L’appareil apparaîtra de nouveau sur le plan après l’enregistrement.","marker.hidden_ghost":"Appareil masqué par l’utilisateur","marker.ha_disabled_device":"L’appareil est désactivé dans Home Assistant et masqué du plan.","marker.ha_disabled_entity":"L’entité est désactivée dans Home Assistant et masquée du plan.","marker.ha_disabled_all_entities":"L’appareil n’a aucune entité Home Assistant active ; il est donc masqué du plan.","marker.ha_registry_limited":"Le registre Home Assistant complet n’est pas accessible à cet utilisateur. L’objet non vérifié ne peut pas être affiché ni utilisé pour le moment.","marker.delete_tip":"Supprimer complètement l’appareil du plan et de tous les agrégats. Vous pourrez l’ajouter de nouveau plus tard.","tap.run":"Exécuter une automatisation/un script/une scène","tap.none":"Ne rien faire","marker.run_target_label":"Élément à exécuter","marker.run_search_ph":"Rechercher : automatisation, script ou scène…","marker.run_target_gone":"Cible {id} introuvable — choisissez-en une autre","marker.tap_confirm":"Demander une confirmation","marker.tap_confirm_tip":"Afficher une boîte de dialogue de confirmation avant l’action — protection contre les appuis accidentels.","marker.toggle_hint_single":"Cible : {name} ({id}).","marker.virtual_light_target":"Lumière virtuelle : {name}.","marker.virtual_light_current":"État manuel : {state} → {effect}.","marker.virtual_light_state_on":"allumé","marker.virtual_light_state_off":"éteint","marker.toggle_hint_group":"Basculera {count} source(s) : {names}.","marker.toggle_hint_current":"Actuellement : {state} → {effect}.","marker.toggle_hint_group_current":"Actuellement allumées : {on} sur {count} → {effect}.","marker.toggle_hint_skipped":"Seront ignorées ({count}) : {targets}.","marker.toggle_effect_turn_on":"sera allumé","marker.toggle_effect_turn_off":"sera éteint","marker.toggle_effect_open":"sera ouvert","marker.toggle_effect_close":"sera fermé","marker.toggle_effect_stop":"sera arrêté","marker.toggle_effect_toggle":"l’état sera basculé","marker.toggle_skip_missing":"introuvable","marker.toggle_skip_ha_disabled":"désactivé dans HA","marker.toggle_skip_unavailable":"indisponible","marker.toggle_skip_unsupported":"basculement non pris en charge","marker.toggle_skip_secure":"bloqué pour des raisons de sécurité","marker.toggle_none_no_binding":"Cet appareil n’a aucune association ; il n’y a donc aucun état à basculer. Un toucher ne fera rien.","marker.toggle_none_no_actionable_entity":"Cet appareil n’a aucun état pouvant être basculé. Un toucher ne fera rien.","marker.toggle_none_configured_targets_missing":"Les cibles configurées sont indisponibles. L’entité propre de l’appareil ne leur sera pas substituée.","marker.toggle_none_ha_disabled":"La cible est désactivée dans Home Assistant et ne peut pas être utilisée sur le plan.","marker.toggle_none_unavailable":"La cible est actuellement indisponible. Un toucher ne fera rien.","marker.toggle_none_unsupported":"Home Assistant n’expose aucune opération de basculement sûre pour cette entité. Un toucher ne fera rien.","marker.toggle_none_secure":"Le basculement des serrures, alarmes et portails sécurisés depuis le plan est bloqué pour des raisons de sécurité.","run.automation":"automatisation","run.script":"script","run.scene":"scène","confirm.tap_run":"Exécuter « {name} » ?","confirm.tap_toggle":"Basculer « {name} » ?","confirm.current_state":"État actuel : {state}","confirm.expected_state":"Après basculement : {state}","confirm.group_current":"{on} allumé(s) sur {total}","confirm.group_all_on":"tout est allumé","confirm.group_all_off":"tout est éteint","confirm.unavailable_targets":"Indisponibles : {count}","confirm.expected_by_ha":"Home Assistant déterminera l’état","confirm.state_on":"Allumé","confirm.state_off":"Éteint","confirm.state_open":"Ouvert","confirm.state_closed":"Fermé","confirm.state_opening":"Ouverture en cours","confirm.state_closing":"Fermeture en cours","confirm.state_stopped":"Arrêté","confirm.state_unknown":"Inconnu","toast.run_started":"Démarré : {name}","toast.run_target_missing":"Cible d’exécution introuvable — vérifiez les paramètres de l’appareil","toast.run_target_required":"Choisissez une automatisation, un script ou une scène","toast.tap_target_changed":"La cible de l’action a changé. Réessayez.","toast.virtual_light_toggle_failed":"Impossible de basculer la lumière virtuelle : {err}","toast.value_badge_source_required":"Choisissez une valeur pour le badge","btn.run":"Exécuter","vac.section":"Robot aspirateur : position en direct","vac.autocal":"Configurer automatiquement","vac.live":"Position en direct sur le plan","vac.trail":"Afficher le trajet du robot","vac.autocal_no_rooms":"L’intégration ne fournit aucune liste de pièces — ouvrez « Ajuster manuellement »","vac.route_warn_unmapped":"Le robot nettoie une carte qui n'est assignée à aucun étage","vac.route_warn_needs_calibration":"La carte est assignée à un étage mais n'est pas calibrée","vac.route_warn_ambiguous":"Deux cartes sont indiscernables — aucun étage choisi","vac.route_warn_missing_space":"L'espace de cette carte a été supprimé","vac.autocal_no_match":"Les noms de pièces ne correspondent pas (il en faut ≥3 en commun) — ouvrez « Ajuster manuellement »","vac.autocal_done":"Terminé : association via {rooms} pièces. Lancez un nettoyage et vérifiez","vac.cal_need_pos":"Le robot ne transmet pas de coordonnées — lancez un nettoyage puis mettez-le en pause","vac.cal_done":"Calibration enregistrée. Lancez un nettoyage et vérifiez","vac.cal_cancelled":"Calibration annulée","vac.fit":"Ajuster manuellement","vac.fit_hint":"Faites glisser la carte du robot pour la positionner, étirez-la par les coins","vac.fit_rotate":"Rotation de 90°","vac.fit_mirror":"Miroir","vac.trail_never":"Jamais","vac.trail_cleaning":"Pendant le nettoyage","vac.trail_always":"Toujours","gs.bg_group":"Arrière-plan de la scène","gs.bg_color":"Arrière-plan autour du plan","gs.bg_default":"Valeur par défaut du thème","gs.bg_theme":"valeur par défaut du thème","gs.bg_mode":"Arrière-plan du plan","gs.bg_mode.help":"« Suit le soleil » utilise sun.sun ou, à défaut, l’heure locale du navigateur ; « Couleur statique » affiche toujours la couleur choisie.","gs.bg_mode.help.aria":"Aide : arrière-plan général du plan","gs.bg_static":"Couleur statique","gs.bg_daynight":"Suit le soleil","gs.sun_group":"Soleil","gs.sun_missing":"L’entité sun.sun est introuvable — l’arrière-plan suit votre heure locale ; les rayons de soleil par les fenêtres sont indisponibles.","gs.north":"Nord sur le plan","gs.north.help":"L’angle se mesure dans le sens horaire depuis la verticale supérieure du plan ; le nord sert aux rayons des fenêtres, pas à l’arrière-plan « Suit le soleil ».","gs.north.help.aria":"Aide : direction générale du nord","gs.north_ph":"non défini","gs.north_clear":"Effacer","gs.north_letter":"N","gs.sun_rays":"Lumière du soleil à travers les fenêtres","gs.about_version":"Houseplan Card v{v}","gs.about_github":"GitHub · documentation et problèmes","gs.about_telegram":"Discussion Telegram","support.title":"Aide et commentaires","space.bg_color":"Arrière-plan autour du plan","space.bg_inherit":"Hériter des paramètres généraux","space.bg_inherited":"hérite des paramètres généraux","space.bg_mode":"Arrière-plan du plan","space.bg_mode.help":"Héritez de l’arrière-plan général ou remplacez-le pour cet espace par une couleur statique ou le mode « Suit le soleil ».","space.bg_mode.help.aria":"Aide : arrière-plan de l’espace","space.north":"Nord sur le plan (remplacement)","space.north.help":"Remplace le nord général pour cet espace ; l’angle se mesure dans le sens horaire depuis la verticale supérieure du plan et sert aux rayons des fenêtres.","space.north.help.aria":"Aide : nord de cet espace","space.north_inherited":"hérité : {v}","space.sun_rays":"Lumière du soleil à travers les fenêtres","space.sun_inherit":"Hériter des paramètres généraux","space.sun_on":"Activé","space.sun_off":"Désactivé","canvas.far_objects":"{n} objet(s) éloigné(s) du plan","canvas.show_far":"Afficher","canvas.home_tip":"Le plan est là-bas — cliquez pour l’ajuster à l’écran","gs.grid_group":"Maintenance du plan","gs.grid_hint":"Met à jour les modèles de données, aligne les éléments du plan sur la grille et fusionne les fragments de murs redondants. Un rapport précis est affiché avant tout enregistrement.","gs.align_all":"Optimiser les plans","gs.align_title":"Optimiser les plans","gs.align_none":"Tous les plans utilisent déjà le modèle de données optimisé actuel.","gs.optimize_no_automatic_changes":"Aucune modification automatique n’est à appliquer. Vérifiez les éléments ci-dessous.","gs.align_count":"{n} élément(s) sur {total} seront déplacés, de {cm} cm au maximum.","gs.align_where":"Le plus grand déplacement se trouve dans « {s} ».","gs.align_turned":"Ouvertures dont l’angle est corrigé : {n}.","gs.align_preflight_failed":"Impossible de vérifier en toute sécurité la géométrie des espaces suivants : {spaces}{more}.","gs.align_preflight_hint":"Les plans n’ont pas été modifiés. Copiez les diagnostics avec le bouton ci-dessous et joignez-les au rapport de bug avec un export de l’espace.","gs.preflight_reason_prepare-exception":"Impossible de préparer la géométrie de l’espace (exception lors de la construction du modèle)","gs.preflight_reason_wall-null":"Le corps du mur n’a pas pu être construit (l’union a renvoyé un résultat vide)","gs.preflight_reason_wall-degraded-extra":"Le corps du mur s’est dégradé avec une géométrie supplémentaire","gs.preflight_reason_wall-failed-core":"Le noyau du corps du mur n’a pas pu être assemblé","gs.preflight_reason_wall-exception":"La construction du mur a déclenché une exception","gs.preflight_reason_floor-null":"Le contour du sol n’a pas pu être construit","gs.preflight_reason_floor-exception":"La construction du sol a déclenché une exception","gs.preflight_copy":"Copier les diagnostics","gs.preflight_copied":"Diagnostics copiés","gs.preflight_update_hint":"Les versions de la carte et de l’intégration diffèrent — mettez House Plan à jour puis réessayez.","gs.align_preflight_space":"Espace {n}","gs.align_preflight_more":", et {n} de plus","gs.optimize_changes":"Migrations de modèle : {m} ; espaces mis à jour : {c} ; valeurs de coordonnées parasites supprimées : {p} ; fragments de murs réels fusionnés : {w} ; fragments de murs d’épaisseur nulle fusionnés : {s} ; murs indépendants : {i}.","gs.zero_walls_migrated":"Portions de murs virtuels converties : {n}.","gs.wall_segments_migrated":"Segments de murs stabilisés : {n}.","gs.room_drafts_migrated":"Contours inachevés convertis en murs ordinaires : {drafts} ; segments : {segments}.","gs.optimize_lattice_summary":"Valeurs de coordonnées parasites normalisées : {n} ; déplacement maximal : {cm} cm.","gs.optimize_lattice_space":"{space} : valeurs de coordonnées normalisées : {n} ; valeurs hors grille laissées inchangées : {far}.","gs.optimize_coincident_partitions":"Sections de murs indépendants masquées absorbées dans les murs des pièces : {n}.","gs.optimize_openings_rehosted":"Ouvertures rattachées aux murs des pièces : {n}.","gs.optimize_walls_straightened":"Murs redressés : {n} ; déplacement maximal : {cm} cm.","gs.optimize_walls_straightened_where":"Plus grande correction de mur : {s}.","gs.optimize_walls_straighten_skipped":"Murs proches d’un axe laissés inchangés car ils ne pouvaient pas être réparés en toute sécurité : {n}.","gs.optimize_glow_migration":"Ancien mode Glow : {spaces} espaces → aucun remplissage de données + Glow indépendant ; {rooms} pièces → remplissage de données hérité + Glow indépendant.","gs.optimize_references":"Références réparées : espaces — {spaces} ; pièces — {rooms} ; positions — {positions} ; appareils dissociés des espaces manquants — {detached}.","gs.optimize_reference_more":", et {n} de plus","gs.optimize_orphans_removed":"Enregistrements oubliés supprimés : {total} — étiquettes de pièces : {rooms} ; appareils : {devices} ; marqueurs de groupe : {groups}. Ils appartenaient à des espaces supprimés précédemment.","gs.optimize_live_positions":"Anciennes positions dans des espaces supprimés appartenant à des objets existants : {n}{names}. Elles seront conservées.","gs.optimize_live_positions_remove":"Anciennes positions dans des espaces supprimés appartenant à des objets existants : {n}{names}. Elles sont sélectionnées pour suppression.","gs.optimize_live_names":" : {names}{more}","gs.optimize_live_remove":"Supprimer les anciennes positions","gs.optimize_live_keep":"Conserver les anciennes positions","gs.optimize_live_selected":"Les anciennes positions seront supprimées après l’application de l’optimisation.","gs.optimize_unverified":"Impossible de vérifier en toute sécurité les positions : {n}. Elles ont été laissées inchangées.","gs.optimize_registry_limited":"Un accès administrateur complet aux registres Home Assistant est requis pour une vérification sûre.","gs.optimize_vacuum_warning":"Associations de pièces d’aspirateur nécessitant encore une vérification : {n}.","gs.optimize_details":"Détails","gs.optimize_details_more":"Et {n} enregistrement(s) de plus.","gs.optimize_detail_removed":"sera supprimé","gs.optimize_detail_live":"sera conservé","gs.optimize_detail_unverified":"non vérifié","gs.optimize_detail_room_label":"étiquette de pièce","gs.optimize_detail_device":"appareil","gs.optimize_detail_group":"marqueur de groupe","gs.optimize_detail_unknown":"propriétaire inconnu","gs.optimize_detail_item":"{status} : {kind} {id} ; ancien espace {space}","gs.align_warn":"Les éléments volontairement placés entre les nœuds de la grille seront déplacés. Une seule annulation est disponible après l’opération, uniquement jusqu’à la prochaine modification du plan.","gs.align_run":"Optimiser","gs.align_done":"Plans optimisés : {n} élément(s) déplacé(s), {m} enregistrement(s) maintenu(s), {r} référence(s) réparée(s)","gs.optimize_undo":"Annuler la dernière optimisation","gs.optimize_undone":"La dernière optimisation a été annulée","decor.furniture":"Mobilier","decor.image":"Image","decor.image_title":"Images personnalisées","decor.image_upload":"Importer une image","decor.image_replace":"Remplacer l’image","decor.image_uploading":"Importation…","decor.image_asset":"Fichier image","decor.image_pick_hint":"Importez une image ou choisissez-en une existante.","decor.image_place_hint":"Cliquez sur le plan pour placer l’image.","decor.image_none":"Aucune image importée pour le moment.","decor.image_unavailable":"Image indisponible","decor.image_used":"Utilisée dans {n} objets","decor.image_upload_failed":"Impossible d’importer l’image : {err}","decor.image_error_capacity":"Le stockage des images personnalisées est plein.","decor.image_in_use":"Supprimez toutes les copies placées avant ce fichier.","decor.image_delete_title":"Supprimer le fichier image ?","decor.image_delete_message":"Supprimer « {name} » de House Plan ? Cette action est irréversible.","furn.title":"Bibliothèque de mobilier","furn.symbol":"Symbole","furn.group_furniture":"Mobilier","furn.group_appliance":"Électroménager","furn.group_sanitary":"Sanitaires","furn.group_other":"Autre","furn.width":"Largeur","furn.depth":"Profondeur","furn.back_to_categories":"Toutes les catégories","furn.pick_hint":"Choisissez un symbole, puis cliquez sur le plan.","furn.place_hint":"Cliquez sur le plan — le meuble se place contre le mur le plus proche. Maj permet un placement libre.","furn.cat_air_conditioner":"Climatiseurs","furn.cat_armchair":"Fauteuils","furn.cat_bathtub":"Baignoires","furn.cat_bed":"Lits","furn.cat_bidet":"Bidets","furn.cat_boiler":"Chauffe-eau","furn.cat_chair":"Chaises","furn.cat_coffee_table":"Tables basses","furn.cat_cooktop":"Plaques de cuisson","furn.cat_dining_table":"Tables à manger","furn.cat_dishwasher":"Lave-vaisselle","furn.cat_dryer":"Sèche-linge","furn.cat_fireplace":"Cheminées","furn.cat_fridge":"Réfrigérateurs","furn.cat_kitchen_cabinet":"Meubles de cuisine","furn.cat_kitchen_sink":"Éviers de cuisine","furn.cat_nightstand":"Meubles","furn.cat_plant":"Plantes","furn.cat_rug":"Tapis","furn.cat_shelving":"Étagères","furn.cat_shower":"Douches","furn.cat_sink":"Lavabos","furn.cat_sofa":"Canapés","furn.cat_stairs":"Escaliers","furn.cat_toilet":"Toilettes","furn.cat_tv":"Téléviseurs","furn.cat_wardrobe":"Armoires","furn.cat_washer":"Lave-linge","furn.cat_work_table":"Bureaux","furn.sym_sofa":"Canapé","furn.sym_sofa_three_seat":"Canapé trois places","furn.sym_sofa_corner_right":"Canapé d'angle droit","furn.sym_armchair":"Fauteuil","furn.sym_armchair_office":"Chaise de bureau","furn.sym_coffee_table":"Table basse","furn.sym_coffee_table_round":"Table basse ronde","furn.sym_coffee_table_oval":"Table basse ovale","furn.sym_coffee_table_rounded":"Table basse arrondie","furn.sym_table_dining":"Table à manger","furn.sym_table_round":"Table ronde","furn.sym_table_dining_oval":"Table à manger ovale","furn.sym_table_dining_rounded":"Table à manger arrondie","furn.sym_chair":"Chaise","furn.sym_chair_bar":"Tabouret de bar","furn.sym_desk":"Bureau","furn.sym_desk_corner":"Bureau d'angle","furn.sym_bed_double":"Lit double","furn.sym_bed_single":"Lit simple","furn.sym_nightstand":"Table de chevet","furn.sym_cabinet_tv":"Meuble TV","furn.sym_cabinet_shoe":"Meuble à chaussures","furn.sym_cabinet_sink":"Meuble sous lavabo","furn.sym_wardrobe":"Armoire","furn.sym_bookshelf":"Bibliothèque","furn.sym_wall_unit":"Élément mural","furn.sym_kitchen_floor":"Module de cuisine bas","furn.sym_kitchen_floor_corner":"Module de cuisine bas d'angle","furn.sym_kitchen_wall":"Module de cuisine haut","furn.sym_kitchen_wall_corner":"Module de cuisine haut d'angle","furn.sym_shelf_floor":"Étagère au sol","furn.sym_shelf_wall":"Étagère murale","furn.sym_fridge":"Réfrigérateur","furn.sym_stove":"Cuisinière","furn.sym_cooktop_two":"Plaque à deux feux","furn.sym_dishwasher":"Lave-vaisselle","furn.sym_washer":"Lave-linge","furn.sym_dryer":"Sèche-linge","furn.sym_tv":"Téléviseur","furn.sym_tv_wall":"Téléviseur mural","furn.sym_ac":"Climatiseur","furn.sym_water_heater":"Chauffe-eau","furn.sym_toilet":"Toilettes","furn.sym_toilet_built_in":"Toilettes suspendues","furn.sym_bathtub":"Baignoire","furn.sym_bathtub_corner":"Baignoire d'angle","furn.sym_shower":"Douche","furn.sym_sink":"Lavabo","furn.sym_kitchen_sink":"Évier de cuisine","furn.sym_kitchen_sink_double":"Évier de cuisine double","furn.sym_bidet":"Bidet","furn.sym_bidet_built_in":"Bidet suspendu","furn.sym_stairs":"Escalier","furn.sym_fireplace":"Cheminée","furn.sym_plant":"Plante","furn.sym_rug":"Tapis","common.yes":"Oui","common.no":"Non","vac.diag_source":"Source","vac.diag_platform":"Intégration","vac.diag_status":"État","vac.diag_position":"Position","vac.diag_rooms":"Pièces","vac.diag_rooms_value":"{total} · {matched} noms correspondent · {readiness}","vac.autocal_ready":"calibration automatique disponible","vac.autocal_not_ready":"3 noms correspondants requis","vac.diag_path":"Chemin de l’intégration","vac.diag_map":"ID de carte","vac.source_none":"non sélectionné","vac.source_status_ok":"Prêt","vac.source_status_missing":"Manquant","vac.source_status_disabled":"Désactivé dans Home Assistant","vac.source_status_unavailable":"Indisponible","vac.source_status_unverified":"Impossible à vérifier avec les autorisations actuelles","vac.source_status_unsupported":"Aucune donnée de position","vac.source_status_none":"Aucune source","vac.source_banner_missing":"La source enregistrée n’existe plus. Elle n’a pas été remplacée automatiquement ; choisissez une autre source ou restaurez-la dans Home Assistant.","vac.source_banner_disabled":"La source enregistrée est désactivée dans Home Assistant. Activez-la ou choisissez une autre source.","vac.source_banner_unverified":"Les autorisations Home Assistant actuelles ne permettent pas de vérifier cette source enregistrée. Elle reste épinglée et ne sera pas remplacée automatiquement.","vac.choose_source":"Choisir la source","vac.source_auto":"Automatique","vac.source_auto_hint":"Utiliser une entité compatible de cet appareil","vac.all_cameras":"Toutes les caméras","vac.all_cameras_warn":"Une caméra peut ne pas fournir de données du robot. Choisissez-en une uniquement s’il s’agit de la carte de votre aspirateur.","vac.all_cameras_empty":"Aucune autre entité caméra trouvée.","vac.platform_unknown":"intégration inconnue","vac.cap_position":"position","vac.cap_rooms_short":"pièces","vac.cap_path":"trajet","vac.cap_map":"ID de carte","vac.cap_none":"aucune donnée de robot détectée","vac.xcme_hint":"Activez ces attributs Xiaomi Cloud Map Extractor :","vac.documentation":"Documentation","vac.residual_title":"Vérifier la calibration automatique","vac.residual_message":"Les pièces correspondantes présentent un écart maximal de {error}. Appliquez cette calibration approximative, affinez-la manuellement ou annulez sans modifier la configuration enregistrée.","vac.apply_proposal":"Appliquer","gs.backup_group":"Sauvegarde et transfert","gs.backup_hint":"Téléchargez une sauvegarde JSON portable ou prévisualisez et importez une sauvegarde créée par House Plan.","backup.export_open":"Exporter","backup.import_open":"Importer","backup.export_title":"Exporter House Plan","backup.import_title":"Importer House Plan","backup.export_hint":"Choisissez si la sauvegarde doit contenir toute la configuration House Plan ou uniquement l’espace actuel.","backup.full":"Sauvegarde complète","backup.current_space":"Espace actuel","backup.current_space_title":"Espace actuel : {title}","backup.no_current_space":"Aucun espace actuel","backup.plan_only":"Plan uniquement","backup.plan_only_hint":"Conserver les pièces, murs, ouvertures, décorations et positions des étiquettes de pièces sans les appareils ni les associations Home Assistant.","backup.plan_only_preview":"Ce fichier contient uniquement le plan","backup.privacy_warning":"L’archive conserve les noms, identifiants Home Assistant et coordonnées exactes. Les plans internes et pièces jointes sont référencés, pas intégrés ; les états d’exécution et trajets d’aspirateur ne sont pas inclus.","backup.download":"Télécharger le JSON","backup.export_done":"Sauvegarde téléchargée","backup.reading":"Vérification de la sauvegarde…","backup.revalidated":"Le plan a changé depuis cet aperçu. Le résumé a été actualisé ; vérifiez-le et confirmez de nouveau.","backup.error.support_invalid_message":"Vérifiez le message d’assistance et réessayez.","backup.error.support_package_too_large":"Le paquet d’assistance anonymisé dépasse la limite de 8 Mio.","backup.error.support_preview_expired":"L’aperçu de la pièce jointe d’assistance a expiré ou n’est plus disponible.","backup.error.support_rate_limited":"Trop de rapports ou d’aperçus d’assistance ont été demandés. Réessayez plus tard.","backup.error.support_rejected":"Le rapport n’a pas passé la validation du service d’assistance.","backup.error.support_unavailable":"Le service d’assistance privé est temporairement indisponible.","backup.error.unauthorized":"Vous n’avez pas l’autorisation d’exporter ou d’importer ce plan.","backup.error.not_ready":"House Plan n’est pas encore prêt. Réessayez dans un instant.","backup.error.too_large":"La sauvegarde dépasse la limite de 8 Mio.","backup.error.invalid_json":"Le fichier sélectionné n’est pas un JSON valide.","backup.error.invalid_format":"Le fichier sélectionné n’est pas une sauvegarde House Plan.","backup.error.invalid_image":"L’image est endommagée ou ne correspond pas à son format.","backup.error.unsupported_export_version":"Ce format de sauvegarde n’est pas pris en charge par la version installée.","backup.error.unsupported_image":"Utilisez une image PNG, JPEG, WebP ou SVG prise en charge.","backup.error.future_model":"La sauvegarde a été créée avec un modèle de données House Plan plus récent.","backup.error.invalid_config":"La sauvegarde contient une configuration House Plan invalide.","backup.error.wall_model_migration_blocked":"Le modèle de murs de la sauvegarde n’a pas pu être mis à niveau en toute sécurité. Optimisez d’abord le plan source, puis exportez-le de nouveau.","backup.error.invalid_layout":"La sauvegarde contient des positions d’objets invalides.","backup.error.invalid_content":"La sauvegarde contient des références de contenu invalides ou incohérentes.","backup.error.space_not_found":"L’espace sélectionné n’existe plus.","backup.error.capacity_exceeded":"L’ajout de cette sauvegarde dépasserait les limites du plan.","backup.error.preview_expired":"L’aperçu a expiré. Sélectionnez de nouveau le fichier de sauvegarde.","backup.error.preview_owner_mismatch":"Cet aperçu appartient à un autre utilisateur Home Assistant.","backup.error.conflict":"Le plan a changé depuis l’aperçu. Vérifiez le résumé actualisé.","backup.error.content_confirmation_required":"Confirmez que le contenu local indisponible peut être dissocié.","backup.error.commit_failed":"La sauvegarde n’a pas pu être appliquée en toute sécurité. Le plan précédent a été restauré ou est en attente de récupération.","backup.error.missing_plan":"Un fichier de plan référencé a disparu depuis l’aperçu. Vérifiez de nouveau la sauvegarde.","backup.error.missing_content":"Une pièce jointe locale référencée a disparu depuis l’aperçu. Vérifiez de nouveau la sauvegarde.","backup.error.marker_control_missing":"Une lumière liée au plan est absente de la sauvegarde.","backup.error.marker_control_not_light":"Une cible liée au plan n’est plus marquée comme source lumineuse.","backup.error.marker_control_self":"Une source lumineuse ne peut pas se contrôler elle-même.","backup.error.marker_control_cycle":"La sauvegarde contient une chaîne circulaire de contrôles de lumière.","backup.error.duplicate_marker_control":"La sauvegarde contient un lien de lumière du plan en doublon.","backup.error.no_backup":"Aucun instantané d’importation ou d’optimisation n’est disponible à restaurer.","backup.error.in_use":"L'élément est encore utilisé","backup.error.invalid_data":"La requête contient des données invalides","backup.error.invalid_light_entity":"La lumière principale doit être une entité light.* ou switch.*","backup.error.invalid_marker_control":"Référence de contrôle de marqueur invalide","backup.error.invalid_name":"Le nom est invalide","backup.error.invalid_partition_opening_host":"L'ouverture doit conserver sa cloison porteuse","backup.error.invalid_partition_opening_jamb_margin":"L'ouverture ne laisse aucun jambage physique au bout du mur","backup.error.invalid_passage_fields":"Un passage ouvert ne peut pas porter de réglages de porte","backup.error.invalid_space_id":"Espace inconnu","backup.error.invalid_toggle_entity":"L'entité de bascule doit être light.* ou switch.*","backup.error.invalid_value_badge":"Réglages de badge de valeur invalides","backup.error.invalid_value_badge_attribute":"Attribut de badge de valeur invalide","backup.error.invalid_value_badge_position":"Position de badge de valeur invalide","backup.error.invalid_value_badge_source":"Source de badge de valeur invalide","backup.error.invalid_vacuum_map_route":"Vérifiez l'affectation des cartes du robot aux espaces.","backup.error.invalid_value_source":"Source de valeur invalide","backup.error.invalid_value_source_attribute":"Attribut de source de valeur invalide","backup.error.io_error":"Une opération de fichier a échoué sur le serveur","backup.error.not_toggleable":"Cet appareil ne peut pas être basculé","backup.error.nothing_to_repair":"Rien à réparer","backup.error.space_in_use":"L'espace est encore référencé","backup.error.value_badge_source_required":"Le badge de valeur nécessite une source","backup.error.wall_model_client_outdated":"Le plan a été mis à jour ailleurs — rechargez la page","backup.same_source":"Créée sur cette instance Home Assistant","backup.foreign_source":"Créée sur une autre instance Home Assistant","backup.created":"Créée : {value}","backup.versions":"Carte {card} ; intégration {integration} ; modèle de données {model}","backup.count_spaces":"Espaces : {n}","backup.count_rooms":"Pièces : {n}","backup.count_walls":"Murs : {n}","backup.count_openings":"Ouvertures : {n}","backup.count_decor":"Objets décoratifs : {n}","backup.count_markers":"Appareils : {n}","backup.count_layout":"Positions : {n}","backup.bindings":"Associations — appareils : {device}, entités : {entity}, virtuels : {virtual} ; positions sans espace : {legacy}","backup.binding_status":"État des cibles — actives : {active}, désactivées : {disabled}, manquantes : {missing}","backup.missing_areas":"Zones absentes sur la cible : {areas}","backup.dropped_marker_links":"Liens de lumières du plan hors de cet espace transféré omis : {n}.","backup.room_drafts_migrated":"Anciens contours inachevés convertis en murs ordinaires : {drafts} ; segments : {segments}.","backup.repaired_target_refs":"Références existantes restaurées par cet import d’espace : {n}.","backup.preserved_unresolved_refs":"Références qui n’ont pas pu être restaurées sans ambiguïté conservées : {n}.","backup.preserved_unresolved_hint":"Aucune donnée n’a été devinée ni supprimée. Après l’importation, lancez « Optimiser les plans » pour examiner les références restantes.","backup.import_details":"Détails des références d’importation","backup.import_detail.incoming_remapped":"Références mises à jour dans la copie importée : {n}","backup.import_detail.target_repaired":"Références existantes restaurées : {n}","backup.import_detail.preserved_unresolved":"Références non résolues conservées : {n}","backup.import_detail.collisions":"Conflits de destination conservés en toute sécurité : {n}","backup.import_detail.dropped_links":"Liens entrants omis selon les règles de transfert : {n}","backup.import_detail.bounded_lineages":"Identifiants trop imbriqués maintenus dans les limites : {n}","backup.replace_warning":"Cela remplace la configuration et la disposition actuelles. Les fichiers importés ne sont jamais supprimés. Une seule annulation reste disponible jusqu’à la prochaine modification du plan.","backup.foreign_bookkeeping":"Les données de suivi des appareils connus/nouveaux propres à l’instance ne seront pas importées.","backup.final_name":"Nom du nouvel espace","backup.target_settings":"Les paramètres généraux de l’instance cible restent inchangés.","backup.duplicates":"Associations déjà présentes : {n}","backup.skip":"Ignorer les appareils en doublon","backup.virtual_copy":"Ajouter des copies virtuelles statiques sûres","backup.content":"Contenu référencé","backup.decor_images_summary":"Images personnalisées : {objects} objets, {assets} fichiers ; fichiers absents : {missing}.","backup.content_available":"disponible localement","backup.content_external":"lien externe","backup.content_detach_required":"sera dissocié","backup.confirm_detach":"Je comprends que les plans internes et pièces jointes indisponibles seront dissociés de la configuration importée.","backup.confirm_missing_images":"Je comprends que les images personnalisées absentes resteront des espaces réservés réparables et que les autres fichiers locaux indisponibles seront dissociés.","backup.replace":"Remplacer","backup.add":"Ajouter un espace","backup.space_done":"Espace importé : {rooms} pièces, {markers} appareils, {refs} références existantes restaurées","backup.full_done":"Sauvegarde restaurée : {spaces} espaces, {rooms} pièces, {markers} appareils","backup.undo_import":"Annuler la dernière importation complète","backup.import_undone":"Importation complète annulée","backdrop.large_title":"Grande image","backdrop.large_body":"Cette image fait {w}×{h} (fichier de {fileMb} Mo) et nécessite environ {decodedMb} Mo de mémoire pour s'afficher. Sur tablette, cela peut faire planter la page.","backdrop.unknown_body":"Les dimensions de l'image n'ont pas pu être lues — le fichier est peut-être endommagé. Continuer peut faire planter la page sur tablette.","backdrop.reduced_dimensions":"Copie réduite : {w}×{h} px.","backdrop.use_downscaled":"Téléverser une copie réduite","backdrop.reducing":"Réduction…","backdrop.keep_original":"Conserver l'original","backdrop.too_large_title":"Image trop grande","backdrop.too_large_body":"Cette image dépasse ce que les navigateurs peuvent afficher ({w}×{h}, limite {limit} px par côté). Réduisez-la dans un éditeur de bureau puis téléversez-la à nouveau.","backdrop.downscale_failed":"Impossible de créer la copie réduite. Le plan actuel n'a pas été modifié."};const r="012abf4b3924ad03971870eb8085ab1ac1a66b0d9b6676fe095285a8b0f201ab";export{e as dictionary,r as fingerprint}; diff --git a/dist/houseplan-assets/furniture-plan-art.generated-CrvWoAvu.js b/custom_components/houseplan/frontend/houseplan-assets/furniture-plan-art.generated-C_WDX48s.js similarity index 99% rename from dist/houseplan-assets/furniture-plan-art.generated-CrvWoAvu.js rename to custom_components/houseplan/frontend/houseplan-assets/furniture-plan-art.generated-C_WDX48s.js index c00ad590..3711f59a 100644 --- a/dist/houseplan-assets/furniture-plan-art.generated-CrvWoAvu.js +++ b/custom_components/houseplan/frontend/houseplan-assets/furniture-plan-art.generated-C_WDX48s.js @@ -1 +1 @@ -globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae33533bdef7216a6d7d513ae04091";const c="74cbeb9792716ab64cfbcf339d3044c6e8ae33533bdef7216a6d7d513ae04091",a={coffee_table:{d:"M3.84 5.884c0-1.21 1.048-2.192 2.34-2.192h107.64c1.293 0 2.34.981 2.34 2.192v48.23c0 1.212-1.047 2.193-2.34 2.193H6.18c-1.292 0-2.34-.981-2.34-2.192z M103.056 15.093V9.83a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877m0 35.078v-5.262a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877m-93.6-35.077V9.83a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877m0 35.078v-5.262a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877",viewW:120,viewH:60},coffee_table_round:{d:"M3.765 40a36.235 36.235 0 1 0 72.47 0 36.235 36.235 0 1 0-72.47 0 m56.26 26.96-3.843-3.843a.906.906 0 0 1 0-1.28l3.843-3.844a.906.906 0 0 1 1.281 0l3.844 3.843a.906.906 0 0 1 0 1.281l-3.844 3.844a.906.906 0 0 1-1.28 0m-.001 34.66-3.843-3.843a.906.906 0 0 1 0-1.281l3.843-3.844a.906.906 0 0 1 1.281 0l3.843 3.844a.906.906 0 0 1 0 1.28l-3.843 3.844a.906.906 0 0 1-1.281 0m-34.423-34.66-3.843-3.843a.906.906 0 0 1 0-1.281l3.843-3.844a.906.906 0 0 1 1.281 0l3.844 3.844a.906.906 0 0 1 0 1.28l-3.844 3.844a.906.906 0 0 1-1.28 0m-.001 34.66-3.843-3.843a.906.906 0 0 1 0-1.281l3.843-3.843a.906.906 0 0 1 1.281 0l3.844 3.843a.906.906 0 0 1 0 1.281l-3.844 3.843a.906.906 0 0 1-1.28 0",viewW:80,viewH:80},coffee_table_oval:{d:"M3.84 30c0-14.53 12.572-26.308 28.08-26.308h56.16c15.509 0 28.08 11.778 28.08 26.308s-12.571 26.307-28.08 26.307H31.92C16.412 56.307 3.84 44.53 3.84 30 M80.592 15.093V9.83a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877m0 35.077v-5.262a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877M31.92 15.093V9.83a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.876h-5.616a.936.877 0 0 1-.936-.876m0 35.077v-5.262a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.876h-5.616a.936.877 0 0 1-.936-.876",viewW:120,viewH:60},coffee_table_rounded:{d:"M3.84 12.461c0-4.843 4.19-8.77 9.36-8.77h93.6c5.17 0 9.36 3.927 9.36 8.77v35.077c0 4.843-4.19 8.77-9.36 8.77H13.2c-5.17 0-9.36-3.927-9.36-8.77z M103.056 15.093V9.83a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877m0 35.078v-5.262a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877m-93.6-35.077V9.83a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877m0 35.078v-5.262a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877",viewW:120,viewH:60},table_dining:{d:"M3.879 6.08c0-1.265 1.065-2.29 2.378-2.29h147.484c1.314 0 2.38 1.025 2.38 2.29v77.84c0 1.265-1.066 2.29-2.38 2.29H6.257c-1.313 0-2.378-1.025-2.378-2.29z M138.994 19.358v-5.495a.952.916 0 0 1 .951-.915h5.71a.952.916 0 0 1 .95.915v5.495a.952.916 0 0 1-.95.916h-5.71a.952.916 0 0 1-.951-.916m-.001 56.778v-5.495a.952.916 0 0 1 .952-.915h5.709a.952.916 0 0 1 .951.915v5.495a.952.916 0 0 1-.951.916h-5.71a.952.916 0 0 1-.95-.916m-125.6-56.778v-5.495a.952.916 0 0 1 .951-.916h5.71a.952.916 0 0 1 .95.916v5.495a.952.916 0 0 1-.95.915h-5.71a.952.916 0 0 1-.951-.915m-.001 56.779v-5.495a.952.916 0 0 1 .952-.916h5.709a.952.916 0 0 1 .951.916v5.495a.952.916 0 0 1-.951.915h-5.71a.952.916 0 0 1-.95-.915",viewW:160,viewH:90},table_round:{d:"M3.826 55a51.174 51.174 0 1 0 102.349 0A51.174 51.174 0 1 0 3.826 55 m81.005 32.303-3.947-3.947a.93.93 0 0 1 0-1.316l3.947-3.948a.93.93 0 0 1 1.316 0l3.948 3.948a.93.93 0 0 1 0 1.316l-3.948 3.947a.93.93 0 0 1-1.316 0m0 54.897-3.947-3.948a.93.93 0 0 1 0-1.316l3.947-3.947a.93.93 0 0 1 1.316 0l3.948 3.947a.93.93 0 0 1 0 1.316L82.32 87.2a.93.93 0 0 1-1.316 0M27.04 32.304l-3.947-3.948a.93.93 0 0 1 0-1.315l3.948-3.948a.93.93 0 0 1 1.315 0l3.948 3.948a.93.93 0 0 1 0 1.315l-3.948 3.948a.93.93 0 0 1-1.315 0m-.001 54.604-3.947-3.948a.93.93 0 0 1 0-1.316l3.948-3.947a.93.93 0 0 1 1.315 0l3.948 3.947a.93.93 0 0 1 0 1.316l-3.948 3.948a.93.93 0 0 1-1.315 0",viewW:110,viewH:110},table_dining_oval:{d:"M3.892 50c0-25.51 21.418-46.19 47.838-46.19h76.54c26.42 0 47.839 20.68 47.839 46.19S154.69 96.19 128.27 96.19H51.73C25.31 96.19 3.892 75.51 3.892 50 M122.53 19.514V13.97a.957.924 0 0 1 .956-.924h5.74a.957.924 0 0 1 .958.924v5.543a.957.924 0 0 1-.957.924h-5.74a.957.924 0 0 1-.958-.924m.001 66.516v-5.543a.957.924 0 0 1 .957-.924h5.74a.957.924 0 0 1 .957.924v5.543a.957.924 0 0 1-.957.924h-5.74a.957.924 0 0 1-.957-.924M49.816 19.515v-5.543a.957.924 0 0 1 .957-.924h5.74a.957.924 0 0 1 .958.924v5.542a.957.924 0 0 1-.957.924h-5.74a.957.924 0 0 1-.958-.924m0 66.516v-5.543a.957.924 0 0 1 .957-.924h5.74a.957.924 0 0 1 .957.924v5.543a.957.924 0 0 1-.957.923h-5.74a.957.924 0 0 1-.957-.924",viewW:180,viewH:100},table_dining_rounded:{d:"M3.879 17.527c0-7.587 6.39-13.737 14.272-13.737h123.696c7.883 0 14.273 6.15 14.273 13.737v54.947c0 7.587-6.39 13.737-14.273 13.737H18.151c-7.882 0-14.272-6.15-14.272-13.737z M138.994 19.358v-5.495a.952.916 0 0 1 .951-.915h5.71a.952.916 0 0 1 .95.915v5.495a.952.916 0 0 1-.95.916h-5.71a.952.916 0 0 1-.951-.916m-.001 56.778v-5.495a.952.916 0 0 1 .952-.915h5.709a.952.916 0 0 1 .951.915v5.495a.952.916 0 0 1-.951.916h-5.71a.952.916 0 0 1-.95-.916m-125.6-56.778v-5.495a.952.916 0 0 1 .951-.916h5.71a.952.916 0 0 1 .95.916v5.495a.952.916 0 0 1-.95.915h-5.71a.952.916 0 0 1-.951-.915m-.001 56.779v-5.495a.952.916 0 0 1 .952-.916h5.709a.952.916 0 0 1 .951.916v5.495a.952.916 0 0 1-.951.915h-5.71a.952.916 0 0 1-.95-.915",viewW:160,viewH:90},desk:{d:"M3.862 5.967c0-1.234 1.057-2.234 2.362-2.234h127.552c1.305 0 2.362 1 2.362 2.234v58.066c0 1.234-1.057 2.233-2.362 2.233H6.224c-1.305 0-2.362-1-2.362-2.233z M9.531 15.346v-5.36a.945.893 0 0 1 .945-.893h5.67a.945.893 0 0 1 .944.893v5.36a.945.893 0 0 1-.945.894h-5.669a.945.893 0 0 1-.945-.894m113.379.001v-5.36a.945.893 0 0 1 .945-.894h5.67a.945.893 0 0 1 .944.894v5.36a.945.893 0 0 1-.945.893h-5.669a.945.893 0 0 1-.945-.893M9.53 60.013v-5.36a.945.893 0 0 1 .946-.893h5.669a.945.893 0 0 1 .945.893v5.36a.945.893 0 0 1-.945.894h-5.67a.945.893 0 0 1-.944-.894m113.38.001v-5.36a.945.893 0 0 1 .945-.894h5.669a.945.893 0 0 1 .945.894v5.36a.945.893 0 0 1-.945.893h-5.67a.945.893 0 0 1-.944-.893m-97.318-2.681h88.814",viewW:140,viewH:70},desk_corner:{d:"M156.12 66.202a2.38 2.38 0 0 1-2.379 2.38H94.272c-13.138 0-23.788 10.65-23.788 23.787v61.372a2.38 2.38 0 0 1-2.379 2.38H6.257a2.38 2.38 0 0 1-2.378-2.38V6.257A2.38 2.38 0 0 1 6.257 3.88h147.484a2.38 2.38 0 0 1 2.38 2.378z M9.588 16.249v-5.71a.95.95 0 0 1 .951-.95h5.71a.95.95 0 0 1 .95.95v5.71a.95.95 0 0 1-.95.951h-5.71a.95.95 0 0 1-.951-.951m133.212.001v-5.71a.95.95 0 0 1 .951-.951h5.71a.95.95 0 0 1 .95.951v5.71a.95.95 0 0 1-.95.951h-5.71a.95.95 0 0 1-.951-.951m0 45.672v-5.71a.95.95 0 0 1 .952-.951h5.709a.95.95 0 0 1 .951.951v5.71a.95.95 0 0 1-.951.951h-5.71a.95.95 0 0 1-.95-.951M9.587 149.46v-5.708a.95.95 0 0 1 .952-.952h5.709a.95.95 0 0 1 .951.952v5.709a.95.95 0 0 1-.951.951h-5.71a.95.95 0 0 1-.951-.951m47.576 0v-5.709a.95.95 0 0 1 .952-.951h5.709a.95.95 0 0 1 .951.951v5.71a.95.95 0 0 1-.951.95h-5.71a.95.95 0 0 1-.951-.95m51.382-90.396H95.569a34.6 34.6 0 0 0-34.6 34.6v12.976",viewW:160,viewH:160},chair:{d:"M39.452 12.433H10.548a4.398 4.398 0 1 1 0-8.796h28.904a4.398 4.398 0 0 1 0 8.796m-28.904 0H8.035a4.4 4.4 0 0 0-4.398 4.399V40.08a6.283 6.283 0 0 0 6.283 6.284h30.16a6.283 6.283 0 0 0 6.284-6.284V16.832c0-2.43-1.97-4.399-4.399-4.399h-2.513",viewW:50,viewH:50},chair_bar:{d:"M38.579 17.168c1.326 2.526 1.947 6.015 1.947 9.071 0 10.018-8.07 18.139-18.025 18.139S4.475 36.257 4.475 26.239c0-3.056.586-6.552 1.912-9.078m32.192.007a3.59 3.59 0 0 1-3.333-.976m3.333.976a3.6 3.6 0 0 0 1.765-.976m-33.827.996-.13-.027a3.6 3.6 0 0 1-1.731-.969m30.59 0a18 18 0 0 0-5.848-3.932 17.93 17.93 0 0 0-13.796 0 18 18 0 0 0-5.848 3.932 3.59 3.59 0 0 1-3.237.996m28.729-.996a3.59 3.59 0 0 0 5.098 0m-33.827.996a3.6 3.6 0 0 1-1.861-.996 3.644 3.644 0 0 1 0-5.13 25.2 25.2 0 0 1 8.187-5.505A25.1 25.1 0 0 1 22.5 3.623a25.1 25.1 0 0 1 9.657 1.934 25.2 25.2 0 0 1 8.187 5.505 3.644 3.644 0 0 1 0 5.13",viewW:45,viewH:48},armchair:{d:"M75.702 13.011q.012-.225.012-.453c0-4.843-3.917-8.768-8.748-8.768H23.034c-4.83 0-8.747 3.925-8.747 8.768q0 .228.011.453M77.132 72.09q.59.091 1.206.092c4.348 0 7.873-3.533 7.873-7.892V20.45c0-4.359-3.525-7.892-7.873-7.892-.924 0-1.812.16-2.636.453a7.89 7.89 0 0 0-5.237 7.438v.148m0 0a8.7 8.7 0 0 1-3.499.73H23.034a8.7 8.7 0 0 1-3.499-.73m50.93 0V64.29a7.89 7.89 0 0 0 6.667 7.8M14.298 13.01a7.89 7.89 0 0 1 5.237 7.438v.148m0 0V64.29a7.89 7.89 0 0 1-6.666 7.8q-.59.091-1.206.092c-4.348 0-7.873-3.533-7.873-7.892V20.45c0-4.359 3.525-7.892 7.873-7.892.924 0 1.811.16 2.635.453M77.132 72.09c-1.585 8.05-8.667 14.12-17.164 14.12H30.032c-8.496 0-15.578-6.07-17.163-14.12",viewW:90,viewH:90},armchair_office:{d:"M56.968 18.845q0-.368-.05-.72M49.051 13.8H15.95a5.04 5.04 0 0 1-5.038-5.043 5.04 5.04 0 0 1 5.038-5.043h33.103a5.04 5.04 0 0 1 5.038 5.043 5.04 5.04 0 0 1-5.038 5.043m-33.103 0h-2.88a5.04 5.04 0 0 0-4.986 4.323M49.052 13.8h2.879a5.04 5.04 0 0 1 4.986 4.324m.051 24.826a4.32 4.32 0 0 0 4.318-4.323v-16.18a4.32 4.32 0 0 0-4.369-4.322m.051 24.826a4.32 4.32 0 0 1-4.318-4.323V22.447a4.32 4.32 0 0 1 4.267-4.322m-11.84 37.24h4.695c.736 0 1.446-.111 2.115-.317a7.21 7.21 0 0 0 5.081-6.889v-5.208M8.084 18.124h-.051a4.32 4.32 0 0 0-4.318 4.323v16.18a4.32 4.32 0 0 0 4.318 4.324 4.32 4.32 0 0 0 4.317-4.323V22.447a4.32 4.32 0 0 0-4.266-4.323m11.935 37.24h-4.79a7.2 7.2 0 0 1-2.04-.294 7.21 7.21 0 0 1-5.156-6.91v-5.21m37.045 12.414 5.177 5.183c.969.97 2.534.987 3.524.038a2.526 2.526 0 0 0 .038-3.605l-1.93-1.932m-6.81.316H20.02m-6.83-.294-1.909 1.91c-.998 1-.98 2.627.038 3.605.99.949 2.555.932 3.524-.038l5.177-5.183",viewW:65,viewH:65},sofa:{d:"M90 19.365v57.111m0-57.11V7.683m0 11.681c0 2.151-1.836 3.894-4.1 3.894H30.544a10.7 10.7 0 0 1-4.136-.825M90 19.365c0 2.151 1.836 3.894 4.1 3.894h55.356c1.472 0 2.871-.294 4.137-.825M90 76.476c0 5.376-4.59 9.735-10.25 9.735H30.543c-5.266 0-9.605-3.772-10.185-8.625M90 76.476c0 5.376 4.59 9.735 10.25 9.735h49.206c5.266 0 9.605-3.772 10.185-8.625M90 7.684c0-2.15-1.837-3.894-4.101-3.894H30.544c-5.661 0-10.25 4.358-10.25 9.735q0 .416.036.825M90 7.684c0-2.15 1.836-3.894 4.1-3.894h55.356c5.661 0 10.25 4.358 10.25 9.735q0 .416-.036.825m0 0a10.7 10.7 0 0 1 4.137-.825h2.05c5.662 0 10.252 4.358 10.252 9.734v45.43c0 5.376-4.59 9.734-10.251 9.734h-2.05c-1.484 0-2.894-.3-4.167-.837m0 0c-3.585-1.517-6.084-4.93-6.084-8.898V23.26q0-.417.036-.825c.32-3.622 2.728-6.68 6.077-8.084m-139.34 0c3.35 1.404 5.758 4.462 6.078 8.084q.036.408.036.825v45.43c0 3.967-2.5 7.38-6.085 8.897a10.7 10.7 0 0 1-4.166.837h-2.05c-5.662 0-10.251-4.358-10.251-9.735V23.26c0-5.376 4.59-9.734 10.25-9.734h2.05c1.473 0 2.872.294 4.138.825",viewW:180,viewH:90},sofa_three_seat:{d:"M86.553 18.593V76.96m0-58.366V7.491m0 11.102c0 2.044-1.762 3.701-3.935 3.701H29.496c-1.413 0-2.756-.28-3.97-.784m61.027-2.917c0 2.044 1.762 3.701 3.935 3.701h59.024c2.174 0 3.935-1.657 3.935-3.7M86.553 76.958c0 5.11-4.404 9.252-9.837 9.252h-47.22c-5.054 0-9.218-3.585-9.775-8.198m66.832-1.054c0 5.11 4.404 9.252 9.837 9.252h47.22c5.433 0 9.837-4.142 9.837-9.252m0-58.366V76.96m0-58.366V7.491m0 11.102c0 2.044 1.762 3.701 3.936 3.701h53.122c1.413 0 2.756-.28 3.97-.784m-61.028 55.449c0 5.11 4.405 9.252 9.838 9.252h47.22c5.054 0 9.218-3.585 9.775-8.198M86.553 7.491c0-2.044-1.762-3.701-3.935-3.701H29.496c-5.433 0-9.838 4.142-9.838 9.252q0 .396.035.784m66.86-6.335c0-2.044 1.762-3.701 3.935-3.701h59.024c2.174 0 3.935 1.657 3.935 3.7m0 0c0-2.043 1.762-3.7 3.936-3.7h53.122c5.433 0 9.838 4.142 9.838 9.252 0 .258.022.517 0 .77m-.063 64.201c1.22.512 2.574.796 3.998.796h1.967c5.433 0 9.837-4.142 9.837-9.252V22.294c0-5.11-4.404-9.252-9.837-9.252h-1.967c-5.153 0-9.38 3.725-9.803 8.468q-.036.387-.035.784v47.263c0 3.771 2.399 7.015 5.84 8.456M19.693 13.826a10.3 10.3 0 0 0-3.97-.784h-1.967c-5.433 0-9.838 4.142-9.838 9.252v47.263c0 5.11 4.405 9.252 9.838 9.252h1.967c1.424 0 2.777-.284 3.998-.796 3.441-1.441 5.84-4.685 5.84-8.456V22.294a9 9 0 0 0-.035-.784c-.307-3.443-2.618-6.349-5.833-7.684",viewW:240,viewH:90},sofa_corner_right:{d:"M93.673 20.687V83.69m0-63.004v-12.6m0 12.6c0 2.32-1.913 4.2-4.273 4.2H31.704a10.8 10.8 0 0 1-4.311-.89m66.28-3.31c0 2.32 1.914 4.2 4.274 4.2h64.106c2.36 0 4.274-1.88 4.274-4.2M93.673 83.692c0 5.8-4.783 10.501-10.684 10.501H31.704c-5.489 0-10.011-4.068-10.616-9.304m72.585-1.197c0 5.8 4.784 10.501 10.684 10.501h51.286c5.9 0 10.684-4.701 10.684-10.5m0-63.005V83.69m0-63.004v-12.6m0 12.6c0 2.32 1.914 4.2 4.273 4.2h57.696c1.534 0 2.993-.317 4.312-.89m-66.28 59.695v71.923c0 5.799 4.782 10.5 10.684 10.5h51.284c5.49 0 10.012-4.068 10.616-9.304V84.888M93.673 8.086c0-2.32-1.913-4.2-4.273-4.2H31.704c-5.9 0-10.684 4.7-10.684 10.5q0 .45.038.89m72.615-7.19c0-2.32 1.914-4.2 4.274-4.2h64.106c2.36 0 4.274 1.88 4.274 4.2m0 0c0-2.32 1.914-4.2 4.273-4.2h57.696c5.9 0 10.685 4.7 10.685 10.5 0 .293.024.587 0 .874m-.07 69.628c1.327.58 2.797.904 4.344.904h2.136c5.901 0 10.684-4.702 10.684-10.501V24.887c0-5.8-4.783-10.5-10.684-10.5h-2.136c-5.596 0-10.187 4.227-10.647 9.61q-.038.44-.038.89V75.29c0 4.28 2.605 7.961 6.342 9.597M21.059 15.276a10.8 10.8 0 0 0-4.312-.89H14.61c-5.9 0-10.684 4.701-10.684 10.5v50.405c0 5.8 4.783 10.5 10.684 10.5h2.137c1.546 0 3.016-.322 4.342-.903 3.737-1.636 6.342-5.317 6.342-9.597V24.887q0-.45-.037-.89c-.334-3.907-2.844-7.206-6.335-8.72",viewW:260,viewH:170},bed_single:{d:"M3.79 14.024c0 5.59 4.318 10.122 9.645 10.122h63.13c5.328 0 9.646-4.532 9.646-10.122m-22.797 46.93V46.23c0-5.082-3.926-9.201-8.769-9.201h-19.29c-4.842 0-8.768 4.12-8.768 9.201v14.723m-22.797 0h82.42m0 22.085H3.79m8.768 113.06h64.885c4.842 0 8.768-4.12 8.768-9.202V13.104c0-5.082-3.926-9.202-8.768-9.202H12.558c-4.843 0-8.768 4.12-8.768 9.202v173.792c0 5.082 3.925 9.202 8.768 9.202",viewW:90,viewH:200},bed_double:{d:"M3.879 14.073c0 5.618 4.516 10.172 10.088 10.172h132.065c5.571 0 10.088-4.554 10.088-10.172m-81.165 47.16V46.438c0-5.107-4.106-9.247-9.171-9.247H45.607c-5.065 0-9.17 4.14-9.17 9.247v14.795m89.877 0V46.438c0-5.107-4.107-9.247-9.172-9.247H96.966c-5.065 0-9.171 4.14-9.171 9.247v14.795m-83.916 0H156.12m0 22.192H3.88m9.17 112.673h133.9c5.065 0 9.171-4.14 9.171-9.247V13.15c0-5.107-4.106-9.247-9.171-9.247H13.05c-5.064 0-9.17 4.14-9.17 9.247v173.7c0 5.107 4.106 9.247 9.17 9.247",viewW:160,viewH:200},nightstand:{d:"M5.773 3.555h38.454a2.136 2.056 0 0 1 2.137 2.056v28.777a2.136 2.056 0 0 1-2.137 2.056H5.773a2.136 2.056 0 0 1-2.136-2.056V5.611a2.136 2.056 0 0 1 2.136-2.056",viewW:50,viewH:40},cabinet_tv:{d:"M56.772 17.88h5.315m0 0h5.315m-5.315 0v9.214m9.832-9.214 5.315 9.45 5.314-9.45M6.224 41.4h127.552c1.305 0 2.362-.94 2.362-2.1V5.7c0-1.16-1.057-2.1-2.362-2.1H6.224c-1.305 0-2.362.94-2.362 2.1v33.6c0 1.16 1.057 2.1 2.362 2.1",viewW:140,viewH:45},cabinet_shoe:{d:"m39.722 16.231 1.505-1.596m1.134 3.15 1.53-1.738M6.03 31.5h67.94c1.251 0 2.265-.895 2.265-2v-24c0-1.105-1.014-2-2.264-2H6.03c-1.251 0-2.265.895-2.265 2v24c0 1.105 1.014 2 2.265 2m41.966-14.305L46.92 17.1a3.4 3.4 0 0 1-1.813-.706l-4.583-3.62c-1.264-1-3.277-.326-3.475 1.161-.185 1.39-1.983 2.1-3.28 1.299l-1.532-.947c-.968-.513-2.2.103-2.2 1.1v3.463c0 1.559 1.43 2.823 3.196 2.823h14.51c1.404 0 2.542-1.005 2.542-2.245 0-1.153-.99-2.118-2.289-2.233",viewW:80,viewH:35},cabinet_sink:{d:"M3.765 5.773c0-1.18 1.014-2.136 2.265-2.136h67.94c1.251 0 2.265.956 2.265 2.136v38.454c0 1.18-1.014 2.137-2.264 2.137H6.03c-1.251 0-2.265-.957-2.265-2.137z M36.088 32.135c2.525 1.88 6.205 1.88 8.73 0s3.167-5.101 1.52-7.637l-5.879-8.043-5.893 8.043c-1.644 2.536-1.003 5.755 1.522 7.637",viewW:80,viewH:50},bookshelf:{d:"M57.12 20.488H45.473c-.514 0-1.008.124-1.372.345s-.568.52-.568.832m4.076-8.236h5.434M6.119 3.5h87.762c1.276 0 2.31.895 2.31 2v24c0 1.105-1.034 2-2.31 2H6.12c-1.275 0-2.31-.895-2.31-2v-24c0-1.105 1.035-2 2.31-2m51 6.4v14.118H45.474a2.04 2.04 0 0 1-1.372-.517 1.7 1.7 0 0 1-.568-1.248V11.665c0-.468.204-.917.568-1.248a2.04 2.04 0 0 1 1.372-.517z",viewW:100,viewH:35},wall_unit:{d:"M6.336 41.4h227.328a2.418 2.1 0 0 0 2.418-2.1V5.7a2.418 2.1 0 0 0-2.418-2.1H6.336a2.418 2.1 0 0 0-2.418 2.1v33.6a2.418 2.1 0 0 0 2.418 2.1m43.744-5.88V9.48m46.432 26.04V9.48m46.433 26.04V9.48m46.433 26.04V9.48",viewW:240,viewH:45},wardrobe:{d:"M93.87 20.25a3.3 3.3 0 0 0-1.072-2.407 3.8 3.8 0 0 0-2.586-.997c-.97 0-1.9.358-2.587.997a3.3 3.3 0 0 0-1.071 2.407c0 2.838 1.225 5.107 3.658 6.81h-.015m0 0 14.58 7.537c.57.295 1.046.726 1.377 1.25.331.523.505 1.12.505 1.727v1.401a3.3 3.3 0 0 1-1.071 2.407 3.8 3.8 0 0 1-2.587.998H77.393a3.8 3.8 0 0 1-2.586-.998 3.3 3.3 0 0 1-1.072-2.407v-1.4c0-.608.174-1.205.505-1.728a3.55 3.55 0 0 1 1.377-1.25zM6.284 3.691h167.433c1.32 0 2.392.981 2.392 2.192v48.23c0 1.212-1.071 2.193-2.392 2.193H6.284c-1.321 0-2.392-.981-2.392-2.192V5.885c0-1.212 1.07-2.193 2.392-2.193",viewW:180,viewH:60},kitchen_floor:{d:"M3.692 5.884c0-1.21.981-2.192 2.192-2.192h48.23c1.212 0 2.193.981 2.193 2.192v48.23a2.19 2.19 0 0 1-2.192 2.193H5.885a2.19 2.19 0 0 1-2.193-2.192z",viewW:60,viewH:60},kitchen_floor_corner:{d:"M45.944 41.767a2.29 2.29 0 0 0 2.29 2.29H83.92a2.29 2.29 0 0 1 2.29 2.29V83.92a2.29 2.29 0 0 1-2.29 2.29H6.08a2.29 2.29 0 0 1-2.29-2.29V6.08a2.29 2.29 0 0 1 2.29-2.29h37.576a2.29 2.29 0 0 1 2.29 2.29z",viewW:90,viewH:90},kitchen_wall:{d:"m4.444 31.033 50.75-27.007m-50.752-.06 50.75 27.008M5.884 31.5h48.23c1.212 0 2.193-.895 2.193-2v-24c0-1.105-.981-2-2.192-2H5.885c-1.212 0-2.193.895-2.193 2v24c0 1.105.981 2 2.192 2",viewW:60,viewH:35},kitchen_wall_corner:{d:"M3.772 29.59 29.88 4.383M4.57 55.43 55.43 30M4.175 4.383l26.701 23.863m-27.184.877L55.43 55.43M28.41 3.692H5.884c-1.21 0-2.192.981-2.192 2.192v48.23c0 1.212.981 2.193 2.192 2.193h48.23a2.19 2.19 0 0 0 2.193-2.192V31.589c0-1.21-.981-2.192-2.192-2.192h-21.32a2.19 2.19 0 0 1-2.193-2.192V5.885a2.19 2.19 0 0 0-2.192-2.193",viewW:60,viewH:60},shelf_floor:{d:"M6.12 31.5h87.76a2.31 2 0 0 0 2.31-2v-24a2.31 2 0 0 0-2.31-2H6.12a2.31 2 0 0 0-2.31 2v24a2.31 2 0 0 0 2.31 2 M9.089 25.933c-.494.112-.776.546-.63.97s.664.675 1.157.564l-.263-.767zM90.912 9.067c.493-.112.775-.546.63-.97s-.664-.675-1.158-.564l.264.767zM11.875 26.956c.493-.112.775-.546.63-.97s-.664-.676-1.158-.564l.264.767zm3.988-2.556c-.493.112-.775.546-.63.969s.664.676 1.158.564l-.264-.766zm5.045.511c.493-.112.775-.545.63-.969s-.664-.676-1.158-.564l.264.766zm3.988-2.555c-.493.111-.775.545-.63.968.146.424.664.677 1.158.565l-.264-.767zm5.044.51c.494-.111.776-.545.63-.968-.145-.424-.664-.676-1.157-.565l.263.767zm3.99-2.555c-.495.112-.777.546-.63.97.145.423.663.675 1.157.563l-.264-.766zm5.043.511c.494-.112.776-.545.63-.969s-.664-.676-1.158-.564l.264.767zm3.989-2.555c-.494.111-.776.545-.63.969s.664.676 1.157.564l-.263-.767zm5.044.51c.494-.11.776-.545.63-.968-.146-.424-.664-.676-1.158-.565l.264.767zm3.989-2.555c-.494.112-.776.546-.63.97.145.423.664.675 1.157.564l-.264-.767zm5.044.511c.493-.111.775-.545.63-.969s-.664-.676-1.158-.564l.264.767zm3.988-2.555c-.493.112-.775.545-.63.969s.664.676 1.158.564l-.264-.767zm5.045.51c.493-.11.775-.545.63-.968-.146-.424-.664-.676-1.158-.564l.264.766zm3.988-2.555c-.493.112-.775.546-.63.97s.664.675 1.158.564l-.264-.767zm5.044.511c.494-.111.776-.545.63-.968-.145-.424-.664-.677-1.157-.565l.264.767zm3.99-2.555c-.494.112-.777.545-.63.969.145.423.663.676 1.157.564l-.264-.766zm5.043.511c.494-.112.776-.546.63-.969s-.664-.676-1.157-.564l.263.766zm3.989-2.556c-.494.112-.776.546-.63.97s.664.676 1.158.564l-.264-.767zM9.353 26.7l.263.767 2.259-.511-.264-.767-.264-.767-2.258.511zm6.774-1.533.264.766 4.517-1.022-.264-.767-.264-.766-4.517 1.022zm9.033-2.045.264.767 4.516-1.022-.264-.767-.263-.767-4.517 1.023zm9.033-2.044.264.766 4.516-1.022-.264-.766-.264-.767-4.516 1.022zm9.033-2.045.263.767 4.517-1.022-.264-.767-.264-.767-4.516 1.023zm9.032-2.044.264.767 4.517-1.023-.264-.766-.264-.767-4.516 1.022zm9.033-2.045.264.767 4.517-1.022-.264-.767-.264-.766-4.517 1.022zm9.033-2.044.264.767 4.516-1.023-.263-.766-.264-.767-4.517 1.022zm9.033-2.044.264.766 4.516-1.022-.264-.767-.263-.766-4.517 1.022zM88.39 8.81l.264.767 2.258-.511-.264-.767-.264-.767-2.258.511z M9.089 9.067c-.494-.112-.776-.546-.63-.97s.664-.675 1.157-.564l-.263.767zm81.823 16.866c.493.112.775.546.63.97s-.664.675-1.158.564l.264-.767zM11.875 8.044c.493.112.775.546.63.97s-.664.676-1.158.564l.264-.767zm3.988 2.556c-.493-.112-.775-.546-.63-.969s.664-.676 1.158-.564l-.264.766zm5.045-.511c.493.112.775.545.63.969s-.664.676-1.158.564l.264-.766zm3.988 2.555c-.493-.111-.775-.545-.63-.968.146-.424.664-.677 1.158-.565l-.264.767zm5.044-.51c.494.111.776.545.63.968-.145.424-.664.676-1.157.565l.263-.767zm3.99 2.555c-.495-.112-.777-.546-.63-.97.145-.423.663-.675 1.157-.563l-.264.766zm5.043-.511c.494.112.776.545.63.969s-.664.676-1.158.564l.264-.767zm3.989 2.555c-.494-.111-.776-.545-.63-.969s.664-.676 1.157-.564l-.263.767zm5.044-.51c.494.11.776.545.63.968-.146.424-.664.676-1.158.565l.264-.767zm3.989 2.555c-.494-.112-.776-.546-.63-.97.145-.423.664-.675 1.157-.564l-.264.767zm5.044-.511c.493.111.775.545.63.969s-.664.676-1.158.564l.264-.767zm3.988 2.555c-.493-.112-.775-.545-.63-.969s.664-.676 1.158-.564l-.264.767zm5.045-.51c.493.11.775.545.63.968-.146.424-.664.676-1.158.564l.264-.766zm3.988 2.555c-.493-.112-.775-.546-.63-.97s.664-.675 1.158-.564l-.264.767zm5.044-.511c.494.111.776.545.63.968-.145.424-.664.677-1.157.565l.264-.767zm3.99 2.555c-.494-.112-.777-.545-.63-.969.145-.423.663-.676 1.157-.564l-.264.766zm5.043-.511c.494.112.776.546.63.969s-.664.676-1.157.564l.263-.766zm3.989 2.556c-.494-.112-.776-.546-.63-.97s.664-.676 1.158-.564l-.264.767zM9.353 8.3l.263-.767 2.259.511-.264.767-.264.767-2.258-.511zm6.774 1.533.264-.766 4.517 1.022-.264.767-.264.766-4.517-1.022zm9.033 2.045.264-.767 4.516 1.022-.264.767-.263.767-4.517-1.023zm9.033 2.044.264-.766 4.516 1.022-.264.766-.264.767-4.516-1.022zm9.033 2.045.263-.767 4.517 1.022-.264.767-.264.767-4.516-1.023zm9.032 2.044.264-.767 4.517 1.023-.264.766-.264.767-4.516-1.022zm9.033 2.045.264-.767 4.517 1.022-.264.767-.264.766-4.517-1.022zm9.033 2.044.264-.767 4.516 1.023-.263.766-.264.767-4.517-1.022zm9.033 2.044.264-.766 4.516 1.022-.264.767-.263.766-4.517-1.022zm9.033 2.045.264-.767 2.258.511-.264.767-.264.767-2.258-.511z",viewW:100,viewH:35},shelf_wall:{d:"M18.36 3.15v2.567c0 1.012-1.034 1.833-2.31 1.833h-.924c-1.275 0-2.309-.82-2.309-1.833V3.15m73.905 0v2.567c0 1.012-1.034 1.833-2.31 1.833h-.924c-1.275 0-2.31-.82-2.31-1.833V3.15m-75.29 0H93.65c1.276 0 2.31.82 2.31 1.833V19.65c0 1.012-1.034 1.833-2.31 1.833H5.888c-1.275 0-2.31-.82-2.31-1.833V4.983c0-1.012 1.035-1.833 2.31-1.833",viewW:100,viewH:25},cooktop_two:{d:"M15 30.982v-1.71m3.086 5.128h1.542M15 39.527v-1.709M10.372 34.4h1.542M5.84 46.364h18.322c1.331 0 2.41-1.196 2.41-2.67V6.306c0-1.475-1.079-2.67-2.41-2.67H5.839c-1.331 0-2.41 1.195-2.41 2.67v37.386c0 1.475 1.079 2.67 2.41 2.67m14.56-29.91c0 3.304-2.417 5.982-5.4 5.982-2.981 0-5.4-2.678-5.4-5.981s2.419-5.982 5.4-5.982c2.983 0 5.4 2.678 5.4 5.982M18.858 34.4c0 2.36-1.727 4.273-3.857 4.273s-3.857-1.913-3.857-4.273S12.87 30.127 15 30.127s3.857 1.913 3.857 4.273",viewW:30,viewH:50},stove:{d:"M41.4 35.261a.877.877 0 1 0-1.754 0zm4.384 6.138a.877.877 0 1 0 0-1.753zM41.4 44.03a.877.877 0 1 0-1.753 0zm-4.384-2.63a.877.877 0 1 0 0-1.754zM5.885 3.691v.877h48.23V2.815H5.885zm50.422 2.192h-.877v48.23h1.754V5.885zm-2.192 50.423v-.877H5.885v1.754h48.23zM3.692 54.115h.877V5.885H2.815v48.23zm2.192 2.192v-.877a1.315 1.315 0 0 1-1.315-1.315H2.815a3.07 3.07 0 0 0 3.07 3.069zm50.423-2.192h-.877c0 .726-.589 1.315-1.315 1.315v1.754a3.07 3.07 0 0 0 3.069-3.07zM54.115 3.692v.877c.726 0 1.315.589 1.315 1.315h1.754a3.07 3.07 0 0 0-3.07-3.069zm-48.23 0v-.877a3.07 3.07 0 0 0-3.07 3.07h1.754c0-.727.589-1.316 1.315-1.316zm19.73 36.83h-.877a5.26 5.26 0 0 1-5.262 5.262v1.754a7.015 7.015 0 0 0 7.016-7.015zm-6.139 6.139v-.877a5.26 5.26 0 0 1-5.261-5.261h-1.754a7.015 7.015 0 0 0 7.015 7.015zm-6.138-6.138h.877a5.26 5.26 0 0 1 5.261-5.262v-1.754a7.015 7.015 0 0 0-7.015 7.016zm6.138-6.139v.877a5.26 5.26 0 0 1 5.262 5.262h1.754a7.015 7.015 0 0 0-7.016-7.016zm27.185-14.908h-.877a5.26 5.26 0 0 1-5.261 5.262v1.754a7.015 7.015 0 0 0 7.015-7.016zm-6.138 6.139v-.877a5.26 5.26 0 0 1-5.262-5.262h-1.754a7.015 7.015 0 0 0 7.016 7.016zm-6.139-6.139h.877a5.26 5.26 0 0 1 5.262-5.261v-1.754a7.015 7.015 0 0 0-7.016 7.015zm6.139-6.138v.877a5.26 5.26 0 0 1 5.261 5.261h1.754a7.015 7.015 0 0 0-7.015-7.015zm4.384 27.185h-.877a3.51 3.51 0 0 1-3.507 3.507v1.754a5.26 5.26 0 0 0 5.261-5.261zm-4.384 4.384v-.877a3.51 3.51 0 0 1-3.508-3.507H35.26a5.26 5.26 0 0 0 5.262 5.261zm-4.385-4.384h.877a3.51 3.51 0 0 1 3.508-3.508V35.26a5.26 5.26 0 0 0-5.262 5.262zm4.385-4.385v.877a3.51 3.51 0 0 1 3.507 3.508h1.754a5.26 5.26 0 0 0-5.261-5.262zm0 .877h.876V35.26h-1.753v1.754zm3.508 3.508v.876h1.753v-1.753h-1.753zm-3.508 5.261h.876V44.03h-1.753v1.754zm-5.261-5.261v.876h1.753v-1.753h-1.753zm-9.647-21.047h-.877a5.26 5.26 0 0 1-5.262 5.262v1.754a7.015 7.015 0 0 0 7.016-7.016zm-6.139 6.139v-.877a5.26 5.26 0 0 1-5.261-5.262h-1.754a7.015 7.015 0 0 0 7.015 7.016zm-6.138-6.139h.877a5.26 5.26 0 0 1 5.261-5.261v-1.754a7.015 7.015 0 0 0-7.015 7.015zm6.138-6.138v.877a5.26 5.26 0 0 1 5.262 5.261h1.754a7.015 7.015 0 0 0-7.016-7.015z",viewW:60,viewH:60},tv:{d:"M45.134 10.766H6.18c-1.292 0-2.34.848-2.34 1.894v2.68c0 1.045 1.048 1.893 2.34 1.893h38.954m0-6.467V5.288c0-1.046 1.048-1.894 2.34-1.894h26.704c1.292 0 2.34.848 2.34 1.894v5.478m-31.384 0h31.384m0 0h37.302c1.293 0 2.34.848 2.34 1.894v2.68c0 1.045-1.047 1.893-2.34 1.893H76.518m-31.384 0v5.479c0 1.046 1.048 1.894 2.34 1.894h26.704c1.292 0 2.34-.848 2.34-1.894v-5.479m-31.384 0h31.384",viewW:120,viewH:28},tv_wall:{d:"M35.664 11.4c-.517 0-.936.269-.936.6s.419.6.936.6zm49.553 1.2c.517 0 .936-.269.936-.6s-.42-.6-.936-.6zM6.18 3v.6h107.64V2.4H6.18zm109.98 1.5h-.936v1.8h1.872V4.5zm-2.34 3.3v-.6H6.18v1.2h107.64zM3.84 6.3h.936V4.5H2.904v1.8zm2.34 1.5v-.6c-.775 0-1.404-.403-1.404-.9H2.904c0 1.16 1.467 2.1 3.276 2.1zm109.98-1.5h-.936c0 .497-.629.9-1.404.9v1.2c1.81 0 3.276-.94 3.276-2.1zM113.82 3v.6c.775 0 1.404.403 1.404.9h1.872c0-1.16-1.467-2.1-3.276-2.1zM6.18 3v-.6c-1.81 0-3.276.94-3.276 2.1h1.872c0-.497.629-.9 1.404-.9zm61.308 4.2h-.936V12h1.872V7.2zM52.512 12h.936V7.2h-1.872V12zm-16.848 0v.6h49.553v-1.2H35.664z",viewW:120,viewH:15},toilet:{d:"M3.555 48.976c0 9.55 7.125 17.29 15.914 17.29h1.061c8.79 0 15.914-7.74 15.914-17.29V5.966c0-1.233-.92-2.233-2.056-2.233H5.611c-1.135 0-2.056 1-2.056 2.234z M7.666 49.12c0 7.003 5.225 12.68 11.67 12.68h1.327c6.445 0 11.67-5.677 11.67-12.68V31.873c0-1.233-.92-2.233-2.056-2.233H9.722c-1.135 0-2.056 1-2.056 2.233zM33.792 3.733c1.465 0 2.652 1.29 2.652 2.882v12.103c0 1.592-1.187 2.882-2.652 2.882H6.208c-1.465 0-2.653-1.29-2.653-2.882V6.615c0-1.591 1.188-2.882 2.653-2.882z M24.11 50.186c0 2.467-1.84 4.467-4.11 4.467s-4.111-2-4.111-4.467 1.84-4.466 4.11-4.466 4.112 2 4.112 4.466",viewW:40,viewH:70},toilet_built_in:{d:"M3.555 34.56c0 9.263 7.125 16.774 15.914 16.774h1.061c8.79 0 15.914-7.51 15.914-16.775V5.833c0-1.196-.92-2.166-2.056-2.166H5.611c-1.135 0-2.056.97-2.056 2.166z M7.666 34.7c0 6.793 5.225 12.3 11.67 12.3h1.327c6.445 0 11.67-5.507 11.67-12.3V14.5c0-1.197-.92-2.167-2.056-2.167H9.722c-1.135 0-2.056.97-2.056 2.167z M24.11 35.733c0 2.394-1.84 4.334-4.11 4.334s-4.111-1.94-4.111-4.334 1.84-4.333 4.11-4.333 4.112 1.94 4.112 4.333",viewW:40,viewH:55},bathtub:{d:"M3.885 6c0-1.243 1.068-2.25 2.386-2.25h157.458c1.318 0 2.386 1.007 2.386 2.25v63c0 1.243-1.068 2.25-2.386 2.25H6.27c-1.318 0-2.386-1.007-2.386-2.25z M13.428 37.5c0-13.669 11.75-24.75 26.243-24.75h90.658c14.493 0 26.243 11.081 26.243 24.75s-11.75 24.75-26.243 24.75H39.67c-14.493 0-26.243-11.081-26.243-24.75 M31.56 37.5c0 2.237-1.923 4.05-4.295 4.05s-4.294-1.813-4.294-4.05 1.923-4.05 4.294-4.05c2.372 0 4.295 1.813 4.295 4.05",viewW:170,viewH:75},bathtub_corner:{d:"M3.862 6.224a2.36 2.36 0 0 1 2.362-2.362H133.97c1.197 0 2.168.97 2.168 2.168 0 71.857-58.251 130.108-130.108 130.108a2.17 2.17 0 0 1-2.168-2.168z M13.31 32.207c0-10.437 8.46-18.897 18.897-18.897h87.628a2.13 2.13 0 0 1 2.13 2.13c0 58.833-47.692 106.526-106.524 106.526a2.13 2.13 0 0 1-2.13-2.131z M32.207 27.483a4.724 4.724 0 1 1-9.449 0 4.724 4.724 0 0 1 9.449 0",viewW:140,viewH:140},bidet:{d:"M22.466 3.692v10.085c0 1.21-.92 2.192-2.055 2.192h-.822c-1.136 0-2.056-.981-2.056-2.192V3.692m4.933 8.77h2.878c1.135 0 2.056-.982 2.056-2.193v-.877c0-1.21-.92-2.192-2.056-2.192h-2.878m-4.933 5.262h-2.878c-1.135 0-2.055-.982-2.055-2.193v-.877c0-1.21.92-2.192 2.055-2.192h2.878M5.611 3.692h28.777c1.136 0 2.056.981 2.056 2.192v33.45c0 9.374-7.125 16.973-15.914 16.973h-1.06c-8.79 0-15.915-7.599-15.915-16.972V5.885c0-1.212.92-2.193 2.056-2.193m4.11 15.785h20.556c1.136 0 2.056.981 2.056 2.192v17.807c0 6.874-5.225 12.447-11.67 12.447h-1.327c-6.445 0-11.67-5.573-11.67-12.447V21.67c0-1.21.92-2.192 2.056-2.192m13.567 7.892c0 1.937-1.472 3.508-3.288 3.508-1.817 0-3.29-1.57-3.29-3.508s1.473-3.507 3.29-3.507 3.288 1.57 3.288 3.507",viewW:40,viewH:60},bidet_built_in:{d:"M17.318 12.182h-8.06c-.88 0-1.592.74-1.592 1.654v16.126c0 6.698 5.225 12.129 11.67 12.129h1.327c6.445 0 11.67-5.43 11.67-12.13V13.837c0-.914-.713-1.654-1.591-1.654H22.68m-.215-8.545v9.827c0 1.18-.92 2.136-2.055 2.136h-.822c-1.136 0-2.056-.956-2.056-2.136V3.637m10.689 8.545V3.637m-16.445 0v8.545M5.611 3.637h28.777c1.136 0 2.056.956 2.056 2.136v24.051c0 9.135-7.125 16.54-15.914 16.54h-1.06c-8.79 0-15.915-7.405-15.915-16.54V5.773c0-1.18.92-2.136 2.056-2.136M23.289 23.29c0 1.888-1.473 3.418-3.29 3.418s-3.288-1.53-3.288-3.418 1.472-3.418 3.289-3.418c1.816 0 3.288 1.53 3.288 3.418",viewW:40,viewH:50},kitchen_sink:{d:"M38.188 8.7h10.598c1.211 0 2.193.956 2.193 2.136v28.2c0 1.18-.982 2.136-2.193 2.136H11.08c-1.21 0-2.192-.956-2.192-2.136v-28.2c0-1.18.981-2.136 2.192-2.136h10.599m10.885-5.128V15.11c0 1.18-.981 2.136-2.192 2.136h-.877c-1.21 0-2.192-.957-2.192-2.136V3.572m5.261 7.691h3.07c1.21 0 2.192-.956 2.192-2.136v-.855c0-1.18-.982-2.136-2.192-2.136h-3.07m-5.261 5.127h-3.07c-1.21 0-2.192-.956-2.192-2.136v-.855c0-1.18.982-2.136 2.193-2.136h3.069M5.817 46.299h48.231c1.21 0 2.192-.956 2.192-2.136V5.709c0-1.18-.981-2.137-2.192-2.137H5.818c-1.211 0-2.193.957-2.193 2.137v38.454c0 1.18.982 2.136 2.192 2.136M33.44 25.79c0 1.888-1.57 3.418-3.507 3.418s-3.508-1.53-3.508-3.418c0-1.887 1.57-3.418 3.508-3.418s3.507 1.53 3.507 3.418",viewW:60,viewH:50},kitchen_sink_double:{d:"M53.173 12.182c-.468 0-.847.354-.847.79s.38.79.847.79zm21.979 1.58c.467 0 .846-.353.846-.79 0-.436-.379-.79-.846-.79zM6.01 3.572v.79h77.842v-1.58H6.01zM86.14 5.71h-.847v38.454h1.694V5.709zM83.85 46.3v-.79H6.01v1.58h77.842zM3.72 44.163h.847V5.709H2.873v38.454zm2.29 2.136v-.79c-.797 0-1.443-.603-1.443-1.346H2.873c0 1.616 1.404 2.926 3.137 2.926zm80.131-2.136h-.847c0 .743-.646 1.346-1.442 1.346v1.58c1.732 0 3.136-1.31 3.136-2.926zm-2.29-40.59v.79c.797 0 1.443.602 1.443 1.346h1.694c0-1.617-1.404-2.927-3.136-2.927zm-77.841 0v-.79c-1.733 0-3.137 1.31-3.137 2.926h1.694c0-.744.646-1.347 1.443-1.347zm5.494 37.599v.79h28.39v-1.58h-28.39zm30.68-2.136h.846v-28.2h-1.694v28.2zm-32.97-28.2h-.846v28.2h1.694v-28.2zM39.895 8.7v-.79h-5.669v1.58h5.669zm-22.721 0v-.79h-5.669v1.58h5.669zm-7.958 2.136h.847c0-.744.645-1.346 1.442-1.346V7.91c-1.732 0-3.136 1.31-3.136 2.926zm32.968 0h.847c0-1.616-1.404-2.927-3.136-2.927v1.58c.797 0 1.442.603 1.442 1.347zm-2.29 30.336v.79c1.733 0 3.137-1.31 3.137-2.926h-1.694c0 .743-.645 1.346-1.442 1.346zm-28.389 0v-.79c-.797 0-1.442-.603-1.442-1.346H8.368c0 1.616 1.404 2.926 3.136 2.926zm13.737-23.927v.79h.916v-1.58h-.916zm3.205-2.136h.847V3.572H27.6V15.11zM22.952 3.572h-.847V15.11h1.693V3.572zm3.205 13.673v.79c1.732 0 3.136-1.31 3.136-2.926H27.6c0 .743-.646 1.346-1.443 1.346zm-.916 0v-.79c-.797 0-1.443-.603-1.443-1.346h-1.693c0 1.616 1.404 2.926 3.136 2.926zm3.205-5.982v.79h3.206v-1.58h-3.206zm5.495-2.136h.847v-.855h-1.694v.855zm-2.29-2.991v-.79h-3.205v1.58h3.206zm2.29 2.136h.847c0-1.616-1.404-2.926-3.136-2.926v1.58c.796 0 1.442.603 1.442 1.346zm-2.29 2.991v.79c1.733 0 3.137-1.31 3.137-2.926h-1.694c0 .743-.646 1.346-1.442 1.346zm-11.905 0v.79h3.206v-1.58h-3.206zm3.206-5.127v-.79h-3.206v1.58h3.206zm-5.495 2.136h-.847v.855h1.694v-.855zm2.29-2.136v-.79c-1.733 0-3.137 1.31-3.137 2.926h1.694c0-.743.646-1.346 1.442-1.346zm0 5.127v-.79c-.797 0-1.443-.603-1.443-1.346H16.61c0 1.616 1.404 2.926 3.136 2.926zm9.615 14.527h-.847c0 1.452-1.26 2.628-2.816 2.628v1.58c2.49 0 4.51-1.884 4.51-4.208zM25.7 29.208v-.79c-1.555 0-2.816-1.176-2.816-2.628H21.19c0 2.324 2.02 4.209 4.51 4.209zm-3.663-3.418h.847c0-1.451 1.26-2.628 2.816-2.628v-1.58c-2.49 0-4.51 1.884-4.51 4.208zm3.663-3.418v.79c1.555 0 2.816 1.177 2.816 2.628h1.694c0-2.324-2.02-4.208-4.51-4.208zm24.268 18.8v.79h28.39v-1.58h-28.39zm30.68-2.136h.846v-28.2H79.8v28.2zM78.356 8.7v-.79h-28.39v1.58h28.39zm-30.68 2.136h-.846v28.2h1.694v-28.2zm2.29-2.136v-.79c-1.732 0-3.136 1.31-3.136 2.926h1.694c0-.744.646-1.346 1.442-1.346zm30.68 2.136h.846c0-1.616-1.404-2.927-3.136-2.927v1.58c.797 0 1.443.603 1.443 1.347zm-2.29 30.336v.79c1.732 0 3.136-1.31 3.136-2.926H79.8c0 .743-.646 1.346-1.443 1.346zm-28.39 0v-.79c-.796 0-1.442-.603-1.442-1.346H46.83c0 1.616 1.404 2.926 3.136 2.926zm3.206-28.2v.79h21.979v-1.58h-21.98z",viewW:90,viewH:50}};export{c as FURNITURE_ART_FINGERPRINT,a as GENERATED_FURNITURE_ART}; +globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="012abf4b3924ad03971870eb8085ab1ac1a66b0d9b6676fe095285a8b0f201ab";const c="012abf4b3924ad03971870eb8085ab1ac1a66b0d9b6676fe095285a8b0f201ab",a={coffee_table:{d:"M3.84 5.884c0-1.21 1.048-2.192 2.34-2.192h107.64c1.293 0 2.34.981 2.34 2.192v48.23c0 1.212-1.047 2.193-2.34 2.193H6.18c-1.292 0-2.34-.981-2.34-2.192z M103.056 15.093V9.83a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877m0 35.078v-5.262a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877m-93.6-35.077V9.83a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877m0 35.078v-5.262a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877",viewW:120,viewH:60},coffee_table_round:{d:"M3.765 40a36.235 36.235 0 1 0 72.47 0 36.235 36.235 0 1 0-72.47 0 m56.26 26.96-3.843-3.843a.906.906 0 0 1 0-1.28l3.843-3.844a.906.906 0 0 1 1.281 0l3.844 3.843a.906.906 0 0 1 0 1.281l-3.844 3.844a.906.906 0 0 1-1.28 0m-.001 34.66-3.843-3.843a.906.906 0 0 1 0-1.281l3.843-3.844a.906.906 0 0 1 1.281 0l3.843 3.844a.906.906 0 0 1 0 1.28l-3.843 3.844a.906.906 0 0 1-1.281 0m-34.423-34.66-3.843-3.843a.906.906 0 0 1 0-1.281l3.843-3.844a.906.906 0 0 1 1.281 0l3.844 3.844a.906.906 0 0 1 0 1.28l-3.844 3.844a.906.906 0 0 1-1.28 0m-.001 34.66-3.843-3.843a.906.906 0 0 1 0-1.281l3.843-3.843a.906.906 0 0 1 1.281 0l3.844 3.843a.906.906 0 0 1 0 1.281l-3.844 3.843a.906.906 0 0 1-1.28 0",viewW:80,viewH:80},coffee_table_oval:{d:"M3.84 30c0-14.53 12.572-26.308 28.08-26.308h56.16c15.509 0 28.08 11.778 28.08 26.308s-12.571 26.307-28.08 26.307H31.92C16.412 56.307 3.84 44.53 3.84 30 M80.592 15.093V9.83a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877m0 35.077v-5.262a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877M31.92 15.093V9.83a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.876h-5.616a.936.877 0 0 1-.936-.876m0 35.077v-5.262a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.876h-5.616a.936.877 0 0 1-.936-.876",viewW:120,viewH:60},coffee_table_rounded:{d:"M3.84 12.461c0-4.843 4.19-8.77 9.36-8.77h93.6c5.17 0 9.36 3.927 9.36 8.77v35.077c0 4.843-4.19 8.77-9.36 8.77H13.2c-5.17 0-9.36-3.927-9.36-8.77z M103.056 15.093V9.83a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877m0 35.078v-5.262a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877m-93.6-35.077V9.83a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877m0 35.078v-5.262a.936.877 0 0 1 .936-.877h5.616a.936.877 0 0 1 .936.877v5.262a.936.877 0 0 1-.936.877h-5.616a.936.877 0 0 1-.936-.877",viewW:120,viewH:60},table_dining:{d:"M3.879 6.08c0-1.265 1.065-2.29 2.378-2.29h147.484c1.314 0 2.38 1.025 2.38 2.29v77.84c0 1.265-1.066 2.29-2.38 2.29H6.257c-1.313 0-2.378-1.025-2.378-2.29z M138.994 19.358v-5.495a.952.916 0 0 1 .951-.915h5.71a.952.916 0 0 1 .95.915v5.495a.952.916 0 0 1-.95.916h-5.71a.952.916 0 0 1-.951-.916m-.001 56.778v-5.495a.952.916 0 0 1 .952-.915h5.709a.952.916 0 0 1 .951.915v5.495a.952.916 0 0 1-.951.916h-5.71a.952.916 0 0 1-.95-.916m-125.6-56.778v-5.495a.952.916 0 0 1 .951-.916h5.71a.952.916 0 0 1 .95.916v5.495a.952.916 0 0 1-.95.915h-5.71a.952.916 0 0 1-.951-.915m-.001 56.779v-5.495a.952.916 0 0 1 .952-.916h5.709a.952.916 0 0 1 .951.916v5.495a.952.916 0 0 1-.951.915h-5.71a.952.916 0 0 1-.95-.915",viewW:160,viewH:90},table_round:{d:"M3.826 55a51.174 51.174 0 1 0 102.349 0A51.174 51.174 0 1 0 3.826 55 m81.005 32.303-3.947-3.947a.93.93 0 0 1 0-1.316l3.947-3.948a.93.93 0 0 1 1.316 0l3.948 3.948a.93.93 0 0 1 0 1.316l-3.948 3.947a.93.93 0 0 1-1.316 0m0 54.897-3.947-3.948a.93.93 0 0 1 0-1.316l3.947-3.947a.93.93 0 0 1 1.316 0l3.948 3.947a.93.93 0 0 1 0 1.316L82.32 87.2a.93.93 0 0 1-1.316 0M27.04 32.304l-3.947-3.948a.93.93 0 0 1 0-1.315l3.948-3.948a.93.93 0 0 1 1.315 0l3.948 3.948a.93.93 0 0 1 0 1.315l-3.948 3.948a.93.93 0 0 1-1.315 0m-.001 54.604-3.947-3.948a.93.93 0 0 1 0-1.316l3.948-3.947a.93.93 0 0 1 1.315 0l3.948 3.947a.93.93 0 0 1 0 1.316l-3.948 3.948a.93.93 0 0 1-1.315 0",viewW:110,viewH:110},table_dining_oval:{d:"M3.892 50c0-25.51 21.418-46.19 47.838-46.19h76.54c26.42 0 47.839 20.68 47.839 46.19S154.69 96.19 128.27 96.19H51.73C25.31 96.19 3.892 75.51 3.892 50 M122.53 19.514V13.97a.957.924 0 0 1 .956-.924h5.74a.957.924 0 0 1 .958.924v5.543a.957.924 0 0 1-.957.924h-5.74a.957.924 0 0 1-.958-.924m.001 66.516v-5.543a.957.924 0 0 1 .957-.924h5.74a.957.924 0 0 1 .957.924v5.543a.957.924 0 0 1-.957.924h-5.74a.957.924 0 0 1-.957-.924M49.816 19.515v-5.543a.957.924 0 0 1 .957-.924h5.74a.957.924 0 0 1 .958.924v5.542a.957.924 0 0 1-.957.924h-5.74a.957.924 0 0 1-.958-.924m0 66.516v-5.543a.957.924 0 0 1 .957-.924h5.74a.957.924 0 0 1 .957.924v5.543a.957.924 0 0 1-.957.923h-5.74a.957.924 0 0 1-.957-.924",viewW:180,viewH:100},table_dining_rounded:{d:"M3.879 17.527c0-7.587 6.39-13.737 14.272-13.737h123.696c7.883 0 14.273 6.15 14.273 13.737v54.947c0 7.587-6.39 13.737-14.273 13.737H18.151c-7.882 0-14.272-6.15-14.272-13.737z M138.994 19.358v-5.495a.952.916 0 0 1 .951-.915h5.71a.952.916 0 0 1 .95.915v5.495a.952.916 0 0 1-.95.916h-5.71a.952.916 0 0 1-.951-.916m-.001 56.778v-5.495a.952.916 0 0 1 .952-.915h5.709a.952.916 0 0 1 .951.915v5.495a.952.916 0 0 1-.951.916h-5.71a.952.916 0 0 1-.95-.916m-125.6-56.778v-5.495a.952.916 0 0 1 .951-.916h5.71a.952.916 0 0 1 .95.916v5.495a.952.916 0 0 1-.95.915h-5.71a.952.916 0 0 1-.951-.915m-.001 56.779v-5.495a.952.916 0 0 1 .952-.916h5.709a.952.916 0 0 1 .951.916v5.495a.952.916 0 0 1-.951.915h-5.71a.952.916 0 0 1-.95-.915",viewW:160,viewH:90},desk:{d:"M3.862 5.967c0-1.234 1.057-2.234 2.362-2.234h127.552c1.305 0 2.362 1 2.362 2.234v58.066c0 1.234-1.057 2.233-2.362 2.233H6.224c-1.305 0-2.362-1-2.362-2.233z M9.531 15.346v-5.36a.945.893 0 0 1 .945-.893h5.67a.945.893 0 0 1 .944.893v5.36a.945.893 0 0 1-.945.894h-5.669a.945.893 0 0 1-.945-.894m113.379.001v-5.36a.945.893 0 0 1 .945-.894h5.67a.945.893 0 0 1 .944.894v5.36a.945.893 0 0 1-.945.893h-5.669a.945.893 0 0 1-.945-.893M9.53 60.013v-5.36a.945.893 0 0 1 .946-.893h5.669a.945.893 0 0 1 .945.893v5.36a.945.893 0 0 1-.945.894h-5.67a.945.893 0 0 1-.944-.894m113.38.001v-5.36a.945.893 0 0 1 .945-.894h5.669a.945.893 0 0 1 .945.894v5.36a.945.893 0 0 1-.945.893h-5.67a.945.893 0 0 1-.944-.893m-97.318-2.681h88.814",viewW:140,viewH:70},desk_corner:{d:"M156.12 66.202a2.38 2.38 0 0 1-2.379 2.38H94.272c-13.138 0-23.788 10.65-23.788 23.787v61.372a2.38 2.38 0 0 1-2.379 2.38H6.257a2.38 2.38 0 0 1-2.378-2.38V6.257A2.38 2.38 0 0 1 6.257 3.88h147.484a2.38 2.38 0 0 1 2.38 2.378z M9.588 16.249v-5.71a.95.95 0 0 1 .951-.95h5.71a.95.95 0 0 1 .95.95v5.71a.95.95 0 0 1-.95.951h-5.71a.95.95 0 0 1-.951-.951m133.212.001v-5.71a.95.95 0 0 1 .951-.951h5.71a.95.95 0 0 1 .95.951v5.71a.95.95 0 0 1-.95.951h-5.71a.95.95 0 0 1-.951-.951m0 45.672v-5.71a.95.95 0 0 1 .952-.951h5.709a.95.95 0 0 1 .951.951v5.71a.95.95 0 0 1-.951.951h-5.71a.95.95 0 0 1-.95-.951M9.587 149.46v-5.708a.95.95 0 0 1 .952-.952h5.709a.95.95 0 0 1 .951.952v5.709a.95.95 0 0 1-.951.951h-5.71a.95.95 0 0 1-.951-.951m47.576 0v-5.709a.95.95 0 0 1 .952-.951h5.709a.95.95 0 0 1 .951.951v5.71a.95.95 0 0 1-.951.95h-5.71a.95.95 0 0 1-.951-.95m51.382-90.396H95.569a34.6 34.6 0 0 0-34.6 34.6v12.976",viewW:160,viewH:160},chair:{d:"M39.452 12.433H10.548a4.398 4.398 0 1 1 0-8.796h28.904a4.398 4.398 0 0 1 0 8.796m-28.904 0H8.035a4.4 4.4 0 0 0-4.398 4.399V40.08a6.283 6.283 0 0 0 6.283 6.284h30.16a6.283 6.283 0 0 0 6.284-6.284V16.832c0-2.43-1.97-4.399-4.399-4.399h-2.513",viewW:50,viewH:50},chair_bar:{d:"M38.579 17.168c1.326 2.526 1.947 6.015 1.947 9.071 0 10.018-8.07 18.139-18.025 18.139S4.475 36.257 4.475 26.239c0-3.056.586-6.552 1.912-9.078m32.192.007a3.59 3.59 0 0 1-3.333-.976m3.333.976a3.6 3.6 0 0 0 1.765-.976m-33.827.996-.13-.027a3.6 3.6 0 0 1-1.731-.969m30.59 0a18 18 0 0 0-5.848-3.932 17.93 17.93 0 0 0-13.796 0 18 18 0 0 0-5.848 3.932 3.59 3.59 0 0 1-3.237.996m28.729-.996a3.59 3.59 0 0 0 5.098 0m-33.827.996a3.6 3.6 0 0 1-1.861-.996 3.644 3.644 0 0 1 0-5.13 25.2 25.2 0 0 1 8.187-5.505A25.1 25.1 0 0 1 22.5 3.623a25.1 25.1 0 0 1 9.657 1.934 25.2 25.2 0 0 1 8.187 5.505 3.644 3.644 0 0 1 0 5.13",viewW:45,viewH:48},armchair:{d:"M75.702 13.011q.012-.225.012-.453c0-4.843-3.917-8.768-8.748-8.768H23.034c-4.83 0-8.747 3.925-8.747 8.768q0 .228.011.453M77.132 72.09q.59.091 1.206.092c4.348 0 7.873-3.533 7.873-7.892V20.45c0-4.359-3.525-7.892-7.873-7.892-.924 0-1.812.16-2.636.453a7.89 7.89 0 0 0-5.237 7.438v.148m0 0a8.7 8.7 0 0 1-3.499.73H23.034a8.7 8.7 0 0 1-3.499-.73m50.93 0V64.29a7.89 7.89 0 0 0 6.667 7.8M14.298 13.01a7.89 7.89 0 0 1 5.237 7.438v.148m0 0V64.29a7.89 7.89 0 0 1-6.666 7.8q-.59.091-1.206.092c-4.348 0-7.873-3.533-7.873-7.892V20.45c0-4.359 3.525-7.892 7.873-7.892.924 0 1.811.16 2.635.453M77.132 72.09c-1.585 8.05-8.667 14.12-17.164 14.12H30.032c-8.496 0-15.578-6.07-17.163-14.12",viewW:90,viewH:90},armchair_office:{d:"M56.968 18.845q0-.368-.05-.72M49.051 13.8H15.95a5.04 5.04 0 0 1-5.038-5.043 5.04 5.04 0 0 1 5.038-5.043h33.103a5.04 5.04 0 0 1 5.038 5.043 5.04 5.04 0 0 1-5.038 5.043m-33.103 0h-2.88a5.04 5.04 0 0 0-4.986 4.323M49.052 13.8h2.879a5.04 5.04 0 0 1 4.986 4.324m.051 24.826a4.32 4.32 0 0 0 4.318-4.323v-16.18a4.32 4.32 0 0 0-4.369-4.322m.051 24.826a4.32 4.32 0 0 1-4.318-4.323V22.447a4.32 4.32 0 0 1 4.267-4.322m-11.84 37.24h4.695c.736 0 1.446-.111 2.115-.317a7.21 7.21 0 0 0 5.081-6.889v-5.208M8.084 18.124h-.051a4.32 4.32 0 0 0-4.318 4.323v16.18a4.32 4.32 0 0 0 4.318 4.324 4.32 4.32 0 0 0 4.317-4.323V22.447a4.32 4.32 0 0 0-4.266-4.323m11.935 37.24h-4.79a7.2 7.2 0 0 1-2.04-.294 7.21 7.21 0 0 1-5.156-6.91v-5.21m37.045 12.414 5.177 5.183c.969.97 2.534.987 3.524.038a2.526 2.526 0 0 0 .038-3.605l-1.93-1.932m-6.81.316H20.02m-6.83-.294-1.909 1.91c-.998 1-.98 2.627.038 3.605.99.949 2.555.932 3.524-.038l5.177-5.183",viewW:65,viewH:65},sofa:{d:"M90 19.365v57.111m0-57.11V7.683m0 11.681c0 2.151-1.836 3.894-4.1 3.894H30.544a10.7 10.7 0 0 1-4.136-.825M90 19.365c0 2.151 1.836 3.894 4.1 3.894h55.356c1.472 0 2.871-.294 4.137-.825M90 76.476c0 5.376-4.59 9.735-10.25 9.735H30.543c-5.266 0-9.605-3.772-10.185-8.625M90 76.476c0 5.376 4.59 9.735 10.25 9.735h49.206c5.266 0 9.605-3.772 10.185-8.625M90 7.684c0-2.15-1.837-3.894-4.101-3.894H30.544c-5.661 0-10.25 4.358-10.25 9.735q0 .416.036.825M90 7.684c0-2.15 1.836-3.894 4.1-3.894h55.356c5.661 0 10.25 4.358 10.25 9.735q0 .416-.036.825m0 0a10.7 10.7 0 0 1 4.137-.825h2.05c5.662 0 10.252 4.358 10.252 9.734v45.43c0 5.376-4.59 9.734-10.251 9.734h-2.05c-1.484 0-2.894-.3-4.167-.837m0 0c-3.585-1.517-6.084-4.93-6.084-8.898V23.26q0-.417.036-.825c.32-3.622 2.728-6.68 6.077-8.084m-139.34 0c3.35 1.404 5.758 4.462 6.078 8.084q.036.408.036.825v45.43c0 3.967-2.5 7.38-6.085 8.897a10.7 10.7 0 0 1-4.166.837h-2.05c-5.662 0-10.251-4.358-10.251-9.735V23.26c0-5.376 4.59-9.734 10.25-9.734h2.05c1.473 0 2.872.294 4.138.825",viewW:180,viewH:90},sofa_three_seat:{d:"M86.553 18.593V76.96m0-58.366V7.491m0 11.102c0 2.044-1.762 3.701-3.935 3.701H29.496c-1.413 0-2.756-.28-3.97-.784m61.027-2.917c0 2.044 1.762 3.701 3.935 3.701h59.024c2.174 0 3.935-1.657 3.935-3.7M86.553 76.958c0 5.11-4.404 9.252-9.837 9.252h-47.22c-5.054 0-9.218-3.585-9.775-8.198m66.832-1.054c0 5.11 4.404 9.252 9.837 9.252h47.22c5.433 0 9.837-4.142 9.837-9.252m0-58.366V76.96m0-58.366V7.491m0 11.102c0 2.044 1.762 3.701 3.936 3.701h53.122c1.413 0 2.756-.28 3.97-.784m-61.028 55.449c0 5.11 4.405 9.252 9.838 9.252h47.22c5.054 0 9.218-3.585 9.775-8.198M86.553 7.491c0-2.044-1.762-3.701-3.935-3.701H29.496c-5.433 0-9.838 4.142-9.838 9.252q0 .396.035.784m66.86-6.335c0-2.044 1.762-3.701 3.935-3.701h59.024c2.174 0 3.935 1.657 3.935 3.7m0 0c0-2.043 1.762-3.7 3.936-3.7h53.122c5.433 0 9.838 4.142 9.838 9.252 0 .258.022.517 0 .77m-.063 64.201c1.22.512 2.574.796 3.998.796h1.967c5.433 0 9.837-4.142 9.837-9.252V22.294c0-5.11-4.404-9.252-9.837-9.252h-1.967c-5.153 0-9.38 3.725-9.803 8.468q-.036.387-.035.784v47.263c0 3.771 2.399 7.015 5.84 8.456M19.693 13.826a10.3 10.3 0 0 0-3.97-.784h-1.967c-5.433 0-9.838 4.142-9.838 9.252v47.263c0 5.11 4.405 9.252 9.838 9.252h1.967c1.424 0 2.777-.284 3.998-.796 3.441-1.441 5.84-4.685 5.84-8.456V22.294a9 9 0 0 0-.035-.784c-.307-3.443-2.618-6.349-5.833-7.684",viewW:240,viewH:90},sofa_corner_right:{d:"M93.673 20.687V83.69m0-63.004v-12.6m0 12.6c0 2.32-1.913 4.2-4.273 4.2H31.704a10.8 10.8 0 0 1-4.311-.89m66.28-3.31c0 2.32 1.914 4.2 4.274 4.2h64.106c2.36 0 4.274-1.88 4.274-4.2M93.673 83.692c0 5.8-4.783 10.501-10.684 10.501H31.704c-5.489 0-10.011-4.068-10.616-9.304m72.585-1.197c0 5.8 4.784 10.501 10.684 10.501h51.286c5.9 0 10.684-4.701 10.684-10.5m0-63.005V83.69m0-63.004v-12.6m0 12.6c0 2.32 1.914 4.2 4.273 4.2h57.696c1.534 0 2.993-.317 4.312-.89m-66.28 59.695v71.923c0 5.799 4.782 10.5 10.684 10.5h51.284c5.49 0 10.012-4.068 10.616-9.304V84.888M93.673 8.086c0-2.32-1.913-4.2-4.273-4.2H31.704c-5.9 0-10.684 4.7-10.684 10.5q0 .45.038.89m72.615-7.19c0-2.32 1.914-4.2 4.274-4.2h64.106c2.36 0 4.274 1.88 4.274 4.2m0 0c0-2.32 1.914-4.2 4.273-4.2h57.696c5.9 0 10.685 4.7 10.685 10.5 0 .293.024.587 0 .874m-.07 69.628c1.327.58 2.797.904 4.344.904h2.136c5.901 0 10.684-4.702 10.684-10.501V24.887c0-5.8-4.783-10.5-10.684-10.5h-2.136c-5.596 0-10.187 4.227-10.647 9.61q-.038.44-.038.89V75.29c0 4.28 2.605 7.961 6.342 9.597M21.059 15.276a10.8 10.8 0 0 0-4.312-.89H14.61c-5.9 0-10.684 4.701-10.684 10.5v50.405c0 5.8 4.783 10.5 10.684 10.5h2.137c1.546 0 3.016-.322 4.342-.903 3.737-1.636 6.342-5.317 6.342-9.597V24.887q0-.45-.037-.89c-.334-3.907-2.844-7.206-6.335-8.72",viewW:260,viewH:170},bed_single:{d:"M3.79 14.024c0 5.59 4.318 10.122 9.645 10.122h63.13c5.328 0 9.646-4.532 9.646-10.122m-22.797 46.93V46.23c0-5.082-3.926-9.201-8.769-9.201h-19.29c-4.842 0-8.768 4.12-8.768 9.201v14.723m-22.797 0h82.42m0 22.085H3.79m8.768 113.06h64.885c4.842 0 8.768-4.12 8.768-9.202V13.104c0-5.082-3.926-9.202-8.768-9.202H12.558c-4.843 0-8.768 4.12-8.768 9.202v173.792c0 5.082 3.925 9.202 8.768 9.202",viewW:90,viewH:200},bed_double:{d:"M3.879 14.073c0 5.618 4.516 10.172 10.088 10.172h132.065c5.571 0 10.088-4.554 10.088-10.172m-81.165 47.16V46.438c0-5.107-4.106-9.247-9.171-9.247H45.607c-5.065 0-9.17 4.14-9.17 9.247v14.795m89.877 0V46.438c0-5.107-4.107-9.247-9.172-9.247H96.966c-5.065 0-9.171 4.14-9.171 9.247v14.795m-83.916 0H156.12m0 22.192H3.88m9.17 112.673h133.9c5.065 0 9.171-4.14 9.171-9.247V13.15c0-5.107-4.106-9.247-9.171-9.247H13.05c-5.064 0-9.17 4.14-9.17 9.247v173.7c0 5.107 4.106 9.247 9.17 9.247",viewW:160,viewH:200},nightstand:{d:"M5.773 3.555h38.454a2.136 2.056 0 0 1 2.137 2.056v28.777a2.136 2.056 0 0 1-2.137 2.056H5.773a2.136 2.056 0 0 1-2.136-2.056V5.611a2.136 2.056 0 0 1 2.136-2.056",viewW:50,viewH:40},cabinet_tv:{d:"M56.772 17.88h5.315m0 0h5.315m-5.315 0v9.214m9.832-9.214 5.315 9.45 5.314-9.45M6.224 41.4h127.552c1.305 0 2.362-.94 2.362-2.1V5.7c0-1.16-1.057-2.1-2.362-2.1H6.224c-1.305 0-2.362.94-2.362 2.1v33.6c0 1.16 1.057 2.1 2.362 2.1",viewW:140,viewH:45},cabinet_shoe:{d:"m39.722 16.231 1.505-1.596m1.134 3.15 1.53-1.738M6.03 31.5h67.94c1.251 0 2.265-.895 2.265-2v-24c0-1.105-1.014-2-2.264-2H6.03c-1.251 0-2.265.895-2.265 2v24c0 1.105 1.014 2 2.265 2m41.966-14.305L46.92 17.1a3.4 3.4 0 0 1-1.813-.706l-4.583-3.62c-1.264-1-3.277-.326-3.475 1.161-.185 1.39-1.983 2.1-3.28 1.299l-1.532-.947c-.968-.513-2.2.103-2.2 1.1v3.463c0 1.559 1.43 2.823 3.196 2.823h14.51c1.404 0 2.542-1.005 2.542-2.245 0-1.153-.99-2.118-2.289-2.233",viewW:80,viewH:35},cabinet_sink:{d:"M3.765 5.773c0-1.18 1.014-2.136 2.265-2.136h67.94c1.251 0 2.265.956 2.265 2.136v38.454c0 1.18-1.014 2.137-2.264 2.137H6.03c-1.251 0-2.265-.957-2.265-2.137z M36.088 32.135c2.525 1.88 6.205 1.88 8.73 0s3.167-5.101 1.52-7.637l-5.879-8.043-5.893 8.043c-1.644 2.536-1.003 5.755 1.522 7.637",viewW:80,viewH:50},bookshelf:{d:"M57.12 20.488H45.473c-.514 0-1.008.124-1.372.345s-.568.52-.568.832m4.076-8.236h5.434M6.119 3.5h87.762c1.276 0 2.31.895 2.31 2v24c0 1.105-1.034 2-2.31 2H6.12c-1.275 0-2.31-.895-2.31-2v-24c0-1.105 1.035-2 2.31-2m51 6.4v14.118H45.474a2.04 2.04 0 0 1-1.372-.517 1.7 1.7 0 0 1-.568-1.248V11.665c0-.468.204-.917.568-1.248a2.04 2.04 0 0 1 1.372-.517z",viewW:100,viewH:35},wall_unit:{d:"M6.336 41.4h227.328a2.418 2.1 0 0 0 2.418-2.1V5.7a2.418 2.1 0 0 0-2.418-2.1H6.336a2.418 2.1 0 0 0-2.418 2.1v33.6a2.418 2.1 0 0 0 2.418 2.1m43.744-5.88V9.48m46.432 26.04V9.48m46.433 26.04V9.48m46.433 26.04V9.48",viewW:240,viewH:45},wardrobe:{d:"M93.87 20.25a3.3 3.3 0 0 0-1.072-2.407 3.8 3.8 0 0 0-2.586-.997c-.97 0-1.9.358-2.587.997a3.3 3.3 0 0 0-1.071 2.407c0 2.838 1.225 5.107 3.658 6.81h-.015m0 0 14.58 7.537c.57.295 1.046.726 1.377 1.25.331.523.505 1.12.505 1.727v1.401a3.3 3.3 0 0 1-1.071 2.407 3.8 3.8 0 0 1-2.587.998H77.393a3.8 3.8 0 0 1-2.586-.998 3.3 3.3 0 0 1-1.072-2.407v-1.4c0-.608.174-1.205.505-1.728a3.55 3.55 0 0 1 1.377-1.25zM6.284 3.691h167.433c1.32 0 2.392.981 2.392 2.192v48.23c0 1.212-1.071 2.193-2.392 2.193H6.284c-1.321 0-2.392-.981-2.392-2.192V5.885c0-1.212 1.07-2.193 2.392-2.193",viewW:180,viewH:60},kitchen_floor:{d:"M3.692 5.884c0-1.21.981-2.192 2.192-2.192h48.23c1.212 0 2.193.981 2.193 2.192v48.23a2.19 2.19 0 0 1-2.192 2.193H5.885a2.19 2.19 0 0 1-2.193-2.192z",viewW:60,viewH:60},kitchen_floor_corner:{d:"M45.944 41.767a2.29 2.29 0 0 0 2.29 2.29H83.92a2.29 2.29 0 0 1 2.29 2.29V83.92a2.29 2.29 0 0 1-2.29 2.29H6.08a2.29 2.29 0 0 1-2.29-2.29V6.08a2.29 2.29 0 0 1 2.29-2.29h37.576a2.29 2.29 0 0 1 2.29 2.29z",viewW:90,viewH:90},kitchen_wall:{d:"m4.444 31.033 50.75-27.007m-50.752-.06 50.75 27.008M5.884 31.5h48.23c1.212 0 2.193-.895 2.193-2v-24c0-1.105-.981-2-2.192-2H5.885c-1.212 0-2.193.895-2.193 2v24c0 1.105.981 2 2.192 2",viewW:60,viewH:35},kitchen_wall_corner:{d:"M3.772 29.59 29.88 4.383M4.57 55.43 55.43 30M4.175 4.383l26.701 23.863m-27.184.877L55.43 55.43M28.41 3.692H5.884c-1.21 0-2.192.981-2.192 2.192v48.23c0 1.212.981 2.193 2.192 2.193h48.23a2.19 2.19 0 0 0 2.193-2.192V31.589c0-1.21-.981-2.192-2.192-2.192h-21.32a2.19 2.19 0 0 1-2.193-2.192V5.885a2.19 2.19 0 0 0-2.192-2.193",viewW:60,viewH:60},shelf_floor:{d:"M6.12 31.5h87.76a2.31 2 0 0 0 2.31-2v-24a2.31 2 0 0 0-2.31-2H6.12a2.31 2 0 0 0-2.31 2v24a2.31 2 0 0 0 2.31 2 M9.089 25.933c-.494.112-.776.546-.63.97s.664.675 1.157.564l-.263-.767zM90.912 9.067c.493-.112.775-.546.63-.97s-.664-.675-1.158-.564l.264.767zM11.875 26.956c.493-.112.775-.546.63-.97s-.664-.676-1.158-.564l.264.767zm3.988-2.556c-.493.112-.775.546-.63.969s.664.676 1.158.564l-.264-.766zm5.045.511c.493-.112.775-.545.63-.969s-.664-.676-1.158-.564l.264.766zm3.988-2.555c-.493.111-.775.545-.63.968.146.424.664.677 1.158.565l-.264-.767zm5.044.51c.494-.111.776-.545.63-.968-.145-.424-.664-.676-1.157-.565l.263.767zm3.99-2.555c-.495.112-.777.546-.63.97.145.423.663.675 1.157.563l-.264-.766zm5.043.511c.494-.112.776-.545.63-.969s-.664-.676-1.158-.564l.264.767zm3.989-2.555c-.494.111-.776.545-.63.969s.664.676 1.157.564l-.263-.767zm5.044.51c.494-.11.776-.545.63-.968-.146-.424-.664-.676-1.158-.565l.264.767zm3.989-2.555c-.494.112-.776.546-.63.97.145.423.664.675 1.157.564l-.264-.767zm5.044.511c.493-.111.775-.545.63-.969s-.664-.676-1.158-.564l.264.767zm3.988-2.555c-.493.112-.775.545-.63.969s.664.676 1.158.564l-.264-.767zm5.045.51c.493-.11.775-.545.63-.968-.146-.424-.664-.676-1.158-.564l.264.766zm3.988-2.555c-.493.112-.775.546-.63.97s.664.675 1.158.564l-.264-.767zm5.044.511c.494-.111.776-.545.63-.968-.145-.424-.664-.677-1.157-.565l.264.767zm3.99-2.555c-.494.112-.777.545-.63.969.145.423.663.676 1.157.564l-.264-.766zm5.043.511c.494-.112.776-.546.63-.969s-.664-.676-1.157-.564l.263.766zm3.989-2.556c-.494.112-.776.546-.63.97s.664.676 1.158.564l-.264-.767zM9.353 26.7l.263.767 2.259-.511-.264-.767-.264-.767-2.258.511zm6.774-1.533.264.766 4.517-1.022-.264-.767-.264-.766-4.517 1.022zm9.033-2.045.264.767 4.516-1.022-.264-.767-.263-.767-4.517 1.023zm9.033-2.044.264.766 4.516-1.022-.264-.766-.264-.767-4.516 1.022zm9.033-2.045.263.767 4.517-1.022-.264-.767-.264-.767-4.516 1.023zm9.032-2.044.264.767 4.517-1.023-.264-.766-.264-.767-4.516 1.022zm9.033-2.045.264.767 4.517-1.022-.264-.767-.264-.766-4.517 1.022zm9.033-2.044.264.767 4.516-1.023-.263-.766-.264-.767-4.517 1.022zm9.033-2.044.264.766 4.516-1.022-.264-.767-.263-.766-4.517 1.022zM88.39 8.81l.264.767 2.258-.511-.264-.767-.264-.767-2.258.511z M9.089 9.067c-.494-.112-.776-.546-.63-.97s.664-.675 1.157-.564l-.263.767zm81.823 16.866c.493.112.775.546.63.97s-.664.675-1.158.564l.264-.767zM11.875 8.044c.493.112.775.546.63.97s-.664.676-1.158.564l.264-.767zm3.988 2.556c-.493-.112-.775-.546-.63-.969s.664-.676 1.158-.564l-.264.766zm5.045-.511c.493.112.775.545.63.969s-.664.676-1.158.564l.264-.766zm3.988 2.555c-.493-.111-.775-.545-.63-.968.146-.424.664-.677 1.158-.565l-.264.767zm5.044-.51c.494.111.776.545.63.968-.145.424-.664.676-1.157.565l.263-.767zm3.99 2.555c-.495-.112-.777-.546-.63-.97.145-.423.663-.675 1.157-.563l-.264.766zm5.043-.511c.494.112.776.545.63.969s-.664.676-1.158.564l.264-.767zm3.989 2.555c-.494-.111-.776-.545-.63-.969s.664-.676 1.157-.564l-.263.767zm5.044-.51c.494.11.776.545.63.968-.146.424-.664.676-1.158.565l.264-.767zm3.989 2.555c-.494-.112-.776-.546-.63-.97.145-.423.664-.675 1.157-.564l-.264.767zm5.044-.511c.493.111.775.545.63.969s-.664.676-1.158.564l.264-.767zm3.988 2.555c-.493-.112-.775-.545-.63-.969s.664-.676 1.158-.564l-.264.767zm5.045-.51c.493.11.775.545.63.968-.146.424-.664.676-1.158.564l.264-.766zm3.988 2.555c-.493-.112-.775-.546-.63-.97s.664-.675 1.158-.564l-.264.767zm5.044-.511c.494.111.776.545.63.968-.145.424-.664.677-1.157.565l.264-.767zm3.99 2.555c-.494-.112-.777-.545-.63-.969.145-.423.663-.676 1.157-.564l-.264.766zm5.043-.511c.494.112.776.546.63.969s-.664.676-1.157.564l.263-.766zm3.989 2.556c-.494-.112-.776-.546-.63-.97s.664-.676 1.158-.564l-.264.767zM9.353 8.3l.263-.767 2.259.511-.264.767-.264.767-2.258-.511zm6.774 1.533.264-.766 4.517 1.022-.264.767-.264.766-4.517-1.022zm9.033 2.045.264-.767 4.516 1.022-.264.767-.263.767-4.517-1.023zm9.033 2.044.264-.766 4.516 1.022-.264.766-.264.767-4.516-1.022zm9.033 2.045.263-.767 4.517 1.022-.264.767-.264.767-4.516-1.023zm9.032 2.044.264-.767 4.517 1.023-.264.766-.264.767-4.516-1.022zm9.033 2.045.264-.767 4.517 1.022-.264.767-.264.766-4.517-1.022zm9.033 2.044.264-.767 4.516 1.023-.263.766-.264.767-4.517-1.022zm9.033 2.044.264-.766 4.516 1.022-.264.767-.263.766-4.517-1.022zm9.033 2.045.264-.767 2.258.511-.264.767-.264.767-2.258-.511z",viewW:100,viewH:35},shelf_wall:{d:"M18.36 3.15v2.567c0 1.012-1.034 1.833-2.31 1.833h-.924c-1.275 0-2.309-.82-2.309-1.833V3.15m73.905 0v2.567c0 1.012-1.034 1.833-2.31 1.833h-.924c-1.275 0-2.31-.82-2.31-1.833V3.15m-75.29 0H93.65c1.276 0 2.31.82 2.31 1.833V19.65c0 1.012-1.034 1.833-2.31 1.833H5.888c-1.275 0-2.31-.82-2.31-1.833V4.983c0-1.012 1.035-1.833 2.31-1.833",viewW:100,viewH:25},cooktop_two:{d:"M15 30.982v-1.71m3.086 5.128h1.542M15 39.527v-1.709M10.372 34.4h1.542M5.84 46.364h18.322c1.331 0 2.41-1.196 2.41-2.67V6.306c0-1.475-1.079-2.67-2.41-2.67H5.839c-1.331 0-2.41 1.195-2.41 2.67v37.386c0 1.475 1.079 2.67 2.41 2.67m14.56-29.91c0 3.304-2.417 5.982-5.4 5.982-2.981 0-5.4-2.678-5.4-5.981s2.419-5.982 5.4-5.982c2.983 0 5.4 2.678 5.4 5.982M18.858 34.4c0 2.36-1.727 4.273-3.857 4.273s-3.857-1.913-3.857-4.273S12.87 30.127 15 30.127s3.857 1.913 3.857 4.273",viewW:30,viewH:50},stove:{d:"M41.4 35.261a.877.877 0 1 0-1.754 0zm4.384 6.138a.877.877 0 1 0 0-1.753zM41.4 44.03a.877.877 0 1 0-1.753 0zm-4.384-2.63a.877.877 0 1 0 0-1.754zM5.885 3.691v.877h48.23V2.815H5.885zm50.422 2.192h-.877v48.23h1.754V5.885zm-2.192 50.423v-.877H5.885v1.754h48.23zM3.692 54.115h.877V5.885H2.815v48.23zm2.192 2.192v-.877a1.315 1.315 0 0 1-1.315-1.315H2.815a3.07 3.07 0 0 0 3.07 3.069zm50.423-2.192h-.877c0 .726-.589 1.315-1.315 1.315v1.754a3.07 3.07 0 0 0 3.069-3.07zM54.115 3.692v.877c.726 0 1.315.589 1.315 1.315h1.754a3.07 3.07 0 0 0-3.07-3.069zm-48.23 0v-.877a3.07 3.07 0 0 0-3.07 3.07h1.754c0-.727.589-1.316 1.315-1.316zm19.73 36.83h-.877a5.26 5.26 0 0 1-5.262 5.262v1.754a7.015 7.015 0 0 0 7.016-7.015zm-6.139 6.139v-.877a5.26 5.26 0 0 1-5.261-5.261h-1.754a7.015 7.015 0 0 0 7.015 7.015zm-6.138-6.138h.877a5.26 5.26 0 0 1 5.261-5.262v-1.754a7.015 7.015 0 0 0-7.015 7.016zm6.138-6.139v.877a5.26 5.26 0 0 1 5.262 5.262h1.754a7.015 7.015 0 0 0-7.016-7.016zm27.185-14.908h-.877a5.26 5.26 0 0 1-5.261 5.262v1.754a7.015 7.015 0 0 0 7.015-7.016zm-6.138 6.139v-.877a5.26 5.26 0 0 1-5.262-5.262h-1.754a7.015 7.015 0 0 0 7.016 7.016zm-6.139-6.139h.877a5.26 5.26 0 0 1 5.262-5.261v-1.754a7.015 7.015 0 0 0-7.016 7.015zm6.139-6.138v.877a5.26 5.26 0 0 1 5.261 5.261h1.754a7.015 7.015 0 0 0-7.015-7.015zm4.384 27.185h-.877a3.51 3.51 0 0 1-3.507 3.507v1.754a5.26 5.26 0 0 0 5.261-5.261zm-4.384 4.384v-.877a3.51 3.51 0 0 1-3.508-3.507H35.26a5.26 5.26 0 0 0 5.262 5.261zm-4.385-4.384h.877a3.51 3.51 0 0 1 3.508-3.508V35.26a5.26 5.26 0 0 0-5.262 5.262zm4.385-4.385v.877a3.51 3.51 0 0 1 3.507 3.508h1.754a5.26 5.26 0 0 0-5.261-5.262zm0 .877h.876V35.26h-1.753v1.754zm3.508 3.508v.876h1.753v-1.753h-1.753zm-3.508 5.261h.876V44.03h-1.753v1.754zm-5.261-5.261v.876h1.753v-1.753h-1.753zm-9.647-21.047h-.877a5.26 5.26 0 0 1-5.262 5.262v1.754a7.015 7.015 0 0 0 7.016-7.016zm-6.139 6.139v-.877a5.26 5.26 0 0 1-5.261-5.262h-1.754a7.015 7.015 0 0 0 7.015 7.016zm-6.138-6.139h.877a5.26 5.26 0 0 1 5.261-5.261v-1.754a7.015 7.015 0 0 0-7.015 7.015zm6.138-6.138v.877a5.26 5.26 0 0 1 5.262 5.261h1.754a7.015 7.015 0 0 0-7.016-7.015z",viewW:60,viewH:60},tv:{d:"M45.134 10.766H6.18c-1.292 0-2.34.848-2.34 1.894v2.68c0 1.045 1.048 1.893 2.34 1.893h38.954m0-6.467V5.288c0-1.046 1.048-1.894 2.34-1.894h26.704c1.292 0 2.34.848 2.34 1.894v5.478m-31.384 0h31.384m0 0h37.302c1.293 0 2.34.848 2.34 1.894v2.68c0 1.045-1.047 1.893-2.34 1.893H76.518m-31.384 0v5.479c0 1.046 1.048 1.894 2.34 1.894h26.704c1.292 0 2.34-.848 2.34-1.894v-5.479m-31.384 0h31.384",viewW:120,viewH:28},tv_wall:{d:"M35.664 11.4c-.517 0-.936.269-.936.6s.419.6.936.6zm49.553 1.2c.517 0 .936-.269.936-.6s-.42-.6-.936-.6zM6.18 3v.6h107.64V2.4H6.18zm109.98 1.5h-.936v1.8h1.872V4.5zm-2.34 3.3v-.6H6.18v1.2h107.64zM3.84 6.3h.936V4.5H2.904v1.8zm2.34 1.5v-.6c-.775 0-1.404-.403-1.404-.9H2.904c0 1.16 1.467 2.1 3.276 2.1zm109.98-1.5h-.936c0 .497-.629.9-1.404.9v1.2c1.81 0 3.276-.94 3.276-2.1zM113.82 3v.6c.775 0 1.404.403 1.404.9h1.872c0-1.16-1.467-2.1-3.276-2.1zM6.18 3v-.6c-1.81 0-3.276.94-3.276 2.1h1.872c0-.497.629-.9 1.404-.9zm61.308 4.2h-.936V12h1.872V7.2zM52.512 12h.936V7.2h-1.872V12zm-16.848 0v.6h49.553v-1.2H35.664z",viewW:120,viewH:15},toilet:{d:"M3.555 48.976c0 9.55 7.125 17.29 15.914 17.29h1.061c8.79 0 15.914-7.74 15.914-17.29V5.966c0-1.233-.92-2.233-2.056-2.233H5.611c-1.135 0-2.056 1-2.056 2.234z M7.666 49.12c0 7.003 5.225 12.68 11.67 12.68h1.327c6.445 0 11.67-5.677 11.67-12.68V31.873c0-1.233-.92-2.233-2.056-2.233H9.722c-1.135 0-2.056 1-2.056 2.233zM33.792 3.733c1.465 0 2.652 1.29 2.652 2.882v12.103c0 1.592-1.187 2.882-2.652 2.882H6.208c-1.465 0-2.653-1.29-2.653-2.882V6.615c0-1.591 1.188-2.882 2.653-2.882z M24.11 50.186c0 2.467-1.84 4.467-4.11 4.467s-4.111-2-4.111-4.467 1.84-4.466 4.11-4.466 4.112 2 4.112 4.466",viewW:40,viewH:70},toilet_built_in:{d:"M3.555 34.56c0 9.263 7.125 16.774 15.914 16.774h1.061c8.79 0 15.914-7.51 15.914-16.775V5.833c0-1.196-.92-2.166-2.056-2.166H5.611c-1.135 0-2.056.97-2.056 2.166z M7.666 34.7c0 6.793 5.225 12.3 11.67 12.3h1.327c6.445 0 11.67-5.507 11.67-12.3V14.5c0-1.197-.92-2.167-2.056-2.167H9.722c-1.135 0-2.056.97-2.056 2.167z M24.11 35.733c0 2.394-1.84 4.334-4.11 4.334s-4.111-1.94-4.111-4.334 1.84-4.333 4.11-4.333 4.112 1.94 4.112 4.333",viewW:40,viewH:55},bathtub:{d:"M3.885 6c0-1.243 1.068-2.25 2.386-2.25h157.458c1.318 0 2.386 1.007 2.386 2.25v63c0 1.243-1.068 2.25-2.386 2.25H6.27c-1.318 0-2.386-1.007-2.386-2.25z M13.428 37.5c0-13.669 11.75-24.75 26.243-24.75h90.658c14.493 0 26.243 11.081 26.243 24.75s-11.75 24.75-26.243 24.75H39.67c-14.493 0-26.243-11.081-26.243-24.75 M31.56 37.5c0 2.237-1.923 4.05-4.295 4.05s-4.294-1.813-4.294-4.05 1.923-4.05 4.294-4.05c2.372 0 4.295 1.813 4.295 4.05",viewW:170,viewH:75},bathtub_corner:{d:"M3.862 6.224a2.36 2.36 0 0 1 2.362-2.362H133.97c1.197 0 2.168.97 2.168 2.168 0 71.857-58.251 130.108-130.108 130.108a2.17 2.17 0 0 1-2.168-2.168z M13.31 32.207c0-10.437 8.46-18.897 18.897-18.897h87.628a2.13 2.13 0 0 1 2.13 2.13c0 58.833-47.692 106.526-106.524 106.526a2.13 2.13 0 0 1-2.13-2.131z M32.207 27.483a4.724 4.724 0 1 1-9.449 0 4.724 4.724 0 0 1 9.449 0",viewW:140,viewH:140},bidet:{d:"M22.466 3.692v10.085c0 1.21-.92 2.192-2.055 2.192h-.822c-1.136 0-2.056-.981-2.056-2.192V3.692m4.933 8.77h2.878c1.135 0 2.056-.982 2.056-2.193v-.877c0-1.21-.92-2.192-2.056-2.192h-2.878m-4.933 5.262h-2.878c-1.135 0-2.055-.982-2.055-2.193v-.877c0-1.21.92-2.192 2.055-2.192h2.878M5.611 3.692h28.777c1.136 0 2.056.981 2.056 2.192v33.45c0 9.374-7.125 16.973-15.914 16.973h-1.06c-8.79 0-15.915-7.599-15.915-16.972V5.885c0-1.212.92-2.193 2.056-2.193m4.11 15.785h20.556c1.136 0 2.056.981 2.056 2.192v17.807c0 6.874-5.225 12.447-11.67 12.447h-1.327c-6.445 0-11.67-5.573-11.67-12.447V21.67c0-1.21.92-2.192 2.056-2.192m13.567 7.892c0 1.937-1.472 3.508-3.288 3.508-1.817 0-3.29-1.57-3.29-3.508s1.473-3.507 3.29-3.507 3.288 1.57 3.288 3.507",viewW:40,viewH:60},bidet_built_in:{d:"M17.318 12.182h-8.06c-.88 0-1.592.74-1.592 1.654v16.126c0 6.698 5.225 12.129 11.67 12.129h1.327c6.445 0 11.67-5.43 11.67-12.13V13.837c0-.914-.713-1.654-1.591-1.654H22.68m-.215-8.545v9.827c0 1.18-.92 2.136-2.055 2.136h-.822c-1.136 0-2.056-.956-2.056-2.136V3.637m10.689 8.545V3.637m-16.445 0v8.545M5.611 3.637h28.777c1.136 0 2.056.956 2.056 2.136v24.051c0 9.135-7.125 16.54-15.914 16.54h-1.06c-8.79 0-15.915-7.405-15.915-16.54V5.773c0-1.18.92-2.136 2.056-2.136M23.289 23.29c0 1.888-1.473 3.418-3.29 3.418s-3.288-1.53-3.288-3.418 1.472-3.418 3.289-3.418c1.816 0 3.288 1.53 3.288 3.418",viewW:40,viewH:50},kitchen_sink:{d:"M38.188 8.7h10.598c1.211 0 2.193.956 2.193 2.136v28.2c0 1.18-.982 2.136-2.193 2.136H11.08c-1.21 0-2.192-.956-2.192-2.136v-28.2c0-1.18.981-2.136 2.192-2.136h10.599m10.885-5.128V15.11c0 1.18-.981 2.136-2.192 2.136h-.877c-1.21 0-2.192-.957-2.192-2.136V3.572m5.261 7.691h3.07c1.21 0 2.192-.956 2.192-2.136v-.855c0-1.18-.982-2.136-2.192-2.136h-3.07m-5.261 5.127h-3.07c-1.21 0-2.192-.956-2.192-2.136v-.855c0-1.18.982-2.136 2.193-2.136h3.069M5.817 46.299h48.231c1.21 0 2.192-.956 2.192-2.136V5.709c0-1.18-.981-2.137-2.192-2.137H5.818c-1.211 0-2.193.957-2.193 2.137v38.454c0 1.18.982 2.136 2.192 2.136M33.44 25.79c0 1.888-1.57 3.418-3.507 3.418s-3.508-1.53-3.508-3.418c0-1.887 1.57-3.418 3.508-3.418s3.507 1.53 3.507 3.418",viewW:60,viewH:50},kitchen_sink_double:{d:"M53.173 12.182c-.468 0-.847.354-.847.79s.38.79.847.79zm21.979 1.58c.467 0 .846-.353.846-.79 0-.436-.379-.79-.846-.79zM6.01 3.572v.79h77.842v-1.58H6.01zM86.14 5.71h-.847v38.454h1.694V5.709zM83.85 46.3v-.79H6.01v1.58h77.842zM3.72 44.163h.847V5.709H2.873v38.454zm2.29 2.136v-.79c-.797 0-1.443-.603-1.443-1.346H2.873c0 1.616 1.404 2.926 3.137 2.926zm80.131-2.136h-.847c0 .743-.646 1.346-1.442 1.346v1.58c1.732 0 3.136-1.31 3.136-2.926zm-2.29-40.59v.79c.797 0 1.443.602 1.443 1.346h1.694c0-1.617-1.404-2.927-3.136-2.927zm-77.841 0v-.79c-1.733 0-3.137 1.31-3.137 2.926h1.694c0-.744.646-1.347 1.443-1.347zm5.494 37.599v.79h28.39v-1.58h-28.39zm30.68-2.136h.846v-28.2h-1.694v28.2zm-32.97-28.2h-.846v28.2h1.694v-28.2zM39.895 8.7v-.79h-5.669v1.58h5.669zm-22.721 0v-.79h-5.669v1.58h5.669zm-7.958 2.136h.847c0-.744.645-1.346 1.442-1.346V7.91c-1.732 0-3.136 1.31-3.136 2.926zm32.968 0h.847c0-1.616-1.404-2.927-3.136-2.927v1.58c.797 0 1.442.603 1.442 1.347zm-2.29 30.336v.79c1.733 0 3.137-1.31 3.137-2.926h-1.694c0 .743-.645 1.346-1.442 1.346zm-28.389 0v-.79c-.797 0-1.442-.603-1.442-1.346H8.368c0 1.616 1.404 2.926 3.136 2.926zm13.737-23.927v.79h.916v-1.58h-.916zm3.205-2.136h.847V3.572H27.6V15.11zM22.952 3.572h-.847V15.11h1.693V3.572zm3.205 13.673v.79c1.732 0 3.136-1.31 3.136-2.926H27.6c0 .743-.646 1.346-1.443 1.346zm-.916 0v-.79c-.797 0-1.443-.603-1.443-1.346h-1.693c0 1.616 1.404 2.926 3.136 2.926zm3.205-5.982v.79h3.206v-1.58h-3.206zm5.495-2.136h.847v-.855h-1.694v.855zm-2.29-2.991v-.79h-3.205v1.58h3.206zm2.29 2.136h.847c0-1.616-1.404-2.926-3.136-2.926v1.58c.796 0 1.442.603 1.442 1.346zm-2.29 2.991v.79c1.733 0 3.137-1.31 3.137-2.926h-1.694c0 .743-.646 1.346-1.442 1.346zm-11.905 0v.79h3.206v-1.58h-3.206zm3.206-5.127v-.79h-3.206v1.58h3.206zm-5.495 2.136h-.847v.855h1.694v-.855zm2.29-2.136v-.79c-1.733 0-3.137 1.31-3.137 2.926h1.694c0-.743.646-1.346 1.442-1.346zm0 5.127v-.79c-.797 0-1.443-.603-1.443-1.346H16.61c0 1.616 1.404 2.926 3.136 2.926zm9.615 14.527h-.847c0 1.452-1.26 2.628-2.816 2.628v1.58c2.49 0 4.51-1.884 4.51-4.208zM25.7 29.208v-.79c-1.555 0-2.816-1.176-2.816-2.628H21.19c0 2.324 2.02 4.209 4.51 4.209zm-3.663-3.418h.847c0-1.451 1.26-2.628 2.816-2.628v-1.58c-2.49 0-4.51 1.884-4.51 4.208zm3.663-3.418v.79c1.555 0 2.816 1.177 2.816 2.628h1.694c0-2.324-2.02-4.208-4.51-4.208zm24.268 18.8v.79h28.39v-1.58h-28.39zm30.68-2.136h.846v-28.2H79.8v28.2zM78.356 8.7v-.79h-28.39v1.58h28.39zm-30.68 2.136h-.846v28.2h1.694v-28.2zm2.29-2.136v-.79c-1.732 0-3.136 1.31-3.136 2.926h1.694c0-.744.646-1.346 1.442-1.346zm30.68 2.136h.846c0-1.616-1.404-2.927-3.136-2.927v1.58c.797 0 1.443.603 1.443 1.347zm-2.29 30.336v.79c1.732 0 3.136-1.31 3.136-2.926H79.8c0 .743-.646 1.346-1.443 1.346zm-28.39 0v-.79c-.796 0-1.442-.603-1.442-1.346H46.83c0 1.616 1.404 2.926 3.136 2.926zm3.206-28.2v.79h21.979v-1.58h-21.98z",viewW:90,viewH:50}};export{c as FURNITURE_ART_FINGERPRINT,a as GENERATED_FURNITURE_ART}; diff --git a/custom_components/houseplan/frontend/houseplan-assets/guard-DBKIUfbp.js b/custom_components/houseplan/frontend/houseplan-assets/guard-DBKIUfbp.js deleted file mode 100644 index 1612f5f1..00000000 --- a/custom_components/houseplan/frontend/houseplan-assets/guard-DBKIUfbp.js +++ /dev/null @@ -1 +0,0 @@ -globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae33533bdef7216a6d7d513ae04091";import{dS as r,dT as t,dU as e}from"./houseplan-card-DqlR1H6U.js";const s={},a=r(class extends t{constructor(){super(...arguments),this.ot=s}render(r,t){return t()}update(r,[t,s]){if(Array.isArray(t)){if(Array.isArray(this.ot)&&this.ot.length===t.length&&t.every((r,t)=>r===this.ot[t]))return e}else if(this.ot===t)return e;return this.ot=Array.isArray(t)?Array.from(t):t,this.render(t,s)}});export{a as i}; diff --git a/custom_components/houseplan/frontend/houseplan-assets/houseplan-card-DqlR1H6U.js b/custom_components/houseplan/frontend/houseplan-assets/houseplan-card-CrTmJZ8b.js similarity index 64% rename from custom_components/houseplan/frontend/houseplan-assets/houseplan-card-DqlR1H6U.js rename to custom_components/houseplan/frontend/houseplan-assets/houseplan-card-CrTmJZ8b.js index 0307d078..d09c71a0 100644 --- a/custom_components/houseplan/frontend/houseplan-assets/houseplan-card-DqlR1H6U.js +++ b/custom_components/houseplan/frontend/houseplan-assets/houseplan-card-CrTmJZ8b.js @@ -1,4 +1,4 @@ -globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae33533bdef7216a6d7d513ae04091";const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),n=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const i=this.t;if(t&&void 0===e){const t=void 0!==i&&1===i.length;t&&(e=n.get(i)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&n.set(i,e))}return e}toString(){return this.cssText}};const o=(e,...t)=>{const n=1===e.length?e[0]:t.reduce((t,i,n)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[n+1],e[0]);return new r(n,e,i)},s=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new r("string"==typeof e?e:e+"",void 0,i))(t)})(e):e,{is:a,defineProperty:l,getOwnPropertyDescriptor:c,getOwnPropertyNames:h,getOwnPropertySymbols:d,getPrototypeOf:u}=Object,p=globalThis,_=p.trustedTypes,m=_?_.emptyScript:"",g=p.reactiveElementPolyfillSupport,f=(e,t)=>e,v={toAttribute(e,t){switch(t){case Boolean:e=e?m:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},y=(e,t)=>!a(e,t),b={attribute:!0,type:String,converter:v,reflect:!1,useDefault:!1,hasChanged:y};Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;let w=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=b){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(e,i,t);void 0!==n&&l(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){const{get:n,set:r}=c(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:n,set(t){const o=n?.call(this);r?.call(this,t),this.requestUpdate(e,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??b}static _$Ei(){if(this.hasOwnProperty(f("elementProperties")))return;const e=u(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(f("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(f("properties"))){const e=this.properties,t=[...h(e),...d(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(s(e))}else void 0!==e&&t.push(s(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((i,n)=>{if(t)i.adoptedStyleSheets=n.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const t of n){const n=document.createElement("style"),r=e.litNonce;void 0!==r&&n.setAttribute("nonce",r),n.textContent=t.cssText,i.appendChild(n)}})(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,i);if(void 0!==n&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:v).toAttribute(t,i.type);this._$Em=e,null==r?this.removeAttribute(n):this.setAttribute(n,r),this._$Em=null}}_$AK(e,t){const i=this.constructor,n=i._$Eh.get(e);if(void 0!==n&&this._$Em!==n){const e=i.getPropertyOptions(n),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:v;this._$Em=n;const o=r.fromAttribute(t,e.type);this[n]=o??this._$Ej?.get(n)??o,this._$Em=null}}requestUpdate(e,t,i,n=!1,r){if(void 0!==e){const o=this.constructor;if(!1===n&&(r=this[e]),i??=o.getPropertyOptions(e),!((i.hasChanged??y)(r,t)||i.useDefault&&i.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:n,wrapped:r},o){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),!0!==r||void 0!==o)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===n&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,i]of e){const{wrapped:e}=i,n=this[t];!0!==e||this._$AL.has(t)||void 0===n||this.C(t,void 0,i,n)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[f("elementProperties")]=new Map,w[f("finalized")]=new Map,g?.({ReactiveElement:w}),(p.reactiveElementVersions??=[]).push("2.1.2");const k=globalThis,x=e=>e,S=k.trustedTypes,$=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,M="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,C="?"+R,T=`<${C}>`,D=document,A=()=>D.createComment(""),P=e=>null===e||"object"!=typeof e&&"function"!=typeof e,F=Array.isArray,z="[ \t\n\f\r]",I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,E=/>/g,N=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,L=/"/g,B=/^(?:script|style|textarea|title)$/i,q=e=>(t,...i)=>({_$litType$:e,strings:t,values:i}),j=q(1),W=q(2),U=Symbol.for("lit-noChange"),G=Symbol.for("lit-nothing"),V=new WeakMap,K=D.createTreeWalker(D,129);function Y(e,t){if(!F(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==$?$.createHTML(t):t}const X=(e,t)=>{const i=e.length-1,n=[];let r,o=2===t?"":3===t?"":"",s=I;for(let t=0;t"===l[0]?(s=r??I,c=-1):void 0===l[1]?c=-2:(c=s.lastIndex-l[2].length,a=l[1],s=void 0===l[3]?N:'"'===l[3]?L:H):s===L||s===H?s=N:s===O||s===E?s=I:(s=N,r=void 0);const d=s===N&&e[t+1].startsWith("/>")?" ":"";o+=s===I?i+T:c>=0?(n.push(a),i.slice(0,c)+M+i.slice(c)+R+d):i+R+(-2===c?t:d)}return[Y(e,o+(e[i]||"")+(2===t?"":3===t?"":"")),n]};class Z{constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let r=0,o=0;const s=e.length-1,a=this.parts,[l,c]=X(e,t);if(this.el=Z.createElement(l,i),K.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(n=K.nextNode())&&a.length0){n.textContent=S?S.emptyScript:"";for(let i=0;iF(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==G&&P(this._$AH)?this._$AA.nextSibling.data=e:this.T(D.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,n="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=Z.createElement(Y(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===n)this._$AH.p(t);else{const e=new Q(n,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=V.get(e.strings);return void 0===t&&V.set(e.strings,t=new Z(e)),t}k(e){F(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,n=0;for(const r of e)n===t.length?t.push(i=new ee(this.O(A()),this.O(A()),this,this.options)):i=t[n],i._$AI(r),n++;n2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=G}_$AI(e,t=this,i,n){const r=this.strings;let o=!1;if(void 0===r)e=J(this,e,t,0),o=!P(e)||e!==this._$AH&&e!==U,o&&(this._$AH=e);else{const n=e;let s,a;for(e=r[0],s=0;s{const n=i?.renderBefore??t;let r=n._$litPart$;if(void 0===r){const e=i?.renderBefore??null;n._$litPart$=r=new ee(t.insertBefore(A(),e),e,void 0,i??{})}return r._$AI(e),r},ce=globalThis;let he=class extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=le(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};he._$litElement$=!0,he.finalized=!0,ce.litElementHydrateSupport?.({LitElement:he});const de=ce.litElementPolyfillSupport;de?.({LitElement:he}),(ce.litElementVersions??=[]).push("4.2.2");const ue=2,pe=e=>(...t)=>({_$litDirective$:e,values:t});let _e=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};const{I:me}=se,ge=e=>e,fe=(e,t)=>void 0!==e?._$litType$,ve=()=>document.createComment(""),ye=(e,t,i)=>{const n=e._$AA.parentNode,r=void 0===t?e._$AB:t._$AA;if(void 0===i){const t=n.insertBefore(ve(),r),o=n.insertBefore(ve(),r);i=new me(t,o,e,e.options)}else{const t=i._$AB.nextSibling,o=i._$AM,s=o!==e;if(s){let t;i._$AQ?.(e),i._$AM=e,void 0!==i._$AP&&(t=e._$AU)!==o._$AU&&i._$AP(t)}if(t!==r||s){let e=i._$AA;for(;e!==t;){const t=ge(e).nextSibling;ge(n).insertBefore(e,r),e=t}}}return i},be=(e,t,i=e)=>(e._$AI(t,i),e),we={},ke=(e,t=we)=>e._$AH=t,xe=e=>e._$AH,Se=e=>{e._$AR(),e._$AA.remove()},$e=e=>(e=>null!=e?._$litType$?.h)(e)?e._$litType$.h:e.strings,Me=pe(class extends _e{constructor(e){super(e),this.et=new WeakMap}render(e){return[e]}update(e,[t]){const i=fe(this.it)?$e(this.it):null,n=fe(t)?$e(t):null;if(null!==i&&(null===n||i!==n)){const t=xe(e).pop();let n=this.et.get(i);if(void 0===n){const e=document.createDocumentFragment();n=le(G,e),n.setConnected(!1),this.et.set(i,n)}ke(n,[t]),ye(n,void 0,t)}if(null!==n){if(null===i||i!==n){const t=this.et.get(n);if(void 0!==t){const i=xe(t).pop();(e=>{e._$AR()})(e),ye(e,void 0,i),ke(e,[i])}}this.it=t}else this.it=void 0;return this.render(t)}}),Re=pe(class extends _e{constructor(){super(...arguments),this.key=G}render(e,t){return this.key=e,t}update(e,[t,i]){return t!==this.key&&(ke(e),this.key=t),i}}),Ce=(e,t,i)=>{const n=new Map;for(let r=t;r<=i;r++)n.set(e[r],r);return n},Te=pe(class extends _e{constructor(e){if(super(e),e.type!==ue)throw Error("repeat() can only be used in text expressions")}dt(e,t,i){let n;void 0===i?i=t:void 0!==t&&(n=t);const r=[],o=[];let s=0;for(const t of e)r[s]=n?n(t,s):s,o[s]=i(t,s),s++;return{values:o,keys:r}}render(e,t,i){return this.dt(e,t,i).values}update(e,[t,i,n]){const r=xe(e),{values:o,keys:s}=this.dt(t,i,n);if(!Array.isArray(r))return this.ut=s,o;const a=this.ut??=[],l=[];let c,h,d=0,u=r.length-1,p=0,_=o.length-1;for(;d<=u&&p<=_;)if(null===r[d])d++;else if(null===r[u])u--;else if(a[d]===s[p])l[p]=be(r[d],o[p]),d++,p++;else if(a[u]===s[_])l[_]=be(r[u],o[_]),u--,_--;else if(a[d]===s[_])l[_]=be(r[d],o[_]),ye(e,l[_+1],r[d]),d++,_--;else if(a[u]===s[p])l[p]=be(r[u],o[p]),ye(e,r[d],r[u]),u--,p++;else if(void 0===c&&(c=Ce(s,p,_),h=Ce(a,d,u)),c.has(a[d]))if(c.has(a[u])){const t=h.get(s[p]),i=void 0!==t?r[t]:null;if(null===i){const t=ye(e,r[d]);be(t,o[p]),l[p]=t}else l[p]=be(i,o[p]),ye(e,r[d],i),r[t]=null;p++}else Se(r[u]),u--;else Se(r[d]),d++;for(;p<=_;){const t=ye(e,l[_+1]);be(t,o[p]),l[p++]=t}for(;d<=u;){const e=r[d++];null!==e&&Se(e)}return this.ut=s,ke(e,l),U}}),De=new WeakMap;let Ae=0;class Pe extends he{constructor(){super(...arguments),this.title="",this.icon="",this.wide=!1,this.alert=!1,this.describedBy="",this.dismissOnScrim=!1,this.flexContent=!1,this.hass=null,this._opener=null,this._focusRoot=null,this._useHaDialog=null,this._closing=!1,this._overlays=[],this._titleId="hp-dialog-title-"+ ++Ae,this._focusInitial=()=>{const e=this._focusableElements(),t=e.find(e=>e.hasAttribute("autofocus"))||e[0]||(this._usesHaDialog()?null:this.renderRoot.querySelector(".close"))||this.renderRoot.querySelector(".surface")||this.renderRoot.querySelector("ha-dialog");t?.focus({preventScroll:!0})},this._requestClose=()=>{this._closing||(this._closing=!0,this.dispatchEvent(new CustomEvent("hp-close",{bubbles:!0,composed:!0})))},this._onKeyDown=e=>{if("Escape"===e.key){e.preventDefault(),e.stopImmediatePropagation(),this._pruneOverlays();const t=this._overlays[this._overlays.length-1];return t?void this._closeOverlay(t,"escape"):void this._requestClose()}if("Tab"!==e.key||this._usesHaDialog())return;const t=this.renderRoot.querySelector(".close"),i=t?[t,...this._focusableElements()]:this._focusableElements();if(!i.length)return e.preventDefault(),void this.renderRoot.querySelector(".surface")?.focus({preventScroll:!0});const n=this._deepActiveElement(),r=i[0],o=i[i.length-1];!e.shiftKey||n!==r&&i.includes(n)?e.shiftKey||n!==o||(e.preventDefault(),r.focus()):(e.preventDefault(),o.focus())},this._onFallbackCancel=e=>{e.preventDefault(),this._requestClose()},this._onFallbackClick=e=>{this.dismissOnScrim&&e.target===e.currentTarget&&this._requestClose()}}_usesHaDialog(){return!0===this._useHaDialog&&!this.alert}connectedCallback(){this.setAttribute("data-hp","dialog"),super.connectedCallback(),this._opener=this._deepActiveElement();const e=this.getRootNode();this._focusRoot=e;const t=De.get(e)||{dialogs:new Set,opener:this._opener};t.dialogs.add(this),De.set(e,t),null===this._useHaDialog&&(this._useHaDialog=!!customElements.get("ha-dialog")),this.addEventListener("keydown",this._onKeyDown,!0),queueMicrotask(()=>{this._ensureNativeModal()&&this._focusInitial()})}disconnectedCallback(){this.removeEventListener("keydown",this._onKeyDown,!0);const e=[...this._overlays];this._overlays=[];for(const t of e.reverse())t.close("disconnect");const t=this._focusRoot,i=this._opener;this._opener=null,this._focusRoot=null;const n=t?De.get(t):void 0;n?.dialogs.delete(this),super.disconnectedCallback(),t&&n&&requestAnimationFrame(()=>{const e=De.get(t);if(!e)return;if(!e.dialogs.size)return e.opener?.isConnected&&e.opener.focus({preventScroll:!0}),void De.delete(t);const n=i?.closest("hp-dialog");i?.isConnected&&n&&e.dialogs.has(n)&&i.focus({preventScroll:!0})})}firstUpdated(e){super.firstUpdated(e),this._ensureNativeModal(),queueMicrotask(()=>this._focusInitial())}updated(e){super.updated(e),this._ensureNativeModal()}_ensureNativeModal(){if(this._usesHaDialog()||!this.isConnected)return!1;const e=this.renderRoot.querySelector("dialog");if(!e?.isConnected)return!1;try{return!e.matches(":modal")&&(e.open&&e.close(),e.showModal(),!0)}catch{return!1}}_deepActiveElement(){let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e&&e!==document.body?e:null}_focusableElements(){const e=["[autofocus]","a[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[contenteditable="true"]','[tabindex]:not([tabindex="-1"])'].join(","),t=[],i=new Set,n=r=>{if(!i.has(r)){if(i.add(r),r instanceof HTMLElement){if(r.matches(e)&&t.push(r),r instanceof HTMLSlotElement){for(const e of r.assignedNodes({flatten:!0}))n(e);return}if(r.shadowRoot){for(const e of r.shadowRoot.childNodes)n(e);return}}for(const e of r.childNodes)n(e)}};for(const e of this.childNodes)n(e);const r=this.overlayPortal();return r&&n(r),t.filter(e=>{let t=e;for(;t;){const e=getComputedStyle(t);if(t.hidden||t.inert||"true"===t.getAttribute("aria-hidden")||"none"===e.display||"hidden"===e.visibility)return!1;if(t=t.assignedSlot||t.parentElement||(t.getRootNode()instanceof ShadowRoot?t.getRootNode().host:null),t===this)break}return!0})}rejectClose(){this._closing=!1,this.requestUpdate()}_pruneOverlays(){this._overlays=this._overlays.filter(e=>e.owner.isConnected)}_closeOverlay(e,t){const i=this._overlays.findIndex(t=>t.token===e.token);i>=0&&this._overlays.splice(i,1),e.close(t)}registerOverlay(e){this._pruneOverlays();const t=this._overlays.find(t=>t.owner===e.owner);t&&this._overlays.splice(this._overlays.indexOf(t),1);const i=e.group||"transient";for(const e of[...this._overlays].reverse())e.group===i&&this._closeOverlay(e,"exclusive");const n={...e,group:i,token:Symbol("hp-overlay")};this._overlays.push(n);let r=!1;return()=>{if(r)return;r=!0;const e=this._overlays.findIndex(e=>e.token===n.token);e>=0&&this._overlays.splice(e,1)}}closeTransientOverlays(e="outside"){this._pruneOverlays();const t=[...this._overlays].filter(e=>"transient"===(e.group||"transient"));for(const i of t.reverse())this._closeOverlay(i,e);return t.length>0}overlayPortal(){return this.renderRoot.querySelector(".overlay-portal")}render(){const e=j` +globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="012abf4b3924ad03971870eb8085ab1ac1a66b0d9b6676fe095285a8b0f201ab";const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),n=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const i=this.t;if(t&&void 0===e){const t=void 0!==i&&1===i.length;t&&(e=n.get(i)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&n.set(i,e))}return e}toString(){return this.cssText}};const o=(e,...t)=>{const n=1===e.length?e[0]:t.reduce((t,i,n)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[n+1],e[0]);return new r(n,e,i)},s=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new r("string"==typeof e?e:e+"",void 0,i))(t)})(e):e,{is:a,defineProperty:l,getOwnPropertyDescriptor:c,getOwnPropertyNames:h,getOwnPropertySymbols:d,getPrototypeOf:u}=Object,p=globalThis,_=p.trustedTypes,m=_?_.emptyScript:"",g=p.reactiveElementPolyfillSupport,f=(e,t)=>e,v={toAttribute(e,t){switch(t){case Boolean:e=e?m:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},y=(e,t)=>!a(e,t),b={attribute:!0,type:String,converter:v,reflect:!1,useDefault:!1,hasChanged:y};Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;let w=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=b){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(e,i,t);void 0!==n&&l(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){const{get:n,set:r}=c(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:n,set(t){const o=n?.call(this);r?.call(this,t),this.requestUpdate(e,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??b}static _$Ei(){if(this.hasOwnProperty(f("elementProperties")))return;const e=u(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(f("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(f("properties"))){const e=this.properties,t=[...h(e),...d(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(s(e))}else void 0!==e&&t.push(s(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((i,n)=>{if(t)i.adoptedStyleSheets=n.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const t of n){const n=document.createElement("style"),r=e.litNonce;void 0!==r&&n.setAttribute("nonce",r),n.textContent=t.cssText,i.appendChild(n)}})(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,i);if(void 0!==n&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:v).toAttribute(t,i.type);this._$Em=e,null==r?this.removeAttribute(n):this.setAttribute(n,r),this._$Em=null}}_$AK(e,t){const i=this.constructor,n=i._$Eh.get(e);if(void 0!==n&&this._$Em!==n){const e=i.getPropertyOptions(n),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:v;this._$Em=n;const o=r.fromAttribute(t,e.type);this[n]=o??this._$Ej?.get(n)??o,this._$Em=null}}requestUpdate(e,t,i,n=!1,r){if(void 0!==e){const o=this.constructor;if(!1===n&&(r=this[e]),i??=o.getPropertyOptions(e),!((i.hasChanged??y)(r,t)||i.useDefault&&i.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:n,wrapped:r},o){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),!0!==r||void 0!==o)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===n&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,i]of e){const{wrapped:e}=i,n=this[t];!0!==e||this._$AL.has(t)||void 0===n||this.C(t,void 0,i,n)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[f("elementProperties")]=new Map,w[f("finalized")]=new Map,g?.({ReactiveElement:w}),(p.reactiveElementVersions??=[]).push("2.1.2");const k=globalThis,x=e=>e,S=k.trustedTypes,$=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,M="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,C="?"+R,T=`<${C}>`,D=document,A=()=>D.createComment(""),P=e=>null===e||"object"!=typeof e&&"function"!=typeof e,F=Array.isArray,z="[ \t\n\f\r]",I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,E=/>/g,N=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,L=/"/g,B=/^(?:script|style|textarea|title)$/i,q=e=>(t,...i)=>({_$litType$:e,strings:t,values:i}),j=q(1),W=q(2),U=Symbol.for("lit-noChange"),G=Symbol.for("lit-nothing"),V=new WeakMap,K=D.createTreeWalker(D,129);function Y(e,t){if(!F(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==$?$.createHTML(t):t}const X=(e,t)=>{const i=e.length-1,n=[];let r,o=2===t?"":3===t?"":"",s=I;for(let t=0;t"===l[0]?(s=r??I,c=-1):void 0===l[1]?c=-2:(c=s.lastIndex-l[2].length,a=l[1],s=void 0===l[3]?N:'"'===l[3]?L:H):s===L||s===H?s=N:s===O||s===E?s=I:(s=N,r=void 0);const d=s===N&&e[t+1].startsWith("/>")?" ":"";o+=s===I?i+T:c>=0?(n.push(a),i.slice(0,c)+M+i.slice(c)+R+d):i+R+(-2===c?t:d)}return[Y(e,o+(e[i]||"")+(2===t?"":3===t?"":"")),n]};class Z{constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let r=0,o=0;const s=e.length-1,a=this.parts,[l,c]=X(e,t);if(this.el=Z.createElement(l,i),K.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(n=K.nextNode())&&a.length0){n.textContent=S?S.emptyScript:"";for(let i=0;iF(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==G&&P(this._$AH)?this._$AA.nextSibling.data=e:this.T(D.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,n="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=Z.createElement(Y(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===n)this._$AH.p(t);else{const e=new Q(n,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=V.get(e.strings);return void 0===t&&V.set(e.strings,t=new Z(e)),t}k(e){F(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,n=0;for(const r of e)n===t.length?t.push(i=new ee(this.O(A()),this.O(A()),this,this.options)):i=t[n],i._$AI(r),n++;n2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=G}_$AI(e,t=this,i,n){const r=this.strings;let o=!1;if(void 0===r)e=J(this,e,t,0),o=!P(e)||e!==this._$AH&&e!==U,o&&(this._$AH=e);else{const n=e;let s,a;for(e=r[0],s=0;s{const n=i?.renderBefore??t;let r=n._$litPart$;if(void 0===r){const e=i?.renderBefore??null;n._$litPart$=r=new ee(t.insertBefore(A(),e),e,void 0,i??{})}return r._$AI(e),r},ce=globalThis;let he=class extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=le(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};he._$litElement$=!0,he.finalized=!0,ce.litElementHydrateSupport?.({LitElement:he});const de=ce.litElementPolyfillSupport;de?.({LitElement:he}),(ce.litElementVersions??=[]).push("4.2.2");const ue=2,pe=e=>(...t)=>({_$litDirective$:e,values:t});let _e=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};const{I:me}=se,ge=e=>e,fe=(e,t)=>void 0!==e?._$litType$,ve=()=>document.createComment(""),ye=(e,t,i)=>{const n=e._$AA.parentNode,r=void 0===t?e._$AB:t._$AA;if(void 0===i){const t=n.insertBefore(ve(),r),o=n.insertBefore(ve(),r);i=new me(t,o,e,e.options)}else{const t=i._$AB.nextSibling,o=i._$AM,s=o!==e;if(s){let t;i._$AQ?.(e),i._$AM=e,void 0!==i._$AP&&(t=e._$AU)!==o._$AU&&i._$AP(t)}if(t!==r||s){let e=i._$AA;for(;e!==t;){const t=ge(e).nextSibling;ge(n).insertBefore(e,r),e=t}}}return i},be=(e,t,i=e)=>(e._$AI(t,i),e),we={},ke=(e,t=we)=>e._$AH=t,xe=e=>e._$AH,Se=e=>{e._$AR(),e._$AA.remove()},$e=e=>(e=>null!=e?._$litType$?.h)(e)?e._$litType$.h:e.strings,Me=pe(class extends _e{constructor(e){super(e),this.et=new WeakMap}render(e){return[e]}update(e,[t]){const i=fe(this.it)?$e(this.it):null,n=fe(t)?$e(t):null;if(null!==i&&(null===n||i!==n)){const t=xe(e).pop();let n=this.et.get(i);if(void 0===n){const e=document.createDocumentFragment();n=le(G,e),n.setConnected(!1),this.et.set(i,n)}ke(n,[t]),ye(n,void 0,t)}if(null!==n){if(null===i||i!==n){const t=this.et.get(n);if(void 0!==t){const i=xe(t).pop();(e=>{e._$AR()})(e),ye(e,void 0,i),ke(e,[i])}}this.it=t}else this.it=void 0;return this.render(t)}}),Re=pe(class extends _e{constructor(){super(...arguments),this.key=G}render(e,t){return this.key=e,t}update(e,[t,i]){return t!==this.key&&(ke(e),this.key=t),i}}),Ce=(e,t,i)=>{const n=new Map;for(let r=t;r<=i;r++)n.set(e[r],r);return n},Te=pe(class extends _e{constructor(e){if(super(e),e.type!==ue)throw Error("repeat() can only be used in text expressions")}dt(e,t,i){let n;void 0===i?i=t:void 0!==t&&(n=t);const r=[],o=[];let s=0;for(const t of e)r[s]=n?n(t,s):s,o[s]=i(t,s),s++;return{values:o,keys:r}}render(e,t,i){return this.dt(e,t,i).values}update(e,[t,i,n]){const r=xe(e),{values:o,keys:s}=this.dt(t,i,n);if(!Array.isArray(r))return this.ut=s,o;const a=this.ut??=[],l=[];let c,h,d=0,u=r.length-1,p=0,_=o.length-1;for(;d<=u&&p<=_;)if(null===r[d])d++;else if(null===r[u])u--;else if(a[d]===s[p])l[p]=be(r[d],o[p]),d++,p++;else if(a[u]===s[_])l[_]=be(r[u],o[_]),u--,_--;else if(a[d]===s[_])l[_]=be(r[d],o[_]),ye(e,l[_+1],r[d]),d++,_--;else if(a[u]===s[p])l[p]=be(r[u],o[p]),ye(e,r[d],r[u]),u--,p++;else if(void 0===c&&(c=Ce(s,p,_),h=Ce(a,d,u)),c.has(a[d]))if(c.has(a[u])){const t=h.get(s[p]),i=void 0!==t?r[t]:null;if(null===i){const t=ye(e,r[d]);be(t,o[p]),l[p]=t}else l[p]=be(i,o[p]),ye(e,r[d],i),r[t]=null;p++}else Se(r[u]),u--;else Se(r[d]),d++;for(;p<=_;){const t=ye(e,l[_+1]);be(t,o[p]),l[p++]=t}for(;d<=u;){const e=r[d++];null!==e&&Se(e)}return this.ut=s,ke(e,l),U}}),De=new WeakMap;let Ae=0;class Pe extends he{constructor(){super(...arguments),this.title="",this.icon="",this.wide=!1,this.alert=!1,this.describedBy="",this.dismissOnScrim=!1,this.flexContent=!1,this.hass=null,this._opener=null,this._focusRoot=null,this._useHaDialog=null,this._closing=!1,this._overlays=[],this._titleId="hp-dialog-title-"+ ++Ae,this._focusInitial=()=>{const e=this._focusableElements(),t=e.find(e=>e.hasAttribute("autofocus"))||e[0]||(this._usesHaDialog()?null:this.renderRoot.querySelector(".close"))||this.renderRoot.querySelector(".surface")||this.renderRoot.querySelector("ha-dialog");t?.focus({preventScroll:!0})},this._requestClose=()=>{this._closing||(this._closing=!0,this.dispatchEvent(new CustomEvent("hp-close",{bubbles:!0,composed:!0})))},this._onKeyDown=e=>{if("Escape"===e.key){e.preventDefault(),e.stopImmediatePropagation(),this._pruneOverlays();const t=this._overlays[this._overlays.length-1];return t?void this._closeOverlay(t,"escape"):void this._requestClose()}if("Tab"!==e.key||this._usesHaDialog())return;const t=this.renderRoot.querySelector(".close"),i=t?[t,...this._focusableElements()]:this._focusableElements();if(!i.length)return e.preventDefault(),void this.renderRoot.querySelector(".surface")?.focus({preventScroll:!0});const n=this._deepActiveElement(),r=i[0],o=i[i.length-1];!e.shiftKey||n!==r&&i.includes(n)?e.shiftKey||n!==o||(e.preventDefault(),r.focus()):(e.preventDefault(),o.focus())},this._onFallbackCancel=e=>{e.preventDefault(),this._requestClose()},this._onFallbackClick=e=>{this.dismissOnScrim&&e.target===e.currentTarget&&this._requestClose()}}_usesHaDialog(){return!0===this._useHaDialog&&!this.alert}connectedCallback(){this.setAttribute("data-hp","dialog"),super.connectedCallback(),this._opener=this._deepActiveElement();const e=this.getRootNode();this._focusRoot=e;const t=De.get(e)||{dialogs:new Set,opener:this._opener};t.dialogs.add(this),De.set(e,t),null===this._useHaDialog&&(this._useHaDialog=!!customElements.get("ha-dialog")),this.addEventListener("keydown",this._onKeyDown,!0),queueMicrotask(()=>{this._ensureNativeModal()&&this._focusInitial()})}disconnectedCallback(){this.removeEventListener("keydown",this._onKeyDown,!0);const e=[...this._overlays];this._overlays=[];for(const t of e.reverse())t.close("disconnect");const t=this._focusRoot,i=this._opener;this._opener=null,this._focusRoot=null;const n=t?De.get(t):void 0;n?.dialogs.delete(this),super.disconnectedCallback(),t&&n&&requestAnimationFrame(()=>{const e=De.get(t);if(!e)return;if(!e.dialogs.size)return e.opener?.isConnected&&e.opener.focus({preventScroll:!0}),void De.delete(t);const n=i?.closest("hp-dialog");i?.isConnected&&n&&e.dialogs.has(n)&&i.focus({preventScroll:!0})})}firstUpdated(e){super.firstUpdated(e),this._ensureNativeModal(),queueMicrotask(()=>this._focusInitial())}updated(e){super.updated(e),this._ensureNativeModal()}_ensureNativeModal(){if(this._usesHaDialog()||!this.isConnected)return!1;const e=this.renderRoot.querySelector("dialog");if(!e?.isConnected)return!1;try{return!e.matches(":modal")&&(e.open&&e.close(),e.showModal(),!0)}catch{return!1}}_deepActiveElement(){let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e&&e!==document.body?e:null}_focusableElements(){const e=["[autofocus]","a[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[contenteditable="true"]','[tabindex]:not([tabindex="-1"])'].join(","),t=[],i=new Set,n=r=>{if(!i.has(r)){if(i.add(r),r instanceof HTMLElement){if(r.matches(e)&&t.push(r),r instanceof HTMLSlotElement){for(const e of r.assignedNodes({flatten:!0}))n(e);return}if(r.shadowRoot){for(const e of r.shadowRoot.childNodes)n(e);return}}for(const e of r.childNodes)n(e)}};for(const e of this.childNodes)n(e);const r=this.overlayPortal();return r&&n(r),t.filter(e=>{let t=e;for(;t;){const e=getComputedStyle(t);if(t.hidden||t.inert||"true"===t.getAttribute("aria-hidden")||"none"===e.display||"hidden"===e.visibility)return!1;if(t=t.assignedSlot||t.parentElement||(t.getRootNode()instanceof ShadowRoot?t.getRootNode().host:null),t===this)break}return!0})}rejectClose(){this._closing=!1,this.requestUpdate()}_pruneOverlays(){this._overlays=this._overlays.filter(e=>e.owner.isConnected)}_closeOverlay(e,t){const i=this._overlays.findIndex(t=>t.token===e.token);i>=0&&this._overlays.splice(i,1),e.close(t)}registerOverlay(e){this._pruneOverlays();const t=this._overlays.find(t=>t.owner===e.owner);t&&this._overlays.splice(this._overlays.indexOf(t),1);const i=e.group||"transient";for(const e of[...this._overlays].reverse())e.group===i&&this._closeOverlay(e,"exclusive");const n={...e,group:i,token:Symbol("hp-overlay")};this._overlays.push(n);let r=!1;return()=>{if(r)return;r=!0;const e=this._overlays.findIndex(e=>e.token===n.token);e>=0&&this._overlays.splice(e,1)}}closeTransientOverlays(e="outside"){this._pruneOverlays();const t=[...this._overlays].filter(e=>"transient"===(e.group||"transient"));for(const i of t.reverse())this._closeOverlay(i,e);return t.length>0}overlayPortal(){return this.renderRoot.querySelector(".overlay-portal")}render(){const e=j` ${this.icon?j``:G} ${this.title} `;return this._usesHaDialog()?this.describedBy?j`
`})} - `}const xr={color:"#607d8b",opacity:1,widthCm:3.6,fill:!1,fillColor:"#607d8b",fillOpacity:.25},Sr=(e,t=1)=>{const i=Number(e);return Number.isFinite(i)?Math.min(1,Math.max(0,i)):t},$r=e=>{let t=Number(e);return Number.isFinite(t)?(t=(t%360+360)%360,t>180?t-360:t):0};function Mr(e,t,i){return $r(t)?[e.x,e.y]:i([e.x,e.y])}function Rr(e,t,i,n){const r=Math.abs(i[0]-t[0]),o=Math.abs(i[1]-t[1]);return"line"===e?Math.hypot(r,o)>=n:r>=n&&o>=n}const Cr=(e,t,i)=>{const n=Number(e),r=Number.isFinite(t)&&t>0?t:5;return Number.isFinite(n)&&n>0?n/r*i:0},Tr=(e,t,i)=>{const n=Number(e),r=Number.isFinite(t)&&t>0?t:5;return Number.isFinite(n)&&i>0?n/i*r:0},Dr=(e,t,i,n=xr.widthCm)=>{const r=Number(e?.width_cm);if(Number.isFinite(r)&&r>0)return r;const o=Number(e?.width);return Number.isFinite(o)&&o>0?Tr(o,t,i):n};function Ar(e){const t=xr;return e.color===t.color&&e.opacity===t.opacity&&e.widthCm===t.widthCm&&e.fill===t.fill&&e.fillColor===t.fillColor&&e.fillOpacity===t.fillOpacity?null:{color:e.color,opacity:Sr(e.opacity),width_cm:Math.max(.1,Math.min(100,Number(e.widthCm)||.1)),fill:!!e.fill,fill_color:e.fillColor,fill_opacity:Sr(e.fillOpacity,.25)}}function Pr(e,t){return{color:e.color,opacity:Sr(e.opacity),width_cm:Math.max(.1,Math.min(100,Number(e.widthCm)||.1)),...t?{fill:e.fill,fill_color:e.fillColor,fill_opacity:Sr(e.fillOpacity,.25)}:{}}}function Fr(e){const t=e.x+e.w/2,i=e.y+e.h/2,n=$r(e.angle)*Math.PI/180,r=Math.cos(n),o=Math.sin(n),s=(e,n)=>{const s=e-t,a=n-i;return[t+s*r-a*o,i+s*o+a*r]};return[s(e.x,e.y),s(e.x+e.w,e.y),s(e.x+e.w,e.y+e.h),s(e.x,e.y+e.h)]}function zr(e){const t=Fr(e),i=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],n=[(t[0][0]+t[2][0])/2,(t[0][1]+t[2][1])/2];return{points:[...t,i(t[0],t[1]),i(t[1],t[2]),i(t[2],t[3]),i(t[3],t[0]),n],segments:t.map((e,i)=>({a:e,b:t[(i+1)%4]}))}}function Ir(e,t,i,n,r,o,s,a){const l=$r(e.angle)*Math.PI/180,c=Math.cos(l),h=Math.sin(l),d=-Math.sin(l),u=Math.cos(l),p=e.x+e.w/2,_=e.y+e.h/2,m=t>0?-e.w/2:e.w/2,g=i>0?-e.h/2:e.h/2,f=p+m*c+g*d,v=_+m*h+g*u,y=n-f,b=r-v;let w=(y*c+b*h)*(t>0?1:-1),k=(y*d+b*u)*(i>0?1:-1),x=null;if(o){const t=w/Math.max(e.w,a),i=k/Math.max(e.h,a);x=Math.max(a/Math.max(e.w,a),a/Math.max(e.h,a),t,i),w=e.w*x,k=e.h*x}if(s>0)if(o){const t=Math.max(1,Math.round(e.w/s)),i=Math.max(1,Math.round(e.h/s));if(Math.abs(e.w-t*s)<1e-6&&Math.abs(e.h-i*s)<1e-6){const n=(e,t)=>{let i=Math.abs(e),n=Math.abs(t);for(;n;)[i,n]=[n,i%n];return Math.max(1,i)},r=1/n(t,i),o=Math.max(a/e.w,a/e.h),s=Math.max(o,Math.round((x??1)/r)*r);w=e.w*s,k=e.h*s}else{e.w>=e.h?(w=Math.round(w/s)*s,k=w*(e.h/Math.max(e.w,a))):(k=Math.round(k/s)*s,w=k*(e.w/Math.max(e.h,a)))}}else w=Math.round(w/s)*s,k=Math.round(k/s)*s;w=Math.max(a,w),k=Math.max(a,k);return{x:f+(t>0?w/2:-w/2)*c+(i>0?k/2:-k/2)*d-w/2,y:v+(t>0?w/2:-w/2)*h+(i>0?k/2:-k/2)*u-k/2,w:w,h:k,angle:$r(e.angle)||void 0}}const Or=(e,t,i)=>{const n=i[0]-t[0],r=i[1]-t[1],o=n*n+r*r;if(o<1e-12)return[...t];const s=Math.max(0,Math.min(1,((e[0]-t[0])*n+(e[1]-t[1])*r)/o));return[t[0]+n*s,t[1]+r*s]};function Er(e,t,i,n){const r=n(e);let o=null;for(const r of t.points){const t=n(r),s=Math.hypot(t[0]-e[0],t[1]-e[1]);s<=i&&(!o||se.points),segments:e.flatMap(e=>e.segments)}}const Hr=Math.tan(.25*Math.PI/180);function Lr(e,t){const i=Math.abs(Number(t[0])-Number(e[0])),n=Math.abs(Number(t[1])-Number(e[1]));if(!([i,n].every(Number.isFinite)&&i>0&&n>0))return null;const r=i>=n?"horizontal":"vertical",o=Math.max(i,n),s=Math.min(i,n);return s/o>Hr?null:{axis:r,major:o,minor:s,angleDegrees:180*Math.atan2(s,o)/Math.PI}}function Br(e,t){const i=Lr(e,t);return i?"horizontal"===i.axis?[Number(t[0]),Number(e[1])]:[Number(e[0]),Number(t[1])]:[Number(t[0]),Number(t[1])]}const qr=e=>`${e[0]},${e[1]}`,jr=(e,t)=>e[0]===t[0]&&e[1]===t[1],Wr=(e,t)=>{const i=qr(e),n=qr(t);return i{let t=0;for(let i=0;i{if(e.length<3)return!1;for(let t=0;t1e-12},Vr=(e,t)=>jr(e,t.from)?[...t.to]:[...e],Kr=(e,t)=>e.map(e=>Array.isArray(e?.poly)?{...e,poly:e.poly.map(e=>Vr(e,t))}:e),Yr=(e,t,i)=>{const n=e.flatMap((e,t)=>ni(e)?.some(e=>jr(e,i.from))?[t]:[]);if(!n.length)return!1;for(const i of n){const n=ni(e[i]),r=ni(t[i]);if(!n||!r)continue;if(!Gr(r))return!1;const o=Math.sign(Ur(n)),s=Math.sign(Ur(r));if(o&&s&&o!==s)return!1}const r=new Set;for(const e of n){const i=ni(t[e]);if(i)for(let n=0;n{let i=0;for(const n of e){const e=ni(n);if(e)for(let n=0;n{const{a:i,b:n,axis:r}=e,o="horizontal"===r?{from:n,to:[n[0],i[1]]}:{from:n,to:[i[0],n[1]]},s="horizontal"===r?{from:i,to:[i[0],n[1]]}:{from:i,to:[n[0],i[1]]};return[{move:o,preservedDegree:Xr(t,i)},{move:s,preservedDegree:Xr(t,n)}].sort((e,t)=>t.preservedDegree-e.preservedDegree||qr(e.move.to).localeCompare(qr(t.move.to))||qr(e.move.from).localeCompare(qr(t.move.from))).map(e=>e.move)};function Jr(e){const t=JSON.parse(JSON.stringify(e||{}));let i=Array.isArray(t.rooms)?t.rooms:[];const n=new Map;for(const e of i){const t=ni(e);if(t)for(let e=0;ee.key.localeCompare(t.key))){let t=null;for(const n of Zr(e,i)){const e=a.get(qr(n.from));if(e&&e!==qr(n.to))continue;const r=Kr(i,n);if(Yr(i,r,n)){t=n,i=r;break}}t?(a.set(qr(t.from),qr(t.to)),r++,s=Math.max(s,Math.hypot(t.to[0]-t.from[0],t.to[1]-t.from[1]))):o++}t.rooms=i;for(const e of t.partitions||[]){if(!Array.isArray(e?.a)||!Array.isArray(e?.b))continue;const i=Lr(e.a,e.b);if(!i)continue;const n={key:String(e.id||Wr(e.a,e.b)),a:[...e.a],b:[...e.b],axis:i.axis};let a=null;for(const i of Zr(n,[{poly:[e.a,e.b]}])){const n=Vr(e.a,i),r=Vr(e.b,i),o=Math.hypot(r[0]-n[0],r[1]-n[1]);if(!(o>0))continue;const s=(t.openings||[]).filter(t=>"partition"===t?.host?.kind&&t.host.id===e.id).every(e=>{const t=Number(e.host.t),i=Number(e.length);return Number.isFinite(t)&&t>=0&&t<=1&&Number.isFinite(i)&&i>0&&t*o-i/2>=-1e-12&&t*o+i/2<=o+1e-12});if(s){a=i,e.a=n,e.b=r;break}}a?(r++,s=Math.max(s,Math.hypot(a.to[0]-a.from[0],a.to[1]-a.from[1]))):o++}return{space:t,report:{wallsStraightened:r,wallsStraightenSkipped:o,maxStraightenShift:s},changed:r>0}}const Qr=["rect","ellipse","furniture","image"],eo=10**9,to=240,io=1e-4;function no(e){if(Array.isArray(e))return e.map(e=>no(e));if(null!==e&&"object"==typeof e){const t={};for(const[i,n]of Object.entries(e))t[i]=no(n);return t}return e}function ro(e){if("number"!=typeof e||!Number.isFinite(e))return e;const t=(e<0||Object.is(e,-0)?-1:1)*(Math.floor(Math.abs(e)*eo+.5)/eo);return 0===t?0:t}function oo(e){if("number"!=typeof e||!Number.isFinite(e))return e;const t=e*to,i=Math.round(t);if(Math.abs(t-i)null!==ao(e)):[]}function co(e){return"string"==typeof e&&Qr.includes(e)}function ho(e,t){for(const i of t)Object.prototype.hasOwnProperty.call(e,i)&&(e[i]=ro(e[i]))}function uo(e,t){for(const i of t)Object.prototype.hasOwnProperty.call(e,i)&&(e[i]=oo(e[i]))}function po(e){if(Array.isArray(e))for(let t=0;t{for(const r of n){const n=t[r];"number"==typeof n&&Number.isFinite(n)&&i(n,e)}},n=t=>{if(Array.isArray(t))for(let n=0;n{if(Array.isArray(e))for(const t of e)n(t)};for(const i of lo(e.rooms))t(i,["x","y","w","h"]),r(i.poly);for(const t of lo(e.walls))n(t.a),n(t.b);for(const t of lo(e.wall_segments))n(t.a),n(t.b);for(const i of lo(e.openings))t(i,["x","y"]);for(const i of lo(e.decor))"line"===i.kind?t(i,["x1","y1","x2","y2"]):co(i.kind)?t(i,["x","y","w","h"]):"text"===i.kind&&t(i,["x","y"]);for(const t of lo(e.room_drafts))r(t.points);for(const t of lo(e.partitions))n(t.a),n(t.b);for(const t of lo(e.wall_columns))n(t.center);for(const t of lo(e.open_spans))n(t.a),n(t.b)}const r=ao(t);if(!r)return;const o=new Map;if(n)for(const e of lo(n.spaces))null!=e.id&&o.set(String(e.id),e);for(const e of Object.values(r)){const t=ao(e);if(!t)continue;const n=null!=t.s&&o.get(String(t.s))||null;for(const e of["x","y"]){const r=t[e];"number"==typeof r&&Number.isFinite(r)&&i(r,n)}}}function go(e){const t=Number(e?.cell_cm);return t>0?t:5}function fo(e,t={}){const i={canonicalized:0,far:0,maxShift:0,maxShiftCm:0,spaces:[],bySpace:new Map},n=lo(ao(e)?.spaces);let r=5;for(const e of n)r=Math.max(r,go(e));mo(e,t,(e,t)=>{const n=e*to,o=Math.abs(n-Math.round(n)),s=oo(e),a=o>0&&o=io))return;const l=a&&"number"==typeof s?Math.abs(s-e):0;if(a?i.canonicalized++:i.far++,i.maxShift=Math.max(i.maxShift,l),i.maxShiftCm=Math.max(i.maxShiftCm,l*to*(t?go(t):r)),!t?.id||!a)return;const c=String(t.id);let h=i.bySpace.get(c);h||(h={spaceId:c,space:String(t.title||c),canonicalized:0,far:0,maxShift:0,maxShiftCm:0},i.bySpace.set(c,h)),h.canonicalized++,h.maxShift=Math.max(h.maxShift,l),h.maxShiftCm=Math.max(h.maxShiftCm,l*to*go(t))}),i.bySpace.size&&mo(e,t,(e,t)=>{if(!t?.id)return;const n=i.bySpace.get(String(t.id));if(!n)return;const r=e*to;Math.abs(r-Math.round(r))>=io&&n.far++}),i.spaces=[...i.bySpace.values()];const{bySpace:o,...s}=i;return s}function vo(e){return function(e){const t=e,i=ao(t);i&&uo(i,["x","y"]);return t}(no(e))}function yo(e){const t=e,i=ao(t);if(!i)return t;for(const e of Object.values(i)){const t=ao(e);t&&uo(t,["x","y"])}return t}function bo(e){return wo(no(e))}function wo(e){const t=e,i=ao(t);if(!i)return t;for(const e of lo(i.spaces)){ho(e,["plan_x","plan_y","plan_scale","plan_scale_x","plan_scale_y","plan_angle"]);for(const t of lo(e.rooms))uo(t,["x","y","w","h"]),_o(t.poly);for(const t of lo(e.walls))po(t.a),po(t.b);for(const t of lo(e.wall_segments))po(t.a),po(t.b);for(const t of lo(e.openings)){uo(t,["x","y"]),ho(t,["angle","length"]);const e=ao(t.host);e&&ho(e,["t"])}for(const t of lo(e.decor))"line"===t.kind?uo(t,["x1","y1","x2","y2"]):co(t.kind)?(uo(t,["x","y","w","h"]),ho(t,["angle"])):"text"===t.kind&&(uo(t,["x","y"]),ho(t,["scale","angle"]));for(const t of lo(e.room_drafts))_o(t.points);for(const t of lo(e.partitions))po(t.a),po(t.b);for(const t of lo(e.wall_columns))po(t.center),"square"===t.shape&&ho(t,["angle"]);for(const t of lo(e.open_spans))po(t.a),po(t.b)}for(const e of lo(i.markers))ho(e,["angle"]);return t}const ko=15,xo=8;function So(e,t,i,n,r){const o=i[0]-e[0],s=i[1]-e[1],a=Math.hypot(o,s);if(!(a>0)||a<=r+1e-9)return null;const l=o/a,c=s/a,h=t=>{const n=(t[0]-e[0])*l+(t[1]-e[1])*c,o=(r-n)/(a-n);return!Number.isFinite(o)||o<-1e-9||o>1+1e-9?null:[t[0]+(i[0]-t[0])*o,t[1]+(i[1]-t[1])*o]},d=h(t),u=h(n);return d&&u?[[e[0],e[1]],t,d,u,n]:null}const $o=Math.sin(.25*Math.PI/180);function Mo(e,t){return Number.isFinite(e)&&e>0&&Number.isFinite(t)&&t>0&&e*t<3}function Ro(e){const t=Number(e)>0?Number(e):5;if(5===t)return 8;const i=5/t*8;return Math.min(80,Math.max(.5,i))}function Co(e,t){return Number.isFinite(e)&&e>0&&Number.isFinite(t)&&t>0&&e*t<2}function To(e){return Number.isFinite(e)?Math.max(1,Math.min(100,e)):1}function Do(e,t){return!Number.isFinite(e)||e<0?"":String(t?Math.round(e/2.54*100)/100:Math.round(100*e)/100)}function Ao(e,t,i){if(!Number.isFinite(e)||e<=0)return 0;const n=Number(t)>0?Number(t):5;return To(e)/n*i}function Po(e,t){return t>0&&Number.isFinite(e)?Math.round(e/t)*t:e}function Fo(e){return Math.max(1e-6*Math.abs(e),1e-9)}function zo(e,t){if(!(t>0&&Number.isFinite(e)))return e;const i=Po(e,t);return Math.abs(i-e)<=Fo(t)?i:e}function Io(e,t){let i=t[0]-e[0],n=t[1]-e[1];const r=Math.hypot(i,n);return r<1e-12?[1,0]:(i/=r,n/=r,(i<-1e-12||Math.abs(i)<=1e-12&&n<0)&&(i=-i,n=-n),[i,n])}function Oo(e,t,i){const n=[zo(e[0],i),zo(e[1],i)],r=[zo(t[0],i),zo(t[1],i)],o=Po((n[0]+r[0])/2,i),s=Po((n[1]+r[1])/2,i),[a,l]=Io(n,r);let c=Math.atan2(l,a);c<0&&(c+=Math.PI);const h=Math.round(1800*c)/1800,d=i>0&&i<.01?6:i<1?4:2;return`${o.toFixed(d)},${s.toFixed(d)}@${h.toFixed(4)}`}function Eo(e,t,i,n){return 1===n?Oo(e,t,i):Oo([e[0]/n,e[1]/n],[t[0]/n,t[1]/n],i)}function No(e,t){if(!Array.isArray(e.a)||!Array.isArray(e.b)||e.a.length<2||e.b.length<2)return null;const i=[Number(e.a[0]),Number(e.a[1]),Number(e.b[0]),Number(e.b[1])];if(!i.every(Number.isFinite))return null;const n=t>0?t:1;return[[i[0]*n,i[1]*n],[i[2]*n,i[3]*n]]}function Ho(e,t,i,n,r){const o=r>0?r:1;return{key:Eo(e,t,n,o),cm:To(i),a:[e[0]/o,e[1]/o],b:[t[0]/o,t[1]/o]}}function Lo(e,t){const i=t>0?t:1,n=[];for(const t of e){const e=t.key.lastIndexOf("@");if(e<0)continue;const[r,o]=t.key.slice(0,e).split(",").map(Number),s=Number(t.key.slice(e+1));[r,o,s].every(Number.isFinite)&&n.push({w:t,x:r*i,y:o*i,ang:s})}return n}function Bo(e,t){const[i,n]=Io(e,t);let r=Math.atan2(n,i);return r<0&&(r+=Math.PI),r}function qo(e,t){let i=Math.abs(e-t);return i>Math.PI/2&&(i=Math.PI-i),i<.02}function jo(e,t,i,n,r=1){if(!e?.length)return null;const o=Eo(t,i,n,r),s=e.find(e=>e.key===o);if(s)return s;const a=r>0?r:1,l=Fo(n)*a,c=(e,t)=>Math.abs(e[0]-t[0])<=l&&Math.abs(e[1]-t[1])<=l;for(const n of e){const e=No(n,a);if(e&&(c(e[0],t)&&c(e[1],i)||c(e[0],i)&&c(e[1],t)))return n}const h=(t[0]+i[0])/2,d=(t[1]+i[1])/2,u=Bo(t,i),p=Math.max(.5*n,1e-9)*a;for(const t of Lo(e,a))if(qo(t.ang,u)&&Math.hypot(t.x-h,t.y-d)<=p)return t.w;return null}function Wo(e,t,i,n,r=1){const o=jo(e,t,i,n,r);if(o&&o.cm>0)return To(o.cm);const s=function(e,t,i,n,r){if(!e?.length)return null;const o=r>0?r:1,s=Math.hypot(i[0]-t[0],i[1]-t[1]);if(s<1e-12)return null;const a=Bo(t,i),l=Math.max(.5*n,1e-9)*o;let c=null;for(const n of e){if(!(n.cm>0))continue;const e=No(n,o);if(!e)continue;const r=Math.hypot(e[1][0]-e[0][0],e[1][1]-e[0][1]);if(r<1e-12||!qo(Bo(e[0],e[1]),a))continue;if(Fs(t[0],t[1],e[0][0],e[0][1],e[1][0],e[1][1])>l||Fs(i[0],i[1],e[0][0],e[0][1],e[1][0],e[1][1])>l)continue;if(r+l(o.has(e.key)||(e=>{const t=No(e,n);if(!t)return!1;const[i,o]=t,a=o[0]-i[0],c=o[1]-i[1],h=Math.hypot(a,c);if(h<=l)return!1;if(!s.some(e=>{const t=[e[0],e[1]],n=[e[2],e[3]];return qo(Bo(i,o),Bo(t,n))&&Fs(i[0],i[1],t[0],t[1],n[0],n[1])<=l&&Fs(o[0],o[1],t[0],t[1],n[0],n[1])<=l}))return!1;const d=(r||[]).some(e=>{const t=[e[0],e[1]],n=[e[2],e[3]];if(!qo(Bo(i,o),Bo(t,n)))return!1;const r=e=>Math.abs((e[0]-i[0])*c-(e[1]-i[1])*a)/h;if(r(t)>l||r(n)>l)return!1;const s=h*h,d=((t[0]-i[0])*a+(t[1]-i[1])*c)/s,u=((n[0]-i[0])*a+(n[1]-i[1])*c)/s;return Math.min(1,Math.max(d,u))-Math.max(0,Math.min(d,u))>l/h});return!d})(e))&&e.cm>=1&&e.cm<=100)}function Go(e,t,i,n=8){const[r,o]=Io(e,t);let s=Math.atan2(o,r);s<0&&(s+=Math.PI);let a=i*Math.PI/180%Math.PI;a<0&&(a+=Math.PI);let l=Math.abs(s-a);return l>Math.PI/2&&(l=Math.PI-l),l<=n*Math.PI/180}function Vo(e,t,i,n,r=1,o="affine",s){if(!e?.length)return[];if(t.length!==i.length)return"fixed-topology"===o&&s?.(),e.slice();const a=r>0?r:1,l=Math.max(.5*n,1e-9)*a,c=Math.max(n*a*1e-6,1e-9),h=[],d=new Map,u=new Map,p=(e,t,i)=>{const n=e.get(t)||new Set;n.add(i),e.set(t,n)};for(let e=0;e[e[0]+(t[0]-e[0])*i,e[1]+(t[1]-e[1])*i],m=(e,t)=>Math.hypot(e[0]-t[0],e[1]-t[1])<=c,g=(e,t)=>{if("fixed-topology"===o){const i=t.na[0]-t.oa[0],n=t.na[1]-t.oa[1],r=t.nb[0]-t.ob[0],o=t.nb[1]-t.ob[1];return Math.hypot(i-r,n-o)<=c?[e[0]+i,e[1]+n]:m(e,t.oa)?[...t.na]:m(e,t.ob)?[...t.nb]:[...e]}const i=Math.max(0,Math.min(1,((e[0]-t.oa[0])*t.dx+(e[1]-t.oa[1])*t.dy)/t.len2));return _(t.na,t.nb,i)},f=(e,t)=>{const[i,n]=Io(e,t);return(t[0]-e[0])*i+(t[1]-e[1])*n>=0?[[...e],[...t]]:[[...t],[...e]]},v=[],y=[],b=(e,t,i)=>{if(Math.hypot(t[0]-e[0],t[1]-e[1])<=c)return;const[r,o]=f(e,t),s=To(i);if(y.some(e=>e.entry.cm===s&&m(e.span[0],r)&&m(e.span[1],o)))return;const l=Ho(r,o,s,n,a);v.push(l),y.push({entry:l,span:[r,o]})};for(const t of e){const e=No(t,a);if(e){const[i,n]=f(e[0],e[1]),r=n[0]-i[0],s=n[1]-i[1],a=r*r+s*s,d=Math.sqrt(a);if(d<=c){v.push({...t,cm:To(t.cm)});continue}const u=[];for(const e of h){if(!qo(Bo(i,n),Bo(e.oa,e.ob)))continue;const t=e=>Math.abs((e[0]-i[0])*s-(e[1]-i[1])*r)/d;if(t(e.oa)>l||t(e.ob)>l)continue;const o=((e.oa[0]-i[0])*r+(e.oa[1]-i[1])*s)/a,h=((e.ob[0]-i[0])*r+(e.ob[1]-i[1])*s)/a,p=Math.max(0,Math.min(o,h)),_=Math.min(1,Math.max(o,h));(_-p)*d>c&&u.push({lo:p,hi:_,move:e})}if(!u.length){"fixed-topology"===o?v.push({...t}):b(i,n,t.cm);continue}const p=[0,1,...u.flatMap(({lo:e,hi:t})=>[e,t])].sort((e,t)=>e-t).filter((e,t,i)=>0===t||Math.abs(e-i[t-1])*d>c),y=[];for(let e=0;e+1a>=e.lo-1e-12&&a<=e.hi+1e-12);if(!l.length){y.push([o,s]);continue}const h=[g(o,l[0].move),g(s,l[0].move)],f=l.slice(1).some(e=>{const t=g(o,e.move),i=g(s,e.move);return!m(h[0],t)||!m(h[1],i)});y.push(f?[o,s]:h)}const w=(e,t)=>{const i=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.hypot(i,n);return!(s<=c||i*r+n*o<=0)&&Math.abs(i*o-n*r)/s<=c},k=[];for(const e of y){const t=k[k.length-1];t&&m(t[1],e[0])&&w(t,e)?t[1]=e[1]:k.push([[...e[0]],[...e[1]]])}if("fixed-topology"===o&&1===k.length){const[i,n]=k[0];if(m(i,e[0])&&m(n,e[1])||m(i,e[1])&&m(n,e[0])){v.push({...t});continue}}for(const[e,i]of k)b(e,i,t.cm);continue}if("fixed-topology"===o){const e=u.get(t.key);if(1===e?.size){const i=[...e][0];v.push(i===t.key?{...t}:{...t,key:i});continue}const i=[Lo([t],a)[0]];1!==a&&i.push(Lo([t],1)[0]);const n=i.filter(Boolean).some(e=>h.some(t=>{if(!qo(e.ang,Bo(t.oa,t.ob)))return!1;const i=((e.x-t.oa[0])*t.dx+(e.y-t.oa[1])*t.dy)/t.len2;return i>=-1e-6&&i<=1.000001&&Fs(e.x,e.y,t.oa[0],t.oa[1],t.ob[0],t.ob[1])<=l}));((e?.size||0)>1||n)&&s?.(),v.push({...t});continue}let i="";const r=d.get(t.key);if(1===r?.size&&(i=[...r][0]),!i){const e=Lo([t],a)[0];if(e){const t=new Set;for(const i of h){if(!qo(e.ang,Bo(i.oa,i.ob)))continue;const r=((e.x-i.oa[0])*i.dx+(e.y-i.oa[1])*i.dy)/i.len2;if(r<-1e-6||r>1.000001)continue;if(Fs(e.x,e.y,i.oa[0],i.oa[1],i.ob[0],i.ob[1])>l)continue;const o=g([e.x,e.y],i),[s,c]=Io(i.na,i.nb),h=Math.max(n*a,1e-6);t.add(Eo([o[0]-s*h,o[1]-c*h],[o[0]+s*h,o[1]+c*h],n,a))}1===t.size&&(i=[...t][0])}}v.push({...t,key:i||t.key,cm:To(t.cm)})}return v}function Ko(e,t,i,n,r=1,o="affine"){return Vo(e,t,i,n,r,o)}function Yo(e,t,i,n,r=1,o="fixed-topology"){let s=!1;const a=Vo(e,t,i,n,r,o,()=>{s=!0});return{walls:s?(e||[]).map(e=>({...e})):a,rejected:s}}function Xo(e,t,i,n=1,r=[]){const o=n>0?n:1,s=Math.abs(i),a=Math.max(s*o*io,1e-9),l=(r||[]).flatMap(e=>{const t=No(e,o);return t?t.map(e=>[...e]):[]}),c=e=>e.every((e,t)=>(e=>{if(!(s>0))return!0;const t=e/o/s;return Math.abs(t-Math.round(t))Math.abs(e-i[t])<=a)),h=[],d=e=>JSON.stringify([e.key,e.cm,e.a,e.b]);for(const i of e||[]){const e=No(i,o);if(!e)continue;const[n,r]=e;if(![n[0],n[1],r[0],r[1]].every(Number.isFinite)||!c(n)||!c(r)){h.push(d(i));continue}const s=r[0]-n[0],l=r[1]-n[1],u=Math.hypot(s,l);if(u<=a){h.push(d(i));continue}const p=s/u,_=l/u,m=[];for(const e of t){const[t,i]=e;if(![t?.[0],t?.[1],i?.[0],i?.[1]].every(Number.isFinite))continue;const r=e=>Math.abs((e[0]-n[0])*_-(e[1]-n[1])*p);if(r(t)>a||r(i)>a)continue;const o=(t[0]-n[0])*p+(t[1]-n[1])*_,s=(i[0]-n[0])*p+(i[1]-n[1])*_,l=Math.max(0,Math.min(o,s)),c=Math.min(u,Math.max(o,s));c-l>a&&m.push([l,c])}m.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let g=0;for(const[e,t]of m){if(e>g+a)break;if(g=Math.max(g,t),g>=u-a)break}ge.key!==s);return null==n||n<1?a:[...a,Ho(t,i,n,r,o)]}function Jo(e,t,i,n,r,o=[],s=1){let a=e?e.slice():[];for(const e of function(e,t,i,n,r=1,o=[]){const s=ys(e,t,i,n,r,o);if(!s)return[];const a=[];for(let e=0;e0||(c=Zo(c,t,i,n,r,s)))}return c}function es(e){const{a:t,b:i,halfDepth:n}=e;if(!Array.isArray(t)||!Array.isArray(i)||t.length<2||i.length<2||![t[0],t[1],i[0],i[1]].every(Number.isFinite))return null;const r=i[0]-t[0],o=i[1]-t[1],s=Math.hypot(r,o);if(!(s>1e-9&&n>0&&Number.isFinite(n)))return null;const a=-o/s*n,l=r/s*n;return[[t[0]+a,t[1]+l],[i[0]+a,i[1]+l],[i[0]-a,i[1]-l],[t[0]-a,t[1]-l]]}function ts(e,t,i){return Math.hypot(e[0]-t[0],e[1]-t[1])<=i}function is(e,t,i){const n=t.b[0]-t.a[0],r=t.b[1]-t.a[1],o=n*n+r*r;if(!(o>i*i))return!1;const s=((e[0]-t.a[0])*n+(e[1]-t.a[1])*r)/o;if(!(s>0&&s<1))return!1;const a=[t.a[0]+n*s,t.a[1]+r*s];return Math.hypot(e[0]-a[0],e[1]-a[1])<=i}function ns(e,t,i,n){const r=Math.hypot(t,i);if(!(r>1e-9&&n>0))return;const o=[t/r,i/r],s=e.find(e=>Math.abs(e.u[0]*o[1]-e.u[1]*o[0])<1e-9&&e.u[0]*o[0]+e.u[1]*o[1]>1-1e-9);s?s.halfDepth=Math.max(s.halfDepth,n):e.push({u:o,halfDepth:n})}function rs(e,t){try{const i=Gt(Os(e),Os(t));let n=null,r=0;for(const e of i||[]){const t=e?.[0]||[],i=Math.abs(hs(t));t.length>=4&&i>r&&(r=i,n=t.slice(0,-1).map(e=>[e[0],e[1]]))}return n}catch{return null}}function os(e,t=1e-6){const i=(e||[]).map((e,t)=>({segment:e,index:t})).filter(({segment:e})=>e&&Array.isArray(e.a)&&Array.isArray(e.b)&&e.a.length>=2&&e.b.length>=2&&e.a.every(Number.isFinite)&&e.b.every(Number.isFinite)&&Number.isFinite(e.halfDepth)&&e.halfDepth>0&&Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])>1e-9);if(i.length<2)return[];const n=Math.max(Number.isFinite(t)?t:0,1e-9),r=i.flatMap(({segment:e})=>[e.a,e.b]).map(e=>[e[0],e[1]]).sort((e,t)=>e[0]-t[0]||e[1]-t[1]),o=[];for(const e of r)o.some(t=>ts(t,e,n))||o.push(e);const s=[];for(const e of o){const t=[];let r=!1;for(const{segment:o,index:s}of i){const i=Math.hypot(o.b[0]-o.a[0],o.b[1]-o.a[1]);ts(e,o.a,n)?t.push({u:[(o.b[0]-o.a[0])/i,(o.b[1]-o.a[1])/i],halfDepth:o.halfDepth,length:i,index:s}):ts(e,o.b,n)?t.push({u:[(o.a[0]-o.b[0])/i,(o.a[1]-o.b[1])/i],halfDepth:o.halfDepth,length:i,index:s}):is(e,o,n)&&(r=!0)}if(r||2!==t.length)continue;const[o,a]=t,l=o.u[0]*a.u[1]-o.u[1]*a.u[0];if(Math.abs(l)<1e-9)continue;const c=l<0?1:-1,h=[-o.u[1],o.u[0]],d=[-a.u[1],a.u[0]],u=[e[0]+h[0]*o.halfDepth*c,e[1]+h[1]*o.halfDepth*c],p=[e[0]-d[0]*a.halfDepth*c,e[1]-d[1]*a.halfDepth*c];if(!ps(u,o.u,p,a.u))continue;const _=[[o,a,p,[d[0]*-c,d[1]*-c]],[a,o,u,[h[0]*c,h[1]*c]]];for(const[t,,i,r]of _){const o=Math.min(2*t.halfDepth,t.length),a=[-t.u[1]*t.halfDepth,t.u[0]*t.halfDepth],l=[[e[0]+a[0],e[1]+a[1]],[e[0]+t.u[0]*o+a[0],e[1]+t.u[1]*o+a[1]],[e[0]+t.u[0]*o-a[0],e[1]+t.u[1]*o-a[1]],[e[0]-a[0],e[1]-a[1]]],c=e=>(e[0]-i[0])*r[0]+(e[1]-i[1])*r[1],h=[];for(let e=0;e=-1e-12&&h.push(t),n>1e-12&&r<-1e-12||n<-1e-12&&r>1e-12){const e=n/(n-r);h.push([t[0]+(i[0]-t[0])*e,t[1]+(i[1]-t[1])*e])}}h.length>=3&&Math.abs(hs(h))>n*n&&s.push({segmentIndex:t.index,wedge:h})}}return s}function ss(e,t=1e-6){const i=(e||[]).filter(e=>e&&Array.isArray(e.a)&&Array.isArray(e.b)&&e.a.length>=2&&e.b.length>=2&&e.a.every(Number.isFinite)&&e.b.every(Number.isFinite)&&Number.isFinite(e.halfDepth)&&e.halfDepth>0&&Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])>1e-9);if(i.length<2)return[];const n=Math.max(Number.isFinite(t)?t:0,1e-9),r=i.flatMap(e=>[e.a,e.b]).map(e=>[e[0],e[1]]).sort((e,t)=>e[0]-t[0]||e[1]-t[1]),o=[];for(const e of r)o.some(t=>ts(t,e,n))||o.push(e);const s=[],a=i.map((e,t)=>({roomId:"",a:[e.a[0],e.a[1]],b:[e.b[0],e.b[1]],key:`join-${t}`,kind:"outer",cm:0,open:!1,half:e.halfDepth})),l=Ss(a,n);for(const e of $s(l).fans)s.push(e);const c=e=>!!Ms(l,e);for(const e of o){if(c(e))continue;const t=[];for(const r of i)ts(e,r.a,n)?ns(t,r.b[0]-r.a[0],r.b[1]-r.a[1],r.halfDepth):ts(e,r.b,n)?ns(t,r.a[0]-r.b[0],r.a[1]-r.b[1],r.halfDepth):is(e,r,n)&&(ns(t,r.a[0]-e[0],r.a[1]-e[1],r.halfDepth),ns(t,r.b[0]-e[0],r.b[1]-e[1],r.halfDepth));if(!(t.length<2)){t.sort((e,t)=>Math.atan2(e.u[1],e.u[0])-Math.atan2(t.u[1],t.u[0])||e.halfDepth-t.halfDepth);for(let i=0;in*n&&s.push(m)}}}return s}function as(e,t,i,n){if(!(t>0)||!e||e.length<2)return"";if(i&&e.length>=3){let i=e;const r=e[e.length-1];if(e.length>=4&&Math.hypot(e[0][0]-r[0],e[0][1]-r[1])<1e-9&&(i=e.slice(0,-1)),i.length>=3){const e=i.map((e,i)=>n?.[i]||t),r=ia(i,e),o=gs(i,e);if(r&&o)return`${fs(r)} ${fs(vs(o))}`}}const r=[];for(let i=0;i=1e-9&&a>0&&r.push({a:o,b:s,halfDepth:a})}const o=r.map(es);for(const{segmentIndex:e,wedge:t}of os(r)){const i=o[e];if(!i)continue;const n=rs(i,t);n&&(o[e]=n)}const s=[...o.filter(e=>!!e),...ss(r)],a=function(e){let t=null;try{for(const i of e){if(i.length<3)continue;const e=Os(i);t=t?Wt(t,e):[e]}return t}catch{return null}}(s);return a?Ks(a):s.map(e=>fs(e)).join(" ")}function ls(e,t,i,n,r=1){if(!i.length)return!1;const o=cs(n,r),s=(e[0]+t[0])/2,a=(e[1]+t[1])/2,[l,c]=Io(e,t);for(const e of i){const[t,i]=Io([e[0],e[1]],[e[2],e[3]]);if(!(Math.abs(l*i-c*t)>.05)&&Fs(s,a,e[0],e[1],e[2],e[3])<=o)return!0}return!1}function cs(e,t){return Math.max(e*(t>0?t:1)*.04,1e-9)}function hs(e){let t=0;for(let i=0;ie[1]!=l>e[1]&&e[0]<(a-o)*(e[1]-s)/(l-s+0)+o&&(i=!i)}return i}([c[0]+.001*a,c[1]+.001*l],e)||(a=-a,l=-l),[a,l]}function us(e,t){const i=e[0]*t[1]-e[1]*t[0],n=e[0]*t[0]+e[1]*t[1];return Math.abs(i)<1e-9&&n>0}function ps(e,t,i,n){const r=t[0]*n[1]-t[1]*n[0];if(Math.abs(r)<1e-12)return null;const o=[i[0]-e[0],i[1]-e[1]],s=(o[0]*n[1]-o[1]*n[0])/r;return[e[0]+s*t[0],e[1]+s*t[1]]}function _s(e,t,i){const n=e?.length||0;if(n<3||!Array.isArray(i)||i.length!==n)return 0;const r=(Math.trunc(t)%n+n)%n,o=e[r],s=e[(r+1)%n],a=s[0]-o[0],l=s[1]-o[1],c=Math.hypot(a,l);if(!(c>0))return 0;const h=Math.max(0,Number(i[r])||0);if(!(h>0))return c;const d=[a/c,l/c],u=ds(e,r),p=[o[0]+u[0]*h,o[1]+u[1]*h],_=t=>{const r=Math.max(0,Number(i[t])||0);if(!(r>0))return null;const s=e[t],a=e[(t+1)%n],l=a[0]-s[0],c=a[1]-s[1],h=Math.hypot(l,c);if(!(h>0))return null;const u=ds(e,t),_=ps(p,d,[s[0]+u[0]*r,s[1]+u[1]*r],[l/h,c/h]);return _?(_[0]-o[0])*d[0]+(_[1]-o[1])*d[1]:null},m=_((r-1+n)%n)??0,g=(_((r+1)%n)??c)-m;return g>0?g:0}function ms(e,t,i,n,r,o,s,a=1){const l=(e||[]).find(e=>e?.id===t),c=ni(l);if(!c||c.length<3)return null;const h=Cs(e,t,i,n,r,o,s,a);if(!h)return c.map(()=>0);const d=4*cs(r,a);return c.map((e,t)=>{const i=c[(t+1)%c.length],n=[(e[0]+i[0])/2,(e[1]+i[1])/2];for(let e=0;e!(e>0)))return e.map(e=>[e[0],e[1]]);const r=[];for(let o=0;o0||u>0)){r.push([e[o][0],e[o][1]]);continue}if(d>0!=u>0){const t=e[o],i=d>0?[t[0]+p*d,t[1]+_*d]:[t[0],t[1]],n=u>0?[t[0]+m*u,t[1]+g*u]:[t[0],t[1]];r.push(i),Math.hypot(n[0]-i[0],n[1]-i[1])>1e-9&&r.push(n);continue}if(us(w,k)){const t=e[o],i=[t[0]+p*d,t[1]+_*d],n=[t[0]+m*u,t[1]+g*u];r.push(i),Math.hypot(n[0]-i[0],n[1]-i[1])>1e-9&&r.push(n);continue}const $=ps(x,w,S,k),M=Math.max(d,u,1e-9),R=Ms(i,e[o])?.limit??4*M;if($){const i=Math.hypot($[0]-e[o][0],$[1]-e[o][1]);if(Number.isFinite(i)&&i<=R){r.push($);continue}if(Xs(e,t,o)){r.push($);continue}}d>0&&r.push([e[o][0]+p*d,e[o][1]+_*d]),u>0&&r.push([e[o][0]+m*u,e[o][1]+g*u]),d>0||u>0||r.push([e[o][0],e[o][1]])}return r.length>=3?r:null}function fs(e,t=!0){if(!e.length)return"";let i=`M ${e[0][0]} ${e[0][1]}`;for(let t=1;te?.id===t),a=ni(s);if(!a||a.length<3)return null;const l=cs(n,r),c=[];for(const i of e||[]){if(!i||i.id===t)continue;const e=ni(i);if(e)for(const t of An(a,e,l))c.push([t[0],t[1]],[t[2],t[3]])}for(const e of i||[])c.push([e[0],e[1]],[e[2],e[3]]);for(const e of o||[]){const t=No(e,r);t&&c.push(t[0],t[1])}const h=[],d=[];for(let e=0;el)continue;const s=((e[0]-t[0])*(i[0]-t[0])+(e[1]-t[1])*(i[1]-t[1]))/(n*n);s<=r||s>=1-r||(o.some(e=>Math.abs(e-s)*n<=2*l)||o.push(s))}o.sort((e,t)=>e-t);for(const n of o)h.push([t[0]+(i[0]-t[0])*n,t[1]+(i[1]-t[1])*n]),d.push(e)}return{poly:h,parent:d,orig:a}}function bs(e,t,i,n){const r=t.poly.length,o=new Array(r).fill(0);if(!e?.length)return o;const s=new Set,a=[];for(let l=0;l0?(o[l]=To(c.cm),s.add(c.key)):a.push(l)}if(!a.length)return o;const l=n>0?n:1,c=Math.max(.5*i,1e-9)*l,h=Lo(e,l).filter(e=>e.w.cm>0);for(let e=a.length-1;e>=0;e--){const i=a[e],n=t.poly[i],s=t.poly[(i+1)%r],d=Bo(n,s);let u=null;for(const e of h){const t=No(e.w,l);if(!t||!qo(Bo(t[0],t[1]),d))continue;if(Fs(n[0],n[1],t[0][0],t[0][1],t[1][0],t[1][1])>c||Fs(s[0],s[1],t[0][0],t[0][1],t[1][0],t[1][1])>c)continue;const i=Math.hypot(s[0]-n[0],s[1]-n[1]),r=Math.hypot(t[1][0]-t[0][0],t[1][1]-t[0][1]),o=Math.max(0,r-i);(!u||oc||Fs(r[0],r[1],t[0][0],t[0][1],t[1][0],t[1][1])>c)continue;i=!0,o=Math.max(0,Math.hypot(t[1][0]-t[0][0],t[1][1]-t[0][1])-_)}else{if(Fs(e.x,e.y,n[0],n[1],r[0],r[1])>c)continue;o=Math.hypot(e.x-d,e.y-u)}(!p||i&&!p.exact||i===p.exact&&o0?i:1,o=(e||[]).filter(e=>e&&!e.open&&null!==e.kind&&Number.isFinite(e.half)&&e.half>0&&Array.isArray(e.a)&&Array.isArray(e.b)&&e.a.length>=2&&e.b.length>=2&&[e.a[0],e.a[1],e.b[0],e.b[1]].every(Number.isFinite)&&Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])>n).sort((e,t)=>e.key.localeCompare(t.key)||e.a[0]-t.a[0]||e.a[1]-t.a[1]||e.b[0]-t.b[0]||e.b[1]-t.b[1]||e.half-t.half),s=new Map;for(const e of o){const t=s.get(e.key);t?e.half>t.half&&s.set(e.key,{...t,half:e.half}):s.set(e.key,e)}const a=[...s.values()].flatMap(e=>[{point:[e.a[0],e.a[1]],other:e.b,halfDepth:e.half,kind:e.kind,key:e.key},{point:[e.b[0],e.b[1]],other:e.a,halfDepth:e.half,kind:e.kind,key:e.key}]).sort((e,t)=>e.point[0]-t.point[0]||e.point[1]-t.point[1]||e.other[0]-t.other[0]||e.other[1]-t.other[1]||e.halfDepth-t.halfDepth),l=new Map;for(const e of a){const[t,i]=ws(e.point,n),r=ks(t,i),o=l.get(r)||[];o.push(e),l.set(r,o)}const c=[],h=new Map;for(const e of a){const t=xs(h,e.point,n).filter(t=>Math.hypot(t.point[0]-e.point[0],t.point[1]-e.point[1])<=n).sort((t,i)=>Math.hypot(t.point[0]-e.point[0],t.point[1]-e.point[1])-Math.hypot(i.point[0]-e.point[0],i.point[1]-e.point[1])||t.point[0]-i.point[0]||t.point[1]-i.point[1]);let i=t[0];if(!i){i={point:[...e.point],rays:[]},c.push(i);const[t,r]=ws(i.point,n),o=ks(t,r),s=h.get(o)||[];s.push(i),h.set(o,s)}const r=e.other[0]-e.point[0],o=e.other[1]-e.point[1],s=Math.hypot(r,o);if(!(s>n))continue;const a=[r/s,o/s];let l=Math.atan2(a[1],a[0]);l<0&&(l+=2*Math.PI),i.rays.push({u:a,halfDepth:e.halfDepth,length:s,angle:l})}const d=[],u=e=>{const t=1e-9*Math.max(1,r),i=e.filter(e=>Number.isFinite(e.halfDepth)&&e.halfDepth>0&&Number.isFinite(e.length)&&e.length>n);return i.filter((e,n)=>!i.some((i,r)=>r!==n&&i.halfDepth>=e.halfDepth-t&&i.length>=e.length-t&&(i.halfDepth>e.halfDepth+t||i.length>e.length+t||re.length-t.length||e.halfDepth-t.halfDepth).map(e=>({...e}))};for(const e of c){const t=e.rays.sort((e,t)=>e.angle-t.angle||e.length-t.length||e.halfDepth-t.halfDepth),i=[];for(const e of t){const t=i[i.length-1];t&&Math.abs(e.angle-t.angle)<=1e-9?t.supports.push({halfDepth:e.halfDepth,length:e.length}):i.push({u:[...e.u],angle:e.angle,supports:[{halfDepth:e.halfDepth,length:e.length}]})}if(i.length>1&&2*Math.PI-i[i.length-1].angle+i[0].angle<=1e-9){const e=i.pop();i[0].supports.push(...e.supports)}if(i.length<3)continue;const r=i.map(t=>{const i=u(t.supports),r=new Set,o=[];for(const s of i){const i=[e.point[0]+t.u[0]*s.length,e.point[1]+t.u[1]*s.length];for(const t of xs(l,i,n)){if("shared"!==t.kind||Math.hypot(t.point[0]-i[0],t.point[1]-i[1])>n)continue;const s=t.other[0]-t.point[0],a=t.other[1]-t.point[1],l=Math.hypot(s,a);if(!(l>n))continue;const c=s/l,h=a/l;if(Math.hypot(t.other[0]-e.point[0],t.other[1]-e.point[1])<=n)continue;const d=`${t.key}|${t.point[0]}|${t.point[1]}|${t.other[0]}|${t.other[1]}|${t.halfDepth}`;r.has(d)||(r.add(d),o.push({start:[t.point[0],t.point[1]],u:[c,h],length:l,halfDepth:t.halfDepth}))}}return o.sort((e,t)=>e.start[0]-t.start[0]||e.start[1]-t.start[1]||e.u[0]-t.u[0]||e.u[1]-t.u[1]||e.length-t.length||e.halfDepth-t.halfDepth),{u:[...t.u],halfDepth:Math.max(...i.map(e=>e.halfDepth)),length:Math.max(...i.map(e=>e.length)),supports:i,continuations:o}}).filter(e=>Number.isFinite(e.halfDepth)&&e.halfDepth>0&&Number.isFinite(e.length)&&e.length>n);if(r.length<3)continue;const o=Math.max(...r.map(e=>e.halfDepth));o>0&&Number.isFinite(o)&&d.push({point:[...e.point],rays:r,halfDepth:o,limit:1.25*o})}d.sort((e,t)=>e.point[0]-t.point[0]||e.point[1]-t.point[1]);const p=new Map;for(const e of d){const[t,i]=ws(e.point,n),r=ks(t,i),o=p.get(r)||[];o.push(e),p.set(r,o)}return{epsilon:n,coordinateScale:r,nodes:d,index:p}}function $s(e){const t={fans:[],supports:[]};if(!e?.nodes?.length)return t;const i=Math.max(e.epsilon,1e-9)**2;for(const n of e.nodes){const e=n.rays.filter(e=>Number.isFinite(e.halfDepth)&&e.halfDepth>0).map(e=>({...e,thickLength:Math.max(...e.supports.filter(t=>t.halfDepth>=e.halfDepth-1e-12).map(e=>e.length),0),angle:(()=>{const t=Math.atan2(e.u[1],e.u[0]);return t<0?t+2*Math.PI:t})()})).sort((e,t)=>e.angle-t.angle);if(e.length<2)continue;const r=n.point;for(const i of e)for(const e of i.supports){if(!(e.halfDepth>0&&e.length>0))continue;const n=-i.u[1]*e.halfDepth,o=i.u[0]*e.halfDepth,s=[r[0]+i.u[0]*e.length,r[1]+i.u[1]*e.length];t.supports.push([[r[0]+n,r[1]+o],[s[0]+n,s[1]+o],[s[0]-n,s[1]-o],[r[0]-n,r[1]-o]])}for(let n=0;n{const e=s.angle-o.angle;return e>0?e:e+2*Math.PI})();if(a<1e-9)continue;const l=a>Math.PI+1e-9,c=4*Math.max(o.halfDepth,s.halfDepth),h=[r[0]-o.u[1]*o.halfDepth,r[1]+o.u[0]*o.halfDepth],d=[r[0]+s.u[1]*s.halfDepth,r[1]-s.u[0]*s.halfDepth],u=o.u[0]*s.u[1]-o.u[1]*s.u[0],p=e=>{let t=Math.atan2(e[1]-r[1],e[0]-r[0])-o.angle;for(;t<0;)t+=2*Math.PI;return t<=a+1e-9};let _=null;if(Math.abs(u)>1e-9){const e=((d[0]-h[0])*s.u[1]-(d[1]-h[1])*s.u[0])/u,t=((d[0]-h[0])*o.u[1]-(d[1]-h[1])*o.u[0])/u,i=[h[0]+o.u[0]*e,h[1]+o.u[1]*e];(l?e<=1e-9&&t<=1e-9:e>1e-9&&e<=o.thickLength&&t<=s.thickLength)&&Math.hypot(i[0]-r[0],i[1]-r[1])<=c&&p(i)&&(_=i)}const m=e=>{Math.abs(hs(e))>i&&t.fans.push(e)};if(_){const e=1.5*Math.max(o.halfDepth,s.halfDepth);m(So([r[0],r[1]],h,_,d,e)??[[r[0],r[1]],h,_,d]);continue}if(l){m([[r[0],r[1]],h,d]);continue}const g=(e,t)=>Math.min(t,Math.sqrt(Math.max(c**2-e**2,0)),2*Math.max(o.halfDepth,s.halfDepth)),f=[h[0]+o.u[0]*g(o.halfDepth,o.thickLength),h[1]+o.u[1]*g(o.halfDepth,o.thickLength)],v=[d[0]+s.u[0]*g(s.halfDepth,s.thickLength),d[1]+s.u[1]*g(s.halfDepth,s.thickLength)];m([[r[0],r[1]],h,f,v,d])}}return t}function Ms(e,t){return!e||!Array.isArray(t)||t.length<2||!t.slice(0,2).every(Number.isFinite)?null:xs(e.index,t,e.epsilon).filter(i=>Math.hypot(i.point[0]-t[0],i.point[1]-t[1])<=e.epsilon).sort((e,i)=>Math.hypot(e.point[0]-t[0],e.point[1]-t[1])-Math.hypot(i.point[0]-t[0],i.point[1]-t[1])||e.point[0]-i.point[0]||e.point[1]-i.point[1])[0]||null}function Rs(e,t,i,n,r,o,s){return Ss(Ts(e,t,i,n,r,o,s),4*cs(n,s),s)}function Cs(e,t,i,n,r,o,s,a=1){const l=ys(e,t,n,r,a,i);if(!l)return null;const c=function(e,t,i){const n=(e||[]).find(e=>e?.id===t),r=ni(n);if(!r)return[];const o=[];for(const n of e||[]){if(!n||n.id===t)continue;const e=ni(n);if(e)for(const t of An(r,e,i))o.push(t)}return o}(e,t,cs(r,a)),h=function(e,t,i,n,r){const o=cs(n,r),s=[];for(let a=0;aFs(h,d,e[0],e[1],e[2],e[3])<=o);s.push(u?"shared":"outer")}return s}(l.poly,c,n,r,a),d=bs(i,l,r,a),u=d.map((e,t)=>h[t]&&e>0?Ao(e,o,s)/2:0);return{...l,kinds:h,cms:d,offsets:u}}function Ts(e,t,i,n,r,o,s=1){const a=[];for(const l of e||[]){if(!l?.id)continue;const c=Cs(e,l.id,t,i,n,r,o,s);if(c)for(let e=0;e0&&(a=Zo(a,e.a,e.b,e.cm,n,s));return a}function As(e,t,i,n,r,o,s=1){if(!t?.length)return[];const a=Ts(e,t,i,n,r,o,s),l=new Map;for(const e of a){if(e.open||!e.kind||!e.roomId)continue;const t=l.get(e.key)||new Set;t.add(e.roomId),l.set(e.key,t)}const c=e=>{const t=[...l.get(e)||[]].sort();return 1!==t.length&&2!==t.length?`ambiguous:${e}`:`${1===t.length?"outer":"shared"}:${t.join("|")}`},h=[],d=new Set;for(const e of a)!e.open&&e.cm>0&&!d.has(e.key)&&(d.add(e.key),h.push({...e,ownerSignature:c(e.key)}));const u=[];for(const a of e||[]){if(!a?.id)continue;const l=Cs(e,a.id,t,i,n,r,o,s);if(l)for(let e=0;e0)||null===l.kinds[i]){e++;continue}const o=c(Eo(l.poly[i],l.poly[(i+1)%l.poly.length],n,s));let a=e;for(;a+10&&u.push({a:[d[0],d[1]],b:[p[0],p[1]],key:Eo(d,p,n,s),cm:r,len:_,ownerSignature:o}),e=a+1}}}u.sort((e,t)=>t.len-e.len||e.key.localeCompare(t.key));const p=[],_=new Set,m=new Set,g=4*cs(n,s);for(const e of u){const t=h.filter(t=>!m.has(t.key)&&t.cm===e.cm&&t.ownerSignature===e.ownerSignature&&qo(Bo(t.a,t.b),Bo(e.a,e.b))&&Fs(t.a[0],t.a[1],e.a[0],e.a[1],e.b[0],e.b[1])<=g&&Fs(t.b[0],t.b[1],e.a[0],e.a[1],e.b[0],e.b[1])<=g);if(t.length){for(const e of t)m.add(e.key);_.has(e.key)||(_.add(e.key),p.push(Ho(e.a,e.b,e.cm,n,s)))}}for(const e of h)m.has(e.key)||_.has(e.key)||(_.add(e.key),p.push(Ho(e.a,e.b,e.cm,n,s)));return p}function Ps(e,t,i,n,r,o,s,a=1){const l=cs(r,a),c=(n[0]+n[2])/2,h=(n[1]+n[3])/2,d=Bo([n[0],n[1]],[n[2],n[3]]);let u=null;for(const n of Ts(e,t,i,r,o,s,a)){if(!qo(Bo(n.a,n.b),d))continue;const e=Fs(c,h,n.a[0],n.a[1],n.b[0],n.b[1]);e>4*l||(!u||e[e[0],e[1]]),o=Math.abs(hs(r));r.length>=3&&o>i&&(t=r,i=o)}return t}function Is(e,t,i,n,r,o,s,a=1,l,c){const h=(e||[]).find(e=>e?.id===t),d=ni(h);if(!d||d.length<3)return null;if(!i?.length)return d.map(e=>[e[0],e[1]]);const u=Cs(e,t,i,n,r,o,s,a);if(!u||!u.offsets.some(e=>e>0))return d.map(e=>[e[0],e[1]]);const p=c||Rs(e,i,n,r,o,s,a),_=gs(u.poly,u.offsets,p);if(!_)return d.map(e=>[e[0],e[1]]);if(!p.nodes.length)return _;const m=void 0===l?Zs(e,i,n,[],r,o,s,a):null,g=l??("ok"===m?.status||"degraded-extra"===m?.status?m.roomGeom:void 0);if(g)try{const e=zs(Gt(Os(u.poly),g));if(e)return e}catch{}return function(e,t){try{return zs(Ut(Os(e),Os(t)))}catch{return null}}(_,u.poly)||d.map(e=>[e[0],e[1]])}function Os(e){const t=e.map(e=>[e[0],e[1]]);return t.push([e[0][0],e[0][1]]),[t]}function Es(e){return!(!Array.isArray(e)||!e.length)&&e.every(e=>Array.isArray(e)&&e.length&&e.every(e=>Array.isArray(e)&&e.length>=4&&e.every(e=>Array.isArray(e)&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])))&&Math.abs(Ci(e[0]))>1e-9)}function Ns(e,t,i,n){const r=n?new Set(n):null;let o=null;for(let n=0;nt.epsilon))continue;const l=js([[e.point[0]+a[0]*n.halfDepth,e.point[1]+a[1]*n.halfDepth],[e.point[0]+s.u[0]*r+a[0]*n.halfDepth,e.point[1]+s.u[1]*r+a[1]*n.halfDepth],[e.point[0]+s.u[0]*r-a[0]*n.halfDepth,e.point[1]+s.u[1]*r-a[1]*n.halfDepth],[e.point[0]-a[0]*n.halfDepth,e.point[1]-a[1]*n.halfDepth]],t.coordinateScale);if(!l)continue;const c=Os(l);o=o?Wt(o,c):c}}return o}function Hs(e,t,i){let n=null;for(const r of e.rays)for(const e of r.continuations){const r=[-e.u[1],e.u[0]],o=[e.start[0]+e.u[0]*e.length,e.start[1]+e.u[1]*e.length],s=js([[e.start[0]+r[0]*e.halfDepth,e.start[1]+r[1]*e.halfDepth],[o[0]+r[0]*e.halfDepth,o[1]+r[1]*e.halfDepth],[o[0]-r[0]*e.halfDepth,o[1]-r[1]*e.halfDepth],[e.start[0]-r[0]*e.halfDepth,e.start[1]-r[1]*e.halfDepth]],t.coordinateScale);if(!s)continue;const a=Ut(Os(s),i);Array.isArray(a)&&0!==a.length&&(n=n?Wt(n,a):a)}return n}function Ls(e,t,i=2*(4*e.halfDepth+2*t.epsilon)){const n=function(e,t=$o){const i=new Set,n=Number.isFinite(t)&&t>=0?t:$o;for(let t=0;te-t)}(e);return n.length?Ns(e,t,i,n):null}function Bs(e,t,i,n,r){const o=function(e){let t=null;for(const i of e){const e=Os(i);try{t=t?Wt(t,e):e}catch{}}return t}(function(e,t,i=!1){if(!e)return[];const n=[];for(const r of e.nodes)for(let o=0;o1e-9)||h>=Math.PI-1e-9)continue;const d=[-s.u[1],s.u[0]],u=[-a.u[1],a.u[0]],p=[r.point[0]+d[0]*s.halfDepth,r.point[1]+d[1]*s.halfDepth],_=[r.point[0]-u[0]*a.halfDepth,r.point[1]-u[1]*a.halfDepth],m=ps(p,s.u,_,a.u);if(!m)continue;const g=Math.hypot(m[0]-r.point[0],m[1]-r.point[1]);if(!Number.isFinite(g)||g<=r.limit)continue;const f=t?Math.sqrt(Math.max(0,r.limit*r.limit-s.halfDepth*s.halfDepth)):0,v=t?Math.sqrt(Math.max(0,r.limit*r.limit-a.halfDepth*a.halfDepth)):0,y=js([[p[0]+s.u[0]*f,p[1]+s.u[1]*f],[_[0]+a.u[0]*v,_[1]+a.u[1]*v],m],e.coordinateScale);if(y&&n.push(y),i){const t=m[0]-r.point[0],i=m[1]-r.point[1],o=Math.hypot(t,i),s=g-r.limit;if(o>e.epsilon&&s>e.epsilon){const a=Math.min(Math.max(8*e.epsilon,.05*r.halfDepth),.25*s),l=t/o,c=i/o,h=-c,d=l,u=js([[m[0]-l*a+h*a,m[1]-c*a+d*a],[m[0]-l*a-h*a,m[1]-c*a-d*a],[m[0]+l*a,m[1]+c*a]],e.coordinateScale);u&&n.push(u)}}}return n}({...t,nodes:[e]},i,n));return o&&r?Gt(o,r):o}function qs(e,t,i,n){if(!e||!t.nodes.length)return e;let r=null;try{r=function(e){let t=null;for(const i of e.nodes){const n=Ls(i,e);n&&(t=t?Wt(t,n):n)}return t}(t)}catch{return e}let o=e;for(const e of t.nodes){const s=4*e.halfDepth+2*t.epsilon,a=2*s,l=[[e.point[0]-s,e.point[1]-s],[e.point[0]+s,e.point[1]-s],[e.point[0]+s,e.point[1]+s],[e.point[0]-s,e.point[1]+s]];try{let s=o;const c=Bs(e,t,!1,!0,r);c&&(s=Gt(s,c));let h=Ns(e,t,a);const d=Bs(e,t,!0,!0,r);d&&(h=Gt(h,d)),r&&(h=Wt(h,r));const u=.02*Math.min(...e.rays.map(e=>e.halfDepth));if(h=Wt(h,Os([[e.point[0]-u,e.point[1]-u],[e.point[0]+u,e.point[1]-u],[e.point[0]+u,e.point[1]+u],[e.point[0]-u,e.point[1]+u]])),!h)continue;let p=Ut(h,Os(l));n?p=Ut(p,n):i&&(p=Ut(p,i));const _=Os(l),m=Gt(s,_),g=i?Gt(Ut(s,_),i):null,f=Hs(e,t,_);o=Wt(m,...g?[g]:[],...f?[f]:[],p)}catch{}}if(r)try{let e=r;n?e=Ut(e,n):i&&(e=Ut(e,i)),o=Wt(o,e)}catch{}return o}function js(e,t=1){if(!Array.isArray(e)||e.length<3)return null;const i=Number.isFinite(t)&&t>0?t:1,n=1e-12*Math.max(1,i),r=[];for(const t of e){if(!Array.isArray(t)||t.length<2)return null;const e=Number(t[0]),i=Number(t[1]);if(!Number.isFinite(e)||!Number.isFinite(i))return null;const o=Math.round(e/n)*n,s=Math.round(i/n)*n;if(!Number.isFinite(o)||!Number.isFinite(s))return null;r.push([Object.is(o,-0)?0:o,Object.is(s,-0)?0:s])}return Math.abs(hs(r))>n*n?r:null}function Ws(e,t,i,n){if(Fs(e[0],e[1],t[0],t[1],i[0],i[1])>n)return!1;const r=i[0]-t[0],o=i[1]-t[1],s=(e[0]-t[0])*r+(e[1]-t[1])*o,a=r*r+o*o,l=n*Math.sqrt(a);return s>=-l&&s<=a+l}function Us(e,t,i){const n=[],r=[];for(let o=0;oi*i))continue;const d=i/Math.sqrt(h),u=[0,1];for(const e of t)for(const t of[e.a,e.b]){if(!Ws(t,s,a,i))continue;const e=((t[0]-s[0])*l+(t[1]-s[1])*c)/h;e>d&&e<1-d&&u.push(e)}u.sort((e,t)=>e-t);const p=u.filter((e,t)=>0===t||Math.abs(e-u[t-1])>d);for(let e=0;e=3&&r.length===n.length?{poly:n,offsets:r}:null}function Gs(e,t,i,n,r,o,s,a){const l=(e||[]).map(ni).filter(e=>!!e&&e.length>=3);if(!l.length)return null;let c=Wt(Os(l[0]));for(let e=1;e"outer"===e.kind&&e.half>0),u=4*cs(n,s),p=a||Ss(h,u,s);let _=null;for(const e of function(e){const t=[];for(const i of Array.isArray(e)?e:[])if(Array.isArray(i))for(const e of i){if(!Array.isArray(e)||e.length<4)continue;const i=e.slice(0,-1).map(e=>[e[0],e[1]]);i.length>=3&&t.push(i)}return t}(c)){const t=Us(e,d,u);if(!t||!t.offsets.some(e=>e>0))continue;const i=ia(t.poly,t.offsets,p),n=gs(t.poly,t.offsets,p);if(!i||!n)continue;const r=Gt(Os(i),Os(n));_=_?Wt(_,r):r}return{centre:c,shell:_||[]}}function Vs(e,t,i,n,r,o,s=1){try{const a=Gs(e,t,i,n,r,o,s,Rs(e,t,i,n,r,o,s));if(!a)return[];return a.shell?.length?Wt(a.centre,a.shell):a.centre}catch{return null}}function Ks(e){if(!e)return"";let t="";for(const i of e)if(Array.isArray(i))for(const e of i){if(!Array.isArray(e)||e.length<4)continue;const i=e.slice(0,e.length-1);i.length<3||(t+=(t?" ":"")+fs(i.map(e=>[e[0],e[1]])))}return t}const Ys=15;function Xs(e,t,i){const n=e?.length||0;if(n<3||t?.length!==n)return!1;const r=e[(i-1+n)%n],o=e[i],s=e[(i+1)%n],a=[r[0]-o[0],r[1]-o[1]],l=[s[0]-o[0],s[1]-o[1]],c=Math.hypot(a[0],a[1]),h=Math.hypot(l[0],l[1]);if(!(c>1e-9&&h>1e-9))return!1;const d=Math.max(-1,Math.min(1,(a[0]*l[0]+a[1]*l[1])/(c*h))),u=Math.acos(d);if(!(u>1e-9))return!1;if(u>=Ys*Math.PI/180)return!1;const p=Math.max(0,t[(i-1+n)%n]),_=Math.max(0,t[i]);if(!(p>0||_>0))return!1;const m=Math.sin(u);if(!(m>1e-12))return!1;const g=(_+p*d)/m,f=(p+_*d)/m;return Number.isFinite(g)&&Number.isFinite(f)&&g>0&&f>0&&ge>0))continue;for(const e of l.offsets)e>0&&(u=Math.max(u,2*e));const c=ia(l.poly,l.offsets,d),p=gs(l.poly,l.offsets,d);c&&h.push({outset:c,inset:p})}for(const e of l){const t=e.map(e=>e[0]),i=e.map(e=>e[1]);if(t.length){const n=Math.min(Math.max(...t)-Math.min(...t),Math.max(...i)-Math.min(...i)),r=Math.min(...e.map((t,i)=>{const n=e[(i+1)%e.length];return Math.hypot(n[0]-t[0],n[1]-t[1])}));u=Math.max(u,e.length>16?n:r)}}const p=function(e,t,i,n,r,o,s,a){if(!t?.length||!i?.length)return[];const l=4*cs(n,s),c=new Map;for(const a of Ts(e,t,i,n,r,o,s))!a.open&&a.half>0&&!c.has(a.key)&&c.set(a.key,a);const h=[...c.values()];if(h.length<2)return[];const d=a||Ss(h,l),u=[];for(const e of i)for(const t of[[e[0],e[1]],[e[2],e[3]]])u.some(e=>Math.hypot(e[0]-t[0],e[1]-t[1])<=l)||u.push(t);const p=[],_=(e,t)=>{let i=0,n=0;if(Math.hypot(e.a[0]-t[0],e.a[1]-t[1])<=l)i=e.b[0]-e.a[0],n=e.b[1]-e.a[1];else{if(!(Math.hypot(e.b[0]-t[0],e.b[1]-t[1])<=l))return null;i=e.a[0]-e.b[0],n=e.a[1]-e.b[1]}const r=Math.hypot(i,n);return r>l?[i/r,n/r]:null};for(const e of u){const t=h.map(t=>({iv:t,u:_(t,e)})).filter(e=>!!e.u);for(let i=0;i0?[e.slice(),u,m,_]:[e.slice(),_,m,u];else{if(!f)continue;{const t=[-r.u[1],r.u[0]],i=[-o.u[1],o.u[0]],n=s<0?1:-1,a=[e[0]+t[0]*r.iv.half*n,e[1]+t[1]*r.iv.half*n],l=[e[0]-i[0]*o.iv.half*n,e[1]-i[1]*o.iv.half*n];y=s>0?[e.slice(),a,l]:[e.slice(),l,a]}}Math.abs(hs(y))>l*l&&p.push(y)}}return p}(e,t,i,r,o,s,a,d),_=n.length?na(e,t,i,r,o,s,a):null;let m="exterior";try{const v=Gs(e,t,i,r,o,s,a,d);m="paper";const y=v?v.shell?.length?Wt(v.centre,v.shell):v.centre:[],b=e=>{const t=Os(e.outset);if(!e.inset)return t;const i=Os(e.inset);return Gt(t,i)};m="room-rings";let w=null;for(const e of h)try{const t=b(e);w=w?Wt(w,t):t}catch{}if(m="edge-bodies",v)for(const n of ea(e,t,i,r,o,s,a))try{const e=Ut(Os(n.quad),v.centre);w=w?Wt(w,e):e}catch{}m="junctions",w=function(e,t,i=1,n=Wt){let r=e;for(const e of t||[]){const t=js(e,i);if(t)try{const e=Os(t);r=r?n(r,e):e}catch{}}return r}(w,p,a),m="facade-clip",w&&v&&(w=Ut(w,v.centre)),m="exterior-shell";const k=[];let x=0;if(v?.shell?.length)if(w)try{const e=Wt(w,v.shell);if(!Es(e))throw new Error("invalid shell union");w=e}catch{if(!Es(w)||!Es(v.shell))throw new Error("invalid shell");k.push({id:"exterior-shell",geom:v.shell}),x++}else w=v.shell;if(m="multi-wall-trim",w&&d.nodes.length){const e=e=>e.rays.some(e=>e.supports.some(e=>e.length<2*e.halfDepth)),t=d.nodes.filter(e);if(t.length){w=qs(w,{...d,nodes:t},v?.centre,y)}}if(m="junction-corners",d.nodes.length){const n=$s(d),l=function(e,t,i,n,r,o,s,a){try{const l=Gs(e,t,i,n,r,o,s,{epsilon:a.epsilon,coordinateScale:a.coordinateScale,nodes:[],index:new Map});return l?l.shell?.length?Wt(l.centre,l.shell):l.centre:null}catch{return null}}(e,t,i,r,o,s,a,d);for(const e of n.fans)try{let t=[Os(e)];if(l&&(t=Ut(t,l)),!t?.length)continue;w=w?Wt(w,t):t}catch{}g=w,f=Math.max(d.epsilon,1e-9)**2,w=Array.isArray(g)?g.map(e=>{if(!Array.isArray(e)||!e.length)return e;const[t,...i]=e;return Math.abs(hs(t||[]))<=f?null:[t,...i.filter(e=>Math.abs(hs(e||[]))>f)]}).filter(e=>!!e):g}const S=w||[],$=[...Es(S)?[{id:"room-primary",geom:S}]:[],...k.map((e,t)=>({id:`room-isolated-${t}`,geom:e.geom}))];m="openings";for(const e of n){if(!(e.length>0))continue;const t=sa(_,e,!0);if(!t.negative&&!t.positive)continue;const i=e.angle*Math.PI/180,n=Math.cos(i),o=Math.sin(i),s=-o,l=n,c=e.length/2,h=1.25*Math.max(u,r*a),d=[[e.x-n*c-s*h,e.y-o*c-l*h],[e.x+n*c-s*h,e.y+o*c-l*h],[e.x+n*c+s*h,e.y+o*c+l*h],[e.x-n*c+s*h,e.y-o*c+l*h]];w&&(w=Gt(w,Os(d)));for(const e of k)e.geom=Gt(e.geom,Os(d))}m="extras";const M=[];let R=0;const C=c.mergeExtra||((e,t)=>e?Wt(e,t):t);for(let e=0;ee.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1]))||Math.abs(Ci(t))<=1e-9){R++;continue}const i=[Os(t)];try{const t=C(w,i,e);if(!Es(t))throw new Error("invalid extra union");w=t}catch{R++,Es(i)&&M.push({id:`extra-${e}`,geom:i})}}M.push(...k),M.sort((e,t)=>Ks(e.geom).localeCompare(Ks(t.geom)));const T=w||[];return{status:R||x?"degraded-extra":"ok",geom:T,components:[...Es(T)?[{id:"primary",geom:T}]:[],...M.map((e,t)=>({...e,id:`isolated-${t}`}))],roomGeom:S,roomComponents:$,paperGeom:y,depthUnits:u,openingPadUnits:1.25*Math.max(u,r*a),openingIndex:_,multiWallNodes:d,degradedExtraCount:R+x}}catch{return c.onCoreFailure?.(m),{status:"failed-core",geom:[],components:[],roomGeom:[],paperGeom:[],roomComponents:[],depthUnits:u,openingIndex:null,multiWallNodes:d,degradedExtraCount:0}}var g,f}function Js(e,t,i,n=[],r,o,s,a=1,l=[],c={}){if(!t?.length&&!l.length)return null;return Qs(Zs(e,t,i,n,r,o,s,a,l,c))}function Qs(e){if("failed-core"===e.status||"not-applicable"===e.status)return null;const t=e.components.map(e=>({id:e.id,d:Ks(e.geom),fillRule:"evenodd"})).filter(e=>!!e.d),i=t[0]?.d||"",n=Ks(e.paperGeom);if(t.length){const r={status:e.status,d:i,paths:t,components:e.components,roomGeom:e.roomGeom,multiWallNodes:e.multiWallNodes,paperD:n,depthUnits:e.depthUnits,fillRule:"evenodd"};return Object.defineProperties(r,{roomComponents:{value:e.roomComponents||[],enumerable:!1},openingIndex:{value:e.openingIndex,enumerable:!1},openingPadUnits:{value:e.openingPadUnits,enumerable:!1}}),r}return null}function ea(e,t,i,n,r,o,s=1){if(!t?.length)return[];const a=new Set,l=[];for(const c of e||[]){if(!c?.id)continue;const h=Cs(e,c.id,t,i,n,r,o,s);if(!h)continue;const d=h.poly;for(let e=0;e0))continue;const p=Eo(t,i,n,s);if(a.has(p))continue;a.add(p);const _=Ao(u,r,o),[m,g]=ds(d,e),f=-m,v=-g,y=_/2,b=[[t[0]+f*y,t[1]+v*y],[i[0]+f*y,i[1]+v*y],[i[0]+m*y,i[1]+g*y],[t[0]+m*y,t[1]+g*y]];l.push({key:p,kind:c,cm:u,quad:b,a:[t[0],t[1]],b:[i[0],i[1]],depthUnits:_})}}return l}function ta(e,t=[]){let i=fs(e.quad);const[n,r]=Io(e.a,e.b),o=n,s=r,a=-s,l=o;for(const n of t){if(!Go(e.a,e.b,n.angle))continue;if(Fs(n.x,n.y,e.a[0],e.a[1],e.b[0],e.b[1])>Math.max(.55*e.depthUnits,.001))continue;const t=n.length/2,r=e.depthUnits,c=n.x,h=n.y;i+=` ${fs(vs([[c-o*t-a*r,h-s*t-l*r],[c+o*t-a*r,h+s*t-l*r],[c+o*t+a*r,h+s*t+l*r],[c-o*t+a*r,h-s*t+l*r]]))}`}return i}function ia(e,t,i){const n=e?.length||0;if(n<3||t.length!==n)return null;if(t.every(e=>!(e>0)))return e.map(e=>[e[0],e[1]]);vs(e),t.slice().reverse();const r=[];for(let o=0;o0||l>0)){r.push([e[o][0],e[o][1]]);continue}if(a>0!=l>0){const t=e[o],i=a>0?[t[0]-c*a,t[1]-h*a]:[t[0],t[1]],n=l>0?[t[0]-d*l,t[1]-u*l]:[t[0],t[1]];r.push(i),Math.hypot(n[0]-i[0],n[1]-i[1])>1e-9&&r.push(n);continue}if(us(w,k)){const t=e[o],i=[t[0]-c*a,t[1]-h*a],n=[t[0]-d*l,t[1]-u*l];r.push(i),Math.hypot(n[0]-i[0],n[1]-i[1])>1e-9&&r.push(n);continue}const $=ps(x,w,S,k),M=Math.max(a,l,1e-9),R=Ms(i,e[o])?.limit??4*M;if($){const i=Math.hypot($[0]-e[o][0],$[1]-e[o][1]);if(Number.isFinite(i)&&i<=R){r.push($);continue}if(Xs(e,t,o)){r.push([e[o][0],e[o][1]]);continue}}a>0&&r.push([e[o][0]-c*a,e[o][1]-h*a]),l>0&&r.push([e[o][0]-d*l,e[o][1]-u*l])}return r.length>=3?r:null}function na(e,t,i,n,r,o,s=1){const a=[];for(const l of e||[]){if(!l?.id)continue;const c=Cs(e,l.id,t,i,n,r,o,s);if(!c)continue;const h=Math.abs(Ci(c.poly));for(let e=0;e[Math.max(t,e.x0),Math.min(i,e.x1)]).filter(e=>e[1]-e[0]>n).sort((e,t)=>e[0]-t[0]||e[1]-t[1]);if(!r.length)return{coverage:0,full:!1};let o=r[0][0],s=r[0][1],a=0,l=o<=t+n;for(let e=1;e=i-n,{coverage:a,full:l}}function oa(e,t){return Number(t.full)-Number(e.full)||e.faceDistance-t.faceDistance||e.area-t.area||e.roomId.localeCompare(t.roomId)}function sa(e,t,i=!1){const n=Number(t?.x),r=Number(t?.y),o=Number(t?.angle),s=Number(t?.length);if(!([n,r,o,s].every(Number.isFinite)&&s>0))return{negative:null,positive:null};const a=o*Math.PI/180,l=Math.cos(a),c=Math.sin(a),h=-c,d=l,u=s/2,p=Math.max(1e-9,e.adjacencyEps),_=new Map;let m=0;for(const t of e.edges){if(i&&!(t.half>0))continue;if(!Go(t.a,t.b,o))continue;const[e,s]=Io(t.a,t.b);if(Math.abs((n-t.a[0])*s-(r-t.a[1])*e)>p)continue;const a=(t.a[0]-n)*l+(t.a[1]-r)*c,g=(t.b[0]-n)*l+(t.b[1]-r)*c,f=Math.max(-u,Math.min(a,g)),v=Math.min(u,Math.max(a,g));if(v-f<=p)continue;const y=t.inward[0]*h+t.inward[1]*d>=0?1:-1,b=((t.a[0]+t.b[0])/2-n)*h+((t.a[1]+t.b[1])/2-r)*d,w=Math.abs(b+y*t.half),k=`${y}|${t.roomId}`,x={x0:f,x1:v,half:t.half,cm:t.cm,key:t.key,axis:[e,s]},S=_.get(k);S?(S.pieces.push(x),S.faceDistance=Math.min(S.faceDistance,w)):_.set(k,{roomId:t.roomId,side:y,order:m++,pieces:[x],faceDistance:w,area:t.area,coverage:0,full:!1})}for(const e of _.values()){const t=ra(e.pieces,-u,u,p);e.coverage=t.coverage,e.full=t.full}const g=e=>{const t=[..._.values()].filter(t=>t.side===e&&t.coverage>p);return t.sort(oa),t[0]||null};return{negative:g(-1),positive:g(1)}}function aa(e,t,i,n,r,o,s=1,a=[]){return la(na(e,i,a,n,r,o,s),t)}function la(e,t){const i=sa(e,t),n=[i.negative,i.positive].filter(e=>!!e);if(!n.length)return{ox:0,oy:0,cm:0,side:-1};const r=i.negative&&i.positive?-1:n[0].side,o=t.flip_v?-r:r,s=(-1===o?i.negative:i.positive)||n[0],a=[...s.pieces].sort((e,t)=>(e.x0<=0&&e.x1>=0?0:Math.min(Math.abs(e.x0),Math.abs(e.x1)))-(t.x0<=0&&t.x1>=0?0:Math.min(Math.abs(t.x0),Math.abs(t.x1)))||t.x1-t.x0-(e.x1-e.x0)||e.key.localeCompare(t.key))[0];if(!(a.half>0&&a.cm>0))return{ox:0,oy:0,cm:0,side:o};const l=t.angle*Math.PI/180,c=-Math.sin(l),h=Math.cos(l);return{ox:c*o*a.half,oy:h*o*a.half,cm:a.cm,side:o}}function ca(e,t){const i=1e-9,n=t.filter(e=>Number.isFinite(e.x0)&&Number.isFinite(e.x1)&&Number.isFinite(e.half)&&e.x1>e.x0&&e.half>0);if(!n.length)return"";const r=n.flatMap(e=>[e.x0,e.x1]).sort((e,t)=>e-t),o=[];for(const e of r){const t=o[o.length-1];(void 0===t||e>t+i)&&o.push(e)}const s=[];for(let e=0;e+1t+i))continue;const a=(t+r)/2,l=n.reduce((e,t)=>a>=t.x0-i&&a<=t.x1+i?Math.max(e,t.half):e,0);if(!(l>0))continue;const c=s[s.length-1];c&&t<=c.x1+i&&Math.abs(l-c.half)<=i?c.x1=r:s.push({x0:t,x1:r,half:l})}const a=[];for(const e of s){const t=a[a.length-1],n=t?.[t.length-1];n&&e.x0<=n.x1+i?(e.x0=n.x1,t.push(e)):a.push([e])}return a.map(t=>{const i=t[0],n=t[t.length-1],r=Math.min(.25*Math.min(...t.map(e=>e.half)),.75),o=-e*r,s=[];if(1===e){s.push(`M ${i.x0} ${o} L ${n.x1} ${o}`);for(let e=t.length-1;e>=0;e--){const i=t[e];s.push(`L ${i.x1} ${i.half} L ${i.x0} ${i.half}`)}}else{s.push(`M ${n.x1} ${o} L ${i.x0} ${o}`);for(const e of t)s.push(`L ${e.x0} ${-e.half} L ${e.x1} ${-e.half}`)}return s.push("Z"),s.join(" ")}).join(" ")}function ha(e,t,i,n){if(!n)return i;const r=e.angle*Math.PI/180,o=Math.cos(r),s=Math.sin(r),a=[],l=1e-9;for(const r of i){const[i,c]=r.axis,h=o*i+s*c;if(Math.abs(h)<=l)continue;const d=e.x*i+e.y*c,u=d+h*r.x0,p=d+h*r.x1,_=Math.min(u,p),m=Math.max(u,p),g=`${r.key}|${t}`,f=n.get(g)||[];let v=[[_,m]];for(const[e,t]of f){const i=[];for(const[n,r]of v)t<=n+l||e>=r-l?i.push([n,r]):(e>n+l&&i.push([n,Math.min(r,e)]),te[0]-t[0]||e[1]-t[1]),b=[];for(const e of y){const t=b[b.length-1];t&&e[0]<=t[1]+l?t[1]=Math.max(t[1],e[1]):b.push([e[0],e[1]])}n.set(g,b)}return a}function da(e,t){const i=new Map;return t.map(t=>function(e,t,i){const n=sa(e,t,!0),r=n.negative,o=n.positive;if(!r&&!o)return null;let s;if(r&&o)s=[{candidate:r,side:-1},{candidate:o,side:1}];else{const e=r||o;s=[{candidate:e,side:-1},{candidate:e,side:1}]}const a=s.map(({candidate:e,side:n})=>({candidate:e,side:n,pieces:ha(t,n,e.pieces,i)})),l=a.map(({candidate:e,side:t,pieces:i})=>({side:t,roomId:e.roomId,d:ca(t,i)})),c=a.flatMap(({pieces:e})=>e);if(!c.length)return null;const h=Math.max(...c.map(e=>e.half));return{faces:l,minY:-h,maxY:h,wallKey:[...new Set(c.map(e=>e.key))].sort().join("|")}}(e,t,i))}const ua=150,pa=1e-6;function _a(e){return Number.isFinite(e)?Math.max(1,Math.min(ua,e)):1}function ma(e){return((Number.isFinite(Number(e))?Number(e):0)%90+90)%90}const ga=e=>{const t=e.map(e=>[e[0],e[1]]);return!t.length||t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]||t.push([...t[0]]),[t]},fa=(e,t)=>e[0]===t[0]&&e[1]===t[1];function va(e,t=1e-6){const i=Number.isFinite(t)&&t>0?t:pa,n=[];for(const t of e||[]){if(!Array.isArray(t)||t.length<2)return null;const e=Number(t[0]),r=Number(t[1]);if(!Number.isFinite(e)||!Number.isFinite(r))return null;const o=Math.round(e/i)*i,s=Math.round(r/i)*i;if(!Number.isFinite(o)||!Number.isFinite(s))return null;const a=[Object.is(o,-0)?0:o,Object.is(s,-0)?0:s];n.length&&fa(n[n.length-1],a)||n.push(a)}return n.length>1&&fa(n[0],n[n.length-1])&&n.pop(),n.length<3||new Set(n.map(e=>`${e[0]},${e[1]}`)).size<3?null:Ci(n)>i*i?n:null}function ya(e){const t=[];for(const i of e||[])for(const e of i||[]){const i=(e||[]).filter(e=>Array.isArray(e)&&e.length>=2);i.length<4||t.push(`M ${i.slice(0,-1).map(e=>`${e[0]} ${e[1]}`).join(" L ")} Z`)}return t.join(" ")}function ba(e,t,i,n,r){return es({a:e,b:t,halfDepth:Ao(i,n,r)/2})}function wa(e,t,i){const n=Number(t)>0?Number(t):5,r=_a(e.cm)/n*i,o=e.center[0],s=e.center[1];if("circle"===e.shape){const e=r/2;return Array.from({length:96},(t,i)=>{const n=i/96*Math.PI*2;return[o+Math.cos(n)*e,s+Math.sin(n)*e]})}const a=r/2,l=ma(e.angle)*Math.PI/180,c=Math.cos(l),h=Math.sin(l);return[[-a,-a],[a,-a],[a,a],[-a,a]].map(([e,t])=>[o+e*c-t*h,s+e*h+t*c])}function ka(e,t){const i=Number.isFinite(t)?Math.max(0,Math.min(1,t)):0,n=(e.a[0]+e.b[0])/2,r=(e.a[1]+e.b[1])/2,o=(e.b[0]-e.a[0])*i/2,s=(e.b[1]-e.a[1])*i/2;return{...e,a:[n-o,r-s],b:[n+o,r+s]}}function xa(e,t,i=1e-9){if(!t.length)return[e];let n=[ga(e)];try{for(const e of t){const t=e.b[0]-e.a[0],r=e.b[1]-e.a[1],o=Math.hypot(t,r);if(!(o>i))continue;const s=t/o,a=r/o,l=-a,c=s,h=1.25*Math.max(Number(e.depth)||0,4*i),d=Math.max(2*i,1e-9*o),u=[[e.a[0]-s*d-l*h,e.a[1]-a*d-c*h],[e.b[0]+s*d-l*h,e.b[1]+a*d-c*h],[e.b[0]+s*d+l*h,e.b[1]+a*d+c*h],[e.a[0]-s*d+l*h,e.a[1]-a*d+c*h]];n=Gt(n,ga(u))}return Fa(n)}catch{return[e]}}function Sa(e,t){try{const i=Gt([[...e.map(e=>[e[0],e[1]]),[e[0][0],e[0][1]]]],[[...t.map(e=>[e[0],e[1]]),[t[0][0],t[0][1]]]]);let n=null,r=0;for(const e of i||[]){const t=e?.[0]||[],i=Math.abs(Ci(t));t.length>=4&&i>r&&(r=i,n=t.slice(0,-1).map(e=>[e[0],e[1]]))}return n}catch{return null}}function $a(e,t,i,n=Math.max(2e-4*i,1e-9),r=[]){const o=[],s=new Map;for(const e of r){const t=s.get(e.hostId)||[];t.push(e),s.set(e.hostId,t)}const a=[],l=[],c=[];for(const n of e.partitions||[]){const e={a:n.a,b:n.b,halfDepth:Ao(n.cm,t,i)/2};if(!(e.halfDepth>0))continue;const r=es(e);r&&(o.push(e),a.push(r),c.push({id:n.id,body:r}))}const h=o;for(const{segmentIndex:e,wedge:t}of os(h,n)){const i={list:a,at:e},n=Sa(i.list[i.at],t);n&&(i.list[i.at]=n,c[i.at].body=n)}for(const e of c)l.push(...xa(e.body,s.get(e.id)||[],n));const d=(e.wall_columns||[]).map(e=>wa(e,t,i)),u=ss(o,n).flatMap(e=>xa(e,r,n));return{partitions:a,columns:d,patches:u,all:[...l,...u,...d]}}function Ma(e){try{const t=e.map(e=>va(e)).filter(e=>!!e).map(e=>ga(e));return t.length?Wt(t[0],...t.slice(1)):null}catch{return null}}const Ra=e=>`M ${e.map(e=>`${e[0]} ${e[1]}`).join(" L ")} Z`;function Ca(e){const t=[];for(const i of e||[]){if(Aa([i])<=1e-6)continue;const e=[];for(const t of i||[]){const i=(t||[]).filter(e=>Array.isArray(e)&&e.length>=2);i.length<4||e.push(Ra(i.slice(0,-1)))}e.length&&t.push(e.join(" "))}return t}function Ta(e,t,i={}){const n=Ma(e.filter(e=>e.length>=3)),r=t.some(e=>!va(e))?null:Ma(t);if(!n)return[];if(r)try{return Ca(Ut(n,r))}catch{}return function(e,t,i){let n=null;for(let r=0;r=4&&t.push(e.slice(0,-1).map(e=>[e[0],e[1]]));return t}function Fa(e){const t=[];for(const i of e||[]){const e=i?.[0];e?.length>=4&&t.push(e.slice(0,-1).map(e=>[e[0],e[1]]))}return t}function za(e,t){let i=!1;for(let n=0,r=t.length-1;ne[1]!=l>e[1]&&e[0]<(a-o)*(e[1]-s)/(l-s||1e-12)+o&&(i=!i)}return i}function Ia(e,t){for(const i of t||[]){const t=i?.[0];if(!t?.length||!za(e,t))continue;let n=!1;for(let t=1;ti)return!1;if(Math.abs(_a(e.cm)-_a(t.cm))>1e-6)return!1;if(e.shape!==t.shape)return!0;if("circle"===e.shape||"circle"===t.shape)return!0;const n=Math.abs(ma(e.angle)-ma(t.angle));return Math.min(n,90-n)<=1e-6}const Ea=2.54;function Na(e){const t="number"==typeof e?e:NaN;return!Number.isFinite(t)||t<=0||5===t?1:5/t}function Ha(e,t){return e*Na(t)}function La(e){return e?Ea:1}function Ba(e,t){if(!t)return String(e);const i=e/Ea;return String(Math.round(1e6*i)/1e6)}function qa(e,t){return t?e*Ea:e}const ja=1e3;function Wa(e,t){const i=Number(e),n=Number.isFinite(i)&&i>0?i:1,r=n>=1?t:t*n,o=n>=1?t/n:t;return{x:(t-r)/2,y:(t-o)/2,w:r,h:o}}const Ua=.01,Ga=100;function Va(e,t=1e3){const i=Wa(e?.plan_aspect,t),n=Number(e?.plan_scale),r=Number.isFinite(n)&&n>0?Math.min(Ga,Math.max(Ua,n)):1,o=Number(e?.plan_scale_x),s=Number(e?.plan_scale_y),a=Number.isFinite(o)&&o>0?Math.min(Ga,Math.max(Ua,o)):r,l=Number.isFinite(s)&&s>0?Math.min(Ga,Math.max(Ua,s)):r,c=Number(e?.plan_x),h=Number(e?.plan_y),d=$r(e?.plan_angle);return{x:i.x+(Number.isFinite(c)?rl(c):0)*t,y:i.y+(Number.isFinite(h)?rl(h):0)*t,w:i.w*a,h:i.h*l,...d?{angle:d}:{}}}function Ka(e){if(null==e.x||null==e.y)return{x:e.x,y:e.y,w:e.w,h:e.h};const t=Number(e.w)||0,i=Number(e.h)||0;return{x:t<0?e.x+t:e.x,y:i<0?e.y+i:e.y,w:Math.abs(t),h:Math.abs(i)}}function Ya(e){return e&&Array.isArray(e.spaces)?e.spaces.map(e=>{const t=ja,i=function(e){return Array.isArray(e)&&4===e.length&&e.every(e=>Number.isFinite(e))&&e[2]>1e-6&&e[3]>1e-6?e:[0,0,1,1]}(e.view_box);return{id:e.id,title:e.title,cellCm:Number.isFinite(Number(e.cell_cm))&&Number(e.cell_cm)>0?Number(e.cell_cm):5,vb:[i[0]*ja,i[1]*t,i[2]*ja,i[3]*t],bg:e.plan_url?{href:En(e.plan_url),...Va(e,ja)}:null,rooms:(e.rooms||[]).map(e=>{const i={...e,...Ka(e)};return{id:i.id,name:i.name,area:i.area??null,open_to:i.open_to||void 0,settings:i.settings||void 0,x:null!=i.x?i.x*ja:void 0,y:null!=i.y?i.y*t:void 0,w:null!=i.w?i.w*ja:void 0,h:null!=i.h?i.h*t:void 0,poly:i.poly?i.poly.map(e=>[e[0]*ja,e[1]*t]):void 0,wall_ids:Array.isArray(i.wall_ids)?[...i.wall_ids]:void 0}}),wall_segments:(e.wall_segments||[]).map(e=>({...e,id:String(e.id),a:[Number(e.a?.[0])*ja,Number(e.a?.[1])*t],b:[Number(e.b?.[0])*ja,Number(e.b?.[1])*t],cm:Number(e.cm)})),partitions:(e.partitions||[]).map(e=>({id:e.id,a:[e.a[0]*ja,e.a[1]*t],b:[e.b[0]*ja,e.b[1]*t],cm:Number(e.cm)})),wall_columns:(e.wall_columns||[]).map(e=>({id:e.id,shape:"circle"===e.shape?"circle":"square",center:[e.center[0]*ja,e.center[1]*t],cm:Number(e.cm),..."circle"===e.shape?{}:{angle:ma(e.angle)}}))}}):[]}const Xa=5e3,Za=Xa*ja,Ja=240,Qa=ja/Ja,el=1/Ja;function tl(e){if(!Number.isFinite(e))return e;const t=Math.round(e*Ja/ja)*ja/Ja;return Math.abs(t-e)<=1e-9*Qa?e:t}function il(e){return{x:tl(e.x),y:tl(e.y)}}function nl(e){return Number.isFinite(e)?Math.min(Za,Math.max(-Za,e)):0}function rl(e){return Number.isFinite(e)?Math.min(Xa,Math.max(-Xa,e)):0}const ol=1/3,sl=200;function al(e){return"house"===e?"house":"content"}function ll(e){let t=1/0,i=1/0,n=-1/0,r=-1/0;for(const o of e){const e=Number(o[0]),s=Number(o[1]);Number.isFinite(e)&&Number.isFinite(s)&&(en&&(n=e),s>r&&(r=s))}return t>n?null:{minX:t,minY:i,maxX:n,maxY:r}}function cl(e){const t=[],i=e=>{if(Array.isArray(e))if(e.length>=2&&Number.isFinite(Number(e[0]))&&Number.isFinite(Number(e[1])))t.push([Number(e[0]),Number(e[1])]);else for(const t of e)i(t)};return i(e),ll(t)}function hl(e,t){const i=Number.isFinite(t)&&t>0?t:0;return{minX:e.minX-i,minY:e.minY-i,maxX:e.maxX+i,maxY:e.maxY+i}}function dl(e){return e.poly&&e.poly.length?ll(e.poly):null==e.x||null==e.y?null:ll([[e.x,e.y],[e.x+(e.w||0),e.y+(e.h||0)]])}function ul(e,t=1e3,i=1e3){const n=Number(e.x)*t,r=Number(e.y)*i,o=Number(e.w)*t,s=Number(e.h)*i;return![n,r,o,s].every(Number.isFinite)||o<=0||s<=0?null:ll(Fr({x:n,y:r,w:o,h:s,angle:$r(e.angle)||void 0}))}function pl(e,t){const i=[];for(const t of e.rooms||[]){const e=dl(t);e&&i.push(e)}if(e.bg){const t=ll(Fr(e.bg));t&&i.push(t)}for(const e of t||[])if(Array.isArray(e)){const t=ll([e]);t&&i.push(t)}else i.push(e);return i}const _l=e=>{if(!e.length)return 0;const t=[...e].sort((e,t)=>e-t),i=t.length>>1;return t.length%2?t[i]:(t[i-1]+t[i])/2},ml=e=>{let t=1/0,i=1/0,n=-1/0,r=-1/0;for(const o of e)o.minXn&&(n=o.maxX),o.maxY>r&&(r=o.maxY);return t>n||i>r?null:{x:t,y:i,w:n-t,h:r-i}};function gl(e,t){let{x:i,y:n,w:r,h:o}=e;r<30&&(i=i+r/2-100,r=sl),o<30&&(n=n+o/2-100,o=sl);const s="number"==typeof t?{top:t,right:t,bottom:t,left:t}:t,a=Math.max(r,o),l=a*s.top,c=a*s.right,h=a*s.bottom,d=a*s.left;return{x:i-d,y:n-l,w:r+d+c,h:o+l+h}}function fl(e,t={}){const i=t.pad??.05,n=t.k??10,r=t.minSpread??50,o=e.filter(e=>Number.isFinite(e.minX)&&Number.isFinite(e.minY)&&Number.isFinite(e.maxX)&&Number.isFinite(e.maxY)&&Math.abs(e.minX)<=Za&&Math.abs(e.maxX)<=Za&&Math.abs(e.minY)<=Za&&Math.abs(e.maxY)<=Za);if(!o.length)return{core:null,all:null,outliers:0};const s=ml(o);if(o.length<4){const e=gl(s,i);return{core:e,all:e,outliers:0}}const a=o.map(e=>(e.minX+e.maxX)/2),l=o.map(e=>(e.minY+e.maxY)/2),c=_l(a),h=_l(l),d=o.map((e,t)=>Math.max(Math.abs(a[t]-c),Math.abs(l[t]-h))),u=Math.max(((e,t)=>e.length?e[Math.min(e.length-1,Math.max(0,Math.round(t*(e.length-1))))]:0)([...d].sort((e,t)=>e-t),.75),r),p=d.map(e=>e>n*u),_=p.filter(Boolean).length,m=_&&_<=o.length*ol?o.filter((e,t)=>!p[t]):o;return{core:gl(ml(m)||s,i),all:gl(s,i),outliers:m===o?0:_}}function vl(e){return fl(e,{pad:0}).all}function yl(e,t,i=.05){const n=fl(pl(e,t),{pad:i});if(n.core)return n.core;const r=e.vb&&4===e.vb.length&&e.vb[2]>0&&e.vb[3]>0?e.vb:[0,0,ja,ja];return{x:r[0],y:r[1],w:r[2],h:r[3]}}function bl(e){const t=yl(e);return{x:t.x+t.w/2,y:t.y+t.h/2}}function wl(e){const t=[];for(const i of e.rooms||[]){const e=dl(i);e&&t.push(e)}const i=fl(t,{pad:0}).core,n=ja*Na(e.cellCm??5);return i?Math.max(n,Math.min(Za,Math.max(i.w,i.h))):n}function kl(e,t,i,n=1){const r=Number(i),o=Number.isFinite(n)&&n>0?n:1;return!Number.isFinite(r)||r<=0?e*o:e*wl(t)*o/r}const xl=[1,2,5,10,20,50,100,200,500,1e3];function Sl(e,t,i=7){if(!(e>0&&t>0&&Number.isFinite(t)))return null;const n=xl.find(n=>e*n*t>=i);if(void 0===n)return null;const r=xl.find(e=>e>=5*n)??5*n;return{fine:n,coarse:r}}function $l(e){if(e.poly&&e.poly.length){const t=e.poly.map(e=>e[0]),i=e.poly.map(e=>e[1]),n=Math.min(...t),r=Math.min(...i);return{x:n,y:r,w:Math.max(...t)-n,h:Math.max(...i)-r}}return{x:e.x??0,y:e.y??0,w:e.w??0,h:e.h??0}}function Ml(e,t,i,n,r,o=new Set){const s=t[e.id];return!o.has(e.id)&&s&&s.s===e.space?{x:s.x*ja,y:s.y*ja}:n[e.id]?n[e.id]:il(bl(r))}function Rl(e,t,i,n){const r=i["rl_"+(e.id||"")];if(r&&r.s===t)return{x:r.x*ja,y:r.y*ja};const o=function(e){if(e.poly){const t=e.poly.length;return[e.poly.reduce((e,t)=>e+t[0],0)/t,e.poly.reduce((e,t)=>e+t[1],0)/t]}return[e.x+e.w/2,e.y+.1*Math.min(e.w,e.h)]}(e);return il({x:o[0],y:o[1]})}function Cl(e,t){for(const i of e?.spaces??[])for(const e of i?.decor??[])if("furniture"===e?.kind&&"string"==typeof e.symbol&&t(e.symbol))return!0;return!1}let Tl=0;const Dl=new Set;const Al=new class{constructor(e){this.options=e,this._art=null,this._failed=!1,this._terminal=!1,this._inFlight=null,this._hosts=new Set,this._settled=[]}state(){return this._art?"ready":this._failed?"fallback":"pending"}get terminal(){return this._terminal}art(e,t){if(this._art)return this._art[e];t&&!this._failed&&this._hosts.add(t)}adopt(e,t){return!!this._art||(t!==this.options.expectedFingerprint?((this.options.warn??console.warn)("[houseplan] furniture artwork from another build ignored",{fingerprint:t}),!1):(this._install(e),!0))}ensure(){return"pending"!==this.state()?Promise.resolve():(this._inFlight||(this._inFlight=this._loadWithRetry().finally(()=>{this._inFlight=null})),this._inFlight)}onSettled(e){"pending"===this.state()?this._settled.push(e):Promise.resolve().then(e)}async _loadWithRetry(){let e=new Error("furniture artwork did not load");for(const t of[0,1])try{const i=await this.options.load(t);if(i.FURNITURE_ART_FINGERPRINT!==this.options.expectedFingerprint){this._terminal=!0,e=new Error(`furniture artwork fingerprint mismatch: expected ${this.options.expectedFingerprint}, got ${i.FURNITURE_ART_FINGERPRINT}`);break}if(this._art)return;return void this._install(i.GENERATED_FURNITURE_ART)}catch(t){e=t}this._art||(this._failed=!0,(this.options.warn??console.warn)("[houseplan] furniture artwork unavailable",e),this.options.loadFailed?.(this._terminal),this._flush())}_install(e){this._art=e,this._failed=!1,this._flush()}_flush(){const e=[...this._hosts];this._hosts.clear();for(const t of e)t.isConnected&&t.requestUpdate();const t=this._settled.splice(0);for(const e of t)e()}}({expectedFingerprint:"74cbeb9792716ab64cfbcf339d3044c6e8ae33533bdef7216a6d7d513ae04091",load:async e=>0===e?await import("./furniture-plan-art.generated-CrvWoAvu.js"):await import((()=>{const e=new URL("./furniture-plan-art.generated-CrvWoAvu.js",import.meta.url);return e.searchParams.set("hp_retry","art-"+ ++Tl),e.href})()),loadFailed:e=>{for(const t of Dl)t(e)}}),Pl=["furniture","appliance","sanitary","other"],Fl=[{id:"sofa",group:"furniture",category:"sofa",w:220,h:90,g:[["r",0,0,1,1],["l",.09,.26,.91,.26],["l",.09,.26,.09,1],["l",.91,.26,.91,1],["l",.5,.26,.5,1]]},{id:"armchair",group:"furniture",category:"armchair",w:90,h:85,g:[["r",0,0,1,1],["l",.14,.28,.86,.28],["l",.14,.28,.14,1],["l",.86,.28,.86,1]]},{id:"coffee_table",group:"furniture",category:"coffee_table",w:110,h:60,g:[["r",0,0,1,1],["r",.08,.14,.84,.72]]},{id:"table_dining",group:"furniture",category:"dining_table",w:140,h:80,g:[["r",0,0,1,1],["r",.06,.11,.88,.78]]},{id:"table_round",group:"furniture",category:"dining_table",w:120,h:120,g:[["e",.5,.5,.5,.5],["e",.5,.5,.41,.41]]},{id:"chair",group:"furniture",category:"chair",w:45,h:45,g:[["r",0,0,1,.18],["r",.06,.18,.88,.8]]},{id:"desk",group:"furniture",category:"work_table",w:120,h:60,g:[["r",0,0,1,1],["r",.63,.07,.31,.86],["l",.63,.5,.94,.5]]},{id:"bed_double",group:"furniture",category:"bed",w:160,h:200,g:[["r",0,0,1,1],["r",0,0,1,.07],["r",.06,.1,.4,.15],["r",.54,.1,.4,.15],["l",0,.33,1,.33]]},{id:"bed_single",group:"furniture",category:"bed",w:90,h:200,g:[["r",0,0,1,1],["r",0,0,1,.07],["r",.15,.1,.7,.15],["l",0,.33,1,.33]]},{id:"nightstand",group:"furniture",category:"nightstand",w:45,h:40,g:[["r",0,0,1,1],["r",.12,.14,.76,.33],["r",.12,.53,.76,.33]]},{id:"wardrobe",group:"furniture",category:"wardrobe",w:100,h:60,g:[["r",0,0,1,1],["l",0,.72,1,.72],["l",.5,.72,.5,1]]},{id:"bookshelf",group:"furniture",category:"wardrobe",w:80,h:30,g:[["r",0,0,1,1],["l",.34,0,.34,1],["l",.67,0,.67,1]]},{id:"fridge",group:"appliance",category:"fridge",w:60,h:65,g:[["r",0,0,1,1],["l",0,.36,1,.36],["l",.83,.44,.83,.64]]},{id:"stove",group:"appliance",category:"cooktop",w:60,h:60,g:[["r",0,0,1,1],["e",.29,.31,.15,.15],["e",.71,.31,.15,.15],["e",.29,.71,.15,.15],["e",.71,.71,.15,.15]]},{id:"dishwasher",group:"appliance",category:"dishwasher",w:60,h:60,g:[["r",0,0,1,1],["r",.1,.12,.8,.76],["e",.5,.5,.27,.27],["e",.5,.5,.13,.13]]},{id:"washer",group:"appliance",category:"washer",w:60,h:60,g:[["r",0,0,1,1],["l",.08,.17,.92,.17],["e",.5,.57,.3,.3],["e",.5,.57,.14,.14]]},{id:"dryer",group:"appliance",category:"dryer",w:60,h:60,g:[["r",0,0,1,1],["l",.08,.17,.92,.17],["e",.5,.57,.3,.3],["p",.36,.5,.5,.64,.64,.5]]},{id:"tv",group:"appliance",category:"tv",w:120,h:30,g:[["r",0,0,1,.42],["l",.5,.42,.5,.72],["l",.3,.72,.7,.72]]},{id:"ac",group:"appliance",category:"air_conditioner",w:90,h:25,g:[["r",0,0,1,1],["l",.05,.55,.95,.55],["l",.05,.79,.95,.79]]},{id:"water_heater",group:"appliance",category:"boiler",w:45,h:45,g:[["e",.5,.5,.5,.5],["e",.5,.5,.31,.31]]},{id:"toilet",group:"sanitary",category:"toilet",w:40,h:70,g:[["r",.06,0,.88,.2],["e",.5,.58,.37,.35],["e",.5,.58,.22,.2]]},{id:"bathtub",group:"sanitary",category:"bathtub",w:170,h:75,g:[["r",0,0,1,1],["r",.05,.11,.77,.78],["e",.89,.5,.045,.1]]},{id:"shower",group:"sanitary",category:"shower",w:90,h:90,g:[["r",0,0,1,1],["l",0,0,1,1],["l",1,0,0,1],["e",.5,.5,.08,.08]]},{id:"sink",group:"sanitary",category:"sink",w:60,h:45,g:[["r",0,0,1,1],["e",.5,.6,.34,.3],["e",.5,.15,.07,.07]]},{id:"kitchen_sink",group:"sanitary",category:"kitchen_sink",w:80,h:60,g:[["r",0,0,1,1],["r",.06,.24,.44,.64],["r",.54,.24,.4,.64],["e",.5,.12,.06,.06]]},{id:"bidet",group:"sanitary",category:"bidet",w:40,h:55,g:[["e",.5,.5,.44,.5],["e",.5,.5,.26,.3]]},{id:"stairs",group:"other",category:"stairs",w:100,h:280,g:[["r",0,0,1,1],["l",0,.111,1,.111],["l",0,.222,1,.222],["l",0,.333,1,.333],["l",0,.444,1,.444],["l",0,.556,1,.556],["l",0,.667,1,.667],["l",0,.778,1,.778],["l",0,.889,1,.889],["l",.5,.93,.5,.06],["p",.38,.16,.5,.06,.62,.16]]},{id:"fireplace",group:"other",category:"fireplace",w:120,h:40,g:[["r",0,0,1,1],["p",.22,1,.22,.42,.78,.42,.78,1]]},{id:"plant",group:"other",category:"plant",w:40,h:40,g:[["e",.5,.5,.22,.22],["l",.5,.28,.5,.02],["l",.5,.72,.5,.98],["l",.28,.5,.02,.5],["l",.72,.5,.98,.5],["l",.34,.34,.13,.13],["l",.66,.66,.87,.87],["l",.66,.34,.87,.13],["l",.34,.66,.13,.87]]},{id:"rug",group:"other",category:"rug",w:200,h:140,g:[["r",0,0,1,1],["r",.06,.09,.88,.82]]}],zl=new Set(["fridge","dishwasher","washer","dryer","ac","water_heater","shower","sink","stairs","fireplace","plant","rug"]),Il=[...[{id:"coffee_table",group:"furniture",category:"coffee_table",w:120,h:60},{id:"coffee_table_round",group:"furniture",category:"coffee_table",w:80,h:80},{id:"coffee_table_oval",group:"furniture",category:"coffee_table",w:120,h:60},{id:"coffee_table_rounded",group:"furniture",category:"coffee_table",w:120,h:60},{id:"table_dining",group:"furniture",category:"dining_table",w:160,h:90},{id:"table_round",group:"furniture",category:"dining_table",w:110,h:110},{id:"table_dining_oval",group:"furniture",category:"dining_table",w:180,h:100},{id:"table_dining_rounded",group:"furniture",category:"dining_table",w:160,h:90},{id:"desk",group:"furniture",category:"work_table",w:140,h:70},{id:"desk_corner",group:"furniture",category:"work_table",w:160,h:160},{id:"chair",group:"furniture",category:"chair",w:50,h:50},{id:"chair_bar",group:"furniture",category:"chair",w:45,h:48},{id:"armchair",group:"furniture",category:"armchair",w:90,h:90},{id:"armchair_office",group:"furniture",category:"armchair",w:65,h:65},{id:"sofa",group:"furniture",category:"sofa",w:180,h:90},{id:"sofa_three_seat",group:"furniture",category:"sofa",w:240,h:90},{id:"sofa_corner_right",group:"furniture",category:"sofa",w:260,h:170},{id:"bed_single",group:"furniture",category:"bed",w:90,h:200},{id:"bed_double",group:"furniture",category:"bed",w:160,h:200},{id:"nightstand",group:"furniture",category:"nightstand",w:50,h:40},{id:"cabinet_tv",group:"furniture",category:"nightstand",w:140,h:45},{id:"cabinet_shoe",group:"furniture",category:"nightstand",w:80,h:35},{id:"cabinet_sink",group:"furniture",category:"nightstand",w:80,h:50},{id:"bookshelf",group:"furniture",category:"wardrobe",w:100,h:35},{id:"wall_unit",group:"furniture",category:"wardrobe",w:240,h:45},{id:"wardrobe",group:"furniture",category:"wardrobe",w:180,h:60},{id:"kitchen_floor",group:"furniture",category:"kitchen_cabinet",w:60,h:60},{id:"kitchen_floor_corner",group:"furniture",category:"kitchen_cabinet",w:90,h:90},{id:"kitchen_wall",group:"furniture",category:"kitchen_cabinet",w:60,h:35},{id:"kitchen_wall_corner",group:"furniture",category:"kitchen_cabinet",w:60,h:60},{id:"shelf_floor",group:"furniture",category:"shelving",w:100,h:35},{id:"shelf_wall",group:"furniture",category:"shelving",w:100,h:25},{id:"cooktop_two",group:"appliance",category:"cooktop",w:30,h:50},{id:"stove",group:"appliance",category:"cooktop",w:60,h:60},{id:"tv",group:"appliance",category:"tv",w:120,h:28},{id:"tv_wall",group:"appliance",category:"tv",w:120,h:15},{id:"toilet",group:"sanitary",category:"toilet",w:40,h:70},{id:"toilet_built_in",group:"sanitary",category:"toilet",w:40,h:55},{id:"bathtub",group:"sanitary",category:"bathtub",w:170,h:75},{id:"bathtub_corner",group:"sanitary",category:"bathtub",w:140,h:140},{id:"bidet",group:"sanitary",category:"bidet",w:40,h:60},{id:"bidet_built_in",group:"sanitary",category:"bidet",w:40,h:50},{id:"kitchen_sink",group:"sanitary",category:"kitchen_sink",w:60,h:50},{id:"kitchen_sink_double",group:"sanitary",category:"kitchen_sink",w:90,h:50}].map(e=>({id:e.id,group:e.group,category:e.category,w:e.w,h:e.h,designer:!0})),...Fl.filter(e=>zl.has(e.id))],Ol=new Map(Il.map(e=>[e.id,e]));function El(e){return e&&Ol.get(e)||null}function Nl(e){return!0===Ol.get(e)?.designer}function Hl(e){return Il.filter(t=>t.group===e)}function Ll(e){const t=El(e);return t?{w:t.w,h:t.h}:{w:60,h:60}}function Bl(e,t,i=Qa,n=1e3){const r=Number(t)>0?Number(t):5;return(Number(e)||0)/r*i/n}const ql=5e-4,jl=Xa;function Wl(e){return Number.isFinite(e)?Math.max(ql,Math.min(jl,e)):ql}function Ul(e){return Number.isFinite(e)?Math.max(1,Math.min(1e4,e)):1}const Gl=e=>{const t=Math.round(1e3*e)/1e3;return Object.is(t,-0)?"0":String(t)};function Vl(e,t){const i=El(e);if(!i)return null;if(i.designer)return Al.art(e,t)??null;const n=function(e,t,i){if(!e.g)return"";const n=e=>Gl(e*t),r=e=>Gl(e*i),o=[];for(const s of e.g)if("r"===s[0]){const[,e,t,i,a]=s;o.push(`M${n(e)} ${r(t)}H${n(e+i)}V${r(t+a)}H${n(e)}Z`)}else if("l"===s[0]){const[,e,t,i,a]=s;o.push(`M${n(e)} ${r(t)}L${n(i)} ${r(a)}`)}else if("e"===s[0]){const[,e,a,l,c]=s;o.push(`M${n(e-l)} ${r(a)}A${Gl(l*t)} ${Gl(c*i)} 0 0 1 ${n(e+l)} ${r(a)}A${Gl(l*t)} ${Gl(c*i)} 0 0 1 ${n(e-l)} ${r(a)}Z`)}else{const e=s.slice(1);if(e.length<4)continue;let t=`M${n(e[0])} ${r(e[1])}`;for(let i=2;i+10?n:Number.isFinite(r)&&r>0?r:1,s=Number(t),a=o*(Number.isFinite(s)&&s>0?s:1);return Number.isFinite(a)&&a>0?a:o}function Yl(e,t,i,n,r){const o=e+i/2,s=t+n/2,a=(Number(r)||0)*Math.PI/180,l=Math.cos(a),c=Math.sin(a),h=(e,t)=>{const i=e-o,n=t-s;return[o+i*l-n*c,s+i*c+n*l]};return[h(e,t),h(e+i,t),h(e+i,t+n),h(e,t+n)]}function Xl(e,t,i,n,r,o,s){const a=Number.isFinite(s)&&s>0?s:1e-6,l=(Number(e.angle)||0)*Math.PI/180,c=Math.cos(l),h=Math.sin(l),d=-Math.sin(l),u=Math.cos(l),p=e.x+e.w/2,_=e.y+e.h/2,m=t>0?-e.w/2:t<0?e.w/2:0,g=i>0?-e.h/2:i<0?e.h/2:0,f=p+m*c+g*d,v=_+m*h+g*u,y=n-f,b=r-v,w=t?(y*c+b*h)*(t>0?1:-1):e.w,k=i?(y*d+b*u)*(i>0?1:-1):e.h;let x=t?Math.abs(w):e.w,S=i?Math.abs(k):e.h;if(o&&t&&i){const t=x/Math.max(e.w,a),i=S/Math.max(e.h,a),n=Math.abs(t-1)>=Math.abs(i-1)?t:i,r=Math.max(a/e.w,a/e.h),o=Math.max(r,Number.isFinite(n)?n:r);x=e.w*o,S=e.h*o}x=Math.max(a,Number.isFinite(x)?x:a),S=Math.max(a,Number.isFinite(S)?S:a);const $=!!t&&w<0,M=!!i&&k<0,R=t?(t>0?1:-1)*($?-1:1):0,C=i?(i>0?1:-1)*(M?-1:1):0,T=f+R*(x/2)*c+C*(S/2)*d,D=v+R*(x/2)*h+C*(S/2)*u,A=!!e.flip_h!==$,P=!!e.flip_v!==M;return{x:T-x/2,y:D-S/2,w:x,h:S,...Number(e.angle)?{angle:Number(e.angle)}:{},...A?{flip_h:!0}:{},...P?{flip_v:!0}:{}}}function Zl(e,t,i,n){let r=Number(e)+(Number(i)-Number(t));if([r,t,i].every(Number.isFinite)||(r=0),n){const e=r/45;r=45*(e<0?-Math.round(Math.abs(e)):Math.round(e))}return r=(r%360+360)%360,r>180?r-360:r}function Jl(e,t,i,n,r){const o=e.x*t,s=e.y*i,a=e.w*t,l=e.h*i,c=o+a/2,h=s+l/2,d=o+(e.flip_h?a:0),u=s+(e.flip_v?l:0),p=(e.flip_h?-1:1)*a/n,_=(e.flip_v?-1:1)*l/r,m=Number(e.angle)||0;return(m?`rotate(${m} ${c} ${h}) `:"")+`translate(${d} ${u}) scale(${p} ${_})`}function Ql(e,t,i,n=.1){if("string"==typeof e&&!e.trim())return null;const r=Number(e);if(!Number.isFinite(r)||0===r)return null;const o=r*(t?30.48:100),s=Math.abs(o);return si?null:o}function ec(e,t,i){const n=Math.abs(Number(e))/(i?30.48:100),r=Number(n.toFixed(6));return String(t?-r:r)}const tc=15e3,ic=2e3,nc=new WeakMap;function rc(e,t){let i=nc.get(e);if(!i){const t=new Set;i={hiddenAt:"hidden"===e.visibilityState?Date.now():0,token:0,subscribers:t,onVisibility:()=>{const t=nc.get(e);if(!t)return;const i=Date.now();if("hidden"===e.visibilityState){t.hiddenAt||(t.hiddenAt=i);const e={kind:"hidden",token:t.token,at:i,hiddenFor:0,long:!1};for(const i of[...t.subscribers])i(e);return}const n=t.hiddenAt?Math.max(0,i-t.hiddenAt):0;t.hiddenAt=0,t.token++;const r={kind:"visible",token:t.token,at:i,hiddenFor:n,long:n>=tc};for(const e of[...t.subscribers])e(r)},onPageShow:t=>{const i=nc.get(e);if(!i)return;const n=Date.now();i.token++;const r={kind:"pageshow",token:i.token,at:n,hiddenFor:0,long:!!t.persisted,persisted:!!t.persisted};for(const e of[...i.subscribers])e(r)}},nc.set(e,i),e.addEventListener("visibilitychange",i.onVisibility),e.defaultView?.addEventListener("pageshow",i.onPageShow)}return i.subscribers.add(t),()=>{const i=nc.get(e);i&&(i.subscribers.delete(t),i.subscribers.size||(e.removeEventListener("visibilitychange",i.onVisibility),e.defaultView?.removeEventListener("pageshow",i.onPageShow),nc.delete(e)))}}const oc={now:()=>Date.now(),setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e),requestAnimationFrame:e=>window.requestAnimationFrame(e),cancelAnimationFrame:e=>window.cancelAnimationFrame(e)};class sc{constructor(e,t=oc){this.onChange=e,this.clock=t,this._state="steady",this._token=0,this._frameFingerprint="",this._hasCompleteFrame=!1,this._overlayPhase="none",this._recoveryReason=null,this._overlayTimer=0,this._overlayRaf=0,this._overlayOpaqueAt=0,this._barrierRafs=new Set,this._trace=[],this._disposed=!1}get state(){return this._state}get token(){return this._token}get frameFingerprint(){return this._frameFingerprint}get hasCompleteFrame(){return this._hasCompleteFrame}get overlayPhase(){return this._overlayPhase}get overlayVisible(){return"none"!==this._overlayPhase}get overlayBlocksInteraction(){return this.overlayVisible}get recoveryReason(){return this._recoveryReason}get trace(){return this._trace.map(e=>({...e,...e.stage?{stage:[...e.stage]}:{}}))}note(e,t={}){this.record(e,void 0,t)}record(e,t,i={}){this._trace.push({at:this.clock.now(),token:this._token,event:e,state:this._state,...t?{reason:t}:{},...i}),this._trace.length>80&&this._trace.splice(0,this._trace.length-80)}changed(){this._disposed||this.onChange()}adoptCompleteFrame(e){e&&(this._hasCompleteFrame=!0,this._frameFingerprint=e,this._state="steady",this._recoveryReason=null,this.clearOverlay(),this.record("frame-adopted"),this.changed())}markCompleteFrame(e){e&&(this._hasCompleteFrame=!0,this._frameFingerprint=e,this._state="steady",this._recoveryReason=null,this.clearOverlay(),this.record("frame-complete"),this.changed())}refreshCompleteFrame(e){!this._disposed&&this._hasCompleteFrame&&"steady"===this._state&&e&&e!==this._frameFingerprint&&(this._frameFingerprint=e,this.record("frame-refreshed"))}visibility(e){return"hidden"===e.kind?(this.record("visibility-hidden"),this._token):e.long||"visible"!==e.kind&&"pageshow"!==e.kind?this.beginCandidate("pageshow"===e.kind?"pageshow":"long-resume"):(this.record("pageshow"===e.kind?"pageshow-noop":"visibility-visible-quick"),this._token)}beginCandidate(e,t="plan"){return this._token++,this._recoveryReason=t,this._hasCompleteFrame?(this._state="connection"===t?"offline-stale":"holding",this.clearOverlay()):this.overlayVisible?this._state="overlay-visible":(this._state="overlay-pending",this.scheduleOverlay(t)),this.record("candidate-start",e),this.changed(),this._token}connectionLost(){return this.beginCandidate("connection-lost","connection")}candidateReady(e){return!this._disposed&&e===this._token&&(this._state="candidate-ready",this.record("candidate-ready"),this.changed(),!0)}async commitAfterPaint(e,t){if(this._disposed||e!==this._token)return!1;let i=!0;const n=(async()=>{for(await t.updateComplete();i&&!this._disposed&&e===this._token;)if(t.stageValid()&&t.assetsReady()){if(await this.nextFrame(),e!==this._token||!t.stageValid()||!t.assetsReady())continue;if(await this.nextFrame(),e===this._token&&t.stageValid()&&t.assetsReady())return!0}else await this.nextFrame();return!1})();let r=0;const o=new Promise(e=>{r=this.clock.setTimeout(()=>e({ready:!1,timedOut:!0}),ic)}),s=await Promise.race([n.then(e=>({ready:e,timedOut:!1})),o]);return i=!1,this.clock.clearTimeout(r),!this._disposed&&e===this._token&&(!(!s.ready&&!s.timedOut)&&(s.ready?(this._hasCompleteFrame=!0,this._frameFingerprint=t.frameFingerprint(),this.record("paint-barrier"),this.finishOverlayAfterCommit(),!0):(this.record("paint-barrier-timeout"),this._hasCompleteFrame?(this._state="connection"===this._recoveryReason?"offline-stale":"steady",this.clearOverlay()):(this._state="recovery-error","opaque"!==this._overlayPhase&&this.showOverlayNow()),this.changed(),!1)))}retry(e=this._recoveryReason||"plan"){return this.beginCandidate("retry",e)}nextFrame(){return new Promise(e=>{const t=this.clock.requestAnimationFrame(()=>{this._barrierRafs.delete(t),e()});this._barrierRafs.add(t)})}scheduleOverlay(e){this.clearOverlayTimer(),this._recoveryReason=e,this._overlayTimer=this.clock.setTimeout(()=>{this._overlayTimer=0,this._hasCompleteFrame||"overlay-pending"!==this._state&&"candidate-ready"!==this._state||(this._state="overlay-visible",this._overlayPhase="entering",this.record("overlay-enter"),this.changed(),this._overlayRaf=this.clock.requestAnimationFrame(()=>{this._overlayRaf=0,"entering"===this._overlayPhase&&(this._overlayPhase="fading-in",this.changed(),this._overlayTimer=this.clock.setTimeout(()=>{this._overlayTimer=0,"fading-in"===this._overlayPhase&&(this._overlayPhase="opaque",this._overlayOpaqueAt=this.clock.now(),this.record("overlay-opaque"),this.changed())},150))}))},150)}showOverlayNow(){this.clearOverlayTimer(),this._overlayPhase="opaque",this._overlayOpaqueAt=this.clock.now(),this.record("overlay-error")}finishOverlayAfterCommit(){if(this.clearOverlayTimer(),"none"===this._overlayPhase||"entering"===this._overlayPhase||"fading-in"===this._overlayPhase)return this.clearOverlay(),this._state="steady",this._recoveryReason=null,this.record("candidate-committed"),void this.changed();const e=Math.max(0,this._overlayOpaqueAt+250-this.clock.now());this._overlayTimer=this.clock.setTimeout(()=>{this._overlayTimer=0,this._overlayPhase="leaving",this.record("overlay-leave"),this.changed(),this._overlayTimer=this.clock.setTimeout(()=>{this._overlayTimer=0,this._overlayPhase="none",this._state="steady",this._recoveryReason=null,this.record("candidate-committed"),this.changed()},180)},e)}clearOverlayTimer(){this._overlayTimer&&this.clock.clearTimeout(this._overlayTimer),this._overlayTimer=0}clearOverlay(){this.clearOverlayTimer(),this._overlayRaf&&this.clock.cancelAnimationFrame(this._overlayRaf),this._overlayRaf=0,this._overlayPhase="none",this._overlayOpaqueAt=0}dispose(){this._disposed=!0,this._token++,this.clearOverlay();for(const e of this._barrierRafs)this.clock.cancelAnimationFrame(e);this._barrierRafs.clear()}}function ac(e){let t=2166136261,i=2654435769;const n=new WeakSet,r=e=>{for(let n=0;n>>0)+(i>>>2)}},o=e=>{if(null===e)return void r("n");const t=typeof e;if("string"===t)return void r(`s${e.length}:${e}`);if("number"===t)return void r(`d${Number.isNaN(e)?"NaN":String(e)}`);if("boolean"===t)return void r(e?"t":"f");if("undefined"===t)return void r("u");if("object"!==t)return void r(`${t}:${String(e)}`);const i=e;if(n.has(i))r("[cycle]");else{if(n.add(i),Array.isArray(e)){r("[");for(const t of e)o(t);return r("]"),void n.delete(i)}r("{");for(const t of Object.keys(e).sort())r(t),o(e[t]);r("}"),n.delete(i)}};return o(e),`${(t>>>0).toString(16).padStart(8,"0")}${(i>>>0).toString(16).padStart(8,"0")}`}function lc(e){return ac(e)}const cc=new WeakMap;class hc{constructor(e,t=()=>Date.now()){this.onUpdate=e,this.now=t,this.fallbackAuthority={},this.referenceOwner={},this.referenced=new Set,this.queued=new Set,this.disposed=!1,this.sharedUpdate=()=>{this.disposed||this.onUpdate()}}bind(e){const t=((e,t)=>{const i=e?.connection||e?.callWS||t;return!i||"object"!=typeof i&&"function"!=typeof i?t:i})(e,this.fallbackAuthority);return this.shared&&this.authority===t||(this.shared&&(this.shared.listeners.delete(this.sharedUpdate),this.shared.references.delete(this.referenceOwner)),this.authority=t,this.shared=(e=>{let t=cc.get(e);return t||(t={signed:{},queued:new Set,inFlight:new Map,retry:new Map,listeners:new Set,settlers:new Set,references:new Map},cc.set(e,t)),t})(t),this.disposed||(this.shared.listeners.add(this.sharedUpdate),this.shared.references.set(this.referenceOwner,new Set(this.referenced)))),this.shared}start(e,t){this.disposed=!1,this.referenced=new Set(t());const i=this.bind(e());i.listeners.add(this.sharedUpdate),i.references.set(this.referenceOwner,new Set(this.referenced)),this.stopTimer(),this.resignTimer=setInterval(()=>this.resign(e(),t()),288e5)}dispose(){if(this.disposed=!0,this.stopTimer(),clearTimeout(this.batchTimer),this.shared){this.shared.listeners.delete(this.sharedUpdate),this.shared.references.delete(this.referenceOwner);for(const e of this.queued)this.shared.queued.delete(e)}this.queued.clear()}invalidate(e){const t=this.bind(e);clearTimeout(this.batchTimer),this.queued.clear(),t.queued.clear(),t.inFlight.clear(),t.retry.clear(),t.signed={}}stopTimer(){void 0!==this.resignTimer&&clearInterval(this.resignTimer),this.resignTimer=void 0}display(e,t){const i=En(t);if(!i.startsWith("/api/houseplan/content/"))return i;const n=this.bind(e);this.referenced.add(i),n.references.set(this.referenceOwner,new Set(this.referenced));const r=n.signed[i],o=r?this.now()-r.at:1/0;return o{const t=[...this.queued];this.queued.clear();for(const e of t)i.queued.delete(e);this.sign(e,t)},30))}sign(e,t){if(!t.length||!e?.callWS)return;const i=this.bind(e);for(const n of function(e,t){const i=Math.max(1,Math.floor(t)),n=[];for(let t=0;t{const n=i.inFlight.get(e);return!(void 0!==n&&t-n<15e3)&&(i.inFlight.set(e,t),!0)});r.length&&e.callWS({type:"houseplan/content/sign",paths:r}).then(e=>{const t=this.now();let n=0,o=!1;for(const s of r){const r=e?.urls?.[s];if("string"==typeof r&&r){const e=i.signed[s];e?.loaded&&e.url!==r?(e.pending={url:r,at:t},this.preloadReplacement(i,s,r,t)):(i.signed[s]={url:r,at:t,loaded:e?.url===r&&!!e.loaded},o=!0),i.retry.delete(s),n++}else this.backOff(i,s)}if(n&&(this.trimShared(i),o))for(const e of[...i.listeners])e()}).catch(()=>{for(const e of r)this.backOff(i,e)}).finally(()=>{for(const e of r)i.inFlight.get(e)===t&&i.inFlight.delete(e);for(const e of[...i.settlers])e()})}}preloadReplacement(e,t,i,n){const r=()=>{const r=e.signed[t];if(r?.pending?.url===i){e.signed[t]={url:i,at:n,loaded:!0},e.retry.delete(t),this.trimShared(e);for(const t of[...e.listeners])t()}},o=()=>{const n=e.signed[t];n?.pending?.url===i&&(delete n.pending,this.backOff(e,t))};if("undefined"==typeof Image)return void r();const s=new Image;s.onload=()=>{("function"==typeof s.decode?s.decode():Promise.resolve()).then(r).catch(o)},s.onerror=o,s.src=i}preloadCurrentImage(e,t,i){if(i.loaded)return Promise.resolve(!0);if(i.preload)return i.preload;if("undefined"==typeof Image)return i.loaded=!0,Promise.resolve(!0);const n=i.url;return i.preload=new Promise(r=>{const o=new Image;let s=!1;const a=o=>{if(s)return;s=!0,clearTimeout(l);const a=e.signed[t];if(a===i&&delete a.preload,o&&a===i&&a.url===n){a.loaded=!0;for(const t of[...e.listeners])t();r(!0)}else o||a!==i||this.backOff(e,t),r(!1)};o.onload=()=>{("function"==typeof o.decode?o.decode():Promise.resolve()).then(()=>a(!0)).catch(()=>a(!1))},o.onerror=()=>a(!1);const l=setTimeout(()=>a(!1),ic);o.src=n}),i.preload}prepareImage(e,t){const i=En(t);if(!i.startsWith("/api/houseplan/content/"))return Promise.resolve(!0);const n=this.bind(e),r=()=>{const t=n.signed[i];if(t&&this.now()-t.atthis.now()&&!n.inFlight.has(i)&&!n.queued.has(i)?Promise.resolve(!1):null},o=r();return o?(s=o,new Promise(e=>{let t=!1;const i=i=>{t||(t=!0,clearTimeout(n),e(i))},n=setTimeout(()=>i(!1),ic);s.then(i).catch(()=>i(!1))})):new Promise(e=>{let t=!1,i=null;const o=i=>{t||(t=!0,clearTimeout(a),n.settlers.delete(s),e(i))},s=()=>{t||i||(i=r(),i&&i.then(o).catch(()=>o(!1)))},a=setTimeout(()=>o(!1),ic);n.settlers.add(s),s()});var s}backOff(e,t){const i=e.retry.get(t)?.delay||0,n=Math.min(6e4,i?2*i:2e3);e.retry.set(t,{notBefore:this.now()+n,delay:n})}trimShared(e){const t=Object.entries(e.signed);if(t.length<=512)return;const i=new Set(e.inFlight.keys());for(const t of e.references.values())for(const e of t)i.add(e);for(const[e,n]of t)(n.pending||n.preload)&&i.add(e);t.sort((e,t)=>t[1].at-e[1].at);const n=t.filter(([e])=>i.has(e));for(const e of t){if(n.length>=512)break;i.has(e[0])||n.push(e)}e.signed=Object.fromEntries(n)}resign(e,t){const i=this.bind(e);this.referenced=new Set(t),i.references.set(this.referenceOwner,new Set(this.referenced));const n=this.now(),r=new Set;for(const e of i.references.values())for(const t of e)r.add(t);const o={};for(const[e,t]of Object.entries(i.signed))r.has(e)&&n-t.at!!o[e]&&!o[e].pending))}markLoaded(e,t,i){const n=En(t);if(!n.startsWith("/api/houseplan/content/"))return;const r=this.bind(e).signed[n];if(r&&(!i||r.url===i)&&!r.loaded){r.loaded=!0;for(const t of[...this.bind(e).listeners])t()}}isReady(e,t){const i=En(t);if(!i.startsWith("/api/houseplan/content/"))return!0;const n=this.bind(e).signed[i];return!!n&&this.now()-n.at=2&&(this._sequenceMultitouch=!0,this._postGestureClickBlocked=!0))}pointerTerminal(e,t){if("touch"!==t)return!1;const i=this._sequenceMultitouch;return this._activeTouchPointers.delete(e),0===this._activeTouchPointers.size&&(this._sequenceMultitouch=!1),i}reset(){this._activeTouchPointers.clear(),this._sequenceMultitouch=!1,this._postGestureClickBlocked=!1}}const uc=1e-7,pc=(e,t)=>{const i=e.x-t.x,n=e.y-t.y;return i*i+n*n};function _c(e){const t=Math.max(0,e.floorRadius);return{left:Math.min(e.painted.left,e.center.x-t),top:Math.min(e.painted.top,e.center.y-t),right:Math.max(e.painted.right,e.center.x+t),bottom:Math.max(e.painted.bottom,e.center.y+t)}}function mc(e,t){let i=null,n=Number.POSITIVE_INFINITY;for(const r of e){const e=pc(t,r.center);(efunction(e,t){const i=Math.max(0,t.right-t.left),n=Math.max(0,t.bottom-t.top);if(i<=0||n<=0)return!1;const r=Math.min(i,n)/2,o=Math.max(t.left+r,Math.min(t.right-r,e.x)),s=Math.max(t.top+r,Math.min(t.bottom-r,e.y));return pc(e,{x:o,y:s})<=r*r+uc}(t,e.painted));if(i.length)return mc(i,t);return mc(e.filter(e=>{const i=Math.max(0,e.floorRadius);return pc(t,e.center)<=i*i+uc}),t)}class fc{constructor(e,t=44){this.cellSize=t,this.buckets=new Map;const i=Number.isFinite(t)&&t>0?t:44;this.cellSize=i;for(const t of e){const e=_c(t),n=Math.floor(e.left/i),r=Math.floor(e.right/i),o=Math.floor(e.top/i),s=Math.floor(e.bottom/i);for(let e=n;e<=r;e++)for(let i=o;i<=s;i++){const n=`${e}:${i}`,r=this.buckets.get(n);r?r.push(t):this.buckets.set(n,[t])}}}resolve(e){const t=`${Math.floor(e.x/this.cellSize)}:${Math.floor(e.y/this.cellSize)}`;return gc(this.buckets.get(t)||[],e)}}class vc{constructor(){this.active=new Map,this.released=new Map}begin(e,t){this.released.delete(e),this.active.set(e,t)}owner(e){return this.active.get(e)||null}release(e){const t=this.active.get(e)||null;if(!t)return this.released.get(e)||null;for(this.active.delete(e),this.released.set(e,t);this.released.size>16;){const e=this.released.keys().next().value;if(void 0===e)break;this.released.delete(e)}return t}consumeClick(e){const t=this.released.get(e)||null;return this.released.delete(e),t}cancel(e){const t=this.active.get(e)||null;return this.active.delete(e),t}clear(){this.active.clear(),this.released.clear()}}class yc{constructor(){this.index=null,this.pointers=new vc,this.hoverId=null,this.hoverElement=null}invalidate(){this.index=null}reset(e){this.invalidate(),this.pointers.clear(),this.hover(e,null)}clearPointers(){this.pointers.clear()}cancel(e){return this.pointers.cancel(e)}release(e){return this.pointers.release(e)}indexFor(e){if(this.index)return this.index;const t=[];for(const i of e.querySelectorAll('.devlayer > .dev[data-hp="device"][data-id]')){const e=i.querySelector(".device-shell-frame"),n=i.getBoundingClientRect(),r=e?.getBoundingClientRect();!i.dataset.id||!i.isConnected||!r||n.width<=0||n.height<=0||r.width<=0||r.height<=0||t.push({id:i.dataset.id,center:{x:n.left+n.width/2,y:n.top+n.height/2},painted:{left:r.left,top:r.top,right:r.right,bottom:r.bottom},floorRadius:Math.max(22,Math.min(r.width,r.height)/2)})}return this.index=new fc(t),this.index}at(e,t,i,n,r){const o=this.indexFor(e).resolve({x:n,y:r})?.id;return o&&t.find(e=>e.id===o&&e.space===i)||null}byId(e,t,i){return i&&e.find(e=>e.id===i&&e.space===t)||null}begin(e,t,i,n,r){const o=this.at(e,t,i,n.clientX,n.clientY)||r;return this.pointers.begin(n.pointerId,o.id),o}pointer(e,t,i,n,r){const o=n.pointerId;return(Number.isFinite(o)?this.byId(t,i,this.pointers.owner(o)):null)||this.at(e,t,i,n.clientX,n.clientY)||r}click(e,t,i,n,r){if(!(n instanceof PointerEvent))return r;const o=n,s=Number.isFinite(o.pointerId)?this.pointers.consumeClick(o.pointerId):null;return this.byId(t,i,s)||this.at(e,t,i,o.clientX,o.clientY)||r}hover(e,t){this.hoverId===t&&this.hoverElement?.isConnected||(this.hoverElement?.removeAttribute("data-hp-device-hover"),this.hoverId=t,this.hoverElement=t&&[...e.querySelectorAll('.devlayer > .dev[data-hp="device"][data-id]')].find(e=>e.dataset.id===t)||null,this.hoverElement?.setAttribute("data-hp-device-hover",""))}}function bc(e,t){if(t)return e.find(e=>e.id===t)}function wc(e,t){return{id:e,title:t,plan_url:null,view_box:[0,0,1,1],rooms:[],wall_segments:[]}}function kc(e="file"){const t="draw"===e;return{source:e,showBorders:t,showNames:t,displayTouched:!1}}function xc(e,t){if(e.displayTouched)return{...e,source:t};const i="draw"===t;return{...e,source:t,showBorders:i,showNames:i}}function Sc(e,t,i){return{...e,[t]:i,displayTouched:!0}}function $c(e){const t=String(e??"").trim().replace(",",".");if(!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(t))return null;const i=Number(t);return Number.isFinite(i)?i:null}function Mc(e,t){const i=e=>{if(""===String(e??"").trim())return{valid:!0,value:null};const t=$c(e);return{valid:null!==t,value:t}},n=i(e),r=i(t);return n.valid&&r.valid?null!==n.value&&null!==r.value&&n.value>r.value?{valid:!0,min:r.value,max:n.value}:{valid:!0,min:n.value,max:r.value}:{valid:!1,min:n.value,max:r.value}}function Rc(e,t,i,n,r,o){const s=Mc(n,r);return dn(e,t,o&&s.valid?{settings:{...i.settings||{},temp_min:s.min,temp_max:s.max}}:i)}function Cc(e){const t=e=>"number"==typeof e&&Number.isFinite(e)?String(e):"";return[t(e?.temp_min),t(e?.temp_max)]}function Tc(e,t,i){const n=Mc(t,i);return!!n.valid&&(null===n.min?delete e.temp_min:e.temp_min=n.min,null===n.max?delete e.temp_max:e.temp_max=n.max,!0)}var Dc="M11,18H13V16H11V18M12,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,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,6A4,4 0 0,0 8,10H10A2,2 0 0,1 12,8A2,2 0 0,1 14,10C14,12 11,11.75 11,15H13C13,12.75 16,12.5 16,10A4,4 0 0,0 12,6Z";function Ac(e,t,i){return[e[0]*t+e[1]*i+e[2],e[3]*t+e[4]*i+e[5]]}function Pc(e,t){let i=0;for(const[n,r]of t){const t=Ac(e,n[0],n[1]);i=Math.max(i,Math.hypot(t[0]-r[0],t[1]-r[1]))}return i}const Fc=e=>{if(null==e||""===e)return null;const t=Number(e);return Number.isFinite(t)?t:null},zc=e=>{const t=e,i=Fc(Array.isArray(t)?t[0]:t?.x),n=Fc(Array.isArray(t)?t[1]:t?.y);return null==i||null==n?null:[i,n]};function Ic(e){if(!Array.isArray(e))return null;const t=[];for(const i of e){const e=zc(i);if(!e)return null;t.push(e)}if(t.length>1){const e=t[0],i=t[t.length-1];e[0]===i[0]&&e[1]===i[1]&&t.pop()}if(t.length<3)return null;let i=0,n=0,r=0;for(let e=0;ee+t[0],0)/t.length,t.reduce((e,t)=>e+t[1],0)/t.length]:[n/(3*i),r/(3*i)]}function Oc(e){if(!Array.isArray(e))return null;const t=[];for(const i of e){const e=zc(i);if(!e)return null;t.push(e)}if(t.length>1){const e=t[0],i=t[t.length-1];e[0]===i[0]&&e[1]===i[1]&&t.pop()}const i=Ic(t);if(!i)return null;const n=t.map(e=>e[0]),r=t.map(e=>e[1]);return{centroid:i,bbox:[Math.min(...n),Math.min(...r),Math.max(...n),Math.max(...r)]}}function Ec(e){let t=e;if(t&&"object"==typeof t&&!Array.isArray(t)){const e=t;t=e.path??e.points??t}if(!Array.isArray(t)||!t.length)return[];let i=(t.some(e=>(e=>Array.isArray(e)?e.length>=2&&!Array.isArray(e[0])&&("object"!=typeof e[0]||null==e[0]):!!e&&"object"==typeof e&&("x"in e||"y"in e))(e))?[t]:t.filter(Array.isArray)).map(e=>e.map(zc).filter(e=>null!=e)).filter(e=>e.length>=2);i.length>64&&(i=i.slice(-64));const n=i.reduce((e,t)=>e+t.length,0);if(n<=4e3)return i.map(e=>e.slice());const r=4e3-2*i.length,o=i.map(e=>e.length-2),s=o.reduce((e,t)=>e+t,0),a=o.map(e=>r*e/s),l=a.map(Math.floor);let c=r-l.reduce((e,t)=>e+t,0);const h=a.map((e,t)=>({index:t,fraction:e-Math.floor(e)})).sort((e,t)=>t.fraction-e.fraction||e.index-t.index);for(let e=0;efunction(e,t){if(t>=e.length)return e.slice();if(t<=2)return[e[0],e[e.length-1]];const i=[];for(let n=0;ne.slice()),i=t[t.length-1];return i?(i.length>2?i.pop():t.pop(),t):[]}const Lc=e=>Number.isFinite(e[0])&&Number.isFinite(e[1]),Bc=(e,t)=>e[0]===t[0]&&e[1]===t[1];function qc(e){if(!e)return null;const t=e.vacuum_position||e.robot_position||null,i=t&&null!=Fc(t.x)&&null!=Fc(t.y)?{x:Fc(t.x),y:Fc(t.y),a:Fc(t.a??t.angle??t.theta)}:null,n=Ec(e.path?.path??e.path?.points??e.path),r=[],o=e.rooms,s=Array.isArray(o)?o.map((e,t)=>[String(e?.id??t),e]):o&&"object"==typeof o?Object.entries(o):[];for(const[e,t]of s){if(!t||"object"!=typeof t)continue;const i=String(t.name??t.label??"").trim(),n=[[Fc(t.cx),Fc(t.cy)],[Fc(t.center?.x),Fc(t.center?.y)],[Fc(t.x),Fc(t.y)]].find(([e,t])=>null!=e&&null!=t);let o=n?.[0]??null,s=n?.[1]??null;const a=Oc(t.outline),l=Fc(t.x0),c=Fc(t.y0),h=Fc(t.x1),d=Fc(t.y1),u=(null!=l&&null!=c&&null!=h&&null!=d?[Math.min(l,h),Math.min(c,d),Math.max(l,h),Math.max(c,d)]:null)||a?.bbox||null;if(null!=o&&null!=s||!a||([o,s]=a.centroid),null!=o&&null!=s||!u||(o=(u[0]+u[2])/2,s=(u[1]+u[3])/2),i&&null!=o&&null!=s){const t={id:e,name:i,cx:o,cy:s};u&&([t.x0,t.y0,t.x1,t.y1]=u),r.push(t)}}const a=function(e){return String(e.map_name??e.current_map??e.map_index??e.selected_map??"default")}(e);return i||r.length||n.length?{pos:i,path:n,rooms:r,mapId:a}:null}function jc(e,t,i){return![e,t,i].every(Number.isFinite)||e<0||t<=0||i<=0?Number.POSITIVE_INFINITY:e/t*i}const Wc=40;function Uc(e,t,i){if(!e||!t)return null;const n=t.attributes||{},r=e.split(".")[0]||"",o=null!=i?.platform?String(i.platform):null,s=!!zc(n.vacuum_position??n.robot_position),a=!(!n.rooms||"object"!=typeof n.rooms),l=Ec(n.path?.path??n.path?.points??n.path).length>0,c=[n.map_name,n.current_map,n.map_index,n.selected_map].some(e=>null!=e),h="xiaomi_cloud_map_extractor"===o,d=a||l||c;let u=null;if(s?u="compatible":h?u="known_xcme_incomplete":d?u="partial":"camera"===r&&(u="camera"),!u)return null;const p=s?"camera"===r?300:200:h?100:d?50:0;return{entityId:e,name:String(n.friendly_name||e),platform:o,category:u,hasPosition:s,hasRooms:a,hasPath:l,hasMapId:c,score:p}}const Gc=e=>e.toLowerCase().replace(/[\s_\-.,]+/g,"");function Vc(e,t){const i=new Set(t.map(Gc).filter(Boolean)),n=new Set;for(const t of e){const e=Gc(t.name||"");e&&i.has(e)&&n.add(e)}return n.size}function Kc(e,t){const i=new Map(t.map(e=>[Gc(e.name),e])),n=[],r=[];for(const t of e){const e=i.get(Gc(t.name));e&&(n.push([[t.cx,t.cy],[e.cx,e.cy]]),r.push(t.name))}if(n.length<3)return null;const o=function(e){if(e.length<3)return null;let t=0,i=0,n=0,r=0,o=0,s=0,a=0,l=0,c=0,h=0,d=0,u=0;for(const[[p,_],[m,g]]of e){if(![p,_,m,g].every(Number.isFinite))return null;t+=p*p,i+=p*_,n+=p,r+=_*_,o+=_,s+=1,a+=p*m,l+=_*m,c+=m,h+=p*g,d+=_*g,u+=g}const p=[t,i,n,i,r,o,n,o,s],_=e=>{const[t,i,n,r,o,s,a,l,c]=p,h=t*(o*c-s*l)-i*(r*c-s*a)+n*(r*l-o*a);if(!Number.isFinite(h)||Math.abs(h)<1e-9)return null;const d=[(o*c-s*l)/h,(n*l-i*c)/h,(i*s-n*o)/h,(s*a-r*c)/h,(t*c-n*a)/h,(n*r-t*s)/h,(r*l-o*a)/h,(i*a-t*l)/h,(t*o-i*r)/h];return[d[0]*e[0]+d[1]*e[1]+d[2]*e[2],d[3]*e[0]+d[4]*e[1]+d[5]*e[2],d[6]*e[0]+d[7]*e[1]+d[8]*e[2]]},m=_([a,l,c]),g=_([h,d,u]);if(!m||!g)return null;const f=[m[0],m[1],m[2],g[0],g[1],g[2]];return f.every(Number.isFinite)?f:null}(n);return o?{matrix:o,matched:r,residual:Pc(o,n)}:null}function Yc(e,t,i){const n=e[e.length-1];if(n&&n[0]===t[0]&&n[1]===t[1])return e;if(e.push(t),e.length<=600)return e;let r=function(e,t){if(e.length<3)return e.slice();const i=new Uint8Array(e.length);i[0]=i[e.length-1]=1;const n=[[0,e.length-1]];for(;n.length;){const[r,o]=n.pop(),[s,a]=e[r],[l,c]=e[o],h=l-s,d=c-a,u=Math.hypot(h,d)||1e-9;let p=0,_=-1;for(let t=r+1;tp&&(p=i,_=t)}_>0&&p>t&&(i[_]=1,n.push([r,_],[_,o]))}const r=[];for(let t=0;t600&&(r=r.filter((e,t)=>t%2==0||t===r.length-1)),r}function Xc(e){return"cleaning"===e||"returning"===e||"on"===e}const Zc={0:[1,0],90:[0,1],180:[-1,0],270:[0,-1]};function Jc(e){const[t,i]=Zc[e.rot]||[1,0],n=e.mir?-1:1;return[e.s*t*n,-e.s*i,e.ox,e.s*i*n,e.s*t,e.oy]}function Qc(e){const t=e[0]*e[4]-e[1]*e[3];if(!Number.isFinite(t)||Math.abs(t)<1e-12)return null;const i=t<0,n=Math.sqrt(Math.abs(t));let r=180*Math.atan2(-e[1],e[4])/Math.PI;return r=(90*Math.round(r/90)%360+360)%360,{ox:e[2],oy:e[5],s:n,rot:r,mir:i}}function eh(e,t){const i=[],n=[];for(const t of e)null!=t.x0?(i.push(t.x0,t.x1),n.push(t.y0,t.y1)):(i.push(t.cx),n.push(t.cy));if(!i.length)return{ox:t[0]+t[2]/2,oy:t[1]+t[3]/2,s:t[2]/1e4,rot:0,mir:!0};const r=Math.min(...i),o=Math.max(...i),s=Math.min(...n),a=Math.max(...n),l=Math.max(o-r,a-s)||1,c={ox:0,oy:0,s:.6*Math.min(t[2],t[3])/l,rot:0,mir:!0},h=Jc(c),[d,u]=Ac(h,(r+o)/2,(s+a)/2);return c.ox=t[0]+t[2]/2-d,c.oy=t[1]+t[3]/2-u,c}function th(e,t,i,n){const[r,o]=Ac(Jc(t),i,n),s=Jc({...e,ox:0,oy:0}),[a,l]=Ac(s,i,n);return{...e,ox:r-a,oy:o-l}}function ih(e){const t=e?.trail_mode;return"never"===t||"cleaning"===t||"always"===t?t:!1===e?.trail?"never":"cleaning"}const nh=e=>"number"==typeof e&&Number.isFinite(e);function rh(e){return Array.isArray(e)&&6===e.length&&e.every(nh)?[e[0],e[1],e[2],e[3],e[4],e[5]]:null}function oh(e,t,i){return"legacy:"+e+" "+t+" "+i}function sh(e,t,i,n){const r=t?.map_routes;if(Array.isArray(r))return r.filter(e=>e&&"string"==typeof e.id&&e.id).map(e=>({id:e.id,source:String(e.source??""),map_id:String(e.map_id??""),space:String(e.space??""),calibration:rh(e.calibration)}));const o="string"==typeof t?.source&&t.source?t.source:n||"";if(!o)return[];const s=t?.calibration;if(!s||"object"!=typeof s)return[];const a=[];for(const t of Object.keys(s)){const n=rh(s[t]);n&&a.push({id:oh(e,o,t),source:o,map_id:t,space:i,calibration:n})}return a}const ah=(e,t)=>e instanceof Map?e.get(t):e?.[t];function lh(e){const t=[];let i=!1,n="",r="";for(const o of e.routes){const s=ah(e.observed,o.source);void 0!==s&&(i=!0,n||(n=o.source,r=s),s===o.map_id&&t.push(o))}if(t.length>1)return{kind:"ambiguous",routeIds:t.map(e=>e.id).sort()};if(1===t.length){const i=t[0];if(e.spaceIds&&!e.spaceIds.has(i.space))return{kind:"missing_space",route:i};const n=rh(i.calibration);return n?{kind:"ready",route:{...i,calibration:n}}:{kind:"needs_calibration",route:i}}if(i)return{kind:"unmapped",source:n,mapId:r};const o=e.observed instanceof Map?[...e.observed.entries()]:Object.entries(e.observed||{});if(o.length){const e=o.slice().sort((e,t)=>e[0].localeCompare(t[0]))[0];return{kind:"unmapped",source:e[0],mapId:e[1]}}return{kind:"none"}}function ch(e,t,i){const n=new Set;for(const t of e)t.source&&n.add(t.source);for(const e of t)e&&n.add(e);const r={};for(const e of[...n].sort()){const t=i(e);void 0!==t&&(r[e]=t)}return r}function hh(e,t,i){if(!e)return null;const n="string"==typeof e.route_id?e.route_id:"";if(n)return t.find(e=>e.id===n)||null;const r=function(e,t,i){if(!e||"string"!=typeof e.map_id)return{kind:"orphan_run"};const n=e.map_id,r="string"==typeof i?i:"";let o=t.filter(e=>e.map_id===n);return r&&(o=o.filter(e=>e.source===r)),1===o.length?{kind:"adopted",route:o[0]}:0===o.length?{kind:"orphan_run"}:{kind:"ambiguous_run",routeIds:o.map(e=>e.id).sort()}}(e,t,i);return"adopted"===r.kind?r.route:null}function dh(e){const t="ready"===e.resolution.kind?e.resolution.route:null,i=t&&t.space===e.renderSpace?rh(t.calibration):null,n=hh(e.serverCurrent,e.routes,e.rootSource),r=!!t&&!!n&&n.id===t.id,o=hh(e.serverPrevious,e.routes,e.rootSource);return{live:i,currentRunMatches:r,previous:!!o&&o.space===e.renderSpace&&(e.explicitRoutes||!!t&&o.id===t.id)?rh(o.calibration):null}}const uh={availability:"available",status:"alarm",activity:"none"},ph=new Set(["motion","vibration","sound"]),_h=new Set(["occupancy","presence"]),mh=new Set(["door","window","garage_door","opening"]),gh=new Set(["running","power"]),fh=new Set(["smoke","gas","carbon_monoxide","moisture","safety","tamper","problem"]);const vh=new Set(["running","working","washing","rinsing","spinning","drying","heating","cooling","cleaning","cooking","playing","recording","pumping","irrigating","humidifying","dehumidifying","fan","preheating","defrosting"]),yh=new Set([...vh,"start","started","run","active","in_progress","wash","rinse","spin","dry"]),bh=new Set(["off","idle","paused","standby","docked","finished","complete","completed","stopped","ready","sleeping","stop","end","done","inactive"]),wh=new Set(["heat","cool","heat_cool","auto","dry","fan_only"]),kh=e=>""===e||"unknown"===e||"unavailable"===e||"__missing__"===e,xh=e=>String(e??"").trim().toLowerCase(),Sh=e=>xh(e).replace(/[\s-]+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),$h=new Map([["run_state",0],["job_state",0],["operation_state",0],["activity_state",0],["machine_state",1],["running_state",1],["status",2],["device_status",2],["machine_status",2]]),Mh=new Set(["wifi","connection","signal","battery"]);function Rh(e,t){const i=e?.entities?.[t]||{};if("config"===i.entity_category)return null;const n=String(t||"").split(".").slice(1).join("."),r=[i.translation_key,i.original_name,i.name],o=[...r,n];r.some(e=>xh(e))||o.push(e?.states?.[t]?.attributes?.friendly_name);const s=o.map(Sh).filter(Boolean);if(s.some(e=>e.split("_").some(e=>Mh.has(e))))return null;let a=null;for(const e of s)for(const[t,i]of $h)(e===t||e.endsWith(`_${t}`))&&(a=null==a?i:Math.min(a,i));return a}const Ch=(e,t)=>null!=Rh(e,t);function Th(e,t){if(!t.startsWith("switch."))return!1;const i=e?.entities?.[t]||{},n=e?.states?.[t],r=t.slice(7).toLowerCase();if(/(?:^|_)(?:main_)?power$/.test(r))return!0;if([i.translation_key,i.original_name,i.name].map(xh).some(e=>["power","main power","power switch","питание"].includes(e)))return!0;const o=xh(n?.attributes?.friendly_name);return/(?:^|[\s._-])(?:main[\s._-]+)?power$/.test(o)||/(?:^|[\s._-])питание$/.test(o)}function Dh(e){for(const t of["hvac_action","action","current_operation","run_state","job_state","operation","activity"]){const i=xh(e?.[t]);if(vh.has(i)||bh.has(i))return i}return""}function Ah(e,t){const i=e?.states?.[t],n=i?xh(i.state):"__missing__",r=String(t||"").split(".")[0],o=xh(i?.attributes?.device_class),s={eid:t,state:n,availability:kh(n)?"unavailable":"available",status:"neutral",activity:"none",edge:"none"};if("unavailable"===s.availability)return s;if(function(e,t,i){return"alarm_control_panel"===e?"triggered"===i:"on"===i&&Vn(e,t)}(r,o,n))return{...s,status:"alarm"};if("binary_sensor"===r)return ph.has(o)?{...s,edge:"rising"}:_h.has(o)?{...s,activity:"on"===n?"presence":"none"}:mh.has(o)?{...s,status:"on"===n?"open":"neutral",edge:"rising"}:"moving"===o?{...s,activity:"on"===n?"transition":"none"}:gh.has(o)&&"on"===n?{...s,status:"working",activity:"running"}:s;if("cover"===r)return{...s,activity:"opening"===n||"closing"===n?"transition":"none",edge:"terminal_transition"};if("lock"===r)return{...s,status:"unlocked"===n||"open"===n?"open":"neutral",activity:"locking"===n||"unlocking"===n?"transition":"none",edge:"terminal_transition"};if("valve"===r)return{...s,status:["open","opening","closing"].includes(n)?"open":"neutral",activity:"opening"===n||"closing"===n?"transition":"none",edge:"terminal_transition"};if("climate"===r){const e=Dh(i.attributes),t=Array.isArray(i.attributes?.hvac_modes)?i.attributes.hvac_modes.map(xh):[],r=!bh.has(n)&&(wh.has(n)||vh.has(n)||t.includes(n));return(e?vh.has(e):r)?{...s,status:"working",activity:"running"}:s}if(["light","switch","fan","humidifier"].includes(r))return"on"===n?{...s,status:"working",activity:"running"}:s;if("media_player"===r)return"off"===n?{...s,availability:"unavailable"}:s;if("vacuum"===r)return"cleaning"===n?{...s,status:"working",activity:"running"}:"returning"===n?{...s,status:"working",activity:"transition"}:s;if("script"===r)return"on"===n?{...s,status:"working",activity:"running"}:s;if("automation"===r)return s;if("button"===r||"event"===r)return{...s,edge:"change"};const a=Dh(i.attributes);return vh.has(a)||vh.has(n)&&!bh.has(n)?{...s,status:"working",activity:"running"}:s}function Ph(e,t,i){const n=i.filter(t=>t.startsWith("switch.")&&!e?.entities?.[t]?.entity_category),r=t.find(t=>Th(e,t));if(!(n.length>1&&!!r))return t.map(t=>Ah(e,t));const o=t.find(t=>t!==r&&Ch(e,t)),s=Ah(e,r);return"unavailable"===s.availability||"off"===s.state?t.map(t=>({eid:t,state:e?.states?.[t]?xh(e.states[t].state):"__missing__",availability:"unavailable",status:"neutral",activity:"none",edge:"none"})):t.map(t=>{if(t===o)return function(e,t){const i=e?.states?.[t],n=i?xh(i.state):"__missing__",r={eid:t,state:n,availability:kh(n)?"unavailable":"available",status:"neutral",activity:"none",edge:"none"};if("unavailable"===r.availability)return r;const o=Dh(i?.attributes);return vh.has(o)||yh.has(n)&&!bh.has(n)?{...r,status:"working",activity:"running"}:r}(e,t);return{...t===r?s:Ah(e,t),status:"neutral",activity:"none",edge:"none"}})}function Fh(e){if(!e.length)return{availability:"available",status:"neutral",activity:"none"};const t=e.filter(e=>"available"===e.availability);if(!t.length)return{availability:"unavailable",status:"neutral",activity:"none"};if(t.some(e=>"alarm"===e.status))return uh;const i=t.some(e=>"working"===e.status)?"working":t.some(e=>"open"===e.status)?"open":"neutral",n=t.some(e=>"transition"===e.activity)?"transition":t.some(e=>"presence"===e.activity)?"presence":t.some(e=>"running"===e.activity)?"running":"none";return{availability:"available",status:i,activity:n}}function zh(e,t){if(!(e=>!!e&&!kh(e))(e)||"unavailable"===t.availability||e===t.state)return null;if("rising"===t.edge)return"off"===e&&"on"===t.state?"event":null;if("change"===t.edge)return"event";if("terminal_transition"===t.edge){const i=new Set([e,t.state]);if(i.has("closed")&&i.has("open")||i.has("locked")&&i.has("unlocked"))return"transition"}return null}const Ih=(e,t=0)=>{const i=Number(e);return Number.isInteger(i)&&i>=0?i:t},Oh=(e,t)=>{const i={rev:0,configRev:Ih(t),off:new Set};if(null==e)return{snapshot:i,valid:!1};const n=e.off;return!Number.isInteger(e.rev)||Number(e.rev)<0||!Number.isInteger(e.config_rev)||Number(e.config_rev)<0||!Array.isArray(n)||n.some(e=>"string"!=typeof e||!e)?{snapshot:i,valid:!1}:{snapshot:{rev:Number(e.rev),configRev:Number(e.config_rev),off:new Set(n)},valid:!0}};function Eh(e,t=0){return Oh(e,t).snapshot}function Nh(e,t,i,n){const r=Oh(t,i);return n&&r.valid&&r.snapshot.configRev===i?e.configRev===i&&r.snapshot.rev{try{const[i,n]=await Promise.all([e.callWS({type:"config/device_registry/list"}),e.callWS({type:"config/entity_registry/list"})]),r=Yh(i,"id"),o=Yh(n,"entity_id");if(!r||!o)throw new Error("invalid_registry_response");t.devices=r,t.entities=o,t.authoritative=!0,t.access="full",t.lastSuccess=Date.now(),t.error=void 0}catch(e){t.authoritative=!1,t.access="limited",t.error=function(e){if(e&&"object"==typeof e){const t=e;return String(t.message||t.code||t.error||"registry_unavailable")}return String(e||"registry_unavailable")}(e)}finally{t.revision++,t.loading=void 0,function(e){for(const t of[...e.listeners])try{t()}catch{}}(t)}})()),t.loading}function Zh(e,t){void 0===t.reloadTimer&&(t.reloadTimer=globalThis.setTimeout(()=>{t.reloadTimer=void 0,Xh(e,t)},80))}async function Jh(e,t){if(t.subscribing||t.unsubDevice&&t.unsubEntity)return t.subscribing;const i=e?.connection?.subscribeEvents;return"function"==typeof i?(t.subscribing=(async()=>{try{t.unsubDevice||(t.unsubDevice=await i.call(e.connection,()=>Zh(e,t),"device_registry_updated")),t.unsubEntity||(t.unsubEntity=await i.call(e.connection,()=>Zh(e,t),"entity_registry_updated"))}catch{}finally{0===t.refs&&(t.unsubDevice?.(),t.unsubEntity?.(),t.unsubDevice=void 0,t.unsubEntity=void 0),t.subscribing=void 0}})(),t.subscribing):void 0}function Qh(e,t){const i=Kh(e);if(!i)return()=>{};const n=0===i.refs;i.refs++,i.listeners.add(t),("pending"===i.access||n)&&Xh(e,i),Jh(e,i);let r=!1;return()=>{r||(r=!0,i.listeners.delete(t),i.refs=Math.max(0,i.refs-1),i.refs>0||(i.unsubDevice?.(),i.unsubEntity?.(),i.unsubDevice=void 0,i.unsubEntity=void 0,void 0!==i.reloadTimer&&globalThis.clearTimeout(i.reloadTimer),i.reloadTimer=void 0))}}function ed(e){const t=Kh(e);t&&(Zh(e,t),Jh(e,t))}function td(e){const t=Kh(e);if(!t)return{revision:0,authoritative:!1,access:"limited",devices:e?.devices||{},entities:e?.entities||{},lastSuccess:0,error:"registry_unavailable"};let i=e?.devices||{},n=e?.entities||{};if(t.authoritative){const r=t.liveDevices!==i||t.liveEntities!==n,o=void 0!==t.liveDevices||void 0!==t.liveEntities;if(r&&(t.liveDevices=i,t.liveEntities=n,t.projectedRevision=void 0,o&&Zh(e,t)),t.projectedRevision!==t.revision||!t.projectedDevices||!t.projectedEntities){const e={...t.devices},r={...t.entities};for(const[t,n]of Object.entries(i))Object.prototype.hasOwnProperty.call(e,t)||(e[t]=n);for(const[e,t]of Object.entries(n))Object.prototype.hasOwnProperty.call(r,e)||(r[e]=t);t.projectedDevices=e,t.projectedEntities=r,t.projectedRevision=t.revision}i=t.projectedDevices,n=t.projectedEntities}return{revision:t.revision,authoritative:t.authoritative,access:t.access,devices:i,entities:n,lastSuccess:t.lastSuccess,error:t.error}}function id(e){if(!e||"object"!=typeof e&&"function"!=typeof e)return 0;let t=Wh.get(e);return t||(t=Uh++,Wh.set(e,t)),t}function nd(e,t=td(e)){return[t.revision,t.access,id(t.devices),id(t.entities)].join(":")}function rd(e){return!!e&&null==e.disabled_by}function od(e,t=td(e)){const i={},n={},r={};for(const[e,n]of Object.entries(t.devices||{}))rd(n)&&(i[e]=n);for(const[e,i]of Object.entries(t.entities||{})){if(!rd(i))continue;const r=i.device_id?t.devices?.[i.device_id]:null;t.authoritative&&i.device_id&&!r||(r&&!rd(r)||(n[e]=i))}for(const[i,n]of Object.entries(e?.states||{})){const e=t.entities?.[i];if(e&&!rd(e))continue;const o=e?.device_id?t.devices?.[e.device_id]:null;t.authoritative&&e?.device_id&&!o||(o&&!rd(o)||(r[i]=n))}return{...e,devices:i,entities:n,states:r}}function sd(e,t=td(e)){return{...e,devices:t.devices||{},entities:t.entities||{}}}function ad(e,t){const i=[];for(const[n,r]of Object.entries(e||{}))r?.device_id===t&&i.push(n);return i}function ld(){if(Vh)return Vh;if("undefined"==typeof localStorage)return{};try{const e=JSON.parse(localStorage.getItem(Gh)||"{}");if(!e||"object"!=typeof e||Array.isArray(e))return{};const t=Date.now(),i={};for(const[n,r]of Object.entries(e))!r||"active"!==r.kind&&"ha_disabled"!==r.kind||!Number.isFinite(r.ts)||t-r.ts>7776e6||(i[n]=r);return Vh=i,Vh}catch{return{}}}function cd(e,t,i=td(e)){if(!t||"virtual"===t)return{kind:"active",enabledEntityIds:[],allEntityIds:[]};const n=t.indexOf(":");if(n<1)return{kind:"unverified",reason:"registry_unavailable",enabledEntityIds:[],allEntityIds:[]};const r=t.slice(0,n),o=t.slice(n+1);if("device"!==r&&"entity"!==r||!o)return{kind:"unverified",reason:"registry_unavailable",enabledEntityIds:[],allEntityIds:[]};const s=i.devices||{},a=i.entities||{};if(i.authoritative){if("device"===r){const e=s[o];if(!e)return{kind:"orphaned",reason:"device_missing",enabledEntityIds:[],allEntityIds:[]};const t=ad(a,o);if(!rd(e))return{kind:"ha_disabled",reason:"device",enabledEntityIds:[],allEntityIds:t};const i=t.filter(e=>rd(a[e]));return t.length&&!i.length?{kind:"ha_disabled",reason:"all_entities",enabledEntityIds:[],allEntityIds:t}:{kind:"active",enabledEntityIds:i,allEntityIds:t}}const t=a[o];return t&&!rd(t)?{kind:"ha_disabled",reason:"entity",enabledEntityIds:[],allEntityIds:[o]}:t?.device_id&&!s[t.device_id]?{kind:"orphaned",reason:"device_missing",enabledEntityIds:[],allEntityIds:[o]}:t?.device_id&&!rd(s[t.device_id])?{kind:"ha_disabled",reason:"device",enabledEntityIds:[],allEntityIds:[o]}:t||e?.states?.[o]?{kind:"active",enabledEntityIds:[o],allEntityIds:[o]}:{kind:"orphaned",reason:"entity_missing",enabledEntityIds:[],allEntityIds:[]}}const l=function(e){return ld()[e]||null}(t);if("device"===r){const t=s[o],i=ad(a,o);if(null!=t?.disabled_by)return{kind:"ha_disabled",reason:"device",enabledEntityIds:[],allEntityIds:i};const n=i.filter(e=>{const t=a[e];return null==t?.disabled_by&&(!t.device_id||null==s[t.device_id]?.disabled_by)});if(i.length&&!n.length&&i.every(e=>null!=a[e]?.disabled_by))return{kind:"ha_disabled",reason:"all_entities",enabledEntityIds:[],allEntityIds:i};if("ha_disabled"===l?.kind)return{kind:"ha_disabled",reason:l.reason||"device",enabledEntityIds:[],allEntityIds:i};if(t||n.some(t=>!!e?.states?.[t]))return{kind:"active",enabledEntityIds:n,allEntityIds:i}}else{const t=a[o];if(null!=t?.disabled_by)return{kind:"ha_disabled",reason:"entity",enabledEntityIds:[],allEntityIds:[o]};if(t?.device_id&&null!=s[t.device_id]?.disabled_by)return{kind:"ha_disabled",reason:"device",enabledEntityIds:[],allEntityIds:[o]};if("ha_disabled"===l?.kind)return{kind:"ha_disabled",reason:l.reason||"entity",enabledEntityIds:[],allEntityIds:[o]};if(t||e?.states?.[o])return{kind:"active",enabledEntityIds:[o],allEntityIds:[o]}}return{kind:"unverified",reason:"registry_unavailable",enabledEntityIds:[],allEntityIds:[]}}function hd(e){const t=td(e);return{access:t.access,authoritative:t.authoritative,revision:t.revision,lastSuccess:t.lastSuccess,error:t.error}}function dd(e){const t={};for(const[i,n]of Object.entries(e.entities)){if(!n?.device_id||!rd(n))continue;const r=e.devices?.[n.device_id];r&&!rd(r)||(t[n.device_id]=t[n.device_id]||[]).push(i)}return t}function ud(e,t){const i=new Map;for(const n of e){if(!0===n?.removed)continue;const e=n?.binding||"";if(!e.startsWith("entity:"))continue;const r=e.slice(7);if(!r)continue;const o=t?.entities?.[r]?.device_id;if(!o)continue;const s=i.get(o)||new Set;s.add(r),i.set(o,s)}return{byDevice:i}}function pd(e,t,i,n){const r=n.byDevice.get(t);return r?.size?{partial:!0,entityIds:i.filter(t=>!r.has(t)&&!e?.entities?.[t]?.hidden)}:{partial:!1,entityIds:[...i]}}function _d(e,t,i){if(t.identifiers?.[0]?.[0])return t.identifiers[0][0];for(const t of i){const i=e.entities[t]?.platform;if(i)return i}return""}function md(e,t){if(/_device_temperature$/.test(t))return!1;if(e.entities?.[t]?.entity_category)return!1;const i=e.states[t];if(!i)return/_temperature$/.test(t);const n=i.attributes||{};return"temperature"===n.device_class||/°C|°F/.test(n.unit_of_measurement||"")||/_temperature$/.test(t)}const gd=["vacuum","lawn_mower","climate","media_player","light","cover","lock","valve","alarm_control_panel","water_heater","fan","humidifier","siren","camera","remote"],fd=e=>[...e.filter(e=>!e.reg?.hidden),...e.filter(e=>!!e.reg?.hidden)];function vd(e,t){const i=t.map(t=>({eid:t,reg:e?.entities?.[t]})).filter(e=>!!e.reg);if(!i.length)return[];const n=i.filter(e=>!e.reg.entity_category),r=n.length?n:i;for(const e of gd){const t=r.filter(t=>t.eid.startsWith(e+"."));if(t.length)return fd(t).map(e=>e.eid)}const o=r.filter(t=>function(e,t){if(!t.startsWith("binary_sensor."))return!1;const i=xh(e?.states?.[t]?.attributes?.device_class||e?.entities?.[t]?.device_class||e?.entities?.[t]?.original_device_class);return ph.has(i)||_h.has(i)||mh.has(i)||gh.has(i)||"moving"===i||fh.has(i)}(e,t.eid));if(o.length)return fd(o).map(e=>e.eid);const s=r.filter(e=>e.eid.startsWith("switch."));if(s.length){const t=fd(s),n=t.find(t=>Th(e,t.eid));if(s.length>1&&n){const t=i.filter(t=>t.eid!==n.eid&&"config"!==t.reg?.entity_category&&null!=Rh(e,t.eid)),r=t.filter(e=>!e.reg?.entity_category),o=r.length?r:t;for(const t of[0,1,2]){const i=fd(o.filter(i=>Rh(e,i.eid)===t));if(i.length)return[i[0].eid,n.eid]}}return[(n||t[0]).eid]}const a=[];for(const e of je)a.push(...fd(r.filter(t=>t.eid.startsWith(e+"."))));return a.push(...fd(r.filter(e=>!je.includes(e.eid.split(".")[0])))),a.map(e=>e.eid)}function yd(e,t,i){const n=t.map(t=>({eid:t,reg:e.entities[t],st:e.states[t]})).filter(e=>e.reg),r=[n.filter(e=>!e.reg.hidden&&!e.reg.entity_category),n.filter(e=>!e.reg.entity_category),n.filter(e=>!e.reg.hidden),n];if("mdi:thermometer"===i||"mdi:air-filter"===i)for(const t of r){const i=t.find(t=>md(e,t.eid));if(i)return i.eid}const o=vd(e,t);return o.find(Dn)||o[0]}function bd(e,t,i=[]){return[...new Set(wd(e,t,i))].filter(e=>Dn(e))}function wd(e,t,i=[]){const n=e?.startsWith("entity:")?new Set([e.slice(7)]):new Set(i);return(t||[]).filter(e=>"string"==typeof e&&!n.has(e))}function kd(e,t){if("string"==typeof t)return e.area===t;const i=e.marker?.room_id;return i?!!t.id&&i===t.id:!!t.area&&e.area===t.area}function xd(e){const t=e.marker?.binding?.startsWith("entity:")?e.marker.binding.slice(7):null,i=e.entities.filter(Dn),n=e.primary&&Dn(e.primary)?e.primary:null;return[...new Set([t,n,...i].filter(e=>!!e&&Dn(e)))]}function Sd(e){const t=xd(e),i=e.marker?.light_entity;return i&&t.includes(i)?i:t[0]||null}function $d(e,t){if(!1===t.marker?.is_light)return[];if(!0===t.marker?.is_light){return[{eid:Sd(t),via:"forced"}]}const i=t.primary||vd(e,t.entities)[0];return i&&!i.startsWith("light.")?[]:t.entities.filter(t=>t.startsWith("light.")&&!!e.states?.[t]).map(e=>({eid:e,via:"light"}))}const Md=new WeakMap,Rd=new WeakMap;function Cd(e){return e.map(e=>[e.id||"",!0===e.hidden?1:0,e.primary||"",[...e.entities].join(","),void 0===e.controls?"":[...e.controls].join(","),e.marker?.id||"",e.marker?.binding||"",e.marker?.is_light,e.marker?.tap_action||"",!0===e.marker?.removed?1:0,e.marker?.light_entity||"",null==e.marker?.controls?"":[...e.marker.controls].join(",")].join("")).join("")}function Td(e){const t=Cd(e),i=Md.get(e);if(i?.fingerprint===t)return i;const n=e.filter(e=>!e.hidden),r=new Map,o=new Map;for(const t of e){o.set(t,wd(t.marker?.binding,t.marker?.controls??t.controls,t.entities));const e=t.hidden||!0!==t.marker?.is_light?null:t.marker?.id||t.id;e&&r.set(String(e),t)}const s=new Map;for(const t of e){const e=o.get(t)||[],i=new Set(void 0===t.controls?e.filter(Dn):t.controls.filter(Dn)),n=Sd(t),a=i.size?[...i]:n?[n]:[];for(const i of e){if(!i.startsWith("marker:"))continue;const e=i.slice(7);if(!e||e===String(t.marker?.id||t.id||""))continue;if(!r.has(e))continue;const n=s.get(e)||{markerId:e,controllers:[],driverEids:[]};n.controllers.push({device:t,driverEids:[...a]}),n.driverEids=[...new Set([...n.driverEids,...a])],s.set(e,n)}}const a={fingerprint:t,visible:n,markerById:r,persistedByDevice:o,incomingByMarker:s};return Md.set(e,a),a}function Dd(e){return Td(e).incomingByMarker}function Ad(e,t){const i=bd(t.marker?.binding,t.controls??t.marker?.controls,t.entities),n=wd(t.marker?.binding,t.marker?.controls??t.controls,t.entities);return(null!=t.marker?.is_light||!i.length&&!n.some(e=>e.startsWith("marker:")))&&$d(e,t).length>0}function Pd(e,t){return $d(e,t).some(e=>!!e.eid)}function Fd(e,t,i,n){const r="always"===e||"auto"===e&&t,o=r&&!i;return{sourceExists:r,fromSourceEnabled:r&&i,manualEnabled:r,radiusEnabled:r,passive:o,effectiveMode:o&&"auto"===n?"fixed":n}}function zd(e,t){const i=bd(t.marker?.binding,t.controls??t.marker?.controls,t.entities).map(e=>({eid:e,via:"controls"})),n=Ad(e,t)?$d(e,t):[];for(const e of n)e.eid&&i.some(t=>t.eid===e.eid)||i.push(e);return i}function Id(e,t,i,n){if(null!=i)return Id(e,t,null,n).filter(e=>kd(e.device,i));const r=Cd(t),o=function(e,t){const i=new Set;for(const e of t){for(const t of e.entities)i.add(t);for(const t of e.controls||e.marker?.controls||[])"string"!=typeof t||t.startsWith("marker:")||i.add(t)}return[...i].sort().map(t=>`${t}:${e?.states?.[t]?.state??""}`).join("|")}(e,t),s=Hh(n),a=Rd.get(t);if(a?.graphFingerprint===r&&a.stateFingerprint===o&&a.virtualLightFingerprint===s&&a.registry===e?.entities)return a.sources;const{visible:l,markerById:c,persistedByDevice:h,incomingByMarker:d}=Td(t),u=null==i?l:l.filter(e=>kd(e,i)),p=new Map,_=new Map;for(const t of u){const i=zd(e,t).filter(e=>"controls"!==e.via);for(const n of i){const i=!0===t.marker?.is_light?String(t.marker?.id||t.id||""):"",r=i?`marker:${i}`:`entity:${n.eid}`,o=n.eid?[n.eid]:[],s={key:r,eid:n.eid||"",stateEids:o,serviceEids:o,device:t,via:n.via,castsGlow:!0,passive:!n.eid,on:!n.eid||"on"===e.states?.[n.eid]?.state};p.set(t,[...p.get(t)||[],s]),n.eid&&_.set(n.eid,s)}}const m=new Map;for(const e of t){const t=h.get(e)||[],i=new Set(void 0===e.controls?t.filter(Dn):e.controls);m.set(e,i)}for(const t of p.values())for(const i of t){if(!i.passive)continue;const t=i.key.slice(7),r=d.get(t);i.on=!r||r.driverEids.some(t=>"on"===e.states?.[t]?.state),!r&&Lh(i.device.marker)&&(i.on=Bh(i.device.marker,n))}const g=new Map,f=e=>{const t=g.get(e.key);(!t||e.castsGlow&&!t.castsGlow)&&g.set(e.key,e)};for(const t of l){const n=h.get(t)||[],r=null==i||kd(t,i);for(const i of n){if(i.startsWith("marker:")){const e=c.get(i.slice(7)),t=e?p.get(e):null;if(t)for(const e of t)f(e);continue}if(!Dn(i)||!m.get(t)?.has(i))continue;const n=_.get(i);n?f(n):r&&f({key:`entity:${i}`,eid:i,stateEids:[i],serviceEids:[i],device:t,via:"controls",castsGlow:!1,passive:!1,on:"on"===e.states?.[i]?.state})}for(const e of p.get(t)||[])f(e)}const v=[...g.values()];return Rd.set(t,{graphFingerprint:r,stateFingerprint:o,virtualLightFingerprint:s,registry:e?.entities,sources:v}),v}function Od(e){const t=e.filter(e=>e.castsGlow);return t.find(e=>e.on)||t[0]||null}function Ed(e){return e.length?e.some(e=>e.on)?"on":"off":"none"}function Nd(e,t){const i=[];for(const n of t){const t=e.states[n];if(!t)continue;const r=(t.attributes?.unit_of_measurement||"").toLowerCase();if(/_(linkquality|lqi)$/.test(n)||"lqi"===r){const e=parseFloat(t.state);isNaN(e)||i.push(e);continue}const o=t.attributes?.linkquality??t.attributes?.lqi;if(null!=o){const e=parseFloat(o);isNaN(e)||i.push(e)}}return Ii(i)}function Hd(e,t){for(const i of t){if(!md(e,i))continue;const t=e.states[i];if(!t)continue;const n=parseFloat(t.state);if(!isNaN(n))return Math.round(10*n)/10}return null}function Ld(e,t){for(const i of t){if(!i.startsWith("climate."))continue;const t=e.states[i];if(!t||"unavailable"===t.state||"unknown"===t.state)continue;const n=parseFloat(t.attributes?.current_temperature);if(Number.isFinite(n))return Math.round(10*n)/10}return null}function Bd(e,t){if(e.entities?.[t]?.entity_category)return!1;const i=e.states[t];if(!i)return/_humidity$/.test(t);const n=i.attributes||{};return"humidity"===n.device_class||"%"===n.unit_of_measurement&&/_humidity$/.test(t)||/_humidity$/.test(t)}function qd(e,t){for(const i of t){if(!Bd(e,i))continue;const t=e.states[i];if(!t)continue;const n=parseFloat(t.state);if(!isNaN(n))return Math.round(n)}return null}function jd(e,t){if(!t)return[];const i=[];for(const[t,n]of Object.entries(e.entities)){if(!t.startsWith("light.")||n.hidden||!rd(n))continue;let r=null;if("group"===n.platform)r=n.area_id||null;else{if(!n.device_id)continue;{const t=e.devices[n.device_id];if(!rd(t))continue;if("Group"!==t?.model)continue;r=t.area_id||n.area_id||null}}if(!r)continue;const o=e.states[t];i.push({eid:t,name:n.name||o?.attributes?.friendly_name||t,area:r})}return i}function Wd(e,t,i,n,r){const o=qe(t,i,r);if(o!==Be)return o;const s=[];for(const t of n){const i=e.states[t]?.attributes?.device_class;i&&s.push(i)}return function(e){for(const t of e){const e=Le[t];if(e)return e}return null}(s)??Be}function Ud(e,t){return e.map(e=>{if(!Array.isArray(e.controls))return e;const i=e.controls.filter(e=>!("string"==typeof e&&e.startsWith("marker:")&&t.has(e.slice(7))));return i.length===e.controls.length?e:{...e,controls:i.length?i:null}})}function Gd(e,t,i){if(!t||!i||t===i)return[...e];const n=`marker:${t}`,r=`marker:${i}`;return e.map(e=>{const t=Array.isArray(e.controls)?e.controls.map(e=>e===n?r:e):e.controls,i="derived_marker_state"===e.value_badge?.source?.kind&&e.value_badge.source.ref===n?{...e.value_badge,source:{...e.value_badge.source,ref:r}}:e.value_badge,o="derived_marker_state"===e.value_source?.kind&&e.value_source.ref===n?{...e.value_source,ref:r}:e.value_source;return t===e.controls&&i===e.value_badge&&o===e.value_source?e:{...e,controls:t,...void 0!==i?{value_badge:i}:{},...void 0!==o?{value_source:o}:{}}})}function Vd(e,t,i){if(!t||t===i)return!0;const n=new Map;for(const t of e)n.set(t.id,(t.controls||[]).filter(e=>"string"==typeof e&&e.startsWith("marker:")).map(e=>e.slice(7)));const r=new Set,o=[i];for(;o.length;){const e=o.pop();if(e===t)return!0;r.has(e)||(r.add(e),o.push(...n.get(e)||[]))}return!1}function Kd(e,t,i,n){const r=new Set([t]),o=e.filter(e=>{const o=e.id===t||!n&&e.binding===i;return o&&r.add(e.id),!o});return{markers:n?o:[...o,{id:t,binding:i,removed:!0,hidden:!0}],cleanupIds:r}}function Yd(e){const t=new Set,i=new Set,n=new Set;for(const r of e||[]){const e=String(r.binding||"").indexOf(":");if(e<1)continue;const o=r.binding.slice(0,e),s=r.binding.slice(e+1);s&&(!0===r?.removed?"device"===o?t.add(s):"entity"===o&&i.add(s):"entity"===o&&n.add(s))}return{devices:t,entities:i,liveEntities:n}}function Xd(e,t,i){if(i.liveEntities.has(t))return!1;if(i.entities.has(t))return!0;const n=e?.entities?.[t]?.device_id;return!!n&&i.devices.has(n)}function Zd(e,t,i,n,r){const o=bd(t.binding,t.controls,e.entities).filter(e=>!Xd(i,e,n)).filter(e=>"active"===cd(i,"entity:"+e,r).kind);e.marker=t,e.controls=o,e.userHidden=!0===t.hidden,e.hidden=e.userHidden||"ha_disabled"===e.bindingStatus?.kind,t.name&&(e.name=t.name),t.icon&&(e.icon=t.icon),null!=t.model&&(e.model=t.model),e.link=t.link??null,e.description=t.description??null,e.pdfs=t.pdfs||[],e.tapAction=t.tap_action??null}function Jd(e){const t=e.hass,i=e.registry||td(t),n=od(t,i),r=sd(t,i),{areaToSpace:o,markers:s,settings:a,excluded:l,iconRules:c}=e,h=!1!==a.group_lights,d=Yd(s),u=jd(n,h).filter(e=>!Xd(n,e.eid,d)),p=new Set(u.map(e=>e.area)),_=dd(n),m=ud(s,r),g=new Set(s.map(e=>e.binding)),f=[];for(const e of Object.values(n.devices)){const r=e.area_id;if(!r||!o[r])continue;if("service"===e.entry_type)continue;if(g.has("device:"+e.id))continue;if("active"!==cd(t,"device:"+e.id,i).kind)continue;const s=pd(n,e.id,_[e.id]||[],m);if(s.partial&&!s.entityIds.length)continue;const a=s.entityIds,d=_d(n,e,a);let u=l.has(d)||"Group"===e.model||/scene/i.test(e.model||"")||/bridge/i.test((e.model||"")+(e.name||""))||"myheat"===d&&!!e.via_device_id;if(!u&&h&&p.has(r)){const t=(e.name_by_user||e.name||"").trim();"mdi:lightbulb"===Wd(n,t,e.model,a,c)&&(u=!0)}u&&f.push("device:"+e.id)}return f}function Qd(e,t,i,n){if("string"==typeof e.room_id&&e.room_id.length>0&&null===e.area)return{area:"",space:e.space||n};const r=e.area||t||"";return{area:r,space:r&&i[r]||e.space||n}}function eu(e){const t=e.hass,i=e.registry||td(t),n=od(t,i),r=sd(t,i),{areaToSpace:o,markers:s,settings:a,excluded:l,showAll:c,firstSpaceId:h,loc:d,iconRules:u}=e,p=!1!==a.group_lights,_=Yd(s),m=jd(n,p).filter(e=>!Xd(n,e.eid,_)),g=new Set(m.map(e=>e.area)),f=dd(n),v=function(e){const t={};for(const[i,n]of Object.entries(e.entities||{}))n?.device_id&&(t[n.device_id]=t[n.device_id]||[]).push(i);return t}(r),y=ud(s,r),b=new Set;for(const e of s){const[t,i]=e.binding.split(":");"device"!==t&&"entity"!==t||!i||b.add(e.binding)}const w=(e,t)=>s.find(i=>i.binding===e+":"+t),k={},x=[];for(const e of Object.values(n.devices)){const r=e.area_id;if(!r||!o[r])continue;if("service"===e.entry_type)continue;if(b.has("device:"+e.id))continue;const s=cd(t,"device:"+e.id,i);if("active"!==s.kind)continue;const h=w("device",e.id);if(h&&h.hidden&&!a.filter_seeded)continue;const _=pd(n,e.id,f[e.id]||[],y);if(_.partial&&!_.entityIds.length)continue;const m=_.entityIds,v=_.partial?{kind:"active",enabledEntityIds:m,allEntityIds:m}:s,S=_d(n,e,m),$=!a.filter_seeded;if($&&!c){if(l.has(S))continue;if("Group"===e.model)continue;if(/scene/i.test(e.model||""))continue;if(/bridge/i.test((e.model||"")+(e.name||"")))continue;if("myheat"===S&&e.via_device_id)continue}const M=(e.name_by_user||e.name||d("device.unnamed")).trim(),R=M+"|"+r;let C=Wd(n,M,e.model,m,u);if(m.some(e=>e.startsWith("lock."))&&(C="mdi:lock"),$&&!c&&p&&"mdi:lightbulb"===C&&g.has(r))continue;k[R]=(k[R]||0)+1;const T=k[R]>1?M+" "+k[R]:M,D={id:e.id,name:T,model:e.model||"",area:r,space:o[r],icon:C,entities:m,allEntities:v.allEntityIds,bindingStatus:v,bindingKind:"device",bindingRef:e.id,pdfs:[]};D.primary=yd(n,m,C),"mdi:thermometer"!==C&&"mdi:air-filter"!==C||(D.temp=Hd(n,m)),D.primary&&Bd(n,D.primary)&&(D.hum=qd(n,m)),x.push(D)}for(const e of m)o[e.area]&&(b.has("entity:"+e.eid)||x.push({id:"lg_"+e.eid,name:e.name,model:d("device.light_group"),area:e.area,space:o[e.area],icon:"mdi:lightbulb-group",entities:[e.eid],allEntities:[e.eid],bindingStatus:{kind:"active",enabledEntityIds:[e.eid],allEntityIds:[e.eid]},primary:e.eid,bindingKind:"entity",bindingRef:e.eid,pdfs:[]}));for(const e of s){if(e.removed)continue;const[s,l]=e.binding.split(":"),c="device"===s||"entity"===s?cd(t,e.binding,i):null;if(!e.hidden||a.filter_seeded||"ha_disabled"===c?.kind)if("device"===s){const t=c;if("unverified"===t.kind)continue;const s=r.devices[l],{area:a,space:p}=Qd(e,s?.area_id,o,h),m="active"===t.kind?t.enabledEntityIds:[];let g=s?Wd(n,s.name_by_user||s.name||"",s.model,m,u):"mdi:help-circle";m.some(e=>e.startsWith("lock."))&&(g="mdi:lock");const f={id:e.id,name:s?.name_by_user||s?.name||d("device.fallback"),model:s?.model||"",area:a,space:p,icon:g,entities:m,allEntities:t.allEntityIds.length?t.allEntityIds:s&&v[s.id]||[],bindingStatus:t,bindingKind:"device",bindingRef:l};f.primary=yd(n,m,g),"mdi:thermometer"!==g&&"mdi:air-filter"!==g||(f.temp=Hd(n,m)),f.primary&&Bd(n,f.primary)&&(f.hum=qd(n,m)),Zd(f,e,r,_,i),x.push(f)}else if("entity"===s){if(Xd(r,l,_))continue;const t=c;if("unverified"===t.kind)continue;const s=r.entities[l],a=s?.area_id||s?.device_id&&r.devices[s.device_id]?.area_id||"",{area:d,space:p}=Qd(e,a,o,h),m=n.states[l],g=s?.name||m?.attributes?.friendly_name||l;let f=Wd(n,g,"",[l],u);l.startsWith("lock.")&&(f="mdi:lock");const v={id:e.id,name:g,model:"",area:d,space:p,icon:f,entities:"active"===t.kind?[l]:[],allEntities:[l],bindingStatus:t,primary:"active"===t.kind?l:void 0,bindingKind:"entity",bindingRef:l};"mdi:thermometer"!==f&&"mdi:air-filter"!==f||!v.entities.length||(v.temp=Hd(n,v.entities)),v.entities.length&&Bd(n,l)&&(v.hum=qd(n,v.entities)),Zd(v,e,r,_,i),x.push(v)}else{const t=e.area||"",n=e.space||t&&o[t]||h,s={id:e.id,name:e.name||d("device.virtual"),model:e.model||"",area:t,space:n,icon:e.icon||"mdi:map-marker",entities:[],allEntities:[],bindingStatus:{kind:"active",enabledEntityIds:[],allEntityIds:[]},bindingKind:"virtual",virtual:!0};Zd(s,e,r,_,i),x.push(s)}}return x}function tu(e){const{marker:t,siblingMarkers:i=[],...n}=e;return eu({...n,markers:[...i.filter(e=>e.id!==t.id),t]}).find(e=>e.id===t.id)||null}function iu(e,t,i,n){if(!t)return null;if(function(e,t,i){if(!t)return!1;const n=t.indexOf(":");if(n<1)return!1;const r=t.slice(0,n),o=t.slice(n+1),s=Yd(i);return"device"===r?s.devices.has(o):"entity"===r&&Xd(e,o,s)}(e,t,n))return null;const r=t.indexOf(":");if(r<0)return null;const o=t.slice(0,r),s=t.slice(r+1);if(!s)return null;if("entity"===o){const t=parseFloat(e.states[s]?.state);return Number.isFinite(t)?"temp"===i?Math.round(10*t)/10:Math.round(t):null}if("device"===o){const t=Object.entries(e.entities).filter(([,e])=>e.device_id===s).map(([e])=>e);return"temp"===i?Hd(e,t):qd(e,t)}return null}const nu=new RegExp(["water","voda","coolant","flow_?temp","return_?temp","target","setpoint","chip","cpu","processor","board","core_temp","device_temp","batter","akkum","freezer","fridge","oven","kettle","boiler"].join("|"),"i");function ru(e,t){return t.area?t.area:e&&t.id?`@room/${encodeURIComponent(e)}/${encodeURIComponent(t.id)}`:null}function ou(e){return null==e.area&&e.space&&e.room_id?ru(e.space,{id:e.room_id,area:null}):e.area||null}function su(e){const t=e?.exclude_integrations;return t?new Set(t):Ie}function au(e,t,i,n=Ie){const r=new Map;if(!e?.entities)return r;const o=Yd(i),s=new Set,a=new Map,l=new Map;for(const e of i||[]){if(e?.removed)continue;const t=(e.binding||"").indexOf(":");if(t<=0)continue;const i=e.binding.slice(0,t),n=e.binding.slice(t+1);if(!n)continue;!0===e.use_climate_temp&&s.add(n);const r=ou(e);r&&("entity"!==i||a.has(n)?"device"!==i||l.has(n)||l.set(n,r):a.set(n,r))}const c=new Map;for(const[t,i]of Object.entries(e.entities)){if(i.device_id&&o.devices.has(i.device_id)&&!o.liveEntities.has(t)||!i.device_id&&o.entities.has(t)&&!o.liveEntities.has(t))continue;const r=i.device_id?e.devices?.[i.device_id]:null;if(!rd(i)||r&&!rd(r))continue;const h=a.get(t)||(i.device_id?l.get(i.device_id):null)||i.area_id||r?.area_id||null;if(!h)continue;if(i.entity_category)continue;if(!(s.size>0&&t.startsWith("climate.")&&(s.has(t)||i.device_id&&s.has(i.device_id)))){if(n.has(i.platform))continue;if(nu.test(t))continue}let d=c.get(h);d||(d=new Map,c.set(h,d));const u=i.device_id||t;let p=d.get(u);if(!p){const n=e.states?.[t];p={name:(r?r.name_by_user||r.name:i.name||n?.attributes?.friendly_name||t)||t,model:r?.model,ents:[]},d.set(u,p)}p.ents.push(t)}for(const[i,n]of c){const o=[],a=[];for(const[i,r]of n){const n=Wd(e,r.name,r.model,r.ents,t),l="mdi:thermometer"===n||"mdi:air-filter"===n;if(l){const t=Hd(e,r.ents);null!=t&&o.push(t)}if(s.size>0&&(s.has(i)||r.ents.some(e=>s.has(e)))){const t=Ld(e,r.ents);null!=t&&o.push(t)}if(l||"mdi:water-percent"===n){const t=qd(e,r.ents);null!=t&&a.push(t)}}(o.length||a.length)&&r.set(i,{temp:o.length?Math.round(o.reduce((e,t)=>e+t,0)/o.length*10)/10:null,hum:a.length?Math.round(a.reduce((e,t)=>e+t,0)/a.length):null})}return r}function lu(e,t,i){const n=[];for(const r of t){if(r.area!==i||r.virtual)continue;const t=Nd(e,r.entities);null!=t&&n.push(t)}return Ii(n)}const cu={offStates:["off"],unknownUsesToggle:!0},hu={light:cu,switch:cu,fan:cu,humidifier:cu,input_boolean:cu,automation:cu,remote:cu,group:cu,climate:{...cu,featureMasks:{turn_on:256,turn_off:128,toggle:384}},media_player:{...cu,featureMasks:{turn_on:128,turn_off:256,toggle:384}},siren:{...cu,featureMasks:{turn_on:1,turn_off:2,toggle:3}},vacuum:{...cu,featureMasks:{turn_on:1,turn_off:2,toggle:3}},water_heater:{...cu,featureMasks:{turn_on:8,turn_off:8,toggle:8}},camera:{...cu,featureMasks:{turn_on:1,turn_off:1,toggle:1}}};function du(e){return e.slice(0,e.indexOf("."))}function uu(e,t,i){if(!e?.services||"object"!=typeof e.services)return!1;const n=e.services?.[t];return!!n&&Object.prototype.hasOwnProperty.call(n,i)}function pu(e,t,i){return uu(e,t,i)?{domain:t,service:i}:uu(e,"homeassistant",i)?{domain:"homeassistant",service:i}:null}function _u(e,t){return e?.entities?.[t]||null}function mu(e,t,i){const n=e?.states?.[i],r=_u(t,i);return n?.attributes?.friendly_name||r?.name||r?.original_name||i}function gu(e,t){const i=_u(e,t);if(null!=i?.disabled_by)return!0;const n=i?.device_id?e?.devices?.[i.device_id]:null;return null!=n?.disabled_by}function fu(e,t){const i=e?.attributes?.supported_features;if(null==i||""===i)return!1;const n=Number(i);return Number.isFinite(n)&&(n&t)===t}function vu(e,t,i){const n=du(i);if("lock"===n||"alarm_control_panel"===n)return!0;if("cover"!==n)return!1;const r=e?.states?.[i],o=_u(t,i),s=String(r?.attributes?.device_class||o?.device_class||o?.original_device_class||"");return Wi.has(s)}function yu(e,t,i,n,r){return{ref:i,entityId:n,name:n?mu(e,t,n):null,reason:r}}function bu(e,t,i,n,r,o=null){return{target:null,skipped:yu(e,t,i,n,r),semantics:o,nextEffect:null,command:null}}function wu(e,t,i,n,r=i){const o=du(i);if("cover"!==o&&"valve"!==o)return function(e,t,i,n,r=i){const o=du(i),s=e?.states?.[i];if(gu(t,i))return bu(e,t,r,i,"ha-disabled","power");if(vu(e,t,i))return bu(e,t,r,i,"secure");if(!s)return bu(e,t,r,i,"missing","power");if("unavailable"===s.state)return bu(e,t,r,i,"unavailable","power");const a=hu[o];if(!a)return bu(e,t,r,i,"unsupported");let l,c;if("unknown"===s.state||""===s.state){if(!a.unknownUsesToggle)return bu(e,t,r,i,"unsupported","power");l="toggle",c="toggle"}else a.offStates.includes(String(s.state))?(l="turn-on",c="turn_on"):(l="turn-off",c="turn_off");const h=a.featureMasks?.[c];if(h&&!fu(s,h))return bu(e,t,r,i,"unsupported","power");const d=pu(e,o,c);return d?{target:{entityId:i,name:mu(e,t,i),state:String(s.state||""),via:n},skipped:null,semantics:"power",nextEffect:l,command:{...d,data:{entity_id:i}}}:bu(e,t,r,i,"unsupported","power")}(e,t,i,n,r);if(gu(t,i))return bu(e,t,r,i,"ha-disabled",o);if(vu(e,t,i))return bu(e,t,r,i,"secure",o);const s=e?.states?.[i];if(!s)return bu(e,t,r,i,"missing",o);if("unavailable"===s.state)return bu(e,t,r,i,"unavailable",o);const a=function(e,t,i){const n=String(i?.state||""),r="closed"===n?{service:`open_${t}`,effect:"open",feature:1}:"open"===n?{service:`close_${t}`,effect:"close",feature:2}:"opening"===n||"closing"===n?{service:`stop_${t}`,effect:"stop",feature:8}:null;return r&&fu(i,r.feature)&&uu(e,t,r.service)?r:fu(i,3)&&uu(e,t,"toggle")?{service:"toggle",effect:"toggle"}:null}(e,o,s);if(!a)return bu(e,t,r,i,"unsupported",o);return{target:{entityId:i,name:mu(e,t,i),state:String(s.state||""),via:n},skipped:null,semantics:o,nextEffect:a.effect,command:{domain:o,service:a.service,data:{entity_id:i}}}}function ku(e){return"entity"===e.bindingKind?e.bindingRef&&Dn(e.bindingRef)?[e.bindingRef]:[]:"virtual"===e.bindingKind?[]:xd(e)}function xu(e){const t=e.marker?.toggle_entity;return t&&ku(e).includes(t)?t:null}function Su(e,t,i){const n=function(e,t){if("entity"===e.bindingKind&&e.bindingRef){const t=e.marker?.light_entity?Sd(e):null;return[...new Set([t,e.bindingRef].filter(e=>!!e))]}const i=e.entities.length?e.entities:e.allEntities||[],n=e.marker?.light_entity||e.primary&&Dn(e.primary)?Sd(e):null;return[...new Set([n,...vd(t,i)].filter(e=>!!e))]}(i,t);if(!n.length)return null;const r="entity"===i.bindingKind?"binding":"device-role";if("binding"===r)return wu(e,t,n[0],r);let o=null,s=null;for(const i of n){const n=wu(e,t,i,r);if(n.command)return n;const a=n.skipped?.reason;if("missing"===a||"unavailable"===a||"secure"===a)return n;"ha-disabled"!==a?o||=n:s||=n}return o||s}function $u(e){const t=e.skipped?.reason;return"missing"===t?"unavailable":t||"unsupported"}function Mu(e,t){return{origin:e,kind:"none",semantics:null,targets:[],skippedTargets:[],noneReason:t,nextEffect:null,command:null}}function Ru(e,t){return"cover"===e||"toggle"===e?"toggle":"more-info"===e||"run"===e||"info"===e||"none"===e?e:(null==e||""===e)&&"light"===t?"toggle":"info"}function Cu(e,t){return{origin:e,kind:"single",semantics:t.semantics,targets:t.target?[t.target]:[],skippedTargets:t.skipped?[t.skipped]:[],noneReason:t.command?null:$u(t),nextEffect:t.nextEffect,command:t.command}}function Tu(e,t,i,n=[]){const r=new Map,o=[],s=new Set,a=e=>{const t=`${e.ref}\n${e.entityId||""}\n${e.reason}`;s.has(t)||(s.add(t),o.push(e))};for(const e of n)a(e);for(const n of i){const i=wu(e,t,n.entityId,n.via,n.ref);i.target?r.set(n.entityId,r.get(n.entityId)||i.target):i.skipped&&a(i.skipped)}const l=[...r.values()];if(!l.length)return{origin:"explicit-toggle",kind:"group",semantics:"group-power",targets:l,skippedTargets:o,noneReason:o.length&&o.every(e=>"secure"===e.reason)?"secure":"configured-targets-missing",nextEffect:null,command:null};const c=l.some(e=>"on"===e.state)?"turn_off":"turn_on",h=pu(e,"homeassistant",c);return h?{origin:"explicit-toggle",kind:"group",semantics:"group-power",targets:l,skippedTargets:o,noneReason:null,nextEffect:"turn_on"===c?"turn-on":"turn-off",command:{...h,data:{entity_id:l.map(e=>e.entityId)}}}:{origin:"explicit-toggle",kind:"group",semantics:"group-power",targets:[],skippedTargets:[...o,...l.map(i=>yu(e,t,i.entityId,i.entityId,"unsupported"))],noneReason:"unsupported",nextEffect:null,command:null}}function Du(e){return String(e.marker?.id||e.id||"")}function Au(e){const{hass:t,device:i}=e,n=e.registryHass||t,r=function(e){return"toggle"===e.tapAction?"explicit-toggle":"cover"===e.tapAction?"legacy-cover":!e.tapAction&&e.primary?.startsWith("light.")?"default-light":null}(i);if(!r)return null;const o=i.marker;if("explicit-toggle"===r&&Lh(o)){const t=String(o?.id||i.id||""),n=Dd(e.devices).get(t);if(n)return function(e,t){const i=e.registryHass||e.hass;return Tu(e.hass,i,t.driverEids.map(e=>({entityId:e,via:"control-marker-driver",ref:`marker:${t.markerId}`})))}(e,n);const s=Bh(o,e.virtualLights);return{origin:r,kind:"single",semantics:"power",targets:[{entityId:"",name:i.name,state:s?"on":"off",via:"virtual-light"}],skippedTargets:[],noneReason:null,nextEffect:s?"turn-off":"turn-on",command:null,operation:{kind:"virtual-light",markerId:o.id}}}if("explicit-toggle"===r){if(wd(i.marker?.binding,i.marker?.controls??i.controls,i.entities).length)return function(e,t=null){const{hass:i,device:n,devices:r}=e,o=e.registryHass||i,s=wd(n.marker?.binding,n.marker?.controls??n.controls,n.entities),a=e.lightSources||Id(i,r,null,e.virtualLights),l=new Map;for(const e of a){if(!e.key.startsWith("marker:"))continue;const t=l.get(e.key)||[];t.push(e),l.set(e.key,t)}const c=Dd(r),h=new Map;for(const e of r){const t=String(e.marker?.id||e.id||"");t&&h.set(t,e)}const d=[],u=[];t&&d.push({entityId:t,via:"entity"===n.bindingKind?"binding":"device-role",ref:t});for(const e of s){if(!e.startsWith("marker:")){Dn(e)?d.push({entityId:e,via:"control-entity",ref:e}):u.push(yu(i,o,e,e.includes(".")?e:null,"unsupported"));continue}const t=l.get(e)||[];if(!t.length){const t=h.get(e.slice(7));if("ha_disabled"===t?.bindingStatus?.kind){const n=t.bindingStatus.allEntityIds[0]||null;u.push({ref:e,entityId:n,name:t.name||(n?mu(i,o,n):null),reason:"ha-disabled"})}else u.push(yu(i,o,e,null,"missing"));continue}const r=[...new Set(t.flatMap(e=>e.serviceEids))];if(r.length){for(const t of r)d.push({entityId:t,via:"control-entity",ref:e});continue}const s=t.some(e=>e.passive),a=e.slice(7),p=Du(n),_=c.get(a)?.controllers.find(e=>Du(e.device)===p);if(s&&_?.driverEids.length)for(const t of _.driverEids)d.push({entityId:t,via:"control-marker-driver",ref:e});else u.push(yu(i,o,e,null,s?"missing":"unsupported"))}return Tu(i,o,d,u)}(e,xu(i))}if("legacy-cover"===r){const e=i.entities.find(e=>e.startsWith("cover."))||i.allEntities?.find(e=>e.startsWith("cover."));return e?Cu(r,wu(t,n,e,"device-role")):Mu(r,"no-actionable-entity")}const s=xu(i),a=s?wu(t,n,s,"entity"===i.bindingKind?"binding":"device-role"):Su(t,n,i);return a?Cu(r,a):Mu(r,i.virtual||"virtual"===i.bindingKind?"no-actionable-entity":"no-binding")}function Pu(e){if(!e)return[];const t=Array.isArray(e.data.entity_id)?e.data.entity_id:[e.data.entity_id];return[...new Set(t)].sort()}function Fu(e){return e?e.operation?e.operation:e.command?{kind:"ha-service",command:e.command}:null:null}const zu=new Set(["missing","ha-disabled","unavailable"]);function Iu(e,t){const i=Fu(e),n=Fu(t);return!(!i||!n||i.kind!==n.kind)&&("virtual-light"===i.kind&&"virtual-light"===n.kind?i.markerId===n.markerId:"ha-service"===i.kind&&"ha-service"===n.kind&&function(e,t){const i=Pu(e),n=Pu(t);return i.length===n.length&&i.every((e,t)=>e===n[t])}(i.command,n.command))}function Ou(e,t){const i=e.targets[0]||e.skippedTargets[0],n=[];return"group"===e.kind?e.targets.length&&n.push(t.group(e.targets)):i&&n.push(t.single(i)),e.nextEffect&&e.targets.length&&n.push("group"===e.kind?t.groupCurrentNext(e.targets,e.nextEffect):t.currentNext(e.targets[0],e.nextEffect)),e.skippedTargets.length&&n.push(t.skipped(e.skippedTargets)),!e.command&&e.noneReason&&n.push(t.none(e.noneReason)),n}function Eu(e,t){return e.catch(()=>{}).then(t)}const Nu=e=>{const t=e?.config;return t&&Array.isArray(t.spaces)?t:null},Hu=(e,t)=>"number"==typeof e&&Number.isFinite(e)?e:t;class Lu{constructor(e){this.onBodyReplaced=e,this.config=null,this.configRev=0,this.configFingerprint="",this.layout={},this.layoutRev=0,this.layoutFingerprint=""}setConfig(e){const t=this.config;e!==t&&(this.config=e,this.onBodyReplaced?.("_serverCfg",t))}setLayout(e){const t=this.layout;e!==t&&(this.layout=e,this.onBodyReplaced?.("_layout",t))}currentConfigFingerprint(){return this.configFingerprint||ac(this.config)}currentLayoutFingerprint(){return this.layoutFingerprint||ac(this.layout)}adoptResponses(e,t,i,n){const r=Nu(e),o=ac(r),s=o!==this.currentConfigFingerprint();s&&(i(),this.setConfig(r),this.configFingerprint=o),this.configRev=e?.rev??this.configRev;let a=!1;if(void 0!==t){const e=t?.layout??{},i=ac(e);a=i!==this.currentLayoutFingerprint(),a&&(n(),this.setLayout(e),this.layoutFingerprint=i),this.layoutRev=t?.rev??this.layoutRev}return{configChanged:s,layoutChanged:a}}adoptMergedLayout(e,t,i){const n=ac(e),r=n!==ac(this.layout);return r&&(i?.(),this.setLayout(e)),this.layoutFingerprint=n,this.layoutRev=t?.rev??this.layoutRev,r}stageConfigCandidate(e){const t=ac(e);t!==ac(this.config)&&this.setConfig(e),this.configFingerprint=t}acceptConfigWrite(e,t){this.configFingerprint=ac(e),this.configRev=Hu(t?.rev,this.configRev+1)}acceptPairWrite(e,t,i){this.setConfig(e),this.configFingerprint=ac(e),this.setLayout(t),this.layoutFingerprint=ac(t),this.configRev=Hu(i?.config_rev,this.configRev+1),this.layoutRev=Hu(i?.layout_rev,this.layoutRev+1)}noteLayoutRevision(e){"number"==typeof e&&e>this.layoutRev&&(this.layoutRev=e)}stageLocalConfig(e){this.setConfig(e)}stageLocalLayout(e){this.setLayout(e)}seedIdentity(e){Object.assign(this,e)}refreshConfigFingerprint(){this.configFingerprint=ac(this.config)}refreshLayoutFingerprint(){this.layoutFingerprint=ac(this.layout)}beginOptimistic(e,t){return function(e,t,i,n,r){return{previous:JSON.parse(JSON.stringify(e)),previousFingerprint:i,revision:n,attempted:t,attemptedFingerprint:r(t)}}(e,t,this.configFingerprint,this.configRev,ac)}rollbackOptimistic(e){const t=this.config;return!(!t||this.configRev!==e.revision||ac(t)!==e.attemptedFingerprint)&&(this.setConfig(e.previous),this.configFingerprint=e.previousFingerprint,!0)}restoreCached(e){const t=e?.config;return!(!t||!Array.isArray(t.spaces))&&(this.setConfig(t),this.configRev=e?.rev||0,this.configFingerprint=e?.config_fingerprint||ac(t),this.setLayout(e?.layout||{}),this.layoutRev=e?.layout_rev||0,this.layoutFingerprint=e?.layout_fingerprint||ac(this.layout),!0)}snapshot(e){return this.config?(this.refreshConfigFingerprint(),this.refreshLayoutFingerprint(),{config:this.config,rev:this.configRev,config_fingerprint:this.configFingerprint,layout:this.layout,layout_rev:this.layoutRev,layout_fingerprint:this.layoutFingerprint,virtual_lights:e}):null}}async function Bu(e,t){const i=t.isCurrent??(()=>!0);if(!i())return{status:"superseded"};const{cfgResp:n,layResp:r}=t,o=e._adoption,s=Nu(n),a=null!=n&&ac(s)!==o.currentConfigFingerprint()||null!=r&&ac(r.layout??{})!==o.currentLayoutFingerprint();if(a){const t=await e._signer.prepareImage(e.hass,e._candidateBackdrop(s));if(!i())return{status:"superseded"};if(!t)return e._continuity.note("asset-failed"),e._scheduleLoadRetry(!0),{status:"asset-wait"}}if(!i())return{status:"superseded"};a&&e._continuity.hasCompleteFrame&&"steady"===e._continuity.state&&e._beginContinuityCandidate(t.reason,!0),t.beforeAdopt?.();const l=e._space;return function(e,t,i){const n=e._adoption,r=!!n.config,{configChanged:o,layoutChanged:s}=n.adoptResponses(t??{},i,()=>{e._geometryHistory.clear(),e._devicePositionHistory.clear(),e._cancelDeviceDrag(),e._pendingPhysicalWrites.clear(),e._clearRoomFocus(!0),e._cancelCameraTransition(!1),r&&e._clearGeometryGesture()},()=>{e._cancelCameraTransition(!1),e._devicePositionHistory.clear(),e._cancelDeviceDrag()});if(o&&e._seedDecorStyle(n.config),t&&("virtual_lights"in t||"config"in t)){const i=Nh(e._virtualLights,t.virtual_lights,n.configRev,"virtual_lights"in t);Hh(i)!==Hh(e._virtualLights)&&(e._virtualLights=i,e._capturedSnapshotVirtual="")}e._canOptimizeUndo=!(!t?.can_optimize_undo&&!i?.can_optimize_undo),e._adoptConfigCapabilities(t),e._undoKind=t?.undo_kind||i?.undo_kind||null,"boolean"==typeof t?.can_write&&(e._serverCanWrite=t.can_write),o&&e._continuity.note("config-candidate",{configRev:n.configRev}),s&&e._continuity.note("layout-candidate",{layoutRev:n.layoutRev})}(e,n,r),"reload"===t.profile&&(e._syncDecorAssets(s).catch(()=>{}),e._adoptInitialSpace(e._model,!0),e._resumePendingNavMode(),e._cacheSnapshot()),t.afterAdopt?.(),{status:"adopted",spaceChanged:e._space!==l}}const qu=(e,t)=>e.connection===t.connection&&e.userId===t.userId&&e.route===t.route,ju=e=>"number"==typeof e&&Number.isFinite(e)?e:null;class Wu{constructor(){this.sequence=0,this.currentSequence=0,this.lifecycle=0,this.observedHighWater=null,this.context=null}observeContext(e){this.context?qu(this.context,e)||(this.context={...e},this.invalidateLifecycle()):this.context={...e}}invalidateLifecycle(){this.lifecycle+=1,this.currentSequence=++this.sequence,this.observedHighWater=null}observeRevision(e,t,i){this.observeContext(i);const n=ju(e);if(null===n)return null;const r=ju(t)??Number.NEGATIVE_INFINITY;return n<=Math.max(r,this.observedHighWater??Number.NEGATIVE_INFINITY)?null:(this.observedHighWater=n,Object.freeze({sequence:this.currentSequence,lifecycle:this.lifecycle,context:{...i},observedRevision:n}))}isReservationCurrent(e,t,i){this.observeContext(t);const n=ju(i)??Number.NEGATIVE_INFINITY;return e.sequence===this.currentSequence&&e.lifecycle===this.lifecycle&&qu(e.context,t)&&e.observedRevision===this.observedHighWater&&e.observedRevision>n}begin(e){this.observeContext(e.context),e.force&&this.invalidateLifecycle();const t=++this.sequence;return this.currentSequence=t,Object.freeze({sequence:t,lifecycle:this.lifecycle,force:e.force,context:{...e.context},baselineRevision:e.baselineRevision,baselineFingerprint:e.baselineFingerprint})}isCurrent(e){this.observeContext(e.context);const t=e.claim;return e.connected&&(t.force||!e.writePending)&&t.sequence===this.currentSequence&&t.lifecycle===this.lifecycle&&qu(t.context,e.context)&&t.baselineRevision===e.baselineRevision&&t.baselineFingerprint===e.baselineFingerprint}}const Uu=e=>{const t=e.hass,i=t?.user?.id;return{connection:t?.connection??null,userId:"string"==typeof i?i:null,route:location.pathname}};async function Gu(e,t=!1,i){let n=null;const r=e._configReloadAuthority;if(!t){if(void 0!==i&&(n=r.observeRevision(i,e._cfgRev,Uu(e)),!n))return;if(e._saveConfigDebounced.pending()&&e._saveConfigDebounced.flush(),e._cfgWriting)return clearTimeout(e._reloadRetry),void(e._reloadRetry=window.setTimeout(()=>{n&&!r.isReservationCurrent(n,Uu(e),e._cfgRev)||Gu(e,!1)},400))}const o=r.begin({force:t,context:Uu(e),baselineRevision:e._cfgRev,baselineFingerprint:e._adoption.currentConfigFingerprint()}),s=()=>((e,t)=>e._configReloadAuthority.isCurrent({claim:t,context:Uu(e),connected:e.isConnected,baselineRevision:e._cfgRev,baselineFingerprint:e._adoption.currentConfigFingerprint(),writePending:e._saveConfigDebounced.pending()||e._cfgWriting}))(e,o);let a=!1;try{const t=await e._getAuthoritativeConfig();if(!s())return;const i=await e._adoptAuthoritative({cfgResp:t,reason:"config-reload",profile:"reload",isCurrent:s,afterAdopt:()=>{e._regSignature="",e._maybeRebuildDevices()}});if("superseded"===i.status)return;if(a=!0,"adopted"!==i.status)return;i.spaceChanged&&e._restoreZoom(),e.requestUpdate()}catch(t){if(!s())return;a=!0,e._showToast(e._t("toast.cfg_reload_failed",{err:e._errText(t)}))}finally{(a||s())&&(e._continuityDataReady=!0,e.requestUpdate())}}const Vu=e=>!!e&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1]);function Ku(e,t=5,i=5){return Ao(e.cm,t,i)/2}function Yu(e,t,i=1,n=5,r=5,o=0){const s=e.host;if(!s||"partition"!==s.kind||"string"!=typeof s.id||!s.id)return{resolved:null,reason:"invalid-host"};const a=t.find(e=>e.id===s.id);if(!a)return{resolved:null,reason:"missing-partition"};if(!Vu(a.a)||!Vu(a.b)||!Number.isFinite(s.t)||s.t<0||s.t>1)return{resolved:null,reason:"invalid-position"};const l=a.b[0]-a.a[0],c=a.b[1]-a.a[1],h=Math.hypot(l,c),d=Number(e.length)*i;if(!(h>1e-9&&d>0&&Number.isFinite(d)))return{resolved:null,reason:"invalid-length"};const u=s.t*h;if(u-d/2h-o+1e-9)return{resolved:null,reason:"does-not-fit"};const p=l/h,_=c/h;let m=180*Math.atan2(c,l)/Math.PI;return m>=90?m-=180:m<-90&&(m+=180),{reason:null,resolved:{opening:e,host:s,partition:a,center:[a.a[0]+l*s.t,a.a[1]+c*s.t],angle:m,length:d,depth:Ao(a.cm,n,r),t:s.t,axis:{a:[a.a[0],a.a[1]],b:[a.b[0],a.b[1]],ux:p,uy:_,length:h}}}}function Xu(e,t,i=1,n=5,r=5){return Yu(e,t,i,n,r,0)}function Zu(e,t,i=1,n=5,r=5){const o=e.host,s="partition"===o?.kind?t.find(e=>e.id===o.id):void 0;if(!s)return Xu(e,t,i,n,r);const a=Yu(e,t,i,n,r,Ku(s,n,r));return"does-not-fit"===a.reason?{resolved:null,reason:"does-not-fit-jamb"}:a}function Ju(e,t){return!e||(e.length!==t.length||e.host?.kind!==t.host?.kind||e.host?.id!==t.host?.id||e.host?.t!==t.host?.t)}function Qu(e){const{center:t,length:i,axis:n,host:r}=e,o=i/2;return{hostId:r.id,a:[t[0]-n.ux*o,t[1]-n.uy*o],b:[t[0]+n.ux*o,t[1]+n.uy*o],depth:e.depth}}function ep(e,t=!1){const i=t?1:-1,n=e.depth/2;return{ox:-e.axis.uy*i*n,oy:e.axis.ux*i*n,cm:e.partition.cm,side:i}}function tp(e,t,i){return e.flatMap(e=>!Vu(e.a)||!Vu(e.b)||Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])<=1e-9?[]:[{roomId:"",a:[e.a[0],e.a[1]],b:[e.b[0],e.b[1]],key:`partition:${e.id}`,kind:"outer",cm:e.cm,open:!1,half:Ao(e.cm,t,i)/2,partitionHost:{kind:"partition",id:e.id}}])}function ip(e,t,i){const{center:n,length:r,axis:o}=e,s=r/2,a=t.flatMap(e=>{if(!e.kind||e.open)return[];const t=e.b[0]-e.a[0],r=e.b[1]-e.a[1],a=Math.hypot(t,r);if(!(a>i))return[];const l=t/a,c=r/a;if(Math.abs(o.ux*c-o.uy*l)>1e-6)return[];if(Math.abs((n[0]-e.a[0])*c-(n[1]-e.a[1])*l)>i)return[];const h=e=>(e[0]-n[0])*o.ux+(e[1]-n[1])*o.uy,d=h(e.a),u=h(e.b),p=Math.max(-s,Math.min(d,u)),_=Math.min(s,Math.max(d,u));return _>=p-i?[[p,_]]:[]});if(!a.length)return!1;a.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let l=-s;for(const[e,t]of a){if(e>l+i)return!1;if(l=Math.max(l,t),l>=s-i)return!0}return!1}function np(e,t,i=1e-9){const n=e.length/(2*e.axis.length),r=e.t-n,o=e.t+n;return t.some(t=>{if(t.host.id!==e.host.id||t.opening.id===e.opening.id)return!1;const n=t.length/(2*t.axis.length);return Math.max(r,t.t-n)ha-icon{align-self:start;color:var(--hp-accent);}.version-recovery-copy{min-width:0;display:flex;flex-direction:column;gap:var(--sp-2);font-size:var(--fs-m);line-height:1.35;}.version-recovery-copy>span{color:var(--hp-muted);}.version-recovery-versions{display:flex;flex-wrap:wrap;gap:var(--sp-2) var(--sp-5);}.version-recovery-versions span,.version-recovery-versions b{overflow-wrap:anywhere;}.version-recovery-reload{min-height:44px;white-space:normal;}@keyframes hp-version-recovery-in{from{opacity:0;}to{opacity:1;}}@keyframes hp-version-recovery-out{from{opacity:1;}to{opacity:0;}}@media (max-width:520px){.version-recovery-card{grid-template-columns:auto minmax(0,1fr);}.version-recovery-reload{grid-column:1 / -1;width:100%;}}@keyframes fixedfloor-spin{to{transform:rotate(360deg);}}.spacer{flex:1;}.bootveil{position:absolute;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;background:var(--hp-bg,#16212e);opacity:1;transition:opacity 0.15s ease;pointer-events:none;}.bootveil.off{opacity:0;}.bootveil .boothouse{position:static;width:56px;height:56px;fill:var(--hp-accent);opacity:0.85;animation:hp-boot-pulse 1.3s ease-in-out infinite;}@keyframes hp-boot-pulse{0%,100%{opacity:0.3;transform:scale(0.94);}50%{opacity:0.9;transform:scale(1);}}@media (prefers-reduced-motion:reduce){.bootveil .boothouse{animation:none;opacity:0.7;}.version-recovery.phase-visible,.version-recovery.phase-leaving{animation:none;}}@keyframes hp-pulse-short{0%{transform:scale(1);opacity:0.55;}70%{opacity:0.22;}100%{transform:scale(var(--ripple-scale,1.5));opacity:0;}}@keyframes hp-pulse-short-b{0%{transform:scale(1);opacity:0.55;}70%{opacity:0.22;}100%{transform:scale(var(--ripple-scale,1.5));opacity:0;}}@keyframes hp-pulse-continuous{0%{transform:scale(1);opacity:0.55;}65%{opacity:0.18;}100%{transform:scale(var(--ripple-scale,1.5));opacity:0;}}@keyframes hp-pulse-alarm{0%{transform:scale(1);opacity:0.72;}100%{transform:scale(1.5);opacity:0;}}@keyframes hp-slide-left{0%{transform:translateX(4%);opacity:0.72;}100%{transform:translateX(0);opacity:1;}}@keyframes hp-slide-right{0%{transform:translateX(-4%);opacity:0.72;}100%{transform:translateX(0);opacity:1;}}@keyframes hp-sunfade-in{from{opacity:0;}to{opacity:1;}}@keyframes hp-sunfade-out{from{opacity:1;}to{opacity:0;}}.sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0,0,0,0) !important;white-space:nowrap !important;border:0 !important;}.toast{position:fixed;pointer-events:none;left:50%;bottom:22px;transform:translateX(-50%);background:var(--hp-bg);border:1px solid var(--hp-accent);color:var(--hp-txt);padding:var(--sp-4) var(--sp-6);border-radius:var(--rad-l);font-size:var(--fs-m);box-shadow:var(--shadow-2);z-index:120;max-width:90vw;}`,o`.fixedfloor-loading{animation:fixedfloor-spin 1.1s linear infinite;}.fixedfloor-error p{max-width:42rem;margin:0;overflow-wrap:anywhere;}@media (prefers-reduced-motion:reduce){.fixedfloor-loading{animation:none;}.radar-target{transition:none;}}.stage.noplan{background:#ffffff;}.stage.mode-plan,.stage.mode-devices,.stage.mode-decor{background:#ffffff;}.stage{position:relative;width:100%;container-type:inline-size;overflow:hidden;touch-action:none;background:var(--ha-card-background,var(--card-background-color,#111));}.zoomwrap{position:absolute;inset:0;z-index:1;}.stage.mode-transition,.stage.mode-transition .zoomwrap{transition:none !important;}.stage.mode-transition .hp-view-only-layer,.stage.mode-transition .hp-editor-only-layer{pointer-events:none;will-change:opacity;}.stage.mode-transition .hp-paper{fill:var(--hp-mode-paper) !important;}.hp-day-cycle-env{position:absolute;inset:0;z-index:0;overflow:hidden;pointer-events:none;isolation:isolate;}.hp-day-cycle-bg{position:absolute;inset:0;opacity:0;overflow:hidden;transition:opacity 1100ms cubic-bezier(.22,.61,.36,1);}.hp-day-cycle-bg.active{opacity:1;}.hp-day-cycle-sun{position:absolute;left:var(--hp-day-cycle-sun-x);top:var(--hp-day-cycle-sun-y);width:clamp(140px,25cqw,250px);height:clamp(140px,25cqw,250px);transform:translate(-50%,-50%);border-radius:50%;filter:blur(10px);opacity:var(--hp-day-cycle-sun-opacity);transition:left 1100ms cubic-bezier(.22,.61,.36,1),top 1100ms cubic-bezier(.22,.61,.36,1),opacity 1100ms cubic-bezier(.22,.61,.36,1);}.stage.mode-transition .hp-day-cycle-env{transition:none;}.stage.daycycle .hp-paperg,.hp-static-stage.daycycle .hp-paperg{filter:drop-shadow(0 0 1px var(--hp-day-cycle-outline-near)) drop-shadow(0 0 5px var(--hp-day-cycle-outline-mid)) drop-shadow(0 0 10px var(--hp-day-cycle-outline-far));will-change:filter;transition:filter 1100ms cubic-bezier(.22,.61,.36,1);}@media (prefers-reduced-motion:reduce){.hp-day-cycle-bg,.hp-day-cycle-sun,.stage.daycycle .hp-paperg,.hp-static-stage.daycycle .hp-paperg{transition:none;}}.sunlayer{pointer-events:none;}.compass{width:120px;height:120px;flex:none;touch-action:none;cursor:grab;user-select:none;}.compass:active{cursor:grabbing;}.compass .cring{fill:rgba(255,255,255,0.04);stroke:var(--divider-color,#444);stroke-width:2;}.compass .ctick{stroke:var(--secondary-text-color,#9aa4ad);stroke-width:2;}.compass .ctick.minor{stroke-width:1;opacity:0.6;}.compass .cneedle line{stroke:var(--primary-color,#3ea6ff);stroke-width:2.5;stroke-linecap:round;}.compass .cneedle path{fill:var(--primary-color,#3ea6ff);}.compass .cneedle text{fill:var(--text-primary-color,#fff);font-size:11px;font-weight:700;}.compass .cdeg{fill:var(--secondary-text-color,#9aa4ad);font-size:13px;}.compass.unset .cneedle{opacity:0.35;}.stage.hpboot .zoomwrap,.stage.hpboot .zoombadge{visibility:hidden;}.stage.hpsettle{transition:height 0.25s ease;}@media (prefers-reduced-motion:reduce){.stage.hpsettle{transition:none;}}.zoomctl{display:inline-flex;gap:var(--sp-1);background:rgba(127,127,127,0.12);border-radius:var(--rad-m);padding:var(--sp-1);}.zoomctl .zb{border:none;padding:var(--sp-3) var(--sp-4);}.zoomctl .zb[disabled]{opacity:0.4;pointer-events:none;}.projection-toggle{min-width:44px;min-height:44px;justify-content:center;padding:var(--sp-3);}.header-action{min-width:44px;min-height:44px;justify-content:center;padding:var(--sp-3);}.homearrow{position:absolute;z-index:12;transform:translate(-50%,-50%);width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;background:var(--card-background-color,var(--hp-bg));color:var(--hp-accent);border:1px solid var(--hp-accent);opacity:0.9;padding:0;}.homearrow ha-icon{--mdc-icon-size:22px;line-height:1;}.zoombadge{position:absolute;z-index:12;left:var(--sp-4);bottom:var(--sp-4);background:var(--card-background-color,var(--hp-bg));opacity:0.92;color:var(--hp-txt);border:1px solid var(--hp-accent);border-radius:var(--rad-m);padding:var(--sp-1) var(--sp-4);font-size:var(--fs-s);font-weight:600;pointer-events:none;}.zoomwrap>svg{position:absolute;inset:0;width:100%;height:100%;display:block;}.plan-svg{z-index:1;}.iso-underlay-svg{z-index:0;overflow:visible;}.iso-shadows-svg{z-index:3;overflow:visible;}.iso-walls-svg{z-index:4;overflow:visible;}.iso-overlays-svg{z-index:5;overflow:visible;}.iso-underlay-svg,.iso-shadows-svg,.iso-walls-svg,.iso-overlays-svg,.iso-underlay,.iso-shadows,.iso-walls,.iso-openings{pointer-events:none;}.iso-side-hi{stop-color:#b9bdbe;}.iso-side-lo{stop-color:#969c9f;}.iso-top-hi{stop-color:#fafaf7;}.iso-top-lo{stop-color:#e2e4e2;}.iso-wall-side{fill:url(#hp-iso-wall-side) #a8acae;stroke:#92989b;stroke-width:0.7;vector-effect:non-scaling-stroke;}.iso-wall-top{fill:url(#hp-iso-wall-top) #f3f3f1;stroke:#d7d9d8;stroke-width:0.8;vector-effect:non-scaling-stroke;}.iso-material-texture{fill:url(#hp-iso-wall-texture);stroke:none;opacity:0.12;pointer-events:none;}.iso-floor-texture{fill:url(#hp-iso-floor-texture);opacity:0.1;}.iso-texture-mark{fill:rgba(36,43,47,0.34);}.iso-texture-line{fill:none;stroke:rgba(36,43,47,0.24);stroke-width:0.55;}.iso-floor-side{fill:#858b8d;stroke:#71787b;stroke-width:0.7;vector-effect:non-scaling-stroke;}.iso-opening-panel{fill:#d7d9d7;fill-opacity:0.96;stroke:#7f878b;stroke-width:0.9;vector-effect:non-scaling-stroke;}.iso-opening-panel.iso-window{fill:#dfeff4;fill-opacity:0.72;stroke:#8aa7b1;}.iso-opening-panel.iso-material-reveal{fill:#c7cbca;stroke:#8b9294;}.iso-opening-panel.iso-material-matte-leaf{fill:#a6abad;stroke:#737b7f;}.iso-opening-panel.iso-opening-leaf-edge,.iso-opening-panel.iso-opening-leaf-top{fill:#8d9497;}.iso-opening-panel.iso-material-light-window,.iso-opening-panel.iso-material-light-frame,.iso-opening-panel.iso-material-light-sill{fill:#edf7f9;fill-opacity:0.94;stroke:#94adb4;}.iso-overlay-ground{fill:rgba(20,26,29,0.3);filter:url(#hp-iso-overlay-ground);pointer-events:none;}.iso-overlay-tether{stroke:rgba(54,65,71,0.48);stroke-width:1;stroke-dasharray:3 2;vector-effect:non-scaling-stroke;pointer-events:none;}.iso-ambient-shadow{fill:rgba(15,21,25,0.22);filter:url(#hp-iso-ambient-shadow);}.iso-contact-shadow{fill:none;stroke:rgba(22,28,31,0.25);stroke-width:3;filter:url(#hp-iso-contact-shadow);vector-effect:non-scaling-stroke;}.iso-leaf-shadow{fill:none;stroke:rgba(18,23,27,0.24);stroke-width:4;filter:url(#hp-iso-leaf-shadow);vector-effect:non-scaling-stroke;}.stage.theme-dark .iso-side-hi{stop-color:#4c555a;}.stage.theme-dark .iso-side-lo{stop-color:#343c40;}.stage.theme-dark .iso-top-hi{stop-color:#687176;}.stage.theme-dark .iso-top-lo{stop-color:#50585d;}.stage.theme-dark .iso-wall-side{stroke:#30373b;}.stage.theme-dark .iso-wall-top{stroke:#7b858a;}.stage.theme-dark .iso-floor-side{fill:#2d3438;stroke:#20272a;}.stage.theme-dark .iso-opening-panel{fill:#626b70;stroke:#899399;}.stage.theme-dark .iso-opening-panel.iso-window{fill:#75919b;stroke:#abc6ce;}.stage.theme-dark .iso-opening-panel.iso-material-reveal{fill:#454e52;stroke:#727d82;}.stage.theme-dark .iso-opening-panel.iso-material-matte-leaf{fill:#626a6e;stroke:#899398;}.stage.theme-dark .iso-opening-panel.iso-opening-leaf-edge,.stage.theme-dark .iso-opening-panel.iso-opening-leaf-top{fill:#4b5458;}.stage.theme-dark .iso-opening-panel.iso-material-light-window,.stage.theme-dark .iso-opening-panel.iso-material-light-frame,.stage.theme-dark .iso-opening-panel.iso-material-light-sill{fill:#d8e8eb;stroke:#9eb8bf;}.stage.theme-dark .iso-ambient-shadow{fill:rgba(0,0,0,0.34);}.stage.theme-dark .iso-contact-shadow,.stage.theme-dark .iso-leaf-shadow{stroke:rgba(0,0,0,0.38);}.stage.theme-dark .iso-texture-mark{fill:rgba(255,255,255,0.24);}.stage.theme-dark .iso-texture-line{stroke:rgba(255,255,255,0.18);}.stage.theme-dark .iso-overlay-ground{fill:rgba(0,0,0,0.42);}.stage.theme-dark .iso-overlay-tether{stroke:rgba(224,232,235,0.5);}@media (prefers-color-scheme:dark){.stage:not(.theme-light) .iso-side-hi{stop-color:#4c555a;}.stage:not(.theme-light) .iso-side-lo{stop-color:#343c40;}.stage:not(.theme-light) .iso-top-hi{stop-color:#687176;}.stage:not(.theme-light) .iso-top-lo{stop-color:#50585d;}.stage:not(.theme-light) .iso-wall-side{stroke:#30373b;}.stage:not(.theme-light) .iso-wall-top{stroke:#7b858a;}.stage:not(.theme-light) .iso-floor-side{fill:#2d3438;stroke:#20272a;}.stage:not(.theme-light) .iso-opening-panel{fill:#626b70;stroke:#899399;}.stage:not(.theme-light) .iso-opening-panel.iso-window{fill:#75919b;stroke:#abc6ce;}.stage:not(.theme-light) .iso-opening-panel.iso-material-reveal{fill:#454e52;stroke:#727d82;}.stage:not(.theme-light) .iso-opening-panel.iso-material-matte-leaf{fill:#626a6e;stroke:#899398;}.stage:not(.theme-light) .iso-opening-panel.iso-opening-leaf-edge,.stage:not(.theme-light) .iso-opening-panel.iso-opening-leaf-top{fill:#4b5458;}.stage:not(.theme-light) .iso-opening-panel.iso-material-light-window,.stage:not(.theme-light) .iso-opening-panel.iso-material-light-frame,.stage:not(.theme-light) .iso-opening-panel.iso-material-light-sill{fill:#d8e8eb;stroke:#9eb8bf;}.stage:not(.theme-light) .iso-ambient-shadow{fill:rgba(0,0,0,0.34);}.stage:not(.theme-light) .iso-contact-shadow,.stage:not(.theme-light) .iso-leaf-shadow{stroke:rgba(0,0,0,0.38);}.stage:not(.theme-light) .iso-texture-mark{fill:rgba(255,255,255,0.24);}.stage:not(.theme-light) .iso-texture-line{stroke:rgba(255,255,255,0.18);}.stage:not(.theme-light) .iso-overlay-ground{fill:rgba(0,0,0,0.42);}.stage:not(.theme-light) .iso-overlay-tether{stroke:rgba(224,232,235,0.5);}}@media (forced-colors:active){.iso-wall-side,.iso-wall-top,.iso-floor-side,.iso-opening-panel{fill:Canvas;stroke:CanvasText;forced-color-adjust:auto;}.iso-ambient-shadow,.iso-contact-shadow,.iso-leaf-shadow,.iso-overlay-ground,.iso-material-texture{display:none;}.iso-overlay-tether{stroke:CanvasText;}}@supports not (filter:blur(1px)){.iso-ambient-shadow,.iso-contact-shadow,.iso-leaf-shadow,.iso-overlay-ground,.iso-material-texture{display:none;}}.hp-paper{fill:var(--ha-card-background,var(--card-background-color,#111));stroke:none;}.stage.noplan .hp-paper,.stage.mode-plan .hp-paper,.stage.mode-devices .hp-paper,.stage.mode-decor .hp-paper{fill:#ffffff;}.room{transition:0.12s;cursor:default;stroke-linejoin:round;stroke-linecap:round;}.stage.mode-view .room{cursor:pointer;}.room.overlay{fill:transparent;stroke:transparent;stroke-width:calc(2px * var(--hp-cell-visual-scale,1));}:host([data-pointer-hover]) .stage.mode-view .room.overlay:not(.styled):hover{stroke:var(--hp-accent);stroke-opacity:1;}.room.yard{fill:rgba(75,140,90,0.14);stroke:#4b8c5a;stroke-width:calc(2px * var(--hp-cell-visual-scale,1));}:host([data-pointer-hover]) .stage.mode-view .room.yard:not(.styled):hover{stroke:var(--hp-accent);stroke-opacity:1;}.room.styled{stroke:var(--room-stroke,transparent);stroke-opacity:var(--room-stroke-op,0);stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));fill:var(--room-fill,transparent);fill-opacity:var(--room-fill-op,0);}.glow-base-layer,.glow-base-tunnels,.glow-pools-frame,.glow-pools,.glow-spot{pointer-events:none;}.glow-pools-frame,.glow-pools,.glow-spot{isolation:isolate;}.glow-pools.blend-screen .glow-spot{mix-blend-mode:screen;}.glow-spot{opacity:1;transition:opacity 500ms ease;}.glow-spot.is-entering,.glow-spot.is-leaving{opacity:0;}@media (prefers-reduced-motion:reduce){.glow-spot{transition:none;}}:host([data-pointer-hover]) .stage.mode-view .room.styled:hover{stroke:var(--hp-accent);stroke-opacity:1;}.op-leaf{transition:transform 0.6s ease;}.op-arc{stroke-width:calc(1.5px * var(--hp-cell-visual-scale,1));transition:stroke-dashoffset 0.6s ease;}.op-outline{fill:none;stroke:var(--hp-accent);stroke-width:calc(1.5px * var(--hp-cell-visual-scale,1));opacity:0;transition:opacity 0.15s;pointer-events:none;}:host([data-pointer-hover]) .stage.markup g.opening:hover .op-outline{opacity:0.9;}.op-hit{fill:transparent;pointer-events:none;cursor:default;}.stage.markup .op-hit{pointer-events:auto;cursor:grab;touch-action:none;}.stage.markup .op-hit:active{cursor:grabbing;}.stage.markup .opening.orphan{pointer-events:auto;cursor:pointer;color:var(--error-color,#db4437);}.stage.markup .opening.orphan circle{fill:var(--hp-bg);stroke:currentColor;stroke-width:calc(2px * var(--hp-cell-visual-scale,1));}.stage.markup .opening.orphan text{fill:currentColor;font-weight:800;font-size:calc(12px * var(--hp-cell-visual-scale,1));pointer-events:none;}.stage.markup.tool-resize .op-hit{pointer-events:none;cursor:default;}.stage.mode-view .oplock{pointer-events:auto;cursor:pointer;}.stage.projection-iso.mode-view .oplock::before{content:'';position:absolute;left:50%;top:50%;width:max(44px,100%);height:max(44px,100%);transform:translate(-50%,-50%);border-radius:50%;pointer-events:auto;}@media (prefers-reduced-motion:reduce){.op-leaf,.op-arc{transition:none;}}.roomlabel{pointer-events:none;position:absolute;transform:translate(-50%,-50%);font-size:calc(var(--rl-icon-size,var(--icon-size,2.5cqw)) * 0.5 * var(--rl-scale,1) * var(--rl-font,1) * var(--rl-space,1));font-weight:700;letter-spacing:0.04em;white-space:nowrap;cursor:grab;user-select:none;z-index:1;display:flex;flex-direction:column;align-items:center;gap:0.15em;text-align:center;}.rlname{display:inline-flex;align-items:center;gap:0.25em;font-size:calc(1em * var(--rl-name,1));}.zoomwrap.slide-left{animation:hp-slide-left 0.18s cubic-bezier(0.2,0.7,0.2,1);}.zoomwrap.slide-right{animation:hp-slide-right 0.18s cubic-bezier(0.2,0.7,0.2,1);}@media (prefers-reduced-motion:reduce){.zoomwrap.slide-left,.zoomwrap.slide-right{animation:none;}}.rlgearbtn{--gear-h:calc(var(--icon-size,2.5cqw) * 0.77);position:absolute;transform:translate(-50%,-50%);display:inline-flex;align-items:center;gap:0.35em;height:var(--gear-h);padding:0 calc(var(--gear-h) * 0.38);border:0;border-radius:999px;background:var(--hp-accent);color:var(--text-primary-color,#fff);font:inherit;font-size:calc(var(--gear-h) * 0.42);font-weight:600;line-height:1;white-space:nowrap;cursor:pointer;pointer-events:auto;opacity:0.92;box-shadow:var(--shadow-1);z-index:2;}.rlgearbtn{transition:opacity 0.15s,filter 0.15s;}:host([data-pointer-hover]) .rlgearbtn:hover{opacity:1;filter:brightness(1.18);}.rlgearbtn ha-icon{--mdc-icon-size:calc(var(--gear-h) * 0.55);display:inline-flex;}.rlgear{--mdc-icon-size:0.9em;display:inline-flex;margin-right:0.2em;opacity:0.6;cursor:pointer;pointer-events:auto;}:host([data-pointer-hover]) .rlgear:hover{opacity:1;}.rlgo{--mdc-icon-size:0.85em;display:inline-flex;opacity:0.55;}.stage.mode-view .rlgo{pointer-events:auto;cursor:pointer;}:host([data-pointer-hover]) .stage.mode-view .rlgo:hover{opacity:1;}.roomlabel .rlmetrics{position:absolute;top:calc(100% + 0.15em);left:50%;transform:translateX(-50%);white-space:nowrap;display:flex;align-items:center;gap:0.55em;font-size:calc(0.75em * var(--rl-meta,1));font-weight:600;letter-spacing:0.02em;opacity:0.9;}.roomlabel .rlm{display:inline-flex;align-items:center;gap:0.12em;}.roomlabel .rlm ha-icon{--mdc-icon-size:1.05em;display:inline-flex;}.roomlabel .rlm.lit{opacity:1;}.rlhandle{display:none;position:absolute;width:9px;height:9px;border-radius:2px;background:var(--hp-accent);border:1px solid var(--card-background-color,#fff);z-index:2;}.rlhandle.tl{left:-6px;top:-6px;cursor:nwse-resize;}.rlhandle.br{right:-6px;bottom:-6px;cursor:nwse-resize;}.rlhandle.tr{right:-6px;top:-6px;cursor:nesw-resize;}.rlhandle.bl{left:-6px;bottom:-6px;cursor:nesw-resize;}:host([data-pointer-hover]) .stage.markup .roomlabel:hover .rlhandle{display:block;}.stage.markup .roomlabel{pointer-events:auto;}.stage.mode-view .roomlabel{pointer-events:auto;cursor:pointer;border-radius:0.2em;}.stage.projection-iso.mode-view .roomlabel{box-sizing:border-box;min-width:44px;min-height:44px;justify-content:center;}.stage.mode-view .roomlabel:focus-visible{outline:2px solid var(--hp-accent);outline-offset:4px;}.roomlabel:active{cursor:grabbing;}.measurelayer{position:absolute;inset:0;pointer-events:none;}.alignline{stroke:var(--hp-accent);stroke-width:calc(1.2px * var(--hp-cell-visual-scale,1));stroke-dasharray:calc(4px * var(--hp-cell-visual-scale,1)) calc(4px * var(--hp-cell-visual-scale,1));pointer-events:none;opacity:0.9;}.aligndot{fill:var(--hp-accent);pointer-events:none;}.measurelabel.on45{color:#4bd28f;border-color:#4bd28f;}.measurelabel{position:absolute;transform:translate(12px,-150%);font-size:var(--fs-s);font-weight:600;padding:1px var(--sp-3);border-radius:var(--rad-s);background:rgba(0,0,0,0.72);color:#fff;white-space:nowrap;pointer-events:none;user-select:none;z-index:3;}.measurelabel.opdimension{transform:translate(calc(-50% + var(--op-label-shift-x,0px)),calc(-50% + var(--op-label-shift-y,-12px)));border:1px solid var(--hp-open,#ff9800);}.decorlayer .dshape{pointer-events:none;}.stage.mode-decor .decorlayer .dshape{pointer-events:visiblePainted;cursor:pointer;}.stage.mode-decor.dtool-select .decorlayer .dshape{cursor:move;}.stage.mode-decor.dtool-line .decorlayer .dshape,.stage.mode-decor.dtool-rect .decorlayer .dshape,.stage.mode-decor.dtool-ellipse .decorlayer .dshape,.stage.mode-decor.dtool-text .decorlayer .dshape,.stage.mode-decor.dtool-furniture .decorlayer .dshape,.stage.mode-decor.dtool-image .decorlayer .dshape,.stage.mode-decor.dtool-backdrop .decorlayer .dshape{pointer-events:none;}.stage.mode-decor.dtool-furniture,.stage.mode-decor.dtool-image{cursor:copy;}.stage.mode-decor.dtool-select .decorlayer .dimage,.stage.mode-decor.dtool-erase .decorlayer .dimage,.stage.mode-decor.dtool-select .decorlayer .dimage-missing,.stage.mode-decor.dtool-erase .decorlayer .dimage-missing{pointer-events:bounding-box;}.decorlayer .dimage-missing rect{fill:rgba(127,127,127,0.12);stroke:var(--hp-accent);stroke-dasharray:8 5;vector-effect:non-scaling-stroke;}.decorlayer .dimage-missing path{fill:none;stroke:var(--hp-accent);vector-effect:non-scaling-stroke;}.decorlayer .decor-image-placement-preview{opacity:0.65;}.stage.mode-decor.dtool-text .decorlayer .dshape.dtext,.stage.mode-decor.dtool-select .decorlayer .dshape.dtext,.stage.mode-decor.dtool-erase .decorlayer .dshape.dtext{pointer-events:visiblePainted;pointer-events:bounding-box;}.stage.mode-decor.dtool-text .decorlayer .dshape.dtext{cursor:text;}.decorlayer .derasehit{fill:none;stroke:transparent;stroke-width:16px;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;pointer-events:none;}.stage.mode-decor.dtool-erase .decorlayer .derasehit{pointer-events:stroke;}.decorlayer .dselecthit{fill:none;stroke:transparent;stroke-width:16px;stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:none;}.stage.mode-decor.dtool-select .decorlayer .dselecthit{pointer-events:stroke;cursor:move;}.stage.mode-decor .decorlayer .dshape.dfurniturehit{fill:none;stroke:transparent;pointer-events:none;}.stage.mode-decor.dtool-select .decorlayer .dshape.dfurniturehit{pointer-events:stroke;cursor:move;}.decorlayer .dsel{filter:drop-shadow(0 0 3px var(--hp-accent));}.decorlayer .ddraft{stroke-dasharray:calc(6px * var(--hp-cell-visual-scale,1)) calc(5px * var(--hp-cell-visual-scale,1));pointer-events:none;}.decorlayer .furniture-placement-preview{opacity:0.55;pointer-events:none;}.decorlayer text{font-weight:600;user-select:none;dominant-baseline:middle;text-anchor:middle;}.stage.mode-decor{outline:2px solid #26a69a;outline-offset:-2px;}.bdframe .bdbox{fill:none;stroke:var(--hp-accent);stroke-width:2;stroke-dasharray:10 7;vector-effect:non-scaling-stroke;pointer-events:none;opacity:0.9;}.bdframe .bdhandle{fill:transparent;stroke:none;pointer-events:all;touch-action:none;}.bdframe .bdknob{fill:var(--hp-accent);stroke:#fff;stroke-width:1;vector-effect:non-scaling-stroke;pointer-events:none;}:host([data-pointer-hover]) .bdframe .bdhandle:hover + .bdknob{fill:#fff;stroke:var(--hp-accent);}.bdframe .bd-nwse{cursor:nwse-resize;}.bdframe .bd-nesw{cursor:nesw-resize;}.stage.mode-decor.bdgrab{cursor:grab;}.stage.mode-decor.bdgrabbing,.stage.mode-decor.bdgrabbing .bdframe .bdhandle{cursor:grabbing;}.measurelabel.bdmeasure{transform:translate(-50%,-50%);border:1px solid var(--hp-accent);}.dtframe .dtbox{fill:none;stroke:var(--hp-accent);stroke-width:1.5;stroke-dasharray:7 5;vector-effect:non-scaling-stroke;pointer-events:none;opacity:0.85;}.dtframe .dtstem,.bdframe .dtstem{stroke:var(--hp-accent);stroke-width:1.5;vector-effect:non-scaling-stroke;pointer-events:none;opacity:0.85;}.dtframe .dthandle{fill:transparent;stroke:none;pointer-events:all;touch-action:none;}.dtframe .dtknob{fill:var(--hp-accent);stroke:#fff;stroke-width:1;vector-effect:non-scaling-stroke;pointer-events:none;}:host([data-pointer-hover]) .dtframe .dthandle:hover + .dtknob{fill:#fff;stroke:var(--hp-accent);}.dtframe .dt-nwse{cursor:nwse-resize;}.dtframe .dt-nesw{cursor:nesw-resize;}.dtframe .dtrot{cursor:grab;}.dtframe .dt-ew{cursor:ew-resize;}.dtframe .dt-ns{cursor:ns-resize;}.dtfurnitureframe .dtrot{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M18.4 7.2A8 8 0 1 0 20 12' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='m15.5 3.8 3.2 3.5-4.6.8' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 12 12,grab;}.dtfurnitureframe .dtrot:active{cursor:grabbing;}.dtframe .dtendpoint{cursor:crosshair;}.bdframe .dtrot{cursor:grab;}.dtarea{resize:vertical;min-height:3.4em;font:inherit;line-height:1.35;}.stage.mode-decor.dtool-line,.stage.mode-decor.dtool-rect,.stage.mode-decor.dtool-ellipse,.stage.mode-decor.dtool-text{cursor:crosshair;}.stage.mode-decor.dtool-erase,.stage.mode-decor.dtool-erase .decorlayer .dshape{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cg transform='rotate(-45 12 12)'%3E%3Crect x='7' y='2' width='10' height='18' rx='2' fill='%23fff' stroke='%23111' stroke-width='1.5'/%3E%3Cpath d='M7 13h10v5a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2z' fill='%23ff9f43' stroke='%23111' stroke-width='1.5'/%3E%3C/g%3E%3C/svg%3E") 5 22,pointer;}.stage.mode-decor .room{pointer-events:none;}.stage.mode-decor .devlayer,.stage.mode-decor .devlayer *,.stage.mode-decor .dev::before{pointer-events:none;}.stage .room,.stage .devlayer,.stage .opening,.stage .room-outline,.stage .wallbodies,.stage .opening-tunnels,.stage .glow-base-layer,.stage .glow-pools-frame,.stage .zero-walls{opacity:var(--hp-mode-architecture-opacity,1);}.opening-preview{opacity:0.5;pointer-events:none;}.opening-preview[data-kind="passage"]{opacity:1;}.passage-preview-cut{fill:var(--wall-fill,#ffffff);fill-opacity:0.35;stroke:none;pointer-events:none;}.passage-preview-boundary{stroke:var(--hp-open,#ff9800);stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));pointer-events:none;}.opening-preview .op-leaf,.opening-preview .op-arc{transition:none;}.opening-preview-dot{fill:var(--hp-open,#ff9800);pointer-events:none;}.opening-dimensions,.opening-dimension{pointer-events:none;}.opening-dimension-line,.opening-dimension-tick{fill:none;stroke:var(--hp-open,#ff9800);stroke-width:1.5;vector-effect:non-scaling-stroke;pointer-events:none;}.opening-dimension-tick{stroke-width:2;}.stage.edit .room{pointer-events:none;}.stage.markup{cursor:crosshair;}.stage.markup.tool-merge,.stage.markup.tool-split.pickstage,.stage.markup.tool-delroom{cursor:pointer;}.stage.markup.tool-wallthick{cursor:default;}.stage.markup.tool-wallthick.wallhot{cursor:pointer;}.wallbody-fill{fill:var(--wall-fill,#ffffff);fill-opacity:var(--wall-fill-op,1);fill-rule:evenodd;stroke:none;pointer-events:none;}.wallbody{fill:url(#hp-wall-hatch);fill-rule:evenodd;stroke:var(--room-stroke,var(--hp-muted));stroke-width:calc(0.6px * var(--hp-cell-visual-scale,1));pointer-events:none;}.wallbody.solid{fill:none;}.wallthick-hover{fill:var(--accent-color,#03a9f4);fill-opacity:0.38;stroke:var(--accent-color,#03a9f4);stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));stroke-linejoin:round;stroke-linecap:round;pointer-events:none;}.wallthick-hover.isopen{fill:var(--error-color,#f44336);stroke:var(--error-color,#f44336);}.zero-wall{stroke:var(--zero-wall-stroke,var(--hp-muted));stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));stroke-dasharray:calc(7px * var(--hp-cell-visual-scale,1)) calc(7px * var(--hp-cell-visual-scale,1));stroke-linecap:butt;pointer-events:none;opacity:0.9;}.zero-walls.solid .zero-wall{stroke-dasharray:none;}.room.noedge{stroke-opacity:0 !important;}.room-outline{fill:none;stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));stroke-linejoin:round;stroke-linecap:round;pointer-events:none;}.room-outline.outlined{stroke:rgba(62,166,255,0.55);stroke-opacity:1;}.room-hover-fill{fill:#000;fill-opacity:0.22;pointer-events:none;}.room-hover-halo{fill:none;stroke:var(--hp-accent);stroke-opacity:0.28;stroke-width:calc(8px * var(--hp-cell-visual-scale,1));stroke-linejoin:round;stroke-linecap:round;pointer-events:none;}.room-hover-outline{fill:none;stroke:var(--hp-accent);stroke-width:calc(3px * var(--hp-cell-visual-scale,1));stroke-linejoin:round;stroke-linecap:round;pointer-events:none;}.stage.markup .room{pointer-events:none;}.stage.markup .devlayer .dev{display:none;}.stage.mode-plan{outline:2px solid #ffc14d;outline-offset:-2px;}.stage.mode-devices{outline:2px solid var(--hp-accent);outline-offset:-2px;}.room.outlined{stroke:rgba(62,166,255,0.55);fill:rgba(62,166,255,0.06);}.room.picked{stroke:#ffc14d;stroke-width:calc(3px * var(--hp-cell-visual-scale,1));fill:rgba(255,193,77,0.25);}.griddot{fill:var(--hp-accent);opacity:0.35;stroke:rgba(0,0,0,0.35);stroke-width:0.4;}.griddot.major{opacity:0.5;stroke-width:0;}.seg{stroke:var(--hp-accent);stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));stroke-linecap:round;stroke-linejoin:round;}.pathline{stroke:#ffc14d;stroke-width:calc(3px * var(--hp-cell-visual-scale,1));fill:none;stroke-linecap:round;stroke-linejoin:round;}.preview{stroke:#ffc14d;stroke-width:calc(2px * var(--hp-cell-visual-scale,1));stroke-dasharray:calc(6px * var(--hp-cell-visual-scale,1)) calc(5px * var(--hp-cell-visual-scale,1));opacity:0.7;}.active-axis{stroke:#ffc14d;stroke-width:2;stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:none;}.active-vertex{fill:#ffc14d;stroke:#171006;stroke-width:2;vector-effect:non-scaling-stroke;pointer-events:none;}.wall-repair-preview{stroke:#d93025;stroke-width:4;stroke-linecap:round;stroke-dasharray:5 4;vector-effect:non-scaling-stroke;pointer-events:none;}.drawwall-preview-fill{fill:var(--wall-fill,#ffffff);fill-opacity:calc(var(--wall-fill-op,1) * 0.55);fill-rule:evenodd;stroke:none;pointer-events:none;}.drawwall-preview{fill:url(#hp-wall-hatch);fill-opacity:0.55;fill-rule:evenodd;stroke:var(--accent-color,#03a9f4);stroke-width:calc(0.5px * var(--hp-cell-visual-scale,1));stroke-opacity:0.7;pointer-events:none;}.drawwall-zero-preview{fill:none;stroke:var(--accent-color,#03a9f4);stroke-width:calc(3px * var(--hp-cell-visual-scale,1));stroke-linecap:butt;stroke-linejoin:round;opacity:0.72;pointer-events:none;}.drawwall-zero-preview.dashed{stroke-dasharray:calc(7px * var(--hp-cell-visual-scale,1)) calc(7px * var(--hp-cell-visual-scale,1));}.vertex{fill:#ffc14d;stroke:#4a2800;stroke-width:calc(1px * var(--hp-cell-visual-scale,1));}.vertex.first{fill:#4bd28f;stroke:#04121f;}.plan-snap-overlay,.plan-snap-overlay *,.hidden-wall-diagnostic,.hidden-wall-diagnostic *{pointer-events:none;}.plan-snap-line,.hidden-wall-line{fill:none;stroke:color-mix(in srgb,var(--hp-accent) 82%,white 18%);stroke-width:1;stroke-linecap:round;opacity:0.92;}.plan-snap-node,.hidden-wall-node{fill:var(--ha-card-background,var(--card-background-color,#fff));stroke:color-mix(in srgb,var(--hp-accent) 88%,#07131c 12%);stroke-width:1;vector-effect:non-scaling-stroke;}.plan-snap-node.active{fill:#ffc14d;stroke:#171006;stroke-width:2;}.plan-snap-node.active.dynamic{fill:#4bd28f;stroke:#04121f;}.plan-snap-node.conflict{fill:#fff;stroke:#d93025;stroke-width:3;}@media (prefers-color-scheme:dark){.plan-snap-line{stroke:color-mix(in srgb,var(--hp-accent) 72%,white 28%);}.hidden-wall-line{stroke:color-mix(in srgb,var(--hp-accent) 72%,white 28%);}.plan-snap-node,.hidden-wall-node{fill:#17242c;stroke:#9bdcf5;}.plan-snap-node.active{fill:#ffc14d;stroke:#fff4d6;}.plan-snap-node.active.dynamic{fill:#4bd28f;stroke:#eafff4;}}@media (forced-colors:active){.plan-snap-line,.hidden-wall-line{stroke:CanvasText;opacity:1;forced-color-adjust:auto;}.plan-snap-node,.hidden-wall-node{fill:Canvas;stroke:CanvasText;forced-color-adjust:auto;}.plan-snap-node.active,.plan-snap-node.active.dynamic{fill:Highlight;stroke:HighlightText;forced-color-adjust:auto;}}.sunlayer{animation:hp-sunfade-in 2s linear both;}.sunlayer.out{animation:hp-sunfade-out 2s linear both;}@media (prefers-reduced-motion:reduce){.sunlayer,.sunlayer.out{animation:none;}.sunlayer.out{opacity:0;}}.devlayer{position:absolute;inset:0;pointer-events:none;z-index:6;}.radar-target{position:absolute;width:8px;height:8px;box-sizing:border-box;transform:translate(-50%,-50%);border-radius:50%;background:var(--success-color,#43a047);border:2px solid var(--primary-text-color,#1f1f1f);box-shadow:0 0 0 1px color-mix(in srgb,var(--card-background-color,#fff) 80%,transparent);pointer-events:none;z-index:0;}.radar-target.smooth{transition:left 200ms linear,top 200ms linear;}.radar-ranges{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;z-index:0;}.radar-ranges path,.radar-ranges polyline{fill:none;stroke:var(--success-color,#43a047);stroke-width:2px;stroke-dasharray:5 4;vector-effect:non-scaling-stroke;opacity:0.72;}.radar-ranges .radar-zone{fill:color-mix(in srgb,var(--success-color,#43a047) 8%,transparent);stroke:var(--success-color,#43a047);stroke-width:2px;vector-effect:non-scaling-stroke;opacity:0.8;}.stage.mode-devices .dev{cursor:grab;}.stage.mode-devices .dev:active{cursor:grabbing;}.physical-hit{fill:transparent;stroke:transparent;pointer-events:none;cursor:grab;}.stage.tool-select .physical-hit{pointer-events:all;}.physical-hit:active{cursor:grabbing;}line.physical-hit{cursor:pointer;}.physical-hit.selected{fill:rgba(255,193,77,0.24);stroke:transparent;}line.physical-hit.selected{stroke:transparent;}.physical-drag{fill:rgba(255,193,77,0.38);stroke:#ffc14d;stroke-width:2.5;vector-effect:non-scaling-stroke;pointer-events:none;}.physical-chrome{pointer-events:none;}.physical-chrome .frame,.physical-chrome .stem{fill:none;stroke:#ffc14d;stroke-width:2;vector-effect:non-scaling-stroke;}.physical-chrome .frame{fill:rgba(255,193,77,0.22);}.physical-chrome polyline.frame{fill:none;}.physical-chrome .move-dot{fill:#ffc14d;stroke:#24262d;stroke-width:1.5;vector-effect:non-scaling-stroke;}.physical-chrome .rotate-handle{fill:#24262d;stroke:#ffc14d;stroke-width:2.5;vector-effect:non-scaling-stroke;pointer-events:all;cursor:crosshair;}.drawwall.invalid input{border-color:var(--error-color,#db4437);}.drawwall .rangehint{margin-inline-start:4px;font-size:0.78em;opacity:0.72;}.drawwall.invalid .rangehint{color:var(--error-color,#db4437);opacity:1;}.stage.markup.tool-partition,.stage.markup.tool-column{cursor:crosshair;}.rszhandle{fill:transparent;stroke:none;pointer-events:all;cursor:grab;touch-action:none;}.rszhandle:active{cursor:grabbing;}.rszhandle.disabled,.rszhandle.disabled:active{cursor:not-allowed;}.rszicon{pointer-events:none;}.rszicon path{fill:none;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;}.rszhalo{stroke:var(--hp-bg);stroke-width:6;}.rszink{stroke:var(--hp-accent);stroke-width:2;}:host([data-pointer-hover]) .rszhandle:hover + .rszicon .rszink{stroke-width:3;}.rszicon.disabled{opacity:0.38;}:host([data-pointer-hover]) .rszhandle.disabled:hover + .rszicon .rszink{stroke-width:2;}.rszmeasurelayer,.rszmeasurelayer *{pointer-events:none;}.rszmeasurehalo,.rszmeasureink,.rszleader{fill:none;stroke-linecap:round;vector-effect:non-scaling-stroke;}.rszmeasurehalo{stroke:var(--hp-bg);stroke-width:7px;opacity:0.9;}.rszmeasureink{stroke:var(--hp-accent);stroke-width:3px;}.rszleader{stroke:var(--hp-accent);stroke-width:2px;opacity:0.95;}.measurelabel.dmeasure{transform:translate(-50%,-160%);}.measurelabel.rszarea{transform:translate(calc(-50% + var(--rsz-label-x,0px)),calc(-50% + var(--rsz-label-y,0px)));background:rgba(0,0,0,0.6);border:1px solid var(--hp-accent);}.measurelabel.furnmeasure{transform:translate(-50%,-50%);border:1px solid var(--hp-accent);}.alignmsg{margin:0 0 8px;font-size:13px;line-height:1.45;}`,o`.dev ha-icon{position:relative;z-index:1;}.device-pulse{position:absolute;left:50%;top:50%;width:var(--dev-size);height:var(--dev-size);transform:translate(-50%,-50%);pointer-events:none;z-index:0;}.device-pulse i{position:absolute;inset:0;border-radius:50%;border:2px solid var(--ripple-color,var(--hp-accent));opacity:0;}.device-pulse.short i{animation:hp-pulse-short 1.1s cubic-bezier(.22,.61,.36,1) 1 forwards;}.device-pulse.short i:nth-child(2){animation-delay:1.1s;}.device-pulse.short i:nth-child(3){animation-delay:2.2s;}.device-pulse.short.gen2 i{animation-name:hp-pulse-short-b;}.device-pulse.continuous i:nth-child(n + 2),.device-pulse.alarm i:nth-child(n + 3){display:none;}.device-pulse.continuous i:first-child{animation:hp-pulse-continuous 3.6s cubic-bezier(.45,.05,.55,.95) infinite;}.device-pulse.alarm i{border-width:3px;border-color:#F0410C;animation:hp-pulse-alarm 2.4s cubic-bezier(.22,.61,.36,1) infinite;}.device-pulse.alarm i:nth-child(2){animation-delay:1.2s;}.activity-dot{position:absolute;right:8%;bottom:8%;width:18%;height:18%;min-width:4px;min-height:4px;border-radius:50%;background:var(--ripple-color,var(--hp-accent));border:1px solid color-mix(in srgb,var(--hp-bg) 82%,transparent);pointer-events:none;z-index:3;}.kioskdots{position:absolute;left:50%;bottom:var(--sp-5);transform:translateX(-50%);display:flex;gap:var(--sp-4);z-index:5;pointer-events:none;}.kdot{width:9px;height:9px;border-radius:50%;background:var(--hp-muted);opacity:0.55;}.kdot.on{background:var(--hp-accent);opacity:1;}.dev.valonly{width:var(--dev-size,var(--icon-size,2.5cqw));}.dev.valonly .device-core{width:max-content;min-width:var(--dev-size,var(--icon-size,2.5cqw));padding-inline:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.16);border-radius:calc(var(--dev-size,var(--icon-size,2.5cqw)) / 2);}.dev .valtext{overflow:visible;font-size:calc(var(--dev-size,var(--icon-size,2.5cqw)) * var(--value-font-scale,.45));font-weight:600;white-space:nowrap;}@media (prefers-reduced-motion:reduce){.device-pulse{display:none;}}.dev .newdot{position:absolute;top:calc(var(--dev-size,var(--icon-size,2.5cqw)) * -0.12);right:calc(var(--dev-size,var(--icon-size,2.5cqw)) * -0.12);width:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.34);height:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.34);border-radius:50%;background:#f0301f;border:2px solid var(--card-background-color,var(--hp-bg));pointer-events:none;z-index:2;}.dev{position:absolute;--dev-size:calc(var(--device-base-size,2.25cqw) * var(--dev-scale,1));--device-shell-size:calc(var(--dev-size) * 1.26875);--device-shell-inset:calc(var(--dev-size) * 0.134375);--device-shell-stroke-ratio:0.01875;--device-shell-border-width:max(1px,calc(var(--dev-size) * var(--device-shell-stroke-ratio)));--device-core-bg:var(--card-background-color,#fff);--device-core-fg:var(--primary-text-color,#252525);--device-core-bg:light-dark(#fff,#252525);--device-core-fg:light-dark(#252525,#fff);--device-face-bg:var(--device-core-bg);--device-face-fg:var(--device-core-fg);--device-shell-base-stroke:light-dark(#BCBCBC,rgb(37 37 37 / 75%));--device-shell-stroke:var(--device-shell-base-stroke);--device-shell-shadow:0 calc(var(--dev-size) * .025) calc(var(--dev-size) * .05) rgb(37 40 45 / 12%),0 calc(var(--dev-size) * .1) calc(var(--dev-size) * .175) calc(var(--dev-size) * -.025) rgb(37 40 45 / 18%);--device-core-inset-shadow:0 0 0 0 transparent;--device-ring-color:transparent;--device-ring-width:0px;width:var(--dev-size);height:var(--dev-size);margin:calc(var(--dev-size) / -2) 0 0 calc(var(--dev-size) / -2);border:0;background:transparent;display:block;color:var(--device-core-fg);cursor:pointer;pointer-events:none;transition:opacity 0.2s;box-shadow:none;outline:none;z-index:auto;}.dev.theme-light{--device-core-bg:#fff;--device-core-fg:#000;--device-shell-base-stroke:#BCBCBC;--device-shell-stroke:var(--device-shell-base-stroke);--device-shell-shadow:0 calc(var(--dev-size) * .025) calc(var(--dev-size) * .05) rgb(37 40 45 / 12%),0 calc(var(--dev-size) * .1) calc(var(--dev-size) * .175) calc(var(--dev-size) * -.025) rgb(37 40 45 / 18%);--device-core-inset-shadow:0 0 0 0 transparent;}.dev.theme-dark{--device-core-bg:#252525;--device-core-fg:#fff;--device-shell-base-stroke:rgb(37 37 37 / 75%);--device-shell-stroke:var(--device-shell-base-stroke);--device-shell-shadow:0 calc(var(--dev-size) * .025) calc(var(--dev-size) * .0375) rgb(37 40 45 / 12%),0 calc(var(--dev-size) * .1) calc(var(--dev-size) * .175) calc(var(--dev-size) * -.025) rgb(37 40 45 / 18%);--device-core-inset-shadow:inset 0 calc(var(--dev-size) * 0.0125) calc(var(--dev-size) * 0.0125) rgb(255 255 255 / 70%);}.dev::before{content:'';position:absolute;left:50%;top:50%;width:max(44px,var(--device-shell-size));height:max(44px,var(--device-shell-size));transform:translate(-50%,-50%);border-radius:50%;pointer-events:auto;z-index:1;}.device-shell{position:absolute;box-sizing:border-box;display:flex;align-items:center;gap:calc(var(--dev-size) * 0.1);padding:0;min-width:var(--dev-size);min-height:var(--dev-size);border:0;background:transparent;box-shadow:none;transition:opacity .2s;pointer-events:none;z-index:2;}.device-shell-frame{position:absolute;z-index:0;box-sizing:border-box;inset:calc(var(--device-shell-inset) / -1);border:var(--device-shell-border-width) solid var(--device-shell-stroke);border-radius:9999px;background:transparent;box-shadow:var(--device-shell-shadow);transition:border-color .15s,opacity .2s;pointer-events:auto;backdrop-filter:none;}.device-shell:not(.with-values){left:0;top:0;}.device-shell:not(.with-values):not(.text-shell) .device-shell-frame{border-radius:50%;}.device-shell.with-values.pos-right{left:0;top:50%;transform:translateY(-50%);}.device-shell.with-values.pos-left{right:0;top:50%;transform:translateY(-50%);flex-direction:row-reverse;}.device-shell.with-values.pos-bottom{left:50%;top:0;transform:translateX(-50%);flex-direction:column;}.device-shell.with-values.pos-top{left:50%;bottom:0;transform:translateX(-50%);flex-direction:column-reverse;}.device-core{position:relative;z-index:1;box-sizing:border-box;flex:0 0 auto;width:var(--dev-size);height:var(--dev-size);display:flex;align-items:center;justify-content:center;border-radius:50%;background:var(--device-face-bg);color:var(--device-face-fg);box-shadow:var(--device-core-inset-shadow),0 0 0 var(--device-ring-width) var(--device-ring-color);line-height:0;transition:background .15s,color .15s,opacity .2s;pointer-events:none;}.device-sections{display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:calc(var(--dev-size) * .08);min-width:0;pointer-events:none;}.device-shell.pos-top .device-sections,.device-shell.pos-bottom .device-sections{flex-direction:row;}.dev ha-icon{--mdc-icon-size:calc(var(--dev-size,var(--device-base-size,2.25cqw)) * 0.55);display:flex;align-items:center;justify-content:center;line-height:0;}.dev.on{--device-face-bg:#F0A00C;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:#F0A00C;}.dev.theme-light.on{--device-face-fg:#fff;}.dev.theme-dark.on{--device-face-fg:#252525;--device-shell-stroke-ratio:.0375;}.dev.open{--device-face-bg:var(--hp-open);--device-face-fg:light-dark(#fff,#252525);}.dev.theme-light.open{--device-face-fg:#fff;}.dev.theme-dark.open{--device-face-fg:#252525;}.dev.lock-locked{--device-face-bg:#66D17A;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:#66D17A;}.dev.theme-light.lock-locked{--device-face-fg:#fff;}.dev.theme-dark.lock-locked{--device-face-fg:#252525;--device-shell-stroke-ratio:.025;}.dev.lock-unlocked{--device-face-bg:#F0410C;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:#F0410C;}.dev.theme-light.lock-unlocked{--device-face-fg:#fff;}.dev.theme-dark.lock-unlocked{--device-face-fg:#252525;--device-shell-stroke-ratio:.025;}:host([data-pointer-hover]) .dev:not(.unavail)[data-hp-device-hover]{--device-face-bg:#0C82F0;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:var(--device-shell-base-stroke);}:host([data-pointer-hover]) .dev.theme-light:not(.unavail)[data-hp-device-hover]{--device-face-fg:#fff;}:host([data-pointer-hover]) .dev.theme-dark:not(.unavail)[data-hp-device-hover]{--device-face-fg:#252525;}:host([data-pointer-hover]) .dev[data-hp-device-hover],.dev:focus-visible{z-index:5;}.dev[data-hp-zigbee-topology-endpoint]{z-index:8;}:host([data-pointer-hover]) .dev[data-hp-zigbee-topology-endpoint][data-hp-device-hover]{z-index:8;}.dev.unavail{opacity:0.35;--device-face-bg:#B5BAC1;--device-shell-stroke:var(--device-shell-base-stroke);}.dev.virtual .device-shell-frame{border-style:dashed;}.dev.ghost{opacity:0.6;color:var(--hp-accent);}.dev.ghost .device-shell-frame{border-style:dashed;border-color:var(--hp-accent);box-shadow:none;}.dev.ghost .device-core{background:rgba(62,166,255,0.22);background:color-mix(in srgb,var(--hp-accent) 30%,var(--card-background-color,#1c2530));color:var(--hp-accent);}.dev.ghost.ha-disabled{opacity:0.62;color:var(--secondary-text-color,#9aa0aa);}.dev.ghost.ha-disabled .device-shell-frame{border-color:var(--secondary-text-color,#9aa0aa);}.dev.ghost.ha-disabled .device-core{background:rgba(120,124,134,0.2);background:color-mix(in srgb,var(--secondary-text-color,#9aa0aa) 24%,var(--card-background-color,#1c2530));color:var(--secondary-text-color,#9aa0aa);}.dev .habadge{position:absolute;right:-18%;bottom:-18%;display:grid;place-items:center;width:46%;height:46%;min-width:12px;min-height:12px;border-radius:50%;background:var(--card-background-color,#242832);border:1px solid currentColor;}.dev .habadge ha-icon{width:72%;height:72%;}.dev.sel{--device-ring-color:#F0A00C;--device-ring-width:calc(var(--dev-size) * 0.0375);}.dev:focus-visible{--device-ring-color:#0C82F0;--device-ring-width:calc(var(--dev-size) * 0.0375);}.dev:not(.on):not(.open):not(.alarm):not(.lock-locked):not(.lock-unlocked):not(.unavail):focus-visible{--device-face-fg:#0C82F0;}.dev.alarm,:host([data-pointer-hover]) .dev.alarm[data-hp-device-hover],.dev.alarm:focus-visible{--device-face-bg:#F0410C;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:#F0410C;}.dev.theme-light.alarm{--device-face-fg:#fff;}.dev.theme-dark.alarm{--device-face-fg:#252525;--device-shell-stroke-ratio:.025;}.dev .value-badge{position:relative;z-index:2;box-sizing:border-box;width:max-content;min-width:calc(var(--dev-size,var(--icon-size,2.5cqw)) * .7875);height:calc(var(--dev-size,var(--icon-size,2.5cqw)) * .7875);display:flex;align-items:center;justify-content:center;overflow:visible;background:var(--device-core-bg);border:0;border-radius:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.39375);padding:0 calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.14);font-size:calc(var(--dev-size,var(--icon-size,2.5cqw)) * var(--value-font-scale,.45));font-weight:600;line-height:1;color:var(--device-core-fg);white-space:nowrap;pointer-events:none;}.dev .value-badge.unavailable,.dev .value-badge.missing{opacity:0.66;}.dev .lqi{position:absolute;top:calc(50% + var(--device-shell-size) / 2 + var(--dev-size) * .05);left:50%;transform:translateX(-50%);margin-top:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.05);font-size:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.38);font-weight:600;line-height:1;text-shadow:0 0 3px rgba(0,0,0,0.9),0 0 2px rgba(0,0,0,0.9);white-space:nowrap;pointer-events:none;}.dev .lqi.below-value-badge{margin-top:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.8875);}.temprange{display:inline-flex;align-items:center;gap:var(--sp-3);margin-left:auto;color:var(--hp-muted);font-size:var(--fs-s);}.vacwarn{position:absolute;top:-12%;right:-12%;width:calc(var(--device-base-size,2.25cqw) * 0.42);height:calc(var(--device-base-size,2.25cqw) * 0.42);border-radius:50%;display:flex;align-items:center;justify-content:center;background:light-dark(#fff,#252525);border:1px solid #E5A100;color:#E5A100;z-index:7;pointer-events:none;}.vacwarn ha-icon{--mdc-icon-size:calc(var(--device-base-size,2.25cqw) * 0.32);color:inherit;}.vacpuck{position:absolute;--puck-size:calc(var(--device-base-size,2.25cqw) * 0.8);width:var(--puck-size);height:var(--puck-size);border-radius:50%;transform:translate(-50%,-50%);--vac-core-bg:light-dark(#fff,#252525);--vac-core-fg:light-dark(#252525,#fff);background:var(--vac-core-bg);border:1px solid #BCBCBC;box-shadow:0 1px 2px rgb(37 40 45 / 12%),0 4px 8px -1.07px rgb(37 40 45 / 18%);color:var(--vac-core-fg);display:flex;align-items:center;justify-content:center;cursor:pointer;z-index:6;transition:left 1.2s linear,top 1.2s linear;animation:vacpulse 2.2s ease-out infinite;}.vacpuck.theme-light{--vac-core-bg:#fff;--vac-core-fg:#252525;}.vacpuck.theme-dark{--vac-core-bg:#252525;--vac-core-fg:#fff;}.vacpuck.jump{transition:none;}.vacpuck.stale{opacity:0.45;animation:none;}.vacpuck ha-icon{--mdc-icon-size:calc(var(--puck-size) * 0.68);color:var(--vac-core-fg);display:flex;align-items:center;justify-content:center;line-height:0;width:var(--mdc-icon-size);height:var(--mdc-icon-size);}@keyframes vacpulse{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--hp-accent) 45%,transparent);}70%{box-shadow:0 0 0 12px transparent;}100%{box-shadow:0 0 0 0 transparent;}}@media (prefers-reduced-motion:reduce){.vacpuck{animation:none;}}.vactrail{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:5;overflow:visible;}.vactrail polyline,.vactrail path{fill:none;stroke-linejoin:round;stroke-linecap:round;vector-effect:non-scaling-stroke;}.vactrail g.prev{opacity:0.4;}.vactrail .case{stroke:rgba(0,0,0,0.4);stroke-width:2.25;}.vactrail .core{stroke:rgba(255,255,255,0.82);stroke-width:0.9;}.devicepreview-empty{min-height:82px;margin:4px 0 14px;padding:var(--sp-4);display:flex;align-items:center;justify-content:center;gap:var(--sp-3);border:1px dashed var(--hp-line);border-radius:var(--rad-m);color:var(--hp-muted);text-align:center;}`,o`.hdr{position:sticky;top:var(--header-height,56px);z-index:20;background:var(--card-background-color,var(--hp-bg));border-radius:var(--ha-card-border-radius,12px) var(--ha-card-border-radius,12px) 0 0;}.tabs{display:flex;gap:var(--sp-2);background:rgba(127,127,127,0.12);padding:var(--sp-2);border-radius:var(--rad-l);flex-wrap:wrap;}.tab{border:0;background:transparent;color:var(--hp-muted);display:inline-flex;align-items:center;padding:var(--sp-3) var(--sp-5);border-radius:var(--rad-m);font-size:var(--fs-m);font-weight:600;cursor:pointer;transition:0.15s;font-family:inherit;}:host([data-pointer-hover]) .tab:hover{color:var(--hp-txt);}.tab.active{background:var(--hp-accent);color:var(--text-primary-color,#fff);}.farhint{position:absolute;left:50%;transform:translateX(-50%);bottom:var(--sp-4);z-index:12;display:flex;align-items:center;gap:var(--sp-2);max-width:calc(100% - var(--sp-8));background:var(--card-background-color,var(--hp-bg));opacity:0.94;color:var(--hp-txt);border:1px solid var(--divider-color,#33404d);border-radius:var(--rad-m);padding:var(--sp-1) var(--sp-3);font-size:var(--fs-s);}.farhint ha-icon{--mdc-icon-size:18px;color:var(--hp-warn,#e2a03f);flex:none;}.farhint span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.dropbtn{display:flex;align-items:center;gap:var(--sp-4);width:100%;text-align:left;border:1px solid var(--hp-muted);border-radius:var(--rad-m);background:transparent;color:var(--hp-txt);padding:var(--sp-4) 10px;cursor:pointer;font-family:inherit;font-size:var(--fs-m);margin-top:var(--sp-3);}.dropbtn .ref{color:var(--hp-muted);font-size:var(--fs-s);margin-left:auto;}.dropbtn ha-icon{--mdc-icon-size:18px;margin-left:var(--sp-2);}.dropbtn.open{border-color:var(--hp-accent);}.droppanel{border:1px solid var(--hp-accent);border-top:none;border-radius:0 0 var(--rad-m) var(--rad-m);padding:var(--sp-3);margin-top:-4px;}.hdr.kioskhide{display:none;}.decorbar .dcolor{width:30px;height:26px;padding:0;border:none;background:none;cursor:pointer;}.decorbar .dwidth{font-family:inherit;font-size:var(--fs-s);border-radius:var(--rad-s);background:var(--hp-bg2,transparent);color:var(--hp-txt);border:1px solid var(--hp-muted);padding:var(--sp-2) var(--sp-3);}.decorbar .bdhint{font-size:var(--fs-s);color:var(--hp-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.decorbar .dfill{display:inline-flex;align-items:center;gap:var(--sp-2);font-size:var(--fs-s);cursor:pointer;}.decorbar .dfill input[type="checkbox"]{width:16px;height:16px;flex:none;margin:0;padding:0;}.decorbar hp-color-opacity{flex:0 0 auto;}.modes{display:inline-flex;gap:var(--sp-1);background:rgba(127,127,127,0.12);border-radius:var(--rad-l);padding:var(--sp-2);}.modetab{display:inline-flex;align-items:center;gap:var(--sp-3);border:0;background:transparent;color:var(--hp-muted);padding:var(--sp-3) 10px;border-radius:var(--rad-m);font-size:var(--fs-m);font-weight:600;cursor:pointer;font-family:inherit;transition:background-color 0.14s ease,color 0.14s ease,transform 0.14s ease;}.modetab:active{transform:scale(0.97);}.modetab ha-icon{--mdc-icon-size:15px;}.tab[data-reorderable]{cursor:grab;}.tab.dragging{cursor:grabbing;opacity:0.55;}.tab.drop-before{box-shadow:inset 2px 0 0 0 var(--primary-color,#03a9f4);}.tab.drop-after{box-shadow:inset -2px 0 0 0 var(--primary-color,#03a9f4);}.modetab .closex{--mdc-icon-size:13px;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;min-width:24px;min-height:24px;margin:-5.5px -5.5px -5.5px -3.5px;opacity:0.75;cursor:pointer;border-radius:var(--rad-s);}:host([data-pointer-hover]) .modetab .closex:hover{opacity:1;}.editbar .barclose{box-sizing:border-box;width:40px;height:40px;padding:0;margin:0;min-width:40px;min-height:40px;justify-content:center;gap:0;line-height:0;}.editbar .barclose ha-icon{flex:none;margin:0;}.modetab.active{background:var(--hp-accent);color:var(--text-primary-color,#fff);}@media (max-width:720px){.modetab .ml{display:none;}}.editbar{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:stretch;border-bottom:1px solid var(--hp-line);font-size:var(--fs-m);}.editbar-tools{display:flex;align-items:center;gap:10px;padding:var(--sp-4) var(--sp-5);flex-wrap:wrap;min-width:0;outline:none;}.editbar-end{display:flex;align-items:center;padding:var(--sp-4) var(--sp-5);border-inline-start:1px solid var(--hp-line);background:var(--card-background-color,var(--hp-bg));position:relative;z-index:2;}.tab .tabedit{--mdc-icon-size:13px;display:inline-flex;align-items:center;margin-left:var(--sp-3);opacity:0.4;}:host([data-pointer-hover]) .tab:hover .tabedit{opacity:0.9;}.tab.tabadd{padding:var(--sp-3) var(--sp-4);}.tab.tabadd ha-icon{--mdc-icon-size:15px;}.rhint{font-size:var(--fs-s);color:var(--hp-muted);margin-bottom:var(--sp-3);}.togglehint{overflow-wrap:anywhere;}.togglehint>div + div{margin-top:var(--sp-1);}.editorchrome{display:block;height:0;opacity:0;visibility:hidden;overflow:hidden;}.editorchrome:not(.open){pointer-events:none;}.editorchrome.open{height:auto;opacity:1;visibility:visible;overflow:visible;}.editorchrome.transitioning{overflow:hidden;will-change:height;pointer-events:none;}.editorchrome.transitioning .barclose{pointer-events:auto;}.editorchrome-inner{min-height:0;transform-origin:top center;}.editorchrome.transitioning .editorchrome-inner{will-change:opacity;}@media (prefers-reduced-motion:reduce){.modetab{transition:none;}}.editbar .warn{color:#ffc14d;}.editbar .sname{font-weight:600;}.editbar input{width:74px;background:transparent;border:1px solid var(--hp-line);color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-m);}.editbar label,.editbar .hint{color:var(--hp-muted);font-size:var(--fs-s);}.editbar .drawwall{display:inline-flex;align-items:center;gap:var(--sp-3);white-space:nowrap;}.editbar .wallsgroup{display:inline-flex;align-items:center;gap:10px;white-space:nowrap;}.editbar .drawwall input{width:4.2em;}.editbar .drawwall .opl{color:var(--hp-muted);font-size:var(--fs-s);}.menuwrap{position:fixed;inset:0;z-index:80;}.menu{position:fixed;background:var(--hp-bg);border:1px solid var(--hp-accent);border-radius:var(--rad-l);box-shadow:var(--shadow-2);min-width:210px;max-width:300px;overflow:hidden;transform:translate(0,8px);}.menu .hd{padding:var(--sp-4) var(--sp-5);font-weight:600;font-size:var(--fs-m);border-bottom:1px solid var(--hp-line);display:flex;align-items:center;gap:var(--sp-3);}.menu .hd ha-icon,.menu .it.all ha-icon{color:var(--hp-accent);--mdc-icon-size:16px;}.menu .it{padding:var(--sp-4) var(--sp-5);font-size:var(--fs-m);cursor:pointer;display:flex;align-items:center;gap:var(--sp-4);}.menu .it ha-icon{--mdc-icon-size:16px;color:var(--hp-muted);}:host([data-pointer-hover]) .menu .it:hover{background:rgba(127,127,127,0.15);}.menu .it.all{color:var(--hp-accent);font-weight:600;}.tip{position:fixed;pointer-events:none;background:var(--hp-bg);border:1px solid var(--hp-accent);color:var(--hp-txt);padding:var(--sp-3) 10px;border-radius:var(--rad-m);font-size:var(--fs-m);box-shadow:var(--shadow-2);z-index:60;max-width:260px;}.tip .m{color:var(--hp-muted);font-size:var(--fs-s);display:block;}`,o`.head{display:flex;align-items:center;gap:10px;padding:10px var(--sp-5);border-bottom:1px solid var(--hp-line);flex-wrap:wrap;}.title{font-size:var(--fs-l);font-weight:600;display:flex;align-items:center;gap:var(--sp-3);white-space:nowrap;}.title ha-icon{color:var(--hp-accent);--mdc-icon-size:18px;}@media (max-width:1100px){.head .count{display:none;}}@media (max-width:620px){.head{gap:var(--sp-3);padding:var(--sp-4) 10px;}.head .title{font-size:var(--fs-m);}}.count{font-size:var(--fs-s);color:var(--hp-muted);}.btn{display:inline-flex;align-items:center;gap:var(--sp-3);border:1px solid var(--hp-line);background:transparent;color:var(--hp-txt);padding:var(--sp-3) 10px;border-radius:var(--rad-m);cursor:pointer;transition:0.15s;font-family:inherit;font-size:var(--fs-m);}.btn ha-icon{--mdc-icon-size:17px;}:host([data-pointer-hover]) .btn:hover{border-color:var(--hp-accent);}.btn.on{background:var(--hp-accent);color:var(--text-primary-color,#fff);border-color:var(--hp-accent);}.btn.ghost{border:none;}.btn[disabled]{opacity:0.5;pointer-events:none;}.sunrow{display:flex;align-items:center;gap:var(--sp-5);margin:var(--sp-3) 0;}.suncol{flex:1;display:flex;flex-direction:column;gap:var(--sp-3);min-width:0;}.recoveryoverlay{position:absolute;inset:0;z-index:75;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--sp-4);padding:var(--sp-6);box-sizing:border-box;background:linear-gradient(var(--ha-card-background,var(--card-background-color,#111)),var(--ha-card-background,var(--card-background-color,#111))),#111;color:var(--primary-text-color,#fff);text-align:center;pointer-events:auto;transition:opacity 0.15s ease;}.recoveryoverlay.phase-entering,.recoveryoverlay.phase-leaving{opacity:0;}.recoveryoverlay.phase-fading-in,.recoveryoverlay.phase-opaque{opacity:1;}.recoveryoverlay ha-icon{--mdc-icon-size:44px;color:var(--hp-accent);}.editorloading{position:absolute;z-index:74;left:50%;top:50%;display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-3) var(--sp-5);border:1px solid color-mix(in srgb,var(--hp-accent) 45%,transparent);border-radius:999px;background:color-mix(in srgb,var(--ha-card-background,var(--card-background-color,#111)) 92%,transparent);color:var(--primary-text-color);box-shadow:0 6px 22px rgb(0 0 0 / 18%);transform:translate(-50%,-50%);pointer-events:none;animation:editor-loading-in 0.15s ease both;}.editorloading ha-icon{--mdc-icon-size:22px;color:var(--hp-accent);animation:editor-loading-spin 0.9s linear infinite;}@keyframes editor-loading-in{from{opacity:0;transform:translate(-50%,calc(-50% + 4px));}to{opacity:1;transform:translate(-50%,-50%);}}@keyframes editor-loading-spin{to{transform:rotate(360deg);}}@media (prefers-reduced-motion:reduce){.recoveryoverlay,.editorloading,.editorloading ha-icon{transition:none;animation:none;}}.oplock{--oplock-size:calc(var(--icon-size,2.5cqw) * 0.62);--oplock-core-size:calc(var(--oplock-size) / 1.26875);--oplock-stroke-ratio:0.01875;--oplock-stroke-width:max(1px,calc(var(--oplock-core-size) * var(--oplock-stroke-ratio)));--oplock-core-bg:light-dark(#fff,#252525);--oplock-core-fg:light-dark(#252525,#fff);--oplock-shell-stroke:light-dark(#BCBCBC,rgb(37 37 37 / 75%));--oplock-shell-shadow:0 calc(var(--oplock-core-size) * .025) calc(var(--oplock-core-size) * .05) rgb(37 40 45 / 12%),0 calc(var(--oplock-core-size) * .1) calc(var(--oplock-core-size) * .175) calc(var(--oplock-core-size) * -.025) rgb(37 40 45 / 18%);--oplock-core-shadow:0 0 0 0 transparent;pointer-events:none;position:absolute;transform:translate(-50%,-50%);width:var(--oplock-size);height:var(--oplock-size);display:grid;place-items:center;border:0;background:transparent;z-index:1;}.oplock.theme-light{--oplock-core-bg:#fff;--oplock-core-fg:#252525;--oplock-shell-stroke:#BCBCBC;}.oplock.theme-dark{--oplock-core-bg:#252525;--oplock-core-fg:#fff;--oplock-shell-stroke:rgb(37 37 37 / 75%);--oplock-core-shadow:inset 0 calc(var(--oplock-core-size) * .0125) calc(var(--oplock-core-size) * .0125) rgb(255 255 255 / 70%);}.oplock-shell{box-sizing:border-box;width:100%;height:100%;border:var(--oplock-stroke-width) solid var(--oplock-shell-stroke);border-radius:50%;background:transparent;box-shadow:var(--oplock-shell-shadow);display:grid;place-items:center;pointer-events:none;backdrop-filter:none;}.oplock-core{width:var(--oplock-core-size);height:var(--oplock-core-size);border-radius:50%;background:var(--oplock-core-bg);color:var(--oplock-core-fg);box-shadow:var(--oplock-core-shadow);display:grid;place-items:center;pointer-events:none;}.oplock ha-icon{--mdc-icon-size:calc(var(--oplock-core-size) * 0.55);display:flex;line-height:0;}.oplock.locked{--oplock-core-bg:#66D17A;--oplock-core-fg:light-dark(#fff,#252525);--oplock-shell-stroke:#66D17A;}.oplock.theme-light.locked{--oplock-core-fg:#fff;}.oplock.theme-dark.locked{--oplock-core-fg:#252525;--oplock-stroke-ratio:.025;}.oplock.unlocked{--oplock-core-bg:#F0410C;--oplock-core-fg:light-dark(#fff,#252525);--oplock-shell-stroke:#F0410C;}.oplock.theme-light.unlocked{--oplock-core-fg:#fff;}.oplock.theme-dark.unlocked{--oplock-core-fg:#252525;--oplock-stroke-ratio:.025;}.oplock.unknown{--oplock-core-fg:var(--hp-muted);}.btn.lockact{width:100%;justify-content:center;display:flex;align-items:center;gap:var(--sp-3);margin-top:var(--sp-4);}.btn.lockact.warn{color:var(--error-color,#d33);border-color:var(--error-color,#d33);}.oprow{display:flex;align-items:center;gap:var(--sp-4);padding:var(--sp-3) 0;}.oprow b{margin-left:auto;}.oprow.ok b{color:#66d17a;}.oprow.warn b{color:var(--hp-open);}.bindharow{display:flex;align-items:center;gap:var(--sp-5);flex-wrap:wrap;}.bindharow .entcheck{opacity:0.9;}.ctrlchips{display:flex;flex-wrap:wrap;gap:var(--sp-3);margin:var(--sp-2) 0;}.ctrlchip{display:inline-flex;align-items:center;gap:var(--sp-2);background:var(--hp-accent);color:var(--text-primary-color,#fff);border-radius:var(--rad-l);padding:var(--sp-2) var(--sp-4);font-size:var(--fs-s);}.ctrlchip ha-icon{--mdc-icon-size:14px;cursor:pointer;}.ctrllist{display:flex;flex-direction:column;gap:var(--sp-1);margin-top:var(--sp-2);}.ctrlopt{display:flex;align-items:center;gap:var(--sp-4);text-align:left;border:0;background:transparent;color:var(--hp-txt);padding:var(--sp-3) var(--sp-4);border-radius:var(--rad-s);cursor:pointer;font-family:inherit;font-size:var(--fs-m);}:host([data-pointer-hover]) .ctrlopt:hover{background:var(--secondary-background-color,rgba(128,128,128,0.15));}.ctrlopt .sub{color:var(--hp-muted);font-size:var(--fs-s);margin-left:auto;}.ctrlopt ha-icon{--mdc-icon-size:16px;}.ctrlstates{display:flex;flex-direction:column;gap:var(--sp-2);}.ctrlstate{display:inline-flex;align-items:center;gap:var(--sp-3);color:var(--hp-muted);}.ctrlstate.on{color:var(--hp-txt);}.ctrlstate ha-icon{--mdc-icon-size:15px;}.cardpreview{display:flex;flex-direction:column;align-items:center;gap:var(--sp-2);margin:var(--sp-4) 0 var(--sp-1);padding:10px;border:1px dashed var(--hp-muted);border-radius:var(--rad-m);}.cardpreview .cpname{font-weight:700;letter-spacing:0.04em;}.cardpreview .cpmeta{display:inline-flex;align-items:center;gap:0.3em;font-weight:600;opacity:0.85;}.cardpreview .cpmeta ha-icon{--mdc-icon-size:1.05em;}.iconauto{display:flex;align-items:center;gap:var(--sp-3);font-size:var(--fs-s);margin:var(--sp-2) 0 0;}.iconauto ha-icon{--mdc-icon-size:18px;}.iconauto span{flex:1;}.iconauto .btn{min-height:32px;padding:0 var(--sp-3);}hp-dialog .dfill{display:inline-flex;align-items:center;gap:var(--sp-3);cursor:pointer;}.wallthick-dlg{position:absolute;z-index:40;min-width:200px;transform:translate(-50%,8px);padding:10px 12px;border-radius:10px;background:var(--card-background-color,#fff);box-shadow:0 8px 28px rgba(0,0,0,.22);display:flex;flex-direction:column;gap:8px;pointer-events:auto;}.wallthick-dlg .row{display:flex;align-items:center;gap:8px;}.wallthick-dlg input[type="number"]{width:5.5em;padding:4px 6px;border:1px solid var(--divider-color,#ccc);border-radius:6px;background:var(--input-fill,transparent);color:var(--primary-text-color);}.areasel,.namein{background:var(--hp-bg);border:1px solid var(--hp-line);color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-m);font-family:inherit;}.namein{width:130px;}.habindingbanner{display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-3) var(--sp-4);margin-bottom:var(--sp-4);border:1px solid var(--warning-color,#ff9800);border-radius:var(--rad-m);background:color-mix(in srgb,var(--warning-color,#ff9800) 12%,transparent);color:var(--primary-text-color,#f1f3f6);}.habindingbanner>span{flex:1;min-width:0;}.habindingbanner>ha-icon{color:var(--warning-color,#ff9800);flex:0 0 auto;}.habindingbanner.limited{border-color:var(--secondary-text-color,#9aa0aa);background:color-mix(in srgb,var(--secondary-text-color,#9aa0aa) 10%,transparent);}.habindingbanner.limited>ha-icon{color:var(--secondary-text-color,#9aa0aa);}.srcrow{display:flex;align-items:center;gap:var(--sp-4);font-size:var(--fs-m);cursor:pointer;padding:var(--sp-1) 0;}.dispsection{margin-top:var(--sp-5) !important;padding-top:var(--sp-4);border-top:1px solid var(--hp-line);font-weight:600;color:var(--hp-txt) !important;}.colorrow{display:flex;align-items:center;gap:var(--sp-4);}.roomtemprange{display:grid;gap:8px;min-width:0;}.roomtemprange-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px;}.roomtemprange-fields{display:flex;flex-wrap:wrap;align-items:center;gap:8px;min-width:0;}.roomtemprange-fields input{flex:0 1 104px;min-width:72px;}.roomtemprange-fields input[aria-invalid='true']{border-color:var(--error-color,#db4437);}.gsrow>hp-color-opacity{min-width:min(100%,210px);justify-content:space-between;}.ripple-colorrow>hp-color-opacity{width:100%;justify-content:space-between;}.ripple-sizerow>.opl{min-width:0;}.colorrow input[type='range']{flex:1;}.colorrow .tempin{width:70px;flex:none;}hp-dialog .body .temprange .tempin{width:56px;flex:none;padding:var(--sp-2) var(--sp-3);}hp-dialog .body .colorrow .tempin{width:72px;flex:none;}.srcrow{flex-wrap:nowrap;}.srcrow ha-switch{flex:none;}.colorrow ha-slider{flex:1;min-width:0;}.srcrow>span:first-of-type{white-space:nowrap;}.colorrow .opl{color:var(--hp-muted);font-size:var(--fs-s);}.colorrow .opv{font-size:var(--fs-s);min-width:34px;text-align:right;}.markerlightgroup{min-width:0;margin:var(--sp-5) 0 0;padding:var(--sp-4);border:1px solid var(--hp-line);border-radius:var(--rad-m);}.markerlightgroup legend{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-1);padding:0 var(--sp-2);color:var(--hp-txt);font-weight:600;}.markerlightgroup legend>span{min-width:0;overflow-wrap:anywhere;}.markerlightgroup[disabled]>:not(legend){opacity:.62;}.radargroup{display:grid;gap:var(--sp-2);}.radargroup>p{margin:0;}.radargroup>label:not(.srcrow){margin-top:var(--sp-2);}.radarcoordinates{align-items:flex-end;flex-wrap:wrap;}.radarcoordinates>label{display:grid;flex:1 1 92px;gap:var(--sp-1);min-width:0;margin:0;}hp-dialog .body .radarcoordinates .tempin{box-sizing:border-box;width:100%;}.radaradditional{margin-top:var(--sp-5);}.radaradditional summary{cursor:pointer;font-weight:600;}.radaradditional .btn{margin-top:var(--sp-3);}.radarinspection{display:grid;gap:6px;padding:10px 12px;border-radius:10px;background:color-mix(in srgb,var(--primary-color) 7%,transparent);}.radarinspection code{overflow-wrap:anywhere;font-size:12px;}.radarsetup{display:grid;gap:10px;margin-top:10px;padding:12px;border:1px solid var(--hp-accent);border-radius:var(--rad-m);background:color-mix(in srgb,var(--secondary-background-color) 88%,transparent);}.radarsetup-head{display:flex;align-items:center;gap:8px;}.radarsetup-head strong{flex:1;}.radarsetup>svg{width:min(100%,460px);aspect-ratio:1;justify-self:center;border-radius:var(--rad-m);background:var(--primary-background-color);touch-action:none;cursor:crosshair;}.radarsetup .room{fill:color-mix(in srgb,var(--hp-accent) 8%,transparent);stroke:var(--divider-color);stroke-width:3;vector-effect:non-scaling-stroke;}.radarsetup .heading{stroke:var(--hp-accent);stroke-width:4;vector-effect:non-scaling-stroke;}.radarsetup .trail{fill:none;stroke:var(--success-color,#43a047);stroke-width:3;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;opacity:.55;}.radarsetup g circle{fill:var(--hp-bg);stroke:var(--hp-accent);stroke-width:3;vector-effect:non-scaling-stroke;}.radarsetup g.pending circle{stroke-dasharray:5 4;}.radarsetup g text{fill:var(--hp-txt);font-size:22px;font-weight:700;text-anchor:middle;dominant-baseline:middle;pointer-events:none;}.markerhelpfield{margin-top:var(--sp-4);}.markerhelplabel{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-1);margin-bottom:var(--sp-1);}.markerhelplabel>label{min-width:0;overflow-wrap:anywhere;}.helpfieldlabel{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-1);min-width:0;margin-top:var(--sp-3);color:var(--hp-muted);font-size:var(--fs-s);}.helpfieldlabel.compact{margin-top:0;}hp-dialog .body .helpfieldlabel>label{min-width:0;margin-top:0;overflow-wrap:anywhere;}.help-inline-label{display:inline-flex;align-items:center;flex-wrap:wrap;gap:var(--sp-1);}hp-dialog .body .help-inline-label>label{min-width:0;margin-top:0;overflow-wrap:anywhere;}.markerradios{display:grid;gap:var(--sp-1);min-width:0;}.markerlightgroup .srcrow>span:first-of-type{min-width:0;white-space:normal;overflow-wrap:anywhere;}.markerglowvalue{margin:var(--sp-3) 0;flex-wrap:wrap;}.markerglowvalue hp-color-opacity{flex:none;}.markerlightdisabled{display:flex;align-items:center;gap:var(--sp-2);margin-top:var(--sp-2) !important;}.markerlightdisabled ha-icon{--mdc-icon-size:18px;flex:none;}.markerbadgetechnical{min-width:0;margin:var(--sp-1) 0 var(--sp-2) !important;overflow-wrap:anywhere;}.markerbadgetechnical code{white-space:normal;}.planrow{display:flex;align-items:center;gap:10px;}.savedplans{display:flex;flex-direction:column;gap:var(--sp-3);max-height:240px;overflow:auto;margin:var(--sp-3) 0 var(--sp-1);padding:var(--sp-3);border:1px solid var(--hp-line);border-radius:var(--rad-m);background:var(--hp-bg2,rgba(255,255,255,0.03));flex:0 0 auto;min-height:2.6em;}.savedplan{display:flex;align-items:center;gap:10px;}.savedplan.cur{outline:1px solid var(--hp-accent);border-radius:var(--rad-s);}.savedplan img{width:56px;height:40px;object-fit:contain;border:1px solid var(--hp-line);border-radius:var(--rad-s);background:#fff;flex:none;}.savedmeta{display:flex;flex-direction:column;min-width:0;flex:1;}.savedmeta b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.savedmeta .muted{font-size:var(--fs-s);}.savedplan .btn.danger ha-icon{color:#f25a4a;}.savedplan .btn[disabled]{opacity:0.4;pointer-events:none;}.planprev{max-width:120px;max-height:70px;border:1px solid var(--hp-line);border-radius:var(--rad-s);background:#fff;}.planname{font-size:var(--fs-m);max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.planname.muted{color:var(--hp-muted);}.filebtn{cursor:pointer;}.fileupload{display:inline-flex;min-width:0;}.fileupload>input{display:none;}.btn.danger{border-color:#b3402a;color:#ff7a5c;}hp-dialog .row .spacer{flex:1;}hp-dialog .body{max-height:66vh;overflow-y:auto;}hp-confirm{display:contents;}hp-dialog .danger-confirm-body{display:flex;flex-direction:column;gap:var(--sp-4);}hp-dialog .danger-confirm-body p{margin:0;line-height:1.45;}hp-dialog .danger-confirm-object{overflow-wrap:anywhere;font-size:var(--fs-l);line-height:1.3;}.descin{width:100%;box-sizing:border-box;background:var(--hp-bg);border:1px solid var(--hp-line);color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-m);font-family:inherit;resize:vertical;min-height:92px;flex-shrink:0;line-height:1.35;}.bindsel{display:flex;flex-direction:column;gap:var(--sp-3);border:1px solid var(--hp-line);border-radius:var(--rad-m);padding:var(--sp-4);}.bindsel .opt{display:flex;align-items:center;gap:var(--sp-3);border:1px solid var(--hp-line);background:transparent;color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);cursor:pointer;font-size:var(--fs-m);font-family:inherit;}.bindsel .opt.on{background:var(--hp-accent);color:var(--text-primary-color,#fff);border-color:var(--hp-accent);}.curbind{display:flex;align-items:center;gap:var(--sp-3);font-size:var(--fs-m);color:var(--hp-txt);flex-wrap:wrap;}.curbind .ref{color:var(--hp-muted);font-size:var(--fs-s);}.vacbox .vacbtns{display:flex;gap:var(--sp-4);margin:var(--sp-3) 0;flex-wrap:wrap;}.vacdiag{display:grid;gap:4px;margin-bottom:var(--sp-3);}.vacdiag>div{display:flex;justify-content:space-between;gap:var(--sp-5);}.vacdiag>div>span{color:var(--secondary-text-color);}.vacdiag>div>b{text-align:right;overflow-wrap:anywhere;}.vacroute-missing-group{margin-top:var(--sp-4);padding-top:var(--sp-4);border-top:1px solid var(--hp-line);}.vacroute-group-title{margin:0 0 var(--sp-3);color:var(--secondary-text-color);font-size:var(--fs-m);font-weight:600;}.vacroute-missing-group .vacroute-list{margin-top:0;}.vacpicker{margin:var(--sp-3) 0;}.vacsource-warning{display:grid;gap:8px;}.vacsource-warning .btn{justify-self:start;}.vacpicker>summary{display:inline-flex;width:auto;list-style:none;cursor:pointer;}.vacpicker>summary::-webkit-details-marker{display:none;}.vacsource-list{display:grid;gap:6px;margin-top:8px;}.vacsource-list details{padding:6px 0 0;}.vacsource-list details>summary{cursor:pointer;font-weight:600;}.vacsource{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-width:0;padding:9px 10px;border:1px solid var(--divider-color);border-radius:10px;color:var(--primary-text-color);background:var(--secondary-background-color);text-align:left;cursor:pointer;}.vacsource.on{border-color:var(--accent-color);box-shadow:inset 3px 0 var(--accent-color);}.vacsource>span:first-child{min-width:0;display:grid;gap:2px;}.vacsource small{color:var(--secondary-text-color);overflow-wrap:anywhere;}.vacsource-meta{color:var(--secondary-text-color);text-align:right;font-size:0.82em;}.vacxcme pre{margin:8px 0 0;white-space:pre-wrap;user-select:text;}.vacfit{position:absolute;inset:0;width:100%;height:100%;z-index:12;overflow:visible;touch-action:none;cursor:grab;pointer-events:auto;}.vacfit:active{cursor:grabbing;}.vacfit polygon{fill:color-mix(in srgb,var(--hp-accent) 16%,transparent);stroke:var(--hp-accent);stroke-width:2;vector-effect:non-scaling-stroke;stroke-dasharray:6 4;}.vacfit text{fill:var(--hp-accent);font-size:26px;text-anchor:middle;dominant-baseline:middle;pointer-events:none;user-select:none;}.furnpalette{display:flex;flex-direction:column;max-height:38vh;border-top:1px solid var(--hp-border,rgba(255,255,255,0.12));background:var(--card-background-color,var(--hp-bg));font-size:0.85em;}.furnhd{display:flex;align-items:center;gap:6px;padding:4px 8px;font-weight:600;opacity:0.9;}.furnhd .spacer{flex:1;}.furnbody{overflow:auto;padding:0 8px 6px;}.furngroup{margin:6px 0 3px;font-size:0.85em;text-transform:uppercase;letter-spacing:0.04em;opacity:0.6;}.furnrow{display:flex;flex-wrap:wrap;gap:4px;}.furnback{min-height:34px;gap:5px;margin:2px 0 4px;}.furnitem{display:flex;flex-direction:column;align-items:center;gap:2px;width:74px;padding:4px 2px;border:1px solid transparent;border-radius:8px;background:rgba(127,127,127,0.08);color:inherit;font:inherit;font-size:0.8em;line-height:1.15;text-align:center;cursor:pointer;}:host([data-pointer-hover]) .furnitem:hover{background:rgba(127,127,127,0.18);}.furnitem.on{border-color:var(--hp-accent);background:rgba(38,166,154,0.18);}.furnprev{width:40px;height:40px;color:var(--primary-text-color,currentColor);}.furncategory{width:92px;min-height:76px;}.furncatprev{width:48px;height:48px;}.furnvariants .furnitem{min-height:74px;}.furnsize{display:flex;align-items:center;flex-wrap:wrap;gap:6px;padding:6px 8px;border-top:1px solid var(--hp-border,rgba(255,255,255,0.12));}.furnsize label{display:flex;align-items:baseline;gap:3px;opacity:0.8;}.furnsize .furnunit{opacity:0.6;font-size:0.85em;}.furnsize input{width:5.5em;padding:3px 5px;}.furnhint{opacity:0.6;}.imageupload{display:inline-flex;gap:6px;margin:4px 0 8px;cursor:pointer;}.imageupload.disabled{opacity:0.55;pointer-events:none;}.imageupload input{display:none;}.imageassets{align-items:stretch;}.imageempty{padding:12px 6px;}.imageasset{position:relative;}.imageasset .furnitem{width:104px;min-height:92px;}.imageasset img{width:64px;height:54px;object-fit:contain;border-radius:4px;background:repeating-conic-gradient(#ddd 0 25%,#fff 0 50%) 50% / 12px 12px;}.imageasset .furnitem span{max-width:96px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.imageasset .furnitem small{opacity:0.65;font-size:0.72em;}.imageassetdelete{position:absolute;top:0;right:0;min-width:30px;width:30px;min-height:30px;padding:3px;}.imagepropertypreview{display:flex;align-items:center;gap:10px;min-width:0;}.imagepropertypreview img{width:72px;height:54px;object-fit:contain;border-radius:4px;background:repeating-conic-gradient(#ddd 0 25%,#fff 0 50%) 50% / 12px 12px;}.imagepropertypreview span{overflow-wrap:anywhere;}.vacfitdot{fill:var(--hp-accent);pointer-events:none;}.vacfithandle{fill:transparent;stroke:none;cursor:nwse-resize;}.vacfitknob{fill:var(--hp-bg);stroke:var(--hp-accent);stroke-width:2;vector-effect:non-scaling-stroke;pointer-events:none;}.vaccalbar{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);display:flex;gap:var(--sp-5);align-items:center;background:var(--hp-bg);color:var(--hp-txt);border:1px solid var(--hp-accent);border-radius:var(--rad-l);padding:10px var(--sp-5);z-index:60;box-shadow:var(--shadow-2);}.candlist{max-height:160px;overflow-y:auto;border-top:1px solid var(--hp-line);flex:0 0 auto;min-height:2.6em;}.cand{display:flex;justify-content:space-between;gap:var(--sp-4);padding:var(--sp-3) var(--sp-4);cursor:pointer;border-radius:var(--rad-s);font-size:var(--fs-m);}:host([data-pointer-hover]) .cand:hover{background:rgba(127,127,127,0.15);}.cand.sel{background:var(--hp-accent);color:var(--text-primary-color,#fff);}.cand .cs{color:var(--hp-muted);font-size:var(--fs-s);white-space:nowrap;}.opening-entity-candidate{width:100%;border:0;background:transparent;color:inherit;font:inherit;text-align:left;}.opening-entity-candidate.sel{background:var(--hp-accent);color:var(--text-primary-color,#fff);}.opening-entity-empty{cursor:default;}.cand.sel .cs{color:var(--text-primary-color,#fff);opacity:0.85;}.cand.muted{color:var(--hp-muted);cursor:default;}.pdfedit{display:flex;flex-wrap:wrap;gap:var(--sp-3);align-items:center;}.pdftag{display:inline-flex;align-items:center;gap:var(--sp-2);border:1px solid var(--hp-line);border-radius:var(--rad-s);padding:var(--sp-2) var(--sp-3);font-size:var(--fs-s);}.pdftag a{color:var(--hp-txt);text-decoration:none;max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.pdftag .x{--mdc-icon-size:15px;cursor:pointer;color:var(--hp-muted);}:host([data-pointer-hover]) .pdftag .x:hover{color:#ff7a5c;}.entlist{display:flex;flex-direction:column;gap:var(--sp-2);margin-bottom:10px;}.entrow{display:flex;align-items:center;gap:var(--sp-4);padding:var(--sp-3) var(--sp-4);border-radius:var(--rad-m);background:var(--secondary-background-color,rgba(128,128,128,0.12));}.entrow ha-icon{--mdc-icon-size:20px;color:var(--hp-muted);}.entrow.on ha-icon{color:var(--hp-accent);}.entrow .en{flex:1;font-size:var(--fs-m);}.entrow .ev{font-size:var(--fs-m);color:var(--hp-muted);}.entbtn{min-width:74px;min-height:32px;padding:var(--sp-2) var(--sp-5);border:1px solid var(--hp-muted);border-radius:999px;background:transparent;color:var(--hp-txt);font:inherit;font-size:var(--fs-m);cursor:pointer;}.entbtn.on{background:var(--hp-accent);border-color:var(--hp-accent);color:var(--text-primary-color,#fff);font-weight:600;}.inforow{display:flex;gap:10px;font-size:var(--fs-m);margin:var(--sp-2) 0;}.inforow .k{color:var(--hp-muted);min-width:84px;}.inforow a{color:var(--hp-accent);word-break:break-all;}.infodesc{font-size:var(--fs-m);white-space:pre-wrap;margin-top:var(--sp-3);}.infodesc.muted{color:var(--hp-muted);}.pdflist{display:flex;flex-direction:column;gap:var(--sp-2);}.pdf{display:inline-flex;align-items:center;gap:var(--sp-2);color:var(--hp-accent);text-decoration:none;}ha-icon-picker{display:block;}.floorrow{display:flex;align-items:center;gap:var(--sp-4);padding:var(--sp-3) var(--sp-2);font-size:var(--fs-m);cursor:pointer;}.floorrow .floorlvl{color:var(--hp-muted);font-size:var(--fs-s);border:1px solid var(--hp-line);border-radius:var(--rad-s);padding:0 var(--sp-3);}.rtest{display:flex;align-items:center;gap:var(--sp-4);margin-bottom:var(--sp-4);}.rtest .namein{flex:1;}.rtest ha-icon{color:var(--hp-accent);}.rtesticon{font-size:var(--fs-s);color:var(--hp-muted);}.rrow{display:flex;align-items:center;gap:var(--sp-3);margin:var(--sp-1) 0;}.rrow .rpat{flex:2;}.rrow .ricon{flex:1.4;}.rrow .rpat.bad{border-color:#ff7a5c;}.rrow .rprev{--mdc-icon-size:18px;color:var(--hp-txt);min-width:18px;}.rrow .ract{--mdc-icon-size:16px;color:var(--hp-muted);cursor:pointer;}:host([data-pointer-hover]) .rrow .ract:hover{color:var(--hp-txt);}:host([data-pointer-hover]) .rrow .ract.del:hover{color:#ff7a5c;}.gsrow .gsl{min-width:150px;font-size:var(--fs-m);color:var(--hp-muted);}.optimize-live{display:grid;justify-items:start;gap:var(--sp-2);margin-bottom:var(--sp-3);}.optimize-live .alignmsg,.optimize-live .rhint{margin-bottom:0;}.optimize-cleanup{min-height:44px;}.optimize-selected{color:var(--hp-txt);}.optimize-details{margin-top:var(--sp-3);color:var(--hp-muted);font-size:var(--fs-s);overflow-wrap:anywhere;}.optimize-details>summary{width:fit-content;color:var(--hp-txt);cursor:pointer;font-weight:600;}.optimize-details>summary:focus-visible{outline:2px solid var(--hp-accent);outline-offset:3px;border-radius:var(--rad-s);}.optimize-details ul{margin:var(--sp-3) 0;padding-inline-start:22px;}.optimize-details li + li{margin-top:var(--sp-1);}.btn.alignall{width:100%;justify-content:center;}.backupactions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--sp-3);}.backupactions .btn{justify-content:center;min-width:0;}.backupupload{display:inline-flex;min-width:0;}.backupupload>.btn{width:100%;justify-content:center;}.backupupload input{display:none;}.backupbody{min-width:0;}.backupplanonly{margin-inline-start:var(--sp-4) !important;align-items:flex-start !important;}.backupplanonly>span:first-of-type{display:grid;gap:2px;white-space:normal;}.backupplanonly small{color:var(--secondary-text-color);line-height:1.35;}.backupplanonlystatus{color:var(--hp-accent) !important;font-weight:700;}.backupfile,.backupsummary,.backupcontent{display:flex;flex-direction:column;min-width:0;gap:var(--sp-1);}.backupfile b,.backupcontent span{overflow-wrap:anywhere;}.backupfile span,.backupsummary span,.backupcontent span{color:var(--hp-muted);font-size:var(--fs-s);}.backupcounts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--sp-2) var(--sp-4);font-size:var(--fs-s);}.backupwarn,.backuperror{border-radius:var(--rad-s);padding:var(--sp-3);font-size:var(--fs-s);line-height:1.45;overflow-wrap:anywhere;}.backupwarn{background:color-mix(in srgb,var(--hp-accent) 12%,transparent);}.backuperror{background:rgba(179,64,42,.16);color:#ff7a5c;}.backupdetails{border:1px solid var(--hp-line);border-radius:var(--rad-s);padding:var(--sp-2) var(--sp-3);font-size:var(--fs-s);}.backupdetails summary{cursor:pointer;font-weight:700;}.backupdetails>div{display:grid;gap:var(--sp-1);padding-block-start:var(--sp-2);}.backupdetails code{overflow-wrap:anywhere;color:var(--hp-muted);}.backupchoices{display:flex;flex-direction:column;gap:var(--sp-2);border:1px solid var(--hp-line);border-radius:var(--rad-s);min-width:0;}.backupchoices label{margin:0 !important;display:flex;gap:var(--sp-2);}.backupconfirm{align-items:flex-start !important;}.backupconfirm>span:first-of-type{min-width:0;white-space:normal;overflow-wrap:anywhere;}@media (max-width:520px){.backupactions,.backupcounts{grid-template-columns:1fr;}}.aboutver{font-size:var(--fs-s);color:var(--hp-muted);margin:var(--sp-2) 0 var(--sp-3);}.aboutlink{display:flex;align-items:center;gap:var(--sp-3);width:fit-content;color:var(--hp-accent);text-decoration:none;font-size:var(--fs-m);padding:var(--sp-1) 0;}:host([data-pointer-hover]) .aboutlink:hover{text-decoration:underline;}.aboutlink ha-icon{--mdc-icon-size:18px;line-height:1;}hp-dialog .supportbody{min-width:0;overflow-x:hidden;gap:var(--sp-5);}.supportsection{display:grid;min-width:0;gap:var(--sp-2);}.supportsection + .supportsection{padding-top:var(--sp-4);border-top:1px solid var(--hp-line);}.supportsection h3{margin:0;color:var(--hp-txt);font-size:var(--fs-m);}.supportlinks,.supportactions{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-2) var(--sp-4);min-width:0;}.supportform>label:not(.srcrow){margin-top:var(--sp-2);color:var(--hp-muted);font-size:var(--fs-s);}.supportmessage,.supportraw{width:100%;min-width:0;box-sizing:border-box;resize:vertical;border:1px solid var(--hp-line);border-radius:var(--rad-s);padding:var(--sp-3);color:var(--hp-txt);background:color-mix(in srgb,var(--card-background-color,var(--hp-bg)) 92%,var(--hp-txt));font:inherit;}.supportmessage{min-height:120px;background:var(--hp-bg);}.supportraw{min-height:220px;margin-top:var(--sp-2);resize:none;white-space:pre;overflow:auto;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;}.supportattach{min-width:0;align-items:flex-start;margin:var(--sp-2) 0 0 !important;}.supportattach>span:first-of-type{min-width:0;white-space:normal;overflow-wrap:anywhere;}.supportwarning,.supportstatus,.supportupdate{display:flex;align-items:flex-start;gap:var(--sp-2);min-width:0;margin:0;padding:var(--sp-3);border-radius:var(--rad-s);background:color-mix(in srgb,var(--hp-accent) 14%,transparent);overflow-wrap:anywhere;font-size:var(--fs-s);line-height:1.45;}.supportwarning ha-icon,.supportstatus ha-icon,.supportupdate ha-icon{flex:none;color:var(--hp-accent);--mdc-icon-size:20px;}.supportpreview,.supportmanual,.supporterror,.supportsuccess{display:grid;min-width:0;gap:var(--sp-2);padding:var(--sp-3);border:1px solid var(--hp-line);border-radius:var(--rad-s);}.supportsummary{font-weight:600;overflow-wrap:anywhere;}.supporthash{display:grid;min-width:0;gap:var(--sp-1);color:var(--hp-muted);font-size:var(--fs-s);}.supporthash code{overflow-wrap:anywhere;color:var(--hp-txt);}.supportpreview details{min-width:0;}.supportpreview summary{cursor:pointer;color:var(--hp-accent);}.supportprivacy{margin:0 !important;line-height:1.45;}.supporterror{background:color-mix(in srgb,var(--error-color,#db4437) 12%,transparent);border-color:color-mix(in srgb,var(--error-color,#db4437) 45%,var(--hp-line));}.supportsuccess{background:color-mix(in srgb,var(--success-color,#43a047) 12%,transparent);border-color:color-mix(in srgb,var(--success-color,#43a047) 45%,var(--hp-line));}.supportfooter{flex-wrap:wrap;}@media (max-width:520px){hp-dialog .supportbody{padding-inline:var(--sp-4);}hp-dialog .supportfooter{padding-inline:var(--sp-4);}.supportactions .btn,.supportactions .aboutlink{max-width:100%;}}hp-dialog .body{padding:var(--sp-5) var(--sp-6);display:flex;flex-direction:column;gap:var(--sp-3);}hp-dialog .tapconfirm-body{min-width:0;overflow-x:hidden;}hp-dialog .tapconfirm-body p{max-width:100%;min-width:0;margin:0;overflow-wrap:anywhere;white-space:normal;}hp-dialog .tapconfirm-line{color:var(--hp-muted);}hp-dialog .body label{font-size:var(--fs-s);color:var(--hp-muted);margin-top:var(--sp-3);}hp-dialog .body .namein,hp-dialog .body .areasel{width:100%;box-sizing:border-box;}hp-dialog.roomdialog .body{min-width:0;overflow-x:hidden;}hp-dialog.roomdialog .body>*{min-width:0;max-width:100%;box-sizing:border-box;}hp-dialog.roomdialog .srcrow{min-width:0;align-items:flex-start;}hp-dialog.roomdialog .srcrow>span:first-of-type{min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.35;}hp-dialog.roomdialog .dropbtn>b,hp-dialog.roomdialog .dropbtn>.ref{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}hp-dialog .row{display:flex;justify-content:flex-end;gap:var(--sp-4);width:100%;min-width:0;box-sizing:border-box;padding:var(--sp-5) var(--sp-6);border-top:1px solid var(--hp-line);}hp-dialog>.row[slot='footer'] button{min-height:44px;}hp-dialog .row.dialog-action-footer{align-items:center;justify-content:flex-start;flex-wrap:wrap;row-gap:var(--sp-4);}hp-dialog .dialog-action-group{display:flex;flex:0 1 auto;flex-wrap:wrap;align-items:center;gap:var(--sp-4);max-width:100%;min-width:0;}hp-dialog .dialog-action-group .btn{flex:0 0 auto;min-height:44px;}hp-dialog .dialog-action-danger{margin-right:auto;}hp-dialog .dialog-action-commit{margin-left:auto;justify-content:flex-end;}hp-dialog .row.markerfooter{justify-content:space-between;align-items:center;flex-wrap:wrap;}hp-dialog .row.roomfooter{align-items:center;flex-wrap:wrap;}hp-dialog .row.infofooter{align-items:center;justify-content:flex-start;flex-wrap:wrap;gap:var(--sp-3);}hp-dialog .row.infofooter .btn{flex-shrink:0;}hp-dialog .row.infofooter .infofooter-close{margin-left:auto;}@media (max-width:480px){hp-dialog .row.infofooter{padding:var(--sp-4) var(--sp-5);}}.markeractions,.markersaveactions{display:flex;align-items:center;gap:var(--sp-4);}.markeractions:empty{display:none;}.markersaveactions{margin-left:auto;}.device-inbox{display:flex;flex-direction:column;gap:var(--sp-4);padding:var(--sp-5) var(--sp-6);min-width:0;}.device-inbox-dialog{--hp-dialog-wide-width:920px;}.device-inbox-head{display:grid;grid-template-columns:minmax(180px,1fr) auto;align-items:center;gap:var(--sp-4);}.device-inbox-search{width:100%;min-width:0;box-sizing:border-box;border:1px solid var(--hp-line);border-radius:var(--rad-m);background:transparent;color:var(--hp-txt);font:inherit;padding:11px 14px;}.device-inbox-tabs{display:flex;gap:var(--sp-2);overflow-x:auto;scrollbar-width:thin;padding-bottom:var(--sp-1);}.device-inbox-tabs button{flex:0 0 auto;border:1px solid var(--hp-line);border-radius:999px;background:transparent;color:var(--hp-txt);font:inherit;padding:8px 12px;cursor:pointer;}.device-inbox-tabs button.on{border-color:var(--hp-accent);background:color-mix(in srgb,var(--hp-accent) 18%,transparent);}.device-inbox-tabs button span{color:var(--hp-muted);margin-inline-start:4px;}.device-inbox-discovery{margin:8px 0;padding:8px 10px;border:1px solid var(--divider-color,#e0e0e0);border-radius:8px;}.device-inbox-discovery summary{cursor:pointer;font-weight:600;}.device-inbox-discovery .srcrow{display:flex;gap:6px;align-items:center;margin:8px 0;}.device-inbox-excluded{display:flex;flex-wrap:wrap;gap:6px;align-items:center;}.device-inbox-excluded>span{font-weight:500;}.device-inbox-chips{display:flex;flex-wrap:wrap;gap:4px;}.device-inbox-chips .chip{display:inline-flex;align-items:center;gap:2px;padding:1px 6px;border-radius:10px;background:var(--secondary-background-color,#f0f0f0);font-size:12px;}.device-inbox-chips .chip button{border:none;background:none;cursor:pointer;padding:0 2px;color:var(--secondary-text-color,#666);}.device-inbox-excluded input[type="text"]{flex:1 1 140px;min-width:120px;padding:4px 6px;border:1px solid var(--divider-color,#e0e0e0);border-radius:6px;background:var(--card-background-color,#fff);color:var(--primary-text-color,#212121);}.device-inbox-preview{margin:8px 0 4px;font-size:13px;opacity:0.85;}.device-inbox-filters{display:flex;flex-wrap:wrap;gap:var(--sp-4) var(--sp-6);color:var(--hp-muted);}.device-inbox-filters label{display:inline-flex;align-items:center;gap:var(--sp-2);cursor:pointer;}.device-inbox-filter-help{display:inline-flex;align-items:center;gap:var(--sp-1);min-width:0;}.device-inbox-results{display:grid;gap:var(--sp-3);min-width:0;}.device-inbox-row{display:grid;grid-template-columns:42px minmax(180px,1fr) minmax(180px,auto);align-items:center;gap:var(--sp-4);min-width:0;border:1px solid var(--hp-line);border-radius:var(--rad-m);padding:var(--sp-4);background:color-mix(in srgb,var(--hp-txt) 3%,transparent);}.device-inbox-icon{--mdc-icon-size:28px;color:var(--hp-txt);justify-self:center;}.device-inbox-copy{min-width:0;}.device-inbox-name{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-2);}.device-inbox-new{border-radius:999px;background:var(--hp-accent);color:var(--text-primary-color,#fff);font-size:var(--fs-s);padding:2px 7px;}.device-inbox-meta,.device-inbox-reason,.device-inbox-copy code{display:block;color:var(--hp-muted);font-size:var(--fs-s);overflow-wrap:anywhere;white-space:normal;}.device-inbox-status{color:var(--error-color,#db4437);margin-inline-start:var(--sp-2);}.device-inbox-actions{display:flex;justify-content:flex-end;align-items:center;flex-wrap:wrap;gap:var(--sp-2);}.device-inbox-actions .btn{min-height:36px;padding:7px 10px;}.device-inbox-menu{position:relative;}.device-inbox-menu summary{list-style:none;cursor:pointer;}.device-inbox-menu summary::-webkit-details-marker{display:none;}.device-inbox-menu-items{position:absolute;z-index:2;inset-inline-end:0;top:calc(100% + var(--sp-1));display:grid;gap:var(--sp-1);min-width:180px;padding:var(--sp-2);border:1px solid var(--hp-line);border-radius:var(--rad-m);background:var(--hp-panel,var(--card-background-color,#fff));box-shadow:0 8px 24px rgba(0,0,0,.22);}.device-inbox-menu-items .btn{justify-content:flex-start;width:100%;}.device-inbox-empty{color:var(--hp-muted);text-align:center;padding:var(--sp-8);}.device-inbox-more{align-self:center;}@media (max-width:680px){.device-inbox{padding:var(--sp-4);}.device-inbox-head{grid-template-columns:minmax(0,1fr);}.device-inbox-head .btn{justify-self:stretch;}.device-inbox-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));overflow-x:visible;}.device-inbox-tabs button{min-width:0;overflow-wrap:anywhere;}.device-inbox-row{grid-template-columns:36px minmax(0,1fr);}.device-inbox-actions{grid-column:1 / -1;justify-content:flex-start;}}`];var sp={"editor.context_actions":"Actions: {object}","editor.tool_options":"Tool options: {tool}","editor.palette":"Palette: {tool}","editor.open_group":"Tool group: {group}","editor.group_active":"{group} — active: {item}","editor.disabled_action":"{action} is unavailable: {reason}","editor.loading":"Loading editor…","editor.loading_aria":"The plan editor is loading","editor.load_failed":"Could not load the editor.","editor.refresh_advice":"Refresh the page and try again.","editor.retry_advice":"Check your connection and press again.","version_mismatch.title":"House Plan versions do not match","version_mismatch.body":"If Home Assistant is still restarting, let it finish, then reload this page.","version_mismatch.frontend":"Card","version_mismatch.backend":"Integration","version_mismatch.reload":"Reload page","color_picker.title":"Color picker","color_picker.hue":"Hue","color_picker.saturation":"Saturation","color_picker.value":"Brightness","color_picker.hex":"Hex color","color_picker.invalid_hex":"Enter a 3- or 6-digit hex color","color_picker.confirm":"OK","btn.properties":"Properties","btn.keep_as_walls":"Keep as walls","btn.delete_room_keep_walls":"Delete room, keep walls","btn.delete_room_with_walls":"Delete room and walls","title.markup_select":"Select and edit walls and columns","title.markup_column":"Column: click a grid point to place a square column","markup.partition":"Partition","markup.column":"Column","markup.hint_column":"click a grid point to place a square column","history.wall_segment":"Add wall segment","history.column_add":"Add column","history.physical_edit":"Change physical object","history.physical_delete":"Delete physical object","history.physical_move":"Move physical object","history.wall_face_batch":"Create rooms from walls","toast.column_duplicate":"A column with the same centre and outer size already exists","physical.partition_properties":"Partition properties","physical.column_properties":"Column properties","physical.shape":"Shape","physical.square":"Square","physical.circle":"Circle","physical.diameter":"Diameter","physical.side":"Side","physical.rotation":"Rotation angle","physical.length":"Length","physical.allowed_range":"Allowed: {min}–{max} {unit}","physical.column_size_title":"Outer side of the square column placed by the click (1–150 cm).","card.title":"House plan","count.devices":"{n} dev.","empty.no_spaces":"No spaces yet.","nav.spaces":"House Plan spaces","empty.add_first":"Add the first space and upload a floor plan.","empty.read_only":"No spaces are configured. Ask an administrator to add one.","empty.install":'Install the House Plan integration and add it in "Devices & services".',"btn.add_space":"Add space","btn.cancel":"Cancel","btn.save":"Save","btn.close":"Close","btn.delete":"Delete","btn.copy":"Copy","btn.edit":"Edit","btn.open_in_ha":"Open in HA","btn.reset":"Reset","btn.attach":"Attach…","btn.upload":"Upload…","btn.replace":"Replace…","title.zoom_in":"Zoom in","title.zoom_out":"Zoom out","title.zoom_fit":"Fit all","title.configure_space":"Configure space","title.add_space":"Add space","title.markup_add":"Walls: draw a continuous chain; each accepted segment is saved independently. Shift locks to 45°","title.markup_merge":"Merge: click one room, then the neighbour it shares a wall with","title.markup_split":"Split a room: click the room, then two points on its walls","title.markup_delroom":"Delete room: click inside a room and confirm","title.need_plan":"Upload a floor-plan image","markup.add":"Walls","markup.merge":"Merge","markup.split":"Split","markup.resize":"Resize","title.markup_resize":"Resize rooms: drag an available horizontal or vertical wall handle","markup.hint_resize":"drag an available wall handle · the wall stops at the first unsafe position · Esc cancels · Ctrl+Z — undo","resize.disabled.diagonal":"This wall is angled; Resize supports only horizontal and vertical walls","resize.disabled.side-angle":"An adjoining wall is angled; Resize requires both adjoining walls to meet this wall at right angles","resize.disabled.duplicate-physical-wall":"A separate partition or column overlaps this wall; remove or move it before resizing","resize.disabled.partial-shared":"A neighbouring room uses only part of this wall, so it cannot be moved safely as one shared wall","resize.disabled.unequal-shared":"The neighbouring room uses different endpoints or wall length, so the walls cannot move together safely","resize.disabled.multiple-rooms":"Moving this wall would affect more than two rooms","resize.disabled.thickness-conflict":"The wall thickness cannot be preserved safely","resize.disabled.opening-conflict":"An opening on this wall cannot be moved safely","resize.disabled.invalid-geometry":"This wall cannot be resized without changing the plan structure","resize.limit_stopped":"Wall stopped: the next step would break a junction limit","resize.commit_failed":"Resize was cancelled because the final plan did not pass the geometry check","resize.preview_failed":"Resize stopped at the last safe position because the plan geometry could not be preserved","markup.opening":"Opening","markup.delete_room":"Delete room","history.undo":"Undo","history.redo":"Redo","history.undo_named":"Undo: {name} (Ctrl+Z)","history.redo_named":"Redo: {name} (Ctrl+Shift+Z / Ctrl+Y)","history.undo_empty":"Nothing to undo","history.redo_empty":"Nothing to redo","history.undone":"Undone: {name}","history.redone":"Redone: {name}","history.add_room":"Create room","history.split_room":"Split room","history.merge_rooms":"Merge rooms","history.resize_room":"Resize room","history.wall_thickness":"Change wall thickness","history.add_opening":"Add door or window opening","history.edit_opening":"Edit opening","history.move_opening":"Move opening","history.delete_opening":"Delete opening","history.delete_room_keep_walls":"Delete room, keep walls","history.delete_room_with_walls":"Delete room and walls","history.decor_add":"Add decor object","history.decor_edit":"Edit decor object","history.decor_move":"Move decor object","history.decor_transform":"Transform decor object","history.decor_delete":"Delete decor object","history.backdrop_transform":"Transform plan backdrop","history.device_move":"Move {name}","history.device_stale":"Device position history is no longer applicable and was cleared","opening.new":"New opening","opening.edit":"Opening","opening.door":"Door","opening.window":"Window","opening.gate":"Gate","opening.passage":"Open passage","opening.passage_binding_warning":"Saving will remove the open/close sensor and lock.","opening.invalid_passage_fields":"The open passage on plan “{room}” has unsupported settings: {fields}.","opening.type_label":"Type","opening.length_label":"Length, cm","opening.contact_label":"Open/close sensor","opening.lock_label":"Lock","opening.none":"— none —","opening.search_ph":"Search: name or entity id…","opening.invert":"Invert open/closed","opening.flip_h":"Hinge on the other jamb","opening.flip_v":"Opens to the other side","opening.open":"Open","opening.closed":"Closed","opening.locked":"Locked","opening.unlocked":"Unlocked","opening.state_unknown":"unavailable","opening.no_entities":"No sensors bound — a static symbol on the plan.","toast.opening_no_wall":"Click next to a room wall or independent wall","opening.host_partition":"Independent wall","opening.partition_orphan":"The independent wall for this opening no longer exists","opening.partition_jamb_margin":"Leave at least {distance} between the opening and the end of the wall","opening.rebind_partition":"Attach to another independent wall","confirm.delete_partition_openings_title":"Delete wall and openings?","confirm.delete_partition_openings_body":"This wall contains {count} opening(s). They will be deleted together.","confirm.delete_partition_openings_item":"• {type}, {length}","markup.hint_points":"points: {n} · Shift — 45° steps · Esc — finish chain · Ctrl+Z — undo a point · closing an area offers a room","markup.hint_start":"click a grid dot to start a wall chain","tip.lqi":"average zigbee signal:","tip.area":"area: {value}","info.device_header":"Device on the plan","info.model":"Model","info.state":"State","info.link":"Link","info.manuals":"Manuals","info.none":"No additional information","marker.new_device":"New device","marker.name_label":"Name (shown on the plan)","marker.name_ph":"Name","marker.binding_label":"Bind to an HA device","marker.binding_disabled":"disabled in Home Assistant","marker.virtual_option":"Virtual device (no binding)","marker.search_ph":"Search device / group…","marker.nothing_found":"nothing found","marker.room_label":"Room","marker.room_override":" (override placement)","marker.room_choose":"— select a room —","marker.room_auto":"— by device area (auto) —","marker.icon_label":"Icon","marker.icon_ph":"mdi:… (empty = auto)","marker.display_label":"Display","display.badge":"Icon + state","display.icon_ripple":"Icon + state and activity","display.static_icon":"Always static icon","marker.display_hint_badge":"The icon and dynamic plate show device state without the ordinary activity pulse. Red alarms remain visible.","marker.display_hint_icon_ripple":"The icon, dynamic plate and pulse show a short pulse for events and a continuous pulse for work, motion or presence. Red alarms have separate priority.","marker.display_hint_value":"A selected or automatically resolved Home Assistant value replaces the icon while the plate continues to show state. Red alarms remain visible.","marker.display_hint_static_icon":"The theme-aware shell and icon always stay the same. State, activity, unavailability and alarms do not change the face.","marker.static_alarm_warning":"This device can report alarms. Static display hides the marker's visual alarm indication.","marker.preview.title":"Display preview","marker.preview.actual":"Now","marker.preview.example":"Example","marker.preview.integration":"Provided by","marker.preview.source":"Display source","marker.preview.current_state":"Current state","marker.preview.result":"On the plan","marker.preview.details":"Source details","marker.preview.select_source":"Choose a Home Assistant device or entity to see its actual display.","marker.preview.unknown_provider":"Unknown integration","marker.preview.virtual_provider":"House Plan · virtual device","marker.preview.no_source":"No active source","marker.preview.no_state":"No current state","marker.preview.mixed_states":"Several different states","marker.preview.multiple_sources":"{n} sources","marker.preview.more_sources":"+{n} more","marker.preview.scaled":"The preview is scaled to {n}% to fit. The saved size is unchanged.","marker.preview.demo_short":"Show short activity","marker.preview.demo_continuous":"Show continuous activity","marker.preview.stop_continuous":"Stop continuous activity","marker.preview.demo_short_notice":"Short activity example; the actual device state is unchanged.","marker.preview.demo_continuous_notice":"Continuous activity example; the actual device state is unchanged.","marker.preview.demo_already_visible":"The current state already shows a real activity or alarm effect.","marker.preview.reduced_motion":"System reduced-motion is enabled, so ordinary activity is shown as a dot.","marker.preview.reason.neutral":"Neutral dark plate","marker.preview.reason.working":"Yellow plate: the device is working now","marker.preview.reason.working_activity":"Yellow plate and activity effect: the device is working now","marker.preview.reason.open":"Orange plate: physically open or unlocked","marker.preview.reason.cover_icon_state":"Neutral plate; the cover entity controls the displayed state and icon","marker.preview.reason.presence":"Activity effect while presence is detected","marker.preview.reason.event":"Short activity effect after a detected event","marker.preview.reason.transition":"Activity effect while the device is moving or changing state","marker.preview.reason.media_neutral":"Media devices stay on a neutral dark plate while available","marker.preview.reason.unavailable":"Subdued neutral plate: unavailable or off","marker.preview.reason.alarm":"Red alarm plate; alarm indication is always shown","marker.preview.reason.live_states_disabled":"Live-state styling is disabled for this card","marker.preview.reason.value_no_state":"No usable state value; the icon is shown instead","marker.preview.reason.value_ambiguous_sources":"Several possible value sources; the icon is shown instead","marker.preview.reason.value_non_scalar":"The source did not return a simple value; the icon is shown instead","marker.preview.reason.value_virtual":"A virtual device has no Home Assistant value; the icon is shown instead","marker.preview.reason.vacuum_live_plan_only":"Live vacuum position and trail are available only on the full plan","marker.preview.reason.hidden_design_preview":"The device is hidden on the plan; this design preview remains visible","marker.preview.reason.composite_power_source":"State comes from the device Power entity; auxiliary switches are ignored","marker.preview.reason.activity_display_disabled":"The selected display mode does not show ordinary activity effects","marker.preview.reason.ha_disabled":"The Home Assistant binding is disabled and will be hidden on the plan","marker.preview.reason.orphaned":"The saved Home Assistant binding can no longer be found","marker.preview.reason.static_icon":"Static mode: device state does not change the icon","marker.activity_color":"Activity pulse color","marker.ripple_size":"Activity pulse size","marker.activity_alarm_note":"Color and size affect ordinary activity only and do not change red alarms.","marker.pulse_a11y_alarm":"Alarm","marker.pulse_a11y_event":"Recent event","marker.pulse_a11y_presence":"Presence detected","marker.pulse_a11y_transition":"Changing state","marker.pulse_a11y_running":"Working","marker.state_a11y_neutral":"Default state","marker.state_a11y_working":"Working","marker.state_a11y_open":"Open","marker.state_a11y_locked":"Locked","marker.state_a11y_unlocked":"Unlocked","marker.state_a11y_alarm":"Alarm","marker.state_a11y_unavailable":"Unavailable","marker.lqi_a11y_low":"LQI {value}, low signal","marker.lqi_a11y_mid":"LQI {value}, medium signal","marker.lqi_a11y_high":"LQI {value}, high signal","marker.size_label":"Icon size / rotation","marker.angle_label":"Rotate","marker.model_label":"Model","marker.model_ph":"e.g. Aqara T&H","marker.link_label":"Link","marker.desc_label":"Description","marker.desc_ph":"Notes, specs…","marker.manuals_label":"Manuals (PDF etc.)","marker.sub_device":"device","marker.sub_z2m_group":" · Z2M group","marker.sub_group":"group","marker.sub_helper":"helper","space.new":"New space","space.copy_title":"Copy space","space.copy_name":"New space name","space.copy_fallback":"Space","space.copy_create":"Create copy","space.copy_optimize_title":"Optimize before copying?","space.copy_optimize_body":"Before creating “{name}”, House Plan must optimize the entire plan, including other spaces. Continue?","space.copy_optimize_confirm":"Optimize and copy","space.copy_error_changed":"The plan changed while confirmation was open. Review it and try again.","space.copy_error_source_missing":"The source space no longer exists. Reopen its settings and try again.","space.copy_error_source_invalid":"House Plan could not validate every wall in this space. Fix the source space and try again.","space.copy_error_spaces_limit":"House Plan already has the maximum number of spaces.","space.copy_error_partitions_limit":"This space has too many walls to copy.","space.copy_error_openings_limit":"This space has too many openings to copy.","space.copy_error_decor_limit":"This space has too many background objects to copy.","space.copy_error_columns_limit":"This space has too many columns to copy.","space.copy_error_opening_host":"One of the openings is no longer attached to a wall. Fix or delete it before copying.","space.copy_error_geometry":"The copy would create unsafe wall geometry. Fix the source space and try again.","space.copy_error_optimize_geometry":"Copy stopped because optimizing the entire plan is unsafe for one of the spaces.","space.header":"Space","space.title_label":"Title","space.title_ph":"e.g. Garage","space.plan_label":"Floor plan (background)","space.no_plan":"no plan image","space.plan_alt":"plan","room.new":"New room","room.name_label":"Display name","room.name_ph":"e.g. Terrace","room.area_label":"Home Assistant area (unassigned)","room.no_area_option":"— no area —","room.default_name":"Room","device.unnamed":"unnamed","device.light_group":"light group","device.fallback":"device","device.virtual":"virtual device","confirm.delete_room_title":'Delete room "{name}"?',"confirm.delete_room_body":"Choose whether the room's exclusive physical walls should remain. Walls shared with another room are always kept.","confirm.remove_marker_title":"Delete device from the plan?","confirm.remove_marker_body":"The device will disappear completely and stop contributing to plan data. You can add it again later.","confirm.erase_decor":"Erase the {kind} object? You can undo this action from the editor history.","confirm.delete_space_title":"Delete space?","confirm.delete_space_body":"The space, all its rooms and all its plan markup will be deleted.","confirm.delete_space_vac_routes":"Robot map assignments will also be removed: {count}.","space.delete_blocked":"This space is still used by {n} device(s). Move them to another space or delete them first.","toast.pos_save_failed":"Failed to save position: {err}","toast.no_entity":"The device has no suitable entity","toast.ha_disabled_action":"A Home Assistant object that is disabled cannot be used on the plan.","toast.ha_disabled_show_device":"A device disabled in Home Assistant cannot be shown on the plan. Enable it in Home Assistant first.","toast.ha_disabled_show_entity":"An entity disabled in Home Assistant cannot be shown on the plan. Enable it in Home Assistant first.","toast.ha_disabled_add":"A disabled Home Assistant object cannot be added to the plan. Enable it in Home Assistant first.","toast.ha_binding_unverified":"The object status could not be verified through the Home Assistant registry. Display and actions are temporarily unavailable.","toast.markup_needs_server":"Markup is available after the config is moved to the server","toast.space_order_changed":"Order changed. If any card pins its floor by number, check those panels.","toast.conflict":"Config was changed in another window — data refreshed, repeat your last action","toast.cfg_save_failed":"Failed to save config: {err}","toast.room_overlap":"The outline overlaps room “{name}” — rooms must not overlap","toast.contour_cannot_close":"The outline cannot close because it is degenerate or intersects itself","toast.merge_not_adjacent":"Only rooms that share a wall can be merged","toast.rooms_merged":"Rooms merged into “{name}”","toast.split_pick_wall":"Start the cut on the room’s wall","toast.split_bad_cut":"The cut must run wall to wall inside the room, without crossing walls or itself","merge.header":"Merge rooms","merge.hint":"The merged room keeps one name and one area. The other area is released — its devices leave the plan until another room claims it.","merge.keep":"Keep","merge.no_area":"no area","toast.room_saved":"Room saved ({n}). Devices added: {added}. Outline the next one or exit markup.","toast.room_saved_no_area":"Room saved ({n}, no area). Outline the next one or exit markup.","toast.marker_needs_server":"Device editing is available after the config is moved to the server","toast.virtual_name_required":"Enter a name for the virtual device","toast.marker_saved":"Device saved","toast.marker_removed":"Device deleted from the plan","toast.integration_missing":"The House Plan integration is not installed — management unavailable","toast.plan_formats":"Supported formats: SVG, PNG, JPG, WebP","toast.plan_required":"Upload a floor plan — it is required","toast.space_added_onboard":"Space added. Outline the rooms: click grid dots and close the contour.","toast.space_added":"Space added","toast.space_copied":"Space “{name}” created","toast.space_saved":"Space saved","toast.space_deleted":"Space deleted","toast.delete_failed":"Delete failed: {err}","toast.error":"Error: {err}","toast.toggle_target_unavailable":"Target “{name}” is unavailable — no action was performed","toast.toggle_targets_unavailable":"Targets are unavailable: {names}. No action was performed","toast.file_failed":'File "{name}" was not uploaded: {err}',"toast.files_attached":"Files attached: {n}","err.unknown":"unknown error","err.code":"code {code}","err.too_large":"file larger than {mb} MB","err.bad_ext":"unsupported type (PDF/image expected)","err.unauthorized":"administrator rights required","editor.title":"Title","editor.default_floor":"Initial space","editor.default_floor_missing":"Initial space “{id}” no longer exists. Choose another space.","editor.floor":"Fixed space","editor.floor_none":"— not fixed —","editor.floor_index":"YAML index {index} (preserved)","fixed_floor.loading":"Loading the fixed space…","fixed_floor.invalid_title":"The fixed space is unavailable","fixed_floor.invalid_body":"Check floor in the card configuration. The configured value is: {value}","editor.icon_size":"Icon size, % of plan width","editor.show_temperature":"Show temperature","editor.live_states":"Live states (on/off, open…)","editor.light_pools":"Light pools and wall shadows","editor.show_signal":"Show zigbee signal (LQI)","editor.language":"Interface language","editor.lang_auto":"Auto (HA profile)","title.icon_rules":"Icon rules: which MDI icon devices get by name","rules.title":"Icon rules","rules.hint":"Rules are checked top-down against “device name + model” (case-insensitive regex); the first match wins. When nothing matches, the entity device class decides, then the generic chip icon.","rules.pattern_ph":"regex, e.g. plug|socket","rules.icon_ph":"mdi:power-socket-de","rules.add":"Add rule","rules.reset":"Reset to defaults","rules.test_ph":"Try a device name…","rules.invalid":"invalid regex","rules.saved":"Icon rules saved","btn.up":"Up","btn.down":"Down","tap.info":"Device card","tap.more_info":"HA more-info dialog","tap.toggle":"Toggle state","marker.tap_label":"Tap action for this device","tap.toggle_note":"The resolved state is shown below. Secure devices are never toggled from the plan.","import.title":"Create spaces from HA floors","import.hint":"Your Home Assistant already knows these floors. Pick the ones to turn into plan spaces — you will upload a floor-plan image for each one next. Rooms are then outlined by hand on the plan.","import.start":"Create {n} space(s)","import.manual":"Start from scratch","import.progress":"Floor {i} of {n}","import.done":"Spaces created. Outline the rooms: click grid dots and close the contour.","btn.skip":"Skip","space.scale_label":"Scale (grid cell size)","space.cell_cm.help":"Links the grid to real dimensions: lengths, areas, wall thickness, opening sizes and glow radius depend on it. Changing it after drawing changes the calculated dimensions of the whole space without moving its points on the plan.","space.cell_cm.help.aria":"Help: space scale","space.scale_unit":"cm per cell","space.scale_unit_imperial":"in per cell","space.display_section":"Display","space.show_borders":"Always show room borders","space.zero_wall_style":"Zero-thickness walls","space.zero_wall_style.help":"Dashed zero-thickness walls pass Glow and sun rays, while solid ones block them as zero-area barriers. The choice affects every such wall in the space even when its line is hidden in View.","space.zero_wall_style.help.aria":"Help: zero-thickness wall style","space.zero_wall_dashed":"Dashed","space.zero_wall_solid":"Solid","space.show_names":"Show room names (drag to move)","space.room_color":"Border & name color","space.opacity":"Opacity","space.fill_label":"Room fill","space.fill_mode.help":"“Custom colour” is styling, while “Light”, “Temperature” and “LQI” use current Home Assistant data; Glow is enabled separately.","space.fill_mode.help.aria":"Help: room fill mode","fill.none":"None","fill.lqi":"Zigbee signal","fill.light":"Lights","fill.custom":"Custom color","space.custom_fill":"Fill color","space.source_file":"I have a floor-plan image","space.source_draw":"No image — I'll outline rooms by hand","fill.temp":"Temperature","tip.temp_avg":"average temperature:","tip.hum_avg":"average humidity:","space_card.button":"Open the space plan","space_card.not_found":"Space “{id}” not found","space_card.loading":"Loading…","continuity.restore_plan":"Restoring floor plan…","continuity.restore_connection":"Restoring device connection…","continuity.retry":"Try again","editor.space":"Space","editor.framing":"Framing","editor.fit_content":"All visible content","editor.fit_house":"Tight to house geometry","editor.show_button":"Show button","editor.button_label":"Button label","editor.button_target":"Target dashboard path","marker.sub_entity":"entity","title.general_settings":"General settings","title.export_pdf":"Save as PDF","pdf.title":"Save as PDF","pdf.dimensions":"Show dimensions and areas","pdf.decor":"Show furniture and other decor","pdf.room_names":"Show room names","pdf.backdrop":"Show backdrop","pdf.save":"Save","pdf.saving":"Creating…","pdf.failed":"Could not create the PDF.","pdf.too_large":"The images exceed the 25 MB PDF limit.","pdf.asset_failed":"A backdrop or decor image could not be loaded.","pdf.scale":"Scale 1:{n}","pdf.north":"North","gs.title":"General settings","gs.light_group":"Fill: lights","gs.light_on":"Lights on","gs.light_off":"All lights off","gs.temp_group":"Fill: temperature","gs.temp_cold":"Cold","gs.temp_ok":"Comfortable","gs.temp_hot":"Hot","gs.lqi_group":"Fill: zigbee signal","gs.lqi_low":"Weak signal","gs.lqi_high":"Strong signal","gs.reset":"Reset to defaults","gs.saved":"General settings saved","gs.radar_show_live":"Show live presence on the plan","gs.radar_show_live_hint":"Hides or shows all live radar targets. This does not start or stop observation recording.","radar.title":"Presence on the plan","radar.help":"Connect this marker to exact Home Assistant radar entities, place the sensor and choose its coordinate profile. Live positions are clipped to the selected room.","radar.help.aria":"Help: presence radar settings","radar.enabled":"Use this presence radar","radar.show_live":"Show live targets","radar.configure":"Configure radar","radar.configure_on_plan":"Configure on plan","radar.change_installation":"Change installation","radar.no_contour":"This room has no boundary. Radar points will not be clipped.","radar.discard_setup_title":"Discard radar setup?","radar.discard_setup":"The unsaved radar setup will be lost.","radar.step_place_mount":"Mark the physical sensor position","radar.step_place_heading":"Mark a point straight ahead of the sensor","radar.step_reference":"Mark reference position {n}, then start measurement","radar.step_check_reference":"Mark an independent check position","radar.start_measure":"Start measurement","radar.countdown":"Stand at the mark in {seconds} s","radar.capturing":"Stand still and alone while measuring…","radar.fit_ready":"Calibration is ready","radar.check_third":"Check at another position","radar.check_complete":"Independent check completed","radar.error_distance":"Position difference: {distance}","radar.ambiguous_target":"More than one target was reported. Repeat the measurement alone.","radar.insufficient_samples":"Not enough current coordinates. Retry or use manual setup.","radar.bad_references":"Choose separated references in different directions from the sensor.","radar.ambiguous_sources":"The measurements allow two equally plausible directions. Choose reference points that distinguish left from right.","radar.bad_fit":"Measurements do not match. Check units, mounting point and references.","radar.desktop_hint":"Use a computer for precise setup. Editing on touch devices is best effort.","radar.detected":"House Plan recognized radar metadata for this device. Review the exact sources before saving.","radar.detected_ld2450":"House Plan found an ESPHome LD2450 coordinate set. Review the exact X/Y sources before saving.","radar.additional_actions":"Additional actions","radar.declare":"This is a presence radar","radar.profile":"Data profile","radar.profile_esphome_ld2450_v1":"ESPHome LD2450 (X/Y targets)","radar.profile_cartesian_v1":"Cartesian targets (X/Y)","radar.profile_polar_v1":"Polar target (distance/angle)","radar.profile_range_v1":"Distance only","radar.profile_zones_v1":"Zone states","radar.profile_presence_v1":"Presence only","radar.room":"Radar room","radar.room_choose":"Choose a room","radar.target":"Target {n}","radar.axis_x":"X coordinate entity","radar.axis_y":"Y coordinate entity","radar.add_target":"Add target slot","radar.range_channel":"Range channel {n}","radar.add_range":"Add range channel","radar.presence_gate":"Presence gate entity","radar.swap_axes":"Swap X and Y axes","radar.axis_x_sign":"X direction","radar.axis_y_sign":"Y direction","radar.distance_source":"Distance entity","radar.angle_source":"Angle entity","radar.angle_unit":"Angle unit","radar.degrees":"Degrees","radar.radians":"Radians","radar.angle_zero":"Zero-angle direction","radar.angle_forward":"Forward","radar.angle_right":"Right","radar.angle_clockwise":"Angles increase clockwise","radar.zone_source":"Zone entity","radar.occupancy_source":"Presence entity","radar.count_source":"Target count entity","radar.availability_source":"Availability entity","radar.source_choose":"Choose an entity","radar.source_optional":"Optional","radar.source_missing":"currently unavailable","radar.saved_unsupported":"This saved radar setup is unsupported or incomplete. It remains inactive; remove it or update House Plan before configuring it again.","radar.occupancy":"Presence (on/off)","radar.count":"Count","radar.mount":"Position and direction","radar.mount_hint":"This is the physical sensor position. Moving its decorative marker does not change it.","radar.heading":"Direction, °","radar.range_cm":"Range, cm","radar.fov_deg":"Field of view, °","radar.unit":"Source unit","radar.mirror":"Mirror the left/right axis","radar.remove":"Remove radar settings","radar.invalid":"Complete the radar room, sources and position before saving.","radar.check_sources":"Check live data","radar.checking":"Checking…","radar.health":"Connection status","radar.live_summary":"Current targets: {targets}; range arcs: {ranges}","radar.health_ok":"Current data received","radar.health_off":"No targets detected","radar.health_stale":"Some coordinate data is out of date","radar.health_partial":"Some sources are current; others are out of date","radar.health_restricted":"Access to one or more sources is restricted","radar.health_incomplete":"The current radar report is incomplete","radar.health_position_unavailable":"Presence reported; current position unavailable","radar.health_unavailable":"Sensor data unavailable","radar.health_needs_setup":"Installation needs setup","radar.health_inconsistent":"The sources report conflicting values","radar.health_unknown":"Current state is unknown","radar.health_disabled":"Radar is disabled","radar.error_invalid_radar":"Check the radar settings.","radar.error_invalid_selection":"Select an existing room and valid sources.","radar.error_source_restricted":"You do not have access to all selected sources.","radar.error_rate_limited":"Too many requests. Try again shortly.","radar.error_not_ready":"Radar processing is not ready.","radar.error_conflict":"The plan changed. Reopen the radar setup and try again.","radar.error_source_unavailable":"One or more selected radar sources are unavailable.","radar.error_unsupported_capability":"This radar capability is not supported by the installed integration.","radar.report_age":"{seconds} s ago","space.show_lqi":"Show zigbee signal (LQI) next to devices","space.hide_decor":"Hide the decorative layer","space.hide_decor_tip":"Lines, shapes, labels and furniture stay where they are — visible in the backdrop editor, not on the plan.","space.hide_openings":"Hide openings","space.hide_openings_tip":"Door, window and gate symbols are not drawn, but the openings keep working: light passes through, the sun comes in at a window, contact sensors still open them. The plan editor always shows them.","gs.light_none":"No light sources","mode.plan":"Plan editor","mode.devices":"Device editor","display.value":"Value + state","marker.subarea":"no area, manual","device.new":"New device — open its editor to dismiss","opening.unlock_action":"Unlock","opening.lock_action":"Lock","opening.lock_pending":"Working…","title.close_editor":"Close editor (back to view)","title.add_device":"Add a device to the plan","devbar.add":"Add","devbar.rules":"Icon rules","device_inbox.button":"Devices","device_inbox.title":"Devices on the plan","device_inbox.search":"Search devices, entities and integrations…","device_inbox.add_virtual":"Add virtual device","device_inbox.tab_on_plan":"On plan","device_inbox.tab_available":"Available","device_inbox.tab_hidden":"Hidden","device_inbox.tab_readd":"Available again","device_inbox.only_new":"New only","device_inbox.show_entities":"Show entities","device_inbox.show_hidden":"Show hidden on plan","device_inbox.show_hidden.help":"Temporarily shows hidden and disabled markers as editor-only ghosts on the plan. Saved device visibility does not change.","device_inbox.show_hidden.help.aria":"Help: show hidden devices on the plan","device_inbox.new":"New","device_inbox.find":"Find on plan","device_inbox.edit":"Edit","device_inbox.hide":"Hide","device_inbox.show":"Show","device_inbox.add":"Add","device_inbox.readd":"Add again","device_inbox.hide_available":"Hide from list","device_inbox.show_more":"Show more","device_inbox.more_actions":"More actions","device_inbox.find_hidden_hint":"Enable “Show hidden on plan” first","device_inbox.show_disabled":"Activate this binding in Home Assistant before showing it","device_inbox.empty_on_plan":"No matching devices are on the plan yet.","device_inbox.empty_available":"No devices are available to add.","device_inbox.empty_hidden":"There are no hidden devices.","device_inbox.empty_readd":"No removed devices are available to add again.","device_inbox.reason_visible_auto":"Discovered automatically","device_inbox.reason_visible_explicit":"Added explicitly","device_inbox.reason_manual_hidden":"Hidden by user","device_inbox.reason_automatic_hidden":"Hidden automatically","device_inbox.reason_service_entry":"Service-only registry entry","device_inbox.reason_excluded_integration":"Integration “{integration}” excluded by discovery filters","device_inbox.reason_excluded_domain":"Non-spatial entity type","device_inbox.reason_grouped_light":"Represented by a room light group","device_inbox.reason_represented_by_parent":"Represented by its parent device","device_inbox.reason_removed":"Previously removed from the plan","device_inbox.reason_available":"Available to add to the plan","device_inbox.reason_no_bound_room":"HA area is not linked to a plan room","device_inbox.status_ha_disabled":"Disabled in Home Assistant","device_inbox.status_orphaned":"Binding is no longer present in Home Assistant","device_inbox.status_unverified":"Home Assistant registry is temporarily unavailable","device_inbox.saved":"Device list updated","device_inbox.filters_excluded":"Excluded integrations","device_inbox.filters_group_lights":"Group room lights into one marker","device_inbox.filters_preview_appear":"will appear: {count}","device_inbox.filters_preview_hide":"will disappear: {count}","device_inbox.filters_preview_lights":"lights affected: {count}","device_inbox.filters_reset":"Restore recommended","device_inbox.filters_save":"Save filters","device_inbox.filters_search_ph":"Add an integration…","device_inbox.filters_title":"Discovery filters","space.roomcard_section":"Room card shows:","space.label_temp":"Temperature","space.label_hum":"Humidity","space.label_lqi":"Average Zigbee signal","space.label_light":"Lights on/off","roomcard.light_on":"On","roomcard.light_off":"Off","roomcard.light_partial":"{on} of {total}","toast.split_pick_inside":"Intermediate cut points must be inside the room","mode.decor":"Background editor","decor.select":"Select","decor.line":"Line","decor.rect":"Rectangle","decor.ellipse":"Oval","decor.text":"Text","decor.erase":"Erase","decor.erase_confirm_title":"Erase object?","decor.color":"Color","decor.width":"Line width","decor.line_style":"Line style","decor.line_style_solid":"Solid","decor.line_style_dashed":"Dashed","decor.fill":"Fill","decor.fill_color":"Fill color","decor.length":"Length","decor.size":"Size","decor.flip_h":"Flip horizontally","decor.flip_v":"Flip vertically","decor.angle":"Rotation angle, °","decor.text_size":"Text size","decor.backdrop_properties":"Plan backdrop properties","decor.text_title":"Text label","decor.object_title":"Edit {kind}","decor.text_label":"Text","decor.live_group":"Insert HA variable","decor.live_entity":"Entity","decor.live_entity_ph":"choose an entity","decor.live_attr":"Value","decor.live_attr_ph":"choose state or attribute","decor.live_state":"State","decor.backdrop":"Backdrop image","decor.backdrop_hint":"Drag to move; pull a corner to resize; use the top handle to rotate. Shift changes proportions or frees the angle.","decor.backdrop_reset":"Reset the picture","decor.backdrop_reset_done":"The picture is back at its original place and size","marker.icon_auto":"Auto: {icon} (by icon rules; pick one to override)","marker.icon_pin_auto":"Pin","mode.plan_tip":"Plan editor — the geometry of the home: draw and split/merge rooms, bind them to HA areas, place doors, windows and gates, move room cards, set the scale","mode.devices_tip":"Device editor — everything about icons: drag to position, click to edit binding/icon/display, add virtual devices, icon rules","mode.decor_tip":"Background editor — purely visual decor under the plan: lines, rectangles, ovals and text labels that never react to clicks","space.glow_enabled":"Light-source glow","gs.glow_group":"Light-source glow","gs.glow_base":"House darkness","gs.glow_light":"Default light color / intensity","gs.wall_group":"Walls","gs.wall_fill":"Wall fill","gs.glow_radius":"Glow radius","gs.glow_radius.help":"Sets the default glow radius in metres or feet; a device-specific radius overrides it.","gs.glow_radius.help.aria":"Help: default glow radius","gs.unit_m":"m","gs.unit_ft":"ft","marker.controls_label":"Controls other light sources","marker.controls.help":"With the “Toggle state” action, the listed sources toggle together with this marker. Their glow stays at their own markers, and the link alone does not turn the controlling marker into a light source.","marker.controls.help.aria":"Help: controlling other light sources","marker.controls_filter":"Search lights and switches…","info.controls":"Controls","marker.glow_radius_label":"Glow radius","marker.glow_radius.help":"Sets the glow radius in metres or feet; an empty value uses the radius from general settings.","marker.glow_radius.help.aria":"Help: glow radius","markup.wallthick":"Thickness","markup.select":"Select","title.markup_wallthick":"Thickness — click a wall to set its thickness from 0 to 100 cm.","markup.hint_wallthick":"click a wall · Esc closes without applying","wallthick.field":"Thickness","wallthick.unit_cm":"cm","wallthick.unit_in":"in","wallthick.apply_room":"Apply to all walls of this room","markup.draw_wall_title":"Thickness of each new wall segment (0–100 cm). Shared walls keep the existing value.","room.queue_progress":"Room {current} of {total}","toast.wall_rooms_saved":"Created rooms: {n}","toast.wall_chain_saved":"Wall chain saved","toast.wallthick_pick":"Click a wall","toast.wallthick_set":"Wall thickness set","toast.wallthick_cleared":"Wall thickness removed","toast.physical_range":"Enter a value from {min} to {max} {unit}","toast.zero_wall_opening_conflict":"Remove the opening on this wall segment first.","toast.zero_wall_ambiguous":"The wall segment is ambiguous. Simplify or adjust the junction.","toast.zero_wall_migration_blocked":"The space was not converted: {reason}. No data was changed.","toast.physical_angle":"Enter a rotation angle from 0° up to, but not including, 90°","toast.physical_limit":"The space has reached the limit for this type of geometry","toast.geometry_unsafe":"Change canceled: wall geometry could not be built safely.","junction.limit_angle":"The angle between walls is too sharp: {actual}°, minimum {limit}°.","junction.limit_valence":"Too many walls meet in one node: {actual}, maximum {limit}.","junction.limit_length":"The wall segment is too short: {actual} cm, minimum {limit} cm.","junction.limit_distance":"Walls and nodes are too close: {actual} cm, minimum {limit} cm.","junction.limit_clearance":"No room interior is left: {actual} cm², minimum {limit} cm².","junction.limit_check_failed":"The junction check could not run — the change was not saved","toast.wall_model_migration_blocked":"The wall model could not be updated: {reason}. The plan was not changed. Run “Optimize plans”; if the error repeats, fix the conflicting wall geometry.","toast.wall_model_client_outdated":"Update the card and reload the page before editing the plan.","wall_model.reason.invalid-room":"invalid room contour","wall_model.reason.zero-length":"zero-length wall segment","wall_model.reason.third-owner":"wall shared by more than two rooms","wall_model.reason.duplicate-id":"conflicting wall identifiers","wall_model.reason.thickness-conflict":"conflicting wall thickness values","wall_model.reason.opening-host":"opening cannot be assigned to one wall","toast.delete_room_pick":"Click inside the room you want to delete","toast.plan_snap_ambiguous":"Zoom in to choose the wall node","toast.wall_repair_ambiguous":"The room outline has more than one possible connection. Zoom in and connect it explicitly.","toast.wall_repair_too_large":"The gap is larger than 2 cm. Connect the walls before creating the room.","toast.wall_repair_changed":"The wall geometry changed. Try creating the room again.","toast.opening_on_zero_wall":"Openings cannot sit on a zero-thickness wall","marker.from_ha_option":"Pick from the HA list","marker.show_entities":"Show entities","marker.show_entities_tip":"Adds not only devices to the list, but all their entities too","marker.pick_ph":"Choose a device…","room.open_area":"Open the HA area","room.fit_action":"Fit room {name}","view.volumetric":"Volumetric view","view.flat":"Flat view","kiosk.title":"This screen's sizes","kiosk.hint":"Stored on this device only — every wall tablet or TV can have its own comfortable sizes.","kiosk.icon_scale":"Device icon size","kiosk.font_scale":"Room card text size","editor.kiosk":"Wall device (kiosk) mode","editor.cycle":"Auto-switch spaces every N seconds (kiosk, 0 = off)","room.settings_title":"Room settings","room.settings_section":"Room settings (override the space)","room.fill_label":"Fill in THIS room","fill.inherit":"As the space","room.custom_fill_space":"Space color","room.custom_fill_own":"Room color","room.temp_range_label":"Comfort range","room.temp_range_min":"Lower comfort-temperature bound","room.temp_range_max":"Upper comfort-temperature bound","room.temp_range_reset":"As the space","room.temp_range.help":"This range applies only to this room. Empty fields inherit the corresponding space bounds; if the bounds are reversed, House Plan uses the smaller value as the lower bound and the larger value as the upper bound.","room.temp_range.help.aria":"About the room comfort range","room.temp_src_label":"Temperature source","room.hum_src_label":"Humidity source","room.src_average":"Average over the room's sensors (default)","room.src_pick":"A specific HA device or entity","room.src_ph":"Choose a source…","toast.room_updated":"Room updated","space.card_font":"Room-card font size (whole space)","room.sizes_section":"Font sizes","room.name_scale":"Room name size","room.label_scale":"Metrics size","preview.room_name":"Living room","toast.cfg_reload_failed":"Could not reload the plan from the server: {err}","toast.locale_load_failed":"Could not load the language pack. English is used until the page reloads.","toast.furniture_art_load_failed":"Could not load the furniture drawings. Reload the page to show them.","room.settings_short":"Room settings","room.unnamed":"Unnamed room","marker.use_climate_temp":"Include the device temperature in the room","marker.use_climate_temp_tip":"Adds an air conditioner or thermostat current_temperature to the room average. Configure the external value badge separately below.","marker.value_badge_title":"Value badge","marker.value_badge.help":"Shows one selected value next to the icon. It does not affect room metrics, light, Glow or the tap action.","marker.value_badge.help.aria":"Help: device value badge","marker.value_badge_enabled":"Show a value badge","marker.value_badge_source":"Value","marker.value_badge_source.help":"Choose a specific state, supported attribute, or derived value of this device.","marker.value_badge_source.help.aria":"Help: value badge source","marker.value_badge_position":"Position","marker.value_badge_position.help":"The chosen side stays fixed and does not flip automatically at a plan edge.","marker.value_badge_position.help.aria":"Help: value badge position","marker.value_badge_right":"Right","marker.value_badge_bottom":"Below","marker.value_badge_left":"Left","marker.value_badge_top":"Above","marker.value_badge_empty":"This device has no available values","marker.value_badge_static":"A static icon does not show live values. The setting is preserved.","marker.value_badge_missing":"Source unavailable","marker.value_badge_missing_hint":"The saved source is currently unavailable. Keep it, disable the badge, or choose another value.","marker.value_badge_duplicate":"The same value is already shown inside the icon.","marker.value_badge_state":"State · {name}","marker.value_badge_marker_state":"Light-source state · {name}","marker.value_badge_lqi":"Average Zigbee signal quality","marker.value_badge_attr_current_temperature":"Current temperature · {name}","marker.value_badge_attr_temperature":"Target temperature · {name}","marker.value_badge_attr_current_humidity":"Current humidity · {name}","marker.value_badge_attr_humidity":"Humidity · {name}","marker.value_badge_attr_current_position":"Position · {name}","marker.value_badge_attr_percentage":"Speed · {name}","marker.value_badge_attr_brightness":"Brightness · {name}","marker.value_badge_attr_volume_level":"Volume · {name}","marker.value_badge_attr_battery_level":"Battery · {name}","marker.value_badge_attr_fan_speed":"Fan speed · {name}","marker.value_source":"Value source","marker.value_source.help":"Choose the value that replaces the icon. The tap action does not change.","marker.value_source.help.aria":"Help: value face source","marker.value_source_auto":"Automatic (as before)","marker.value_source_missing_hint":"The saved source is currently unavailable. The face shows — until it recovers or you choose another value.","marker.light_role_label":"Is this device a light source?","marker.light_role.help":"“Auto” uses the bound device's resolved role, “Always” forces its own source and “Never” excludes it; linked lights above remain independent.","marker.light_role.help.aria":"Help: whether this device is a light source","marker.light_role_auto_yes":"Auto (light source)","marker.light_role_auto_no":"Auto (not a light source)","marker.light_role_always":"Always a light source","marker.light_role_never":"Never a light source","marker.light_entity_label":"Leading light entity","marker.light_entity.help":"For a composite device, choose the entity whose state, colour and brightness represent this plan source. The automatic fallback remains compatible with older plans.","marker.light_entity.help.aria":"Help: leading light entity","marker.light_entity_auto":"Automatic ({entity})","marker.light_entity_none":"no controllable entity","marker.light_entity_missing":"The saved entity {entity} is unavailable. House Plan temporarily uses {fallback}; the saved choice will be restored if it returns.","marker.toggle_entity_label":"Entity to toggle","marker.toggle_entity.help":"For a composite device, choose the exact own light or switch operated by a tap. Automatic keeps the previous target rules and is independent from the leading light entity.","marker.toggle_entity.help.aria":"Help: entity to toggle","marker.toggle_entity_auto":"Automatic ({entity})","marker.toggle_entity_none":"no own controllable entity","marker.toggle_entity_missing":"The saved entity {entity} is no longer among this marker’s selectable channels. House Plan temporarily uses {fallback}; the saved choice will be restored if it returns.","marker.glow_color_label":"Glow colour and brightness","marker.glow_mode.help":"Use live source values, override only its colour, or fix both colour and brightness. The minimum is 1%; to disable the source, choose “Never”.","marker.glow_mode.help.aria":"Help: glow colour and brightness","marker.glow_mode_auto":"From source","marker.glow_mode_color":"Set colour","marker.glow_mode_fixed":"Set colour and brightness","marker.glow_color":"Glow colour","marker.glow_brightness":"Brightness","marker.glow_disabled_never":"Glow settings are unavailable because this marker is explicitly not a light source.","marker.glow_disabled_auto":"Auto mode found no spatial light source for this marker.","marker.glow_disabled_no_entity":"No active controllable Home Assistant entity is available for this spatial source.","marker.glow_passive_hint":"This source has no own Home Assistant data. Set its colour and brightness manually; its radius remains available.","marker.control_broken":"Saved source is missing or no longer marked as a light","marker.control_missing_label":"Missing plan light","marker.control_passive":"passive source","toast.marker_control_cycle":"This link would create a circular chain of light controls.","toast.marker_binding_required":"Choose a Home Assistant device before linking another light source.","confirm.unlock_title":"Unlock?","confirm.unlock_body":"House Plan will send an unlock command to this lock.","toast.files_migrate_failed":"Attachments could not be moved to the new binding, links keep pointing at the old files: {err}","space.pick_saved":"Already uploaded","space.pick_saved_hint":"Plans stored on the server, including ones you detached earlier","space.no_saved":"No plans stored on the server yet.","space.loading":"Loading…","space.used_by":"in use: {list}","space.in_use":"A space still uses this plan — detach it first","btn.use":"Use","confirm.delete_plan_title":"Delete plan file?","confirm.delete_plan_body":"The file will be deleted from the server. This action cannot be undone.","toast.plans_list_failed":"Could not list the stored plans: {err}","toast.plan_delete_failed":"Could not delete the plan: {err}","marker.hide":"Hide","marker.hide_tip":'The device will disappear from the plan after saving but will still count toward the room signal. Restore it through the "Devices" catalog in the device editor.',"marker.show":"Show","marker.show_tip":"The device will appear on the plan again after saving.","marker.hidden_ghost":"Device hidden by the user","marker.ha_disabled_device":"The device is disabled in Home Assistant and hidden from the plan.","marker.ha_disabled_entity":"The entity is disabled in Home Assistant and hidden from the plan.","marker.ha_disabled_all_entities":"The device has no active Home Assistant entities, so it is hidden from the plan.","marker.ha_registry_limited":"The full Home Assistant registry is unavailable to this user. The unverified object cannot be shown or used for now.","marker.delete_tip":"Completely delete the device from the plan and every aggregate. You can add it again later.","tap.run":"Run automation/script/scene","tap.none":"Do nothing","marker.run_target_label":"What to run","marker.run_search_ph":"Search: automation, script or scene…","marker.run_target_gone":"Target {id} not found — pick again","marker.tap_confirm":"Ask for confirmation","marker.tap_confirm_tip":"Show a confirmation dialog before acting — a guard against accidental taps.","marker.toggle_hint_single":"Target: {name} ({id}).","marker.virtual_light_target":"Virtual light: {name}.","marker.virtual_light_current":"Manual state: {state} → {effect}.","marker.virtual_light_state_on":"on","marker.virtual_light_state_off":"off","marker.toggle_hint_group":"Will toggle {count} source(s): {names}.","marker.toggle_hint_current":"Now: {state} → {effect}.","marker.toggle_hint_group_current":"Currently on: {on} of {count} → {effect}.","marker.toggle_hint_skipped":"Will be skipped ({count}): {targets}.","marker.toggle_effect_turn_on":"will turn on","marker.toggle_effect_turn_off":"will turn off","marker.toggle_effect_open":"will open","marker.toggle_effect_close":"will close","marker.toggle_effect_stop":"will stop","marker.toggle_effect_toggle":"state will toggle","marker.toggle_skip_missing":"not found","marker.toggle_skip_ha_disabled":"disabled in HA","marker.toggle_skip_unavailable":"unavailable","marker.toggle_skip_unsupported":"toggle is unsupported","marker.toggle_skip_secure":"blocked for security","marker.toggle_none_no_binding":"This device has no binding, so there is no state to toggle. Tapping will do nothing.","marker.toggle_none_no_actionable_entity":"This device has no state that can be toggled. Tapping will do nothing.","marker.toggle_none_configured_targets_missing":"The configured targets are unavailable. The device's own entity will not be substituted for them.","marker.toggle_none_ha_disabled":"The target is disabled in Home Assistant and cannot be used on the plan.","marker.toggle_none_unavailable":"The target is currently unavailable. Tapping will do nothing.","marker.toggle_none_unsupported":"Home Assistant exposes no safe toggle operation for this entity. Tapping will do nothing.","marker.toggle_none_secure":"Toggling locks, alarms and secure gates from the plan is blocked for security.","run.automation":"automation","run.script":"script","run.scene":"scene","confirm.tap_run":'Run "{name}"?',"confirm.tap_toggle":'Toggle "{name}"?',"confirm.current_state":"Current state: {state}","confirm.expected_state":"After switching: {state}","confirm.group_current":"on {on} of {total}","confirm.group_all_on":"all are on","confirm.group_all_off":"all are off","confirm.unavailable_targets":"Unavailable: {count}","confirm.expected_by_ha":"Home Assistant will determine the state","confirm.state_on":"On","confirm.state_off":"Off","confirm.state_open":"Open","confirm.state_closed":"Closed","confirm.state_opening":"Opening","confirm.state_closing":"Closing","confirm.state_stopped":"Stopped","confirm.state_unknown":"Unknown","toast.run_started":"Started: {name}","toast.run_target_missing":"Run target not found — check the device settings","toast.run_target_required":"Pick an automation, script or scene","toast.tap_target_changed":"The action target changed. Try again.","toast.virtual_light_toggle_failed":"Could not toggle the virtual light: {err}","toast.value_badge_source_required":"Choose a value for the badge","btn.run":"Run","vac.section":"Robot vacuum: live position","vac.autocal":"Set up automatically","vac.live":"Live position on the plan","vac.trail":"Show the robot's path","vac.autocal_no_rooms":"The integration reports no room list — open “Fit manually”","vac.route_warn_unmapped":"The robot is cleaning a map that is not assigned to any floor","vac.route_warn_needs_calibration":"The map is assigned to a floor but not calibrated","vac.route_warn_ambiguous":"Two maps are indistinguishable — no floor was chosen","vac.route_warn_missing_space":"The space of this map was deleted","vac.autocal_no_match":"Room names did not match (need ≥3 in common) — open “Fit manually”","vac.autocal_done":"Done: bound via {rooms} rooms. Start a cleanup and check","vac.cal_need_pos":"The robot is not reporting coordinates — start a cleanup and pause it","vac.cal_done":"Calibration saved. Start a cleanup and check","vac.cal_cancelled":"Calibration cancelled","vac.fit":"Fit manually","vac.fit_hint":"Drag the robot map into place, stretch by the corners","vac.fit_rotate":"Rotate 90°","vac.fit_mirror":"Mirror","vac.trail_never":"Never","vac.trail_cleaning":"While cleaning","vac.trail_always":"Always","gs.bg_group":"Stage background","gs.bg_color":"Background around the plan","gs.bg_default":"Theme default","gs.bg_theme":"theme default","gs.bg_mode":"Plan background","gs.bg_mode.help":"“Follows the Sun” uses sun.sun, falling back to the browser's local clock; Static always shows the selected colour.","gs.bg_mode.help.aria":"Help: general plan background","gs.bg_static":"Static color","gs.bg_daynight":"Follows the Sun","gs.sun_group":"Sun","gs.sun_missing":"The sun.sun entity was not found — the background follows your local clock; window rays are unavailable.","gs.north":"North on the plan","gs.north.help":"The angle is measured clockwise from the plan's upward vertical; north is required for window rays, not for the “Follows the Sun” background.","gs.north.help.aria":"Help: general north direction","gs.north_ph":"not set","gs.north_clear":"Clear","gs.north_letter":"N","gs.sun_rays":"Sunlight through windows","gs.about_version":"Houseplan Card v{v}","gs.about_github":"GitHub · docs & issues","gs.about_telegram":"Telegram chat","support.title":"Help & feedback","space.bg_color":"Background around the plan","space.bg_inherit":"Inherit general","space.bg_inherited":"inherits general settings","space.bg_mode":"Plan background","space.bg_mode.help":"Inherit the general background or override this space with a static colour or “Follows the Sun”.","space.bg_mode.help.aria":"Help: space background","space.north":"North on the plan (override)","space.north.help":"Overrides general north for this space; the angle is measured clockwise from the plan's upward vertical and is used by window rays.","space.north.help.aria":"Help: north for this space","space.north_inherited":"inherited: {v}","space.sun_rays":"Sunlight through windows","space.sun_inherit":"Inherit general","space.sun_on":"On","space.sun_off":"Off","canvas.far_objects":"{n} object(s) far from the plan","canvas.show_far":"Show","canvas.home_tip":"The plan is over there — click to fit it","gs.grid_group":"Plan maintenance","gs.grid_hint":"Updates data models, aligns plan elements to the grid and merges redundant wall fragments. An exact report is shown before anything is stored.","gs.align_all":"Optimize plans","gs.align_title":"Optimize plans","gs.align_none":"All plans already use the current optimized data model.","gs.optimize_no_automatic_changes":"There are no automatic changes to apply. Review the items below.","gs.align_count":"{n} of {total} elements will move, by at most {cm} cm.","gs.align_where":"The largest shift is in “{s}”.","gs.align_turned":"Openings whose angle is corrected: {n}.","gs.align_preflight_failed":"Could not safely verify the geometry of the following spaces: {spaces}{more}.","gs.align_preflight_hint":"Plans were not changed. Copy the diagnostics with the button below and attach them to the bug report together with a space export.","gs.preflight_reason_prepare-exception":"Could not prepare the space geometry (exception while building the model)","gs.preflight_reason_wall-null":"The wall body did not build (the union came back empty)","gs.preflight_reason_wall-degraded-extra":"The wall body degraded with extra geometry","gs.preflight_reason_wall-failed-core":"The wall body core failed to assemble","gs.preflight_reason_wall-exception":"Wall construction threw an exception","gs.preflight_reason_floor-null":"The floor outline did not build","gs.preflight_reason_floor-exception":"Floor construction threw an exception","gs.preflight_copy":"Copy diagnostics","gs.preflight_copied":"Diagnostics copied","gs.preflight_update_hint":"The card and integration versions differ — update House Plan and retry.","gs.align_preflight_space":"Space {n}","gs.align_preflight_more":", and {n} more","gs.optimize_changes":"Model migrations: {m}; spaces updated: {c}; noisy coordinate values removed: {p}; merged real-wall fragments: {w}; merged zero-thickness wall fragments: {s}; independent walls: {i}.","gs.zero_walls_migrated":"Virtual wall spans converted: {n}.","gs.wall_segments_migrated":"Wall segments stabilised: {n}.","gs.room_drafts_migrated":"Unfinished contours converted to ordinary walls: {drafts}; wall segments: {segments}.","gs.optimize_lattice_summary":"Noisy coordinate values canonicalized: {n}; maximum movement: {cm} cm.","gs.optimize_lattice_space":"{space}: coordinate values canonicalized: {n}; off-grid values left unchanged: {far}.","gs.optimize_coincident_partitions":"Hidden independent wall sections absorbed into room walls: {n}.","gs.optimize_openings_rehosted":"Openings reattached to room walls: {n}.","gs.optimize_walls_straightened":"Walls straightened: {n}; maximum movement: {cm} cm.","gs.optimize_walls_straightened_where":"Largest wall correction: {s}.","gs.optimize_walls_straighten_skipped":"Near-axis walls left unchanged because they could not be repaired safely: {n}.","gs.optimize_glow_migration":"Legacy Glow: {spaces} spaces → no data fill + independent Glow; {rooms} rooms → inherited data fill + independent Glow.","gs.optimize_references":"References repaired: spaces — {spaces}; rooms — {rooms}; positions — {positions}; devices detached from missing spaces — {detached}.","gs.optimize_reference_more":", and {n} more","gs.optimize_orphans_removed":"Forgotten records removed: {total} — room labels: {rooms}; devices: {devices}; group markers: {groups}. They belonged to spaces deleted earlier.","gs.optimize_live_positions":"Old positions in deleted spaces belong to existing objects: {n}{names}. They will be kept.","gs.optimize_live_positions_remove":"Old positions in deleted spaces belong to existing objects: {n}{names}. They are selected for removal.","gs.optimize_live_names":": {names}{more}","gs.optimize_live_remove":"Remove old positions","gs.optimize_live_keep":"Keep old positions","gs.optimize_live_selected":"Old positions will be removed after Optimize is applied.","gs.optimize_unverified":"Could not safely verify positions: {n}. They were left unchanged.","gs.optimize_registry_limited":"Full administrator access to the Home Assistant registries is required for a safe check.","gs.optimize_vacuum_warning":"Vacuum room mappings that still need review: {n}.","gs.optimize_details":"Details","gs.optimize_details_more":"And {n} more records.","gs.optimize_detail_removed":"will be removed","gs.optimize_detail_live":"will be kept","gs.optimize_detail_unverified":"not verified","gs.optimize_detail_room_label":"room label","gs.optimize_detail_device":"device","gs.optimize_detail_group":"group marker","gs.optimize_detail_unknown":"unknown owner","gs.optimize_detail_item":"{status}: {kind} {id}; old space {space}","gs.align_warn":"Elements deliberately placed between grid nodes will move. One undo is available after the operation, only until the next plan edit.","gs.align_run":"Optimize","gs.align_done":"Plans optimized: {n} elements moved, {m} records maintained, {r} references repaired","gs.optimize_undo":"Undo last optimization","gs.optimize_undone":"The last optimization was undone","decor.furniture":"Furniture","decor.image":"Image","decor.image_title":"Custom images","decor.image_upload":"Upload image","decor.image_replace":"Replace image","decor.image_uploading":"Uploading…","decor.image_asset":"Image file","decor.image_pick_hint":"Upload an image or choose one already used in House Plan.","decor.image_place_hint":"Click on the plan to place the image.","decor.image_none":"No uploaded images yet.","decor.image_unavailable":"Image unavailable","decor.image_used":"Used in {n} objects","decor.image_upload_failed":"Could not upload the image: {err}","decor.image_error_capacity":"The custom image storage limit has been reached.","decor.image_in_use":"Remove every placed copy before deleting this image.","decor.image_delete_title":"Delete image file?","decor.image_delete_message":"Delete “{name}” from House Plan? This cannot be undone.","furn.title":"Furniture library","furn.symbol":"Symbol","furn.group_furniture":"Furniture","furn.group_appliance":"Appliances","furn.group_sanitary":"Plumbing","furn.group_other":"Other","furn.width":"Width","furn.depth":"Depth","furn.back_to_categories":"All categories","furn.pick_hint":"Choose a category, then a symbol.","furn.place_hint":"Click on the plan — the piece lands against the nearest wall. Shift places it free.","furn.cat_air_conditioner":"Air conditioners","furn.cat_armchair":"Armchairs","furn.cat_bathtub":"Bathtubs","furn.cat_bed":"Beds","furn.cat_bidet":"Bidets","furn.cat_boiler":"Water heaters","furn.cat_chair":"Chairs","furn.cat_coffee_table":"Coffee tables","furn.cat_cooktop":"Cooktops","furn.cat_dining_table":"Dining tables","furn.cat_dishwasher":"Dishwashers","furn.cat_dryer":"Dryers","furn.cat_fireplace":"Fireplaces","furn.cat_fridge":"Refrigerators","furn.cat_kitchen_cabinet":"Kitchen cabinets","furn.cat_kitchen_sink":"Kitchen sinks","furn.cat_nightstand":"Cabinets","furn.cat_plant":"Plants","furn.cat_rug":"Rugs","furn.cat_shelving":"Shelving","furn.cat_shower":"Showers","furn.cat_sink":"Sinks","furn.cat_sofa":"Sofas","furn.cat_stairs":"Stairs","furn.cat_toilet":"Toilets","furn.cat_tv":"Televisions","furn.cat_wardrobe":"Wardrobes","furn.cat_washer":"Washing machines","furn.cat_work_table":"Desks","furn.sym_sofa":"Two-seat sofa","furn.sym_sofa_three_seat":"Three-seat sofa","furn.sym_sofa_corner_right":"Right sectional sofa","furn.sym_armchair":"Soft armchair","furn.sym_armchair_office":"Office chair","furn.sym_coffee_table":"Rectangular coffee table","furn.sym_coffee_table_round":"Round coffee table","furn.sym_coffee_table_oval":"Oval coffee table","furn.sym_coffee_table_rounded":"Rounded coffee table","furn.sym_table_dining":"Rectangular dining table","furn.sym_table_round":"Round table","furn.sym_table_dining_oval":"Oval dining table","furn.sym_table_dining_rounded":"Rounded dining table","furn.sym_chair":"Chair","furn.sym_chair_bar":"Bar stool","furn.sym_desk":"Rectangular desk","furn.sym_desk_corner":"Corner desk","furn.sym_bed_double":"Double bed","furn.sym_bed_single":"Single bed","furn.sym_nightstand":"Bedside table","furn.sym_cabinet_tv":"TV cabinet","furn.sym_cabinet_shoe":"Shoe cabinet","furn.sym_cabinet_sink":"Sink cabinet","furn.sym_wardrobe":"Wardrobe","furn.sym_bookshelf":"Bookcase","furn.sym_wall_unit":"Wall unit","furn.sym_kitchen_floor":"Kitchen floor module","furn.sym_kitchen_floor_corner":"Kitchen floor corner module","furn.sym_kitchen_wall":"Kitchen wall module","furn.sym_kitchen_wall_corner":"Kitchen wall corner module","furn.sym_shelf_floor":"Floor shelving unit","furn.sym_shelf_wall":"Wall shelf","furn.sym_fridge":"Fridge","furn.sym_stove":"Four-burner cooktop","furn.sym_cooktop_two":"Two-burner cooktop","furn.sym_dishwasher":"Dishwasher","furn.sym_washer":"Washing machine","furn.sym_dryer":"Tumble dryer","furn.sym_tv":"TV on stand","furn.sym_tv_wall":"Wall-mounted TV","furn.sym_ac":"Air conditioner","furn.sym_water_heater":"Water heater","furn.sym_toilet":"Floor-standing toilet","furn.sym_toilet_built_in":"Built-in toilet","furn.sym_bathtub":"Rectangular bathtub","furn.sym_bathtub_corner":"Corner bathtub","furn.sym_shower":"Shower","furn.sym_sink":"Washbasin","furn.sym_kitchen_sink":"Single kitchen sink","furn.sym_kitchen_sink_double":"Double kitchen sink","furn.sym_bidet":"Floor-standing bidet","furn.sym_bidet_built_in":"Built-in bidet","furn.sym_stairs":"Stairs","furn.sym_fireplace":"Fireplace","furn.sym_plant":"Plant","furn.sym_rug":"Rug","common.yes":"Yes","common.no":"No","vac.diag_source":"Source","vac.diag_platform":"Integration","vac.diag_status":"Status","vac.diag_position":"Position","vac.diag_rooms":"Rooms","vac.diag_rooms_value":"{total} · {matched} names match · {readiness}","vac.autocal_ready":"auto-calibration available","vac.autocal_not_ready":"need 3 matching names","vac.diag_path":"Integration path","vac.diag_map":"Map ID","vac.source_none":"not selected","vac.source_status_ok":"Ready","vac.source_status_missing":"Missing","vac.source_status_disabled":"Disabled in Home Assistant","vac.source_status_unavailable":"Unavailable","vac.source_status_unverified":"Cannot verify with current permissions","vac.source_status_unsupported":"No position data","vac.source_status_none":"No source","vac.source_banner_missing":"The saved source no longer exists. It was not replaced automatically; choose another source or restore it in Home Assistant.","vac.source_banner_disabled":"The saved source is disabled in Home Assistant. Enable it there or choose another source.","vac.source_banner_unverified":"Current Home Assistant permissions cannot verify this saved source. It remains pinned and will not be replaced automatically.","vac.choose_source":"Choose source","vac.source_auto":"Automatic","vac.source_auto_hint":"Use a compatible entity from this device","vac.all_cameras":"All cameras","vac.all_cameras_warn":"A camera may not provide robot data. Choose one only if it is your vacuum map.","vac.all_cameras_empty":"No other camera entities found.","vac.platform_unknown":"unknown integration","vac.cap_position":"position","vac.cap_rooms_short":"rooms","vac.cap_path":"path","vac.cap_map":"map ID","vac.cap_none":"no robot data detected","vac.xcme_hint":"Enable these Xiaomi Cloud Map Extractor attributes:","vac.documentation":"Documentation","vac.residual_title":"Check automatic calibration","vac.residual_message":"The matched rooms disagree by up to {error}. Apply this approximate calibration, refine it manually, or cancel without changing the saved setup.","vac.apply_proposal":"Apply","gs.backup_group":"Backup and transfer","gs.backup_hint":"Download a portable JSON backup or preview and import a backup made by House Plan.","backup.export_open":"Export","backup.import_open":"Import","backup.export_title":"Export House Plan","backup.import_title":"Import House Plan","backup.export_hint":"Choose whether the backup should contain the whole House Plan configuration or only the current space.","backup.full":"Full backup","backup.current_space":"Current space","backup.current_space_title":"Current space: {title}","backup.no_current_space":"No current space","backup.plan_only":"Plan only","backup.plan_only_hint":"Keep rooms, walls, openings, decor and room-label positions without devices or Home Assistant bindings.","backup.plan_only_preview":"This file contains the plan only","backup.privacy_warning":"The archive keeps names, Home Assistant identifiers and exact coordinates. Internal plans and attachments are referenced, not embedded; runtime states and vacuum trails are not included.","backup.download":"Download JSON","backup.export_done":"Backup downloaded","backup.reading":"Checking the backup…","backup.revalidated":"The plan changed after this preview. The summary was refreshed; review it and confirm again.","backup.error.support_invalid_message":"Check the support message and try again.","backup.error.support_package_too_large":"The anonymized support package exceeds the 8 MiB limit.","backup.error.support_preview_expired":"The support attachment preview expired or is no longer available.","backup.error.support_rate_limited":"Too many support reports or previews were requested. Try again later.","backup.error.support_rejected":"The report did not pass support service validation.","backup.error.support_unavailable":"The private support service is temporarily unavailable.","backup.error.unauthorized":"You do not have permission to export or import this plan.","backup.error.not_ready":"House Plan is not ready yet. Try again in a moment.","backup.error.too_large":"The backup exceeds the 8 MiB limit.","backup.error.invalid_json":"The selected file is not valid JSON.","backup.error.invalid_format":"The selected file is not a House Plan backup.","backup.error.invalid_image":"The image is damaged or does not match its format.","backup.error.unsupported_export_version":"This backup format is not supported by the installed version.","backup.error.unsupported_image":"Use a supported PNG, JPEG, WebP or SVG image.","backup.error.future_model":"The backup was created by a newer House Plan data model.","backup.error.invalid_config":"The backup contains an invalid House Plan configuration.","backup.error.wall_model_migration_blocked":"The backup wall model could not be upgraded safely. Optimize the source plan first, then export it again.","backup.error.invalid_layout":"The backup contains invalid object positions.","backup.error.invalid_content":"The backup contains invalid or inconsistent content references.","backup.error.space_not_found":"The selected space no longer exists.","backup.error.capacity_exceeded":"Adding this backup would exceed the plan limits.","backup.error.preview_expired":"The preview expired. Select the backup file again.","backup.error.preview_owner_mismatch":"This preview belongs to another Home Assistant user.","backup.error.conflict":"The plan changed after the preview. Review the refreshed summary.","backup.error.content_confirmation_required":"Confirm that unavailable local content may be detached.","backup.error.commit_failed":"The backup could not be applied safely. The previous plan was restored or is pending recovery.","backup.error.missing_plan":"A referenced plan file disappeared after the preview. Review the backup again.","backup.error.missing_content":"A referenced local attachment disappeared after the preview. Review the backup again.","backup.error.marker_control_missing":"A linked plan light is missing from the backup.","backup.error.marker_control_not_light":"A linked plan target is no longer marked as a light source.","backup.error.marker_control_self":"A light source cannot control itself.","backup.error.marker_control_cycle":"The backup contains a circular chain of light controls.","backup.error.duplicate_marker_control":"The backup contains a duplicate plan-light link.","backup.error.no_backup":"There is no import or optimization snapshot to restore.","backup.error.in_use":"The item is still in use","backup.error.invalid_data":"The request carries invalid data","backup.error.invalid_light_entity":"The leading light must be a light.* or switch.* entity","backup.error.invalid_marker_control":"Invalid marker control reference","backup.error.invalid_name":"The name is invalid","backup.error.invalid_partition_opening_host":"The opening must keep its partition host","backup.error.invalid_partition_opening_jamb_margin":"The opening leaves no physical jamb at the wall end","backup.error.invalid_passage_fields":"An open passage cannot carry door-only settings","backup.error.invalid_space_id":"Unknown space","backup.error.invalid_toggle_entity":"The toggle entity must be light.* or switch.*","backup.error.invalid_value_badge":"Invalid value badge settings","backup.error.invalid_value_badge_attribute":"Invalid value badge attribute","backup.error.invalid_value_badge_position":"Invalid value badge position","backup.error.invalid_value_badge_source":"Invalid value badge source","backup.error.invalid_vacuum_map_route":"Check how the robot's maps are assigned to spaces.","backup.error.invalid_value_source":"Invalid value source","backup.error.invalid_value_source_attribute":"Invalid value source attribute","backup.error.io_error":"A file operation failed on the server","backup.error.not_toggleable":"This device cannot be toggled","backup.error.nothing_to_repair":"Nothing to repair","backup.error.space_in_use":"The space is still referenced","backup.error.value_badge_source_required":"The value badge needs a source","backup.error.wall_model_client_outdated":"The plan was updated elsewhere — reload the page","backup.same_source":"Created on this Home Assistant instance","backup.foreign_source":"Created on another Home Assistant instance","backup.created":"Created: {value}","backup.versions":"Card {card}; integration {integration}; data model {model}","backup.count_spaces":"Spaces: {n}","backup.count_rooms":"Rooms: {n}","backup.count_walls":"Walls: {n}","backup.count_openings":"Openings: {n}","backup.count_decor":"Decor objects: {n}","backup.count_markers":"Devices: {n}","backup.count_layout":"Positions: {n}","backup.bindings":"Bindings — devices: {device}, entities: {entity}, virtual: {virtual}; positions without a space: {legacy}","backup.binding_status":"Target status — active: {active}, disabled: {disabled}, missing: {missing}","backup.missing_areas":"Areas missing on the target: {areas}","backup.dropped_marker_links":"Plan-light links outside this transferred space were omitted: {n}.","backup.room_drafts_migrated":"Legacy unfinished contours converted to ordinary walls: {drafts}; wall segments: {segments}.","backup.repaired_target_refs":"Existing references restored by this space import: {n}.","backup.preserved_unresolved_refs":"References that could not be restored unambiguously were preserved: {n}.","backup.preserved_unresolved_hint":"No data was guessed or deleted. After the import, run Optimize plans to inspect the remaining references.","backup.import_details":"Import reference details","backup.import_detail.incoming_remapped":"References updated inside the imported copy: {n}","backup.import_detail.target_repaired":"Existing references restored: {n}","backup.import_detail.preserved_unresolved":"Unresolved references preserved: {n}","backup.import_detail.collisions":"Destination conflicts preserved safely: {n}","backup.import_detail.dropped_links":"Incoming links omitted by transfer rules: {n}","backup.import_detail.bounded_lineages":"Overly nested identifiers left bounded: {n}","backup.replace_warning":"This replaces the current configuration and layout. Uploaded files are never deleted. One undo remains available until the next plan edit.","backup.foreign_bookkeeping":"Instance-specific known/new-device bookkeeping will not be imported.","backup.final_name":"New space name","backup.target_settings":"The target instance's global settings remain unchanged.","backup.duplicates":"Bindings already present: {n}","backup.skip":"Skip duplicate devices","backup.virtual_copy":"Add safe static virtual copies","backup.content":"Referenced content","backup.decor_images_summary":"Custom images: {objects} objects, {assets} files; missing files: {missing}.","backup.content_available":"available locally","backup.content_external":"external link","backup.content_detach_required":"will be detached","backup.confirm_detach":"I understand that unavailable internal plans and attachments will be detached from the imported configuration.","backup.confirm_missing_images":"I understand that missing custom images will remain as repair placeholders and other unavailable local files will be detached.","backup.replace":"Replace","backup.add":"Add space","backup.space_done":"Space imported: {rooms} rooms, {markers} devices, {refs} existing references restored","backup.full_done":"Backup restored: {spaces} spaces, {rooms} rooms, {markers} devices","backup.undo_import":"Undo last full import","backup.import_undone":"Full import undone","backdrop.large_title":"Large image","backdrop.large_body":"This image is {w}×{h} ({fileMb} MB file) and needs about {decodedMb} MB of memory to display. On tablets this can crash the page.","backdrop.unknown_body":"The image dimensions could not be read — the file may be damaged. Continuing may crash the page on tablets.","backdrop.reduced_dimensions":"Reduced copy: {w}×{h} px.","backdrop.use_downscaled":"Upload a reduced copy","backdrop.reducing":"Reducing…","backdrop.keep_original":"Keep the original","backdrop.too_large_title":"Image is too large","backdrop.too_large_body":"This image exceeds what browsers can display ({w}×{h}, limit {limit} px per side). Please reduce it in a desktop editor and upload again.","backdrop.downscale_failed":"Could not create the reduced copy. The original plan was not changed."};const ap=new WeakSet,lp=new WeakSet;function cp(e,t,i){const n=i?t.state(i):"ready";return i&&"pending"===n?(lp.has(e)||(e.inert=!0,e.setAttribute("aria-busy","true"),lp.add(e)),t.ensure(i).then(()=>{e.isConnected&&e.requestUpdate()}),ap.has(e)?"warm":"cold"):(lp.delete(e)&&(e.inert=!1,e.removeAttribute("aria-busy")),i&&(e.setAttribute("lang","fallback"===n?"en":i),ap.add(e)),"ready")}function hp(){return j``}const dp=[{code:"en",nativeLabel:"English",dictionary:sp},{code:"ru",nativeLabel:"Русский",dictionary:{"editor.context_actions":"Действия: {object}","editor.tool_options":"Параметры инструмента: {tool}","editor.palette":"Палитра: {tool}","editor.open_group":"Группа инструментов: {group}","editor.group_active":"{group} — активно: {item}","editor.disabled_action":"{action} недоступно: {reason}","editor.loading":"Загружаем редактор…","editor.loading_aria":"Редактор плана загружается","editor.load_failed":"Не удалось загрузить редактор.","editor.refresh_advice":"Обновите страницу и повторите попытку.","editor.retry_advice":"Проверьте сеть и нажмите ещё раз.","version_mismatch.title":"Версии House Plan не совпадают","version_mismatch.body":"Если Home Assistant ещё перезапускается, дождитесь завершения, затем перезагрузите эту страницу.","version_mismatch.frontend":"Карточка","version_mismatch.backend":"Интеграция","version_mismatch.reload":"Перезагрузить страницу","color_picker.title":"Выбор цвета","color_picker.hue":"Оттенок","color_picker.saturation":"Насыщенность","color_picker.value":"Яркость","color_picker.hex":"Цвет HEX","color_picker.invalid_hex":"Введите цвет HEX из 3 или 6 цифр","color_picker.confirm":"ОК","btn.properties":"Свойства","btn.keep_as_walls":"Оставить стенами","btn.delete_room_keep_walls":"Удалить комнату, оставить стены","btn.delete_room_with_walls":"Удалить комнату и стены","title.markup_select":"Выбор и редактирование стен и колонн","title.markup_column":"Колонна: кликните точку сетки для квадратной колонны","markup.partition":"Перегородка","markup.column":"Колонна","markup.hint_column":"кликните точку сетки, чтобы поставить квадратную колонну","history.wall_segment":"Добавление отрезка стены","history.column_add":"Добавление колонны","history.physical_edit":"Изменение физического объекта","history.physical_delete":"Удаление физического объекта","history.physical_move":"Перемещение физического объекта","history.wall_face_batch":"Создание комнат из стен","toast.column_duplicate":"Колонна с тем же центром и внешним размером уже существует","physical.partition_properties":"Свойства перегородки","physical.column_properties":"Свойства колонны","physical.shape":"Форма","physical.square":"Квадрат","physical.circle":"Круг","physical.diameter":"Диаметр","physical.side":"Сторона","physical.rotation":"Угол поворота","physical.length":"Длина","physical.allowed_range":"Допустимо: {min}–{max} {unit}","physical.column_size_title":"Внешняя сторона квадратной колонны, создаваемой кликом (1–150 см).","card.title":"План дома","count.devices":"{n} устр.","empty.no_spaces":"Пространств пока нет.","nav.spaces":"Пространства House Plan","empty.add_first":"Добавьте первое пространство и загрузите план этажа.","empty.read_only":"Пространства не настроены. Попросите администратора добавить первое.","empty.install":"Установите интеграцию House Plan и добавьте запись в «Устройства и службы».","btn.add_space":"Добавить пространство","btn.cancel":"Отмена","btn.save":"Сохранить","btn.close":"Закрыть","btn.delete":"Удалить","btn.copy":"Копировать","btn.edit":"Редактировать","btn.open_in_ha":"Открыть в HA","btn.reset":"Сброс","btn.attach":"Прикрепить…","btn.upload":"Загрузить…","btn.replace":"Заменить…","title.zoom_in":"Приблизить","title.zoom_out":"Отдалить","title.zoom_fit":"Вписать всё","title.configure_space":"Настроить пространство","title.add_space":"Добавить пространство","title.markup_add":"Стены: рисуйте непрерывную цепочку; каждый принятый отрезок сохраняется отдельно. Shift фиксирует 45°","title.markup_merge":"Объединить: клик по одной комнате, затем по соседней с общей стеной","title.markup_split":"Разделить комнату: клик по комнате, затем две точки на её стенах","title.markup_delroom":"Удалить комнату: кликните внутри комнаты и подтвердите удаление","title.need_plan":"Загрузите подложку (план этажа)","markup.add":"Стены","markup.merge":"Объединить","markup.split":"Разделить","markup.resize":"Размер","title.markup_resize":"Изменение размера комнат: тяните доступную ручку горизонтальной или вертикальной стены","markup.hint_resize":"тяните доступную ручку стены · стена упирается в первую небезопасную позицию · Esc — отмена · Ctrl+Z — отмена шага","resize.disabled.diagonal":"Стена расположена под углом: Resize поддерживает только горизонтальные и вертикальные стены","resize.disabled.side-angle":"Примыкающая стена расположена под углом: для Resize обе примыкающие стены должны образовывать прямой угол","resize.disabled.duplicate-physical-wall":"Стену перекрывает отдельная перегородка или колонна; удалите или переместите её перед изменением размера","resize.disabled.partial-shared":"Соседняя комната использует только часть этой стены, поэтому её нельзя безопасно двигать как одну общую стену","resize.disabled.unequal-shared":"У соседней комнаты другие конечные точки или длина стены, поэтому стены нельзя безопасно двигать вместе","resize.disabled.multiple-rooms":"Перемещение затронуло бы больше двух комнат","resize.disabled.thickness-conflict":"Толщину стены нельзя безопасно сохранить","resize.disabled.opening-conflict":"Проём на этой стене нельзя безопасно переместить","resize.disabled.invalid-geometry":"Эту стену нельзя переместить без изменения структуры плана","resize.limit_stopped":"Стена остановлена: дальше нарушается ограничение стыков","resize.commit_failed":"Изменение размера отменено: итоговый план не прошёл проверку геометрии","resize.preview_failed":"Стена остановлена в последней безопасной позиции: геометрию плана нельзя сохранить без потерь","markup.opening":"Проём","markup.delete_room":"Удалить комнату","history.undo":"Отменить","history.redo":"Повторить","history.undo_named":"Отменить: {name} (Ctrl+Z)","history.redo_named":"Повторить: {name} (Ctrl+Shift+Z / Ctrl+Y)","history.undo_empty":"Нет операций для отмены","history.redo_empty":"Нет операций для повтора","history.undone":"Отменено: {name}","history.redone":"Повторено: {name}","history.add_room":"Создание комнаты","history.split_room":"Разделение комнаты","history.merge_rooms":"Объединение комнат","history.resize_room":"Изменение размера комнаты","history.wall_thickness":"Изменение толщины стены","history.add_opening":"Добавление дверного или оконного проёма","history.edit_opening":"Изменение проёма","history.move_opening":"Перемещение проёма","history.delete_opening":"Удаление проёма","history.delete_room_keep_walls":"Удаление комнаты с сохранением стен","history.delete_room_with_walls":"Удаление комнаты и её стен","history.decor_add":"Добавление объекта декора","history.decor_edit":"Изменение объекта декора","history.decor_move":"Перемещение объекта декора","history.decor_transform":"Трансформация объекта декора","history.decor_delete":"Удаление объекта декора","history.backdrop_transform":"Трансформация подложки плана","history.device_move":"Перемещение: {name}","history.device_stale":"История позиций больше неприменима и была очищена","opening.new":"Новый проём","opening.edit":"Проём","opening.door":"Дверь","opening.window":"Окно","opening.gate":"Ворота","opening.passage":"Открытый проём","opening.passage_binding_warning":"При сохранении датчик открытия и замок будут удалены.","opening.invalid_passage_fields":"У открытого проёма на плане «{room}» есть недопустимые параметры: {fields}.","opening.type_label":"Тип","opening.length_label":"Длина, см","opening.contact_label":"Датчик открытия","opening.lock_label":"Замок","opening.none":"— нет —","opening.search_ph":"Поиск: имя или entity_id…","opening.invert":"Инвертировать открыто/закрыто","opening.flip_h":"Петли с другой стороны","opening.flip_v":"Открывается в другую сторону","opening.open":"Открыто","opening.closed":"Закрыто","opening.locked":"Заперто","opening.unlocked":"Не заперто","opening.state_unknown":"недоступно","opening.no_entities":"Датчики не привязаны — статичный символ на плане.","toast.opening_no_wall":"Кликните рядом со стеной комнаты или независимой стеной","opening.host_partition":"Независимая стена","opening.partition_orphan":"Независимая стена этого проёма больше не существует","opening.partition_jamb_margin":"Оставьте от края проёма до торца стены минимум {distance}","opening.rebind_partition":"Привязать к другой независимой стене","confirm.delete_partition_openings_title":"Удалить стену и проёмы?","confirm.delete_partition_openings_body":"В стене есть проёмы: {count}. Они будут удалены вместе со стеной.","confirm.delete_partition_openings_item":"• {type}, {length}","markup.hint_points":"точек: {n} · Shift — шаг 45° · Esc — завершить цепочку · Ctrl+Z — убрать точку · при замыкании будет предложена комната","markup.hint_start":"кликните точку сетки, чтобы начать цепочку стен","tip.lqi":"средний сигнал zigbee:","tip.area":"площадь: {value}","info.device_header":"Устройство на плане","info.model":"Модель","info.state":"Состояние","info.link":"Ссылка","info.manuals":"Инструкции","info.none":"Нет дополнительной информации","marker.new_device":"Новое устройство","marker.name_label":"Имя (отображается на плане)","marker.name_ph":"Название","marker.binding_label":"Привязка к устройству HA","marker.binding_disabled":"деактивировано в Home Assistant","marker.virtual_option":"Виртуальное устройство (без привязки)","marker.search_ph":"Поиск устройства / группы…","marker.nothing_found":"ничего не найдено","marker.room_label":"Комната","marker.room_override":" (переопределить размещение)","marker.room_choose":"— выберите комнату —","marker.room_auto":"— по зоне устройства (авто) —","marker.icon_label":"Иконка","marker.icon_ph":"mdi:… (пусто = авто)","marker.display_label":"Отображение","display.badge":"Значок + состояние","display.icon_ripple":"Значок + состояние и активность","display.static_icon":"Всегда статичный значок","marker.display_hint_badge":"Значок и динамическая подложка показывают состояние устройства без обычной пульсации активности. Красная тревога сохраняется.","marker.display_hint_icon_ripple":"Значок, динамическая подложка и пульсация: короткая — для событий, постоянная — для работы, движения или присутствия. Красная тревога имеет отдельный приоритет.","marker.display_hint_value":"Значок заменяется выбранным или автоматически найденным значением Home Assistant; подложка продолжает показывать состояние. Красная тревога сохраняется.","marker.display_hint_static_icon":"Подложка в цветах темы и значок всегда остаются одинаковыми. Состояния, активность, недоступность и тревоги не меняют отображение.","marker.static_alarm_warning":"Это устройство может сообщать о тревогах. Статичный режим скрывает визуальную тревогу маркера.","marker.preview.title":"Предпросмотр отображения","marker.preview.actual":"Сейчас","marker.preview.example":"Пример","marker.preview.integration":"Интеграция","marker.preview.source":"Источник отображения","marker.preview.current_state":"Текущее состояние","marker.preview.result":"На плане","marker.preview.details":"Подробнее об источниках","marker.preview.select_source":"Выберите устройство или сущность Home Assistant, чтобы увидеть фактическое отображение.","marker.preview.unknown_provider":"Интеграция неизвестна","marker.preview.virtual_provider":"House Plan · виртуальное устройство","marker.preview.no_source":"Нет активного источника","marker.preview.no_state":"Нет текущего состояния","marker.preview.mixed_states":"Несколько разных состояний","marker.preview.multiple_sources":"Источников: {n}","marker.preview.more_sources":"ещё {n}","marker.preview.scaled":"Предпросмотр уменьшен до {n}%, чтобы поместиться. Сохранённый размер не изменится.","marker.preview.demo_short":"Показать краткую активность","marker.preview.demo_continuous":"Показать постоянную активность","marker.preview.stop_continuous":"Остановить постоянную активность","marker.preview.demo_short_notice":"Пример краткой активности; фактическое состояние устройства не меняется.","marker.preview.demo_continuous_notice":"Пример постоянной активности; фактическое состояние устройства не меняется.","marker.preview.demo_already_visible":"Текущее состояние уже показывает реальную активность или тревогу.","marker.preview.reduced_motion":"В системе включено уменьшение движения, поэтому обычная активность показана точкой.","marker.preview.reason.neutral":"Нейтральная тёмная подложка","marker.preview.reason.working":"Жёлтая подложка: устройство сейчас работает","marker.preview.reason.working_activity":"Жёлтая подложка и эффект активности: устройство сейчас работает","marker.preview.reason.open":"Оранжевая подложка: физически открыто или разблокировано","marker.preview.reason.cover_icon_state":"Нейтральная подложка; состояние и значок определяет сущность шторы или заслонки","marker.preview.reason.presence":"Эффект активности, пока обнаружено присутствие","marker.preview.reason.event":"Короткий эффект активности после события","marker.preview.reason.transition":"Эффект активности во время движения или смены состояния","marker.preview.reason.media_neutral":"Медиаустройство остаётся на нейтральной тёмной подложке, пока доступно","marker.preview.reason.unavailable":"Приглушённая нейтральная подложка: отключено или недоступно","marker.preview.reason.alarm":"Красная тревожная подложка; тревога отображается всегда","marker.preview.reason.live_states_disabled":"Оформление по живым состояниям отключено в настройках карточки","marker.preview.reason.value_no_state":"Нет подходящего значения состояния — вместо него показан значок","marker.preview.reason.value_ambiguous_sources":"Подходит несколько источников значения — вместо него показан значок","marker.preview.reason.value_non_scalar":"Источник вернул не простое значение — вместо него показан значок","marker.preview.reason.value_virtual":"У виртуального устройства нет значения HA — вместо него показан значок","marker.preview.reason.vacuum_live_plan_only":"Живая позиция и след пылесоса доступны только на полном плане","marker.preview.reason.hidden_design_preview":"Устройство скрыто на плане, но его оформление видно в предпросмотре","marker.preview.reason.composite_power_source":"Состояние берётся из сущности питания устройства; вспомогательные переключатели не учитываются","marker.preview.reason.activity_display_disabled":"Выбранный режим отображения не показывает обычные эффекты активности","marker.preview.reason.ha_disabled":"Привязка отключена в Home Assistant, поэтому устройство будет скрыто на плане","marker.preview.reason.orphaned":"Сохранённая привязка Home Assistant больше не найдена","marker.preview.reason.static_icon":"Статичный режим: состояние устройства не меняет значок","marker.activity_color":"Цвет пульсации активности","marker.ripple_size":"Размер пульсации активности","marker.activity_alarm_note":"Цвет и размер относятся только к обычной активности и не влияют на красную тревогу.","marker.pulse_a11y_alarm":"Тревога","marker.pulse_a11y_event":"Недавнее событие","marker.pulse_a11y_presence":"Обнаружено присутствие","marker.pulse_a11y_transition":"Изменение состояния","marker.pulse_a11y_running":"Работает","marker.state_a11y_neutral":"Обычное состояние","marker.state_a11y_working":"Работает","marker.state_a11y_open":"Открыто","marker.state_a11y_locked":"Заблокировано","marker.state_a11y_unlocked":"Разблокировано","marker.state_a11y_alarm":"Тревога","marker.state_a11y_unavailable":"Недоступно","marker.lqi_a11y_low":"LQI {value}, слабый сигнал","marker.lqi_a11y_mid":"LQI {value}, средний сигнал","marker.lqi_a11y_high":"LQI {value}, сильный сигнал","marker.size_label":"Размер / поворот значка","marker.angle_label":"Поворот","marker.model_label":"Модель","marker.model_ph":"напр. Aqara T&H","marker.link_label":"Ссылка","marker.desc_label":"Описание","marker.desc_ph":"Заметки, характеристики…","marker.manuals_label":"Инструкции (PDF и т.п.)","marker.sub_device":"устройство","marker.sub_z2m_group":" · Z2M-группа","marker.sub_group":"группа","marker.sub_helper":"хелпер","space.new":"Новое пространство","space.copy_title":"Копирование пространства","space.copy_name":"Название нового пространства","space.copy_fallback":"Пространство","space.copy_create":"Создать копию","space.copy_optimize_title":"Оптимизировать перед копированием?","space.copy_optimize_body":"Перед созданием «{name}» House Plan должен оптимизировать весь план, включая другие пространства. Продолжить?","space.copy_optimize_confirm":"Оптимизировать и скопировать","space.copy_error_changed":"План изменился, пока было открыто подтверждение. Проверьте его и повторите попытку.","space.copy_error_source_missing":"Исходного пространства больше нет. Снова откройте его настройки и повторите попытку.","space.copy_error_source_invalid":"House Plan не смог проверить все стены этого пространства. Исправьте исходное пространство и повторите попытку.","space.copy_error_spaces_limit":"В House Plan уже создано максимальное число пространств.","space.copy_error_partitions_limit":"В этом пространстве слишком много стен для копирования.","space.copy_error_openings_limit":"В этом пространстве слишком много проёмов для копирования.","space.copy_error_decor_limit":"В этом пространстве слишком много элементов подложки для копирования.","space.copy_error_columns_limit":"В этом пространстве слишком много колонн для копирования.","space.copy_error_opening_host":"Один из проёмов больше не привязан к стене. Исправьте или удалите его перед копированием.","space.copy_error_geometry":"Копия создаст небезопасную геометрию стен. Исправьте исходное пространство и повторите попытку.","space.copy_error_optimize_geometry":"Копирование остановлено: оптимизация всего плана небезопасна для одного из пространств.","space.header":"Пространство","space.title_label":"Название","space.title_ph":"Например: Гараж","space.plan_label":"Подложка (план)","space.no_plan":"нет подложки","space.plan_alt":"план","room.new":"Новая комната","room.name_label":"Отображаемое имя","room.name_ph":"Например: Терраса","room.area_label":"Зона Home Assistant (свободные)","room.no_area_option":"— без зоны —","room.default_name":"Комната","device.unnamed":"без имени","device.light_group":"группа света","device.fallback":"устройство","device.virtual":"виртуальное устройство","confirm.delete_room_title":"Удалить комнату «{name}»?","confirm.delete_room_body":"Выберите, нужно ли оставить физические стены, принадлежащие только этой комнате. Общие с другой комнатой стены сохраняются всегда.","confirm.remove_marker_title":"Удалить устройство с плана?","confirm.remove_marker_body":"Устройство исчезнет полностью и перестанет участвовать в данных плана. Позже его можно будет добавить заново.","confirm.erase_decor":"Стереть объект «{kind}»? Действие можно отменить из истории редактора.","confirm.delete_space_title":"Удалить пространство?","confirm.delete_space_body":"Пространство, все его комнаты и вся разметка плана будут удалены.","confirm.delete_space_vac_routes":"Также будет снято сопоставление карт роботов: {count}.","space.delete_blocked":"Это пространство всё ещё используется устройствами: {n}. Сначала перенесите их в другое пространство или удалите.","toast.pos_save_failed":"Не удалось сохранить позицию: {err}","toast.no_entity":"У устройства нет подходящей сущности","toast.ha_disabled_action":"Деактивированный объект Home Assistant нельзя использовать на плане.","toast.ha_disabled_show_device":"Деактивированное в Home Assistant устройство нельзя показать на плане. Сначала активируйте его в Home Assistant.","toast.ha_disabled_show_entity":"Деактивированную в Home Assistant сущность нельзя показать на плане. Сначала активируйте её в Home Assistant.","toast.ha_disabled_add":"Деактивированный объект Home Assistant нельзя добавить на план. Сначала активируйте его в Home Assistant.","toast.ha_binding_unverified":"Статус объекта не удалось подтвердить по реестру Home Assistant. Отображение и действия временно недоступны.","toast.markup_needs_server":"Разметка доступна после переноса конфига на сервер","toast.space_order_changed":"Порядок изменён. Если где-то этаж карточки задан номером, проверьте такие панели.","toast.conflict":"Конфиг изменён в другом окне — данные обновлены, повторите последнее действие","toast.cfg_save_failed":"Не удалось сохранить конфиг: {err}","toast.room_overlap":"Контур накладывается на комнату «{name}» — комнаты не должны накладываться","toast.contour_cannot_close":"Контур нельзя замкнуть: он вырожден или пересекает сам себя","toast.merge_not_adjacent":"Объединять можно только комнаты с общей стеной","toast.rooms_merged":"Комнаты объединены в «{name}»","toast.split_pick_wall":"Начните разрез на стене комнаты","toast.split_bad_cut":"Разрез — от стены до стены внутри комнаты, без пересечения стен и самого себя","merge.header":"Объединение комнат","merge.hint":"У объединённой комнаты одно имя и одна зона. Вторая зона освобождается — её устройства уйдут с плана, пока их не заберёт другая комната.","merge.keep":"Оставить","merge.no_area":"без зоны","toast.room_saved":"Комната сохранена ({n}). Устройств добавлено: {added}. Обведите следующую или выйдите из разметки.","toast.room_saved_no_area":"Комната сохранена ({n}, без зоны). Обведите следующую или выйдите из разметки.","toast.marker_needs_server":"Редактирование устройств доступно после переноса конфига на сервер","toast.virtual_name_required":"Укажите имя виртуального устройства","toast.marker_saved":"Устройство сохранено","toast.marker_removed":"Устройство удалено с плана","toast.integration_missing":"Интеграция House Plan не установлена — управление недоступно","toast.plan_formats":"Поддерживаются SVG, PNG, JPG, WebP","toast.plan_required":"Загрузите подложку — план этажа обязателен","toast.space_added_onboard":"Пространство добавлено. Обведите комнаты: кликайте по точкам сетки и замкните контур.","toast.space_added":"Пространство добавлено","toast.space_copied":"Пространство «{name}» создано","toast.space_saved":"Пространство сохранено","toast.space_deleted":"Пространство удалено","toast.delete_failed":"Ошибка удаления: {err}","toast.error":"Ошибка: {err}","toast.toggle_target_unavailable":"Цель «{name}» недоступна — действие не выполнено","toast.toggle_targets_unavailable":"Цели недоступны: {names}. Действие не выполнено","toast.file_failed":"Файл «{name}» не загружен: {err}","toast.files_attached":"Прикреплено файлов: {n}","err.unknown":"неизвестная ошибка","err.code":"код {code}","err.too_large":"файл больше {mb} МБ","err.bad_ext":"недопустимый тип (нужен PDF/изображение)","err.unauthorized":"нужны права администратора","editor.title":"Заголовок","editor.default_floor":"Стартовое пространство","editor.default_floor_missing":"Стартовое пространство «{id}» больше не существует. Выберите другое.","editor.floor":"Закреплённое пространство","editor.floor_none":"— не закреплять —","editor.floor_index":"YAML-индекс {index} (сохранён)","fixed_floor.loading":"Загружаем закреплённое пространство…","fixed_floor.invalid_title":"Закреплённое пространство недоступно","fixed_floor.invalid_body":"Проверьте floor в конфигурации карточки. Настроенное значение: {value}","editor.icon_size":"Размер иконок, % ширины плана","editor.show_temperature":"Показывать температуру","editor.live_states":"Живые состояния (вкл/выкл, открыто…)","editor.light_pools":"Световые пулы и тени от стен","editor.show_signal":"Показывать сигнал zigbee (LQI)","editor.language":"Язык интерфейса","editor.lang_auto":"Авто (профиль HA)","title.icon_rules":"Правила иконок: какая MDI-иконка достаётся устройству по имени","rules.title":"Правила иконок","rules.hint":"Правила проверяются сверху вниз по строке «имя устройства + модель» (regex без учёта регистра); срабатывает первое совпадение. Если ничего не подошло — решает device class сущности, затем — иконка-заглушка.","rules.pattern_ph":"regex, напр. розетк|plug","rules.icon_ph":"mdi:power-socket-de","rules.add":"Добавить правило","rules.reset":"Сбросить к умолчаниям","rules.test_ph":"Проверьте имя устройства…","rules.invalid":"некорректный regex","rules.saved":"Правила иконок сохранены","btn.up":"Вверх","btn.down":"Вниз","tap.info":"Карточка устройства","tap.more_info":"Диалог HA (more-info)","tap.toggle":"Переключить состояние","marker.tap_label":"Действие по нажатию для этого устройства","tap.toggle_note":"Под селектором показано, какое состояние изменится. Защищённые устройства не переключаются с плана.","import.title":"Создать пространства из этажей HA","import.hint":"Home Assistant уже знает эти этажи. Отметьте, какие превратить в пространства плана — далее для каждого попросим картинку плана. Комнаты затем обводятся вручную по плану.","import.start":"Создать: {n}","import.manual":"Начать с нуля","import.progress":"Этаж {i} из {n}","import.done":"Пространства созданы. Обведите комнаты: кликайте по точкам сетки и замкните контур.","btn.skip":"Пропустить","space.scale_label":"Масштаб (размер клетки сетки)","space.cell_cm.help":"Связывает сетку с реальными размерами: от значения зависят длины и площади, толщина стен, размеры проёмов и радиус свечения. Изменение после разметки меняет расчётные размеры всего пространства, но не двигает его точки на плане.","space.cell_cm.help.aria":"Подсказка: масштаб пространства","space.scale_unit":"см на клетку","space.scale_unit_imperial":"дюйм на клетку","space.display_section":"Отображение","space.show_borders":"Всегда отображать границы комнат","space.zero_wall_style":"Стены нулевой толщины","space.zero_wall_style.help":"Пунктирные стены нулевой толщины пропускают Glow и солнечные лучи, сплошные блокируют их как барьер нулевой площади. Выбор меняет все такие стены пространства, даже когда их линии скрыты в просмотре.","space.zero_wall_style.help.aria":"Подсказка: вид стен нулевой толщины","space.zero_wall_dashed":"Пунктирные","space.zero_wall_solid":"Сплошные","space.show_names":"Отображать названия комнат (перетаскиваются)","space.room_color":"Цвет границ и названий","space.opacity":"Прозрачность","space.fill_label":"Заливка комнат","space.fill_mode.help":"«Свой цвет» задаёт оформление, а «Свет», «Температура» и «LQI» используют текущие данные Home Assistant; Glow включается отдельно.","space.fill_mode.help.aria":"Подсказка: режим заливки комнат","fill.none":"Нет","fill.lqi":"По силе зигби-сигнала","fill.light":"По освещению","fill.custom":"Свой цвет","space.custom_fill":"Цвет заливки","space.source_file":"У меня есть картинка плана","space.source_draw":"Нет подложки — нарисую комнаты вручную","fill.temp":"По температуре","tip.temp_avg":"средняя температура:","tip.hum_avg":"средняя влажность:","space_card.button":"Перейти к пространству","space_card.not_found":"Пространство «{id}» не найдено","space_card.loading":"Загрузка…","continuity.restore_plan":"Восстанавливаем план…","continuity.restore_connection":"Восстанавливаем подключение к устройствам…","continuity.retry":"Повторить","editor.space":"Пространство","editor.framing":"Кадрирование","editor.fit_content":"Всё видимое содержимое","editor.fit_house":"Плотно по геометрии дома","editor.show_button":"Показывать кнопку","editor.button_label":"Текст кнопки","editor.button_target":"Путь дашборда (куда вести)","marker.sub_entity":"сущность","title.general_settings":"Общие настройки","title.export_pdf":"Сохранить в PDF","pdf.title":"Сохранение в PDF","pdf.dimensions":"Отображать размеры и площади","pdf.decor":"Отображать мебель и другой декор","pdf.room_names":"Отображать названия комнат","pdf.backdrop":"Отображать подложку","pdf.save":"Сохранить","pdf.saving":"Формируем…","pdf.failed":"Не удалось создать PDF.","pdf.too_large":"Размер изображений превышает лимит PDF 25 МБ.","pdf.asset_failed":"Не удалось загрузить подложку или изображение декора.","pdf.scale":"Масштаб 1:{n}","pdf.north":"Север","gs.title":"Общие настройки","gs.light_group":"Заливка: освещение","gs.light_on":"Свет включён","gs.light_off":"Весь свет выключен","gs.temp_group":"Заливка: температура","gs.temp_cold":"Холодно","gs.temp_ok":"Комфорт","gs.temp_hot":"Жарко","gs.lqi_group":"Заливка: зигби-сигнал","gs.lqi_low":"Слабый сигнал","gs.lqi_high":"Сильный сигнал","gs.reset":"Сбросить к умолчаниям","gs.saved":"Общие настройки сохранены","gs.radar_show_live":"Показывать текущее присутствие на плане","gs.radar_show_live_hint":"Скрывает или показывает все живые цели радаров. Это не запускает и не останавливает запись наблюдений.","radar.title":"Присутствие на плане","radar.help":"Свяжите маркер с точными сущностями радара Home Assistant, укажите положение датчика и профиль координат. Живые позиции обрезаются по выбранной комнате.","radar.help.aria":"Подсказка: настройки радара присутствия","radar.enabled":"Использовать этот радар присутствия","radar.show_live":"Показывать живые цели","radar.configure":"Настроить радар","radar.configure_on_plan":"Настроить на плане","radar.change_installation":"Сменить установку","radar.no_contour":"У комнаты нет контура. Точки радара не будут обрезаться по комнате.","radar.discard_setup_title":"Отменить настройку радара?","radar.discard_setup":"Несохранённая настройка радара будет потеряна.","radar.step_place_mount":"Укажите физическое положение датчика","radar.step_place_heading":"Укажите точку прямо перед датчиком","radar.step_reference":"Укажите контрольное положение {n}, затем начните измерение","radar.step_check_reference":"Укажите независимое проверочное положение","radar.start_measure":"Начать измерение","radar.countdown":"Встаньте в отмеченное место через {seconds} с","radar.capturing":"Стойте неподвижно и в одиночестве…","radar.fit_ready":"Калибровка готова","radar.check_third":"Проверить в другом положении","radar.check_complete":"Независимая проверка завершена","radar.error_distance":"Расхождение положения: {distance}","radar.ambiguous_target":"Обнаружено несколько целей. Повторите измерение в одиночестве.","radar.insufficient_samples":"Недостаточно актуальных координат. Повторите или настройте вручную.","radar.bad_references":"Выберите разнесённые положения в разных направлениях от датчика.","radar.ambiguous_sources":"Измерения допускают два одинаково вероятных направления. Выберите точки, по которым можно различить левую и правую стороны.","radar.bad_fit":"Измерения не совпадают. Проверьте единицы, положение датчика и контрольные точки.","radar.desktop_hint":"Для точной настройки используйте компьютер. Редактирование на тач-устройствах поддерживается по остаточному принципу.","radar.detected":"House Plan распознал признаки радара у этого устройства. Перед сохранением проверьте точные источники.","radar.detected_ld2450":"House Plan нашёл набор координат ESPHome LD2450. Перед сохранением проверьте точные источники X/Y.","radar.additional_actions":"Дополнительные действия","radar.declare":"Это радар присутствия","radar.profile":"Профиль данных","radar.profile_esphome_ld2450_v1":"ESPHome LD2450 (цели X/Y)","radar.profile_cartesian_v1":"Декартовы цели (X/Y)","radar.profile_polar_v1":"Полярная цель (дальность/угол)","radar.profile_range_v1":"Только дальность","radar.profile_zones_v1":"Состояния зон","radar.profile_presence_v1":"Только присутствие","radar.room":"Комната радара","radar.room_choose":"Выберите комнату","radar.target":"Цель {n}","radar.axis_x":"Сущность координаты X","radar.axis_y":"Сущность координаты Y","radar.add_target":"Добавить слот цели","radar.range_channel":"Канал дальности {n}","radar.add_range":"Добавить канал дальности","radar.presence_gate":"Сущность присутствия для слота","radar.swap_axes":"Поменять оси X и Y местами","radar.axis_x_sign":"Направление X","radar.axis_y_sign":"Направление Y","radar.distance_source":"Сущность дальности","radar.angle_source":"Сущность угла","radar.angle_unit":"Единица угла","radar.degrees":"Градусы","radar.radians":"Радианы","radar.angle_zero":"Направление нулевого угла","radar.angle_forward":"Вперёд","radar.angle_right":"Вправо","radar.angle_clockwise":"Угол растёт по часовой стрелке","radar.zone_source":"Сущность зоны","radar.occupancy_source":"Сущность присутствия","radar.count_source":"Сущность количества целей","radar.availability_source":"Сущность доступности","radar.source_choose":"Выберите сущность","radar.source_optional":"Необязательно","radar.source_missing":"сейчас недоступна","radar.saved_unsupported":"Сохранённая настройка радара не поддерживается или неполна. Она неактивна; удалите её либо обновите House Plan перед повторной настройкой.","radar.occupancy":"Присутствие (вкл/выкл)","radar.count":"Количество","radar.mount":"Положение и направление","radar.mount_hint":"Это физическое положение датчика. Перемещение его декоративного маркера не меняет установку.","radar.heading":"Направление, °","radar.range_cm":"Дальность, см","radar.fov_deg":"Угол обзора, °","radar.unit":"Единица источника","radar.mirror":"Отразить ось влево/вправо","radar.remove":"Удалить настройки радара","radar.invalid":"Перед сохранением заполните комнату, источники и положение радара.","radar.check_sources":"Проверить живые данные","radar.checking":"Проверяем…","radar.health":"Состояние подключения","radar.live_summary":"Текущих целей: {targets}; дуг дальности: {ranges}","radar.health_ok":"Актуальные данные получены","radar.health_off":"Цели не обнаружены","radar.health_stale":"Часть координат устарела","radar.health_partial":"Часть источников актуальна, часть устарела","radar.health_restricted":"Нет доступа к одному или нескольким источникам","radar.health_incomplete":"Текущий отчёт радара неполон","radar.health_position_unavailable":"Есть присутствие, но актуальное положение недоступно","radar.health_unavailable":"Данные датчика недоступны","radar.health_needs_setup":"Требуется настроить установку","radar.health_inconsistent":"Источники передают противоречивые данные","radar.health_unknown":"Текущее состояние неизвестно","radar.health_disabled":"Радар отключён","radar.error_invalid_radar":"Проверьте настройки радара.","radar.error_invalid_selection":"Выберите существующую комнату и допустимые источники.","radar.error_source_restricted":"Нет доступа ко всем выбранным источникам.","radar.error_rate_limited":"Слишком много запросов. Повторите чуть позже.","radar.error_not_ready":"Обработка данных радара ещё не готова.","radar.error_conflict":"План изменился. Откройте настройку радара заново и повторите попытку.","radar.error_source_unavailable":"Один или несколько выбранных источников радара недоступны.","radar.error_unsupported_capability":"Установленная интеграция не поддерживает эту возможность радара.","radar.report_age":"{seconds} с назад","space.show_lqi":"Показывать зигби-сигнал (LQI) у устройств","space.hide_decor":"Скрыть декоративный слой","space.hide_decor_tip":"Линии, фигуры, надписи и мебель остаются на месте — их видно в редакторе подложки, но не на плане.","space.hide_openings":"Скрыть проёмы","space.hide_openings_tip":"Двери, окна и ворота не рисуются, но продолжают работать: свет проходит, солнце светит в окна, датчики открытия срабатывают. В редакторе плана проёмы видно всегда.","gs.light_none":"Нет источников света","mode.plan":"Редактор плана","mode.devices":"Редактор устройств","display.value":"Значение + состояние","marker.subarea":"без зоны, вручную","device.new":"Новое устройство — откройте его редактор, чтобы снять отметку","opening.unlock_action":"Открыть замок","opening.lock_action":"Закрыть замок","opening.lock_pending":"Выполняется…","title.close_editor":"Закрыть редактор (вернуться к просмотру)","title.add_device":"Добавить устройство на план","devbar.add":"Добавить","devbar.rules":"Правила иконок","device_inbox.button":"Устройства","device_inbox.title":"Устройства на плане","device_inbox.search":"Поиск по устройствам, сущностям и интеграциям…","device_inbox.add_virtual":"Добавить виртуальное устройство","device_inbox.tab_on_plan":"На плане","device_inbox.tab_available":"Доступны","device_inbox.tab_hidden":"Скрытые","device_inbox.tab_readd":"Доступны снова","device_inbox.only_new":"Только новые","device_inbox.show_entities":"Показывать сущности","device_inbox.show_hidden":"Показывать скрытые на плане","device_inbox.show_hidden.help":"Временно показывает на плане скрытые и деактивированные маркеры служебными призраками только в редакторе устройств. Сохранённая видимость устройств не меняется.","device_inbox.show_hidden.help.aria":"Подсказка: показывать скрытые устройства на плане","device_inbox.new":"Новое","device_inbox.find":"Найти на плане","device_inbox.edit":"Настроить","device_inbox.hide":"Скрыть","device_inbox.show":"Показать","device_inbox.add":"Добавить","device_inbox.readd":"Добавить заново","device_inbox.hide_available":"Скрыть из списка","device_inbox.show_more":"Показать ещё","device_inbox.more_actions":"Другие действия","device_inbox.find_hidden_hint":"Сначала включите «Показывать скрытые на плане»","device_inbox.show_disabled":"Перед показом активируйте эту привязку в Home Assistant","device_inbox.empty_on_plan":"На плане пока нет подходящих устройств.","device_inbox.empty_available":"Нет доступных устройств для добавления.","device_inbox.empty_hidden":"Скрытых устройств нет.","device_inbox.empty_readd":"Нет удалённых устройств, доступных для повторного добавления.","device_inbox.reason_visible_auto":"Найдено автоматически","device_inbox.reason_visible_explicit":"Добавлено явно","device_inbox.reason_manual_hidden":"Скрыто пользователем","device_inbox.reason_automatic_hidden":"Скрыто автоматически","device_inbox.reason_service_entry":"Служебная запись реестра","device_inbox.reason_excluded_integration":"Исключена интеграция «{integration}»","device_inbox.reason_excluded_domain":"Непространственный тип сущности","device_inbox.reason_grouped_light":"Представлено группой света комнаты","device_inbox.reason_represented_by_parent":"Представлено родительским устройством","device_inbox.reason_removed":"Ранее удалено с плана","device_inbox.reason_available":"Можно добавить на план","device_inbox.reason_no_bound_room":"Зона HA не связана с комнатой плана","device_inbox.status_ha_disabled":"Отключено в Home Assistant","device_inbox.status_orphaned":"Привязка больше не найдена в Home Assistant","device_inbox.status_unverified":"Реестр Home Assistant временно недоступен","device_inbox.saved":"Список устройств обновлён","device_inbox.filters_excluded":"Исключённые интеграции","device_inbox.filters_group_lights":"Объединять светильники комнаты в один маркер","device_inbox.filters_preview_appear":"появится: {count}","device_inbox.filters_preview_hide":"скроется: {count}","device_inbox.filters_preview_lights":"затронет светильников: {count}","device_inbox.filters_reset":"Вернуть рекомендуемые","device_inbox.filters_save":"Сохранить фильтры","device_inbox.filters_search_ph":"Добавить интеграцию…","device_inbox.filters_title":"Фильтры обнаружения","space.roomcard_section":"В карточке комнаты:","space.label_temp":"Температура","space.label_hum":"Влажность","space.label_lqi":"Средний Zigbee-сигнал","space.label_light":"Свет вкл/выкл","roomcard.light_on":"Вкл","roomcard.light_off":"Выкл","roomcard.light_partial":"{on} из {total}","toast.split_pick_inside":"Промежуточные точки разреза — внутри комнаты","mode.decor":"Редактор подложки","decor.select":"Выбрать","decor.line":"Линия","decor.rect":"Прямоугольник","decor.ellipse":"Овал","decor.text":"Надпись","decor.erase":"Стереть","decor.erase_confirm_title":"Стереть объект?","decor.color":"Цвет","decor.width":"Толщина линии","decor.line_style":"Стиль линии","decor.line_style_solid":"Сплошная","decor.line_style_dashed":"Пунктирная","decor.fill":"Заливка","decor.fill_color":"Цвет заливки","decor.length":"Длина","decor.size":"Размер","decor.flip_h":"Отзеркалить по горизонтали","decor.flip_v":"Отзеркалить по вертикали","decor.angle":"Угол поворота, °","decor.text_size":"Размер текста","decor.backdrop_properties":"Свойства картинки-подложки","decor.text_title":"Надпись","decor.object_title":"Редактирование: {kind}","decor.text_label":"Текст","decor.live_group":"Вставить переменную HA","decor.live_entity":"Сущность","decor.live_entity_ph":"выберите сущность","decor.live_attr":"Значение","decor.live_attr_ph":"выберите состояние или атрибут","decor.live_state":"Состояние","decor.backdrop":"Картинка-подложка","decor.backdrop_hint":"Тяните картинку — перемещение; угол — размер; верхнюю ручку — поворот. Shift меняет пропорции или снимает шаг угла.","decor.backdrop_reset":"Вернуть картинку","decor.backdrop_reset_done":"Картинка вернулась на своё место и в свой размер","marker.icon_auto":"Авто: {icon} (по правилам иконок; выберите свою, чтобы заменить)","marker.icon_pin_auto":"Закрепить","mode.plan_tip":"Редактор плана — геометрия дома: рисование и объединение/разделение комнат, привязка к зонам HA, двери, окна и ворота, карточки комнат, масштаб","mode.devices_tip":"Редактор устройств — всё про значки: перетаскивание, клик — настройка привязки/иконки/отображения, виртуальные устройства, правила иконок","mode.decor_tip":"Редактор подложки — чисто визуальный декор под планом: линии, прямоугольники, овалы и надписи, не реагирующие на клики","space.glow_enabled":"Свечение источников света","gs.glow_group":"Свечение источников света","gs.glow_base":"Темнота дома","gs.glow_light":"Цвет света по умолчанию / интенсивность","gs.wall_group":"Стены","gs.wall_fill":"Цвет заливки стен","gs.glow_radius":"Радиус свечения","gs.glow_radius.help":"Задаёт общий радиус светового пятна в метрах или футах; персональный радиус устройства заменяет это значение.","gs.glow_radius.help.aria":"Подсказка: общий радиус свечения","gs.unit_m":"м","gs.unit_ft":"фут","marker.controls_label":"Управляет другими источниками света","marker.controls.help":"При действии «Переключить состояние» перечисленные источники переключаются вместе с этим маркером. Их световые пятна остаются у собственных маркеров, а эта связь сама по себе не делает управляющий маркер источником света.","marker.controls.help.aria":"Подсказка: управление другими источниками света","marker.controls_filter":"Поиск ламп и выключателей…","info.controls":"Управляет","marker.glow_radius_label":"Радиус свечения","marker.glow_radius.help":"Задаёт радиус свечения в метрах или футах; пустое значение использует радиус из общих настроек.","marker.glow_radius.help.aria":"Подсказка: радиус свечения","markup.wallthick":"Толщина","markup.select":"Выбрать","title.markup_wallthick":"Толщина — клик по стене задаёт толщину от 0 до 100 см.","markup.hint_wallthick":"клик по стене · Esc закрывает без применения","wallthick.field":"Толщина","wallthick.unit_cm":"см","wallthick.unit_in":"дюйм","wallthick.apply_room":"Применить ко всем стенам комнаты","markup.draw_wall_title":"Толщина каждого нового сегмента стены (0–100 см). Общие стены сохраняют существующее значение.","room.queue_progress":"Комната {current} из {total}","toast.wall_rooms_saved":"Создано комнат: {n}","toast.wall_chain_saved":"Цепочка стен сохранена","toast.wallthick_pick":"Кликните по стене","toast.wallthick_set":"Толщина стены задана","toast.wallthick_cleared":"Толщина стены убрана","toast.physical_range":"Введите значение от {min} до {max} {unit}","toast.zero_wall_opening_conflict":"Сначала удалите проём на этом участке стены.","toast.zero_wall_ambiguous":"Не удалось однозначно выбрать участок стены. Уточните геометрию узла.","toast.zero_wall_migration_blocked":"Пространство не преобразовано: {reason}. Данные не изменены.","toast.physical_angle":"Введите угол поворота от 0° до 90°, не включая 90°","toast.physical_limit":"В пространстве достигнут лимит объектов этого типа","toast.geometry_unsafe":"Изменение отменено: геометрию стен нельзя безопасно построить.","junction.limit_angle":"Слишком острый угол между стенами: {actual}°, минимум {limit}°.","junction.limit_valence":"Слишком много стен в одном узле: {actual}, максимум {limit}.","junction.limit_length":"Слишком короткий участок стены: {actual} см, минимум {limit} см.","junction.limit_distance":"Стены и узлы слишком близко: {actual} см, минимум {limit} см.","junction.limit_clearance":"Внутри комнаты не остаётся места: {actual} см², минимум {limit} см².","junction.limit_check_failed":"Проверку стыков выполнить не удалось — изменение не сохранено","toast.wall_model_migration_blocked":"Не удалось обновить модель стен: {reason}. План не изменён. Запустите «Оптимизировать планы»; если ошибка повторится, исправьте конфликтующую геометрию стен.","toast.wall_model_client_outdated":"Обновите карточку и перезагрузите страницу перед редактированием плана.","wall_model.reason.invalid-room":"некорректный контур комнаты","wall_model.reason.zero-length":"отрезок стены нулевой длины","wall_model.reason.third-owner":"стена принадлежит более чем двум комнатам","wall_model.reason.duplicate-id":"конфликт идентификаторов стен","wall_model.reason.thickness-conflict":"конфликт значений толщины стены","wall_model.reason.opening-host":"проём нельзя однозначно привязать к стене","toast.delete_room_pick":"Кликните внутри комнаты, которую нужно удалить","toast.plan_snap_ambiguous":"Увеличьте масштаб, чтобы выбрать узел стены","toast.wall_repair_ambiguous":"У контура несколько возможных соединений. Увеличьте масштаб и соедините стены явно.","toast.wall_repair_too_large":"Разрыв больше 2 см. Соедините стены перед созданием комнаты.","toast.wall_repair_changed":"Геометрия стен изменилась. Попробуйте создать комнату ещё раз.","toast.opening_on_zero_wall":"Проёмы на стене нулевой толщины запрещены","marker.from_ha_option":"Выбрать из списка HA","marker.show_entities":"Показывать сущности","marker.show_entities_tip":"Добавляет в список не только устройства, но и все их сущности","marker.pick_ph":"Выберите устройство…","room.open_area":"Открыть зону в HA","room.fit_action":"Вписать комнату {name}","view.volumetric":"Объёмный вид","view.flat":"Плоский вид","kiosk.title":"Размеры на этом экране","kiosk.hint":"Хранится только на этом устройстве — у каждого настенного планшета или ТВ свои удобные размеры.","kiosk.icon_scale":"Размер значков устройств","kiosk.font_scale":"Размер текста карточек комнат","editor.kiosk":"Режим настенного устройства (киоск)","editor.cycle":"Автосмена пространств каждые N секунд (киоск, 0 = выкл)","room.settings_title":"Настройки комнаты","room.settings_section":"Настройки комнаты (переопределяют пространство)","room.fill_label":"Заливка в ЭТОЙ комнате","fill.inherit":"Как у пространства","room.custom_fill_space":"Цвет пространства","room.custom_fill_own":"Цвет комнаты","room.temp_range_label":"Диапазон комфорта","room.temp_range_min":"Нижняя граница комфортной температуры","room.temp_range_max":"Верхняя граница комфортной температуры","room.temp_range_reset":"Как у пространства","room.temp_range.help":"Диапазон применяется только к этой комнате. Пустое поле наследует соответствующую границу пространства; если границы поменялись местами, House Plan использует меньшую как нижнюю, а большую как верхнюю.","room.temp_range.help.aria":"О диапазоне комфорта комнаты","room.temp_src_label":"Источник температуры","room.hum_src_label":"Источник влажности","room.src_average":"Средняя по датчикам комнаты (по умолчанию)","room.src_pick":"Конкретное устройство или сущность HA","room.src_ph":"Выберите источник…","toast.room_updated":"Комната обновлена","space.card_font":"Размер шрифта карточек комнат (всё пространство)","room.sizes_section":"Размеры шрифтов","room.name_scale":"Размер названия","room.label_scale":"Размер подписей","preview.room_name":"Гостиная","toast.cfg_reload_failed":"Не удалось перечитать план с сервера: {err}","toast.locale_load_failed":"Не удалось загрузить языковой пакет. До перезагрузки страницы используется английский.","toast.furniture_art_load_failed":"Не удалось загрузить изображения мебели. Обновите страницу, чтобы их показать.","room.settings_short":"Настройки комнаты","room.unnamed":"Комната без имени","marker.use_climate_temp":"Учитывать температуру устройства в комнате","marker.use_climate_temp_tip":"Добавляет current_temperature кондиционера или термостата в среднюю температуру комнаты. Внешний бейдж со значением настраивается отдельно ниже.","marker.value_badge_title":"Бейдж со значением","marker.value_badge.help":"Показывает одно выбранное значение рядом со значком. Не влияет на комнатные показатели, свет, Glow и действие по нажатию.","marker.value_badge.help.aria":"Подсказка: бейдж со значением устройства","marker.value_badge_enabled":"Отображать бейдж со значением","marker.value_badge_source":"Значение","marker.value_badge_source.help":"Выберите конкретное состояние, поддерживаемый атрибут или производное значение этого устройства.","marker.value_badge_source.help.aria":"Подсказка: источник значения бейджа","marker.value_badge_position":"Расположение","marker.value_badge_position.help":"Выбранная сторона сохраняется постоянно и не переворачивается автоматически у края плана.","marker.value_badge_position.help.aria":"Подсказка: расположение бейджа","marker.value_badge_right":"Справа","marker.value_badge_bottom":"Снизу","marker.value_badge_left":"Слева","marker.value_badge_top":"Сверху","marker.value_badge_empty":"У этого устройства нет доступных значений","marker.value_badge_static":"Статичный значок не показывает живые значения. Настройка сохранится.","marker.value_badge_missing":"Источник недоступен","marker.value_badge_missing_hint":"Сохранённый источник сейчас недоступен. Можно сохранить его, отключить бейдж или выбрать другой.","marker.value_badge_duplicate":"То же значение уже показано внутри значка.","marker.value_badge_state":"Состояние · {name}","marker.value_badge_marker_state":"Состояние источника света · {name}","marker.value_badge_lqi":"Качество Zigbee-сигнала (среднее)","marker.value_badge_attr_current_temperature":"Текущая температура · {name}","marker.value_badge_attr_temperature":"Целевая температура · {name}","marker.value_badge_attr_current_humidity":"Текущая влажность · {name}","marker.value_badge_attr_humidity":"Влажность · {name}","marker.value_badge_attr_current_position":"Положение · {name}","marker.value_badge_attr_percentage":"Скорость · {name}","marker.value_badge_attr_brightness":"Яркость · {name}","marker.value_badge_attr_volume_level":"Громкость · {name}","marker.value_badge_attr_battery_level":"Заряд батареи · {name}","marker.value_badge_attr_fan_speed":"Скорость вентилятора · {name}","marker.value_source":"Источник значения","marker.value_source.help":"Выберите, что заменит значок. Действие по нажатию не изменится.","marker.value_source.help.aria":"Подсказка: источник значения внутри значка","marker.value_source_auto":"Автоматически (как раньше)","marker.value_source_missing_hint":"Сохранённый источник сейчас недоступен. До его восстановления или выбора другого значения внутри будет показано —.","marker.light_role_label":"Является источником света","marker.light_role.help":"«Авто» использует фактическую роль привязанного устройства, «Всегда» принудительно создаёт собственный источник, а «Никогда» исключает его; связанные лампы выше остаются независимыми.","marker.light_role.help.aria":"Подсказка: является ли устройство источником света","marker.light_role_auto_yes":"Автоматически (источник света)","marker.light_role_auto_no":"Автоматически (не источник света)","marker.light_role_always":"Всегда источник света","marker.light_role_never":"Никогда не источник света","marker.light_entity_label":"Ведущая сущность света","marker.light_entity.help":"Для составного устройства выберите сущность, состояние, цвет и яркость которой представляют этот источник на плане. Автоматический вариант сохраняет совместимость со старыми планами.","marker.light_entity.help.aria":"Подсказка: ведущая сущность света","marker.light_entity_auto":"Автоматически ({entity})","marker.light_entity_none":"нет управляемой сущности","marker.light_entity_missing":"Сохранённая сущность {entity} недоступна. Временно используется {fallback}; выбор восстановится, если сущность вернётся.","marker.toggle_entity_label":"Переключаемая сущность","marker.toggle_entity.help":"Для составного устройства выберите собственную лампу или переключатель, которой управляет нажатие. Автоматический вариант сохраняет прежние правила цели и не зависит от ведущей сущности света.","marker.toggle_entity.help.aria":"Подсказка: переключаемая сущность","marker.toggle_entity_auto":"Автоматически ({entity})","marker.toggle_entity_none":"нет собственной управляемой сущности","marker.toggle_entity_missing":"Сохранённой сущности {entity} больше нет среди выбираемых каналов этого маркера. Временно используется {fallback}; выбор восстановится, если сущность вернётся.","marker.glow_color_label":"Цвет и яркость свечения","marker.glow_mode.help":"Используйте данные источника, задайте только цвет или зафиксируйте цвет и яркость. Минимум — 1%; чтобы отключить источник, выберите «Никогда».","marker.glow_mode.help.aria":"Подсказка: цвет и яркость свечения","marker.glow_mode_auto":"Из источника","marker.glow_mode_color":"Задать цвет","marker.glow_mode_fixed":"Задать цвет и яркость","marker.glow_color":"Цвет свечения","marker.glow_brightness":"Яркость","marker.glow_disabled_never":"Настройки свечения недоступны: маркер явно исключён из источников света.","marker.glow_disabled_auto":"В автоматическом режиме у этого маркера не найден пространственный источник света.","marker.glow_disabled_no_entity":"Для пространственного источника нет активной управляемой сущности Home Assistant.","marker.glow_passive_hint":"У источника нет собственных данных Home Assistant. Задайте цвет и яркость вручную; радиус остаётся доступным.","marker.control_broken":"Сохранённый источник отсутствует или больше не отмечен как источник света","marker.control_missing_label":"Отсутствующий источник на плане","marker.control_passive":"пассивный источник","toast.marker_control_cycle":"Такая связь создаст циклическую цепочку управления светом.","toast.marker_binding_required":"Сначала выберите устройство Home Assistant, затем добавьте управляемый источник света.","confirm.unlock_title":"Открыть замок?","confirm.unlock_body":"House Plan отправит этому замку команду открытия.","toast.files_migrate_failed":"Не удалось перенести вложения к новой привязке, ссылки остались на старые файлы: {err}","space.pick_saved":"Уже загруженные","space.pick_saved_hint":"Планы, сохранённые на сервере, включая отцеплённые ранее","space.no_saved":"На сервере пока нет сохранённых планов.","space.loading":"Загрузка…","space.used_by":"используется: {list}","space.in_use":"План используется пространством — сначала отцепите его","btn.use":"Выбрать","confirm.delete_plan_title":"Удалить файл плана?","confirm.delete_plan_body":"Файл будет удалён с сервера. Это действие нельзя отменить.","toast.plans_list_failed":"Не удалось получить список планов: {err}","toast.plan_delete_failed":"Не удалось удалить план: {err}","marker.hide":"Скрыть","marker.hide_tip":"Устройство исчезнет с плана после сохранения, но продолжит участвовать в расчёте сигнала комнаты. Вернуть его можно через каталог «Устройства» в редакторе устройств.","marker.show":"Показать","marker.show_tip":"Устройство снова появится на плане после сохранения.","marker.hidden_ghost":"Устройство скрыто пользователем","marker.ha_disabled_device":"Устройство деактивировано в Home Assistant и скрыто с плана.","marker.ha_disabled_entity":"Сущность деактивирована в Home Assistant и скрыта с плана.","marker.ha_disabled_all_entities":"У устройства нет активных сущностей Home Assistant, поэтому оно скрыто с плана.","marker.ha_registry_limited":"Полный реестр Home Assistant недоступен этому пользователю. Неподтверждённый объект временно нельзя показывать или использовать.","marker.delete_tip":"Полностью удалить устройство с плана и из всех расчётов. Позже его можно добавить заново.","tap.run":"Запустить автоматизацию/скрипт/сцену","tap.none":"Ничего не делать","marker.run_target_label":"Что запускать","marker.run_search_ph":"Поиск: автоматизация, скрипт или сцена…","marker.run_target_gone":"Цель {id} не найдена — выберите заново","marker.tap_confirm":"Спрашивать подтверждение","marker.tap_confirm_tip":"Перед выполнением показать диалог подтверждения — защита от случайных нажатий.","marker.toggle_hint_single":"Цель: {name} ({id}).","marker.virtual_light_target":"Виртуальный свет: {name}.","marker.virtual_light_current":"Ручное состояние: {state} → {effect}.","marker.virtual_light_state_on":"включён","marker.virtual_light_state_off":"выключен","marker.toggle_hint_group":"Переключатся источники ({count}): {names}.","marker.toggle_hint_current":"Сейчас: {state} → {effect}.","marker.toggle_hint_group_current":"Сейчас включено {on} из {count} → {effect}.","marker.toggle_hint_skipped":"Не будут затронуты ({count}): {targets}.","marker.toggle_effect_turn_on":"включится","marker.toggle_effect_turn_off":"выключится","marker.toggle_effect_open":"откроется","marker.toggle_effect_close":"закроется","marker.toggle_effect_stop":"остановится","marker.toggle_effect_toggle":"состояние переключится","marker.toggle_skip_missing":"не найдено","marker.toggle_skip_ha_disabled":"деактивировано в HA","marker.toggle_skip_unavailable":"недоступно","marker.toggle_skip_unsupported":"переключение не поддерживается","marker.toggle_skip_secure":"заблокировано из соображений безопасности","marker.toggle_none_no_binding":"У устройства нет привязки, состояние переключать нечем. По нажатию ничего не произойдёт.","marker.toggle_none_no_actionable_entity":"У устройства нет состояния, которое можно переключить. По нажатию ничего не произойдёт.","marker.toggle_none_configured_targets_missing":"Настроенные цели сейчас недоступны. Собственная сущность устройства не будет подставлена вместо них.","marker.toggle_none_ha_disabled":"Цель деактивирована в Home Assistant и не может использоваться на плане.","marker.toggle_none_unavailable":"Цель сейчас недоступна. По нажатию ничего не произойдёт.","marker.toggle_none_unsupported":"Для этой сущности Home Assistant не предоставляет безопасного переключения. По нажатию ничего не произойдёт.","marker.toggle_none_secure":"Переключение замков, сигнализации и защитных ворот с плана заблокировано из соображений безопасности.","run.automation":"автоматизация","run.script":"скрипт","run.scene":"сцена","confirm.tap_run":"Запустить «{name}»?","confirm.tap_toggle":"Переключить «{name}»?","confirm.current_state":"Текущее состояние: {state}","confirm.expected_state":"После переключения: {state}","confirm.group_current":"включено {on} из {total}","confirm.group_all_on":"все включены","confirm.group_all_off":"все выключены","confirm.unavailable_targets":"Недоступно: {count}","confirm.expected_by_ha":"Состояние определит Home Assistant","confirm.state_on":"Включено","confirm.state_off":"Выключено","confirm.state_open":"Открыто","confirm.state_closed":"Закрыто","confirm.state_opening":"Открывается","confirm.state_closing":"Закрывается","confirm.state_stopped":"Остановлено","confirm.state_unknown":"Неизвестно","toast.run_started":"Запущено: {name}","toast.run_target_missing":"Цель запуска не найдена — проверьте настройки устройства","toast.run_target_required":"Выберите автоматизацию, скрипт или сцену","toast.tap_target_changed":"Цель действия изменилась. Повторите попытку.","toast.virtual_light_toggle_failed":"Не удалось переключить виртуальный свет: {err}","toast.value_badge_source_required":"Выберите значение для бейджа","btn.run":"Выполнить","vac.section":"Робот-пылесос: живая позиция","vac.autocal":"Настроить автоматически","vac.live":"Живая позиция на плане","vac.trail":"Показывать путь робота","vac.autocal_no_rooms":"Интеграция не отдаёт список комнат — откройте «Подогнать вручную»","vac.route_warn_unmapped":"Робот убирает на карте, которая не сопоставлена ни одному этажу","vac.route_warn_needs_calibration":"Карта сопоставлена этажу, но не откалибрована","vac.route_warn_ambiguous":"Две карты неразличимы — этаж не выбран","vac.route_warn_missing_space":"Пространство этой карты удалено","vac.autocal_no_match":"Не совпали имена комнат (нужно ≥3 общих) — откройте «Подогнать вручную»","vac.autocal_done":"Готово: привязка по {rooms} комнатам. Запустите уборку и проверьте","vac.cal_need_pos":"Робот сейчас не отдаёт координаты — запустите уборку и поставьте на паузу","vac.cal_done":"Калибровка сохранена. Запустите уборку и проверьте","vac.cal_cancelled":"Калибровка отменена","vac.fit":"Подогнать вручную","vac.fit_hint":"Перетащите карту робота на место, растяните за уголки","vac.fit_rotate":"Повернуть 90°","vac.fit_mirror":"Отразить","vac.trail_never":"Не показывать никогда","vac.trail_cleaning":"Во время уборки","vac.trail_always":"Показывать всегда","gs.bg_group":"Фон сцены","gs.bg_color":"Цвет фона вокруг плана","gs.bg_default":"Как в теме","gs.bg_theme":"по умолчанию — из темы","gs.bg_mode":"Фон плана","gs.bg_mode.help":"«Следует за Солнцем» использует sun.sun, а при недоступности — локальные часы браузера; статичный режим всегда показывает выбранный цвет.","gs.bg_mode.help.aria":"Подсказка: общий фон плана","gs.bg_static":"Статичный цвет","gs.bg_daynight":"Следует за Солнцем","gs.sun_group":"Солнце","gs.sun_missing":"Сущность sun.sun не найдена — фон следует локальным часам, а оконные лучи недоступны.","gs.north":"Север на плане","gs.north.help":"Угол отсчитывается по часовой стрелке от верхней вертикали плана; север нужен для оконных лучей, а не для фона «Следует за Солнцем».","gs.north.help.aria":"Подсказка: общее направление севера","gs.north_ph":"не задан","gs.north_clear":"Сбросить","gs.north_letter":"С","gs.sun_rays":"Солнце в окнах","gs.about_version":"Houseplan Card v{v}","gs.about_github":"GitHub · документация и issues","gs.about_telegram":"Чат в Telegram","support.title":"Помощь и обратная связь","space.bg_color":"Цвет фона вокруг плана","space.bg_inherit":"Наследовать общий","space.bg_inherited":"наследуется из общих настроек","space.bg_mode":"Фон плана","space.bg_mode.help":"Выберите наследование общего фона либо переопределите это пространство статичным цветом или режимом «Следует за Солнцем».","space.bg_mode.help.aria":"Подсказка: фон пространства","space.north":"Север на плане (переопределение)","space.north.help":"Переопределяет общий север для этого пространства; угол отсчитывается по часовой стрелке от верхней вертикали плана и используется оконными лучами.","space.north.help.aria":"Подсказка: север для пространства","space.north_inherited":"наследуется: {v}","space.sun_rays":"Солнце в окнах","space.sun_inherit":"Наследовать общий","space.sun_on":"Вкл","space.sun_off":"Выкл","canvas.far_objects":"Объектов далеко от плана: {n}","canvas.show_far":"Показать","canvas.home_tip":"План там — нажмите, чтобы вписать","gs.grid_group":"Обслуживание планов","gs.grid_hint":"Обновляет модели данных, выравнивает элементы по сетке и объединяет лишние фрагменты стен. Перед записью будет показан точный отчёт.","gs.align_all":"Оптимизировать планы","gs.align_title":"Оптимизировать планы","gs.align_none":"Все планы уже используют актуальную и оптимальную модель данных.","gs.optimize_no_automatic_changes":"Автоматических изменений нет. Проверьте пункты ниже.","gs.align_count":"Сдвинется элементов: {n} из {total}, максимум на {cm} см.","gs.align_where":"Наибольший сдвиг — в пространстве «{s}».","gs.align_turned":"Проёмов с исправлением угла: {n}.","gs.align_preflight_failed":"Не удалось безопасно проверить геометрию следующих пространств: {spaces}{more}.","gs.align_preflight_hint":"Планы не изменены. Скопируйте диагностику кнопкой ниже и приложите её к отчёту об ошибке вместе с экспортом пространства.","gs.preflight_reason_prepare-exception":"Не удалось подготовить геометрию пространства (исключение при сборке модели)","gs.preflight_reason_wall-null":"Тело стен не построилось (объединение вернуло пустоту)","gs.preflight_reason_wall-degraded-extra":"Тело стен деградировало с лишней геометрией","gs.preflight_reason_wall-failed-core":"Ядро тела стен не собралось","gs.preflight_reason_wall-exception":"Построение стен упало с исключением","gs.preflight_reason_floor-null":"Контур пола не построился","gs.preflight_reason_floor-exception":"Построение пола упало с исключением","gs.preflight_copy":"Скопировать диагностику","gs.preflight_copied":"Диагностика скопирована","gs.preflight_update_hint":"Версии карточки и интеграции различаются — обновите House Plan и повторите.","gs.align_preflight_space":"Пространство {n}","gs.align_preflight_more":" и ещё {n}","gs.optimize_changes":"Миграций модели: {m}; обновлено пространств: {c}; устранён шум координат: {p}; объединено отрезков реальных стен: {w}; объединено отрезков стен нулевой толщины: {s}; независимых: {i}.","gs.zero_walls_migrated":"Преобразовано виртуальных участков: {n}.","gs.wall_segments_migrated":"Стабилизировано сегментов стен: {n}.","gs.room_drafts_migrated":"Незавершённые контуры преобразованы в обычные стены: {drafts}; отрезков: {segments}.","gs.optimize_lattice_summary":"Канонизировано шумовых значений координат: {n}; максимальный сдвиг: {cm} см.","gs.optimize_lattice_space":"{space}: канонизировано значений координат: {n}; оставлено значений вне сетки: {far}.","gs.optimize_coincident_partitions":"Скрытые участки независимых стен поглощены стенами комнат: {n}.","gs.optimize_openings_rehosted":"Проёмы перепривязаны к стенам комнат: {n}.","gs.optimize_walls_straightened":"Выпрямлено стен: {n}; максимальное перемещение: {cm} см.","gs.optimize_walls_straightened_where":"Максимальная правка стены: {s}.","gs.optimize_walls_straighten_skipped":"Оставлено почти осевых стен, которые нельзя безопасно выпрямить: {n}.","gs.optimize_glow_migration":"Старый Glow: пространств — {spaces} → без заливки данных + независимый Glow; комнат — {rooms} → наследуемая заливка + независимый Glow.","gs.optimize_references":"Исправлено ссылок: пространства — {spaces}; комнаты — {rooms}; позиции — {positions}; устройств отвязано от отсутствующих пространств — {detached}.","gs.optimize_reference_more":", и ещё {n}","gs.optimize_orphans_removed":"Убрано забытых записей: {total} — подписи комнат: {rooms}; устройства: {devices}; групповые метки: {groups}. Все они принадлежали пространствам, удалённым ранее.","gs.optimize_live_positions":"Старые позиции в удалённых пространствах принадлежат существующим объектам: {n}{names}. Они будут сохранены.","gs.optimize_live_positions_remove":"Старые позиции в удалённых пространствах принадлежат существующим объектам: {n}{names}. Они выбраны для удаления.","gs.optimize_live_names":": {names}{more}","gs.optimize_live_remove":"Убрать старые позиции","gs.optimize_live_keep":"Сохранить старые позиции","gs.optimize_live_selected":"Старые позиции будут убраны после применения оптимизации.","gs.optimize_unverified":"Не удалось безопасно проверить позиций: {n}. Они оставлены без изменений.","gs.optimize_registry_limited":"Для безопасной проверки нужен полный доступ администратора к реестрам Home Assistant.","gs.optimize_vacuum_warning":"Сопоставления комнат пылесоса требуют проверки: {n}.","gs.optimize_details":"Подробности","gs.optimize_details_more":"И ещё записей: {n}.","gs.optimize_detail_removed":"будет удалено","gs.optimize_detail_live":"будет сохранено","gs.optimize_detail_unverified":"не проверено","gs.optimize_detail_room_label":"подпись комнаты","gs.optimize_detail_device":"устройство","gs.optimize_detail_group":"групповая метка","gs.optimize_detail_unknown":"неизвестный владелец","gs.optimize_detail_item":"{status}: {kind} {id}; прежнее пространство {space}","gs.align_warn":"Элементы, намеренно поставленные между узлами, будут сдвинуты. После операции доступна одна отмена — только до следующего изменения плана.","gs.align_run":"Оптимизировать","gs.align_done":"Планы оптимизированы: сдвинуто элементов — {n}, обслужено записей — {m}, исправлено ссылок — {r}","gs.optimize_undo":"Отменить последнюю оптимизацию","gs.optimize_undone":"Последняя оптимизация отменена","decor.furniture":"Мебель","decor.image":"Изображение","decor.image_title":"Свои изображения","decor.image_upload":"Загрузить изображение","decor.image_replace":"Заменить изображение","decor.image_uploading":"Загрузка…","decor.image_asset":"Файл изображения","decor.image_pick_hint":"Загрузите изображение или выберите уже используемое в House Plan.","decor.image_place_hint":"Кликните по плану, чтобы разместить изображение.","decor.image_none":"Загруженных изображений пока нет.","decor.image_unavailable":"Изображение недоступно","decor.image_used":"Используется в объектах: {n}","decor.image_upload_failed":"Не удалось загрузить изображение: {err}","decor.image_error_capacity":"Хранилище пользовательских изображений заполнено.","decor.image_in_use":"Перед удалением файла удалите все размещённые копии.","decor.image_delete_title":"Удалить файл изображения?","decor.image_delete_message":"Удалить «{name}» из House Plan? Это действие нельзя отменить.","furn.title":"Библиотека мебели","furn.symbol":"Символ","furn.group_furniture":"Мебель","furn.group_appliance":"Техника","furn.group_sanitary":"Сантехника","furn.group_other":"Прочее","furn.width":"Ширина","furn.depth":"Глубина","furn.back_to_categories":"Все категории","furn.pick_hint":"Выберите категорию, затем символ.","furn.place_hint":"Кликните по плану — предмет встанет к ближайшей стене. Shift — свободно.","furn.cat_air_conditioner":"Кондиционеры","furn.cat_armchair":"Кресла","furn.cat_bathtub":"Ванны","furn.cat_bed":"Кровати","furn.cat_bidet":"Биде","furn.cat_boiler":"Бойлеры","furn.cat_chair":"Стулья","furn.cat_coffee_table":"Журнальные столы","furn.cat_cooktop":"Варочные панели","furn.cat_dining_table":"Обеденные столы","furn.cat_dishwasher":"Посудомоечные машины","furn.cat_dryer":"Сушильные машины","furn.cat_fireplace":"Камины","furn.cat_fridge":"Холодильники","furn.cat_kitchen_cabinet":"Кухонные шкафы","furn.cat_kitchen_sink":"Кухонные мойки","furn.cat_nightstand":"Тумбы","furn.cat_plant":"Растения","furn.cat_rug":"Ковры","furn.cat_shelving":"Стеллажи","furn.cat_shower":"Душевые","furn.cat_sink":"Раковины","furn.cat_sofa":"Диваны","furn.cat_stairs":"Лестницы","furn.cat_toilet":"Унитазы","furn.cat_tv":"Телевизоры","furn.cat_wardrobe":"Шкафы","furn.cat_washer":"Стиральные машины","furn.cat_work_table":"Рабочие столы","furn.sym_sofa":"Диван двухместный","furn.sym_sofa_three_seat":"Диван трёхместный","furn.sym_sofa_corner_right":"Угловой диван, правый","furn.sym_armchair":"Кресло мягкое","furn.sym_armchair_office":"Кресло офисное","furn.sym_coffee_table":"Журнальный стол, прямоугольный","furn.sym_coffee_table_round":"Журнальный стол, круглый","furn.sym_coffee_table_oval":"Журнальный стол, овальный","furn.sym_coffee_table_rounded":"Журнальный стол, скруглённый","furn.sym_table_dining":"Обеденный стол, прямоугольный","furn.sym_table_round":"Круглый стол","furn.sym_table_dining_oval":"Обеденный стол, овальный","furn.sym_table_dining_rounded":"Обеденный стол, скруглённый","furn.sym_chair":"Стул","furn.sym_chair_bar":"Барный стул","furn.sym_desk":"Рабочий стол, прямоугольный","furn.sym_desk_corner":"Рабочий стол, угловой","furn.sym_bed_double":"Двуспальная кровать","furn.sym_bed_single":"Односпальная кровать","furn.sym_nightstand":"Тумба прикроватная","furn.sym_cabinet_tv":"Тумба под телевизор","furn.sym_cabinet_shoe":"Тумба для обуви","furn.sym_cabinet_sink":"Тумба под раковину","furn.sym_wardrobe":"Шкаф гардеробный","furn.sym_bookshelf":"Шкаф книжный","furn.sym_wall_unit":"Шкаф-стенка","furn.sym_kitchen_floor":"Кухонный напольный модуль","furn.sym_kitchen_floor_corner":"Кухонный напольный угловой модуль","furn.sym_kitchen_wall":"Кухонный навесной модуль","furn.sym_kitchen_wall_corner":"Кухонный навесной угловой модуль","furn.sym_shelf_floor":"Стеллаж напольный","furn.sym_shelf_wall":"Полка настенная","furn.sym_fridge":"Холодильник","furn.sym_stove":"Варочная панель, 4 конфорки","furn.sym_cooktop_two":"Варочная панель, 2 конфорки","furn.sym_dishwasher":"Посудомоечная машина","furn.sym_washer":"Стиральная машина","furn.sym_dryer":"Сушильная машина","furn.sym_tv":"Телевизор на подставке","furn.sym_tv_wall":"Телевизор на кронштейне","furn.sym_ac":"Кондиционер","furn.sym_water_heater":"Бойлер","furn.sym_toilet":"Унитаз напольный","furn.sym_toilet_built_in":"Унитаз встроенный","furn.sym_bathtub":"Ванна прямоугольная","furn.sym_bathtub_corner":"Ванна угловая","furn.sym_shower":"Душ","furn.sym_sink":"Раковина","furn.sym_kitchen_sink":"Кухонная мойка одинарная","furn.sym_kitchen_sink_double":"Кухонная мойка двойная","furn.sym_bidet":"Биде напольное","furn.sym_bidet_built_in":"Биде встроенное","furn.sym_stairs":"Лестница","furn.sym_fireplace":"Камин","furn.sym_plant":"Растение","furn.sym_rug":"Ковёр","common.yes":"Да","common.no":"Нет","vac.diag_source":"Источник","vac.diag_platform":"Интеграция","vac.diag_status":"Статус","vac.diag_position":"Позиция","vac.diag_rooms":"Комнаты","vac.diag_rooms_value":"{total} · совпало имён: {matched} · {readiness}","vac.autocal_ready":"автокалибровка доступна","vac.autocal_not_ready":"нужно 3 совпавших имени","vac.diag_path":"Путь интеграции","vac.diag_map":"ID карты","vac.source_none":"не выбран","vac.source_status_ok":"Готов","vac.source_status_missing":"Не найден","vac.source_status_disabled":"Деактивирован в Home Assistant","vac.source_status_unavailable":"Недоступен","vac.source_status_unverified":"Нельзя проверить с текущими правами","vac.source_status_unsupported":"Нет данных позиции","vac.source_status_none":"Нет источника","vac.source_banner_missing":"Сохранённый источник больше не существует. Он не заменён автоматически: выберите другой или восстановите его в Home Assistant.","vac.source_banner_disabled":"Сохранённый источник деактивирован в Home Assistant. Активируйте его там или выберите другой.","vac.source_banner_unverified":"Текущих прав Home Assistant недостаточно для проверки источника. Привязка сохранена и не будет заменена автоматически.","vac.choose_source":"Выбрать источник","vac.source_auto":"Автоматически","vac.source_auto_hint":"Использовать совместимую сущность этого устройства","vac.all_cameras":"Все камеры","vac.all_cameras_warn":"Камера может не отдавать данные робота. Выбирайте её только если это карта вашего пылесоса.","vac.all_cameras_empty":"Других сущностей камеры не найдено.","vac.platform_unknown":"интеграция неизвестна","vac.cap_position":"позиция","vac.cap_rooms_short":"комнаты","vac.cap_path":"путь","vac.cap_map":"ID карты","vac.cap_none":"данные робота не обнаружены","vac.xcme_hint":"Включите атрибуты Xiaomi Cloud Map Extractor:","vac.documentation":"Документация","vac.residual_title":"Проверьте автокалибровку","vac.residual_message":"Совпавшие комнаты расходятся максимум на {error}. Примените приблизительную калибровку, подгоните её вручную либо отмените без изменения сохранённых настроек.","vac.apply_proposal":"Применить","gs.backup_group":"Резервная копия и перенос","gs.backup_hint":"Скачайте переносимую JSON-копию или проверьте и импортируйте копию, созданную House Plan.","backup.export_open":"Экспорт","backup.import_open":"Импорт","backup.export_title":"Экспорт House Plan","backup.import_title":"Импорт House Plan","backup.export_hint":"Выберите, должна ли копия содержать всю конфигурацию House Plan или только текущее пространство.","backup.full":"Полная копия","backup.current_space":"Текущее пространство","backup.current_space_title":"Текущее пространство: {title}","backup.no_current_space":"Нет текущего пространства","backup.plan_only":"Только планировка","backup.plan_only_hint":"Сохранить комнаты, стены, проёмы, декор и позиции подписей комнат без устройств и привязок Home Assistant.","backup.plan_only_preview":"Файл содержит только планировку","backup.privacy_warning":"Архив сохраняет названия, идентификаторы Home Assistant и точные координаты. Внутренние планы и вложения указываются ссылками, но не вкладываются; текущие состояния и маршруты пылесосов не включаются.","backup.download":"Скачать JSON","backup.export_done":"Резервная копия скачана","backup.reading":"Проверяем резервную копию…","backup.revalidated":"После предпросмотра план изменился. Сводка обновлена — проверьте её и подтвердите ещё раз.","backup.error.support_invalid_message":"Проверьте сообщение для поддержки и повторите попытку.","backup.error.support_package_too_large":"Обезличенный пакет для поддержки превышает лимит 8 МиБ.","backup.error.support_preview_expired":"Предпросмотр вложения для поддержки истёк или больше недоступен.","backup.error.support_rate_limited":"Запрошено слишком много репортов или предпросмотров. Повторите позже.","backup.error.support_rejected":"Репорт не прошёл проверку службы поддержки.","backup.error.support_unavailable":"Закрытая служба поддержки временно недоступна.","backup.error.unauthorized":"У вас нет прав на экспорт или импорт этого плана.","backup.error.not_ready":"House Plan ещё не готов. Повторите попытку через несколько секунд.","backup.error.too_large":"Размер резервной копии превышает 8 МиБ.","backup.error.invalid_json":"Выбранный файл не является корректным JSON.","backup.error.invalid_format":"Выбранный файл не является резервной копией House Plan.","backup.error.invalid_image":"Изображение повреждено или не соответствует своему формату.","backup.error.unsupported_export_version":"Эта версия формата резервной копии не поддерживается установленной версией.","backup.error.unsupported_image":"Используйте поддерживаемое изображение PNG, JPEG, WebP или SVG.","backup.error.future_model":"Резервная копия создана в более новой версии модели данных House Plan.","backup.error.invalid_config":"Резервная копия содержит некорректную конфигурацию House Plan.","backup.error.wall_model_migration_blocked":"Не удалось безопасно обновить модель стен из резервной копии. Сначала оптимизируйте исходный план и повторите экспорт.","backup.error.invalid_layout":"Резервная копия содержит некорректные позиции объектов.","backup.error.invalid_content":"Резервная копия содержит некорректные или несогласованные ссылки на файлы.","backup.error.space_not_found":"Выбранное пространство больше не существует.","backup.error.capacity_exceeded":"Добавление этой копии превысит ограничения размера плана.","backup.error.preview_expired":"Время предпросмотра истекло. Выберите файл резервной копии заново.","backup.error.preview_owner_mismatch":"Этот предпросмотр принадлежит другому пользователю Home Assistant.","backup.error.conflict":"После предпросмотра план изменился. Проверьте обновлённую сводку.","backup.error.content_confirmation_required":"Подтвердите отсоединение недоступных локальных файлов.","backup.error.commit_failed":"Не удалось безопасно применить копию. Предыдущий план восстановлен или ожидает восстановления.","backup.error.missing_plan":"После предпросмотра исчез связанный файл плана. Проверьте копию ещё раз.","backup.error.missing_content":"После предпросмотра исчез связанный локальный файл. Проверьте копию ещё раз.","backup.error.marker_control_missing":"В резервной копии отсутствует связанный источник света на плане.","backup.error.marker_control_not_light":"Связанная цель больше не отмечена как источник света.","backup.error.marker_control_self":"Источник света не может управлять самим собой.","backup.error.marker_control_cycle":"Резервная копия содержит циклическую цепочку управления светом.","backup.error.duplicate_marker_control":"Резервная копия содержит повторяющуюся связь с источником света.","backup.error.no_backup":"Нет снимка импорта или оптимизации, который можно восстановить.","backup.error.in_use":"Элемент ещё используется","backup.error.invalid_data":"Запрос содержит некорректные данные","backup.error.invalid_light_entity":"Ведущий свет должен быть сущностью light.* или switch.*","backup.error.invalid_marker_control":"Некорректная ссылка управления маркером","backup.error.invalid_name":"Некорректное имя","backup.error.invalid_partition_opening_host":"Проём должен сохранить свою перегородку-носитель","backup.error.invalid_partition_opening_jamb_margin":"Проём не оставляет физического простенка у края стены","backup.error.invalid_passage_fields":"Открытый проход не может нести настройки двери","backup.error.invalid_space_id":"Неизвестное пространство","backup.error.invalid_toggle_entity":"Сущность переключения должна быть light.* или switch.*","backup.error.invalid_value_badge":"Некорректные настройки бейджа значения","backup.error.invalid_value_badge_attribute":"Некорректный атрибут бейджа значения","backup.error.invalid_value_badge_position":"Некорректная позиция бейджа значения","backup.error.invalid_value_badge_source":"Некорректный источник бейджа значения","backup.error.invalid_vacuum_map_route":"Проверьте сопоставление карт робота пространствам.","backup.error.invalid_value_source":"Некорректный источник значения","backup.error.invalid_value_source_attribute":"Некорректный атрибут источника значения","backup.error.io_error":"Файловая операция на сервере не удалась","backup.error.not_toggleable":"Это устройство нельзя переключить","backup.error.nothing_to_repair":"Нечего чинить","backup.error.space_in_use":"На пространство ещё есть ссылки","backup.error.value_badge_source_required":"Бейджу значения нужен источник","backup.error.wall_model_client_outdated":"План обновлён в другом месте — перезагрузите страницу","backup.same_source":"Создано на этом экземпляре Home Assistant","backup.foreign_source":"Создано на другом экземпляре Home Assistant","backup.created":"Создано: {value}","backup.versions":"Карточка {card}; интеграция {integration}; модель данных {model}","backup.count_spaces":"Пространств: {n}","backup.count_rooms":"Комнат: {n}","backup.count_walls":"Стен: {n}","backup.count_openings":"Проёмов: {n}","backup.count_decor":"Объектов декора: {n}","backup.count_markers":"Устройств: {n}","backup.count_layout":"Позиций: {n}","backup.bindings":"Привязки — устройства: {device}, сущности: {entity}, виртуальные: {virtual}; позиций без пространства: {legacy}","backup.binding_status":"Статус на целевом экземпляре — активных: {active}, деактивированных: {disabled}, отсутствующих: {missing}","backup.missing_areas":"На целевом экземпляре отсутствуют зоны: {areas}","backup.dropped_marker_links":"Связи с источниками света вне переносимого пространства пропущены: {n}.","backup.room_drafts_migrated":"Старые незавершённые контуры преобразованы в обычные стены: {drafts}; отрезков: {segments}.","backup.repaired_target_refs":"Существующих ссылок восстановлено этим импортом: {n}.","backup.preserved_unresolved_refs":"Неоднозначные ссылки сохранены без изменений: {n}.","backup.preserved_unresolved_hint":"House Plan ничего не угадывал и не удалял. После импорта запустите «Оптимизировать планы», чтобы проверить оставшиеся ссылки.","backup.import_details":"Подробности восстановления ссылок","backup.import_detail.incoming_remapped":"Ссылок обновлено внутри импортируемой копии: {n}","backup.import_detail.target_repaired":"Существующих ссылок восстановлено: {n}","backup.import_detail.preserved_unresolved":"Неразрешимых ссылок сохранено: {n}","backup.import_detail.collisions":"Конфликтов назначения безопасно сохранено: {n}","backup.import_detail.dropped_links":"Входящих связей пропущено по правилам переноса: {n}","backup.import_detail.bounded_lineages":"Чрезмерно вложенных идентификаторов ограничено: {n}","backup.replace_warning":"Текущая конфигурация и расположение будут заменены. Загруженные файлы не удаляются. Одну отмену можно выполнить до следующего изменения плана.","backup.foreign_bookkeeping":"Служебные списки известных и новых устройств другого экземпляра импортированы не будут.","backup.final_name":"Название нового пространства","backup.target_settings":"Глобальные настройки целевого экземпляра не изменятся.","backup.duplicates":"Уже существующих привязок: {n}","backup.skip":"Пропустить повторяющиеся устройства","backup.virtual_copy":"Добавить безопасные статичные виртуальные копии","backup.content":"Связанное содержимое","backup.decor_images_summary":"Свои изображения: объектов — {objects}, файлов — {assets}; отсутствует файлов — {missing}.","backup.content_available":"доступно локально","backup.content_external":"внешняя ссылка","backup.content_detach_required":"будет отвязано","backup.confirm_detach":"Я понимаю, что недоступные внутренние планы и вложения будут отвязаны от импортируемой конфигурации.","backup.confirm_missing_images":"Я понимаю, что отсутствующие свои изображения останутся восстанавливаемыми заглушками, а остальные недоступные локальные файлы будут отвязаны.","backup.replace":"Заменить","backup.add":"Добавить пространство","backup.space_done":"Пространство импортировано: комнат — {rooms}, устройств — {markers}, существующих ссылок восстановлено — {refs}","backup.full_done":"Копия восстановлена: пространств — {spaces}, комнат — {rooms}, устройств — {markers}","backup.undo_import":"Отменить последний полный импорт","backup.import_undone":"Полный импорт отменён","backdrop.large_title":"Большое изображение","backdrop.large_body":"Изображение {w}×{h} ({fileMb} МБ), для показа потребуется около {decodedMb} МБ памяти. На планшетах это может привести к падению страницы.","backdrop.unknown_body":"Не удалось прочитать размеры изображения — файл может быть повреждён. Продолжение может привести к падению страницы на планшете.","backdrop.reduced_dimensions":"Уменьшенная копия: {w}×{h} px.","backdrop.use_downscaled":"Загрузить уменьшенную копию","backdrop.reducing":"Уменьшаем…","backdrop.keep_original":"Оставить оригинал","backdrop.too_large_title":"Изображение слишком большое","backdrop.too_large_body":"Изображение превышает возможности браузера ({w}×{h}, предел {limit} px по стороне). Уменьшите его в редакторе на компьютере и загрузите снова.","backdrop.downscale_failed":"Не удалось создать уменьшенную копию. Текущий план не изменён."}},{code:"de",nativeLabel:"Deutsch",loadDictionary:async function(e){const t=0===e?await import("./de-CqAe7_tE.js"):await import(new URL("./de-CqAe7_tE.js?retry",import.meta.url).href);return{dictionary:t.dictionary,fingerprint:t.fingerprint}}},{code:"fr",nativeLabel:"Français",loadDictionary:async function(e){const t=0===e?await import("./fr-6DtT8TWD.js"):await import(new URL("./fr-6DtT8TWD.js?retry",import.meta.url).href);return{dictionary:t.dictionary,fingerprint:t.fingerprint}}}],up=sp,pp=new Set;const _p=new class{constructor(e,t,i=console.warn,n){this.entries=e,this.expectedFingerprint=t,this.warn=i,this.loadFailed=n,this.dictionaries=new Map,this.pending=new Map,this.failed=new Set;for(const t of e)t.dictionary&&this.dictionaries.set(t.code,t.dictionary)}state(e){return this.dictionaries.has(e)?"ready":this.failed.has(e)?"fallback":"pending"}dictionary(e){return this.dictionaries.get(e)}ensure(e){if("pending"!==this.state(e))return Promise.resolve();const t=this.pending.get(e);if(t)return t;const i=this.entries.find(t=>t.code===e),n=this.load(i).finally(()=>this.pending.delete(e));return this.pending.set(e,n),n}async load(e){if(!e?.loadDictionary)return void(e&&this.failed.add(e.code));let t;for(const i of[0,1])try{const t=await e.loadDictionary(i);if(t.fingerprint!==this.expectedFingerprint)throw new Error(`locale fingerprint mismatch for ${e.code}`);return this.dictionaries.set(e.code,t.dictionary),void this.failed.delete(e.code)}catch(e){t=e}this.failed.add(e.code),this.warn(`[houseplan] unable to load ${e.code} locale; using English`,t),this.loadFailed?.(e.code)}}(dp,"74cbeb9792716ab64cfbcf339d3044c6e8ae33533bdef7216a6d7d513ae04091",console.warn,function(e){for(const t of pp)t(e)});function mp(e){const t=vp(e)?.code??"en";return _p.dictionary(t)??up}function gp(e){return"string"==typeof e?e.trim().replaceAll("_","-").toLowerCase():""}const fp=new Map(dp.map(e=>[gp(e.code),e]));function vp(e){return fp.get(gp(e))}function yp(e,t){const i=[{value:"",label:e},...dp.map(({code:e,nativeLabel:t})=>({value:e,label:t}))],n="string"==typeof t?t:"";return n&&!i.some(e=>e.value===n)&&i.push({value:n,label:vp(n)?.nativeLabel??n}),i}function bp(e,t){return function(e,t,i,n){const r=new Map(i.map(e=>[gp(e),e])),o=r.get(gp(e));if(o)return o;const s=gp(t),a=r.get(s);return a||(r.get(s.split("-")[0]||"")??n)}(t,e?.locale?.language||e?.language,dp.map(({code:e})=>e),"en")}function wp(e,t,i){return nn(mp(e)[t]??up[t]??t,i)}function kp(e,t){const i=mp(e)[t]??up[t];return"string"==typeof i&&i.trim().length>0}function xp(e,t,i,n){return{ox:0,oy:0}}function Sp(e,t){const i=(e.angle+90)*Math.PI/180,n=Ha(16,t),r=e.gateFace?-n*e.gateFace.side:n*(e.flipV?-1:1);return[[e.x+Math.cos(i)*r,e.y+Math.sin(i)*r],r<0]}function $p(e){const t=e.length/2,i=e.face.cm>0?e.face.cm/e.cellCm*e.gridPitch/2:Ha(4,e.cellCm),n="gate"===e.type?Math.sin(10*Math.PI/180)*t:0;return{half:t,jambHalf:i,gateDepth:n,outlineHalf:Math.max(Ha(16,e.cellCm),i+Ha(8,e.cellCm),n+Ha(8,e.cellCm)),hitHalf:Math.max(Ha(20,e.cellCm),i+Ha(10,e.cellCm),n+Ha(12,e.cellCm))}}function Mp(e,t,i){e.minX=Math.min(e.minX,t),e.minY=Math.min(e.minY,i),e.maxX=Math.max(e.maxX,t),e.maxY=Math.max(e.maxY,i)}function Rp(e,t,i,n,r,o,s,a){const l=Math.min(s,a)*Math.PI/180,c=Math.max(s,a)*Math.PI/180,h=(e,t)=>{const i=Math.atan2(t,e),n=[l,c];for(let e=-3;e<=3;e++){const t=e*Math.PI-i,r=Math.PI/2+e*Math.PI-i;t>l&&tl&&r0&&[e.length,e.angle,t[0],t[1]].every(Number.isFinite)))return null;const{half:i,jambHalf:n}=$p(e),r=Na(e.cellCm),o=1.75*r,s=1.25*r,a=.75*r,l={minX:-i-s,minY:-n-s,maxX:i+s,maxY:n+s},c={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("window"===e.type)Rp(c,-i,0,i,-o,o,-90,0),Rp(c,i,-i,0,-o,o,0,90),Mp(c,-i-a,-i-a),Mp(c,i+a,a);else if("gate"===e.type){const t=10*e.face.side;Rp(c,-i,0,i,-o,o,0,t),Rp(c,i,-i,0,-o,o,-t,0)}else Rp(c,-i,0,e.length,-o,o,-90,0),Mp(c,-i-a,-e.length-a),Mp(c,i+a,a);const[h,d]=Cp(e),u={...l};Mp(u,c.minX+h,c.minY+d),Mp(u,c.maxX+h,c.maxY+d);const p=e.flipH?-1:1,_="gate"===e.type?1:e.flipV?-1:1,m=e.angle*Math.PI/180,g=Math.cos(m),f=Math.sin(m),v={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const e of[u.minX,u.maxX])for(const i of[u.minY,u.maxY]){const n=e*p,r=i*_;Mp(v,t[0]+n*g-r*f,t[1]+n*f+r*g)}return v}function Dp(e){if("passage"===e.type)return W``;const t=Math.max(0,Math.min(1,e.amount)),{half:i,jambHalf:n}=$p(e),r=Na(e.cellCm),o=1.75*r,s=e.flipH?-1:1,a=e.flipV?-1:1,l="gate"===e.type?1:a,[c,h]=Cp(e);let d;if("window"===e.type){const o=Math.PI/2*i,s=e.face.cm>0?W``}const xr={color:"#607d8b",opacity:1,widthCm:3.6,fill:!1,fillColor:"#607d8b",fillOpacity:.25},Sr=(e,t=1)=>{const i=Number(e);return Number.isFinite(i)?Math.min(1,Math.max(0,i)):t},$r=e=>{let t=Number(e);return Number.isFinite(t)?(t=(t%360+360)%360,t>180?t-360:t):0};function Mr(e,t,i){return $r(t)?[e.x,e.y]:i([e.x,e.y])}function Rr(e,t,i,n){const r=Math.abs(i[0]-t[0]),o=Math.abs(i[1]-t[1]);return"line"===e?Math.hypot(r,o)>=n:r>=n&&o>=n}const Cr=(e,t,i)=>{const n=Number(e),r=Number.isFinite(t)&&t>0?t:5;return Number.isFinite(n)&&n>0?n/r*i:0},Tr=(e,t,i)=>{const n=Number(e),r=Number.isFinite(t)&&t>0?t:5;return Number.isFinite(n)&&i>0?n/i*r:0},Dr=(e,t,i,n=xr.widthCm)=>{const r=Number(e?.width_cm);if(Number.isFinite(r)&&r>0)return r;const o=Number(e?.width);return Number.isFinite(o)&&o>0?Tr(o,t,i):n};function Ar(e){const t=xr;return e.color===t.color&&e.opacity===t.opacity&&e.widthCm===t.widthCm&&e.fill===t.fill&&e.fillColor===t.fillColor&&e.fillOpacity===t.fillOpacity?null:{color:e.color,opacity:Sr(e.opacity),width_cm:Math.max(.1,Math.min(100,Number(e.widthCm)||.1)),fill:!!e.fill,fill_color:e.fillColor,fill_opacity:Sr(e.fillOpacity,.25)}}function Pr(e,t){return{color:e.color,opacity:Sr(e.opacity),width_cm:Math.max(.1,Math.min(100,Number(e.widthCm)||.1)),...t?{fill:e.fill,fill_color:e.fillColor,fill_opacity:Sr(e.fillOpacity,.25)}:{}}}function Fr(e){const t=e.x+e.w/2,i=e.y+e.h/2,n=$r(e.angle)*Math.PI/180,r=Math.cos(n),o=Math.sin(n),s=(e,n)=>{const s=e-t,a=n-i;return[t+s*r-a*o,i+s*o+a*r]};return[s(e.x,e.y),s(e.x+e.w,e.y),s(e.x+e.w,e.y+e.h),s(e.x,e.y+e.h)]}function zr(e){const t=Fr(e),i=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],n=[(t[0][0]+t[2][0])/2,(t[0][1]+t[2][1])/2];return{points:[...t,i(t[0],t[1]),i(t[1],t[2]),i(t[2],t[3]),i(t[3],t[0]),n],segments:t.map((e,i)=>({a:e,b:t[(i+1)%4]}))}}function Ir(e,t,i,n,r,o,s,a){const l=$r(e.angle)*Math.PI/180,c=Math.cos(l),h=Math.sin(l),d=-Math.sin(l),u=Math.cos(l),p=e.x+e.w/2,_=e.y+e.h/2,m=t>0?-e.w/2:e.w/2,g=i>0?-e.h/2:e.h/2,f=p+m*c+g*d,v=_+m*h+g*u,y=n-f,b=r-v;let w=(y*c+b*h)*(t>0?1:-1),k=(y*d+b*u)*(i>0?1:-1),x=null;if(o){const t=w/Math.max(e.w,a),i=k/Math.max(e.h,a);x=Math.max(a/Math.max(e.w,a),a/Math.max(e.h,a),t,i),w=e.w*x,k=e.h*x}if(s>0)if(o){const t=Math.max(1,Math.round(e.w/s)),i=Math.max(1,Math.round(e.h/s));if(Math.abs(e.w-t*s)<1e-6&&Math.abs(e.h-i*s)<1e-6){const n=(e,t)=>{let i=Math.abs(e),n=Math.abs(t);for(;n;)[i,n]=[n,i%n];return Math.max(1,i)},r=1/n(t,i),o=Math.max(a/e.w,a/e.h),s=Math.max(o,Math.round((x??1)/r)*r);w=e.w*s,k=e.h*s}else{e.w>=e.h?(w=Math.round(w/s)*s,k=w*(e.h/Math.max(e.w,a))):(k=Math.round(k/s)*s,w=k*(e.w/Math.max(e.h,a)))}}else w=Math.round(w/s)*s,k=Math.round(k/s)*s;w=Math.max(a,w),k=Math.max(a,k);return{x:f+(t>0?w/2:-w/2)*c+(i>0?k/2:-k/2)*d-w/2,y:v+(t>0?w/2:-w/2)*h+(i>0?k/2:-k/2)*u-k/2,w:w,h:k,angle:$r(e.angle)||void 0}}const Or=(e,t,i)=>{const n=i[0]-t[0],r=i[1]-t[1],o=n*n+r*r;if(o<1e-12)return[...t];const s=Math.max(0,Math.min(1,((e[0]-t[0])*n+(e[1]-t[1])*r)/o));return[t[0]+n*s,t[1]+r*s]};function Er(e,t,i,n){const r=n(e);let o=null;for(const r of t.points){const t=n(r),s=Math.hypot(t[0]-e[0],t[1]-e[1]);s<=i&&(!o||se.points),segments:e.flatMap(e=>e.segments)}}const Hr=Math.tan(.25*Math.PI/180);function Lr(e,t){const i=Math.abs(Number(t[0])-Number(e[0])),n=Math.abs(Number(t[1])-Number(e[1]));if(!([i,n].every(Number.isFinite)&&i>0&&n>0))return null;const r=i>=n?"horizontal":"vertical",o=Math.max(i,n),s=Math.min(i,n);return s/o>Hr?null:{axis:r,major:o,minor:s,angleDegrees:180*Math.atan2(s,o)/Math.PI}}function Br(e,t){const i=Lr(e,t);return i?"horizontal"===i.axis?[Number(t[0]),Number(e[1])]:[Number(e[0]),Number(t[1])]:[Number(t[0]),Number(t[1])]}const qr=e=>`${e[0]},${e[1]}`,jr=(e,t)=>e[0]===t[0]&&e[1]===t[1],Wr=(e,t)=>{const i=qr(e),n=qr(t);return i{let t=0;for(let i=0;i{if(e.length<3)return!1;for(let t=0;t1e-12},Vr=(e,t)=>jr(e,t.from)?[...t.to]:[...e],Kr=(e,t)=>e.map(e=>Array.isArray(e?.poly)?{...e,poly:e.poly.map(e=>Vr(e,t))}:e),Yr=(e,t,i)=>{const n=e.flatMap((e,t)=>ni(e)?.some(e=>jr(e,i.from))?[t]:[]);if(!n.length)return!1;for(const i of n){const n=ni(e[i]),r=ni(t[i]);if(!n||!r)continue;if(!Gr(r))return!1;const o=Math.sign(Ur(n)),s=Math.sign(Ur(r));if(o&&s&&o!==s)return!1}const r=new Set;for(const e of n){const i=ni(t[e]);if(i)for(let n=0;n{let i=0;for(const n of e){const e=ni(n);if(e)for(let n=0;n{const{a:i,b:n,axis:r}=e,o="horizontal"===r?{from:n,to:[n[0],i[1]]}:{from:n,to:[i[0],n[1]]},s="horizontal"===r?{from:i,to:[i[0],n[1]]}:{from:i,to:[n[0],i[1]]};return[{move:o,preservedDegree:Xr(t,i)},{move:s,preservedDegree:Xr(t,n)}].sort((e,t)=>t.preservedDegree-e.preservedDegree||qr(e.move.to).localeCompare(qr(t.move.to))||qr(e.move.from).localeCompare(qr(t.move.from))).map(e=>e.move)};function Jr(e){const t=JSON.parse(JSON.stringify(e||{}));let i=Array.isArray(t.rooms)?t.rooms:[];const n=new Map;for(const e of i){const t=ni(e);if(t)for(let e=0;ee.key.localeCompare(t.key))){let t=null;for(const n of Zr(e,i)){const e=a.get(qr(n.from));if(e&&e!==qr(n.to))continue;const r=Kr(i,n);if(Yr(i,r,n)){t=n,i=r;break}}t?(a.set(qr(t.from),qr(t.to)),r++,s=Math.max(s,Math.hypot(t.to[0]-t.from[0],t.to[1]-t.from[1]))):o++}t.rooms=i;for(const e of t.partitions||[]){if(!Array.isArray(e?.a)||!Array.isArray(e?.b))continue;const i=Lr(e.a,e.b);if(!i)continue;const n={key:String(e.id||Wr(e.a,e.b)),a:[...e.a],b:[...e.b],axis:i.axis};let a=null;for(const i of Zr(n,[{poly:[e.a,e.b]}])){const n=Vr(e.a,i),r=Vr(e.b,i),o=Math.hypot(r[0]-n[0],r[1]-n[1]);if(!(o>0))continue;const s=(t.openings||[]).filter(t=>"partition"===t?.host?.kind&&t.host.id===e.id).every(e=>{const t=Number(e.host.t),i=Number(e.length);return Number.isFinite(t)&&t>=0&&t<=1&&Number.isFinite(i)&&i>0&&t*o-i/2>=-1e-12&&t*o+i/2<=o+1e-12});if(s){a=i,e.a=n,e.b=r;break}}a?(r++,s=Math.max(s,Math.hypot(a.to[0]-a.from[0],a.to[1]-a.from[1]))):o++}return{space:t,report:{wallsStraightened:r,wallsStraightenSkipped:o,maxStraightenShift:s},changed:r>0}}const Qr=["rect","ellipse","furniture","image"],eo=10**9,to=240,io=1e-4;function no(e){if(Array.isArray(e))return e.map(e=>no(e));if(null!==e&&"object"==typeof e){const t={};for(const[i,n]of Object.entries(e))t[i]=no(n);return t}return e}function ro(e){if("number"!=typeof e||!Number.isFinite(e))return e;const t=(e<0||Object.is(e,-0)?-1:1)*(Math.floor(Math.abs(e)*eo+.5)/eo);return 0===t?0:t}function oo(e){if("number"!=typeof e||!Number.isFinite(e))return e;const t=e*to,i=Math.round(t);if(Math.abs(t-i)null!==ao(e)):[]}function co(e){return"string"==typeof e&&Qr.includes(e)}function ho(e,t){for(const i of t)Object.prototype.hasOwnProperty.call(e,i)&&(e[i]=ro(e[i]))}function uo(e,t){for(const i of t)Object.prototype.hasOwnProperty.call(e,i)&&(e[i]=oo(e[i]))}function po(e){if(Array.isArray(e))for(let t=0;t{for(const r of n){const n=t[r];"number"==typeof n&&Number.isFinite(n)&&i(n,e)}},n=t=>{if(Array.isArray(t))for(let n=0;n{if(Array.isArray(e))for(const t of e)n(t)};for(const i of lo(e.rooms))t(i,["x","y","w","h"]),r(i.poly);for(const t of lo(e.walls))n(t.a),n(t.b);for(const t of lo(e.wall_segments))n(t.a),n(t.b);for(const i of lo(e.openings))t(i,["x","y"]);for(const i of lo(e.decor))"line"===i.kind?t(i,["x1","y1","x2","y2"]):co(i.kind)?t(i,["x","y","w","h"]):"text"===i.kind&&t(i,["x","y"]);for(const t of lo(e.room_drafts))r(t.points);for(const t of lo(e.partitions))n(t.a),n(t.b);for(const t of lo(e.wall_columns))n(t.center);for(const t of lo(e.open_spans))n(t.a),n(t.b)}const r=ao(t);if(!r)return;const o=new Map;if(n)for(const e of lo(n.spaces))null!=e.id&&o.set(String(e.id),e);for(const e of Object.values(r)){const t=ao(e);if(!t)continue;const n=null!=t.s&&o.get(String(t.s))||null;for(const e of["x","y"]){const r=t[e];"number"==typeof r&&Number.isFinite(r)&&i(r,n)}}}function go(e){const t=Number(e?.cell_cm);return t>0?t:5}function fo(e,t={}){const i={canonicalized:0,far:0,maxShift:0,maxShiftCm:0,spaces:[],bySpace:new Map},n=lo(ao(e)?.spaces);let r=5;for(const e of n)r=Math.max(r,go(e));mo(e,t,(e,t)=>{const n=e*to,o=Math.abs(n-Math.round(n)),s=oo(e),a=o>0&&o=io))return;const l=a&&"number"==typeof s?Math.abs(s-e):0;if(a?i.canonicalized++:i.far++,i.maxShift=Math.max(i.maxShift,l),i.maxShiftCm=Math.max(i.maxShiftCm,l*to*(t?go(t):r)),!t?.id||!a)return;const c=String(t.id);let h=i.bySpace.get(c);h||(h={spaceId:c,space:String(t.title||c),canonicalized:0,far:0,maxShift:0,maxShiftCm:0},i.bySpace.set(c,h)),h.canonicalized++,h.maxShift=Math.max(h.maxShift,l),h.maxShiftCm=Math.max(h.maxShiftCm,l*to*go(t))}),i.bySpace.size&&mo(e,t,(e,t)=>{if(!t?.id)return;const n=i.bySpace.get(String(t.id));if(!n)return;const r=e*to;Math.abs(r-Math.round(r))>=io&&n.far++}),i.spaces=[...i.bySpace.values()];const{bySpace:o,...s}=i;return s}function vo(e){return function(e){const t=e,i=ao(t);i&&uo(i,["x","y"]);return t}(no(e))}function yo(e){const t=e,i=ao(t);if(!i)return t;for(const e of Object.values(i)){const t=ao(e);t&&uo(t,["x","y"])}return t}function bo(e){return wo(no(e))}function wo(e){const t=e,i=ao(t);if(!i)return t;for(const e of lo(i.spaces)){ho(e,["plan_x","plan_y","plan_scale","plan_scale_x","plan_scale_y","plan_angle"]);for(const t of lo(e.rooms))uo(t,["x","y","w","h"]),_o(t.poly);for(const t of lo(e.walls))po(t.a),po(t.b);for(const t of lo(e.wall_segments))po(t.a),po(t.b);for(const t of lo(e.openings)){uo(t,["x","y"]),ho(t,["angle","length"]);const e=ao(t.host);e&&ho(e,["t"])}for(const t of lo(e.decor))"line"===t.kind?uo(t,["x1","y1","x2","y2"]):co(t.kind)?(uo(t,["x","y","w","h"]),ho(t,["angle"])):"text"===t.kind&&(uo(t,["x","y"]),ho(t,["scale","angle"]));for(const t of lo(e.room_drafts))_o(t.points);for(const t of lo(e.partitions))po(t.a),po(t.b);for(const t of lo(e.wall_columns))po(t.center),"square"===t.shape&&ho(t,["angle"]);for(const t of lo(e.open_spans))po(t.a),po(t.b)}for(const e of lo(i.markers))ho(e,["angle"]);return t}const ko=15,xo=8;function So(e,t,i,n,r){const o=i[0]-e[0],s=i[1]-e[1],a=Math.hypot(o,s);if(!(a>0)||a<=r+1e-9)return null;const l=o/a,c=s/a,h=t=>{const n=(t[0]-e[0])*l+(t[1]-e[1])*c,o=(r-n)/(a-n);return!Number.isFinite(o)||o<-1e-9||o>1+1e-9?null:[t[0]+(i[0]-t[0])*o,t[1]+(i[1]-t[1])*o]},d=h(t),u=h(n);return d&&u?[[e[0],e[1]],t,d,u,n]:null}const $o=Math.sin(.25*Math.PI/180);function Mo(e,t){return Number.isFinite(e)&&e>0&&Number.isFinite(t)&&t>0&&e*t<3}function Ro(e){const t=Number(e)>0?Number(e):5;if(5===t)return 8;const i=5/t*8;return Math.min(80,Math.max(.5,i))}function Co(e,t){return Number.isFinite(e)&&e>0&&Number.isFinite(t)&&t>0&&e*t<2}function To(e){return Number.isFinite(e)?Math.max(1,Math.min(100,e)):1}function Do(e,t){return!Number.isFinite(e)||e<0?"":String(t?Math.round(e/2.54*100)/100:Math.round(100*e)/100)}function Ao(e,t,i){if(!Number.isFinite(e)||e<=0)return 0;const n=Number(t)>0?Number(t):5;return To(e)/n*i}function Po(e,t){return t>0&&Number.isFinite(e)?Math.round(e/t)*t:e}function Fo(e){return Math.max(1e-6*Math.abs(e),1e-9)}function zo(e,t){if(!(t>0&&Number.isFinite(e)))return e;const i=Po(e,t);return Math.abs(i-e)<=Fo(t)?i:e}function Io(e,t){let i=t[0]-e[0],n=t[1]-e[1];const r=Math.hypot(i,n);return r<1e-12?[1,0]:(i/=r,n/=r,(i<-1e-12||Math.abs(i)<=1e-12&&n<0)&&(i=-i,n=-n),[i,n])}function Oo(e,t,i){const n=[zo(e[0],i),zo(e[1],i)],r=[zo(t[0],i),zo(t[1],i)],o=Po((n[0]+r[0])/2,i),s=Po((n[1]+r[1])/2,i),[a,l]=Io(n,r);let c=Math.atan2(l,a);c<0&&(c+=Math.PI);const h=Math.round(1800*c)/1800,d=i>0&&i<.01?6:i<1?4:2;return`${o.toFixed(d)},${s.toFixed(d)}@${h.toFixed(4)}`}function Eo(e,t,i,n){return 1===n?Oo(e,t,i):Oo([e[0]/n,e[1]/n],[t[0]/n,t[1]/n],i)}function No(e,t){if(!Array.isArray(e.a)||!Array.isArray(e.b)||e.a.length<2||e.b.length<2)return null;const i=[Number(e.a[0]),Number(e.a[1]),Number(e.b[0]),Number(e.b[1])];if(!i.every(Number.isFinite))return null;const n=t>0?t:1;return[[i[0]*n,i[1]*n],[i[2]*n,i[3]*n]]}function Ho(e,t,i,n,r){const o=r>0?r:1;return{key:Eo(e,t,n,o),cm:To(i),a:[e[0]/o,e[1]/o],b:[t[0]/o,t[1]/o]}}function Lo(e,t){const i=t>0?t:1,n=[];for(const t of e){const e=t.key.lastIndexOf("@");if(e<0)continue;const[r,o]=t.key.slice(0,e).split(",").map(Number),s=Number(t.key.slice(e+1));[r,o,s].every(Number.isFinite)&&n.push({w:t,x:r*i,y:o*i,ang:s})}return n}function Bo(e,t){const[i,n]=Io(e,t);let r=Math.atan2(n,i);return r<0&&(r+=Math.PI),r}function qo(e,t){let i=Math.abs(e-t);return i>Math.PI/2&&(i=Math.PI-i),i<.02}function jo(e,t,i,n,r=1){if(!e?.length)return null;const o=Eo(t,i,n,r),s=e.find(e=>e.key===o);if(s)return s;const a=r>0?r:1,l=Fo(n)*a,c=(e,t)=>Math.abs(e[0]-t[0])<=l&&Math.abs(e[1]-t[1])<=l;for(const n of e){const e=No(n,a);if(e&&(c(e[0],t)&&c(e[1],i)||c(e[0],i)&&c(e[1],t)))return n}const h=(t[0]+i[0])/2,d=(t[1]+i[1])/2,u=Bo(t,i),p=Math.max(.5*n,1e-9)*a;for(const t of Lo(e,a))if(qo(t.ang,u)&&Math.hypot(t.x-h,t.y-d)<=p)return t.w;return null}function Wo(e,t,i,n,r=1){const o=jo(e,t,i,n,r);if(o&&o.cm>0)return To(o.cm);const s=function(e,t,i,n,r){if(!e?.length)return null;const o=r>0?r:1,s=Math.hypot(i[0]-t[0],i[1]-t[1]);if(s<1e-12)return null;const a=Bo(t,i),l=Math.max(.5*n,1e-9)*o;let c=null;for(const n of e){if(!(n.cm>0))continue;const e=No(n,o);if(!e)continue;const r=Math.hypot(e[1][0]-e[0][0],e[1][1]-e[0][1]);if(r<1e-12||!qo(Bo(e[0],e[1]),a))continue;if(Fs(t[0],t[1],e[0][0],e[0][1],e[1][0],e[1][1])>l||Fs(i[0],i[1],e[0][0],e[0][1],e[1][0],e[1][1])>l)continue;if(r+l(o.has(e.key)||(e=>{const t=No(e,n);if(!t)return!1;const[i,o]=t,a=o[0]-i[0],c=o[1]-i[1],h=Math.hypot(a,c);if(h<=l)return!1;if(!s.some(e=>{const t=[e[0],e[1]],n=[e[2],e[3]];return qo(Bo(i,o),Bo(t,n))&&Fs(i[0],i[1],t[0],t[1],n[0],n[1])<=l&&Fs(o[0],o[1],t[0],t[1],n[0],n[1])<=l}))return!1;const d=(r||[]).some(e=>{const t=[e[0],e[1]],n=[e[2],e[3]];if(!qo(Bo(i,o),Bo(t,n)))return!1;const r=e=>Math.abs((e[0]-i[0])*c-(e[1]-i[1])*a)/h;if(r(t)>l||r(n)>l)return!1;const s=h*h,d=((t[0]-i[0])*a+(t[1]-i[1])*c)/s,u=((n[0]-i[0])*a+(n[1]-i[1])*c)/s;return Math.min(1,Math.max(d,u))-Math.max(0,Math.min(d,u))>l/h});return!d})(e))&&e.cm>=1&&e.cm<=100)}function Go(e,t,i,n=8){const[r,o]=Io(e,t);let s=Math.atan2(o,r);s<0&&(s+=Math.PI);let a=i*Math.PI/180%Math.PI;a<0&&(a+=Math.PI);let l=Math.abs(s-a);return l>Math.PI/2&&(l=Math.PI-l),l<=n*Math.PI/180}function Vo(e,t,i,n,r=1,o="affine",s){if(!e?.length)return[];if(t.length!==i.length)return"fixed-topology"===o&&s?.(),e.slice();const a=r>0?r:1,l=Math.max(.5*n,1e-9)*a,c=Math.max(n*a*1e-6,1e-9),h=[],d=new Map,u=new Map,p=(e,t,i)=>{const n=e.get(t)||new Set;n.add(i),e.set(t,n)};for(let e=0;e[e[0]+(t[0]-e[0])*i,e[1]+(t[1]-e[1])*i],m=(e,t)=>Math.hypot(e[0]-t[0],e[1]-t[1])<=c,g=(e,t)=>{if("fixed-topology"===o){const i=t.na[0]-t.oa[0],n=t.na[1]-t.oa[1],r=t.nb[0]-t.ob[0],o=t.nb[1]-t.ob[1];return Math.hypot(i-r,n-o)<=c?[e[0]+i,e[1]+n]:m(e,t.oa)?[...t.na]:m(e,t.ob)?[...t.nb]:[...e]}const i=Math.max(0,Math.min(1,((e[0]-t.oa[0])*t.dx+(e[1]-t.oa[1])*t.dy)/t.len2));return _(t.na,t.nb,i)},f=(e,t)=>{const[i,n]=Io(e,t);return(t[0]-e[0])*i+(t[1]-e[1])*n>=0?[[...e],[...t]]:[[...t],[...e]]},v=[],y=[],b=(e,t,i)=>{if(Math.hypot(t[0]-e[0],t[1]-e[1])<=c)return;const[r,o]=f(e,t),s=To(i);if(y.some(e=>e.entry.cm===s&&m(e.span[0],r)&&m(e.span[1],o)))return;const l=Ho(r,o,s,n,a);v.push(l),y.push({entry:l,span:[r,o]})};for(const t of e){const e=No(t,a);if(e){const[i,n]=f(e[0],e[1]),r=n[0]-i[0],s=n[1]-i[1],a=r*r+s*s,d=Math.sqrt(a);if(d<=c){v.push({...t,cm:To(t.cm)});continue}const u=[];for(const e of h){if(!qo(Bo(i,n),Bo(e.oa,e.ob)))continue;const t=e=>Math.abs((e[0]-i[0])*s-(e[1]-i[1])*r)/d;if(t(e.oa)>l||t(e.ob)>l)continue;const o=((e.oa[0]-i[0])*r+(e.oa[1]-i[1])*s)/a,h=((e.ob[0]-i[0])*r+(e.ob[1]-i[1])*s)/a,p=Math.max(0,Math.min(o,h)),_=Math.min(1,Math.max(o,h));(_-p)*d>c&&u.push({lo:p,hi:_,move:e})}if(!u.length){"fixed-topology"===o?v.push({...t}):b(i,n,t.cm);continue}const p=[0,1,...u.flatMap(({lo:e,hi:t})=>[e,t])].sort((e,t)=>e-t).filter((e,t,i)=>0===t||Math.abs(e-i[t-1])*d>c),y=[];for(let e=0;e+1a>=e.lo-1e-12&&a<=e.hi+1e-12);if(!l.length){y.push([o,s]);continue}const h=[g(o,l[0].move),g(s,l[0].move)],f=l.slice(1).some(e=>{const t=g(o,e.move),i=g(s,e.move);return!m(h[0],t)||!m(h[1],i)});y.push(f?[o,s]:h)}const w=(e,t)=>{const i=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.hypot(i,n);return!(s<=c||i*r+n*o<=0)&&Math.abs(i*o-n*r)/s<=c},k=[];for(const e of y){const t=k[k.length-1];t&&m(t[1],e[0])&&w(t,e)?t[1]=e[1]:k.push([[...e[0]],[...e[1]]])}if("fixed-topology"===o&&1===k.length){const[i,n]=k[0];if(m(i,e[0])&&m(n,e[1])||m(i,e[1])&&m(n,e[0])){v.push({...t});continue}}for(const[e,i]of k)b(e,i,t.cm);continue}if("fixed-topology"===o){const e=u.get(t.key);if(1===e?.size){const i=[...e][0];v.push(i===t.key?{...t}:{...t,key:i});continue}const i=[Lo([t],a)[0]];1!==a&&i.push(Lo([t],1)[0]);const n=i.filter(Boolean).some(e=>h.some(t=>{if(!qo(e.ang,Bo(t.oa,t.ob)))return!1;const i=((e.x-t.oa[0])*t.dx+(e.y-t.oa[1])*t.dy)/t.len2;return i>=-1e-6&&i<=1.000001&&Fs(e.x,e.y,t.oa[0],t.oa[1],t.ob[0],t.ob[1])<=l}));((e?.size||0)>1||n)&&s?.(),v.push({...t});continue}let i="";const r=d.get(t.key);if(1===r?.size&&(i=[...r][0]),!i){const e=Lo([t],a)[0];if(e){const t=new Set;for(const i of h){if(!qo(e.ang,Bo(i.oa,i.ob)))continue;const r=((e.x-i.oa[0])*i.dx+(e.y-i.oa[1])*i.dy)/i.len2;if(r<-1e-6||r>1.000001)continue;if(Fs(e.x,e.y,i.oa[0],i.oa[1],i.ob[0],i.ob[1])>l)continue;const o=g([e.x,e.y],i),[s,c]=Io(i.na,i.nb),h=Math.max(n*a,1e-6);t.add(Eo([o[0]-s*h,o[1]-c*h],[o[0]+s*h,o[1]+c*h],n,a))}1===t.size&&(i=[...t][0])}}v.push({...t,key:i||t.key,cm:To(t.cm)})}return v}function Ko(e,t,i,n,r=1,o="affine"){return Vo(e,t,i,n,r,o)}function Yo(e,t,i,n,r=1,o="fixed-topology"){let s=!1;const a=Vo(e,t,i,n,r,o,()=>{s=!0});return{walls:s?(e||[]).map(e=>({...e})):a,rejected:s}}function Xo(e,t,i,n=1,r=[]){const o=n>0?n:1,s=Math.abs(i),a=Math.max(s*o*io,1e-9),l=(r||[]).flatMap(e=>{const t=No(e,o);return t?t.map(e=>[...e]):[]}),c=e=>e.every((e,t)=>(e=>{if(!(s>0))return!0;const t=e/o/s;return Math.abs(t-Math.round(t))Math.abs(e-i[t])<=a)),h=[],d=e=>JSON.stringify([e.key,e.cm,e.a,e.b]);for(const i of e||[]){const e=No(i,o);if(!e)continue;const[n,r]=e;if(![n[0],n[1],r[0],r[1]].every(Number.isFinite)||!c(n)||!c(r)){h.push(d(i));continue}const s=r[0]-n[0],l=r[1]-n[1],u=Math.hypot(s,l);if(u<=a){h.push(d(i));continue}const p=s/u,_=l/u,m=[];for(const e of t){const[t,i]=e;if(![t?.[0],t?.[1],i?.[0],i?.[1]].every(Number.isFinite))continue;const r=e=>Math.abs((e[0]-n[0])*_-(e[1]-n[1])*p);if(r(t)>a||r(i)>a)continue;const o=(t[0]-n[0])*p+(t[1]-n[1])*_,s=(i[0]-n[0])*p+(i[1]-n[1])*_,l=Math.max(0,Math.min(o,s)),c=Math.min(u,Math.max(o,s));c-l>a&&m.push([l,c])}m.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let g=0;for(const[e,t]of m){if(e>g+a)break;if(g=Math.max(g,t),g>=u-a)break}ge.key!==s);return null==n||n<1?a:[...a,Ho(t,i,n,r,o)]}function Jo(e,t,i,n,r,o=[],s=1){let a=e?e.slice():[];for(const e of function(e,t,i,n,r=1,o=[]){const s=ys(e,t,i,n,r,o);if(!s)return[];const a=[];for(let e=0;e0||(c=Zo(c,t,i,n,r,s)))}return c}function es(e){const{a:t,b:i,halfDepth:n}=e;if(!Array.isArray(t)||!Array.isArray(i)||t.length<2||i.length<2||![t[0],t[1],i[0],i[1]].every(Number.isFinite))return null;const r=i[0]-t[0],o=i[1]-t[1],s=Math.hypot(r,o);if(!(s>1e-9&&n>0&&Number.isFinite(n)))return null;const a=-o/s*n,l=r/s*n;return[[t[0]+a,t[1]+l],[i[0]+a,i[1]+l],[i[0]-a,i[1]-l],[t[0]-a,t[1]-l]]}function ts(e,t,i){return Math.hypot(e[0]-t[0],e[1]-t[1])<=i}function is(e,t,i){const n=t.b[0]-t.a[0],r=t.b[1]-t.a[1],o=n*n+r*r;if(!(o>i*i))return!1;const s=((e[0]-t.a[0])*n+(e[1]-t.a[1])*r)/o;if(!(s>0&&s<1))return!1;const a=[t.a[0]+n*s,t.a[1]+r*s];return Math.hypot(e[0]-a[0],e[1]-a[1])<=i}function ns(e,t,i,n){const r=Math.hypot(t,i);if(!(r>1e-9&&n>0))return;const o=[t/r,i/r],s=e.find(e=>Math.abs(e.u[0]*o[1]-e.u[1]*o[0])<1e-9&&e.u[0]*o[0]+e.u[1]*o[1]>1-1e-9);s?s.halfDepth=Math.max(s.halfDepth,n):e.push({u:o,halfDepth:n})}function rs(e,t){try{const i=Gt(Os(e),Os(t));let n=null,r=0;for(const e of i||[]){const t=e?.[0]||[],i=Math.abs(hs(t));t.length>=4&&i>r&&(r=i,n=t.slice(0,-1).map(e=>[e[0],e[1]]))}return n}catch{return null}}function os(e,t=1e-6){const i=(e||[]).map((e,t)=>({segment:e,index:t})).filter(({segment:e})=>e&&Array.isArray(e.a)&&Array.isArray(e.b)&&e.a.length>=2&&e.b.length>=2&&e.a.every(Number.isFinite)&&e.b.every(Number.isFinite)&&Number.isFinite(e.halfDepth)&&e.halfDepth>0&&Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])>1e-9);if(i.length<2)return[];const n=Math.max(Number.isFinite(t)?t:0,1e-9),r=i.flatMap(({segment:e})=>[e.a,e.b]).map(e=>[e[0],e[1]]).sort((e,t)=>e[0]-t[0]||e[1]-t[1]),o=[];for(const e of r)o.some(t=>ts(t,e,n))||o.push(e);const s=[];for(const e of o){const t=[];let r=!1;for(const{segment:o,index:s}of i){const i=Math.hypot(o.b[0]-o.a[0],o.b[1]-o.a[1]);ts(e,o.a,n)?t.push({u:[(o.b[0]-o.a[0])/i,(o.b[1]-o.a[1])/i],halfDepth:o.halfDepth,length:i,index:s}):ts(e,o.b,n)?t.push({u:[(o.a[0]-o.b[0])/i,(o.a[1]-o.b[1])/i],halfDepth:o.halfDepth,length:i,index:s}):is(e,o,n)&&(r=!0)}if(r||2!==t.length)continue;const[o,a]=t,l=o.u[0]*a.u[1]-o.u[1]*a.u[0];if(Math.abs(l)<1e-9)continue;const c=l<0?1:-1,h=[-o.u[1],o.u[0]],d=[-a.u[1],a.u[0]],u=[e[0]+h[0]*o.halfDepth*c,e[1]+h[1]*o.halfDepth*c],p=[e[0]-d[0]*a.halfDepth*c,e[1]-d[1]*a.halfDepth*c];if(!ps(u,o.u,p,a.u))continue;const _=[[o,a,p,[d[0]*-c,d[1]*-c]],[a,o,u,[h[0]*c,h[1]*c]]];for(const[t,,i,r]of _){const o=Math.min(2*t.halfDepth,t.length),a=[-t.u[1]*t.halfDepth,t.u[0]*t.halfDepth],l=[[e[0]+a[0],e[1]+a[1]],[e[0]+t.u[0]*o+a[0],e[1]+t.u[1]*o+a[1]],[e[0]+t.u[0]*o-a[0],e[1]+t.u[1]*o-a[1]],[e[0]-a[0],e[1]-a[1]]],c=e=>(e[0]-i[0])*r[0]+(e[1]-i[1])*r[1],h=[];for(let e=0;e=-1e-12&&h.push(t),n>1e-12&&r<-1e-12||n<-1e-12&&r>1e-12){const e=n/(n-r);h.push([t[0]+(i[0]-t[0])*e,t[1]+(i[1]-t[1])*e])}}h.length>=3&&Math.abs(hs(h))>n*n&&s.push({segmentIndex:t.index,wedge:h})}}return s}function ss(e,t=1e-6){const i=(e||[]).filter(e=>e&&Array.isArray(e.a)&&Array.isArray(e.b)&&e.a.length>=2&&e.b.length>=2&&e.a.every(Number.isFinite)&&e.b.every(Number.isFinite)&&Number.isFinite(e.halfDepth)&&e.halfDepth>0&&Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])>1e-9);if(i.length<2)return[];const n=Math.max(Number.isFinite(t)?t:0,1e-9),r=i.flatMap(e=>[e.a,e.b]).map(e=>[e[0],e[1]]).sort((e,t)=>e[0]-t[0]||e[1]-t[1]),o=[];for(const e of r)o.some(t=>ts(t,e,n))||o.push(e);const s=[],a=i.map((e,t)=>({roomId:"",a:[e.a[0],e.a[1]],b:[e.b[0],e.b[1]],key:`join-${t}`,kind:"outer",cm:0,open:!1,half:e.halfDepth})),l=Ss(a,n);for(const e of $s(l).fans)s.push(e);const c=e=>!!Ms(l,e);for(const e of o){if(c(e))continue;const t=[];for(const r of i)ts(e,r.a,n)?ns(t,r.b[0]-r.a[0],r.b[1]-r.a[1],r.halfDepth):ts(e,r.b,n)?ns(t,r.a[0]-r.b[0],r.a[1]-r.b[1],r.halfDepth):is(e,r,n)&&(ns(t,r.a[0]-e[0],r.a[1]-e[1],r.halfDepth),ns(t,r.b[0]-e[0],r.b[1]-e[1],r.halfDepth));if(!(t.length<2)){t.sort((e,t)=>Math.atan2(e.u[1],e.u[0])-Math.atan2(t.u[1],t.u[0])||e.halfDepth-t.halfDepth);for(let i=0;in*n&&s.push(m)}}}return s}function as(e,t,i,n){if(!(t>0)||!e||e.length<2)return"";if(i&&e.length>=3){let i=e;const r=e[e.length-1];if(e.length>=4&&Math.hypot(e[0][0]-r[0],e[0][1]-r[1])<1e-9&&(i=e.slice(0,-1)),i.length>=3){const e=i.map((e,i)=>n?.[i]||t),r=ia(i,e),o=gs(i,e);if(r&&o)return`${fs(r)} ${fs(vs(o))}`}}const r=[];for(let i=0;i=1e-9&&a>0&&r.push({a:o,b:s,halfDepth:a})}const o=r.map(es);for(const{segmentIndex:e,wedge:t}of os(r)){const i=o[e];if(!i)continue;const n=rs(i,t);n&&(o[e]=n)}const s=[...o.filter(e=>!!e),...ss(r)],a=function(e){let t=null;try{for(const i of e){if(i.length<3)continue;const e=Os(i);t=t?Wt(t,e):[e]}return t}catch{return null}}(s);return a?Ks(a):s.map(e=>fs(e)).join(" ")}function ls(e,t,i,n,r=1){if(!i.length)return!1;const o=cs(n,r),s=(e[0]+t[0])/2,a=(e[1]+t[1])/2,[l,c]=Io(e,t);for(const e of i){const[t,i]=Io([e[0],e[1]],[e[2],e[3]]);if(!(Math.abs(l*i-c*t)>.05)&&Fs(s,a,e[0],e[1],e[2],e[3])<=o)return!0}return!1}function cs(e,t){return Math.max(e*(t>0?t:1)*.04,1e-9)}function hs(e){let t=0;for(let i=0;ie[1]!=l>e[1]&&e[0]<(a-o)*(e[1]-s)/(l-s+0)+o&&(i=!i)}return i}([c[0]+.001*a,c[1]+.001*l],e)||(a=-a,l=-l),[a,l]}function us(e,t){const i=e[0]*t[1]-e[1]*t[0],n=e[0]*t[0]+e[1]*t[1];return Math.abs(i)<1e-9&&n>0}function ps(e,t,i,n){const r=t[0]*n[1]-t[1]*n[0];if(Math.abs(r)<1e-12)return null;const o=[i[0]-e[0],i[1]-e[1]],s=(o[0]*n[1]-o[1]*n[0])/r;return[e[0]+s*t[0],e[1]+s*t[1]]}function _s(e,t,i){const n=e?.length||0;if(n<3||!Array.isArray(i)||i.length!==n)return 0;const r=(Math.trunc(t)%n+n)%n,o=e[r],s=e[(r+1)%n],a=s[0]-o[0],l=s[1]-o[1],c=Math.hypot(a,l);if(!(c>0))return 0;const h=Math.max(0,Number(i[r])||0);if(!(h>0))return c;const d=[a/c,l/c],u=ds(e,r),p=[o[0]+u[0]*h,o[1]+u[1]*h],_=t=>{const r=Math.max(0,Number(i[t])||0);if(!(r>0))return null;const s=e[t],a=e[(t+1)%n],l=a[0]-s[0],c=a[1]-s[1],h=Math.hypot(l,c);if(!(h>0))return null;const u=ds(e,t),_=ps(p,d,[s[0]+u[0]*r,s[1]+u[1]*r],[l/h,c/h]);return _?(_[0]-o[0])*d[0]+(_[1]-o[1])*d[1]:null},m=_((r-1+n)%n)??0,g=(_((r+1)%n)??c)-m;return g>0?g:0}function ms(e,t,i,n,r,o,s,a=1){const l=(e||[]).find(e=>e?.id===t),c=ni(l);if(!c||c.length<3)return null;const h=Cs(e,t,i,n,r,o,s,a);if(!h)return c.map(()=>0);const d=4*cs(r,a);return c.map((e,t)=>{const i=c[(t+1)%c.length],n=[(e[0]+i[0])/2,(e[1]+i[1])/2];for(let e=0;e!(e>0)))return e.map(e=>[e[0],e[1]]);const r=[];for(let o=0;o0||u>0)){r.push([e[o][0],e[o][1]]);continue}if(d>0!=u>0){const t=e[o],i=d>0?[t[0]+p*d,t[1]+_*d]:[t[0],t[1]],n=u>0?[t[0]+m*u,t[1]+g*u]:[t[0],t[1]];r.push(i),Math.hypot(n[0]-i[0],n[1]-i[1])>1e-9&&r.push(n);continue}if(us(w,k)){const t=e[o],i=[t[0]+p*d,t[1]+_*d],n=[t[0]+m*u,t[1]+g*u];r.push(i),Math.hypot(n[0]-i[0],n[1]-i[1])>1e-9&&r.push(n);continue}const $=ps(x,w,S,k),M=Math.max(d,u,1e-9),R=Ms(i,e[o])?.limit??4*M;if($){const i=Math.hypot($[0]-e[o][0],$[1]-e[o][1]);if(Number.isFinite(i)&&i<=R){r.push($);continue}if(Xs(e,t,o)){r.push($);continue}}d>0&&r.push([e[o][0]+p*d,e[o][1]+_*d]),u>0&&r.push([e[o][0]+m*u,e[o][1]+g*u]),d>0||u>0||r.push([e[o][0],e[o][1]])}return r.length>=3?r:null}function fs(e,t=!0){if(!e.length)return"";let i=`M ${e[0][0]} ${e[0][1]}`;for(let t=1;te?.id===t),a=ni(s);if(!a||a.length<3)return null;const l=cs(n,r),c=[];for(const i of e||[]){if(!i||i.id===t)continue;const e=ni(i);if(e)for(const t of An(a,e,l))c.push([t[0],t[1]],[t[2],t[3]])}for(const e of i||[])c.push([e[0],e[1]],[e[2],e[3]]);for(const e of o||[]){const t=No(e,r);t&&c.push(t[0],t[1])}const h=[],d=[];for(let e=0;el)continue;const s=((e[0]-t[0])*(i[0]-t[0])+(e[1]-t[1])*(i[1]-t[1]))/(n*n);s<=r||s>=1-r||(o.some(e=>Math.abs(e-s)*n<=2*l)||o.push(s))}o.sort((e,t)=>e-t);for(const n of o)h.push([t[0]+(i[0]-t[0])*n,t[1]+(i[1]-t[1])*n]),d.push(e)}return{poly:h,parent:d,orig:a}}function bs(e,t,i,n){const r=t.poly.length,o=new Array(r).fill(0);if(!e?.length)return o;const s=new Set,a=[];for(let l=0;l0?(o[l]=To(c.cm),s.add(c.key)):a.push(l)}if(!a.length)return o;const l=n>0?n:1,c=Math.max(.5*i,1e-9)*l,h=Lo(e,l).filter(e=>e.w.cm>0);for(let e=a.length-1;e>=0;e--){const i=a[e],n=t.poly[i],s=t.poly[(i+1)%r],d=Bo(n,s);let u=null;for(const e of h){const t=No(e.w,l);if(!t||!qo(Bo(t[0],t[1]),d))continue;if(Fs(n[0],n[1],t[0][0],t[0][1],t[1][0],t[1][1])>c||Fs(s[0],s[1],t[0][0],t[0][1],t[1][0],t[1][1])>c)continue;const i=Math.hypot(s[0]-n[0],s[1]-n[1]),r=Math.hypot(t[1][0]-t[0][0],t[1][1]-t[0][1]),o=Math.max(0,r-i);(!u||oc||Fs(r[0],r[1],t[0][0],t[0][1],t[1][0],t[1][1])>c)continue;i=!0,o=Math.max(0,Math.hypot(t[1][0]-t[0][0],t[1][1]-t[0][1])-_)}else{if(Fs(e.x,e.y,n[0],n[1],r[0],r[1])>c)continue;o=Math.hypot(e.x-d,e.y-u)}(!p||i&&!p.exact||i===p.exact&&o0?i:1,o=(e||[]).filter(e=>e&&!e.open&&null!==e.kind&&Number.isFinite(e.half)&&e.half>0&&Array.isArray(e.a)&&Array.isArray(e.b)&&e.a.length>=2&&e.b.length>=2&&[e.a[0],e.a[1],e.b[0],e.b[1]].every(Number.isFinite)&&Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])>n).sort((e,t)=>e.key.localeCompare(t.key)||e.a[0]-t.a[0]||e.a[1]-t.a[1]||e.b[0]-t.b[0]||e.b[1]-t.b[1]||e.half-t.half),s=new Map;for(const e of o){const t=s.get(e.key);t?e.half>t.half&&s.set(e.key,{...t,half:e.half}):s.set(e.key,e)}const a=[...s.values()].flatMap(e=>[{point:[e.a[0],e.a[1]],other:e.b,halfDepth:e.half,kind:e.kind,key:e.key},{point:[e.b[0],e.b[1]],other:e.a,halfDepth:e.half,kind:e.kind,key:e.key}]).sort((e,t)=>e.point[0]-t.point[0]||e.point[1]-t.point[1]||e.other[0]-t.other[0]||e.other[1]-t.other[1]||e.halfDepth-t.halfDepth),l=new Map;for(const e of a){const[t,i]=ws(e.point,n),r=ks(t,i),o=l.get(r)||[];o.push(e),l.set(r,o)}const c=[],h=new Map;for(const e of a){const t=xs(h,e.point,n).filter(t=>Math.hypot(t.point[0]-e.point[0],t.point[1]-e.point[1])<=n).sort((t,i)=>Math.hypot(t.point[0]-e.point[0],t.point[1]-e.point[1])-Math.hypot(i.point[0]-e.point[0],i.point[1]-e.point[1])||t.point[0]-i.point[0]||t.point[1]-i.point[1]);let i=t[0];if(!i){i={point:[...e.point],rays:[]},c.push(i);const[t,r]=ws(i.point,n),o=ks(t,r),s=h.get(o)||[];s.push(i),h.set(o,s)}const r=e.other[0]-e.point[0],o=e.other[1]-e.point[1],s=Math.hypot(r,o);if(!(s>n))continue;const a=[r/s,o/s];let l=Math.atan2(a[1],a[0]);l<0&&(l+=2*Math.PI),i.rays.push({u:a,halfDepth:e.halfDepth,length:s,angle:l})}const d=[],u=e=>{const t=1e-9*Math.max(1,r),i=e.filter(e=>Number.isFinite(e.halfDepth)&&e.halfDepth>0&&Number.isFinite(e.length)&&e.length>n);return i.filter((e,n)=>!i.some((i,r)=>r!==n&&i.halfDepth>=e.halfDepth-t&&i.length>=e.length-t&&(i.halfDepth>e.halfDepth+t||i.length>e.length+t||re.length-t.length||e.halfDepth-t.halfDepth).map(e=>({...e}))};for(const e of c){const t=e.rays.sort((e,t)=>e.angle-t.angle||e.length-t.length||e.halfDepth-t.halfDepth),i=[];for(const e of t){const t=i[i.length-1];t&&Math.abs(e.angle-t.angle)<=1e-9?t.supports.push({halfDepth:e.halfDepth,length:e.length}):i.push({u:[...e.u],angle:e.angle,supports:[{halfDepth:e.halfDepth,length:e.length}]})}if(i.length>1&&2*Math.PI-i[i.length-1].angle+i[0].angle<=1e-9){const e=i.pop();i[0].supports.push(...e.supports)}if(i.length<3)continue;const r=i.map(t=>{const i=u(t.supports),r=new Set,o=[];for(const s of i){const i=[e.point[0]+t.u[0]*s.length,e.point[1]+t.u[1]*s.length];for(const t of xs(l,i,n)){if("shared"!==t.kind||Math.hypot(t.point[0]-i[0],t.point[1]-i[1])>n)continue;const s=t.other[0]-t.point[0],a=t.other[1]-t.point[1],l=Math.hypot(s,a);if(!(l>n))continue;const c=s/l,h=a/l;if(Math.hypot(t.other[0]-e.point[0],t.other[1]-e.point[1])<=n)continue;const d=`${t.key}|${t.point[0]}|${t.point[1]}|${t.other[0]}|${t.other[1]}|${t.halfDepth}`;r.has(d)||(r.add(d),o.push({start:[t.point[0],t.point[1]],u:[c,h],length:l,halfDepth:t.halfDepth}))}}return o.sort((e,t)=>e.start[0]-t.start[0]||e.start[1]-t.start[1]||e.u[0]-t.u[0]||e.u[1]-t.u[1]||e.length-t.length||e.halfDepth-t.halfDepth),{u:[...t.u],halfDepth:Math.max(...i.map(e=>e.halfDepth)),length:Math.max(...i.map(e=>e.length)),supports:i,continuations:o}}).filter(e=>Number.isFinite(e.halfDepth)&&e.halfDepth>0&&Number.isFinite(e.length)&&e.length>n);if(r.length<3)continue;const o=Math.max(...r.map(e=>e.halfDepth));o>0&&Number.isFinite(o)&&d.push({point:[...e.point],rays:r,halfDepth:o,limit:1.25*o})}d.sort((e,t)=>e.point[0]-t.point[0]||e.point[1]-t.point[1]);const p=new Map;for(const e of d){const[t,i]=ws(e.point,n),r=ks(t,i),o=p.get(r)||[];o.push(e),p.set(r,o)}return{epsilon:n,coordinateScale:r,nodes:d,index:p}}function $s(e){const t={fans:[],supports:[]};if(!e?.nodes?.length)return t;const i=Math.max(e.epsilon,1e-9)**2;for(const n of e.nodes){const e=n.rays.filter(e=>Number.isFinite(e.halfDepth)&&e.halfDepth>0).map(e=>({...e,thickLength:Math.max(...e.supports.filter(t=>t.halfDepth>=e.halfDepth-1e-12).map(e=>e.length),0),angle:(()=>{const t=Math.atan2(e.u[1],e.u[0]);return t<0?t+2*Math.PI:t})()})).sort((e,t)=>e.angle-t.angle);if(e.length<2)continue;const r=n.point;for(const i of e)for(const e of i.supports){if(!(e.halfDepth>0&&e.length>0))continue;const n=-i.u[1]*e.halfDepth,o=i.u[0]*e.halfDepth,s=[r[0]+i.u[0]*e.length,r[1]+i.u[1]*e.length];t.supports.push([[r[0]+n,r[1]+o],[s[0]+n,s[1]+o],[s[0]-n,s[1]-o],[r[0]-n,r[1]-o]])}for(let n=0;n{const e=s.angle-o.angle;return e>0?e:e+2*Math.PI})();if(a<1e-9)continue;const l=a>Math.PI+1e-9,c=4*Math.max(o.halfDepth,s.halfDepth),h=[r[0]-o.u[1]*o.halfDepth,r[1]+o.u[0]*o.halfDepth],d=[r[0]+s.u[1]*s.halfDepth,r[1]-s.u[0]*s.halfDepth],u=o.u[0]*s.u[1]-o.u[1]*s.u[0],p=e=>{let t=Math.atan2(e[1]-r[1],e[0]-r[0])-o.angle;for(;t<0;)t+=2*Math.PI;return t<=a+1e-9};let _=null;if(Math.abs(u)>1e-9){const e=((d[0]-h[0])*s.u[1]-(d[1]-h[1])*s.u[0])/u,t=((d[0]-h[0])*o.u[1]-(d[1]-h[1])*o.u[0])/u,i=[h[0]+o.u[0]*e,h[1]+o.u[1]*e];(l?e<=1e-9&&t<=1e-9:e>1e-9&&e<=o.thickLength&&t<=s.thickLength)&&Math.hypot(i[0]-r[0],i[1]-r[1])<=c&&p(i)&&(_=i)}const m=e=>{Math.abs(hs(e))>i&&t.fans.push(e)};if(_){const e=1.5*Math.max(o.halfDepth,s.halfDepth);m(So([r[0],r[1]],h,_,d,e)??[[r[0],r[1]],h,_,d]);continue}if(l){m([[r[0],r[1]],h,d]);continue}const g=(e,t)=>Math.min(t,Math.sqrt(Math.max(c**2-e**2,0)),2*Math.max(o.halfDepth,s.halfDepth)),f=[h[0]+o.u[0]*g(o.halfDepth,o.thickLength),h[1]+o.u[1]*g(o.halfDepth,o.thickLength)],v=[d[0]+s.u[0]*g(s.halfDepth,s.thickLength),d[1]+s.u[1]*g(s.halfDepth,s.thickLength)];m([[r[0],r[1]],h,f,v,d])}}return t}function Ms(e,t){return!e||!Array.isArray(t)||t.length<2||!t.slice(0,2).every(Number.isFinite)?null:xs(e.index,t,e.epsilon).filter(i=>Math.hypot(i.point[0]-t[0],i.point[1]-t[1])<=e.epsilon).sort((e,i)=>Math.hypot(e.point[0]-t[0],e.point[1]-t[1])-Math.hypot(i.point[0]-t[0],i.point[1]-t[1])||e.point[0]-i.point[0]||e.point[1]-i.point[1])[0]||null}function Rs(e,t,i,n,r,o,s){return Ss(Ts(e,t,i,n,r,o,s),4*cs(n,s),s)}function Cs(e,t,i,n,r,o,s,a=1){const l=ys(e,t,n,r,a,i);if(!l)return null;const c=function(e,t,i){const n=(e||[]).find(e=>e?.id===t),r=ni(n);if(!r)return[];const o=[];for(const n of e||[]){if(!n||n.id===t)continue;const e=ni(n);if(e)for(const t of An(r,e,i))o.push(t)}return o}(e,t,cs(r,a)),h=function(e,t,i,n,r){const o=cs(n,r),s=[];for(let a=0;aFs(h,d,e[0],e[1],e[2],e[3])<=o);s.push(u?"shared":"outer")}return s}(l.poly,c,n,r,a),d=bs(i,l,r,a),u=d.map((e,t)=>h[t]&&e>0?Ao(e,o,s)/2:0);return{...l,kinds:h,cms:d,offsets:u}}function Ts(e,t,i,n,r,o,s=1){const a=[];for(const l of e||[]){if(!l?.id)continue;const c=Cs(e,l.id,t,i,n,r,o,s);if(c)for(let e=0;e0&&(a=Zo(a,e.a,e.b,e.cm,n,s));return a}function As(e,t,i,n,r,o,s=1){if(!t?.length)return[];const a=Ts(e,t,i,n,r,o,s),l=new Map;for(const e of a){if(e.open||!e.kind||!e.roomId)continue;const t=l.get(e.key)||new Set;t.add(e.roomId),l.set(e.key,t)}const c=e=>{const t=[...l.get(e)||[]].sort();return 1!==t.length&&2!==t.length?`ambiguous:${e}`:`${1===t.length?"outer":"shared"}:${t.join("|")}`},h=[],d=new Set;for(const e of a)!e.open&&e.cm>0&&!d.has(e.key)&&(d.add(e.key),h.push({...e,ownerSignature:c(e.key)}));const u=[];for(const a of e||[]){if(!a?.id)continue;const l=Cs(e,a.id,t,i,n,r,o,s);if(l)for(let e=0;e0)||null===l.kinds[i]){e++;continue}const o=c(Eo(l.poly[i],l.poly[(i+1)%l.poly.length],n,s));let a=e;for(;a+10&&u.push({a:[d[0],d[1]],b:[p[0],p[1]],key:Eo(d,p,n,s),cm:r,len:_,ownerSignature:o}),e=a+1}}}u.sort((e,t)=>t.len-e.len||e.key.localeCompare(t.key));const p=[],_=new Set,m=new Set,g=4*cs(n,s);for(const e of u){const t=h.filter(t=>!m.has(t.key)&&t.cm===e.cm&&t.ownerSignature===e.ownerSignature&&qo(Bo(t.a,t.b),Bo(e.a,e.b))&&Fs(t.a[0],t.a[1],e.a[0],e.a[1],e.b[0],e.b[1])<=g&&Fs(t.b[0],t.b[1],e.a[0],e.a[1],e.b[0],e.b[1])<=g);if(t.length){for(const e of t)m.add(e.key);_.has(e.key)||(_.add(e.key),p.push(Ho(e.a,e.b,e.cm,n,s)))}}for(const e of h)m.has(e.key)||_.has(e.key)||(_.add(e.key),p.push(Ho(e.a,e.b,e.cm,n,s)));return p}function Ps(e,t,i,n,r,o,s,a=1){const l=cs(r,a),c=(n[0]+n[2])/2,h=(n[1]+n[3])/2,d=Bo([n[0],n[1]],[n[2],n[3]]);let u=null;for(const n of Ts(e,t,i,r,o,s,a)){if(!qo(Bo(n.a,n.b),d))continue;const e=Fs(c,h,n.a[0],n.a[1],n.b[0],n.b[1]);e>4*l||(!u||e[e[0],e[1]]),o=Math.abs(hs(r));r.length>=3&&o>i&&(t=r,i=o)}return t}function Is(e,t,i,n,r,o,s,a=1,l,c){const h=(e||[]).find(e=>e?.id===t),d=ni(h);if(!d||d.length<3)return null;if(!i?.length)return d.map(e=>[e[0],e[1]]);const u=Cs(e,t,i,n,r,o,s,a);if(!u||!u.offsets.some(e=>e>0))return d.map(e=>[e[0],e[1]]);const p=c||Rs(e,i,n,r,o,s,a),_=gs(u.poly,u.offsets,p);if(!_)return d.map(e=>[e[0],e[1]]);if(!p.nodes.length)return _;const m=void 0===l?Zs(e,i,n,[],r,o,s,a):null,g=l??("ok"===m?.status||"degraded-extra"===m?.status?m.roomGeom:void 0);if(g)try{const e=zs(Gt(Os(u.poly),g));if(e)return e}catch{}return function(e,t){try{return zs(Ut(Os(e),Os(t)))}catch{return null}}(_,u.poly)||d.map(e=>[e[0],e[1]])}function Os(e){const t=e.map(e=>[e[0],e[1]]);return t.push([e[0][0],e[0][1]]),[t]}function Es(e){return!(!Array.isArray(e)||!e.length)&&e.every(e=>Array.isArray(e)&&e.length&&e.every(e=>Array.isArray(e)&&e.length>=4&&e.every(e=>Array.isArray(e)&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])))&&Math.abs(Ci(e[0]))>1e-9)}function Ns(e,t,i,n){const r=n?new Set(n):null;let o=null;for(let n=0;nt.epsilon))continue;const l=js([[e.point[0]+a[0]*n.halfDepth,e.point[1]+a[1]*n.halfDepth],[e.point[0]+s.u[0]*r+a[0]*n.halfDepth,e.point[1]+s.u[1]*r+a[1]*n.halfDepth],[e.point[0]+s.u[0]*r-a[0]*n.halfDepth,e.point[1]+s.u[1]*r-a[1]*n.halfDepth],[e.point[0]-a[0]*n.halfDepth,e.point[1]-a[1]*n.halfDepth]],t.coordinateScale);if(!l)continue;const c=Os(l);o=o?Wt(o,c):c}}return o}function Hs(e,t,i){let n=null;for(const r of e.rays)for(const e of r.continuations){const r=[-e.u[1],e.u[0]],o=[e.start[0]+e.u[0]*e.length,e.start[1]+e.u[1]*e.length],s=js([[e.start[0]+r[0]*e.halfDepth,e.start[1]+r[1]*e.halfDepth],[o[0]+r[0]*e.halfDepth,o[1]+r[1]*e.halfDepth],[o[0]-r[0]*e.halfDepth,o[1]-r[1]*e.halfDepth],[e.start[0]-r[0]*e.halfDepth,e.start[1]-r[1]*e.halfDepth]],t.coordinateScale);if(!s)continue;const a=Ut(Os(s),i);Array.isArray(a)&&0!==a.length&&(n=n?Wt(n,a):a)}return n}function Ls(e,t,i=2*(4*e.halfDepth+2*t.epsilon)){const n=function(e,t=$o){const i=new Set,n=Number.isFinite(t)&&t>=0?t:$o;for(let t=0;te-t)}(e);return n.length?Ns(e,t,i,n):null}function Bs(e,t,i,n,r){const o=function(e){let t=null;for(const i of e){const e=Os(i);try{t=t?Wt(t,e):e}catch{}}return t}(function(e,t,i=!1){if(!e)return[];const n=[];for(const r of e.nodes)for(let o=0;o1e-9)||h>=Math.PI-1e-9)continue;const d=[-s.u[1],s.u[0]],u=[-a.u[1],a.u[0]],p=[r.point[0]+d[0]*s.halfDepth,r.point[1]+d[1]*s.halfDepth],_=[r.point[0]-u[0]*a.halfDepth,r.point[1]-u[1]*a.halfDepth],m=ps(p,s.u,_,a.u);if(!m)continue;const g=Math.hypot(m[0]-r.point[0],m[1]-r.point[1]);if(!Number.isFinite(g)||g<=r.limit)continue;const f=t?Math.sqrt(Math.max(0,r.limit*r.limit-s.halfDepth*s.halfDepth)):0,v=t?Math.sqrt(Math.max(0,r.limit*r.limit-a.halfDepth*a.halfDepth)):0,y=js([[p[0]+s.u[0]*f,p[1]+s.u[1]*f],[_[0]+a.u[0]*v,_[1]+a.u[1]*v],m],e.coordinateScale);if(y&&n.push(y),i){const t=m[0]-r.point[0],i=m[1]-r.point[1],o=Math.hypot(t,i),s=g-r.limit;if(o>e.epsilon&&s>e.epsilon){const a=Math.min(Math.max(8*e.epsilon,.05*r.halfDepth),.25*s),l=t/o,c=i/o,h=-c,d=l,u=js([[m[0]-l*a+h*a,m[1]-c*a+d*a],[m[0]-l*a-h*a,m[1]-c*a-d*a],[m[0]+l*a,m[1]+c*a]],e.coordinateScale);u&&n.push(u)}}}return n}({...t,nodes:[e]},i,n));return o&&r?Gt(o,r):o}function qs(e,t,i,n){if(!e||!t.nodes.length)return e;let r=null;try{r=function(e){let t=null;for(const i of e.nodes){const n=Ls(i,e);n&&(t=t?Wt(t,n):n)}return t}(t)}catch{return e}let o=e;for(const e of t.nodes){const s=4*e.halfDepth+2*t.epsilon,a=2*s,l=[[e.point[0]-s,e.point[1]-s],[e.point[0]+s,e.point[1]-s],[e.point[0]+s,e.point[1]+s],[e.point[0]-s,e.point[1]+s]];try{let s=o;const c=Bs(e,t,!1,!0,r);c&&(s=Gt(s,c));let h=Ns(e,t,a);const d=Bs(e,t,!0,!0,r);d&&(h=Gt(h,d)),r&&(h=Wt(h,r));const u=.02*Math.min(...e.rays.map(e=>e.halfDepth));if(h=Wt(h,Os([[e.point[0]-u,e.point[1]-u],[e.point[0]+u,e.point[1]-u],[e.point[0]+u,e.point[1]+u],[e.point[0]-u,e.point[1]+u]])),!h)continue;let p=Ut(h,Os(l));n?p=Ut(p,n):i&&(p=Ut(p,i));const _=Os(l),m=Gt(s,_),g=i?Gt(Ut(s,_),i):null,f=Hs(e,t,_);o=Wt(m,...g?[g]:[],...f?[f]:[],p)}catch{}}if(r)try{let e=r;n?e=Ut(e,n):i&&(e=Ut(e,i)),o=Wt(o,e)}catch{}return o}function js(e,t=1){if(!Array.isArray(e)||e.length<3)return null;const i=Number.isFinite(t)&&t>0?t:1,n=1e-12*Math.max(1,i),r=[];for(const t of e){if(!Array.isArray(t)||t.length<2)return null;const e=Number(t[0]),i=Number(t[1]);if(!Number.isFinite(e)||!Number.isFinite(i))return null;const o=Math.round(e/n)*n,s=Math.round(i/n)*n;if(!Number.isFinite(o)||!Number.isFinite(s))return null;r.push([Object.is(o,-0)?0:o,Object.is(s,-0)?0:s])}return Math.abs(hs(r))>n*n?r:null}function Ws(e,t,i,n){if(Fs(e[0],e[1],t[0],t[1],i[0],i[1])>n)return!1;const r=i[0]-t[0],o=i[1]-t[1],s=(e[0]-t[0])*r+(e[1]-t[1])*o,a=r*r+o*o,l=n*Math.sqrt(a);return s>=-l&&s<=a+l}function Us(e,t,i){const n=[],r=[];for(let o=0;oi*i))continue;const d=i/Math.sqrt(h),u=[0,1];for(const e of t)for(const t of[e.a,e.b]){if(!Ws(t,s,a,i))continue;const e=((t[0]-s[0])*l+(t[1]-s[1])*c)/h;e>d&&e<1-d&&u.push(e)}u.sort((e,t)=>e-t);const p=u.filter((e,t)=>0===t||Math.abs(e-u[t-1])>d);for(let e=0;e=3&&r.length===n.length?{poly:n,offsets:r}:null}function Gs(e,t,i,n,r,o,s,a){const l=(e||[]).map(ni).filter(e=>!!e&&e.length>=3);if(!l.length)return null;let c=Wt(Os(l[0]));for(let e=1;e"outer"===e.kind&&e.half>0),u=4*cs(n,s),p=a||Ss(h,u,s);let _=null;for(const e of function(e){const t=[];for(const i of Array.isArray(e)?e:[])if(Array.isArray(i))for(const e of i){if(!Array.isArray(e)||e.length<4)continue;const i=e.slice(0,-1).map(e=>[e[0],e[1]]);i.length>=3&&t.push(i)}return t}(c)){const t=Us(e,d,u);if(!t||!t.offsets.some(e=>e>0))continue;const i=ia(t.poly,t.offsets,p),n=gs(t.poly,t.offsets,p);if(!i||!n)continue;const r=Gt(Os(i),Os(n));_=_?Wt(_,r):r}return{centre:c,shell:_||[]}}function Vs(e,t,i,n,r,o,s=1){try{const a=Gs(e,t,i,n,r,o,s,Rs(e,t,i,n,r,o,s));if(!a)return[];return a.shell?.length?Wt(a.centre,a.shell):a.centre}catch{return null}}function Ks(e){if(!e)return"";let t="";for(const i of e)if(Array.isArray(i))for(const e of i){if(!Array.isArray(e)||e.length<4)continue;const i=e.slice(0,e.length-1);i.length<3||(t+=(t?" ":"")+fs(i.map(e=>[e[0],e[1]])))}return t}const Ys=15;function Xs(e,t,i){const n=e?.length||0;if(n<3||t?.length!==n)return!1;const r=e[(i-1+n)%n],o=e[i],s=e[(i+1)%n],a=[r[0]-o[0],r[1]-o[1]],l=[s[0]-o[0],s[1]-o[1]],c=Math.hypot(a[0],a[1]),h=Math.hypot(l[0],l[1]);if(!(c>1e-9&&h>1e-9))return!1;const d=Math.max(-1,Math.min(1,(a[0]*l[0]+a[1]*l[1])/(c*h))),u=Math.acos(d);if(!(u>1e-9))return!1;if(u>=Ys*Math.PI/180)return!1;const p=Math.max(0,t[(i-1+n)%n]),_=Math.max(0,t[i]);if(!(p>0||_>0))return!1;const m=Math.sin(u);if(!(m>1e-12))return!1;const g=(_+p*d)/m,f=(p+_*d)/m;return Number.isFinite(g)&&Number.isFinite(f)&&g>0&&f>0&&ge>0))continue;for(const e of l.offsets)e>0&&(u=Math.max(u,2*e));const c=ia(l.poly,l.offsets,d),p=gs(l.poly,l.offsets,d);c&&h.push({outset:c,inset:p})}for(const e of l){const t=e.map(e=>e[0]),i=e.map(e=>e[1]);if(t.length){const n=Math.min(Math.max(...t)-Math.min(...t),Math.max(...i)-Math.min(...i)),r=Math.min(...e.map((t,i)=>{const n=e[(i+1)%e.length];return Math.hypot(n[0]-t[0],n[1]-t[1])}));u=Math.max(u,e.length>16?n:r)}}const p=function(e,t,i,n,r,o,s,a){if(!t?.length||!i?.length)return[];const l=4*cs(n,s),c=new Map;for(const a of Ts(e,t,i,n,r,o,s))!a.open&&a.half>0&&!c.has(a.key)&&c.set(a.key,a);const h=[...c.values()];if(h.length<2)return[];const d=a||Ss(h,l),u=[];for(const e of i)for(const t of[[e[0],e[1]],[e[2],e[3]]])u.some(e=>Math.hypot(e[0]-t[0],e[1]-t[1])<=l)||u.push(t);const p=[],_=(e,t)=>{let i=0,n=0;if(Math.hypot(e.a[0]-t[0],e.a[1]-t[1])<=l)i=e.b[0]-e.a[0],n=e.b[1]-e.a[1];else{if(!(Math.hypot(e.b[0]-t[0],e.b[1]-t[1])<=l))return null;i=e.a[0]-e.b[0],n=e.a[1]-e.b[1]}const r=Math.hypot(i,n);return r>l?[i/r,n/r]:null};for(const e of u){const t=h.map(t=>({iv:t,u:_(t,e)})).filter(e=>!!e.u);for(let i=0;i0?[e.slice(),u,m,_]:[e.slice(),_,m,u];else{if(!f)continue;{const t=[-r.u[1],r.u[0]],i=[-o.u[1],o.u[0]],n=s<0?1:-1,a=[e[0]+t[0]*r.iv.half*n,e[1]+t[1]*r.iv.half*n],l=[e[0]-i[0]*o.iv.half*n,e[1]-i[1]*o.iv.half*n];y=s>0?[e.slice(),a,l]:[e.slice(),l,a]}}Math.abs(hs(y))>l*l&&p.push(y)}}return p}(e,t,i,r,o,s,a,d),_=n.length?na(e,t,i,r,o,s,a):null;let m="exterior";try{const v=Gs(e,t,i,r,o,s,a,d);m="paper";const y=v?v.shell?.length?Wt(v.centre,v.shell):v.centre:[],b=e=>{const t=Os(e.outset);if(!e.inset)return t;const i=Os(e.inset);return Gt(t,i)};m="room-rings";let w=null;for(const e of h)try{const t=b(e);w=w?Wt(w,t):t}catch{}if(m="edge-bodies",v)for(const n of ea(e,t,i,r,o,s,a))try{const e=Ut(Os(n.quad),v.centre);w=w?Wt(w,e):e}catch{}m="junctions",w=function(e,t,i=1,n=Wt){let r=e;for(const e of t||[]){const t=js(e,i);if(t)try{const e=Os(t);r=r?n(r,e):e}catch{}}return r}(w,p,a),m="facade-clip",w&&v&&(w=Ut(w,v.centre)),m="exterior-shell";const k=[];let x=0;if(v?.shell?.length)if(w)try{const e=Wt(w,v.shell);if(!Es(e))throw new Error("invalid shell union");w=e}catch{if(!Es(w)||!Es(v.shell))throw new Error("invalid shell");k.push({id:"exterior-shell",geom:v.shell}),x++}else w=v.shell;if(m="multi-wall-trim",w&&d.nodes.length){const e=e=>e.rays.some(e=>e.supports.some(e=>e.length<2*e.halfDepth)),t=d.nodes.filter(e);if(t.length){w=qs(w,{...d,nodes:t},v?.centre,y)}}if(m="junction-corners",d.nodes.length){const n=$s(d),l=function(e,t,i,n,r,o,s,a){try{const l=Gs(e,t,i,n,r,o,s,{epsilon:a.epsilon,coordinateScale:a.coordinateScale,nodes:[],index:new Map});return l?l.shell?.length?Wt(l.centre,l.shell):l.centre:null}catch{return null}}(e,t,i,r,o,s,a,d);for(const e of n.fans)try{let t=[Os(e)];if(l&&(t=Ut(t,l)),!t?.length)continue;w=w?Wt(w,t):t}catch{}g=w,f=Math.max(d.epsilon,1e-9)**2,w=Array.isArray(g)?g.map(e=>{if(!Array.isArray(e)||!e.length)return e;const[t,...i]=e;return Math.abs(hs(t||[]))<=f?null:[t,...i.filter(e=>Math.abs(hs(e||[]))>f)]}).filter(e=>!!e):g}const S=w||[],$=[...Es(S)?[{id:"room-primary",geom:S}]:[],...k.map((e,t)=>({id:`room-isolated-${t}`,geom:e.geom}))];m="openings";for(const e of n){if(!(e.length>0))continue;const t=sa(_,e,!0);if(!t.negative&&!t.positive)continue;const i=e.angle*Math.PI/180,n=Math.cos(i),o=Math.sin(i),s=-o,l=n,c=e.length/2,h=1.25*Math.max(u,r*a),d=[[e.x-n*c-s*h,e.y-o*c-l*h],[e.x+n*c-s*h,e.y+o*c-l*h],[e.x+n*c+s*h,e.y+o*c+l*h],[e.x-n*c+s*h,e.y-o*c+l*h]];w&&(w=Gt(w,Os(d)));for(const e of k)e.geom=Gt(e.geom,Os(d))}m="extras";const M=[];let R=0;const C=c.mergeExtra||((e,t)=>e?Wt(e,t):t);for(let e=0;ee.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1]))||Math.abs(Ci(t))<=1e-9){R++;continue}const i=[Os(t)];try{const t=C(w,i,e);if(!Es(t))throw new Error("invalid extra union");w=t}catch{R++,Es(i)&&M.push({id:`extra-${e}`,geom:i})}}M.push(...k),M.sort((e,t)=>Ks(e.geom).localeCompare(Ks(t.geom)));const T=w||[];return{status:R||x?"degraded-extra":"ok",geom:T,components:[...Es(T)?[{id:"primary",geom:T}]:[],...M.map((e,t)=>({...e,id:`isolated-${t}`}))],roomGeom:S,roomComponents:$,paperGeom:y,depthUnits:u,openingPadUnits:1.25*Math.max(u,r*a),openingIndex:_,multiWallNodes:d,degradedExtraCount:R+x}}catch{return c.onCoreFailure?.(m),{status:"failed-core",geom:[],components:[],roomGeom:[],paperGeom:[],roomComponents:[],depthUnits:u,openingIndex:null,multiWallNodes:d,degradedExtraCount:0}}var g,f}function Js(e,t,i,n=[],r,o,s,a=1,l=[],c={}){if(!t?.length&&!l.length)return null;return Qs(Zs(e,t,i,n,r,o,s,a,l,c))}function Qs(e){if("failed-core"===e.status||"not-applicable"===e.status)return null;const t=e.components.map(e=>({id:e.id,d:Ks(e.geom),fillRule:"evenodd"})).filter(e=>!!e.d),i=t[0]?.d||"",n=Ks(e.paperGeom);if(t.length){const r={status:e.status,d:i,paths:t,components:e.components,roomGeom:e.roomGeom,multiWallNodes:e.multiWallNodes,paperD:n,depthUnits:e.depthUnits,fillRule:"evenodd"};return Object.defineProperties(r,{roomComponents:{value:e.roomComponents||[],enumerable:!1},openingIndex:{value:e.openingIndex,enumerable:!1},openingPadUnits:{value:e.openingPadUnits,enumerable:!1}}),r}return null}function ea(e,t,i,n,r,o,s=1){if(!t?.length)return[];const a=new Set,l=[];for(const c of e||[]){if(!c?.id)continue;const h=Cs(e,c.id,t,i,n,r,o,s);if(!h)continue;const d=h.poly;for(let e=0;e0))continue;const p=Eo(t,i,n,s);if(a.has(p))continue;a.add(p);const _=Ao(u,r,o),[m,g]=ds(d,e),f=-m,v=-g,y=_/2,b=[[t[0]+f*y,t[1]+v*y],[i[0]+f*y,i[1]+v*y],[i[0]+m*y,i[1]+g*y],[t[0]+m*y,t[1]+g*y]];l.push({key:p,kind:c,cm:u,quad:b,a:[t[0],t[1]],b:[i[0],i[1]],depthUnits:_})}}return l}function ta(e,t=[]){let i=fs(e.quad);const[n,r]=Io(e.a,e.b),o=n,s=r,a=-s,l=o;for(const n of t){if(!Go(e.a,e.b,n.angle))continue;if(Fs(n.x,n.y,e.a[0],e.a[1],e.b[0],e.b[1])>Math.max(.55*e.depthUnits,.001))continue;const t=n.length/2,r=e.depthUnits,c=n.x,h=n.y;i+=` ${fs(vs([[c-o*t-a*r,h-s*t-l*r],[c+o*t-a*r,h+s*t-l*r],[c+o*t+a*r,h+s*t+l*r],[c-o*t+a*r,h-s*t+l*r]]))}`}return i}function ia(e,t,i){const n=e?.length||0;if(n<3||t.length!==n)return null;if(t.every(e=>!(e>0)))return e.map(e=>[e[0],e[1]]);vs(e),t.slice().reverse();const r=[];for(let o=0;o0||l>0)){r.push([e[o][0],e[o][1]]);continue}if(a>0!=l>0){const t=e[o],i=a>0?[t[0]-c*a,t[1]-h*a]:[t[0],t[1]],n=l>0?[t[0]-d*l,t[1]-u*l]:[t[0],t[1]];r.push(i),Math.hypot(n[0]-i[0],n[1]-i[1])>1e-9&&r.push(n);continue}if(us(w,k)){const t=e[o],i=[t[0]-c*a,t[1]-h*a],n=[t[0]-d*l,t[1]-u*l];r.push(i),Math.hypot(n[0]-i[0],n[1]-i[1])>1e-9&&r.push(n);continue}const $=ps(x,w,S,k),M=Math.max(a,l,1e-9),R=Ms(i,e[o])?.limit??4*M;if($){const i=Math.hypot($[0]-e[o][0],$[1]-e[o][1]);if(Number.isFinite(i)&&i<=R){r.push($);continue}if(Xs(e,t,o)){r.push([e[o][0],e[o][1]]);continue}}a>0&&r.push([e[o][0]-c*a,e[o][1]-h*a]),l>0&&r.push([e[o][0]-d*l,e[o][1]-u*l])}return r.length>=3?r:null}function na(e,t,i,n,r,o,s=1){const a=[];for(const l of e||[]){if(!l?.id)continue;const c=Cs(e,l.id,t,i,n,r,o,s);if(!c)continue;const h=Math.abs(Ci(c.poly));for(let e=0;e[Math.max(t,e.x0),Math.min(i,e.x1)]).filter(e=>e[1]-e[0]>n).sort((e,t)=>e[0]-t[0]||e[1]-t[1]);if(!r.length)return{coverage:0,full:!1};let o=r[0][0],s=r[0][1],a=0,l=o<=t+n;for(let e=1;e=i-n,{coverage:a,full:l}}function oa(e,t){return Number(t.full)-Number(e.full)||e.faceDistance-t.faceDistance||e.area-t.area||e.roomId.localeCompare(t.roomId)}function sa(e,t,i=!1){const n=Number(t?.x),r=Number(t?.y),o=Number(t?.angle),s=Number(t?.length);if(!([n,r,o,s].every(Number.isFinite)&&s>0))return{negative:null,positive:null};const a=o*Math.PI/180,l=Math.cos(a),c=Math.sin(a),h=-c,d=l,u=s/2,p=Math.max(1e-9,e.adjacencyEps),_=new Map;let m=0;for(const t of e.edges){if(i&&!(t.half>0))continue;if(!Go(t.a,t.b,o))continue;const[e,s]=Io(t.a,t.b);if(Math.abs((n-t.a[0])*s-(r-t.a[1])*e)>p)continue;const a=(t.a[0]-n)*l+(t.a[1]-r)*c,g=(t.b[0]-n)*l+(t.b[1]-r)*c,f=Math.max(-u,Math.min(a,g)),v=Math.min(u,Math.max(a,g));if(v-f<=p)continue;const y=t.inward[0]*h+t.inward[1]*d>=0?1:-1,b=((t.a[0]+t.b[0])/2-n)*h+((t.a[1]+t.b[1])/2-r)*d,w=Math.abs(b+y*t.half),k=`${y}|${t.roomId}`,x={x0:f,x1:v,half:t.half,cm:t.cm,key:t.key,axis:[e,s]},S=_.get(k);S?(S.pieces.push(x),S.faceDistance=Math.min(S.faceDistance,w)):_.set(k,{roomId:t.roomId,side:y,order:m++,pieces:[x],faceDistance:w,area:t.area,coverage:0,full:!1})}for(const e of _.values()){const t=ra(e.pieces,-u,u,p);e.coverage=t.coverage,e.full=t.full}const g=e=>{const t=[..._.values()].filter(t=>t.side===e&&t.coverage>p);return t.sort(oa),t[0]||null};return{negative:g(-1),positive:g(1)}}function aa(e,t,i,n,r,o,s=1,a=[]){return la(na(e,i,a,n,r,o,s),t)}function la(e,t){const i=sa(e,t),n=[i.negative,i.positive].filter(e=>!!e);if(!n.length)return{ox:0,oy:0,cm:0,side:-1};const r=i.negative&&i.positive?-1:n[0].side,o=t.flip_v?-r:r,s=(-1===o?i.negative:i.positive)||n[0],a=[...s.pieces].sort((e,t)=>(e.x0<=0&&e.x1>=0?0:Math.min(Math.abs(e.x0),Math.abs(e.x1)))-(t.x0<=0&&t.x1>=0?0:Math.min(Math.abs(t.x0),Math.abs(t.x1)))||t.x1-t.x0-(e.x1-e.x0)||e.key.localeCompare(t.key))[0];if(!(a.half>0&&a.cm>0))return{ox:0,oy:0,cm:0,side:o};const l=t.angle*Math.PI/180,c=-Math.sin(l),h=Math.cos(l);return{ox:c*o*a.half,oy:h*o*a.half,cm:a.cm,side:o}}function ca(e,t){const i=1e-9,n=t.filter(e=>Number.isFinite(e.x0)&&Number.isFinite(e.x1)&&Number.isFinite(e.half)&&e.x1>e.x0&&e.half>0);if(!n.length)return"";const r=n.flatMap(e=>[e.x0,e.x1]).sort((e,t)=>e-t),o=[];for(const e of r){const t=o[o.length-1];(void 0===t||e>t+i)&&o.push(e)}const s=[];for(let e=0;e+1t+i))continue;const a=(t+r)/2,l=n.reduce((e,t)=>a>=t.x0-i&&a<=t.x1+i?Math.max(e,t.half):e,0);if(!(l>0))continue;const c=s[s.length-1];c&&t<=c.x1+i&&Math.abs(l-c.half)<=i?c.x1=r:s.push({x0:t,x1:r,half:l})}const a=[];for(const e of s){const t=a[a.length-1],n=t?.[t.length-1];n&&e.x0<=n.x1+i?(e.x0=n.x1,t.push(e)):a.push([e])}return a.map(t=>{const i=t[0],n=t[t.length-1],r=Math.min(.25*Math.min(...t.map(e=>e.half)),.75),o=-e*r,s=[];if(1===e){s.push(`M ${i.x0} ${o} L ${n.x1} ${o}`);for(let e=t.length-1;e>=0;e--){const i=t[e];s.push(`L ${i.x1} ${i.half} L ${i.x0} ${i.half}`)}}else{s.push(`M ${n.x1} ${o} L ${i.x0} ${o}`);for(const e of t)s.push(`L ${e.x0} ${-e.half} L ${e.x1} ${-e.half}`)}return s.push("Z"),s.join(" ")}).join(" ")}function ha(e,t,i,n){if(!n)return i;const r=e.angle*Math.PI/180,o=Math.cos(r),s=Math.sin(r),a=[],l=1e-9;for(const r of i){const[i,c]=r.axis,h=o*i+s*c;if(Math.abs(h)<=l)continue;const d=e.x*i+e.y*c,u=d+h*r.x0,p=d+h*r.x1,_=Math.min(u,p),m=Math.max(u,p),g=`${r.key}|${t}`,f=n.get(g)||[];let v=[[_,m]];for(const[e,t]of f){const i=[];for(const[n,r]of v)t<=n+l||e>=r-l?i.push([n,r]):(e>n+l&&i.push([n,Math.min(r,e)]),te[0]-t[0]||e[1]-t[1]),b=[];for(const e of y){const t=b[b.length-1];t&&e[0]<=t[1]+l?t[1]=Math.max(t[1],e[1]):b.push([e[0],e[1]])}n.set(g,b)}return a}function da(e,t){const i=new Map;return t.map(t=>function(e,t,i){const n=sa(e,t,!0),r=n.negative,o=n.positive;if(!r&&!o)return null;let s;if(r&&o)s=[{candidate:r,side:-1},{candidate:o,side:1}];else{const e=r||o;s=[{candidate:e,side:-1},{candidate:e,side:1}]}const a=s.map(({candidate:e,side:n})=>({candidate:e,side:n,pieces:ha(t,n,e.pieces,i)})),l=a.map(({candidate:e,side:t,pieces:i})=>({side:t,roomId:e.roomId,d:ca(t,i)})),c=a.flatMap(({pieces:e})=>e);if(!c.length)return null;const h=Math.max(...c.map(e=>e.half));return{faces:l,minY:-h,maxY:h,wallKey:[...new Set(c.map(e=>e.key))].sort().join("|")}}(e,t,i))}const ua=150,pa=1e-6;function _a(e){return Number.isFinite(e)?Math.max(1,Math.min(ua,e)):1}function ma(e){return((Number.isFinite(Number(e))?Number(e):0)%90+90)%90}const ga=e=>{const t=e.map(e=>[e[0],e[1]]);return!t.length||t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]||t.push([...t[0]]),[t]},fa=(e,t)=>e[0]===t[0]&&e[1]===t[1];function va(e,t=1e-6){const i=Number.isFinite(t)&&t>0?t:pa,n=[];for(const t of e||[]){if(!Array.isArray(t)||t.length<2)return null;const e=Number(t[0]),r=Number(t[1]);if(!Number.isFinite(e)||!Number.isFinite(r))return null;const o=Math.round(e/i)*i,s=Math.round(r/i)*i;if(!Number.isFinite(o)||!Number.isFinite(s))return null;const a=[Object.is(o,-0)?0:o,Object.is(s,-0)?0:s];n.length&&fa(n[n.length-1],a)||n.push(a)}return n.length>1&&fa(n[0],n[n.length-1])&&n.pop(),n.length<3||new Set(n.map(e=>`${e[0]},${e[1]}`)).size<3?null:Ci(n)>i*i?n:null}function ya(e){const t=[];for(const i of e||[])for(const e of i||[]){const i=(e||[]).filter(e=>Array.isArray(e)&&e.length>=2);i.length<4||t.push(`M ${i.slice(0,-1).map(e=>`${e[0]} ${e[1]}`).join(" L ")} Z`)}return t.join(" ")}function ba(e,t,i,n,r){return es({a:e,b:t,halfDepth:Ao(i,n,r)/2})}function wa(e,t,i){const n=Number(t)>0?Number(t):5,r=_a(e.cm)/n*i,o=e.center[0],s=e.center[1];if("circle"===e.shape){const e=r/2;return Array.from({length:96},(t,i)=>{const n=i/96*Math.PI*2;return[o+Math.cos(n)*e,s+Math.sin(n)*e]})}const a=r/2,l=ma(e.angle)*Math.PI/180,c=Math.cos(l),h=Math.sin(l);return[[-a,-a],[a,-a],[a,a],[-a,a]].map(([e,t])=>[o+e*c-t*h,s+e*h+t*c])}function ka(e,t){const i=Number.isFinite(t)?Math.max(0,Math.min(1,t)):0,n=(e.a[0]+e.b[0])/2,r=(e.a[1]+e.b[1])/2,o=(e.b[0]-e.a[0])*i/2,s=(e.b[1]-e.a[1])*i/2;return{...e,a:[n-o,r-s],b:[n+o,r+s]}}function xa(e,t,i=1e-9){if(!t.length)return[e];let n=[ga(e)];try{for(const e of t){const t=e.b[0]-e.a[0],r=e.b[1]-e.a[1],o=Math.hypot(t,r);if(!(o>i))continue;const s=t/o,a=r/o,l=-a,c=s,h=1.25*Math.max(Number(e.depth)||0,4*i),d=Math.max(2*i,1e-9*o),u=[[e.a[0]-s*d-l*h,e.a[1]-a*d-c*h],[e.b[0]+s*d-l*h,e.b[1]+a*d-c*h],[e.b[0]+s*d+l*h,e.b[1]+a*d+c*h],[e.a[0]-s*d+l*h,e.a[1]-a*d+c*h]];n=Gt(n,ga(u))}return Fa(n)}catch{return[e]}}function Sa(e,t){try{const i=Gt([[...e.map(e=>[e[0],e[1]]),[e[0][0],e[0][1]]]],[[...t.map(e=>[e[0],e[1]]),[t[0][0],t[0][1]]]]);let n=null,r=0;for(const e of i||[]){const t=e?.[0]||[],i=Math.abs(Ci(t));t.length>=4&&i>r&&(r=i,n=t.slice(0,-1).map(e=>[e[0],e[1]]))}return n}catch{return null}}function $a(e,t,i,n=Math.max(2e-4*i,1e-9),r=[]){const o=[],s=new Map;for(const e of r){const t=s.get(e.hostId)||[];t.push(e),s.set(e.hostId,t)}const a=[],l=[],c=[];for(const n of e.partitions||[]){const e={a:n.a,b:n.b,halfDepth:Ao(n.cm,t,i)/2};if(!(e.halfDepth>0))continue;const r=es(e);r&&(o.push(e),a.push(r),c.push({id:n.id,body:r}))}const h=o;for(const{segmentIndex:e,wedge:t}of os(h,n)){const i={list:a,at:e},n=Sa(i.list[i.at],t);n&&(i.list[i.at]=n,c[i.at].body=n)}for(const e of c)l.push(...xa(e.body,s.get(e.id)||[],n));const d=(e.wall_columns||[]).map(e=>wa(e,t,i)),u=ss(o,n).flatMap(e=>xa(e,r,n));return{partitions:a,columns:d,patches:u,all:[...l,...u,...d]}}function Ma(e){try{const t=e.map(e=>va(e)).filter(e=>!!e).map(e=>ga(e));return t.length?Wt(t[0],...t.slice(1)):null}catch{return null}}const Ra=e=>`M ${e.map(e=>`${e[0]} ${e[1]}`).join(" L ")} Z`;function Ca(e){const t=[];for(const i of e||[]){if(Aa([i])<=1e-6)continue;const e=[];for(const t of i||[]){const i=(t||[]).filter(e=>Array.isArray(e)&&e.length>=2);i.length<4||e.push(Ra(i.slice(0,-1)))}e.length&&t.push(e.join(" "))}return t}function Ta(e,t,i={}){const n=Ma(e.filter(e=>e.length>=3)),r=t.some(e=>!va(e))?null:Ma(t);if(!n)return[];if(r)try{return Ca(Ut(n,r))}catch{}return function(e,t,i){let n=null;for(let r=0;r=4&&t.push(e.slice(0,-1).map(e=>[e[0],e[1]]));return t}function Fa(e){const t=[];for(const i of e||[]){const e=i?.[0];e?.length>=4&&t.push(e.slice(0,-1).map(e=>[e[0],e[1]]))}return t}function za(e,t){let i=!1;for(let n=0,r=t.length-1;ne[1]!=l>e[1]&&e[0]<(a-o)*(e[1]-s)/(l-s||1e-12)+o&&(i=!i)}return i}function Ia(e,t){for(const i of t||[]){const t=i?.[0];if(!t?.length||!za(e,t))continue;let n=!1;for(let t=1;ti)return!1;if(Math.abs(_a(e.cm)-_a(t.cm))>1e-6)return!1;if(e.shape!==t.shape)return!0;if("circle"===e.shape||"circle"===t.shape)return!0;const n=Math.abs(ma(e.angle)-ma(t.angle));return Math.min(n,90-n)<=1e-6}const Ea=2.54;function Na(e){const t="number"==typeof e?e:NaN;return!Number.isFinite(t)||t<=0||5===t?1:5/t}function Ha(e,t){return e*Na(t)}function La(e){return e?Ea:1}function Ba(e,t){if(!t)return String(e);const i=e/Ea;return String(Math.round(1e6*i)/1e6)}function qa(e,t){return t?e*Ea:e}const ja=1e3;function Wa(e,t){const i=Number(e),n=Number.isFinite(i)&&i>0?i:1,r=n>=1?t:t*n,o=n>=1?t/n:t;return{x:(t-r)/2,y:(t-o)/2,w:r,h:o}}const Ua=.01,Ga=100;function Va(e,t=1e3){const i=Wa(e?.plan_aspect,t),n=Number(e?.plan_scale),r=Number.isFinite(n)&&n>0?Math.min(Ga,Math.max(Ua,n)):1,o=Number(e?.plan_scale_x),s=Number(e?.plan_scale_y),a=Number.isFinite(o)&&o>0?Math.min(Ga,Math.max(Ua,o)):r,l=Number.isFinite(s)&&s>0?Math.min(Ga,Math.max(Ua,s)):r,c=Number(e?.plan_x),h=Number(e?.plan_y),d=$r(e?.plan_angle);return{x:i.x+(Number.isFinite(c)?rl(c):0)*t,y:i.y+(Number.isFinite(h)?rl(h):0)*t,w:i.w*a,h:i.h*l,...d?{angle:d}:{}}}function Ka(e){if(null==e.x||null==e.y)return{x:e.x,y:e.y,w:e.w,h:e.h};const t=Number(e.w)||0,i=Number(e.h)||0;return{x:t<0?e.x+t:e.x,y:i<0?e.y+i:e.y,w:Math.abs(t),h:Math.abs(i)}}function Ya(e){return e&&Array.isArray(e.spaces)?e.spaces.map(e=>{const t=ja,i=function(e){return Array.isArray(e)&&4===e.length&&e.every(e=>Number.isFinite(e))&&e[2]>1e-6&&e[3]>1e-6?e:[0,0,1,1]}(e.view_box);return{id:e.id,title:e.title,cellCm:Number.isFinite(Number(e.cell_cm))&&Number(e.cell_cm)>0?Number(e.cell_cm):5,vb:[i[0]*ja,i[1]*t,i[2]*ja,i[3]*t],bg:e.plan_url?{href:En(e.plan_url),...Va(e,ja)}:null,rooms:(e.rooms||[]).map(e=>{const i={...e,...Ka(e)};return{id:i.id,name:i.name,area:i.area??null,open_to:i.open_to||void 0,settings:i.settings||void 0,x:null!=i.x?i.x*ja:void 0,y:null!=i.y?i.y*t:void 0,w:null!=i.w?i.w*ja:void 0,h:null!=i.h?i.h*t:void 0,poly:i.poly?i.poly.map(e=>[e[0]*ja,e[1]*t]):void 0,wall_ids:Array.isArray(i.wall_ids)?[...i.wall_ids]:void 0}}),wall_segments:(e.wall_segments||[]).map(e=>({...e,id:String(e.id),a:[Number(e.a?.[0])*ja,Number(e.a?.[1])*t],b:[Number(e.b?.[0])*ja,Number(e.b?.[1])*t],cm:Number(e.cm)})),partitions:(e.partitions||[]).map(e=>({id:e.id,a:[e.a[0]*ja,e.a[1]*t],b:[e.b[0]*ja,e.b[1]*t],cm:Number(e.cm)})),wall_columns:(e.wall_columns||[]).map(e=>({id:e.id,shape:"circle"===e.shape?"circle":"square",center:[e.center[0]*ja,e.center[1]*t],cm:Number(e.cm),..."circle"===e.shape?{}:{angle:ma(e.angle)}}))}}):[]}const Xa=5e3,Za=Xa*ja,Ja=240,Qa=ja/Ja,el=1/Ja;function tl(e){if(!Number.isFinite(e))return e;const t=Math.round(e*Ja/ja)*ja/Ja;return Math.abs(t-e)<=1e-9*Qa?e:t}function il(e){return{x:tl(e.x),y:tl(e.y)}}function nl(e){return Number.isFinite(e)?Math.min(Za,Math.max(-Za,e)):0}function rl(e){return Number.isFinite(e)?Math.min(Xa,Math.max(-Xa,e)):0}const ol=1/3,sl=200;function al(e){return"house"===e?"house":"content"}function ll(e){let t=1/0,i=1/0,n=-1/0,r=-1/0;for(const o of e){const e=Number(o[0]),s=Number(o[1]);Number.isFinite(e)&&Number.isFinite(s)&&(en&&(n=e),s>r&&(r=s))}return t>n?null:{minX:t,minY:i,maxX:n,maxY:r}}function cl(e){const t=[],i=e=>{if(Array.isArray(e))if(e.length>=2&&Number.isFinite(Number(e[0]))&&Number.isFinite(Number(e[1])))t.push([Number(e[0]),Number(e[1])]);else for(const t of e)i(t)};return i(e),ll(t)}function hl(e,t){const i=Number.isFinite(t)&&t>0?t:0;return{minX:e.minX-i,minY:e.minY-i,maxX:e.maxX+i,maxY:e.maxY+i}}function dl(e){return e.poly&&e.poly.length?ll(e.poly):null==e.x||null==e.y?null:ll([[e.x,e.y],[e.x+(e.w||0),e.y+(e.h||0)]])}function ul(e,t=1e3,i=1e3){const n=Number(e.x)*t,r=Number(e.y)*i,o=Number(e.w)*t,s=Number(e.h)*i;return![n,r,o,s].every(Number.isFinite)||o<=0||s<=0?null:ll(Fr({x:n,y:r,w:o,h:s,angle:$r(e.angle)||void 0}))}function pl(e,t){const i=[];for(const t of e.rooms||[]){const e=dl(t);e&&i.push(e)}if(e.bg){const t=ll(Fr(e.bg));t&&i.push(t)}for(const e of t||[])if(Array.isArray(e)){const t=ll([e]);t&&i.push(t)}else i.push(e);return i}const _l=e=>{if(!e.length)return 0;const t=[...e].sort((e,t)=>e-t),i=t.length>>1;return t.length%2?t[i]:(t[i-1]+t[i])/2},ml=e=>{let t=1/0,i=1/0,n=-1/0,r=-1/0;for(const o of e)o.minXn&&(n=o.maxX),o.maxY>r&&(r=o.maxY);return t>n||i>r?null:{x:t,y:i,w:n-t,h:r-i}};function gl(e,t){let{x:i,y:n,w:r,h:o}=e;r<30&&(i=i+r/2-100,r=sl),o<30&&(n=n+o/2-100,o=sl);const s="number"==typeof t?{top:t,right:t,bottom:t,left:t}:t,a=Math.max(r,o),l=a*s.top,c=a*s.right,h=a*s.bottom,d=a*s.left;return{x:i-d,y:n-l,w:r+d+c,h:o+l+h}}function fl(e,t={}){const i=t.pad??.05,n=t.k??10,r=t.minSpread??50,o=e.filter(e=>Number.isFinite(e.minX)&&Number.isFinite(e.minY)&&Number.isFinite(e.maxX)&&Number.isFinite(e.maxY)&&Math.abs(e.minX)<=Za&&Math.abs(e.maxX)<=Za&&Math.abs(e.minY)<=Za&&Math.abs(e.maxY)<=Za);if(!o.length)return{core:null,all:null,outliers:0};const s=ml(o);if(o.length<4){const e=gl(s,i);return{core:e,all:e,outliers:0}}const a=o.map(e=>(e.minX+e.maxX)/2),l=o.map(e=>(e.minY+e.maxY)/2),c=_l(a),h=_l(l),d=o.map((e,t)=>Math.max(Math.abs(a[t]-c),Math.abs(l[t]-h))),u=Math.max(((e,t)=>e.length?e[Math.min(e.length-1,Math.max(0,Math.round(t*(e.length-1))))]:0)([...d].sort((e,t)=>e-t),.75),r),p=d.map(e=>e>n*u),_=p.filter(Boolean).length,m=_&&_<=o.length*ol?o.filter((e,t)=>!p[t]):o;return{core:gl(ml(m)||s,i),all:gl(s,i),outliers:m===o?0:_}}function vl(e){return fl(e,{pad:0}).all}function yl(e,t,i=.05){const n=fl(pl(e,t),{pad:i});if(n.core)return n.core;const r=e.vb&&4===e.vb.length&&e.vb[2]>0&&e.vb[3]>0?e.vb:[0,0,ja,ja];return{x:r[0],y:r[1],w:r[2],h:r[3]}}function bl(e){const t=yl(e);return{x:t.x+t.w/2,y:t.y+t.h/2}}function wl(e){const t=[];for(const i of e.rooms||[]){const e=dl(i);e&&t.push(e)}const i=fl(t,{pad:0}).core,n=ja*Na(e.cellCm??5);return i?Math.max(n,Math.min(Za,Math.max(i.w,i.h))):n}function kl(e,t,i,n=1){const r=Number(i),o=Number.isFinite(n)&&n>0?n:1;return!Number.isFinite(r)||r<=0?e*o:e*wl(t)*o/r}const xl=[1,2,5,10,20,50,100,200,500,1e3];function Sl(e,t,i=7){if(!(e>0&&t>0&&Number.isFinite(t)))return null;const n=xl.find(n=>e*n*t>=i);if(void 0===n)return null;const r=xl.find(e=>e>=5*n)??5*n;return{fine:n,coarse:r}}function $l(e){if(e.poly&&e.poly.length){const t=e.poly.map(e=>e[0]),i=e.poly.map(e=>e[1]),n=Math.min(...t),r=Math.min(...i);return{x:n,y:r,w:Math.max(...t)-n,h:Math.max(...i)-r}}return{x:e.x??0,y:e.y??0,w:e.w??0,h:e.h??0}}function Ml(e,t,i,n,r,o=new Set){const s=t[e.id];return!o.has(e.id)&&s&&s.s===e.space?{x:s.x*ja,y:s.y*ja}:n[e.id]?n[e.id]:il(bl(r))}function Rl(e,t,i,n){const r=i["rl_"+(e.id||"")];if(r&&r.s===t)return{x:r.x*ja,y:r.y*ja};const o=function(e){if(e.poly){const t=e.poly.length;return[e.poly.reduce((e,t)=>e+t[0],0)/t,e.poly.reduce((e,t)=>e+t[1],0)/t]}return[e.x+e.w/2,e.y+.1*Math.min(e.w,e.h)]}(e);return il({x:o[0],y:o[1]})}function Cl(e,t){for(const i of e?.spaces??[])for(const e of i?.decor??[])if("furniture"===e?.kind&&"string"==typeof e.symbol&&t(e.symbol))return!0;return!1}let Tl=0;const Dl=new Set;const Al=new class{constructor(e){this.options=e,this._art=null,this._failed=!1,this._terminal=!1,this._inFlight=null,this._hosts=new Set,this._settled=[]}state(){return this._art?"ready":this._failed?"fallback":"pending"}get terminal(){return this._terminal}art(e,t){if(this._art)return this._art[e];t&&!this._failed&&this._hosts.add(t)}adopt(e,t){return!!this._art||(t!==this.options.expectedFingerprint?((this.options.warn??console.warn)("[houseplan] furniture artwork from another build ignored",{fingerprint:t}),!1):(this._install(e),!0))}ensure(){return"pending"!==this.state()?Promise.resolve():(this._inFlight||(this._inFlight=this._loadWithRetry().finally(()=>{this._inFlight=null})),this._inFlight)}onSettled(e){"pending"===this.state()?this._settled.push(e):Promise.resolve().then(e)}async _loadWithRetry(){let e=new Error("furniture artwork did not load");for(const t of[0,1])try{const i=await this.options.load(t);if(i.FURNITURE_ART_FINGERPRINT!==this.options.expectedFingerprint){this._terminal=!0,e=new Error(`furniture artwork fingerprint mismatch: expected ${this.options.expectedFingerprint}, got ${i.FURNITURE_ART_FINGERPRINT}`);break}if(this._art)return;return void this._install(i.GENERATED_FURNITURE_ART)}catch(t){e=t}this._art||(this._failed=!0,(this.options.warn??console.warn)("[houseplan] furniture artwork unavailable",e),this.options.loadFailed?.(this._terminal),this._flush())}_install(e){this._art=e,this._failed=!1,this._flush()}_flush(){const e=[...this._hosts];this._hosts.clear();for(const t of e)t.isConnected&&t.requestUpdate();const t=this._settled.splice(0);for(const e of t)e()}}({expectedFingerprint:"012abf4b3924ad03971870eb8085ab1ac1a66b0d9b6676fe095285a8b0f201ab",load:async e=>0===e?await import("./furniture-plan-art.generated-C_WDX48s.js"):await import((()=>{const e=new URL("./furniture-plan-art.generated-C_WDX48s.js",import.meta.url);return e.searchParams.set("hp_retry","art-"+ ++Tl),e.href})()),loadFailed:e=>{for(const t of Dl)t(e)}}),Pl=["furniture","appliance","sanitary","other"],Fl=[{id:"sofa",group:"furniture",category:"sofa",w:220,h:90,g:[["r",0,0,1,1],["l",.09,.26,.91,.26],["l",.09,.26,.09,1],["l",.91,.26,.91,1],["l",.5,.26,.5,1]]},{id:"armchair",group:"furniture",category:"armchair",w:90,h:85,g:[["r",0,0,1,1],["l",.14,.28,.86,.28],["l",.14,.28,.14,1],["l",.86,.28,.86,1]]},{id:"coffee_table",group:"furniture",category:"coffee_table",w:110,h:60,g:[["r",0,0,1,1],["r",.08,.14,.84,.72]]},{id:"table_dining",group:"furniture",category:"dining_table",w:140,h:80,g:[["r",0,0,1,1],["r",.06,.11,.88,.78]]},{id:"table_round",group:"furniture",category:"dining_table",w:120,h:120,g:[["e",.5,.5,.5,.5],["e",.5,.5,.41,.41]]},{id:"chair",group:"furniture",category:"chair",w:45,h:45,g:[["r",0,0,1,.18],["r",.06,.18,.88,.8]]},{id:"desk",group:"furniture",category:"work_table",w:120,h:60,g:[["r",0,0,1,1],["r",.63,.07,.31,.86],["l",.63,.5,.94,.5]]},{id:"bed_double",group:"furniture",category:"bed",w:160,h:200,g:[["r",0,0,1,1],["r",0,0,1,.07],["r",.06,.1,.4,.15],["r",.54,.1,.4,.15],["l",0,.33,1,.33]]},{id:"bed_single",group:"furniture",category:"bed",w:90,h:200,g:[["r",0,0,1,1],["r",0,0,1,.07],["r",.15,.1,.7,.15],["l",0,.33,1,.33]]},{id:"nightstand",group:"furniture",category:"nightstand",w:45,h:40,g:[["r",0,0,1,1],["r",.12,.14,.76,.33],["r",.12,.53,.76,.33]]},{id:"wardrobe",group:"furniture",category:"wardrobe",w:100,h:60,g:[["r",0,0,1,1],["l",0,.72,1,.72],["l",.5,.72,.5,1]]},{id:"bookshelf",group:"furniture",category:"wardrobe",w:80,h:30,g:[["r",0,0,1,1],["l",.34,0,.34,1],["l",.67,0,.67,1]]},{id:"fridge",group:"appliance",category:"fridge",w:60,h:65,g:[["r",0,0,1,1],["l",0,.36,1,.36],["l",.83,.44,.83,.64]]},{id:"stove",group:"appliance",category:"cooktop",w:60,h:60,g:[["r",0,0,1,1],["e",.29,.31,.15,.15],["e",.71,.31,.15,.15],["e",.29,.71,.15,.15],["e",.71,.71,.15,.15]]},{id:"dishwasher",group:"appliance",category:"dishwasher",w:60,h:60,g:[["r",0,0,1,1],["r",.1,.12,.8,.76],["e",.5,.5,.27,.27],["e",.5,.5,.13,.13]]},{id:"washer",group:"appliance",category:"washer",w:60,h:60,g:[["r",0,0,1,1],["l",.08,.17,.92,.17],["e",.5,.57,.3,.3],["e",.5,.57,.14,.14]]},{id:"dryer",group:"appliance",category:"dryer",w:60,h:60,g:[["r",0,0,1,1],["l",.08,.17,.92,.17],["e",.5,.57,.3,.3],["p",.36,.5,.5,.64,.64,.5]]},{id:"tv",group:"appliance",category:"tv",w:120,h:30,g:[["r",0,0,1,.42],["l",.5,.42,.5,.72],["l",.3,.72,.7,.72]]},{id:"ac",group:"appliance",category:"air_conditioner",w:90,h:25,g:[["r",0,0,1,1],["l",.05,.55,.95,.55],["l",.05,.79,.95,.79]]},{id:"water_heater",group:"appliance",category:"boiler",w:45,h:45,g:[["e",.5,.5,.5,.5],["e",.5,.5,.31,.31]]},{id:"toilet",group:"sanitary",category:"toilet",w:40,h:70,g:[["r",.06,0,.88,.2],["e",.5,.58,.37,.35],["e",.5,.58,.22,.2]]},{id:"bathtub",group:"sanitary",category:"bathtub",w:170,h:75,g:[["r",0,0,1,1],["r",.05,.11,.77,.78],["e",.89,.5,.045,.1]]},{id:"shower",group:"sanitary",category:"shower",w:90,h:90,g:[["r",0,0,1,1],["l",0,0,1,1],["l",1,0,0,1],["e",.5,.5,.08,.08]]},{id:"sink",group:"sanitary",category:"sink",w:60,h:45,g:[["r",0,0,1,1],["e",.5,.6,.34,.3],["e",.5,.15,.07,.07]]},{id:"kitchen_sink",group:"sanitary",category:"kitchen_sink",w:80,h:60,g:[["r",0,0,1,1],["r",.06,.24,.44,.64],["r",.54,.24,.4,.64],["e",.5,.12,.06,.06]]},{id:"bidet",group:"sanitary",category:"bidet",w:40,h:55,g:[["e",.5,.5,.44,.5],["e",.5,.5,.26,.3]]},{id:"stairs",group:"other",category:"stairs",w:100,h:280,g:[["r",0,0,1,1],["l",0,.111,1,.111],["l",0,.222,1,.222],["l",0,.333,1,.333],["l",0,.444,1,.444],["l",0,.556,1,.556],["l",0,.667,1,.667],["l",0,.778,1,.778],["l",0,.889,1,.889],["l",.5,.93,.5,.06],["p",.38,.16,.5,.06,.62,.16]]},{id:"fireplace",group:"other",category:"fireplace",w:120,h:40,g:[["r",0,0,1,1],["p",.22,1,.22,.42,.78,.42,.78,1]]},{id:"plant",group:"other",category:"plant",w:40,h:40,g:[["e",.5,.5,.22,.22],["l",.5,.28,.5,.02],["l",.5,.72,.5,.98],["l",.28,.5,.02,.5],["l",.72,.5,.98,.5],["l",.34,.34,.13,.13],["l",.66,.66,.87,.87],["l",.66,.34,.87,.13],["l",.34,.66,.13,.87]]},{id:"rug",group:"other",category:"rug",w:200,h:140,g:[["r",0,0,1,1],["r",.06,.09,.88,.82]]}],zl=new Set(["fridge","dishwasher","washer","dryer","ac","water_heater","shower","sink","stairs","fireplace","plant","rug"]),Il=[...[{id:"coffee_table",group:"furniture",category:"coffee_table",w:120,h:60},{id:"coffee_table_round",group:"furniture",category:"coffee_table",w:80,h:80},{id:"coffee_table_oval",group:"furniture",category:"coffee_table",w:120,h:60},{id:"coffee_table_rounded",group:"furniture",category:"coffee_table",w:120,h:60},{id:"table_dining",group:"furniture",category:"dining_table",w:160,h:90},{id:"table_round",group:"furniture",category:"dining_table",w:110,h:110},{id:"table_dining_oval",group:"furniture",category:"dining_table",w:180,h:100},{id:"table_dining_rounded",group:"furniture",category:"dining_table",w:160,h:90},{id:"desk",group:"furniture",category:"work_table",w:140,h:70},{id:"desk_corner",group:"furniture",category:"work_table",w:160,h:160},{id:"chair",group:"furniture",category:"chair",w:50,h:50},{id:"chair_bar",group:"furniture",category:"chair",w:45,h:48},{id:"armchair",group:"furniture",category:"armchair",w:90,h:90},{id:"armchair_office",group:"furniture",category:"armchair",w:65,h:65},{id:"sofa",group:"furniture",category:"sofa",w:180,h:90},{id:"sofa_three_seat",group:"furniture",category:"sofa",w:240,h:90},{id:"sofa_corner_right",group:"furniture",category:"sofa",w:260,h:170},{id:"bed_single",group:"furniture",category:"bed",w:90,h:200},{id:"bed_double",group:"furniture",category:"bed",w:160,h:200},{id:"nightstand",group:"furniture",category:"nightstand",w:50,h:40},{id:"cabinet_tv",group:"furniture",category:"nightstand",w:140,h:45},{id:"cabinet_shoe",group:"furniture",category:"nightstand",w:80,h:35},{id:"cabinet_sink",group:"furniture",category:"nightstand",w:80,h:50},{id:"bookshelf",group:"furniture",category:"wardrobe",w:100,h:35},{id:"wall_unit",group:"furniture",category:"wardrobe",w:240,h:45},{id:"wardrobe",group:"furniture",category:"wardrobe",w:180,h:60},{id:"kitchen_floor",group:"furniture",category:"kitchen_cabinet",w:60,h:60},{id:"kitchen_floor_corner",group:"furniture",category:"kitchen_cabinet",w:90,h:90},{id:"kitchen_wall",group:"furniture",category:"kitchen_cabinet",w:60,h:35},{id:"kitchen_wall_corner",group:"furniture",category:"kitchen_cabinet",w:60,h:60},{id:"shelf_floor",group:"furniture",category:"shelving",w:100,h:35},{id:"shelf_wall",group:"furniture",category:"shelving",w:100,h:25},{id:"cooktop_two",group:"appliance",category:"cooktop",w:30,h:50},{id:"stove",group:"appliance",category:"cooktop",w:60,h:60},{id:"tv",group:"appliance",category:"tv",w:120,h:28},{id:"tv_wall",group:"appliance",category:"tv",w:120,h:15},{id:"toilet",group:"sanitary",category:"toilet",w:40,h:70},{id:"toilet_built_in",group:"sanitary",category:"toilet",w:40,h:55},{id:"bathtub",group:"sanitary",category:"bathtub",w:170,h:75},{id:"bathtub_corner",group:"sanitary",category:"bathtub",w:140,h:140},{id:"bidet",group:"sanitary",category:"bidet",w:40,h:60},{id:"bidet_built_in",group:"sanitary",category:"bidet",w:40,h:50},{id:"kitchen_sink",group:"sanitary",category:"kitchen_sink",w:60,h:50},{id:"kitchen_sink_double",group:"sanitary",category:"kitchen_sink",w:90,h:50}].map(e=>({id:e.id,group:e.group,category:e.category,w:e.w,h:e.h,designer:!0})),...Fl.filter(e=>zl.has(e.id))],Ol=new Map(Il.map(e=>[e.id,e]));function El(e){return e&&Ol.get(e)||null}function Nl(e){return!0===Ol.get(e)?.designer}function Hl(e){return Il.filter(t=>t.group===e)}function Ll(e){const t=El(e);return t?{w:t.w,h:t.h}:{w:60,h:60}}function Bl(e,t,i=Qa,n=1e3){const r=Number(t)>0?Number(t):5;return(Number(e)||0)/r*i/n}const ql=5e-4,jl=Xa;function Wl(e){return Number.isFinite(e)?Math.max(ql,Math.min(jl,e)):ql}function Ul(e){return Number.isFinite(e)?Math.max(1,Math.min(1e4,e)):1}const Gl=e=>{const t=Math.round(1e3*e)/1e3;return Object.is(t,-0)?"0":String(t)};function Vl(e,t){const i=El(e);if(!i)return null;if(i.designer)return Al.art(e,t)??null;const n=function(e,t,i){if(!e.g)return"";const n=e=>Gl(e*t),r=e=>Gl(e*i),o=[];for(const s of e.g)if("r"===s[0]){const[,e,t,i,a]=s;o.push(`M${n(e)} ${r(t)}H${n(e+i)}V${r(t+a)}H${n(e)}Z`)}else if("l"===s[0]){const[,e,t,i,a]=s;o.push(`M${n(e)} ${r(t)}L${n(i)} ${r(a)}`)}else if("e"===s[0]){const[,e,a,l,c]=s;o.push(`M${n(e-l)} ${r(a)}A${Gl(l*t)} ${Gl(c*i)} 0 0 1 ${n(e+l)} ${r(a)}A${Gl(l*t)} ${Gl(c*i)} 0 0 1 ${n(e-l)} ${r(a)}Z`)}else{const e=s.slice(1);if(e.length<4)continue;let t=`M${n(e[0])} ${r(e[1])}`;for(let i=2;i+10?n:Number.isFinite(r)&&r>0?r:1,s=Number(t),a=o*(Number.isFinite(s)&&s>0?s:1);return Number.isFinite(a)&&a>0?a:o}function Yl(e,t,i,n,r){const o=e+i/2,s=t+n/2,a=(Number(r)||0)*Math.PI/180,l=Math.cos(a),c=Math.sin(a),h=(e,t)=>{const i=e-o,n=t-s;return[o+i*l-n*c,s+i*c+n*l]};return[h(e,t),h(e+i,t),h(e+i,t+n),h(e,t+n)]}function Xl(e,t,i,n,r,o,s){const a=Number.isFinite(s)&&s>0?s:1e-6,l=(Number(e.angle)||0)*Math.PI/180,c=Math.cos(l),h=Math.sin(l),d=-Math.sin(l),u=Math.cos(l),p=e.x+e.w/2,_=e.y+e.h/2,m=t>0?-e.w/2:t<0?e.w/2:0,g=i>0?-e.h/2:i<0?e.h/2:0,f=p+m*c+g*d,v=_+m*h+g*u,y=n-f,b=r-v,w=t?(y*c+b*h)*(t>0?1:-1):e.w,k=i?(y*d+b*u)*(i>0?1:-1):e.h;let x=t?Math.abs(w):e.w,S=i?Math.abs(k):e.h;if(o&&t&&i){const t=x/Math.max(e.w,a),i=S/Math.max(e.h,a),n=Math.abs(t-1)>=Math.abs(i-1)?t:i,r=Math.max(a/e.w,a/e.h),o=Math.max(r,Number.isFinite(n)?n:r);x=e.w*o,S=e.h*o}x=Math.max(a,Number.isFinite(x)?x:a),S=Math.max(a,Number.isFinite(S)?S:a);const $=!!t&&w<0,M=!!i&&k<0,R=t?(t>0?1:-1)*($?-1:1):0,C=i?(i>0?1:-1)*(M?-1:1):0,T=f+R*(x/2)*c+C*(S/2)*d,D=v+R*(x/2)*h+C*(S/2)*u,A=!!e.flip_h!==$,P=!!e.flip_v!==M;return{x:T-x/2,y:D-S/2,w:x,h:S,...Number(e.angle)?{angle:Number(e.angle)}:{},...A?{flip_h:!0}:{},...P?{flip_v:!0}:{}}}function Zl(e,t,i,n){let r=Number(e)+(Number(i)-Number(t));if([r,t,i].every(Number.isFinite)||(r=0),n){const e=r/45;r=45*(e<0?-Math.round(Math.abs(e)):Math.round(e))}return r=(r%360+360)%360,r>180?r-360:r}function Jl(e,t,i,n,r){const o=e.x*t,s=e.y*i,a=e.w*t,l=e.h*i,c=o+a/2,h=s+l/2,d=o+(e.flip_h?a:0),u=s+(e.flip_v?l:0),p=(e.flip_h?-1:1)*a/n,_=(e.flip_v?-1:1)*l/r,m=Number(e.angle)||0;return(m?`rotate(${m} ${c} ${h}) `:"")+`translate(${d} ${u}) scale(${p} ${_})`}function Ql(e,t,i,n=.1){if("string"==typeof e&&!e.trim())return null;const r=Number(e);if(!Number.isFinite(r)||0===r)return null;const o=r*(t?30.48:100),s=Math.abs(o);return si?null:o}function ec(e,t,i){const n=Math.abs(Number(e))/(i?30.48:100),r=Number(n.toFixed(6));return String(t?-r:r)}const tc=15e3,ic=2e3,nc=new WeakMap;function rc(e,t){let i=nc.get(e);if(!i){const t=new Set;i={hiddenAt:"hidden"===e.visibilityState?Date.now():0,token:0,subscribers:t,onVisibility:()=>{const t=nc.get(e);if(!t)return;const i=Date.now();if("hidden"===e.visibilityState){t.hiddenAt||(t.hiddenAt=i);const e={kind:"hidden",token:t.token,at:i,hiddenFor:0,long:!1};for(const i of[...t.subscribers])i(e);return}const n=t.hiddenAt?Math.max(0,i-t.hiddenAt):0;t.hiddenAt=0,t.token++;const r={kind:"visible",token:t.token,at:i,hiddenFor:n,long:n>=tc};for(const e of[...t.subscribers])e(r)},onPageShow:t=>{const i=nc.get(e);if(!i)return;const n=Date.now();i.token++;const r={kind:"pageshow",token:i.token,at:n,hiddenFor:0,long:!!t.persisted,persisted:!!t.persisted};for(const e of[...i.subscribers])e(r)}},nc.set(e,i),e.addEventListener("visibilitychange",i.onVisibility),e.defaultView?.addEventListener("pageshow",i.onPageShow)}return i.subscribers.add(t),()=>{const i=nc.get(e);i&&(i.subscribers.delete(t),i.subscribers.size||(e.removeEventListener("visibilitychange",i.onVisibility),e.defaultView?.removeEventListener("pageshow",i.onPageShow),nc.delete(e)))}}const oc={now:()=>Date.now(),setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e),requestAnimationFrame:e=>window.requestAnimationFrame(e),cancelAnimationFrame:e=>window.cancelAnimationFrame(e)};class sc{constructor(e,t=oc){this.onChange=e,this.clock=t,this._state="steady",this._token=0,this._frameFingerprint="",this._hasCompleteFrame=!1,this._overlayPhase="none",this._recoveryReason=null,this._overlayTimer=0,this._overlayRaf=0,this._overlayOpaqueAt=0,this._barrierRafs=new Set,this._trace=[],this._disposed=!1}get state(){return this._state}get token(){return this._token}get frameFingerprint(){return this._frameFingerprint}get hasCompleteFrame(){return this._hasCompleteFrame}get overlayPhase(){return this._overlayPhase}get overlayVisible(){return"none"!==this._overlayPhase}get overlayBlocksInteraction(){return this.overlayVisible}get recoveryReason(){return this._recoveryReason}get trace(){return this._trace.map(e=>({...e,...e.stage?{stage:[...e.stage]}:{}}))}note(e,t={}){this.record(e,void 0,t)}record(e,t,i={}){this._trace.push({at:this.clock.now(),token:this._token,event:e,state:this._state,...t?{reason:t}:{},...i}),this._trace.length>80&&this._trace.splice(0,this._trace.length-80)}changed(){this._disposed||this.onChange()}adoptCompleteFrame(e){e&&(this._hasCompleteFrame=!0,this._frameFingerprint=e,this._state="steady",this._recoveryReason=null,this.clearOverlay(),this.record("frame-adopted"),this.changed())}markCompleteFrame(e){e&&(this._hasCompleteFrame=!0,this._frameFingerprint=e,this._state="steady",this._recoveryReason=null,this.clearOverlay(),this.record("frame-complete"),this.changed())}refreshCompleteFrame(e){!this._disposed&&this._hasCompleteFrame&&"steady"===this._state&&e&&e!==this._frameFingerprint&&(this._frameFingerprint=e,this.record("frame-refreshed"))}visibility(e){return"hidden"===e.kind?(this.record("visibility-hidden"),this._token):e.long||"visible"!==e.kind&&"pageshow"!==e.kind?this.beginCandidate("pageshow"===e.kind?"pageshow":"long-resume"):(this.record("pageshow"===e.kind?"pageshow-noop":"visibility-visible-quick"),this._token)}beginCandidate(e,t="plan"){return this._token++,this._recoveryReason=t,this._hasCompleteFrame?(this._state="connection"===t?"offline-stale":"holding",this.clearOverlay()):this.overlayVisible?this._state="overlay-visible":(this._state="overlay-pending",this.scheduleOverlay(t)),this.record("candidate-start",e),this.changed(),this._token}connectionLost(){return this.beginCandidate("connection-lost","connection")}candidateReady(e){return!this._disposed&&e===this._token&&(this._state="candidate-ready",this.record("candidate-ready"),this.changed(),!0)}async commitAfterPaint(e,t){if(this._disposed||e!==this._token)return!1;let i=!0;const n=(async()=>{for(await t.updateComplete();i&&!this._disposed&&e===this._token;)if(t.stageValid()&&t.assetsReady()){if(await this.nextFrame(),e!==this._token||!t.stageValid()||!t.assetsReady())continue;if(await this.nextFrame(),e===this._token&&t.stageValid()&&t.assetsReady())return!0}else await this.nextFrame();return!1})();let r=0;const o=new Promise(e=>{r=this.clock.setTimeout(()=>e({ready:!1,timedOut:!0}),ic)}),s=await Promise.race([n.then(e=>({ready:e,timedOut:!1})),o]);return i=!1,this.clock.clearTimeout(r),!this._disposed&&e===this._token&&(!(!s.ready&&!s.timedOut)&&(s.ready?(this._hasCompleteFrame=!0,this._frameFingerprint=t.frameFingerprint(),this.record("paint-barrier"),this.finishOverlayAfterCommit(),!0):(this.record("paint-barrier-timeout"),this._hasCompleteFrame?(this._state="connection"===this._recoveryReason?"offline-stale":"steady",this.clearOverlay()):(this._state="recovery-error","opaque"!==this._overlayPhase&&this.showOverlayNow()),this.changed(),!1)))}retry(e=this._recoveryReason||"plan"){return this.beginCandidate("retry",e)}nextFrame(){return new Promise(e=>{const t=this.clock.requestAnimationFrame(()=>{this._barrierRafs.delete(t),e()});this._barrierRafs.add(t)})}scheduleOverlay(e){this.clearOverlayTimer(),this._recoveryReason=e,this._overlayTimer=this.clock.setTimeout(()=>{this._overlayTimer=0,this._hasCompleteFrame||"overlay-pending"!==this._state&&"candidate-ready"!==this._state||(this._state="overlay-visible",this._overlayPhase="entering",this.record("overlay-enter"),this.changed(),this._overlayRaf=this.clock.requestAnimationFrame(()=>{this._overlayRaf=0,"entering"===this._overlayPhase&&(this._overlayPhase="fading-in",this.changed(),this._overlayTimer=this.clock.setTimeout(()=>{this._overlayTimer=0,"fading-in"===this._overlayPhase&&(this._overlayPhase="opaque",this._overlayOpaqueAt=this.clock.now(),this.record("overlay-opaque"),this.changed())},150))}))},150)}showOverlayNow(){this.clearOverlayTimer(),this._overlayPhase="opaque",this._overlayOpaqueAt=this.clock.now(),this.record("overlay-error")}finishOverlayAfterCommit(){if(this.clearOverlayTimer(),"none"===this._overlayPhase||"entering"===this._overlayPhase||"fading-in"===this._overlayPhase)return this.clearOverlay(),this._state="steady",this._recoveryReason=null,this.record("candidate-committed"),void this.changed();const e=Math.max(0,this._overlayOpaqueAt+250-this.clock.now());this._overlayTimer=this.clock.setTimeout(()=>{this._overlayTimer=0,this._overlayPhase="leaving",this.record("overlay-leave"),this.changed(),this._overlayTimer=this.clock.setTimeout(()=>{this._overlayTimer=0,this._overlayPhase="none",this._state="steady",this._recoveryReason=null,this.record("candidate-committed"),this.changed()},180)},e)}clearOverlayTimer(){this._overlayTimer&&this.clock.clearTimeout(this._overlayTimer),this._overlayTimer=0}clearOverlay(){this.clearOverlayTimer(),this._overlayRaf&&this.clock.cancelAnimationFrame(this._overlayRaf),this._overlayRaf=0,this._overlayPhase="none",this._overlayOpaqueAt=0}dispose(){this._disposed=!0,this._token++,this.clearOverlay();for(const e of this._barrierRafs)this.clock.cancelAnimationFrame(e);this._barrierRafs.clear()}}function ac(e){let t=2166136261,i=2654435769;const n=new WeakSet,r=e=>{for(let n=0;n>>0)+(i>>>2)}},o=e=>{if(null===e)return void r("n");const t=typeof e;if("string"===t)return void r(`s${e.length}:${e}`);if("number"===t)return void r(`d${Number.isNaN(e)?"NaN":String(e)}`);if("boolean"===t)return void r(e?"t":"f");if("undefined"===t)return void r("u");if("object"!==t)return void r(`${t}:${String(e)}`);const i=e;if(n.has(i))r("[cycle]");else{if(n.add(i),Array.isArray(e)){r("[");for(const t of e)o(t);return r("]"),void n.delete(i)}r("{");for(const t of Object.keys(e).sort())r(t),o(e[t]);r("}"),n.delete(i)}};return o(e),`${(t>>>0).toString(16).padStart(8,"0")}${(i>>>0).toString(16).padStart(8,"0")}`}function lc(e){return ac(e)}const cc=new WeakMap;class hc{constructor(e,t=()=>Date.now()){this.onUpdate=e,this.now=t,this.fallbackAuthority={},this.referenceOwner={},this.referenced=new Set,this.queued=new Set,this.disposed=!1,this.sharedUpdate=()=>{this.disposed||this.onUpdate()}}bind(e){const t=((e,t)=>{const i=e?.connection||e?.callWS||t;return!i||"object"!=typeof i&&"function"!=typeof i?t:i})(e,this.fallbackAuthority);return this.shared&&this.authority===t||(this.shared&&(this.shared.listeners.delete(this.sharedUpdate),this.shared.references.delete(this.referenceOwner)),this.authority=t,this.shared=(e=>{let t=cc.get(e);return t||(t={signed:{},queued:new Set,inFlight:new Map,retry:new Map,listeners:new Set,settlers:new Set,references:new Map},cc.set(e,t)),t})(t),this.disposed||(this.shared.listeners.add(this.sharedUpdate),this.shared.references.set(this.referenceOwner,new Set(this.referenced)))),this.shared}start(e,t){this.disposed=!1,this.referenced=new Set(t());const i=this.bind(e());i.listeners.add(this.sharedUpdate),i.references.set(this.referenceOwner,new Set(this.referenced)),this.stopTimer(),this.resignTimer=setInterval(()=>this.resign(e(),t()),288e5)}dispose(){if(this.disposed=!0,this.stopTimer(),clearTimeout(this.batchTimer),this.shared){this.shared.listeners.delete(this.sharedUpdate),this.shared.references.delete(this.referenceOwner);for(const e of this.queued)this.shared.queued.delete(e)}this.queued.clear()}invalidate(e){const t=this.bind(e);clearTimeout(this.batchTimer),this.queued.clear(),t.queued.clear(),t.inFlight.clear(),t.retry.clear(),t.signed={}}stopTimer(){void 0!==this.resignTimer&&clearInterval(this.resignTimer),this.resignTimer=void 0}display(e,t){const i=En(t);if(!i.startsWith("/api/houseplan/content/"))return i;const n=this.bind(e);this.referenced.add(i),n.references.set(this.referenceOwner,new Set(this.referenced));const r=n.signed[i],o=r?this.now()-r.at:1/0;return o{const t=[...this.queued];this.queued.clear();for(const e of t)i.queued.delete(e);this.sign(e,t)},30))}sign(e,t){if(!t.length||!e?.callWS)return;const i=this.bind(e);for(const n of function(e,t){const i=Math.max(1,Math.floor(t)),n=[];for(let t=0;t{const n=i.inFlight.get(e);return!(void 0!==n&&t-n<15e3)&&(i.inFlight.set(e,t),!0)});r.length&&e.callWS({type:"houseplan/content/sign",paths:r}).then(e=>{const t=this.now();let n=0,o=!1;for(const s of r){const r=e?.urls?.[s];if("string"==typeof r&&r){const e=i.signed[s];e?.loaded&&e.url!==r?(e.pending={url:r,at:t},this.preloadReplacement(i,s,r,t)):(i.signed[s]={url:r,at:t,loaded:e?.url===r&&!!e.loaded},o=!0),i.retry.delete(s),n++}else this.backOff(i,s)}if(n&&(this.trimShared(i),o))for(const e of[...i.listeners])e()}).catch(()=>{for(const e of r)this.backOff(i,e)}).finally(()=>{for(const e of r)i.inFlight.get(e)===t&&i.inFlight.delete(e);for(const e of[...i.settlers])e()})}}preloadReplacement(e,t,i,n){const r=()=>{const r=e.signed[t];if(r?.pending?.url===i){e.signed[t]={url:i,at:n,loaded:!0},e.retry.delete(t),this.trimShared(e);for(const t of[...e.listeners])t()}},o=()=>{const n=e.signed[t];n?.pending?.url===i&&(delete n.pending,this.backOff(e,t))};if("undefined"==typeof Image)return void r();const s=new Image;s.onload=()=>{("function"==typeof s.decode?s.decode():Promise.resolve()).then(r).catch(o)},s.onerror=o,s.src=i}preloadCurrentImage(e,t,i){if(i.loaded)return Promise.resolve(!0);if(i.preload)return i.preload;if("undefined"==typeof Image)return i.loaded=!0,Promise.resolve(!0);const n=i.url;return i.preload=new Promise(r=>{const o=new Image;let s=!1;const a=o=>{if(s)return;s=!0,clearTimeout(l);const a=e.signed[t];if(a===i&&delete a.preload,o&&a===i&&a.url===n){a.loaded=!0;for(const t of[...e.listeners])t();r(!0)}else o||a!==i||this.backOff(e,t),r(!1)};o.onload=()=>{("function"==typeof o.decode?o.decode():Promise.resolve()).then(()=>a(!0)).catch(()=>a(!1))},o.onerror=()=>a(!1);const l=setTimeout(()=>a(!1),ic);o.src=n}),i.preload}prepareImage(e,t){const i=En(t);if(!i.startsWith("/api/houseplan/content/"))return Promise.resolve(!0);const n=this.bind(e),r=()=>{const t=n.signed[i];if(t&&this.now()-t.atthis.now()&&!n.inFlight.has(i)&&!n.queued.has(i)?Promise.resolve(!1):null},o=r();return o?(s=o,new Promise(e=>{let t=!1;const i=i=>{t||(t=!0,clearTimeout(n),e(i))},n=setTimeout(()=>i(!1),ic);s.then(i).catch(()=>i(!1))})):new Promise(e=>{let t=!1,i=null;const o=i=>{t||(t=!0,clearTimeout(a),n.settlers.delete(s),e(i))},s=()=>{t||i||(i=r(),i&&i.then(o).catch(()=>o(!1)))},a=setTimeout(()=>o(!1),ic);n.settlers.add(s),s()});var s}backOff(e,t){const i=e.retry.get(t)?.delay||0,n=Math.min(6e4,i?2*i:2e3);e.retry.set(t,{notBefore:this.now()+n,delay:n})}trimShared(e){const t=Object.entries(e.signed);if(t.length<=512)return;const i=new Set(e.inFlight.keys());for(const t of e.references.values())for(const e of t)i.add(e);for(const[e,n]of t)(n.pending||n.preload)&&i.add(e);t.sort((e,t)=>t[1].at-e[1].at);const n=t.filter(([e])=>i.has(e));for(const e of t){if(n.length>=512)break;i.has(e[0])||n.push(e)}e.signed=Object.fromEntries(n)}resign(e,t){const i=this.bind(e);this.referenced=new Set(t),i.references.set(this.referenceOwner,new Set(this.referenced));const n=this.now(),r=new Set;for(const e of i.references.values())for(const t of e)r.add(t);const o={};for(const[e,t]of Object.entries(i.signed))r.has(e)&&n-t.at!!o[e]&&!o[e].pending))}markLoaded(e,t,i){const n=En(t);if(!n.startsWith("/api/houseplan/content/"))return;const r=this.bind(e).signed[n];if(r&&(!i||r.url===i)&&!r.loaded){r.loaded=!0;for(const t of[...this.bind(e).listeners])t()}}isReady(e,t){const i=En(t);if(!i.startsWith("/api/houseplan/content/"))return!0;const n=this.bind(e).signed[i];return!!n&&this.now()-n.at=2&&(this._sequenceMultitouch=!0,this._postGestureClickBlocked=!0))}pointerTerminal(e,t){if("touch"!==t)return!1;const i=this._sequenceMultitouch;return this._activeTouchPointers.delete(e),0===this._activeTouchPointers.size&&(this._sequenceMultitouch=!1),i}reset(){this._activeTouchPointers.clear(),this._sequenceMultitouch=!1,this._postGestureClickBlocked=!1}}const uc=1e-7,pc=(e,t)=>{const i=e.x-t.x,n=e.y-t.y;return i*i+n*n};function _c(e){const t=Math.max(0,e.floorRadius);return{left:Math.min(e.painted.left,e.center.x-t),top:Math.min(e.painted.top,e.center.y-t),right:Math.max(e.painted.right,e.center.x+t),bottom:Math.max(e.painted.bottom,e.center.y+t)}}function mc(e,t){let i=null,n=Number.POSITIVE_INFINITY;for(const r of e){const e=pc(t,r.center);(efunction(e,t){const i=Math.max(0,t.right-t.left),n=Math.max(0,t.bottom-t.top);if(i<=0||n<=0)return!1;const r=Math.min(i,n)/2,o=Math.max(t.left+r,Math.min(t.right-r,e.x)),s=Math.max(t.top+r,Math.min(t.bottom-r,e.y));return pc(e,{x:o,y:s})<=r*r+uc}(t,e.painted));if(i.length)return mc(i,t);return mc(e.filter(e=>{const i=Math.max(0,e.floorRadius);return pc(t,e.center)<=i*i+uc}),t)}class fc{constructor(e,t=44){this.cellSize=t,this.buckets=new Map;const i=Number.isFinite(t)&&t>0?t:44;this.cellSize=i;for(const t of e){const e=_c(t),n=Math.floor(e.left/i),r=Math.floor(e.right/i),o=Math.floor(e.top/i),s=Math.floor(e.bottom/i);for(let e=n;e<=r;e++)for(let i=o;i<=s;i++){const n=`${e}:${i}`,r=this.buckets.get(n);r?r.push(t):this.buckets.set(n,[t])}}}resolve(e){const t=`${Math.floor(e.x/this.cellSize)}:${Math.floor(e.y/this.cellSize)}`;return gc(this.buckets.get(t)||[],e)}}class vc{constructor(){this.active=new Map,this.released=new Map}begin(e,t){this.released.delete(e),this.active.set(e,t)}owner(e){return this.active.get(e)||null}release(e){const t=this.active.get(e)||null;if(!t)return this.released.get(e)||null;for(this.active.delete(e),this.released.set(e,t);this.released.size>16;){const e=this.released.keys().next().value;if(void 0===e)break;this.released.delete(e)}return t}consumeClick(e){const t=this.released.get(e)||null;return this.released.delete(e),t}cancel(e){const t=this.active.get(e)||null;return this.active.delete(e),t}clear(){this.active.clear(),this.released.clear()}}class yc{constructor(){this.index=null,this.pointers=new vc,this.hoverId=null,this.hoverElement=null}invalidate(){this.index=null}reset(e){this.invalidate(),this.pointers.clear(),this.hover(e,null)}clearPointers(){this.pointers.clear()}cancel(e){return this.pointers.cancel(e)}release(e){return this.pointers.release(e)}indexFor(e){if(this.index)return this.index;const t=[];for(const i of e.querySelectorAll('.devlayer > .dev[data-hp="device"][data-id]')){const e=i.querySelector(".device-shell-frame"),n=i.getBoundingClientRect(),r=e?.getBoundingClientRect();!i.dataset.id||!i.isConnected||!r||n.width<=0||n.height<=0||r.width<=0||r.height<=0||t.push({id:i.dataset.id,center:{x:n.left+n.width/2,y:n.top+n.height/2},painted:{left:r.left,top:r.top,right:r.right,bottom:r.bottom},floorRadius:Math.max(22,Math.min(r.width,r.height)/2)})}return this.index=new fc(t),this.index}at(e,t,i,n,r){const o=this.indexFor(e).resolve({x:n,y:r})?.id;return o&&t.find(e=>e.id===o&&e.space===i)||null}byId(e,t,i){return i&&e.find(e=>e.id===i&&e.space===t)||null}begin(e,t,i,n,r){const o=this.at(e,t,i,n.clientX,n.clientY)||r;return this.pointers.begin(n.pointerId,o.id),o}pointer(e,t,i,n,r){const o=n.pointerId;return(Number.isFinite(o)?this.byId(t,i,this.pointers.owner(o)):null)||this.at(e,t,i,n.clientX,n.clientY)||r}click(e,t,i,n,r){if(!(n instanceof PointerEvent))return r;const o=n,s=Number.isFinite(o.pointerId)?this.pointers.consumeClick(o.pointerId):null;return this.byId(t,i,s)||this.at(e,t,i,o.clientX,o.clientY)||r}hover(e,t){this.hoverId===t&&this.hoverElement?.isConnected||(this.hoverElement?.removeAttribute("data-hp-device-hover"),this.hoverId=t,this.hoverElement=t&&[...e.querySelectorAll('.devlayer > .dev[data-hp="device"][data-id]')].find(e=>e.dataset.id===t)||null,this.hoverElement?.setAttribute("data-hp-device-hover",""))}}function bc(e,t){if(t)return e.find(e=>e.id===t)}function wc(e,t){return{id:e,title:t,plan_url:null,view_box:[0,0,1,1],rooms:[],wall_segments:[]}}function kc(e="file"){const t="draw"===e;return{source:e,showBorders:t,showNames:t,displayTouched:!1}}function xc(e,t){if(e.displayTouched)return{...e,source:t};const i="draw"===t;return{...e,source:t,showBorders:i,showNames:i}}function Sc(e,t,i){return{...e,[t]:i,displayTouched:!0}}function $c(e){const t=String(e??"").trim().replace(",",".");if(!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(t))return null;const i=Number(t);return Number.isFinite(i)?i:null}function Mc(e,t){const i=e=>{if(""===String(e??"").trim())return{valid:!0,value:null};const t=$c(e);return{valid:null!==t,value:t}},n=i(e),r=i(t);return n.valid&&r.valid?null!==n.value&&null!==r.value&&n.value>r.value?{valid:!0,min:r.value,max:n.value}:{valid:!0,min:n.value,max:r.value}:{valid:!1,min:n.value,max:r.value}}function Rc(e,t,i,n,r,o){const s=Mc(n,r);return dn(e,t,o&&s.valid?{settings:{...i.settings||{},temp_min:s.min,temp_max:s.max}}:i)}function Cc(e){const t=e=>"number"==typeof e&&Number.isFinite(e)?String(e):"";return[t(e?.temp_min),t(e?.temp_max)]}function Tc(e,t,i){const n=Mc(t,i);return!!n.valid&&(null===n.min?delete e.temp_min:e.temp_min=n.min,null===n.max?delete e.temp_max:e.temp_max=n.max,!0)}var Dc="M11,18H13V16H11V18M12,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,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,6A4,4 0 0,0 8,10H10A2,2 0 0,1 12,8A2,2 0 0,1 14,10C14,12 11,11.75 11,15H13C13,12.75 16,12.5 16,10A4,4 0 0,0 12,6Z";function Ac(e,t,i){return[e[0]*t+e[1]*i+e[2],e[3]*t+e[4]*i+e[5]]}function Pc(e,t){let i=0;for(const[n,r]of t){const t=Ac(e,n[0],n[1]);i=Math.max(i,Math.hypot(t[0]-r[0],t[1]-r[1]))}return i}const Fc=e=>{if(null==e||""===e)return null;const t=Number(e);return Number.isFinite(t)?t:null},zc=e=>{const t=e,i=Fc(Array.isArray(t)?t[0]:t?.x),n=Fc(Array.isArray(t)?t[1]:t?.y);return null==i||null==n?null:[i,n]};function Ic(e){if(!Array.isArray(e))return null;const t=[];for(const i of e){const e=zc(i);if(!e)return null;t.push(e)}if(t.length>1){const e=t[0],i=t[t.length-1];e[0]===i[0]&&e[1]===i[1]&&t.pop()}if(t.length<3)return null;let i=0,n=0,r=0;for(let e=0;ee+t[0],0)/t.length,t.reduce((e,t)=>e+t[1],0)/t.length]:[n/(3*i),r/(3*i)]}function Oc(e){if(!Array.isArray(e))return null;const t=[];for(const i of e){const e=zc(i);if(!e)return null;t.push(e)}if(t.length>1){const e=t[0],i=t[t.length-1];e[0]===i[0]&&e[1]===i[1]&&t.pop()}const i=Ic(t);if(!i)return null;const n=t.map(e=>e[0]),r=t.map(e=>e[1]);return{centroid:i,bbox:[Math.min(...n),Math.min(...r),Math.max(...n),Math.max(...r)]}}function Ec(e){let t=e;if(t&&"object"==typeof t&&!Array.isArray(t)){const e=t;t=e.path??e.points??t}if(!Array.isArray(t)||!t.length)return[];let i=(t.some(e=>(e=>Array.isArray(e)?e.length>=2&&!Array.isArray(e[0])&&("object"!=typeof e[0]||null==e[0]):!!e&&"object"==typeof e&&("x"in e||"y"in e))(e))?[t]:t.filter(Array.isArray)).map(e=>e.map(zc).filter(e=>null!=e)).filter(e=>e.length>=2);i.length>64&&(i=i.slice(-64));const n=i.reduce((e,t)=>e+t.length,0);if(n<=4e3)return i.map(e=>e.slice());const r=4e3-2*i.length,o=i.map(e=>e.length-2),s=o.reduce((e,t)=>e+t,0),a=o.map(e=>r*e/s),l=a.map(Math.floor);let c=r-l.reduce((e,t)=>e+t,0);const h=a.map((e,t)=>({index:t,fraction:e-Math.floor(e)})).sort((e,t)=>t.fraction-e.fraction||e.index-t.index);for(let e=0;efunction(e,t){if(t>=e.length)return e.slice();if(t<=2)return[e[0],e[e.length-1]];const i=[];for(let n=0;ne.slice()),i=t[t.length-1];return i?(i.length>2?i.pop():t.pop(),t):[]}const Lc=e=>Number.isFinite(e[0])&&Number.isFinite(e[1]),Bc=(e,t)=>e[0]===t[0]&&e[1]===t[1];function qc(e){if(!e)return null;const t=e.vacuum_position||e.robot_position||null,i=t&&null!=Fc(t.x)&&null!=Fc(t.y)?{x:Fc(t.x),y:Fc(t.y),a:Fc(t.a??t.angle??t.theta)}:null,n=Ec(e.path?.path??e.path?.points??e.path),r=[],o=e.rooms,s=Array.isArray(o)?o.map((e,t)=>[String(e?.id??t),e]):o&&"object"==typeof o?Object.entries(o):[];for(const[e,t]of s){if(!t||"object"!=typeof t)continue;const i=String(t.name??t.label??"").trim(),n=[[Fc(t.cx),Fc(t.cy)],[Fc(t.center?.x),Fc(t.center?.y)],[Fc(t.x),Fc(t.y)]].find(([e,t])=>null!=e&&null!=t);let o=n?.[0]??null,s=n?.[1]??null;const a=Oc(t.outline),l=Fc(t.x0),c=Fc(t.y0),h=Fc(t.x1),d=Fc(t.y1),u=(null!=l&&null!=c&&null!=h&&null!=d?[Math.min(l,h),Math.min(c,d),Math.max(l,h),Math.max(c,d)]:null)||a?.bbox||null;if(null!=o&&null!=s||!a||([o,s]=a.centroid),null!=o&&null!=s||!u||(o=(u[0]+u[2])/2,s=(u[1]+u[3])/2),i&&null!=o&&null!=s){const t={id:e,name:i,cx:o,cy:s};u&&([t.x0,t.y0,t.x1,t.y1]=u),r.push(t)}}const a=function(e){return String(e.map_name??e.current_map??e.map_index??e.selected_map??"default")}(e);return i||r.length||n.length?{pos:i,path:n,rooms:r,mapId:a}:null}function jc(e,t,i){return![e,t,i].every(Number.isFinite)||e<0||t<=0||i<=0?Number.POSITIVE_INFINITY:e/t*i}const Wc=40;function Uc(e,t,i){if(!e||!t)return null;const n=t.attributes||{},r=e.split(".")[0]||"",o=null!=i?.platform?String(i.platform):null,s=!!zc(n.vacuum_position??n.robot_position),a=!(!n.rooms||"object"!=typeof n.rooms),l=Ec(n.path?.path??n.path?.points??n.path).length>0,c=[n.map_name,n.current_map,n.map_index,n.selected_map].some(e=>null!=e),h="xiaomi_cloud_map_extractor"===o,d=a||l||c;let u=null;if(s?u="compatible":h?u="known_xcme_incomplete":d?u="partial":"camera"===r&&(u="camera"),!u)return null;const p=s?"camera"===r?300:200:h?100:d?50:0;return{entityId:e,name:String(n.friendly_name||e),platform:o,category:u,hasPosition:s,hasRooms:a,hasPath:l,hasMapId:c,score:p}}const Gc=e=>e.toLowerCase().replace(/[\s_\-.,]+/g,"");function Vc(e,t){const i=new Set(t.map(Gc).filter(Boolean)),n=new Set;for(const t of e){const e=Gc(t.name||"");e&&i.has(e)&&n.add(e)}return n.size}function Kc(e,t){const i=new Map(t.map(e=>[Gc(e.name),e])),n=[],r=[];for(const t of e){const e=i.get(Gc(t.name));e&&(n.push([[t.cx,t.cy],[e.cx,e.cy]]),r.push(t.name))}if(n.length<3)return null;const o=function(e){if(e.length<3)return null;let t=0,i=0,n=0,r=0,o=0,s=0,a=0,l=0,c=0,h=0,d=0,u=0;for(const[[p,_],[m,g]]of e){if(![p,_,m,g].every(Number.isFinite))return null;t+=p*p,i+=p*_,n+=p,r+=_*_,o+=_,s+=1,a+=p*m,l+=_*m,c+=m,h+=p*g,d+=_*g,u+=g}const p=[t,i,n,i,r,o,n,o,s],_=e=>{const[t,i,n,r,o,s,a,l,c]=p,h=t*(o*c-s*l)-i*(r*c-s*a)+n*(r*l-o*a);if(!Number.isFinite(h)||Math.abs(h)<1e-9)return null;const d=[(o*c-s*l)/h,(n*l-i*c)/h,(i*s-n*o)/h,(s*a-r*c)/h,(t*c-n*a)/h,(n*r-t*s)/h,(r*l-o*a)/h,(i*a-t*l)/h,(t*o-i*r)/h];return[d[0]*e[0]+d[1]*e[1]+d[2]*e[2],d[3]*e[0]+d[4]*e[1]+d[5]*e[2],d[6]*e[0]+d[7]*e[1]+d[8]*e[2]]},m=_([a,l,c]),g=_([h,d,u]);if(!m||!g)return null;const f=[m[0],m[1],m[2],g[0],g[1],g[2]];return f.every(Number.isFinite)?f:null}(n);return o?{matrix:o,matched:r,residual:Pc(o,n)}:null}function Yc(e,t,i){const n=e[e.length-1];if(n&&n[0]===t[0]&&n[1]===t[1])return e;if(e.push(t),e.length<=600)return e;let r=function(e,t){if(e.length<3)return e.slice();const i=new Uint8Array(e.length);i[0]=i[e.length-1]=1;const n=[[0,e.length-1]];for(;n.length;){const[r,o]=n.pop(),[s,a]=e[r],[l,c]=e[o],h=l-s,d=c-a,u=Math.hypot(h,d)||1e-9;let p=0,_=-1;for(let t=r+1;tp&&(p=i,_=t)}_>0&&p>t&&(i[_]=1,n.push([r,_],[_,o]))}const r=[];for(let t=0;t600&&(r=r.filter((e,t)=>t%2==0||t===r.length-1)),r}function Xc(e){return"cleaning"===e||"returning"===e||"on"===e}const Zc={0:[1,0],90:[0,1],180:[-1,0],270:[0,-1]};function Jc(e){const[t,i]=Zc[e.rot]||[1,0],n=e.mir?-1:1;return[e.s*t*n,-e.s*i,e.ox,e.s*i*n,e.s*t,e.oy]}function Qc(e){const t=e[0]*e[4]-e[1]*e[3];if(!Number.isFinite(t)||Math.abs(t)<1e-12)return null;const i=t<0,n=Math.sqrt(Math.abs(t));let r=180*Math.atan2(-e[1],e[4])/Math.PI;return r=(90*Math.round(r/90)%360+360)%360,{ox:e[2],oy:e[5],s:n,rot:r,mir:i}}function eh(e,t){const i=[],n=[];for(const t of e)null!=t.x0?(i.push(t.x0,t.x1),n.push(t.y0,t.y1)):(i.push(t.cx),n.push(t.cy));if(!i.length)return{ox:t[0]+t[2]/2,oy:t[1]+t[3]/2,s:t[2]/1e4,rot:0,mir:!0};const r=Math.min(...i),o=Math.max(...i),s=Math.min(...n),a=Math.max(...n),l=Math.max(o-r,a-s)||1,c={ox:0,oy:0,s:.6*Math.min(t[2],t[3])/l,rot:0,mir:!0},h=Jc(c),[d,u]=Ac(h,(r+o)/2,(s+a)/2);return c.ox=t[0]+t[2]/2-d,c.oy=t[1]+t[3]/2-u,c}function th(e,t,i,n){const[r,o]=Ac(Jc(t),i,n),s=Jc({...e,ox:0,oy:0}),[a,l]=Ac(s,i,n);return{...e,ox:r-a,oy:o-l}}function ih(e){const t=e?.trail_mode;return"never"===t||"cleaning"===t||"always"===t?t:!1===e?.trail?"never":"cleaning"}const nh=e=>"number"==typeof e&&Number.isFinite(e);function rh(e){return Array.isArray(e)&&6===e.length&&e.every(nh)?[e[0],e[1],e[2],e[3],e[4],e[5]]:null}function oh(e,t,i){return"legacy:"+e+" "+t+" "+i}function sh(e,t,i,n){const r=t?.map_routes;if(Array.isArray(r))return r.filter(e=>e&&"string"==typeof e.id&&e.id).map(e=>({id:e.id,source:String(e.source??""),map_id:String(e.map_id??""),space:String(e.space??""),calibration:rh(e.calibration)}));const o="string"==typeof t?.source&&t.source?t.source:n||"";if(!o)return[];const s=t?.calibration;if(!s||"object"!=typeof s)return[];const a=[];for(const t of Object.keys(s)){const n=rh(s[t]);n&&a.push({id:oh(e,o,t),source:o,map_id:t,space:i,calibration:n})}return a}const ah=(e,t)=>e instanceof Map?e.get(t):e?.[t];function lh(e){const t=[];let i=!1,n="",r="";for(const o of e.routes){const s=ah(e.observed,o.source);void 0!==s&&(i=!0,n||(n=o.source,r=s),s===o.map_id&&t.push(o))}if(t.length>1)return{kind:"ambiguous",routeIds:t.map(e=>e.id).sort()};if(1===t.length){const i=t[0];if(e.spaceIds&&!e.spaceIds.has(i.space))return{kind:"missing_space",route:i};const n=rh(i.calibration);return n?{kind:"ready",route:{...i,calibration:n}}:{kind:"needs_calibration",route:i}}if(i)return{kind:"unmapped",source:n,mapId:r};const o=e.observed instanceof Map?[...e.observed.entries()]:Object.entries(e.observed||{});if(o.length){const e=o.slice().sort((e,t)=>e[0].localeCompare(t[0]))[0];return{kind:"unmapped",source:e[0],mapId:e[1]}}return{kind:"none"}}function ch(e,t,i){const n=new Set;for(const t of e)t.source&&n.add(t.source);for(const e of t)e&&n.add(e);const r={};for(const e of[...n].sort()){const t=i(e);void 0!==t&&(r[e]=t)}return r}function hh(e,t,i){if(!e)return null;const n="string"==typeof e.route_id?e.route_id:"";if(n)return t.find(e=>e.id===n)||null;const r=function(e,t,i){if(!e||"string"!=typeof e.map_id)return{kind:"orphan_run"};const n=e.map_id,r="string"==typeof i?i:"";let o=t.filter(e=>e.map_id===n);return r&&(o=o.filter(e=>e.source===r)),1===o.length?{kind:"adopted",route:o[0]}:0===o.length?{kind:"orphan_run"}:{kind:"ambiguous_run",routeIds:o.map(e=>e.id).sort()}}(e,t,i);return"adopted"===r.kind?r.route:null}function dh(e){const t="ready"===e.resolution.kind?e.resolution.route:null,i=t&&t.space===e.renderSpace?rh(t.calibration):null,n=hh(e.serverCurrent,e.routes,e.rootSource),r=!!t&&!!n&&n.id===t.id,o=hh(e.serverPrevious,e.routes,e.rootSource);return{live:i,currentRunMatches:r,previous:!!o&&o.space===e.renderSpace&&(e.explicitRoutes||!!t&&o.id===t.id)?rh(o.calibration):null}}const uh={availability:"available",status:"alarm",activity:"none"},ph=new Set(["motion","vibration","sound"]),_h=new Set(["occupancy","presence"]),mh=new Set(["door","window","garage_door","opening"]),gh=new Set(["running","power"]),fh=new Set(["smoke","gas","carbon_monoxide","moisture","safety","tamper","problem"]);const vh=new Set(["running","working","washing","rinsing","spinning","drying","heating","cooling","cleaning","cooking","playing","recording","pumping","irrigating","humidifying","dehumidifying","fan","preheating","defrosting"]),yh=new Set([...vh,"start","started","run","active","in_progress","wash","rinse","spin","dry"]),bh=new Set(["off","idle","paused","standby","docked","finished","complete","completed","stopped","ready","sleeping","stop","end","done","inactive"]),wh=new Set(["heat","cool","heat_cool","auto","dry","fan_only"]),kh=e=>""===e||"unknown"===e||"unavailable"===e||"__missing__"===e,xh=e=>String(e??"").trim().toLowerCase(),Sh=e=>xh(e).replace(/[\s-]+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),$h=new Map([["run_state",0],["job_state",0],["operation_state",0],["activity_state",0],["machine_state",1],["running_state",1],["status",2],["device_status",2],["machine_status",2]]),Mh=new Set(["wifi","connection","signal","battery"]);function Rh(e,t){const i=e?.entities?.[t]||{};if("config"===i.entity_category)return null;const n=String(t||"").split(".").slice(1).join("."),r=[i.translation_key,i.original_name,i.name],o=[...r,n];r.some(e=>xh(e))||o.push(e?.states?.[t]?.attributes?.friendly_name);const s=o.map(Sh).filter(Boolean);if(s.some(e=>e.split("_").some(e=>Mh.has(e))))return null;let a=null;for(const e of s)for(const[t,i]of $h)(e===t||e.endsWith(`_${t}`))&&(a=null==a?i:Math.min(a,i));return a}const Ch=(e,t)=>null!=Rh(e,t);function Th(e,t){if(!t.startsWith("switch."))return!1;const i=e?.entities?.[t]||{},n=e?.states?.[t],r=t.slice(7).toLowerCase();if(/(?:^|_)(?:main_)?power$/.test(r))return!0;if([i.translation_key,i.original_name,i.name].map(xh).some(e=>["power","main power","power switch","питание"].includes(e)))return!0;const o=xh(n?.attributes?.friendly_name);return/(?:^|[\s._-])(?:main[\s._-]+)?power$/.test(o)||/(?:^|[\s._-])питание$/.test(o)}function Dh(e){for(const t of["hvac_action","action","current_operation","run_state","job_state","operation","activity"]){const i=xh(e?.[t]);if(vh.has(i)||bh.has(i))return i}return""}function Ah(e,t){const i=e?.states?.[t],n=i?xh(i.state):"__missing__",r=String(t||"").split(".")[0],o=xh(i?.attributes?.device_class),s={eid:t,state:n,availability:kh(n)?"unavailable":"available",status:"neutral",activity:"none",edge:"none"};if("unavailable"===s.availability)return s;if(function(e,t,i){return"alarm_control_panel"===e?"triggered"===i:"on"===i&&Vn(e,t)}(r,o,n))return{...s,status:"alarm"};if("binary_sensor"===r)return ph.has(o)?{...s,edge:"rising"}:_h.has(o)?{...s,activity:"on"===n?"presence":"none"}:mh.has(o)?{...s,status:"on"===n?"open":"neutral",edge:"rising"}:"moving"===o?{...s,activity:"on"===n?"transition":"none"}:gh.has(o)&&"on"===n?{...s,status:"working",activity:"running"}:s;if("cover"===r)return{...s,activity:"opening"===n||"closing"===n?"transition":"none",edge:"terminal_transition"};if("lock"===r)return{...s,status:"unlocked"===n||"open"===n?"open":"neutral",activity:"locking"===n||"unlocking"===n?"transition":"none",edge:"terminal_transition"};if("valve"===r)return{...s,status:["open","opening","closing"].includes(n)?"open":"neutral",activity:"opening"===n||"closing"===n?"transition":"none",edge:"terminal_transition"};if("climate"===r){const e=Dh(i.attributes),t=Array.isArray(i.attributes?.hvac_modes)?i.attributes.hvac_modes.map(xh):[],r=!bh.has(n)&&(wh.has(n)||vh.has(n)||t.includes(n));return(e?vh.has(e):r)?{...s,status:"working",activity:"running"}:s}if(["light","switch","fan","humidifier"].includes(r))return"on"===n?{...s,status:"working",activity:"running"}:s;if("media_player"===r)return"off"===n?{...s,availability:"unavailable"}:s;if("vacuum"===r)return"cleaning"===n?{...s,status:"working",activity:"running"}:"returning"===n?{...s,status:"working",activity:"transition"}:s;if("script"===r)return"on"===n?{...s,status:"working",activity:"running"}:s;if("automation"===r)return s;if("button"===r||"event"===r)return{...s,edge:"change"};const a=Dh(i.attributes);return vh.has(a)||vh.has(n)&&!bh.has(n)?{...s,status:"working",activity:"running"}:s}function Ph(e,t,i){const n=i.filter(t=>t.startsWith("switch.")&&!e?.entities?.[t]?.entity_category),r=t.find(t=>Th(e,t));if(!(n.length>1&&!!r))return t.map(t=>Ah(e,t));const o=t.find(t=>t!==r&&Ch(e,t)),s=Ah(e,r);return"unavailable"===s.availability||"off"===s.state?t.map(t=>({eid:t,state:e?.states?.[t]?xh(e.states[t].state):"__missing__",availability:"unavailable",status:"neutral",activity:"none",edge:"none"})):t.map(t=>{if(t===o)return function(e,t){const i=e?.states?.[t],n=i?xh(i.state):"__missing__",r={eid:t,state:n,availability:kh(n)?"unavailable":"available",status:"neutral",activity:"none",edge:"none"};if("unavailable"===r.availability)return r;const o=Dh(i?.attributes);return vh.has(o)||yh.has(n)&&!bh.has(n)?{...r,status:"working",activity:"running"}:r}(e,t);return{...t===r?s:Ah(e,t),status:"neutral",activity:"none",edge:"none"}})}function Fh(e){if(!e.length)return{availability:"available",status:"neutral",activity:"none"};const t=e.filter(e=>"available"===e.availability);if(!t.length)return{availability:"unavailable",status:"neutral",activity:"none"};if(t.some(e=>"alarm"===e.status))return uh;const i=t.some(e=>"working"===e.status)?"working":t.some(e=>"open"===e.status)?"open":"neutral",n=t.some(e=>"transition"===e.activity)?"transition":t.some(e=>"presence"===e.activity)?"presence":t.some(e=>"running"===e.activity)?"running":"none";return{availability:"available",status:i,activity:n}}function zh(e,t){if(!(e=>!!e&&!kh(e))(e)||"unavailable"===t.availability||e===t.state)return null;if("rising"===t.edge)return"off"===e&&"on"===t.state?"event":null;if("change"===t.edge)return"event";if("terminal_transition"===t.edge){const i=new Set([e,t.state]);if(i.has("closed")&&i.has("open")||i.has("locked")&&i.has("unlocked"))return"transition"}return null}const Ih=(e,t=0)=>{const i=Number(e);return Number.isInteger(i)&&i>=0?i:t},Oh=(e,t)=>{const i={rev:0,configRev:Ih(t),off:new Set};if(null==e)return{snapshot:i,valid:!1};const n=e.off;return!Number.isInteger(e.rev)||Number(e.rev)<0||!Number.isInteger(e.config_rev)||Number(e.config_rev)<0||!Array.isArray(n)||n.some(e=>"string"!=typeof e||!e)?{snapshot:i,valid:!1}:{snapshot:{rev:Number(e.rev),configRev:Number(e.config_rev),off:new Set(n)},valid:!0}};function Eh(e,t=0){return Oh(e,t).snapshot}function Nh(e,t,i,n){const r=Oh(t,i);return n&&r.valid&&r.snapshot.configRev===i?e.configRev===i&&r.snapshot.rev{try{const[i,n]=await Promise.all([e.callWS({type:"config/device_registry/list"}),e.callWS({type:"config/entity_registry/list"})]),r=Yh(i,"id"),o=Yh(n,"entity_id");if(!r||!o)throw new Error("invalid_registry_response");t.devices=r,t.entities=o,t.authoritative=!0,t.access="full",t.lastSuccess=Date.now(),t.error=void 0}catch(e){t.authoritative=!1,t.access="limited",t.error=function(e){if(e&&"object"==typeof e){const t=e;return String(t.message||t.code||t.error||"registry_unavailable")}return String(e||"registry_unavailable")}(e)}finally{t.revision++,t.loading=void 0,function(e){for(const t of[...e.listeners])try{t()}catch{}}(t)}})()),t.loading}function Zh(e,t){void 0===t.reloadTimer&&(t.reloadTimer=globalThis.setTimeout(()=>{t.reloadTimer=void 0,Xh(e,t)},80))}async function Jh(e,t){if(t.subscribing||t.unsubDevice&&t.unsubEntity)return t.subscribing;const i=e?.connection?.subscribeEvents;return"function"==typeof i?(t.subscribing=(async()=>{try{t.unsubDevice||(t.unsubDevice=await i.call(e.connection,()=>Zh(e,t),"device_registry_updated")),t.unsubEntity||(t.unsubEntity=await i.call(e.connection,()=>Zh(e,t),"entity_registry_updated"))}catch{}finally{0===t.refs&&(t.unsubDevice?.(),t.unsubEntity?.(),t.unsubDevice=void 0,t.unsubEntity=void 0),t.subscribing=void 0}})(),t.subscribing):void 0}function Qh(e,t){const i=Kh(e);if(!i)return()=>{};const n=0===i.refs;i.refs++,i.listeners.add(t),("pending"===i.access||n)&&Xh(e,i),Jh(e,i);let r=!1;return()=>{r||(r=!0,i.listeners.delete(t),i.refs=Math.max(0,i.refs-1),i.refs>0||(i.unsubDevice?.(),i.unsubEntity?.(),i.unsubDevice=void 0,i.unsubEntity=void 0,void 0!==i.reloadTimer&&globalThis.clearTimeout(i.reloadTimer),i.reloadTimer=void 0))}}function ed(e){const t=Kh(e);t&&(Zh(e,t),Jh(e,t))}function td(e){const t=Kh(e);if(!t)return{revision:0,authoritative:!1,access:"limited",devices:e?.devices||{},entities:e?.entities||{},lastSuccess:0,error:"registry_unavailable"};let i=e?.devices||{},n=e?.entities||{};if(t.authoritative){const r=t.liveDevices!==i||t.liveEntities!==n,o=void 0!==t.liveDevices||void 0!==t.liveEntities;if(r&&(t.liveDevices=i,t.liveEntities=n,t.projectedRevision=void 0,o&&Zh(e,t)),t.projectedRevision!==t.revision||!t.projectedDevices||!t.projectedEntities){const e={...t.devices},r={...t.entities};for(const[t,n]of Object.entries(i))Object.prototype.hasOwnProperty.call(e,t)||(e[t]=n);for(const[e,t]of Object.entries(n))Object.prototype.hasOwnProperty.call(r,e)||(r[e]=t);t.projectedDevices=e,t.projectedEntities=r,t.projectedRevision=t.revision}i=t.projectedDevices,n=t.projectedEntities}return{revision:t.revision,authoritative:t.authoritative,access:t.access,devices:i,entities:n,lastSuccess:t.lastSuccess,error:t.error}}function id(e){if(!e||"object"!=typeof e&&"function"!=typeof e)return 0;let t=Wh.get(e);return t||(t=Uh++,Wh.set(e,t)),t}function nd(e,t=td(e)){return[t.revision,t.access,id(t.devices),id(t.entities)].join(":")}function rd(e){return!!e&&null==e.disabled_by}function od(e,t=td(e)){const i={},n={},r={};for(const[e,n]of Object.entries(t.devices||{}))rd(n)&&(i[e]=n);for(const[e,i]of Object.entries(t.entities||{})){if(!rd(i))continue;const r=i.device_id?t.devices?.[i.device_id]:null;t.authoritative&&i.device_id&&!r||(r&&!rd(r)||(n[e]=i))}for(const[i,n]of Object.entries(e?.states||{})){const e=t.entities?.[i];if(e&&!rd(e))continue;const o=e?.device_id?t.devices?.[e.device_id]:null;t.authoritative&&e?.device_id&&!o||(o&&!rd(o)||(r[i]=n))}return{...e,devices:i,entities:n,states:r}}function sd(e,t=td(e)){return{...e,devices:t.devices||{},entities:t.entities||{}}}function ad(e,t){const i=[];for(const[n,r]of Object.entries(e||{}))r?.device_id===t&&i.push(n);return i}function ld(){if(Vh)return Vh;if("undefined"==typeof localStorage)return{};try{const e=JSON.parse(localStorage.getItem(Gh)||"{}");if(!e||"object"!=typeof e||Array.isArray(e))return{};const t=Date.now(),i={};for(const[n,r]of Object.entries(e))!r||"active"!==r.kind&&"ha_disabled"!==r.kind||!Number.isFinite(r.ts)||t-r.ts>7776e6||(i[n]=r);return Vh=i,Vh}catch{return{}}}function cd(e,t,i=td(e)){if(!t||"virtual"===t)return{kind:"active",enabledEntityIds:[],allEntityIds:[]};const n=t.indexOf(":");if(n<1)return{kind:"unverified",reason:"registry_unavailable",enabledEntityIds:[],allEntityIds:[]};const r=t.slice(0,n),o=t.slice(n+1);if("device"!==r&&"entity"!==r||!o)return{kind:"unverified",reason:"registry_unavailable",enabledEntityIds:[],allEntityIds:[]};const s=i.devices||{},a=i.entities||{};if(i.authoritative){if("device"===r){const e=s[o];if(!e)return{kind:"orphaned",reason:"device_missing",enabledEntityIds:[],allEntityIds:[]};const t=ad(a,o);if(!rd(e))return{kind:"ha_disabled",reason:"device",enabledEntityIds:[],allEntityIds:t};const i=t.filter(e=>rd(a[e]));return t.length&&!i.length?{kind:"ha_disabled",reason:"all_entities",enabledEntityIds:[],allEntityIds:t}:{kind:"active",enabledEntityIds:i,allEntityIds:t}}const t=a[o];return t&&!rd(t)?{kind:"ha_disabled",reason:"entity",enabledEntityIds:[],allEntityIds:[o]}:t?.device_id&&!s[t.device_id]?{kind:"orphaned",reason:"device_missing",enabledEntityIds:[],allEntityIds:[o]}:t?.device_id&&!rd(s[t.device_id])?{kind:"ha_disabled",reason:"device",enabledEntityIds:[],allEntityIds:[o]}:t||e?.states?.[o]?{kind:"active",enabledEntityIds:[o],allEntityIds:[o]}:{kind:"orphaned",reason:"entity_missing",enabledEntityIds:[],allEntityIds:[]}}const l=function(e){return ld()[e]||null}(t);if("device"===r){const t=s[o],i=ad(a,o);if(null!=t?.disabled_by)return{kind:"ha_disabled",reason:"device",enabledEntityIds:[],allEntityIds:i};const n=i.filter(e=>{const t=a[e];return null==t?.disabled_by&&(!t.device_id||null==s[t.device_id]?.disabled_by)});if(i.length&&!n.length&&i.every(e=>null!=a[e]?.disabled_by))return{kind:"ha_disabled",reason:"all_entities",enabledEntityIds:[],allEntityIds:i};if("ha_disabled"===l?.kind)return{kind:"ha_disabled",reason:l.reason||"device",enabledEntityIds:[],allEntityIds:i};if(t||n.some(t=>!!e?.states?.[t]))return{kind:"active",enabledEntityIds:n,allEntityIds:i}}else{const t=a[o];if(null!=t?.disabled_by)return{kind:"ha_disabled",reason:"entity",enabledEntityIds:[],allEntityIds:[o]};if(t?.device_id&&null!=s[t.device_id]?.disabled_by)return{kind:"ha_disabled",reason:"device",enabledEntityIds:[],allEntityIds:[o]};if("ha_disabled"===l?.kind)return{kind:"ha_disabled",reason:l.reason||"entity",enabledEntityIds:[],allEntityIds:[o]};if(t||e?.states?.[o])return{kind:"active",enabledEntityIds:[o],allEntityIds:[o]}}return{kind:"unverified",reason:"registry_unavailable",enabledEntityIds:[],allEntityIds:[]}}function hd(e){const t=td(e);return{access:t.access,authoritative:t.authoritative,revision:t.revision,lastSuccess:t.lastSuccess,error:t.error}}function dd(e){const t={};for(const[i,n]of Object.entries(e.entities)){if(!n?.device_id||!rd(n))continue;const r=e.devices?.[n.device_id];r&&!rd(r)||(t[n.device_id]=t[n.device_id]||[]).push(i)}return t}function ud(e,t){const i=new Map;for(const n of e){if(!0===n?.removed)continue;const e=n?.binding||"";if(!e.startsWith("entity:"))continue;const r=e.slice(7);if(!r)continue;const o=t?.entities?.[r]?.device_id;if(!o)continue;const s=i.get(o)||new Set;s.add(r),i.set(o,s)}return{byDevice:i}}function pd(e,t,i,n){const r=n.byDevice.get(t);return r?.size?{partial:!0,entityIds:i.filter(t=>!r.has(t)&&!e?.entities?.[t]?.hidden)}:{partial:!1,entityIds:[...i]}}function _d(e,t,i){if(t.identifiers?.[0]?.[0])return t.identifiers[0][0];for(const t of i){const i=e.entities[t]?.platform;if(i)return i}return""}function md(e,t){if(/_device_temperature$/.test(t))return!1;if(e.entities?.[t]?.entity_category)return!1;const i=e.states[t];if(!i)return/_temperature$/.test(t);const n=i.attributes||{};return"temperature"===n.device_class||/°C|°F/.test(n.unit_of_measurement||"")||/_temperature$/.test(t)}const gd=["vacuum","lawn_mower","climate","media_player","light","cover","lock","valve","alarm_control_panel","water_heater","fan","humidifier","siren","camera","remote"],fd=e=>[...e.filter(e=>!e.reg?.hidden),...e.filter(e=>!!e.reg?.hidden)];function vd(e,t){const i=t.map(t=>({eid:t,reg:e?.entities?.[t]})).filter(e=>!!e.reg);if(!i.length)return[];const n=i.filter(e=>!e.reg.entity_category),r=n.length?n:i;for(const e of gd){const t=r.filter(t=>t.eid.startsWith(e+"."));if(t.length)return fd(t).map(e=>e.eid)}const o=r.filter(t=>function(e,t){if(!t.startsWith("binary_sensor."))return!1;const i=xh(e?.states?.[t]?.attributes?.device_class||e?.entities?.[t]?.device_class||e?.entities?.[t]?.original_device_class);return ph.has(i)||_h.has(i)||mh.has(i)||gh.has(i)||"moving"===i||fh.has(i)}(e,t.eid));if(o.length)return fd(o).map(e=>e.eid);const s=r.filter(e=>e.eid.startsWith("switch."));if(s.length){const t=fd(s),n=t.find(t=>Th(e,t.eid));if(s.length>1&&n){const t=i.filter(t=>t.eid!==n.eid&&"config"!==t.reg?.entity_category&&null!=Rh(e,t.eid)),r=t.filter(e=>!e.reg?.entity_category),o=r.length?r:t;for(const t of[0,1,2]){const i=fd(o.filter(i=>Rh(e,i.eid)===t));if(i.length)return[i[0].eid,n.eid]}}return[(n||t[0]).eid]}const a=[];for(const e of je)a.push(...fd(r.filter(t=>t.eid.startsWith(e+"."))));return a.push(...fd(r.filter(e=>!je.includes(e.eid.split(".")[0])))),a.map(e=>e.eid)}function yd(e,t,i){const n=t.map(t=>({eid:t,reg:e.entities[t],st:e.states[t]})).filter(e=>e.reg),r=[n.filter(e=>!e.reg.hidden&&!e.reg.entity_category),n.filter(e=>!e.reg.entity_category),n.filter(e=>!e.reg.hidden),n];if("mdi:thermometer"===i||"mdi:air-filter"===i)for(const t of r){const i=t.find(t=>md(e,t.eid));if(i)return i.eid}const o=vd(e,t);return o.find(Dn)||o[0]}function bd(e,t,i=[]){return[...new Set(wd(e,t,i))].filter(e=>Dn(e))}function wd(e,t,i=[]){const n=e?.startsWith("entity:")?new Set([e.slice(7)]):new Set(i);return(t||[]).filter(e=>"string"==typeof e&&!n.has(e))}function kd(e,t){if("string"==typeof t)return e.area===t;const i=e.marker?.room_id;return i?!!t.id&&i===t.id:!!t.area&&e.area===t.area}function xd(e){const t=e.marker?.binding?.startsWith("entity:")?e.marker.binding.slice(7):null,i=e.entities.filter(Dn),n=e.primary&&Dn(e.primary)?e.primary:null;return[...new Set([t,n,...i].filter(e=>!!e&&Dn(e)))]}function Sd(e){const t=xd(e),i=e.marker?.light_entity;return i&&t.includes(i)?i:t[0]||null}function $d(e,t){if(!1===t.marker?.is_light)return[];if(!0===t.marker?.is_light){return[{eid:Sd(t),via:"forced"}]}const i=t.primary||vd(e,t.entities)[0];return i&&!i.startsWith("light.")?[]:t.entities.filter(t=>t.startsWith("light.")&&!!e.states?.[t]).map(e=>({eid:e,via:"light"}))}const Md=new WeakMap,Rd=new WeakMap;function Cd(e){return e.map(e=>[e.id||"",!0===e.hidden?1:0,e.primary||"",[...e.entities].join(","),void 0===e.controls?"":[...e.controls].join(","),e.marker?.id||"",e.marker?.binding||"",e.marker?.is_light,e.marker?.tap_action||"",!0===e.marker?.removed?1:0,e.marker?.light_entity||"",null==e.marker?.controls?"":[...e.marker.controls].join(",")].join("")).join("")}function Td(e){const t=Cd(e),i=Md.get(e);if(i?.fingerprint===t)return i;const n=e.filter(e=>!e.hidden),r=new Map,o=new Map;for(const t of e){o.set(t,wd(t.marker?.binding,t.marker?.controls??t.controls,t.entities));const e=t.hidden||!0!==t.marker?.is_light?null:t.marker?.id||t.id;e&&r.set(String(e),t)}const s=new Map;for(const t of e){const e=o.get(t)||[],i=new Set(void 0===t.controls?e.filter(Dn):t.controls.filter(Dn)),n=Sd(t),a=i.size?[...i]:n?[n]:[];for(const i of e){if(!i.startsWith("marker:"))continue;const e=i.slice(7);if(!e||e===String(t.marker?.id||t.id||""))continue;if(!r.has(e))continue;const n=s.get(e)||{markerId:e,controllers:[],driverEids:[]};n.controllers.push({device:t,driverEids:[...a]}),n.driverEids=[...new Set([...n.driverEids,...a])],s.set(e,n)}}const a={fingerprint:t,visible:n,markerById:r,persistedByDevice:o,incomingByMarker:s};return Md.set(e,a),a}function Dd(e){return Td(e).incomingByMarker}function Ad(e,t){const i=bd(t.marker?.binding,t.controls??t.marker?.controls,t.entities),n=wd(t.marker?.binding,t.marker?.controls??t.controls,t.entities);return(null!=t.marker?.is_light||!i.length&&!n.some(e=>e.startsWith("marker:")))&&$d(e,t).length>0}function Pd(e,t){return $d(e,t).some(e=>!!e.eid)}function Fd(e,t,i,n){const r="always"===e||"auto"===e&&t,o=r&&!i;return{sourceExists:r,fromSourceEnabled:r&&i,manualEnabled:r,radiusEnabled:r,passive:o,effectiveMode:o&&"auto"===n?"fixed":n}}function zd(e,t){const i=bd(t.marker?.binding,t.controls??t.marker?.controls,t.entities).map(e=>({eid:e,via:"controls"})),n=Ad(e,t)?$d(e,t):[];for(const e of n)e.eid&&i.some(t=>t.eid===e.eid)||i.push(e);return i}function Id(e,t,i,n){if(null!=i)return Id(e,t,null,n).filter(e=>kd(e.device,i));const r=Cd(t),o=function(e,t){const i=new Set;for(const e of t){for(const t of e.entities)i.add(t);for(const t of e.controls||e.marker?.controls||[])"string"!=typeof t||t.startsWith("marker:")||i.add(t)}return[...i].sort().map(t=>`${t}:${e?.states?.[t]?.state??""}`).join("|")}(e,t),s=Hh(n),a=Rd.get(t);if(a?.graphFingerprint===r&&a.stateFingerprint===o&&a.virtualLightFingerprint===s&&a.registry===e?.entities)return a.sources;const{visible:l,markerById:c,persistedByDevice:h,incomingByMarker:d}=Td(t),u=null==i?l:l.filter(e=>kd(e,i)),p=new Map,_=new Map;for(const t of u){const i=zd(e,t).filter(e=>"controls"!==e.via);for(const n of i){const i=!0===t.marker?.is_light?String(t.marker?.id||t.id||""):"",r=i?`marker:${i}`:`entity:${n.eid}`,o=n.eid?[n.eid]:[],s={key:r,eid:n.eid||"",stateEids:o,serviceEids:o,device:t,via:n.via,castsGlow:!0,passive:!n.eid,on:!n.eid||"on"===e.states?.[n.eid]?.state};p.set(t,[...p.get(t)||[],s]),n.eid&&_.set(n.eid,s)}}const m=new Map;for(const e of t){const t=h.get(e)||[],i=new Set(void 0===e.controls?t.filter(Dn):e.controls);m.set(e,i)}for(const t of p.values())for(const i of t){if(!i.passive)continue;const t=i.key.slice(7),r=d.get(t);i.on=!r||r.driverEids.some(t=>"on"===e.states?.[t]?.state),!r&&Lh(i.device.marker)&&(i.on=Bh(i.device.marker,n))}const g=new Map,f=e=>{const t=g.get(e.key);(!t||e.castsGlow&&!t.castsGlow)&&g.set(e.key,e)};for(const t of l){const n=h.get(t)||[],r=null==i||kd(t,i);for(const i of n){if(i.startsWith("marker:")){const e=c.get(i.slice(7)),t=e?p.get(e):null;if(t)for(const e of t)f(e);continue}if(!Dn(i)||!m.get(t)?.has(i))continue;const n=_.get(i);n?f(n):r&&f({key:`entity:${i}`,eid:i,stateEids:[i],serviceEids:[i],device:t,via:"controls",castsGlow:!1,passive:!1,on:"on"===e.states?.[i]?.state})}for(const e of p.get(t)||[])f(e)}const v=[...g.values()];return Rd.set(t,{graphFingerprint:r,stateFingerprint:o,virtualLightFingerprint:s,registry:e?.entities,sources:v}),v}function Od(e){const t=e.filter(e=>e.castsGlow);return t.find(e=>e.on)||t[0]||null}function Ed(e){return e.length?e.some(e=>e.on)?"on":"off":"none"}function Nd(e,t){const i=[];for(const n of t){const t=e.states[n];if(!t)continue;const r=(t.attributes?.unit_of_measurement||"").toLowerCase();if(/_(linkquality|lqi)$/.test(n)||"lqi"===r){const e=parseFloat(t.state);isNaN(e)||i.push(e);continue}const o=t.attributes?.linkquality??t.attributes?.lqi;if(null!=o){const e=parseFloat(o);isNaN(e)||i.push(e)}}return Ii(i)}function Hd(e,t){for(const i of t){if(!md(e,i))continue;const t=e.states[i];if(!t)continue;const n=parseFloat(t.state);if(!isNaN(n))return Math.round(10*n)/10}return null}function Ld(e,t){for(const i of t){if(!i.startsWith("climate."))continue;const t=e.states[i];if(!t||"unavailable"===t.state||"unknown"===t.state)continue;const n=parseFloat(t.attributes?.current_temperature);if(Number.isFinite(n))return Math.round(10*n)/10}return null}function Bd(e,t){if(e.entities?.[t]?.entity_category)return!1;const i=e.states[t];if(!i)return/_humidity$/.test(t);const n=i.attributes||{};return"humidity"===n.device_class||"%"===n.unit_of_measurement&&/_humidity$/.test(t)||/_humidity$/.test(t)}function qd(e,t){for(const i of t){if(!Bd(e,i))continue;const t=e.states[i];if(!t)continue;const n=parseFloat(t.state);if(!isNaN(n))return Math.round(n)}return null}function jd(e,t){if(!t)return[];const i=[];for(const[t,n]of Object.entries(e.entities)){if(!t.startsWith("light.")||n.hidden||!rd(n))continue;let r=null;if("group"===n.platform)r=n.area_id||null;else{if(!n.device_id)continue;{const t=e.devices[n.device_id];if(!rd(t))continue;if("Group"!==t?.model)continue;r=t.area_id||n.area_id||null}}if(!r)continue;const o=e.states[t];i.push({eid:t,name:n.name||o?.attributes?.friendly_name||t,area:r})}return i}function Wd(e,t,i,n,r){const o=qe(t,i,r);if(o!==Be)return o;const s=[];for(const t of n){const i=e.states[t]?.attributes?.device_class;i&&s.push(i)}return function(e){for(const t of e){const e=Le[t];if(e)return e}return null}(s)??Be}function Ud(e,t){return e.map(e=>{if(!Array.isArray(e.controls))return e;const i=e.controls.filter(e=>!("string"==typeof e&&e.startsWith("marker:")&&t.has(e.slice(7))));return i.length===e.controls.length?e:{...e,controls:i.length?i:null}})}function Gd(e,t,i){if(!t||!i||t===i)return[...e];const n=`marker:${t}`,r=`marker:${i}`;return e.map(e=>{const t=Array.isArray(e.controls)?e.controls.map(e=>e===n?r:e):e.controls,i="derived_marker_state"===e.value_badge?.source?.kind&&e.value_badge.source.ref===n?{...e.value_badge,source:{...e.value_badge.source,ref:r}}:e.value_badge,o="derived_marker_state"===e.value_source?.kind&&e.value_source.ref===n?{...e.value_source,ref:r}:e.value_source;return t===e.controls&&i===e.value_badge&&o===e.value_source?e:{...e,controls:t,...void 0!==i?{value_badge:i}:{},...void 0!==o?{value_source:o}:{}}})}function Vd(e,t,i){if(!t||t===i)return!0;const n=new Map;for(const t of e)n.set(t.id,(t.controls||[]).filter(e=>"string"==typeof e&&e.startsWith("marker:")).map(e=>e.slice(7)));const r=new Set,o=[i];for(;o.length;){const e=o.pop();if(e===t)return!0;r.has(e)||(r.add(e),o.push(...n.get(e)||[]))}return!1}function Kd(e,t,i,n){const r=new Set([t]),o=e.filter(e=>{const o=e.id===t||!n&&e.binding===i;return o&&r.add(e.id),!o});return{markers:n?o:[...o,{id:t,binding:i,removed:!0,hidden:!0}],cleanupIds:r}}function Yd(e){const t=new Set,i=new Set,n=new Set;for(const r of e||[]){const e=String(r.binding||"").indexOf(":");if(e<1)continue;const o=r.binding.slice(0,e),s=r.binding.slice(e+1);s&&(!0===r?.removed?"device"===o?t.add(s):"entity"===o&&i.add(s):"entity"===o&&n.add(s))}return{devices:t,entities:i,liveEntities:n}}function Xd(e,t,i){if(i.liveEntities.has(t))return!1;if(i.entities.has(t))return!0;const n=e?.entities?.[t]?.device_id;return!!n&&i.devices.has(n)}function Zd(e,t,i,n,r){const o=bd(t.binding,t.controls,e.entities).filter(e=>!Xd(i,e,n)).filter(e=>"active"===cd(i,"entity:"+e,r).kind);e.marker=t,e.controls=o,e.userHidden=!0===t.hidden,e.hidden=e.userHidden||"ha_disabled"===e.bindingStatus?.kind,t.name&&(e.name=t.name),t.icon&&(e.icon=t.icon),null!=t.model&&(e.model=t.model),e.link=t.link??null,e.description=t.description??null,e.pdfs=t.pdfs||[],e.tapAction=t.tap_action??null}function Jd(e){const t=e.hass,i=e.registry||td(t),n=od(t,i),r=sd(t,i),{areaToSpace:o,markers:s,settings:a,excluded:l,iconRules:c}=e,h=!1!==a.group_lights,d=Yd(s),u=jd(n,h).filter(e=>!Xd(n,e.eid,d)),p=new Set(u.map(e=>e.area)),_=dd(n),m=ud(s,r),g=new Set(s.map(e=>e.binding)),f=[];for(const e of Object.values(n.devices)){const r=e.area_id;if(!r||!o[r])continue;if("service"===e.entry_type)continue;if(g.has("device:"+e.id))continue;if("active"!==cd(t,"device:"+e.id,i).kind)continue;const s=pd(n,e.id,_[e.id]||[],m);if(s.partial&&!s.entityIds.length)continue;const a=s.entityIds,d=_d(n,e,a);let u=l.has(d)||"Group"===e.model||/scene/i.test(e.model||"")||/bridge/i.test((e.model||"")+(e.name||""))||"myheat"===d&&!!e.via_device_id;if(!u&&h&&p.has(r)){const t=(e.name_by_user||e.name||"").trim();"mdi:lightbulb"===Wd(n,t,e.model,a,c)&&(u=!0)}u&&f.push("device:"+e.id)}return f}function Qd(e,t,i,n){if("string"==typeof e.room_id&&e.room_id.length>0&&null===e.area)return{area:"",space:e.space||n};const r=e.area||t||"";return{area:r,space:r&&i[r]||e.space||n}}function eu(e){const t=e.hass,i=e.registry||td(t),n=od(t,i),r=sd(t,i),{areaToSpace:o,markers:s,settings:a,excluded:l,showAll:c,firstSpaceId:h,loc:d,iconRules:u}=e,p=!1!==a.group_lights,_=Yd(s),m=jd(n,p).filter(e=>!Xd(n,e.eid,_)),g=new Set(m.map(e=>e.area)),f=dd(n),v=function(e){const t={};for(const[i,n]of Object.entries(e.entities||{}))n?.device_id&&(t[n.device_id]=t[n.device_id]||[]).push(i);return t}(r),y=ud(s,r),b=new Set;for(const e of s){const[t,i]=e.binding.split(":");"device"!==t&&"entity"!==t||!i||b.add(e.binding)}const w=(e,t)=>s.find(i=>i.binding===e+":"+t),k={},x=[];for(const e of Object.values(n.devices)){const r=e.area_id;if(!r||!o[r])continue;if("service"===e.entry_type)continue;if(b.has("device:"+e.id))continue;const s=cd(t,"device:"+e.id,i);if("active"!==s.kind)continue;const h=w("device",e.id);if(h&&h.hidden&&!a.filter_seeded)continue;const _=pd(n,e.id,f[e.id]||[],y);if(_.partial&&!_.entityIds.length)continue;const m=_.entityIds,v=_.partial?{kind:"active",enabledEntityIds:m,allEntityIds:m}:s,S=_d(n,e,m),$=!a.filter_seeded;if($&&!c){if(l.has(S))continue;if("Group"===e.model)continue;if(/scene/i.test(e.model||""))continue;if(/bridge/i.test((e.model||"")+(e.name||"")))continue;if("myheat"===S&&e.via_device_id)continue}const M=(e.name_by_user||e.name||d("device.unnamed")).trim(),R=M+"|"+r;let C=Wd(n,M,e.model,m,u);if(m.some(e=>e.startsWith("lock."))&&(C="mdi:lock"),$&&!c&&p&&"mdi:lightbulb"===C&&g.has(r))continue;k[R]=(k[R]||0)+1;const T=k[R]>1?M+" "+k[R]:M,D={id:e.id,name:T,model:e.model||"",area:r,space:o[r],icon:C,entities:m,allEntities:v.allEntityIds,bindingStatus:v,bindingKind:"device",bindingRef:e.id,pdfs:[]};D.primary=yd(n,m,C),"mdi:thermometer"!==C&&"mdi:air-filter"!==C||(D.temp=Hd(n,m)),D.primary&&Bd(n,D.primary)&&(D.hum=qd(n,m)),x.push(D)}for(const e of m)o[e.area]&&(b.has("entity:"+e.eid)||x.push({id:"lg_"+e.eid,name:e.name,model:d("device.light_group"),area:e.area,space:o[e.area],icon:"mdi:lightbulb-group",entities:[e.eid],allEntities:[e.eid],bindingStatus:{kind:"active",enabledEntityIds:[e.eid],allEntityIds:[e.eid]},primary:e.eid,bindingKind:"entity",bindingRef:e.eid,pdfs:[]}));for(const e of s){if(e.removed)continue;const[s,l]=e.binding.split(":"),c="device"===s||"entity"===s?cd(t,e.binding,i):null;if(!e.hidden||a.filter_seeded||"ha_disabled"===c?.kind)if("device"===s){const t=c;if("unverified"===t.kind)continue;const s=r.devices[l],{area:a,space:p}=Qd(e,s?.area_id,o,h),m="active"===t.kind?t.enabledEntityIds:[];let g=s?Wd(n,s.name_by_user||s.name||"",s.model,m,u):"mdi:help-circle";m.some(e=>e.startsWith("lock."))&&(g="mdi:lock");const f={id:e.id,name:s?.name_by_user||s?.name||d("device.fallback"),model:s?.model||"",area:a,space:p,icon:g,entities:m,allEntities:t.allEntityIds.length?t.allEntityIds:s&&v[s.id]||[],bindingStatus:t,bindingKind:"device",bindingRef:l};f.primary=yd(n,m,g),"mdi:thermometer"!==g&&"mdi:air-filter"!==g||(f.temp=Hd(n,m)),f.primary&&Bd(n,f.primary)&&(f.hum=qd(n,m)),Zd(f,e,r,_,i),x.push(f)}else if("entity"===s){if(Xd(r,l,_))continue;const t=c;if("unverified"===t.kind)continue;const s=r.entities[l],a=s?.area_id||s?.device_id&&r.devices[s.device_id]?.area_id||"",{area:d,space:p}=Qd(e,a,o,h),m=n.states[l],g=s?.name||m?.attributes?.friendly_name||l;let f=Wd(n,g,"",[l],u);l.startsWith("lock.")&&(f="mdi:lock");const v={id:e.id,name:g,model:"",area:d,space:p,icon:f,entities:"active"===t.kind?[l]:[],allEntities:[l],bindingStatus:t,primary:"active"===t.kind?l:void 0,bindingKind:"entity",bindingRef:l};"mdi:thermometer"!==f&&"mdi:air-filter"!==f||!v.entities.length||(v.temp=Hd(n,v.entities)),v.entities.length&&Bd(n,l)&&(v.hum=qd(n,v.entities)),Zd(v,e,r,_,i),x.push(v)}else{const t=e.area||"",n=e.space||t&&o[t]||h,s={id:e.id,name:e.name||d("device.virtual"),model:e.model||"",area:t,space:n,icon:e.icon||"mdi:map-marker",entities:[],allEntities:[],bindingStatus:{kind:"active",enabledEntityIds:[],allEntityIds:[]},bindingKind:"virtual",virtual:!0};Zd(s,e,r,_,i),x.push(s)}}return x}function tu(e){const{marker:t,siblingMarkers:i=[],...n}=e;return eu({...n,markers:[...i.filter(e=>e.id!==t.id),t]}).find(e=>e.id===t.id)||null}function iu(e,t,i,n){if(!t)return null;if(function(e,t,i){if(!t)return!1;const n=t.indexOf(":");if(n<1)return!1;const r=t.slice(0,n),o=t.slice(n+1),s=Yd(i);return"device"===r?s.devices.has(o):"entity"===r&&Xd(e,o,s)}(e,t,n))return null;const r=t.indexOf(":");if(r<0)return null;const o=t.slice(0,r),s=t.slice(r+1);if(!s)return null;if("entity"===o){const t=parseFloat(e.states[s]?.state);return Number.isFinite(t)?"temp"===i?Math.round(10*t)/10:Math.round(t):null}if("device"===o){const t=Object.entries(e.entities).filter(([,e])=>e.device_id===s).map(([e])=>e);return"temp"===i?Hd(e,t):qd(e,t)}return null}const nu=new RegExp(["water","voda","coolant","flow_?temp","return_?temp","target","setpoint","chip","cpu","processor","board","core_temp","device_temp","batter","akkum","freezer","fridge","oven","kettle","boiler"].join("|"),"i");function ru(e,t){return t.area?t.area:e&&t.id?`@room/${encodeURIComponent(e)}/${encodeURIComponent(t.id)}`:null}function ou(e){return null==e.area&&e.space&&e.room_id?ru(e.space,{id:e.room_id,area:null}):e.area||null}function su(e){const t=e?.exclude_integrations;return t?new Set(t):Ie}function au(e,t,i,n=Ie){const r=new Map;if(!e?.entities)return r;const o=Yd(i),s=new Set,a=new Map,l=new Map;for(const e of i||[]){if(e?.removed)continue;const t=(e.binding||"").indexOf(":");if(t<=0)continue;const i=e.binding.slice(0,t),n=e.binding.slice(t+1);if(!n)continue;!0===e.use_climate_temp&&s.add(n);const r=ou(e);r&&("entity"!==i||a.has(n)?"device"!==i||l.has(n)||l.set(n,r):a.set(n,r))}const c=new Map;for(const[t,i]of Object.entries(e.entities)){if(i.device_id&&o.devices.has(i.device_id)&&!o.liveEntities.has(t)||!i.device_id&&o.entities.has(t)&&!o.liveEntities.has(t))continue;const r=i.device_id?e.devices?.[i.device_id]:null;if(!rd(i)||r&&!rd(r))continue;const h=a.get(t)||(i.device_id?l.get(i.device_id):null)||i.area_id||r?.area_id||null;if(!h)continue;if(i.entity_category)continue;if(!(s.size>0&&t.startsWith("climate.")&&(s.has(t)||i.device_id&&s.has(i.device_id)))){if(n.has(i.platform))continue;if(nu.test(t))continue}let d=c.get(h);d||(d=new Map,c.set(h,d));const u=i.device_id||t;let p=d.get(u);if(!p){const n=e.states?.[t];p={name:(r?r.name_by_user||r.name:i.name||n?.attributes?.friendly_name||t)||t,model:r?.model,ents:[]},d.set(u,p)}p.ents.push(t)}for(const[i,n]of c){const o=[],a=[];for(const[i,r]of n){const n=Wd(e,r.name,r.model,r.ents,t),l="mdi:thermometer"===n||"mdi:air-filter"===n;if(l){const t=Hd(e,r.ents);null!=t&&o.push(t)}if(s.size>0&&(s.has(i)||r.ents.some(e=>s.has(e)))){const t=Ld(e,r.ents);null!=t&&o.push(t)}if(l||"mdi:water-percent"===n){const t=qd(e,r.ents);null!=t&&a.push(t)}}(o.length||a.length)&&r.set(i,{temp:o.length?Math.round(o.reduce((e,t)=>e+t,0)/o.length*10)/10:null,hum:a.length?Math.round(a.reduce((e,t)=>e+t,0)/a.length):null})}return r}function lu(e,t,i){const n=[];for(const r of t){if(r.area!==i||r.virtual)continue;const t=Nd(e,r.entities);null!=t&&n.push(t)}return Ii(n)}const cu={offStates:["off"],unknownUsesToggle:!0},hu={light:cu,switch:cu,fan:cu,humidifier:cu,input_boolean:cu,automation:cu,remote:cu,group:cu,climate:{...cu,featureMasks:{turn_on:256,turn_off:128,toggle:384}},media_player:{...cu,featureMasks:{turn_on:128,turn_off:256,toggle:384}},siren:{...cu,featureMasks:{turn_on:1,turn_off:2,toggle:3}},vacuum:{...cu,featureMasks:{turn_on:1,turn_off:2,toggle:3}},water_heater:{...cu,featureMasks:{turn_on:8,turn_off:8,toggle:8}},camera:{...cu,featureMasks:{turn_on:1,turn_off:1,toggle:1}}};function du(e){return e.slice(0,e.indexOf("."))}function uu(e,t,i){if(!e?.services||"object"!=typeof e.services)return!1;const n=e.services?.[t];return!!n&&Object.prototype.hasOwnProperty.call(n,i)}function pu(e,t,i){return uu(e,t,i)?{domain:t,service:i}:uu(e,"homeassistant",i)?{domain:"homeassistant",service:i}:null}function _u(e,t){return e?.entities?.[t]||null}function mu(e,t,i){const n=e?.states?.[i],r=_u(t,i);return n?.attributes?.friendly_name||r?.name||r?.original_name||i}function gu(e,t){const i=_u(e,t);if(null!=i?.disabled_by)return!0;const n=i?.device_id?e?.devices?.[i.device_id]:null;return null!=n?.disabled_by}function fu(e,t){const i=e?.attributes?.supported_features;if(null==i||""===i)return!1;const n=Number(i);return Number.isFinite(n)&&(n&t)===t}function vu(e,t,i){const n=du(i);if("lock"===n||"alarm_control_panel"===n)return!0;if("cover"!==n)return!1;const r=e?.states?.[i],o=_u(t,i),s=String(r?.attributes?.device_class||o?.device_class||o?.original_device_class||"");return Wi.has(s)}function yu(e,t,i,n,r){return{ref:i,entityId:n,name:n?mu(e,t,n):null,reason:r}}function bu(e,t,i,n,r,o=null){return{target:null,skipped:yu(e,t,i,n,r),semantics:o,nextEffect:null,command:null}}function wu(e,t,i,n,r=i){const o=du(i);if("cover"!==o&&"valve"!==o)return function(e,t,i,n,r=i){const o=du(i),s=e?.states?.[i];if(gu(t,i))return bu(e,t,r,i,"ha-disabled","power");if(vu(e,t,i))return bu(e,t,r,i,"secure");if(!s)return bu(e,t,r,i,"missing","power");if("unavailable"===s.state)return bu(e,t,r,i,"unavailable","power");const a=hu[o];if(!a)return bu(e,t,r,i,"unsupported");let l,c;if("unknown"===s.state||""===s.state){if(!a.unknownUsesToggle)return bu(e,t,r,i,"unsupported","power");l="toggle",c="toggle"}else a.offStates.includes(String(s.state))?(l="turn-on",c="turn_on"):(l="turn-off",c="turn_off");const h=a.featureMasks?.[c];if(h&&!fu(s,h))return bu(e,t,r,i,"unsupported","power");const d=pu(e,o,c);return d?{target:{entityId:i,name:mu(e,t,i),state:String(s.state||""),via:n},skipped:null,semantics:"power",nextEffect:l,command:{...d,data:{entity_id:i}}}:bu(e,t,r,i,"unsupported","power")}(e,t,i,n,r);if(gu(t,i))return bu(e,t,r,i,"ha-disabled",o);if(vu(e,t,i))return bu(e,t,r,i,"secure",o);const s=e?.states?.[i];if(!s)return bu(e,t,r,i,"missing",o);if("unavailable"===s.state)return bu(e,t,r,i,"unavailable",o);const a=function(e,t,i){const n=String(i?.state||""),r="closed"===n?{service:`open_${t}`,effect:"open",feature:1}:"open"===n?{service:`close_${t}`,effect:"close",feature:2}:"opening"===n||"closing"===n?{service:`stop_${t}`,effect:"stop",feature:8}:null;return r&&fu(i,r.feature)&&uu(e,t,r.service)?r:fu(i,3)&&uu(e,t,"toggle")?{service:"toggle",effect:"toggle"}:null}(e,o,s);if(!a)return bu(e,t,r,i,"unsupported",o);return{target:{entityId:i,name:mu(e,t,i),state:String(s.state||""),via:n},skipped:null,semantics:o,nextEffect:a.effect,command:{domain:o,service:a.service,data:{entity_id:i}}}}function ku(e){return"entity"===e.bindingKind?e.bindingRef&&Dn(e.bindingRef)?[e.bindingRef]:[]:"virtual"===e.bindingKind?[]:xd(e)}function xu(e){const t=e.marker?.toggle_entity;return t&&ku(e).includes(t)?t:null}function Su(e,t,i){const n=function(e,t){if("entity"===e.bindingKind&&e.bindingRef){const t=e.marker?.light_entity?Sd(e):null;return[...new Set([t,e.bindingRef].filter(e=>!!e))]}const i=e.entities.length?e.entities:e.allEntities||[],n=e.marker?.light_entity||e.primary&&Dn(e.primary)?Sd(e):null;return[...new Set([n,...vd(t,i)].filter(e=>!!e))]}(i,t);if(!n.length)return null;const r="entity"===i.bindingKind?"binding":"device-role";if("binding"===r)return wu(e,t,n[0],r);let o=null,s=null;for(const i of n){const n=wu(e,t,i,r);if(n.command)return n;const a=n.skipped?.reason;if("missing"===a||"unavailable"===a||"secure"===a)return n;"ha-disabled"!==a?o||=n:s||=n}return o||s}function $u(e){const t=e.skipped?.reason;return"missing"===t?"unavailable":t||"unsupported"}function Mu(e,t){return{origin:e,kind:"none",semantics:null,targets:[],skippedTargets:[],noneReason:t,nextEffect:null,command:null}}function Ru(e,t){return"cover"===e||"toggle"===e?"toggle":"more-info"===e||"run"===e||"info"===e||"none"===e?e:(null==e||""===e)&&"light"===t?"toggle":"info"}function Cu(e,t){return{origin:e,kind:"single",semantics:t.semantics,targets:t.target?[t.target]:[],skippedTargets:t.skipped?[t.skipped]:[],noneReason:t.command?null:$u(t),nextEffect:t.nextEffect,command:t.command}}function Tu(e,t,i,n=[]){const r=new Map,o=[],s=new Set,a=e=>{const t=`${e.ref}\n${e.entityId||""}\n${e.reason}`;s.has(t)||(s.add(t),o.push(e))};for(const e of n)a(e);for(const n of i){const i=wu(e,t,n.entityId,n.via,n.ref);i.target?r.set(n.entityId,r.get(n.entityId)||i.target):i.skipped&&a(i.skipped)}const l=[...r.values()];if(!l.length)return{origin:"explicit-toggle",kind:"group",semantics:"group-power",targets:l,skippedTargets:o,noneReason:o.length&&o.every(e=>"secure"===e.reason)?"secure":"configured-targets-missing",nextEffect:null,command:null};const c=l.some(e=>"on"===e.state)?"turn_off":"turn_on",h=pu(e,"homeassistant",c);return h?{origin:"explicit-toggle",kind:"group",semantics:"group-power",targets:l,skippedTargets:o,noneReason:null,nextEffect:"turn_on"===c?"turn-on":"turn-off",command:{...h,data:{entity_id:l.map(e=>e.entityId)}}}:{origin:"explicit-toggle",kind:"group",semantics:"group-power",targets:[],skippedTargets:[...o,...l.map(i=>yu(e,t,i.entityId,i.entityId,"unsupported"))],noneReason:"unsupported",nextEffect:null,command:null}}function Du(e){return String(e.marker?.id||e.id||"")}function Au(e){const{hass:t,device:i}=e,n=e.registryHass||t,r=function(e){return"toggle"===e.tapAction?"explicit-toggle":"cover"===e.tapAction?"legacy-cover":!e.tapAction&&e.primary?.startsWith("light.")?"default-light":null}(i);if(!r)return null;const o=i.marker;if("explicit-toggle"===r&&Lh(o)){const t=String(o?.id||i.id||""),n=Dd(e.devices).get(t);if(n)return function(e,t){const i=e.registryHass||e.hass;return Tu(e.hass,i,t.driverEids.map(e=>({entityId:e,via:"control-marker-driver",ref:`marker:${t.markerId}`})))}(e,n);const s=Bh(o,e.virtualLights);return{origin:r,kind:"single",semantics:"power",targets:[{entityId:"",name:i.name,state:s?"on":"off",via:"virtual-light"}],skippedTargets:[],noneReason:null,nextEffect:s?"turn-off":"turn-on",command:null,operation:{kind:"virtual-light",markerId:o.id}}}if("explicit-toggle"===r){if(wd(i.marker?.binding,i.marker?.controls??i.controls,i.entities).length)return function(e,t=null){const{hass:i,device:n,devices:r}=e,o=e.registryHass||i,s=wd(n.marker?.binding,n.marker?.controls??n.controls,n.entities),a=e.lightSources||Id(i,r,null,e.virtualLights),l=new Map;for(const e of a){if(!e.key.startsWith("marker:"))continue;const t=l.get(e.key)||[];t.push(e),l.set(e.key,t)}const c=Dd(r),h=new Map;for(const e of r){const t=String(e.marker?.id||e.id||"");t&&h.set(t,e)}const d=[],u=[];t&&d.push({entityId:t,via:"entity"===n.bindingKind?"binding":"device-role",ref:t});for(const e of s){if(!e.startsWith("marker:")){Dn(e)?d.push({entityId:e,via:"control-entity",ref:e}):u.push(yu(i,o,e,e.includes(".")?e:null,"unsupported"));continue}const t=l.get(e)||[];if(!t.length){const t=h.get(e.slice(7));if("ha_disabled"===t?.bindingStatus?.kind){const n=t.bindingStatus.allEntityIds[0]||null;u.push({ref:e,entityId:n,name:t.name||(n?mu(i,o,n):null),reason:"ha-disabled"})}else u.push(yu(i,o,e,null,"missing"));continue}const r=[...new Set(t.flatMap(e=>e.serviceEids))];if(r.length){for(const t of r)d.push({entityId:t,via:"control-entity",ref:e});continue}const s=t.some(e=>e.passive),a=e.slice(7),p=Du(n),_=c.get(a)?.controllers.find(e=>Du(e.device)===p);if(s&&_?.driverEids.length)for(const t of _.driverEids)d.push({entityId:t,via:"control-marker-driver",ref:e});else u.push(yu(i,o,e,null,s?"missing":"unsupported"))}return Tu(i,o,d,u)}(e,xu(i))}if("legacy-cover"===r){const e=i.entities.find(e=>e.startsWith("cover."))||i.allEntities?.find(e=>e.startsWith("cover."));return e?Cu(r,wu(t,n,e,"device-role")):Mu(r,"no-actionable-entity")}const s=xu(i),a=s?wu(t,n,s,"entity"===i.bindingKind?"binding":"device-role"):Su(t,n,i);return a?Cu(r,a):Mu(r,i.virtual||"virtual"===i.bindingKind?"no-actionable-entity":"no-binding")}function Pu(e){if(!e)return[];const t=Array.isArray(e.data.entity_id)?e.data.entity_id:[e.data.entity_id];return[...new Set(t)].sort()}function Fu(e){return e?e.operation?e.operation:e.command?{kind:"ha-service",command:e.command}:null:null}const zu=new Set(["missing","ha-disabled","unavailable"]);function Iu(e,t){const i=Fu(e),n=Fu(t);return!(!i||!n||i.kind!==n.kind)&&("virtual-light"===i.kind&&"virtual-light"===n.kind?i.markerId===n.markerId:"ha-service"===i.kind&&"ha-service"===n.kind&&function(e,t){const i=Pu(e),n=Pu(t);return i.length===n.length&&i.every((e,t)=>e===n[t])}(i.command,n.command))}function Ou(e,t){const i=e.targets[0]||e.skippedTargets[0],n=[];return"group"===e.kind?e.targets.length&&n.push(t.group(e.targets)):i&&n.push(t.single(i)),e.nextEffect&&e.targets.length&&n.push("group"===e.kind?t.groupCurrentNext(e.targets,e.nextEffect):t.currentNext(e.targets[0],e.nextEffect)),e.skippedTargets.length&&n.push(t.skipped(e.skippedTargets)),!e.command&&e.noneReason&&n.push(t.none(e.noneReason)),n}function Eu(e,t){return e.catch(()=>{}).then(t)}const Nu=e=>{const t=e?.config;return t&&Array.isArray(t.spaces)?t:null},Hu=(e,t)=>"number"==typeof e&&Number.isFinite(e)?e:t;class Lu{constructor(e){this.onBodyReplaced=e,this.config=null,this.configRev=0,this.configFingerprint="",this.layout={},this.layoutRev=0,this.layoutFingerprint=""}setConfig(e){const t=this.config;e!==t&&(this.config=e,this.onBodyReplaced?.("_serverCfg",t))}setLayout(e){const t=this.layout;e!==t&&(this.layout=e,this.onBodyReplaced?.("_layout",t))}currentConfigFingerprint(){return this.configFingerprint||ac(this.config)}currentLayoutFingerprint(){return this.layoutFingerprint||ac(this.layout)}adoptResponses(e,t,i,n){const r=Nu(e),o=ac(r),s=o!==this.currentConfigFingerprint();s&&(i(),this.setConfig(r),this.configFingerprint=o),this.configRev=e?.rev??this.configRev;let a=!1;if(void 0!==t){const e=t?.layout??{},i=ac(e);a=i!==this.currentLayoutFingerprint(),a&&(n(),this.setLayout(e),this.layoutFingerprint=i),this.layoutRev=t?.rev??this.layoutRev}return{configChanged:s,layoutChanged:a}}adoptMergedLayout(e,t,i){const n=ac(e),r=n!==ac(this.layout);return r&&(i?.(),this.setLayout(e)),this.layoutFingerprint=n,this.layoutRev=t?.rev??this.layoutRev,r}stageConfigCandidate(e){const t=ac(e);t!==ac(this.config)&&this.setConfig(e),this.configFingerprint=t}acceptConfigWrite(e,t){this.configFingerprint=ac(e),this.configRev=Hu(t?.rev,this.configRev+1)}acceptPairWrite(e,t,i){this.setConfig(e),this.configFingerprint=ac(e),this.setLayout(t),this.layoutFingerprint=ac(t),this.configRev=Hu(i?.config_rev,this.configRev+1),this.layoutRev=Hu(i?.layout_rev,this.layoutRev+1)}noteLayoutRevision(e){"number"==typeof e&&e>this.layoutRev&&(this.layoutRev=e)}stageLocalConfig(e){this.setConfig(e)}stageLocalLayout(e){this.setLayout(e)}seedIdentity(e){Object.assign(this,e)}refreshConfigFingerprint(){this.configFingerprint=ac(this.config)}refreshLayoutFingerprint(){this.layoutFingerprint=ac(this.layout)}beginOptimistic(e,t){return function(e,t,i,n,r){return{previous:JSON.parse(JSON.stringify(e)),previousFingerprint:i,revision:n,attempted:t,attemptedFingerprint:r(t)}}(e,t,this.configFingerprint,this.configRev,ac)}rollbackOptimistic(e){const t=this.config;return!(!t||this.configRev!==e.revision||ac(t)!==e.attemptedFingerprint)&&(this.setConfig(e.previous),this.configFingerprint=e.previousFingerprint,!0)}restoreCached(e){const t=e?.config;return!(!t||!Array.isArray(t.spaces))&&(this.setConfig(t),this.configRev=e?.rev||0,this.configFingerprint=e?.config_fingerprint||ac(t),this.setLayout(e?.layout||{}),this.layoutRev=e?.layout_rev||0,this.layoutFingerprint=e?.layout_fingerprint||ac(this.layout),!0)}snapshot(e){return this.config?(this.refreshConfigFingerprint(),this.refreshLayoutFingerprint(),{config:this.config,rev:this.configRev,config_fingerprint:this.configFingerprint,layout:this.layout,layout_rev:this.layoutRev,layout_fingerprint:this.layoutFingerprint,virtual_lights:e}):null}}async function Bu(e,t){const i=t.isCurrent??(()=>!0);if(!i())return{status:"superseded"};const{cfgResp:n,layResp:r}=t,o=e._adoption,s=Nu(n),a=null!=n&&ac(s)!==o.currentConfigFingerprint()||null!=r&&ac(r.layout??{})!==o.currentLayoutFingerprint();if(a){const t=await e._signer.prepareImage(e.hass,e._candidateBackdrop(s));if(!i())return{status:"superseded"};if(!t)return e._continuity.note("asset-failed"),e._scheduleLoadRetry(!0),{status:"asset-wait"}}if(!i())return{status:"superseded"};a&&e._continuity.hasCompleteFrame&&"steady"===e._continuity.state&&e._beginContinuityCandidate(t.reason,!0),t.beforeAdopt?.();const l=e._space;return function(e,t,i){const n=e._adoption,r=!!n.config,{configChanged:o,layoutChanged:s}=n.adoptResponses(t??{},i,()=>{e._geometryHistory.clear(),e._devicePositionHistory.clear(),e._cancelDeviceDrag(),e._pendingPhysicalWrites.clear(),e._clearRoomFocus(!0),e._cancelCameraTransition(!1),r&&e._clearGeometryGesture()},()=>{e._cancelCameraTransition(!1),e._devicePositionHistory.clear(),e._cancelDeviceDrag()});if(o&&e._seedDecorStyle(n.config),t&&("virtual_lights"in t||"config"in t)){const i=Nh(e._virtualLights,t.virtual_lights,n.configRev,"virtual_lights"in t);Hh(i)!==Hh(e._virtualLights)&&(e._virtualLights=i,e._capturedSnapshotVirtual="")}e._canOptimizeUndo=!(!t?.can_optimize_undo&&!i?.can_optimize_undo),e._adoptConfigCapabilities(t),e._undoKind=t?.undo_kind||i?.undo_kind||null,"boolean"==typeof t?.can_write&&(e._serverCanWrite=t.can_write),o&&e._continuity.note("config-candidate",{configRev:n.configRev}),s&&e._continuity.note("layout-candidate",{layoutRev:n.layoutRev})}(e,n,r),"reload"===t.profile&&(e._syncDecorAssets(s).catch(()=>{}),e._adoptInitialSpace(e._model,!0),e._resumePendingNavMode(),e._cacheSnapshot()),t.afterAdopt?.(),{status:"adopted",spaceChanged:e._space!==l}}const qu=(e,t)=>e.connection===t.connection&&e.userId===t.userId&&e.route===t.route,ju=e=>"number"==typeof e&&Number.isFinite(e)?e:null;class Wu{constructor(){this.sequence=0,this.currentSequence=0,this.lifecycle=0,this.observedHighWater=null,this.context=null}observeContext(e){this.context?qu(this.context,e)||(this.context={...e},this.invalidateLifecycle()):this.context={...e}}invalidateLifecycle(){this.lifecycle+=1,this.currentSequence=++this.sequence,this.observedHighWater=null}observeRevision(e,t,i){this.observeContext(i);const n=ju(e);if(null===n)return null;const r=ju(t)??Number.NEGATIVE_INFINITY;return n<=Math.max(r,this.observedHighWater??Number.NEGATIVE_INFINITY)?null:(this.observedHighWater=n,Object.freeze({sequence:this.currentSequence,lifecycle:this.lifecycle,context:{...i},observedRevision:n}))}isReservationCurrent(e,t,i){this.observeContext(t);const n=ju(i)??Number.NEGATIVE_INFINITY;return e.sequence===this.currentSequence&&e.lifecycle===this.lifecycle&&qu(e.context,t)&&e.observedRevision===this.observedHighWater&&e.observedRevision>n}begin(e){this.observeContext(e.context),e.force&&this.invalidateLifecycle();const t=++this.sequence;return this.currentSequence=t,Object.freeze({sequence:t,lifecycle:this.lifecycle,force:e.force,context:{...e.context},baselineRevision:e.baselineRevision,baselineFingerprint:e.baselineFingerprint})}isCurrent(e){this.observeContext(e.context);const t=e.claim;return e.connected&&(t.force||!e.writePending)&&t.sequence===this.currentSequence&&t.lifecycle===this.lifecycle&&qu(t.context,e.context)&&t.baselineRevision===e.baselineRevision&&t.baselineFingerprint===e.baselineFingerprint}}const Uu=e=>{const t=e.hass,i=t?.user?.id;return{connection:t?.connection??null,userId:"string"==typeof i?i:null,route:location.pathname}};async function Gu(e,t=!1,i){let n=null;const r=e._configReloadAuthority;if(!t){if(void 0!==i&&(n=r.observeRevision(i,e._cfgRev,Uu(e)),!n))return;if(e._saveConfigDebounced.pending()&&e._saveConfigDebounced.flush(),e._cfgWriting)return clearTimeout(e._reloadRetry),void(e._reloadRetry=window.setTimeout(()=>{n&&!r.isReservationCurrent(n,Uu(e),e._cfgRev)||Gu(e,!1)},400))}const o=r.begin({force:t,context:Uu(e),baselineRevision:e._cfgRev,baselineFingerprint:e._adoption.currentConfigFingerprint()}),s=()=>((e,t)=>e._configReloadAuthority.isCurrent({claim:t,context:Uu(e),connected:e.isConnected,baselineRevision:e._cfgRev,baselineFingerprint:e._adoption.currentConfigFingerprint(),writePending:e._saveConfigDebounced.pending()||e._cfgWriting}))(e,o);let a=!1;try{const t=await e._getAuthoritativeConfig();if(!s())return;const i=await e._adoptAuthoritative({cfgResp:t,reason:"config-reload",profile:"reload",isCurrent:s,afterAdopt:()=>{e._regSignature="",e._maybeRebuildDevices()}});if("superseded"===i.status)return;if(a=!0,"adopted"!==i.status)return;i.spaceChanged&&e._restoreZoom(),e.requestUpdate()}catch(t){if(!s())return;a=!0,e._showToast(e._t("toast.cfg_reload_failed",{err:e._errText(t)}))}finally{(a||s())&&(e._continuityDataReady=!0,e.requestUpdate())}}const Vu=e=>!!e&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1]);function Ku(e,t=5,i=5){return Ao(e.cm,t,i)/2}function Yu(e,t,i=1,n=5,r=5,o=0){const s=e.host;if(!s||"partition"!==s.kind||"string"!=typeof s.id||!s.id)return{resolved:null,reason:"invalid-host"};const a=t.find(e=>e.id===s.id);if(!a)return{resolved:null,reason:"missing-partition"};if(!Vu(a.a)||!Vu(a.b)||!Number.isFinite(s.t)||s.t<0||s.t>1)return{resolved:null,reason:"invalid-position"};const l=a.b[0]-a.a[0],c=a.b[1]-a.a[1],h=Math.hypot(l,c),d=Number(e.length)*i;if(!(h>1e-9&&d>0&&Number.isFinite(d)))return{resolved:null,reason:"invalid-length"};const u=s.t*h;if(u-d/2h-o+1e-9)return{resolved:null,reason:"does-not-fit"};const p=l/h,_=c/h;let m=180*Math.atan2(c,l)/Math.PI;return m>=90?m-=180:m<-90&&(m+=180),{reason:null,resolved:{opening:e,host:s,partition:a,center:[a.a[0]+l*s.t,a.a[1]+c*s.t],angle:m,length:d,depth:Ao(a.cm,n,r),t:s.t,axis:{a:[a.a[0],a.a[1]],b:[a.b[0],a.b[1]],ux:p,uy:_,length:h}}}}function Xu(e,t,i=1,n=5,r=5){return Yu(e,t,i,n,r,0)}function Zu(e,t,i=1,n=5,r=5){const o=e.host,s="partition"===o?.kind?t.find(e=>e.id===o.id):void 0;if(!s)return Xu(e,t,i,n,r);const a=Yu(e,t,i,n,r,Ku(s,n,r));return"does-not-fit"===a.reason?{resolved:null,reason:"does-not-fit-jamb"}:a}function Ju(e,t){return!e||(e.length!==t.length||e.host?.kind!==t.host?.kind||e.host?.id!==t.host?.id||e.host?.t!==t.host?.t)}function Qu(e){const{center:t,length:i,axis:n,host:r}=e,o=i/2;return{hostId:r.id,a:[t[0]-n.ux*o,t[1]-n.uy*o],b:[t[0]+n.ux*o,t[1]+n.uy*o],depth:e.depth}}function ep(e,t=!1){const i=t?1:-1,n=e.depth/2;return{ox:-e.axis.uy*i*n,oy:e.axis.ux*i*n,cm:e.partition.cm,side:i}}function tp(e,t,i){return e.flatMap(e=>!Vu(e.a)||!Vu(e.b)||Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])<=1e-9?[]:[{roomId:"",a:[e.a[0],e.a[1]],b:[e.b[0],e.b[1]],key:`partition:${e.id}`,kind:"outer",cm:e.cm,open:!1,half:Ao(e.cm,t,i)/2,partitionHost:{kind:"partition",id:e.id}}])}function ip(e,t,i){const{center:n,length:r,axis:o}=e,s=r/2,a=t.flatMap(e=>{if(!e.kind||e.open)return[];const t=e.b[0]-e.a[0],r=e.b[1]-e.a[1],a=Math.hypot(t,r);if(!(a>i))return[];const l=t/a,c=r/a;if(Math.abs(o.ux*c-o.uy*l)>1e-6)return[];if(Math.abs((n[0]-e.a[0])*c-(n[1]-e.a[1])*l)>i)return[];const h=e=>(e[0]-n[0])*o.ux+(e[1]-n[1])*o.uy,d=h(e.a),u=h(e.b),p=Math.max(-s,Math.min(d,u)),_=Math.min(s,Math.max(d,u));return _>=p-i?[[p,_]]:[]});if(!a.length)return!1;a.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let l=-s;for(const[e,t]of a){if(e>l+i)return!1;if(l=Math.max(l,t),l>=s-i)return!0}return!1}function np(e,t,i=1e-9){const n=e.length/(2*e.axis.length),r=e.t-n,o=e.t+n;return t.some(t=>{if(t.host.id!==e.host.id||t.opening.id===e.opening.id)return!1;const n=t.length/(2*t.axis.length);return Math.max(r,t.t-n)ha-icon{align-self:start;color:var(--hp-accent);}.version-recovery-copy{min-width:0;display:flex;flex-direction:column;gap:var(--sp-2);font-size:var(--fs-m);line-height:1.35;}.version-recovery-copy>span{color:var(--hp-muted);}.version-recovery-versions{display:flex;flex-wrap:wrap;gap:var(--sp-2) var(--sp-5);}.version-recovery-versions span,.version-recovery-versions b{overflow-wrap:anywhere;}.version-recovery-reload{min-height:44px;white-space:normal;}@keyframes hp-version-recovery-in{from{opacity:0;}to{opacity:1;}}@keyframes hp-version-recovery-out{from{opacity:1;}to{opacity:0;}}@media (max-width:520px){.version-recovery-card{grid-template-columns:auto minmax(0,1fr);}.version-recovery-reload{grid-column:1 / -1;width:100%;}}@keyframes fixedfloor-spin{to{transform:rotate(360deg);}}.spacer{flex:1;}.bootveil{position:absolute;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;background:var(--hp-bg,#16212e);opacity:1;transition:opacity 0.15s ease;pointer-events:none;}.bootveil.off{opacity:0;}.bootveil .boothouse{position:static;width:56px;height:56px;fill:var(--hp-accent);opacity:0.85;animation:hp-boot-pulse 1.3s ease-in-out infinite;}@keyframes hp-boot-pulse{0%,100%{opacity:0.3;transform:scale(0.94);}50%{opacity:0.9;transform:scale(1);}}@media (prefers-reduced-motion:reduce){.bootveil .boothouse{animation:none;opacity:0.7;}.version-recovery.phase-visible,.version-recovery.phase-leaving{animation:none;}}@keyframes hp-pulse-short{0%{transform:scale(1);opacity:0.55;}70%{opacity:0.22;}100%{transform:scale(var(--ripple-scale,1.5));opacity:0;}}@keyframes hp-pulse-short-b{0%{transform:scale(1);opacity:0.55;}70%{opacity:0.22;}100%{transform:scale(var(--ripple-scale,1.5));opacity:0;}}@keyframes hp-pulse-continuous{0%{transform:scale(1);opacity:0.55;}65%{opacity:0.18;}100%{transform:scale(var(--ripple-scale,1.5));opacity:0;}}@keyframes hp-pulse-alarm{0%{transform:scale(1);opacity:0.72;}100%{transform:scale(1.5);opacity:0;}}@keyframes hp-slide-left{0%{transform:translateX(4%);opacity:0.72;}100%{transform:translateX(0);opacity:1;}}@keyframes hp-slide-right{0%{transform:translateX(-4%);opacity:0.72;}100%{transform:translateX(0);opacity:1;}}@keyframes hp-sunfade-in{from{opacity:0;}to{opacity:1;}}@keyframes hp-sunfade-out{from{opacity:1;}to{opacity:0;}}.sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0,0,0,0) !important;white-space:nowrap !important;border:0 !important;}.toast{position:fixed;pointer-events:none;left:50%;bottom:22px;transform:translateX(-50%);background:var(--hp-bg);border:1px solid var(--hp-accent);color:var(--hp-txt);padding:var(--sp-4) var(--sp-6);border-radius:var(--rad-l);font-size:var(--fs-m);box-shadow:var(--shadow-2);z-index:120;max-width:90vw;}`,o`.fixedfloor-loading{animation:fixedfloor-spin 1.1s linear infinite;}.fixedfloor-error p{max-width:42rem;margin:0;overflow-wrap:anywhere;}@media (prefers-reduced-motion:reduce){.fixedfloor-loading{animation:none;}.radar-target{transition:none;}}.stage.noplan{background:#ffffff;}.stage.mode-plan,.stage.mode-devices,.stage.mode-decor{background:#ffffff;}.stage{position:relative;width:100%;container-type:inline-size;overflow:hidden;touch-action:none;background:var(--ha-card-background,var(--card-background-color,#111));}.zoomwrap{position:absolute;inset:0;z-index:1;}.stage.mode-transition,.stage.mode-transition .zoomwrap{transition:none !important;}.stage.mode-transition .hp-view-only-layer,.stage.mode-transition .hp-editor-only-layer{pointer-events:none;will-change:opacity;}.stage.mode-transition .hp-paper{fill:var(--hp-mode-paper) !important;}.hp-day-cycle-env{position:absolute;inset:0;z-index:0;overflow:hidden;pointer-events:none;isolation:isolate;}.hp-day-cycle-bg{position:absolute;inset:0;opacity:0;overflow:hidden;transition:opacity 1100ms cubic-bezier(.22,.61,.36,1);}.hp-day-cycle-bg.active{opacity:1;}.hp-day-cycle-sun{position:absolute;left:var(--hp-day-cycle-sun-x);top:var(--hp-day-cycle-sun-y);width:clamp(140px,25cqw,250px);height:clamp(140px,25cqw,250px);transform:translate(-50%,-50%);border-radius:50%;filter:blur(10px);opacity:var(--hp-day-cycle-sun-opacity);transition:left 1100ms cubic-bezier(.22,.61,.36,1),top 1100ms cubic-bezier(.22,.61,.36,1),opacity 1100ms cubic-bezier(.22,.61,.36,1);}.stage.mode-transition .hp-day-cycle-env{transition:none;}.stage.daycycle .hp-paperg,.hp-static-stage.daycycle .hp-paperg{filter:drop-shadow(0 0 1px var(--hp-day-cycle-outline-near)) drop-shadow(0 0 5px var(--hp-day-cycle-outline-mid)) drop-shadow(0 0 10px var(--hp-day-cycle-outline-far));will-change:filter;transition:filter 1100ms cubic-bezier(.22,.61,.36,1);}@media (prefers-reduced-motion:reduce){.hp-day-cycle-bg,.hp-day-cycle-sun,.stage.daycycle .hp-paperg,.hp-static-stage.daycycle .hp-paperg{transition:none;}}.sunlayer{pointer-events:none;}.compass{width:120px;height:120px;flex:none;touch-action:none;cursor:grab;user-select:none;}.compass:active{cursor:grabbing;}.compass .cring{fill:rgba(255,255,255,0.04);stroke:var(--divider-color,#444);stroke-width:2;}.compass .ctick{stroke:var(--secondary-text-color,#9aa4ad);stroke-width:2;}.compass .ctick.minor{stroke-width:1;opacity:0.6;}.compass .cneedle line{stroke:var(--primary-color,#3ea6ff);stroke-width:2.5;stroke-linecap:round;}.compass .cneedle path{fill:var(--primary-color,#3ea6ff);}.compass .cneedle text{fill:var(--text-primary-color,#fff);font-size:11px;font-weight:700;}.compass .cdeg{fill:var(--secondary-text-color,#9aa4ad);font-size:13px;}.compass.unset .cneedle{opacity:0.35;}.stage.hpboot .zoomwrap,.stage.hpboot .zoombadge{visibility:hidden;}.stage.hpsettle{transition:height 0.25s ease;}@media (prefers-reduced-motion:reduce){.stage.hpsettle{transition:none;}}.zoomctl{display:inline-flex;gap:var(--sp-1);background:rgba(127,127,127,0.12);border-radius:var(--rad-m);padding:var(--sp-1);}.zoomctl .zb{border:none;padding:var(--sp-3) var(--sp-4);}.zoomctl .zb[disabled]{opacity:0.4;pointer-events:none;}.projection-toggle{min-width:44px;min-height:44px;justify-content:center;padding:var(--sp-3);}.header-action{min-width:44px;min-height:44px;justify-content:center;padding:var(--sp-3);}.homearrow{position:absolute;z-index:12;transform:translate(-50%,-50%);width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;background:var(--card-background-color,var(--hp-bg));color:var(--hp-accent);border:1px solid var(--hp-accent);opacity:0.9;padding:0;}.homearrow ha-icon{--mdc-icon-size:22px;line-height:1;}.zoombadge{position:absolute;z-index:12;left:var(--sp-4);bottom:var(--sp-4);background:var(--card-background-color,var(--hp-bg));opacity:0.92;color:var(--hp-txt);border:1px solid var(--hp-accent);border-radius:var(--rad-m);padding:var(--sp-1) var(--sp-4);font-size:var(--fs-s);font-weight:600;pointer-events:none;}.zoomwrap>svg{position:absolute;inset:0;width:100%;height:100%;display:block;}.plan-svg{z-index:1;}.iso-underlay-svg{z-index:0;overflow:visible;}.iso-shadows-svg{z-index:3;overflow:visible;}.iso-walls-svg{z-index:4;overflow:visible;}.iso-overlays-svg{z-index:5;overflow:visible;}.iso-underlay-svg,.iso-shadows-svg,.iso-walls-svg,.iso-overlays-svg,.iso-underlay,.iso-shadows,.iso-walls,.iso-openings{pointer-events:none;}.iso-side-hi{stop-color:#b9bdbe;}.iso-side-lo{stop-color:#969c9f;}.iso-top-hi{stop-color:#fafaf7;}.iso-top-lo{stop-color:#e2e4e2;}.iso-wall-side{fill:url(#hp-iso-wall-side) #a8acae;stroke:#92989b;stroke-width:0.7;vector-effect:non-scaling-stroke;}.iso-wall-top{fill:url(#hp-iso-wall-top) #f3f3f1;stroke:#d7d9d8;stroke-width:0.8;vector-effect:non-scaling-stroke;}.iso-material-texture{fill:url(#hp-iso-wall-texture);stroke:none;opacity:0.12;pointer-events:none;}.iso-floor-texture{fill:url(#hp-iso-floor-texture);opacity:0.1;}.iso-texture-mark{fill:rgba(36,43,47,0.34);}.iso-texture-line{fill:none;stroke:rgba(36,43,47,0.24);stroke-width:0.55;}.iso-floor-side{fill:#858b8d;stroke:#71787b;stroke-width:0.7;vector-effect:non-scaling-stroke;}.iso-opening-panel{fill:#d7d9d7;fill-opacity:0.96;stroke:#7f878b;stroke-width:0.9;vector-effect:non-scaling-stroke;}.iso-opening-panel.iso-window{fill:#dfeff4;fill-opacity:0.72;stroke:#8aa7b1;}.iso-opening-panel.iso-material-reveal{fill:#c7cbca;stroke:#8b9294;}.iso-opening-panel.iso-material-matte-leaf{fill:#a6abad;stroke:#737b7f;}.iso-opening-panel.iso-opening-leaf-edge,.iso-opening-panel.iso-opening-leaf-top{fill:#8d9497;}.iso-opening-panel.iso-material-light-frame,.iso-opening-panel.iso-material-light-sill{fill:#fffef8;fill-opacity:0.94;stroke:#b3b5ae;}.iso-opening-panel.iso-material-light-window,.iso-opening-panel.iso-material-glass-side{fill:#c9e4f3;fill-opacity:0.88;stroke:#8fb4c7;}.iso-opening-panel.iso-material-glass-top{fill:#e3f2fa;fill-opacity:0.96;stroke:#9fc4d5;}.iso-ambient-shadow{fill:rgba(15,21,25,0.22);filter:url(#hp-iso-ambient-shadow);}.iso-contact-shadow{fill:none;stroke:rgba(22,28,31,0.25);stroke-width:3;filter:url(#hp-iso-contact-shadow);vector-effect:non-scaling-stroke;}.iso-leaf-shadow{fill:none;stroke:rgba(18,23,27,0.24);stroke-width:4;filter:url(#hp-iso-leaf-shadow);vector-effect:non-scaling-stroke;}.stage.theme-dark .iso-side-hi{stop-color:#4c555a;}.stage.theme-dark .iso-side-lo{stop-color:#343c40;}.stage.theme-dark .iso-top-hi{stop-color:#687176;}.stage.theme-dark .iso-top-lo{stop-color:#50585d;}.stage.theme-dark .iso-wall-side{stroke:#30373b;}.stage.theme-dark .iso-wall-top{stroke:#7b858a;}.stage.theme-dark .iso-floor-side{fill:#2d3438;stroke:#20272a;}.stage.theme-dark .iso-opening-panel{fill:#626b70;stroke:#899399;}.stage.theme-dark .iso-opening-panel.iso-window{fill:#75919b;stroke:#abc6ce;}.stage.theme-dark .iso-opening-panel.iso-material-reveal{fill:#454e52;stroke:#727d82;}.stage.theme-dark .iso-opening-panel.iso-material-matte-leaf{fill:#626a6e;stroke:#899398;}.stage.theme-dark .iso-opening-panel.iso-opening-leaf-edge,.stage.theme-dark .iso-opening-panel.iso-opening-leaf-top{fill:#4b5458;}.stage.theme-dark .iso-opening-panel.iso-material-light-frame,.stage.theme-dark .iso-opening-panel.iso-material-light-sill{fill:#e8e7df;stroke:#a9aca7;}.stage.theme-dark .iso-opening-panel.iso-material-light-window,.stage.theme-dark .iso-opening-panel.iso-material-glass-side{fill:#8fbfd5;stroke:#bad9e6;}.stage.theme-dark .iso-opening-panel.iso-material-glass-top{fill:#c9e6f2;stroke:#d9eef6;}.stage.theme-dark .iso-ambient-shadow{fill:rgba(0,0,0,0.34);}.stage.theme-dark .iso-contact-shadow,.stage.theme-dark .iso-leaf-shadow{stroke:rgba(0,0,0,0.38);}.stage.theme-dark .iso-texture-mark{fill:rgba(255,255,255,0.24);}.stage.theme-dark .iso-texture-line{stroke:rgba(255,255,255,0.18);}@media (prefers-color-scheme:dark){.stage:not(.theme-light) .iso-side-hi{stop-color:#4c555a;}.stage:not(.theme-light) .iso-side-lo{stop-color:#343c40;}.stage:not(.theme-light) .iso-top-hi{stop-color:#687176;}.stage:not(.theme-light) .iso-top-lo{stop-color:#50585d;}.stage:not(.theme-light) .iso-wall-side{stroke:#30373b;}.stage:not(.theme-light) .iso-wall-top{stroke:#7b858a;}.stage:not(.theme-light) .iso-floor-side{fill:#2d3438;stroke:#20272a;}.stage:not(.theme-light) .iso-opening-panel{fill:#626b70;stroke:#899399;}.stage:not(.theme-light) .iso-opening-panel.iso-window{fill:#75919b;stroke:#abc6ce;}.stage:not(.theme-light) .iso-opening-panel.iso-material-reveal{fill:#454e52;stroke:#727d82;}.stage:not(.theme-light) .iso-opening-panel.iso-material-matte-leaf{fill:#626a6e;stroke:#899398;}.stage:not(.theme-light) .iso-opening-panel.iso-opening-leaf-edge,.stage:not(.theme-light) .iso-opening-panel.iso-opening-leaf-top{fill:#4b5458;}.stage:not(.theme-light) .iso-opening-panel.iso-material-light-frame,.stage:not(.theme-light) .iso-opening-panel.iso-material-light-sill{fill:#e8e7df;stroke:#a9aca7;}.stage:not(.theme-light) .iso-opening-panel.iso-material-light-window,.stage:not(.theme-light) .iso-opening-panel.iso-material-glass-side{fill:#8fbfd5;stroke:#bad9e6;}.stage:not(.theme-light) .iso-opening-panel.iso-material-glass-top{fill:#c9e6f2;stroke:#d9eef6;}.stage:not(.theme-light) .iso-ambient-shadow{fill:rgba(0,0,0,0.34);}.stage:not(.theme-light) .iso-contact-shadow,.stage:not(.theme-light) .iso-leaf-shadow{stroke:rgba(0,0,0,0.38);}.stage:not(.theme-light) .iso-texture-mark{fill:rgba(255,255,255,0.24);}.stage:not(.theme-light) .iso-texture-line{stroke:rgba(255,255,255,0.18);}}@media (forced-colors:active){.iso-wall-side,.iso-wall-top,.iso-floor-side,.iso-opening-panel{fill:Canvas;stroke:CanvasText;forced-color-adjust:auto;}.iso-ambient-shadow,.iso-contact-shadow,.iso-leaf-shadow,.iso-material-texture{display:none;}}@supports not (filter:blur(1px)){.iso-ambient-shadow,.iso-contact-shadow,.iso-leaf-shadow,.iso-material-texture{display:none;}}.hp-paper{fill:var(--ha-card-background,var(--card-background-color,#111));stroke:none;}.stage.noplan .hp-paper,.stage.mode-plan .hp-paper,.stage.mode-devices .hp-paper,.stage.mode-decor .hp-paper{fill:#ffffff;}.room{transition:0.12s;cursor:default;stroke-linejoin:round;stroke-linecap:round;}.stage.mode-view .room{cursor:pointer;}.room.overlay{fill:transparent;stroke:transparent;stroke-width:calc(2px * var(--hp-cell-visual-scale,1));}:host([data-pointer-hover]) .stage.mode-view .room.overlay:not(.styled):hover{stroke:var(--hp-accent);stroke-opacity:1;}.room.yard{fill:rgba(75,140,90,0.14);stroke:#4b8c5a;stroke-width:calc(2px * var(--hp-cell-visual-scale,1));}:host([data-pointer-hover]) .stage.mode-view .room.yard:not(.styled):hover{stroke:var(--hp-accent);stroke-opacity:1;}.room.styled{stroke:var(--room-stroke,transparent);stroke-opacity:var(--room-stroke-op,0);stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));fill:var(--room-fill,transparent);fill-opacity:var(--room-fill-op,0);}.glow-base-layer,.glow-base-tunnels,.glow-pools-frame,.glow-pools,.glow-spot{pointer-events:none;}.glow-pools-frame,.glow-pools,.glow-spot{isolation:isolate;}.glow-pools.blend-screen .glow-spot{mix-blend-mode:screen;}.glow-spot{opacity:1;transition:opacity 500ms ease;}.glow-spot.is-entering,.glow-spot.is-leaving{opacity:0;}@media (prefers-reduced-motion:reduce){.glow-spot{transition:none;}}:host([data-pointer-hover]) .stage.mode-view .room.styled:hover{stroke:var(--hp-accent);stroke-opacity:1;}.op-leaf{transition:transform 0.6s ease;}.op-arc{stroke-width:calc(1.5px * var(--hp-cell-visual-scale,1));transition:stroke-dashoffset 0.6s ease;}.op-outline{fill:none;stroke:var(--hp-accent);stroke-width:calc(1.5px * var(--hp-cell-visual-scale,1));opacity:0;transition:opacity 0.15s;pointer-events:none;}:host([data-pointer-hover]) .stage.markup g.opening:hover .op-outline{opacity:0.9;}.op-hit{fill:transparent;pointer-events:none;cursor:default;}.stage.markup .op-hit{pointer-events:auto;cursor:grab;touch-action:none;}.stage.markup .op-hit:active{cursor:grabbing;}.stage.markup .opening.orphan{pointer-events:auto;cursor:pointer;color:var(--error-color,#db4437);}.stage.markup .opening.orphan circle{fill:var(--hp-bg);stroke:currentColor;stroke-width:calc(2px * var(--hp-cell-visual-scale,1));}.stage.markup .opening.orphan text{fill:currentColor;font-weight:800;font-size:calc(12px * var(--hp-cell-visual-scale,1));pointer-events:none;}.stage.markup.tool-resize .op-hit{pointer-events:none;cursor:default;}.stage.mode-view .oplock{pointer-events:auto;cursor:pointer;}.stage.projection-iso.mode-view .oplock::before{content:'';position:absolute;left:50%;top:50%;width:max(44px,100%);height:max(44px,100%);transform:translate(-50%,-50%);border-radius:50%;pointer-events:auto;}@media (prefers-reduced-motion:reduce){.op-leaf,.op-arc{transition:none;}}.roomlabel{pointer-events:none;position:absolute;transform:translate(-50%,-50%);font-size:calc(var(--rl-icon-size,var(--icon-size,2.5cqw)) * 0.5 * var(--rl-scale,1) * var(--rl-font,1) * var(--rl-space,1));font-weight:700;letter-spacing:0.04em;white-space:nowrap;cursor:grab;user-select:none;z-index:1;display:flex;flex-direction:column;align-items:center;gap:0.15em;text-align:center;}.rlname{display:inline-flex;align-items:center;gap:0.25em;font-size:calc(1em * var(--rl-name,1));}.zoomwrap.slide-left{animation:hp-slide-left 0.18s cubic-bezier(0.2,0.7,0.2,1);}.zoomwrap.slide-right{animation:hp-slide-right 0.18s cubic-bezier(0.2,0.7,0.2,1);}@media (prefers-reduced-motion:reduce){.zoomwrap.slide-left,.zoomwrap.slide-right{animation:none;}}.rlgearbtn{--gear-h:calc(var(--icon-size,2.5cqw) * 0.77);position:absolute;transform:translate(-50%,-50%);display:inline-flex;align-items:center;gap:0.35em;height:var(--gear-h);padding:0 calc(var(--gear-h) * 0.38);border:0;border-radius:999px;background:var(--hp-accent);color:var(--text-primary-color,#fff);font:inherit;font-size:calc(var(--gear-h) * 0.42);font-weight:600;line-height:1;white-space:nowrap;cursor:pointer;pointer-events:auto;opacity:0.92;box-shadow:var(--shadow-1);z-index:2;}.rlgearbtn{transition:opacity 0.15s,filter 0.15s;}:host([data-pointer-hover]) .rlgearbtn:hover{opacity:1;filter:brightness(1.18);}.rlgearbtn ha-icon{--mdc-icon-size:calc(var(--gear-h) * 0.55);display:inline-flex;}.rlgear{--mdc-icon-size:0.9em;display:inline-flex;margin-right:0.2em;opacity:0.6;cursor:pointer;pointer-events:auto;}:host([data-pointer-hover]) .rlgear:hover{opacity:1;}.rlgo{--mdc-icon-size:0.85em;display:inline-flex;opacity:0.55;}.stage.mode-view .rlgo{pointer-events:auto;cursor:pointer;}:host([data-pointer-hover]) .stage.mode-view .rlgo:hover{opacity:1;}.roomlabel .rlmetrics{position:absolute;top:calc(100% + 0.15em);left:50%;transform:translateX(-50%);white-space:nowrap;display:flex;align-items:center;gap:0.55em;font-size:calc(0.75em * var(--rl-meta,1));font-weight:600;letter-spacing:0.02em;opacity:0.9;}.roomlabel .rlm{display:inline-flex;align-items:center;gap:0.12em;}.roomlabel .rlm ha-icon{--mdc-icon-size:1.05em;display:inline-flex;}.roomlabel .rlm.lit{opacity:1;}.rlhandle{display:none;position:absolute;width:9px;height:9px;border-radius:2px;background:var(--hp-accent);border:1px solid var(--card-background-color,#fff);z-index:2;}.rlhandle.tl{left:-6px;top:-6px;cursor:nwse-resize;}.rlhandle.br{right:-6px;bottom:-6px;cursor:nwse-resize;}.rlhandle.tr{right:-6px;top:-6px;cursor:nesw-resize;}.rlhandle.bl{left:-6px;bottom:-6px;cursor:nesw-resize;}:host([data-pointer-hover]) .stage.markup .roomlabel:hover .rlhandle{display:block;}.stage.markup .roomlabel{pointer-events:auto;}.stage.mode-view .roomlabel{pointer-events:auto;cursor:pointer;border-radius:0.2em;}.stage.projection-iso.mode-view .roomlabel{box-sizing:border-box;min-width:44px;min-height:44px;justify-content:center;text-shadow:none;filter:none;-webkit-text-stroke:0 transparent;color:#303936 !important;}.stage.projection-iso.theme-dark.mode-view .roomlabel{color:#f2f0e8 !important;}@media (prefers-color-scheme:dark){.stage.projection-iso:not(.theme-light).mode-view .roomlabel{color:#f2f0e8 !important;}}.stage.mode-view .roomlabel:focus-visible{outline:2px solid var(--hp-accent);outline-offset:4px;}.roomlabel:active{cursor:grabbing;}.measurelayer{position:absolute;inset:0;pointer-events:none;}.alignline{stroke:var(--hp-accent);stroke-width:calc(1.2px * var(--hp-cell-visual-scale,1));stroke-dasharray:calc(4px * var(--hp-cell-visual-scale,1)) calc(4px * var(--hp-cell-visual-scale,1));pointer-events:none;opacity:0.9;}.aligndot{fill:var(--hp-accent);pointer-events:none;}.measurelabel.on45{color:#4bd28f;border-color:#4bd28f;}.measurelabel{position:absolute;transform:translate(12px,-150%);font-size:var(--fs-s);font-weight:600;padding:1px var(--sp-3);border-radius:var(--rad-s);background:rgba(0,0,0,0.72);color:#fff;white-space:nowrap;pointer-events:none;user-select:none;z-index:3;}.measurelabel.opdimension{transform:translate(calc(-50% + var(--op-label-shift-x,0px)),calc(-50% + var(--op-label-shift-y,-12px)));border:1px solid var(--hp-open,#ff9800);}.decorlayer .dshape{pointer-events:none;}.stage.mode-decor .decorlayer .dshape{pointer-events:visiblePainted;cursor:pointer;}.stage.mode-decor.dtool-select .decorlayer .dshape{cursor:move;}.stage.mode-decor.dtool-line .decorlayer .dshape,.stage.mode-decor.dtool-rect .decorlayer .dshape,.stage.mode-decor.dtool-ellipse .decorlayer .dshape,.stage.mode-decor.dtool-text .decorlayer .dshape,.stage.mode-decor.dtool-furniture .decorlayer .dshape,.stage.mode-decor.dtool-image .decorlayer .dshape,.stage.mode-decor.dtool-backdrop .decorlayer .dshape{pointer-events:none;}.stage.mode-decor.dtool-furniture,.stage.mode-decor.dtool-image{cursor:copy;}.stage.mode-decor.dtool-select .decorlayer .dimage,.stage.mode-decor.dtool-erase .decorlayer .dimage,.stage.mode-decor.dtool-select .decorlayer .dimage-missing,.stage.mode-decor.dtool-erase .decorlayer .dimage-missing{pointer-events:bounding-box;}.decorlayer .dimage-missing rect{fill:rgba(127,127,127,0.12);stroke:var(--hp-accent);stroke-dasharray:8 5;vector-effect:non-scaling-stroke;}.decorlayer .dimage-missing path{fill:none;stroke:var(--hp-accent);vector-effect:non-scaling-stroke;}.decorlayer .decor-image-placement-preview{opacity:0.65;}.stage.mode-decor.dtool-text .decorlayer .dshape.dtext,.stage.mode-decor.dtool-select .decorlayer .dshape.dtext,.stage.mode-decor.dtool-erase .decorlayer .dshape.dtext{pointer-events:visiblePainted;pointer-events:bounding-box;}.stage.mode-decor.dtool-text .decorlayer .dshape.dtext{cursor:text;}.decorlayer .derasehit{fill:none;stroke:transparent;stroke-width:16px;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;pointer-events:none;}.stage.mode-decor.dtool-erase .decorlayer .derasehit{pointer-events:stroke;}.decorlayer .dselecthit{fill:none;stroke:transparent;stroke-width:16px;stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:none;}.stage.mode-decor.dtool-select .decorlayer .dselecthit{pointer-events:stroke;cursor:move;}.stage.mode-decor .decorlayer .dshape.dfurniturehit{fill:none;stroke:transparent;pointer-events:none;}.stage.mode-decor.dtool-select .decorlayer .dshape.dfurniturehit{pointer-events:stroke;cursor:move;}.decorlayer .dsel{filter:drop-shadow(0 0 3px var(--hp-accent));}.decorlayer .ddraft{stroke-dasharray:calc(6px * var(--hp-cell-visual-scale,1)) calc(5px * var(--hp-cell-visual-scale,1));pointer-events:none;}.decorlayer .furniture-placement-preview{opacity:0.55;pointer-events:none;}.decorlayer text{font-weight:600;user-select:none;dominant-baseline:middle;text-anchor:middle;}.stage.mode-decor{outline:2px solid #26a69a;outline-offset:-2px;}.bdframe .bdbox{fill:none;stroke:var(--hp-accent);stroke-width:2;stroke-dasharray:10 7;vector-effect:non-scaling-stroke;pointer-events:none;opacity:0.9;}.bdframe .bdhandle{fill:transparent;stroke:none;pointer-events:all;touch-action:none;}.bdframe .bdknob{fill:var(--hp-accent);stroke:#fff;stroke-width:1;vector-effect:non-scaling-stroke;pointer-events:none;}:host([data-pointer-hover]) .bdframe .bdhandle:hover + .bdknob{fill:#fff;stroke:var(--hp-accent);}.bdframe .bd-nwse{cursor:nwse-resize;}.bdframe .bd-nesw{cursor:nesw-resize;}.stage.mode-decor.bdgrab{cursor:grab;}.stage.mode-decor.bdgrabbing,.stage.mode-decor.bdgrabbing .bdframe .bdhandle{cursor:grabbing;}.measurelabel.bdmeasure{transform:translate(-50%,-50%);border:1px solid var(--hp-accent);}.dtframe .dtbox{fill:none;stroke:var(--hp-accent);stroke-width:1.5;stroke-dasharray:7 5;vector-effect:non-scaling-stroke;pointer-events:none;opacity:0.85;}.dtframe .dtstem,.bdframe .dtstem{stroke:var(--hp-accent);stroke-width:1.5;vector-effect:non-scaling-stroke;pointer-events:none;opacity:0.85;}.dtframe .dthandle{fill:transparent;stroke:none;pointer-events:all;touch-action:none;}.dtframe .dtknob{fill:var(--hp-accent);stroke:#fff;stroke-width:1;vector-effect:non-scaling-stroke;pointer-events:none;}:host([data-pointer-hover]) .dtframe .dthandle:hover + .dtknob{fill:#fff;stroke:var(--hp-accent);}.dtframe .dt-nwse{cursor:nwse-resize;}.dtframe .dt-nesw{cursor:nesw-resize;}.dtframe .dtrot{cursor:grab;}.dtframe .dt-ew{cursor:ew-resize;}.dtframe .dt-ns{cursor:ns-resize;}.dtfurnitureframe .dtrot{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M18.4 7.2A8 8 0 1 0 20 12' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='m15.5 3.8 3.2 3.5-4.6.8' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 12 12,grab;}.dtfurnitureframe .dtrot:active{cursor:grabbing;}.dtframe .dtendpoint{cursor:crosshair;}.bdframe .dtrot{cursor:grab;}.dtarea{resize:vertical;min-height:3.4em;font:inherit;line-height:1.35;}.stage.mode-decor.dtool-line,.stage.mode-decor.dtool-rect,.stage.mode-decor.dtool-ellipse,.stage.mode-decor.dtool-text{cursor:crosshair;}.stage.mode-decor.dtool-erase,.stage.mode-decor.dtool-erase .decorlayer .dshape{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cg transform='rotate(-45 12 12)'%3E%3Crect x='7' y='2' width='10' height='18' rx='2' fill='%23fff' stroke='%23111' stroke-width='1.5'/%3E%3Cpath d='M7 13h10v5a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2z' fill='%23ff9f43' stroke='%23111' stroke-width='1.5'/%3E%3C/g%3E%3C/svg%3E") 5 22,pointer;}.stage.mode-decor .room{pointer-events:none;}.stage.mode-decor .devlayer,.stage.mode-decor .devlayer *,.stage.mode-decor .dev::before{pointer-events:none;}.stage .room,.stage .devlayer,.stage .opening,.stage .room-outline,.stage .wallbodies,.stage .opening-tunnels,.stage .glow-base-layer,.stage .glow-pools-frame,.stage .zero-walls{opacity:var(--hp-mode-architecture-opacity,1);}.opening-preview{opacity:0.5;pointer-events:none;}.opening-preview[data-kind="passage"]{opacity:1;}.passage-preview-cut{fill:var(--wall-fill,#ffffff);fill-opacity:0.35;stroke:none;pointer-events:none;}.passage-preview-boundary{stroke:var(--hp-open,#ff9800);stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));pointer-events:none;}.opening-preview .op-leaf,.opening-preview .op-arc{transition:none;}.opening-preview-dot{fill:var(--hp-open,#ff9800);pointer-events:none;}.opening-dimensions,.opening-dimension{pointer-events:none;}.opening-dimension-line,.opening-dimension-tick{fill:none;stroke:var(--hp-open,#ff9800);stroke-width:1.5;vector-effect:non-scaling-stroke;pointer-events:none;}.opening-dimension-tick{stroke-width:2;}.stage.edit .room{pointer-events:none;}.stage.markup{cursor:crosshair;}.stage.markup.tool-merge,.stage.markup.tool-split.pickstage,.stage.markup.tool-delroom{cursor:pointer;}.stage.markup.tool-wallthick{cursor:default;}.stage.markup.tool-wallthick.wallhot{cursor:pointer;}.wallbody-fill{fill:var(--wall-fill,#ffffff);fill-opacity:var(--wall-fill-op,1);fill-rule:evenodd;stroke:none;pointer-events:none;}.wallbody{fill:url(#hp-wall-hatch);fill-rule:evenodd;stroke:var(--room-stroke,var(--hp-muted));stroke-width:calc(0.6px * var(--hp-cell-visual-scale,1));pointer-events:none;}.wallbody.solid{fill:none;}.wallthick-hover{fill:var(--accent-color,#03a9f4);fill-opacity:0.38;stroke:var(--accent-color,#03a9f4);stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));stroke-linejoin:round;stroke-linecap:round;pointer-events:none;}.wallthick-hover.isopen{fill:var(--error-color,#f44336);stroke:var(--error-color,#f44336);}.zero-wall{stroke:var(--zero-wall-stroke,var(--hp-muted));stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));stroke-dasharray:calc(7px * var(--hp-cell-visual-scale,1)) calc(7px * var(--hp-cell-visual-scale,1));stroke-linecap:butt;pointer-events:none;opacity:0.9;}.zero-walls.solid .zero-wall{stroke-dasharray:none;}.room.noedge{stroke-opacity:0 !important;}.room-outline{fill:none;stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));stroke-linejoin:round;stroke-linecap:round;pointer-events:none;}.room-outline.outlined{stroke:rgba(62,166,255,0.55);stroke-opacity:1;}.room-hover-fill{fill:#000;fill-opacity:0.22;pointer-events:none;}.room-hover-halo{fill:none;stroke:var(--hp-accent);stroke-opacity:0.28;stroke-width:calc(8px * var(--hp-cell-visual-scale,1));stroke-linejoin:round;stroke-linecap:round;pointer-events:none;}.room-hover-outline{fill:none;stroke:var(--hp-accent);stroke-width:calc(3px * var(--hp-cell-visual-scale,1));stroke-linejoin:round;stroke-linecap:round;pointer-events:none;}.stage.markup .room{pointer-events:none;}.stage.markup .devlayer .dev{display:none;}.stage.mode-plan{outline:2px solid #ffc14d;outline-offset:-2px;}.stage.mode-devices{outline:2px solid var(--hp-accent);outline-offset:-2px;}.room.outlined{stroke:rgba(62,166,255,0.55);fill:rgba(62,166,255,0.06);}.room.picked{stroke:#ffc14d;stroke-width:calc(3px * var(--hp-cell-visual-scale,1));fill:rgba(255,193,77,0.25);}.griddot{fill:var(--hp-accent);opacity:0.35;stroke:rgba(0,0,0,0.35);stroke-width:0.4;}.griddot.major{opacity:0.5;stroke-width:0;}.seg{stroke:var(--hp-accent);stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));stroke-linecap:round;stroke-linejoin:round;}.pathline{stroke:#ffc14d;stroke-width:calc(3px * var(--hp-cell-visual-scale,1));fill:none;stroke-linecap:round;stroke-linejoin:round;}.preview{stroke:#ffc14d;stroke-width:calc(2px * var(--hp-cell-visual-scale,1));stroke-dasharray:calc(6px * var(--hp-cell-visual-scale,1)) calc(5px * var(--hp-cell-visual-scale,1));opacity:0.7;}.active-axis{stroke:#ffc14d;stroke-width:2;stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:none;}.active-vertex{fill:#ffc14d;stroke:#171006;stroke-width:2;vector-effect:non-scaling-stroke;pointer-events:none;}.wall-repair-preview{stroke:#d93025;stroke-width:4;stroke-linecap:round;stroke-dasharray:5 4;vector-effect:non-scaling-stroke;pointer-events:none;}.drawwall-preview-fill{fill:var(--wall-fill,#ffffff);fill-opacity:calc(var(--wall-fill-op,1) * 0.55);fill-rule:evenodd;stroke:none;pointer-events:none;}.drawwall-preview{fill:url(#hp-wall-hatch);fill-opacity:0.55;fill-rule:evenodd;stroke:var(--accent-color,#03a9f4);stroke-width:calc(0.5px * var(--hp-cell-visual-scale,1));stroke-opacity:0.7;pointer-events:none;}.drawwall-zero-preview{fill:none;stroke:var(--accent-color,#03a9f4);stroke-width:calc(3px * var(--hp-cell-visual-scale,1));stroke-linecap:butt;stroke-linejoin:round;opacity:0.72;pointer-events:none;}.drawwall-zero-preview.dashed{stroke-dasharray:calc(7px * var(--hp-cell-visual-scale,1)) calc(7px * var(--hp-cell-visual-scale,1));}.vertex{fill:#ffc14d;stroke:#4a2800;stroke-width:calc(1px * var(--hp-cell-visual-scale,1));}.vertex.first{fill:#4bd28f;stroke:#04121f;}.plan-snap-overlay,.plan-snap-overlay *,.hidden-wall-diagnostic,.hidden-wall-diagnostic *{pointer-events:none;}.plan-snap-line,.hidden-wall-line{fill:none;stroke:color-mix(in srgb,var(--hp-accent) 82%,white 18%);stroke-width:1;stroke-linecap:round;opacity:0.92;}.plan-snap-node,.hidden-wall-node{fill:var(--ha-card-background,var(--card-background-color,#fff));stroke:color-mix(in srgb,var(--hp-accent) 88%,#07131c 12%);stroke-width:1;vector-effect:non-scaling-stroke;}.plan-snap-node.active{fill:#ffc14d;stroke:#171006;stroke-width:2;}.plan-snap-node.active.dynamic{fill:#4bd28f;stroke:#04121f;}.plan-snap-node.conflict{fill:#fff;stroke:#d93025;stroke-width:3;}@media (prefers-color-scheme:dark){.plan-snap-line{stroke:color-mix(in srgb,var(--hp-accent) 72%,white 28%);}.hidden-wall-line{stroke:color-mix(in srgb,var(--hp-accent) 72%,white 28%);}.plan-snap-node,.hidden-wall-node{fill:#17242c;stroke:#9bdcf5;}.plan-snap-node.active{fill:#ffc14d;stroke:#fff4d6;}.plan-snap-node.active.dynamic{fill:#4bd28f;stroke:#eafff4;}}@media (forced-colors:active){.plan-snap-line,.hidden-wall-line{stroke:CanvasText;opacity:1;forced-color-adjust:auto;}.plan-snap-node,.hidden-wall-node{fill:Canvas;stroke:CanvasText;forced-color-adjust:auto;}.plan-snap-node.active,.plan-snap-node.active.dynamic{fill:Highlight;stroke:HighlightText;forced-color-adjust:auto;}}.sunlayer{animation:hp-sunfade-in 2s linear both;}.sunlayer.out{animation:hp-sunfade-out 2s linear both;}@media (prefers-reduced-motion:reduce){.sunlayer,.sunlayer.out{animation:none;}.sunlayer.out{opacity:0;}}.devlayer{position:absolute;inset:0;pointer-events:none;z-index:6;}.radar-target{position:absolute;width:8px;height:8px;box-sizing:border-box;transform:translate(-50%,-50%);border-radius:50%;background:var(--success-color,#43a047);border:2px solid var(--primary-text-color,#1f1f1f);box-shadow:0 0 0 1px color-mix(in srgb,var(--card-background-color,#fff) 80%,transparent);pointer-events:none;z-index:0;}.radar-target.smooth{transition:left 200ms linear,top 200ms linear;}.radar-ranges{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;z-index:0;}.radar-ranges path,.radar-ranges polyline{fill:none;stroke:var(--success-color,#43a047);stroke-width:2px;stroke-dasharray:5 4;vector-effect:non-scaling-stroke;opacity:0.72;}.radar-ranges .radar-zone{fill:color-mix(in srgb,var(--success-color,#43a047) 8%,transparent);stroke:var(--success-color,#43a047);stroke-width:2px;vector-effect:non-scaling-stroke;opacity:0.8;}.stage.mode-devices .dev{cursor:grab;}.stage.mode-devices .dev:active{cursor:grabbing;}.physical-hit{fill:transparent;stroke:transparent;pointer-events:none;cursor:grab;}.stage.tool-select .physical-hit{pointer-events:all;}.physical-hit:active{cursor:grabbing;}line.physical-hit{cursor:pointer;}.physical-hit.selected{fill:rgba(255,193,77,0.24);stroke:transparent;}line.physical-hit.selected{stroke:transparent;}.physical-drag{fill:rgba(255,193,77,0.38);stroke:#ffc14d;stroke-width:2.5;vector-effect:non-scaling-stroke;pointer-events:none;}.physical-chrome{pointer-events:none;}.physical-chrome .frame,.physical-chrome .stem{fill:none;stroke:#ffc14d;stroke-width:2;vector-effect:non-scaling-stroke;}.physical-chrome .frame{fill:rgba(255,193,77,0.22);}.physical-chrome polyline.frame{fill:none;}.physical-chrome .move-dot{fill:#ffc14d;stroke:#24262d;stroke-width:1.5;vector-effect:non-scaling-stroke;}.physical-chrome .rotate-handle{fill:#24262d;stroke:#ffc14d;stroke-width:2.5;vector-effect:non-scaling-stroke;pointer-events:all;cursor:crosshair;}.drawwall.invalid input{border-color:var(--error-color,#db4437);}.drawwall .rangehint{margin-inline-start:4px;font-size:0.78em;opacity:0.72;}.drawwall.invalid .rangehint{color:var(--error-color,#db4437);opacity:1;}.stage.markup.tool-partition,.stage.markup.tool-column{cursor:crosshair;}.rszhandle{fill:transparent;stroke:none;pointer-events:all;cursor:grab;touch-action:none;}.rszhandle:active{cursor:grabbing;}.rszhandle.disabled,.rszhandle.disabled:active{cursor:not-allowed;}.rszicon{pointer-events:none;}.rszicon path{fill:none;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;}.rszhalo{stroke:var(--hp-bg);stroke-width:6;}.rszink{stroke:var(--hp-accent);stroke-width:2;}:host([data-pointer-hover]) .rszhandle:hover + .rszicon .rszink{stroke-width:3;}.rszicon.disabled{opacity:0.38;}:host([data-pointer-hover]) .rszhandle.disabled:hover + .rszicon .rszink{stroke-width:2;}.rszmeasurelayer,.rszmeasurelayer *{pointer-events:none;}.rszmeasurehalo,.rszmeasureink,.rszleader{fill:none;stroke-linecap:round;vector-effect:non-scaling-stroke;}.rszmeasurehalo{stroke:var(--hp-bg);stroke-width:7px;opacity:0.9;}.rszmeasureink{stroke:var(--hp-accent);stroke-width:3px;}.rszleader{stroke:var(--hp-accent);stroke-width:2px;opacity:0.95;}.measurelabel.dmeasure{transform:translate(-50%,-160%);}.measurelabel.rszarea{transform:translate(calc(-50% + var(--rsz-label-x,0px)),calc(-50% + var(--rsz-label-y,0px)));background:rgba(0,0,0,0.6);border:1px solid var(--hp-accent);}.measurelabel.furnmeasure{transform:translate(-50%,-50%);border:1px solid var(--hp-accent);}.alignmsg{margin:0 0 8px;font-size:13px;line-height:1.45;}`,o`.dev ha-icon{position:relative;z-index:1;}.device-pulse{position:absolute;left:50%;top:50%;width:var(--dev-size);height:var(--dev-size);transform:translate(-50%,-50%);pointer-events:none;z-index:0;}.device-pulse i{position:absolute;inset:0;border-radius:50%;border:2px solid var(--ripple-color,var(--hp-accent));opacity:0;}.device-pulse.short i{animation:hp-pulse-short 1.1s cubic-bezier(.22,.61,.36,1) 1 forwards;}.device-pulse.short i:nth-child(2){animation-delay:1.1s;}.device-pulse.short i:nth-child(3){animation-delay:2.2s;}.device-pulse.short.gen2 i{animation-name:hp-pulse-short-b;}.device-pulse.continuous i:nth-child(n + 2),.device-pulse.alarm i:nth-child(n + 3){display:none;}.device-pulse.continuous i:first-child{animation:hp-pulse-continuous 3.6s cubic-bezier(.45,.05,.55,.95) infinite;}.device-pulse.alarm i{border-width:3px;border-color:#F0410C;animation:hp-pulse-alarm 2.4s cubic-bezier(.22,.61,.36,1) infinite;}.device-pulse.alarm i:nth-child(2){animation-delay:1.2s;}.activity-dot{position:absolute;right:8%;bottom:8%;width:18%;height:18%;min-width:4px;min-height:4px;border-radius:50%;background:var(--ripple-color,var(--hp-accent));border:1px solid color-mix(in srgb,var(--hp-bg) 82%,transparent);pointer-events:none;z-index:3;}.kioskdots{position:absolute;left:50%;bottom:var(--sp-5);transform:translateX(-50%);display:flex;gap:var(--sp-4);z-index:5;pointer-events:none;}.kdot{width:9px;height:9px;border-radius:50%;background:var(--hp-muted);opacity:0.55;}.kdot.on{background:var(--hp-accent);opacity:1;}.dev.valonly{width:var(--dev-size,var(--icon-size,2.5cqw));}.dev.valonly .device-core{width:max-content;min-width:var(--dev-size,var(--icon-size,2.5cqw));padding-inline:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.16);border-radius:calc(var(--dev-size,var(--icon-size,2.5cqw)) / 2);}.dev .valtext{overflow:visible;font-size:calc(var(--dev-size,var(--icon-size,2.5cqw)) * var(--value-font-scale,.45));font-weight:600;white-space:nowrap;}@media (prefers-reduced-motion:reduce){.device-pulse{display:none;}}.dev .newdot{position:absolute;top:calc(var(--dev-size,var(--icon-size,2.5cqw)) * -0.12);right:calc(var(--dev-size,var(--icon-size,2.5cqw)) * -0.12);width:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.34);height:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.34);border-radius:50%;background:#f0301f;border:2px solid var(--card-background-color,var(--hp-bg));pointer-events:none;z-index:2;}.dev{position:absolute;--dev-size:calc(var(--device-base-size,2.25cqw) * var(--dev-scale,1));--device-shell-size:calc(var(--dev-size) * 1.26875);--device-shell-inset:calc(var(--dev-size) * 0.134375);--device-shell-stroke-ratio:0.01875;--device-shell-border-width:max(1px,calc(var(--dev-size) * var(--device-shell-stroke-ratio)));--device-core-bg:var(--card-background-color,#fff);--device-core-fg:var(--primary-text-color,#252525);--device-core-bg:light-dark(#fff,#252525);--device-core-fg:light-dark(#252525,#fff);--device-face-bg:var(--device-core-bg);--device-face-fg:var(--device-core-fg);--device-shell-base-stroke:light-dark(#BCBCBC,rgb(37 37 37 / 75%));--device-shell-stroke:var(--device-shell-base-stroke);--device-shell-shadow:0 calc(var(--dev-size) * .025) calc(var(--dev-size) * .05) rgb(37 40 45 / 12%),0 calc(var(--dev-size) * .1) calc(var(--dev-size) * .175) calc(var(--dev-size) * -.025) rgb(37 40 45 / 18%);--device-core-inset-shadow:0 0 0 0 transparent;--device-ring-color:transparent;--device-ring-width:0px;width:var(--dev-size);height:var(--dev-size);margin:calc(var(--dev-size) / -2) 0 0 calc(var(--dev-size) / -2);border:0;background:transparent;display:block;color:var(--device-core-fg);cursor:pointer;pointer-events:none;transition:opacity 0.2s;box-shadow:none;outline:none;z-index:auto;}.dev.theme-light{--device-core-bg:#fff;--device-core-fg:#000;--device-shell-base-stroke:#BCBCBC;--device-shell-stroke:var(--device-shell-base-stroke);--device-shell-shadow:0 calc(var(--dev-size) * .025) calc(var(--dev-size) * .05) rgb(37 40 45 / 12%),0 calc(var(--dev-size) * .1) calc(var(--dev-size) * .175) calc(var(--dev-size) * -.025) rgb(37 40 45 / 18%);--device-core-inset-shadow:0 0 0 0 transparent;}.dev.theme-dark{--device-core-bg:#252525;--device-core-fg:#fff;--device-shell-base-stroke:rgb(37 37 37 / 75%);--device-shell-stroke:var(--device-shell-base-stroke);--device-shell-shadow:0 calc(var(--dev-size) * .025) calc(var(--dev-size) * .0375) rgb(37 40 45 / 12%),0 calc(var(--dev-size) * .1) calc(var(--dev-size) * .175) calc(var(--dev-size) * -.025) rgb(37 40 45 / 18%);--device-core-inset-shadow:inset 0 calc(var(--dev-size) * 0.0125) calc(var(--dev-size) * 0.0125) rgb(255 255 255 / 70%);}.dev::before{content:'';position:absolute;left:50%;top:50%;width:max(44px,var(--device-shell-size));height:max(44px,var(--device-shell-size));transform:translate(-50%,-50%);border-radius:50%;pointer-events:auto;z-index:1;}.device-shell{position:absolute;box-sizing:border-box;display:flex;align-items:center;gap:calc(var(--dev-size) * 0.1);padding:0;min-width:var(--dev-size);min-height:var(--dev-size);border:0;background:transparent;box-shadow:none;transition:opacity .2s;pointer-events:none;z-index:2;}.device-shell-frame{position:absolute;z-index:0;box-sizing:border-box;inset:calc(var(--device-shell-inset) / -1);border:var(--device-shell-border-width) solid var(--device-shell-stroke);border-radius:9999px;background:transparent;box-shadow:var(--device-shell-shadow);transition:border-color .15s,opacity .2s;pointer-events:auto;backdrop-filter:none;}.device-shell:not(.with-values){left:0;top:0;}.device-shell:not(.with-values):not(.text-shell) .device-shell-frame{border-radius:50%;}.device-shell.with-values.pos-right{left:0;top:50%;transform:translateY(-50%);}.device-shell.with-values.pos-left{right:0;top:50%;transform:translateY(-50%);flex-direction:row-reverse;}.device-shell.with-values.pos-bottom{left:50%;top:0;transform:translateX(-50%);flex-direction:column;}.device-shell.with-values.pos-top{left:50%;bottom:0;transform:translateX(-50%);flex-direction:column-reverse;}.device-core{position:relative;z-index:1;box-sizing:border-box;flex:0 0 auto;width:var(--dev-size);height:var(--dev-size);display:flex;align-items:center;justify-content:center;border-radius:50%;background:var(--device-face-bg);color:var(--device-face-fg);box-shadow:var(--device-core-inset-shadow),0 0 0 var(--device-ring-width) var(--device-ring-color);line-height:0;transition:background .15s,color .15s,opacity .2s;pointer-events:none;}.device-sections{display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:calc(var(--dev-size) * .08);min-width:0;pointer-events:none;}.device-shell.pos-top .device-sections,.device-shell.pos-bottom .device-sections{flex-direction:row;}.dev ha-icon{--mdc-icon-size:calc(var(--dev-size,var(--device-base-size,2.25cqw)) * 0.55);display:flex;align-items:center;justify-content:center;line-height:0;}.dev.on{--device-face-bg:#F0A00C;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:#F0A00C;}.dev.theme-light.on{--device-face-fg:#fff;}.dev.theme-dark.on{--device-face-fg:#252525;--device-shell-stroke-ratio:.0375;}.dev.open{--device-face-bg:var(--hp-open);--device-face-fg:light-dark(#fff,#252525);}.dev.theme-light.open{--device-face-fg:#fff;}.dev.theme-dark.open{--device-face-fg:#252525;}.dev.lock-locked{--device-face-bg:#66D17A;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:#66D17A;}.dev.theme-light.lock-locked{--device-face-fg:#fff;}.dev.theme-dark.lock-locked{--device-face-fg:#252525;--device-shell-stroke-ratio:.025;}.dev.lock-unlocked{--device-face-bg:#F0410C;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:#F0410C;}.dev.theme-light.lock-unlocked{--device-face-fg:#fff;}.dev.theme-dark.lock-unlocked{--device-face-fg:#252525;--device-shell-stroke-ratio:.025;}:host([data-pointer-hover]) .dev:not(.unavail)[data-hp-device-hover]{--device-face-bg:#0C82F0;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:var(--device-shell-base-stroke);}:host([data-pointer-hover]) .dev.theme-light:not(.unavail)[data-hp-device-hover]{--device-face-fg:#fff;}:host([data-pointer-hover]) .dev.theme-dark:not(.unavail)[data-hp-device-hover]{--device-face-fg:#252525;}:host([data-pointer-hover]) .dev[data-hp-device-hover],.dev:focus-visible{z-index:5;}.dev[data-hp-zigbee-topology-endpoint]{z-index:8;}:host([data-pointer-hover]) .dev[data-hp-zigbee-topology-endpoint][data-hp-device-hover]{z-index:8;}.dev.unavail{opacity:0.35;--device-face-bg:#B5BAC1;--device-shell-stroke:var(--device-shell-base-stroke);}.dev.virtual .device-shell-frame{border-style:dashed;}.dev.ghost{opacity:0.6;color:var(--hp-accent);}.dev.ghost .device-shell-frame{border-style:dashed;border-color:var(--hp-accent);box-shadow:none;}.dev.ghost .device-core{background:rgba(62,166,255,0.22);background:color-mix(in srgb,var(--hp-accent) 30%,var(--card-background-color,#1c2530));color:var(--hp-accent);}.dev.ghost.ha-disabled{opacity:0.62;color:var(--secondary-text-color,#9aa0aa);}.dev.ghost.ha-disabled .device-shell-frame{border-color:var(--secondary-text-color,#9aa0aa);}.dev.ghost.ha-disabled .device-core{background:rgba(120,124,134,0.2);background:color-mix(in srgb,var(--secondary-text-color,#9aa0aa) 24%,var(--card-background-color,#1c2530));color:var(--secondary-text-color,#9aa0aa);}.dev .habadge{position:absolute;right:-18%;bottom:-18%;display:grid;place-items:center;width:46%;height:46%;min-width:12px;min-height:12px;border-radius:50%;background:var(--card-background-color,#242832);border:1px solid currentColor;}.dev .habadge ha-icon{width:72%;height:72%;}.dev.sel{--device-ring-color:#F0A00C;--device-ring-width:calc(var(--dev-size) * 0.0375);}.dev:focus-visible{--device-ring-color:#0C82F0;--device-ring-width:calc(var(--dev-size) * 0.0375);}.dev:not(.on):not(.open):not(.alarm):not(.lock-locked):not(.lock-unlocked):not(.unavail):focus-visible{--device-face-fg:#0C82F0;}.dev.alarm,:host([data-pointer-hover]) .dev.alarm[data-hp-device-hover],.dev.alarm:focus-visible{--device-face-bg:#F0410C;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:#F0410C;}.dev.theme-light.alarm{--device-face-fg:#fff;}.dev.theme-dark.alarm{--device-face-fg:#252525;--device-shell-stroke-ratio:.025;}.dev .value-badge{position:relative;z-index:2;box-sizing:border-box;width:max-content;min-width:calc(var(--dev-size,var(--icon-size,2.5cqw)) * .7875);height:calc(var(--dev-size,var(--icon-size,2.5cqw)) * .7875);display:flex;align-items:center;justify-content:center;overflow:visible;background:var(--device-core-bg);border:0;border-radius:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.39375);padding:0 calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.14);font-size:calc(var(--dev-size,var(--icon-size,2.5cqw)) * var(--value-font-scale,.45));font-weight:600;line-height:1;color:var(--device-core-fg);white-space:nowrap;pointer-events:none;}.dev .value-badge.unavailable,.dev .value-badge.missing{opacity:0.66;}.dev .lqi{position:absolute;top:calc(50% + var(--device-shell-size) / 2 + var(--dev-size) * .05);left:50%;transform:translateX(-50%);margin-top:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.05);font-size:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.38);font-weight:600;line-height:1;text-shadow:0 0 3px rgba(0,0,0,0.9),0 0 2px rgba(0,0,0,0.9);white-space:nowrap;pointer-events:none;}.dev .lqi.below-value-badge{margin-top:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.8875);}.temprange{display:inline-flex;align-items:center;gap:var(--sp-3);margin-left:auto;color:var(--hp-muted);font-size:var(--fs-s);}.vacwarn{position:absolute;top:-12%;right:-12%;width:calc(var(--device-base-size,2.25cqw) * 0.42);height:calc(var(--device-base-size,2.25cqw) * 0.42);border-radius:50%;display:flex;align-items:center;justify-content:center;background:light-dark(#fff,#252525);border:1px solid #E5A100;color:#E5A100;z-index:7;pointer-events:none;}.vacwarn ha-icon{--mdc-icon-size:calc(var(--device-base-size,2.25cqw) * 0.32);color:inherit;}.vacpuck{position:absolute;--puck-size:calc(var(--device-base-size,2.25cqw) * 0.8);width:var(--puck-size);height:var(--puck-size);border-radius:50%;transform:translate(-50%,-50%);--vac-core-bg:light-dark(#fff,#252525);--vac-core-fg:light-dark(#252525,#fff);background:var(--vac-core-bg);border:1px solid #BCBCBC;box-shadow:0 1px 2px rgb(37 40 45 / 12%),0 4px 8px -1.07px rgb(37 40 45 / 18%);color:var(--vac-core-fg);display:flex;align-items:center;justify-content:center;cursor:pointer;z-index:6;transition:left 1.2s linear,top 1.2s linear;animation:vacpulse 2.2s ease-out infinite;}.vacpuck.theme-light{--vac-core-bg:#fff;--vac-core-fg:#252525;}.vacpuck.theme-dark{--vac-core-bg:#252525;--vac-core-fg:#fff;}.vacpuck.jump{transition:none;}.vacpuck.stale{opacity:0.45;animation:none;}.vacpuck ha-icon{--mdc-icon-size:calc(var(--puck-size) * 0.68);color:var(--vac-core-fg);display:flex;align-items:center;justify-content:center;line-height:0;width:var(--mdc-icon-size);height:var(--mdc-icon-size);}@keyframes vacpulse{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--hp-accent) 45%,transparent);}70%{box-shadow:0 0 0 12px transparent;}100%{box-shadow:0 0 0 0 transparent;}}@media (prefers-reduced-motion:reduce){.vacpuck{animation:none;}}.vactrail{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:5;overflow:visible;}.vactrail polyline,.vactrail path{fill:none;stroke-linejoin:round;stroke-linecap:round;vector-effect:non-scaling-stroke;}.vactrail g.prev{opacity:0.4;}.vactrail .case{stroke:rgba(0,0,0,0.4);stroke-width:2.25;}.vactrail .core{stroke:rgba(255,255,255,0.82);stroke-width:0.9;}.devicepreview-empty{min-height:82px;margin:4px 0 14px;padding:var(--sp-4);display:flex;align-items:center;justify-content:center;gap:var(--sp-3);border:1px dashed var(--hp-line);border-radius:var(--rad-m);color:var(--hp-muted);text-align:center;}`,o`.hdr{position:sticky;top:var(--header-height,56px);z-index:20;background:var(--card-background-color,var(--hp-bg));border-radius:var(--ha-card-border-radius,12px) var(--ha-card-border-radius,12px) 0 0;}.tabs{display:flex;gap:var(--sp-2);background:rgba(127,127,127,0.12);padding:var(--sp-2);border-radius:var(--rad-l);flex-wrap:wrap;}.tab{border:0;background:transparent;color:var(--hp-muted);display:inline-flex;align-items:center;padding:var(--sp-3) var(--sp-5);border-radius:var(--rad-m);font-size:var(--fs-m);font-weight:600;cursor:pointer;transition:0.15s;font-family:inherit;}:host([data-pointer-hover]) .tab:hover{color:var(--hp-txt);}.tab.active{background:var(--hp-accent);color:var(--text-primary-color,#fff);}.farhint{position:absolute;left:50%;transform:translateX(-50%);bottom:var(--sp-4);z-index:12;display:flex;align-items:center;gap:var(--sp-2);max-width:calc(100% - var(--sp-8));background:var(--card-background-color,var(--hp-bg));opacity:0.94;color:var(--hp-txt);border:1px solid var(--divider-color,#33404d);border-radius:var(--rad-m);padding:var(--sp-1) var(--sp-3);font-size:var(--fs-s);}.farhint ha-icon{--mdc-icon-size:18px;color:var(--hp-warn,#e2a03f);flex:none;}.farhint span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.dropbtn{display:flex;align-items:center;gap:var(--sp-4);width:100%;text-align:left;border:1px solid var(--hp-muted);border-radius:var(--rad-m);background:transparent;color:var(--hp-txt);padding:var(--sp-4) 10px;cursor:pointer;font-family:inherit;font-size:var(--fs-m);margin-top:var(--sp-3);}.dropbtn .ref{color:var(--hp-muted);font-size:var(--fs-s);margin-left:auto;}.dropbtn ha-icon{--mdc-icon-size:18px;margin-left:var(--sp-2);}.dropbtn.open{border-color:var(--hp-accent);}.droppanel{border:1px solid var(--hp-accent);border-top:none;border-radius:0 0 var(--rad-m) var(--rad-m);padding:var(--sp-3);margin-top:-4px;}.hdr.kioskhide{display:none;}.decorbar .dcolor{width:30px;height:26px;padding:0;border:none;background:none;cursor:pointer;}.decorbar .dwidth{font-family:inherit;font-size:var(--fs-s);border-radius:var(--rad-s);background:var(--hp-bg2,transparent);color:var(--hp-txt);border:1px solid var(--hp-muted);padding:var(--sp-2) var(--sp-3);}.decorbar .bdhint{font-size:var(--fs-s);color:var(--hp-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.decorbar .dfill{display:inline-flex;align-items:center;gap:var(--sp-2);font-size:var(--fs-s);cursor:pointer;}.decorbar .dfill input[type="checkbox"]{width:16px;height:16px;flex:none;margin:0;padding:0;}.decorbar hp-color-opacity{flex:0 0 auto;}.modes{display:inline-flex;gap:var(--sp-1);background:rgba(127,127,127,0.12);border-radius:var(--rad-l);padding:var(--sp-2);}.modetab{display:inline-flex;align-items:center;gap:var(--sp-3);border:0;background:transparent;color:var(--hp-muted);padding:var(--sp-3) 10px;border-radius:var(--rad-m);font-size:var(--fs-m);font-weight:600;cursor:pointer;font-family:inherit;transition:background-color 0.14s ease,color 0.14s ease,transform 0.14s ease;}.modetab:active{transform:scale(0.97);}.modetab ha-icon{--mdc-icon-size:15px;}.tab[data-reorderable]{cursor:grab;}.tab.dragging{cursor:grabbing;opacity:0.55;}.tab.drop-before{box-shadow:inset 2px 0 0 0 var(--primary-color,#03a9f4);}.tab.drop-after{box-shadow:inset -2px 0 0 0 var(--primary-color,#03a9f4);}.modetab .closex{--mdc-icon-size:13px;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;min-width:24px;min-height:24px;margin:-5.5px -5.5px -5.5px -3.5px;opacity:0.75;cursor:pointer;border-radius:var(--rad-s);}:host([data-pointer-hover]) .modetab .closex:hover{opacity:1;}.editbar .barclose{box-sizing:border-box;width:40px;height:40px;padding:0;margin:0;min-width:40px;min-height:40px;justify-content:center;gap:0;line-height:0;}.editbar .barclose ha-icon{flex:none;margin:0;}.modetab.active{background:var(--hp-accent);color:var(--text-primary-color,#fff);}@media (max-width:720px){.modetab .ml{display:none;}}.editbar{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:stretch;border-bottom:1px solid var(--hp-line);font-size:var(--fs-m);}.editbar-tools{display:flex;align-items:center;gap:10px;padding:var(--sp-4) var(--sp-5);flex-wrap:wrap;min-width:0;outline:none;}.editbar-end{display:flex;align-items:center;padding:var(--sp-4) var(--sp-5);border-inline-start:1px solid var(--hp-line);background:var(--card-background-color,var(--hp-bg));position:relative;z-index:2;}.tab .tabedit{--mdc-icon-size:13px;display:inline-flex;align-items:center;margin-left:var(--sp-3);opacity:0.4;}:host([data-pointer-hover]) .tab:hover .tabedit{opacity:0.9;}.tab.tabadd{padding:var(--sp-3) var(--sp-4);}.tab.tabadd ha-icon{--mdc-icon-size:15px;}.rhint{font-size:var(--fs-s);color:var(--hp-muted);margin-bottom:var(--sp-3);}.togglehint{overflow-wrap:anywhere;}.togglehint>div + div{margin-top:var(--sp-1);}.editorchrome{display:block;height:0;opacity:0;visibility:hidden;overflow:hidden;}.editorchrome:not(.open){pointer-events:none;}.editorchrome.open{height:auto;opacity:1;visibility:visible;overflow:visible;}.editorchrome.transitioning{overflow:hidden;will-change:height;pointer-events:none;}.editorchrome.transitioning .barclose{pointer-events:auto;}.editorchrome-inner{min-height:0;transform-origin:top center;}.editorchrome.transitioning .editorchrome-inner{will-change:opacity;}@media (prefers-reduced-motion:reduce){.modetab{transition:none;}}.editbar .warn{color:#ffc14d;}.editbar .sname{font-weight:600;}.editbar input{width:74px;background:transparent;border:1px solid var(--hp-line);color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-m);}.editbar label,.editbar .hint{color:var(--hp-muted);font-size:var(--fs-s);}.editbar .drawwall{display:inline-flex;align-items:center;gap:var(--sp-3);white-space:nowrap;}.editbar .wallsgroup{display:inline-flex;align-items:center;gap:10px;white-space:nowrap;}.editbar .drawwall input{width:4.2em;}.editbar .drawwall .opl{color:var(--hp-muted);font-size:var(--fs-s);}.menuwrap{position:fixed;inset:0;z-index:80;}.menu{position:fixed;background:var(--hp-bg);border:1px solid var(--hp-accent);border-radius:var(--rad-l);box-shadow:var(--shadow-2);min-width:210px;max-width:300px;overflow:hidden;transform:translate(0,8px);}.menu .hd{padding:var(--sp-4) var(--sp-5);font-weight:600;font-size:var(--fs-m);border-bottom:1px solid var(--hp-line);display:flex;align-items:center;gap:var(--sp-3);}.menu .hd ha-icon,.menu .it.all ha-icon{color:var(--hp-accent);--mdc-icon-size:16px;}.menu .it{padding:var(--sp-4) var(--sp-5);font-size:var(--fs-m);cursor:pointer;display:flex;align-items:center;gap:var(--sp-4);}.menu .it ha-icon{--mdc-icon-size:16px;color:var(--hp-muted);}:host([data-pointer-hover]) .menu .it:hover{background:rgba(127,127,127,0.15);}.menu .it.all{color:var(--hp-accent);font-weight:600;}.tip{position:fixed;pointer-events:none;background:var(--hp-bg);border:1px solid var(--hp-accent);color:var(--hp-txt);padding:var(--sp-3) 10px;border-radius:var(--rad-m);font-size:var(--fs-m);box-shadow:var(--shadow-2);z-index:60;max-width:260px;}.tip .m{color:var(--hp-muted);font-size:var(--fs-s);display:block;}`,o`.head{display:flex;align-items:center;gap:10px;padding:10px var(--sp-5);border-bottom:1px solid var(--hp-line);flex-wrap:wrap;}.title{font-size:var(--fs-l);font-weight:600;display:flex;align-items:center;gap:var(--sp-3);white-space:nowrap;}.title ha-icon{color:var(--hp-accent);--mdc-icon-size:18px;}@media (max-width:1100px){.head .count{display:none;}}@media (max-width:620px){.head{gap:var(--sp-3);padding:var(--sp-4) 10px;}.head .title{font-size:var(--fs-m);}}.count{font-size:var(--fs-s);color:var(--hp-muted);}.btn{display:inline-flex;align-items:center;gap:var(--sp-3);border:1px solid var(--hp-line);background:transparent;color:var(--hp-txt);padding:var(--sp-3) 10px;border-radius:var(--rad-m);cursor:pointer;transition:0.15s;font-family:inherit;font-size:var(--fs-m);}.btn ha-icon{--mdc-icon-size:17px;}:host([data-pointer-hover]) .btn:hover{border-color:var(--hp-accent);}.btn.on{background:var(--hp-accent);color:var(--text-primary-color,#fff);border-color:var(--hp-accent);}.btn.ghost{border:none;}.btn[disabled]{opacity:0.5;pointer-events:none;}.sunrow{display:flex;align-items:center;gap:var(--sp-5);margin:var(--sp-3) 0;}.suncol{flex:1;display:flex;flex-direction:column;gap:var(--sp-3);min-width:0;}.recoveryoverlay{position:absolute;inset:0;z-index:75;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--sp-4);padding:var(--sp-6);box-sizing:border-box;background:linear-gradient(var(--ha-card-background,var(--card-background-color,#111)),var(--ha-card-background,var(--card-background-color,#111))),#111;color:var(--primary-text-color,#fff);text-align:center;pointer-events:auto;transition:opacity 0.15s ease;}.recoveryoverlay.phase-entering,.recoveryoverlay.phase-leaving{opacity:0;}.recoveryoverlay.phase-fading-in,.recoveryoverlay.phase-opaque{opacity:1;}.recoveryoverlay ha-icon{--mdc-icon-size:44px;color:var(--hp-accent);}.editorloading{position:absolute;z-index:74;left:50%;top:50%;display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-3) var(--sp-5);border:1px solid color-mix(in srgb,var(--hp-accent) 45%,transparent);border-radius:999px;background:color-mix(in srgb,var(--ha-card-background,var(--card-background-color,#111)) 92%,transparent);color:var(--primary-text-color);box-shadow:0 6px 22px rgb(0 0 0 / 18%);transform:translate(-50%,-50%);pointer-events:none;animation:editor-loading-in 0.15s ease both;}.editorloading ha-icon{--mdc-icon-size:22px;color:var(--hp-accent);animation:editor-loading-spin 0.9s linear infinite;}@keyframes editor-loading-in{from{opacity:0;transform:translate(-50%,calc(-50% + 4px));}to{opacity:1;transform:translate(-50%,-50%);}}@keyframes editor-loading-spin{to{transform:rotate(360deg);}}@media (prefers-reduced-motion:reduce){.recoveryoverlay,.editorloading,.editorloading ha-icon{transition:none;animation:none;}}.oplock{--oplock-size:calc(var(--icon-size,2.5cqw) * 0.62);--oplock-core-size:calc(var(--oplock-size) / 1.26875);--oplock-stroke-ratio:0.01875;--oplock-stroke-width:max(1px,calc(var(--oplock-core-size) * var(--oplock-stroke-ratio)));--oplock-core-bg:light-dark(#fff,#252525);--oplock-core-fg:light-dark(#252525,#fff);--oplock-shell-stroke:light-dark(#BCBCBC,rgb(37 37 37 / 75%));--oplock-shell-shadow:0 calc(var(--oplock-core-size) * .025) calc(var(--oplock-core-size) * .05) rgb(37 40 45 / 12%),0 calc(var(--oplock-core-size) * .1) calc(var(--oplock-core-size) * .175) calc(var(--oplock-core-size) * -.025) rgb(37 40 45 / 18%);--oplock-core-shadow:0 0 0 0 transparent;pointer-events:none;position:absolute;transform:translate(-50%,-50%);width:var(--oplock-size);height:var(--oplock-size);display:grid;place-items:center;border:0;background:transparent;z-index:1;}.oplock.theme-light{--oplock-core-bg:#fff;--oplock-core-fg:#252525;--oplock-shell-stroke:#BCBCBC;}.oplock.theme-dark{--oplock-core-bg:#252525;--oplock-core-fg:#fff;--oplock-shell-stroke:rgb(37 37 37 / 75%);--oplock-core-shadow:inset 0 calc(var(--oplock-core-size) * .0125) calc(var(--oplock-core-size) * .0125) rgb(255 255 255 / 70%);}.oplock-shell{box-sizing:border-box;width:100%;height:100%;border:var(--oplock-stroke-width) solid var(--oplock-shell-stroke);border-radius:50%;background:transparent;box-shadow:var(--oplock-shell-shadow);display:grid;place-items:center;pointer-events:none;backdrop-filter:none;}.oplock-core{width:var(--oplock-core-size);height:var(--oplock-core-size);border-radius:50%;background:var(--oplock-core-bg);color:var(--oplock-core-fg);box-shadow:var(--oplock-core-shadow);display:grid;place-items:center;pointer-events:none;}.oplock ha-icon{--mdc-icon-size:calc(var(--oplock-core-size) * 0.55);display:flex;line-height:0;}.oplock.locked{--oplock-core-bg:#66D17A;--oplock-core-fg:light-dark(#fff,#252525);--oplock-shell-stroke:#66D17A;}.oplock.theme-light.locked{--oplock-core-fg:#fff;}.oplock.theme-dark.locked{--oplock-core-fg:#252525;--oplock-stroke-ratio:.025;}.oplock.unlocked{--oplock-core-bg:#F0410C;--oplock-core-fg:light-dark(#fff,#252525);--oplock-shell-stroke:#F0410C;}.oplock.theme-light.unlocked{--oplock-core-fg:#fff;}.oplock.theme-dark.unlocked{--oplock-core-fg:#252525;--oplock-stroke-ratio:.025;}.oplock.unknown{--oplock-core-fg:var(--hp-muted);}.btn.lockact{width:100%;justify-content:center;display:flex;align-items:center;gap:var(--sp-3);margin-top:var(--sp-4);}.btn.lockact.warn{color:var(--error-color,#d33);border-color:var(--error-color,#d33);}.oprow{display:flex;align-items:center;gap:var(--sp-4);padding:var(--sp-3) 0;}.oprow b{margin-left:auto;}.oprow.ok b{color:#66d17a;}.oprow.warn b{color:var(--hp-open);}.bindharow{display:flex;align-items:center;gap:var(--sp-5);flex-wrap:wrap;}.bindharow .entcheck{opacity:0.9;}.ctrlchips{display:flex;flex-wrap:wrap;gap:var(--sp-3);margin:var(--sp-2) 0;}.ctrlchip{display:inline-flex;align-items:center;gap:var(--sp-2);background:var(--hp-accent);color:var(--text-primary-color,#fff);border-radius:var(--rad-l);padding:var(--sp-2) var(--sp-4);font-size:var(--fs-s);}.ctrlchip ha-icon{--mdc-icon-size:14px;cursor:pointer;}.ctrllist{display:flex;flex-direction:column;gap:var(--sp-1);margin-top:var(--sp-2);}.ctrlopt{display:flex;align-items:center;gap:var(--sp-4);text-align:left;border:0;background:transparent;color:var(--hp-txt);padding:var(--sp-3) var(--sp-4);border-radius:var(--rad-s);cursor:pointer;font-family:inherit;font-size:var(--fs-m);}:host([data-pointer-hover]) .ctrlopt:hover{background:var(--secondary-background-color,rgba(128,128,128,0.15));}.ctrlopt .sub{color:var(--hp-muted);font-size:var(--fs-s);margin-left:auto;}.ctrlopt ha-icon{--mdc-icon-size:16px;}.ctrlstates{display:flex;flex-direction:column;gap:var(--sp-2);}.ctrlstate{display:inline-flex;align-items:center;gap:var(--sp-3);color:var(--hp-muted);}.ctrlstate.on{color:var(--hp-txt);}.ctrlstate ha-icon{--mdc-icon-size:15px;}.cardpreview{display:flex;flex-direction:column;align-items:center;gap:var(--sp-2);margin:var(--sp-4) 0 var(--sp-1);padding:10px;border:1px dashed var(--hp-muted);border-radius:var(--rad-m);}.cardpreview .cpname{font-weight:700;letter-spacing:0.04em;}.cardpreview .cpmeta{display:inline-flex;align-items:center;gap:0.3em;font-weight:600;opacity:0.85;}.cardpreview .cpmeta ha-icon{--mdc-icon-size:1.05em;}.iconauto{display:flex;align-items:center;gap:var(--sp-3);font-size:var(--fs-s);margin:var(--sp-2) 0 0;}.iconauto ha-icon{--mdc-icon-size:18px;}.iconauto span{flex:1;}.iconauto .btn{min-height:32px;padding:0 var(--sp-3);}hp-dialog .dfill{display:inline-flex;align-items:center;gap:var(--sp-3);cursor:pointer;}.wallthick-dlg{position:absolute;z-index:40;min-width:200px;transform:translate(-50%,8px);padding:10px 12px;border-radius:10px;background:var(--card-background-color,#fff);box-shadow:0 8px 28px rgba(0,0,0,.22);display:flex;flex-direction:column;gap:8px;pointer-events:auto;}.wallthick-dlg .row{display:flex;align-items:center;gap:8px;}.wallthick-dlg input[type="number"]{width:5.5em;padding:4px 6px;border:1px solid var(--divider-color,#ccc);border-radius:6px;background:var(--input-fill,transparent);color:var(--primary-text-color);}.areasel,.namein{background:var(--hp-bg);border:1px solid var(--hp-line);color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-m);font-family:inherit;}.namein{width:130px;}.habindingbanner{display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-3) var(--sp-4);margin-bottom:var(--sp-4);border:1px solid var(--warning-color,#ff9800);border-radius:var(--rad-m);background:color-mix(in srgb,var(--warning-color,#ff9800) 12%,transparent);color:var(--primary-text-color,#f1f3f6);}.habindingbanner>span{flex:1;min-width:0;}.habindingbanner>ha-icon{color:var(--warning-color,#ff9800);flex:0 0 auto;}.habindingbanner.limited{border-color:var(--secondary-text-color,#9aa0aa);background:color-mix(in srgb,var(--secondary-text-color,#9aa0aa) 10%,transparent);}.habindingbanner.limited>ha-icon{color:var(--secondary-text-color,#9aa0aa);}.srcrow{display:flex;align-items:center;gap:var(--sp-4);font-size:var(--fs-m);cursor:pointer;padding:var(--sp-1) 0;}.dispsection{margin-top:var(--sp-5) !important;padding-top:var(--sp-4);border-top:1px solid var(--hp-line);font-weight:600;color:var(--hp-txt) !important;}.colorrow{display:flex;align-items:center;gap:var(--sp-4);}.roomtemprange{display:grid;gap:8px;min-width:0;}.roomtemprange-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px;}.roomtemprange-fields{display:flex;flex-wrap:wrap;align-items:center;gap:8px;min-width:0;}.roomtemprange-fields input{flex:0 1 104px;min-width:72px;}.roomtemprange-fields input[aria-invalid='true']{border-color:var(--error-color,#db4437);}.gsrow>hp-color-opacity{min-width:min(100%,210px);justify-content:space-between;}.ripple-colorrow>hp-color-opacity{width:100%;justify-content:space-between;}.ripple-sizerow>.opl{min-width:0;}.colorrow input[type='range']{flex:1;}.colorrow .tempin{width:70px;flex:none;}hp-dialog .body .temprange .tempin{width:56px;flex:none;padding:var(--sp-2) var(--sp-3);}hp-dialog .body .colorrow .tempin{width:72px;flex:none;}.srcrow{flex-wrap:nowrap;}.srcrow ha-switch{flex:none;}.colorrow ha-slider{flex:1;min-width:0;}.srcrow>span:first-of-type{white-space:nowrap;}.colorrow .opl{color:var(--hp-muted);font-size:var(--fs-s);}.colorrow .opv{font-size:var(--fs-s);min-width:34px;text-align:right;}.markerlightgroup{min-width:0;margin:var(--sp-5) 0 0;padding:var(--sp-4);border:1px solid var(--hp-line);border-radius:var(--rad-m);}.markerlightgroup legend{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-1);padding:0 var(--sp-2);color:var(--hp-txt);font-weight:600;}.markerlightgroup legend>span{min-width:0;overflow-wrap:anywhere;}.markerlightgroup[disabled]>:not(legend){opacity:.62;}.radargroup{display:grid;gap:var(--sp-2);}.radargroup>p{margin:0;}.radargroup>label:not(.srcrow){margin-top:var(--sp-2);}.radarcoordinates{align-items:flex-end;flex-wrap:wrap;}.radarcoordinates>label{display:grid;flex:1 1 92px;gap:var(--sp-1);min-width:0;margin:0;}hp-dialog .body .radarcoordinates .tempin{box-sizing:border-box;width:100%;}.radaradditional{margin-top:var(--sp-5);}.radaradditional summary{cursor:pointer;font-weight:600;}.radaradditional .btn{margin-top:var(--sp-3);}.radarinspection{display:grid;gap:6px;padding:10px 12px;border-radius:10px;background:color-mix(in srgb,var(--primary-color) 7%,transparent);}.radarinspection code{overflow-wrap:anywhere;font-size:12px;}.radarsetup{display:grid;gap:10px;margin-top:10px;padding:12px;border:1px solid var(--hp-accent);border-radius:var(--rad-m);background:color-mix(in srgb,var(--secondary-background-color) 88%,transparent);}.radarsetup-head{display:flex;align-items:center;gap:8px;}.radarsetup-head strong{flex:1;}.radarsetup>svg{width:min(100%,460px);aspect-ratio:1;justify-self:center;border-radius:var(--rad-m);background:var(--primary-background-color);touch-action:none;cursor:crosshair;}.radarsetup .room{fill:color-mix(in srgb,var(--hp-accent) 8%,transparent);stroke:var(--divider-color);stroke-width:3;vector-effect:non-scaling-stroke;}.radarsetup .heading{stroke:var(--hp-accent);stroke-width:4;vector-effect:non-scaling-stroke;}.radarsetup .trail{fill:none;stroke:var(--success-color,#43a047);stroke-width:3;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;opacity:.55;}.radarsetup g circle{fill:var(--hp-bg);stroke:var(--hp-accent);stroke-width:3;vector-effect:non-scaling-stroke;}.radarsetup g.pending circle{stroke-dasharray:5 4;}.radarsetup g text{fill:var(--hp-txt);font-size:22px;font-weight:700;text-anchor:middle;dominant-baseline:middle;pointer-events:none;}.markerhelpfield{margin-top:var(--sp-4);}.markerhelplabel{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-1);margin-bottom:var(--sp-1);}.markerhelplabel>label{min-width:0;overflow-wrap:anywhere;}.helpfieldlabel{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-1);min-width:0;margin-top:var(--sp-3);color:var(--hp-muted);font-size:var(--fs-s);}.helpfieldlabel.compact{margin-top:0;}hp-dialog .body .helpfieldlabel>label{min-width:0;margin-top:0;overflow-wrap:anywhere;}.help-inline-label{display:inline-flex;align-items:center;flex-wrap:wrap;gap:var(--sp-1);}hp-dialog .body .help-inline-label>label{min-width:0;margin-top:0;overflow-wrap:anywhere;}.markerradios{display:grid;gap:var(--sp-1);min-width:0;}.markerlightgroup .srcrow>span:first-of-type{min-width:0;white-space:normal;overflow-wrap:anywhere;}.markerglowvalue{margin:var(--sp-3) 0;flex-wrap:wrap;}.markerglowvalue hp-color-opacity{flex:none;}.markerlightdisabled{display:flex;align-items:center;gap:var(--sp-2);margin-top:var(--sp-2) !important;}.markerlightdisabled ha-icon{--mdc-icon-size:18px;flex:none;}.markerbadgetechnical{min-width:0;margin:var(--sp-1) 0 var(--sp-2) !important;overflow-wrap:anywhere;}.markerbadgetechnical code{white-space:normal;}.planrow{display:flex;align-items:center;gap:10px;}.savedplans{display:flex;flex-direction:column;gap:var(--sp-3);max-height:240px;overflow:auto;margin:var(--sp-3) 0 var(--sp-1);padding:var(--sp-3);border:1px solid var(--hp-line);border-radius:var(--rad-m);background:var(--hp-bg2,rgba(255,255,255,0.03));flex:0 0 auto;min-height:2.6em;}.savedplan{display:flex;align-items:center;gap:10px;}.savedplan.cur{outline:1px solid var(--hp-accent);border-radius:var(--rad-s);}.savedplan img{width:56px;height:40px;object-fit:contain;border:1px solid var(--hp-line);border-radius:var(--rad-s);background:#fff;flex:none;}.savedmeta{display:flex;flex-direction:column;min-width:0;flex:1;}.savedmeta b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.savedmeta .muted{font-size:var(--fs-s);}.savedplan .btn.danger ha-icon{color:#f25a4a;}.savedplan .btn[disabled]{opacity:0.4;pointer-events:none;}.planprev{max-width:120px;max-height:70px;border:1px solid var(--hp-line);border-radius:var(--rad-s);background:#fff;}.planname{font-size:var(--fs-m);max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.planname.muted{color:var(--hp-muted);}.filebtn{cursor:pointer;}.fileupload{display:inline-flex;min-width:0;}.fileupload>input{display:none;}.btn.danger{border-color:#b3402a;color:#ff7a5c;}hp-dialog .row .spacer{flex:1;}hp-dialog .body{max-height:66vh;overflow-y:auto;}hp-confirm{display:contents;}hp-dialog .danger-confirm-body{display:flex;flex-direction:column;gap:var(--sp-4);}hp-dialog .danger-confirm-body p{margin:0;line-height:1.45;}hp-dialog .danger-confirm-object{overflow-wrap:anywhere;font-size:var(--fs-l);line-height:1.3;}.descin{width:100%;box-sizing:border-box;background:var(--hp-bg);border:1px solid var(--hp-line);color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-m);font-family:inherit;resize:vertical;min-height:92px;flex-shrink:0;line-height:1.35;}.bindsel{display:flex;flex-direction:column;gap:var(--sp-3);border:1px solid var(--hp-line);border-radius:var(--rad-m);padding:var(--sp-4);}.bindsel .opt{display:flex;align-items:center;gap:var(--sp-3);border:1px solid var(--hp-line);background:transparent;color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);cursor:pointer;font-size:var(--fs-m);font-family:inherit;}.bindsel .opt.on{background:var(--hp-accent);color:var(--text-primary-color,#fff);border-color:var(--hp-accent);}.curbind{display:flex;align-items:center;gap:var(--sp-3);font-size:var(--fs-m);color:var(--hp-txt);flex-wrap:wrap;}.curbind .ref{color:var(--hp-muted);font-size:var(--fs-s);}.vacbox .vacbtns{display:flex;gap:var(--sp-4);margin:var(--sp-3) 0;flex-wrap:wrap;}.vacdiag{display:grid;gap:4px;margin-bottom:var(--sp-3);}.vacdiag>div{display:flex;justify-content:space-between;gap:var(--sp-5);}.vacdiag>div>span{color:var(--secondary-text-color);}.vacdiag>div>b{text-align:right;overflow-wrap:anywhere;}.vacroute-missing-group{margin-top:var(--sp-4);padding-top:var(--sp-4);border-top:1px solid var(--hp-line);}.vacroute-group-title{margin:0 0 var(--sp-3);color:var(--secondary-text-color);font-size:var(--fs-m);font-weight:600;}.vacroute-missing-group .vacroute-list{margin-top:0;}.vacpicker{margin:var(--sp-3) 0;}.vacsource-warning{display:grid;gap:8px;}.vacsource-warning .btn{justify-self:start;}.vacpicker>summary{display:inline-flex;width:auto;list-style:none;cursor:pointer;}.vacpicker>summary::-webkit-details-marker{display:none;}.vacsource-list{display:grid;gap:6px;margin-top:8px;}.vacsource-list details{padding:6px 0 0;}.vacsource-list details>summary{cursor:pointer;font-weight:600;}.vacsource{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-width:0;padding:9px 10px;border:1px solid var(--divider-color);border-radius:10px;color:var(--primary-text-color);background:var(--secondary-background-color);text-align:left;cursor:pointer;}.vacsource.on{border-color:var(--accent-color);box-shadow:inset 3px 0 var(--accent-color);}.vacsource>span:first-child{min-width:0;display:grid;gap:2px;}.vacsource small{color:var(--secondary-text-color);overflow-wrap:anywhere;}.vacsource-meta{color:var(--secondary-text-color);text-align:right;font-size:0.82em;}.vacxcme pre{margin:8px 0 0;white-space:pre-wrap;user-select:text;}.vacfit{position:absolute;inset:0;width:100%;height:100%;z-index:12;overflow:visible;touch-action:none;cursor:grab;pointer-events:auto;}.vacfit:active{cursor:grabbing;}.vacfit polygon{fill:color-mix(in srgb,var(--hp-accent) 16%,transparent);stroke:var(--hp-accent);stroke-width:2;vector-effect:non-scaling-stroke;stroke-dasharray:6 4;}.vacfit text{fill:var(--hp-accent);font-size:26px;text-anchor:middle;dominant-baseline:middle;pointer-events:none;user-select:none;}.furnpalette{display:flex;flex-direction:column;max-height:38vh;border-top:1px solid var(--hp-border,rgba(255,255,255,0.12));background:var(--card-background-color,var(--hp-bg));font-size:0.85em;}.furnhd{display:flex;align-items:center;gap:6px;padding:4px 8px;font-weight:600;opacity:0.9;}.furnhd .spacer{flex:1;}.furnbody{overflow:auto;padding:0 8px 6px;}.furngroup{margin:6px 0 3px;font-size:0.85em;text-transform:uppercase;letter-spacing:0.04em;opacity:0.6;}.furnrow{display:flex;flex-wrap:wrap;gap:4px;}.furnback{min-height:34px;gap:5px;margin:2px 0 4px;}.furnitem{display:flex;flex-direction:column;align-items:center;gap:2px;width:74px;padding:4px 2px;border:1px solid transparent;border-radius:8px;background:rgba(127,127,127,0.08);color:inherit;font:inherit;font-size:0.8em;line-height:1.15;text-align:center;cursor:pointer;}:host([data-pointer-hover]) .furnitem:hover{background:rgba(127,127,127,0.18);}.furnitem.on{border-color:var(--hp-accent);background:rgba(38,166,154,0.18);}.furnprev{width:40px;height:40px;color:var(--primary-text-color,currentColor);}.furncategory{width:92px;min-height:76px;}.furncatprev{width:48px;height:48px;}.furnvariants .furnitem{min-height:74px;}.furnsize{display:flex;align-items:center;flex-wrap:wrap;gap:6px;padding:6px 8px;border-top:1px solid var(--hp-border,rgba(255,255,255,0.12));}.furnsize label{display:flex;align-items:baseline;gap:3px;opacity:0.8;}.furnsize .furnunit{opacity:0.6;font-size:0.85em;}.furnsize input{width:5.5em;padding:3px 5px;}.furnhint{opacity:0.6;}.imageupload{display:inline-flex;gap:6px;margin:4px 0 8px;cursor:pointer;}.imageupload.disabled{opacity:0.55;pointer-events:none;}.imageupload input{display:none;}.imageassets{align-items:stretch;}.imageempty{padding:12px 6px;}.imageasset{position:relative;}.imageasset .furnitem{width:104px;min-height:92px;}.imageasset img{width:64px;height:54px;object-fit:contain;border-radius:4px;background:repeating-conic-gradient(#ddd 0 25%,#fff 0 50%) 50% / 12px 12px;}.imageasset .furnitem span{max-width:96px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.imageasset .furnitem small{opacity:0.65;font-size:0.72em;}.imageassetdelete{position:absolute;top:0;right:0;min-width:30px;width:30px;min-height:30px;padding:3px;}.imagepropertypreview{display:flex;align-items:center;gap:10px;min-width:0;}.imagepropertypreview img{width:72px;height:54px;object-fit:contain;border-radius:4px;background:repeating-conic-gradient(#ddd 0 25%,#fff 0 50%) 50% / 12px 12px;}.imagepropertypreview span{overflow-wrap:anywhere;}.vacfitdot{fill:var(--hp-accent);pointer-events:none;}.vacfithandle{fill:transparent;stroke:none;cursor:nwse-resize;}.vacfitknob{fill:var(--hp-bg);stroke:var(--hp-accent);stroke-width:2;vector-effect:non-scaling-stroke;pointer-events:none;}.vaccalbar{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);display:flex;gap:var(--sp-5);align-items:center;background:var(--hp-bg);color:var(--hp-txt);border:1px solid var(--hp-accent);border-radius:var(--rad-l);padding:10px var(--sp-5);z-index:60;box-shadow:var(--shadow-2);}.candlist{max-height:160px;overflow-y:auto;border-top:1px solid var(--hp-line);flex:0 0 auto;min-height:2.6em;}.cand{display:flex;justify-content:space-between;gap:var(--sp-4);padding:var(--sp-3) var(--sp-4);cursor:pointer;border-radius:var(--rad-s);font-size:var(--fs-m);}:host([data-pointer-hover]) .cand:hover{background:rgba(127,127,127,0.15);}.cand.sel{background:var(--hp-accent);color:var(--text-primary-color,#fff);}.cand .cs{color:var(--hp-muted);font-size:var(--fs-s);white-space:nowrap;}.opening-entity-candidate{width:100%;border:0;background:transparent;color:inherit;font:inherit;text-align:left;}.opening-entity-candidate.sel{background:var(--hp-accent);color:var(--text-primary-color,#fff);}.opening-entity-empty{cursor:default;}.cand.sel .cs{color:var(--text-primary-color,#fff);opacity:0.85;}.cand.muted{color:var(--hp-muted);cursor:default;}.pdfedit{display:flex;flex-wrap:wrap;gap:var(--sp-3);align-items:center;}.pdftag{display:inline-flex;align-items:center;gap:var(--sp-2);border:1px solid var(--hp-line);border-radius:var(--rad-s);padding:var(--sp-2) var(--sp-3);font-size:var(--fs-s);}.pdftag a{color:var(--hp-txt);text-decoration:none;max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.pdftag .x{--mdc-icon-size:15px;cursor:pointer;color:var(--hp-muted);}:host([data-pointer-hover]) .pdftag .x:hover{color:#ff7a5c;}.entlist{display:flex;flex-direction:column;gap:var(--sp-2);margin-bottom:10px;}.entrow{display:flex;align-items:center;gap:var(--sp-4);padding:var(--sp-3) var(--sp-4);border-radius:var(--rad-m);background:var(--secondary-background-color,rgba(128,128,128,0.12));}.entrow ha-icon{--mdc-icon-size:20px;color:var(--hp-muted);}.entrow.on ha-icon{color:var(--hp-accent);}.entrow .en{flex:1;font-size:var(--fs-m);}.entrow .ev{font-size:var(--fs-m);color:var(--hp-muted);}.entbtn{min-width:74px;min-height:32px;padding:var(--sp-2) var(--sp-5);border:1px solid var(--hp-muted);border-radius:999px;background:transparent;color:var(--hp-txt);font:inherit;font-size:var(--fs-m);cursor:pointer;}.entbtn.on{background:var(--hp-accent);border-color:var(--hp-accent);color:var(--text-primary-color,#fff);font-weight:600;}.inforow{display:flex;gap:10px;font-size:var(--fs-m);margin:var(--sp-2) 0;}.inforow .k{color:var(--hp-muted);min-width:84px;}.inforow a{color:var(--hp-accent);word-break:break-all;}.infodesc{font-size:var(--fs-m);white-space:pre-wrap;margin-top:var(--sp-3);}.infodesc.muted{color:var(--hp-muted);}.pdflist{display:flex;flex-direction:column;gap:var(--sp-2);}.pdf{display:inline-flex;align-items:center;gap:var(--sp-2);color:var(--hp-accent);text-decoration:none;}ha-icon-picker{display:block;}.floorrow{display:flex;align-items:center;gap:var(--sp-4);padding:var(--sp-3) var(--sp-2);font-size:var(--fs-m);cursor:pointer;}.floorrow .floorlvl{color:var(--hp-muted);font-size:var(--fs-s);border:1px solid var(--hp-line);border-radius:var(--rad-s);padding:0 var(--sp-3);}.rtest{display:flex;align-items:center;gap:var(--sp-4);margin-bottom:var(--sp-4);}.rtest .namein{flex:1;}.rtest ha-icon{color:var(--hp-accent);}.rtesticon{font-size:var(--fs-s);color:var(--hp-muted);}.rrow{display:flex;align-items:center;gap:var(--sp-3);margin:var(--sp-1) 0;}.rrow .rpat{flex:2;}.rrow .ricon{flex:1.4;}.rrow .rpat.bad{border-color:#ff7a5c;}.rrow .rprev{--mdc-icon-size:18px;color:var(--hp-txt);min-width:18px;}.rrow .ract{--mdc-icon-size:16px;color:var(--hp-muted);cursor:pointer;}:host([data-pointer-hover]) .rrow .ract:hover{color:var(--hp-txt);}:host([data-pointer-hover]) .rrow .ract.del:hover{color:#ff7a5c;}.gsrow .gsl{min-width:150px;font-size:var(--fs-m);color:var(--hp-muted);}.optimize-live{display:grid;justify-items:start;gap:var(--sp-2);margin-bottom:var(--sp-3);}.optimize-live .alignmsg,.optimize-live .rhint{margin-bottom:0;}.optimize-cleanup{min-height:44px;}.optimize-selected{color:var(--hp-txt);}.optimize-details{margin-top:var(--sp-3);color:var(--hp-muted);font-size:var(--fs-s);overflow-wrap:anywhere;}.optimize-details>summary{width:fit-content;color:var(--hp-txt);cursor:pointer;font-weight:600;}.optimize-details>summary:focus-visible{outline:2px solid var(--hp-accent);outline-offset:3px;border-radius:var(--rad-s);}.optimize-details ul{margin:var(--sp-3) 0;padding-inline-start:22px;}.optimize-details li + li{margin-top:var(--sp-1);}.btn.alignall{width:100%;justify-content:center;}.backupactions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--sp-3);}.backupactions .btn{justify-content:center;min-width:0;}.backupupload{display:inline-flex;min-width:0;}.backupupload>.btn{width:100%;justify-content:center;}.backupupload input{display:none;}.backupbody{min-width:0;}.backupplanonly{margin-inline-start:var(--sp-4) !important;align-items:flex-start !important;}.backupplanonly>span:first-of-type{display:grid;gap:2px;white-space:normal;}.backupplanonly small{color:var(--secondary-text-color);line-height:1.35;}.backupplanonlystatus{color:var(--hp-accent) !important;font-weight:700;}.backupfile,.backupsummary,.backupcontent{display:flex;flex-direction:column;min-width:0;gap:var(--sp-1);}.backupfile b,.backupcontent span{overflow-wrap:anywhere;}.backupfile span,.backupsummary span,.backupcontent span{color:var(--hp-muted);font-size:var(--fs-s);}.backupcounts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--sp-2) var(--sp-4);font-size:var(--fs-s);}.backupwarn,.backuperror{border-radius:var(--rad-s);padding:var(--sp-3);font-size:var(--fs-s);line-height:1.45;overflow-wrap:anywhere;}.backupwarn{background:color-mix(in srgb,var(--hp-accent) 12%,transparent);}.backuperror{background:rgba(179,64,42,.16);color:#ff7a5c;}.backupdetails{border:1px solid var(--hp-line);border-radius:var(--rad-s);padding:var(--sp-2) var(--sp-3);font-size:var(--fs-s);}.backupdetails summary{cursor:pointer;font-weight:700;}.backupdetails>div{display:grid;gap:var(--sp-1);padding-block-start:var(--sp-2);}.backupdetails code{overflow-wrap:anywhere;color:var(--hp-muted);}.backupchoices{display:flex;flex-direction:column;gap:var(--sp-2);border:1px solid var(--hp-line);border-radius:var(--rad-s);min-width:0;}.backupchoices label{margin:0 !important;display:flex;gap:var(--sp-2);}.backupconfirm{align-items:flex-start !important;}.backupconfirm>span:first-of-type{min-width:0;white-space:normal;overflow-wrap:anywhere;}@media (max-width:520px){.backupactions,.backupcounts{grid-template-columns:1fr;}}.aboutver{font-size:var(--fs-s);color:var(--hp-muted);margin:var(--sp-2) 0 var(--sp-3);}.aboutlink{display:flex;align-items:center;gap:var(--sp-3);width:fit-content;color:var(--hp-accent);text-decoration:none;font-size:var(--fs-m);padding:var(--sp-1) 0;}:host([data-pointer-hover]) .aboutlink:hover{text-decoration:underline;}.aboutlink ha-icon{--mdc-icon-size:18px;line-height:1;}hp-dialog .supportbody{min-width:0;overflow-x:hidden;gap:var(--sp-5);}.supportsection{display:grid;min-width:0;gap:var(--sp-2);}.supportsection + .supportsection{padding-top:var(--sp-4);border-top:1px solid var(--hp-line);}.supportsection h3{margin:0;color:var(--hp-txt);font-size:var(--fs-m);}.supportlinks,.supportactions{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-2) var(--sp-4);min-width:0;}.supportform>label:not(.srcrow){margin-top:var(--sp-2);color:var(--hp-muted);font-size:var(--fs-s);}.supportmessage,.supportraw{width:100%;min-width:0;box-sizing:border-box;resize:vertical;border:1px solid var(--hp-line);border-radius:var(--rad-s);padding:var(--sp-3);color:var(--hp-txt);background:color-mix(in srgb,var(--card-background-color,var(--hp-bg)) 92%,var(--hp-txt));font:inherit;}.supportmessage{min-height:120px;background:var(--hp-bg);}.supportraw{min-height:220px;margin-top:var(--sp-2);resize:none;white-space:pre;overflow:auto;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;}.supportattach{min-width:0;align-items:flex-start;margin:var(--sp-2) 0 0 !important;}.supportattach>span:first-of-type{min-width:0;white-space:normal;overflow-wrap:anywhere;}.supportwarning,.supportstatus,.supportupdate{display:flex;align-items:flex-start;gap:var(--sp-2);min-width:0;margin:0;padding:var(--sp-3);border-radius:var(--rad-s);background:color-mix(in srgb,var(--hp-accent) 14%,transparent);overflow-wrap:anywhere;font-size:var(--fs-s);line-height:1.45;}.supportwarning ha-icon,.supportstatus ha-icon,.supportupdate ha-icon{flex:none;color:var(--hp-accent);--mdc-icon-size:20px;}.supportpreview,.supportmanual,.supporterror,.supportsuccess{display:grid;min-width:0;gap:var(--sp-2);padding:var(--sp-3);border:1px solid var(--hp-line);border-radius:var(--rad-s);}.supportsummary{font-weight:600;overflow-wrap:anywhere;}.supporthash{display:grid;min-width:0;gap:var(--sp-1);color:var(--hp-muted);font-size:var(--fs-s);}.supporthash code{overflow-wrap:anywhere;color:var(--hp-txt);}.supportpreview details{min-width:0;}.supportpreview summary{cursor:pointer;color:var(--hp-accent);}.supportprivacy{margin:0 !important;line-height:1.45;}.supporterror{background:color-mix(in srgb,var(--error-color,#db4437) 12%,transparent);border-color:color-mix(in srgb,var(--error-color,#db4437) 45%,var(--hp-line));}.supportsuccess{background:color-mix(in srgb,var(--success-color,#43a047) 12%,transparent);border-color:color-mix(in srgb,var(--success-color,#43a047) 45%,var(--hp-line));}.supportfooter{flex-wrap:wrap;}@media (max-width:520px){hp-dialog .supportbody{padding-inline:var(--sp-4);}hp-dialog .supportfooter{padding-inline:var(--sp-4);}.supportactions .btn,.supportactions .aboutlink{max-width:100%;}}hp-dialog .body{padding:var(--sp-5) var(--sp-6);display:flex;flex-direction:column;gap:var(--sp-3);}hp-dialog .tapconfirm-body{min-width:0;overflow-x:hidden;}hp-dialog .tapconfirm-body p{max-width:100%;min-width:0;margin:0;overflow-wrap:anywhere;white-space:normal;}hp-dialog .tapconfirm-line{color:var(--hp-muted);}hp-dialog .body label{font-size:var(--fs-s);color:var(--hp-muted);margin-top:var(--sp-3);}hp-dialog .body .namein,hp-dialog .body .areasel{width:100%;box-sizing:border-box;}hp-dialog.roomdialog .body{min-width:0;overflow-x:hidden;}hp-dialog.roomdialog .body>*{min-width:0;max-width:100%;box-sizing:border-box;}hp-dialog.roomdialog .srcrow{min-width:0;align-items:flex-start;}hp-dialog.roomdialog .srcrow>span:first-of-type{min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.35;}hp-dialog.roomdialog .dropbtn>b,hp-dialog.roomdialog .dropbtn>.ref{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}hp-dialog .row{display:flex;justify-content:flex-end;gap:var(--sp-4);width:100%;min-width:0;box-sizing:border-box;padding:var(--sp-5) var(--sp-6);border-top:1px solid var(--hp-line);}hp-dialog>.row[slot='footer'] button{min-height:44px;}hp-dialog .row.dialog-action-footer{align-items:center;justify-content:flex-start;flex-wrap:wrap;row-gap:var(--sp-4);}hp-dialog .dialog-action-group{display:flex;flex:0 1 auto;flex-wrap:wrap;align-items:center;gap:var(--sp-4);max-width:100%;min-width:0;}hp-dialog .dialog-action-group .btn{flex:0 0 auto;min-height:44px;}hp-dialog .dialog-action-danger{margin-right:auto;}hp-dialog .dialog-action-commit{margin-left:auto;justify-content:flex-end;}hp-dialog .row.markerfooter{justify-content:space-between;align-items:center;flex-wrap:wrap;}hp-dialog .row.roomfooter{align-items:center;flex-wrap:wrap;}hp-dialog .row.infofooter{align-items:center;justify-content:flex-start;flex-wrap:wrap;gap:var(--sp-3);}hp-dialog .row.infofooter .btn{flex-shrink:0;}hp-dialog .row.infofooter .infofooter-close{margin-left:auto;}@media (max-width:480px){hp-dialog .row.infofooter{padding:var(--sp-4) var(--sp-5);}}.markeractions,.markersaveactions{display:flex;align-items:center;gap:var(--sp-4);}.markeractions:empty{display:none;}.markersaveactions{margin-left:auto;}.device-inbox{display:flex;flex-direction:column;gap:var(--sp-4);padding:var(--sp-5) var(--sp-6);min-width:0;}.device-inbox-dialog{--hp-dialog-wide-width:920px;}.device-inbox-head{display:grid;grid-template-columns:minmax(180px,1fr) auto;align-items:center;gap:var(--sp-4);}.device-inbox-search{width:100%;min-width:0;box-sizing:border-box;border:1px solid var(--hp-line);border-radius:var(--rad-m);background:transparent;color:var(--hp-txt);font:inherit;padding:11px 14px;}.device-inbox-tabs{display:flex;gap:var(--sp-2);overflow-x:auto;scrollbar-width:thin;padding-bottom:var(--sp-1);}.device-inbox-tabs button{flex:0 0 auto;border:1px solid var(--hp-line);border-radius:999px;background:transparent;color:var(--hp-txt);font:inherit;padding:8px 12px;cursor:pointer;}.device-inbox-tabs button.on{border-color:var(--hp-accent);background:color-mix(in srgb,var(--hp-accent) 18%,transparent);}.device-inbox-tabs button span{color:var(--hp-muted);margin-inline-start:4px;}.device-inbox-discovery{margin:8px 0;padding:8px 10px;border:1px solid var(--divider-color,#e0e0e0);border-radius:8px;}.device-inbox-discovery summary{cursor:pointer;font-weight:600;}.device-inbox-discovery .srcrow{display:flex;gap:6px;align-items:center;margin:8px 0;}.device-inbox-excluded{display:flex;flex-wrap:wrap;gap:6px;align-items:center;}.device-inbox-excluded>span{font-weight:500;}.device-inbox-chips{display:flex;flex-wrap:wrap;gap:4px;}.device-inbox-chips .chip{display:inline-flex;align-items:center;gap:2px;padding:1px 6px;border-radius:10px;background:var(--secondary-background-color,#f0f0f0);font-size:12px;}.device-inbox-chips .chip button{border:none;background:none;cursor:pointer;padding:0 2px;color:var(--secondary-text-color,#666);}.device-inbox-excluded input[type="text"]{flex:1 1 140px;min-width:120px;padding:4px 6px;border:1px solid var(--divider-color,#e0e0e0);border-radius:6px;background:var(--card-background-color,#fff);color:var(--primary-text-color,#212121);}.device-inbox-preview{margin:8px 0 4px;font-size:13px;opacity:0.85;}.device-inbox-filters{display:flex;flex-wrap:wrap;gap:var(--sp-4) var(--sp-6);color:var(--hp-muted);}.device-inbox-filters label{display:inline-flex;align-items:center;gap:var(--sp-2);cursor:pointer;}.device-inbox-filter-help{display:inline-flex;align-items:center;gap:var(--sp-1);min-width:0;}.device-inbox-results{display:grid;gap:var(--sp-3);min-width:0;}.device-inbox-row{display:grid;grid-template-columns:42px minmax(180px,1fr) minmax(180px,auto);align-items:center;gap:var(--sp-4);min-width:0;border:1px solid var(--hp-line);border-radius:var(--rad-m);padding:var(--sp-4);background:color-mix(in srgb,var(--hp-txt) 3%,transparent);}.device-inbox-icon{--mdc-icon-size:28px;color:var(--hp-txt);justify-self:center;}.device-inbox-copy{min-width:0;}.device-inbox-name{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-2);}.device-inbox-new{border-radius:999px;background:var(--hp-accent);color:var(--text-primary-color,#fff);font-size:var(--fs-s);padding:2px 7px;}.device-inbox-meta,.device-inbox-reason,.device-inbox-copy code{display:block;color:var(--hp-muted);font-size:var(--fs-s);overflow-wrap:anywhere;white-space:normal;}.device-inbox-status{color:var(--error-color,#db4437);margin-inline-start:var(--sp-2);}.device-inbox-actions{display:flex;justify-content:flex-end;align-items:center;flex-wrap:wrap;gap:var(--sp-2);}.device-inbox-actions .btn{min-height:36px;padding:7px 10px;}.device-inbox-menu{position:relative;}.device-inbox-menu summary{list-style:none;cursor:pointer;}.device-inbox-menu summary::-webkit-details-marker{display:none;}.device-inbox-menu-items{position:absolute;z-index:2;inset-inline-end:0;top:calc(100% + var(--sp-1));display:grid;gap:var(--sp-1);min-width:180px;padding:var(--sp-2);border:1px solid var(--hp-line);border-radius:var(--rad-m);background:var(--hp-panel,var(--card-background-color,#fff));box-shadow:0 8px 24px rgba(0,0,0,.22);}.device-inbox-menu-items .btn{justify-content:flex-start;width:100%;}.device-inbox-empty{color:var(--hp-muted);text-align:center;padding:var(--sp-8);}.device-inbox-more{align-self:center;}@media (max-width:680px){.device-inbox{padding:var(--sp-4);}.device-inbox-head{grid-template-columns:minmax(0,1fr);}.device-inbox-head .btn{justify-self:stretch;}.device-inbox-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));overflow-x:visible;}.device-inbox-tabs button{min-width:0;overflow-wrap:anywhere;}.device-inbox-row{grid-template-columns:36px minmax(0,1fr);}.device-inbox-actions{grid-column:1 / -1;justify-content:flex-start;}}`];var sp={"editor.context_actions":"Actions: {object}","editor.tool_options":"Tool options: {tool}","editor.palette":"Palette: {tool}","editor.open_group":"Tool group: {group}","editor.group_active":"{group} — active: {item}","editor.disabled_action":"{action} is unavailable: {reason}","editor.loading":"Loading editor…","editor.loading_aria":"The plan editor is loading","editor.load_failed":"Could not load the editor.","editor.refresh_advice":"Refresh the page and try again.","editor.retry_advice":"Check your connection and press again.","version_mismatch.title":"House Plan versions do not match","version_mismatch.body":"If Home Assistant is still restarting, let it finish, then reload this page.","version_mismatch.frontend":"Card","version_mismatch.backend":"Integration","version_mismatch.reload":"Reload page","color_picker.title":"Color picker","color_picker.hue":"Hue","color_picker.saturation":"Saturation","color_picker.value":"Brightness","color_picker.hex":"Hex color","color_picker.invalid_hex":"Enter a 3- or 6-digit hex color","color_picker.confirm":"OK","btn.properties":"Properties","btn.keep_as_walls":"Keep as walls","btn.delete_room_keep_walls":"Delete room, keep walls","btn.delete_room_with_walls":"Delete room and walls","title.markup_select":"Select and edit walls and columns","title.markup_column":"Column: click a grid point to place a square column","markup.partition":"Partition","markup.column":"Column","markup.hint_column":"click a grid point to place a square column","history.wall_segment":"Add wall segment","history.column_add":"Add column","history.physical_edit":"Change physical object","history.physical_delete":"Delete physical object","history.physical_move":"Move physical object","history.wall_face_batch":"Create rooms from walls","toast.column_duplicate":"A column with the same centre and outer size already exists","physical.partition_properties":"Partition properties","physical.column_properties":"Column properties","physical.shape":"Shape","physical.square":"Square","physical.circle":"Circle","physical.diameter":"Diameter","physical.side":"Side","physical.rotation":"Rotation angle","physical.length":"Length","physical.allowed_range":"Allowed: {min}–{max} {unit}","physical.column_size_title":"Outer side of the square column placed by the click (1–150 cm).","card.title":"House plan","count.devices":"{n} dev.","empty.no_spaces":"No spaces yet.","nav.spaces":"House Plan spaces","empty.add_first":"Add the first space and upload a floor plan.","empty.read_only":"No spaces are configured. Ask an administrator to add one.","empty.install":'Install the House Plan integration and add it in "Devices & services".',"btn.add_space":"Add space","btn.cancel":"Cancel","btn.save":"Save","btn.close":"Close","btn.delete":"Delete","btn.copy":"Copy","btn.edit":"Edit","btn.open_in_ha":"Open in HA","btn.reset":"Reset","btn.attach":"Attach…","btn.upload":"Upload…","btn.replace":"Replace…","title.zoom_in":"Zoom in","title.zoom_out":"Zoom out","title.zoom_fit":"Fit all","title.configure_space":"Configure space","title.add_space":"Add space","title.markup_add":"Walls: draw a continuous chain; each accepted segment is saved independently. Shift locks to 45°","title.markup_merge":"Merge: click one room, then the neighbour it shares a wall with","title.markup_split":"Split a room: click the room, then two points on its walls","title.markup_delroom":"Delete room: click inside a room and confirm","title.need_plan":"Upload a floor-plan image","markup.add":"Walls","markup.merge":"Merge","markup.split":"Split","markup.resize":"Resize","title.markup_resize":"Resize rooms: drag an available horizontal or vertical wall handle","markup.hint_resize":"drag an available wall handle · the wall stops at the first unsafe position · Esc cancels · Ctrl+Z — undo","resize.disabled.diagonal":"This wall is angled; Resize supports only horizontal and vertical walls","resize.disabled.side-angle":"An adjoining wall is angled; Resize requires both adjoining walls to meet this wall at right angles","resize.disabled.duplicate-physical-wall":"A separate partition or column overlaps this wall; remove or move it before resizing","resize.disabled.partial-shared":"A neighbouring room uses only part of this wall, so it cannot be moved safely as one shared wall","resize.disabled.unequal-shared":"The neighbouring room uses different endpoints or wall length, so the walls cannot move together safely","resize.disabled.multiple-rooms":"Moving this wall would affect more than two rooms","resize.disabled.thickness-conflict":"The wall thickness cannot be preserved safely","resize.disabled.opening-conflict":"An opening on this wall cannot be moved safely","resize.disabled.invalid-geometry":"This wall cannot be resized without changing the plan structure","resize.limit_stopped":"Wall stopped: the next step would break a junction limit","resize.commit_failed":"Resize was cancelled because the final plan did not pass the geometry check","resize.preview_failed":"Resize stopped at the last safe position because the plan geometry could not be preserved","markup.opening":"Opening","markup.delete_room":"Delete room","history.undo":"Undo","history.redo":"Redo","history.undo_named":"Undo: {name} (Ctrl+Z)","history.redo_named":"Redo: {name} (Ctrl+Shift+Z / Ctrl+Y)","history.undo_empty":"Nothing to undo","history.redo_empty":"Nothing to redo","history.undone":"Undone: {name}","history.redone":"Redone: {name}","history.add_room":"Create room","history.split_room":"Split room","history.merge_rooms":"Merge rooms","history.resize_room":"Resize room","history.wall_thickness":"Change wall thickness","history.add_opening":"Add door or window opening","history.edit_opening":"Edit opening","history.move_opening":"Move opening","history.delete_opening":"Delete opening","history.delete_room_keep_walls":"Delete room, keep walls","history.delete_room_with_walls":"Delete room and walls","history.decor_add":"Add decor object","history.decor_edit":"Edit decor object","history.decor_move":"Move decor object","history.decor_transform":"Transform decor object","history.decor_delete":"Delete decor object","history.backdrop_transform":"Transform plan backdrop","history.device_move":"Move {name}","history.device_stale":"Device position history is no longer applicable and was cleared","opening.new":"New opening","opening.edit":"Opening","opening.door":"Door","opening.window":"Window","opening.gate":"Gate","opening.passage":"Open passage","opening.passage_binding_warning":"Saving will remove the open/close sensor and lock.","opening.invalid_passage_fields":"The open passage on plan “{room}” has unsupported settings: {fields}.","opening.type_label":"Type","opening.length_label":"Length, cm","opening.contact_label":"Open/close sensor","opening.lock_label":"Lock","opening.none":"— none —","opening.search_ph":"Search: name or entity id…","opening.invert":"Invert open/closed","opening.flip_h":"Hinge on the other jamb","opening.flip_v":"Opens to the other side","opening.open":"Open","opening.closed":"Closed","opening.locked":"Locked","opening.unlocked":"Unlocked","opening.state_unknown":"unavailable","opening.no_entities":"No sensors bound — a static symbol on the plan.","toast.opening_no_wall":"Click next to a room wall or independent wall","opening.host_partition":"Independent wall","opening.partition_orphan":"The independent wall for this opening no longer exists","opening.partition_jamb_margin":"Leave at least {distance} between the opening and the end of the wall","opening.rebind_partition":"Attach to another independent wall","confirm.delete_partition_openings_title":"Delete wall and openings?","confirm.delete_partition_openings_body":"This wall contains {count} opening(s). They will be deleted together.","confirm.delete_partition_openings_item":"• {type}, {length}","markup.hint_points":"points: {n} · Shift — 45° steps · Esc — finish chain · Ctrl+Z — undo a point · closing an area offers a room","markup.hint_start":"click a grid dot to start a wall chain","tip.lqi":"average zigbee signal:","tip.area":"area: {value}","info.device_header":"Device on the plan","info.model":"Model","info.state":"State","info.link":"Link","info.manuals":"Manuals","info.none":"No additional information","marker.new_device":"New device","marker.name_label":"Name (shown on the plan)","marker.name_ph":"Name","marker.binding_label":"Bind to an HA device","marker.binding_disabled":"disabled in Home Assistant","marker.virtual_option":"Virtual device (no binding)","marker.search_ph":"Search device / group…","marker.nothing_found":"nothing found","marker.room_label":"Room","marker.room_override":" (override placement)","marker.room_choose":"— select a room —","marker.room_auto":"— by device area (auto) —","marker.icon_label":"Icon","marker.icon_ph":"mdi:… (empty = auto)","marker.display_label":"Display","display.badge":"Icon + state","display.icon_ripple":"Icon + state and activity","display.static_icon":"Always static icon","marker.display_hint_badge":"The icon and dynamic plate show device state without the ordinary activity pulse. Red alarms remain visible.","marker.display_hint_icon_ripple":"The icon, dynamic plate and pulse show a short pulse for events and a continuous pulse for work, motion or presence. Red alarms have separate priority.","marker.display_hint_value":"A selected or automatically resolved Home Assistant value replaces the icon while the plate continues to show state. Red alarms remain visible.","marker.display_hint_static_icon":"The theme-aware shell and icon always stay the same. State, activity, unavailability and alarms do not change the face.","marker.static_alarm_warning":"This device can report alarms. Static display hides the marker's visual alarm indication.","marker.preview.title":"Display preview","marker.preview.actual":"Now","marker.preview.example":"Example","marker.preview.integration":"Provided by","marker.preview.source":"Display source","marker.preview.current_state":"Current state","marker.preview.result":"On the plan","marker.preview.details":"Source details","marker.preview.select_source":"Choose a Home Assistant device or entity to see its actual display.","marker.preview.unknown_provider":"Unknown integration","marker.preview.virtual_provider":"House Plan · virtual device","marker.preview.no_source":"No active source","marker.preview.no_state":"No current state","marker.preview.mixed_states":"Several different states","marker.preview.multiple_sources":"{n} sources","marker.preview.more_sources":"+{n} more","marker.preview.scaled":"The preview is scaled to {n}% to fit. The saved size is unchanged.","marker.preview.demo_short":"Show short activity","marker.preview.demo_continuous":"Show continuous activity","marker.preview.stop_continuous":"Stop continuous activity","marker.preview.demo_short_notice":"Short activity example; the actual device state is unchanged.","marker.preview.demo_continuous_notice":"Continuous activity example; the actual device state is unchanged.","marker.preview.demo_already_visible":"The current state already shows a real activity or alarm effect.","marker.preview.reduced_motion":"System reduced-motion is enabled, so ordinary activity is shown as a dot.","marker.preview.reason.neutral":"Neutral dark plate","marker.preview.reason.working":"Yellow plate: the device is working now","marker.preview.reason.working_activity":"Yellow plate and activity effect: the device is working now","marker.preview.reason.open":"Orange plate: physically open or unlocked","marker.preview.reason.cover_icon_state":"Neutral plate; the cover entity controls the displayed state and icon","marker.preview.reason.presence":"Activity effect while presence is detected","marker.preview.reason.event":"Short activity effect after a detected event","marker.preview.reason.transition":"Activity effect while the device is moving or changing state","marker.preview.reason.media_neutral":"Media devices stay on a neutral dark plate while available","marker.preview.reason.unavailable":"Subdued neutral plate: unavailable or off","marker.preview.reason.alarm":"Red alarm plate; alarm indication is always shown","marker.preview.reason.live_states_disabled":"Live-state styling is disabled for this card","marker.preview.reason.value_no_state":"No usable state value; the icon is shown instead","marker.preview.reason.value_ambiguous_sources":"Several possible value sources; the icon is shown instead","marker.preview.reason.value_non_scalar":"The source did not return a simple value; the icon is shown instead","marker.preview.reason.value_virtual":"A virtual device has no Home Assistant value; the icon is shown instead","marker.preview.reason.vacuum_live_plan_only":"Live vacuum position and trail are available only on the full plan","marker.preview.reason.hidden_design_preview":"The device is hidden on the plan; this design preview remains visible","marker.preview.reason.composite_power_source":"State comes from the device Power entity; auxiliary switches are ignored","marker.preview.reason.activity_display_disabled":"The selected display mode does not show ordinary activity effects","marker.preview.reason.ha_disabled":"The Home Assistant binding is disabled and will be hidden on the plan","marker.preview.reason.orphaned":"The saved Home Assistant binding can no longer be found","marker.preview.reason.static_icon":"Static mode: device state does not change the icon","marker.activity_color":"Activity pulse color","marker.ripple_size":"Activity pulse size","marker.activity_alarm_note":"Color and size affect ordinary activity only and do not change red alarms.","marker.pulse_a11y_alarm":"Alarm","marker.pulse_a11y_event":"Recent event","marker.pulse_a11y_presence":"Presence detected","marker.pulse_a11y_transition":"Changing state","marker.pulse_a11y_running":"Working","marker.state_a11y_neutral":"Default state","marker.state_a11y_working":"Working","marker.state_a11y_open":"Open","marker.state_a11y_locked":"Locked","marker.state_a11y_unlocked":"Unlocked","marker.state_a11y_alarm":"Alarm","marker.state_a11y_unavailable":"Unavailable","marker.lqi_a11y_low":"LQI {value}, low signal","marker.lqi_a11y_mid":"LQI {value}, medium signal","marker.lqi_a11y_high":"LQI {value}, high signal","marker.size_label":"Icon size / rotation","marker.angle_label":"Rotate","marker.model_label":"Model","marker.model_ph":"e.g. Aqara T&H","marker.link_label":"Link","marker.desc_label":"Description","marker.desc_ph":"Notes, specs…","marker.manuals_label":"Manuals (PDF etc.)","marker.sub_device":"device","marker.sub_z2m_group":" · Z2M group","marker.sub_group":"group","marker.sub_helper":"helper","space.new":"New space","space.copy_title":"Copy space","space.copy_name":"New space name","space.copy_fallback":"Space","space.copy_create":"Create copy","space.copy_optimize_title":"Optimize before copying?","space.copy_optimize_body":"Before creating “{name}”, House Plan must optimize the entire plan, including other spaces. Continue?","space.copy_optimize_confirm":"Optimize and copy","space.copy_error_changed":"The plan changed while confirmation was open. Review it and try again.","space.copy_error_source_missing":"The source space no longer exists. Reopen its settings and try again.","space.copy_error_source_invalid":"House Plan could not validate every wall in this space. Fix the source space and try again.","space.copy_error_spaces_limit":"House Plan already has the maximum number of spaces.","space.copy_error_partitions_limit":"This space has too many walls to copy.","space.copy_error_openings_limit":"This space has too many openings to copy.","space.copy_error_decor_limit":"This space has too many background objects to copy.","space.copy_error_columns_limit":"This space has too many columns to copy.","space.copy_error_opening_host":"One of the openings is no longer attached to a wall. Fix or delete it before copying.","space.copy_error_geometry":"The copy would create unsafe wall geometry. Fix the source space and try again.","space.copy_error_optimize_geometry":"Copy stopped because optimizing the entire plan is unsafe for one of the spaces.","space.header":"Space","space.title_label":"Title","space.title_ph":"e.g. Garage","space.plan_label":"Floor plan (background)","space.no_plan":"no plan image","space.plan_alt":"plan","room.new":"New room","room.name_label":"Display name","room.name_ph":"e.g. Terrace","room.area_label":"Home Assistant area (unassigned)","room.no_area_option":"— no area —","room.default_name":"Room","device.unnamed":"unnamed","device.light_group":"light group","device.fallback":"device","device.virtual":"virtual device","confirm.delete_room_title":'Delete room "{name}"?',"confirm.delete_room_body":"Choose whether the room's exclusive physical walls should remain. Walls shared with another room are always kept.","confirm.remove_marker_title":"Delete device from the plan?","confirm.remove_marker_body":"The device will disappear completely and stop contributing to plan data. You can add it again later.","confirm.erase_decor":"Erase the {kind} object? You can undo this action from the editor history.","confirm.delete_space_title":"Delete space?","confirm.delete_space_body":"The space, all its rooms and all its plan markup will be deleted.","confirm.delete_space_vac_routes":"Robot map assignments will also be removed: {count}.","space.delete_blocked":"This space is still used by {n} device(s). Move them to another space or delete them first.","toast.pos_save_failed":"Failed to save position: {err}","toast.no_entity":"The device has no suitable entity","toast.ha_disabled_action":"A Home Assistant object that is disabled cannot be used on the plan.","toast.ha_disabled_show_device":"A device disabled in Home Assistant cannot be shown on the plan. Enable it in Home Assistant first.","toast.ha_disabled_show_entity":"An entity disabled in Home Assistant cannot be shown on the plan. Enable it in Home Assistant first.","toast.ha_disabled_add":"A disabled Home Assistant object cannot be added to the plan. Enable it in Home Assistant first.","toast.ha_binding_unverified":"The object status could not be verified through the Home Assistant registry. Display and actions are temporarily unavailable.","toast.markup_needs_server":"Markup is available after the config is moved to the server","toast.space_order_changed":"Order changed. If any card pins its floor by number, check those panels.","toast.conflict":"Config was changed in another window — data refreshed, repeat your last action","toast.cfg_save_failed":"Failed to save config: {err}","toast.room_overlap":"The outline overlaps room “{name}” — rooms must not overlap","toast.contour_cannot_close":"The outline cannot close because it is degenerate or intersects itself","toast.merge_not_adjacent":"Only rooms that share a wall can be merged","toast.rooms_merged":"Rooms merged into “{name}”","toast.split_pick_wall":"Start the cut on the room’s wall","toast.split_bad_cut":"The cut must run wall to wall inside the room, without crossing walls or itself","merge.header":"Merge rooms","merge.hint":"The merged room keeps one name and one area. The other area is released — its devices leave the plan until another room claims it.","merge.keep":"Keep","merge.no_area":"no area","toast.room_saved":"Room saved ({n}). Devices added: {added}. Outline the next one or exit markup.","toast.room_saved_no_area":"Room saved ({n}, no area). Outline the next one or exit markup.","toast.marker_needs_server":"Device editing is available after the config is moved to the server","toast.virtual_name_required":"Enter a name for the virtual device","toast.marker_saved":"Device saved","toast.marker_removed":"Device deleted from the plan","toast.integration_missing":"The House Plan integration is not installed — management unavailable","toast.plan_formats":"Supported formats: SVG, PNG, JPG, WebP","toast.plan_required":"Upload a floor plan — it is required","toast.space_added_onboard":"Space added. Outline the rooms: click grid dots and close the contour.","toast.space_added":"Space added","toast.space_copied":"Space “{name}” created","toast.space_saved":"Space saved","toast.space_deleted":"Space deleted","toast.delete_failed":"Delete failed: {err}","toast.error":"Error: {err}","toast.toggle_target_unavailable":"Target “{name}” is unavailable — no action was performed","toast.toggle_targets_unavailable":"Targets are unavailable: {names}. No action was performed","toast.file_failed":'File "{name}" was not uploaded: {err}',"toast.files_attached":"Files attached: {n}","err.unknown":"unknown error","err.code":"code {code}","err.too_large":"file larger than {mb} MB","err.bad_ext":"unsupported type (PDF/image expected)","err.unauthorized":"administrator rights required","editor.title":"Title","editor.default_floor":"Initial space","editor.default_floor_missing":"Initial space “{id}” no longer exists. Choose another space.","editor.floor":"Fixed space","editor.floor_none":"— not fixed —","editor.floor_index":"YAML index {index} (preserved)","fixed_floor.loading":"Loading the fixed space…","fixed_floor.invalid_title":"The fixed space is unavailable","fixed_floor.invalid_body":"Check floor in the card configuration. The configured value is: {value}","editor.icon_size":"Icon size, % of plan width","editor.show_temperature":"Show temperature","editor.live_states":"Live states (on/off, open…)","editor.light_pools":"Light pools and wall shadows","editor.show_signal":"Show zigbee signal (LQI)","editor.language":"Interface language","editor.lang_auto":"Auto (HA profile)","title.icon_rules":"Icon rules: which MDI icon devices get by name","rules.title":"Icon rules","rules.hint":"Rules are checked top-down against “device name + model” (case-insensitive regex); the first match wins. When nothing matches, the entity device class decides, then the generic chip icon.","rules.pattern_ph":"regex, e.g. plug|socket","rules.icon_ph":"mdi:power-socket-de","rules.add":"Add rule","rules.reset":"Reset to defaults","rules.test_ph":"Try a device name…","rules.invalid":"invalid regex","rules.saved":"Icon rules saved","btn.up":"Up","btn.down":"Down","tap.info":"Device card","tap.more_info":"HA more-info dialog","tap.toggle":"Toggle state","marker.tap_label":"Tap action for this device","tap.toggle_note":"The resolved state is shown below. Secure devices are never toggled from the plan.","import.title":"Create spaces from HA floors","import.hint":"Your Home Assistant already knows these floors. Pick the ones to turn into plan spaces — you will upload a floor-plan image for each one next. Rooms are then outlined by hand on the plan.","import.start":"Create {n} space(s)","import.manual":"Start from scratch","import.progress":"Floor {i} of {n}","import.done":"Spaces created. Outline the rooms: click grid dots and close the contour.","btn.skip":"Skip","space.scale_label":"Scale (grid cell size)","space.cell_cm.help":"Links the grid to real dimensions: lengths, areas, wall thickness, opening sizes and glow radius depend on it. Changing it after drawing changes the calculated dimensions of the whole space without moving its points on the plan.","space.cell_cm.help.aria":"Help: space scale","space.scale_unit":"cm per cell","space.scale_unit_imperial":"in per cell","space.display_section":"Display","space.show_borders":"Always show room borders","space.zero_wall_style":"Zero-thickness walls","space.zero_wall_style.help":"Dashed zero-thickness walls pass Glow and sun rays, while solid ones block them as zero-area barriers. The choice affects every such wall in the space even when its line is hidden in View.","space.zero_wall_style.help.aria":"Help: zero-thickness wall style","space.zero_wall_dashed":"Dashed","space.zero_wall_solid":"Solid","space.show_names":"Show room names (drag to move)","space.room_color":"Border & name color","space.opacity":"Opacity","space.fill_label":"Room fill","space.fill_mode.help":"“Custom colour” is styling, while “Light”, “Temperature” and “LQI” use current Home Assistant data; Glow is enabled separately.","space.fill_mode.help.aria":"Help: room fill mode","fill.none":"None","fill.lqi":"Zigbee signal","fill.light":"Lights","fill.custom":"Custom color","space.custom_fill":"Fill color","space.source_file":"I have a floor-plan image","space.source_draw":"No image — I'll outline rooms by hand","fill.temp":"Temperature","tip.temp_avg":"average temperature:","tip.hum_avg":"average humidity:","space_card.button":"Open the space plan","space_card.not_found":"Space “{id}” not found","space_card.loading":"Loading…","continuity.restore_plan":"Restoring floor plan…","continuity.restore_connection":"Restoring device connection…","continuity.retry":"Try again","editor.space":"Space","editor.framing":"Framing","editor.fit_content":"All visible content","editor.fit_house":"Tight to house geometry","editor.show_button":"Show button","editor.button_label":"Button label","editor.button_target":"Target dashboard path","marker.sub_entity":"entity","title.general_settings":"General settings","title.export_pdf":"Save as PDF","pdf.title":"Save as PDF","pdf.dimensions":"Show dimensions and areas","pdf.decor":"Show furniture and other decor","pdf.room_names":"Show room names","pdf.backdrop":"Show backdrop","pdf.save":"Save","pdf.saving":"Creating…","pdf.failed":"Could not create the PDF.","pdf.too_large":"The images exceed the 25 MB PDF limit.","pdf.asset_failed":"A backdrop or decor image could not be loaded.","pdf.scale":"Scale 1:{n}","pdf.north":"North","gs.title":"General settings","gs.light_group":"Fill: lights","gs.light_on":"Lights on","gs.light_off":"All lights off","gs.temp_group":"Fill: temperature","gs.temp_cold":"Cold","gs.temp_ok":"Comfortable","gs.temp_hot":"Hot","gs.lqi_group":"Fill: zigbee signal","gs.lqi_low":"Weak signal","gs.lqi_high":"Strong signal","gs.reset":"Reset to defaults","gs.saved":"General settings saved","gs.radar_show_live":"Show live presence on the plan","gs.radar_show_live_hint":"Hides or shows all live radar targets. This does not start or stop observation recording.","radar.title":"Presence on the plan","radar.help":"Connect this marker to exact Home Assistant radar entities, place the sensor and choose its coordinate profile. Live positions are clipped to the selected room.","radar.help.aria":"Help: presence radar settings","radar.enabled":"Use this presence radar","radar.show_live":"Show live targets","radar.configure":"Configure radar","radar.configure_on_plan":"Configure on plan","radar.change_installation":"Change installation","radar.no_contour":"This room has no boundary. Radar points will not be clipped.","radar.discard_setup_title":"Discard radar setup?","radar.discard_setup":"The unsaved radar setup will be lost.","radar.step_place_mount":"Mark the physical sensor position","radar.step_place_heading":"Mark a point straight ahead of the sensor","radar.step_reference":"Mark reference position {n}, then start measurement","radar.step_check_reference":"Mark an independent check position","radar.start_measure":"Start measurement","radar.countdown":"Stand at the mark in {seconds} s","radar.capturing":"Stand still and alone while measuring…","radar.fit_ready":"Calibration is ready","radar.check_third":"Check at another position","radar.check_complete":"Independent check completed","radar.error_distance":"Position difference: {distance}","radar.ambiguous_target":"More than one target was reported. Repeat the measurement alone.","radar.insufficient_samples":"Not enough current coordinates. Retry or use manual setup.","radar.bad_references":"Choose separated references in different directions from the sensor.","radar.ambiguous_sources":"The measurements allow two equally plausible directions. Choose reference points that distinguish left from right.","radar.bad_fit":"Measurements do not match. Check units, mounting point and references.","radar.desktop_hint":"Use a computer for precise setup. Editing on touch devices is best effort.","radar.detected":"House Plan recognized radar metadata for this device. Review the exact sources before saving.","radar.detected_ld2450":"House Plan found an ESPHome LD2450 coordinate set. Review the exact X/Y sources before saving.","radar.additional_actions":"Additional actions","radar.declare":"This is a presence radar","radar.profile":"Data profile","radar.profile_esphome_ld2450_v1":"ESPHome LD2450 (X/Y targets)","radar.profile_cartesian_v1":"Cartesian targets (X/Y)","radar.profile_polar_v1":"Polar target (distance/angle)","radar.profile_range_v1":"Distance only","radar.profile_zones_v1":"Zone states","radar.profile_presence_v1":"Presence only","radar.room":"Radar room","radar.room_choose":"Choose a room","radar.target":"Target {n}","radar.axis_x":"X coordinate entity","radar.axis_y":"Y coordinate entity","radar.add_target":"Add target slot","radar.range_channel":"Range channel {n}","radar.add_range":"Add range channel","radar.presence_gate":"Presence gate entity","radar.swap_axes":"Swap X and Y axes","radar.axis_x_sign":"X direction","radar.axis_y_sign":"Y direction","radar.distance_source":"Distance entity","radar.angle_source":"Angle entity","radar.angle_unit":"Angle unit","radar.degrees":"Degrees","radar.radians":"Radians","radar.angle_zero":"Zero-angle direction","radar.angle_forward":"Forward","radar.angle_right":"Right","radar.angle_clockwise":"Angles increase clockwise","radar.zone_source":"Zone entity","radar.occupancy_source":"Presence entity","radar.count_source":"Target count entity","radar.availability_source":"Availability entity","radar.source_choose":"Choose an entity","radar.source_optional":"Optional","radar.source_missing":"currently unavailable","radar.saved_unsupported":"This saved radar setup is unsupported or incomplete. It remains inactive; remove it or update House Plan before configuring it again.","radar.occupancy":"Presence (on/off)","radar.count":"Count","radar.mount":"Position and direction","radar.mount_hint":"This is the physical sensor position. Moving its decorative marker does not change it.","radar.heading":"Direction, °","radar.range_cm":"Range, cm","radar.fov_deg":"Field of view, °","radar.unit":"Source unit","radar.mirror":"Mirror the left/right axis","radar.remove":"Remove radar settings","radar.invalid":"Complete the radar room, sources and position before saving.","radar.check_sources":"Check live data","radar.checking":"Checking…","radar.health":"Connection status","radar.live_summary":"Current targets: {targets}; range arcs: {ranges}","radar.health_ok":"Current data received","radar.health_off":"No targets detected","radar.health_stale":"Some coordinate data is out of date","radar.health_partial":"Some sources are current; others are out of date","radar.health_restricted":"Access to one or more sources is restricted","radar.health_incomplete":"The current radar report is incomplete","radar.health_position_unavailable":"Presence reported; current position unavailable","radar.health_unavailable":"Sensor data unavailable","radar.health_needs_setup":"Installation needs setup","radar.health_inconsistent":"The sources report conflicting values","radar.health_unknown":"Current state is unknown","radar.health_disabled":"Radar is disabled","radar.error_invalid_radar":"Check the radar settings.","radar.error_invalid_selection":"Select an existing room and valid sources.","radar.error_source_restricted":"You do not have access to all selected sources.","radar.error_rate_limited":"Too many requests. Try again shortly.","radar.error_not_ready":"Radar processing is not ready.","radar.error_conflict":"The plan changed. Reopen the radar setup and try again.","radar.error_source_unavailable":"One or more selected radar sources are unavailable.","radar.error_unsupported_capability":"This radar capability is not supported by the installed integration.","radar.report_age":"{seconds} s ago","space.show_lqi":"Show zigbee signal (LQI) next to devices","space.hide_decor":"Hide the decorative layer","space.hide_decor_tip":"Lines, shapes, labels and furniture stay where they are — visible in the backdrop editor, not on the plan.","space.hide_openings":"Hide openings","space.hide_openings_tip":"Door, window and gate symbols are not drawn, but the openings keep working: light passes through, the sun comes in at a window, contact sensors still open them. The plan editor always shows them.","gs.light_none":"No light sources","mode.plan":"Plan editor","mode.devices":"Device editor","display.value":"Value + state","marker.subarea":"no area, manual","device.new":"New device — open its editor to dismiss","opening.unlock_action":"Unlock","opening.lock_action":"Lock","opening.lock_pending":"Working…","title.close_editor":"Close editor (back to view)","title.add_device":"Add a device to the plan","devbar.add":"Add","devbar.rules":"Icon rules","device_inbox.button":"Devices","device_inbox.title":"Devices on the plan","device_inbox.search":"Search devices, entities and integrations…","device_inbox.add_virtual":"Add virtual device","device_inbox.tab_on_plan":"On plan","device_inbox.tab_available":"Available","device_inbox.tab_hidden":"Hidden","device_inbox.tab_readd":"Available again","device_inbox.only_new":"New only","device_inbox.show_entities":"Show entities","device_inbox.show_hidden":"Show hidden on plan","device_inbox.show_hidden.help":"Temporarily shows hidden and disabled markers as editor-only ghosts on the plan. Saved device visibility does not change.","device_inbox.show_hidden.help.aria":"Help: show hidden devices on the plan","device_inbox.new":"New","device_inbox.find":"Find on plan","device_inbox.edit":"Edit","device_inbox.hide":"Hide","device_inbox.show":"Show","device_inbox.add":"Add","device_inbox.readd":"Add again","device_inbox.hide_available":"Hide from list","device_inbox.show_more":"Show more","device_inbox.more_actions":"More actions","device_inbox.find_hidden_hint":"Enable “Show hidden on plan” first","device_inbox.show_disabled":"Activate this binding in Home Assistant before showing it","device_inbox.empty_on_plan":"No matching devices are on the plan yet.","device_inbox.empty_available":"No devices are available to add.","device_inbox.empty_hidden":"There are no hidden devices.","device_inbox.empty_readd":"No removed devices are available to add again.","device_inbox.reason_visible_auto":"Discovered automatically","device_inbox.reason_visible_explicit":"Added explicitly","device_inbox.reason_manual_hidden":"Hidden by user","device_inbox.reason_automatic_hidden":"Hidden automatically","device_inbox.reason_service_entry":"Service-only registry entry","device_inbox.reason_excluded_integration":"Integration “{integration}” excluded by discovery filters","device_inbox.reason_excluded_domain":"Non-spatial entity type","device_inbox.reason_grouped_light":"Represented by a room light group","device_inbox.reason_represented_by_parent":"Represented by its parent device","device_inbox.reason_removed":"Previously removed from the plan","device_inbox.reason_available":"Available to add to the plan","device_inbox.reason_no_bound_room":"HA area is not linked to a plan room","device_inbox.status_ha_disabled":"Disabled in Home Assistant","device_inbox.status_orphaned":"Binding is no longer present in Home Assistant","device_inbox.status_unverified":"Home Assistant registry is temporarily unavailable","device_inbox.saved":"Device list updated","device_inbox.filters_excluded":"Excluded integrations","device_inbox.filters_group_lights":"Group room lights into one marker","device_inbox.filters_preview_appear":"will appear: {count}","device_inbox.filters_preview_hide":"will disappear: {count}","device_inbox.filters_preview_lights":"lights affected: {count}","device_inbox.filters_reset":"Restore recommended","device_inbox.filters_save":"Save filters","device_inbox.filters_search_ph":"Add an integration…","device_inbox.filters_title":"Discovery filters","space.roomcard_section":"Room card shows:","space.label_temp":"Temperature","space.label_hum":"Humidity","space.label_lqi":"Average Zigbee signal","space.label_light":"Lights on/off","roomcard.light_on":"On","roomcard.light_off":"Off","roomcard.light_partial":"{on} of {total}","toast.split_pick_inside":"Intermediate cut points must be inside the room","mode.decor":"Background editor","decor.select":"Select","decor.line":"Line","decor.rect":"Rectangle","decor.ellipse":"Oval","decor.text":"Text","decor.erase":"Erase","decor.erase_confirm_title":"Erase object?","decor.color":"Color","decor.width":"Line width","decor.line_style":"Line style","decor.line_style_solid":"Solid","decor.line_style_dashed":"Dashed","decor.fill":"Fill","decor.fill_color":"Fill color","decor.length":"Length","decor.size":"Size","decor.flip_h":"Flip horizontally","decor.flip_v":"Flip vertically","decor.angle":"Rotation angle, °","decor.text_size":"Text size","decor.backdrop_properties":"Plan backdrop properties","decor.text_title":"Text label","decor.object_title":"Edit {kind}","decor.text_label":"Text","decor.live_group":"Insert HA variable","decor.live_entity":"Entity","decor.live_entity_ph":"choose an entity","decor.live_attr":"Value","decor.live_attr_ph":"choose state or attribute","decor.live_state":"State","decor.backdrop":"Backdrop image","decor.backdrop_hint":"Drag to move; pull a corner to resize; use the top handle to rotate. Shift changes proportions or frees the angle.","decor.backdrop_reset":"Reset the picture","decor.backdrop_reset_done":"The picture is back at its original place and size","marker.icon_auto":"Auto: {icon} (by icon rules; pick one to override)","marker.icon_pin_auto":"Pin","mode.plan_tip":"Plan editor — the geometry of the home: draw and split/merge rooms, bind them to HA areas, place doors, windows and gates, move room cards, set the scale","mode.devices_tip":"Device editor — everything about icons: drag to position, click to edit binding/icon/display, add virtual devices, icon rules","mode.decor_tip":"Background editor — purely visual decor under the plan: lines, rectangles, ovals and text labels that never react to clicks","space.glow_enabled":"Light-source glow","gs.glow_group":"Light-source glow","gs.glow_base":"House darkness","gs.glow_light":"Default light color / intensity","gs.wall_group":"Walls","gs.wall_fill":"Wall fill","gs.glow_radius":"Glow radius","gs.glow_radius.help":"Sets the default glow radius in metres or feet; a device-specific radius overrides it.","gs.glow_radius.help.aria":"Help: default glow radius","gs.unit_m":"m","gs.unit_ft":"ft","marker.controls_label":"Controls other light sources","marker.controls.help":"With the “Toggle state” action, the listed sources toggle together with this marker. Their glow stays at their own markers, and the link alone does not turn the controlling marker into a light source.","marker.controls.help.aria":"Help: controlling other light sources","marker.controls_filter":"Search lights and switches…","info.controls":"Controls","marker.glow_radius_label":"Glow radius","marker.glow_radius.help":"Sets the glow radius in metres or feet; an empty value uses the radius from general settings.","marker.glow_radius.help.aria":"Help: glow radius","markup.wallthick":"Thickness","markup.select":"Select","title.markup_wallthick":"Thickness — click a wall to set its thickness from 0 to 100 cm.","markup.hint_wallthick":"click a wall · Esc closes without applying","wallthick.field":"Thickness","wallthick.unit_cm":"cm","wallthick.unit_in":"in","wallthick.apply_room":"Apply to all walls of this room","markup.draw_wall_title":"Thickness of each new wall segment (0–100 cm). Shared walls keep the existing value.","room.queue_progress":"Room {current} of {total}","toast.wall_rooms_saved":"Created rooms: {n}","toast.wall_chain_saved":"Wall chain saved","toast.wallthick_pick":"Click a wall","toast.wallthick_set":"Wall thickness set","toast.wallthick_cleared":"Wall thickness removed","toast.physical_range":"Enter a value from {min} to {max} {unit}","toast.zero_wall_opening_conflict":"Remove the opening on this wall segment first.","toast.zero_wall_ambiguous":"The wall segment is ambiguous. Simplify or adjust the junction.","toast.zero_wall_migration_blocked":"The space was not converted: {reason}. No data was changed.","toast.physical_angle":"Enter a rotation angle from 0° up to, but not including, 90°","toast.physical_limit":"The space has reached the limit for this type of geometry","toast.geometry_unsafe":"Change canceled: wall geometry could not be built safely.","junction.limit_angle":"The angle between walls is too sharp: {actual}°, minimum {limit}°.","junction.limit_valence":"Too many walls meet in one node: {actual}, maximum {limit}.","junction.limit_length":"The wall segment is too short: {actual} cm, minimum {limit} cm.","junction.limit_distance":"Walls and nodes are too close: {actual} cm, minimum {limit} cm.","junction.limit_clearance":"No room interior is left: {actual} cm², minimum {limit} cm².","junction.limit_check_failed":"The junction check could not run — the change was not saved","toast.wall_model_migration_blocked":"The wall model could not be updated: {reason}. The plan was not changed. Run “Optimize plans”; if the error repeats, fix the conflicting wall geometry.","toast.wall_model_client_outdated":"Update the card and reload the page before editing the plan.","wall_model.reason.invalid-room":"invalid room contour","wall_model.reason.zero-length":"zero-length wall segment","wall_model.reason.third-owner":"wall shared by more than two rooms","wall_model.reason.duplicate-id":"conflicting wall identifiers","wall_model.reason.thickness-conflict":"conflicting wall thickness values","wall_model.reason.opening-host":"opening cannot be assigned to one wall","toast.delete_room_pick":"Click inside the room you want to delete","toast.plan_snap_ambiguous":"Zoom in to choose the wall node","toast.wall_repair_ambiguous":"The room outline has more than one possible connection. Zoom in and connect it explicitly.","toast.wall_repair_too_large":"The gap is larger than 2 cm. Connect the walls before creating the room.","toast.wall_repair_changed":"The wall geometry changed. Try creating the room again.","toast.opening_on_zero_wall":"Openings cannot sit on a zero-thickness wall","marker.from_ha_option":"Pick from the HA list","marker.show_entities":"Show entities","marker.show_entities_tip":"Adds not only devices to the list, but all their entities too","marker.pick_ph":"Choose a device…","room.open_area":"Open the HA area","room.fit_action":"Fit room {name}","view.volumetric":"Volumetric view","view.flat":"Flat view","kiosk.title":"This screen's sizes","kiosk.hint":"Stored on this device only — every wall tablet or TV can have its own comfortable sizes.","kiosk.icon_scale":"Device icon size","kiosk.font_scale":"Room card text size","editor.kiosk":"Wall device (kiosk) mode","editor.cycle":"Auto-switch spaces every N seconds (kiosk, 0 = off)","room.settings_title":"Room settings","room.settings_section":"Room settings (override the space)","room.fill_label":"Fill in THIS room","fill.inherit":"As the space","room.custom_fill_space":"Space color","room.custom_fill_own":"Room color","room.temp_range_label":"Comfort range","room.temp_range_min":"Lower comfort-temperature bound","room.temp_range_max":"Upper comfort-temperature bound","room.temp_range_reset":"As the space","room.temp_range.help":"This range applies only to this room. Empty fields inherit the corresponding space bounds; if the bounds are reversed, House Plan uses the smaller value as the lower bound and the larger value as the upper bound.","room.temp_range.help.aria":"About the room comfort range","room.temp_src_label":"Temperature source","room.hum_src_label":"Humidity source","room.src_average":"Average over the room's sensors (default)","room.src_pick":"A specific HA device or entity","room.src_ph":"Choose a source…","toast.room_updated":"Room updated","space.card_font":"Room-card font size (whole space)","room.sizes_section":"Font sizes","room.name_scale":"Room name size","room.label_scale":"Metrics size","preview.room_name":"Living room","toast.cfg_reload_failed":"Could not reload the plan from the server: {err}","toast.locale_load_failed":"Could not load the language pack. English is used until the page reloads.","toast.furniture_art_load_failed":"Could not load the furniture drawings. Reload the page to show them.","room.settings_short":"Room settings","room.unnamed":"Unnamed room","marker.use_climate_temp":"Include the device temperature in the room","marker.use_climate_temp_tip":"Adds an air conditioner or thermostat current_temperature to the room average. Configure the external value badge separately below.","marker.value_badge_title":"Value badge","marker.value_badge.help":"Shows one selected value next to the icon. It does not affect room metrics, light, Glow or the tap action.","marker.value_badge.help.aria":"Help: device value badge","marker.value_badge_enabled":"Show a value badge","marker.value_badge_source":"Value","marker.value_badge_source.help":"Choose a specific state, supported attribute, or derived value of this device.","marker.value_badge_source.help.aria":"Help: value badge source","marker.value_badge_position":"Position","marker.value_badge_position.help":"The chosen side stays fixed and does not flip automatically at a plan edge.","marker.value_badge_position.help.aria":"Help: value badge position","marker.value_badge_right":"Right","marker.value_badge_bottom":"Below","marker.value_badge_left":"Left","marker.value_badge_top":"Above","marker.value_badge_empty":"This device has no available values","marker.value_badge_static":"A static icon does not show live values. The setting is preserved.","marker.value_badge_missing":"Source unavailable","marker.value_badge_missing_hint":"The saved source is currently unavailable. Keep it, disable the badge, or choose another value.","marker.value_badge_duplicate":"The same value is already shown inside the icon.","marker.value_badge_state":"State · {name}","marker.value_badge_marker_state":"Light-source state · {name}","marker.value_badge_lqi":"Average Zigbee signal quality","marker.value_badge_attr_current_temperature":"Current temperature · {name}","marker.value_badge_attr_temperature":"Target temperature · {name}","marker.value_badge_attr_current_humidity":"Current humidity · {name}","marker.value_badge_attr_humidity":"Humidity · {name}","marker.value_badge_attr_current_position":"Position · {name}","marker.value_badge_attr_percentage":"Speed · {name}","marker.value_badge_attr_brightness":"Brightness · {name}","marker.value_badge_attr_volume_level":"Volume · {name}","marker.value_badge_attr_battery_level":"Battery · {name}","marker.value_badge_attr_fan_speed":"Fan speed · {name}","marker.value_source":"Value source","marker.value_source.help":"Choose the value that replaces the icon. The tap action does not change.","marker.value_source.help.aria":"Help: value face source","marker.value_source_auto":"Automatic (as before)","marker.value_source_missing_hint":"The saved source is currently unavailable. The face shows — until it recovers or you choose another value.","marker.light_role_label":"Is this device a light source?","marker.light_role.help":"“Auto” uses the bound device's resolved role, “Always” forces its own source and “Never” excludes it; linked lights above remain independent.","marker.light_role.help.aria":"Help: whether this device is a light source","marker.light_role_auto_yes":"Auto (light source)","marker.light_role_auto_no":"Auto (not a light source)","marker.light_role_always":"Always a light source","marker.light_role_never":"Never a light source","marker.light_entity_label":"Leading light entity","marker.light_entity.help":"For a composite device, choose the entity whose state, colour and brightness represent this plan source. The automatic fallback remains compatible with older plans.","marker.light_entity.help.aria":"Help: leading light entity","marker.light_entity_auto":"Automatic ({entity})","marker.light_entity_none":"no controllable entity","marker.light_entity_missing":"The saved entity {entity} is unavailable. House Plan temporarily uses {fallback}; the saved choice will be restored if it returns.","marker.toggle_entity_label":"Entity to toggle","marker.toggle_entity.help":"For a composite device, choose the exact own light or switch operated by a tap. Automatic keeps the previous target rules and is independent from the leading light entity.","marker.toggle_entity.help.aria":"Help: entity to toggle","marker.toggle_entity_auto":"Automatic ({entity})","marker.toggle_entity_none":"no own controllable entity","marker.toggle_entity_missing":"The saved entity {entity} is no longer among this marker’s selectable channels. House Plan temporarily uses {fallback}; the saved choice will be restored if it returns.","marker.glow_color_label":"Glow colour and brightness","marker.glow_mode.help":"Use live source values, override only its colour, or fix both colour and brightness. The minimum is 1%; to disable the source, choose “Never”.","marker.glow_mode.help.aria":"Help: glow colour and brightness","marker.glow_mode_auto":"From source","marker.glow_mode_color":"Set colour","marker.glow_mode_fixed":"Set colour and brightness","marker.glow_color":"Glow colour","marker.glow_brightness":"Brightness","marker.glow_disabled_never":"Glow settings are unavailable because this marker is explicitly not a light source.","marker.glow_disabled_auto":"Auto mode found no spatial light source for this marker.","marker.glow_disabled_no_entity":"No active controllable Home Assistant entity is available for this spatial source.","marker.glow_passive_hint":"This source has no own Home Assistant data. Set its colour and brightness manually; its radius remains available.","marker.control_broken":"Saved source is missing or no longer marked as a light","marker.control_missing_label":"Missing plan light","marker.control_passive":"passive source","toast.marker_control_cycle":"This link would create a circular chain of light controls.","toast.marker_binding_required":"Choose a Home Assistant device before linking another light source.","confirm.unlock_title":"Unlock?","confirm.unlock_body":"House Plan will send an unlock command to this lock.","toast.files_migrate_failed":"Attachments could not be moved to the new binding, links keep pointing at the old files: {err}","space.pick_saved":"Already uploaded","space.pick_saved_hint":"Plans stored on the server, including ones you detached earlier","space.no_saved":"No plans stored on the server yet.","space.loading":"Loading…","space.used_by":"in use: {list}","space.in_use":"A space still uses this plan — detach it first","btn.use":"Use","confirm.delete_plan_title":"Delete plan file?","confirm.delete_plan_body":"The file will be deleted from the server. This action cannot be undone.","toast.plans_list_failed":"Could not list the stored plans: {err}","toast.plan_delete_failed":"Could not delete the plan: {err}","marker.hide":"Hide","marker.hide_tip":'The device will disappear from the plan after saving but will still count toward the room signal. Restore it through the "Devices" catalog in the device editor.',"marker.show":"Show","marker.show_tip":"The device will appear on the plan again after saving.","marker.hidden_ghost":"Device hidden by the user","marker.ha_disabled_device":"The device is disabled in Home Assistant and hidden from the plan.","marker.ha_disabled_entity":"The entity is disabled in Home Assistant and hidden from the plan.","marker.ha_disabled_all_entities":"The device has no active Home Assistant entities, so it is hidden from the plan.","marker.ha_registry_limited":"The full Home Assistant registry is unavailable to this user. The unverified object cannot be shown or used for now.","marker.delete_tip":"Completely delete the device from the plan and every aggregate. You can add it again later.","tap.run":"Run automation/script/scene","tap.none":"Do nothing","marker.run_target_label":"What to run","marker.run_search_ph":"Search: automation, script or scene…","marker.run_target_gone":"Target {id} not found — pick again","marker.tap_confirm":"Ask for confirmation","marker.tap_confirm_tip":"Show a confirmation dialog before acting — a guard against accidental taps.","marker.toggle_hint_single":"Target: {name} ({id}).","marker.virtual_light_target":"Virtual light: {name}.","marker.virtual_light_current":"Manual state: {state} → {effect}.","marker.virtual_light_state_on":"on","marker.virtual_light_state_off":"off","marker.toggle_hint_group":"Will toggle {count} source(s): {names}.","marker.toggle_hint_current":"Now: {state} → {effect}.","marker.toggle_hint_group_current":"Currently on: {on} of {count} → {effect}.","marker.toggle_hint_skipped":"Will be skipped ({count}): {targets}.","marker.toggle_effect_turn_on":"will turn on","marker.toggle_effect_turn_off":"will turn off","marker.toggle_effect_open":"will open","marker.toggle_effect_close":"will close","marker.toggle_effect_stop":"will stop","marker.toggle_effect_toggle":"state will toggle","marker.toggle_skip_missing":"not found","marker.toggle_skip_ha_disabled":"disabled in HA","marker.toggle_skip_unavailable":"unavailable","marker.toggle_skip_unsupported":"toggle is unsupported","marker.toggle_skip_secure":"blocked for security","marker.toggle_none_no_binding":"This device has no binding, so there is no state to toggle. Tapping will do nothing.","marker.toggle_none_no_actionable_entity":"This device has no state that can be toggled. Tapping will do nothing.","marker.toggle_none_configured_targets_missing":"The configured targets are unavailable. The device's own entity will not be substituted for them.","marker.toggle_none_ha_disabled":"The target is disabled in Home Assistant and cannot be used on the plan.","marker.toggle_none_unavailable":"The target is currently unavailable. Tapping will do nothing.","marker.toggle_none_unsupported":"Home Assistant exposes no safe toggle operation for this entity. Tapping will do nothing.","marker.toggle_none_secure":"Toggling locks, alarms and secure gates from the plan is blocked for security.","run.automation":"automation","run.script":"script","run.scene":"scene","confirm.tap_run":'Run "{name}"?',"confirm.tap_toggle":'Toggle "{name}"?',"confirm.current_state":"Current state: {state}","confirm.expected_state":"After switching: {state}","confirm.group_current":"on {on} of {total}","confirm.group_all_on":"all are on","confirm.group_all_off":"all are off","confirm.unavailable_targets":"Unavailable: {count}","confirm.expected_by_ha":"Home Assistant will determine the state","confirm.state_on":"On","confirm.state_off":"Off","confirm.state_open":"Open","confirm.state_closed":"Closed","confirm.state_opening":"Opening","confirm.state_closing":"Closing","confirm.state_stopped":"Stopped","confirm.state_unknown":"Unknown","toast.run_started":"Started: {name}","toast.run_target_missing":"Run target not found — check the device settings","toast.run_target_required":"Pick an automation, script or scene","toast.tap_target_changed":"The action target changed. Try again.","toast.virtual_light_toggle_failed":"Could not toggle the virtual light: {err}","toast.value_badge_source_required":"Choose a value for the badge","btn.run":"Run","vac.section":"Robot vacuum: live position","vac.autocal":"Set up automatically","vac.live":"Live position on the plan","vac.trail":"Show the robot's path","vac.autocal_no_rooms":"The integration reports no room list — open “Fit manually”","vac.route_warn_unmapped":"The robot is cleaning a map that is not assigned to any floor","vac.route_warn_needs_calibration":"The map is assigned to a floor but not calibrated","vac.route_warn_ambiguous":"Two maps are indistinguishable — no floor was chosen","vac.route_warn_missing_space":"The space of this map was deleted","vac.autocal_no_match":"Room names did not match (need ≥3 in common) — open “Fit manually”","vac.autocal_done":"Done: bound via {rooms} rooms. Start a cleanup and check","vac.cal_need_pos":"The robot is not reporting coordinates — start a cleanup and pause it","vac.cal_done":"Calibration saved. Start a cleanup and check","vac.cal_cancelled":"Calibration cancelled","vac.fit":"Fit manually","vac.fit_hint":"Drag the robot map into place, stretch by the corners","vac.fit_rotate":"Rotate 90°","vac.fit_mirror":"Mirror","vac.trail_never":"Never","vac.trail_cleaning":"While cleaning","vac.trail_always":"Always","gs.bg_group":"Stage background","gs.bg_color":"Background around the plan","gs.bg_default":"Theme default","gs.bg_theme":"theme default","gs.bg_mode":"Plan background","gs.bg_mode.help":"“Follows the Sun” uses sun.sun, falling back to the browser's local clock; Static always shows the selected colour.","gs.bg_mode.help.aria":"Help: general plan background","gs.bg_static":"Static color","gs.bg_daynight":"Follows the Sun","gs.sun_group":"Sun","gs.sun_missing":"The sun.sun entity was not found — the background follows your local clock; window rays are unavailable.","gs.north":"North on the plan","gs.north.help":"The angle is measured clockwise from the plan's upward vertical; north is required for window rays, not for the “Follows the Sun” background.","gs.north.help.aria":"Help: general north direction","gs.north_ph":"not set","gs.north_clear":"Clear","gs.north_letter":"N","gs.sun_rays":"Sunlight through windows","gs.about_version":"Houseplan Card v{v}","gs.about_github":"GitHub · docs & issues","gs.about_telegram":"Telegram chat","support.title":"Help & feedback","space.bg_color":"Background around the plan","space.bg_inherit":"Inherit general","space.bg_inherited":"inherits general settings","space.bg_mode":"Plan background","space.bg_mode.help":"Inherit the general background or override this space with a static colour or “Follows the Sun”.","space.bg_mode.help.aria":"Help: space background","space.north":"North on the plan (override)","space.north.help":"Overrides general north for this space; the angle is measured clockwise from the plan's upward vertical and is used by window rays.","space.north.help.aria":"Help: north for this space","space.north_inherited":"inherited: {v}","space.sun_rays":"Sunlight through windows","space.sun_inherit":"Inherit general","space.sun_on":"On","space.sun_off":"Off","canvas.far_objects":"{n} object(s) far from the plan","canvas.show_far":"Show","canvas.home_tip":"The plan is over there — click to fit it","gs.grid_group":"Plan maintenance","gs.grid_hint":"Updates data models, aligns plan elements to the grid and merges redundant wall fragments. An exact report is shown before anything is stored.","gs.align_all":"Optimize plans","gs.align_title":"Optimize plans","gs.align_none":"All plans already use the current optimized data model.","gs.optimize_no_automatic_changes":"There are no automatic changes to apply. Review the items below.","gs.align_count":"{n} of {total} elements will move, by at most {cm} cm.","gs.align_where":"The largest shift is in “{s}”.","gs.align_turned":"Openings whose angle is corrected: {n}.","gs.align_preflight_failed":"Could not safely verify the geometry of the following spaces: {spaces}{more}.","gs.align_preflight_hint":"Plans were not changed. Copy the diagnostics with the button below and attach them to the bug report together with a space export.","gs.preflight_reason_prepare-exception":"Could not prepare the space geometry (exception while building the model)","gs.preflight_reason_wall-null":"The wall body did not build (the union came back empty)","gs.preflight_reason_wall-degraded-extra":"The wall body degraded with extra geometry","gs.preflight_reason_wall-failed-core":"The wall body core failed to assemble","gs.preflight_reason_wall-exception":"Wall construction threw an exception","gs.preflight_reason_floor-null":"The floor outline did not build","gs.preflight_reason_floor-exception":"Floor construction threw an exception","gs.preflight_copy":"Copy diagnostics","gs.preflight_copied":"Diagnostics copied","gs.preflight_update_hint":"The card and integration versions differ — update House Plan and retry.","gs.align_preflight_space":"Space {n}","gs.align_preflight_more":", and {n} more","gs.optimize_changes":"Model migrations: {m}; spaces updated: {c}; noisy coordinate values removed: {p}; merged real-wall fragments: {w}; merged zero-thickness wall fragments: {s}; independent walls: {i}.","gs.zero_walls_migrated":"Virtual wall spans converted: {n}.","gs.wall_segments_migrated":"Wall segments stabilised: {n}.","gs.room_drafts_migrated":"Unfinished contours converted to ordinary walls: {drafts}; wall segments: {segments}.","gs.optimize_lattice_summary":"Noisy coordinate values canonicalized: {n}; maximum movement: {cm} cm.","gs.optimize_lattice_space":"{space}: coordinate values canonicalized: {n}; off-grid values left unchanged: {far}.","gs.optimize_coincident_partitions":"Hidden independent wall sections absorbed into room walls: {n}.","gs.optimize_openings_rehosted":"Openings reattached to room walls: {n}.","gs.optimize_walls_straightened":"Walls straightened: {n}; maximum movement: {cm} cm.","gs.optimize_walls_straightened_where":"Largest wall correction: {s}.","gs.optimize_walls_straighten_skipped":"Near-axis walls left unchanged because they could not be repaired safely: {n}.","gs.optimize_glow_migration":"Legacy Glow: {spaces} spaces → no data fill + independent Glow; {rooms} rooms → inherited data fill + independent Glow.","gs.optimize_references":"References repaired: spaces — {spaces}; rooms — {rooms}; positions — {positions}; devices detached from missing spaces — {detached}.","gs.optimize_reference_more":", and {n} more","gs.optimize_orphans_removed":"Forgotten records removed: {total} — room labels: {rooms}; devices: {devices}; group markers: {groups}. They belonged to spaces deleted earlier.","gs.optimize_live_positions":"Old positions in deleted spaces belong to existing objects: {n}{names}. They will be kept.","gs.optimize_live_positions_remove":"Old positions in deleted spaces belong to existing objects: {n}{names}. They are selected for removal.","gs.optimize_live_names":": {names}{more}","gs.optimize_live_remove":"Remove old positions","gs.optimize_live_keep":"Keep old positions","gs.optimize_live_selected":"Old positions will be removed after Optimize is applied.","gs.optimize_unverified":"Could not safely verify positions: {n}. They were left unchanged.","gs.optimize_registry_limited":"Full administrator access to the Home Assistant registries is required for a safe check.","gs.optimize_vacuum_warning":"Vacuum room mappings that still need review: {n}.","gs.optimize_details":"Details","gs.optimize_details_more":"And {n} more records.","gs.optimize_detail_removed":"will be removed","gs.optimize_detail_live":"will be kept","gs.optimize_detail_unverified":"not verified","gs.optimize_detail_room_label":"room label","gs.optimize_detail_device":"device","gs.optimize_detail_group":"group marker","gs.optimize_detail_unknown":"unknown owner","gs.optimize_detail_item":"{status}: {kind} {id}; old space {space}","gs.align_warn":"Elements deliberately placed between grid nodes will move. One undo is available after the operation, only until the next plan edit.","gs.align_run":"Optimize","gs.align_done":"Plans optimized: {n} elements moved, {m} records maintained, {r} references repaired","gs.optimize_undo":"Undo last optimization","gs.optimize_undone":"The last optimization was undone","decor.furniture":"Furniture","decor.image":"Image","decor.image_title":"Custom images","decor.image_upload":"Upload image","decor.image_replace":"Replace image","decor.image_uploading":"Uploading…","decor.image_asset":"Image file","decor.image_pick_hint":"Upload an image or choose one already used in House Plan.","decor.image_place_hint":"Click on the plan to place the image.","decor.image_none":"No uploaded images yet.","decor.image_unavailable":"Image unavailable","decor.image_used":"Used in {n} objects","decor.image_upload_failed":"Could not upload the image: {err}","decor.image_error_capacity":"The custom image storage limit has been reached.","decor.image_in_use":"Remove every placed copy before deleting this image.","decor.image_delete_title":"Delete image file?","decor.image_delete_message":"Delete “{name}” from House Plan? This cannot be undone.","furn.title":"Furniture library","furn.symbol":"Symbol","furn.group_furniture":"Furniture","furn.group_appliance":"Appliances","furn.group_sanitary":"Plumbing","furn.group_other":"Other","furn.width":"Width","furn.depth":"Depth","furn.back_to_categories":"All categories","furn.pick_hint":"Choose a category, then a symbol.","furn.place_hint":"Click on the plan — the piece lands against the nearest wall. Shift places it free.","furn.cat_air_conditioner":"Air conditioners","furn.cat_armchair":"Armchairs","furn.cat_bathtub":"Bathtubs","furn.cat_bed":"Beds","furn.cat_bidet":"Bidets","furn.cat_boiler":"Water heaters","furn.cat_chair":"Chairs","furn.cat_coffee_table":"Coffee tables","furn.cat_cooktop":"Cooktops","furn.cat_dining_table":"Dining tables","furn.cat_dishwasher":"Dishwashers","furn.cat_dryer":"Dryers","furn.cat_fireplace":"Fireplaces","furn.cat_fridge":"Refrigerators","furn.cat_kitchen_cabinet":"Kitchen cabinets","furn.cat_kitchen_sink":"Kitchen sinks","furn.cat_nightstand":"Cabinets","furn.cat_plant":"Plants","furn.cat_rug":"Rugs","furn.cat_shelving":"Shelving","furn.cat_shower":"Showers","furn.cat_sink":"Sinks","furn.cat_sofa":"Sofas","furn.cat_stairs":"Stairs","furn.cat_toilet":"Toilets","furn.cat_tv":"Televisions","furn.cat_wardrobe":"Wardrobes","furn.cat_washer":"Washing machines","furn.cat_work_table":"Desks","furn.sym_sofa":"Two-seat sofa","furn.sym_sofa_three_seat":"Three-seat sofa","furn.sym_sofa_corner_right":"Right sectional sofa","furn.sym_armchair":"Soft armchair","furn.sym_armchair_office":"Office chair","furn.sym_coffee_table":"Rectangular coffee table","furn.sym_coffee_table_round":"Round coffee table","furn.sym_coffee_table_oval":"Oval coffee table","furn.sym_coffee_table_rounded":"Rounded coffee table","furn.sym_table_dining":"Rectangular dining table","furn.sym_table_round":"Round table","furn.sym_table_dining_oval":"Oval dining table","furn.sym_table_dining_rounded":"Rounded dining table","furn.sym_chair":"Chair","furn.sym_chair_bar":"Bar stool","furn.sym_desk":"Rectangular desk","furn.sym_desk_corner":"Corner desk","furn.sym_bed_double":"Double bed","furn.sym_bed_single":"Single bed","furn.sym_nightstand":"Bedside table","furn.sym_cabinet_tv":"TV cabinet","furn.sym_cabinet_shoe":"Shoe cabinet","furn.sym_cabinet_sink":"Sink cabinet","furn.sym_wardrobe":"Wardrobe","furn.sym_bookshelf":"Bookcase","furn.sym_wall_unit":"Wall unit","furn.sym_kitchen_floor":"Kitchen floor module","furn.sym_kitchen_floor_corner":"Kitchen floor corner module","furn.sym_kitchen_wall":"Kitchen wall module","furn.sym_kitchen_wall_corner":"Kitchen wall corner module","furn.sym_shelf_floor":"Floor shelving unit","furn.sym_shelf_wall":"Wall shelf","furn.sym_fridge":"Fridge","furn.sym_stove":"Four-burner cooktop","furn.sym_cooktop_two":"Two-burner cooktop","furn.sym_dishwasher":"Dishwasher","furn.sym_washer":"Washing machine","furn.sym_dryer":"Tumble dryer","furn.sym_tv":"TV on stand","furn.sym_tv_wall":"Wall-mounted TV","furn.sym_ac":"Air conditioner","furn.sym_water_heater":"Water heater","furn.sym_toilet":"Floor-standing toilet","furn.sym_toilet_built_in":"Built-in toilet","furn.sym_bathtub":"Rectangular bathtub","furn.sym_bathtub_corner":"Corner bathtub","furn.sym_shower":"Shower","furn.sym_sink":"Washbasin","furn.sym_kitchen_sink":"Single kitchen sink","furn.sym_kitchen_sink_double":"Double kitchen sink","furn.sym_bidet":"Floor-standing bidet","furn.sym_bidet_built_in":"Built-in bidet","furn.sym_stairs":"Stairs","furn.sym_fireplace":"Fireplace","furn.sym_plant":"Plant","furn.sym_rug":"Rug","common.yes":"Yes","common.no":"No","vac.diag_source":"Source","vac.diag_platform":"Integration","vac.diag_status":"Status","vac.diag_position":"Position","vac.diag_rooms":"Rooms","vac.diag_rooms_value":"{total} · {matched} names match · {readiness}","vac.autocal_ready":"auto-calibration available","vac.autocal_not_ready":"need 3 matching names","vac.diag_path":"Integration path","vac.diag_map":"Map ID","vac.source_none":"not selected","vac.source_status_ok":"Ready","vac.source_status_missing":"Missing","vac.source_status_disabled":"Disabled in Home Assistant","vac.source_status_unavailable":"Unavailable","vac.source_status_unverified":"Cannot verify with current permissions","vac.source_status_unsupported":"No position data","vac.source_status_none":"No source","vac.source_banner_missing":"The saved source no longer exists. It was not replaced automatically; choose another source or restore it in Home Assistant.","vac.source_banner_disabled":"The saved source is disabled in Home Assistant. Enable it there or choose another source.","vac.source_banner_unverified":"Current Home Assistant permissions cannot verify this saved source. It remains pinned and will not be replaced automatically.","vac.choose_source":"Choose source","vac.source_auto":"Automatic","vac.source_auto_hint":"Use a compatible entity from this device","vac.all_cameras":"All cameras","vac.all_cameras_warn":"A camera may not provide robot data. Choose one only if it is your vacuum map.","vac.all_cameras_empty":"No other camera entities found.","vac.platform_unknown":"unknown integration","vac.cap_position":"position","vac.cap_rooms_short":"rooms","vac.cap_path":"path","vac.cap_map":"map ID","vac.cap_none":"no robot data detected","vac.xcme_hint":"Enable these Xiaomi Cloud Map Extractor attributes:","vac.documentation":"Documentation","vac.residual_title":"Check automatic calibration","vac.residual_message":"The matched rooms disagree by up to {error}. Apply this approximate calibration, refine it manually, or cancel without changing the saved setup.","vac.apply_proposal":"Apply","gs.backup_group":"Backup and transfer","gs.backup_hint":"Download a portable JSON backup or preview and import a backup made by House Plan.","backup.export_open":"Export","backup.import_open":"Import","backup.export_title":"Export House Plan","backup.import_title":"Import House Plan","backup.export_hint":"Choose whether the backup should contain the whole House Plan configuration or only the current space.","backup.full":"Full backup","backup.current_space":"Current space","backup.current_space_title":"Current space: {title}","backup.no_current_space":"No current space","backup.plan_only":"Plan only","backup.plan_only_hint":"Keep rooms, walls, openings, decor and room-label positions without devices or Home Assistant bindings.","backup.plan_only_preview":"This file contains the plan only","backup.privacy_warning":"The archive keeps names, Home Assistant identifiers and exact coordinates. Internal plans and attachments are referenced, not embedded; runtime states and vacuum trails are not included.","backup.download":"Download JSON","backup.export_done":"Backup downloaded","backup.reading":"Checking the backup…","backup.revalidated":"The plan changed after this preview. The summary was refreshed; review it and confirm again.","backup.error.support_invalid_message":"Check the support message and try again.","backup.error.support_package_too_large":"The anonymized support package exceeds the 8 MiB limit.","backup.error.support_preview_expired":"The support attachment preview expired or is no longer available.","backup.error.support_rate_limited":"Too many support reports or previews were requested. Try again later.","backup.error.support_rejected":"The report did not pass support service validation.","backup.error.support_unavailable":"The private support service is temporarily unavailable.","backup.error.unauthorized":"You do not have permission to export or import this plan.","backup.error.not_ready":"House Plan is not ready yet. Try again in a moment.","backup.error.too_large":"The backup exceeds the 8 MiB limit.","backup.error.invalid_json":"The selected file is not valid JSON.","backup.error.invalid_format":"The selected file is not a House Plan backup.","backup.error.invalid_image":"The image is damaged or does not match its format.","backup.error.unsupported_export_version":"This backup format is not supported by the installed version.","backup.error.unsupported_image":"Use a supported PNG, JPEG, WebP or SVG image.","backup.error.future_model":"The backup was created by a newer House Plan data model.","backup.error.invalid_config":"The backup contains an invalid House Plan configuration.","backup.error.wall_model_migration_blocked":"The backup wall model could not be upgraded safely. Optimize the source plan first, then export it again.","backup.error.invalid_layout":"The backup contains invalid object positions.","backup.error.invalid_content":"The backup contains invalid or inconsistent content references.","backup.error.space_not_found":"The selected space no longer exists.","backup.error.capacity_exceeded":"Adding this backup would exceed the plan limits.","backup.error.preview_expired":"The preview expired. Select the backup file again.","backup.error.preview_owner_mismatch":"This preview belongs to another Home Assistant user.","backup.error.conflict":"The plan changed after the preview. Review the refreshed summary.","backup.error.content_confirmation_required":"Confirm that unavailable local content may be detached.","backup.error.commit_failed":"The backup could not be applied safely. The previous plan was restored or is pending recovery.","backup.error.missing_plan":"A referenced plan file disappeared after the preview. Review the backup again.","backup.error.missing_content":"A referenced local attachment disappeared after the preview. Review the backup again.","backup.error.marker_control_missing":"A linked plan light is missing from the backup.","backup.error.marker_control_not_light":"A linked plan target is no longer marked as a light source.","backup.error.marker_control_self":"A light source cannot control itself.","backup.error.marker_control_cycle":"The backup contains a circular chain of light controls.","backup.error.duplicate_marker_control":"The backup contains a duplicate plan-light link.","backup.error.no_backup":"There is no import or optimization snapshot to restore.","backup.error.in_use":"The item is still in use","backup.error.invalid_data":"The request carries invalid data","backup.error.invalid_light_entity":"The leading light must be a light.* or switch.* entity","backup.error.invalid_marker_control":"Invalid marker control reference","backup.error.invalid_name":"The name is invalid","backup.error.invalid_partition_opening_host":"The opening must keep its partition host","backup.error.invalid_partition_opening_jamb_margin":"The opening leaves no physical jamb at the wall end","backup.error.invalid_passage_fields":"An open passage cannot carry door-only settings","backup.error.invalid_space_id":"Unknown space","backup.error.invalid_toggle_entity":"The toggle entity must be light.* or switch.*","backup.error.invalid_value_badge":"Invalid value badge settings","backup.error.invalid_value_badge_attribute":"Invalid value badge attribute","backup.error.invalid_value_badge_position":"Invalid value badge position","backup.error.invalid_value_badge_source":"Invalid value badge source","backup.error.invalid_vacuum_map_route":"Check how the robot's maps are assigned to spaces.","backup.error.invalid_value_source":"Invalid value source","backup.error.invalid_value_source_attribute":"Invalid value source attribute","backup.error.io_error":"A file operation failed on the server","backup.error.not_toggleable":"This device cannot be toggled","backup.error.nothing_to_repair":"Nothing to repair","backup.error.space_in_use":"The space is still referenced","backup.error.value_badge_source_required":"The value badge needs a source","backup.error.wall_model_client_outdated":"The plan was updated elsewhere — reload the page","backup.same_source":"Created on this Home Assistant instance","backup.foreign_source":"Created on another Home Assistant instance","backup.created":"Created: {value}","backup.versions":"Card {card}; integration {integration}; data model {model}","backup.count_spaces":"Spaces: {n}","backup.count_rooms":"Rooms: {n}","backup.count_walls":"Walls: {n}","backup.count_openings":"Openings: {n}","backup.count_decor":"Decor objects: {n}","backup.count_markers":"Devices: {n}","backup.count_layout":"Positions: {n}","backup.bindings":"Bindings — devices: {device}, entities: {entity}, virtual: {virtual}; positions without a space: {legacy}","backup.binding_status":"Target status — active: {active}, disabled: {disabled}, missing: {missing}","backup.missing_areas":"Areas missing on the target: {areas}","backup.dropped_marker_links":"Plan-light links outside this transferred space were omitted: {n}.","backup.room_drafts_migrated":"Legacy unfinished contours converted to ordinary walls: {drafts}; wall segments: {segments}.","backup.repaired_target_refs":"Existing references restored by this space import: {n}.","backup.preserved_unresolved_refs":"References that could not be restored unambiguously were preserved: {n}.","backup.preserved_unresolved_hint":"No data was guessed or deleted. After the import, run Optimize plans to inspect the remaining references.","backup.import_details":"Import reference details","backup.import_detail.incoming_remapped":"References updated inside the imported copy: {n}","backup.import_detail.target_repaired":"Existing references restored: {n}","backup.import_detail.preserved_unresolved":"Unresolved references preserved: {n}","backup.import_detail.collisions":"Destination conflicts preserved safely: {n}","backup.import_detail.dropped_links":"Incoming links omitted by transfer rules: {n}","backup.import_detail.bounded_lineages":"Overly nested identifiers left bounded: {n}","backup.replace_warning":"This replaces the current configuration and layout. Uploaded files are never deleted. One undo remains available until the next plan edit.","backup.foreign_bookkeeping":"Instance-specific known/new-device bookkeeping will not be imported.","backup.final_name":"New space name","backup.target_settings":"The target instance's global settings remain unchanged.","backup.duplicates":"Bindings already present: {n}","backup.skip":"Skip duplicate devices","backup.virtual_copy":"Add safe static virtual copies","backup.content":"Referenced content","backup.decor_images_summary":"Custom images: {objects} objects, {assets} files; missing files: {missing}.","backup.content_available":"available locally","backup.content_external":"external link","backup.content_detach_required":"will be detached","backup.confirm_detach":"I understand that unavailable internal plans and attachments will be detached from the imported configuration.","backup.confirm_missing_images":"I understand that missing custom images will remain as repair placeholders and other unavailable local files will be detached.","backup.replace":"Replace","backup.add":"Add space","backup.space_done":"Space imported: {rooms} rooms, {markers} devices, {refs} existing references restored","backup.full_done":"Backup restored: {spaces} spaces, {rooms} rooms, {markers} devices","backup.undo_import":"Undo last full import","backup.import_undone":"Full import undone","backdrop.large_title":"Large image","backdrop.large_body":"This image is {w}×{h} ({fileMb} MB file) and needs about {decodedMb} MB of memory to display. On tablets this can crash the page.","backdrop.unknown_body":"The image dimensions could not be read — the file may be damaged. Continuing may crash the page on tablets.","backdrop.reduced_dimensions":"Reduced copy: {w}×{h} px.","backdrop.use_downscaled":"Upload a reduced copy","backdrop.reducing":"Reducing…","backdrop.keep_original":"Keep the original","backdrop.too_large_title":"Image is too large","backdrop.too_large_body":"This image exceeds what browsers can display ({w}×{h}, limit {limit} px per side). Please reduce it in a desktop editor and upload again.","backdrop.downscale_failed":"Could not create the reduced copy. The original plan was not changed."};const ap=new WeakSet,lp=new WeakSet;function cp(e,t,i){const n=i?t.state(i):"ready";return i&&"pending"===n?(lp.has(e)||(e.inert=!0,e.setAttribute("aria-busy","true"),lp.add(e)),t.ensure(i).then(()=>{e.isConnected&&e.requestUpdate()}),ap.has(e)?"warm":"cold"):(lp.delete(e)&&(e.inert=!1,e.removeAttribute("aria-busy")),i&&(e.setAttribute("lang","fallback"===n?"en":i),ap.add(e)),"ready")}function hp(){return j``}const dp=[{code:"en",nativeLabel:"English",dictionary:sp},{code:"ru",nativeLabel:"Русский",dictionary:{"editor.context_actions":"Действия: {object}","editor.tool_options":"Параметры инструмента: {tool}","editor.palette":"Палитра: {tool}","editor.open_group":"Группа инструментов: {group}","editor.group_active":"{group} — активно: {item}","editor.disabled_action":"{action} недоступно: {reason}","editor.loading":"Загружаем редактор…","editor.loading_aria":"Редактор плана загружается","editor.load_failed":"Не удалось загрузить редактор.","editor.refresh_advice":"Обновите страницу и повторите попытку.","editor.retry_advice":"Проверьте сеть и нажмите ещё раз.","version_mismatch.title":"Версии House Plan не совпадают","version_mismatch.body":"Если Home Assistant ещё перезапускается, дождитесь завершения, затем перезагрузите эту страницу.","version_mismatch.frontend":"Карточка","version_mismatch.backend":"Интеграция","version_mismatch.reload":"Перезагрузить страницу","color_picker.title":"Выбор цвета","color_picker.hue":"Оттенок","color_picker.saturation":"Насыщенность","color_picker.value":"Яркость","color_picker.hex":"Цвет HEX","color_picker.invalid_hex":"Введите цвет HEX из 3 или 6 цифр","color_picker.confirm":"ОК","btn.properties":"Свойства","btn.keep_as_walls":"Оставить стенами","btn.delete_room_keep_walls":"Удалить комнату, оставить стены","btn.delete_room_with_walls":"Удалить комнату и стены","title.markup_select":"Выбор и редактирование стен и колонн","title.markup_column":"Колонна: кликните точку сетки для квадратной колонны","markup.partition":"Перегородка","markup.column":"Колонна","markup.hint_column":"кликните точку сетки, чтобы поставить квадратную колонну","history.wall_segment":"Добавление отрезка стены","history.column_add":"Добавление колонны","history.physical_edit":"Изменение физического объекта","history.physical_delete":"Удаление физического объекта","history.physical_move":"Перемещение физического объекта","history.wall_face_batch":"Создание комнат из стен","toast.column_duplicate":"Колонна с тем же центром и внешним размером уже существует","physical.partition_properties":"Свойства перегородки","physical.column_properties":"Свойства колонны","physical.shape":"Форма","physical.square":"Квадрат","physical.circle":"Круг","physical.diameter":"Диаметр","physical.side":"Сторона","physical.rotation":"Угол поворота","physical.length":"Длина","physical.allowed_range":"Допустимо: {min}–{max} {unit}","physical.column_size_title":"Внешняя сторона квадратной колонны, создаваемой кликом (1–150 см).","card.title":"План дома","count.devices":"{n} устр.","empty.no_spaces":"Пространств пока нет.","nav.spaces":"Пространства House Plan","empty.add_first":"Добавьте первое пространство и загрузите план этажа.","empty.read_only":"Пространства не настроены. Попросите администратора добавить первое.","empty.install":"Установите интеграцию House Plan и добавьте запись в «Устройства и службы».","btn.add_space":"Добавить пространство","btn.cancel":"Отмена","btn.save":"Сохранить","btn.close":"Закрыть","btn.delete":"Удалить","btn.copy":"Копировать","btn.edit":"Редактировать","btn.open_in_ha":"Открыть в HA","btn.reset":"Сброс","btn.attach":"Прикрепить…","btn.upload":"Загрузить…","btn.replace":"Заменить…","title.zoom_in":"Приблизить","title.zoom_out":"Отдалить","title.zoom_fit":"Вписать всё","title.configure_space":"Настроить пространство","title.add_space":"Добавить пространство","title.markup_add":"Стены: рисуйте непрерывную цепочку; каждый принятый отрезок сохраняется отдельно. Shift фиксирует 45°","title.markup_merge":"Объединить: клик по одной комнате, затем по соседней с общей стеной","title.markup_split":"Разделить комнату: клик по комнате, затем две точки на её стенах","title.markup_delroom":"Удалить комнату: кликните внутри комнаты и подтвердите удаление","title.need_plan":"Загрузите подложку (план этажа)","markup.add":"Стены","markup.merge":"Объединить","markup.split":"Разделить","markup.resize":"Размер","title.markup_resize":"Изменение размера комнат: тяните доступную ручку горизонтальной или вертикальной стены","markup.hint_resize":"тяните доступную ручку стены · стена упирается в первую небезопасную позицию · Esc — отмена · Ctrl+Z — отмена шага","resize.disabled.diagonal":"Стена расположена под углом: Resize поддерживает только горизонтальные и вертикальные стены","resize.disabled.side-angle":"Примыкающая стена расположена под углом: для Resize обе примыкающие стены должны образовывать прямой угол","resize.disabled.duplicate-physical-wall":"Стену перекрывает отдельная перегородка или колонна; удалите или переместите её перед изменением размера","resize.disabled.partial-shared":"Соседняя комната использует только часть этой стены, поэтому её нельзя безопасно двигать как одну общую стену","resize.disabled.unequal-shared":"У соседней комнаты другие конечные точки или длина стены, поэтому стены нельзя безопасно двигать вместе","resize.disabled.multiple-rooms":"Перемещение затронуло бы больше двух комнат","resize.disabled.thickness-conflict":"Толщину стены нельзя безопасно сохранить","resize.disabled.opening-conflict":"Проём на этой стене нельзя безопасно переместить","resize.disabled.invalid-geometry":"Эту стену нельзя переместить без изменения структуры плана","resize.limit_stopped":"Стена остановлена: дальше нарушается ограничение стыков","resize.commit_failed":"Изменение размера отменено: итоговый план не прошёл проверку геометрии","resize.preview_failed":"Стена остановлена в последней безопасной позиции: геометрию плана нельзя сохранить без потерь","markup.opening":"Проём","markup.delete_room":"Удалить комнату","history.undo":"Отменить","history.redo":"Повторить","history.undo_named":"Отменить: {name} (Ctrl+Z)","history.redo_named":"Повторить: {name} (Ctrl+Shift+Z / Ctrl+Y)","history.undo_empty":"Нет операций для отмены","history.redo_empty":"Нет операций для повтора","history.undone":"Отменено: {name}","history.redone":"Повторено: {name}","history.add_room":"Создание комнаты","history.split_room":"Разделение комнаты","history.merge_rooms":"Объединение комнат","history.resize_room":"Изменение размера комнаты","history.wall_thickness":"Изменение толщины стены","history.add_opening":"Добавление дверного или оконного проёма","history.edit_opening":"Изменение проёма","history.move_opening":"Перемещение проёма","history.delete_opening":"Удаление проёма","history.delete_room_keep_walls":"Удаление комнаты с сохранением стен","history.delete_room_with_walls":"Удаление комнаты и её стен","history.decor_add":"Добавление объекта декора","history.decor_edit":"Изменение объекта декора","history.decor_move":"Перемещение объекта декора","history.decor_transform":"Трансформация объекта декора","history.decor_delete":"Удаление объекта декора","history.backdrop_transform":"Трансформация подложки плана","history.device_move":"Перемещение: {name}","history.device_stale":"История позиций больше неприменима и была очищена","opening.new":"Новый проём","opening.edit":"Проём","opening.door":"Дверь","opening.window":"Окно","opening.gate":"Ворота","opening.passage":"Открытый проём","opening.passage_binding_warning":"При сохранении датчик открытия и замок будут удалены.","opening.invalid_passage_fields":"У открытого проёма на плане «{room}» есть недопустимые параметры: {fields}.","opening.type_label":"Тип","opening.length_label":"Длина, см","opening.contact_label":"Датчик открытия","opening.lock_label":"Замок","opening.none":"— нет —","opening.search_ph":"Поиск: имя или entity_id…","opening.invert":"Инвертировать открыто/закрыто","opening.flip_h":"Петли с другой стороны","opening.flip_v":"Открывается в другую сторону","opening.open":"Открыто","opening.closed":"Закрыто","opening.locked":"Заперто","opening.unlocked":"Не заперто","opening.state_unknown":"недоступно","opening.no_entities":"Датчики не привязаны — статичный символ на плане.","toast.opening_no_wall":"Кликните рядом со стеной комнаты или независимой стеной","opening.host_partition":"Независимая стена","opening.partition_orphan":"Независимая стена этого проёма больше не существует","opening.partition_jamb_margin":"Оставьте от края проёма до торца стены минимум {distance}","opening.rebind_partition":"Привязать к другой независимой стене","confirm.delete_partition_openings_title":"Удалить стену и проёмы?","confirm.delete_partition_openings_body":"В стене есть проёмы: {count}. Они будут удалены вместе со стеной.","confirm.delete_partition_openings_item":"• {type}, {length}","markup.hint_points":"точек: {n} · Shift — шаг 45° · Esc — завершить цепочку · Ctrl+Z — убрать точку · при замыкании будет предложена комната","markup.hint_start":"кликните точку сетки, чтобы начать цепочку стен","tip.lqi":"средний сигнал zigbee:","tip.area":"площадь: {value}","info.device_header":"Устройство на плане","info.model":"Модель","info.state":"Состояние","info.link":"Ссылка","info.manuals":"Инструкции","info.none":"Нет дополнительной информации","marker.new_device":"Новое устройство","marker.name_label":"Имя (отображается на плане)","marker.name_ph":"Название","marker.binding_label":"Привязка к устройству HA","marker.binding_disabled":"деактивировано в Home Assistant","marker.virtual_option":"Виртуальное устройство (без привязки)","marker.search_ph":"Поиск устройства / группы…","marker.nothing_found":"ничего не найдено","marker.room_label":"Комната","marker.room_override":" (переопределить размещение)","marker.room_choose":"— выберите комнату —","marker.room_auto":"— по зоне устройства (авто) —","marker.icon_label":"Иконка","marker.icon_ph":"mdi:… (пусто = авто)","marker.display_label":"Отображение","display.badge":"Значок + состояние","display.icon_ripple":"Значок + состояние и активность","display.static_icon":"Всегда статичный значок","marker.display_hint_badge":"Значок и динамическая подложка показывают состояние устройства без обычной пульсации активности. Красная тревога сохраняется.","marker.display_hint_icon_ripple":"Значок, динамическая подложка и пульсация: короткая — для событий, постоянная — для работы, движения или присутствия. Красная тревога имеет отдельный приоритет.","marker.display_hint_value":"Значок заменяется выбранным или автоматически найденным значением Home Assistant; подложка продолжает показывать состояние. Красная тревога сохраняется.","marker.display_hint_static_icon":"Подложка в цветах темы и значок всегда остаются одинаковыми. Состояния, активность, недоступность и тревоги не меняют отображение.","marker.static_alarm_warning":"Это устройство может сообщать о тревогах. Статичный режим скрывает визуальную тревогу маркера.","marker.preview.title":"Предпросмотр отображения","marker.preview.actual":"Сейчас","marker.preview.example":"Пример","marker.preview.integration":"Интеграция","marker.preview.source":"Источник отображения","marker.preview.current_state":"Текущее состояние","marker.preview.result":"На плане","marker.preview.details":"Подробнее об источниках","marker.preview.select_source":"Выберите устройство или сущность Home Assistant, чтобы увидеть фактическое отображение.","marker.preview.unknown_provider":"Интеграция неизвестна","marker.preview.virtual_provider":"House Plan · виртуальное устройство","marker.preview.no_source":"Нет активного источника","marker.preview.no_state":"Нет текущего состояния","marker.preview.mixed_states":"Несколько разных состояний","marker.preview.multiple_sources":"Источников: {n}","marker.preview.more_sources":"ещё {n}","marker.preview.scaled":"Предпросмотр уменьшен до {n}%, чтобы поместиться. Сохранённый размер не изменится.","marker.preview.demo_short":"Показать краткую активность","marker.preview.demo_continuous":"Показать постоянную активность","marker.preview.stop_continuous":"Остановить постоянную активность","marker.preview.demo_short_notice":"Пример краткой активности; фактическое состояние устройства не меняется.","marker.preview.demo_continuous_notice":"Пример постоянной активности; фактическое состояние устройства не меняется.","marker.preview.demo_already_visible":"Текущее состояние уже показывает реальную активность или тревогу.","marker.preview.reduced_motion":"В системе включено уменьшение движения, поэтому обычная активность показана точкой.","marker.preview.reason.neutral":"Нейтральная тёмная подложка","marker.preview.reason.working":"Жёлтая подложка: устройство сейчас работает","marker.preview.reason.working_activity":"Жёлтая подложка и эффект активности: устройство сейчас работает","marker.preview.reason.open":"Оранжевая подложка: физически открыто или разблокировано","marker.preview.reason.cover_icon_state":"Нейтральная подложка; состояние и значок определяет сущность шторы или заслонки","marker.preview.reason.presence":"Эффект активности, пока обнаружено присутствие","marker.preview.reason.event":"Короткий эффект активности после события","marker.preview.reason.transition":"Эффект активности во время движения или смены состояния","marker.preview.reason.media_neutral":"Медиаустройство остаётся на нейтральной тёмной подложке, пока доступно","marker.preview.reason.unavailable":"Приглушённая нейтральная подложка: отключено или недоступно","marker.preview.reason.alarm":"Красная тревожная подложка; тревога отображается всегда","marker.preview.reason.live_states_disabled":"Оформление по живым состояниям отключено в настройках карточки","marker.preview.reason.value_no_state":"Нет подходящего значения состояния — вместо него показан значок","marker.preview.reason.value_ambiguous_sources":"Подходит несколько источников значения — вместо него показан значок","marker.preview.reason.value_non_scalar":"Источник вернул не простое значение — вместо него показан значок","marker.preview.reason.value_virtual":"У виртуального устройства нет значения HA — вместо него показан значок","marker.preview.reason.vacuum_live_plan_only":"Живая позиция и след пылесоса доступны только на полном плане","marker.preview.reason.hidden_design_preview":"Устройство скрыто на плане, но его оформление видно в предпросмотре","marker.preview.reason.composite_power_source":"Состояние берётся из сущности питания устройства; вспомогательные переключатели не учитываются","marker.preview.reason.activity_display_disabled":"Выбранный режим отображения не показывает обычные эффекты активности","marker.preview.reason.ha_disabled":"Привязка отключена в Home Assistant, поэтому устройство будет скрыто на плане","marker.preview.reason.orphaned":"Сохранённая привязка Home Assistant больше не найдена","marker.preview.reason.static_icon":"Статичный режим: состояние устройства не меняет значок","marker.activity_color":"Цвет пульсации активности","marker.ripple_size":"Размер пульсации активности","marker.activity_alarm_note":"Цвет и размер относятся только к обычной активности и не влияют на красную тревогу.","marker.pulse_a11y_alarm":"Тревога","marker.pulse_a11y_event":"Недавнее событие","marker.pulse_a11y_presence":"Обнаружено присутствие","marker.pulse_a11y_transition":"Изменение состояния","marker.pulse_a11y_running":"Работает","marker.state_a11y_neutral":"Обычное состояние","marker.state_a11y_working":"Работает","marker.state_a11y_open":"Открыто","marker.state_a11y_locked":"Заблокировано","marker.state_a11y_unlocked":"Разблокировано","marker.state_a11y_alarm":"Тревога","marker.state_a11y_unavailable":"Недоступно","marker.lqi_a11y_low":"LQI {value}, слабый сигнал","marker.lqi_a11y_mid":"LQI {value}, средний сигнал","marker.lqi_a11y_high":"LQI {value}, сильный сигнал","marker.size_label":"Размер / поворот значка","marker.angle_label":"Поворот","marker.model_label":"Модель","marker.model_ph":"напр. Aqara T&H","marker.link_label":"Ссылка","marker.desc_label":"Описание","marker.desc_ph":"Заметки, характеристики…","marker.manuals_label":"Инструкции (PDF и т.п.)","marker.sub_device":"устройство","marker.sub_z2m_group":" · Z2M-группа","marker.sub_group":"группа","marker.sub_helper":"хелпер","space.new":"Новое пространство","space.copy_title":"Копирование пространства","space.copy_name":"Название нового пространства","space.copy_fallback":"Пространство","space.copy_create":"Создать копию","space.copy_optimize_title":"Оптимизировать перед копированием?","space.copy_optimize_body":"Перед созданием «{name}» House Plan должен оптимизировать весь план, включая другие пространства. Продолжить?","space.copy_optimize_confirm":"Оптимизировать и скопировать","space.copy_error_changed":"План изменился, пока было открыто подтверждение. Проверьте его и повторите попытку.","space.copy_error_source_missing":"Исходного пространства больше нет. Снова откройте его настройки и повторите попытку.","space.copy_error_source_invalid":"House Plan не смог проверить все стены этого пространства. Исправьте исходное пространство и повторите попытку.","space.copy_error_spaces_limit":"В House Plan уже создано максимальное число пространств.","space.copy_error_partitions_limit":"В этом пространстве слишком много стен для копирования.","space.copy_error_openings_limit":"В этом пространстве слишком много проёмов для копирования.","space.copy_error_decor_limit":"В этом пространстве слишком много элементов подложки для копирования.","space.copy_error_columns_limit":"В этом пространстве слишком много колонн для копирования.","space.copy_error_opening_host":"Один из проёмов больше не привязан к стене. Исправьте или удалите его перед копированием.","space.copy_error_geometry":"Копия создаст небезопасную геометрию стен. Исправьте исходное пространство и повторите попытку.","space.copy_error_optimize_geometry":"Копирование остановлено: оптимизация всего плана небезопасна для одного из пространств.","space.header":"Пространство","space.title_label":"Название","space.title_ph":"Например: Гараж","space.plan_label":"Подложка (план)","space.no_plan":"нет подложки","space.plan_alt":"план","room.new":"Новая комната","room.name_label":"Отображаемое имя","room.name_ph":"Например: Терраса","room.area_label":"Зона Home Assistant (свободные)","room.no_area_option":"— без зоны —","room.default_name":"Комната","device.unnamed":"без имени","device.light_group":"группа света","device.fallback":"устройство","device.virtual":"виртуальное устройство","confirm.delete_room_title":"Удалить комнату «{name}»?","confirm.delete_room_body":"Выберите, нужно ли оставить физические стены, принадлежащие только этой комнате. Общие с другой комнатой стены сохраняются всегда.","confirm.remove_marker_title":"Удалить устройство с плана?","confirm.remove_marker_body":"Устройство исчезнет полностью и перестанет участвовать в данных плана. Позже его можно будет добавить заново.","confirm.erase_decor":"Стереть объект «{kind}»? Действие можно отменить из истории редактора.","confirm.delete_space_title":"Удалить пространство?","confirm.delete_space_body":"Пространство, все его комнаты и вся разметка плана будут удалены.","confirm.delete_space_vac_routes":"Также будет снято сопоставление карт роботов: {count}.","space.delete_blocked":"Это пространство всё ещё используется устройствами: {n}. Сначала перенесите их в другое пространство или удалите.","toast.pos_save_failed":"Не удалось сохранить позицию: {err}","toast.no_entity":"У устройства нет подходящей сущности","toast.ha_disabled_action":"Деактивированный объект Home Assistant нельзя использовать на плане.","toast.ha_disabled_show_device":"Деактивированное в Home Assistant устройство нельзя показать на плане. Сначала активируйте его в Home Assistant.","toast.ha_disabled_show_entity":"Деактивированную в Home Assistant сущность нельзя показать на плане. Сначала активируйте её в Home Assistant.","toast.ha_disabled_add":"Деактивированный объект Home Assistant нельзя добавить на план. Сначала активируйте его в Home Assistant.","toast.ha_binding_unverified":"Статус объекта не удалось подтвердить по реестру Home Assistant. Отображение и действия временно недоступны.","toast.markup_needs_server":"Разметка доступна после переноса конфига на сервер","toast.space_order_changed":"Порядок изменён. Если где-то этаж карточки задан номером, проверьте такие панели.","toast.conflict":"Конфиг изменён в другом окне — данные обновлены, повторите последнее действие","toast.cfg_save_failed":"Не удалось сохранить конфиг: {err}","toast.room_overlap":"Контур накладывается на комнату «{name}» — комнаты не должны накладываться","toast.contour_cannot_close":"Контур нельзя замкнуть: он вырожден или пересекает сам себя","toast.merge_not_adjacent":"Объединять можно только комнаты с общей стеной","toast.rooms_merged":"Комнаты объединены в «{name}»","toast.split_pick_wall":"Начните разрез на стене комнаты","toast.split_bad_cut":"Разрез — от стены до стены внутри комнаты, без пересечения стен и самого себя","merge.header":"Объединение комнат","merge.hint":"У объединённой комнаты одно имя и одна зона. Вторая зона освобождается — её устройства уйдут с плана, пока их не заберёт другая комната.","merge.keep":"Оставить","merge.no_area":"без зоны","toast.room_saved":"Комната сохранена ({n}). Устройств добавлено: {added}. Обведите следующую или выйдите из разметки.","toast.room_saved_no_area":"Комната сохранена ({n}, без зоны). Обведите следующую или выйдите из разметки.","toast.marker_needs_server":"Редактирование устройств доступно после переноса конфига на сервер","toast.virtual_name_required":"Укажите имя виртуального устройства","toast.marker_saved":"Устройство сохранено","toast.marker_removed":"Устройство удалено с плана","toast.integration_missing":"Интеграция House Plan не установлена — управление недоступно","toast.plan_formats":"Поддерживаются SVG, PNG, JPG, WebP","toast.plan_required":"Загрузите подложку — план этажа обязателен","toast.space_added_onboard":"Пространство добавлено. Обведите комнаты: кликайте по точкам сетки и замкните контур.","toast.space_added":"Пространство добавлено","toast.space_copied":"Пространство «{name}» создано","toast.space_saved":"Пространство сохранено","toast.space_deleted":"Пространство удалено","toast.delete_failed":"Ошибка удаления: {err}","toast.error":"Ошибка: {err}","toast.toggle_target_unavailable":"Цель «{name}» недоступна — действие не выполнено","toast.toggle_targets_unavailable":"Цели недоступны: {names}. Действие не выполнено","toast.file_failed":"Файл «{name}» не загружен: {err}","toast.files_attached":"Прикреплено файлов: {n}","err.unknown":"неизвестная ошибка","err.code":"код {code}","err.too_large":"файл больше {mb} МБ","err.bad_ext":"недопустимый тип (нужен PDF/изображение)","err.unauthorized":"нужны права администратора","editor.title":"Заголовок","editor.default_floor":"Стартовое пространство","editor.default_floor_missing":"Стартовое пространство «{id}» больше не существует. Выберите другое.","editor.floor":"Закреплённое пространство","editor.floor_none":"— не закреплять —","editor.floor_index":"YAML-индекс {index} (сохранён)","fixed_floor.loading":"Загружаем закреплённое пространство…","fixed_floor.invalid_title":"Закреплённое пространство недоступно","fixed_floor.invalid_body":"Проверьте floor в конфигурации карточки. Настроенное значение: {value}","editor.icon_size":"Размер иконок, % ширины плана","editor.show_temperature":"Показывать температуру","editor.live_states":"Живые состояния (вкл/выкл, открыто…)","editor.light_pools":"Световые пулы и тени от стен","editor.show_signal":"Показывать сигнал zigbee (LQI)","editor.language":"Язык интерфейса","editor.lang_auto":"Авто (профиль HA)","title.icon_rules":"Правила иконок: какая MDI-иконка достаётся устройству по имени","rules.title":"Правила иконок","rules.hint":"Правила проверяются сверху вниз по строке «имя устройства + модель» (regex без учёта регистра); срабатывает первое совпадение. Если ничего не подошло — решает device class сущности, затем — иконка-заглушка.","rules.pattern_ph":"regex, напр. розетк|plug","rules.icon_ph":"mdi:power-socket-de","rules.add":"Добавить правило","rules.reset":"Сбросить к умолчаниям","rules.test_ph":"Проверьте имя устройства…","rules.invalid":"некорректный regex","rules.saved":"Правила иконок сохранены","btn.up":"Вверх","btn.down":"Вниз","tap.info":"Карточка устройства","tap.more_info":"Диалог HA (more-info)","tap.toggle":"Переключить состояние","marker.tap_label":"Действие по нажатию для этого устройства","tap.toggle_note":"Под селектором показано, какое состояние изменится. Защищённые устройства не переключаются с плана.","import.title":"Создать пространства из этажей HA","import.hint":"Home Assistant уже знает эти этажи. Отметьте, какие превратить в пространства плана — далее для каждого попросим картинку плана. Комнаты затем обводятся вручную по плану.","import.start":"Создать: {n}","import.manual":"Начать с нуля","import.progress":"Этаж {i} из {n}","import.done":"Пространства созданы. Обведите комнаты: кликайте по точкам сетки и замкните контур.","btn.skip":"Пропустить","space.scale_label":"Масштаб (размер клетки сетки)","space.cell_cm.help":"Связывает сетку с реальными размерами: от значения зависят длины и площади, толщина стен, размеры проёмов и радиус свечения. Изменение после разметки меняет расчётные размеры всего пространства, но не двигает его точки на плане.","space.cell_cm.help.aria":"Подсказка: масштаб пространства","space.scale_unit":"см на клетку","space.scale_unit_imperial":"дюйм на клетку","space.display_section":"Отображение","space.show_borders":"Всегда отображать границы комнат","space.zero_wall_style":"Стены нулевой толщины","space.zero_wall_style.help":"Пунктирные стены нулевой толщины пропускают Glow и солнечные лучи, сплошные блокируют их как барьер нулевой площади. Выбор меняет все такие стены пространства, даже когда их линии скрыты в просмотре.","space.zero_wall_style.help.aria":"Подсказка: вид стен нулевой толщины","space.zero_wall_dashed":"Пунктирные","space.zero_wall_solid":"Сплошные","space.show_names":"Отображать названия комнат (перетаскиваются)","space.room_color":"Цвет границ и названий","space.opacity":"Прозрачность","space.fill_label":"Заливка комнат","space.fill_mode.help":"«Свой цвет» задаёт оформление, а «Свет», «Температура» и «LQI» используют текущие данные Home Assistant; Glow включается отдельно.","space.fill_mode.help.aria":"Подсказка: режим заливки комнат","fill.none":"Нет","fill.lqi":"По силе зигби-сигнала","fill.light":"По освещению","fill.custom":"Свой цвет","space.custom_fill":"Цвет заливки","space.source_file":"У меня есть картинка плана","space.source_draw":"Нет подложки — нарисую комнаты вручную","fill.temp":"По температуре","tip.temp_avg":"средняя температура:","tip.hum_avg":"средняя влажность:","space_card.button":"Перейти к пространству","space_card.not_found":"Пространство «{id}» не найдено","space_card.loading":"Загрузка…","continuity.restore_plan":"Восстанавливаем план…","continuity.restore_connection":"Восстанавливаем подключение к устройствам…","continuity.retry":"Повторить","editor.space":"Пространство","editor.framing":"Кадрирование","editor.fit_content":"Всё видимое содержимое","editor.fit_house":"Плотно по геометрии дома","editor.show_button":"Показывать кнопку","editor.button_label":"Текст кнопки","editor.button_target":"Путь дашборда (куда вести)","marker.sub_entity":"сущность","title.general_settings":"Общие настройки","title.export_pdf":"Сохранить в PDF","pdf.title":"Сохранение в PDF","pdf.dimensions":"Отображать размеры и площади","pdf.decor":"Отображать мебель и другой декор","pdf.room_names":"Отображать названия комнат","pdf.backdrop":"Отображать подложку","pdf.save":"Сохранить","pdf.saving":"Формируем…","pdf.failed":"Не удалось создать PDF.","pdf.too_large":"Размер изображений превышает лимит PDF 25 МБ.","pdf.asset_failed":"Не удалось загрузить подложку или изображение декора.","pdf.scale":"Масштаб 1:{n}","pdf.north":"Север","gs.title":"Общие настройки","gs.light_group":"Заливка: освещение","gs.light_on":"Свет включён","gs.light_off":"Весь свет выключен","gs.temp_group":"Заливка: температура","gs.temp_cold":"Холодно","gs.temp_ok":"Комфорт","gs.temp_hot":"Жарко","gs.lqi_group":"Заливка: зигби-сигнал","gs.lqi_low":"Слабый сигнал","gs.lqi_high":"Сильный сигнал","gs.reset":"Сбросить к умолчаниям","gs.saved":"Общие настройки сохранены","gs.radar_show_live":"Показывать текущее присутствие на плане","gs.radar_show_live_hint":"Скрывает или показывает все живые цели радаров. Это не запускает и не останавливает запись наблюдений.","radar.title":"Присутствие на плане","radar.help":"Свяжите маркер с точными сущностями радара Home Assistant, укажите положение датчика и профиль координат. Живые позиции обрезаются по выбранной комнате.","radar.help.aria":"Подсказка: настройки радара присутствия","radar.enabled":"Использовать этот радар присутствия","radar.show_live":"Показывать живые цели","radar.configure":"Настроить радар","radar.configure_on_plan":"Настроить на плане","radar.change_installation":"Сменить установку","radar.no_contour":"У комнаты нет контура. Точки радара не будут обрезаться по комнате.","radar.discard_setup_title":"Отменить настройку радара?","radar.discard_setup":"Несохранённая настройка радара будет потеряна.","radar.step_place_mount":"Укажите физическое положение датчика","radar.step_place_heading":"Укажите точку прямо перед датчиком","radar.step_reference":"Укажите контрольное положение {n}, затем начните измерение","radar.step_check_reference":"Укажите независимое проверочное положение","radar.start_measure":"Начать измерение","radar.countdown":"Встаньте в отмеченное место через {seconds} с","radar.capturing":"Стойте неподвижно и в одиночестве…","radar.fit_ready":"Калибровка готова","radar.check_third":"Проверить в другом положении","radar.check_complete":"Независимая проверка завершена","radar.error_distance":"Расхождение положения: {distance}","radar.ambiguous_target":"Обнаружено несколько целей. Повторите измерение в одиночестве.","radar.insufficient_samples":"Недостаточно актуальных координат. Повторите или настройте вручную.","radar.bad_references":"Выберите разнесённые положения в разных направлениях от датчика.","radar.ambiguous_sources":"Измерения допускают два одинаково вероятных направления. Выберите точки, по которым можно различить левую и правую стороны.","radar.bad_fit":"Измерения не совпадают. Проверьте единицы, положение датчика и контрольные точки.","radar.desktop_hint":"Для точной настройки используйте компьютер. Редактирование на тач-устройствах поддерживается по остаточному принципу.","radar.detected":"House Plan распознал признаки радара у этого устройства. Перед сохранением проверьте точные источники.","radar.detected_ld2450":"House Plan нашёл набор координат ESPHome LD2450. Перед сохранением проверьте точные источники X/Y.","radar.additional_actions":"Дополнительные действия","radar.declare":"Это радар присутствия","radar.profile":"Профиль данных","radar.profile_esphome_ld2450_v1":"ESPHome LD2450 (цели X/Y)","radar.profile_cartesian_v1":"Декартовы цели (X/Y)","radar.profile_polar_v1":"Полярная цель (дальность/угол)","radar.profile_range_v1":"Только дальность","radar.profile_zones_v1":"Состояния зон","radar.profile_presence_v1":"Только присутствие","radar.room":"Комната радара","radar.room_choose":"Выберите комнату","radar.target":"Цель {n}","radar.axis_x":"Сущность координаты X","radar.axis_y":"Сущность координаты Y","radar.add_target":"Добавить слот цели","radar.range_channel":"Канал дальности {n}","radar.add_range":"Добавить канал дальности","radar.presence_gate":"Сущность присутствия для слота","radar.swap_axes":"Поменять оси X и Y местами","radar.axis_x_sign":"Направление X","radar.axis_y_sign":"Направление Y","radar.distance_source":"Сущность дальности","radar.angle_source":"Сущность угла","radar.angle_unit":"Единица угла","radar.degrees":"Градусы","radar.radians":"Радианы","radar.angle_zero":"Направление нулевого угла","radar.angle_forward":"Вперёд","radar.angle_right":"Вправо","radar.angle_clockwise":"Угол растёт по часовой стрелке","radar.zone_source":"Сущность зоны","radar.occupancy_source":"Сущность присутствия","radar.count_source":"Сущность количества целей","radar.availability_source":"Сущность доступности","radar.source_choose":"Выберите сущность","radar.source_optional":"Необязательно","radar.source_missing":"сейчас недоступна","radar.saved_unsupported":"Сохранённая настройка радара не поддерживается или неполна. Она неактивна; удалите её либо обновите House Plan перед повторной настройкой.","radar.occupancy":"Присутствие (вкл/выкл)","radar.count":"Количество","radar.mount":"Положение и направление","radar.mount_hint":"Это физическое положение датчика. Перемещение его декоративного маркера не меняет установку.","radar.heading":"Направление, °","radar.range_cm":"Дальность, см","radar.fov_deg":"Угол обзора, °","radar.unit":"Единица источника","radar.mirror":"Отразить ось влево/вправо","radar.remove":"Удалить настройки радара","radar.invalid":"Перед сохранением заполните комнату, источники и положение радара.","radar.check_sources":"Проверить живые данные","radar.checking":"Проверяем…","radar.health":"Состояние подключения","radar.live_summary":"Текущих целей: {targets}; дуг дальности: {ranges}","radar.health_ok":"Актуальные данные получены","radar.health_off":"Цели не обнаружены","radar.health_stale":"Часть координат устарела","radar.health_partial":"Часть источников актуальна, часть устарела","radar.health_restricted":"Нет доступа к одному или нескольким источникам","radar.health_incomplete":"Текущий отчёт радара неполон","radar.health_position_unavailable":"Есть присутствие, но актуальное положение недоступно","radar.health_unavailable":"Данные датчика недоступны","radar.health_needs_setup":"Требуется настроить установку","radar.health_inconsistent":"Источники передают противоречивые данные","radar.health_unknown":"Текущее состояние неизвестно","radar.health_disabled":"Радар отключён","radar.error_invalid_radar":"Проверьте настройки радара.","radar.error_invalid_selection":"Выберите существующую комнату и допустимые источники.","radar.error_source_restricted":"Нет доступа ко всем выбранным источникам.","radar.error_rate_limited":"Слишком много запросов. Повторите чуть позже.","radar.error_not_ready":"Обработка данных радара ещё не готова.","radar.error_conflict":"План изменился. Откройте настройку радара заново и повторите попытку.","radar.error_source_unavailable":"Один или несколько выбранных источников радара недоступны.","radar.error_unsupported_capability":"Установленная интеграция не поддерживает эту возможность радара.","radar.report_age":"{seconds} с назад","space.show_lqi":"Показывать зигби-сигнал (LQI) у устройств","space.hide_decor":"Скрыть декоративный слой","space.hide_decor_tip":"Линии, фигуры, надписи и мебель остаются на месте — их видно в редакторе подложки, но не на плане.","space.hide_openings":"Скрыть проёмы","space.hide_openings_tip":"Двери, окна и ворота не рисуются, но продолжают работать: свет проходит, солнце светит в окна, датчики открытия срабатывают. В редакторе плана проёмы видно всегда.","gs.light_none":"Нет источников света","mode.plan":"Редактор плана","mode.devices":"Редактор устройств","display.value":"Значение + состояние","marker.subarea":"без зоны, вручную","device.new":"Новое устройство — откройте его редактор, чтобы снять отметку","opening.unlock_action":"Открыть замок","opening.lock_action":"Закрыть замок","opening.lock_pending":"Выполняется…","title.close_editor":"Закрыть редактор (вернуться к просмотру)","title.add_device":"Добавить устройство на план","devbar.add":"Добавить","devbar.rules":"Правила иконок","device_inbox.button":"Устройства","device_inbox.title":"Устройства на плане","device_inbox.search":"Поиск по устройствам, сущностям и интеграциям…","device_inbox.add_virtual":"Добавить виртуальное устройство","device_inbox.tab_on_plan":"На плане","device_inbox.tab_available":"Доступны","device_inbox.tab_hidden":"Скрытые","device_inbox.tab_readd":"Доступны снова","device_inbox.only_new":"Только новые","device_inbox.show_entities":"Показывать сущности","device_inbox.show_hidden":"Показывать скрытые на плане","device_inbox.show_hidden.help":"Временно показывает на плане скрытые и деактивированные маркеры служебными призраками только в редакторе устройств. Сохранённая видимость устройств не меняется.","device_inbox.show_hidden.help.aria":"Подсказка: показывать скрытые устройства на плане","device_inbox.new":"Новое","device_inbox.find":"Найти на плане","device_inbox.edit":"Настроить","device_inbox.hide":"Скрыть","device_inbox.show":"Показать","device_inbox.add":"Добавить","device_inbox.readd":"Добавить заново","device_inbox.hide_available":"Скрыть из списка","device_inbox.show_more":"Показать ещё","device_inbox.more_actions":"Другие действия","device_inbox.find_hidden_hint":"Сначала включите «Показывать скрытые на плане»","device_inbox.show_disabled":"Перед показом активируйте эту привязку в Home Assistant","device_inbox.empty_on_plan":"На плане пока нет подходящих устройств.","device_inbox.empty_available":"Нет доступных устройств для добавления.","device_inbox.empty_hidden":"Скрытых устройств нет.","device_inbox.empty_readd":"Нет удалённых устройств, доступных для повторного добавления.","device_inbox.reason_visible_auto":"Найдено автоматически","device_inbox.reason_visible_explicit":"Добавлено явно","device_inbox.reason_manual_hidden":"Скрыто пользователем","device_inbox.reason_automatic_hidden":"Скрыто автоматически","device_inbox.reason_service_entry":"Служебная запись реестра","device_inbox.reason_excluded_integration":"Исключена интеграция «{integration}»","device_inbox.reason_excluded_domain":"Непространственный тип сущности","device_inbox.reason_grouped_light":"Представлено группой света комнаты","device_inbox.reason_represented_by_parent":"Представлено родительским устройством","device_inbox.reason_removed":"Ранее удалено с плана","device_inbox.reason_available":"Можно добавить на план","device_inbox.reason_no_bound_room":"Зона HA не связана с комнатой плана","device_inbox.status_ha_disabled":"Отключено в Home Assistant","device_inbox.status_orphaned":"Привязка больше не найдена в Home Assistant","device_inbox.status_unverified":"Реестр Home Assistant временно недоступен","device_inbox.saved":"Список устройств обновлён","device_inbox.filters_excluded":"Исключённые интеграции","device_inbox.filters_group_lights":"Объединять светильники комнаты в один маркер","device_inbox.filters_preview_appear":"появится: {count}","device_inbox.filters_preview_hide":"скроется: {count}","device_inbox.filters_preview_lights":"затронет светильников: {count}","device_inbox.filters_reset":"Вернуть рекомендуемые","device_inbox.filters_save":"Сохранить фильтры","device_inbox.filters_search_ph":"Добавить интеграцию…","device_inbox.filters_title":"Фильтры обнаружения","space.roomcard_section":"В карточке комнаты:","space.label_temp":"Температура","space.label_hum":"Влажность","space.label_lqi":"Средний Zigbee-сигнал","space.label_light":"Свет вкл/выкл","roomcard.light_on":"Вкл","roomcard.light_off":"Выкл","roomcard.light_partial":"{on} из {total}","toast.split_pick_inside":"Промежуточные точки разреза — внутри комнаты","mode.decor":"Редактор подложки","decor.select":"Выбрать","decor.line":"Линия","decor.rect":"Прямоугольник","decor.ellipse":"Овал","decor.text":"Надпись","decor.erase":"Стереть","decor.erase_confirm_title":"Стереть объект?","decor.color":"Цвет","decor.width":"Толщина линии","decor.line_style":"Стиль линии","decor.line_style_solid":"Сплошная","decor.line_style_dashed":"Пунктирная","decor.fill":"Заливка","decor.fill_color":"Цвет заливки","decor.length":"Длина","decor.size":"Размер","decor.flip_h":"Отзеркалить по горизонтали","decor.flip_v":"Отзеркалить по вертикали","decor.angle":"Угол поворота, °","decor.text_size":"Размер текста","decor.backdrop_properties":"Свойства картинки-подложки","decor.text_title":"Надпись","decor.object_title":"Редактирование: {kind}","decor.text_label":"Текст","decor.live_group":"Вставить переменную HA","decor.live_entity":"Сущность","decor.live_entity_ph":"выберите сущность","decor.live_attr":"Значение","decor.live_attr_ph":"выберите состояние или атрибут","decor.live_state":"Состояние","decor.backdrop":"Картинка-подложка","decor.backdrop_hint":"Тяните картинку — перемещение; угол — размер; верхнюю ручку — поворот. Shift меняет пропорции или снимает шаг угла.","decor.backdrop_reset":"Вернуть картинку","decor.backdrop_reset_done":"Картинка вернулась на своё место и в свой размер","marker.icon_auto":"Авто: {icon} (по правилам иконок; выберите свою, чтобы заменить)","marker.icon_pin_auto":"Закрепить","mode.plan_tip":"Редактор плана — геометрия дома: рисование и объединение/разделение комнат, привязка к зонам HA, двери, окна и ворота, карточки комнат, масштаб","mode.devices_tip":"Редактор устройств — всё про значки: перетаскивание, клик — настройка привязки/иконки/отображения, виртуальные устройства, правила иконок","mode.decor_tip":"Редактор подложки — чисто визуальный декор под планом: линии, прямоугольники, овалы и надписи, не реагирующие на клики","space.glow_enabled":"Свечение источников света","gs.glow_group":"Свечение источников света","gs.glow_base":"Темнота дома","gs.glow_light":"Цвет света по умолчанию / интенсивность","gs.wall_group":"Стены","gs.wall_fill":"Цвет заливки стен","gs.glow_radius":"Радиус свечения","gs.glow_radius.help":"Задаёт общий радиус светового пятна в метрах или футах; персональный радиус устройства заменяет это значение.","gs.glow_radius.help.aria":"Подсказка: общий радиус свечения","gs.unit_m":"м","gs.unit_ft":"фут","marker.controls_label":"Управляет другими источниками света","marker.controls.help":"При действии «Переключить состояние» перечисленные источники переключаются вместе с этим маркером. Их световые пятна остаются у собственных маркеров, а эта связь сама по себе не делает управляющий маркер источником света.","marker.controls.help.aria":"Подсказка: управление другими источниками света","marker.controls_filter":"Поиск ламп и выключателей…","info.controls":"Управляет","marker.glow_radius_label":"Радиус свечения","marker.glow_radius.help":"Задаёт радиус свечения в метрах или футах; пустое значение использует радиус из общих настроек.","marker.glow_radius.help.aria":"Подсказка: радиус свечения","markup.wallthick":"Толщина","markup.select":"Выбрать","title.markup_wallthick":"Толщина — клик по стене задаёт толщину от 0 до 100 см.","markup.hint_wallthick":"клик по стене · Esc закрывает без применения","wallthick.field":"Толщина","wallthick.unit_cm":"см","wallthick.unit_in":"дюйм","wallthick.apply_room":"Применить ко всем стенам комнаты","markup.draw_wall_title":"Толщина каждого нового сегмента стены (0–100 см). Общие стены сохраняют существующее значение.","room.queue_progress":"Комната {current} из {total}","toast.wall_rooms_saved":"Создано комнат: {n}","toast.wall_chain_saved":"Цепочка стен сохранена","toast.wallthick_pick":"Кликните по стене","toast.wallthick_set":"Толщина стены задана","toast.wallthick_cleared":"Толщина стены убрана","toast.physical_range":"Введите значение от {min} до {max} {unit}","toast.zero_wall_opening_conflict":"Сначала удалите проём на этом участке стены.","toast.zero_wall_ambiguous":"Не удалось однозначно выбрать участок стены. Уточните геометрию узла.","toast.zero_wall_migration_blocked":"Пространство не преобразовано: {reason}. Данные не изменены.","toast.physical_angle":"Введите угол поворота от 0° до 90°, не включая 90°","toast.physical_limit":"В пространстве достигнут лимит объектов этого типа","toast.geometry_unsafe":"Изменение отменено: геометрию стен нельзя безопасно построить.","junction.limit_angle":"Слишком острый угол между стенами: {actual}°, минимум {limit}°.","junction.limit_valence":"Слишком много стен в одном узле: {actual}, максимум {limit}.","junction.limit_length":"Слишком короткий участок стены: {actual} см, минимум {limit} см.","junction.limit_distance":"Стены и узлы слишком близко: {actual} см, минимум {limit} см.","junction.limit_clearance":"Внутри комнаты не остаётся места: {actual} см², минимум {limit} см².","junction.limit_check_failed":"Проверку стыков выполнить не удалось — изменение не сохранено","toast.wall_model_migration_blocked":"Не удалось обновить модель стен: {reason}. План не изменён. Запустите «Оптимизировать планы»; если ошибка повторится, исправьте конфликтующую геометрию стен.","toast.wall_model_client_outdated":"Обновите карточку и перезагрузите страницу перед редактированием плана.","wall_model.reason.invalid-room":"некорректный контур комнаты","wall_model.reason.zero-length":"отрезок стены нулевой длины","wall_model.reason.third-owner":"стена принадлежит более чем двум комнатам","wall_model.reason.duplicate-id":"конфликт идентификаторов стен","wall_model.reason.thickness-conflict":"конфликт значений толщины стены","wall_model.reason.opening-host":"проём нельзя однозначно привязать к стене","toast.delete_room_pick":"Кликните внутри комнаты, которую нужно удалить","toast.plan_snap_ambiguous":"Увеличьте масштаб, чтобы выбрать узел стены","toast.wall_repair_ambiguous":"У контура несколько возможных соединений. Увеличьте масштаб и соедините стены явно.","toast.wall_repair_too_large":"Разрыв больше 2 см. Соедините стены перед созданием комнаты.","toast.wall_repair_changed":"Геометрия стен изменилась. Попробуйте создать комнату ещё раз.","toast.opening_on_zero_wall":"Проёмы на стене нулевой толщины запрещены","marker.from_ha_option":"Выбрать из списка HA","marker.show_entities":"Показывать сущности","marker.show_entities_tip":"Добавляет в список не только устройства, но и все их сущности","marker.pick_ph":"Выберите устройство…","room.open_area":"Открыть зону в HA","room.fit_action":"Вписать комнату {name}","view.volumetric":"Объёмный вид","view.flat":"Плоский вид","kiosk.title":"Размеры на этом экране","kiosk.hint":"Хранится только на этом устройстве — у каждого настенного планшета или ТВ свои удобные размеры.","kiosk.icon_scale":"Размер значков устройств","kiosk.font_scale":"Размер текста карточек комнат","editor.kiosk":"Режим настенного устройства (киоск)","editor.cycle":"Автосмена пространств каждые N секунд (киоск, 0 = выкл)","room.settings_title":"Настройки комнаты","room.settings_section":"Настройки комнаты (переопределяют пространство)","room.fill_label":"Заливка в ЭТОЙ комнате","fill.inherit":"Как у пространства","room.custom_fill_space":"Цвет пространства","room.custom_fill_own":"Цвет комнаты","room.temp_range_label":"Диапазон комфорта","room.temp_range_min":"Нижняя граница комфортной температуры","room.temp_range_max":"Верхняя граница комфортной температуры","room.temp_range_reset":"Как у пространства","room.temp_range.help":"Диапазон применяется только к этой комнате. Пустое поле наследует соответствующую границу пространства; если границы поменялись местами, House Plan использует меньшую как нижнюю, а большую как верхнюю.","room.temp_range.help.aria":"О диапазоне комфорта комнаты","room.temp_src_label":"Источник температуры","room.hum_src_label":"Источник влажности","room.src_average":"Средняя по датчикам комнаты (по умолчанию)","room.src_pick":"Конкретное устройство или сущность HA","room.src_ph":"Выберите источник…","toast.room_updated":"Комната обновлена","space.card_font":"Размер шрифта карточек комнат (всё пространство)","room.sizes_section":"Размеры шрифтов","room.name_scale":"Размер названия","room.label_scale":"Размер подписей","preview.room_name":"Гостиная","toast.cfg_reload_failed":"Не удалось перечитать план с сервера: {err}","toast.locale_load_failed":"Не удалось загрузить языковой пакет. До перезагрузки страницы используется английский.","toast.furniture_art_load_failed":"Не удалось загрузить изображения мебели. Обновите страницу, чтобы их показать.","room.settings_short":"Настройки комнаты","room.unnamed":"Комната без имени","marker.use_climate_temp":"Учитывать температуру устройства в комнате","marker.use_climate_temp_tip":"Добавляет current_temperature кондиционера или термостата в среднюю температуру комнаты. Внешний бейдж со значением настраивается отдельно ниже.","marker.value_badge_title":"Бейдж со значением","marker.value_badge.help":"Показывает одно выбранное значение рядом со значком. Не влияет на комнатные показатели, свет, Glow и действие по нажатию.","marker.value_badge.help.aria":"Подсказка: бейдж со значением устройства","marker.value_badge_enabled":"Отображать бейдж со значением","marker.value_badge_source":"Значение","marker.value_badge_source.help":"Выберите конкретное состояние, поддерживаемый атрибут или производное значение этого устройства.","marker.value_badge_source.help.aria":"Подсказка: источник значения бейджа","marker.value_badge_position":"Расположение","marker.value_badge_position.help":"Выбранная сторона сохраняется постоянно и не переворачивается автоматически у края плана.","marker.value_badge_position.help.aria":"Подсказка: расположение бейджа","marker.value_badge_right":"Справа","marker.value_badge_bottom":"Снизу","marker.value_badge_left":"Слева","marker.value_badge_top":"Сверху","marker.value_badge_empty":"У этого устройства нет доступных значений","marker.value_badge_static":"Статичный значок не показывает живые значения. Настройка сохранится.","marker.value_badge_missing":"Источник недоступен","marker.value_badge_missing_hint":"Сохранённый источник сейчас недоступен. Можно сохранить его, отключить бейдж или выбрать другой.","marker.value_badge_duplicate":"То же значение уже показано внутри значка.","marker.value_badge_state":"Состояние · {name}","marker.value_badge_marker_state":"Состояние источника света · {name}","marker.value_badge_lqi":"Качество Zigbee-сигнала (среднее)","marker.value_badge_attr_current_temperature":"Текущая температура · {name}","marker.value_badge_attr_temperature":"Целевая температура · {name}","marker.value_badge_attr_current_humidity":"Текущая влажность · {name}","marker.value_badge_attr_humidity":"Влажность · {name}","marker.value_badge_attr_current_position":"Положение · {name}","marker.value_badge_attr_percentage":"Скорость · {name}","marker.value_badge_attr_brightness":"Яркость · {name}","marker.value_badge_attr_volume_level":"Громкость · {name}","marker.value_badge_attr_battery_level":"Заряд батареи · {name}","marker.value_badge_attr_fan_speed":"Скорость вентилятора · {name}","marker.value_source":"Источник значения","marker.value_source.help":"Выберите, что заменит значок. Действие по нажатию не изменится.","marker.value_source.help.aria":"Подсказка: источник значения внутри значка","marker.value_source_auto":"Автоматически (как раньше)","marker.value_source_missing_hint":"Сохранённый источник сейчас недоступен. До его восстановления или выбора другого значения внутри будет показано —.","marker.light_role_label":"Является источником света","marker.light_role.help":"«Авто» использует фактическую роль привязанного устройства, «Всегда» принудительно создаёт собственный источник, а «Никогда» исключает его; связанные лампы выше остаются независимыми.","marker.light_role.help.aria":"Подсказка: является ли устройство источником света","marker.light_role_auto_yes":"Автоматически (источник света)","marker.light_role_auto_no":"Автоматически (не источник света)","marker.light_role_always":"Всегда источник света","marker.light_role_never":"Никогда не источник света","marker.light_entity_label":"Ведущая сущность света","marker.light_entity.help":"Для составного устройства выберите сущность, состояние, цвет и яркость которой представляют этот источник на плане. Автоматический вариант сохраняет совместимость со старыми планами.","marker.light_entity.help.aria":"Подсказка: ведущая сущность света","marker.light_entity_auto":"Автоматически ({entity})","marker.light_entity_none":"нет управляемой сущности","marker.light_entity_missing":"Сохранённая сущность {entity} недоступна. Временно используется {fallback}; выбор восстановится, если сущность вернётся.","marker.toggle_entity_label":"Переключаемая сущность","marker.toggle_entity.help":"Для составного устройства выберите собственную лампу или переключатель, которой управляет нажатие. Автоматический вариант сохраняет прежние правила цели и не зависит от ведущей сущности света.","marker.toggle_entity.help.aria":"Подсказка: переключаемая сущность","marker.toggle_entity_auto":"Автоматически ({entity})","marker.toggle_entity_none":"нет собственной управляемой сущности","marker.toggle_entity_missing":"Сохранённой сущности {entity} больше нет среди выбираемых каналов этого маркера. Временно используется {fallback}; выбор восстановится, если сущность вернётся.","marker.glow_color_label":"Цвет и яркость свечения","marker.glow_mode.help":"Используйте данные источника, задайте только цвет или зафиксируйте цвет и яркость. Минимум — 1%; чтобы отключить источник, выберите «Никогда».","marker.glow_mode.help.aria":"Подсказка: цвет и яркость свечения","marker.glow_mode_auto":"Из источника","marker.glow_mode_color":"Задать цвет","marker.glow_mode_fixed":"Задать цвет и яркость","marker.glow_color":"Цвет свечения","marker.glow_brightness":"Яркость","marker.glow_disabled_never":"Настройки свечения недоступны: маркер явно исключён из источников света.","marker.glow_disabled_auto":"В автоматическом режиме у этого маркера не найден пространственный источник света.","marker.glow_disabled_no_entity":"Для пространственного источника нет активной управляемой сущности Home Assistant.","marker.glow_passive_hint":"У источника нет собственных данных Home Assistant. Задайте цвет и яркость вручную; радиус остаётся доступным.","marker.control_broken":"Сохранённый источник отсутствует или больше не отмечен как источник света","marker.control_missing_label":"Отсутствующий источник на плане","marker.control_passive":"пассивный источник","toast.marker_control_cycle":"Такая связь создаст циклическую цепочку управления светом.","toast.marker_binding_required":"Сначала выберите устройство Home Assistant, затем добавьте управляемый источник света.","confirm.unlock_title":"Открыть замок?","confirm.unlock_body":"House Plan отправит этому замку команду открытия.","toast.files_migrate_failed":"Не удалось перенести вложения к новой привязке, ссылки остались на старые файлы: {err}","space.pick_saved":"Уже загруженные","space.pick_saved_hint":"Планы, сохранённые на сервере, включая отцеплённые ранее","space.no_saved":"На сервере пока нет сохранённых планов.","space.loading":"Загрузка…","space.used_by":"используется: {list}","space.in_use":"План используется пространством — сначала отцепите его","btn.use":"Выбрать","confirm.delete_plan_title":"Удалить файл плана?","confirm.delete_plan_body":"Файл будет удалён с сервера. Это действие нельзя отменить.","toast.plans_list_failed":"Не удалось получить список планов: {err}","toast.plan_delete_failed":"Не удалось удалить план: {err}","marker.hide":"Скрыть","marker.hide_tip":"Устройство исчезнет с плана после сохранения, но продолжит участвовать в расчёте сигнала комнаты. Вернуть его можно через каталог «Устройства» в редакторе устройств.","marker.show":"Показать","marker.show_tip":"Устройство снова появится на плане после сохранения.","marker.hidden_ghost":"Устройство скрыто пользователем","marker.ha_disabled_device":"Устройство деактивировано в Home Assistant и скрыто с плана.","marker.ha_disabled_entity":"Сущность деактивирована в Home Assistant и скрыта с плана.","marker.ha_disabled_all_entities":"У устройства нет активных сущностей Home Assistant, поэтому оно скрыто с плана.","marker.ha_registry_limited":"Полный реестр Home Assistant недоступен этому пользователю. Неподтверждённый объект временно нельзя показывать или использовать.","marker.delete_tip":"Полностью удалить устройство с плана и из всех расчётов. Позже его можно добавить заново.","tap.run":"Запустить автоматизацию/скрипт/сцену","tap.none":"Ничего не делать","marker.run_target_label":"Что запускать","marker.run_search_ph":"Поиск: автоматизация, скрипт или сцена…","marker.run_target_gone":"Цель {id} не найдена — выберите заново","marker.tap_confirm":"Спрашивать подтверждение","marker.tap_confirm_tip":"Перед выполнением показать диалог подтверждения — защита от случайных нажатий.","marker.toggle_hint_single":"Цель: {name} ({id}).","marker.virtual_light_target":"Виртуальный свет: {name}.","marker.virtual_light_current":"Ручное состояние: {state} → {effect}.","marker.virtual_light_state_on":"включён","marker.virtual_light_state_off":"выключен","marker.toggle_hint_group":"Переключатся источники ({count}): {names}.","marker.toggle_hint_current":"Сейчас: {state} → {effect}.","marker.toggle_hint_group_current":"Сейчас включено {on} из {count} → {effect}.","marker.toggle_hint_skipped":"Не будут затронуты ({count}): {targets}.","marker.toggle_effect_turn_on":"включится","marker.toggle_effect_turn_off":"выключится","marker.toggle_effect_open":"откроется","marker.toggle_effect_close":"закроется","marker.toggle_effect_stop":"остановится","marker.toggle_effect_toggle":"состояние переключится","marker.toggle_skip_missing":"не найдено","marker.toggle_skip_ha_disabled":"деактивировано в HA","marker.toggle_skip_unavailable":"недоступно","marker.toggle_skip_unsupported":"переключение не поддерживается","marker.toggle_skip_secure":"заблокировано из соображений безопасности","marker.toggle_none_no_binding":"У устройства нет привязки, состояние переключать нечем. По нажатию ничего не произойдёт.","marker.toggle_none_no_actionable_entity":"У устройства нет состояния, которое можно переключить. По нажатию ничего не произойдёт.","marker.toggle_none_configured_targets_missing":"Настроенные цели сейчас недоступны. Собственная сущность устройства не будет подставлена вместо них.","marker.toggle_none_ha_disabled":"Цель деактивирована в Home Assistant и не может использоваться на плане.","marker.toggle_none_unavailable":"Цель сейчас недоступна. По нажатию ничего не произойдёт.","marker.toggle_none_unsupported":"Для этой сущности Home Assistant не предоставляет безопасного переключения. По нажатию ничего не произойдёт.","marker.toggle_none_secure":"Переключение замков, сигнализации и защитных ворот с плана заблокировано из соображений безопасности.","run.automation":"автоматизация","run.script":"скрипт","run.scene":"сцена","confirm.tap_run":"Запустить «{name}»?","confirm.tap_toggle":"Переключить «{name}»?","confirm.current_state":"Текущее состояние: {state}","confirm.expected_state":"После переключения: {state}","confirm.group_current":"включено {on} из {total}","confirm.group_all_on":"все включены","confirm.group_all_off":"все выключены","confirm.unavailable_targets":"Недоступно: {count}","confirm.expected_by_ha":"Состояние определит Home Assistant","confirm.state_on":"Включено","confirm.state_off":"Выключено","confirm.state_open":"Открыто","confirm.state_closed":"Закрыто","confirm.state_opening":"Открывается","confirm.state_closing":"Закрывается","confirm.state_stopped":"Остановлено","confirm.state_unknown":"Неизвестно","toast.run_started":"Запущено: {name}","toast.run_target_missing":"Цель запуска не найдена — проверьте настройки устройства","toast.run_target_required":"Выберите автоматизацию, скрипт или сцену","toast.tap_target_changed":"Цель действия изменилась. Повторите попытку.","toast.virtual_light_toggle_failed":"Не удалось переключить виртуальный свет: {err}","toast.value_badge_source_required":"Выберите значение для бейджа","btn.run":"Выполнить","vac.section":"Робот-пылесос: живая позиция","vac.autocal":"Настроить автоматически","vac.live":"Живая позиция на плане","vac.trail":"Показывать путь робота","vac.autocal_no_rooms":"Интеграция не отдаёт список комнат — откройте «Подогнать вручную»","vac.route_warn_unmapped":"Робот убирает на карте, которая не сопоставлена ни одному этажу","vac.route_warn_needs_calibration":"Карта сопоставлена этажу, но не откалибрована","vac.route_warn_ambiguous":"Две карты неразличимы — этаж не выбран","vac.route_warn_missing_space":"Пространство этой карты удалено","vac.autocal_no_match":"Не совпали имена комнат (нужно ≥3 общих) — откройте «Подогнать вручную»","vac.autocal_done":"Готово: привязка по {rooms} комнатам. Запустите уборку и проверьте","vac.cal_need_pos":"Робот сейчас не отдаёт координаты — запустите уборку и поставьте на паузу","vac.cal_done":"Калибровка сохранена. Запустите уборку и проверьте","vac.cal_cancelled":"Калибровка отменена","vac.fit":"Подогнать вручную","vac.fit_hint":"Перетащите карту робота на место, растяните за уголки","vac.fit_rotate":"Повернуть 90°","vac.fit_mirror":"Отразить","vac.trail_never":"Не показывать никогда","vac.trail_cleaning":"Во время уборки","vac.trail_always":"Показывать всегда","gs.bg_group":"Фон сцены","gs.bg_color":"Цвет фона вокруг плана","gs.bg_default":"Как в теме","gs.bg_theme":"по умолчанию — из темы","gs.bg_mode":"Фон плана","gs.bg_mode.help":"«Следует за Солнцем» использует sun.sun, а при недоступности — локальные часы браузера; статичный режим всегда показывает выбранный цвет.","gs.bg_mode.help.aria":"Подсказка: общий фон плана","gs.bg_static":"Статичный цвет","gs.bg_daynight":"Следует за Солнцем","gs.sun_group":"Солнце","gs.sun_missing":"Сущность sun.sun не найдена — фон следует локальным часам, а оконные лучи недоступны.","gs.north":"Север на плане","gs.north.help":"Угол отсчитывается по часовой стрелке от верхней вертикали плана; север нужен для оконных лучей, а не для фона «Следует за Солнцем».","gs.north.help.aria":"Подсказка: общее направление севера","gs.north_ph":"не задан","gs.north_clear":"Сбросить","gs.north_letter":"С","gs.sun_rays":"Солнце в окнах","gs.about_version":"Houseplan Card v{v}","gs.about_github":"GitHub · документация и issues","gs.about_telegram":"Чат в Telegram","support.title":"Помощь и обратная связь","space.bg_color":"Цвет фона вокруг плана","space.bg_inherit":"Наследовать общий","space.bg_inherited":"наследуется из общих настроек","space.bg_mode":"Фон плана","space.bg_mode.help":"Выберите наследование общего фона либо переопределите это пространство статичным цветом или режимом «Следует за Солнцем».","space.bg_mode.help.aria":"Подсказка: фон пространства","space.north":"Север на плане (переопределение)","space.north.help":"Переопределяет общий север для этого пространства; угол отсчитывается по часовой стрелке от верхней вертикали плана и используется оконными лучами.","space.north.help.aria":"Подсказка: север для пространства","space.north_inherited":"наследуется: {v}","space.sun_rays":"Солнце в окнах","space.sun_inherit":"Наследовать общий","space.sun_on":"Вкл","space.sun_off":"Выкл","canvas.far_objects":"Объектов далеко от плана: {n}","canvas.show_far":"Показать","canvas.home_tip":"План там — нажмите, чтобы вписать","gs.grid_group":"Обслуживание планов","gs.grid_hint":"Обновляет модели данных, выравнивает элементы по сетке и объединяет лишние фрагменты стен. Перед записью будет показан точный отчёт.","gs.align_all":"Оптимизировать планы","gs.align_title":"Оптимизировать планы","gs.align_none":"Все планы уже используют актуальную и оптимальную модель данных.","gs.optimize_no_automatic_changes":"Автоматических изменений нет. Проверьте пункты ниже.","gs.align_count":"Сдвинется элементов: {n} из {total}, максимум на {cm} см.","gs.align_where":"Наибольший сдвиг — в пространстве «{s}».","gs.align_turned":"Проёмов с исправлением угла: {n}.","gs.align_preflight_failed":"Не удалось безопасно проверить геометрию следующих пространств: {spaces}{more}.","gs.align_preflight_hint":"Планы не изменены. Скопируйте диагностику кнопкой ниже и приложите её к отчёту об ошибке вместе с экспортом пространства.","gs.preflight_reason_prepare-exception":"Не удалось подготовить геометрию пространства (исключение при сборке модели)","gs.preflight_reason_wall-null":"Тело стен не построилось (объединение вернуло пустоту)","gs.preflight_reason_wall-degraded-extra":"Тело стен деградировало с лишней геометрией","gs.preflight_reason_wall-failed-core":"Ядро тела стен не собралось","gs.preflight_reason_wall-exception":"Построение стен упало с исключением","gs.preflight_reason_floor-null":"Контур пола не построился","gs.preflight_reason_floor-exception":"Построение пола упало с исключением","gs.preflight_copy":"Скопировать диагностику","gs.preflight_copied":"Диагностика скопирована","gs.preflight_update_hint":"Версии карточки и интеграции различаются — обновите House Plan и повторите.","gs.align_preflight_space":"Пространство {n}","gs.align_preflight_more":" и ещё {n}","gs.optimize_changes":"Миграций модели: {m}; обновлено пространств: {c}; устранён шум координат: {p}; объединено отрезков реальных стен: {w}; объединено отрезков стен нулевой толщины: {s}; независимых: {i}.","gs.zero_walls_migrated":"Преобразовано виртуальных участков: {n}.","gs.wall_segments_migrated":"Стабилизировано сегментов стен: {n}.","gs.room_drafts_migrated":"Незавершённые контуры преобразованы в обычные стены: {drafts}; отрезков: {segments}.","gs.optimize_lattice_summary":"Канонизировано шумовых значений координат: {n}; максимальный сдвиг: {cm} см.","gs.optimize_lattice_space":"{space}: канонизировано значений координат: {n}; оставлено значений вне сетки: {far}.","gs.optimize_coincident_partitions":"Скрытые участки независимых стен поглощены стенами комнат: {n}.","gs.optimize_openings_rehosted":"Проёмы перепривязаны к стенам комнат: {n}.","gs.optimize_walls_straightened":"Выпрямлено стен: {n}; максимальное перемещение: {cm} см.","gs.optimize_walls_straightened_where":"Максимальная правка стены: {s}.","gs.optimize_walls_straighten_skipped":"Оставлено почти осевых стен, которые нельзя безопасно выпрямить: {n}.","gs.optimize_glow_migration":"Старый Glow: пространств — {spaces} → без заливки данных + независимый Glow; комнат — {rooms} → наследуемая заливка + независимый Glow.","gs.optimize_references":"Исправлено ссылок: пространства — {spaces}; комнаты — {rooms}; позиции — {positions}; устройств отвязано от отсутствующих пространств — {detached}.","gs.optimize_reference_more":", и ещё {n}","gs.optimize_orphans_removed":"Убрано забытых записей: {total} — подписи комнат: {rooms}; устройства: {devices}; групповые метки: {groups}. Все они принадлежали пространствам, удалённым ранее.","gs.optimize_live_positions":"Старые позиции в удалённых пространствах принадлежат существующим объектам: {n}{names}. Они будут сохранены.","gs.optimize_live_positions_remove":"Старые позиции в удалённых пространствах принадлежат существующим объектам: {n}{names}. Они выбраны для удаления.","gs.optimize_live_names":": {names}{more}","gs.optimize_live_remove":"Убрать старые позиции","gs.optimize_live_keep":"Сохранить старые позиции","gs.optimize_live_selected":"Старые позиции будут убраны после применения оптимизации.","gs.optimize_unverified":"Не удалось безопасно проверить позиций: {n}. Они оставлены без изменений.","gs.optimize_registry_limited":"Для безопасной проверки нужен полный доступ администратора к реестрам Home Assistant.","gs.optimize_vacuum_warning":"Сопоставления комнат пылесоса требуют проверки: {n}.","gs.optimize_details":"Подробности","gs.optimize_details_more":"И ещё записей: {n}.","gs.optimize_detail_removed":"будет удалено","gs.optimize_detail_live":"будет сохранено","gs.optimize_detail_unverified":"не проверено","gs.optimize_detail_room_label":"подпись комнаты","gs.optimize_detail_device":"устройство","gs.optimize_detail_group":"групповая метка","gs.optimize_detail_unknown":"неизвестный владелец","gs.optimize_detail_item":"{status}: {kind} {id}; прежнее пространство {space}","gs.align_warn":"Элементы, намеренно поставленные между узлами, будут сдвинуты. После операции доступна одна отмена — только до следующего изменения плана.","gs.align_run":"Оптимизировать","gs.align_done":"Планы оптимизированы: сдвинуто элементов — {n}, обслужено записей — {m}, исправлено ссылок — {r}","gs.optimize_undo":"Отменить последнюю оптимизацию","gs.optimize_undone":"Последняя оптимизация отменена","decor.furniture":"Мебель","decor.image":"Изображение","decor.image_title":"Свои изображения","decor.image_upload":"Загрузить изображение","decor.image_replace":"Заменить изображение","decor.image_uploading":"Загрузка…","decor.image_asset":"Файл изображения","decor.image_pick_hint":"Загрузите изображение или выберите уже используемое в House Plan.","decor.image_place_hint":"Кликните по плану, чтобы разместить изображение.","decor.image_none":"Загруженных изображений пока нет.","decor.image_unavailable":"Изображение недоступно","decor.image_used":"Используется в объектах: {n}","decor.image_upload_failed":"Не удалось загрузить изображение: {err}","decor.image_error_capacity":"Хранилище пользовательских изображений заполнено.","decor.image_in_use":"Перед удалением файла удалите все размещённые копии.","decor.image_delete_title":"Удалить файл изображения?","decor.image_delete_message":"Удалить «{name}» из House Plan? Это действие нельзя отменить.","furn.title":"Библиотека мебели","furn.symbol":"Символ","furn.group_furniture":"Мебель","furn.group_appliance":"Техника","furn.group_sanitary":"Сантехника","furn.group_other":"Прочее","furn.width":"Ширина","furn.depth":"Глубина","furn.back_to_categories":"Все категории","furn.pick_hint":"Выберите категорию, затем символ.","furn.place_hint":"Кликните по плану — предмет встанет к ближайшей стене. Shift — свободно.","furn.cat_air_conditioner":"Кондиционеры","furn.cat_armchair":"Кресла","furn.cat_bathtub":"Ванны","furn.cat_bed":"Кровати","furn.cat_bidet":"Биде","furn.cat_boiler":"Бойлеры","furn.cat_chair":"Стулья","furn.cat_coffee_table":"Журнальные столы","furn.cat_cooktop":"Варочные панели","furn.cat_dining_table":"Обеденные столы","furn.cat_dishwasher":"Посудомоечные машины","furn.cat_dryer":"Сушильные машины","furn.cat_fireplace":"Камины","furn.cat_fridge":"Холодильники","furn.cat_kitchen_cabinet":"Кухонные шкафы","furn.cat_kitchen_sink":"Кухонные мойки","furn.cat_nightstand":"Тумбы","furn.cat_plant":"Растения","furn.cat_rug":"Ковры","furn.cat_shelving":"Стеллажи","furn.cat_shower":"Душевые","furn.cat_sink":"Раковины","furn.cat_sofa":"Диваны","furn.cat_stairs":"Лестницы","furn.cat_toilet":"Унитазы","furn.cat_tv":"Телевизоры","furn.cat_wardrobe":"Шкафы","furn.cat_washer":"Стиральные машины","furn.cat_work_table":"Рабочие столы","furn.sym_sofa":"Диван двухместный","furn.sym_sofa_three_seat":"Диван трёхместный","furn.sym_sofa_corner_right":"Угловой диван, правый","furn.sym_armchair":"Кресло мягкое","furn.sym_armchair_office":"Кресло офисное","furn.sym_coffee_table":"Журнальный стол, прямоугольный","furn.sym_coffee_table_round":"Журнальный стол, круглый","furn.sym_coffee_table_oval":"Журнальный стол, овальный","furn.sym_coffee_table_rounded":"Журнальный стол, скруглённый","furn.sym_table_dining":"Обеденный стол, прямоугольный","furn.sym_table_round":"Круглый стол","furn.sym_table_dining_oval":"Обеденный стол, овальный","furn.sym_table_dining_rounded":"Обеденный стол, скруглённый","furn.sym_chair":"Стул","furn.sym_chair_bar":"Барный стул","furn.sym_desk":"Рабочий стол, прямоугольный","furn.sym_desk_corner":"Рабочий стол, угловой","furn.sym_bed_double":"Двуспальная кровать","furn.sym_bed_single":"Односпальная кровать","furn.sym_nightstand":"Тумба прикроватная","furn.sym_cabinet_tv":"Тумба под телевизор","furn.sym_cabinet_shoe":"Тумба для обуви","furn.sym_cabinet_sink":"Тумба под раковину","furn.sym_wardrobe":"Шкаф гардеробный","furn.sym_bookshelf":"Шкаф книжный","furn.sym_wall_unit":"Шкаф-стенка","furn.sym_kitchen_floor":"Кухонный напольный модуль","furn.sym_kitchen_floor_corner":"Кухонный напольный угловой модуль","furn.sym_kitchen_wall":"Кухонный навесной модуль","furn.sym_kitchen_wall_corner":"Кухонный навесной угловой модуль","furn.sym_shelf_floor":"Стеллаж напольный","furn.sym_shelf_wall":"Полка настенная","furn.sym_fridge":"Холодильник","furn.sym_stove":"Варочная панель, 4 конфорки","furn.sym_cooktop_two":"Варочная панель, 2 конфорки","furn.sym_dishwasher":"Посудомоечная машина","furn.sym_washer":"Стиральная машина","furn.sym_dryer":"Сушильная машина","furn.sym_tv":"Телевизор на подставке","furn.sym_tv_wall":"Телевизор на кронштейне","furn.sym_ac":"Кондиционер","furn.sym_water_heater":"Бойлер","furn.sym_toilet":"Унитаз напольный","furn.sym_toilet_built_in":"Унитаз встроенный","furn.sym_bathtub":"Ванна прямоугольная","furn.sym_bathtub_corner":"Ванна угловая","furn.sym_shower":"Душ","furn.sym_sink":"Раковина","furn.sym_kitchen_sink":"Кухонная мойка одинарная","furn.sym_kitchen_sink_double":"Кухонная мойка двойная","furn.sym_bidet":"Биде напольное","furn.sym_bidet_built_in":"Биде встроенное","furn.sym_stairs":"Лестница","furn.sym_fireplace":"Камин","furn.sym_plant":"Растение","furn.sym_rug":"Ковёр","common.yes":"Да","common.no":"Нет","vac.diag_source":"Источник","vac.diag_platform":"Интеграция","vac.diag_status":"Статус","vac.diag_position":"Позиция","vac.diag_rooms":"Комнаты","vac.diag_rooms_value":"{total} · совпало имён: {matched} · {readiness}","vac.autocal_ready":"автокалибровка доступна","vac.autocal_not_ready":"нужно 3 совпавших имени","vac.diag_path":"Путь интеграции","vac.diag_map":"ID карты","vac.source_none":"не выбран","vac.source_status_ok":"Готов","vac.source_status_missing":"Не найден","vac.source_status_disabled":"Деактивирован в Home Assistant","vac.source_status_unavailable":"Недоступен","vac.source_status_unverified":"Нельзя проверить с текущими правами","vac.source_status_unsupported":"Нет данных позиции","vac.source_status_none":"Нет источника","vac.source_banner_missing":"Сохранённый источник больше не существует. Он не заменён автоматически: выберите другой или восстановите его в Home Assistant.","vac.source_banner_disabled":"Сохранённый источник деактивирован в Home Assistant. Активируйте его там или выберите другой.","vac.source_banner_unverified":"Текущих прав Home Assistant недостаточно для проверки источника. Привязка сохранена и не будет заменена автоматически.","vac.choose_source":"Выбрать источник","vac.source_auto":"Автоматически","vac.source_auto_hint":"Использовать совместимую сущность этого устройства","vac.all_cameras":"Все камеры","vac.all_cameras_warn":"Камера может не отдавать данные робота. Выбирайте её только если это карта вашего пылесоса.","vac.all_cameras_empty":"Других сущностей камеры не найдено.","vac.platform_unknown":"интеграция неизвестна","vac.cap_position":"позиция","vac.cap_rooms_short":"комнаты","vac.cap_path":"путь","vac.cap_map":"ID карты","vac.cap_none":"данные робота не обнаружены","vac.xcme_hint":"Включите атрибуты Xiaomi Cloud Map Extractor:","vac.documentation":"Документация","vac.residual_title":"Проверьте автокалибровку","vac.residual_message":"Совпавшие комнаты расходятся максимум на {error}. Примените приблизительную калибровку, подгоните её вручную либо отмените без изменения сохранённых настроек.","vac.apply_proposal":"Применить","gs.backup_group":"Резервная копия и перенос","gs.backup_hint":"Скачайте переносимую JSON-копию или проверьте и импортируйте копию, созданную House Plan.","backup.export_open":"Экспорт","backup.import_open":"Импорт","backup.export_title":"Экспорт House Plan","backup.import_title":"Импорт House Plan","backup.export_hint":"Выберите, должна ли копия содержать всю конфигурацию House Plan или только текущее пространство.","backup.full":"Полная копия","backup.current_space":"Текущее пространство","backup.current_space_title":"Текущее пространство: {title}","backup.no_current_space":"Нет текущего пространства","backup.plan_only":"Только планировка","backup.plan_only_hint":"Сохранить комнаты, стены, проёмы, декор и позиции подписей комнат без устройств и привязок Home Assistant.","backup.plan_only_preview":"Файл содержит только планировку","backup.privacy_warning":"Архив сохраняет названия, идентификаторы Home Assistant и точные координаты. Внутренние планы и вложения указываются ссылками, но не вкладываются; текущие состояния и маршруты пылесосов не включаются.","backup.download":"Скачать JSON","backup.export_done":"Резервная копия скачана","backup.reading":"Проверяем резервную копию…","backup.revalidated":"После предпросмотра план изменился. Сводка обновлена — проверьте её и подтвердите ещё раз.","backup.error.support_invalid_message":"Проверьте сообщение для поддержки и повторите попытку.","backup.error.support_package_too_large":"Обезличенный пакет для поддержки превышает лимит 8 МиБ.","backup.error.support_preview_expired":"Предпросмотр вложения для поддержки истёк или больше недоступен.","backup.error.support_rate_limited":"Запрошено слишком много репортов или предпросмотров. Повторите позже.","backup.error.support_rejected":"Репорт не прошёл проверку службы поддержки.","backup.error.support_unavailable":"Закрытая служба поддержки временно недоступна.","backup.error.unauthorized":"У вас нет прав на экспорт или импорт этого плана.","backup.error.not_ready":"House Plan ещё не готов. Повторите попытку через несколько секунд.","backup.error.too_large":"Размер резервной копии превышает 8 МиБ.","backup.error.invalid_json":"Выбранный файл не является корректным JSON.","backup.error.invalid_format":"Выбранный файл не является резервной копией House Plan.","backup.error.invalid_image":"Изображение повреждено или не соответствует своему формату.","backup.error.unsupported_export_version":"Эта версия формата резервной копии не поддерживается установленной версией.","backup.error.unsupported_image":"Используйте поддерживаемое изображение PNG, JPEG, WebP или SVG.","backup.error.future_model":"Резервная копия создана в более новой версии модели данных House Plan.","backup.error.invalid_config":"Резервная копия содержит некорректную конфигурацию House Plan.","backup.error.wall_model_migration_blocked":"Не удалось безопасно обновить модель стен из резервной копии. Сначала оптимизируйте исходный план и повторите экспорт.","backup.error.invalid_layout":"Резервная копия содержит некорректные позиции объектов.","backup.error.invalid_content":"Резервная копия содержит некорректные или несогласованные ссылки на файлы.","backup.error.space_not_found":"Выбранное пространство больше не существует.","backup.error.capacity_exceeded":"Добавление этой копии превысит ограничения размера плана.","backup.error.preview_expired":"Время предпросмотра истекло. Выберите файл резервной копии заново.","backup.error.preview_owner_mismatch":"Этот предпросмотр принадлежит другому пользователю Home Assistant.","backup.error.conflict":"После предпросмотра план изменился. Проверьте обновлённую сводку.","backup.error.content_confirmation_required":"Подтвердите отсоединение недоступных локальных файлов.","backup.error.commit_failed":"Не удалось безопасно применить копию. Предыдущий план восстановлен или ожидает восстановления.","backup.error.missing_plan":"После предпросмотра исчез связанный файл плана. Проверьте копию ещё раз.","backup.error.missing_content":"После предпросмотра исчез связанный локальный файл. Проверьте копию ещё раз.","backup.error.marker_control_missing":"В резервной копии отсутствует связанный источник света на плане.","backup.error.marker_control_not_light":"Связанная цель больше не отмечена как источник света.","backup.error.marker_control_self":"Источник света не может управлять самим собой.","backup.error.marker_control_cycle":"Резервная копия содержит циклическую цепочку управления светом.","backup.error.duplicate_marker_control":"Резервная копия содержит повторяющуюся связь с источником света.","backup.error.no_backup":"Нет снимка импорта или оптимизации, который можно восстановить.","backup.error.in_use":"Элемент ещё используется","backup.error.invalid_data":"Запрос содержит некорректные данные","backup.error.invalid_light_entity":"Ведущий свет должен быть сущностью light.* или switch.*","backup.error.invalid_marker_control":"Некорректная ссылка управления маркером","backup.error.invalid_name":"Некорректное имя","backup.error.invalid_partition_opening_host":"Проём должен сохранить свою перегородку-носитель","backup.error.invalid_partition_opening_jamb_margin":"Проём не оставляет физического простенка у края стены","backup.error.invalid_passage_fields":"Открытый проход не может нести настройки двери","backup.error.invalid_space_id":"Неизвестное пространство","backup.error.invalid_toggle_entity":"Сущность переключения должна быть light.* или switch.*","backup.error.invalid_value_badge":"Некорректные настройки бейджа значения","backup.error.invalid_value_badge_attribute":"Некорректный атрибут бейджа значения","backup.error.invalid_value_badge_position":"Некорректная позиция бейджа значения","backup.error.invalid_value_badge_source":"Некорректный источник бейджа значения","backup.error.invalid_vacuum_map_route":"Проверьте сопоставление карт робота пространствам.","backup.error.invalid_value_source":"Некорректный источник значения","backup.error.invalid_value_source_attribute":"Некорректный атрибут источника значения","backup.error.io_error":"Файловая операция на сервере не удалась","backup.error.not_toggleable":"Это устройство нельзя переключить","backup.error.nothing_to_repair":"Нечего чинить","backup.error.space_in_use":"На пространство ещё есть ссылки","backup.error.value_badge_source_required":"Бейджу значения нужен источник","backup.error.wall_model_client_outdated":"План обновлён в другом месте — перезагрузите страницу","backup.same_source":"Создано на этом экземпляре Home Assistant","backup.foreign_source":"Создано на другом экземпляре Home Assistant","backup.created":"Создано: {value}","backup.versions":"Карточка {card}; интеграция {integration}; модель данных {model}","backup.count_spaces":"Пространств: {n}","backup.count_rooms":"Комнат: {n}","backup.count_walls":"Стен: {n}","backup.count_openings":"Проёмов: {n}","backup.count_decor":"Объектов декора: {n}","backup.count_markers":"Устройств: {n}","backup.count_layout":"Позиций: {n}","backup.bindings":"Привязки — устройства: {device}, сущности: {entity}, виртуальные: {virtual}; позиций без пространства: {legacy}","backup.binding_status":"Статус на целевом экземпляре — активных: {active}, деактивированных: {disabled}, отсутствующих: {missing}","backup.missing_areas":"На целевом экземпляре отсутствуют зоны: {areas}","backup.dropped_marker_links":"Связи с источниками света вне переносимого пространства пропущены: {n}.","backup.room_drafts_migrated":"Старые незавершённые контуры преобразованы в обычные стены: {drafts}; отрезков: {segments}.","backup.repaired_target_refs":"Существующих ссылок восстановлено этим импортом: {n}.","backup.preserved_unresolved_refs":"Неоднозначные ссылки сохранены без изменений: {n}.","backup.preserved_unresolved_hint":"House Plan ничего не угадывал и не удалял. После импорта запустите «Оптимизировать планы», чтобы проверить оставшиеся ссылки.","backup.import_details":"Подробности восстановления ссылок","backup.import_detail.incoming_remapped":"Ссылок обновлено внутри импортируемой копии: {n}","backup.import_detail.target_repaired":"Существующих ссылок восстановлено: {n}","backup.import_detail.preserved_unresolved":"Неразрешимых ссылок сохранено: {n}","backup.import_detail.collisions":"Конфликтов назначения безопасно сохранено: {n}","backup.import_detail.dropped_links":"Входящих связей пропущено по правилам переноса: {n}","backup.import_detail.bounded_lineages":"Чрезмерно вложенных идентификаторов ограничено: {n}","backup.replace_warning":"Текущая конфигурация и расположение будут заменены. Загруженные файлы не удаляются. Одну отмену можно выполнить до следующего изменения плана.","backup.foreign_bookkeeping":"Служебные списки известных и новых устройств другого экземпляра импортированы не будут.","backup.final_name":"Название нового пространства","backup.target_settings":"Глобальные настройки целевого экземпляра не изменятся.","backup.duplicates":"Уже существующих привязок: {n}","backup.skip":"Пропустить повторяющиеся устройства","backup.virtual_copy":"Добавить безопасные статичные виртуальные копии","backup.content":"Связанное содержимое","backup.decor_images_summary":"Свои изображения: объектов — {objects}, файлов — {assets}; отсутствует файлов — {missing}.","backup.content_available":"доступно локально","backup.content_external":"внешняя ссылка","backup.content_detach_required":"будет отвязано","backup.confirm_detach":"Я понимаю, что недоступные внутренние планы и вложения будут отвязаны от импортируемой конфигурации.","backup.confirm_missing_images":"Я понимаю, что отсутствующие свои изображения останутся восстанавливаемыми заглушками, а остальные недоступные локальные файлы будут отвязаны.","backup.replace":"Заменить","backup.add":"Добавить пространство","backup.space_done":"Пространство импортировано: комнат — {rooms}, устройств — {markers}, существующих ссылок восстановлено — {refs}","backup.full_done":"Копия восстановлена: пространств — {spaces}, комнат — {rooms}, устройств — {markers}","backup.undo_import":"Отменить последний полный импорт","backup.import_undone":"Полный импорт отменён","backdrop.large_title":"Большое изображение","backdrop.large_body":"Изображение {w}×{h} ({fileMb} МБ), для показа потребуется около {decodedMb} МБ памяти. На планшетах это может привести к падению страницы.","backdrop.unknown_body":"Не удалось прочитать размеры изображения — файл может быть повреждён. Продолжение может привести к падению страницы на планшете.","backdrop.reduced_dimensions":"Уменьшенная копия: {w}×{h} px.","backdrop.use_downscaled":"Загрузить уменьшенную копию","backdrop.reducing":"Уменьшаем…","backdrop.keep_original":"Оставить оригинал","backdrop.too_large_title":"Изображение слишком большое","backdrop.too_large_body":"Изображение превышает возможности браузера ({w}×{h}, предел {limit} px по стороне). Уменьшите его в редакторе на компьютере и загрузите снова.","backdrop.downscale_failed":"Не удалось создать уменьшенную копию. Текущий план не изменён."}},{code:"de",nativeLabel:"Deutsch",loadDictionary:async function(e){const t=0===e?await import("./de-CguB1iyB.js"):await import(new URL("./de-CguB1iyB.js?retry",import.meta.url).href);return{dictionary:t.dictionary,fingerprint:t.fingerprint}}},{code:"fr",nativeLabel:"Français",loadDictionary:async function(e){const t=0===e?await import("./fr-C84z_afh.js"):await import(new URL("./fr-C84z_afh.js?retry",import.meta.url).href);return{dictionary:t.dictionary,fingerprint:t.fingerprint}}}],up=sp,pp=new Set;const _p=new class{constructor(e,t,i=console.warn,n){this.entries=e,this.expectedFingerprint=t,this.warn=i,this.loadFailed=n,this.dictionaries=new Map,this.pending=new Map,this.failed=new Set;for(const t of e)t.dictionary&&this.dictionaries.set(t.code,t.dictionary)}state(e){return this.dictionaries.has(e)?"ready":this.failed.has(e)?"fallback":"pending"}dictionary(e){return this.dictionaries.get(e)}ensure(e){if("pending"!==this.state(e))return Promise.resolve();const t=this.pending.get(e);if(t)return t;const i=this.entries.find(t=>t.code===e),n=this.load(i).finally(()=>this.pending.delete(e));return this.pending.set(e,n),n}async load(e){if(!e?.loadDictionary)return void(e&&this.failed.add(e.code));let t;for(const i of[0,1])try{const t=await e.loadDictionary(i);if(t.fingerprint!==this.expectedFingerprint)throw new Error(`locale fingerprint mismatch for ${e.code}`);return this.dictionaries.set(e.code,t.dictionary),void this.failed.delete(e.code)}catch(e){t=e}this.failed.add(e.code),this.warn(`[houseplan] unable to load ${e.code} locale; using English`,t),this.loadFailed?.(e.code)}}(dp,"012abf4b3924ad03971870eb8085ab1ac1a66b0d9b6676fe095285a8b0f201ab",console.warn,function(e){for(const t of pp)t(e)});function mp(e){const t=vp(e)?.code??"en";return _p.dictionary(t)??up}function gp(e){return"string"==typeof e?e.trim().replaceAll("_","-").toLowerCase():""}const fp=new Map(dp.map(e=>[gp(e.code),e]));function vp(e){return fp.get(gp(e))}function yp(e,t){const i=[{value:"",label:e},...dp.map(({code:e,nativeLabel:t})=>({value:e,label:t}))],n="string"==typeof t?t:"";return n&&!i.some(e=>e.value===n)&&i.push({value:n,label:vp(n)?.nativeLabel??n}),i}function bp(e,t){return function(e,t,i,n){const r=new Map(i.map(e=>[gp(e),e])),o=r.get(gp(e));if(o)return o;const s=gp(t),a=r.get(s);return a||(r.get(s.split("-")[0]||"")??n)}(t,e?.locale?.language||e?.language,dp.map(({code:e})=>e),"en")}function wp(e,t,i){return nn(mp(e)[t]??up[t]??t,i)}function kp(e,t){const i=mp(e)[t]??up[t];return"string"==typeof i&&i.trim().length>0}function xp(e,t,i,n){return{ox:0,oy:0}}function Sp(e,t){const i=(e.angle+90)*Math.PI/180,n=Ha(16,t),r=e.gateFace?-n*e.gateFace.side:n*(e.flipV?-1:1);return[[e.x+Math.cos(i)*r,e.y+Math.sin(i)*r],r<0]}function $p(e){const t=e.length/2,i=e.face.cm>0?e.face.cm/e.cellCm*e.gridPitch/2:Ha(4,e.cellCm),n="gate"===e.type?Math.sin(10*Math.PI/180)*t:0;return{half:t,jambHalf:i,gateDepth:n,outlineHalf:Math.max(Ha(16,e.cellCm),i+Ha(8,e.cellCm),n+Ha(8,e.cellCm)),hitHalf:Math.max(Ha(20,e.cellCm),i+Ha(10,e.cellCm),n+Ha(12,e.cellCm))}}function Mp(e,t,i){e.minX=Math.min(e.minX,t),e.minY=Math.min(e.minY,i),e.maxX=Math.max(e.maxX,t),e.maxY=Math.max(e.maxY,i)}function Rp(e,t,i,n,r,o,s,a){const l=Math.min(s,a)*Math.PI/180,c=Math.max(s,a)*Math.PI/180,h=(e,t)=>{const i=Math.atan2(t,e),n=[l,c];for(let e=-3;e<=3;e++){const t=e*Math.PI-i,r=Math.PI/2+e*Math.PI-i;t>l&&tl&&r0&&[e.length,e.angle,t[0],t[1]].every(Number.isFinite)))return null;const{half:i,jambHalf:n}=$p(e),r=Na(e.cellCm),o=1.75*r,s=1.25*r,a=.75*r,l={minX:-i-s,minY:-n-s,maxX:i+s,maxY:n+s},c={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("window"===e.type)Rp(c,-i,0,i,-o,o,-90,0),Rp(c,i,-i,0,-o,o,0,90),Mp(c,-i-a,-i-a),Mp(c,i+a,a);else if("gate"===e.type){const t=10*e.face.side;Rp(c,-i,0,i,-o,o,0,t),Rp(c,i,-i,0,-o,o,-t,0)}else Rp(c,-i,0,e.length,-o,o,-90,0),Mp(c,-i-a,-e.length-a),Mp(c,i+a,a);const[h,d]=Cp(e),u={...l};Mp(u,c.minX+h,c.minY+d),Mp(u,c.maxX+h,c.maxY+d);const p=e.flipH?-1:1,_="gate"===e.type?1:e.flipV?-1:1,m=e.angle*Math.PI/180,g=Math.cos(m),f=Math.sin(m),v={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const e of[u.minX,u.maxX])for(const i of[u.minY,u.maxY]){const n=e*p,r=i*_;Mp(v,t[0]+n*g-r*f,t[1]+n*f+r*g)}return v}function Dp(e){if("passage"===e.type)return W``;const t=Math.max(0,Math.min(1,e.amount)),{half:i,jambHalf:n}=$p(e),r=Na(e.cellCm),o=1.75*r,s=e.flipH?-1:1,a=e.flipV?-1:1,l="gate"===e.type?1:a,[c,h]=Cp(e);let d;if("window"===e.type){const o=Math.PI/2*i,s=e.face.cm>0?W``:W``;d=W` ${l} `:G} - `}}ug.properties={hass:{attribute:!1},_config:{state:!0},_snap:{state:!0},_continuityEpoch:{state:!0}},ug.styles=[op,o`.hp-static-title{font-weight:700;padding:10px 14px 6px;font-size:16px;color:var(--primary-text-color);}.hp-static-body{position:relative;}.hp-static-stage{position:relative;width:100%;container-type:inline-size;overflow:hidden;pointer-events:none;background:var(--ha-card-background,var(--card-background-color,#111));}.hp-static-stage svg{position:absolute;inset:0;width:100%;height:100%;display:block;z-index:1;}.hp-paper{fill:var(--ha-card-background,var(--card-background-color,#111));stroke:none;}.wallbody-fill{fill:var(--wall-fill,#ffffff);fill-opacity:var(--wall-fill-op,1);fill-rule:evenodd;stroke:none;pointer-events:none;}.wallbody{fill:url(#hp-wall-hatch);fill-rule:evenodd;stroke:var(--room-stroke,var(--hp-muted,#607d8b));stroke-width:calc(0.6px * var(--hp-cell-visual-scale,1));pointer-events:none;}.wallbody.solid{fill:none;}.hp-static-stage .devlayer{position:absolute;inset:0;z-index:2;}.hp-static-foot{padding:8px 12px 12px;pointer-events:auto;}.hp-static-btn{width:100%;padding:9px 14px;border:none;border-radius:10px;background:var(--primary-color,#3ea6ff);color:var(--text-primary-color,#fff);font-size:14px;font-weight:600;cursor:pointer;}:host([data-pointer-hover]) .hp-static-btn:hover{filter:brightness(1.08);}.hp-static-error{padding:24px;text-align:center;color:var(--secondary-text-color,#9aa4ad);}`],customElements.get("houseplan-space-card")||customElements.define("houseplan-space-card",ug),window.customCards=window.customCards||[],window.customCards.find(e=>"houseplan-space-card"===e.type)||window.customCards.push({type:"houseplan-space-card",name:"House Plan — Space (static)",description:"Read-only live schematic of a single houseplan space, with a deep-link button.",preview:!1,documentation:"https://github.com/Matysh/houseplan-card"});const pg=o`:host{--hp-editor-tray-bg-fallback:color-mix(in srgb,var(--card-background-color,var(--hp-bg)) 94%,var(--hp-line));--hp-editor-tray-bg:color-mix(in srgb,var(--card-background-color,var(--hp-bg)) 86%,transparent);--hp-editor-tray-border:color-mix(in srgb,var(--hp-line) 82%,var(--hp-accent));--hp-editor-tray-blur:8px;--hp-editor-tray-shadow:var(--shadow-2);}.editor-secondary-host{position:absolute;inset:var(--sp-2) var(--sp-4) auto;z-index:70;display:flex;justify-content:flex-end;pointer-events:none;}.editor-secondary-host.kind-palette,.editor-secondary-host.kind-group{justify-content:flex-start;}.editor-secondary{pointer-events:none;max-width:100%;display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-3) var(--sp-4);color:var(--hp-txt);background:var(--card-background-color,var(--hp-bg));background:var(--hp-editor-tray-bg-fallback);border:1px solid var(--hp-line);border-color:var(--hp-editor-tray-border);border-radius:var(--rad-l);box-shadow:var(--hp-editor-tray-shadow);opacity:0;visibility:hidden;transform:translateY(-4px);transition:opacity 0.1s ease,transform 0.1s cubic-bezier(0.2,0.7,0.2,1),visibility 0s linear 0.1s;touch-action:auto;}.editor-secondary-host.open .editor-secondary{pointer-events:auto;opacity:1;visibility:visible;transform:translateY(0);transition-duration:0.14s,0.14s,0s;transition-delay:0s;}.editor-secondary-host.blocked .editor-secondary{pointer-events:none;}@supports ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){.editor-secondary{background:var(--hp-editor-tray-bg);-webkit-backdrop-filter:blur(var(--hp-editor-tray-blur));backdrop-filter:blur(var(--hp-editor-tray-blur));}}.editor-secondary-content,.editor-group-items{display:flex;align-items:center;gap:var(--sp-3);min-width:0;}.editor-context-label{max-width:14rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-inline-end:var(--sp-4);border-inline-end:1px solid var(--hp-line);color:var(--hp-muted);font-size:var(--fs-s);}.editor-secondary.kind-palette{width:min(760px,100%);align-items:stretch;padding:0;overflow:hidden;}.editor-secondary.kind-palette .editor-secondary-content,.editor-secondary.kind-palette .furnpalette{width:100%;}.editor-secondary.kind-palette .furnpalette{max-height:38vh;border:0;background:transparent;}.editor-group-launcher .group-chevron{--mdc-icon-size:16px;transition:transform 0.14s ease;}.editor-group-launcher[aria-expanded="true"] .group-chevron{transform:rotate(180deg);}.editor-secondary .bdhint{font-size:var(--fs-s);color:var(--hp-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.editor-secondary .dfill{display:inline-flex;align-items:center;gap:var(--sp-2);font-size:var(--fs-s);cursor:pointer;}.editor-secondary .dfill input[type="checkbox"]{width:16px;height:16px;flex:none;margin:0;padding:0;}.editor-secondary hp-color-opacity{flex:0 0 auto;}.editor-secondary input{width:74px;background:transparent;border:1px solid var(--hp-line);color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-m);}.editor-secondary label,.editor-secondary .hint{color:var(--hp-muted);font-size:var(--fs-s);}.editor-secondary .drawwall{display:inline-flex;align-items:center;gap:var(--sp-3);white-space:nowrap;}.editor-secondary .drawwall input{width:4.2em;}.editor-secondary .drawwall .opl{color:var(--hp-muted);font-size:var(--fs-s);}@container (min-width:560px) and (max-width:899px){.editor-secondary-content,.editor-group-items{flex-wrap:wrap;justify-content:flex-end;}}@container (max-width:559px){.editor-secondary-host{inset-inline:var(--sp-4);}.editor-secondary{max-width:100%;}.editor-secondary-content,.editor-group-items{overflow-x:auto;scrollbar-width:thin;}.editor-secondary-content>*,.editor-group-items>*{flex:none;}.editor-context-label{display:none;}}@media (prefers-reduced-motion:reduce){.editor-secondary{transition:none;}.editor-group-launcher .group-chevron{transition:none;}}`;class _g{constructor(e=50){this._undo=[],this._redo=[],this._limit=Math.max(30,Math.floor(e))}get canUndo(){return this._undo.length>0}get canRedo(){return this._redo.length>0}get undoName(){return this._undo[this._undo.length-1]?.name??null}get redoName(){return this._redo[this._redo.length-1]?.name??null}get size(){return this._undo.length}push(e){this._undo.push(e),this._undo.length>this._limit&&this._undo.splice(0,this._undo.length-this._limit),this._redo=[]}undo(){const e=this._undo.pop()??null;return e&&this._redo.push(e),e}redo(){const e=this._redo.pop()??null;return e&&this._undo.push(e),e}removeWhere(e){const t=this._undo.length,i=this._redo.length;return this._undo=this._undo.filter(t=>!e(t)),this._redo=this._redo.filter(t=>!e(t)),t+i-this._undo.length-this._redo.length}clear(){this._undo=[],this._redo=[]}}function mg(e,t){const i=e[t];return i&&Number.isFinite(i.x)&&Number.isFinite(i.y)?{x:i.x,y:i.y,..."string"==typeof i.s?{s:i.s}:{}}:null}function gg(e,t,i){if(null===i){if(!(t in e))return e;const i={...e};return delete i[t],i}const n={...e[t]||{}};delete n.x,delete n.y,delete n.s;const r={...n,x:i.x,y:i.y,...void 0!==i.s?{s:i.s}:{}};return{...e,[t]:r}}const fg="houseplan-card:version-reload-target:v1";function vg(e){if("string"!=typeof e)return null;return e.trim()||null}class yg{constructor(e){this.hooks=e,this._input={frontendVersion:null,backendVersion:null,kiosk:!1,reducedMotion:!1},this._relation={kind:"unknown"},this._banner=null,this._connected=!1,this._attemptTarget=null,this._attemptState=null,this._noticeToken=0}get relation(){return this._relation}get banner(){return this._banner}get hasCurrentMismatchNotice(){return"mismatch"===this._relation.kind&&"visible"===this._banner?.phase}connect(){this._connected||(this._connected=!0,this._attemptTarget=null,this._attemptState=null,this._reconcile())}disconnect(){(this._connected||this._banner)&&(this._connected=!1,this._cancelTimer(),this._banner&&(this._banner=null,this.hooks.changed()))}update(e){const t={frontendVersion:vg(e.frontendVersion),backendVersion:vg(e.backendVersion),kiosk:!0===e.kiosk,reducedMotion:!0===e.reducedMotion},i=function(e,t){const i=vg(e),n=vg(t);return i&&n?i===n?{kind:"equal",frontend:i,backend:n}:{kind:"mismatch",frontend:i,backend:n}:{kind:"unknown"}}(t.frontendVersion,t.backendVersion),n=!((e,t)=>e.frontendVersion===t.frontendVersion&&e.backendVersion===t.backendVersion&&e.kiosk===t.kiosk&&e.reducedMotion===t.reducedMotion)(this._input,t)||!((e,t)=>e.kind===t.kind&&("unknown"===e.kind||"unknown"!==t.kind&&e.frontend===t.frontend&&e.backend===t.backend))(this._relation,i);this._input=t,this._relation=i,n&&this._reconcile()}finishBannerExit(e){this._banner&&"leaving"===this._banner.phase&&this._banner.token===e&&(this._banner=null,this.hooks.changed())}_reconcile(){if(this._cancelTimer(),!this._connected||"mismatch"!==this._relation.kind)return this._attemptTarget=null,this._attemptState=null,void this._hideBanner();if(!this._input.kiosk)return this._attemptTarget=null,this._attemptState=null,void this._showBanner(this._relation.frontend,this._relation.backend);const e=this._relation.backend;if(this._attemptTarget===e&&null!==this._attemptState||(this._attemptTarget=e,this._attemptState=function(e,t){try{const i=e();return i?i.getItem(fg)===t?"attempted":"fresh":"unavailable"}catch{return"unavailable"}}(this.hooks.storage,e)),"fresh"===this._attemptState)return this._hideBanner(),void this._armTimer();this._showBanner(this._relation.frontend,e)}_armTimer(){this._connected&&void 0===this._timer&&"mismatch"===this._relation.kind&&this._input.kiosk&&"fresh"===this._attemptState&&(this._timer=this.hooks.clock.setTimeout(()=>{this._timer=void 0,this._tick()},250))}_cancelTimer(){void 0!==this._timer&&(this.hooks.clock.clearTimeout(this._timer),this._timer=void 0)}_tick(){if(!this._connected||"mismatch"!==this._relation.kind||!this._input.kiosk||"fresh"!==this._attemptState)return;if(!function(e){return e.connected&&e.initialFrameSettled&&e.viewOnly&&e.surfacesIdle&&e.configWritesIdle&&e.physicalWritesIdle&&e.layoutWritesIdle&&e.gesturesIdle&&e.interactionPauseElapsed&&e.baseZoom}(this.hooks.safety()))return void this._armTimer();const e=this._relation.backend,t=function(e,t){try{const i=e();return i?i.getItem(fg)===t?"attempted":(i.setItem(fg,t),"claimed"):"unavailable"}catch{return"unavailable"}}(this.hooks.storage,e);if(this._attemptTarget=e,this._attemptState="claimed"===t?"attempted":t,"claimed"===t){this._showBanner(this._relation.frontend,e);try{this.hooks.reload()}catch{}}else this._showBanner(this._relation.frontend,e)}_showBanner(e,t){"visible"===this._banner?.phase&&this._banner.frontend===e&&this._banner.backend===t||(this._banner={frontend:e,backend:t,phase:"visible",token:++this._noticeToken},this.hooks.changed())}_hideBanner(){if(this._banner)return this._input.reducedMotion?(this._banner=null,void this.hooks.changed()):void("leaving"!==this._banner.phase&&(this._banner={...this._banner,phase:"leaving",token:++this._noticeToken},this.hooks.changed()))}}const bg=1;function wg(e,t){const i=t&&"object"==typeof t?t:{};e._haIntegrationVersion=vg(i.integration_version);const n=i.support_api;e._haSupportApi="number"==typeof n&&Number.isSafeInteger(n)?n:null,e._haDecorAssetsApi=1===i.decor_assets_api?1:null,e._haSummaryPanelApi=1===i.summary_panel_api?1:null,e._haRadarStage1Api=1===i.radar_stage1_api?1:null,e._syncVersionRecovery()}function kg(e){const t=e._stageEl,i=e._loadOk&&!e._loading&&e._continuityDataReady&&!e._resumeSettling&&!e._connectionWasLost&&!e._booting&&!e._bootFading&&!e._bootSettling&&!e._bootSoft&&e._continuity.hasCompleteFrame&&"steady"===e._continuity.state&&!e._continuity.overlayBlocksInteraction&&!!t&&t.clientWidth>0&&t.clientHeight>0,n=!(0!==e._pointers.size||0!==e._touchContacts.size||e._touchSequenceMultitouch||e._roomPointer||e._panStart||e._panLock||e._pinchStart||e._swipeStart||e._tabDrag||e._tabDragRelease||e._drag||e._deviceDrag||e._rlResize||e._resize?.dragging||e._physicalDrag||e._physicalRotate||e._opDrag||e._decorDraft||e._decorMove||e._dtDrag||e._bdDrag||e._furnTouchPending||e._compassDrag||e._viewportGestureDirty||e._devicePositionBusy||e._modeTransitionBusy||e._cameraTransition.active||e._slide||0!==e._warmModeRequest),r=!(e._editorSecondaryDialogBlocked||e._partitionDeleteDialog||e._roomDeleteDialog||e._backdropGuard||e._vacFit||e._editorSecondary?.hasOpenGroup||e._furnPalette||e._decorImagePalette);return{connected:e.isConnected,initialFrameSettled:i,viewOnly:!0===e._config?.kiosk&&"view"===e._mode&&!e._editing,surfacesIdle:r,configWritesIdle:0===e._writesPending&&!e._saveConfigDebounced.pending(),physicalWritesIdle:0===e._pendingPhysicalWrites.size,layoutWritesIdle:!e._persistLayout.pending()&&0===e._dirtyPos.size&&0===e._sentPos.size&&!e._devicePositionBusy,gesturesIdle:n,interactionPauseElapsed:Date.now()>=e._cyclePausedUntil,baseZoom:e._zoom<=1.001}}class xg{constructor(){this.seen=null,this.diagnosticsCache=null}observe(e,t,i,n){this.invalidateDiagnosticsForHass(e,t,i),this.intake(t,n)}intake(e,t){e&&this.seen!==e&&(this.seen=e,t())}invalidate(){this.diagnosticsCache=null}invalidateDiagnosticsForHass(e,t,i){this.diagnosticsCache&&(e?.entities!==t?.entities||e?.devices!==t?.devices||[...i?.entityIds||[]].some(i=>!!e?.states?.[i]!=!!t?.states?.[i]))&&this.invalidate()}diagnostics(e,t,i){if(this.diagnosticsCache)return this.diagnosticsCache;const n={active:0,ha_disabled:0,orphaned:0,unverified:0};for(const e of t)e.removed||"virtual"===e.binding||n[i(e.binding).kind]++;return this.diagnosticsCache={registry:hd(e),bindings:n},this.diagnosticsCache}}function Sg(e){const t=e;t._hassSequence++,t._renderSnapshotAt=Date.now(),t._continuity.note("hass-snapshot"),t._ensureHaRegistryAuthority(),t._planHassMemo=null,t._hookConnection(),!t._loadOk&&!t._loading&&t._loadTries<8&&t._loadFromServer(),t._maybeRebuildDevices(),t._vacTick(),t._activityTick()}function $g(e){return!!e&&"object"==typeof e&&1===e.version}function Mg(e,t){const i=e.radar;return e.space===t&&!0!==e.hidden&&!0!==e.removed&&$g(i)&&!0===i.enabled&&!1!==i.show_live}const Rg={ok:"radar.health_ok",off:"radar.health_off",stale:"radar.health_stale",partial:"radar.health_partial",restricted:"radar.health_restricted",incomplete:"radar.health_incomplete",position_unavailable:"radar.health_position_unavailable",unavailable:"radar.health_unavailable",needs_setup:"radar.health_needs_setup",inconsistent:"radar.health_inconsistent",unknown:"radar.health_unknown"};const Cg=e=>"number"==typeof e&&Number.isFinite(e);class Tg{constructor(e){this.host=e,this.frames=new Map,this.connection=null,this.space="",this.generation=0,this.expiryTimer=0,this.deadlines=new Map}sync(e,t){const i=this.host.hass?.connection;if(!t||!i||!this.host.isConnected)return void this.stop();if(this.unsubscribe&&this.connection===i&&this.space===e)return;this.stop(),this.connection=i,this.space=e;const n=++this.generation,r=i.subscribeMessage?.bind(i);"function"==typeof r&&Promise.resolve(r(e=>{if(n!==this.generation||!this.host.isConnected)return;const t=function(e){if(!e||"object"!=typeof e)return null;const t=e;if("string"!=typeof t.marker_id||"string"!=typeof t.server_session_id||!Number.isSafeInteger(t.seq)||"string"!=typeof t.health)return null;const i=Array.isArray(t.targets)?t.targets.slice(0,256).flatMap(e=>{if(!e||"object"!=typeof e)return[];const t=e;return"string"==typeof t.slot&&Cg(t.x)&&Cg(t.y)&&Cg(t.expires_at)&&Cg(t.reported_at)&&("bounded_latest"===t.pair_quality||"coherent"===t.pair_quality)?[{...t,included:!0===t.included,smooth:!0===t.smooth}]:[]}):[],n=Array.isArray(t.ranges)?t.ranges.slice(0,64).flatMap(e=>{if(!e||"object"!=typeof e)return[];const t=e;if(!("string"==typeof t.id&&Cg(t.x)&&Cg(t.y)&&Cg(t.radius)&&Cg(t.expires_at)&&Cg(t.reported_at)))return[];const i=Array.isArray(t.segments)?t.segments.slice(0,64).flatMap(e=>{if(!Array.isArray(e))return[];const t=e.slice(0,181).flatMap(e=>Array.isArray(e)&&2===e.length&&Cg(e[0])&&Cg(e[1])?[[e[0],e[1]]]:[]);return t.length>=2?[t]:[]}):void 0;return[{...t,...i?{segments:i}:{}}]}):[],r=Array.isArray(t.zones)?t.zones.slice(0,64).flatMap(e=>{if(!e||"object"!=typeof e)return[];const t=e;if("string"!=typeof t.id)return[];const i=t.state;if(null!==i&&"boolean"!=typeof i&&!Cg(i))return[];const n=Array.isArray(t.polygon)?t.polygon.slice(0,64).flatMap(e=>Array.isArray(e)&&2===e.length&&Cg(e[0])&&Cg(e[1])?[[e[0],e[1]]]:[]):[];return[{id:t.id,state:i,...n.length>=3?{polygon:n}:{}}]}):[];return{server_session_id:t.server_session_id,marker_id:t.marker_id,source_generation:"string"==typeof t.source_generation?t.source_generation:void 0,calibration_revision:"string"==typeof t.calibration_revision?t.calibration_revision:void 0,seq:t.seq,reported_at:Cg(t.reported_at)?t.reported_at:void 0,expires_at:Cg(t.expires_at)?t.expires_at:void 0,health:t.health,reported_presence:"boolean"==typeof t.reported_presence?t.reported_presence:null,complete:!0===t.complete,targets:i,ranges:n,zones:r}}(e);if(!t)return;if(!function(e,t){return!e||t.server_session_id!==e.server_session_id||t.source_generation!==e.source_generation||t.calibration_revision!==e.calibration_revision||t.seq>e.seq}(this.frames.get(t.marker_id),t))return;const i=function(e,t=Date.now()){if(!Cg(e.expires_at))return null;if(!Cg(e.reported_at))return Math.max(0,1e3*e.expires_at-t);const i=Math.max(0,1e3*(e.expires_at-e.reported_at)),n=Math.max(0,t-1e3*e.reported_at);return Math.max(0,i-n)}(t);"restricted"===t.health||"disabled"===t.health||0===i?(this.frames.delete(t.marker_id),this.deadlines.delete(t.marker_id)):(this.frames.set(t.marker_id,t),null==i?this.deadlines.delete(t.marker_id):this.deadlines.set(t.marker_id,this.monotonicNow()+i)),this.armExpiry(),this.host.requestUpdate()},{type:"houseplan/radar/subscribe",space_id:e})).then(e=>{n===this.generation&&this.host.isConnected?"function"==typeof e&&(this.unsubscribe=e):"function"==typeof e&&e()}).catch(()=>{n===this.generation&&this.stop()})}stop(){this.generation++,this.unsubscribe?.(),this.unsubscribe=void 0,this.connection=null,this.space="",clearTimeout(this.expiryTimer),this.expiryTimer=0,this.frames.size&&(this.frames.clear(),this.host.isConnected&&this.host.requestUpdate()),this.deadlines.clear()}armExpiry(){clearTimeout(this.expiryTimer);const e=this.monotonicNow(),t=[...this.deadlines.values()].filter(t=>t>e);if(!t.length)return;const i=Math.max(20,Math.min(...t)-e+10);this.expiryTimer=window.setTimeout(()=>{this.expiryTimer=0;let e=!1;const t=this.monotonicNow();for(const[i,n]of this.deadlines)n>t||(this.deadlines.delete(i),this.frames.delete(i),e=!0);this.armExpiry(),e&&this.host.isConnected&&this.host.requestUpdate()},i)}monotonicNow(){return globalThis.performance?.now?.()??Date.now()}}const Dg=Object.freeze({enabled:!1,z2mBaseTopics:Object.freeze([])});function Ag(e){if("string"!=typeof e)return null;const t=e.trim().replace(/^\/+|\/+$/g,"").replace(/\/{2,}/g,"/");return!t||t.length>180||/[#+\u0000-\u001f\u007f]/.test(t)?null:t}function Pg(e){const t=e?.zigbee_topology;if(!t||"object"!=typeof t)return Dg;const i=t,n=Array.isArray(i.z2m_base_topics)?i.z2m_base_topics:Array.isArray(i.z2mBaseTopics)?i.z2mBaseTopics:[],r=new Set,o=[];for(const e of n){const t=Ag(e);if(t&&!r.has(t)&&(r.add(t),o.push(t),8===o.length))break}return{enabled:!0===i.enabled,z2mBaseTopics:o}}function Fg(e,t){const i={...e},n=t.z2mBaseTopics.map(Ag).filter(Boolean);return t.enabled||n.length?i.zigbee_topology={enabled:!0===t.enabled,z2m_base_topics:[...new Set(n)].slice(0,8)}:delete i.zigbee_topology,i}const zg={now:()=>performance.now(),requestFrame:e=>requestAnimationFrame(e),cancelFrame:e=>cancelAnimationFrame(e)},Ig=e=>Math.max(0,Math.min(1,e)),Og=(e,t,i)=>e+(t-e)*i,Eg=(e,t,i)=>{const n=1-e;return 3*n*n*e*t+3*n*e*e*i+e*e*e},Ng=e=>{const t=Ig(e);if(0===t||1===t)return t;let i=0,n=1,r=t;for(let e=0;e<12;e++)r=(i+n)/2,Eg(r,.2,.2)0&&e.w>0?t/e.w:1,viewBox:{...e}}}function Lg(e,t,i){const n=Math.max(1e-9,e.pixelsPerUnit),r=Math.max(1e-9,t/n),o=Math.max(1e-9,i/n);return{x:e.centerX-r/2,y:e.centerY-o/2,w:r,h:o}}function Bg(e){const t=e.trim(),i=/^rgba?\(\s*([\d.]+)[, ]+([\d.]+)[, ]+([\d.]+)(?:\s*[,/]\s*([\d.]+))?\s*\)$/i.exec(t);if(i)return[Number(i[1]),Number(i[2]),Number(i[3]),null==i[4]?1:Number(i[4])];const n=/^#([0-9a-f]{6}|[0-9a-f]{8})$/i.exec(t)?.[1];return n?[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16),8===n.length?parseInt(n.slice(6,8),16)/255:1]:null}function qg(e,t,i){const n=Bg(e),r=Bg(t);if(!n||!r)return i<.5?e:t;const o=Ig(i);return`rgba(${Math.round(Og(n[0],r[0],o))}, ${Math.round(Og(n[1],r[1],o))}, ${Math.round(Og(n[2],r[2],o))}, ${Og(n[3],r[3],o).toFixed(3)})`}class jg{constructor(e,t=zg){this._hooks=e,this._clock=t,this._token=0,this._raf=0,this._state=null}get state(){return this._state}get active(){return"running"===this._state?.phase||"preparing"===this._state?.phase}get presented(){return this._state?.presented||null}start(e,t,i,n=220){this.cancel(!1);const r=++this._token,o=this._clock.now();if(this._state={token:r,phase:n<=0?"settling":"running",from:e,to:t,presented:n<=0?t:e,startedAt:o,duration:Math.max(0,n),targetMode:i},n<=0)return this._hooks.frame(this._state),this._hooks.settled(this._state),this._state=null,r;this._hooks.frame(this._state);const s=e=>{const t=this._state;if(!t||t.token!==r)return;const i=Ig((e-t.startedAt)/t.duration);t.presented=i>=1?t.to:function(e,t,i){const n=Ng(i),r=Og(e.stageWidth,t.stageWidth,n),o=Og(e.stageHeight,t.stageHeight,n),s=Math.max(1e-9,e.viewport.pixelsPerUnit),a=Math.max(1e-9,t.viewport.pixelsPerUnit),l={centerX:Og(e.viewport.centerX,t.viewport.centerX,n),centerY:Og(e.viewport.centerY,t.viewport.centerY,n),pixelsPerUnit:Math.exp(Og(Math.log(s),Math.log(a),n))};return{presentedMode:n<.5?e.presentedMode:t.presentedMode,editorChromeHeight:Og(e.editorChromeHeight,t.editorChromeHeight,n),stageWidth:r,stageHeight:o,viewport:{...l,viewBox:Lg(l,r,o)},stageColor:qg(e.stageColor,t.stageColor,n),paperColor:qg(e.paperColor,t.paperColor,n),sceneBrightness:Og(e.sceneBrightness,t.sceneBrightness,n),architectureOpacity:Og(e.architectureOpacity,t.architectureOpacity,n),backdropOpacity:Og(e.backdropOpacity,t.backdropOpacity,n),viewWeight:Og(e.viewWeight,t.viewWeight,n),editorWeight:Og(e.editorWeight,t.editorWeight,n),toolbarContentOpacity:Og(e.toolbarContentOpacity,t.toolbarContentOpacity,n)}}(t.from,t.to,i),t.phase=i>=1?"settling":"running",this._hooks.frame(t),i<1?this._raf=this._clock.requestFrame(s):(this._raf=0,this._hooks.settled(t),this._state?.token===r&&(this._state=null))};return this._raf=this._clock.requestFrame(s),r}cancel(e=!0){this._raf&&this._clock.cancelFrame(this._raf),this._raf=0;const t=this._state;this._state=null,this._token++,t&&e&&(t.phase="settling",t.presented=t.to,this._hooks.frame(t),this._hooks.settled(t))}dispose(){this.cancel(!1)}}const Wg={now:()=>"undefined"!=typeof performance?performance.now():Date.now(),requestFrame:e=>"function"==typeof requestAnimationFrame?requestAnimationFrame(e):null,cancelFrame:e=>{"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(e)}},Ug=e=>Number.isFinite(e);function Gg(e){return!!e&&Ug(e.zoom)&&e.zoom>0&&Ug(e.viewBox.x)&&Ug(e.viewBox.y)&&Ug(e.viewBox.w)&&e.viewBox.w>0&&Ug(e.viewBox.h)&&e.viewBox.h>0}function Vg(e){return{zoom:e.zoom,viewBox:{...e.viewBox}}}function Kg(e,t){return Math.abs(e.zoom-t.zoom)<1e-9&&Math.abs(e.viewBox.x-t.viewBox.x)<1e-6&&Math.abs(e.viewBox.y-t.viewBox.y)<1e-6&&Math.abs(e.viewBox.w-t.viewBox.w)<1e-6&&Math.abs(e.viewBox.h-t.viewBox.h)<1e-6}const Yg=(e,t,i)=>e+(t-e)*i,Xg=(e,t,i)=>Math.exp(Yg(Math.log(e),Math.log(t),i));class Zg{constructor(e,t=Wg){this._hooks=e,this._clock=t,this._token=0,this._raf=null,this._state=null}get state(){return this._state}get active(){return"running"===this._state?.phase}get presented(){return this._state?.presented||null}get target(){return this._state?.to||null}start(e,t,i,n){this.cancel(!1);const r=++this._token,o=Vg(e),s=Vg(t),a=n>0&&Gg(o)&&Gg(s),l=this._clock.now(),c={token:r,phase:a?"running":"settling",from:o,to:s,presented:Vg(a?o:s),startedAt:l,duration:a?n:0,reason:i};if(this._state=c,this._hooks.frame(c),!a)return this._settle(r),r;const h=e=>{const t=this._state;if(!t||t.token!==r)return;const i=Math.max(0,Math.min(1,(e-t.startedAt)/t.duration));if(t.presented=i>=1?Vg(t.to):function(e,t,i){if(!Gg(e))return Vg(t);if(!Gg(t))return Vg(e);const n=Ng(i);if(n<=0)return Vg(e);if(n>=1)return Vg(t);const r=e.viewBox.x+e.viewBox.w/2,o=e.viewBox.y+e.viewBox.h/2,s=t.viewBox.x+t.viewBox.w/2,a=t.viewBox.y+t.viewBox.h/2,l=Xg(e.viewBox.w,t.viewBox.w,n),c=Xg(e.viewBox.h,t.viewBox.h,n),h=Yg(r,s,n),d=Yg(o,a,n);return{zoom:Xg(e.zoom,t.zoom,n),viewBox:{x:h-l/2,y:d-c/2,w:l,h:c}}}(t.from,t.to,i),t.phase=i>=1?"settling":"running",this._hooks.frame(t),i>=1)return this._raf=null,void this._settle(r);this._raf=this._clock.requestFrame(h),null===this._raf&&this._settle(r)};return this._raf=this._clock.requestFrame(h),null===this._raf&&(c.phase="settling",c.presented=Vg(s),this._hooks.frame(c),this._settle(r)),r}cancel(e=!0){null!==this._raf&&this._clock.cancelFrame(this._raf),this._raf=null;const t=this._state;this._state=null,this._token++,t&&e&&(t.phase="settling",t.presented=Vg(t.to),this._hooks.frame(t),this._hooks.settled(t))}dispose(){this.cancel(!1)}_settle(e){const t=this._state;t&&t.token===e&&(t.phase="settling",t.presented=Vg(t.to),this._hooks.settled(t),this._state?.token===e&&(this._state=null))}}function Jg(e,t,i){const n=e.querySelector("ha-card");if(!n)return null;const r=n.getBoundingClientRect(),o=t.getBoundingClientRect().top-r.top,s=i?0:Math.min(Math.max(r.top,0),120),a=Math.round(o+s);return a>=0?a:null}const Qg=Object.freeze({rotDeg:4,tiltDeg:20,xyScale:1,zScale:1,origin:Object.freeze([500,500])}),ef=64,tf=10,nf=4,rf=68;function of(e){return[e.rotDeg,e.tiltDeg,e.xyScale,e.zScale,e.origin[0],e.origin[1]].every(Number.isFinite)&&Math.abs(e.xyScale)>1e-12&&Math.abs(Math.cos(e.tiltDeg*Math.PI/180))>1e-12}function sf(e,t,i=Qg){if(!Number.isFinite(e[0])||!Number.isFinite(e[1]))throw new Error("invalid isometric projection input");return function(e,t){if(!Number.isFinite(e[0])||!Number.isFinite(e[1])||!t.every(Number.isFinite))throw new Error("invalid isometric affine input");const[i,n,r,o,s,a]=t;return[i*e[0]+r*e[1]+s,n*e[0]+o*e[1]+a]}(e,lf(t,i))}function af(e,t=Qg){if(!of(t)||!Number.isFinite(e[0])||!Number.isFinite(e[1]))throw new Error("invalid isometric projection input");const i=t.rotDeg*Math.PI/180,n=t.tiltDeg*Math.PI/180,r=(e[0]-t.origin[0])/t.xyScale,o=(e[1]-t.origin[1])/(t.xyScale*Math.cos(n));return[t.origin[0]+r*Math.cos(i)+o*Math.sin(i),t.origin[1]-r*Math.sin(i)+o*Math.cos(i)]}function lf(e=0,t=Qg){if(!of(t)||!Number.isFinite(e))throw new Error("invalid isometric camera");const i=t.rotDeg*Math.PI/180,n=t.tiltDeg*Math.PI/180,r=t.xyScale*Math.cos(i),o=-t.xyScale*Math.sin(i),s=t.xyScale*Math.sin(i)*Math.cos(n),a=t.xyScale*Math.cos(i)*Math.cos(n);return[r,s,o,a,t.origin[0]-r*t.origin[0]-o*t.origin[1],t.origin[1]-s*t.origin[0]-a*t.origin[1]-e*t.zScale*Math.sin(n)]}function cf(e=Qg){return function(e=0,t=Qg){return`matrix(${lf(e,t).map(e=>Number(e.toFixed(12))).join(" ")})`}(0,e)}function hf(e,t=Qg){const{rect:i,wallHeight:n}=e,r=e.openingHeight??n,o=e.floorDepth??0,s=e.raisedHeight??n;if(!(i.w>=0)||!(i.h>=0)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(s)||n<0||r<0||o<0||s<0)throw new Error("invalid isometric frame");const a=[[i.x,i.y],[i.x+i.w,i.y],[i.x+i.w,i.y+i.h],[i.x,i.y+i.h]],l=Math.max(n,r,s),c=a.flatMap(e=>[sf(e,-o,t),sf(e,l,t)]),h=c.map(e=>e[0]),d=c.map(e=>e[1]),u=Math.min(...h),p=Math.min(...d);return{x:u,y:p,w:Math.max(...h)-u,h:Math.max(...d)-p}}const df=[".dev",".vacpuck",".oplock",".op-hit",".opening",".rlgo","a","button","input","select","textarea",'[contenteditable]:not([contenteditable="false"])',"[data-room-fit-block]",'[role="link"]','[role="button"]'].join(","),uf=(e,t)=>{try{return"function"==typeof e?.matches&&e.matches(t)}catch{return!1}};function pf(e){for(const t of e){const e=t;if(uf(e,".roomlabel[data-id]")){const t=e.getAttribute?.("data-id");return t?{kind:"room",roomId:t}:{kind:"interactive"}}if(uf(e,df))return{kind:"interactive"};if(uf(e,'[data-hp="room"][data-id]')){const t=e.getAttribute?.("data-id");return t?{kind:"room",roomId:t}:{kind:"interactive"}}if(uf(e,".stage"))return{kind:"background"}}return{kind:"outside"}}function _f(e){const t=pf(e);return"room"===t.kind?t.roomId:null}class mf{constructor(){this.pointer=null,this.sequence=null}clear(){this.pointer=null,this.sequence=null}clearOutside(e){let t={kind:"outside"};try{t=pf(e.composedPath())}catch{}"outside"===t.kind&&this.clear()}pointerDown(e,t,i){let n={kind:"outside"};try{n=pf(e.composedPath())}catch{}this.pointer=function(e){const t="mouse"===(i=e.pointerType)||"touch"===i||"pen"===i?i:null;var i;return t&&"view"===e.mode&&"background"===e.owner.kind&&!e.blocked&&e.isPrimary&&0===e.button&&Number.isFinite(e.x)&&Number.isFinite(e.y)?{pointerId:e.pointerId,spaceId:e.spaceId,modality:t,x:e.x,y:e.y}:null}({pointerId:e.pointerId,pointerType:e.pointerType,isPrimary:e.isPrimary,button:e.button,spaceId:t,mode:i?"view":"blocked",owner:n,blocked:!i,x:e.clientX,y:e.clientY}),this.pointer||(this.sequence=null)}pointerUp(e,t,i,n,r=Date.now()){let o={kind:"outside"};try{o=pf(e.composedPath())}catch{}const s=function(e,t,i){if(!t||"view"!==i.mode||"background"!==i.owner.kind||i.blocked||t.pointerId!==i.pointerId||t.spaceId!==i.spaceId||!Number.isFinite(i.x)||!Number.isFinite(i.y)||!Number.isFinite(i.now)||Math.abs(i.x-t.x)+Math.abs(i.y-t.y)>=8)return{sequence:null,trigger:!1};const n=e?i.now-e.at:Number.POSITIVE_INFINITY;return e&&e.spaceId===i.spaceId&&e.modality===t.modality&&n>=0&&n<=350?{sequence:null,trigger:!0}:{sequence:{at:i.now,spaceId:i.spaceId,modality:t.modality},trigger:!1}}(this.sequence,this.pointer,{pointerId:e.pointerId,spaceId:t,mode:i?"view":"blocked",owner:o,blocked:n||!i,x:e.clientX,y:e.clientY,now:r});return this.pointer=null,this.sequence=s.sequence,s.trigger}}const gf=e=>e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1]);function ff(e){return!!e&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.w)&&e.w>0&&Number.isFinite(e.h)&&e.h>0}function vf(e,t=0){if(!e.length||!Number.isFinite(t)||t<0||!e.every(gf))return null;let i=1/0,n=1/0,r=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t[0]),n=Math.min(n,t[1]),r=Math.max(r,t[0]),o=Math.max(o,t[1]);const s=r-i,a=o-n;return s>0&&a>0?{x:i-t,y:n-t,w:s+2*t,h:a+2*t}:null}function yf(e,t,i){const n="string"!=typeof t||"invalid"!==t&&"no-borders"!==t&&"unverified"!==t&&!/^[a-z0-9]{1,8}$/i.test(t)?"redacted":t;return Object.freeze({kind:e,fingerprint:n,terminal:!!i})}function bf(e,t){return`${e("editor.load_failed")} ${e(t.terminal?"editor.refresh_advice":"editor.retry_advice")}`}class wf extends Error{}class kf{constructor(e){this.options=e,this._state="idle",this._inFlight=null}get state(){return this._state}ensure(){return"ready"===this._state?Promise.resolve(!0):"failed"===this._state?Promise.resolve(!1):(this._inFlight||(this._setState("loading"),this._inFlight=this._loadWithRetry().finally(()=>{this._inFlight=null})),this._inFlight)}async _loadWithRetry(){let e=new Error("Editor runtime did not load"),t=!1;for(const i of[0,1])try{const e=await this.options.load(i);if(e.fingerprint!==this.options.expectedFingerprint)throw new wf(`Editor runtime fingerprint mismatch: expected ${this.options.expectedFingerprint}, got ${e.fingerprint}`);const t=e.create();return this.options.install(t),this._setState("ready"),!0}catch(i){e=i,i instanceof wf&&(t=!0)}return this._setState(t?"failed":"idle"),this.options.failed?.(e,{terminal:t}),!1}_setState(e){e!==this._state&&(this._state=e,this.options.stateChanged?.(e))}}const xf=(e,t)=>{if(!e.has(t))return{hit:!1};const i=e.get(t);return e.delete(t),e.set(t,i),{hit:!0,value:i}},Sf=(e,t,i,n)=>{for(e.delete(t),e.set(t,i);e.size>n;){const t=e.keys().next().value;if(void 0===t)break;e.delete(t)}},$f=new Set(["select","draw","column","merge","split","resize","opening","wallthick","delroom"]),Mf=e=>`${window.innerWidth}x${window.innerHeight}|${location.pathname}|${JSON.stringify(e??{})}`,Rf="houseplan_card_alpha_v1",Cf=Object.freeze([Object.freeze({id:"iso",issue:89,summary:"Volumetric plan renderer"})]);function Tf(e){return/^[a-z][a-z0-9-]*$/.test(e.id)&&Number.isInteger(e.issue)&&e.issue>0&&!!e.summary.trim()}function Df(e){const t=String(e||"").replace(/^#/,"");return new URLSearchParams(t)}function Af(e){return Df(e).get("space")||""}function Pf(e,t,i=Cf){const n=function(e){const t=new Set;for(const i of e){if(!Tf(i)||t.has(i.id))return!1;t.add(i.id)}return!0}(i),r=function(e){let t,i=!1;const n=e=>{for(const n of e.getAll("hp_alpha"))i=!0,"1"===n?t=!0:"0"===n&&(t=!1)};return n(new URLSearchParams(String(e.search||"").replace(/^\?/,""))),n(Df(e.hash)),{present:i,value:t}}(e),o=void 0!==r.value,s="1"===t,a=o?!0===r.value:!r.present&&s,l=n&&a;return{alpha:l,active:Object.freeze(l?i.map(e=>e.id).sort():[]),space:Af(e.hash),persist:n&&o?l?"1":"0":void 0,knownUrlOperation:o}}let Ff={alpha:!1,active:Object.freeze([]),space:""},zf=!1,If="";const Of=new Set;function Ef(){if("undefined"==typeof window)return Ff;const e=Pf(window.location,function(){try{return window.localStorage.getItem(Rf)}catch{return null}}());void 0!==e.persist&&function(e){try{window.localStorage.setItem(Rf,e)}catch{}}(e.persist),Ff={alpha:e.alpha,active:e.active,space:e.space},window.__hpAlpha=e.alpha,window.__hpLabs=e.active;for(const e of Of)e(Ff);return Ff}function Nf(){Ef()}function Hf(){if("undefined"==typeof window)return Ff;if(!zf){zf=!0,window.__hpLabsListenerCleanup?.(),window.addEventListener("hashchange",Nf),window.addEventListener("popstate",Nf);const e=()=>{window.removeEventListener("hashchange",Nf),window.removeEventListener("popstate",Nf),window.__hpLabsListenerCleanup===e&&delete window.__hpLabsListenerCleanup};window.__hpLabsListenerCleanup=e}return Ef()}const Lf={window:120,door:90,passage:90,gate:300};function Bf(e){return Lf[e]}function qf(e,t){return{type:e,lengthCm:Bf(e),flipH:!1,flipV:!1,revision:t}}function jf(e,t){const i=Math.max(0,e.renderedLength)/2,n=Math.max(0,e.target.physicalHalfWidth),r=n+.18*Math.max(0,t),o=e=>({x1:e,y1:-r,x2:e,y2:r});return{rect:{x:-i,y:n?-n:0,width:2*i,height:2*n},boundaries:[o(-i),o(i)]}}function Wf(e,t){const i=[e[0],e[1]],n=[t[0],t[1]];return function(e,t){return e[0]-t[0]||e[1]-t[1]}(i,n)<=0?{a:i,b:n}:{a:n,b:i}}function Uf(e){const t=new Map;return e.forEach((e,i)=>{if(!e.kind||e.open)return;const n=Wf(e.a,e.b);if(Math.hypot(n.b[0]-n.a[0],n.b[1]-n.a[1])<=1e-9)return;const r=function(e,t){const i=e=>(Math.abs(e)<=5e-10?0:Math.round(1e6*e)/1e6).toFixed(6);return`${i(e[0])},${i(e[1])}>${i(t[0])},${i(t[1])}`}(n.a,n.b),o=t.get(r);if(o)return o.physicalHalfWidth=Math.max(o.physicalHalfWidth,e.half||0),o.sourceOrder=Math.min(o.sourceOrder,i),void(e.partitionHost&&(o.partitionHost&&o.partitionHost.id!==e.partitionHost.id?o.ambiguousPartitionHost=!0:o.partitionHost=e.partitionHost));t.set(r,{segmentKey:r,a:n.a,b:n.b,physicalHalfWidth:Math.max(0,e.half||0),sourceOrder:i,...e.partitionHost?{partitionHost:e.partitionHost}:{}})}),[...t.values()]}function Gf(e,t){if(Math.abs(e.distance-t.distance)>1e-9)return e.distance-t.distance;if(Math.abs(e.perpendicular-t.perpendicular)>1e-9)return e.perpendicular-t.perpendicular;return(e.target.segmentKeyt.target.segmentKey?1:0)||e.target.sourceOrder-t.target.sourceOrder}function Vf(e){const t=Uf(e.intervals).map(t=>{const i=function(e,t){const i=t.b[0]-t.a[0],n=t.b[1]-t.a[1],r=Math.hypot(i,n),o=i/r,s=n/r,a=(e[0]-t.a[0])*o+(e[1]-t.a[1])*s,l=Math.max(0,Math.min(r,a)),c=t.a[0]+l*o,h=t.a[1]+l*s;return{along:l,length:r,x:c,y:h,distance:Math.hypot(e[0]-c,e[1]-h),perpendicular:Math.abs((e[0]-t.a[0])*s-(e[1]-t.a[1])*o)}}(e.pointer,t);return{target:t,...i,envelope:Math.max(e.baseTolerance,t.physicalHalfWidth+e.bodyPointerPadding)}}).filter(e=>e.distance<=e.envelope+1e-9).filter(t=>!function(e,t,i,n,r){const o=t.b[0]-t.a[0],s=t.b[1]-t.a[1],a=Math.hypot(o,s);if(!(a>1e-9))return!1;const l=o/a,c=s/a;for(const o of i){if(!o.open&&o.kind)continue;const i=Wf(o.a,o.b),s=i.b[0]-i.a[0],a=i.b[1]-i.a[1],h=Math.hypot(s,a);if(!(h>1e-9))continue;const d=s/h,u=a/h;if(Math.abs(l*u-c*d)>1e-6)continue;if(Math.abs((i.a[0]-t.a[0])*c-(i.a[1]-t.a[1])*l)>r)continue;const p=(e[0]-i.a[0])*d+(e[1]-i.a[1])*u,_=1e-9;if(!(p<=_||p>=h-_)&&Math.abs((e[0]-i.a[0])*u-(e[1]-i.a[1])*d)<=n+1e-9)return!0}return!1}(e.pointer,t.target,e.intervals,t.envelope,Math.max(1e-9,Math.min(e.baseTolerance,.04*e.gridStep)))),i=t.filter(t=>!!t.target.partitionHost&&e.renderedLength+2*t.target.physicalHalfWidth>t.length+1e-9).sort(Gf),n=t.filter(t=>!t.target.partitionHost||e.renderedLength+2*t.target.physicalHalfWidth<=t.length+1e-9).sort(Gf);let r=n[0];if(!r)return{candidate:null,jambBlockedTarget:i[0]?.target||null};const o=n.filter(e=>Math.abs(e.distance-r.distance)<=1e-9&&Math.abs(e.perpendicular-r.perpendicular)<=1e-9),s=o.filter(e=>e.target.partitionHost);if(s.length){if(1!==new Set(s.map(e=>e.target.partitionHost.id)).size||s.some(e=>e.target.ambiguousPartitionHost))return{candidate:null,jambBlockedTarget:null};const e=s[0],t=e.target.b[0]-e.target.a[0],i=e.target.b[1]-e.target.a[1],n=Math.hypot(t,i),a=t/n,l=i/n;if(!o.every(t=>{const i=t.target.b[0]-t.target.a[0],n=t.target.b[1]-t.target.a[1],r=Math.hypot(i,n),o=i/r,s=n/r,c=Math.abs(a*s-l*o)<=1e-6,h=Math.abs((t.target.a[0]-e.target.a[0])*l-(t.target.a[1]-e.target.a[1])*a);return c&&h<=1e-9}))return{candidate:null,jambBlockedTarget:null};r=e}if(r.target.ambiguousPartitionHost)return{candidate:null,jambBlockedTarget:null};const{target:a,length:l}=r,c=a.b[0]-a.a[0],h=a.b[1]-a.a[1],d=c/l,u=h/l,p=a.partitionHost?a.physicalHalfWidth:0,_=Math.min(Math.max(0,e.renderedLength)/2+p,l/2);let m=r.along;const g=Math.max(e.gridStep,1e-9),f=l/2;m=Math.abs(m-f)<=g/2?f:Math.round(m/g)*g,m=Math.max(_,Math.min(l-_,m));const v=a.a[0]+d*m,y=a.a[1]+u*m,b=Math.max(0,e.renderedLength)/2,w=m-b,k=m+b,x=Math.max(0,w),S=Math.max(0,l-k),$=[a.a[0]+d*(w-x/2),a.a[1]+u*(w-x/2)],M=[a.a[0]+d*(k+S/2),a.a[1]+u*(k+S/2)];let R=180*Math.atan2(h,c)/Math.PI;R>=90?R-=180:R<-90&&(R+=180);const C=Math.abs(m-f)<=1e-9;return{candidate:{presetRevision:e.preset.revision,geometryRevision:e.geometryRevision,pointer:[e.pointer[0],e.pointer[1]],type:e.preset.type,lengthCm:e.preset.lengthCm,flipH:e.preset.flipH,flipV:e.preset.flipV,x:v,y:y,angle:R,renderedLength:e.renderedLength,target:a,...a.partitionHost?{host:{...a.partitionHost,t:l>0?m/l:0}}:{},measure:{labels:[{distance:x,midpoint:$},{distance:S,midpoint:M}],guide:C?{x:v,y:y,angle:R}:null}},jambBlockedTarget:null}}function Kf(e,t,i,n,r=1e-6){return e.presetRevision===i&&e.geometryRevision===n&&Math.hypot(e.pointer[0]-t[0],e.pointer[1]-t[1])<=r}function Yf(e){return!(!e.canEdit||e.kiosk||e.fixedFloor)&&("view"!==e.mode&&("mouse"===e.pointerType&&e.spaceCount>1))}class Xf{constructor(e,t,i){this.loader=e,this.host=t,this.adopted=i,this.attachment=null}connect(){if(this.runtime)return void this.runtime.connect();this.attachment?.cancel();const e=this.loader.attach(this.host,e=>this.adopt(e));this.runtime||(this.attachment=e)}disconnect(){this.attachment?.cancel(),this.attachment=null,this.runtime?.disconnect()}adopt(e){this.attachment=null,this.runtime||(this.runtime=e,this.adopted(e))}}const Zf=new class{constructor(e){this.load=e,this.factory=null,this.pending=null}get warm(){return null!==this.factory}create(e){return this.factory?this.factory(e):null}attach(e,t){let i=!0;const n={cancel:()=>{i=!1}},r=this.create(e);return r?(t(r),n):(this.ensure().then(n=>{i&&t(n(e))},()=>{}),n)}ensure(){return this.factory?Promise.resolve(this.factory):(this.pending||(this.pending=this.load().then(e=>(this.factory=e,this.pending=null,e),e=>{throw this.pending=null,e})),this.pending)}reset(){this.factory=null,this.pending=null}}(()=>import("./summary-panel-runtime-loaded-ospbRm0g.js").then(function(e){return e.e}).then(({LoadedSummaryPanelRuntime:e})=>t=>new e(t)));function Jf(e){const t=globalThis.__HP_VERSION_OVERRIDE__;return"string"==typeof t&&t.length>0?t:e}let Qf=0;const ev="1.76.0-beta.2",tv="74cbeb9792716ab64cfbcf339d3044c6e8ae33533bdef7216a6d7d513ae04091",iv=1500,nv=new Map;let rv=0,ov=1e4;const sv="houseplan_card_layout_v1",av="houseplan_card_cfg_v1",lv="houseplan_card_zoom_v1",cv="houseplan_card_nav_v1",hv="houseplan_card_view_v1",dv="hp-dialog, hp-help, hp-color-opacity, hp-device-preview",uv=1e3,pv=(e,t)=>{const i=Math.min(e.x,t.x),n=Math.min(e.y,t.y);return{x:i,y:n,w:Math.max(e.x+e.w,t.x+t.w)-i,h:Math.max(e.y+e.h,t.y+t.h)-n}},_v=(e,t,i)=>{const n=new Event(t,{bubbles:!0,composed:!0});n.detail=i??{},e.dispatchEvent(n)},mv=e=>{history.pushState(null,"",e),_v(window,"location-changed",{replace:!1})},gv=(e,t)=>{let i,n=null;const r=(...r)=>{clearTimeout(i),n=r,i=window.setTimeout(()=>{i=void 0;const t=n;n=null,t&&e(...t)},t)};return r.flush=()=>{if(void 0===i)return;clearTimeout(i),i=void 0;const t=n;n=null,t&&e(...t)},r.cancel=()=>{clearTimeout(i),i=void 0,n=null},r.pending=()=>void 0!==i,r},fv=e=>{try{e.target?.setPointerCapture?.(e.pointerId)}catch{}},vv=["edges","corners"];class yv extends he{constructor(){var e;super(...arguments),this._editorRuntime=null,this._liveRt=null,this._onboardingRuntime=null,this._editorRuntimeLoadingVisible=!1,this._backdropGuard=null,this._editorModeRequest=0,this._warmModeRequest=0,this._editorRuntimeLoader=new kf({expectedFingerprint:tv,load:async e=>{const t=0===e?await import("./houseplan-editor-runtime-BjAw4ds1.js"):await import((()=>{const e=new URL("./houseplan-editor-runtime-BjAw4ds1.js",import.meta.url);return e.searchParams.set("hp_retry",`${ev}-${++Qf}`),e.href})());return{fingerprint:t.EDITOR_RUNTIME_FINGERPRINT,create:()=>new t.HouseplanEditorRuntime(this)}},install:e=>{this._editorRuntime=e},stateChanged:e=>this._editorRuntimeStateChanged(e),failed:(e,t)=>{console.error("[houseplan] unable to load editor runtime",e),t.terminal&&this._versionRecovery.hasCurrentMismatchNotice||this._showToast(bf(e=>this._t(e),t))}}),this._onboardingRuntimeLoader=new kf({expectedFingerprint:tv,load:async e=>{const t=0===e?await import("./houseplan-onboarding-runtime-BtzaN0OP.js"):await import((()=>{const e=new URL("./houseplan-onboarding-runtime-BtzaN0OP.js",import.meta.url);return e.searchParams.set("hp_retry",`${ev}-${++Qf}`),e.href})());return{fingerprint:t.ONBOARDING_RUNTIME_FINGERPRINT,create:()=>new t.HouseplanOnboardingRuntime(this)}},install:e=>{this._onboardingRuntime=e},failed:(e,t)=>{console.error("[houseplan] unable to load onboarding runtime",e),t.terminal&&this._versionRecovery.hasCurrentMismatchNotice||this._showToast(bf(e=>this._t(e),t))}}),this._isoSceneRuntime=null,this._isoSceneRuntimeLoader=new kf({expectedFingerprint:tv,load:async e=>{const t=0===e?await import("./iso-scene-render-ByC7EDVa.js"):await import((()=>{const e=new URL("./iso-scene-render-ByC7EDVa.js",import.meta.url);return e.searchParams.set("hp_retry",`${ev}-${++Qf}`),e.href})());return{fingerprint:t.ISO_SCENE_RUNTIME_FINGERPRINT,create:()=>t}},install:e=>{const t=this._effectiveProjection();this._isoSceneRuntime=e,this._isoProjectionSnapshot=null;const i=this._effectiveProjection();this._convertProjectionView(t,i),this.isConnected&&this.requestUpdate()},failed:(e,t)=>{console.warn("[houseplan] hidden isometric runtime diagnostic",yf("runtime-load","unverified",t.terminal)),this.isConnected&&this.requestUpdate()}}),this._pdfRuntime=null,this._pdfRuntimeLoader=new kf({expectedFingerprint:tv,load:async e=>{const t=0===e?await import("./pdf-export-DtC_EPb5.js"):await import((()=>{const e=new URL("./pdf-export-DtC_EPb5.js",import.meta.url);return e.searchParams.set("hp_retry",`${ev}-${++Qf}`),e.href})());return{fingerprint:t.PDF_EXPORT_FINGERPRINT,create:()=>new t.PdfExportRuntime}},install:e=>{this._pdfRuntime=e,this.isConnected&&this.requestUpdate()},failed:(e,t)=>{if(console.error("[houseplan] unable to load PDF export runtime",e),!t.terminal||!this._versionRecovery.hasCurrentMismatchNotice){const e=bf(e=>this._t(e),t),i=this._t("editor.load_failed"),n=e.startsWith(i)?e.slice(i.length).trim():e;this._showToast(`${this._t("pdf.failed")} ${n}`.trim())}}}),this.panelHost=!1,this.narrow=null,this._space="f1",this._adoption=new Lu((e,t)=>this.requestUpdate(e,t)),this._serverStorage=!1,this._loadOk=!1,this._serverCanWrite=null,this._loading=!1,this._loadTries=0,this._unsubCfg=null,this._unsubLayout=null,this._unsubVirtual=null,this._liveSyncAttempt=null,this._liveSyncGeneration=0,this._liveSyncConnection=null,this._configReloadAuthority=new Wu,this._virtualLights=Eh(null),this._canOptimizeUndo=!1,this._undoKind=null,this._devices=[],this._regSignature="",this._defPos={},this._newSyncKey="",this._areaRelocationIds=new Set,this._areaSnapshotCleanupCandidates=new Map,this._areaRelocationSyncKey="",this._areaRelocationWrite=Promise.resolve(),this._tip=null,this._hoverRoom=null,this._pointerModality=new rg(this,()=>this._syncPointerHoverTargets()),this._devicePressAnimations=new Map,this._selId=null,this._toast="",this._mode="view",this._pendingNavMode=null,this._decorTool="select",this._decorStyle={...xr},this._decorStyleSeeded=!1,this._decorDraft=null,this._decorMove=null,this._decorSel=null,this._decorEraseConfirm=null,this._decorTextDialog=null,this._decorShapeDialog=null,this._backdropDialog=null,this._decorTextSelection={start:0,end:0},this._furnPalette=null,this._decorImagePalette=null,this._decorAssetCatalog=[],this._decorAssets=new Map,this._decorAssetBusy=!1,this._furnCategory=null,this._furnPreviewInput=null,this._furnTouchPending=null,this._dtBox=null,this._dtDrag=null,this._bdDrag=null,this._slide="",this._reducedMotion=!1,this._onMotionChange=e=>{this._reducedMotion=e.matches,this._cancelDevicePressFeedback(),e.matches&&this._cancelCameraTransition(!0),e.matches&&this._modeTransitionPreparing?this._modeTransitionForceAtomic=!0:e.matches&&this._modeTransition.active&&this._cancelModeTransition(!0),this._syncVersionRecovery(),this.requestUpdate()},this._editorChromeMode="plan",this._modeTransitionVisual=null,this._modeTransitionPreparing=!1,this._modeTransitionForceAtomic=!1,this._modeTransitionRequest=0,this._modeTransitionTargetZoom=1,this._modeTransitionEditorCamera=null,this._modeTransition=new jg({frame:e=>this._applyModeTransitionFrame(e),settled:e=>this._settleModeTransition(e)}),this._cameraTransitionFit=null,this._cameraTransition=new Zg({frame:e=>this._applyCameraTransitionFrame(e),settled:e=>this._settleCameraTransition(e)}),this._editorSecondaryCopy={groupActive:(e,t)=>this._t("editor.group_active",{group:e,item:t}),openGroup:e=>this._t("editor.open_group",{group:e}),disabledAction:(e,t)=>this._t("editor.disabled_action",{action:e,reason:t})},this._tool="draw",this._geometryHistory=new _g(50),this._devicePositionHistory=new _g(50),this._devicePositionBusy=!1,this._wallDialog=null,this._drawWallField=null,this._activeWallChainId=null,this._activeWallChainPartitionIds=[],this._wallChainRedo=[],this._physicalSel=null,this._physicalDialog=null,this._partitionDeleteDialog=null,this._roomDeleteDialog=null,this._physicalDrag=null,this._physicalRotate=null,this._physicalLastTap=null,this._physicalPickCycle=null,this._wallUnionCacheValue=null,this._wallUnionPool=new Map,this._isoGeometryCache=new Map,this._renderIsoScene=null,this._isoProjectionSnapshot=null,this._isoStructuralBuildCount=0,this._isoFallback=new Set,this._openingTunnelCache=null,this._openingWallIndexCache=new Map,this._openingPlacementIntervalsCache=null,this._openingDimensionContextCache=null,this._planSnapGeometryCache=null,this._planStructuralGeometryCache=null,this._hiddenWallDiagnosticCache=null,this._physicalBodiesCache=null,this._lightPhysicalBodiesCache=null,this._cleanFloorCache=new Map,this._innerContourCache=new Map,this._glowRuntimeState=vm(),this._glowRuntimeHost={window:()=>this.ownerDocument.defaultView||window,isConnected:()=>this.isConnected,requestUpdate:()=>this.requestUpdate(),reducedMotion:()=>this._reducedMotion},this._lightBarrierCache=null,this._lightBarrierPool=new Map,this._glowScreenBlend=!1,this._duplicateColumnId=null,this._duplicateColumnTimer=0,this._rszLimitViolation=null,this._path=[],this._cursorPt=null,this._planSnapHover=null,this._mergeSel=null,this._openingPreset=null,this._openingRebindId=null,this._openingPresetRevision=0,this._openingHoverCandidate=null,this._openingJambBlockCm=null,this._openingDialog=null,this._openingInfo=null,this._opDrag=null,this._opMeasure=null,this._mergeDialog=null,this._splitSel=null,this._pendingSplit=null,this._wallFaceBatch=null,this._wallRepairDiagnostic=null,this._wallFaceGraphCache=[],this._areaSel="",this._nameSel="",this._roomDialog=!1,this._roomEditId=null,this._roomFill="",this._roomCustomFill=null,this._roomTempMin="",this._roomTempMax="",this._roomTempSrc="",this._roomHumSrc="",this._roomSrcOpen=null,this._roomSrcFilter="",this._roomNameScale=1,this._roomLabelScale=1,this._zoom=1,this._view=null,this._zoomBySpace={},this._viewModeSnap=null,this._roomFocus=null,this._roomPointer=null,this._doubleFit=new mf,this._deviceHits=new yc,this._pointers=new Map,this._panStart=null,this._panLock=null,this._pinchStart=null,this._suppressClick=!1,this._viewportGestureDirty=!1,this._touchContacts=new Map,this._touchClickGuard=new dc,this._connectedPath="",this._routeDepartureHandled=!1,this._onLocationChanged=()=>{this._connectedPath&&location.pathname!==this._connectedPath?this._leaveCardRoute():location.pathname===this._connectedPath&&(this._routeDepartureHandled=!1)},this._touchGestureGuard={capture:!0,handleEvent:e=>this._guardTouchGesture(e)},this._hdrH=118,this._booting=!0,this._bootFading=!1,this._bootSettling=!1,this._bootSettleRaf=0,this._bootLastH=-1,this._bootStart=0,this._bootLastChange=0,this._bootSoft=!1,this._tapConfirm=null,this._dangerConfirm=null,this._dangerConfirmController=new ze(e=>{this._dangerConfirm=e}),this._confirmDanger=e=>this._config&&this.hass?"warm"===this._syncDangerConfirmLocaleGate()||this._dangerConfirmMissingSpace()?Promise.resolve(!1):this._dangerConfirmController.confirm(e):Promise.resolve(!1),this._cancelDangerConfirm=()=>{this._dangerConfirmController.cancel()},this._onDangerConfirmDecision=e=>{this._dangerConfirmController.resolve(e.detail.token,e.detail.accepted)},this._onboardingShown=!1,this._rulesDialog=null,this._preflightClipboardFallback=null,this._haIntegrationVersion=null,this._versionRecovery=(e=this,new yg({clock:{setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)},storage:()=>e.ownerDocument.defaultView?.sessionStorage??null,safety:()=>kg(e),reload:()=>e._reloadDocument(),changed:()=>{e.requestUpdate()}})),this._haSupportApi=null,this._haDecorAssetsApi=null,this._haSummaryPanelApi=null,this._haRadarStage1Api=null,this._radarLive=new Tg(this),this._decorAssetSyncToken=0,this._alignDialog=null,this._settingsDialog=null,this._pdfDialog=!1,this._supportDialog=null,this._backupExportDialog=null,this._backupImportDialog=null,this._sunRaysCache=null,this._dayCycleTimer=0,this._dayCycleClockKey="",this._compassDrag=!1,this._importDialog=null,this._importQueue=[],this._importTotal=0,this._rulesCompiledSrc="",this._infoCard=null,this._nativeMoreInfoEntity=null,this._deviceInbox=null,this._deviceInboxReturn=null,this._deviceInboxMemo=null,this._markerDialog=null,this._spaceDialog=null,this._keyHandler=e=>this._onKey(e),this._warmVp=null,this._warmVpArmed=!1,this._warmLongReturn=!1,this._warmRevivePending=!1,this._warmGen=++rv,this._warmKey=null,this._warmSlot=null,this._hashApplied=!1,this._navApplied=!1,this._labs={alpha:!1,active:Object.freeze([]),space:""},this._viewPreference={},this._renderProjection="flat",this._kioskScale={icon:1,font:1},this._kioskDialog=!1,this._summarySlot=new Xf(Zf,this,e=>{this._summary=e,this._capturedSnapshotSequence=-1,this.isConnected&&(e.connect(),this.hasUpdated&&this.requestUpdate())}),this._activityRt=new Map,this._vacRt=new Map,this._vacViewKey="",this._vacLastView=null,this._vacRaf=0,this._vacSrvTrails={},this._vacJumpOnce=!1,this._continuity=this._newContinuityController(),this._continuityHistory=[],this._continuityEpoch=0,this._continuityDataReady=!0,this._continuityPaintToken=-1,this._continuityDisposed=!1,this._renderSnapshotAt=Date.now(),this._hassSequence=0,this._visibleDeviceSnapshot=null,this._candidateDeviceSnapshot=null,this._stagedDeviceSnapshotToken=-1,this._capturedSnapshotSequence=-1,this._capturedSnapshotDevices=null,this._capturedSnapshotLayout=null,this._capturedSnapshotActivity="",this._capturedSnapshotConfigEpoch=-1,this._capturedSnapshotVirtual="",this._lastValidStageSize=null,this._pendingRefitSize=null,this._refitRaf=0,this._pageVisibility=e=>{if(this._continuity.visibility(e),this._dayCycleVisibility(e),this._summary?.visibility(e.kind),"hidden"===e.kind)return this._radarLive.stop(),this._editorRuntime?._cancelRadarSetup(),this._clearRoomFocus(!0),this._clearTransientHover(!0),this._cancelDevicePressFeedback(),this._cancelCameraTransition(!0),void(this._modeTransitionPreparing?this._modeTransitionForceAtomic=!0:this._cancelModeTransition(!0));if(this._vacJumpOnce=!0,this._syncRadarLive(),!e.long){const e=Date.now();let t=!1;for(const i of this._activityRt.values())!i.flashKind||(i.expiresAt||i.flashTs+Qm)>e||(i.flashTs=0,i.flashKind=null,i.expiresAt=0,t=!0);return void(t&&this.requestUpdate())}Date.now()-this._renderSnapshotAt>1e3&&this._continuity.note("device-snapshot-stale"),this._continuityDataReady=!1,this._continuityPaintToken=-1,this._resumeSettling=!0,this._loading?this.requestUpdate():this._loadFromServer()},this._resumeSettling=!1,this._viewportInvalidAt=0,this._vacFit=null,this._vacAllCamerasFor=null,this._vacAllCameraCache=null,this._vacCalConfirm=null,this._kioskDots=!1,this._cyclePausedUntil=0,this._swipeStart=null,this._tabDrag=null,this._tabDragRelease=null,this._tabSuppressClick=!1,this._tabOrderWarned=!1,this._onLabsSnapshot=e=>{const t=this._effectiveProjection();this._labs=e,this._isoProjectionSnapshot=null,this._labsIso&&this._ensureIsoSceneRuntime();const i=this._effectiveProjection();this._convertProjectionView(t,i),this.requestUpdate()},this._onHashChange=()=>{if(this._hasFixedFloor)return;const e=this._hashSpace();if(e&&this._model.find(t=>t.id===e)&&e!==this._space){if(this._wallFaceBatch&&this._roomDialogCancel(),"plan"===this._mode&&"draw"===this._tool&&!this._finishWallChain())return;this._commitSpace(e),this._selId=null,this._path=[],this._clearPlanSnapHover(),this._clearOpeningPlacement(!0),this._tool="draw",this._activeWallChainId=null,this._activeWallChainPartitionIds=[],this._wallChainSegmentCms=[],this._closingWallCm=null,this._restoreZoom(),this.requestUpdate()}},this._drag=null,this._deviceDrag=null,this._rlResize=null,this._holdFired=!1,this._retryContinuity=()=>{this._continuityDataReady=!1,this._continuityPaintToken=-1,this._continuity.retry(this._continuity.recoveryReason||"plan"),this._loading||this._loadFromServer()},this._cfgEpoch=0,this._cfgEpochPreservedConfig=null,this._terminalFrame=0,this._modelCache=null,this._emptySpaceStateActive=!1,this._decorSnapCache=null,this._markerPreviewMemo=null,this._markerPreviewDevicesMemo=null,this._showHidden=!1,this._connHooked=null,this._connectionWasLost=!1,this._haRegistryConnection=null,this._haRegistryRev=-1,this._haBindingCacheKey="",this._planHassMemo=null,this._renderLife=new xg,this._liveEditorPaintCount=0,this._onHaRegistryUpdate=()=>{const e=td(this.hass);e.revision===this._haRegistryRev&&this._devices.length||(this._haRegistryRev=e.revision,this._renderLife.invalidate(),this._planHassMemo=null,this._regSignature="",this._maybeRebuildDevices(),this.requestUpdate())},this._onConnReady=()=>{if(this._loadTries=0,clearTimeout(this._loadRetryTimer),this._loadRetryTimer=void 0,ed(this.hass),this._saveConfigDebounced.pending()&&this._saveConfigDebounced.flush(),this._cfgWriting)return clearTimeout(this._reloadRetry),void(this._reloadRetry=window.setTimeout(this._onConnReady,400));!this._connectionWasLost&&this._continuity.hasCompleteFrame?this._beginContinuityCandidate("connection-ready",!1,"plan"):(this._continuityDataReady=!1,this._continuityPaintToken=-1),this._loading||this._loadFromServer()},this._onConnLost=()=>{this._booting&&!this._continuity.hasCompleteFrame||(this._connectionWasLost=!0,this._continuityDataReady=!1,this._continuityPaintToken=-1,this._continuity.connectionLost())},this._signer=new hc(()=>this.requestUpdate()),this._dirtyPos=new Set,this._sentPos=new Map,this._persistLayout=gv(()=>{if(this._serverStorage){const e=[...this._dirtyPos];this._dirtyPos.clear();for(const t of e){const e=vo(this._layout[t]);e&&(this._layout={...this._layout,[t]:e},this._sentPos.set(t,e),this.hass.callWS({type:"houseplan/layout/update",device_id:t,pos:e}).then(e=>this._noteLayoutRev(e)).catch(e=>this._showToast(this._t("toast.pos_save_failed",{err:this._errText(e)}))).finally(()=>{this._sentPos.get(t)===e&&this._sentPos.delete(t)}))}this._cacheSnapshot()}else this._persistLocalLayout()},600),this._frame=null,this._showFar=!1,this._writesPending=0,this._writeChain=Promise.resolve(),this._pendingPhysicalWrites=new Map,this._undoGeometry=()=>this._editorRuntimeOrThrow()._undoGeometry(),this._redoGeometry=()=>this._editorRuntimeOrThrow()._redoGeometry(),this._saveConfigDebounced=gv(()=>{this._serverCfg&&this._writeConfig().catch(e=>{const t=!0===e?.physicalGeometryRolledBack;"geometry-unsafe"!==e?.code&&("wall_model_client_outdated"===e?.code?this._showToast(this._t("toast.wall_model_client_outdated")):"conflict"===e?.code?(this._showToast(this._t("toast.conflict")),t||(this._cancelPath(),this._reloadConfigOnly(!0))):this._showToast(this._t("toast.cfg_save_failed",{err:this._errText(e)})),t&&this._reloadRejectedPhysicalWrite())})},500),this._wallChainSegmentCms=[],this._closingWallCm=null,this._savePhysicalDialog=()=>this._editorRuntimeOrThrow()._savePhysicalDialog(),this._deletePhysicalSelection=()=>this._editorRuntimeOrThrow()._deletePhysicalSelection(),this._confirmPartitionDelete=()=>this._editorRuntimeOrThrow()._confirmPartitionDelete(),this._confirmRoomDelete=e=>this._editorRuntimeOrThrow()._confirmRoomDelete(e),this._rebindPartitionOpening=()=>this._editorRuntimeOrThrow()._rebindPartitionOpening(),this._keepClosedAsPartitions=()=>this._editorRuntimeOrThrow()._keepClosedAsPartitions(),this._toggleServerPlans=async()=>this._onboardingRuntime&&this._spaceDialogUsesOnboardingRuntime("create")?this._onboardingRuntime._toggleServerPlans():this._editorRuntimeOrThrow()._toggleServerPlans(),this._aspectJob=null,this._dayCycleTick=()=>{if(!this.isConnected||"hidden"===this.ownerDocument.visibilityState)return;const e=this._dayCycleState();if(!e)return this._dayCycleTimer&&(clearInterval(this._dayCycleTimer),this._dayCycleTimer=0),void(this._dayCycleClockKey="");const t=ar(e);t!==this._dayCycleClockKey&&(this._dayCycleClockKey=t,this.requestUpdate())},this._sunShown=!1,this._sunOut=!1,this._sunOutTimer=0,this._openSettingsDialog=()=>{if(this._editorRuntime)return this._editorRuntime._openSettingsDialog();this._ensureEditorRuntime().then(e=>{e&&this._openSettingsDialog()})},this._openSupportDialog=()=>{this._editorRuntime?this._editorRuntime._openSupportDialog():this._ensureEditorRuntime().then(e=>{e&&this._openSupportDialog()})},this._openPdfDialog=()=>{this._pdfRuntimeLoader.ensure().then(e=>{e&&(this._pdfDialog=!0,this.requestUpdate())})},this._reportedPreflightFingerprint=null,this._openAlignDialog=()=>this._editorRuntimeOrThrow()._openAlignDialog(),this._toggleOptimizeLivePositions=()=>this._editorRuntimeOrThrow()._toggleOptimizeLivePositions(),this._optimizeUndoBusy=!1,this._openBackupExport=()=>this._editorRuntimeOrThrow()._openBackupExport(),this._openRulesDialog=()=>this._editorRuntimeOrThrow()._openRulesDialog(),this._climateCache=null,this._gearPtCache=new WeakMap}requestUpdate(e,t,i){if("hass"===e&&this.hass&&this._liveRt){const e=this._visibleDeviceSnapshot||this._candidateDeviceSnapshot;if(!this._liveRt.hass(t,this.hass,e?{entityIds:e.entityIds}:null,()=>Sg(this))&&!this._summary?.observeHassComposition())return}void 0!==e&&(this._terminalFrame=0),this._editorRuntime?._routeLiveEditorUpdate(e,t)||(this._liveRt?.clear(),super.requestUpdate(e,t,i))}_editorRuntimeOrThrow(){if(!this._editorRuntime)throw new Error("Houseplan editor runtime is not loaded");return this._editorRuntime}async _ensureEditorRuntime(){return this._editorRuntimeLoader.ensure()}async _ensureOnboardingRuntime(){return this._onboardingRuntimeLoader.ensure()}async _ensureIsoSceneRuntime(){return this._isoSceneRuntimeLoader.ensure()}_editorRuntimeStateChanged(e){clearTimeout(this._editorRuntimeLoadingTimer),this._editorRuntimeLoadingTimer=void 0,"loading"!==e?(this._editorRuntimeLoadingVisible=!1,this.requestUpdate()):this._editorRuntimeLoadingTimer=window.setTimeout(()=>{this._editorRuntimeLoadingVisible=!0,this.requestUpdate()},150)}async _requestMode(e,t=!0,i=!1){const n=++this._editorModeRequest;if(i&&(this._warmModeRequest=n,this._refitRaf&&(cancelAnimationFrame(this._refitRaf),this._refitRaf=0),this._pendingRefitSize=null),"view"===e||await this._ensureEditorRuntime()){if(n===this._editorModeRequest&&this.isConnected)return i?(this._adoptMode(e),this._warmRevivePending&&(clearTimeout(this._warmReviveTimer),this._warmReviveTimer=void 0,this._warmReviveDialog()),this.requestUpdate(),void this.updateComplete.then(()=>requestAnimationFrame(()=>requestAnimationFrame(()=>{if(this._warmModeRequest!==n||n!==this._editorModeRequest)return;const e=this._stageEl;this._lastValidStageSize=e&&e.clientWidth>0&&e.clientHeight>0?[e.clientWidth,e.clientHeight]:null,this._pendingRefitSize=null,this._warmModeRequest=0})))):void this._setMode(e,t);this._warmModeRequest===n&&(this._warmModeRequest=0)}else this._warmModeRequest===n&&(this._warmModeRequest=0)}get _layout(){return this._adoption.layout}set _layout(e){this._adoption.stageLocalLayout(e)}get _layoutRev(){return this._adoption.layoutRev}set _layoutRev(e){this._adoption.seedIdentity({layoutRev:e})}get _layoutContentFingerprint(){return this._adoption.layoutFingerprint}set _layoutContentFingerprint(e){this._adoption.seedIdentity({layoutFingerprint:e})}get _serverCfg(){return this._adoption.config}set _serverCfg(e){this._adoption.stageLocalConfig(e)}get _cfgRev(){return this._adoption.configRev}set _cfgRev(e){this._adoption.seedIdentity({configRev:e})}get _cfgContentFingerprint(){return this._adoption.configFingerprint}set _cfgContentFingerprint(e){this._adoption.seedIdentity({configFingerprint:e})}_seedDecorStyle(e){var t,i;if(t=Al,i=this,Cl(e,Nl)&&"pending"===t.state()&&(t.art("",i),t.ensure()),this._decorStyleSeeded||!e)return;this._decorStyleSeeded=!0;const n=e.settings?.decor_default_style;n&&(this._decorStyle=function(e,t){if(!e||"object"!=typeof e)return{...t};const i=e,n="string"==typeof i.color&&i.color?i.color:t.color,r="string"==typeof i.fill_color&&i.fill_color?i.fill_color:t.fillColor,o=Number(i.width_cm);return{color:n,opacity:Sr(i.opacity,t.opacity),widthCm:Number.isFinite(o)&&o>0?Math.max(.1,Math.min(100,o)):t.widthCm,fill:"boolean"==typeof i.fill?i.fill:t.fill,fillColor:r,fillOpacity:Sr(i.fill_opacity,t.fillOpacity)}}(n,xr))}get _canManageConfiguration(){return null!==this._serverCanWrite?this._serverCanWrite:!0===this.hass?.user?.is_admin}get _canEdit(){return this._norm&&this._canManageConfiguration}get _kiosk(){return!!this._config?.kiosk}_showKioskDots(){this._kioskDots=!0,clearTimeout(this._kioskDotsTimer),this._kioskDotsTimer=window.setTimeout(()=>this._kioskDots=!1,2500)}get _modeTransitionBusy(){return this._modeTransitionPreparing||this._modeTransition.active}get _doubleFitEnabled(){return!("view"!==this._mode||this._vacFit||this._modeTransitionBusy||this._touchSequenceMultitouch||"steady"!==this._continuity.state||this._continuity.overlayBlocksInteraction)}_cameraState(){const e=this._viewOr(this._baseVb());return{zoom:this._zoom,viewBox:{...e}}}_normalizeCameraState(e){const t=this._cameraTransitionFit||Oi(this._baseVb(),this._stageAspect());return{zoom:Math.min(yv.ZOOM_MAX,Math.max(yv.ZOOM_MIN,e.zoom)),viewBox:this._clampView({...e.viewBox},t)}}_applyCameraTransitionFrame(e){const t=this._normalizeCameraState(e.presented);e.presented=t,this._zoom=t.zoom,this._view={...t.viewBox},this._liveVp(!0)}_settleCameraTransition(e){const t=this._normalizeCameraState(e.to);this._zoom=t.zoom,this._view={...t.viewBox},this._cameraTransitionFit=null,"room"!==e.reason&&this._saveZoom(),this.requestUpdate()}_cancelCameraTransition(e=!1,t=!1){const i=this._cameraTransition.state?.reason,n=t&&this._cameraTransition.active?this._cameraTransition.presented?.zoom:void 0;this._cameraTransition.cancel(e),this._cameraTransitionFit=null,void 0!==n&&"room"!==i&&this._saveZoom()}_prepareCameraCommand(){this._bootSoftCancel(),this._modeTransitionBusy&&this._cancelModeTransition(!0),"opening"===this._tool&&(this._cursorPt=null,this._clearOpeningPlacement(!1))}_startCameraTransition(e,t,i,n){const r=this._cameraState(),o=this._cameraTransition.target;return(!o||!Kg(o,e))&&(Kg(r,e)?(this._cancelCameraTransition(!1),!1):(this._cameraTransitionFit={...t},this._cameraTransition.start(r,e,i,this._reducedMotion?0:n),!0))}_cssColor(e,t){const i=String(e||"").trim();if(!i)return t;const n=document.createElement("span");n.style.cssText=`position:absolute;visibility:hidden;color:${i}`,this.renderRoot.append(n);const r=getComputedStyle(n).color||t;return n.remove(),r}_currentModeVisual(e=this._mode){const t=this._modeTransition.presented||this._modeTransitionVisual;if(t)return{...t,viewport:{...t.viewport,viewBox:{...t.viewport.viewBox}}};const i=this._stageEl;if(!i||i.clientWidth<=0||i.clientHeight<=0)return null;const n=this.renderRoot.querySelector(".editorchrome"),r=this._viewOr(this._baseVb()),o=this.renderRoot.querySelector(".hp-paper"),s=this.renderRoot.querySelector(".hp-backdrop"),a=this.renderRoot.querySelector(".zoomwrap"),l=a?getComputedStyle(a).filter:"",c=Number(/brightness\(([^)]+)\)/.exec(l)?.[1]);return{presentedMode:e,editorChromeHeight:"view"===e?0:n?.getBoundingClientRect().height||0,stageWidth:i.clientWidth,stageHeight:i.clientHeight,viewport:Hg(r,i.clientWidth),stageColor:getComputedStyle(i).backgroundColor||"rgb(255, 255, 255)",paperColor:o?getComputedStyle(o).fill:"rgb(255, 255, 255)",sceneBrightness:Number.isFinite(c)?c:1,architectureOpacity:"decor"===e?.35:1,backdropOpacity:s&&Number(getComputedStyle(s).opacity)||1,viewWeight:"view"===e?1:0,editorWeight:"view"===e?0:1,toolbarContentOpacity:"view"===e?0:1}}_viewForModeTarget(e,t,i,n,r){const o=Oi(this._baseVb(),n/r),s=Math.min(yv.ZOOM_MAX,Math.max(yv.ZOOM_MIN,e)),a=o.w/s,l=o.h/s,c=t??o.x+o.w/2,h=i??o.y+o.h/2;return this._clampView({x:c-a/2,y:h-l/2,w:a,h:l},o)}_targetStageColor(e){return"view"!==e?"rgb(255, 255, 255)":this._cssColor(this._stageBg(this._spaceDisplayForRender()),this._cssColor("var(--ha-card-background, var(--card-background-color, #111))","rgb(17, 17, 17)"))}_targetPaperColor(e){return"view"===e&&this._spaceModel()?.bg?this._cssColor("var(--ha-card-background, var(--card-background-color, #111))","rgb(17, 17, 17)"):"rgb(255, 255, 255)"}_targetBrightness(e){return 1}_applyModeTransitionFrame(e){e.targetMode===this._mode&&(this._modeTransitionVisual=e.presented,this._view={...e.presented.viewport.viewBox},this.requestUpdate())}_settleModeTransition(e){if(e.targetMode!==this._mode)return;const t=this._modeTransitionRequest;this._view={...e.to.viewport.viewBox},this._zoom=this._modeTransitionTargetZoom,this._modeTransitionVisual=null,this._modeTransitionPreparing=!1,this._lastValidStageSize=[e.to.stageWidth,e.to.stageHeight],"view"===this._mode&&(this._saveZoom(),this._viewModeSnap=null,this._modeTransitionEditorCamera=null),this.requestUpdate(),this.updateComplete.then(()=>{if(!this.isConnected||t!==this._modeTransitionRequest||this._modeTransitionBusy||e.targetMode!==this._mode)return;const i=this._stageEl;if(i&&i.clientWidth>0&&i.clientHeight>0&&(Math.abs(i.clientWidth-e.to.stageWidth)>.5||Math.abs(i.clientHeight-e.to.stageHeight)>.5)){const e=this._view;this._lastValidStageSize=[i.clientWidth,i.clientHeight],this._applyView(this._zoom,e?e.x+e.w/2:void 0,e?e.y+e.h/2:void 0),this.requestUpdate()}const n=this.renderRoot.activeElement;(!n||!n.isConnected||!!n.closest?.(".editorchrome, .stage"))&&this.renderRoot.querySelector(".modetab.active")?.focus?.({preventScroll:!0})})}_cancelModeTransition(e=!0){this._cancelCameraTransition(!1);const t=!!this._modeTransition.state;this._modeTransitionRequest++,this._modeTransitionPreparing=!1,this._modeTransitionForceAtomic=!1,this._modeTransition.cancel(e),e&&t||(this._modeTransitionVisual=null)}_adoptMode(e){e!==this._mode&&(this._clearRoomFocus(!0),this._resetDeviceHitState()),this._cancelModeTransition(!1),this._mode=e,this._isoProjectionSnapshot=null,"view"!==e&&(this._editorChromeMode=e)}_commitViewModeAtomic(e,t,i,n){if(this._modeTransitionPreparing=!1,this._modeTransitionVisual=null,this._modeTransitionForceAtomic=!1,this._zoom=t,e){const r=this._stageEl?.clientWidth||e.stageWidth,o=Math.max(1,e.stageHeight+e.editorChromeHeight);this._view=this._viewForModeTarget(t,i,n,r,o),this._lastValidStageSize=[r,o]}else this._view=null;this._viewModeSnap=null,this._modeTransitionEditorCamera=null,this._saveZoom(),this.requestUpdate()}_prepareModeTransition(e,t,i,n,r,o){this.updateComplete.then(()=>{if(!this.isConnected||e!==this._modeTransitionRequest||this._mode!==i)return void(e===this._modeTransitionRequest&&(this._modeTransitionPreparing=!1,this._modeTransitionVisual=null,this._modeTransitionForceAtomic=!1,this.requestUpdate()));const s=this.renderRoot.querySelector(".editorchrome-inner"),a="view"===i?0:s?.scrollHeight||0,l=Math.max(1,(this.panelHost?this.clientHeight:innerHeight)-Jg(this.renderRoot,this._stageEl,this.panelHost)),c=this._stageEl?.clientWidth||t.stageWidth,h=this._viewForModeTarget(n,r,o,c,l),d={presentedMode:i,editorChromeHeight:a,stageWidth:c,stageHeight:l,viewport:Hg(h,c),stageColor:this._targetStageColor(i),paperColor:this._targetPaperColor(i),sceneBrightness:this._targetBrightness(i),architectureOpacity:"decor"===i?.35:1,backdropOpacity:"decor"===i&&"backdrop"!==this._decorTool?.5:1,viewWeight:"view"===i?1:0,editorWeight:"view"===i?0:1,toolbarContentOpacity:"view"===i?0:1};this._modeTransitionPreparing=!1;const u=this._modeTransitionForceAtomic;this._modeTransitionForceAtomic=!1,this._modeTransition.start(t,d,i,this._reducedMotion||u?0:220)})}get _hasFixedFloor(){return!!this._config&&Object.prototype.hasOwnProperty.call(this._config,"floor")}_fixedFloorState(e=this._model,t=this._loadOk){const i=this._config?.floor,n=function(e){if(!e.hasFloor)return{kind:"absent"};const t=e.floor;if("string"==typeof t)return t.length?e.spaceIds.includes(t)?{kind:"valid",id:t,source:"id"}:{kind:"invalid",reason:"unknown-id",value:t}:{kind:"invalid",reason:"empty-id",value:t};if("number"==typeof t){if(!Number.isFinite(t))return{kind:"invalid",reason:"non-finite-index",value:t};if(!Number.isInteger(t))return{kind:"invalid",reason:"fractional-index",value:t};if(t<0)return{kind:"invalid",reason:"negative-index",value:t};const i=e.spaceIds[t];return void 0===i?{kind:"invalid",reason:"out-of-range-index",value:t}:{kind:"valid",id:i,source:"index"}}return{kind:"invalid",reason:"invalid-type",value:t}}({spaceIds:e.map(e=>e.id),hasFloor:this._hasFixedFloor,floor:i});return!this._hasFixedFloor||t?n:"number"==typeof i?"valid"===n.kind||"invalid"===n.kind&&"out-of-range-index"===n.reason?{kind:"pending",value:i}:n:"valid"===n.kind||"invalid"===n.kind&&"unknown-id"!==n.reason?n:{kind:"pending",value:i}}_canCommitSpace(e,t=!1){if(t||!this._hasFixedFloor)return!0;const i=this._fixedFloorState();return"valid"===i.kind&&i.id===e}_commitSpace(e,t=!1){return!!this._canCommitSpace(e,t)&&(e!==this._space&&(this._clearRoomFocus(!0),this._resetDeviceHitState(),this._cancelDangerConfirm(),this._cancelCameraTransition(!1),this._clearTransientHover(!0),this._cancelDevicePressFeedback(),this._editorRuntime?._clearFurniturePreview()),this._space=e,this._isoProjectionSnapshot=null,!0)}_slideTo(e,t){if(e===this._space)return!0;if(!this._canCommitSpace(e))return!1;if(this._wallFaceBatch&&this._roomDialogCancel(),"plan"===this._mode&&"draw"===this._tool&&!this._finishWallChain())return!1;this._cancelModeTransition(!0);const i=window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches;return this._commitSpace(e),this._path=[],this._clearPlanSnapHover(),this._clearOpeningPlacement(!0),this._tool="draw",this._activeWallChainId=null,this._activeWallChainPartitionIds=[],this._wallChainSegmentCms=[],this._closingWallCm=null,this._selId=null,this._physicalSel=null,this._editorSecondary?.closeForNavigation(),this._physicalDialog=null,this._physicalDrag=null,this._restoreZoom(),i||(this._slide=t,clearTimeout(this._slideTimer),this._slideTimer=window.setTimeout(()=>{this._slideTimer=void 0,this._slide="",this.requestUpdate()},190),this.requestUpdate()),!0}get _canReorderTabs(){return Yf({canEdit:this._canEdit,kiosk:this._kiosk,mode:this._mode,pointerType:"mouse",spaceCount:this._model.length,fixedFloor:this._hasFixedFloor})}_tabPointerDown(e,t){Yf({canEdit:this._canEdit,kiosk:this._kiosk,mode:this._mode,pointerType:e.pointerType,spaceCount:this._model.length,fixedFloor:this._hasFixedFloor})&&(fv(e),this._tabDragRelease=e=>this._tabPointerUp(e),window.addEventListener("pointerup",this._tabDragRelease),window.addEventListener("pointercancel",this._tabDragRelease),this._tabDrag={id:t,pointerId:e.pointerId,x:e.clientX,y:e.clientY,moved:!1,targetId:null,placement:null})}_tabDropTargetAt(e,t,i){const n=this._model.map(e=>e.id),r=n.indexOf(i);if(r<0)return null;const o=this.renderRoot.querySelectorAll('[data-hp="space-tab"]');for(const s of o){const o=s.dataset.id||"";if(!o||o===i)continue;const a=s.getBoundingClientRect();if(ea.right||ta.bottom)continue;const l=n.indexOf(o);return l<0?null:{targetId:o,placement:l=4)))return;var i,n;const r=this._tabDropTargetAt(e.clientX,e.clientY,t.id);t.moved&&t.targetId===r?.targetId&&t.placement===r?.placement||(this._tabDrag={...t,moved:!0,targetId:r?.targetId||null,placement:r?.placement||null})}_tabPointerUp(e){const t=this._tabDrag;if(t&&t.pointerId!==e.pointerId)return;const i="pointerup"===e.type&&t?.moved?this._tabDropTargetAt(e.clientX,e.clientY,t.id):null;"pointerup"===e.type&&t?.moved&&this._suppressNextTabClick(),this._endTabDrag(),t?.moved&&i&&this._commitTabOrder(t.id,i.targetId)}_endTabDrag(){this._tabDrag=null,this._tabDragRelease&&(window.removeEventListener("pointerup",this._tabDragRelease),window.removeEventListener("pointercancel",this._tabDragRelease),this._tabDragRelease=null)}_tabClick(e){if(this._tabSuppressClick)return this._tabSuppressClick=!1,clearTimeout(this._tabSuppressClickTimer),void(this._tabSuppressClickTimer=void 0);this._pickSpace(e)}_suppressNextTabClick(){this._tabSuppressClick=!0,clearTimeout(this._tabSuppressClickTimer),this._tabSuppressClickTimer=window.setTimeout(()=>{this._tabSuppressClick=!1,this._tabSuppressClickTimer=void 0},0)}_commitTabOrder(e,t){const i=this._serverCfg;if(!i||!this._canReorderTabs)return;const n=this._model.map(e=>e.id),r=function(e,t,i){const n=e.indexOf(t),r=e.indexOf(i);if(n<0||r<0||n===r)return e;const o=e.slice();return o.splice(n,1),o.splice(r,0,t),o}(n,e,t);if(r===n)return;const o=new Map(this._devices.map(e=>[String(e.id),String(e.area||"")])),s=function(e,t,i,n=()=>""){if(!i)return[];const r=[];for(const o of e){if(!o||!0===o.removed)continue;const e="string"==typeof o.id?o.id:"";if(!e)continue;if("string"==typeof o.space&&o.space)continue;const s=("string"==typeof o.area?o.area:"")||n(e)||"";s&&t[s]||r.push({id:e,space:i})}return r}(i.markers||[],Object.fromEntries(Object.entries(this._areaToSpace).map(([e,t])=>[e,t.space])),n[0]||"",e=>o.get(e)||"");if(s.length){const e=new Map(s.map(e=>[e.id,e.space]));for(const t of i.markers||[]){const i=e.get(String(t.id));i&&(t.space=i)}}i.spaces=function(e,t){const i=new Map(t.map((e,t)=>[e,t]));return e.map((e,t)=>({space:e,index:t})).sort((e,t)=>(i.get(String(e.space?.id))??Number.MAX_SAFE_INTEGER)-(i.get(String(t.space?.id))??Number.MAX_SAFE_INTEGER)||e.index-t.index).map(e=>e.space)}(i.spaces||[],r),this._saveConfig(),this._tabOrderWarned||(this._tabOrderWarned=!0,this._showToast(this._t("toast.space_order_changed")))}_pickSpace(e){if(this._endTabDrag(),e===this._space)return;const t=this._model.map(e=>e.id),i=t.indexOf(this._space),n=t.indexOf(e);this._navApplied=!0,this._showFar=!1,this._frame=null,this._slideTo(e,i>=0&&n0&&Date.now()>=this._cyclePausedUntil&&this._model.length>1&&this._zoom<=1.001){const e=this._model.map(e=>e.id),t=e.indexOf(this._space);this._slideTo(e[(t+1)%e.length],"left"),this._showKioskDots()}}_syncCycleTimer(){clearInterval(this._cycleTimer),this._cycleTimer=void 0,this.isConnected&&!this._hasFixedFloor&&this._config?.kiosk&&Number(this._config.cycle)>0&&(this._cycleTimer=window.setInterval(()=>this._cycleTick(),1e3*Number(this._config.cycle)))}get _editing(){return"plan"===this._mode||"devices"===this._mode||"decor"===this._mode}get _markup(){return"plan"===this._mode}get _wallUnionCache(){return this._wallUnionCacheValue}set _wallUnionCache(e){this._wallUnionCacheValue=e,null===e&&this._wallUnionPool.clear()}get _glowClipCache(){return this._glowRuntimeState.clipCache}get _glowGeometryWarnings(){return this._glowRuntimeState.geometryWarnings}get _glowFeatherUnits(){return this._glowRuntimeState.featherUnits}set _glowFeatherUnits(e){this._glowRuntimeState.featherUnits=e}get _glowRenderedSources(){return this._glowRuntimeState.renderedSources}get _glowLastAppearance(){return this._glowRuntimeState.lastAppearance}get _glowFeatherSuspendUntil(){return this._glowRuntimeState.featherSuspendUntil}set _glowFeatherSuspendUntil(e){this._glowRuntimeState.featherSuspendUntil=e}get _glowFeatherResumeTimer(){return this._glowRuntimeState.featherResumeTimer}set _glowFeatherResumeTimer(e){this._glowRuntimeState.featherResumeTimer=e}get _glowSourceSeq(){return this._glowRuntimeState.sourceSeq}set _glowSourceSeq(e){this._glowRuntimeState.sourceSeq=e}get _touchSequenceMultitouch(){return this._touchClickGuard.sequenceMultitouch}_syncDangerConfirmLocaleGate(){return this._config&&this.hass?cp(this,_p,bp(this.hass,this._config.language)):"ready"}_dangerConfirmMissingSpace(){const e=this._model;if(!e.length)return!1;const t=this._fixedFloorState(e);return"pending"!==t.kind&&"invalid"!==t.kind&&!this._spaceModel()}_syncVersionRecovery(){this._versionRecovery.update({frontendVersion:Jf(ev),backendVersion:this._haIntegrationVersion,kiosk:!0===this._config?.kiosk,reducedMotion:this._reducedMotion})}_newContinuityController(){return new sc(()=>{this._resumeSettling="steady"!==this._continuity.state,this._continuityEpoch++,this.isConnected&&this.requestUpdate()})}get _labsIso(){return this._labs.active.includes("iso")}get _desiredProjection(){return"view"===this._mode&&this._labsIso&&"iso"===this._viewPreference[this._space]?"iso":"flat"}_saveViewPreference(){try{localStorage.setItem(hv,JSON.stringify(this._viewPreference))}catch{}}_logicalViewCenter(e){const t=this._view;if(!t)return null;const i=[t.x+t.w/2,t.y+t.h/2],n="iso"===e?af(i):i;return{x:n[0],y:n[1]}}_convertProjectionView(e,t){if(e===t)return;this._clearRoomFocus(!0);const i=this._logicalViewCenter(e);this._view=null;const n=i?"iso"===t?sf([i.x,i.y],0):[i.x,i.y]:null;this._applyView(this._zoom,n?.[0],n?.[1]),this._warmPatch({vp:this._warmViewportState()}),this.requestUpdate()}_setProjection(e){if(!this._labsIso||"view"!==this._mode)return;const t=this._effectiveProjection();if(this._viewPreference={...this._viewPreference,[this._space]:e},"iso"===e){this._ensureIsoSceneRuntime();const e=this._isoSceneKey();e&&this._isoFallback.delete(e),this._isoFallback.delete(`${this._space}|no-borders`),this._clearIsoInvalidFallback()}this._saveViewPreference(),this._isoProjectionSnapshot=null;const i=this._effectiveProjection();this._convertProjectionView(t,i)}_hashSpace(){return Af(window.location.hash||"")}connectedCallback(){this._connectedPath=location.pathname,this._routeDepartureHandled=!1,this._configReloadAuthority.observeContext(Uu(this)),window.addEventListener("location-changed",this._onLocationChanged),window.addEventListener("popstate",this._onLocationChanged),this._continuityDisposed&&(this._continuity=this._newContinuityController(),this._continuityDisposed=!1,this._continuityPaintToken=-1);const e=cg(this.ownerDocument);var t;void 0!==e&&(this._glowScreenBlend=e),this._continuityUnsub?.(),this._continuityUnsub=rc(this.ownerDocument,this._pageVisibility),this._languageFailureUnsub?.(),this._languageFailureUnsub=function(...e){return()=>{for(const t of e)t()}}((t=()=>{this._showToast(this._t("toast.locale_load_failed"))},pp.add(t),()=>pp.delete(t)),function(e){return Dl.add(e),()=>{Dl.delete(e)}}(()=>this._showToast(this._t("toast.furniture_art_load_failed")))),super.connectedCallback(),this._summarySlot.connect(),this._ensureLiveRuntime().catch(()=>this.requestUpdate()),this._pointerModality.connect(this.ownerDocument.defaultView);const i=this.ownerDocument.defaultView?.MutationObserver;i&&(this._pointerHoverObserver=new i(e=>{let t=!1;for(const i of e){for(const e of i.addedNodes)this._syncPointerHoverSubtree(e);const e=e=>{if(e.nodeType!==Node.ELEMENT_NODE)return!1;const t=e;return t.matches(".devlayer, .devlayer *")||!!t.querySelector?.(".devlayer")};(e(i.target)||[...i.addedNodes,...i.removedNodes].some(e))&&(t=!0)}t&&this._invalidateDeviceHitGeometry()}),this._pointerHoverObserver.observe(this.renderRoot,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","data-id"]})),this._motionMedia=window.matchMedia?.("(prefers-reduced-motion: reduce)"),this._reducedMotion=!!this._motionMedia?.matches,this._motionMedia?.addEventListener?.("change",this._onMotionChange),this._syncVersionRecovery(),this._versionRecovery.connect(),lg(this.ownerDocument).then(e=>{e!==this._glowScreenBlend&&(this._glowScreenBlend=e,this.isConnected&&this.requestUpdate())}),this.hass&&this._ensureHaRegistryAuthority(),window.addEventListener("keydown",this._keyHandler),this._signer.start(()=>this.hass,()=>this._referencedContentUrls()),this._syncCycleTimer(),window.addEventListener("hashchange",this._onHashChange),this._labsUnsub?.(),this._labsUnsub=function(e){Of.add(e);const t=Hf();return"undefined"==typeof window&&e(t),()=>{Of.delete(e)}}(this._onLabsSnapshot),this._labsIso&&this._ensureIsoSceneRuntime(),this._booting?this._bootWatch():this._bootFading&&(clearTimeout(this._bootTimer),this._bootTimer=window.setTimeout(()=>{this._bootFading=!1},220)),this._bootSoft&&(clearTimeout(this._bootSoftTimer),this._bootSoftTimer=window.setTimeout(()=>{this._bootSoft=!1},iv)),!this._loadOk&&this._serverCfg&&this.hass&&this._scheduleLoadRetry(),!this._warmSlot&&this._config&&this._warmAdopt(),this._loadOk&&this._ensureLiveSyncSubscriptions(),this._warmVp&&!this._warmRevivePending&&void 0===this._warmReviveTimer&&(this._warmRevivePending=!0,this._warmReviveTimer=window.setTimeout(()=>this._warmReviveDialog(),0)),this._warmLongReturn&&this._beginResumeSettle(),this._warmLongReturn=!1,this.requestUpdate()}disconnectedCallback(){this._versionRecovery.disconnect(),this._configReloadAuthority.invalidateLifecycle(),this._liveRt?.dispose(),this._radarLive.stop(),this._editorRuntime?._disposeLiveEditor(),this._clearRoomFocus(!0),this._cancelDangerConfirm(),this._connectedPath&&location.pathname!==this._connectedPath&&this._leaveCardRoute(),window.removeEventListener("location-changed",this._onLocationChanged),window.removeEventListener("popstate",this._onLocationChanged),this._continuityUnsub?.(),this._continuityUnsub=void 0,this._languageFailureUnsub?.(),this._languageFailureUnsub=void 0,this._motionMedia?.removeEventListener?.("change",this._onMotionChange),this._motionMedia=void 0,this._vacRaf&&(cancelAnimationFrame(this._vacRaf),this._vacRaf=0),this._refitRaf&&(cancelAnimationFrame(this._refitRaf),this._refitRaf=0),this._warmModeRequest=0,this._dayCycleTimer&&(clearInterval(this._dayCycleTimer),this._dayCycleTimer=0),this._summarySlot.disconnect(),this._dayCycleClockKey="",this._bootSettleRaf&&(cancelAnimationFrame(this._bootSettleRaf),this._bootSettleRaf=0),this._bootSettling=!1;for(const e of this._activityRt.values())clearTimeout(e.timer);window.removeEventListener("keydown",this._keyHandler),this._endTabDrag(),clearTimeout(this._tabSuppressClickTimer),this._tabSuppressClickTimer=void 0,this._tabSuppressClick=!1,clearInterval(this._cycleTimer),clearTimeout(this._kioskDotsTimer),clearTimeout(this._kioskHoldTimer),clearTimeout(this._reloadRetry),clearTimeout(this._loadRetryTimer),this._loadRetryTimer=void 0,this._connHooked?.removeEventListener?.("ready",this._onConnReady),this._connHooked?.removeEventListener?.("disconnected",this._onConnLost),this._connHooked?.removeEventListener?.("reconnect-error",this._onConnLost),this._connHooked=null,this._haRegistryRelease?.(),this._haRegistryRelease=void 0,this._haRegistryConnection=null,this._signer.dispose(),clearTimeout(this._toastTimer),clearTimeout(this._slideTimer),clearTimeout(this._editorRuntimeLoadingTimer),this._editorRuntimeLoadingTimer=void 0,this._editorRuntimeLoadingVisible=!1,this._modeTransition.dispose(),this._cameraTransition.dispose(),this._cameraTransitionFit=null,this._modeTransitionVisual=null,this._modeTransitionPreparing=!1,this._modeTransitionForceAtomic=!1,this._modeTransitionRequest++,this._slideTimer=void 0,this._slide="",clearTimeout(this._bootTimer),this._bootTimer=void 0,clearTimeout(this._bootSoftTimer),this._saveConfigDebounced.flush(),this._cancelDeviceDrag(),window.removeEventListener("hashchange",this._onHashChange),this._labsUnsub?.(),this._labsUnsub=void 0,clearTimeout(this._holdTimer),this._roViewport?.disconnect(),this._roViewport=void 0,this._roHdr?.disconnect(),this._roHdr=void 0,this._onWinResize&&(window.removeEventListener("resize",this._onWinResize),this._onWinResize=void 0),this._unsubCfg&&(this._unsubCfg(),this._unsubCfg=null),this._unsubLayout&&(this._unsubLayout(),this._unsubLayout=null),this._unsubVirtual&&(this._unsubVirtual(),this._unsubVirtual=null),this._unsubTrail&&(this._unsubTrail(),this._unsubTrail=void 0),this._liveSyncGeneration++,this._liveSyncAttempt=null,this._liveSyncConnection=null,clearTimeout(this._layoutSyncTimer),clearTimeout(this._duplicateColumnTimer),Am(this._glowRuntimeState,this._glowRuntimeHost),this._warmSnapshot(),this._warmRevivePending=!1,clearTimeout(this._warmReviveTimer),this._warmReviveTimer=void 0,this._warmRelease(),this._clearPlanSnapHover(),this._clearOpeningPlacement(!0),this._editorRuntime?._clearFurniturePreview(),this._editorRuntime?._furnShiftDetach(),this._touchContacts.clear(),this._touchClickGuard.reset(),this._resetDeviceHitState(),this._clearTransientHover(!0),this._cancelDevicePressFeedback(),this._pointerHoverObserver?.disconnect(),this._pointerHoverObserver=void 0,this._pointerModality.disconnect(),this._editorSecondary?.reset(),this._resumeSettling=!1,this._continuityHistory=[...this._continuityHistory,...this._continuity.trace].slice(-80),this._continuity.dispose(),this._continuityDisposed=!0,super.disconnectedCallback()}_onKey(e){if("Escape"===e.key&&this._vacFit){if(this._vacFit.busy)return;return this._vacFit=null,this._showToast(this._t("vac.cal_cancelled")),void e.stopPropagation()}if("Escape"===e.key){if(this._tapConfirm)return void(this._tapConfirm=null);if(this._vacCalConfirm)return void(this._vacCalConfirm.busy||(this._vacCalConfirm=null));if(this._decorEraseConfirm)return void(this._decorEraseConfirm=null);if(this._openingInfo)return void(this._openingInfo=null);if(this._infoCard)return void this._closeInfoCard();if(this._rulesDialog)return void(this._rulesDialog=null);if(this._alignDialog)return this._alignDialog=null,void(this._preflightClipboardFallback=null);if(this._backupImportDialog)return void(this._backupImportDialog=null);if(this._backupExportDialog)return void(this._backupExportDialog=null);if(this._pdfDialog)return void(this._pdfDialog=!1);if(this._supportDialog)return void this._editorRuntime?._closeSupportDialog();if(this._settingsDialog)return void(this._settingsDialog=null);if(this._summary?.closeDialogIfIdle())return;if(this._markerDialog)return void this._closeMarkerDialog();if(this._deviceInbox)return void(this._deviceInbox=null);if(this._openingDialog)return void(this._openingDialog=null);if(this._physicalDialog)return void(this._physicalDialog=null);if(this._backdropDialog)return void(this._backdropDialog=null);if(this._decorShapeDialog)return void(this._decorShapeDialog=null);if(this._decorTextDialog)return void(this._decorTextDialog=null);if(this._spaceDialog&&!this._roomDialog)return this._spaceDialog=null,this._importQueue=[],void(this._importTotal=0);if(this._editorSecondary?.hasOpenGroup)return e.preventDefault(),void this._editorSecondary?.closeGroup(!0)}const t=e.composedPath?.()||[e.target],i=t.some(e=>e?.matches?.('input, textarea, select, [contenteditable="true"]')),n=t.some(e=>e?.classList?.contains?.("editor-secondary")),r=e.ctrlKey||e.metaKey,o=e.key.toLowerCase(),s=/^[a-z]$/.test(o),a="z"===o||!s&&"KeyZ"===e.code,l="y"===o||!s&&"KeyY"===e.code,c=r&&(a&&e.shiftKey||l),h=r&&a&&!e.shiftKey;if("decor"===this._mode){if((h||c)&&i)return;if(c)return e.preventDefault(),void this._redoGeometry();if(h)return e.preventDefault(),this._decorDraft?void(this._decorDraft=null):this._decorMove||this._dtDrag||this._bdDrag?void this._cancelDecorGesture():void this._undoGeometry();if(("Delete"===e.key||"Backspace"===e.key)&&this._decorSel&&!i&&!n)return e.preventDefault(),void this._decorDeleteSel();const t="ArrowLeft"===e.key?[-this._gridPitch,0]:"ArrowRight"===e.key?[this._gridPitch,0]:"ArrowUp"===e.key?[0,-this._gridPitch]:"ArrowDown"===e.key?[0,this._gridPitch]:null;return!t||r||e.altKey||"select"!==this._decorTool||!this._decorSel||!this._decorList.some(e=>e.id===this._decorSel)||this._decorDraft||this._decorMove||this._dtDrag||this._bdDrag||i||n||this._editorSecondaryDialogBlocked?void("Escape"===e.key&&(e.preventDefault(),this._decorDraft?this._decorDraft=null:this._decorMove||this._dtDrag||this._bdDrag?this._cancelDecorGesture():"furniture"===this._decorTool?(this._editorRuntime?._clearFurniturePreview(),this._editorRuntime?._furnShiftDetach(),this._furnPalette=null,this._furnCategory=null,this._decorTool="select"):this._decorSel?this._decorSel=null:"select"!==this._decorTool?this._decorTool="select":this._setMode("view"))):(e.preventDefault(),void this._decorNudge(t[0],t[1]))}if("devices"===this._mode){if((h||c)&&i)return;return c?(e.preventDefault(),void this._redoDevicePosition()):h?(e.preventDefault(),void this._undoDevicePosition()):void("Escape"===e.key&&this._deviceDrag&&(e.preventDefault(),this._cancelDeviceDrag()))}if(this._markup&&(!h&&!c||!i)){if(("Delete"===e.key||"Backspace"===e.key)&&this._physicalSel&&!i&&!n)return e.preventDefault(),void this._deletePhysicalSelection();if(c)return e.preventDefault(),void this._redoGeometry();if(h)return e.preventDefault(),this._resize?.dragging?void this._rszCancelDrag():this._wallFaceBatch?(this._roomDialogCancel(),void(this._activeWallChainId&&this._path.length>1?this._undoActiveWallPoint():this._undoPoint())):"draw"===this._tool&&this._path.length?void(this._activeWallChainId&&this._path.length>1?this._undoActiveWallPoint():this._undoPoint()):"split"===this._tool&&this._splitSel?.pts?.length?(this._splitSel={...this._splitSel,pts:this._splitSel.pts.slice(0,-1)},void(this._splitSel.pts.length||(this._cursorPt=null))):void this._undoGeometry();if("Escape"===e.key)return this._physicalDrag||this._physicalRotate?(e.preventDefault(),void this._cancelPhysicalGesture()):this._roomDialog?(e.preventDefault(),void this._roomDialogCancel()):"draw"===this._tool&&this._path.length?(e.preventDefault(),void this._finishWallChain()):this._physicalSel?(e.preventDefault(),void(this._physicalSel=null)):"resize"===this._tool?(e.preventDefault(),this._resize?.dragging?void this._rszCancelDrag():("exit-tool"===this._resize?.escapeIdle()&&(this._tool="draw"),void this.requestUpdate())):"split"===this._tool?(e.preventDefault(),void(this._splitSel?.pts?.length?(this._splitSel={...this._splitSel,pts:this._splitSel.pts.slice(0,-1)},this._splitSel.pts.length||(this._cursorPt=null)):this._splitSel?this._splitSel=null:this._tool="draw")):"merge"===this._tool?(e.preventDefault(),void(this._mergeSel?this._mergeSel=null:this._tool="draw")):this._wallDialog?(e.preventDefault(),void(this._wallDialog=null)):void("opening"!==this._tool&&"wallthick"!==this._tool&&"delroom"!==this._tool&&"column"!==this._tool||(e.preventDefault(),"opening"===this._tool&&this._clearOpeningPlacement(!0),this._tool="draw"))}}_undoPoint(){if(this._path.length)return this._contourClosed?(this._path=this._path.slice(0,-1),void(this._closingWallCm=null)):void(this._activeWallChainPartitionIds.length&&this._path.length>1?this._undoActiveWallPoint():this._path=this._path.slice(0,-1))}_undoActiveWallPoint(){const e=[...this._activeWallChainPartitionIds],t=e[e.length-1],i=this._spaceModel()?.partitions.find(e=>e.id===t),n=this._path[0]?[...this._path[0]]:null,r=this._path.slice(0,-1).map(e=>[...e]),o=this._wallChainSegmentCms.slice(0,-1),s=this._geometryHistory.undo();if(!s)return this._activeWallChainPartitionIds=[],this._wallChainSegmentCms=[],this._wallChainRedo=[],void(this._path=n?[n]:[]);this._applyGeometryState(s.before,!0)?(this._activeWallChainId||=`chain-${Date.now().toString(36)}`,this._activeWallChainPartitionIds=e.slice(0,-1),this._path=r.length?r:n?[n]:[],this._wallChainSegmentCms=o,i&&this._wallChainRedo.push({id:i.id,point:[...i.b],cm:i.cm}),this._clearPlanSnapHover(),this._showToast(this._t("history.undone",{name:s.name}))):this._geometryHistory.clear()}static async getConfigElement(){return await import("./editor-Bj456-QF.js"),document.createElement("houseplan-card-editor")}static getStubConfig(){return{type:"custom:houseplan-card"}}static _warmBootReset(e){for(const e of nv.values())for(const t of e)clearTimeout(t.evict);nv.clear(),ov=e&&e>0?e:1e4}static _warmBootStats(){let e=0,t=0;const i=[];for(const n of nv.values())for(const r of n)e++,r.dlg&&(t++,i.push(r.dlg.kind));return{keys:nv.size,slots:e,dlgs:t,drafts:i}}setConfig(e){const t=this._config,i=!!t&&Object.prototype.hasOwnProperty.call(t,"floor");this._config={icon_size:2.5,show_temperature:!0,live_states:!0,show_signal:!0,...e};(i!==this._hasFixedFloor||t?.floor!==this._config.floor)&&(this._hashApplied=!1,this._navApplied=!1,this._warmVpArmed=!1),this._config.kiosk&&(this._booting=!1,this._bootFading=!1),!this._hasFixedFloor&&e.default_floor&&this._commitSpace(e.default_floor,!0);try{this._zoomBySpace=JSON.parse(localStorage.getItem(lv)||"{}")||{}}catch{this._zoomBySpace={}}try{const e=JSON.parse(localStorage.getItem(hv)||"{}")||{};this._viewPreference=Object.fromEntries(Object.entries(e).filter(e=>"flat"===e[1]||"iso"===e[1]))}catch{this._viewPreference={}}if(this._labs=Hf(),this.isConnected&&this._labsIso&&this._ensureIsoSceneRuntime(),!this._summary?.applyLocalScaleForCurrentIdentity())try{const e=JSON.parse(localStorage.getItem("houseplan_card_kiosk_v1")||"null");this._kioskScale={icon:Bn(e?.icon),font:Bn(e?.font)}}catch{}try{const e=JSON.parse(localStorage.getItem(av)||"null");this._adoption.restoreCached(e)&&(this._seedDecorStyle(this._serverCfg),this._cfgEpoch++,this._virtualLights=Eh(e.virtual_lights,this._cfgRev),this._serverStorage=!0)}catch{}this._adoptInitialSpace(this._model,this._loadOk),"view"!==this._mode||this._view||(this._zoom=this._zoomBySpace[this._space]||1),this.isConnected&&(this._syncCycleTimer(),this._warmAdopt(),this._warmLongReturn&&this._beginResumeSettle(),this._warmLongReturn=!1),this._syncVersionRecovery()}_warmAdopt(){if(this._config?.kiosk)return;const e=Mf(this._config);if(this._warmKey===e&&this._warmSlot)return;this._warmSlot&&this._warmRelease();const t=this.parentNode,i=this._warmIdx(t),n=nv.get(e);if(!n||!n.length)return;const r=n.find(e=>e.owner===this._warmGen);if(r)return this._warmLongReturn=!!r.freed&&Date.now()-r.freed>=tc,clearTimeout(r.evict),r.evict=0,r.freed=0,r.live=!0,this._warmSlot=r,this._warmKey=e,r.frameFingerprint&&this._continuity.adoptCompleteFrame(r.frameFingerprint),void(!this._devices.length&&r.devices?.length&&(this._devices=[...r.devices]));const{slot:o,sure:s}=((e,t,i,n)=>{const r=e=>{const t=!!i&&e.place?.deref()===i;return t&&e.idx===n?4:e.live?0:t?3:2};let o=null,s=0,a=0,l=null;for(const i of e){if(i.owner===t)continue;l=i;const e=r(i);e<=0||(e>s?(o=i,s=e,a=1):e===s&&a++)}return!o||a>1?{slot:o||l,sure:!1}:{slot:o,sure:!0}})(n,this._warmGen,t,i);o&&(this._warmLongReturn=!!o.freed&&Date.now()-o.freed>=tc,this._booting=!1,this._bootFading=!1,this._hdrH=o.hdrH,this._bootSoft=!0,this.isConnected&&(clearTimeout(this._bootSoftTimer),this._bootSoftTimer=window.setTimeout(()=>{this._bootSoft=!1},iv)),this._warmKey=e,s?(clearTimeout(o.evict),o.evict=0,o.owner=this._warmGen,o.place=t?new WeakRef(t):null,o.idx=i,o.live=!0,this._warmSlot=o,this._warmVp=o.vp,o.frameFingerprint&&this._continuity.adoptCompleteFrame(o.frameFingerprint),!this._devices.length&&o.devices?.length&&(this._devices=[...o.devices]),this._warmAdoptViewport(this._config)):(this._warmSlot={owner:this._warmGen,path:location.pathname,place:t?new WeakRef(t):null,idx:i,live:!0,hdrH:o.hdrH,stageH:o.stageH,vp:null,frameFingerprint:"",devices:null,dlg:null,freed:0,evict:0},n.push(this._warmSlot),this._warmTrim(n)))}_warmIdx(e){const t=e?.children;if(!t)return-1;for(let e=0;e4;){const t=e.findIndex(e=>!e.live);if(t<0)break;clearTimeout(e[t].evict),e.splice(t,1)}}_warmScheduleEvict(e,t){if(clearTimeout(e.evict),!(e.dlg||e.vp&&"view"!==e.vp.mode))return;const i=e.freed,n=e.owner;e.evict=window.setTimeout(()=>{if(e.evict=0,e.freed!==i||e.owner!==n)return;var r;e.dlg=null,e.vp=(r=e.vp)&&"view"!==r.mode?{...r,mode:"view",zoom:r.snap?.space===r.space?r.snap.zoom:r.zoom,view:null,snap:null,tool:"draw",decorTool:"select",showHidden:!1,selId:null,rszSel:null,decorSel:null}:r,e.frameFingerprint="";const o=nv.get(t);if(!e.live&&o&&o.length>1){const t=o.indexOf(e);t>=0&&o.splice(t,1)}},ov+250)}_warmAdoptViewport(e){const t=this._warmVp;if(!t||this._warmSlot?.path!==location.pathname)return void(this._warmVp=null);const i=this._fixedFloorState();if(this._hashApplied||!this._model.find(e=>e.id===t.space)||"valid"===i.kind&&i.id!==t.space||this._hasFixedFloor&&"valid"!==i.kind)return void(this._warmVp=null);this._commitSpace(t.space,!0),this._navApplied=!0;const n="view"!==t.mode&&this._canEdit&&!e.kiosk?t.mode:"view";this._adoptMode("view"),this._pendingNavMode="view"===t.mode||this._canEdit||e.kiosk?null:t.mode,this._zoom=t.zoom;const r=this._effectiveProjection(),o=r===t.projection&&this._labsIso===t.activeLabsIso;if(this._view=o&&t.view?{...t.view}:null,this._viewModeSnap=o&&t.snap?{...t.snap}:null,!o&&t.logicalCenter){const e="iso"===r?sf([t.logicalCenter.x,t.logicalCenter.y],0):[t.logicalCenter.x,t.logicalCenter.y];this._applyView(t.zoom,e[0],e[1])}var s;this._tool="opening"===(s=function(e){return"partition"===e?"draw":e}(s=t.tool))?"draw":"string"==typeof s&&$f.has(s)?s:"draw",this._decorTool=t.decorTool,this._showHidden=t.showHidden,this._showFar!==t.showFar&&(this._showFar=t.showFar,this._frame=null),this._selId=t.selId,this._resize?.restoreSelection(t.rszSel),this._decorSel=t.decorSel,this._warmVpArmed=!0,"view"!==n&&this._requestMode(n,!1,!0)}_warmPatch(e,t=!1){if(this._config?.kiosk)return;const i=Mf(this._config);if(!this._warmSlot||this._warmKey===i){if(!this._warmSlot){if(!t)return;const e=this.parentNode;this._warmKey=i,this._warmSlot={owner:this._warmGen,path:location.pathname,place:e?new WeakRef(e):null,idx:this._warmIdx(e),live:!0,hdrH:this._hdrH,stageH:0,vp:null,frameFingerprint:"",devices:null,dlg:null,freed:0,evict:0};const n=nv.get(i)||[];for(n.push(this._warmSlot),nv.set(i,n),this._warmTrim(n);nv.size>8;){const e=nv.keys().next().value;if(void 0===e||e===i)break;for(const t of nv.get(e)||[])clearTimeout(t.evict);nv.delete(e)}}Object.assign(this._warmSlot,e)}}_warmViewportState(){const e=this._effectiveProjection();return{space:this._space,mode:this._mode,projection:e,activeLabsIso:this._labsIso,logicalCenter:this._logicalViewCenter(e),zoom:this._zoom,view:this._view?{...this._view}:null,snap:this._viewModeSnap?{...this._viewModeSnap}:null,tool:this._tool,decorTool:this._decorTool,showHidden:this._showHidden,showFar:this._showFar,selId:this._selId,rszSel:this._resize?.selectedRoomId,decorSel:this._decorSel}}_warmDialogState(){const e=(e,t)=>({kind:e,space:this._space,mode:this._mode,data:t});return this._tapConfirm||this._alignDialog||this._mergeDialog||this._importDialog||this._backupExportDialog||this._backupImportDialog?null:this._openingInfo?e("openingInfo",this._openingInfo.id):this._infoCard?e("info",this._infoCard.id):this._rulesDialog?this._rulesDialog.busy?null:e("rules",this._rulesDialog):this._settingsDialog?this._settingsDialog.busy?null:e("settings",this._settingsDialog):this._markerDialog?this._markerDialog.busy?null:e("marker",this._markerDialog):this._openingDialog?e("opening",this._openingDialog):this._backdropDialog?e("backdrop",this._backdropDialog):this._decorShapeDialog?e("decorShape",this._decorShapeDialog):this._decorTextDialog?e("decorText",this._decorTextDialog):this._roomDialog?e("room",{editId:this._roomEditId,fill:this._roomFill,customFill:this._roomCustomFill,tempMin:this._roomTempMin,tempMax:this._roomTempMax,tempSrc:this._roomTempSrc,humSrc:this._roomHumSrc,srcOpen:this._roomSrcOpen,srcFilter:this._roomSrcFilter,nameScale:this._roomNameScale,labelScale:this._roomLabelScale,areaSel:this._areaSel,nameSel:this._nameSel,pendingSplit:this._pendingSplit,wallFaceBatch:this._wallFaceBatch,path:this._path}):this._spaceDialog?this._spaceDialog.busy?null:e("space",this._spaceDialog):null}_warmSnapshot(){if(this._booting||this._config?.kiosk||"steady"!==this._continuity.state)return;const e={vp:this._warmViewportState(),frameFingerprint:this._continuity.frameFingerprint,devices:this._devices,hdrH:this._hdrH};if(this._warmRevivePending||(e.dlg=this._warmDialogState()),this.isConnected&&this._warmSlot?.owner===this._warmGen){const t=this.parentNode;e.place=t?new WeakRef(t):null,e.idx=this._warmIdx(t)}this._warmPatch(e)}_warmReviveDialog(){const e=this._warmSlot;if(this._warmReviveTimer=void 0,!e||!e.dlg)return void(this._warmRevivePending=!1);const t=e.dlg,i=e.freed;if(t.mode===this._mode||"view"===t.mode||this._warmVp?.mode!==t.mode||this._editorRuntime){if(this._warmRevivePending=!1,e.dlg=null,e.freed=0,clearTimeout(e.evict),e.evict=0,i&&!(Date.now()-i>ov)&&t.space===this._space&&t.mode===this._mode){switch(t.kind){case"space":this._spaceDialog={...t.data,busy:!1,savedBusy:!1};break;case"marker":this._markerDialog={...t.data,busy:!1};break;case"settings":this._settingsDialog={...t.data,busy:!1};break;case"rules":this._rulesDialog={...t.data,busy:!1};break;case"opening":this._openingDialog={...t.data};break;case"backdrop":this._backdropDialog={...t.data};break;case"decorShape":this._decorShapeDialog={...t.data};break;case"decorText":{this._decorTextDialog={...t.data};const e=String(this._decorTextDialog?.text??"").length;this._decorTextSelection={start:e,end:e};break}case"room":{const e=t.data;this._roomEditId=e.editId,this._roomFill=e.fill,this._roomCustomFill=e.customFill||null,this._roomTempMin=e.tempMin||"",this._roomTempMax=e.tempMax||"",this._roomTempSrc=e.tempSrc,this._roomHumSrc=e.humSrc,this._roomSrcOpen=e.srcOpen,this._roomSrcFilter=e.srcFilter,this._roomNameScale=e.nameScale,this._roomLabelScale=e.labelScale,this._areaSel=e.areaSel,this._nameSel=e.nameSel,this._pendingSplit=e.pendingSplit,this._wallFaceBatch=e.wallFaceBatch||null,this._path=e.path,this._wallFaceBatch&&(this._activeWallChainId=`chain-${Date.now().toString(36)}`,this._activeWallChainPartitionIds=[...this._wallFaceBatch.activePartitionIds],this._wallChainSegmentCms=[...this._wallFaceBatch.activeCms]),this._roomDialog=!0;break}case"info":{const e=this._devices.find(e=>e.id===t.data);e&&(this._infoCard=e);break}case"openingInfo":{const e=(this._curSpaceCfg?.openings||[]).find(e=>e.id===t.data);e&&(this._openingInfo=e);break}}this.requestUpdate()}}else this._warmRevivePending=!0}_cacheSnapshot(){if(this._serverCfg)try{this._virtualLights=function(e,t,i){if(e.configRev===i)return e;const n=new Set((Array.isArray(t?.markers)?t.markers:[]).filter(Lh).map(e=>e.id));return{...e,configRev:i,off:new Set([...e.off].filter(e=>n.has(e)))}}(this._virtualLights,this._serverCfg,this._cfgRev);const e=this._adoption.snapshot(function(e){return{rev:e.rev,config_rev:e.configRev,off:[...e.off].sort()}}(this._virtualLights));e&&localStorage.setItem(av,JSON.stringify(e))}catch{}}_beginContinuityCandidate(e,t,i="plan"){return this._booting&&!this._continuity.hasCompleteFrame?this._continuity.token:(this._continuityDataReady=t,this._continuityPaintToken=-1,this._stagedDeviceSnapshotToken=-1,this._resumeSettling=!0,this._continuity.beginCandidate(e,i))}_continuityStageValid(){const e=this._stageEl;return!!e&&e.clientWidth>0&&e.clientHeight>0}_versionReloadSafetySnapshot(){return kg(this)}_continuityAssetsReady(){if(!this._model.length)return!1;const e=this._model.length?this._spaceModel():null;return!e?.bg?.href||this._signer.isReady(this.hass,e.bg.href)}_initialSpaceSelection(e,t=this._loadOk){const i=this._fixedFloorState(e,t);return"valid"===i.kind?{id:i.id,source:"fixed"}:this._hasFixedFloor?{id:null,source:"none"}:function(e){const t=new Set(e.spaceIds.filter(e=>!!e));if(!t.size)return{id:null,source:"none"};const i=[["hash",!1===e.acceptHash?null:e.hashSpace],["current",e.preserveCurrent?e.currentSpace:null],["saved",e.savedSpace],["default",e.defaultSpace],["first",e.spaceIds[0]]];for(const[e,n]of i)if(n&&t.has(n))return{id:n,source:e};return{id:null,source:"none"}}({spaceIds:e.map(e=>e.id),hashSpace:this._hashSpace(),acceptHash:!this._hashApplied,currentSpace:this._space,preserveCurrent:this._hashApplied||this._navApplied||this._warmVpArmed,savedSpace:this._savedNav()?.space,defaultSpace:this._config?.default_floor})}_adoptInitialSpace(e,t=this._loadOk){const i=this._initialSpaceSelection(e,t);return i.id?(this._commitSpace(i.id,!0),"hash"===i.source&&(this._hashApplied=!0),"saved"===i.source&&(this._navApplied=!0),i):i}_candidateBackdrop(e,t=this._space){const i=Ya(e),n=this._fixedFloorState(i,!0);if(this._hasFixedFloor&&"valid"!==n.kind)return"";const r=this._initialSpaceSelection(i,!0).id||(i.some(e=>e.id===t)?t:i[0]?.id);return i.find(e=>e.id===r)?.bg?.href||""}_visualFrameFingerprint(){const e=this._stageEl,t=e?[e.clientWidth,e.clientHeight]:[0,0];return lc([this._cfgRev,this._adoption.currentConfigFingerprint(),this._layoutRev,this._adoption.currentLayoutFingerprint(),this._space,this._mode,this._view,t,this._glowScreenBlend?"screen":"normal",this.hass?.themes?.darkMode??this.hass?.themes?.default_theme??""])}_settleContinuityFrame(){if(this._booting||!this._continuityStageValid())return;if(!this._continuity.hasCompleteFrame&&"steady"===this._continuity.state)return void(this._continuityAssetsReady()&&(this._renderSnapshotAt=Date.now(),this._continuity.markCompleteFrame(this._visualFrameFingerprint())));if(!this._continuityDataReady)return;if(!["holding","offline-stale","overlay-pending","overlay-visible","candidate-ready"].includes(this._continuity.state))return;const e=this._continuity.token;if(this._candidateDeviceSnapshot&&this._candidateDeviceSnapshot!==this._visibleDeviceSnapshot&&this._stagedDeviceSnapshotToken!==e)return this._stagedDeviceSnapshotToken=e,void this.requestUpdate();this._continuityPaintToken!==e&&(this._continuityPaintToken=e,this._continuity.candidateReady(e)&&this._continuity.commitAfterPaint(e,{updateComplete:()=>this.updateComplete,stageValid:()=>this.isConnected&&this._continuityStageValid(),assetsReady:()=>this._continuityAssetsReady(),frameFingerprint:()=>this._visualFrameFingerprint()}).then(t=>{t&&e===this._continuity.token?(this._resumeSettling=!1,this._renderSnapshotAt=Date.now(),this._candidateDeviceSnapshot&&(this._visibleDeviceSnapshot=this._candidateDeviceSnapshot),this._candidateDeviceSnapshot=null,this._stagedDeviceSnapshotToken=-1,this._warmSnapshot()):e===this._continuity.token&&(this._continuityPaintToken=-1,this._stagedDeviceSnapshotToken=-1,this._candidateDeviceSnapshot=null,this.requestUpdate())}))}_onBackdropLoaded(e,t){this._signer.markLoaded(this.hass,e,t),this._continuity.note("asset-ready"),this._continuityPaintToken=-1,"steady"!==this._continuity.state&&this.requestUpdate()}_renderRecoveryOverlay(){if(!this._continuity.overlayVisible&&"recovery-error"!==this._continuity.state)return G;const e="connection"===this._continuity.recoveryReason;return j`
"houseplan-space-card"===e.type)||window.customCards.push({type:"houseplan-space-card",name:"House Plan — Space (static)",description:"Read-only live schematic of a single houseplan space, with a deep-link button.",preview:!1,documentation:"https://github.com/Matysh/houseplan-card"});const pg=o`:host{--hp-editor-tray-bg-fallback:color-mix(in srgb,var(--card-background-color,var(--hp-bg)) 94%,var(--hp-line));--hp-editor-tray-bg:color-mix(in srgb,var(--card-background-color,var(--hp-bg)) 86%,transparent);--hp-editor-tray-border:color-mix(in srgb,var(--hp-line) 82%,var(--hp-accent));--hp-editor-tray-blur:8px;--hp-editor-tray-shadow:var(--shadow-2);}.editor-secondary-host{position:absolute;inset:var(--sp-2) var(--sp-4) auto;z-index:70;display:flex;justify-content:flex-end;pointer-events:none;}.editor-secondary-host.kind-palette,.editor-secondary-host.kind-group{justify-content:flex-start;}.editor-secondary{pointer-events:none;max-width:100%;display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-3) var(--sp-4);color:var(--hp-txt);background:var(--card-background-color,var(--hp-bg));background:var(--hp-editor-tray-bg-fallback);border:1px solid var(--hp-line);border-color:var(--hp-editor-tray-border);border-radius:var(--rad-l);box-shadow:var(--hp-editor-tray-shadow);opacity:0;visibility:hidden;transform:translateY(-4px);transition:opacity 0.1s ease,transform 0.1s cubic-bezier(0.2,0.7,0.2,1),visibility 0s linear 0.1s;touch-action:auto;}.editor-secondary-host.open .editor-secondary{pointer-events:auto;opacity:1;visibility:visible;transform:translateY(0);transition-duration:0.14s,0.14s,0s;transition-delay:0s;}.editor-secondary-host.blocked .editor-secondary{pointer-events:none;}@supports ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){.editor-secondary{background:var(--hp-editor-tray-bg);-webkit-backdrop-filter:blur(var(--hp-editor-tray-blur));backdrop-filter:blur(var(--hp-editor-tray-blur));}}.editor-secondary-content,.editor-group-items{display:flex;align-items:center;gap:var(--sp-3);min-width:0;}.editor-context-label{max-width:14rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-inline-end:var(--sp-4);border-inline-end:1px solid var(--hp-line);color:var(--hp-muted);font-size:var(--fs-s);}.editor-secondary.kind-palette{width:min(760px,100%);align-items:stretch;padding:0;overflow:hidden;}.editor-secondary.kind-palette .editor-secondary-content,.editor-secondary.kind-palette .furnpalette{width:100%;}.editor-secondary.kind-palette .furnpalette{max-height:38vh;border:0;background:transparent;}.editor-group-launcher .group-chevron{--mdc-icon-size:16px;transition:transform 0.14s ease;}.editor-group-launcher[aria-expanded="true"] .group-chevron{transform:rotate(180deg);}.editor-secondary .bdhint{font-size:var(--fs-s);color:var(--hp-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.editor-secondary .dfill{display:inline-flex;align-items:center;gap:var(--sp-2);font-size:var(--fs-s);cursor:pointer;}.editor-secondary .dfill input[type="checkbox"]{width:16px;height:16px;flex:none;margin:0;padding:0;}.editor-secondary hp-color-opacity{flex:0 0 auto;}.editor-secondary input{width:74px;background:transparent;border:1px solid var(--hp-line);color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-m);}.editor-secondary label,.editor-secondary .hint{color:var(--hp-muted);font-size:var(--fs-s);}.editor-secondary .drawwall{display:inline-flex;align-items:center;gap:var(--sp-3);white-space:nowrap;}.editor-secondary .drawwall input{width:4.2em;}.editor-secondary .drawwall .opl{color:var(--hp-muted);font-size:var(--fs-s);}@container (min-width:560px) and (max-width:899px){.editor-secondary-content,.editor-group-items{flex-wrap:wrap;justify-content:flex-end;}}@container (max-width:559px){.editor-secondary-host{inset-inline:var(--sp-4);}.editor-secondary{max-width:100%;}.editor-secondary-content,.editor-group-items{overflow-x:auto;scrollbar-width:thin;}.editor-secondary-content>*,.editor-group-items>*{flex:none;}.editor-context-label{display:none;}}@media (prefers-reduced-motion:reduce){.editor-secondary{transition:none;}.editor-group-launcher .group-chevron{transition:none;}}`;class _g{constructor(e=50){this._undo=[],this._redo=[],this._limit=Math.max(30,Math.floor(e))}get canUndo(){return this._undo.length>0}get canRedo(){return this._redo.length>0}get undoName(){return this._undo[this._undo.length-1]?.name??null}get redoName(){return this._redo[this._redo.length-1]?.name??null}get size(){return this._undo.length}push(e){this._undo.push(e),this._undo.length>this._limit&&this._undo.splice(0,this._undo.length-this._limit),this._redo=[]}undo(){const e=this._undo.pop()??null;return e&&this._redo.push(e),e}redo(){const e=this._redo.pop()??null;return e&&this._undo.push(e),e}removeWhere(e){const t=this._undo.length,i=this._redo.length;return this._undo=this._undo.filter(t=>!e(t)),this._redo=this._redo.filter(t=>!e(t)),t+i-this._undo.length-this._redo.length}clear(){this._undo=[],this._redo=[]}}function mg(e,t){const i=e[t];return i&&Number.isFinite(i.x)&&Number.isFinite(i.y)?{x:i.x,y:i.y,..."string"==typeof i.s?{s:i.s}:{}}:null}function gg(e,t,i){if(null===i){if(!(t in e))return e;const i={...e};return delete i[t],i}const n={...e[t]||{}};delete n.x,delete n.y,delete n.s;const r={...n,x:i.x,y:i.y,...void 0!==i.s?{s:i.s}:{}};return{...e,[t]:r}}const fg="houseplan-card:version-reload-target:v1";function vg(e){if("string"!=typeof e)return null;return e.trim()||null}class yg{constructor(e){this.hooks=e,this._input={frontendVersion:null,backendVersion:null,kiosk:!1,reducedMotion:!1},this._relation={kind:"unknown"},this._banner=null,this._connected=!1,this._attemptTarget=null,this._attemptState=null,this._noticeToken=0}get relation(){return this._relation}get banner(){return this._banner}get hasCurrentMismatchNotice(){return"mismatch"===this._relation.kind&&"visible"===this._banner?.phase}connect(){this._connected||(this._connected=!0,this._attemptTarget=null,this._attemptState=null,this._reconcile())}disconnect(){(this._connected||this._banner)&&(this._connected=!1,this._cancelTimer(),this._banner&&(this._banner=null,this.hooks.changed()))}update(e){const t={frontendVersion:vg(e.frontendVersion),backendVersion:vg(e.backendVersion),kiosk:!0===e.kiosk,reducedMotion:!0===e.reducedMotion},i=function(e,t){const i=vg(e),n=vg(t);return i&&n?i===n?{kind:"equal",frontend:i,backend:n}:{kind:"mismatch",frontend:i,backend:n}:{kind:"unknown"}}(t.frontendVersion,t.backendVersion),n=!((e,t)=>e.frontendVersion===t.frontendVersion&&e.backendVersion===t.backendVersion&&e.kiosk===t.kiosk&&e.reducedMotion===t.reducedMotion)(this._input,t)||!((e,t)=>e.kind===t.kind&&("unknown"===e.kind||"unknown"!==t.kind&&e.frontend===t.frontend&&e.backend===t.backend))(this._relation,i);this._input=t,this._relation=i,n&&this._reconcile()}finishBannerExit(e){this._banner&&"leaving"===this._banner.phase&&this._banner.token===e&&(this._banner=null,this.hooks.changed())}_reconcile(){if(this._cancelTimer(),!this._connected||"mismatch"!==this._relation.kind)return this._attemptTarget=null,this._attemptState=null,void this._hideBanner();if(!this._input.kiosk)return this._attemptTarget=null,this._attemptState=null,void this._showBanner(this._relation.frontend,this._relation.backend);const e=this._relation.backend;if(this._attemptTarget===e&&null!==this._attemptState||(this._attemptTarget=e,this._attemptState=function(e,t){try{const i=e();return i?i.getItem(fg)===t?"attempted":"fresh":"unavailable"}catch{return"unavailable"}}(this.hooks.storage,e)),"fresh"===this._attemptState)return this._hideBanner(),void this._armTimer();this._showBanner(this._relation.frontend,e)}_armTimer(){this._connected&&void 0===this._timer&&"mismatch"===this._relation.kind&&this._input.kiosk&&"fresh"===this._attemptState&&(this._timer=this.hooks.clock.setTimeout(()=>{this._timer=void 0,this._tick()},250))}_cancelTimer(){void 0!==this._timer&&(this.hooks.clock.clearTimeout(this._timer),this._timer=void 0)}_tick(){if(!this._connected||"mismatch"!==this._relation.kind||!this._input.kiosk||"fresh"!==this._attemptState)return;if(!function(e){return e.connected&&e.initialFrameSettled&&e.viewOnly&&e.surfacesIdle&&e.configWritesIdle&&e.physicalWritesIdle&&e.layoutWritesIdle&&e.gesturesIdle&&e.interactionPauseElapsed&&e.baseZoom}(this.hooks.safety()))return void this._armTimer();const e=this._relation.backend,t=function(e,t){try{const i=e();return i?i.getItem(fg)===t?"attempted":(i.setItem(fg,t),"claimed"):"unavailable"}catch{return"unavailable"}}(this.hooks.storage,e);if(this._attemptTarget=e,this._attemptState="claimed"===t?"attempted":t,"claimed"===t){this._showBanner(this._relation.frontend,e);try{this.hooks.reload()}catch{}}else this._showBanner(this._relation.frontend,e)}_showBanner(e,t){"visible"===this._banner?.phase&&this._banner.frontend===e&&this._banner.backend===t||(this._banner={frontend:e,backend:t,phase:"visible",token:++this._noticeToken},this.hooks.changed())}_hideBanner(){if(this._banner)return this._input.reducedMotion?(this._banner=null,void this.hooks.changed()):void("leaving"!==this._banner.phase&&(this._banner={...this._banner,phase:"leaving",token:++this._noticeToken},this.hooks.changed()))}}const bg=1;function wg(e,t){const i=t&&"object"==typeof t?t:{};e._haIntegrationVersion=vg(i.integration_version);const n=i.support_api;e._haSupportApi="number"==typeof n&&Number.isSafeInteger(n)?n:null,e._haDecorAssetsApi=1===i.decor_assets_api?1:null,e._haSummaryPanelApi=1===i.summary_panel_api?1:null,e._haRadarStage1Api=1===i.radar_stage1_api?1:null,e._syncVersionRecovery()}function kg(e){const t=e._stageEl,i=e._loadOk&&!e._loading&&e._continuityDataReady&&!e._resumeSettling&&!e._connectionWasLost&&!e._booting&&!e._bootFading&&!e._bootSettling&&!e._bootSoft&&e._continuity.hasCompleteFrame&&"steady"===e._continuity.state&&!e._continuity.overlayBlocksInteraction&&!!t&&t.clientWidth>0&&t.clientHeight>0,n=!(0!==e._pointers.size||0!==e._touchContacts.size||e._touchSequenceMultitouch||e._roomPointer||e._panStart||e._panLock||e._pinchStart||e._swipeStart||e._tabDrag||e._tabDragRelease||e._drag||e._deviceDrag||e._rlResize||e._resize?.dragging||e._physicalDrag||e._physicalRotate||e._opDrag||e._decorDraft||e._decorMove||e._dtDrag||e._bdDrag||e._furnTouchPending||e._compassDrag||e._viewportGestureDirty||e._devicePositionBusy||e._modeTransitionBusy||e._cameraTransition.active||e._slide||0!==e._warmModeRequest),r=!(e._editorSecondaryDialogBlocked||e._partitionDeleteDialog||e._roomDeleteDialog||e._backdropGuard||e._vacFit||e._editorSecondary?.hasOpenGroup||e._furnPalette||e._decorImagePalette);return{connected:e.isConnected,initialFrameSettled:i,viewOnly:!0===e._config?.kiosk&&"view"===e._mode&&!e._editing,surfacesIdle:r,configWritesIdle:0===e._writesPending&&!e._saveConfigDebounced.pending(),physicalWritesIdle:0===e._pendingPhysicalWrites.size,layoutWritesIdle:!e._persistLayout.pending()&&0===e._dirtyPos.size&&0===e._sentPos.size&&!e._devicePositionBusy,gesturesIdle:n,interactionPauseElapsed:Date.now()>=e._cyclePausedUntil,baseZoom:e._zoom<=1.001}}class xg{constructor(){this.seen=null,this.diagnosticsCache=null}observe(e,t,i,n){this.invalidateDiagnosticsForHass(e,t,i),this.intake(t,n)}intake(e,t){e&&this.seen!==e&&(this.seen=e,t())}invalidate(){this.diagnosticsCache=null}invalidateDiagnosticsForHass(e,t,i){this.diagnosticsCache&&(e?.entities!==t?.entities||e?.devices!==t?.devices||[...i?.entityIds||[]].some(i=>!!e?.states?.[i]!=!!t?.states?.[i]))&&this.invalidate()}diagnostics(e,t,i){if(this.diagnosticsCache)return this.diagnosticsCache;const n={active:0,ha_disabled:0,orphaned:0,unverified:0};for(const e of t)e.removed||"virtual"===e.binding||n[i(e.binding).kind]++;return this.diagnosticsCache={registry:hd(e),bindings:n},this.diagnosticsCache}}function Sg(e){const t=e;t._hassSequence++,t._renderSnapshotAt=Date.now(),t._continuity.note("hass-snapshot"),t._ensureHaRegistryAuthority(),t._planHassMemo=null,t._hookConnection(),!t._loadOk&&!t._loading&&t._loadTries<8&&t._loadFromServer(),t._maybeRebuildDevices(),t._vacTick(),t._activityTick()}function $g(e){return!!e&&"object"==typeof e&&1===e.version}function Mg(e,t){const i=e.radar;return e.space===t&&!0!==e.hidden&&!0!==e.removed&&$g(i)&&!0===i.enabled&&!1!==i.show_live}const Rg={ok:"radar.health_ok",off:"radar.health_off",stale:"radar.health_stale",partial:"radar.health_partial",restricted:"radar.health_restricted",incomplete:"radar.health_incomplete",position_unavailable:"radar.health_position_unavailable",unavailable:"radar.health_unavailable",needs_setup:"radar.health_needs_setup",inconsistent:"radar.health_inconsistent",unknown:"radar.health_unknown"};const Cg=e=>"number"==typeof e&&Number.isFinite(e);class Tg{constructor(e){this.host=e,this.frames=new Map,this.connection=null,this.space="",this.generation=0,this.expiryTimer=0,this.deadlines=new Map}sync(e,t){const i=this.host.hass?.connection;if(!t||!i||!this.host.isConnected)return void this.stop();if(this.unsubscribe&&this.connection===i&&this.space===e)return;this.stop(),this.connection=i,this.space=e;const n=++this.generation,r=i.subscribeMessage?.bind(i);"function"==typeof r&&Promise.resolve(r(e=>{if(n!==this.generation||!this.host.isConnected)return;const t=function(e){if(!e||"object"!=typeof e)return null;const t=e;if("string"!=typeof t.marker_id||"string"!=typeof t.server_session_id||!Number.isSafeInteger(t.seq)||"string"!=typeof t.health)return null;const i=Array.isArray(t.targets)?t.targets.slice(0,256).flatMap(e=>{if(!e||"object"!=typeof e)return[];const t=e;return"string"==typeof t.slot&&Cg(t.x)&&Cg(t.y)&&Cg(t.expires_at)&&Cg(t.reported_at)&&("bounded_latest"===t.pair_quality||"coherent"===t.pair_quality)?[{...t,included:!0===t.included,smooth:!0===t.smooth}]:[]}):[],n=Array.isArray(t.ranges)?t.ranges.slice(0,64).flatMap(e=>{if(!e||"object"!=typeof e)return[];const t=e;if(!("string"==typeof t.id&&Cg(t.x)&&Cg(t.y)&&Cg(t.radius)&&Cg(t.expires_at)&&Cg(t.reported_at)))return[];const i=Array.isArray(t.segments)?t.segments.slice(0,64).flatMap(e=>{if(!Array.isArray(e))return[];const t=e.slice(0,181).flatMap(e=>Array.isArray(e)&&2===e.length&&Cg(e[0])&&Cg(e[1])?[[e[0],e[1]]]:[]);return t.length>=2?[t]:[]}):void 0;return[{...t,...i?{segments:i}:{}}]}):[],r=Array.isArray(t.zones)?t.zones.slice(0,64).flatMap(e=>{if(!e||"object"!=typeof e)return[];const t=e;if("string"!=typeof t.id)return[];const i=t.state;if(null!==i&&"boolean"!=typeof i&&!Cg(i))return[];const n=Array.isArray(t.polygon)?t.polygon.slice(0,64).flatMap(e=>Array.isArray(e)&&2===e.length&&Cg(e[0])&&Cg(e[1])?[[e[0],e[1]]]:[]):[];return[{id:t.id,state:i,...n.length>=3?{polygon:n}:{}}]}):[];return{server_session_id:t.server_session_id,marker_id:t.marker_id,source_generation:"string"==typeof t.source_generation?t.source_generation:void 0,calibration_revision:"string"==typeof t.calibration_revision?t.calibration_revision:void 0,seq:t.seq,reported_at:Cg(t.reported_at)?t.reported_at:void 0,expires_at:Cg(t.expires_at)?t.expires_at:void 0,health:t.health,reported_presence:"boolean"==typeof t.reported_presence?t.reported_presence:null,complete:!0===t.complete,targets:i,ranges:n,zones:r}}(e);if(!t)return;if(!function(e,t){return!e||t.server_session_id!==e.server_session_id||t.source_generation!==e.source_generation||t.calibration_revision!==e.calibration_revision||t.seq>e.seq}(this.frames.get(t.marker_id),t))return;const i=function(e,t=Date.now()){if(!Cg(e.expires_at))return null;if(!Cg(e.reported_at))return Math.max(0,1e3*e.expires_at-t);const i=Math.max(0,1e3*(e.expires_at-e.reported_at)),n=Math.max(0,t-1e3*e.reported_at);return Math.max(0,i-n)}(t);"restricted"===t.health||"disabled"===t.health||0===i?(this.frames.delete(t.marker_id),this.deadlines.delete(t.marker_id)):(this.frames.set(t.marker_id,t),null==i?this.deadlines.delete(t.marker_id):this.deadlines.set(t.marker_id,this.monotonicNow()+i)),this.armExpiry(),this.host.requestUpdate()},{type:"houseplan/radar/subscribe",space_id:e})).then(e=>{n===this.generation&&this.host.isConnected?"function"==typeof e&&(this.unsubscribe=e):"function"==typeof e&&e()}).catch(()=>{n===this.generation&&this.stop()})}stop(){this.generation++,this.unsubscribe?.(),this.unsubscribe=void 0,this.connection=null,this.space="",clearTimeout(this.expiryTimer),this.expiryTimer=0,this.frames.size&&(this.frames.clear(),this.host.isConnected&&this.host.requestUpdate()),this.deadlines.clear()}armExpiry(){clearTimeout(this.expiryTimer);const e=this.monotonicNow(),t=[...this.deadlines.values()].filter(t=>t>e);if(!t.length)return;const i=Math.max(20,Math.min(...t)-e+10);this.expiryTimer=window.setTimeout(()=>{this.expiryTimer=0;let e=!1;const t=this.monotonicNow();for(const[i,n]of this.deadlines)n>t||(this.deadlines.delete(i),this.frames.delete(i),e=!0);this.armExpiry(),e&&this.host.isConnected&&this.host.requestUpdate()},i)}monotonicNow(){return globalThis.performance?.now?.()??Date.now()}}const Dg=Object.freeze({enabled:!1,z2mBaseTopics:Object.freeze([])});function Ag(e){if("string"!=typeof e)return null;const t=e.trim().replace(/^\/+|\/+$/g,"").replace(/\/{2,}/g,"/");return!t||t.length>180||/[#+\u0000-\u001f\u007f]/.test(t)?null:t}function Pg(e){const t=e?.zigbee_topology;if(!t||"object"!=typeof t)return Dg;const i=t,n=Array.isArray(i.z2m_base_topics)?i.z2m_base_topics:Array.isArray(i.z2mBaseTopics)?i.z2mBaseTopics:[],r=new Set,o=[];for(const e of n){const t=Ag(e);if(t&&!r.has(t)&&(r.add(t),o.push(t),8===o.length))break}return{enabled:!0===i.enabled,z2mBaseTopics:o}}function Fg(e,t){const i={...e},n=t.z2mBaseTopics.map(Ag).filter(Boolean);return t.enabled||n.length?i.zigbee_topology={enabled:!0===t.enabled,z2m_base_topics:[...new Set(n)].slice(0,8)}:delete i.zigbee_topology,i}const zg={now:()=>performance.now(),requestFrame:e=>requestAnimationFrame(e),cancelFrame:e=>cancelAnimationFrame(e)},Ig=e=>Math.max(0,Math.min(1,e)),Og=(e,t,i)=>e+(t-e)*i,Eg=(e,t,i)=>{const n=1-e;return 3*n*n*e*t+3*n*e*e*i+e*e*e},Ng=e=>{const t=Ig(e);if(0===t||1===t)return t;let i=0,n=1,r=t;for(let e=0;e<12;e++)r=(i+n)/2,Eg(r,.2,.2)0&&e.w>0?t/e.w:1,viewBox:{...e}}}function Lg(e,t,i){const n=Math.max(1e-9,e.pixelsPerUnit),r=Math.max(1e-9,t/n),o=Math.max(1e-9,i/n);return{x:e.centerX-r/2,y:e.centerY-o/2,w:r,h:o}}function Bg(e){const t=e.trim(),i=/^rgba?\(\s*([\d.]+)[, ]+([\d.]+)[, ]+([\d.]+)(?:\s*[,/]\s*([\d.]+))?\s*\)$/i.exec(t);if(i)return[Number(i[1]),Number(i[2]),Number(i[3]),null==i[4]?1:Number(i[4])];const n=/^#([0-9a-f]{6}|[0-9a-f]{8})$/i.exec(t)?.[1];return n?[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16),8===n.length?parseInt(n.slice(6,8),16)/255:1]:null}function qg(e,t,i){const n=Bg(e),r=Bg(t);if(!n||!r)return i<.5?e:t;const o=Ig(i);return`rgba(${Math.round(Og(n[0],r[0],o))}, ${Math.round(Og(n[1],r[1],o))}, ${Math.round(Og(n[2],r[2],o))}, ${Og(n[3],r[3],o).toFixed(3)})`}class jg{constructor(e,t=zg){this._hooks=e,this._clock=t,this._token=0,this._raf=0,this._state=null}get state(){return this._state}get active(){return"running"===this._state?.phase||"preparing"===this._state?.phase}get presented(){return this._state?.presented||null}start(e,t,i,n=220){this.cancel(!1);const r=++this._token,o=this._clock.now();if(this._state={token:r,phase:n<=0?"settling":"running",from:e,to:t,presented:n<=0?t:e,startedAt:o,duration:Math.max(0,n),targetMode:i},n<=0)return this._hooks.frame(this._state),this._hooks.settled(this._state),this._state=null,r;this._hooks.frame(this._state);const s=e=>{const t=this._state;if(!t||t.token!==r)return;const i=Ig((e-t.startedAt)/t.duration);t.presented=i>=1?t.to:function(e,t,i){const n=Ng(i),r=Og(e.stageWidth,t.stageWidth,n),o=Og(e.stageHeight,t.stageHeight,n),s=Math.max(1e-9,e.viewport.pixelsPerUnit),a=Math.max(1e-9,t.viewport.pixelsPerUnit),l={centerX:Og(e.viewport.centerX,t.viewport.centerX,n),centerY:Og(e.viewport.centerY,t.viewport.centerY,n),pixelsPerUnit:Math.exp(Og(Math.log(s),Math.log(a),n))};return{presentedMode:n<.5?e.presentedMode:t.presentedMode,editorChromeHeight:Og(e.editorChromeHeight,t.editorChromeHeight,n),stageWidth:r,stageHeight:o,viewport:{...l,viewBox:Lg(l,r,o)},stageColor:qg(e.stageColor,t.stageColor,n),paperColor:qg(e.paperColor,t.paperColor,n),sceneBrightness:Og(e.sceneBrightness,t.sceneBrightness,n),architectureOpacity:Og(e.architectureOpacity,t.architectureOpacity,n),backdropOpacity:Og(e.backdropOpacity,t.backdropOpacity,n),viewWeight:Og(e.viewWeight,t.viewWeight,n),editorWeight:Og(e.editorWeight,t.editorWeight,n),toolbarContentOpacity:Og(e.toolbarContentOpacity,t.toolbarContentOpacity,n)}}(t.from,t.to,i),t.phase=i>=1?"settling":"running",this._hooks.frame(t),i<1?this._raf=this._clock.requestFrame(s):(this._raf=0,this._hooks.settled(t),this._state?.token===r&&(this._state=null))};return this._raf=this._clock.requestFrame(s),r}cancel(e=!0){this._raf&&this._clock.cancelFrame(this._raf),this._raf=0;const t=this._state;this._state=null,this._token++,t&&e&&(t.phase="settling",t.presented=t.to,this._hooks.frame(t),this._hooks.settled(t))}dispose(){this.cancel(!1)}}const Wg={now:()=>"undefined"!=typeof performance?performance.now():Date.now(),requestFrame:e=>"function"==typeof requestAnimationFrame?requestAnimationFrame(e):null,cancelFrame:e=>{"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(e)}},Ug=e=>Number.isFinite(e);function Gg(e){return!!e&&Ug(e.zoom)&&e.zoom>0&&Ug(e.viewBox.x)&&Ug(e.viewBox.y)&&Ug(e.viewBox.w)&&e.viewBox.w>0&&Ug(e.viewBox.h)&&e.viewBox.h>0}function Vg(e){return{zoom:e.zoom,viewBox:{...e.viewBox}}}function Kg(e,t){return Math.abs(e.zoom-t.zoom)<1e-9&&Math.abs(e.viewBox.x-t.viewBox.x)<1e-6&&Math.abs(e.viewBox.y-t.viewBox.y)<1e-6&&Math.abs(e.viewBox.w-t.viewBox.w)<1e-6&&Math.abs(e.viewBox.h-t.viewBox.h)<1e-6}const Yg=(e,t,i)=>e+(t-e)*i,Xg=(e,t,i)=>Math.exp(Yg(Math.log(e),Math.log(t),i));class Zg{constructor(e,t=Wg){this._hooks=e,this._clock=t,this._token=0,this._raf=null,this._state=null}get state(){return this._state}get active(){return"running"===this._state?.phase}get presented(){return this._state?.presented||null}get target(){return this._state?.to||null}start(e,t,i,n){this.cancel(!1);const r=++this._token,o=Vg(e),s=Vg(t),a=n>0&&Gg(o)&&Gg(s),l=this._clock.now(),c={token:r,phase:a?"running":"settling",from:o,to:s,presented:Vg(a?o:s),startedAt:l,duration:a?n:0,reason:i};if(this._state=c,this._hooks.frame(c),!a)return this._settle(r),r;const h=e=>{const t=this._state;if(!t||t.token!==r)return;const i=Math.max(0,Math.min(1,(e-t.startedAt)/t.duration));if(t.presented=i>=1?Vg(t.to):function(e,t,i){if(!Gg(e))return Vg(t);if(!Gg(t))return Vg(e);const n=Ng(i);if(n<=0)return Vg(e);if(n>=1)return Vg(t);const r=e.viewBox.x+e.viewBox.w/2,o=e.viewBox.y+e.viewBox.h/2,s=t.viewBox.x+t.viewBox.w/2,a=t.viewBox.y+t.viewBox.h/2,l=Xg(e.viewBox.w,t.viewBox.w,n),c=Xg(e.viewBox.h,t.viewBox.h,n),h=Yg(r,s,n),d=Yg(o,a,n);return{zoom:Xg(e.zoom,t.zoom,n),viewBox:{x:h-l/2,y:d-c/2,w:l,h:c}}}(t.from,t.to,i),t.phase=i>=1?"settling":"running",this._hooks.frame(t),i>=1)return this._raf=null,void this._settle(r);this._raf=this._clock.requestFrame(h),null===this._raf&&this._settle(r)};return this._raf=this._clock.requestFrame(h),null===this._raf&&(c.phase="settling",c.presented=Vg(s),this._hooks.frame(c),this._settle(r)),r}cancel(e=!0){null!==this._raf&&this._clock.cancelFrame(this._raf),this._raf=null;const t=this._state;this._state=null,this._token++,t&&e&&(t.phase="settling",t.presented=Vg(t.to),this._hooks.frame(t),this._hooks.settled(t))}dispose(){this.cancel(!1)}_settle(e){const t=this._state;t&&t.token===e&&(t.phase="settling",t.presented=Vg(t.to),this._hooks.settled(t),this._state?.token===e&&(this._state=null))}}function Jg(e,t,i){const n=e.querySelector("ha-card");if(!n)return null;const r=n.getBoundingClientRect(),o=t.getBoundingClientRect().top-r.top,s=i?0:Math.min(Math.max(r.top,0),120),a=Math.round(o+s);return a>=0?a:null}const Qg=Object.freeze({rotDeg:0,tiltDeg:20,xyScale:1,zScale:1,origin:Object.freeze([500,500])}),ef=84,tf=10,nf=4,rf=4;function of(e){return[e.rotDeg,e.tiltDeg,e.xyScale,e.zScale,e.origin[0],e.origin[1]].every(Number.isFinite)&&Math.abs(e.xyScale)>1e-12&&Math.abs(Math.cos(e.tiltDeg*Math.PI/180))>1e-12}function sf(e,t,i=Qg){if(!Number.isFinite(e[0])||!Number.isFinite(e[1]))throw new Error("invalid isometric projection input");return function(e,t){if(!Number.isFinite(e[0])||!Number.isFinite(e[1])||!t.every(Number.isFinite))throw new Error("invalid isometric affine input");const[i,n,r,o,s,a]=t;return[i*e[0]+r*e[1]+s,n*e[0]+o*e[1]+a]}(e,lf(t,i))}function af(e,t=Qg){if(!of(t)||!Number.isFinite(e[0])||!Number.isFinite(e[1]))throw new Error("invalid isometric projection input");const i=t.rotDeg*Math.PI/180,n=t.tiltDeg*Math.PI/180,r=(e[0]-t.origin[0])/t.xyScale,o=(e[1]-t.origin[1])/(t.xyScale*Math.cos(n));return[t.origin[0]+r*Math.cos(i)+o*Math.sin(i),t.origin[1]-r*Math.sin(i)+o*Math.cos(i)]}function lf(e=0,t=Qg){if(!of(t)||!Number.isFinite(e))throw new Error("invalid isometric camera");const i=t.rotDeg*Math.PI/180,n=t.tiltDeg*Math.PI/180,r=t.xyScale*Math.cos(i),o=-t.xyScale*Math.sin(i),s=t.xyScale*Math.sin(i)*Math.cos(n),a=t.xyScale*Math.cos(i)*Math.cos(n);return[r,s,o,a,t.origin[0]-r*t.origin[0]-o*t.origin[1],t.origin[1]-s*t.origin[0]-a*t.origin[1]-e*t.zScale*Math.sin(n)]}function cf(e=Qg){return function(e=0,t=Qg){return`matrix(${lf(e,t).map(e=>Number(e.toFixed(12))).join(" ")})`}(0,e)}function hf(e,t=Qg){const{rect:i,wallHeight:n}=e,r=e.openingHeight??n,o=e.floorDepth??0,s=e.raisedHeight??n;if(!(i.w>=0)||!(i.h>=0)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(s)||n<0||r<0||o<0||s<0)throw new Error("invalid isometric frame");const a=[[i.x,i.y],[i.x+i.w,i.y],[i.x+i.w,i.y+i.h],[i.x,i.y+i.h]],l=Math.max(n,r,s),c=a.flatMap(e=>[sf(e,-o,t),sf(e,l,t)]),h=c.map(e=>e[0]),d=c.map(e=>e[1]),u=Math.min(...h),p=Math.min(...d);return{x:u,y:p,w:Math.max(...h)-u,h:Math.max(...d)-p}}const df=[".dev",".vacpuck",".oplock",".op-hit",".opening",".rlgo","a","button","input","select","textarea",'[contenteditable]:not([contenteditable="false"])',"[data-room-fit-block]",'[role="link"]','[role="button"]'].join(","),uf=(e,t)=>{try{return"function"==typeof e?.matches&&e.matches(t)}catch{return!1}};function pf(e){for(const t of e){const e=t;if(uf(e,".roomlabel[data-id]")){const t=e.getAttribute?.("data-id");return t?{kind:"room",roomId:t}:{kind:"interactive"}}if(uf(e,df))return{kind:"interactive"};if(uf(e,'[data-hp="room"][data-id]')){const t=e.getAttribute?.("data-id");return t?{kind:"room",roomId:t}:{kind:"interactive"}}if(uf(e,".stage"))return{kind:"background"}}return{kind:"outside"}}function _f(e){const t=pf(e);return"room"===t.kind?t.roomId:null}class mf{constructor(){this.pointer=null,this.sequence=null}clear(){this.pointer=null,this.sequence=null}clearOutside(e){let t={kind:"outside"};try{t=pf(e.composedPath())}catch{}"outside"===t.kind&&this.clear()}pointerDown(e,t,i){let n={kind:"outside"};try{n=pf(e.composedPath())}catch{}this.pointer=function(e){const t="mouse"===(i=e.pointerType)||"touch"===i||"pen"===i?i:null;var i;return t&&"view"===e.mode&&"background"===e.owner.kind&&!e.blocked&&e.isPrimary&&0===e.button&&Number.isFinite(e.x)&&Number.isFinite(e.y)?{pointerId:e.pointerId,spaceId:e.spaceId,modality:t,x:e.x,y:e.y}:null}({pointerId:e.pointerId,pointerType:e.pointerType,isPrimary:e.isPrimary,button:e.button,spaceId:t,mode:i?"view":"blocked",owner:n,blocked:!i,x:e.clientX,y:e.clientY}),this.pointer||(this.sequence=null)}pointerUp(e,t,i,n,r=Date.now()){let o={kind:"outside"};try{o=pf(e.composedPath())}catch{}const s=function(e,t,i){if(!t||"view"!==i.mode||"background"!==i.owner.kind||i.blocked||t.pointerId!==i.pointerId||t.spaceId!==i.spaceId||!Number.isFinite(i.x)||!Number.isFinite(i.y)||!Number.isFinite(i.now)||Math.abs(i.x-t.x)+Math.abs(i.y-t.y)>=8)return{sequence:null,trigger:!1};const n=e?i.now-e.at:Number.POSITIVE_INFINITY;return e&&e.spaceId===i.spaceId&&e.modality===t.modality&&n>=0&&n<=350?{sequence:null,trigger:!0}:{sequence:{at:i.now,spaceId:i.spaceId,modality:t.modality},trigger:!1}}(this.sequence,this.pointer,{pointerId:e.pointerId,spaceId:t,mode:i?"view":"blocked",owner:o,blocked:n||!i,x:e.clientX,y:e.clientY,now:r});return this.pointer=null,this.sequence=s.sequence,s.trigger}}const gf=e=>e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1]);function ff(e){return!!e&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.w)&&e.w>0&&Number.isFinite(e.h)&&e.h>0}function vf(e,t=0){if(!e.length||!Number.isFinite(t)||t<0||!e.every(gf))return null;let i=1/0,n=1/0,r=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t[0]),n=Math.min(n,t[1]),r=Math.max(r,t[0]),o=Math.max(o,t[1]);const s=r-i,a=o-n;return s>0&&a>0?{x:i-t,y:n-t,w:s+2*t,h:a+2*t}:null}function yf(e,t,i){const n="string"!=typeof t||"invalid"!==t&&"no-borders"!==t&&"unverified"!==t&&!/^[a-z0-9]{1,8}$/i.test(t)?"redacted":t;return Object.freeze({kind:e,fingerprint:n,terminal:!!i})}function bf(e,t){return`${e("editor.load_failed")} ${e(t.terminal?"editor.refresh_advice":"editor.retry_advice")}`}class wf extends Error{}class kf{constructor(e){this.options=e,this._state="idle",this._inFlight=null}get state(){return this._state}ensure(){return"ready"===this._state?Promise.resolve(!0):"failed"===this._state?Promise.resolve(!1):(this._inFlight||(this._setState("loading"),this._inFlight=this._loadWithRetry().finally(()=>{this._inFlight=null})),this._inFlight)}async _loadWithRetry(){let e=new Error("Editor runtime did not load"),t=!1;for(const i of[0,1])try{const e=await this.options.load(i);if(e.fingerprint!==this.options.expectedFingerprint)throw new wf(`Editor runtime fingerprint mismatch: expected ${this.options.expectedFingerprint}, got ${e.fingerprint}`);const t=e.create();return this.options.install(t),this._setState("ready"),!0}catch(i){e=i,i instanceof wf&&(t=!0)}return this._setState(t?"failed":"idle"),this.options.failed?.(e,{terminal:t}),!1}_setState(e){e!==this._state&&(this._state=e,this.options.stateChanged?.(e))}}const xf=(e,t)=>{if(!e.has(t))return{hit:!1};const i=e.get(t);return e.delete(t),e.set(t,i),{hit:!0,value:i}},Sf=(e,t,i,n)=>{for(e.delete(t),e.set(t,i);e.size>n;){const t=e.keys().next().value;if(void 0===t)break;e.delete(t)}},$f=new Set(["select","draw","column","merge","split","resize","opening","wallthick","delroom"]),Mf=e=>`${window.innerWidth}x${window.innerHeight}|${location.pathname}|${JSON.stringify(e??{})}`,Rf="houseplan_card_alpha_v1",Cf=Object.freeze([Object.freeze({id:"iso",issue:89,summary:"Volumetric plan renderer"})]);function Tf(e){return/^[a-z][a-z0-9-]*$/.test(e.id)&&Number.isInteger(e.issue)&&e.issue>0&&!!e.summary.trim()}function Df(e){const t=String(e||"").replace(/^#/,"");return new URLSearchParams(t)}function Af(e){return Df(e).get("space")||""}function Pf(e,t,i=Cf){const n=function(e){const t=new Set;for(const i of e){if(!Tf(i)||t.has(i.id))return!1;t.add(i.id)}return!0}(i),r=function(e){let t,i=!1;const n=e=>{for(const n of e.getAll("hp_alpha"))i=!0,"1"===n?t=!0:"0"===n&&(t=!1)};return n(new URLSearchParams(String(e.search||"").replace(/^\?/,""))),n(Df(e.hash)),{present:i,value:t}}(e),o=void 0!==r.value,s="1"===t,a=o?!0===r.value:!r.present&&s,l=n&&a;return{alpha:l,active:Object.freeze(l?i.map(e=>e.id).sort():[]),space:Af(e.hash),persist:n&&o?l?"1":"0":void 0,knownUrlOperation:o}}let Ff={alpha:!1,active:Object.freeze([]),space:""},zf=!1,If="";const Of=new Set;function Ef(){if("undefined"==typeof window)return Ff;const e=Pf(window.location,function(){try{return window.localStorage.getItem(Rf)}catch{return null}}());void 0!==e.persist&&function(e){try{window.localStorage.setItem(Rf,e)}catch{}}(e.persist),Ff={alpha:e.alpha,active:e.active,space:e.space},window.__hpAlpha=e.alpha,window.__hpLabs=e.active;for(const e of Of)e(Ff);return Ff}function Nf(){Ef()}function Hf(){if("undefined"==typeof window)return Ff;if(!zf){zf=!0,window.__hpLabsListenerCleanup?.(),window.addEventListener("hashchange",Nf),window.addEventListener("popstate",Nf);const e=()=>{window.removeEventListener("hashchange",Nf),window.removeEventListener("popstate",Nf),window.__hpLabsListenerCleanup===e&&delete window.__hpLabsListenerCleanup};window.__hpLabsListenerCleanup=e}return Ef()}const Lf={window:120,door:90,passage:90,gate:300};function Bf(e){return Lf[e]}function qf(e,t){return{type:e,lengthCm:Bf(e),flipH:!1,flipV:!1,revision:t}}function jf(e,t){const i=Math.max(0,e.renderedLength)/2,n=Math.max(0,e.target.physicalHalfWidth),r=n+.18*Math.max(0,t),o=e=>({x1:e,y1:-r,x2:e,y2:r});return{rect:{x:-i,y:n?-n:0,width:2*i,height:2*n},boundaries:[o(-i),o(i)]}}function Wf(e,t){const i=[e[0],e[1]],n=[t[0],t[1]];return function(e,t){return e[0]-t[0]||e[1]-t[1]}(i,n)<=0?{a:i,b:n}:{a:n,b:i}}function Uf(e){const t=new Map;return e.forEach((e,i)=>{if(!e.kind||e.open)return;const n=Wf(e.a,e.b);if(Math.hypot(n.b[0]-n.a[0],n.b[1]-n.a[1])<=1e-9)return;const r=function(e,t){const i=e=>(Math.abs(e)<=5e-10?0:Math.round(1e6*e)/1e6).toFixed(6);return`${i(e[0])},${i(e[1])}>${i(t[0])},${i(t[1])}`}(n.a,n.b),o=t.get(r);if(o)return o.physicalHalfWidth=Math.max(o.physicalHalfWidth,e.half||0),o.sourceOrder=Math.min(o.sourceOrder,i),void(e.partitionHost&&(o.partitionHost&&o.partitionHost.id!==e.partitionHost.id?o.ambiguousPartitionHost=!0:o.partitionHost=e.partitionHost));t.set(r,{segmentKey:r,a:n.a,b:n.b,physicalHalfWidth:Math.max(0,e.half||0),sourceOrder:i,...e.partitionHost?{partitionHost:e.partitionHost}:{}})}),[...t.values()]}function Gf(e,t){if(Math.abs(e.distance-t.distance)>1e-9)return e.distance-t.distance;if(Math.abs(e.perpendicular-t.perpendicular)>1e-9)return e.perpendicular-t.perpendicular;return(e.target.segmentKeyt.target.segmentKey?1:0)||e.target.sourceOrder-t.target.sourceOrder}function Vf(e){const t=Uf(e.intervals).map(t=>{const i=function(e,t){const i=t.b[0]-t.a[0],n=t.b[1]-t.a[1],r=Math.hypot(i,n),o=i/r,s=n/r,a=(e[0]-t.a[0])*o+(e[1]-t.a[1])*s,l=Math.max(0,Math.min(r,a)),c=t.a[0]+l*o,h=t.a[1]+l*s;return{along:l,length:r,x:c,y:h,distance:Math.hypot(e[0]-c,e[1]-h),perpendicular:Math.abs((e[0]-t.a[0])*s-(e[1]-t.a[1])*o)}}(e.pointer,t);return{target:t,...i,envelope:Math.max(e.baseTolerance,t.physicalHalfWidth+e.bodyPointerPadding)}}).filter(e=>e.distance<=e.envelope+1e-9).filter(t=>!function(e,t,i,n,r){const o=t.b[0]-t.a[0],s=t.b[1]-t.a[1],a=Math.hypot(o,s);if(!(a>1e-9))return!1;const l=o/a,c=s/a;for(const o of i){if(!o.open&&o.kind)continue;const i=Wf(o.a,o.b),s=i.b[0]-i.a[0],a=i.b[1]-i.a[1],h=Math.hypot(s,a);if(!(h>1e-9))continue;const d=s/h,u=a/h;if(Math.abs(l*u-c*d)>1e-6)continue;if(Math.abs((i.a[0]-t.a[0])*c-(i.a[1]-t.a[1])*l)>r)continue;const p=(e[0]-i.a[0])*d+(e[1]-i.a[1])*u,_=1e-9;if(!(p<=_||p>=h-_)&&Math.abs((e[0]-i.a[0])*u-(e[1]-i.a[1])*d)<=n+1e-9)return!0}return!1}(e.pointer,t.target,e.intervals,t.envelope,Math.max(1e-9,Math.min(e.baseTolerance,.04*e.gridStep)))),i=t.filter(t=>!!t.target.partitionHost&&e.renderedLength+2*t.target.physicalHalfWidth>t.length+1e-9).sort(Gf),n=t.filter(t=>!t.target.partitionHost||e.renderedLength+2*t.target.physicalHalfWidth<=t.length+1e-9).sort(Gf);let r=n[0];if(!r)return{candidate:null,jambBlockedTarget:i[0]?.target||null};const o=n.filter(e=>Math.abs(e.distance-r.distance)<=1e-9&&Math.abs(e.perpendicular-r.perpendicular)<=1e-9),s=o.filter(e=>e.target.partitionHost);if(s.length){if(1!==new Set(s.map(e=>e.target.partitionHost.id)).size||s.some(e=>e.target.ambiguousPartitionHost))return{candidate:null,jambBlockedTarget:null};const e=s[0],t=e.target.b[0]-e.target.a[0],i=e.target.b[1]-e.target.a[1],n=Math.hypot(t,i),a=t/n,l=i/n;if(!o.every(t=>{const i=t.target.b[0]-t.target.a[0],n=t.target.b[1]-t.target.a[1],r=Math.hypot(i,n),o=i/r,s=n/r,c=Math.abs(a*s-l*o)<=1e-6,h=Math.abs((t.target.a[0]-e.target.a[0])*l-(t.target.a[1]-e.target.a[1])*a);return c&&h<=1e-9}))return{candidate:null,jambBlockedTarget:null};r=e}if(r.target.ambiguousPartitionHost)return{candidate:null,jambBlockedTarget:null};const{target:a,length:l}=r,c=a.b[0]-a.a[0],h=a.b[1]-a.a[1],d=c/l,u=h/l,p=a.partitionHost?a.physicalHalfWidth:0,_=Math.min(Math.max(0,e.renderedLength)/2+p,l/2);let m=r.along;const g=Math.max(e.gridStep,1e-9),f=l/2;m=Math.abs(m-f)<=g/2?f:Math.round(m/g)*g,m=Math.max(_,Math.min(l-_,m));const v=a.a[0]+d*m,y=a.a[1]+u*m,b=Math.max(0,e.renderedLength)/2,w=m-b,k=m+b,x=Math.max(0,w),S=Math.max(0,l-k),$=[a.a[0]+d*(w-x/2),a.a[1]+u*(w-x/2)],M=[a.a[0]+d*(k+S/2),a.a[1]+u*(k+S/2)];let R=180*Math.atan2(h,c)/Math.PI;R>=90?R-=180:R<-90&&(R+=180);const C=Math.abs(m-f)<=1e-9;return{candidate:{presetRevision:e.preset.revision,geometryRevision:e.geometryRevision,pointer:[e.pointer[0],e.pointer[1]],type:e.preset.type,lengthCm:e.preset.lengthCm,flipH:e.preset.flipH,flipV:e.preset.flipV,x:v,y:y,angle:R,renderedLength:e.renderedLength,target:a,...a.partitionHost?{host:{...a.partitionHost,t:l>0?m/l:0}}:{},measure:{labels:[{distance:x,midpoint:$},{distance:S,midpoint:M}],guide:C?{x:v,y:y,angle:R}:null}},jambBlockedTarget:null}}function Kf(e,t,i,n,r=1e-6){return e.presetRevision===i&&e.geometryRevision===n&&Math.hypot(e.pointer[0]-t[0],e.pointer[1]-t[1])<=r}function Yf(e){return!(!e.canEdit||e.kiosk||e.fixedFloor)&&("view"!==e.mode&&("mouse"===e.pointerType&&e.spaceCount>1))}class Xf{constructor(e,t,i){this.loader=e,this.host=t,this.adopted=i,this.attachment=null}connect(){if(this.runtime)return void this.runtime.connect();this.attachment?.cancel();const e=this.loader.attach(this.host,e=>this.adopt(e));this.runtime||(this.attachment=e)}disconnect(){this.attachment?.cancel(),this.attachment=null,this.runtime?.disconnect()}adopt(e){this.attachment=null,this.runtime||(this.runtime=e,this.adopted(e))}}const Zf=new class{constructor(e){this.load=e,this.factory=null,this.pending=null}get warm(){return null!==this.factory}create(e){return this.factory?this.factory(e):null}attach(e,t){let i=!0;const n={cancel:()=>{i=!1}},r=this.create(e);return r?(t(r),n):(this.ensure().then(n=>{i&&t(n(e))},()=>{}),n)}ensure(){return this.factory?Promise.resolve(this.factory):(this.pending||(this.pending=this.load().then(e=>(this.factory=e,this.pending=null,e),e=>{throw this.pending=null,e})),this.pending)}reset(){this.factory=null,this.pending=null}}(()=>import("./summary-panel-runtime-loaded-DQykYOsg.js").then(function(e){return e.e}).then(({LoadedSummaryPanelRuntime:e})=>t=>new e(t)));function Jf(e){const t=globalThis.__HP_VERSION_OVERRIDE__;return"string"==typeof t&&t.length>0?t:e}let Qf=0;const ev="1.76.0-beta.2",tv="012abf4b3924ad03971870eb8085ab1ac1a66b0d9b6676fe095285a8b0f201ab",iv=1500,nv=new Map;let rv=0,ov=1e4;const sv="houseplan_card_layout_v1",av="houseplan_card_cfg_v1",lv="houseplan_card_zoom_v1",cv="houseplan_card_nav_v1",hv="houseplan_card_view_v1",dv="hp-dialog, hp-help, hp-color-opacity, hp-device-preview",uv=1e3,pv=(e,t)=>{const i=Math.min(e.x,t.x),n=Math.min(e.y,t.y);return{x:i,y:n,w:Math.max(e.x+e.w,t.x+t.w)-i,h:Math.max(e.y+e.h,t.y+t.h)-n}},_v=(e,t,i)=>{const n=new Event(t,{bubbles:!0,composed:!0});n.detail=i??{},e.dispatchEvent(n)},mv=e=>{history.pushState(null,"",e),_v(window,"location-changed",{replace:!1})},gv=(e,t)=>{let i,n=null;const r=(...r)=>{clearTimeout(i),n=r,i=window.setTimeout(()=>{i=void 0;const t=n;n=null,t&&e(...t)},t)};return r.flush=()=>{if(void 0===i)return;clearTimeout(i),i=void 0;const t=n;n=null,t&&e(...t)},r.cancel=()=>{clearTimeout(i),i=void 0,n=null},r.pending=()=>void 0!==i,r},fv=e=>{try{e.target?.setPointerCapture?.(e.pointerId)}catch{}},vv=["edges","corners"];class yv extends he{constructor(){var e;super(...arguments),this._editorRuntime=null,this._liveRt=null,this._onboardingRuntime=null,this._editorRuntimeLoadingVisible=!1,this._backdropGuard=null,this._editorModeRequest=0,this._warmModeRequest=0,this._editorRuntimeLoader=new kf({expectedFingerprint:tv,load:async e=>{const t=0===e?await import("./houseplan-editor-runtime-CJrrYe2p.js"):await import((()=>{const e=new URL("./houseplan-editor-runtime-CJrrYe2p.js",import.meta.url);return e.searchParams.set("hp_retry",`${ev}-${++Qf}`),e.href})());return{fingerprint:t.EDITOR_RUNTIME_FINGERPRINT,create:()=>new t.HouseplanEditorRuntime(this)}},install:e=>{this._editorRuntime=e},stateChanged:e=>this._editorRuntimeStateChanged(e),failed:(e,t)=>{console.error("[houseplan] unable to load editor runtime",e),t.terminal&&this._versionRecovery.hasCurrentMismatchNotice||this._showToast(bf(e=>this._t(e),t))}}),this._onboardingRuntimeLoader=new kf({expectedFingerprint:tv,load:async e=>{const t=0===e?await import("./houseplan-onboarding-runtime-B9DTOO67.js"):await import((()=>{const e=new URL("./houseplan-onboarding-runtime-B9DTOO67.js",import.meta.url);return e.searchParams.set("hp_retry",`${ev}-${++Qf}`),e.href})());return{fingerprint:t.ONBOARDING_RUNTIME_FINGERPRINT,create:()=>new t.HouseplanOnboardingRuntime(this)}},install:e=>{this._onboardingRuntime=e},failed:(e,t)=>{console.error("[houseplan] unable to load onboarding runtime",e),t.terminal&&this._versionRecovery.hasCurrentMismatchNotice||this._showToast(bf(e=>this._t(e),t))}}),this._isoSceneRuntime=null,this._isoSceneRuntimeLoader=new kf({expectedFingerprint:tv,load:async e=>{const t=0===e?await import("./iso-scene-render-Bgw9qRET.js"):await import((()=>{const e=new URL("./iso-scene-render-Bgw9qRET.js",import.meta.url);return e.searchParams.set("hp_retry",`${ev}-${++Qf}`),e.href})());return{fingerprint:t.ISO_SCENE_RUNTIME_FINGERPRINT,create:()=>t}},install:e=>{const t=this._effectiveProjection();this._isoSceneRuntime=e,this._isoProjectionSnapshot=null;const i=this._effectiveProjection();this._convertProjectionView(t,i),this.isConnected&&this.requestUpdate()},failed:(e,t)=>{console.warn("[houseplan] hidden isometric runtime diagnostic",yf("runtime-load","unverified",t.terminal)),this.isConnected&&this.requestUpdate()}}),this._pdfRuntime=null,this._pdfRuntimeLoader=new kf({expectedFingerprint:tv,load:async e=>{const t=0===e?await import("./pdf-export-BYCIg7JD.js"):await import((()=>{const e=new URL("./pdf-export-BYCIg7JD.js",import.meta.url);return e.searchParams.set("hp_retry",`${ev}-${++Qf}`),e.href})());return{fingerprint:t.PDF_EXPORT_FINGERPRINT,create:()=>new t.PdfExportRuntime}},install:e=>{this._pdfRuntime=e,this.isConnected&&this.requestUpdate()},failed:(e,t)=>{if(console.error("[houseplan] unable to load PDF export runtime",e),!t.terminal||!this._versionRecovery.hasCurrentMismatchNotice){const e=bf(e=>this._t(e),t),i=this._t("editor.load_failed"),n=e.startsWith(i)?e.slice(i.length).trim():e;this._showToast(`${this._t("pdf.failed")} ${n}`.trim())}}}),this.panelHost=!1,this.narrow=null,this._space="f1",this._adoption=new Lu((e,t)=>this.requestUpdate(e,t)),this._serverStorage=!1,this._loadOk=!1,this._serverCanWrite=null,this._loading=!1,this._loadTries=0,this._unsubCfg=null,this._unsubLayout=null,this._unsubVirtual=null,this._liveSyncAttempt=null,this._liveSyncGeneration=0,this._liveSyncConnection=null,this._configReloadAuthority=new Wu,this._virtualLights=Eh(null),this._canOptimizeUndo=!1,this._undoKind=null,this._devices=[],this._regSignature="",this._defPos={},this._newSyncKey="",this._areaRelocationIds=new Set,this._areaSnapshotCleanupCandidates=new Map,this._areaRelocationSyncKey="",this._areaRelocationWrite=Promise.resolve(),this._tip=null,this._hoverRoom=null,this._pointerModality=new rg(this,()=>this._syncPointerHoverTargets()),this._devicePressAnimations=new Map,this._selId=null,this._toast="",this._mode="view",this._pendingNavMode=null,this._decorTool="select",this._decorStyle={...xr},this._decorStyleSeeded=!1,this._decorDraft=null,this._decorMove=null,this._decorSel=null,this._decorEraseConfirm=null,this._decorTextDialog=null,this._decorShapeDialog=null,this._backdropDialog=null,this._decorTextSelection={start:0,end:0},this._furnPalette=null,this._decorImagePalette=null,this._decorAssetCatalog=[],this._decorAssets=new Map,this._decorAssetBusy=!1,this._furnCategory=null,this._furnPreviewInput=null,this._furnTouchPending=null,this._dtBox=null,this._dtDrag=null,this._bdDrag=null,this._slide="",this._reducedMotion=!1,this._onMotionChange=e=>{this._reducedMotion=e.matches,this._cancelDevicePressFeedback(),e.matches&&this._cancelCameraTransition(!0),e.matches&&this._modeTransitionPreparing?this._modeTransitionForceAtomic=!0:e.matches&&this._modeTransition.active&&this._cancelModeTransition(!0),this._syncVersionRecovery(),this.requestUpdate()},this._editorChromeMode="plan",this._modeTransitionVisual=null,this._modeTransitionPreparing=!1,this._modeTransitionForceAtomic=!1,this._modeTransitionRequest=0,this._modeTransitionTargetZoom=1,this._modeTransitionEditorCamera=null,this._modeTransition=new jg({frame:e=>this._applyModeTransitionFrame(e),settled:e=>this._settleModeTransition(e)}),this._cameraTransitionFit=null,this._cameraTransition=new Zg({frame:e=>this._applyCameraTransitionFrame(e),settled:e=>this._settleCameraTransition(e)}),this._editorSecondaryCopy={groupActive:(e,t)=>this._t("editor.group_active",{group:e,item:t}),openGroup:e=>this._t("editor.open_group",{group:e}),disabledAction:(e,t)=>this._t("editor.disabled_action",{action:e,reason:t})},this._tool="draw",this._geometryHistory=new _g(50),this._devicePositionHistory=new _g(50),this._devicePositionBusy=!1,this._wallDialog=null,this._drawWallField=null,this._activeWallChainId=null,this._activeWallChainPartitionIds=[],this._wallChainRedo=[],this._physicalSel=null,this._physicalDialog=null,this._partitionDeleteDialog=null,this._roomDeleteDialog=null,this._physicalDrag=null,this._physicalRotate=null,this._physicalLastTap=null,this._physicalPickCycle=null,this._wallUnionCacheValue=null,this._wallUnionPool=new Map,this._isoGeometryCache=new Map,this._renderIsoScene=null,this._isoProjectionSnapshot=null,this._isoStructuralBuildCount=0,this._isoFallback=new Set,this._openingTunnelCache=null,this._openingWallIndexCache=new Map,this._openingPlacementIntervalsCache=null,this._openingDimensionContextCache=null,this._planSnapGeometryCache=null,this._planStructuralGeometryCache=null,this._hiddenWallDiagnosticCache=null,this._physicalBodiesCache=null,this._lightPhysicalBodiesCache=null,this._cleanFloorCache=new Map,this._innerContourCache=new Map,this._glowRuntimeState=vm(),this._glowRuntimeHost={window:()=>this.ownerDocument.defaultView||window,isConnected:()=>this.isConnected,requestUpdate:()=>this.requestUpdate(),reducedMotion:()=>this._reducedMotion},this._lightBarrierCache=null,this._lightBarrierPool=new Map,this._glowScreenBlend=!1,this._duplicateColumnId=null,this._duplicateColumnTimer=0,this._rszLimitViolation=null,this._path=[],this._cursorPt=null,this._planSnapHover=null,this._mergeSel=null,this._openingPreset=null,this._openingRebindId=null,this._openingPresetRevision=0,this._openingHoverCandidate=null,this._openingJambBlockCm=null,this._openingDialog=null,this._openingInfo=null,this._opDrag=null,this._opMeasure=null,this._mergeDialog=null,this._splitSel=null,this._pendingSplit=null,this._wallFaceBatch=null,this._wallRepairDiagnostic=null,this._wallFaceGraphCache=[],this._areaSel="",this._nameSel="",this._roomDialog=!1,this._roomEditId=null,this._roomFill="",this._roomCustomFill=null,this._roomTempMin="",this._roomTempMax="",this._roomTempSrc="",this._roomHumSrc="",this._roomSrcOpen=null,this._roomSrcFilter="",this._roomNameScale=1,this._roomLabelScale=1,this._zoom=1,this._view=null,this._zoomBySpace={},this._viewModeSnap=null,this._roomFocus=null,this._roomPointer=null,this._doubleFit=new mf,this._deviceHits=new yc,this._pointers=new Map,this._panStart=null,this._panLock=null,this._pinchStart=null,this._suppressClick=!1,this._viewportGestureDirty=!1,this._touchContacts=new Map,this._touchClickGuard=new dc,this._connectedPath="",this._routeDepartureHandled=!1,this._onLocationChanged=()=>{this._connectedPath&&location.pathname!==this._connectedPath?this._leaveCardRoute():location.pathname===this._connectedPath&&(this._routeDepartureHandled=!1)},this._touchGestureGuard={capture:!0,handleEvent:e=>this._guardTouchGesture(e)},this._hdrH=118,this._booting=!0,this._bootFading=!1,this._bootSettling=!1,this._bootSettleRaf=0,this._bootLastH=-1,this._bootStart=0,this._bootLastChange=0,this._bootSoft=!1,this._tapConfirm=null,this._dangerConfirm=null,this._dangerConfirmController=new ze(e=>{this._dangerConfirm=e}),this._confirmDanger=e=>this._config&&this.hass?"warm"===this._syncDangerConfirmLocaleGate()||this._dangerConfirmMissingSpace()?Promise.resolve(!1):this._dangerConfirmController.confirm(e):Promise.resolve(!1),this._cancelDangerConfirm=()=>{this._dangerConfirmController.cancel()},this._onDangerConfirmDecision=e=>{this._dangerConfirmController.resolve(e.detail.token,e.detail.accepted)},this._onboardingShown=!1,this._rulesDialog=null,this._preflightClipboardFallback=null,this._haIntegrationVersion=null,this._versionRecovery=(e=this,new yg({clock:{setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)},storage:()=>e.ownerDocument.defaultView?.sessionStorage??null,safety:()=>kg(e),reload:()=>e._reloadDocument(),changed:()=>{e.requestUpdate()}})),this._haSupportApi=null,this._haDecorAssetsApi=null,this._haSummaryPanelApi=null,this._haRadarStage1Api=null,this._radarLive=new Tg(this),this._decorAssetSyncToken=0,this._alignDialog=null,this._settingsDialog=null,this._pdfDialog=!1,this._supportDialog=null,this._backupExportDialog=null,this._backupImportDialog=null,this._sunRaysCache=null,this._dayCycleTimer=0,this._dayCycleClockKey="",this._compassDrag=!1,this._importDialog=null,this._importQueue=[],this._importTotal=0,this._rulesCompiledSrc="",this._infoCard=null,this._nativeMoreInfoEntity=null,this._deviceInbox=null,this._deviceInboxReturn=null,this._deviceInboxMemo=null,this._markerDialog=null,this._spaceDialog=null,this._keyHandler=e=>this._onKey(e),this._warmVp=null,this._warmVpArmed=!1,this._warmLongReturn=!1,this._warmRevivePending=!1,this._warmGen=++rv,this._warmKey=null,this._warmSlot=null,this._hashApplied=!1,this._navApplied=!1,this._labs={alpha:!1,active:Object.freeze([]),space:""},this._viewPreference={},this._renderProjection="flat",this._kioskScale={icon:1,font:1},this._kioskDialog=!1,this._summarySlot=new Xf(Zf,this,e=>{this._summary=e,this._capturedSnapshotSequence=-1,this.isConnected&&(e.connect(),this.hasUpdated&&this.requestUpdate())}),this._activityRt=new Map,this._vacRt=new Map,this._vacViewKey="",this._vacLastView=null,this._vacRaf=0,this._vacSrvTrails={},this._vacJumpOnce=!1,this._continuity=this._newContinuityController(),this._continuityHistory=[],this._continuityEpoch=0,this._continuityDataReady=!0,this._continuityPaintToken=-1,this._continuityDisposed=!1,this._renderSnapshotAt=Date.now(),this._hassSequence=0,this._visibleDeviceSnapshot=null,this._candidateDeviceSnapshot=null,this._stagedDeviceSnapshotToken=-1,this._capturedSnapshotSequence=-1,this._capturedSnapshotDevices=null,this._capturedSnapshotLayout=null,this._capturedSnapshotActivity="",this._capturedSnapshotConfigEpoch=-1,this._capturedSnapshotVirtual="",this._lastValidStageSize=null,this._pendingRefitSize=null,this._refitRaf=0,this._pageVisibility=e=>{if(this._continuity.visibility(e),this._dayCycleVisibility(e),this._summary?.visibility(e.kind),"hidden"===e.kind)return this._radarLive.stop(),this._editorRuntime?._cancelRadarSetup(),this._clearRoomFocus(!0),this._clearTransientHover(!0),this._cancelDevicePressFeedback(),this._cancelCameraTransition(!0),void(this._modeTransitionPreparing?this._modeTransitionForceAtomic=!0:this._cancelModeTransition(!0));if(this._vacJumpOnce=!0,this._syncRadarLive(),!e.long){const e=Date.now();let t=!1;for(const i of this._activityRt.values())!i.flashKind||(i.expiresAt||i.flashTs+Qm)>e||(i.flashTs=0,i.flashKind=null,i.expiresAt=0,t=!0);return void(t&&this.requestUpdate())}Date.now()-this._renderSnapshotAt>1e3&&this._continuity.note("device-snapshot-stale"),this._continuityDataReady=!1,this._continuityPaintToken=-1,this._resumeSettling=!0,this._loading?this.requestUpdate():this._loadFromServer()},this._resumeSettling=!1,this._viewportInvalidAt=0,this._vacFit=null,this._vacAllCamerasFor=null,this._vacAllCameraCache=null,this._vacCalConfirm=null,this._kioskDots=!1,this._cyclePausedUntil=0,this._swipeStart=null,this._tabDrag=null,this._tabDragRelease=null,this._tabSuppressClick=!1,this._tabOrderWarned=!1,this._onLabsSnapshot=e=>{const t=this._effectiveProjection();this._labs=e,this._isoProjectionSnapshot=null,this._labsIso&&this._ensureIsoSceneRuntime();const i=this._effectiveProjection();this._convertProjectionView(t,i),this.requestUpdate()},this._onHashChange=()=>{if(this._hasFixedFloor)return;const e=this._hashSpace();if(e&&this._model.find(t=>t.id===e)&&e!==this._space){if(this._wallFaceBatch&&this._roomDialogCancel(),"plan"===this._mode&&"draw"===this._tool&&!this._finishWallChain())return;this._commitSpace(e),this._selId=null,this._path=[],this._clearPlanSnapHover(),this._clearOpeningPlacement(!0),this._tool="draw",this._activeWallChainId=null,this._activeWallChainPartitionIds=[],this._wallChainSegmentCms=[],this._closingWallCm=null,this._restoreZoom(),this.requestUpdate()}},this._drag=null,this._deviceDrag=null,this._rlResize=null,this._holdFired=!1,this._retryContinuity=()=>{this._continuityDataReady=!1,this._continuityPaintToken=-1,this._continuity.retry(this._continuity.recoveryReason||"plan"),this._loading||this._loadFromServer()},this._cfgEpoch=0,this._cfgEpochPreservedConfig=null,this._terminalFrame=0,this._modelCache=null,this._emptySpaceStateActive=!1,this._decorSnapCache=null,this._markerPreviewMemo=null,this._markerPreviewDevicesMemo=null,this._showHidden=!1,this._connHooked=null,this._connectionWasLost=!1,this._haRegistryConnection=null,this._haRegistryRev=-1,this._haBindingCacheKey="",this._planHassMemo=null,this._renderLife=new xg,this._liveEditorPaintCount=0,this._onHaRegistryUpdate=()=>{const e=td(this.hass);e.revision===this._haRegistryRev&&this._devices.length||(this._haRegistryRev=e.revision,this._renderLife.invalidate(),this._planHassMemo=null,this._regSignature="",this._maybeRebuildDevices(),this.requestUpdate())},this._onConnReady=()=>{if(this._loadTries=0,clearTimeout(this._loadRetryTimer),this._loadRetryTimer=void 0,ed(this.hass),this._saveConfigDebounced.pending()&&this._saveConfigDebounced.flush(),this._cfgWriting)return clearTimeout(this._reloadRetry),void(this._reloadRetry=window.setTimeout(this._onConnReady,400));!this._connectionWasLost&&this._continuity.hasCompleteFrame?this._beginContinuityCandidate("connection-ready",!1,"plan"):(this._continuityDataReady=!1,this._continuityPaintToken=-1),this._loading||this._loadFromServer()},this._onConnLost=()=>{this._booting&&!this._continuity.hasCompleteFrame||(this._connectionWasLost=!0,this._continuityDataReady=!1,this._continuityPaintToken=-1,this._continuity.connectionLost())},this._signer=new hc(()=>this.requestUpdate()),this._dirtyPos=new Set,this._sentPos=new Map,this._persistLayout=gv(()=>{if(this._serverStorage){const e=[...this._dirtyPos];this._dirtyPos.clear();for(const t of e){const e=vo(this._layout[t]);e&&(this._layout={...this._layout,[t]:e},this._sentPos.set(t,e),this.hass.callWS({type:"houseplan/layout/update",device_id:t,pos:e}).then(e=>this._noteLayoutRev(e)).catch(e=>this._showToast(this._t("toast.pos_save_failed",{err:this._errText(e)}))).finally(()=>{this._sentPos.get(t)===e&&this._sentPos.delete(t)}))}this._cacheSnapshot()}else this._persistLocalLayout()},600),this._frame=null,this._showFar=!1,this._writesPending=0,this._writeChain=Promise.resolve(),this._pendingPhysicalWrites=new Map,this._undoGeometry=()=>this._editorRuntimeOrThrow()._undoGeometry(),this._redoGeometry=()=>this._editorRuntimeOrThrow()._redoGeometry(),this._saveConfigDebounced=gv(()=>{this._serverCfg&&this._writeConfig().catch(e=>{const t=!0===e?.physicalGeometryRolledBack;"geometry-unsafe"!==e?.code&&("wall_model_client_outdated"===e?.code?this._showToast(this._t("toast.wall_model_client_outdated")):"conflict"===e?.code?(this._showToast(this._t("toast.conflict")),t||(this._cancelPath(),this._reloadConfigOnly(!0))):this._showToast(this._t("toast.cfg_save_failed",{err:this._errText(e)})),t&&this._reloadRejectedPhysicalWrite())})},500),this._wallChainSegmentCms=[],this._closingWallCm=null,this._savePhysicalDialog=()=>this._editorRuntimeOrThrow()._savePhysicalDialog(),this._deletePhysicalSelection=()=>this._editorRuntimeOrThrow()._deletePhysicalSelection(),this._confirmPartitionDelete=()=>this._editorRuntimeOrThrow()._confirmPartitionDelete(),this._confirmRoomDelete=e=>this._editorRuntimeOrThrow()._confirmRoomDelete(e),this._rebindPartitionOpening=()=>this._editorRuntimeOrThrow()._rebindPartitionOpening(),this._keepClosedAsPartitions=()=>this._editorRuntimeOrThrow()._keepClosedAsPartitions(),this._toggleServerPlans=async()=>this._onboardingRuntime&&this._spaceDialogUsesOnboardingRuntime("create")?this._onboardingRuntime._toggleServerPlans():this._editorRuntimeOrThrow()._toggleServerPlans(),this._aspectJob=null,this._dayCycleTick=()=>{if(!this.isConnected||"hidden"===this.ownerDocument.visibilityState)return;const e=this._dayCycleState();if(!e)return this._dayCycleTimer&&(clearInterval(this._dayCycleTimer),this._dayCycleTimer=0),void(this._dayCycleClockKey="");const t=ar(e);t!==this._dayCycleClockKey&&(this._dayCycleClockKey=t,this.requestUpdate())},this._sunShown=!1,this._sunOut=!1,this._sunOutTimer=0,this._openSettingsDialog=()=>{if(this._editorRuntime)return this._editorRuntime._openSettingsDialog();this._ensureEditorRuntime().then(e=>{e&&this._openSettingsDialog()})},this._openSupportDialog=()=>{this._editorRuntime?this._editorRuntime._openSupportDialog():this._ensureEditorRuntime().then(e=>{e&&this._openSupportDialog()})},this._openPdfDialog=()=>{this._pdfRuntimeLoader.ensure().then(e=>{e&&(this._pdfDialog=!0,this.requestUpdate())})},this._reportedPreflightFingerprint=null,this._openAlignDialog=()=>this._editorRuntimeOrThrow()._openAlignDialog(),this._toggleOptimizeLivePositions=()=>this._editorRuntimeOrThrow()._toggleOptimizeLivePositions(),this._optimizeUndoBusy=!1,this._openBackupExport=()=>this._editorRuntimeOrThrow()._openBackupExport(),this._openRulesDialog=()=>this._editorRuntimeOrThrow()._openRulesDialog(),this._climateCache=null,this._gearPtCache=new WeakMap}requestUpdate(e,t,i){if("hass"===e&&this.hass&&this._liveRt){const e=this._visibleDeviceSnapshot||this._candidateDeviceSnapshot;if(!this._liveRt.hass(t,this.hass,e?{entityIds:e.entityIds}:null,()=>Sg(this))&&!this._summary?.observeHassComposition())return}void 0!==e&&(this._terminalFrame=0),this._editorRuntime?._routeLiveEditorUpdate(e,t)||(this._liveRt?.clear(),super.requestUpdate(e,t,i))}_editorRuntimeOrThrow(){if(!this._editorRuntime)throw new Error("Houseplan editor runtime is not loaded");return this._editorRuntime}async _ensureEditorRuntime(){return this._editorRuntimeLoader.ensure()}async _ensureOnboardingRuntime(){return this._onboardingRuntimeLoader.ensure()}async _ensureIsoSceneRuntime(){return this._isoSceneRuntimeLoader.ensure()}_editorRuntimeStateChanged(e){clearTimeout(this._editorRuntimeLoadingTimer),this._editorRuntimeLoadingTimer=void 0,"loading"!==e?(this._editorRuntimeLoadingVisible=!1,this.requestUpdate()):this._editorRuntimeLoadingTimer=window.setTimeout(()=>{this._editorRuntimeLoadingVisible=!0,this.requestUpdate()},150)}async _requestMode(e,t=!0,i=!1){const n=++this._editorModeRequest;if(i&&(this._warmModeRequest=n,this._refitRaf&&(cancelAnimationFrame(this._refitRaf),this._refitRaf=0),this._pendingRefitSize=null),"view"===e||await this._ensureEditorRuntime()){if(n===this._editorModeRequest&&this.isConnected)return i?(this._adoptMode(e),this._warmRevivePending&&(clearTimeout(this._warmReviveTimer),this._warmReviveTimer=void 0,this._warmReviveDialog()),this.requestUpdate(),void this.updateComplete.then(()=>requestAnimationFrame(()=>requestAnimationFrame(()=>{if(this._warmModeRequest!==n||n!==this._editorModeRequest)return;const e=this._stageEl;this._lastValidStageSize=e&&e.clientWidth>0&&e.clientHeight>0?[e.clientWidth,e.clientHeight]:null,this._pendingRefitSize=null,this._warmModeRequest=0})))):void this._setMode(e,t);this._warmModeRequest===n&&(this._warmModeRequest=0)}else this._warmModeRequest===n&&(this._warmModeRequest=0)}get _layout(){return this._adoption.layout}set _layout(e){this._adoption.stageLocalLayout(e)}get _layoutRev(){return this._adoption.layoutRev}set _layoutRev(e){this._adoption.seedIdentity({layoutRev:e})}get _layoutContentFingerprint(){return this._adoption.layoutFingerprint}set _layoutContentFingerprint(e){this._adoption.seedIdentity({layoutFingerprint:e})}get _serverCfg(){return this._adoption.config}set _serverCfg(e){this._adoption.stageLocalConfig(e)}get _cfgRev(){return this._adoption.configRev}set _cfgRev(e){this._adoption.seedIdentity({configRev:e})}get _cfgContentFingerprint(){return this._adoption.configFingerprint}set _cfgContentFingerprint(e){this._adoption.seedIdentity({configFingerprint:e})}_seedDecorStyle(e){var t,i;if(t=Al,i=this,Cl(e,Nl)&&"pending"===t.state()&&(t.art("",i),t.ensure()),this._decorStyleSeeded||!e)return;this._decorStyleSeeded=!0;const n=e.settings?.decor_default_style;n&&(this._decorStyle=function(e,t){if(!e||"object"!=typeof e)return{...t};const i=e,n="string"==typeof i.color&&i.color?i.color:t.color,r="string"==typeof i.fill_color&&i.fill_color?i.fill_color:t.fillColor,o=Number(i.width_cm);return{color:n,opacity:Sr(i.opacity,t.opacity),widthCm:Number.isFinite(o)&&o>0?Math.max(.1,Math.min(100,o)):t.widthCm,fill:"boolean"==typeof i.fill?i.fill:t.fill,fillColor:r,fillOpacity:Sr(i.fill_opacity,t.fillOpacity)}}(n,xr))}get _canManageConfiguration(){return null!==this._serverCanWrite?this._serverCanWrite:!0===this.hass?.user?.is_admin}get _canEdit(){return this._norm&&this._canManageConfiguration}get _kiosk(){return!!this._config?.kiosk}_showKioskDots(){this._kioskDots=!0,clearTimeout(this._kioskDotsTimer),this._kioskDotsTimer=window.setTimeout(()=>this._kioskDots=!1,2500)}get _modeTransitionBusy(){return this._modeTransitionPreparing||this._modeTransition.active}get _doubleFitEnabled(){return!("view"!==this._mode||this._vacFit||this._modeTransitionBusy||this._touchSequenceMultitouch||"steady"!==this._continuity.state||this._continuity.overlayBlocksInteraction)}_cameraState(){const e=this._viewOr(this._baseVb());return{zoom:this._zoom,viewBox:{...e}}}_normalizeCameraState(e){const t=this._cameraTransitionFit||Oi(this._baseVb(),this._stageAspect());return{zoom:Math.min(yv.ZOOM_MAX,Math.max(yv.ZOOM_MIN,e.zoom)),viewBox:this._clampView({...e.viewBox},t)}}_applyCameraTransitionFrame(e){const t=this._normalizeCameraState(e.presented);e.presented=t,this._zoom=t.zoom,this._view={...t.viewBox},this._liveVp(!0)}_settleCameraTransition(e){const t=this._normalizeCameraState(e.to);this._zoom=t.zoom,this._view={...t.viewBox},this._cameraTransitionFit=null,"room"!==e.reason&&this._saveZoom(),this.requestUpdate()}_cancelCameraTransition(e=!1,t=!1){const i=this._cameraTransition.state?.reason,n=t&&this._cameraTransition.active?this._cameraTransition.presented?.zoom:void 0;this._cameraTransition.cancel(e),this._cameraTransitionFit=null,void 0!==n&&"room"!==i&&this._saveZoom()}_prepareCameraCommand(){this._bootSoftCancel(),this._modeTransitionBusy&&this._cancelModeTransition(!0),"opening"===this._tool&&(this._cursorPt=null,this._clearOpeningPlacement(!1))}_startCameraTransition(e,t,i,n){const r=this._cameraState(),o=this._cameraTransition.target;return(!o||!Kg(o,e))&&(Kg(r,e)?(this._cancelCameraTransition(!1),!1):(this._cameraTransitionFit={...t},this._cameraTransition.start(r,e,i,this._reducedMotion?0:n),!0))}_cssColor(e,t){const i=String(e||"").trim();if(!i)return t;const n=document.createElement("span");n.style.cssText=`position:absolute;visibility:hidden;color:${i}`,this.renderRoot.append(n);const r=getComputedStyle(n).color||t;return n.remove(),r}_currentModeVisual(e=this._mode){const t=this._modeTransition.presented||this._modeTransitionVisual;if(t)return{...t,viewport:{...t.viewport,viewBox:{...t.viewport.viewBox}}};const i=this._stageEl;if(!i||i.clientWidth<=0||i.clientHeight<=0)return null;const n=this.renderRoot.querySelector(".editorchrome"),r=this._viewOr(this._baseVb()),o=this.renderRoot.querySelector(".hp-paper"),s=this.renderRoot.querySelector(".hp-backdrop"),a=this.renderRoot.querySelector(".zoomwrap"),l=a?getComputedStyle(a).filter:"",c=Number(/brightness\(([^)]+)\)/.exec(l)?.[1]);return{presentedMode:e,editorChromeHeight:"view"===e?0:n?.getBoundingClientRect().height||0,stageWidth:i.clientWidth,stageHeight:i.clientHeight,viewport:Hg(r,i.clientWidth),stageColor:getComputedStyle(i).backgroundColor||"rgb(255, 255, 255)",paperColor:o?getComputedStyle(o).fill:"rgb(255, 255, 255)",sceneBrightness:Number.isFinite(c)?c:1,architectureOpacity:"decor"===e?.35:1,backdropOpacity:s&&Number(getComputedStyle(s).opacity)||1,viewWeight:"view"===e?1:0,editorWeight:"view"===e?0:1,toolbarContentOpacity:"view"===e?0:1}}_viewForModeTarget(e,t,i,n,r){const o=Oi(this._baseVb(),n/r),s=Math.min(yv.ZOOM_MAX,Math.max(yv.ZOOM_MIN,e)),a=o.w/s,l=o.h/s,c=t??o.x+o.w/2,h=i??o.y+o.h/2;return this._clampView({x:c-a/2,y:h-l/2,w:a,h:l},o)}_targetStageColor(e){return"view"!==e?"rgb(255, 255, 255)":this._cssColor(this._stageBg(this._spaceDisplayForRender()),this._cssColor("var(--ha-card-background, var(--card-background-color, #111))","rgb(17, 17, 17)"))}_targetPaperColor(e){return"view"===e&&this._spaceModel()?.bg?this._cssColor("var(--ha-card-background, var(--card-background-color, #111))","rgb(17, 17, 17)"):"rgb(255, 255, 255)"}_targetBrightness(e){return 1}_applyModeTransitionFrame(e){e.targetMode===this._mode&&(this._modeTransitionVisual=e.presented,this._view={...e.presented.viewport.viewBox},this.requestUpdate())}_settleModeTransition(e){if(e.targetMode!==this._mode)return;const t=this._modeTransitionRequest;this._view={...e.to.viewport.viewBox},this._zoom=this._modeTransitionTargetZoom,this._modeTransitionVisual=null,this._modeTransitionPreparing=!1,this._lastValidStageSize=[e.to.stageWidth,e.to.stageHeight],"view"===this._mode&&(this._saveZoom(),this._viewModeSnap=null,this._modeTransitionEditorCamera=null),this.requestUpdate(),this.updateComplete.then(()=>{if(!this.isConnected||t!==this._modeTransitionRequest||this._modeTransitionBusy||e.targetMode!==this._mode)return;const i=this._stageEl;if(i&&i.clientWidth>0&&i.clientHeight>0&&(Math.abs(i.clientWidth-e.to.stageWidth)>.5||Math.abs(i.clientHeight-e.to.stageHeight)>.5)){const e=this._view;this._lastValidStageSize=[i.clientWidth,i.clientHeight],this._applyView(this._zoom,e?e.x+e.w/2:void 0,e?e.y+e.h/2:void 0),this.requestUpdate()}const n=this.renderRoot.activeElement;(!n||!n.isConnected||!!n.closest?.(".editorchrome, .stage"))&&this.renderRoot.querySelector(".modetab.active")?.focus?.({preventScroll:!0})})}_cancelModeTransition(e=!0){this._cancelCameraTransition(!1);const t=!!this._modeTransition.state;this._modeTransitionRequest++,this._modeTransitionPreparing=!1,this._modeTransitionForceAtomic=!1,this._modeTransition.cancel(e),e&&t||(this._modeTransitionVisual=null)}_adoptMode(e){e!==this._mode&&(this._clearRoomFocus(!0),this._resetDeviceHitState()),this._cancelModeTransition(!1),this._mode=e,this._isoProjectionSnapshot=null,"view"!==e&&(this._editorChromeMode=e)}_commitViewModeAtomic(e,t,i,n){if(this._modeTransitionPreparing=!1,this._modeTransitionVisual=null,this._modeTransitionForceAtomic=!1,this._zoom=t,e){const r=this._stageEl?.clientWidth||e.stageWidth,o=Math.max(1,e.stageHeight+e.editorChromeHeight);this._view=this._viewForModeTarget(t,i,n,r,o),this._lastValidStageSize=[r,o]}else this._view=null;this._viewModeSnap=null,this._modeTransitionEditorCamera=null,this._saveZoom(),this.requestUpdate()}_prepareModeTransition(e,t,i,n,r,o){this.updateComplete.then(()=>{if(!this.isConnected||e!==this._modeTransitionRequest||this._mode!==i)return void(e===this._modeTransitionRequest&&(this._modeTransitionPreparing=!1,this._modeTransitionVisual=null,this._modeTransitionForceAtomic=!1,this.requestUpdate()));const s=this.renderRoot.querySelector(".editorchrome-inner"),a="view"===i?0:s?.scrollHeight||0,l=Math.max(1,(this.panelHost?this.clientHeight:innerHeight)-Jg(this.renderRoot,this._stageEl,this.panelHost)),c=this._stageEl?.clientWidth||t.stageWidth,h=this._viewForModeTarget(n,r,o,c,l),d={presentedMode:i,editorChromeHeight:a,stageWidth:c,stageHeight:l,viewport:Hg(h,c),stageColor:this._targetStageColor(i),paperColor:this._targetPaperColor(i),sceneBrightness:this._targetBrightness(i),architectureOpacity:"decor"===i?.35:1,backdropOpacity:"decor"===i&&"backdrop"!==this._decorTool?.5:1,viewWeight:"view"===i?1:0,editorWeight:"view"===i?0:1,toolbarContentOpacity:"view"===i?0:1};this._modeTransitionPreparing=!1;const u=this._modeTransitionForceAtomic;this._modeTransitionForceAtomic=!1,this._modeTransition.start(t,d,i,this._reducedMotion||u?0:220)})}get _hasFixedFloor(){return!!this._config&&Object.prototype.hasOwnProperty.call(this._config,"floor")}_fixedFloorState(e=this._model,t=this._loadOk){const i=this._config?.floor,n=function(e){if(!e.hasFloor)return{kind:"absent"};const t=e.floor;if("string"==typeof t)return t.length?e.spaceIds.includes(t)?{kind:"valid",id:t,source:"id"}:{kind:"invalid",reason:"unknown-id",value:t}:{kind:"invalid",reason:"empty-id",value:t};if("number"==typeof t){if(!Number.isFinite(t))return{kind:"invalid",reason:"non-finite-index",value:t};if(!Number.isInteger(t))return{kind:"invalid",reason:"fractional-index",value:t};if(t<0)return{kind:"invalid",reason:"negative-index",value:t};const i=e.spaceIds[t];return void 0===i?{kind:"invalid",reason:"out-of-range-index",value:t}:{kind:"valid",id:i,source:"index"}}return{kind:"invalid",reason:"invalid-type",value:t}}({spaceIds:e.map(e=>e.id),hasFloor:this._hasFixedFloor,floor:i});return!this._hasFixedFloor||t?n:"number"==typeof i?"valid"===n.kind||"invalid"===n.kind&&"out-of-range-index"===n.reason?{kind:"pending",value:i}:n:"valid"===n.kind||"invalid"===n.kind&&"unknown-id"!==n.reason?n:{kind:"pending",value:i}}_canCommitSpace(e,t=!1){if(t||!this._hasFixedFloor)return!0;const i=this._fixedFloorState();return"valid"===i.kind&&i.id===e}_commitSpace(e,t=!1){return!!this._canCommitSpace(e,t)&&(e!==this._space&&(this._clearRoomFocus(!0),this._resetDeviceHitState(),this._cancelDangerConfirm(),this._cancelCameraTransition(!1),this._clearTransientHover(!0),this._cancelDevicePressFeedback(),this._editorRuntime?._clearFurniturePreview()),this._space=e,this._isoProjectionSnapshot=null,!0)}_slideTo(e,t){if(e===this._space)return!0;if(!this._canCommitSpace(e))return!1;if(this._wallFaceBatch&&this._roomDialogCancel(),"plan"===this._mode&&"draw"===this._tool&&!this._finishWallChain())return!1;this._cancelModeTransition(!0);const i=window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches;return this._commitSpace(e),this._path=[],this._clearPlanSnapHover(),this._clearOpeningPlacement(!0),this._tool="draw",this._activeWallChainId=null,this._activeWallChainPartitionIds=[],this._wallChainSegmentCms=[],this._closingWallCm=null,this._selId=null,this._physicalSel=null,this._editorSecondary?.closeForNavigation(),this._physicalDialog=null,this._physicalDrag=null,this._restoreZoom(),i||(this._slide=t,clearTimeout(this._slideTimer),this._slideTimer=window.setTimeout(()=>{this._slideTimer=void 0,this._slide="",this.requestUpdate()},190),this.requestUpdate()),!0}get _canReorderTabs(){return Yf({canEdit:this._canEdit,kiosk:this._kiosk,mode:this._mode,pointerType:"mouse",spaceCount:this._model.length,fixedFloor:this._hasFixedFloor})}_tabPointerDown(e,t){Yf({canEdit:this._canEdit,kiosk:this._kiosk,mode:this._mode,pointerType:e.pointerType,spaceCount:this._model.length,fixedFloor:this._hasFixedFloor})&&(fv(e),this._tabDragRelease=e=>this._tabPointerUp(e),window.addEventListener("pointerup",this._tabDragRelease),window.addEventListener("pointercancel",this._tabDragRelease),this._tabDrag={id:t,pointerId:e.pointerId,x:e.clientX,y:e.clientY,moved:!1,targetId:null,placement:null})}_tabDropTargetAt(e,t,i){const n=this._model.map(e=>e.id),r=n.indexOf(i);if(r<0)return null;const o=this.renderRoot.querySelectorAll('[data-hp="space-tab"]');for(const s of o){const o=s.dataset.id||"";if(!o||o===i)continue;const a=s.getBoundingClientRect();if(ea.right||ta.bottom)continue;const l=n.indexOf(o);return l<0?null:{targetId:o,placement:l=4)))return;var i,n;const r=this._tabDropTargetAt(e.clientX,e.clientY,t.id);t.moved&&t.targetId===r?.targetId&&t.placement===r?.placement||(this._tabDrag={...t,moved:!0,targetId:r?.targetId||null,placement:r?.placement||null})}_tabPointerUp(e){const t=this._tabDrag;if(t&&t.pointerId!==e.pointerId)return;const i="pointerup"===e.type&&t?.moved?this._tabDropTargetAt(e.clientX,e.clientY,t.id):null;"pointerup"===e.type&&t?.moved&&this._suppressNextTabClick(),this._endTabDrag(),t?.moved&&i&&this._commitTabOrder(t.id,i.targetId)}_endTabDrag(){this._tabDrag=null,this._tabDragRelease&&(window.removeEventListener("pointerup",this._tabDragRelease),window.removeEventListener("pointercancel",this._tabDragRelease),this._tabDragRelease=null)}_tabClick(e){if(this._tabSuppressClick)return this._tabSuppressClick=!1,clearTimeout(this._tabSuppressClickTimer),void(this._tabSuppressClickTimer=void 0);this._pickSpace(e)}_suppressNextTabClick(){this._tabSuppressClick=!0,clearTimeout(this._tabSuppressClickTimer),this._tabSuppressClickTimer=window.setTimeout(()=>{this._tabSuppressClick=!1,this._tabSuppressClickTimer=void 0},0)}_commitTabOrder(e,t){const i=this._serverCfg;if(!i||!this._canReorderTabs)return;const n=this._model.map(e=>e.id),r=function(e,t,i){const n=e.indexOf(t),r=e.indexOf(i);if(n<0||r<0||n===r)return e;const o=e.slice();return o.splice(n,1),o.splice(r,0,t),o}(n,e,t);if(r===n)return;const o=new Map(this._devices.map(e=>[String(e.id),String(e.area||"")])),s=function(e,t,i,n=()=>""){if(!i)return[];const r=[];for(const o of e){if(!o||!0===o.removed)continue;const e="string"==typeof o.id?o.id:"";if(!e)continue;if("string"==typeof o.space&&o.space)continue;const s=("string"==typeof o.area?o.area:"")||n(e)||"";s&&t[s]||r.push({id:e,space:i})}return r}(i.markers||[],Object.fromEntries(Object.entries(this._areaToSpace).map(([e,t])=>[e,t.space])),n[0]||"",e=>o.get(e)||"");if(s.length){const e=new Map(s.map(e=>[e.id,e.space]));for(const t of i.markers||[]){const i=e.get(String(t.id));i&&(t.space=i)}}i.spaces=function(e,t){const i=new Map(t.map((e,t)=>[e,t]));return e.map((e,t)=>({space:e,index:t})).sort((e,t)=>(i.get(String(e.space?.id))??Number.MAX_SAFE_INTEGER)-(i.get(String(t.space?.id))??Number.MAX_SAFE_INTEGER)||e.index-t.index).map(e=>e.space)}(i.spaces||[],r),this._saveConfig(),this._tabOrderWarned||(this._tabOrderWarned=!0,this._showToast(this._t("toast.space_order_changed")))}_pickSpace(e){if(this._endTabDrag(),e===this._space)return;const t=this._model.map(e=>e.id),i=t.indexOf(this._space),n=t.indexOf(e);this._navApplied=!0,this._showFar=!1,this._frame=null,this._slideTo(e,i>=0&&n0&&Date.now()>=this._cyclePausedUntil&&this._model.length>1&&this._zoom<=1.001){const e=this._model.map(e=>e.id),t=e.indexOf(this._space);this._slideTo(e[(t+1)%e.length],"left"),this._showKioskDots()}}_syncCycleTimer(){clearInterval(this._cycleTimer),this._cycleTimer=void 0,this.isConnected&&!this._hasFixedFloor&&this._config?.kiosk&&Number(this._config.cycle)>0&&(this._cycleTimer=window.setInterval(()=>this._cycleTick(),1e3*Number(this._config.cycle)))}get _editing(){return"plan"===this._mode||"devices"===this._mode||"decor"===this._mode}get _markup(){return"plan"===this._mode}get _wallUnionCache(){return this._wallUnionCacheValue}set _wallUnionCache(e){this._wallUnionCacheValue=e,null===e&&this._wallUnionPool.clear()}get _glowClipCache(){return this._glowRuntimeState.clipCache}get _glowGeometryWarnings(){return this._glowRuntimeState.geometryWarnings}get _glowFeatherUnits(){return this._glowRuntimeState.featherUnits}set _glowFeatherUnits(e){this._glowRuntimeState.featherUnits=e}get _glowRenderedSources(){return this._glowRuntimeState.renderedSources}get _glowLastAppearance(){return this._glowRuntimeState.lastAppearance}get _glowFeatherSuspendUntil(){return this._glowRuntimeState.featherSuspendUntil}set _glowFeatherSuspendUntil(e){this._glowRuntimeState.featherSuspendUntil=e}get _glowFeatherResumeTimer(){return this._glowRuntimeState.featherResumeTimer}set _glowFeatherResumeTimer(e){this._glowRuntimeState.featherResumeTimer=e}get _glowSourceSeq(){return this._glowRuntimeState.sourceSeq}set _glowSourceSeq(e){this._glowRuntimeState.sourceSeq=e}get _touchSequenceMultitouch(){return this._touchClickGuard.sequenceMultitouch}_syncDangerConfirmLocaleGate(){return this._config&&this.hass?cp(this,_p,bp(this.hass,this._config.language)):"ready"}_dangerConfirmMissingSpace(){const e=this._model;if(!e.length)return!1;const t=this._fixedFloorState(e);return"pending"!==t.kind&&"invalid"!==t.kind&&!this._spaceModel()}_syncVersionRecovery(){this._versionRecovery.update({frontendVersion:Jf(ev),backendVersion:this._haIntegrationVersion,kiosk:!0===this._config?.kiosk,reducedMotion:this._reducedMotion})}_newContinuityController(){return new sc(()=>{this._resumeSettling="steady"!==this._continuity.state,this._continuityEpoch++,this.isConnected&&this.requestUpdate()})}get _labsIso(){return this._labs.active.includes("iso")}get _desiredProjection(){return"view"===this._mode&&this._labsIso&&"iso"===this._viewPreference[this._space]?"iso":"flat"}_saveViewPreference(){try{localStorage.setItem(hv,JSON.stringify(this._viewPreference))}catch{}}_logicalViewCenter(e){const t=this._view;if(!t)return null;const i=[t.x+t.w/2,t.y+t.h/2],n="iso"===e?af(i):i;return{x:n[0],y:n[1]}}_convertProjectionView(e,t){if(e===t)return;this._clearRoomFocus(!0);const i=this._logicalViewCenter(e);this._view=null;const n=i?"iso"===t?sf([i.x,i.y],0):[i.x,i.y]:null;this._applyView(this._zoom,n?.[0],n?.[1]),this._warmPatch({vp:this._warmViewportState()}),this.requestUpdate()}_setProjection(e){if(!this._labsIso||"view"!==this._mode)return;const t=this._effectiveProjection();if(this._viewPreference={...this._viewPreference,[this._space]:e},"iso"===e){this._ensureIsoSceneRuntime();const e=this._isoSceneKey();e&&this._isoFallback.delete(e),this._isoFallback.delete(`${this._space}|no-borders`),this._clearIsoInvalidFallback()}this._saveViewPreference(),this._isoProjectionSnapshot=null;const i=this._effectiveProjection();this._convertProjectionView(t,i)}_hashSpace(){return Af(window.location.hash||"")}connectedCallback(){this._connectedPath=location.pathname,this._routeDepartureHandled=!1,this._configReloadAuthority.observeContext(Uu(this)),window.addEventListener("location-changed",this._onLocationChanged),window.addEventListener("popstate",this._onLocationChanged),this._continuityDisposed&&(this._continuity=this._newContinuityController(),this._continuityDisposed=!1,this._continuityPaintToken=-1);const e=cg(this.ownerDocument);var t;void 0!==e&&(this._glowScreenBlend=e),this._continuityUnsub?.(),this._continuityUnsub=rc(this.ownerDocument,this._pageVisibility),this._languageFailureUnsub?.(),this._languageFailureUnsub=function(...e){return()=>{for(const t of e)t()}}((t=()=>{this._showToast(this._t("toast.locale_load_failed"))},pp.add(t),()=>pp.delete(t)),function(e){return Dl.add(e),()=>{Dl.delete(e)}}(()=>this._showToast(this._t("toast.furniture_art_load_failed")))),super.connectedCallback(),this._summarySlot.connect(),this._ensureLiveRuntime().catch(()=>this.requestUpdate()),this._pointerModality.connect(this.ownerDocument.defaultView);const i=this.ownerDocument.defaultView?.MutationObserver;i&&(this._pointerHoverObserver=new i(e=>{let t=!1;for(const i of e){for(const e of i.addedNodes)this._syncPointerHoverSubtree(e);const e=e=>{if(e.nodeType!==Node.ELEMENT_NODE)return!1;const t=e;return t.matches(".devlayer, .devlayer *")||!!t.querySelector?.(".devlayer")};(e(i.target)||[...i.addedNodes,...i.removedNodes].some(e))&&(t=!0)}t&&this._invalidateDeviceHitGeometry()}),this._pointerHoverObserver.observe(this.renderRoot,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","data-id"]})),this._motionMedia=window.matchMedia?.("(prefers-reduced-motion: reduce)"),this._reducedMotion=!!this._motionMedia?.matches,this._motionMedia?.addEventListener?.("change",this._onMotionChange),this._syncVersionRecovery(),this._versionRecovery.connect(),lg(this.ownerDocument).then(e=>{e!==this._glowScreenBlend&&(this._glowScreenBlend=e,this.isConnected&&this.requestUpdate())}),this.hass&&this._ensureHaRegistryAuthority(),window.addEventListener("keydown",this._keyHandler),this._signer.start(()=>this.hass,()=>this._referencedContentUrls()),this._syncCycleTimer(),window.addEventListener("hashchange",this._onHashChange),this._labsUnsub?.(),this._labsUnsub=function(e){Of.add(e);const t=Hf();return"undefined"==typeof window&&e(t),()=>{Of.delete(e)}}(this._onLabsSnapshot),this._labsIso&&this._ensureIsoSceneRuntime(),this._booting?this._bootWatch():this._bootFading&&(clearTimeout(this._bootTimer),this._bootTimer=window.setTimeout(()=>{this._bootFading=!1},220)),this._bootSoft&&(clearTimeout(this._bootSoftTimer),this._bootSoftTimer=window.setTimeout(()=>{this._bootSoft=!1},iv)),!this._loadOk&&this._serverCfg&&this.hass&&this._scheduleLoadRetry(),!this._warmSlot&&this._config&&this._warmAdopt(),this._loadOk&&this._ensureLiveSyncSubscriptions(),this._warmVp&&!this._warmRevivePending&&void 0===this._warmReviveTimer&&(this._warmRevivePending=!0,this._warmReviveTimer=window.setTimeout(()=>this._warmReviveDialog(),0)),this._warmLongReturn&&this._beginResumeSettle(),this._warmLongReturn=!1,this.requestUpdate()}disconnectedCallback(){this._versionRecovery.disconnect(),this._configReloadAuthority.invalidateLifecycle(),this._liveRt?.dispose(),this._radarLive.stop(),this._editorRuntime?._disposeLiveEditor(),this._clearRoomFocus(!0),this._cancelDangerConfirm(),this._connectedPath&&location.pathname!==this._connectedPath&&this._leaveCardRoute(),window.removeEventListener("location-changed",this._onLocationChanged),window.removeEventListener("popstate",this._onLocationChanged),this._continuityUnsub?.(),this._continuityUnsub=void 0,this._languageFailureUnsub?.(),this._languageFailureUnsub=void 0,this._motionMedia?.removeEventListener?.("change",this._onMotionChange),this._motionMedia=void 0,this._vacRaf&&(cancelAnimationFrame(this._vacRaf),this._vacRaf=0),this._refitRaf&&(cancelAnimationFrame(this._refitRaf),this._refitRaf=0),this._warmModeRequest=0,this._dayCycleTimer&&(clearInterval(this._dayCycleTimer),this._dayCycleTimer=0),this._summarySlot.disconnect(),this._dayCycleClockKey="",this._bootSettleRaf&&(cancelAnimationFrame(this._bootSettleRaf),this._bootSettleRaf=0),this._bootSettling=!1;for(const e of this._activityRt.values())clearTimeout(e.timer);window.removeEventListener("keydown",this._keyHandler),this._endTabDrag(),clearTimeout(this._tabSuppressClickTimer),this._tabSuppressClickTimer=void 0,this._tabSuppressClick=!1,clearInterval(this._cycleTimer),clearTimeout(this._kioskDotsTimer),clearTimeout(this._kioskHoldTimer),clearTimeout(this._reloadRetry),clearTimeout(this._loadRetryTimer),this._loadRetryTimer=void 0,this._connHooked?.removeEventListener?.("ready",this._onConnReady),this._connHooked?.removeEventListener?.("disconnected",this._onConnLost),this._connHooked?.removeEventListener?.("reconnect-error",this._onConnLost),this._connHooked=null,this._haRegistryRelease?.(),this._haRegistryRelease=void 0,this._haRegistryConnection=null,this._signer.dispose(),clearTimeout(this._toastTimer),clearTimeout(this._slideTimer),clearTimeout(this._editorRuntimeLoadingTimer),this._editorRuntimeLoadingTimer=void 0,this._editorRuntimeLoadingVisible=!1,this._modeTransition.dispose(),this._cameraTransition.dispose(),this._cameraTransitionFit=null,this._modeTransitionVisual=null,this._modeTransitionPreparing=!1,this._modeTransitionForceAtomic=!1,this._modeTransitionRequest++,this._slideTimer=void 0,this._slide="",clearTimeout(this._bootTimer),this._bootTimer=void 0,clearTimeout(this._bootSoftTimer),this._saveConfigDebounced.flush(),this._cancelDeviceDrag(),window.removeEventListener("hashchange",this._onHashChange),this._labsUnsub?.(),this._labsUnsub=void 0,clearTimeout(this._holdTimer),this._roViewport?.disconnect(),this._roViewport=void 0,this._roHdr?.disconnect(),this._roHdr=void 0,this._onWinResize&&(window.removeEventListener("resize",this._onWinResize),this._onWinResize=void 0),this._unsubCfg&&(this._unsubCfg(),this._unsubCfg=null),this._unsubLayout&&(this._unsubLayout(),this._unsubLayout=null),this._unsubVirtual&&(this._unsubVirtual(),this._unsubVirtual=null),this._unsubTrail&&(this._unsubTrail(),this._unsubTrail=void 0),this._liveSyncGeneration++,this._liveSyncAttempt=null,this._liveSyncConnection=null,clearTimeout(this._layoutSyncTimer),clearTimeout(this._duplicateColumnTimer),Am(this._glowRuntimeState,this._glowRuntimeHost),this._warmSnapshot(),this._warmRevivePending=!1,clearTimeout(this._warmReviveTimer),this._warmReviveTimer=void 0,this._warmRelease(),this._clearPlanSnapHover(),this._clearOpeningPlacement(!0),this._editorRuntime?._clearFurniturePreview(),this._editorRuntime?._furnShiftDetach(),this._touchContacts.clear(),this._touchClickGuard.reset(),this._resetDeviceHitState(),this._clearTransientHover(!0),this._cancelDevicePressFeedback(),this._pointerHoverObserver?.disconnect(),this._pointerHoverObserver=void 0,this._pointerModality.disconnect(),this._editorSecondary?.reset(),this._resumeSettling=!1,this._continuityHistory=[...this._continuityHistory,...this._continuity.trace].slice(-80),this._continuity.dispose(),this._continuityDisposed=!0,super.disconnectedCallback()}_onKey(e){if("Escape"===e.key&&this._vacFit){if(this._vacFit.busy)return;return this._vacFit=null,this._showToast(this._t("vac.cal_cancelled")),void e.stopPropagation()}if("Escape"===e.key){if(this._tapConfirm)return void(this._tapConfirm=null);if(this._vacCalConfirm)return void(this._vacCalConfirm.busy||(this._vacCalConfirm=null));if(this._decorEraseConfirm)return void(this._decorEraseConfirm=null);if(this._openingInfo)return void(this._openingInfo=null);if(this._infoCard)return void this._closeInfoCard();if(this._rulesDialog)return void(this._rulesDialog=null);if(this._alignDialog)return this._alignDialog=null,void(this._preflightClipboardFallback=null);if(this._backupImportDialog)return void(this._backupImportDialog=null);if(this._backupExportDialog)return void(this._backupExportDialog=null);if(this._pdfDialog)return void(this._pdfDialog=!1);if(this._supportDialog)return void this._editorRuntime?._closeSupportDialog();if(this._settingsDialog)return void(this._settingsDialog=null);if(this._summary?.closeDialogIfIdle())return;if(this._markerDialog)return void this._closeMarkerDialog();if(this._deviceInbox)return void(this._deviceInbox=null);if(this._openingDialog)return void(this._openingDialog=null);if(this._physicalDialog)return void(this._physicalDialog=null);if(this._backdropDialog)return void(this._backdropDialog=null);if(this._decorShapeDialog)return void(this._decorShapeDialog=null);if(this._decorTextDialog)return void(this._decorTextDialog=null);if(this._spaceDialog&&!this._roomDialog)return this._spaceDialog=null,this._importQueue=[],void(this._importTotal=0);if(this._editorSecondary?.hasOpenGroup)return e.preventDefault(),void this._editorSecondary?.closeGroup(!0)}const t=e.composedPath?.()||[e.target],i=t.some(e=>e?.matches?.('input, textarea, select, [contenteditable="true"]')),n=t.some(e=>e?.classList?.contains?.("editor-secondary")),r=e.ctrlKey||e.metaKey,o=e.key.toLowerCase(),s=/^[a-z]$/.test(o),a="z"===o||!s&&"KeyZ"===e.code,l="y"===o||!s&&"KeyY"===e.code,c=r&&(a&&e.shiftKey||l),h=r&&a&&!e.shiftKey;if("decor"===this._mode){if((h||c)&&i)return;if(c)return e.preventDefault(),void this._redoGeometry();if(h)return e.preventDefault(),this._decorDraft?void(this._decorDraft=null):this._decorMove||this._dtDrag||this._bdDrag?void this._cancelDecorGesture():void this._undoGeometry();if(("Delete"===e.key||"Backspace"===e.key)&&this._decorSel&&!i&&!n)return e.preventDefault(),void this._decorDeleteSel();const t="ArrowLeft"===e.key?[-this._gridPitch,0]:"ArrowRight"===e.key?[this._gridPitch,0]:"ArrowUp"===e.key?[0,-this._gridPitch]:"ArrowDown"===e.key?[0,this._gridPitch]:null;return!t||r||e.altKey||"select"!==this._decorTool||!this._decorSel||!this._decorList.some(e=>e.id===this._decorSel)||this._decorDraft||this._decorMove||this._dtDrag||this._bdDrag||i||n||this._editorSecondaryDialogBlocked?void("Escape"===e.key&&(e.preventDefault(),this._decorDraft?this._decorDraft=null:this._decorMove||this._dtDrag||this._bdDrag?this._cancelDecorGesture():"furniture"===this._decorTool?(this._editorRuntime?._clearFurniturePreview(),this._editorRuntime?._furnShiftDetach(),this._furnPalette=null,this._furnCategory=null,this._decorTool="select"):this._decorSel?this._decorSel=null:"select"!==this._decorTool?this._decorTool="select":this._setMode("view"))):(e.preventDefault(),void this._decorNudge(t[0],t[1]))}if("devices"===this._mode){if((h||c)&&i)return;return c?(e.preventDefault(),void this._redoDevicePosition()):h?(e.preventDefault(),void this._undoDevicePosition()):void("Escape"===e.key&&this._deviceDrag&&(e.preventDefault(),this._cancelDeviceDrag()))}if(this._markup&&(!h&&!c||!i)){if(("Delete"===e.key||"Backspace"===e.key)&&this._physicalSel&&!i&&!n)return e.preventDefault(),void this._deletePhysicalSelection();if(c)return e.preventDefault(),void this._redoGeometry();if(h)return e.preventDefault(),this._resize?.dragging?void this._rszCancelDrag():this._wallFaceBatch?(this._roomDialogCancel(),void(this._activeWallChainId&&this._path.length>1?this._undoActiveWallPoint():this._undoPoint())):"draw"===this._tool&&this._path.length?void(this._activeWallChainId&&this._path.length>1?this._undoActiveWallPoint():this._undoPoint()):"split"===this._tool&&this._splitSel?.pts?.length?(this._splitSel={...this._splitSel,pts:this._splitSel.pts.slice(0,-1)},void(this._splitSel.pts.length||(this._cursorPt=null))):void this._undoGeometry();if("Escape"===e.key)return this._physicalDrag||this._physicalRotate?(e.preventDefault(),void this._cancelPhysicalGesture()):this._roomDialog?(e.preventDefault(),void this._roomDialogCancel()):"draw"===this._tool&&this._path.length?(e.preventDefault(),void this._finishWallChain()):this._physicalSel?(e.preventDefault(),void(this._physicalSel=null)):"resize"===this._tool?(e.preventDefault(),this._resize?.dragging?void this._rszCancelDrag():("exit-tool"===this._resize?.escapeIdle()&&(this._tool="draw"),void this.requestUpdate())):"split"===this._tool?(e.preventDefault(),void(this._splitSel?.pts?.length?(this._splitSel={...this._splitSel,pts:this._splitSel.pts.slice(0,-1)},this._splitSel.pts.length||(this._cursorPt=null)):this._splitSel?this._splitSel=null:this._tool="draw")):"merge"===this._tool?(e.preventDefault(),void(this._mergeSel?this._mergeSel=null:this._tool="draw")):this._wallDialog?(e.preventDefault(),void(this._wallDialog=null)):void("opening"!==this._tool&&"wallthick"!==this._tool&&"delroom"!==this._tool&&"column"!==this._tool||(e.preventDefault(),"opening"===this._tool&&this._clearOpeningPlacement(!0),this._tool="draw"))}}_undoPoint(){if(this._path.length)return this._contourClosed?(this._path=this._path.slice(0,-1),void(this._closingWallCm=null)):void(this._activeWallChainPartitionIds.length&&this._path.length>1?this._undoActiveWallPoint():this._path=this._path.slice(0,-1))}_undoActiveWallPoint(){const e=[...this._activeWallChainPartitionIds],t=e[e.length-1],i=this._spaceModel()?.partitions.find(e=>e.id===t),n=this._path[0]?[...this._path[0]]:null,r=this._path.slice(0,-1).map(e=>[...e]),o=this._wallChainSegmentCms.slice(0,-1),s=this._geometryHistory.undo();if(!s)return this._activeWallChainPartitionIds=[],this._wallChainSegmentCms=[],this._wallChainRedo=[],void(this._path=n?[n]:[]);this._applyGeometryState(s.before,!0)?(this._activeWallChainId||=`chain-${Date.now().toString(36)}`,this._activeWallChainPartitionIds=e.slice(0,-1),this._path=r.length?r:n?[n]:[],this._wallChainSegmentCms=o,i&&this._wallChainRedo.push({id:i.id,point:[...i.b],cm:i.cm}),this._clearPlanSnapHover(),this._showToast(this._t("history.undone",{name:s.name}))):this._geometryHistory.clear()}static async getConfigElement(){return await import("./editor-CrFGSaM9.js"),document.createElement("houseplan-card-editor")}static getStubConfig(){return{type:"custom:houseplan-card"}}static _warmBootReset(e){for(const e of nv.values())for(const t of e)clearTimeout(t.evict);nv.clear(),ov=e&&e>0?e:1e4}static _warmBootStats(){let e=0,t=0;const i=[];for(const n of nv.values())for(const r of n)e++,r.dlg&&(t++,i.push(r.dlg.kind));return{keys:nv.size,slots:e,dlgs:t,drafts:i}}setConfig(e){const t=this._config,i=!!t&&Object.prototype.hasOwnProperty.call(t,"floor");this._config={icon_size:2.5,show_temperature:!0,live_states:!0,show_signal:!0,...e};(i!==this._hasFixedFloor||t?.floor!==this._config.floor)&&(this._hashApplied=!1,this._navApplied=!1,this._warmVpArmed=!1),this._config.kiosk&&(this._booting=!1,this._bootFading=!1),!this._hasFixedFloor&&e.default_floor&&this._commitSpace(e.default_floor,!0);try{this._zoomBySpace=JSON.parse(localStorage.getItem(lv)||"{}")||{}}catch{this._zoomBySpace={}}try{const e=JSON.parse(localStorage.getItem(hv)||"{}")||{};this._viewPreference=Object.fromEntries(Object.entries(e).filter(e=>"flat"===e[1]||"iso"===e[1]))}catch{this._viewPreference={}}if(this._labs=Hf(),this.isConnected&&this._labsIso&&this._ensureIsoSceneRuntime(),!this._summary?.applyLocalScaleForCurrentIdentity())try{const e=JSON.parse(localStorage.getItem("houseplan_card_kiosk_v1")||"null");this._kioskScale={icon:Bn(e?.icon),font:Bn(e?.font)}}catch{}try{const e=JSON.parse(localStorage.getItem(av)||"null");this._adoption.restoreCached(e)&&(this._seedDecorStyle(this._serverCfg),this._cfgEpoch++,this._virtualLights=Eh(e.virtual_lights,this._cfgRev),this._serverStorage=!0)}catch{}this._adoptInitialSpace(this._model,this._loadOk),"view"!==this._mode||this._view||(this._zoom=this._zoomBySpace[this._space]||1),this.isConnected&&(this._syncCycleTimer(),this._warmAdopt(),this._warmLongReturn&&this._beginResumeSettle(),this._warmLongReturn=!1),this._syncVersionRecovery()}_warmAdopt(){if(this._config?.kiosk)return;const e=Mf(this._config);if(this._warmKey===e&&this._warmSlot)return;this._warmSlot&&this._warmRelease();const t=this.parentNode,i=this._warmIdx(t),n=nv.get(e);if(!n||!n.length)return;const r=n.find(e=>e.owner===this._warmGen);if(r)return this._warmLongReturn=!!r.freed&&Date.now()-r.freed>=tc,clearTimeout(r.evict),r.evict=0,r.freed=0,r.live=!0,this._warmSlot=r,this._warmKey=e,r.frameFingerprint&&this._continuity.adoptCompleteFrame(r.frameFingerprint),void(!this._devices.length&&r.devices?.length&&(this._devices=[...r.devices]));const{slot:o,sure:s}=((e,t,i,n)=>{const r=e=>{const t=!!i&&e.place?.deref()===i;return t&&e.idx===n?4:e.live?0:t?3:2};let o=null,s=0,a=0,l=null;for(const i of e){if(i.owner===t)continue;l=i;const e=r(i);e<=0||(e>s?(o=i,s=e,a=1):e===s&&a++)}return!o||a>1?{slot:o||l,sure:!1}:{slot:o,sure:!0}})(n,this._warmGen,t,i);o&&(this._warmLongReturn=!!o.freed&&Date.now()-o.freed>=tc,this._booting=!1,this._bootFading=!1,this._hdrH=o.hdrH,this._bootSoft=!0,this.isConnected&&(clearTimeout(this._bootSoftTimer),this._bootSoftTimer=window.setTimeout(()=>{this._bootSoft=!1},iv)),this._warmKey=e,s?(clearTimeout(o.evict),o.evict=0,o.owner=this._warmGen,o.place=t?new WeakRef(t):null,o.idx=i,o.live=!0,this._warmSlot=o,this._warmVp=o.vp,o.frameFingerprint&&this._continuity.adoptCompleteFrame(o.frameFingerprint),!this._devices.length&&o.devices?.length&&(this._devices=[...o.devices]),this._warmAdoptViewport(this._config)):(this._warmSlot={owner:this._warmGen,path:location.pathname,place:t?new WeakRef(t):null,idx:i,live:!0,hdrH:o.hdrH,stageH:o.stageH,vp:null,frameFingerprint:"",devices:null,dlg:null,freed:0,evict:0},n.push(this._warmSlot),this._warmTrim(n)))}_warmIdx(e){const t=e?.children;if(!t)return-1;for(let e=0;e4;){const t=e.findIndex(e=>!e.live);if(t<0)break;clearTimeout(e[t].evict),e.splice(t,1)}}_warmScheduleEvict(e,t){if(clearTimeout(e.evict),!(e.dlg||e.vp&&"view"!==e.vp.mode))return;const i=e.freed,n=e.owner;e.evict=window.setTimeout(()=>{if(e.evict=0,e.freed!==i||e.owner!==n)return;var r;e.dlg=null,e.vp=(r=e.vp)&&"view"!==r.mode?{...r,mode:"view",zoom:r.snap?.space===r.space?r.snap.zoom:r.zoom,view:null,snap:null,tool:"draw",decorTool:"select",showHidden:!1,selId:null,rszSel:null,decorSel:null}:r,e.frameFingerprint="";const o=nv.get(t);if(!e.live&&o&&o.length>1){const t=o.indexOf(e);t>=0&&o.splice(t,1)}},ov+250)}_warmAdoptViewport(e){const t=this._warmVp;if(!t||this._warmSlot?.path!==location.pathname)return void(this._warmVp=null);const i=this._fixedFloorState();if(this._hashApplied||!this._model.find(e=>e.id===t.space)||"valid"===i.kind&&i.id!==t.space||this._hasFixedFloor&&"valid"!==i.kind)return void(this._warmVp=null);this._commitSpace(t.space,!0),this._navApplied=!0;const n="view"!==t.mode&&this._canEdit&&!e.kiosk?t.mode:"view";this._adoptMode("view"),this._pendingNavMode="view"===t.mode||this._canEdit||e.kiosk?null:t.mode,this._zoom=t.zoom;const r=this._effectiveProjection(),o=r===t.projection&&this._labsIso===t.activeLabsIso;if(this._view=o&&t.view?{...t.view}:null,this._viewModeSnap=o&&t.snap?{...t.snap}:null,!o&&t.logicalCenter){const e="iso"===r?sf([t.logicalCenter.x,t.logicalCenter.y],0):[t.logicalCenter.x,t.logicalCenter.y];this._applyView(t.zoom,e[0],e[1])}var s;this._tool="opening"===(s=function(e){return"partition"===e?"draw":e}(s=t.tool))?"draw":"string"==typeof s&&$f.has(s)?s:"draw",this._decorTool=t.decorTool,this._showHidden=t.showHidden,this._showFar!==t.showFar&&(this._showFar=t.showFar,this._frame=null),this._selId=t.selId,this._resize?.restoreSelection(t.rszSel),this._decorSel=t.decorSel,this._warmVpArmed=!0,"view"!==n&&this._requestMode(n,!1,!0)}_warmPatch(e,t=!1){if(this._config?.kiosk)return;const i=Mf(this._config);if(!this._warmSlot||this._warmKey===i){if(!this._warmSlot){if(!t)return;const e=this.parentNode;this._warmKey=i,this._warmSlot={owner:this._warmGen,path:location.pathname,place:e?new WeakRef(e):null,idx:this._warmIdx(e),live:!0,hdrH:this._hdrH,stageH:0,vp:null,frameFingerprint:"",devices:null,dlg:null,freed:0,evict:0};const n=nv.get(i)||[];for(n.push(this._warmSlot),nv.set(i,n),this._warmTrim(n);nv.size>8;){const e=nv.keys().next().value;if(void 0===e||e===i)break;for(const t of nv.get(e)||[])clearTimeout(t.evict);nv.delete(e)}}Object.assign(this._warmSlot,e)}}_warmViewportState(){const e=this._effectiveProjection();return{space:this._space,mode:this._mode,projection:e,activeLabsIso:this._labsIso,logicalCenter:this._logicalViewCenter(e),zoom:this._zoom,view:this._view?{...this._view}:null,snap:this._viewModeSnap?{...this._viewModeSnap}:null,tool:this._tool,decorTool:this._decorTool,showHidden:this._showHidden,showFar:this._showFar,selId:this._selId,rszSel:this._resize?.selectedRoomId,decorSel:this._decorSel}}_warmDialogState(){const e=(e,t)=>({kind:e,space:this._space,mode:this._mode,data:t});return this._tapConfirm||this._alignDialog||this._mergeDialog||this._importDialog||this._backupExportDialog||this._backupImportDialog?null:this._openingInfo?e("openingInfo",this._openingInfo.id):this._infoCard?e("info",this._infoCard.id):this._rulesDialog?this._rulesDialog.busy?null:e("rules",this._rulesDialog):this._settingsDialog?this._settingsDialog.busy?null:e("settings",this._settingsDialog):this._markerDialog?this._markerDialog.busy?null:e("marker",this._markerDialog):this._openingDialog?e("opening",this._openingDialog):this._backdropDialog?e("backdrop",this._backdropDialog):this._decorShapeDialog?e("decorShape",this._decorShapeDialog):this._decorTextDialog?e("decorText",this._decorTextDialog):this._roomDialog?e("room",{editId:this._roomEditId,fill:this._roomFill,customFill:this._roomCustomFill,tempMin:this._roomTempMin,tempMax:this._roomTempMax,tempSrc:this._roomTempSrc,humSrc:this._roomHumSrc,srcOpen:this._roomSrcOpen,srcFilter:this._roomSrcFilter,nameScale:this._roomNameScale,labelScale:this._roomLabelScale,areaSel:this._areaSel,nameSel:this._nameSel,pendingSplit:this._pendingSplit,wallFaceBatch:this._wallFaceBatch,path:this._path}):this._spaceDialog?this._spaceDialog.busy?null:e("space",this._spaceDialog):null}_warmSnapshot(){if(this._booting||this._config?.kiosk||"steady"!==this._continuity.state)return;const e={vp:this._warmViewportState(),frameFingerprint:this._continuity.frameFingerprint,devices:this._devices,hdrH:this._hdrH};if(this._warmRevivePending||(e.dlg=this._warmDialogState()),this.isConnected&&this._warmSlot?.owner===this._warmGen){const t=this.parentNode;e.place=t?new WeakRef(t):null,e.idx=this._warmIdx(t)}this._warmPatch(e)}_warmReviveDialog(){const e=this._warmSlot;if(this._warmReviveTimer=void 0,!e||!e.dlg)return void(this._warmRevivePending=!1);const t=e.dlg,i=e.freed;if(t.mode===this._mode||"view"===t.mode||this._warmVp?.mode!==t.mode||this._editorRuntime){if(this._warmRevivePending=!1,e.dlg=null,e.freed=0,clearTimeout(e.evict),e.evict=0,i&&!(Date.now()-i>ov)&&t.space===this._space&&t.mode===this._mode){switch(t.kind){case"space":this._spaceDialog={...t.data,busy:!1,savedBusy:!1};break;case"marker":this._markerDialog={...t.data,busy:!1};break;case"settings":this._settingsDialog={...t.data,busy:!1};break;case"rules":this._rulesDialog={...t.data,busy:!1};break;case"opening":this._openingDialog={...t.data};break;case"backdrop":this._backdropDialog={...t.data};break;case"decorShape":this._decorShapeDialog={...t.data};break;case"decorText":{this._decorTextDialog={...t.data};const e=String(this._decorTextDialog?.text??"").length;this._decorTextSelection={start:e,end:e};break}case"room":{const e=t.data;this._roomEditId=e.editId,this._roomFill=e.fill,this._roomCustomFill=e.customFill||null,this._roomTempMin=e.tempMin||"",this._roomTempMax=e.tempMax||"",this._roomTempSrc=e.tempSrc,this._roomHumSrc=e.humSrc,this._roomSrcOpen=e.srcOpen,this._roomSrcFilter=e.srcFilter,this._roomNameScale=e.nameScale,this._roomLabelScale=e.labelScale,this._areaSel=e.areaSel,this._nameSel=e.nameSel,this._pendingSplit=e.pendingSplit,this._wallFaceBatch=e.wallFaceBatch||null,this._path=e.path,this._wallFaceBatch&&(this._activeWallChainId=`chain-${Date.now().toString(36)}`,this._activeWallChainPartitionIds=[...this._wallFaceBatch.activePartitionIds],this._wallChainSegmentCms=[...this._wallFaceBatch.activeCms]),this._roomDialog=!0;break}case"info":{const e=this._devices.find(e=>e.id===t.data);e&&(this._infoCard=e);break}case"openingInfo":{const e=(this._curSpaceCfg?.openings||[]).find(e=>e.id===t.data);e&&(this._openingInfo=e);break}}this.requestUpdate()}}else this._warmRevivePending=!0}_cacheSnapshot(){if(this._serverCfg)try{this._virtualLights=function(e,t,i){if(e.configRev===i)return e;const n=new Set((Array.isArray(t?.markers)?t.markers:[]).filter(Lh).map(e=>e.id));return{...e,configRev:i,off:new Set([...e.off].filter(e=>n.has(e)))}}(this._virtualLights,this._serverCfg,this._cfgRev);const e=this._adoption.snapshot(function(e){return{rev:e.rev,config_rev:e.configRev,off:[...e.off].sort()}}(this._virtualLights));e&&localStorage.setItem(av,JSON.stringify(e))}catch{}}_beginContinuityCandidate(e,t,i="plan"){return this._booting&&!this._continuity.hasCompleteFrame?this._continuity.token:(this._continuityDataReady=t,this._continuityPaintToken=-1,this._stagedDeviceSnapshotToken=-1,this._resumeSettling=!0,this._continuity.beginCandidate(e,i))}_continuityStageValid(){const e=this._stageEl;return!!e&&e.clientWidth>0&&e.clientHeight>0}_versionReloadSafetySnapshot(){return kg(this)}_continuityAssetsReady(){if(!this._model.length)return!1;const e=this._model.length?this._spaceModel():null;return!e?.bg?.href||this._signer.isReady(this.hass,e.bg.href)}_initialSpaceSelection(e,t=this._loadOk){const i=this._fixedFloorState(e,t);return"valid"===i.kind?{id:i.id,source:"fixed"}:this._hasFixedFloor?{id:null,source:"none"}:function(e){const t=new Set(e.spaceIds.filter(e=>!!e));if(!t.size)return{id:null,source:"none"};const i=[["hash",!1===e.acceptHash?null:e.hashSpace],["current",e.preserveCurrent?e.currentSpace:null],["saved",e.savedSpace],["default",e.defaultSpace],["first",e.spaceIds[0]]];for(const[e,n]of i)if(n&&t.has(n))return{id:n,source:e};return{id:null,source:"none"}}({spaceIds:e.map(e=>e.id),hashSpace:this._hashSpace(),acceptHash:!this._hashApplied,currentSpace:this._space,preserveCurrent:this._hashApplied||this._navApplied||this._warmVpArmed,savedSpace:this._savedNav()?.space,defaultSpace:this._config?.default_floor})}_adoptInitialSpace(e,t=this._loadOk){const i=this._initialSpaceSelection(e,t);return i.id?(this._commitSpace(i.id,!0),"hash"===i.source&&(this._hashApplied=!0),"saved"===i.source&&(this._navApplied=!0),i):i}_candidateBackdrop(e,t=this._space){const i=Ya(e),n=this._fixedFloorState(i,!0);if(this._hasFixedFloor&&"valid"!==n.kind)return"";const r=this._initialSpaceSelection(i,!0).id||(i.some(e=>e.id===t)?t:i[0]?.id);return i.find(e=>e.id===r)?.bg?.href||""}_visualFrameFingerprint(){const e=this._stageEl,t=e?[e.clientWidth,e.clientHeight]:[0,0];return lc([this._cfgRev,this._adoption.currentConfigFingerprint(),this._layoutRev,this._adoption.currentLayoutFingerprint(),this._space,this._mode,this._view,t,this._glowScreenBlend?"screen":"normal",this.hass?.themes?.darkMode??this.hass?.themes?.default_theme??""])}_settleContinuityFrame(){if(this._booting||!this._continuityStageValid())return;if(!this._continuity.hasCompleteFrame&&"steady"===this._continuity.state)return void(this._continuityAssetsReady()&&(this._renderSnapshotAt=Date.now(),this._continuity.markCompleteFrame(this._visualFrameFingerprint())));if(!this._continuityDataReady)return;if(!["holding","offline-stale","overlay-pending","overlay-visible","candidate-ready"].includes(this._continuity.state))return;const e=this._continuity.token;if(this._candidateDeviceSnapshot&&this._candidateDeviceSnapshot!==this._visibleDeviceSnapshot&&this._stagedDeviceSnapshotToken!==e)return this._stagedDeviceSnapshotToken=e,void this.requestUpdate();this._continuityPaintToken!==e&&(this._continuityPaintToken=e,this._continuity.candidateReady(e)&&this._continuity.commitAfterPaint(e,{updateComplete:()=>this.updateComplete,stageValid:()=>this.isConnected&&this._continuityStageValid(),assetsReady:()=>this._continuityAssetsReady(),frameFingerprint:()=>this._visualFrameFingerprint()}).then(t=>{t&&e===this._continuity.token?(this._resumeSettling=!1,this._renderSnapshotAt=Date.now(),this._candidateDeviceSnapshot&&(this._visibleDeviceSnapshot=this._candidateDeviceSnapshot),this._candidateDeviceSnapshot=null,this._stagedDeviceSnapshotToken=-1,this._warmSnapshot()):e===this._continuity.token&&(this._continuityPaintToken=-1,this._stagedDeviceSnapshotToken=-1,this._candidateDeviceSnapshot=null,this.requestUpdate())}))}_onBackdropLoaded(e,t){this._signer.markLoaded(this.hass,e,t),this._continuity.note("asset-ready"),this._continuityPaintToken=-1,"steady"!==this._continuity.state&&this.requestUpdate()}_renderRecoveryOverlay(){if(!this._continuity.overlayVisible&&"recovery-error"!==this._continuity.state)return G;const e="connection"===this._continuity.recoveryReason;return j`
e.stopPropagation()} @click=${e=>e.stopPropagation()} @@ -356,7 +356,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae aria-label=${this._t("editor.loading_aria")}> ${this._t("editor.loading")} -
`:G}houseplanContinuityTrace(){return[...this._continuityHistory,...this._continuity.trace].slice(-80).map(e=>({...e,...e.stage?{stage:[...e.stage]}:{}}))}getCardSize(){return 12}getGridOptions(){return{columns:"full"}}get _norm(){return!(!this._serverCfg||!this._serverCfg.spaces.length)}_cfgFingerprint(){const e=this._serverCfg?.spaces||[];let t=e.length+":";for(const i of e){t+=(i.id||"")+","+(i.plan_aspect||"")+","+(i.plan_url||"").length+","+(i.plan_x??"")+","+(i.plan_y??"")+","+(i.plan_scale??"")+","+(i.plan_scale_x??"")+","+(i.plan_scale_y??"")+","+(i.plan_angle??"")+","+(i.rooms?.length||0)+","+(i.openings?.length||0)+","+(i.decor?.length||0)+";";for(const e of i.rooms||[]){const i=e.poly?.[0],n=e.poly?.[e.poly.length-1];t+=(e.poly?.length||0)+"."+(e.id||"")+"."+(e.open_to||[]).join("+")+"."+(e.area||"")+"."+JSON.stringify(e.settings||0)+"."+(e.x??"")+","+(e.y??"")+","+(e.w??"")+","+(e.h??"")+","+(i?i[0]+"/"+i[1]:"")+","+(n?n[0]+"/"+n[1]:"")+";"}}return t}get _model(){if(!this._serverCfg)return[];const e=this._cfgEpoch+"|"+this._cfgFingerprint();if(this._modelCache&&this._modelCache.key===e)return this._modelCache.model;const t=this._buildModel();return this._modelCache={key:e,model:t},t}_buildModel(){if(!this._serverCfg)return[];const e=this._renderCfg;return Ya(e).map((t,i)=>{const n=e.spaces[i]?.plan_url;return t.bg&&n?{...t,bg:{...t.bg,href:n}}:t})}_spaceModel(){return this._hasFixedFloor?bc(this._model,this._space):(e=this._model,t=this._space,e.find(e=>e.id===t)??e[0]);var e,t}_spaceModelById(e){return bc(this._model,e)}_syncEmptySpaceState(){if(!!this._serverCfg&&0===this._serverCfg.spaces.length){if(!this._emptySpaceStateActive){this._emptySpaceStateActive=!0,this._clearRoomFocus(!0);for(const e of this._pointers.keys())for(const t of this.renderRoot.querySelectorAll("*"))try{t.hasPointerCapture?.(e)&&t.releasePointerCapture(e)}catch{}this._pointers.clear(),this._panStart=null,this._panLock=null,this._pinchStart=null,this._swipeStart=null,this._drag=null,this._deviceDrag=null,this._resetDeviceHitState(),this._rlResize=null,this._vacFit=null,this._compassDrag=!1,this._cancelModeTransition(!1),this._mode="view",this._clearGeometryGesture(),this._geometryHistory.clear(),this._devicePositionHistory.clear(),this._tip=null,this._hoverRoom=null,this._openingInfo=null,this._closeInfoCard(),this._deviceInbox=null,this._deviceInboxReturn=null,this._markerDialog=null,this._physicalDialog=null,this._backdropDialog=null,this._decorShapeDialog=null,this._decorTextDialog=null,this._roomDialog=!1,"edit"===this._spaceDialog?.mode&&(this._spaceDialog=null),this._editorSecondary?.closeForNavigation(),this._saveConfigDebounced.cancel(),this._frame=null,this._planSnapGeometryCache=null,this._hiddenWallDiagnosticCache=null,this._decorSnapCache=null,this._commitSpace("",!0)}}else this._emptySpaceStateActive=!1}get _areaToSpace(){const e={};for(const t of this._model)for(const i of t.rooms)i.area&&(e[i.area]={space:t.id,room:i});return e}get _settings(){return this._serverCfg?.settings||{}}get _showAll(){return this._showHidden||!this._settings.filter_seeded&&!!this._settings.show_all}_seedHiddenDevices(){if(!(this._loadOk&&this._serverCfg&&this._norm&&this._canEdit))return;const e=this._serverCfg,t=Jd({hass:this.hass,registry:this._haRegistry,areaToSpace:Object.fromEntries(Object.entries(this._areaToSpace).map(([e,t])=>[e,t.space])),markers:this._markers,settings:this._settings,excluded:this._excluded,firstSpaceId:this._model[0]?.id||"",iconRules:this._iconRules});if(!t.length&&e.settings?.filter_seeded)return;e.markers=e.markers||[];const i=[];for(const n of t){const t="h"+n.slice(n.indexOf(":")+1);e.markers.push({id:t,binding:n,hidden:!0}),i.push(n.slice(n.indexOf(":")+1))}const n={...e.settings||{},filter_seeded:!0};delete n.show_all,i.length&&Array.isArray(n.new_device_ids)&&(n.new_device_ids=n.new_device_ids.filter(e=>!i.includes(e))),e.settings=n,this._regSignature="",this._maybeRebuildDevices(),this._saveConfig(),this.requestUpdate()}get _iconRules(){const e=this._settings.icon_rules;if(!e||!Array.isArray(e)||!e.length)return;const t=JSON.stringify(e);return t!==this._rulesCompiledSrc&&(this._rulesCompiledSrc=t,this._rulesCompiled=Ee(e)),this._rulesCompiled}get _fillColors(){return gn(this._settings)}get _excluded(){return su(this._settings)}_setAreaLifecycleConfig(e){this._cfgEpochPreservedConfig=e,this._serverCfg=e}willUpdate(e){if(this._isoProjectionSnapshot=null,this._summary?.willUpdate(),e.has("hass")&&this._configReloadAuthority.observeContext(Uu(this)),e.has("_serverCfg")){const e=this._cfgEpochPreservedConfig===this._serverCfg;this._cfgEpochPreservedConfig=null,e||this._cfgEpoch++,this._renderLife.invalidate()}if(this._syncEmptySpaceState(),this._dangerConfirm&&(this._dangerConfirmMissingSpace()||"warm"===this._syncDangerConfirmLocaleGate())&&this._cancelDangerConfirm(),e.has("hass")&&this.hass){const t=this._visibleDeviceSnapshot||this._candidateDeviceSnapshot;this._renderLife.observe(e.get("hass"),this.hass,t?{entityIds:t.entityIds}:null,()=>Sg(this))}this._continuity.hasCompleteFrame&&"steady"===this._continuity.state&&this._continuity.refreshCompleteFrame(this._visualFrameFingerprint()),this._captureRenderDeviceSnapshot()}updated(){this._summary?.updated(),this._liveRt?.commit(),this._editorRuntime?._commitLiveEditor(),this._pruneDevicePressFeedback(),this._syncDayCycleClock(),this._syncRadarLive(),this._warmSnapshot(),this._editorRuntime&&this._dtMeasure();const e=this._stageEl;e&&!this._roViewport&&(this._roViewport=new ResizeObserver(()=>{this._invalidateDeviceHitGeometry(),this._refitView(),requestAnimationFrame(()=>this._summary?.resized())}),this._roViewport.observe(e)),e&&this._booting&&!this._bootTimer&&this._bootWatch();const t=this.renderRoot.querySelector(".hdr");if(t&&e&&!this._roHdr){const i=()=>{const t=Jg(this.renderRoot,e,this.panelHost);null!==t&&(t>=0&&t!==this._hdrH&&(this._hdrH=t),t>=0&&!this._booting&&!this._config?.kiosk&&e.clientHeight>0&&this._warmPatch({hdrH:t,stageH:e.clientHeight}))};this._roHdr=new ResizeObserver(()=>requestAnimationFrame(i)),this._roHdr.observe(t),this._onWinResize=()=>requestAnimationFrame(i),window.addEventListener("resize",this._onWinResize),i()}if(e&&!this._view&&this._refitView(),this._editorSecondary?.afterRender(),this._settleContinuityFrame(),this._serverStorage&&this._loadOk&&this._canManageConfiguration&&0===this._model.length&&!this._spaceDialog&&!this._importDialog&&!this._onboardingShown){this._onboardingShown=!0;const e=function(e){const t=e?.floors;if(!t||"object"!=typeof t)return[];const i=[];for(const e of Object.values(t))e&&e.floor_id&&i.push({id:e.floor_id,name:e.name||e.floor_id,level:e.level??null});return i.sort((e,t)=>{const i=e.level??1e9,n=t.level??1e9;return i!==n?i-n:e.name.localeCompare(t.name)}),i}(this.hass);e.length?this._importDialog={floors:e.map(e=>({...e,checked:!0}))}:this._openSpaceDialog("create")}}_adoptConfigCapabilities(e){wg(this,e)}_syncRadarLive(){const e=this._serverCfg?.settings?.radar,t=(this._serverCfg?.markers||[]).some(e=>Mg(e,this._space));this._radarLive.sync(this._space,1===this._haRadarStage1Api&&"view"===this._mode&&!1!==e?.show_live&&t&&"hidden"!==this.ownerDocument.visibilityState)}async _syncDecorAssets(e){const t=++this._decorAssetSyncToken;if(1!==this._haDecorAssetsApi||!this.hass)return void(this._decorAssets=new Map);const i=await hm(this.hass,am(e),this._cfgRev);t===this._decorAssetSyncToken&&(this._decorAssets=i,this._resign(),this.requestUpdate())}_adoptAuthoritative(e){return Bu(this,e)}_rollbackOptimistic(e){const t=this._adoption.rollbackOptimistic(e);return t&&this.requestUpdate(),t}_resumePendingNavMode(){if(!this._pendingNavMode||!this._canEdit||this._config?.kiosk)return!1;const e=this._pendingNavMode;return this._pendingNavMode=null,this._setMode(e,!1),!0}_getAuthoritativeConfig(){return e=this,async function(e,t){const i=await e();return t(i),i}(()=>e.hass.callWS({type:"houseplan/config/get"}),t=>wg(e,t));var e}async _loadFromServer(){this._loading=!0,this._loadTries++;const e=this._space,t=!!this._view;let i=!1;const n=()=>{i=!0,this._regSignature="",this._maybeRebuildDevices()};try{const[i,r]=await Promise.all([this._getAuthoritativeConfig(),this.hass.callWS({type:"houseplan/layout/get"})]);if("adopted"!==(await this._adoptAuthoritative({cfgResp:i,layResp:r,reason:"structural-response",profile:"reload",beforeAdopt:()=>{this._connectionWasLost=!1,this._serverStorage=!0},afterAdopt:()=>{this._warmVpArmed&&this._space===this._warmVp?.space?this._warmVpArmed=!1:t&&this._space===e||this._restoreZoom(),this._loadOk=!0,n()}})).status)return;this.hass.callWS({type:"houseplan/trail/get"}).then(e=>{this._vacSrvTrails=e?.trails||{},this.requestUpdate()}).catch(()=>{}),this._ensureLiveSyncSubscriptions()}catch(e){if(this._serverCfg)this._scheduleLoadRetry(!0);else if(this._loadTries>=8){this._serverStorage=!1;try{this._layout=JSON.parse(localStorage.getItem(sv)||"{}")||{}}catch{this._layout={}}}}finally{this._loading=!1,this._continuityDataReady=!0,i||n(),this.requestUpdate()}}_ensureLiveSyncSubscriptions(){const e=this.hass?.connection;if(!e)return;if(e!==this._liveSyncConnection&&(this._unsubCfg?.(),this._unsubCfg=null,this._unsubLayout?.(),this._unsubLayout=null,this._unsubTrail?.(),this._unsubTrail=void 0,this._unsubVirtual?.(),this._unsubVirtual=null,this._liveSyncGeneration++,this._liveSyncAttempt=null,this._liveSyncConnection=e),this._liveSyncAttempt)return;const t=this._liveSyncGeneration,i=[],n=(n,r,o,s)=>{n()||i.push(async()=>{const i=await e.subscribeEvents(s,o);t===this._liveSyncGeneration&&this.isConnected&&this.hass?.connection===e&&!n()?r(i):i?.()})};if(n(()=>this._unsubCfg,e=>{this._unsubCfg=e},"houseplan_config_updated",e=>{const t=Number(e?.data?.rev??-1);t!==this._cfgRev&&this._reloadConfigOnly(!1,t)}),n(()=>this._unsubTrail,e=>{this._unsubTrail=e},"houseplan_trail_updated",async()=>{try{const e=await this.hass.callWS({type:"houseplan/trail/get"});this._vacSrvTrails=e?.trails||{},this.requestUpdate()}catch{}}),n(()=>this._unsubLayout,e=>{this._unsubLayout=e},"houseplan_layout_updated",e=>this._onLayoutEvent(Number(e?.data?.rev??-1))),n(()=>this._unsubVirtual,e=>{this._unsubVirtual=e},"houseplan_virtual_light_updated",e=>{const t=qh(this._virtualLights,e?.data);t!==this._virtualLights&&(this._virtualLights=t,this._capturedSnapshotVirtual="",this._cacheSnapshot(),this.requestUpdate())}),!i.length)return;const r=function(e){return Promise.allSettled(e.map(e=>Promise.resolve().then(e)))}(i).then(()=>{});this._liveSyncAttempt=r,r.finally(()=>{this._liveSyncAttempt===r&&(this._liveSyncAttempt=null)})}async _reloadConfigOnly(e=!1,t){return Gu(this,e,t)}_scheduleLoadRetry(e=!1){if(void 0!==this._loadRetryTimer)return;const t=Math.min(8e3,500*2**Math.min(4,Math.max(1,this._loadTries-7)));this._loadRetryTimer=window.setTimeout(()=>{this._loadRetryTimer=void 0,!e&&this._loadOk||this._loading||!this.hass||this._loadFromServer()},t)}async _ensureLiveRuntime(){if(this._liveRt)return;const e=await import("./live-interaction-runtime-CO9GuTnQ.js");this._liveRt=new e.LiveRuntime(this),this.isConnected&&this.requestUpdate()}_liveVp(e=!1){this._liveRt?this._liveRt.viewport(e):this.requestUpdate()}_syncLiveHover(){this._liveRt?this._liveRt.hover():this.requestUpdate()}_flushHa(){this._liveRt?.take()&&(this._terminalFrame=2,super.requestUpdate())}_ensureHaRegistryAuthority(){const e=this.hass?.connection||null;e&&e!==this._haRegistryConnection&&(this._haRegistryRelease?.(),this._haRegistryConnection=e,this._haRegistryRev=-1,this._haBindingCacheKey="",this._renderLife.invalidate(),this._areaSnapshotCleanupCandidates.clear(),this._planHassMemo=null,this._haRegistryRelease=Qh(this.hass,this._onHaRegistryUpdate),this._onHaRegistryUpdate())}get _haRegistry(){return td(this.hass)}get _planHass(){const e=this._haRegistry,t=nd(this.hass,e),i=this._planHassMemo;if(i&&i.hass===this.hass&&i.sig===t)return i.active;const n=od(this.hass,e),r=sd(this.hass,e);return this._planHassMemo={hass:this.hass,sig:t,active:n,full:r},n}_captureRenderDeviceSnapshot(){if(!this.hass)return;const e=Date.now(),t=[...this._activityRt.entries()].map(([t,i])=>`${t}:${i.gen}:${i.flashTs}:`+(i.flashKind&&(i.expiresAt||i.flashTs+Qm)>e?1:0)).join("|"),i=Hh(this._virtualLights);if(this._capturedSnapshotSequence===this._hassSequence&&this._capturedSnapshotDevices===this._devices&&this._capturedSnapshotLayout===this._layout&&this._capturedSnapshotConfigEpoch===this._cfgEpoch&&this._capturedSnapshotVirtual===i&&this._capturedSnapshotActivity===t)return;const n=this._planHass,r=new Map,o=new Map,s=new Set(["sun.sun"]);for(const e of this._summary?.entityIds()||[])s.add(e);this._vacFit?.source&&s.add(this._vacFit.source);const a=new Set,l=new Set,c=e=>{if(!e)return;const t=e.indexOf(":");if(t<0)return void s.add(e);const i=e.slice(0,t),n=e.slice(t+1);"device"===i?a.add(n):"entity"===i&&s.add(n)};for(const e of this._model)for(const t of e.rooms)t.area&&l.add(t.area),c(t.settings?.temp_source),c(t.settings?.hum_source);for(const e of this._serverCfg?.spaces||[])for(const t of e.openings||[])for(const e of ui(t))s.add(e);for(const e of this._serverCfg?.spaces||[])for(const t of e.decor||[])if("text"===t.kind){for(const e of String(t.text||"").matchAll(/\{([^{}\r\n]+)\}/g)){const t=Ki(e[1]);t?.entity&&s.add(t.entity)}t.entity&&s.add(t.entity),o.set(`decor:${e.id}:${t.id}`,Qi(t.text,t,n,e=>!!n.entities?.[e]&&!!n.states?.[e]&&!Xd(n,e,Yd(this._markers))))}const h=Id(n,this._devices,null,this._virtualLights);for(const e of this._devices){for(const t of[!1,!0])r.set(m_(e.id,t),d_(n,e,{liveStates:!1!==this._config?.live_states,showTemperature:!1!==this._config?.show_temperature,showSignal:t,activityRuntime:this._activityRt.get(e.id),sourceDetails:!1,lightDevices:this._devices,lightSources:h,registryHass:this._fullRegistryHass,reducedMotion:this._reducedMotion}));if(this._isVacDev(e)){const t=this._vacSource(e,n),i=t?qc(n?.states?.[t]?.attributes):null,r=this._vacRt.get(e.id),s=sh(e.id,e.marker?.vacuum??null,e.space,t),a=lh({routes:s,observed:ch(s,[t],t=>this._vacObservedMapId(e,t,n)),spaceIds:new Set(this._model.map(e=>e.id))});o.set(`vacuum:${e.id}`,{source:t,telemetry:i,routes:s,resolution:a,mapId:i?this._vacMapId(e,i,n):null,runtime:r?{trail:r.trail,lastTs:r.lastTs,moving:r.moving,jump:r.jump}:null,server:this._vacSrvTrails[e.id]||null})}}const d=__({sourceSequence:this._hassSequence,hass:n,devices:this._devices,presentations:r,positions:(u=this._model.length>0,p=this._devices,_=e=>this._livePos(e),u?new Map(p.map(e=>[e.id,_(e)])):new Map),facts:o,entityIds:s,deviceIds:a,areaIds:l});var u,p,_;this._capturedSnapshotSequence=this._hassSequence,this._capturedSnapshotDevices=this._devices,this._capturedSnapshotLayout=this._layout,this._capturedSnapshotActivity=t,this._capturedSnapshotConfigEpoch=this._cfgEpoch,this._capturedSnapshotVirtual=i,this._visibleDeviceSnapshot&&"steady"!==this._continuity.state?this._candidateDeviceSnapshot=d:(this._visibleDeviceSnapshot=d,this._candidateDeviceSnapshot=null)}get _renderDeviceSnapshot(){return this._stagedDeviceSnapshotToken===this._continuity.token?this._candidateDeviceSnapshot||this._visibleDeviceSnapshot:this._visibleDeviceSnapshot||this._candidateDeviceSnapshot}get _renderPlanHass(){return this._renderDeviceSnapshot?.hass||this._planHass}get _renderDevices(){return this._renderDeviceSnapshot?.devices||this._devices}get _renderVacuumDevices(){return this._renderDeviceSnapshot?.vacuumDevices||this._devices}get _fullRegistryHass(){return this._planHass,this._planHassMemo?.full||this.hass}_bindingStatus(e){return cd(this.hass,e,this._haRegistry)}houseplanDiagnostics(){const{registry:e,bindings:t}=this._renderLife.diagnostics(this.hass,this._markers,e=>this._bindingStatus(e));return{registry:{...e,lastSuccessAgeMs:e.lastSuccess?Math.max(0,Date.now()-e.lastSuccess):null},bindings:t}}_openBindingInHa(e){const[t,i]=e.split(":");if(i)if("device"!==t){if("entity"===t){const e=this._fullRegistryHass.entities?.[i];e?.device_id&&mv("/config/devices/device/"+encodeURIComponent(e.device_id))}}else mv("/config/devices/device/"+encodeURIComponent(i))}_bindingHasHaPage(e){const[t,i]=e.split(":");return!!i&&("device"===t||"entity"===t&&!!this._fullRegistryHass.entities?.[i]?.device_id)}_toggleMarkerDialogVisibility(){const e=this._markerDialog;if(!e)return;const t="ha"===e.bindingMode?this._bindingStatus(e.binding):null,i=e.hideFromPlan||"ha_disabled"===t?.kind;i&&"ha_disabled"===t?.kind?this._showToast(this._t("entity"===t.reason?"toast.ha_disabled_show_entity":"toast.ha_disabled_show_device")):i&&"unverified"===t?.kind?this._showToast(this._t("toast.ha_binding_unverified")):this._markerDialog={...e,hideFromPlan:!i}}_hookConnection(){const e=this.hass?.connection;e&&e!==this._connHooked&&(this._connHooked?.removeEventListener?.("ready",this._onConnReady),this._connHooked?.removeEventListener?.("disconnected",this._onConnLost),this._connHooked?.removeEventListener?.("reconnect-error",this._onConnLost),e.addEventListener?.("ready",this._onConnReady),e.addEventListener?.("disconnected",this._onConnLost),e.addEventListener?.("reconnect-error",this._onConnLost),this._connHooked=e)}_display(e){return this._signer.display(this.hass,e)}_referencedContentUrls(){const e=On(this._serverCfg);for(const t of this._decorAssets.values())e.add(t.url);return e}_resign(){this._signer.resign(this.hass,this._referencedContentUrls())}_onLayoutEvent(e){e<=this._layoutRev||(clearTimeout(this._layoutSyncTimer),this._layoutSyncTimer=window.setTimeout(()=>{e<=this._layoutRev||this._reloadLayoutOnly()},200))}_noteLayoutRev(e){this._adoption.noteLayoutRevision(e?.rev)}async _reloadLayoutOnly(){if(!this._serverStorage||!this.hass?.callWS)return;this._beginContinuityCandidate("layout-reload",!1);const e=new Map;for(const t of this._dirtyPos)this._layout[t]&&e.set(t,this._layout[t]);this._persistLayout.pending()&&this._persistLayout.flush();for(const[t,i]of this._sentPos)e.set(t,i);try{const t=await this.hass.callWS({type:"houseplan/layout/get"}),i={...t?.layout||{}};for(const[t,n]of e)null===n?delete i[t]:i[t]=n;this._adoption.adoptMergedLayout(i,t,()=>{this._cancelDeviceDrag(),this._devicePositionHistory.clear()}),this._canOptimizeUndo=!!t?.can_optimize_undo,this._undoKind=t?.undo_kind||null,this._cacheSnapshot(),this.requestUpdate()}catch{}finally{this._continuityDataReady=!0,this.requestUpdate()}}_persistLocalLayout(){this._layout=yo(no(this._layout)),localStorage.setItem(sv,JSON.stringify(this._layout))}_maybeRebuildDevices(){const e=this.hass;if(!e?.devices||!e?.entities||!e?.areas)return;const t=this._haRegistry,i=nd(e,t)+":"+Object.keys(e.areas).length+":"+(this._norm?"n":"l")+":"+bp(e,this._config?.language);if(i===this._regSignature&&this._devices.length)return;this._regSignature=i;const n=new Map(this._devices.map(e=>[e.id,e.bindingStatus?.kind||"active"]));this._devices=eu({hass:e,registry:t,areaToSpace:Object.fromEntries(Object.entries(this._areaToSpace).map(([e,t])=>[e,t.space])),markers:this._markers,settings:this._settings,excluded:this._excluded,showAll:this._showAll,firstSpaceId:this._model[0]?.id||"",loc:e=>this._t(e),iconRules:this._iconRules});const r=this._markers.filter(e=>!e.removed&&"virtual"!==e.binding).map(e=>e.binding).sort(),o=t.revision+":"+r.join("|");if(t.authoritative&&o!==this._haBindingCacheKey){const i=new Map;for(const n of r)i.set(n,cd(e,n,t));!function(e){if("undefined"==typeof localStorage||!e.size)return;const t=ld(),i=Date.now();for(const[n,r]of e)"active"===r.kind?t[n]={kind:"active",ts:i}:"ha_disabled"===r.kind&&(t[n]={kind:"ha_disabled",reason:r.reason,ts:i});const n=Object.fromEntries(Object.entries(t).sort((e,t)=>t[1].ts-e[1].ts).slice(0,1500));Vh=n;try{localStorage.setItem(Gh,JSON.stringify(n))}catch{}}(i),this._haBindingCacheKey=o}let s=null;if(t.authoritative&&(s=this._resolveAreaRelocations(t),this._areaRelocationIds=new Set(s.relocateIds),this._areaRelocationIds.size)){this._cancelDeviceDrag();const e=this._areaRelocationIds;this._devicePositionHistory.removeWhere(({before:t,after:i})=>e.has(t.deviceId)||e.has(i.deviceId));const t=this._markerDialog;if(t?.devId&&!t.roomTouched&&this._areaRelocationIds.has(t.devId)){const e=this._devices.find(e=>e.id===t.devId);e&&(this._markerDialog={...t,room:e.marker?.room_id?`${e.space}#@${e.marker.room_id}`:e.space&&e.area?`${e.space}#${e.area}`:""})}}this._defPos=this._defaultPositions(),this._syncNewDevices(),this._seedHiddenDevices(),s&&this._syncAreaRelocations(s),this._syncActivityRuntime();const a=new Set(this._devices.filter(e=>!e.hidden).map(e=>e.id));for(const e of this._vacRt.keys())a.has(e)||this._vacRt.delete(e);if(this._infoCard){const e=this._devices.find(e=>e.id===this._infoCard.id);this._infoCard=e&&"ha_disabled"!==e.bindingStatus?.kind?e:null}const l=this._devices.some(e=>"ha_disabled"===e.bindingStatus?.kind&&"ha_disabled"!==n.get(e.id));l&&("ha_disabled"!==this._infoCard?.bindingStatus?.kind&&"ha_disabled"!==this._devices.find(e=>e.id===this._infoCard?.id)?.bindingStatus?.kind||this._closeInfoCard(),this._deviceDrag&&"ha_disabled"===this._devices.find(e=>e.id===this._deviceDrag.id)?.bindingStatus?.kind&&(this._cancelDeviceDrag(),this._devicePositionHistory.clear()),clearTimeout(this._holdTimer),this._holdFired=!1,this._tip=null,this._tapConfirm=null),this._nativeMoreInfoEntity&&!this._planEntityAvailable(this._nativeMoreInfoEntity)&&(_v(this,"hass-more-info",{entityId:null}),this._nativeMoreInfoEntity=null)}_resolveAreaRelocations(e=this._haRegistry){const t=function(e){const t=Z_(e.snapshot),i=new Set(Object.values(t).map(e=>e.binding)),n=new Map;for(const[t,r]of e.previousCandidates||[])X_(t)&&Number.isFinite(r)&&i.has(t)&&n.set(t,r);const r=new Set,o=new Set;for(const t of e.markers||[])t.removed||(Y_(t.id)&&r.add(t.id),X_(t.binding)&&o.add(t.binding));const s=new Set(Object.keys(e.registryDevices||{})),a=new Set(Object.keys(e.registryEntities||{})),l=new Set(Object.keys(e.liveStates||{})),c=new Map;for(const[e,i]of Object.entries(t)){const t=c.get(i.binding)||[];t.push(e),c.set(i.binding,t)}const h=new Set;let d=!1;for(const[t,i]of c){const[c,u]=im(t);if(o.has(t)||i.some(e=>r.has(e))||("device"===c?s.has(u):a.has(u)||l.has(u))){n.delete(t);continue}const p="device"===c?s.size>0:a.size>0;if(!e.authoritative||!p)continue;const _=n.get(t);if(void 0!==_){if(_!==e.revision)for(const e of i)h.add(e)}else n.set(t,e.revision),d=!0}return{removeIds:h,candidates:n,needsConfirmationRefresh:d}}({snapshot:this._settings.marker_area_snapshot,authoritative:e.authoritative,revision:e.revision,registryDevices:e.devices,registryEntities:e.entities,liveStates:this.hass?.states,markers:this._markers,previousCandidates:this._areaSnapshotCleanupCandidates});return this._areaSnapshotCleanupCandidates=t.candidates,t.needsConfirmationRefresh&&this._canEdit&&ed(this.hass),nm({devices:this._devices,model:this._model,layout:this._layout,snapshot:this._settings.marker_area_snapshot,authoritative:e.authoritative,cleanupSnapshotIds:t.removeIds,coordinateScale:uv})}_syncNewDevices(){if(!this._norm||!this._loadOk||!this._serverCfg)return;const e=this._devices.filter(e=>!e.marker&&!e.virtual).map(e=>e.id).sort(),t=e.join(",");if(t===this._newSyncKey)return;this._newSyncKey=t;const i=this._settings,{fresh:n,known:r}=function(e,t){if(!Array.isArray(t))return{fresh:[],known:[...e]};const i=new Set(t),n=e.filter(e=>!i.has(e));return{fresh:n,known:n.length?[...t,...n]:t}}(e,i.known_devices);if(!Array.isArray(i.known_devices)||n.length){const e=[...new Set([...i.new_device_ids||[],...n])];this._serverCfg={...this._serverCfg,settings:{...i,known_devices:r,new_device_ids:e}},this._saveConfig()}}_syncAreaRelocations(e){if(!(this._loadOk&&this._serverCfg&&this._norm&&this._canEdit&&this._haRegistry.authoritative))return;const t=e.decisions.filter(e=>e.updateSnapshot||e.removeSnapshot);if(!t.length)return;const i=ac({snapshot:Z_(this._settings.marker_area_snapshot),decisions:t});i!==this._areaRelocationSyncKey&&(this._areaRelocationSyncKey=i,this._areaRelocationWrite=this._areaRelocationWrite.catch(()=>{}).then(async()=>{if(!this._serverCfg||!this._haRegistry.authoritative)return;const e=this._resolveAreaRelocations();this._areaRelocationIds=new Set(e.relocateIds);const t=new Set,i=new Map;let n=!1;for(const r of e.decisions){if(!r.relocate)continue;const e=mg(this._layout,r.id);try{await this._persistDevicePlacement(r.id,null),t.add(r.id),e&&i.set(r.id,e),this._areaRelocationIds.delete(r.id)}catch(t){n=!0,this._layout=gg(this._layout,r.id,e),this._showToast(this._t("toast.pos_save_failed",{err:this._errText(t)}))}}const r=this._settings,o=function(e,t,i=new Set){const n=Z_(e);for(const e of t.decisions)e.removeSnapshot?delete n[e.id]:e.updateSnapshot&&e.binding&&e.area&&(e.relocate&&!i.has(e.id)||(n[e.id]={binding:e.binding,area:e.area}));return n}(r.marker_area_snapshot,e,t),s=[...new Set([...Array.isArray(r.new_device_ids)?r.new_device_ids:[],...t])],a=ac(o)!==ac(Z_(r.marker_area_snapshot)),l=ac(s)!==ac(Array.isArray(r.new_device_ids)?r.new_device_ids:[]);if(a||l){const e=r.marker_area_snapshot,n=r.new_device_ids,a={...this._serverCfg,settings:{...r,marker_area_snapshot:o,...l?{new_device_ids:s}:{}}};this._setAreaLifecycleConfig(a);try{this._saveConfigDebounced.pending()&&this._saveConfigDebounced.cancel(),await this._writeConfig()}catch(r){const a=this._settings;if(ac(a.marker_area_snapshot)===ac(o)&&ac(a.new_device_ids)===ac(l?s:n)){const t={...a};void 0===e?delete t.marker_area_snapshot:t.marker_area_snapshot=e,void 0===n?delete t.new_device_ids:t.new_device_ids=n;const i={...this._serverCfg,settings:t};this._setAreaLifecycleConfig(i),this._adoption.refreshConfigFingerprint()}for(const e of t)this._areaRelocationIds.add(e);const c=new Set;for(const[e,t]of i)try{await this._persistDevicePlacement(e,t)}catch(t){c.add(e),this._showToast(this._t("toast.pos_save_failed",{err:this._errText(t)}))}this._areaRelocationSyncKey="",this._regSignature="";if("conflict"===(r&&"object"==typeof r&&"code"in r?r.code:void 0)?(this._showToast(this._t("toast.conflict")),await this._reloadConfigOnly(!0)):this._showToast(this._t("toast.cfg_save_failed",{err:this._errText(r)})),c.size&&this._serverCfg){const e=this._settings,t=[...new Set([...Array.isArray(e.new_device_ids)?e.new_device_ids:[],...c])],i={...this._serverCfg,settings:{...e,new_device_ids:t}};this._setAreaLifecycleConfig(i);try{await this._writeConfig()}catch(e){this._showToast(this._t("toast.cfg_save_failed",{err:this._errText(e)}))}}}}n&&(this._areaRelocationSyncKey=""),this.requestUpdate()}))}get _newIds(){const e=this._settings.new_device_ids;return new Set([...Array.isArray(e)?e:[],...this._areaRelocationIds])}_ackNewDevice(e){if(!this._newIds.has(e)||!this._serverCfg)return;const t=this._settings;this._serverCfg={...this._serverCfg,settings:{...t,new_device_ids:(t.new_device_ids||[]).filter(t=>t!==e)}},this._saveConfig(),this.requestUpdate()}get _markers(){return this._serverCfg?.markers||[]}_roomLqi(e){if(!e)return null;const t=[];for(const i of this._renderDevices){if(i.area!==e||i.virtual)continue;const n=Nd(this._renderPlanHass,i.entities);null!=n&&t.push(n)}return Ii(t)}_roomBounds(e){if(e.poly&&e.poly.length){const t=e.poly.map(e=>e[0]),i=e.poly.map(e=>e[1]),n=Math.min(...t),r=Math.min(...i);return{x:n,y:r,w:Math.max(...t)-n,h:Math.max(...i)-r}}return{x:e.x??0,y:e.y??0,w:e.w??0,h:e.h??0}}_defaultPositions(){const e={},t=this._config?.icon_size??2.5;for(const i of this._model){const n=t/100*wl(i)*1.3;for(const t of i.rooms){if(!t.area)continue;const r=this._devices.filter(e=>e.area===t.area&&e.space===i.id);if(!r.length)continue;const o=this._roomBounds(t),s=.1*Math.min(o.w,o.h),a=o.w-2*s,l=o.h-2*s,c=Math.max(1,Math.round(Math.sqrt(r.length*a/Math.max(l,1)))),h=Math.ceil(r.length/c),d=a/c,u=l/Math.max(h,1),p=r.map((e,t)=>({x:o.x+s+d*(t%c+.5),y:o.y+s+u*(Math.floor(t/c)+.5)}));Ei(p,o,n,.5*s),r.forEach((t,i)=>e[t.id]=il(p[i]))}}return e}_pos(e){const t=this._renderDeviceSnapshot?.positions.get(e.id);return t?{x:t.x,y:t.y}:this._livePos(e)}_livePos(e){const t=this._spaceModelById(e.space),i=this._areaRelocationIds.has(e.id)?void 0:this._layout[e.id];if(i)if(this._norm){if(i.s===e.space)return{x:i.x*uv,y:i.y*uv}}else if(void 0===i.s)return{x:i.x,y:i.y};return this._defPos[e.id]?this._defPos[e.id]:t?il(bl(t)):{x:500,y:500}}_devicePlacementForCanvas(e,t,i){if(!this._norm)return{x:Math.round(t),y:Math.round(i)};const n=this._gridPitch,r=Math.round(t/n)*n,o=Math.round(i/n)*n;return{s:e.space,x:rl(r/uv),y:rl(o/uv)}}_previewDevicePlacement(e,t){this._layout=gg(this._layout,e,t),this.requestUpdate()}_cancelDeviceDrag(){const e=this._deviceDrag;if(!e)return!1;this._editorRuntime?._cancelPointerMove("device"),this._deviceDrag=null,this._deviceHits.cancel(e.pointerId);try{e.source?.hasPointerCapture?.(e.pointerId)&&e.source.releasePointerCapture(e.pointerId)}catch{}return this._previewDevicePlacement(e.id,e.before),!0}async _persistDevicePlacement(e,t){if(this._layout=gg(this._layout,e,t),this._serverStorage){let i=null,n=!1;try{let r;if(null===t)i=null,this._sentPos.set(e,i),n=!0,r=await this.hass.callWS({type:"houseplan/layout/delete",device_id:e});else{const t=vo(this._layout[e]);ac(t)!==ac(this._layout[e])&&(this._layout={...this._layout,[e]:t}),i=t,this._sentPos.set(e,i),n=!0,r=await this.hass.callWS({type:"houseplan/layout/update",device_id:e,pos:t})}this._noteLayoutRev(r),this._adoption.refreshLayoutFingerprint(),this._cacheSnapshot()}finally{n&&this._sentPos.get(e)===i&&this._sentPos.delete(e)}return}this._persistLocalLayout()}_devicePositionStateValid(e){const t=this._devices.find(t=>t.id===e.deviceId);return!!t&&t.space===e.spaceId&&"ha_disabled"!==t.bindingStatus?.kind&&!!this._spaceModelById(e.spaceId)}async _runDevicePositionHistory(e){if(this._cancelDeviceDrag()||this._devicePositionBusy)return;const t="undo"===e?this._devicePositionHistory.undo():this._devicePositionHistory.redo();if(!t)return;const i="undo"===e?t.before:t.after;if(!this._devicePositionStateValid(i))return this._devicePositionHistory.clear(),this._showToast(this._t("history.device_stale")),void this.requestUpdate();const n=mg(this._layout,i.deviceId);i.spaceId!==this._space&&(this._commitSpace(i.spaceId),this._restoreZoom()),this._devicePositionBusy=!0,this._previewDevicePlacement(i.deviceId,i.placement);try{await this._persistDevicePlacement(i.deviceId,i.placement),this._showToast(this._t("undo"===e?"history.undone":"history.redone",{name:t.name}))}catch(t){this._previewDevicePlacement(i.deviceId,n),"undo"===e?this._devicePositionHistory.redo():this._devicePositionHistory.undo(),this._showToast(this._t("toast.pos_save_failed",{err:this._errText(t)}))}finally{this._devicePositionBusy=!1,this.requestUpdate()}}_undoDevicePosition(){this._runDevicePositionHistory("undo")}_redoDevicePosition(){this._runDevicePositionHistory("redo")}_savePos(e,t,i){this._spaceModelById(e.space)&&(this._layout=gg(this._layout,e.id,this._devicePlacementForCanvas(e,t,i)),this._dirtyPos.add(e.id),this._persistLayout())}_devicePresentation(e,t=!1!==this._config?.show_signal,i=!1){const n=i?null:this._renderDeviceSnapshot?.presentations.get(m_(e.id,t));return n||d_(this._renderPlanHass,e,{liveStates:!1!==this._config?.live_states,showTemperature:!1!==this._config?.show_temperature,showSignal:t,designPreview:i,activityRuntime:this._activityRt.get(e.id),sourceDetails:!1,lightDevices:this._renderDevices,registryHass:this._fullRegistryHass,reducedMotion:this._reducedMotion})}_deviceVisual(e){return this._devicePresentation(e).visual}_stateClass(e,t=this._deviceVisual(e)){const i=this._devicePresentation(e);return i.effectiveHidden?"":("icon_ripple"!==i.display||!1===this._config?.live_states||"alarm"===t.status||t.activity,h_({...i,visual:t}).join(" "))}_liveTemp(e){if(!this._config?.show_temperature)return null;if(!0===e.marker?.use_climate_temp){const t=Ld(this._renderPlanHass,e.entities);if(null!=t)return t}return"mdi:thermometer"!==e.icon&&"mdi:air-filter"!==e.icon?null:Hd(this._renderPlanHass,e.entities)}_bindingEntities(e){if("virtual"===e||!e)return[];const t=this._bindingStatus(e);return"active"===t.kind?t.enabledEntityIds:t.allEntityIds}_bindingHasClimate(e){return this._bindingEntities(e).some(e=>e.startsWith("climate."))}_bindingHasAlarm(e){return this._bindingEntities(e).some(e=>{const t=this._planHass?.states?.[e]||this.hass?.states?.[e],i=this._fullRegistryHass.entities[e]||this.hass?.entities?.[e];return Vn(e.split(".")[0],t?.attributes?.device_class||i?.device_class||i?.original_device_class)})}_deviceBindingActive(e,t=!0){if(e.virtual||"virtual"===e.bindingKind)return!0;if(!e.bindingKind||!e.bindingRef)return!1;const i=this._bindingStatus(`${e.bindingKind}:${e.bindingRef}`);return"active"===i.kind||(t&&this._showToast(this._t("ha_disabled"===i.kind?"toast.ha_disabled_action":"toast.ha_binding_unverified")),!1)}_openMoreInfo(e){e?this._planEntityAvailable(e)?(this._kiosk&&(this._cyclePausedUntil=Math.max(this._cyclePausedUntil,Date.now()+6e4)),this._nativeMoreInfoEntity=e,_v(this,"hass-more-info",{entityId:e})):this._showToast(this._t("toast.ha_disabled_action")):this._showToast(this._t("toast.no_entity"))}_interruptViewGesture(e,t){if(clearTimeout(this._holdTimer),clearTimeout(this._kioskHoldTimer),void 0!==e)for(const i of[t,this._stageEl])try{i?.hasPointerCapture?.(e)&&i.releasePointerCapture(e)}catch{}this._pointers.clear(),this._panStart=null,this._panLock=null,this._pinchStart=null,this._swipeStart=null,this._roomPointer=null,this._doubleFit.clear(),this._deviceHits.clearPointers()}_closeInfoCard(){this._interruptViewGesture(),this._holdFired=!1,this._infoCard=null}_invalidateDeviceHitGeometry(){this._deviceHits.invalidate()}_resetDeviceHitState(){this._deviceHits.reset(this.renderRoot)}_deviceHitOwnerAt(e,t){return"view"!==this._mode&&"devices"!==this._mode?null:this._deviceHits.at(this.renderRoot,this._renderDevices,this._space,e,t)}_deviceForPointerEvent(e,t){return this._deviceHits.pointer(this.renderRoot,this._renderDevices,this._space,e,t)}_deviceForClickEvent(e,t){return this._deviceHits.click(this.renderRoot,this._renderDevices,this._space,e,t)}_showDeviceTip(e,t){this._liveRt?this._liveRt.devicePointerTip(e,t):this._ensureLiveRuntime().then(()=>this._liveRt?.devicePointerTip(e,t))}_showDeviceFocusTip(e,t){const i=e.currentTarget;this._liveRt?this._liveRt.deviceFocusTip(i,t):this._ensureLiveRuntime().then(()=>this._liveRt?.deviceFocusTip(i,t))}_hideDeviceFocusTip(e){this._liveRt?.deviceBlur(e)}_clearPointerHover(){this._liveRt?this._liveRt.pointerLeave():this._clearTransientHover()}_ctxDevice(e,t){"view"===this._mode&&(t=this._deviceForPointerEvent(e,t),e.preventDefault(),e.stopPropagation(),this._deviceBindingActive(t)&&(t.primary?this._openMoreInfo(t.primary):this._infoCard=t))}_clickDevice(e,t){if("view"!==this._mode&&"devices"!==this._mode)return;if(e.stopPropagation(),t=this._deviceForClickEvent(e,t),this._deviceDrag?.moved||this._suppressClick||this._holdFired)return;if("devices"===this._mode)return void this._openMarkerDialog(t);const i=this._devices.find(e=>e.id===t.id);if(!i)return;const n=Ru(i.tapAction,i.primary?.split(".")[0]);if("none"===n)return;const r=(e,t)=>{i.marker?.tap_confirm?this._tapConfirm={kind:"run",text:e,exec:t}:t()};if("toggle"===n){const e=this._toggleIntent(i);if(!e)return;if(!Fu(e))return void this._showUnavailableToggleTargets(e);const t=e=>{const t=Fu(e);if(!t)return;if("virtual-light"===t.kind)return this._startDevicePressFeedback(i.id),void this.hass.callWS({type:"houseplan/virtual_light/toggle",marker_id:t.markerId}).then(e=>{const t=qh(this._virtualLights,e);t!==this._virtualLights&&(this._virtualLights=t,this._capturedSnapshotVirtual="",this._cacheSnapshot(),this.requestUpdate())}).catch(e=>this._showToast(this._t("toast.virtual_light_toggle_failed",{err:this._errText(e)})));const{command:n}=t;this._startDevicePressFeedback(i.id),this.hass.callService(n.domain,n.service,n.data).catch(e=>this._showToast(this._t("toast.error",{err:this._errText(e)})))},n=((o=e).targets.length?o.targets:o.skippedTargets).map(e=>e.name||e.entityId||e.ref).join(", ")||i.name;if(i.marker?.tap_confirm){const r=this._toggleConfirmationLines(e);if(!r.length)return;this._tapConfirm={kind:"toggle",text:this._t("confirm.tap_toggle",{name:n}),lines:r,initialIntent:e,deviceId:i.id,exec:()=>{const n=this._devices.find(e=>e.id===i.id),r=n?this._toggleIntent(n):null;r&&!Fu(r)&&this._showUnavailableToggleTargets(r)||(r&&Iu(e,r)?t(r):this._showToast(this._t("toast.tap_target_changed")))}}}else t(e);return}var o;if("info"===n)return this._interruptViewGesture(),void(this._infoCard=i);if(this._deviceBindingActive(i)){if("run"===n){const e=i.marker?.tap_target||"",t=function(e){const t=String(e||"").split(".")[0];return"automation"===t?{domain:"automation",service:"trigger"}:"script"===t?{domain:"script",service:"turn_on"}:"scene"===t?{domain:"scene",service:"turn_on"}:null}(e),n=this.hass.states[e];if(!t||!n)return void this._showToast(this._t("toast.run_target_missing"));const o=n.attributes?.friendly_name||e;return void r(this._t("confirm.tap_run",{name:o}),()=>{this._deviceBindingActive(i)&&this._planEntityAvailable(e)&&(this._startDevicePressFeedback(i.id),this.hass.callService(t.domain,t.service,{entity_id:e}).then(()=>{this._stampActivity(i.id,"event",this._activitySourceKey(i)),this.requestUpdate(),this._showToast(this._t("toast.run_started",{name:o}))}).catch(e=>this._showToast(this._t("toast.error",{err:this._errText(e)}))))})}"more-info"===n&&i.primary?this._openMoreInfo(i.primary):this._infoCard=i}}_showUnavailableToggleTargets(e){const t=function(e){if(!e||"group"!==e.kind||Fu(e)||"configured-targets-missing"!==e.noneReason)return[];if(!e.skippedTargets.length||e.skippedTargets.some(e=>!zu.has(e.reason)&&"secure"!==e.reason))return[];const t=[],i=new Set;for(const n of e.skippedTargets){if(!zu.has(n.reason))continue;const e=String(n.name||n.entityId||n.ref||"").trim();e&&!i.has(e)&&(i.add(e),t.push(e))}return t}(e);return!!t.length&&(this._showToast(1===t.length?this._t("toast.toggle_target_unavailable",{name:t[0]}):this._t("toast.toggle_targets_unavailable",{names:t.join(", ")})),!0)}_keyDevice(e,t){"Enter"!==e.key&&" "!==e.key||"view"!==this._mode&&"devices"!==this._mode||(e.preventDefault(),this._clickDevice(e,t))}_startDevicePressFeedback(e){const t=[...this.renderRoot.querySelectorAll(".dev[data-id]")].find(t=>t.dataset.id===e),i=t?.querySelector(".device-shell");if(!i||"function"!=typeof i.animate)return;const n=Number.parseFloat(this.ownerDocument.defaultView?.getComputedStyle(i).scale||""),r=Number.isFinite(n)?Math.max(.95,Math.min(1,n)):1;this._devicePressAnimations.get(e)?.cancel();const o=this._reducedMotion?[{outlineColor:"transparent",outlineStyle:"solid",outlineWidth:"0px"},{outlineColor:"var(--hp-accent, #3ea6ff)",outlineStyle:"solid",outlineWidth:"2px",outlineOffset:"2px",offset:.5},{outlineColor:"transparent",outlineStyle:"solid",outlineWidth:"0px"}]:[{scale:String(r)},{scale:"0.95",offset:.5},{scale:"1"}],s=i.animate(o,{duration:200,easing:"cubic-bezier(.22,.61,.36,1)"});this._devicePressAnimations.set(e,s);const a=()=>{this._devicePressAnimations.get(e)===s&&this._devicePressAnimations.delete(e)};s.addEventListener("finish",a,{once:!0}),s.addEventListener("cancel",a,{once:!0})}_cancelDevicePressFeedback(){for(const e of this._devicePressAnimations.values())e.cancel();this._devicePressAnimations.clear()}_pruneDevicePressFeedback(){if(!this._devicePressAnimations.size)return;const e=new Set([...this.renderRoot.querySelectorAll(".dev[data-id]")].map(e=>e.dataset.id||""));for(const[t,i]of this._devicePressAnimations)e.has(t)||(i.cancel(),this._devicePressAnimations.delete(t))}_t(e,t){return wp(bp(this.hass,this._config?.language),e,t)}get _colorPickerLabels(){return{title:this._t("color_picker.title"),hue:this._t("color_picker.hue"),saturation:this._t("color_picker.saturation"),value:this._t("color_picker.value"),hex:this._t("color_picker.hex"),invalidHex:this._t("color_picker.invalid_hex"),confirm:this._t("color_picker.confirm")}}_help(e){return this._editorRuntimeOrThrow()._help(e)}get _stageEl(){return this.renderRoot.querySelector(".stage")}_contentItems(e){const t=[];for(const i of this._devices){if(i.space!==e.id||i.hidden)continue;const n=this._pos(i);t.push({minX:n.x,minY:n.y,maxX:n.x,maxY:n.y})}if(e.id===this._space){for(const e of this._openingsR){const i=Number(e.angle)*Math.PI/180,n=Math.cos(i)*e.rlen/2,r=Math.sin(i)*e.rlen/2,o=ll([[e.rx-n,e.ry-r],[e.rx+n,e.ry+r]]);o&&t.push(o)}const i=this._decorH;for(const e of this._decorList){if("image"===e.kind&&!this._decorAssets.has(e.asset_id)&&"decor"!==this._mode)continue;const n=ll("line"===e.kind?[[e.x1*uv,e.y1*i],[e.x2*uv,e.y2*i]]:"text"===e.kind?[[e.x*uv,e.y*i]]:Fr({x:e.x*uv,y:e.y*i,w:e.w*uv,h:e.h*i,angle:e.angle}));n&&t.push(n)}for(const i of this._physicalBodiesR(e)){const e=ll(i);e&&t.push(e)}}return pl(e,t)}_frameOf(){const e=this._spaceModel();if(!e){this._frame=null;const e={x:0,y:0,w:uv,h:uv};return{rect:e,all:e,outliers:0}}const t=this._frame,i="view"!==this._mode;if(t&&t.id===e.id&&this._bdDrag)return t;if(t&&t.id===e.id&&t.model===e&&t.layout===this._layout&&t.devs===this._devices&&t.far===this._showFar&&t.grow===i)return t;const n=fl(this._contentItems(e));let r=n.all||yl(e),o=this._showFar?r:n.core||yl(e);return t&&t.id===e.id&&i&&t.grow&&(o=pv(t.rect,o),r=pv(t.all,r)),this._frame={id:e.id,model:e,layout:this._layout,devs:this._devices,far:this._showFar,grow:i,rect:o,all:r,outliers:n.outliers},this._frame}_isoSource(){const e=this._isoSceneRuntime;if(!e)return null;const t=this._spaceModel();if(!t)return null;const i=this._spaceWalls,n=this._openCuts(),r=this._openingsR;return e.createIsoStructuralSource({space:t,walls:i,openCuts:n,openings:r,partitionCuts:()=>this._partitionOpeningCuts(t),roomOpenings:()=>this._roomWallOpeningInputs(r,t),cellCm:this._cellCm,gridPitch:this._gridPitch,wallKeyPitch:this._wallKeyPitch,coordinateScale:uv,onBuild:()=>{this._isoStructuralBuildCount+=1}})}_isoSceneKey(){if(!this._labsIso||"view"!==this._mode)return null;try{return this._isoSource()?.key??null}catch{return this._isoInvalidKey()}}_isoInvalidKey(){return`${this._space}|invalid|${this._cfgEpoch}`}_clearIsoInvalidFallback(e){const t=`${this._space}|invalid|`;for(const i of this._isoFallback)i.startsWith(t)&&i!==e&&this._isoFallback.delete(i)}_isoScene(e=this._isoSource()){const t=this._isoSceneRuntime;if(!t||!e)return null;let i=this._frameOf().rect;const n=this._spaceDisplayForRender(),r=this._spaceModel();if(r&&n.showNames)for(const e of r.rooms)if(e.name){const t=this._labelPos(e,r.id);i=pv(i,{x:t.x,y:t.y,w:0,h:0})}const o=t.resolveIsoScene({source:e,cache:this._isoGeometryCache,cellCm:this._cellCm,liveFrame:i});if(!r||!n.showBorders)return o;const s=this._config?.icon_size??2.5,a=s>8?2.5:s,l=this._stageEl?.getBoundingClientRect?.()??null,c=l?.height?l.width/l.height:o.frame.w/o.frame.h,h=Oi([o.frame.x,o.frame.y,o.frame.w,o.frame.h],c),d=this._isoOverlayScene(r,this._renderDevices.filter(e=>e.space===r.id&&!e.hidden),h,n,t.resolveIsoDecorationLayers(n),o,a,w_(a),n.showLqi??this._config?.show_signal??!0,!1),u=d&&t.resolveIsoOverlayFitEnvelope({baseBounds:o.frame,entries:d.entries,stageSize:l,targetView:e=>Oi([e.x,e.y,e.w,e.h],c)});return u?{...o,frame:u.bounds,overlayFitEntries:d.entries}:o}_latchIsoFallback(e,t){if(this._isoFallback.has(e))return;this._isoFallback.add(e);const i=e.includes("|invalid|")?"invalid":e.split("|").pop()||"invalid";console.warn("HOUSEPLAN ISO FALLBACK: #89/#160",yf("structural",i,!0))}_effectiveProjection(){if(this._isoProjectionSnapshot)return this._isoProjectionSnapshot;const e=e=>this._isoProjectionSnapshot=e,t=()=>("iso"===this._renderProjection&&(this._cancelCameraTransition(!1),this._view=null,this._viewModeSnap=null),e("flat"));if(this._renderIsoScene=null,"iso"!==this._desiredProjection||!this._model.length||!this._isoSceneRuntime)return e("flat");if(!this._spaceDisplayForRender().showBorders)return this._isoFallback.has(`${this._space}|no-borders`)?t():e("iso");let i=this._isoInvalidKey();if(this._clearIsoInvalidFallback(i),this._isoFallback.has(i))return t();try{const n=this._isoSource();if(!n)return e("flat");if(i=n.key,this._isoFallback.has(i))return t();const r=this._isoScene(n);return r?this._isoFallback.has(r.key)?t():(this._renderIsoScene=r,e("iso")):e("flat")}catch(e){return this._latchIsoFallback(i,e),t()}}_scenePoint(e){return"iso"===this._renderProjection?sf(e,0):e}_floorView(e){if("iso"!==this._renderProjection)return e;const t=af([e.x,e.y]),i=af([e.x+e.w,e.y+e.h]);return{x:t[0],y:t[1],w:i[0]-t[0],h:i[1]-t[1]}}_isoOverlayScene(e,t,i,n,r,o,s,a,l,c=!0){const h=this._isoSceneRuntime;return h&&r?.structural&&o?h.buildIsoOverlayRenderScene({space:e,devices:t,openings:this._openingsR,view:i,display:n,layers:r,wallSilhouettes:o.wallSilhouettes,resolveCollisions:c,iconPct:s,deviceBasePct:a,showLqi:l,cellCm:this._cellCm,kioskIconScale:"view"===this._mode?this._kioskScale.icon:1,kioskFontScale:"view"===this._mode?this._kioskScale.font:1,stageSize:this._stageEl?.getBoundingClientRect?.(),selectedDeviceId:this._selId,focusedRoomId:this._roomFocus?.roomId,selectedOpeningId:this._openingInfo?.id,positionOf:e=>this._pos(e),presentationOf:(e,t)=>this._devicePresentation(e,t),labelPositionOf:(e,t)=>this._labelPos(e,t),labelScaleOf:e=>this._labelScale(e),openingEntityAvailable:e=>this._renderOpeningEntityAvailable(e),openingWallIndex:()=>this._openingWallIndexFor(e,this._openCuts()).value}):null}_baseVb(e=this._effectiveProjection(),t=this._renderIsoScene){if("iso"===e){if(!this._spaceDisplayForRender().showBorders){const e=hf({rect:this._frameOf().rect,wallHeight:0});return[e.x,e.y,e.w,e.h]}const e=t?.frame??this._frameOf().rect;return[e.x,e.y,e.w,e.h]}const i=this._frameOf().rect;return[i.x,i.y,i.w,i.h]}get _outliers(){return this._showFar?0:this._frameOf().outliers}_fitFar(){this._clearRoomFocus(),this._showFar=!0,this._frame=null,this.requestUpdate(),this._resetZoom()}_clearRoomFocus(e=!1){this._doubleFit.clear(),this._roomFocus=null,e&&(this._roomPointer=null)}_roomFitBounds(e,t){const i=ni(e);if(!i||!e.id)return null;const n=this._spaceWalls,r=this._openCuts(),o=this._wallUnionGeometry(),s=n.length&&this._innerRoomContour(t,e.id,r,o?.roomGeom,o?.multiWallNodes)||i,a=this._spaceDisplayForRender();let l=[];if(a.showBorders&&n.length){const i=Cs(t.rooms,e.id,n,r,this._wallKeyPitch,this._cellCm,this._gridPitch,uv);i&&(l=ia(i.poly,i.offsets,o?.multiWallNodes)||i.poly)}const c=this._effectiveProjection();return function(e){const t=e.floor,i=e.wall||[],n=e.padding??0;if(!t.length||!t.every(gf)||!i.every(gf)||!Number.isFinite(n)||n<0)return null;if("flat"===e.projection)return vf([...t,...i],n);const r=e.wallHeight??0,o=e.floorDepth??0;if(!Number.isFinite(r)||r<0||!Number.isFinite(o)||o<0)return null;try{const e=[];for(const i of t){const t=[i[0],i[1]];e.push(sf(t,0)),o>0&&e.push(sf(t,-o))}for(const t of i){const i=[t[0],t[1]];e.push(sf(i,0)),r>0&&e.push(sf(i,r))}return vf(e,n)}catch{return null}}({floor:s,wall:l,projection:c,wallHeight:"iso"===c&&a.showBorders?Ha(64,this._cellCm):0,floorDepth:"iso"===c&&a.showBorders?Ha(10,this._cellCm):0,padding:a.showBorders?Ha(1.25,this._cellCm):0})}_fitRoom(e,t=!0){if("view"!==this._mode)return!1;this._doubleFit.clear();const i=this._spaceModel(),n=i?.rooms.find(t=>t.id===e);if(!i||!n)return this._clearRoomFocus(),!1;let r=this._roomFitBounds(n,i);if(!r)return this._clearRoomFocus(),!1;this._roomFocus={spaceId:i.id,roomId:e};const o=this._stageEl;if(!o||o.clientWidth<=0||o.clientHeight<=0)return!0;const s=Oi(this._baseVb(),o.clientWidth/o.clientHeight),a=e=>function(e){const t=e.safeFraction??.8,{bounds:i,baseFit:n,stageWidth:r,stageHeight:o,minZoom:s,maxZoom:a}=e;if(!ff(i)||!ff(n)||!Number.isFinite(r)||r<=0||!Number.isFinite(o)||o<=0||!Number.isFinite(s)||s<=0||!Number.isFinite(a)||a1)return null;const l=r/o,c=Math.max(i.w/t,i.h/t*l);if(!Number.isFinite(c)||c<=0)return null;const h=Math.min(a,Math.max(s,n.w/c)),d=n.w/h,u=d/l;return{zoom:h,viewBox:{x:i.x+i.w/2-d/2,y:i.y+i.h/2-u/2,w:d,h:u}}}({bounds:e,baseFit:s,stageWidth:o.clientWidth,stageHeight:o.clientHeight,minZoom:yv.ZOOM_MIN,maxZoom:yv.ZOOM_MAX});let l=a(r);const c=this._isoSceneRuntime,h=this._renderIsoScene?.overlayFitEntries;if(l&&"iso"===this._effectiveProjection()&&c&&h?.length){const e=c.resolveIsoOverlayFitEnvelope({baseBounds:r,entries:h,ownerId:n.id,stageSize:{width:o.clientWidth,height:o.clientHeight},targetView:e=>a(e)?.viewBox??null});e&&(r=e.bounds,l=a(r))}if(!l)return this._clearRoomFocus(),!1;const d=this._cameraState(),u=function(e,t,i,n){const r=[e,t,i,n],o=Math.min(...r.map(e=>e.x)),s=Math.min(...r.map(e=>e.y));return{x:o,y:s,w:Math.max(...r.map(e=>e.x+e.w))-o,h:Math.max(...r.map(e=>e.y+e.h))-s}}(s,d.viewBox,l.viewBox,r);return l.viewBox=this._clampView(l.viewBox,u),t?(this._prepareCameraCommand(),this._startCameraTransition(l,u,"room",220),!0):(this._cancelCameraTransition(!1),Kg(d,l)||(this._zoom=l.zoom,this._view={...l.viewBox},this.requestUpdate()),!0)}_fitAll(e="fit"){this._clearRoomFocus(),this._showFar=!0,this._frame=null,this.requestUpdate(),this._resetZoom(e)}_renderFarHint(){return this._kiosk||"view"!==this._mode||this._booting||!this._outliers?G:j`
+
`:G}houseplanContinuityTrace(){return[...this._continuityHistory,...this._continuity.trace].slice(-80).map(e=>({...e,...e.stage?{stage:[...e.stage]}:{}}))}getCardSize(){return 12}getGridOptions(){return{columns:"full"}}get _norm(){return!(!this._serverCfg||!this._serverCfg.spaces.length)}_cfgFingerprint(){const e=this._serverCfg?.spaces||[];let t=e.length+":";for(const i of e){t+=(i.id||"")+","+(i.plan_aspect||"")+","+(i.plan_url||"").length+","+(i.plan_x??"")+","+(i.plan_y??"")+","+(i.plan_scale??"")+","+(i.plan_scale_x??"")+","+(i.plan_scale_y??"")+","+(i.plan_angle??"")+","+(i.rooms?.length||0)+","+(i.openings?.length||0)+","+(i.decor?.length||0)+";";for(const e of i.rooms||[]){const i=e.poly?.[0],n=e.poly?.[e.poly.length-1];t+=(e.poly?.length||0)+"."+(e.id||"")+"."+(e.open_to||[]).join("+")+"."+(e.area||"")+"."+JSON.stringify(e.settings||0)+"."+(e.x??"")+","+(e.y??"")+","+(e.w??"")+","+(e.h??"")+","+(i?i[0]+"/"+i[1]:"")+","+(n?n[0]+"/"+n[1]:"")+";"}}return t}get _model(){if(!this._serverCfg)return[];const e=this._cfgEpoch+"|"+this._cfgFingerprint();if(this._modelCache&&this._modelCache.key===e)return this._modelCache.model;const t=this._buildModel();return this._modelCache={key:e,model:t},t}_buildModel(){if(!this._serverCfg)return[];const e=this._renderCfg;return Ya(e).map((t,i)=>{const n=e.spaces[i]?.plan_url;return t.bg&&n?{...t,bg:{...t.bg,href:n}}:t})}_spaceModel(){return this._hasFixedFloor?bc(this._model,this._space):(e=this._model,t=this._space,e.find(e=>e.id===t)??e[0]);var e,t}_spaceModelById(e){return bc(this._model,e)}_syncEmptySpaceState(){if(!!this._serverCfg&&0===this._serverCfg.spaces.length){if(!this._emptySpaceStateActive){this._emptySpaceStateActive=!0,this._clearRoomFocus(!0);for(const e of this._pointers.keys())for(const t of this.renderRoot.querySelectorAll("*"))try{t.hasPointerCapture?.(e)&&t.releasePointerCapture(e)}catch{}this._pointers.clear(),this._panStart=null,this._panLock=null,this._pinchStart=null,this._swipeStart=null,this._drag=null,this._deviceDrag=null,this._resetDeviceHitState(),this._rlResize=null,this._vacFit=null,this._compassDrag=!1,this._cancelModeTransition(!1),this._mode="view",this._clearGeometryGesture(),this._geometryHistory.clear(),this._devicePositionHistory.clear(),this._tip=null,this._hoverRoom=null,this._openingInfo=null,this._closeInfoCard(),this._deviceInbox=null,this._deviceInboxReturn=null,this._markerDialog=null,this._physicalDialog=null,this._backdropDialog=null,this._decorShapeDialog=null,this._decorTextDialog=null,this._roomDialog=!1,"edit"===this._spaceDialog?.mode&&(this._spaceDialog=null),this._editorSecondary?.closeForNavigation(),this._saveConfigDebounced.cancel(),this._frame=null,this._planSnapGeometryCache=null,this._hiddenWallDiagnosticCache=null,this._decorSnapCache=null,this._commitSpace("",!0)}}else this._emptySpaceStateActive=!1}get _areaToSpace(){const e={};for(const t of this._model)for(const i of t.rooms)i.area&&(e[i.area]={space:t.id,room:i});return e}get _settings(){return this._serverCfg?.settings||{}}get _showAll(){return this._showHidden||!this._settings.filter_seeded&&!!this._settings.show_all}_seedHiddenDevices(){if(!(this._loadOk&&this._serverCfg&&this._norm&&this._canEdit))return;const e=this._serverCfg,t=Jd({hass:this.hass,registry:this._haRegistry,areaToSpace:Object.fromEntries(Object.entries(this._areaToSpace).map(([e,t])=>[e,t.space])),markers:this._markers,settings:this._settings,excluded:this._excluded,firstSpaceId:this._model[0]?.id||"",iconRules:this._iconRules});if(!t.length&&e.settings?.filter_seeded)return;e.markers=e.markers||[];const i=[];for(const n of t){const t="h"+n.slice(n.indexOf(":")+1);e.markers.push({id:t,binding:n,hidden:!0}),i.push(n.slice(n.indexOf(":")+1))}const n={...e.settings||{},filter_seeded:!0};delete n.show_all,i.length&&Array.isArray(n.new_device_ids)&&(n.new_device_ids=n.new_device_ids.filter(e=>!i.includes(e))),e.settings=n,this._regSignature="",this._maybeRebuildDevices(),this._saveConfig(),this.requestUpdate()}get _iconRules(){const e=this._settings.icon_rules;if(!e||!Array.isArray(e)||!e.length)return;const t=JSON.stringify(e);return t!==this._rulesCompiledSrc&&(this._rulesCompiledSrc=t,this._rulesCompiled=Ee(e)),this._rulesCompiled}get _fillColors(){return gn(this._settings)}get _excluded(){return su(this._settings)}_setAreaLifecycleConfig(e){this._cfgEpochPreservedConfig=e,this._serverCfg=e}willUpdate(e){if(this._isoProjectionSnapshot=null,this._summary?.willUpdate(),e.has("hass")&&this._configReloadAuthority.observeContext(Uu(this)),e.has("_serverCfg")){const e=this._cfgEpochPreservedConfig===this._serverCfg;this._cfgEpochPreservedConfig=null,e||this._cfgEpoch++,this._renderLife.invalidate()}if(this._syncEmptySpaceState(),this._dangerConfirm&&(this._dangerConfirmMissingSpace()||"warm"===this._syncDangerConfirmLocaleGate())&&this._cancelDangerConfirm(),e.has("hass")&&this.hass){const t=this._visibleDeviceSnapshot||this._candidateDeviceSnapshot;this._renderLife.observe(e.get("hass"),this.hass,t?{entityIds:t.entityIds}:null,()=>Sg(this))}this._continuity.hasCompleteFrame&&"steady"===this._continuity.state&&this._continuity.refreshCompleteFrame(this._visualFrameFingerprint()),this._captureRenderDeviceSnapshot()}updated(){this._summary?.updated(),this._liveRt?.commit(),this._editorRuntime?._commitLiveEditor(),this._pruneDevicePressFeedback(),this._syncDayCycleClock(),this._syncRadarLive(),this._warmSnapshot(),this._editorRuntime&&this._dtMeasure();const e=this._stageEl;e&&!this._roViewport&&(this._roViewport=new ResizeObserver(()=>{this._invalidateDeviceHitGeometry(),this._refitView(),requestAnimationFrame(()=>this._summary?.resized())}),this._roViewport.observe(e)),e&&this._booting&&!this._bootTimer&&this._bootWatch();const t=this.renderRoot.querySelector(".hdr");if(t&&e&&!this._roHdr){const i=()=>{const t=Jg(this.renderRoot,e,this.panelHost);null!==t&&(t>=0&&t!==this._hdrH&&(this._hdrH=t),t>=0&&!this._booting&&!this._config?.kiosk&&e.clientHeight>0&&this._warmPatch({hdrH:t,stageH:e.clientHeight}))};this._roHdr=new ResizeObserver(()=>requestAnimationFrame(i)),this._roHdr.observe(t),this._onWinResize=()=>requestAnimationFrame(i),window.addEventListener("resize",this._onWinResize),i()}if(e&&!this._view&&this._refitView(),this._editorSecondary?.afterRender(),this._settleContinuityFrame(),this._serverStorage&&this._loadOk&&this._canManageConfiguration&&0===this._model.length&&!this._spaceDialog&&!this._importDialog&&!this._onboardingShown){this._onboardingShown=!0;const e=function(e){const t=e?.floors;if(!t||"object"!=typeof t)return[];const i=[];for(const e of Object.values(t))e&&e.floor_id&&i.push({id:e.floor_id,name:e.name||e.floor_id,level:e.level??null});return i.sort((e,t)=>{const i=e.level??1e9,n=t.level??1e9;return i!==n?i-n:e.name.localeCompare(t.name)}),i}(this.hass);e.length?this._importDialog={floors:e.map(e=>({...e,checked:!0}))}:this._openSpaceDialog("create")}}_adoptConfigCapabilities(e){wg(this,e)}_syncRadarLive(){const e=this._serverCfg?.settings?.radar,t=(this._serverCfg?.markers||[]).some(e=>Mg(e,this._space));this._radarLive.sync(this._space,1===this._haRadarStage1Api&&"view"===this._mode&&!1!==e?.show_live&&t&&"hidden"!==this.ownerDocument.visibilityState)}async _syncDecorAssets(e){const t=++this._decorAssetSyncToken;if(1!==this._haDecorAssetsApi||!this.hass)return void(this._decorAssets=new Map);const i=await hm(this.hass,am(e),this._cfgRev);t===this._decorAssetSyncToken&&(this._decorAssets=i,this._resign(),this.requestUpdate())}_adoptAuthoritative(e){return Bu(this,e)}_rollbackOptimistic(e){const t=this._adoption.rollbackOptimistic(e);return t&&this.requestUpdate(),t}_resumePendingNavMode(){if(!this._pendingNavMode||!this._canEdit||this._config?.kiosk)return!1;const e=this._pendingNavMode;return this._pendingNavMode=null,this._setMode(e,!1),!0}_getAuthoritativeConfig(){return e=this,async function(e,t){const i=await e();return t(i),i}(()=>e.hass.callWS({type:"houseplan/config/get"}),t=>wg(e,t));var e}async _loadFromServer(){this._loading=!0,this._loadTries++;const e=this._space,t=!!this._view;let i=!1;const n=()=>{i=!0,this._regSignature="",this._maybeRebuildDevices()};try{const[i,r]=await Promise.all([this._getAuthoritativeConfig(),this.hass.callWS({type:"houseplan/layout/get"})]);if("adopted"!==(await this._adoptAuthoritative({cfgResp:i,layResp:r,reason:"structural-response",profile:"reload",beforeAdopt:()=>{this._connectionWasLost=!1,this._serverStorage=!0},afterAdopt:()=>{this._warmVpArmed&&this._space===this._warmVp?.space?this._warmVpArmed=!1:t&&this._space===e||this._restoreZoom(),this._loadOk=!0,n()}})).status)return;this.hass.callWS({type:"houseplan/trail/get"}).then(e=>{this._vacSrvTrails=e?.trails||{},this.requestUpdate()}).catch(()=>{}),this._ensureLiveSyncSubscriptions()}catch(e){if(this._serverCfg)this._scheduleLoadRetry(!0);else if(this._loadTries>=8){this._serverStorage=!1;try{this._layout=JSON.parse(localStorage.getItem(sv)||"{}")||{}}catch{this._layout={}}}}finally{this._loading=!1,this._continuityDataReady=!0,i||n(),this.requestUpdate()}}_ensureLiveSyncSubscriptions(){const e=this.hass?.connection;if(!e)return;if(e!==this._liveSyncConnection&&(this._unsubCfg?.(),this._unsubCfg=null,this._unsubLayout?.(),this._unsubLayout=null,this._unsubTrail?.(),this._unsubTrail=void 0,this._unsubVirtual?.(),this._unsubVirtual=null,this._liveSyncGeneration++,this._liveSyncAttempt=null,this._liveSyncConnection=e),this._liveSyncAttempt)return;const t=this._liveSyncGeneration,i=[],n=(n,r,o,s)=>{n()||i.push(async()=>{const i=await e.subscribeEvents(s,o);t===this._liveSyncGeneration&&this.isConnected&&this.hass?.connection===e&&!n()?r(i):i?.()})};if(n(()=>this._unsubCfg,e=>{this._unsubCfg=e},"houseplan_config_updated",e=>{const t=Number(e?.data?.rev??-1);t!==this._cfgRev&&this._reloadConfigOnly(!1,t)}),n(()=>this._unsubTrail,e=>{this._unsubTrail=e},"houseplan_trail_updated",async()=>{try{const e=await this.hass.callWS({type:"houseplan/trail/get"});this._vacSrvTrails=e?.trails||{},this.requestUpdate()}catch{}}),n(()=>this._unsubLayout,e=>{this._unsubLayout=e},"houseplan_layout_updated",e=>this._onLayoutEvent(Number(e?.data?.rev??-1))),n(()=>this._unsubVirtual,e=>{this._unsubVirtual=e},"houseplan_virtual_light_updated",e=>{const t=qh(this._virtualLights,e?.data);t!==this._virtualLights&&(this._virtualLights=t,this._capturedSnapshotVirtual="",this._cacheSnapshot(),this.requestUpdate())}),!i.length)return;const r=function(e){return Promise.allSettled(e.map(e=>Promise.resolve().then(e)))}(i).then(()=>{});this._liveSyncAttempt=r,r.finally(()=>{this._liveSyncAttempt===r&&(this._liveSyncAttempt=null)})}async _reloadConfigOnly(e=!1,t){return Gu(this,e,t)}_scheduleLoadRetry(e=!1){if(void 0!==this._loadRetryTimer)return;const t=Math.min(8e3,500*2**Math.min(4,Math.max(1,this._loadTries-7)));this._loadRetryTimer=window.setTimeout(()=>{this._loadRetryTimer=void 0,!e&&this._loadOk||this._loading||!this.hass||this._loadFromServer()},t)}async _ensureLiveRuntime(){if(this._liveRt)return;const e=await import("./live-interaction-runtime-rsvGGxyc.js");this._liveRt=new e.LiveRuntime(this),this.isConnected&&this.requestUpdate()}_liveVp(e=!1){this._liveRt?this._liveRt.viewport(e):this.requestUpdate()}_syncLiveHover(){this._liveRt?this._liveRt.hover():this.requestUpdate()}_flushHa(){this._liveRt?.take()&&(this._terminalFrame=2,super.requestUpdate())}_ensureHaRegistryAuthority(){const e=this.hass?.connection||null;e&&e!==this._haRegistryConnection&&(this._haRegistryRelease?.(),this._haRegistryConnection=e,this._haRegistryRev=-1,this._haBindingCacheKey="",this._renderLife.invalidate(),this._areaSnapshotCleanupCandidates.clear(),this._planHassMemo=null,this._haRegistryRelease=Qh(this.hass,this._onHaRegistryUpdate),this._onHaRegistryUpdate())}get _haRegistry(){return td(this.hass)}get _planHass(){const e=this._haRegistry,t=nd(this.hass,e),i=this._planHassMemo;if(i&&i.hass===this.hass&&i.sig===t)return i.active;const n=od(this.hass,e),r=sd(this.hass,e);return this._planHassMemo={hass:this.hass,sig:t,active:n,full:r},n}_captureRenderDeviceSnapshot(){if(!this.hass)return;const e=Date.now(),t=[...this._activityRt.entries()].map(([t,i])=>`${t}:${i.gen}:${i.flashTs}:`+(i.flashKind&&(i.expiresAt||i.flashTs+Qm)>e?1:0)).join("|"),i=Hh(this._virtualLights);if(this._capturedSnapshotSequence===this._hassSequence&&this._capturedSnapshotDevices===this._devices&&this._capturedSnapshotLayout===this._layout&&this._capturedSnapshotConfigEpoch===this._cfgEpoch&&this._capturedSnapshotVirtual===i&&this._capturedSnapshotActivity===t)return;const n=this._planHass,r=new Map,o=new Map,s=new Set(["sun.sun"]);for(const e of this._summary?.entityIds()||[])s.add(e);this._vacFit?.source&&s.add(this._vacFit.source);const a=new Set,l=new Set,c=e=>{if(!e)return;const t=e.indexOf(":");if(t<0)return void s.add(e);const i=e.slice(0,t),n=e.slice(t+1);"device"===i?a.add(n):"entity"===i&&s.add(n)};for(const e of this._model)for(const t of e.rooms)t.area&&l.add(t.area),c(t.settings?.temp_source),c(t.settings?.hum_source);for(const e of this._serverCfg?.spaces||[])for(const t of e.openings||[])for(const e of ui(t))s.add(e);for(const e of this._serverCfg?.spaces||[])for(const t of e.decor||[])if("text"===t.kind){for(const e of String(t.text||"").matchAll(/\{([^{}\r\n]+)\}/g)){const t=Ki(e[1]);t?.entity&&s.add(t.entity)}t.entity&&s.add(t.entity),o.set(`decor:${e.id}:${t.id}`,Qi(t.text,t,n,e=>!!n.entities?.[e]&&!!n.states?.[e]&&!Xd(n,e,Yd(this._markers))))}const h=Id(n,this._devices,null,this._virtualLights);for(const e of this._devices){for(const t of[!1,!0])r.set(m_(e.id,t),d_(n,e,{liveStates:!1!==this._config?.live_states,showTemperature:!1!==this._config?.show_temperature,showSignal:t,activityRuntime:this._activityRt.get(e.id),sourceDetails:!1,lightDevices:this._devices,lightSources:h,registryHass:this._fullRegistryHass,reducedMotion:this._reducedMotion}));if(this._isVacDev(e)){const t=this._vacSource(e,n),i=t?qc(n?.states?.[t]?.attributes):null,r=this._vacRt.get(e.id),s=sh(e.id,e.marker?.vacuum??null,e.space,t),a=lh({routes:s,observed:ch(s,[t],t=>this._vacObservedMapId(e,t,n)),spaceIds:new Set(this._model.map(e=>e.id))});o.set(`vacuum:${e.id}`,{source:t,telemetry:i,routes:s,resolution:a,mapId:i?this._vacMapId(e,i,n):null,runtime:r?{trail:r.trail,lastTs:r.lastTs,moving:r.moving,jump:r.jump}:null,server:this._vacSrvTrails[e.id]||null})}}const d=__({sourceSequence:this._hassSequence,hass:n,devices:this._devices,presentations:r,positions:(u=this._model.length>0,p=this._devices,_=e=>this._livePos(e),u?new Map(p.map(e=>[e.id,_(e)])):new Map),facts:o,entityIds:s,deviceIds:a,areaIds:l});var u,p,_;this._capturedSnapshotSequence=this._hassSequence,this._capturedSnapshotDevices=this._devices,this._capturedSnapshotLayout=this._layout,this._capturedSnapshotActivity=t,this._capturedSnapshotConfigEpoch=this._cfgEpoch,this._capturedSnapshotVirtual=i,this._visibleDeviceSnapshot&&"steady"!==this._continuity.state?this._candidateDeviceSnapshot=d:(this._visibleDeviceSnapshot=d,this._candidateDeviceSnapshot=null)}get _renderDeviceSnapshot(){return this._stagedDeviceSnapshotToken===this._continuity.token?this._candidateDeviceSnapshot||this._visibleDeviceSnapshot:this._visibleDeviceSnapshot||this._candidateDeviceSnapshot}get _renderPlanHass(){return this._renderDeviceSnapshot?.hass||this._planHass}get _renderDevices(){return this._renderDeviceSnapshot?.devices||this._devices}get _renderVacuumDevices(){return this._renderDeviceSnapshot?.vacuumDevices||this._devices}get _fullRegistryHass(){return this._planHass,this._planHassMemo?.full||this.hass}_bindingStatus(e){return cd(this.hass,e,this._haRegistry)}houseplanDiagnostics(){const{registry:e,bindings:t}=this._renderLife.diagnostics(this.hass,this._markers,e=>this._bindingStatus(e));return{registry:{...e,lastSuccessAgeMs:e.lastSuccess?Math.max(0,Date.now()-e.lastSuccess):null},bindings:t}}_openBindingInHa(e){const[t,i]=e.split(":");if(i)if("device"!==t){if("entity"===t){const e=this._fullRegistryHass.entities?.[i];e?.device_id&&mv("/config/devices/device/"+encodeURIComponent(e.device_id))}}else mv("/config/devices/device/"+encodeURIComponent(i))}_bindingHasHaPage(e){const[t,i]=e.split(":");return!!i&&("device"===t||"entity"===t&&!!this._fullRegistryHass.entities?.[i]?.device_id)}_toggleMarkerDialogVisibility(){const e=this._markerDialog;if(!e)return;const t="ha"===e.bindingMode?this._bindingStatus(e.binding):null,i=e.hideFromPlan||"ha_disabled"===t?.kind;i&&"ha_disabled"===t?.kind?this._showToast(this._t("entity"===t.reason?"toast.ha_disabled_show_entity":"toast.ha_disabled_show_device")):i&&"unverified"===t?.kind?this._showToast(this._t("toast.ha_binding_unverified")):this._markerDialog={...e,hideFromPlan:!i}}_hookConnection(){const e=this.hass?.connection;e&&e!==this._connHooked&&(this._connHooked?.removeEventListener?.("ready",this._onConnReady),this._connHooked?.removeEventListener?.("disconnected",this._onConnLost),this._connHooked?.removeEventListener?.("reconnect-error",this._onConnLost),e.addEventListener?.("ready",this._onConnReady),e.addEventListener?.("disconnected",this._onConnLost),e.addEventListener?.("reconnect-error",this._onConnLost),this._connHooked=e)}_display(e){return this._signer.display(this.hass,e)}_referencedContentUrls(){const e=On(this._serverCfg);for(const t of this._decorAssets.values())e.add(t.url);return e}_resign(){this._signer.resign(this.hass,this._referencedContentUrls())}_onLayoutEvent(e){e<=this._layoutRev||(clearTimeout(this._layoutSyncTimer),this._layoutSyncTimer=window.setTimeout(()=>{e<=this._layoutRev||this._reloadLayoutOnly()},200))}_noteLayoutRev(e){this._adoption.noteLayoutRevision(e?.rev)}async _reloadLayoutOnly(){if(!this._serverStorage||!this.hass?.callWS)return;this._beginContinuityCandidate("layout-reload",!1);const e=new Map;for(const t of this._dirtyPos)this._layout[t]&&e.set(t,this._layout[t]);this._persistLayout.pending()&&this._persistLayout.flush();for(const[t,i]of this._sentPos)e.set(t,i);try{const t=await this.hass.callWS({type:"houseplan/layout/get"}),i={...t?.layout||{}};for(const[t,n]of e)null===n?delete i[t]:i[t]=n;this._adoption.adoptMergedLayout(i,t,()=>{this._cancelDeviceDrag(),this._devicePositionHistory.clear()}),this._canOptimizeUndo=!!t?.can_optimize_undo,this._undoKind=t?.undo_kind||null,this._cacheSnapshot(),this.requestUpdate()}catch{}finally{this._continuityDataReady=!0,this.requestUpdate()}}_persistLocalLayout(){this._layout=yo(no(this._layout)),localStorage.setItem(sv,JSON.stringify(this._layout))}_maybeRebuildDevices(){const e=this.hass;if(!e?.devices||!e?.entities||!e?.areas)return;const t=this._haRegistry,i=nd(e,t)+":"+Object.keys(e.areas).length+":"+(this._norm?"n":"l")+":"+bp(e,this._config?.language);if(i===this._regSignature&&this._devices.length)return;this._regSignature=i;const n=new Map(this._devices.map(e=>[e.id,e.bindingStatus?.kind||"active"]));this._devices=eu({hass:e,registry:t,areaToSpace:Object.fromEntries(Object.entries(this._areaToSpace).map(([e,t])=>[e,t.space])),markers:this._markers,settings:this._settings,excluded:this._excluded,showAll:this._showAll,firstSpaceId:this._model[0]?.id||"",loc:e=>this._t(e),iconRules:this._iconRules});const r=this._markers.filter(e=>!e.removed&&"virtual"!==e.binding).map(e=>e.binding).sort(),o=t.revision+":"+r.join("|");if(t.authoritative&&o!==this._haBindingCacheKey){const i=new Map;for(const n of r)i.set(n,cd(e,n,t));!function(e){if("undefined"==typeof localStorage||!e.size)return;const t=ld(),i=Date.now();for(const[n,r]of e)"active"===r.kind?t[n]={kind:"active",ts:i}:"ha_disabled"===r.kind&&(t[n]={kind:"ha_disabled",reason:r.reason,ts:i});const n=Object.fromEntries(Object.entries(t).sort((e,t)=>t[1].ts-e[1].ts).slice(0,1500));Vh=n;try{localStorage.setItem(Gh,JSON.stringify(n))}catch{}}(i),this._haBindingCacheKey=o}let s=null;if(t.authoritative&&(s=this._resolveAreaRelocations(t),this._areaRelocationIds=new Set(s.relocateIds),this._areaRelocationIds.size)){this._cancelDeviceDrag();const e=this._areaRelocationIds;this._devicePositionHistory.removeWhere(({before:t,after:i})=>e.has(t.deviceId)||e.has(i.deviceId));const t=this._markerDialog;if(t?.devId&&!t.roomTouched&&this._areaRelocationIds.has(t.devId)){const e=this._devices.find(e=>e.id===t.devId);e&&(this._markerDialog={...t,room:e.marker?.room_id?`${e.space}#@${e.marker.room_id}`:e.space&&e.area?`${e.space}#${e.area}`:""})}}this._defPos=this._defaultPositions(),this._syncNewDevices(),this._seedHiddenDevices(),s&&this._syncAreaRelocations(s),this._syncActivityRuntime();const a=new Set(this._devices.filter(e=>!e.hidden).map(e=>e.id));for(const e of this._vacRt.keys())a.has(e)||this._vacRt.delete(e);if(this._infoCard){const e=this._devices.find(e=>e.id===this._infoCard.id);this._infoCard=e&&"ha_disabled"!==e.bindingStatus?.kind?e:null}const l=this._devices.some(e=>"ha_disabled"===e.bindingStatus?.kind&&"ha_disabled"!==n.get(e.id));l&&("ha_disabled"!==this._infoCard?.bindingStatus?.kind&&"ha_disabled"!==this._devices.find(e=>e.id===this._infoCard?.id)?.bindingStatus?.kind||this._closeInfoCard(),this._deviceDrag&&"ha_disabled"===this._devices.find(e=>e.id===this._deviceDrag.id)?.bindingStatus?.kind&&(this._cancelDeviceDrag(),this._devicePositionHistory.clear()),clearTimeout(this._holdTimer),this._holdFired=!1,this._tip=null,this._tapConfirm=null),this._nativeMoreInfoEntity&&!this._planEntityAvailable(this._nativeMoreInfoEntity)&&(_v(this,"hass-more-info",{entityId:null}),this._nativeMoreInfoEntity=null)}_resolveAreaRelocations(e=this._haRegistry){const t=function(e){const t=Z_(e.snapshot),i=new Set(Object.values(t).map(e=>e.binding)),n=new Map;for(const[t,r]of e.previousCandidates||[])X_(t)&&Number.isFinite(r)&&i.has(t)&&n.set(t,r);const r=new Set,o=new Set;for(const t of e.markers||[])t.removed||(Y_(t.id)&&r.add(t.id),X_(t.binding)&&o.add(t.binding));const s=new Set(Object.keys(e.registryDevices||{})),a=new Set(Object.keys(e.registryEntities||{})),l=new Set(Object.keys(e.liveStates||{})),c=new Map;for(const[e,i]of Object.entries(t)){const t=c.get(i.binding)||[];t.push(e),c.set(i.binding,t)}const h=new Set;let d=!1;for(const[t,i]of c){const[c,u]=im(t);if(o.has(t)||i.some(e=>r.has(e))||("device"===c?s.has(u):a.has(u)||l.has(u))){n.delete(t);continue}const p="device"===c?s.size>0:a.size>0;if(!e.authoritative||!p)continue;const _=n.get(t);if(void 0!==_){if(_!==e.revision)for(const e of i)h.add(e)}else n.set(t,e.revision),d=!0}return{removeIds:h,candidates:n,needsConfirmationRefresh:d}}({snapshot:this._settings.marker_area_snapshot,authoritative:e.authoritative,revision:e.revision,registryDevices:e.devices,registryEntities:e.entities,liveStates:this.hass?.states,markers:this._markers,previousCandidates:this._areaSnapshotCleanupCandidates});return this._areaSnapshotCleanupCandidates=t.candidates,t.needsConfirmationRefresh&&this._canEdit&&ed(this.hass),nm({devices:this._devices,model:this._model,layout:this._layout,snapshot:this._settings.marker_area_snapshot,authoritative:e.authoritative,cleanupSnapshotIds:t.removeIds,coordinateScale:uv})}_syncNewDevices(){if(!this._norm||!this._loadOk||!this._serverCfg)return;const e=this._devices.filter(e=>!e.marker&&!e.virtual).map(e=>e.id).sort(),t=e.join(",");if(t===this._newSyncKey)return;this._newSyncKey=t;const i=this._settings,{fresh:n,known:r}=function(e,t){if(!Array.isArray(t))return{fresh:[],known:[...e]};const i=new Set(t),n=e.filter(e=>!i.has(e));return{fresh:n,known:n.length?[...t,...n]:t}}(e,i.known_devices);if(!Array.isArray(i.known_devices)||n.length){const e=[...new Set([...i.new_device_ids||[],...n])];this._serverCfg={...this._serverCfg,settings:{...i,known_devices:r,new_device_ids:e}},this._saveConfig()}}_syncAreaRelocations(e){if(!(this._loadOk&&this._serverCfg&&this._norm&&this._canEdit&&this._haRegistry.authoritative))return;const t=e.decisions.filter(e=>e.updateSnapshot||e.removeSnapshot);if(!t.length)return;const i=ac({snapshot:Z_(this._settings.marker_area_snapshot),decisions:t});i!==this._areaRelocationSyncKey&&(this._areaRelocationSyncKey=i,this._areaRelocationWrite=this._areaRelocationWrite.catch(()=>{}).then(async()=>{if(!this._serverCfg||!this._haRegistry.authoritative)return;const e=this._resolveAreaRelocations();this._areaRelocationIds=new Set(e.relocateIds);const t=new Set,i=new Map;let n=!1;for(const r of e.decisions){if(!r.relocate)continue;const e=mg(this._layout,r.id);try{await this._persistDevicePlacement(r.id,null),t.add(r.id),e&&i.set(r.id,e),this._areaRelocationIds.delete(r.id)}catch(t){n=!0,this._layout=gg(this._layout,r.id,e),this._showToast(this._t("toast.pos_save_failed",{err:this._errText(t)}))}}const r=this._settings,o=function(e,t,i=new Set){const n=Z_(e);for(const e of t.decisions)e.removeSnapshot?delete n[e.id]:e.updateSnapshot&&e.binding&&e.area&&(e.relocate&&!i.has(e.id)||(n[e.id]={binding:e.binding,area:e.area}));return n}(r.marker_area_snapshot,e,t),s=[...new Set([...Array.isArray(r.new_device_ids)?r.new_device_ids:[],...t])],a=ac(o)!==ac(Z_(r.marker_area_snapshot)),l=ac(s)!==ac(Array.isArray(r.new_device_ids)?r.new_device_ids:[]);if(a||l){const e=r.marker_area_snapshot,n=r.new_device_ids,a={...this._serverCfg,settings:{...r,marker_area_snapshot:o,...l?{new_device_ids:s}:{}}};this._setAreaLifecycleConfig(a);try{this._saveConfigDebounced.pending()&&this._saveConfigDebounced.cancel(),await this._writeConfig()}catch(r){const a=this._settings;if(ac(a.marker_area_snapshot)===ac(o)&&ac(a.new_device_ids)===ac(l?s:n)){const t={...a};void 0===e?delete t.marker_area_snapshot:t.marker_area_snapshot=e,void 0===n?delete t.new_device_ids:t.new_device_ids=n;const i={...this._serverCfg,settings:t};this._setAreaLifecycleConfig(i),this._adoption.refreshConfigFingerprint()}for(const e of t)this._areaRelocationIds.add(e);const c=new Set;for(const[e,t]of i)try{await this._persistDevicePlacement(e,t)}catch(t){c.add(e),this._showToast(this._t("toast.pos_save_failed",{err:this._errText(t)}))}this._areaRelocationSyncKey="",this._regSignature="";if("conflict"===(r&&"object"==typeof r&&"code"in r?r.code:void 0)?(this._showToast(this._t("toast.conflict")),await this._reloadConfigOnly(!0)):this._showToast(this._t("toast.cfg_save_failed",{err:this._errText(r)})),c.size&&this._serverCfg){const e=this._settings,t=[...new Set([...Array.isArray(e.new_device_ids)?e.new_device_ids:[],...c])],i={...this._serverCfg,settings:{...e,new_device_ids:t}};this._setAreaLifecycleConfig(i);try{await this._writeConfig()}catch(e){this._showToast(this._t("toast.cfg_save_failed",{err:this._errText(e)}))}}}}n&&(this._areaRelocationSyncKey=""),this.requestUpdate()}))}get _newIds(){const e=this._settings.new_device_ids;return new Set([...Array.isArray(e)?e:[],...this._areaRelocationIds])}_ackNewDevice(e){if(!this._newIds.has(e)||!this._serverCfg)return;const t=this._settings;this._serverCfg={...this._serverCfg,settings:{...t,new_device_ids:(t.new_device_ids||[]).filter(t=>t!==e)}},this._saveConfig(),this.requestUpdate()}get _markers(){return this._serverCfg?.markers||[]}_roomLqi(e){if(!e)return null;const t=[];for(const i of this._renderDevices){if(i.area!==e||i.virtual)continue;const n=Nd(this._renderPlanHass,i.entities);null!=n&&t.push(n)}return Ii(t)}_roomBounds(e){if(e.poly&&e.poly.length){const t=e.poly.map(e=>e[0]),i=e.poly.map(e=>e[1]),n=Math.min(...t),r=Math.min(...i);return{x:n,y:r,w:Math.max(...t)-n,h:Math.max(...i)-r}}return{x:e.x??0,y:e.y??0,w:e.w??0,h:e.h??0}}_defaultPositions(){const e={},t=this._config?.icon_size??2.5;for(const i of this._model){const n=t/100*wl(i)*1.3;for(const t of i.rooms){if(!t.area)continue;const r=this._devices.filter(e=>e.area===t.area&&e.space===i.id);if(!r.length)continue;const o=this._roomBounds(t),s=.1*Math.min(o.w,o.h),a=o.w-2*s,l=o.h-2*s,c=Math.max(1,Math.round(Math.sqrt(r.length*a/Math.max(l,1)))),h=Math.ceil(r.length/c),d=a/c,u=l/Math.max(h,1),p=r.map((e,t)=>({x:o.x+s+d*(t%c+.5),y:o.y+s+u*(Math.floor(t/c)+.5)}));Ei(p,o,n,.5*s),r.forEach((t,i)=>e[t.id]=il(p[i]))}}return e}_pos(e){const t=this._renderDeviceSnapshot?.positions.get(e.id);return t?{x:t.x,y:t.y}:this._livePos(e)}_livePos(e){const t=this._spaceModelById(e.space),i=this._areaRelocationIds.has(e.id)?void 0:this._layout[e.id];if(i)if(this._norm){if(i.s===e.space)return{x:i.x*uv,y:i.y*uv}}else if(void 0===i.s)return{x:i.x,y:i.y};return this._defPos[e.id]?this._defPos[e.id]:t?il(bl(t)):{x:500,y:500}}_devicePlacementForCanvas(e,t,i){if(!this._norm)return{x:Math.round(t),y:Math.round(i)};const n=this._gridPitch,r=Math.round(t/n)*n,o=Math.round(i/n)*n;return{s:e.space,x:rl(r/uv),y:rl(o/uv)}}_previewDevicePlacement(e,t){this._layout=gg(this._layout,e,t),this.requestUpdate()}_cancelDeviceDrag(){const e=this._deviceDrag;if(!e)return!1;this._editorRuntime?._cancelPointerMove("device"),this._deviceDrag=null,this._deviceHits.cancel(e.pointerId);try{e.source?.hasPointerCapture?.(e.pointerId)&&e.source.releasePointerCapture(e.pointerId)}catch{}return this._previewDevicePlacement(e.id,e.before),!0}async _persistDevicePlacement(e,t){if(this._layout=gg(this._layout,e,t),this._serverStorage){let i=null,n=!1;try{let r;if(null===t)i=null,this._sentPos.set(e,i),n=!0,r=await this.hass.callWS({type:"houseplan/layout/delete",device_id:e});else{const t=vo(this._layout[e]);ac(t)!==ac(this._layout[e])&&(this._layout={...this._layout,[e]:t}),i=t,this._sentPos.set(e,i),n=!0,r=await this.hass.callWS({type:"houseplan/layout/update",device_id:e,pos:t})}this._noteLayoutRev(r),this._adoption.refreshLayoutFingerprint(),this._cacheSnapshot()}finally{n&&this._sentPos.get(e)===i&&this._sentPos.delete(e)}return}this._persistLocalLayout()}_devicePositionStateValid(e){const t=this._devices.find(t=>t.id===e.deviceId);return!!t&&t.space===e.spaceId&&"ha_disabled"!==t.bindingStatus?.kind&&!!this._spaceModelById(e.spaceId)}async _runDevicePositionHistory(e){if(this._cancelDeviceDrag()||this._devicePositionBusy)return;const t="undo"===e?this._devicePositionHistory.undo():this._devicePositionHistory.redo();if(!t)return;const i="undo"===e?t.before:t.after;if(!this._devicePositionStateValid(i))return this._devicePositionHistory.clear(),this._showToast(this._t("history.device_stale")),void this.requestUpdate();const n=mg(this._layout,i.deviceId);i.spaceId!==this._space&&(this._commitSpace(i.spaceId),this._restoreZoom()),this._devicePositionBusy=!0,this._previewDevicePlacement(i.deviceId,i.placement);try{await this._persistDevicePlacement(i.deviceId,i.placement),this._showToast(this._t("undo"===e?"history.undone":"history.redone",{name:t.name}))}catch(t){this._previewDevicePlacement(i.deviceId,n),"undo"===e?this._devicePositionHistory.redo():this._devicePositionHistory.undo(),this._showToast(this._t("toast.pos_save_failed",{err:this._errText(t)}))}finally{this._devicePositionBusy=!1,this.requestUpdate()}}_undoDevicePosition(){this._runDevicePositionHistory("undo")}_redoDevicePosition(){this._runDevicePositionHistory("redo")}_savePos(e,t,i){this._spaceModelById(e.space)&&(this._layout=gg(this._layout,e.id,this._devicePlacementForCanvas(e,t,i)),this._dirtyPos.add(e.id),this._persistLayout())}_devicePresentation(e,t=!1!==this._config?.show_signal,i=!1){const n=i?null:this._renderDeviceSnapshot?.presentations.get(m_(e.id,t));return n||d_(this._renderPlanHass,e,{liveStates:!1!==this._config?.live_states,showTemperature:!1!==this._config?.show_temperature,showSignal:t,designPreview:i,activityRuntime:this._activityRt.get(e.id),sourceDetails:!1,lightDevices:this._renderDevices,registryHass:this._fullRegistryHass,reducedMotion:this._reducedMotion})}_deviceVisual(e){return this._devicePresentation(e).visual}_stateClass(e,t=this._deviceVisual(e)){const i=this._devicePresentation(e);return i.effectiveHidden?"":("icon_ripple"!==i.display||!1===this._config?.live_states||"alarm"===t.status||t.activity,h_({...i,visual:t}).join(" "))}_liveTemp(e){if(!this._config?.show_temperature)return null;if(!0===e.marker?.use_climate_temp){const t=Ld(this._renderPlanHass,e.entities);if(null!=t)return t}return"mdi:thermometer"!==e.icon&&"mdi:air-filter"!==e.icon?null:Hd(this._renderPlanHass,e.entities)}_bindingEntities(e){if("virtual"===e||!e)return[];const t=this._bindingStatus(e);return"active"===t.kind?t.enabledEntityIds:t.allEntityIds}_bindingHasClimate(e){return this._bindingEntities(e).some(e=>e.startsWith("climate."))}_bindingHasAlarm(e){return this._bindingEntities(e).some(e=>{const t=this._planHass?.states?.[e]||this.hass?.states?.[e],i=this._fullRegistryHass.entities[e]||this.hass?.entities?.[e];return Vn(e.split(".")[0],t?.attributes?.device_class||i?.device_class||i?.original_device_class)})}_deviceBindingActive(e,t=!0){if(e.virtual||"virtual"===e.bindingKind)return!0;if(!e.bindingKind||!e.bindingRef)return!1;const i=this._bindingStatus(`${e.bindingKind}:${e.bindingRef}`);return"active"===i.kind||(t&&this._showToast(this._t("ha_disabled"===i.kind?"toast.ha_disabled_action":"toast.ha_binding_unverified")),!1)}_openMoreInfo(e){e?this._planEntityAvailable(e)?(this._kiosk&&(this._cyclePausedUntil=Math.max(this._cyclePausedUntil,Date.now()+6e4)),this._nativeMoreInfoEntity=e,_v(this,"hass-more-info",{entityId:e})):this._showToast(this._t("toast.ha_disabled_action")):this._showToast(this._t("toast.no_entity"))}_interruptViewGesture(e,t){if(clearTimeout(this._holdTimer),clearTimeout(this._kioskHoldTimer),void 0!==e)for(const i of[t,this._stageEl])try{i?.hasPointerCapture?.(e)&&i.releasePointerCapture(e)}catch{}this._pointers.clear(),this._panStart=null,this._panLock=null,this._pinchStart=null,this._swipeStart=null,this._roomPointer=null,this._doubleFit.clear(),this._deviceHits.clearPointers()}_closeInfoCard(){this._interruptViewGesture(),this._holdFired=!1,this._infoCard=null}_invalidateDeviceHitGeometry(){this._deviceHits.invalidate()}_resetDeviceHitState(){this._deviceHits.reset(this.renderRoot)}_deviceHitOwnerAt(e,t){return"view"!==this._mode&&"devices"!==this._mode?null:this._deviceHits.at(this.renderRoot,this._renderDevices,this._space,e,t)}_deviceForPointerEvent(e,t){return this._deviceHits.pointer(this.renderRoot,this._renderDevices,this._space,e,t)}_deviceForClickEvent(e,t){return this._deviceHits.click(this.renderRoot,this._renderDevices,this._space,e,t)}_showDeviceTip(e,t){this._liveRt?this._liveRt.devicePointerTip(e,t):this._ensureLiveRuntime().then(()=>this._liveRt?.devicePointerTip(e,t))}_showDeviceFocusTip(e,t){const i=e.currentTarget;this._liveRt?this._liveRt.deviceFocusTip(i,t):this._ensureLiveRuntime().then(()=>this._liveRt?.deviceFocusTip(i,t))}_hideDeviceFocusTip(e){this._liveRt?.deviceBlur(e)}_clearPointerHover(){this._liveRt?this._liveRt.pointerLeave():this._clearTransientHover()}_ctxDevice(e,t){"view"===this._mode&&(t=this._deviceForPointerEvent(e,t),e.preventDefault(),e.stopPropagation(),this._deviceBindingActive(t)&&(t.primary?this._openMoreInfo(t.primary):this._infoCard=t))}_clickDevice(e,t){if("view"!==this._mode&&"devices"!==this._mode)return;if(e.stopPropagation(),t=this._deviceForClickEvent(e,t),this._deviceDrag?.moved||this._suppressClick||this._holdFired)return;if("devices"===this._mode)return void this._openMarkerDialog(t);const i=this._devices.find(e=>e.id===t.id);if(!i)return;const n=Ru(i.tapAction,i.primary?.split(".")[0]);if("none"===n)return;const r=(e,t)=>{i.marker?.tap_confirm?this._tapConfirm={kind:"run",text:e,exec:t}:t()};if("toggle"===n){const e=this._toggleIntent(i);if(!e)return;if(!Fu(e))return void this._showUnavailableToggleTargets(e);const t=e=>{const t=Fu(e);if(!t)return;if("virtual-light"===t.kind)return this._startDevicePressFeedback(i.id),void this.hass.callWS({type:"houseplan/virtual_light/toggle",marker_id:t.markerId}).then(e=>{const t=qh(this._virtualLights,e);t!==this._virtualLights&&(this._virtualLights=t,this._capturedSnapshotVirtual="",this._cacheSnapshot(),this.requestUpdate())}).catch(e=>this._showToast(this._t("toast.virtual_light_toggle_failed",{err:this._errText(e)})));const{command:n}=t;this._startDevicePressFeedback(i.id),this.hass.callService(n.domain,n.service,n.data).catch(e=>this._showToast(this._t("toast.error",{err:this._errText(e)})))},n=((o=e).targets.length?o.targets:o.skippedTargets).map(e=>e.name||e.entityId||e.ref).join(", ")||i.name;if(i.marker?.tap_confirm){const r=this._toggleConfirmationLines(e);if(!r.length)return;this._tapConfirm={kind:"toggle",text:this._t("confirm.tap_toggle",{name:n}),lines:r,initialIntent:e,deviceId:i.id,exec:()=>{const n=this._devices.find(e=>e.id===i.id),r=n?this._toggleIntent(n):null;r&&!Fu(r)&&this._showUnavailableToggleTargets(r)||(r&&Iu(e,r)?t(r):this._showToast(this._t("toast.tap_target_changed")))}}}else t(e);return}var o;if("info"===n)return this._interruptViewGesture(),void(this._infoCard=i);if(this._deviceBindingActive(i)){if("run"===n){const e=i.marker?.tap_target||"",t=function(e){const t=String(e||"").split(".")[0];return"automation"===t?{domain:"automation",service:"trigger"}:"script"===t?{domain:"script",service:"turn_on"}:"scene"===t?{domain:"scene",service:"turn_on"}:null}(e),n=this.hass.states[e];if(!t||!n)return void this._showToast(this._t("toast.run_target_missing"));const o=n.attributes?.friendly_name||e;return void r(this._t("confirm.tap_run",{name:o}),()=>{this._deviceBindingActive(i)&&this._planEntityAvailable(e)&&(this._startDevicePressFeedback(i.id),this.hass.callService(t.domain,t.service,{entity_id:e}).then(()=>{this._stampActivity(i.id,"event",this._activitySourceKey(i)),this.requestUpdate(),this._showToast(this._t("toast.run_started",{name:o}))}).catch(e=>this._showToast(this._t("toast.error",{err:this._errText(e)}))))})}"more-info"===n&&i.primary?this._openMoreInfo(i.primary):this._infoCard=i}}_showUnavailableToggleTargets(e){const t=function(e){if(!e||"group"!==e.kind||Fu(e)||"configured-targets-missing"!==e.noneReason)return[];if(!e.skippedTargets.length||e.skippedTargets.some(e=>!zu.has(e.reason)&&"secure"!==e.reason))return[];const t=[],i=new Set;for(const n of e.skippedTargets){if(!zu.has(n.reason))continue;const e=String(n.name||n.entityId||n.ref||"").trim();e&&!i.has(e)&&(i.add(e),t.push(e))}return t}(e);return!!t.length&&(this._showToast(1===t.length?this._t("toast.toggle_target_unavailable",{name:t[0]}):this._t("toast.toggle_targets_unavailable",{names:t.join(", ")})),!0)}_keyDevice(e,t){"Enter"!==e.key&&" "!==e.key||"view"!==this._mode&&"devices"!==this._mode||(e.preventDefault(),this._clickDevice(e,t))}_startDevicePressFeedback(e){const t=[...this.renderRoot.querySelectorAll(".dev[data-id]")].find(t=>t.dataset.id===e),i=t?.querySelector(".device-shell");if(!i||"function"!=typeof i.animate)return;const n=Number.parseFloat(this.ownerDocument.defaultView?.getComputedStyle(i).scale||""),r=Number.isFinite(n)?Math.max(.95,Math.min(1,n)):1;this._devicePressAnimations.get(e)?.cancel();const o=this._reducedMotion?[{outlineColor:"transparent",outlineStyle:"solid",outlineWidth:"0px"},{outlineColor:"var(--hp-accent, #3ea6ff)",outlineStyle:"solid",outlineWidth:"2px",outlineOffset:"2px",offset:.5},{outlineColor:"transparent",outlineStyle:"solid",outlineWidth:"0px"}]:[{scale:String(r)},{scale:"0.95",offset:.5},{scale:"1"}],s=i.animate(o,{duration:200,easing:"cubic-bezier(.22,.61,.36,1)"});this._devicePressAnimations.set(e,s);const a=()=>{this._devicePressAnimations.get(e)===s&&this._devicePressAnimations.delete(e)};s.addEventListener("finish",a,{once:!0}),s.addEventListener("cancel",a,{once:!0})}_cancelDevicePressFeedback(){for(const e of this._devicePressAnimations.values())e.cancel();this._devicePressAnimations.clear()}_pruneDevicePressFeedback(){if(!this._devicePressAnimations.size)return;const e=new Set([...this.renderRoot.querySelectorAll(".dev[data-id]")].map(e=>e.dataset.id||""));for(const[t,i]of this._devicePressAnimations)e.has(t)||(i.cancel(),this._devicePressAnimations.delete(t))}_t(e,t){return wp(bp(this.hass,this._config?.language),e,t)}get _colorPickerLabels(){return{title:this._t("color_picker.title"),hue:this._t("color_picker.hue"),saturation:this._t("color_picker.saturation"),value:this._t("color_picker.value"),hex:this._t("color_picker.hex"),invalidHex:this._t("color_picker.invalid_hex"),confirm:this._t("color_picker.confirm")}}_help(e){return this._editorRuntimeOrThrow()._help(e)}get _stageEl(){return this.renderRoot.querySelector(".stage")}_contentItems(e){const t=[];for(const i of this._devices){if(i.space!==e.id||i.hidden)continue;const n=this._pos(i);t.push({minX:n.x,minY:n.y,maxX:n.x,maxY:n.y})}if(e.id===this._space){for(const e of this._openingsR){const i=Number(e.angle)*Math.PI/180,n=Math.cos(i)*e.rlen/2,r=Math.sin(i)*e.rlen/2,o=ll([[e.rx-n,e.ry-r],[e.rx+n,e.ry+r]]);o&&t.push(o)}const i=this._decorH;for(const e of this._decorList){if("image"===e.kind&&!this._decorAssets.has(e.asset_id)&&"decor"!==this._mode)continue;const n=ll("line"===e.kind?[[e.x1*uv,e.y1*i],[e.x2*uv,e.y2*i]]:"text"===e.kind?[[e.x*uv,e.y*i]]:Fr({x:e.x*uv,y:e.y*i,w:e.w*uv,h:e.h*i,angle:e.angle}));n&&t.push(n)}for(const i of this._physicalBodiesR(e)){const e=ll(i);e&&t.push(e)}}return pl(e,t)}_frameOf(){const e=this._spaceModel();if(!e){this._frame=null;const e={x:0,y:0,w:uv,h:uv};return{rect:e,all:e,outliers:0}}const t=this._frame,i="view"!==this._mode;if(t&&t.id===e.id&&this._bdDrag)return t;if(t&&t.id===e.id&&t.model===e&&t.layout===this._layout&&t.devs===this._devices&&t.far===this._showFar&&t.grow===i)return t;const n=fl(this._contentItems(e));let r=n.all||yl(e),o=this._showFar?r:n.core||yl(e);return t&&t.id===e.id&&i&&t.grow&&(o=pv(t.rect,o),r=pv(t.all,r)),this._frame={id:e.id,model:e,layout:this._layout,devs:this._devices,far:this._showFar,grow:i,rect:o,all:r,outliers:n.outliers},this._frame}_isoSource(){const e=this._isoSceneRuntime;if(!e)return null;const t=this._spaceModel();if(!t)return null;const i=this._spaceWalls,n=this._openCuts(),r=this._openingsR;return e.createIsoStructuralSource({space:t,walls:i,openCuts:n,openings:r,partitionCuts:()=>this._partitionOpeningCuts(t),roomOpenings:()=>this._roomWallOpeningInputs(r,t),cellCm:this._cellCm,gridPitch:this._gridPitch,wallKeyPitch:this._wallKeyPitch,coordinateScale:uv,onBuild:()=>{this._isoStructuralBuildCount+=1}})}_isoSceneKey(){if(!this._labsIso||"view"!==this._mode)return null;try{return this._isoSource()?.key??null}catch{return this._isoInvalidKey()}}_isoInvalidKey(){return`${this._space}|invalid|${this._cfgEpoch}`}_clearIsoInvalidFallback(e){const t=`${this._space}|invalid|`;for(const i of this._isoFallback)i.startsWith(t)&&i!==e&&this._isoFallback.delete(i)}_isoScene(e=this._isoSource()){const t=this._isoSceneRuntime;if(!t||!e)return null;let i=this._frameOf().rect;const n=this._spaceDisplayForRender(),r=this._spaceModel();if(r&&n.showNames)for(const e of r.rooms)if(e.name){const t=this._labelPos(e,r.id);i=pv(i,{x:t.x,y:t.y,w:0,h:0})}const o=t.resolveIsoScene({source:e,cache:this._isoGeometryCache,cellCm:this._cellCm,liveFrame:i});if(!r||!n.showBorders)return o;const s=this._config?.icon_size??2.5,a=s>8?2.5:s,l=this._stageEl?.getBoundingClientRect?.()??null,c=l?.height?l.width/l.height:o.frame.w/o.frame.h,h=Oi([o.frame.x,o.frame.y,o.frame.w,o.frame.h],c),d=this._isoOverlayScene(r,this._renderDevices.filter(e=>e.space===r.id&&!e.hidden),h,n,t.resolveIsoDecorationLayers(n),o,a,w_(a),n.showLqi??this._config?.show_signal??!0,!1),u=d&&t.resolveIsoOverlayFitEnvelope({baseBounds:o.frame,entries:d.entries,stageSize:l,targetView:e=>Oi([e.x,e.y,e.w,e.h],c)});return u?{...o,frame:u.bounds,overlayFitEntries:d.entries}:o}_latchIsoFallback(e,t){if(this._isoFallback.has(e))return;this._isoFallback.add(e);const i=e.includes("|invalid|")?"invalid":e.split("|").pop()||"invalid";console.warn("HOUSEPLAN ISO FALLBACK: #89/#160",yf("structural",i,!0))}_effectiveProjection(){if(this._isoProjectionSnapshot)return this._isoProjectionSnapshot;const e=e=>this._isoProjectionSnapshot=e,t=()=>("iso"===this._renderProjection&&(this._cancelCameraTransition(!1),this._view=null,this._viewModeSnap=null),e("flat"));if(this._renderIsoScene=null,"iso"!==this._desiredProjection||!this._model.length||!this._isoSceneRuntime)return e("flat");if(!this._spaceDisplayForRender().showBorders)return this._isoFallback.has(`${this._space}|no-borders`)?t():e("iso");let i=this._isoInvalidKey();if(this._clearIsoInvalidFallback(i),this._isoFallback.has(i))return t();try{const n=this._isoSource();if(!n)return e("flat");if(i=n.key,this._isoFallback.has(i))return t();const r=this._isoScene(n);return r?this._isoFallback.has(r.key)?t():(this._renderIsoScene=r,e("iso")):e("flat")}catch(e){return this._latchIsoFallback(i,e),t()}}_scenePoint(e){return"iso"===this._renderProjection?sf(e,0):e}_floorView(e){if("iso"!==this._renderProjection)return e;const t=af([e.x,e.y]),i=af([e.x+e.w,e.y+e.h]);return{x:t[0],y:t[1],w:i[0]-t[0],h:i[1]-t[1]}}_isoOverlayScene(e,t,i,n,r,o,s,a,l,c=!0){const h=this._isoSceneRuntime;return h&&r?.structural&&o?h.buildIsoOverlayRenderScene({space:e,devices:t,openings:this._openingsR,view:i,display:n,wallSilhouettes:o.wallSilhouettes,resolveCollisions:c,iconPct:s,deviceBasePct:a,showLqi:l,cellCm:this._cellCm,kioskIconScale:"view"===this._mode?this._kioskScale.icon:1,kioskFontScale:"view"===this._mode?this._kioskScale.font:1,stageSize:this._stageEl?.getBoundingClientRect?.(),positionOf:e=>this._pos(e),presentationOf:(e,t)=>this._devicePresentation(e,t),labelPositionOf:(e,t)=>this._labelPos(e,t),labelScaleOf:e=>this._labelScale(e),openingEntityAvailable:e=>this._renderOpeningEntityAvailable(e),openingWallIndex:()=>this._openingWallIndexFor(e,this._openCuts()).value}):null}_baseVb(e=this._effectiveProjection(),t=this._renderIsoScene){if("iso"===e){if(!this._spaceDisplayForRender().showBorders){const e=hf({rect:this._frameOf().rect,wallHeight:0});return[e.x,e.y,e.w,e.h]}const e=t?.frame??this._frameOf().rect;return[e.x,e.y,e.w,e.h]}const i=this._frameOf().rect;return[i.x,i.y,i.w,i.h]}get _outliers(){return this._showFar?0:this._frameOf().outliers}_fitFar(){this._clearRoomFocus(),this._showFar=!0,this._frame=null,this.requestUpdate(),this._resetZoom()}_clearRoomFocus(e=!1){this._doubleFit.clear(),this._roomFocus=null,e&&(this._roomPointer=null)}_roomFitBounds(e,t){const i=ni(e);if(!i||!e.id)return null;const n=this._spaceWalls,r=this._openCuts(),o=this._wallUnionGeometry(),s=n.length&&this._innerRoomContour(t,e.id,r,o?.roomGeom,o?.multiWallNodes)||i,a=this._spaceDisplayForRender();let l=[];if(a.showBorders&&n.length){const i=Cs(t.rooms,e.id,n,r,this._wallKeyPitch,this._cellCm,this._gridPitch,uv);i&&(l=ia(i.poly,i.offsets,o?.multiWallNodes)||i.poly)}const c=this._effectiveProjection();return function(e){const t=e.floor,i=e.wall||[],n=e.padding??0;if(!t.length||!t.every(gf)||!i.every(gf)||!Number.isFinite(n)||n<0)return null;if("flat"===e.projection)return vf([...t,...i],n);const r=e.wallHeight??0,o=e.floorDepth??0;if(!Number.isFinite(r)||r<0||!Number.isFinite(o)||o<0)return null;try{const e=[];for(const i of t){const t=[i[0],i[1]];e.push(sf(t,0)),o>0&&e.push(sf(t,-o))}for(const t of i){const i=[t[0],t[1]];e.push(sf(i,0)),r>0&&e.push(sf(i,r))}return vf(e,n)}catch{return null}}({floor:s,wall:l,projection:c,wallHeight:"iso"===c&&a.showBorders?Ha(84,this._cellCm):0,floorDepth:"iso"===c&&a.showBorders?Ha(10,this._cellCm):0,padding:a.showBorders?Ha(1.25,this._cellCm):0})}_fitRoom(e,t=!0){if("view"!==this._mode)return!1;this._doubleFit.clear();const i=this._spaceModel(),n=i?.rooms.find(t=>t.id===e);if(!i||!n)return this._clearRoomFocus(),!1;let r=this._roomFitBounds(n,i);if(!r)return this._clearRoomFocus(),!1;this._roomFocus={spaceId:i.id,roomId:e};const o=this._stageEl;if(!o||o.clientWidth<=0||o.clientHeight<=0)return!0;const s=Oi(this._baseVb(),o.clientWidth/o.clientHeight),a=e=>function(e){const t=e.safeFraction??.8,{bounds:i,baseFit:n,stageWidth:r,stageHeight:o,minZoom:s,maxZoom:a}=e;if(!ff(i)||!ff(n)||!Number.isFinite(r)||r<=0||!Number.isFinite(o)||o<=0||!Number.isFinite(s)||s<=0||!Number.isFinite(a)||a1)return null;const l=r/o,c=Math.max(i.w/t,i.h/t*l);if(!Number.isFinite(c)||c<=0)return null;const h=Math.min(a,Math.max(s,n.w/c)),d=n.w/h,u=d/l;return{zoom:h,viewBox:{x:i.x+i.w/2-d/2,y:i.y+i.h/2-u/2,w:d,h:u}}}({bounds:e,baseFit:s,stageWidth:o.clientWidth,stageHeight:o.clientHeight,minZoom:yv.ZOOM_MIN,maxZoom:yv.ZOOM_MAX});let l=a(r);const c=this._isoSceneRuntime,h=this._renderIsoScene?.overlayFitEntries;if(l&&"iso"===this._effectiveProjection()&&c&&h?.length){const e=c.resolveIsoOverlayFitEnvelope({baseBounds:r,entries:h,ownerId:n.id,stageSize:{width:o.clientWidth,height:o.clientHeight},targetView:e=>a(e)?.viewBox??null});e&&(r=e.bounds,l=a(r))}if(!l)return this._clearRoomFocus(),!1;const d=this._cameraState(),u=function(e,t,i,n){const r=[e,t,i,n],o=Math.min(...r.map(e=>e.x)),s=Math.min(...r.map(e=>e.y));return{x:o,y:s,w:Math.max(...r.map(e=>e.x+e.w))-o,h:Math.max(...r.map(e=>e.y+e.h))-s}}(s,d.viewBox,l.viewBox,r);return l.viewBox=this._clampView(l.viewBox,u),t?(this._prepareCameraCommand(),this._startCameraTransition(l,u,"room",220),!0):(this._cancelCameraTransition(!1),Kg(d,l)||(this._zoom=l.zoom,this._view={...l.viewBox},this.requestUpdate()),!0)}_fitAll(e="fit"){this._clearRoomFocus(),this._showFar=!0,this._frame=null,this.requestUpdate(),this._resetZoom(e)}_renderFarHint(){return this._kiosk||"view"!==this._mode||this._booting||!this._outliers?G:j`
${this._t("canvas.far_objects",{n:this._outliers})} @@ -671,7 +671,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
this._markupClick(e)} @@ -803,7 +803,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae ${this._renderOpeningLocks(S,R?.locks)} ${g.showNames||this._markup?a.rooms.map(e=>this._renderRoomLabel(e,a,S,g,R?.rooms.get(e))):G} ${this._markup?a.rooms.map(e=>this._renderRoomGear(e,a,S)):G} - ${B={hass:this.hass,settings:this._settings,devices:this._renderDevices,registry:this._haRegistry,currentSpace:a.id,spaces:this._serverCfg?.spaces,viewKey:S,view:"view"===this._mode,kiosk:this._kiosk},B.view&&!B.kiosk&&!0===B.hass?.user?.is_admin&&Pg(B.settings).enabled?(import("./hp-zigbee-topology-overlay-CX3rLqEO.js"),j``):G}
@@ -1092,4 +1092,4 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae 45% · ${this._t("roomcard.light_partial",{on:1,total:3})} -
`}_renderRoomSource(e){return this._editorRuntimeOrThrow()._renderRoomSource(e)}_renderRoomDialog(){return this._editorRuntimeOrThrow()._renderRoomDialog()}}yv.properties={_tabDrag:{state:!0},_hdrH:{state:!0},_booting:{state:!0},_bootFading:{state:!0},_bootSoft:{state:!0},_continuityEpoch:{state:!0},_editorRuntimeLoadingVisible:{state:!0},_backdropGuard:{state:!0},_tapConfirm:{state:!0},_dangerConfirm:{state:!0},hass:{attribute:!1},panelHost:{type:Boolean,attribute:"panel-host",reflect:!0},narrow:{attribute:!1},_config:{state:!0},_space:{state:!0},_devices:{state:!0},_selId:{state:!0},_toast:{state:!0},_mode:{state:!0},_tool:{state:!0},_wallDialog:{state:!0},_drawWallField:{state:!0},_activeWallChainId:{state:!0},_physicalSel:{state:!0},_physicalDialog:{state:!0},_partitionDeleteDialog:{state:!0},_roomDeleteDialog:{state:!0},_physicalDrag:{state:!0},_physicalRotate:{state:!0},_duplicateColumnId:{state:!0},_opMeasure:{state:!0},_path:{state:!0},_cursorPt:{state:!0},_mergeSel:{state:!0},_openingPreset:{state:!0},_openingDialog:{state:!0},_openingInfo:{state:!0},_mergeDialog:{state:!0},_splitSel:{state:!0},_decorTool:{state:!0},_decorStyle:{state:!0},_decorDraft:{state:!0},_decorSel:{state:!0},_decorEraseConfirm:{state:!0},_decorTextDialog:{state:!0},_decorShapeDialog:{state:!0},_backdropDialog:{state:!0},_furnPalette:{state:!0},_decorImagePalette:{state:!0},_decorAssetCatalog:{state:!0},_decorAssetBusy:{state:!0},_furnCategory:{state:!0},_furnPreviewInput:{state:!0},_bdDrag:{state:!0},_dtBox:{state:!0},_dtDrag:{state:!0},_kioskDialog:{state:!0},_vacFit:{state:!0},_vacAllCamerasFor:{state:!0},_vacCalConfirm:{state:!0},_kioskDots:{state:!0},_areaSel:{state:!0},_nameSel:{state:!0},_roomDialog:{state:!0},_roomEditId:{state:!0},_roomFill:{state:!0},_roomCustomFill:{state:!0},_roomTempMin:{state:!0},_roomTempMax:{state:!0},_roomTempSrc:{state:!0},_roomHumSrc:{state:!0},_roomSrcOpen:{state:!0},_roomSrcFilter:{state:!0},_roomNameScale:{state:!0},_roomLabelScale:{state:!0},_spaceDialog:{state:!0},_infoCard:{state:!0},_deviceInbox:{state:!0},_rulesDialog:{state:!0},_settingsDialog:{state:!0},_pdfDialog:{state:!0},_supportDialog:{state:!0},_alignDialog:{state:!0},_preflightClipboardFallback:{state:!0},_backupExportDialog:{state:!0},_backupImportDialog:{state:!0},_importDialog:{state:!0},_markerDialog:{state:!0}},yv.ZOOM_MAX=8,yv.ZOOM_MIN=1/3,yv.styles=[op,pg],customElements.get("houseplan-card")||customElements.define("houseplan-card",yv),window.customCards=window.customCards||[],window.customCards.find(e=>"houseplan-card"===e.type)||window.customCards.push({type:"houseplan-card",name:"House Plan Card",description:"Interactive house plan: spaces, rooms and devices with live states and drag layout."}),console.info(`%c HOUSEPLAN-CARD %c v${ev} `,"background:#3ea6ff;color:#04121f;font-weight:700","");export{ds as $,G as A,Ag as B,wi as C,le as D,Lr as E,$i as F,Mi as G,Ut as H,Ci as I,el as J,wo as K,ni as L,Oo as M,ja as N,M_ as O,R_ as P,ys as Q,io as R,Go as S,_i as T,Wo as U,L_ as V,El as W,rl as X,Wl as Y,Bl as Z,Cs as _,ta as a,Oe as a$,Rs as a0,Zs as a1,Is as a2,Mc as a3,$c as a4,si as a5,Ja as a6,Xu as a7,rp as a8,Ts as a9,ti as aA,oi as aB,Pn as aC,Un as aD,dm as aE,Cr as aF,cm as aG,Pl as aH,Hl as aI,Ql as aJ,Xa as aK,ec as aL,Vl as aM,gs as aN,ea as aO,es as aP,ua as aQ,Oa as aR,N_ as aS,_a as aT,Ds as aU,Pg as aV,_n as aW,vr as aX,fr as aY,gr as aZ,pn as a_,ko as aa,ip as ab,Ku as ac,Zo as ad,As as ae,Zu as af,na as ag,sa as ah,fo as ai,yo as aj,Jr as ak,O_ as al,Ko as am,Qa as an,Uo as ao,Ua as ap,Ga as aq,en as ar,tn as as,Ki as at,Yi as au,Ya as av,ac as aw,Yd as ax,Xd as ay,$g as az,j as b,Di as b$,kp as b0,sf as b1,Do as b2,nl as b3,Qt as b4,ei as b5,Br as b6,ma as b7,bc as b8,E_ as b9,$r as bA,Rr as bB,Pr as bC,jn as bD,Sr as bE,Mr as bF,Xl as bG,Ir as bH,Zl as bI,Ul as bJ,Ll as bK,Jl as bL,Kl as bM,Yl as bN,rm as bO,Jo as bP,$p as bQ,tp as bR,Vf as bS,ep as bT,la as bU,qf as bV,Kf as bW,C_ as bX,li as bY,Ju as bZ,np as b_,bo as ba,Eu as bb,q_ as bc,yi as bd,mi as be,Fi as bf,za as bg,wa as bh,ba as bi,Yo as bj,Xo as bk,Qs as bl,kl as bm,Aa as bn,Da as bo,Yn as bp,Xn as bq,ki as br,ms as bs,_s as bt,j_ as bu,W_ as bv,zr as bw,Nr as bx,Er as by,Tr as bz,Mo as c,as as c$,fi as c0,ai as c1,vi as c2,Qo as c3,zi as c4,Mn as c5,Wp as c6,Up as c7,wd as c8,Ru as c9,Fg as cA,so as cB,yr as cC,Ee as cD,qe as cE,Ne as cF,qc as cG,Vc as cH,ih as cI,Ic as cJ,Kc as cK,jc as cL,Wc as cM,th as cN,Jc as cO,Ac as cP,Cc as cQ,Bn as cR,Tc as cS,qn as cT,ci as cU,jf as cV,Dp as cW,Bf as cX,Sl as cY,Ps as cZ,ss as c_,Li as ca,Ui as cb,Kn as cc,Ln as cd,Gd as ce,J_ as cf,vo as cg,Kd as ch,Ud as ci,un as cj,cn as ck,ln as cl,Ba as cm,F_ as cn,an as co,sn as cp,on as cq,rn as cr,La as cs,kc as ct,wc as cu,Jf as cv,K_ as cw,B_ as cx,Ar as cy,mn as cz,Co as d,Rl as d$,Ie as d0,su as d1,Gp as d2,Vp as d3,tu as d4,Ou as d5,Od as d6,Id as d7,Ad as d8,xd as d9,Dc as dA,Qg as dB,ef as dC,xp as dD,nf as dE,wl as dF,tf as dG,rf as dH,$a as dI,Vs as dJ,Sp as dK,Ri as dL,f_ as dM,xf as dN,Sf as dO,hf as dP,y_ as dQ,Na as dR,pe as dS,_e as dT,U as dU,Hr as dV,Pa as dW,aa as dX,Dr as dY,Fr as dZ,Fa as d_,Dn as da,bd as db,Vd as dc,Rn as dd,d_ as de,zp as df,Pd as dg,Fd as dh,Sd as di,ku as dj,Bi as dk,Hi as dl,Ip as dm,Ni as dn,xc as dp,qa as dq,Sc as dr,qi as ds,ji as dt,xo as du,pi as dv,Jd as dw,eu as dx,Za as dy,Al as dz,sh as e,U_ as e0,Ia as e1,lm as e2,yp as e3,cp as e4,_p as e5,hp as e6,Jt as e7,bg as e8,G_ as e9,Xi as ea,Zi as eb,Wt as ec,yv as ed,Qc as f,Ro as g,Ha as h,eh as i,Ao as j,o as k,bp as l,he as m,rh as n,ch as o,Kt as p,op as q,lh as r,nn as s,wp as t,Yp as u,g_ as v,W as w,v_ as x,Pp as y,b_ as z}; + `}_renderRoomSource(e){return this._editorRuntimeOrThrow()._renderRoomSource(e)}_renderRoomDialog(){return this._editorRuntimeOrThrow()._renderRoomDialog()}}yv.properties={_tabDrag:{state:!0},_hdrH:{state:!0},_booting:{state:!0},_bootFading:{state:!0},_bootSoft:{state:!0},_continuityEpoch:{state:!0},_editorRuntimeLoadingVisible:{state:!0},_backdropGuard:{state:!0},_tapConfirm:{state:!0},_dangerConfirm:{state:!0},hass:{attribute:!1},panelHost:{type:Boolean,attribute:"panel-host",reflect:!0},narrow:{attribute:!1},_config:{state:!0},_space:{state:!0},_devices:{state:!0},_selId:{state:!0},_toast:{state:!0},_mode:{state:!0},_tool:{state:!0},_wallDialog:{state:!0},_drawWallField:{state:!0},_activeWallChainId:{state:!0},_physicalSel:{state:!0},_physicalDialog:{state:!0},_partitionDeleteDialog:{state:!0},_roomDeleteDialog:{state:!0},_physicalDrag:{state:!0},_physicalRotate:{state:!0},_duplicateColumnId:{state:!0},_opMeasure:{state:!0},_path:{state:!0},_cursorPt:{state:!0},_mergeSel:{state:!0},_openingPreset:{state:!0},_openingDialog:{state:!0},_openingInfo:{state:!0},_mergeDialog:{state:!0},_splitSel:{state:!0},_decorTool:{state:!0},_decorStyle:{state:!0},_decorDraft:{state:!0},_decorSel:{state:!0},_decorEraseConfirm:{state:!0},_decorTextDialog:{state:!0},_decorShapeDialog:{state:!0},_backdropDialog:{state:!0},_furnPalette:{state:!0},_decorImagePalette:{state:!0},_decorAssetCatalog:{state:!0},_decorAssetBusy:{state:!0},_furnCategory:{state:!0},_furnPreviewInput:{state:!0},_bdDrag:{state:!0},_dtBox:{state:!0},_dtDrag:{state:!0},_kioskDialog:{state:!0},_vacFit:{state:!0},_vacAllCamerasFor:{state:!0},_vacCalConfirm:{state:!0},_kioskDots:{state:!0},_areaSel:{state:!0},_nameSel:{state:!0},_roomDialog:{state:!0},_roomEditId:{state:!0},_roomFill:{state:!0},_roomCustomFill:{state:!0},_roomTempMin:{state:!0},_roomTempMax:{state:!0},_roomTempSrc:{state:!0},_roomHumSrc:{state:!0},_roomSrcOpen:{state:!0},_roomSrcFilter:{state:!0},_roomNameScale:{state:!0},_roomLabelScale:{state:!0},_spaceDialog:{state:!0},_infoCard:{state:!0},_deviceInbox:{state:!0},_rulesDialog:{state:!0},_settingsDialog:{state:!0},_pdfDialog:{state:!0},_supportDialog:{state:!0},_alignDialog:{state:!0},_preflightClipboardFallback:{state:!0},_backupExportDialog:{state:!0},_backupImportDialog:{state:!0},_importDialog:{state:!0},_markerDialog:{state:!0}},yv.ZOOM_MAX=8,yv.ZOOM_MIN=1/3,yv.styles=[op,pg],customElements.get("houseplan-card")||customElements.define("houseplan-card",yv),window.customCards=window.customCards||[],window.customCards.find(e=>"houseplan-card"===e.type)||window.customCards.push({type:"houseplan-card",name:"House Plan Card",description:"Interactive house plan: spaces, rooms and devices with live states and drag layout."}),console.info(`%c HOUSEPLAN-CARD %c v${ev} `,"background:#3ea6ff;color:#04121f;font-weight:700","");export{Wl as $,G as A,Pp as B,b_ as C,le as D,U as E,Ag as F,wi as G,Lr as H,$i as I,Mi as J,Ut as K,Ci as L,el as M,ja as N,wo as O,ni as P,Oo as Q,M_ as R,R_ as S,ys as T,io as U,Go as V,_i as W,Wo as X,L_ as Y,El as Z,rl as _,sh as a,fr as a$,Bl as a0,Cs as a1,ds as a2,Rs as a3,Zs as a4,Is as a5,Mc as a6,$c as a7,si as a8,Ja as a9,Yd as aA,Xd as aB,$g as aC,ti as aD,oi as aE,Pn as aF,Un as aG,dm as aH,Cr as aI,cm as aJ,Pl as aK,Hl as aL,Ql as aM,Xa as aN,ec as aO,Vl as aP,gs as aQ,ea as aR,es as aS,ua as aT,Oa as aU,N_ as aV,_a as aW,Ds as aX,Pg as aY,_n as aZ,vr as a_,Xu as aa,rp as ab,Ts as ac,ko as ad,ip as ae,Ku as af,Zo as ag,As as ah,Zu as ai,na as aj,sa as ak,fo as al,yo as am,Jr as an,O_ as ao,Ko as ap,Qa as aq,Uo as ar,Ua as as,Ga as at,en as au,tn as av,Ki as aw,Yi as ax,Ya as ay,ac as az,eh as b,li as b$,gr as b0,pn as b1,Oe as b2,kp as b3,sf as b4,Do as b5,nl as b6,Qt as b7,ei as b8,Br as b9,Nr as bA,Er as bB,Tr as bC,$r as bD,Rr as bE,Pr as bF,jn as bG,Sr as bH,Mr as bI,Xl as bJ,Ir as bK,Zl as bL,Ul as bM,Ll as bN,Jl as bO,Kl as bP,Yl as bQ,rm as bR,Jo as bS,$p as bT,tp as bU,Vf as bV,ep as bW,la as bX,qf as bY,Kf as bZ,C_ as b_,ma as ba,bc as bb,E_ as bc,bo as bd,Eu as be,q_ as bf,yi as bg,mi as bh,Fi as bi,za as bj,wa as bk,ba as bl,Yo as bm,Xo as bn,Qs as bo,kl as bp,Aa as bq,Da as br,Yn as bs,Xn as bt,ki as bu,ms as bv,_s as bw,j_ as bx,W_ as by,zr as bz,j as c,Sl as c$,Ju as c0,np as c1,Di as c2,fi as c3,ai as c4,vi as c5,Qo as c6,zi as c7,Mn as c8,Wp as c9,B_ as cA,Ar as cB,mn as cC,Fg as cD,so as cE,yr as cF,Ee as cG,qe as cH,Ne as cI,qc as cJ,Vc as cK,ih as cL,Ic as cM,Kc as cN,jc as cO,Wc as cP,th as cQ,Jc as cR,Ac as cS,Cc as cT,Bn as cU,Tc as cV,qn as cW,ci as cX,jf as cY,Dp as cZ,Bf as c_,Up as ca,wd as cb,Ru as cc,Li as cd,Ui as ce,Kn as cf,Ln as cg,Gd as ch,J_ as ci,vo as cj,Kd as ck,Ud as cl,un as cm,cn,ln as co,Ba as cp,F_ as cq,an as cr,sn as cs,on as ct,rn as cu,La as cv,kc as cw,wc as cx,Jf as cy,K_ as cz,ta as d,Rl as d$,Ps as d0,ss as d1,as as d2,Ie as d3,su as d4,Gp as d5,Vp as d6,tu as d7,Ou as d8,Od as d9,eu as dA,Za as dB,Al as dC,Dc as dD,Qg as dE,ef as dF,xp as dG,nf as dH,wl as dI,tf as dJ,rf as dK,$a as dL,Vs as dM,Sp as dN,Ri as dO,f_ as dP,xf as dQ,Sf as dR,hf as dS,y_ as dT,Na as dU,Hr as dV,Pa as dW,aa as dX,Dr as dY,Fr as dZ,Fa as d_,Id as da,Ad as db,xd as dc,Dn as dd,bd as de,Vd as df,Rn as dg,d_ as dh,zp as di,Pd as dj,Fd as dk,Sd as dl,ku as dm,Bi as dn,Hi as dp,Ip as dq,Ni as dr,xc as ds,qa as dt,Sc as du,qi as dv,ji as dw,xo as dx,pi as dy,Jd as dz,pe as e,U_ as e0,Ia as e1,lm as e2,yp as e3,cp as e4,_p as e5,hp as e6,Jt as e7,bg as e8,G_ as e9,Xi as ea,Zi as eb,Wt as ec,yv as ed,Qc as f,Mo as g,Co as h,_e as i,Ro as j,Ha as k,bp as l,Ao as m,rh as n,ch as o,o as p,he as q,lh as r,nn as s,Kt as t,op as u,wp as v,W as w,Yp as x,g_ as y,v_ as z}; diff --git a/custom_components/houseplan/frontend/houseplan-assets/houseplan-editor-runtime-BjAw4ds1.js b/custom_components/houseplan/frontend/houseplan-assets/houseplan-editor-runtime-CJrrYe2p.js similarity index 65% rename from custom_components/houseplan/frontend/houseplan-assets/houseplan-editor-runtime-BjAw4ds1.js rename to custom_components/houseplan/frontend/houseplan-assets/houseplan-editor-runtime-CJrrYe2p.js index 41caebf5..1ccba53e 100644 --- a/custom_components/houseplan/frontend/houseplan-assets/houseplan-editor-runtime-BjAw4ds1.js +++ b/custom_components/houseplan/frontend/houseplan-assets/houseplan-editor-runtime-CJrrYe2p.js @@ -1,121 +1,121 @@ -globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae33533bdef7216a6d7d513ae04091";import{s as t,e,n as s,f as i,i as o,l as a,o as n,r,A as l,b as h,D as c,w as d,N as p,a as u,c as _,d as m,g,h as f,j as b,k as v,m as y,p as $,q as w,t as k,u as x,v as S,x as M,y as C,z as P,B as D,C as I,E as T,F as z,G as R,H as A,I as F,J as N,K as E,L as H,M as O,O as L,P as B,Q as W,R as j,S as G,T as q,U,V as K,W as V,X as J,Y,Z as X,_ as Z,$ as Q,a0 as tt,a1 as et,a2 as st,a3 as it,a4 as ot,a5 as at,a6 as nt,a7 as rt,a8 as lt,a9 as ht,aa as ct,ab as dt,ac as pt,ad as ut,ae as _t,af as mt,ag as gt,ah as ft,ai as bt,aj as vt,ak as yt,al as $t,am as wt,an as kt,ao as xt,ap as St,aq as Mt,ar as Ct,as as Pt,at as Dt,au as It,av as Tt,aw as zt,ax as Rt,ay as At,az as Ft,aA as Nt,aB as Et,aC as Ht,aD as Ot,aE as Lt,aF as Bt,aG as Wt,aH as jt,aI as Gt,aJ as qt,aK as Ut,aL as Kt,aM as Vt,aN as Jt,aO as Yt,aP as Xt,aQ as Zt,aR as Qt,aS as te,aT as ee,aU as se,aV as ie,aW as oe,aX as ae,aY as ne,aZ as re,a_ as le,a$ as he,b0 as ce,b1 as de,b2 as pe,b3 as ue,b4 as _e,b5 as me,b6 as ge,b7 as fe,b8 as be,b9 as ve,ba as ye,bb as $e,bc as we,bd as ke,be as xe,bf as Se,bg as Me,bh as Ce,bi as Pe,bj as De,bk as Ie,bl as Te,bm as ze,bn as Re,bo as Ae,bp as Fe,bq as Ne,br as Ee,bs as He,bt as Oe,bu as Le,bv as Be,bw as We,bx as je,by as Ge,bz as qe,bA as Ue,bB as Ke,bC as Ve,bD as Je,bE as Ye,bF as Xe,bG as Ze,bH as Qe,bI as ts,bJ as es,bK as ss,bL as is,bM as os,bN as as,bO as ns,bP as rs,bQ as ls,bR as hs,bS as cs,bT as ds,bU as ps,bV as us,bW as _s,bX as ms,bY as gs,bZ as fs,b_ as bs,b$ as vs,c0 as ys,c1 as $s,c2 as ws,c3 as ks,c4 as xs,c5 as Ss,c6 as Ms,c7 as Cs,c8 as Ps,c9 as Ds,ca as Is,cb as Ts,cc as zs,cd as Rs,ce as As,cf as Fs,cg as Ns,ch as Es,ci as Hs,cj as Os,ck as Ls,cl as Bs,cm as Ws,cn as js,co as Gs,cp as qs,cq as Us,cr as Ks,cs as Vs,ct as Js,cu as Ys,cv as Xs,cw as Zs,cx as Qs,cy as ti,cz as ei,cA as si,cB as ii,cC as oi,cD as ai,cE as ni,cF as ri,cG as li,cH as hi,cI as ci,cJ as di,cK as pi,cL as ui,cM as _i,cN as mi,cO as gi,cP as fi,cQ as bi,cR as vi,cS as yi,cT as $i,cU as wi,cV as ki,cW as xi,cX as Si,cY as Mi,cZ as Ci,c_ as Pi,c$ as Di,d0 as Ii,d1 as Ti,d2 as zi,d3 as Ri,d4 as Ai,d5 as Fi,d6 as Ni,d7 as Ei,d8 as Hi,d9 as Oi,da as Li,db as Bi,dc as Wi,dd as ji,de as Gi,df as qi,dg as Ui,dh as Ki,di as Vi,dj as Ji,dk as Yi,dl as Xi,dm as Zi,dn as Qi,dp as to,dq as eo,dr as so,ds as io,dt as oo,du as ao,dv as no,dw as ro,dx as lo,dy as ho,dz as co}from"./houseplan-card-DqlR1H6U.js";import{i as po}from"./guard-DBKIUfbp.js";import{F as uo,f as _o,p as mo,c as go,e as fo,r as bo,a as vo,s as yo}from"./backdrop-pick-DCbvGxY2.js";import{t as $o,h as wo,m as ko,T as xo}from"./zigbee-topology-torI07nL.js";import{GENERATED_FURNITURE_ART as So,FURNITURE_ART_FINGERPRINT as Mo}from"./furniture-plan-art.generated-CrvWoAvu.js";var Co={"gs.hint":"Fill colors apply to every space; each color has its own opacity. Which fill mode a space uses is set in that space's dialog.","gs.show_room_tooltip":"Show the room information window on hover","support.about_group":"About the card","support.guide_group":"Documentation","support.guide":"User guide","support.form_group":"Send a report or suggestion","support.contact":"Contact details (email/tg/WhatsApp), optional.","support.message":"Message","support.attach":"Attach anonymized information from your plan","support.attach_hint":"Includes only allowed plan geometry, settings and bounded runtime facts. Excludes names, Home Assistant IDs, live states, URLs, files, and your message/contact.","support.geometry_warning":"The package contains no names or Home Assistant IDs, but it does contain the exact geometry and dimensions of your home.","support.close_busy_title":"Stop the current operation?","support.close_busy_body":"House Plan is preparing or sending the report. Closing now stops waiting for the result.","support.building":"Preparing anonymized data…","support.preview_summary":"Package v{version} · {spaces} spaces · {size} KiB","support.prepared":"Snapshot prepared {n} min ago","support.show_data":"Show data","support.download":"Download JSON","support.refresh":"Refresh snapshot","support.privacy":"When you send, your message, optional contact and, if selected, exact geometry leave your Home Assistant through the House Plan project relay and are visible to maintainers. The project node keeps the report for up to 30 days. Network infrastructure sees your HA server address, but House Plan does not retain it raw; rate-limit and idempotency metadata is kept for up to 24 hours.","support.error_title":"The report was not sent","support.manual_recovery":"You can keep the message and attachment and continue manually:","support.copy_message":"Copy message","support.success":"Report sent: {id}. Save this number when contacting support.","support.copy_id":"Copy ID","support.sending":"Sending…","support.retry":"Retry","support.send":"Send","support.update_required":"Update the House Plan card and integration to compatible versions to send reports.","support.message_copied":"Message copied","support.id_copied":"Report ID copied","support.copy_failed":"Could not access the clipboard. Select and copy the text manually.","support.validation.message_required":"Enter a message.","support.validation.message_too_long":"The message must contain no more than 10,000 characters.","support.validation.contact_too_long":"Contact details must contain no more than 320 characters.","support.validation.preview_missing":"Wait for the attachment preview or turn the attachment off.","support.validation.preview_expired":"The attachment preview expired. Refresh the snapshot.","support.error.support_invalid_message":"Check the message and try again.","support.error.support_preview_expired":"The attachment preview expired or is no longer available. Refresh the snapshot.","support.error.support_package_too_large":"The anonymized package exceeds the 8 MiB limit.","support.error.support_rate_limited":"Too many reports or previews were requested. Try again later.","support.error.support_unavailable":"The private support service is temporarily unavailable. Your draft remains here.","support.error.support_rejected":"The report did not pass the support service validation.","support.error.unauthorized":"You do not have permission to send this report.","vac.routes_section":"Maps and floors","vac.routes_current_map":"Current map","vac.routes_no_map":"no telemetry","vac.routes_status":"Routing","vac.routes_state_ready":"map assigned and calibrated","vac.routes_state_needs_calibration":"map assigned, calibration needed","vac.routes_state_unmapped":"current map is not assigned to a floor","vac.routes_state_ambiguous":"two maps are indistinguishable — no floor is chosen","vac.routes_state_missing_space":"the map's space was deleted","vac.routes_state_none":"no map data","vac.routes_empty":"No map is assigned to a floor yet.","vac.route_map_default":"no map id","vac.route_active":"Active","vac.route_space":"Space","vac.route_space_none":"not selected","vac.route_status_ready":"ready","vac.route_status_needs_calibration":"needs calibration","vac.route_status_ambiguous":"ambiguous","vac.route_status_missing_space":"space deleted","vac.route_missing_space_group":"Deleted space","vac.route_add_current":"Add current map","vac.route_delete":"Remove map","vac.route_delete_title":"Remove the map from its floor?","vac.route_delete_body":"Calibration and saved paths for this map will be removed. Continue?","vac.route_delete_confirm":"Remove","vac.route_space_title":"Move the map to another space?","vac.route_space_body":"Calibration and saved paths for this map will be removed. Continue?","vac.route_space_confirm":"Move","vac.route_missing_space_hint":"One of the maps points at a deleted space: pick a new one or remove the map. Until then the robot is not drawn for that map.","vac.route_default_hint":"The source reports no stable map id. Several floors cannot be told apart without another source or the robot's own selected map.","vac.route_target_hint":"The dock stays in the “{space}” space regardless of the current map.","vac.route_add_source":"Add a map source","vac.route_add_source_hint":"For integrations that give each map its own camera. The “All cameras” section above widens this list.","vac.route_source_no_map":"no map reported"};const Po={en:Co,ru:{"gs.hint":"Цвета заливок действуют на все пространства; у каждого цвета своя прозрачность. Какой режим заливки использует пространство — задаётся в его диалоге.","gs.show_room_tooltip":"Показывать окно с информацией при наведении на комнату","support.about_group":"О карточке","support.guide_group":"Документация","support.guide":"Руководство пользователя","support.form_group":"Отправить репорт или предложение","support.contact":"Контакт для связи (email/tg/WhatsApp), необязательно.","support.message":"Сообщение","support.attach":"Прикрепить обезличенную информацию из вашего плана","support.attach_hint":"В пакет входят только разрешённые геометрия, настройки и ограниченные сведения о среде. Не входят имена, HA id, текущие состояния, URL, файлы, сообщение и контакт.","support.geometry_warning":"Пакет не содержит имён и HA id, но содержит точную геометрию и размеры дома.","support.close_busy_title":"Прервать текущую операцию?","support.close_busy_body":"House Plan подготавливает или отправляет репорт. При закрытии ожидание результата прекратится.","support.building":"Подготавливаем обезличенные данные…","support.preview_summary":"Пакет v{version} · пространств: {spaces} · {size} КиБ","support.prepared":"Снимок подготовлен {n} мин назад","support.show_data":"Показать данные","support.download":"Скачать JSON","support.refresh":"Обновить снимок","support.privacy":"При отправке сообщение, необязательный контакт и, если выбран пакет, точная геометрия покидают ваш Home Assistant через relay проекта House Plan и доступны мейнтейнерам. Узел проекта хранит репорт до 30 дней. Сетевая инфраструктура видит адрес сервера HA, но House Plan не сохраняет его в исходном виде; метаданные лимитов и идемпотентности хранятся до 24 часов.","support.error_title":"Репорт не отправлен","support.manual_recovery":"Сообщение и вложение можно сохранить и продолжить вручную:","support.copy_message":"Копировать сообщение","support.success":"Репорт отправлен: {id}. Сохраните номер для связи с поддержкой.","support.copy_id":"Копировать ID","support.sending":"Отправляем…","support.retry":"Повторить","support.send":"Отправить","support.update_required":"Обновите карточку и интеграцию House Plan до совместимых версий, чтобы отправлять репорты.","support.message_copied":"Сообщение скопировано","support.id_copied":"ID репорта скопирован","support.copy_failed":"Не удалось получить доступ к буферу обмена. Выделите и скопируйте текст вручную.","support.validation.message_required":"Введите сообщение.","support.validation.message_too_long":"Сообщение должно содержать не более 10 000 символов.","support.validation.contact_too_long":"Контакт должен содержать не более 320 символов.","support.validation.preview_missing":"Дождитесь предпросмотра вложения или отключите его.","support.validation.preview_expired":"Предпросмотр вложения истёк. Обновите снимок.","support.error.support_invalid_message":"Проверьте сообщение и повторите попытку.","support.error.support_preview_expired":"Предпросмотр вложения истёк или больше недоступен. Обновите снимок.","support.error.support_package_too_large":"Обезличенный пакет превышает лимит 8 МиБ.","support.error.support_rate_limited":"Запрошено слишком много репортов или предпросмотров. Повторите позже.","support.error.support_unavailable":"Закрытая служба поддержки временно недоступна. Черновик сохранён в этом окне.","support.error.support_rejected":"Репорт не прошёл проверку службы поддержки.","support.error.unauthorized":"У вас нет прав на отправку этого репорта.","vac.routes_section":"Карты и этажи","vac.routes_current_map":"Текущая карта","vac.routes_no_map":"источник молчит","vac.routes_status":"Маршрутизация","vac.routes_state_ready":"карта сопоставлена и откалибрована","vac.routes_state_needs_calibration":"карта сопоставлена, нужна калибровка","vac.routes_state_unmapped":"текущая карта не сопоставлена этажу","vac.routes_state_ambiguous":"две карты неразличимы — этаж не выбирается","vac.routes_state_missing_space":"пространство карты удалено","vac.routes_state_none":"нет данных о карте","vac.routes_empty":"Ни одна карта ещё не сопоставлена этажу.","vac.route_map_default":"без идентификатора","vac.route_active":"Текущая","vac.route_space":"Пространство","vac.route_space_none":"не выбрано","vac.route_status_ready":"готова","vac.route_status_needs_calibration":"нужна калибровка","vac.route_status_ambiguous":"неоднозначна","vac.route_status_missing_space":"пространство удалено","vac.route_missing_space_group":"Пространство удалено","vac.route_add_current":"Добавить текущую карту","vac.route_delete":"Удалить карту","vac.route_delete_title":"Удалить карту с этажа?","vac.route_delete_body":"Калибровка и сохранённые пути этой карты будут удалены. Продолжить?","vac.route_delete_confirm":"Удалить","vac.route_space_title":"Перенести карту в другое пространство?","vac.route_space_body":"Калибровка и сохранённые пути этой карты будут удалены. Продолжить?","vac.route_space_confirm":"Перенести","vac.route_missing_space_hint":"Одна из карт ссылается на удалённое пространство: выберите новое или удалите карту. Пока ссылка не исправлена, робот на этой карте не рисуется.","vac.route_default_hint":"Источник не сообщает стабильный идентификатор карты. Несколько этажей нельзя различить без другого источника или собственной карты робота.","vac.route_target_hint":"Док остаётся в пространстве «{space}» независимо от текущей карты.","vac.route_add_source":"Добавить источник карты","vac.route_add_source_hint":"Для интеграций, где у каждой карты своя камера. Список расширяется разделом «Все камеры» выше.","vac.route_source_no_map":"карта не читается"},de:{"gs.hint":"Füllfarben gelten für jeden Bereich; jede Farbe hat ihre eigene Deckkraft. Der Füllmodus wird in den Einstellungen des jeweiligen Bereichs festgelegt.","gs.show_room_tooltip":"Rauminformationen beim Darüberfahren anzeigen","support.about_group":"Über die Karte","support.guide_group":"Dokumentation","support.guide":"Benutzerhandbuch","support.form_group":"Bericht oder Vorschlag senden","support.contact":"Kontakt (E-Mail/tg/WhatsApp), optional.","support.message":"Nachricht","support.attach":"Anonymisierte Informationen aus dem Plan anhängen","support.attach_hint":"Enthält nur erlaubte Plangeometrie, Einstellungen und begrenzte Laufzeitdaten. Namen, Home-Assistant-IDs, Live-Zustände, URLs, Dateien, Nachricht und Kontakt werden ausgeschlossen.","support.geometry_warning":"Das Paket enthält keine Namen oder Home-Assistant-IDs, aber die exakte Geometrie und die Maße Ihres Hauses.","support.close_busy_title":"Aktuellen Vorgang abbrechen?","support.close_busy_body":"House Plan bereitet den Bericht vor oder sendet ihn. Beim Schließen wird nicht weiter auf das Ergebnis gewartet.","support.building":"Anonymisierte Daten werden vorbereitet…","support.preview_summary":"Paket v{version} · {spaces} Bereiche · {size} KiB","support.prepared":"Schnappschuss vor {n} Min. erstellt","support.show_data":"Daten anzeigen","support.download":"JSON herunterladen","support.refresh":"Schnappschuss aktualisieren","support.privacy":"Beim Senden verlassen Ihre Nachricht, der optionale Kontakt und, falls ausgewählt, die exakte Geometrie Ihren Home Assistant über das House-Plan-Projektrelay und sind für die Maintainer sichtbar. Der Projektserver speichert den Bericht bis zu 30 Tage. Die Netzwerkinfrastruktur sieht die Adresse Ihres HA-Servers, House Plan speichert sie jedoch nicht im Rohformat; Limit- und Idempotenzdaten bleiben bis zu 24 Stunden erhalten.","support.error_title":"Der Bericht wurde nicht gesendet","support.manual_recovery":"Nachricht und Anhang können gespeichert und manuell weitergegeben werden:","support.copy_message":"Nachricht kopieren","support.success":"Bericht gesendet: {id}. Bewahren Sie diese Nummer für den Support auf.","support.copy_id":"ID kopieren","support.sending":"Wird gesendet…","support.retry":"Erneut versuchen","support.send":"Senden","support.update_required":"Aktualisieren Sie House-Plan-Karte und Integration auf kompatible Versionen, um Berichte zu senden.","support.message_copied":"Nachricht kopiert","support.id_copied":"Berichts-ID kopiert","support.copy_failed":"Kein Zugriff auf die Zwischenablage. Markieren und kopieren Sie den Text manuell.","support.validation.message_required":"Geben Sie eine Nachricht ein.","support.validation.message_too_long":"Die Nachricht darf höchstens 10.000 Zeichen enthalten.","support.validation.contact_too_long":"Der Kontakt darf höchstens 320 Zeichen enthalten.","support.validation.preview_missing":"Warten Sie auf die Vorschau oder deaktivieren Sie den Anhang.","support.validation.preview_expired":"Die Anhangsvorschau ist abgelaufen. Aktualisieren Sie den Schnappschuss.","support.error.support_invalid_message":"Prüfen Sie die Nachricht und versuchen Sie es erneut.","support.error.support_preview_expired":"Die Anhangsvorschau ist abgelaufen oder nicht mehr verfügbar. Aktualisieren Sie den Schnappschuss.","support.error.support_package_too_large":"Das anonymisierte Paket überschreitet das Limit von 8 MiB.","support.error.support_rate_limited":"Zu viele Berichte oder Vorschauen wurden angefordert. Versuchen Sie es später erneut.","support.error.support_unavailable":"Der private Supportdienst ist vorübergehend nicht verfügbar. Der Entwurf bleibt in diesem Fenster erhalten.","support.error.support_rejected":"Der Bericht hat die Prüfung des Supportdienstes nicht bestanden.","support.error.unauthorized":"Sie dürfen diesen Bericht nicht senden.","vac.routes_section":"Karten und Etagen","vac.routes_current_map":"Aktuelle Karte","vac.routes_no_map":"keine Telemetrie","vac.routes_status":"Zuordnung","vac.routes_state_ready":"Karte zugeordnet und kalibriert","vac.routes_state_needs_calibration":"Karte zugeordnet, Kalibrierung nötig","vac.routes_state_unmapped":"aktuelle Karte keiner Etage zugeordnet","vac.routes_state_ambiguous":"zwei Karten nicht unterscheidbar — keine Etage gewählt","vac.routes_state_missing_space":"der Raum der Karte wurde gelöscht","vac.routes_state_none":"keine Kartendaten","vac.routes_empty":"Noch keine Karte einer Etage zugeordnet.","vac.route_map_default":"ohne Karten-ID","vac.route_active":"Aktiv","vac.route_space":"Raum","vac.route_space_none":"nicht gewählt","vac.route_status_ready":"bereit","vac.route_status_needs_calibration":"Kalibrierung nötig","vac.route_status_ambiguous":"mehrdeutig","vac.route_status_missing_space":"Raum gelöscht","vac.route_missing_space_group":"Gelöschter Bereich","vac.route_add_current":"Aktuelle Karte hinzufügen","vac.route_delete":"Karte entfernen","vac.route_delete_title":"Karte von der Etage entfernen?","vac.route_delete_body":"Kalibrierung und gespeicherte Pfade dieser Karte werden entfernt. Fortfahren?","vac.route_delete_confirm":"Entfernen","vac.route_space_title":"Karte in einen anderen Raum verschieben?","vac.route_space_body":"Kalibrierung und gespeicherte Pfade dieser Karte werden entfernt. Fortfahren?","vac.route_space_confirm":"Verschieben","vac.route_missing_space_hint":"Eine Karte verweist auf einen gelöschten Raum: neuen wählen oder Karte entfernen. Bis dahin wird der Roboter für diese Karte nicht gezeichnet.","vac.route_default_hint":"Die Quelle meldet keine stabile Karten-ID. Mehrere Etagen lassen sich ohne andere Quelle oder die vom Roboter gewählte Karte nicht unterscheiden.","vac.route_target_hint":"Die Station bleibt unabhängig von der aktuellen Karte im Raum „{space}“.","vac.route_add_source":"Kartenquelle hinzufügen","vac.route_add_source_hint":"Für Integrationen, die jeder Karte eine eigene Kamera geben. Der Abschnitt „Alle Kameras“ oben erweitert diese Liste.","vac.route_source_no_map":"keine Karte gemeldet"},fr:{"gs.hint":"Les couleurs de remplissage s’appliquent à tous les espaces ; chaque couleur possède sa propre opacité. Le mode de remplissage utilisé par un espace se règle dans la boîte de dialogue de cet espace.","gs.show_room_tooltip":"Afficher les informations de la pièce au survol","support.about_group":"À propos de la carte","support.guide_group":"Documentation d’aide","support.guide":"Guide utilisateur","support.form_group":"Envoyer un rapport ou une suggestion","support.contact":"Contact (e-mail/tg/WhatsApp), facultatif.","support.message":"Votre message","support.attach":"Joindre des informations anonymisées de votre plan","support.attach_hint":"Inclut uniquement la géométrie, les réglages autorisés et des données d’exécution limitées. Exclut les noms, identifiants Home Assistant, états en direct, URL, fichiers, message et contact.","support.geometry_warning":"Le paquet ne contient ni noms ni identifiants Home Assistant, mais il contient la géométrie et les dimensions exactes de votre logement.","support.close_busy_title":"Interrompre l’opération en cours ?","support.close_busy_body":"House Plan prépare ou envoie le rapport. Fermer maintenant arrête l’attente du résultat.","support.building":"Préparation des données anonymisées…","support.preview_summary":"Paquet v{version} · {spaces} espaces · {size} Kio","support.prepared":"Instantané préparé il y a {n} min","support.show_data":"Afficher les données","support.download":"Télécharger le JSON","support.refresh":"Actualiser l’instantané","support.privacy":"Lors de l’envoi, votre message, le contact facultatif et, si elle est sélectionnée, la géométrie exacte quittent votre Home Assistant via le relais du projet House Plan et sont visibles par les mainteneurs. Le serveur du projet conserve le rapport jusqu’à 30 jours. L’infrastructure réseau voit l’adresse de votre serveur HA, mais House Plan ne la conserve pas en clair ; les métadonnées de limitation et d’idempotence sont gardées jusqu’à 24 heures.","support.error_title":"Le rapport n’a pas été envoyé","support.manual_recovery":"Vous pouvez conserver le message et la pièce jointe puis continuer manuellement :","support.copy_message":"Copier le message","support.success":"Rapport envoyé : {id}. Conservez ce numéro pour contacter l’assistance.","support.copy_id":"Copier l’ID","support.sending":"Envoi…","support.retry":"Réessayer","support.send":"Envoyer","support.update_required":"Mettez à jour la carte et l’intégration House Plan vers des versions compatibles pour envoyer des rapports.","support.message_copied":"Message copié","support.id_copied":"ID du rapport copié","support.copy_failed":"Impossible d’accéder au presse-papiers. Sélectionnez et copiez le texte manuellement.","support.validation.message_required":"Saisissez un message.","support.validation.message_too_long":"Le message ne doit pas dépasser 10 000 caractères.","support.validation.contact_too_long":"Le contact ne doit pas dépasser 320 caractères.","support.validation.preview_missing":"Attendez l’aperçu de la pièce jointe ou désactivez-la.","support.validation.preview_expired":"L’aperçu de la pièce jointe a expiré. Actualisez l’instantané.","support.error.support_invalid_message":"Vérifiez le message et réessayez.","support.error.support_preview_expired":"L’aperçu de la pièce jointe a expiré ou n’est plus disponible. Actualisez l’instantané.","support.error.support_package_too_large":"Le paquet anonymisé dépasse la limite de 8 Mio.","support.error.support_rate_limited":"Trop de rapports ou d’aperçus ont été demandés. Réessayez plus tard.","support.error.support_unavailable":"Le service d’assistance privé est temporairement indisponible. Le brouillon reste dans cette fenêtre.","support.error.support_rejected":"Le rapport n’a pas passé la validation du service d’assistance.","support.error.unauthorized":"Vous n’êtes pas autorisé à envoyer ce rapport.","vac.routes_section":"Cartes et étages","vac.routes_current_map":"Carte actuelle","vac.routes_no_map":"aucune télémétrie","vac.routes_status":"Routage","vac.routes_state_ready":"carte assignée et calibrée","vac.routes_state_needs_calibration":"carte assignée, calibrage requis","vac.routes_state_unmapped":"carte actuelle non assignée à un étage","vac.routes_state_ambiguous":"deux cartes indiscernables — aucun étage choisi","vac.routes_state_missing_space":"l'espace de la carte a été supprimé","vac.routes_state_none":"aucune donnée de carte","vac.routes_empty":"Aucune carte n'est encore assignée à un étage.","vac.route_map_default":"sans identifiant","vac.route_active":"Active","vac.route_space":"Espace","vac.route_space_none":"non sélectionné","vac.route_status_ready":"prête","vac.route_status_needs_calibration":"calibrage requis","vac.route_status_ambiguous":"ambiguë","vac.route_status_missing_space":"espace supprimé","vac.route_missing_space_group":"Espace supprimé","vac.route_add_current":"Ajouter la carte actuelle","vac.route_delete":"Supprimer la carte","vac.route_delete_title":"Retirer la carte de son étage ?","vac.route_delete_body":"Le calibrage et les trajets enregistrés de cette carte seront supprimés. Continuer ?","vac.route_delete_confirm":"Supprimer","vac.route_space_title":"Déplacer la carte vers un autre espace ?","vac.route_space_body":"Le calibrage et les trajets enregistrés de cette carte seront supprimés. Continuer ?","vac.route_space_confirm":"Déplacer","vac.route_missing_space_hint":"Une carte pointe vers un espace supprimé : choisissez-en un autre ou supprimez la carte. D'ici là, le robot n'est pas dessiné pour cette carte.","vac.route_default_hint":"La source ne fournit pas d'identifiant de carte stable. Plusieurs étages ne peuvent pas être distingués sans une autre source ou la carte sélectionnée du robot.","vac.route_target_hint":"La station reste dans l'espace « {space} » quelle que soit la carte actuelle.","vac.route_add_source":"Ajouter une source de carte","vac.route_add_source_hint":"Pour les intégrations qui donnent à chaque carte sa propre caméra. La section « Toutes les caméras » ci-dessus élargit cette liste.","vac.route_source_no_map":"aucune carte signalée"}};function Do(e,s,i){return t(Po[e]?.[s]??Co[s]??s,i)}function Io(t,e,s,i,o){return{markerId:t,source:i,mapId:o,space:e.length?"":s}}function To(t,e,s){return{...t,space:s.has(e)?e:""}}function zo(t,e=Math.random){const s=new Set(t);for(let t=0;t<64;t+=1){const t="vr_"+Math.floor(16777215*e()).toString(36).padStart(5,"0");if(!s.has(t))return t}return"vr_"+Date.now().toString(36)}function Ro(t,e,s){return t.map(t=>t.id===e?{...t,calibration:s}:t)}const Ao=new WeakMap,Fo=(t,e)=>{const s=(t._serverCfg?.spaces||[]).find(t=>t?.id===e);return String(s?.name||s?.id||e)};function No(t,i,o){const c=t.host,d=a(c.hass,c._config?.language),p=(t,e)=>Do(d,t,e),u=i.marker?.vacuum||{},_=Array.isArray(u.map_routes),m=c._vacSource(i)||"",g=e(i.id,u,i.space,m),f=(c._serverCfg?.spaces||[]).filter(t=>"string"==typeof t?.id&&!!t.id).map(t=>({id:t.id,name:String(t.name||t.id)})),b=new Set(f.map(t=>t.id)),v=n(g,[m],t=>c._vacObservedMapId(i,t)),y=r({routes:g,observed:v,spaceIds:b}),$="ready"===y.kind||"needs_calibration"===y.kind||"missing_space"===y.kind?y.route.id:"",w=m?v[m]:void 0,k=async e=>{let o=_?u.map_routes??null:null;if(!o&&(o=function(t,e,i,o){if(!i)return null;const a=t?.calibration;if(!a||"object"!=typeof a)return null;const n=new Set,r=[];for(const t of Object.keys(a)){const l=s(a[t]);if(!l)continue;const h=o(n);n.add(h),r.push({id:h,source:i,map_id:t,space:e,calibration:l})}return r.length?r:null}(u,i.space,m,t=>zo(t))??[],!m&&Object.keys(u.calibration||{}).length))return!1;const a=e(o);return!!a&&(async e=>{const s=c._serverCfg;if(!s)return!1;const o=JSON.parse(JSON.stringify(s));o.markers=o.markers||[];let a=o.markers.find(t=>t.id===i.id);if(!a){if("device"!==i.bindingKind&&"entity"!==i.bindingKind||!i.bindingRef)return!1;a={id:i.id,binding:`${i.bindingKind}:${i.bindingRef}`,space:i.space||null,area:i.area||null,hidden:!!i.hidden},o.markers.push(a)}a.vacuum={...a.vacuum||{},map_routes:e},delete a.vacuum.calibration;const n=c._adoption.beginOptimistic(s,o);c._adoption.stageLocalConfig(o),c._regSignature="",c._maybeRebuildDevices(),c.requestUpdate(),c._saveConfigDebounced.pending()&&c._saveConfigDebounced.cancel();try{return await t._saveConfigNow(),!0}catch(t){return c._rollbackOptimistic(n),c._regSignature="",c._maybeRebuildDevices(),c.requestUpdate(),c._showToast(c._t("toast.cfg_save_failed",{err:c._errText(t)})),!1}})(a)},x=o.candidates.filter(t=>t.entityId!==m&&!g.some(e=>e.source===t.entityId)),S=async(t,e)=>{if(!e||e===t.space)return;await c._confirmDanger({key:"vacuum_route_space",kind:"warning",title:p("vac.route_space_title"),message:p("vac.route_space_body"),objectName:t.map_id||p("vac.route_map_default"),confirmLabel:p("vac.route_space_confirm"),cancelLabel:c._t("btn.cancel")})&&await k(s=>function(t,e,s,i){return t.map(t=>t.id===e?{...t,id:i,space:s,calibration:null}:t)}(s,t.id,e,zo(new Set(g.map(t=>t.id)))))},M=new Map(f.map((t,e)=>[t.id,e])),C=(t,e)=>t.map_id.localeCompare(e.map_id)||t.source.localeCompare(e.source)||t.id.localeCompare(e.id),P=g.filter(t=>b.has(t.space)).sort((t,e)=>(M.get(t.space)??0)-(M.get(e.space)??0)||C(t,e)),D=g.filter(t=>!b.has(t.space)).sort(C),I=[...P,...D],T=!!m&&void 0!==w&&!g.some(t=>t.source===m&&t.map_id===w);let z=Ao.get(t);const R=z?.source||"",A=z?.mapId||"",F=!!z&&g.some(t=>t.source===R&&t.map_id===A);z&&(z.markerId!==i.id||c._vacObservedMapId(i,z.source)!==z.mapId||F&&!z.saving)&&(Ao.delete(t),z=void 0),z?.space&&!b.has(z.space)&&(z=To(z,"",b),Ao.set(t,z));const N=e=>h` -
  • +globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="012abf4b3924ad03971870eb8085ab1ac1a66b0d9b6676fe095285a8b0f201ab";import{e as t,i as e,E as s,s as i,a as o,n as a,f as n,b as r,l,o as h,r as c,A as d,c as p,D as u,w as _,N as m,d as g,g as f,h as b,j as v,k as y,m as $,p as w,q as k,t as x,u as S,v as M,x as C,y as P,z as D,B as I,C as T,F as z,G as R,H as A,I as F,J as N,K as E,L as H,M as O,O as L,P as B,Q as W,R as j,S as G,T as q,U,V as K,W as V,X as J,Y,Z as X,_ as Z,$ as Q,a0 as tt,a1 as et,a2 as st,a3 as it,a4 as ot,a5 as at,a6 as nt,a7 as rt,a8 as lt,a9 as ht,aa as ct,ab as dt,ac as pt,ad as ut,ae as _t,af as mt,ag as gt,ah as ft,ai as bt,aj as vt,ak as yt,al as $t,am as wt,an as kt,ao as xt,ap as St,aq as Mt,ar as Ct,as as Pt,at as Dt,au as It,av as Tt,aw as zt,ax as Rt,ay as At,az as Ft,aA as Nt,aB as Et,aC as Ht,aD as Ot,aE as Lt,aF as Bt,aG as Wt,aH as jt,aI as Gt,aJ as qt,aK as Ut,aL as Kt,aM as Vt,aN as Jt,aO as Yt,aP as Xt,aQ as Zt,aR as Qt,aS as te,aT as ee,aU as se,aV as ie,aW as oe,aX as ae,aY as ne,aZ as re,a_ as le,a$ as he,b0 as ce,b1 as de,b2 as pe,b3 as ue,b4 as _e,b5 as me,b6 as ge,b7 as fe,b8 as be,b9 as ve,ba as ye,bb as $e,bc as we,bd as ke,be as xe,bf as Se,bg as Me,bh as Ce,bi as Pe,bj as De,bk as Ie,bl as Te,bm as ze,bn as Re,bo as Ae,bp as Fe,bq as Ne,br as Ee,bs as He,bt as Oe,bu as Le,bv as Be,bw as We,bx as je,by as Ge,bz as qe,bA as Ue,bB as Ke,bC as Ve,bD as Je,bE as Ye,bF as Xe,bG as Ze,bH as Qe,bI as ts,bJ as es,bK as ss,bL as is,bM as os,bN as as,bO as ns,bP as rs,bQ as ls,bR as hs,bS as cs,bT as ds,bU as ps,bV as us,bW as _s,bX as ms,bY as gs,bZ as fs,b_ as bs,b$ as vs,c0 as ys,c1 as $s,c2 as ws,c3 as ks,c4 as xs,c5 as Ss,c6 as Ms,c7 as Cs,c8 as Ps,c9 as Ds,ca as Is,cb as Ts,cc as zs,cd as Rs,ce as As,cf as Fs,cg as Ns,ch as Es,ci as Hs,cj as Os,ck as Ls,cl as Bs,cm as Ws,cn as js,co as Gs,cp as qs,cq as Us,cr as Ks,cs as Vs,ct as Js,cu as Ys,cv as Xs,cw as Zs,cx as Qs,cy as ti,cz as ei,cA as si,cB as ii,cC as oi,cD as ai,cE as ni,cF as ri,cG as li,cH as hi,cI as ci,cJ as di,cK as pi,cL as ui,cM as _i,cN as mi,cO as gi,cP as fi,cQ as bi,cR as vi,cS as yi,cT as $i,cU as wi,cV as ki,cW as xi,cX as Si,cY as Mi,cZ as Ci,c_ as Pi,c$ as Di,d0 as Ii,d1 as Ti,d2 as zi,d3 as Ri,d4 as Ai,d5 as Fi,d6 as Ni,d7 as Ei,d8 as Hi,d9 as Oi,da as Li,db as Bi,dc as Wi,dd as ji,de as Gi,df as qi,dg as Ui,dh as Ki,di as Vi,dj as Ji,dk as Yi,dl as Xi,dm as Zi,dn as Qi,dp as to,dq as eo,dr as so,ds as io,dt as oo,du as ao,dv as no,dw as ro,dx as lo,dy as ho,dz as co,dA as po,dB as uo,dC as _o}from"./houseplan-card-CrTmJZ8b.js";import{F as mo,f as go,p as fo,c as bo,e as vo,r as yo,a as $o,s as wo}from"./backdrop-pick-CGON6yBi.js";import{t as ko,h as xo,m as So,T as Mo}from"./zigbee-topology-CQT90rCw.js";import{GENERATED_FURNITURE_ART as Co,FURNITURE_ART_FINGERPRINT as Po}from"./furniture-plan-art.generated-C_WDX48s.js";const Do={},Io=t(class extends e{constructor(){super(...arguments),this.ot=Do}render(t,e){return e()}update(t,[e,i]){if(Array.isArray(e)){if(Array.isArray(this.ot)&&this.ot.length===e.length&&e.every((t,e)=>t===this.ot[e]))return s}else if(this.ot===e)return s;return this.ot=Array.isArray(e)?Array.from(e):e,this.render(e,i)}});var To={"gs.hint":"Fill colors apply to every space; each color has its own opacity. Which fill mode a space uses is set in that space's dialog.","gs.show_room_tooltip":"Show the room information window on hover","support.about_group":"About the card","support.guide_group":"Documentation","support.guide":"User guide","support.form_group":"Send a report or suggestion","support.contact":"Contact details (email/tg/WhatsApp), optional.","support.message":"Message","support.attach":"Attach anonymized information from your plan","support.attach_hint":"Includes only allowed plan geometry, settings and bounded runtime facts. Excludes names, Home Assistant IDs, live states, URLs, files, and your message/contact.","support.geometry_warning":"The package contains no names or Home Assistant IDs, but it does contain the exact geometry and dimensions of your home.","support.close_busy_title":"Stop the current operation?","support.close_busy_body":"House Plan is preparing or sending the report. Closing now stops waiting for the result.","support.building":"Preparing anonymized data…","support.preview_summary":"Package v{version} · {spaces} spaces · {size} KiB","support.prepared":"Snapshot prepared {n} min ago","support.show_data":"Show data","support.download":"Download JSON","support.refresh":"Refresh snapshot","support.privacy":"When you send, your message, optional contact and, if selected, exact geometry leave your Home Assistant through the House Plan project relay and are visible to maintainers. The project node keeps the report for up to 30 days. Network infrastructure sees your HA server address, but House Plan does not retain it raw; rate-limit and idempotency metadata is kept for up to 24 hours.","support.error_title":"The report was not sent","support.manual_recovery":"You can keep the message and attachment and continue manually:","support.copy_message":"Copy message","support.success":"Report sent: {id}. Save this number when contacting support.","support.copy_id":"Copy ID","support.sending":"Sending…","support.retry":"Retry","support.send":"Send","support.update_required":"Update the House Plan card and integration to compatible versions to send reports.","support.message_copied":"Message copied","support.id_copied":"Report ID copied","support.copy_failed":"Could not access the clipboard. Select and copy the text manually.","support.validation.message_required":"Enter a message.","support.validation.message_too_long":"The message must contain no more than 10,000 characters.","support.validation.contact_too_long":"Contact details must contain no more than 320 characters.","support.validation.preview_missing":"Wait for the attachment preview or turn the attachment off.","support.validation.preview_expired":"The attachment preview expired. Refresh the snapshot.","support.error.support_invalid_message":"Check the message and try again.","support.error.support_preview_expired":"The attachment preview expired or is no longer available. Refresh the snapshot.","support.error.support_package_too_large":"The anonymized package exceeds the 8 MiB limit.","support.error.support_rate_limited":"Too many reports or previews were requested. Try again later.","support.error.support_unavailable":"The private support service is temporarily unavailable. Your draft remains here.","support.error.support_rejected":"The report did not pass the support service validation.","support.error.unauthorized":"You do not have permission to send this report.","vac.routes_section":"Maps and floors","vac.routes_current_map":"Current map","vac.routes_no_map":"no telemetry","vac.routes_status":"Routing","vac.routes_state_ready":"map assigned and calibrated","vac.routes_state_needs_calibration":"map assigned, calibration needed","vac.routes_state_unmapped":"current map is not assigned to a floor","vac.routes_state_ambiguous":"two maps are indistinguishable — no floor is chosen","vac.routes_state_missing_space":"the map's space was deleted","vac.routes_state_none":"no map data","vac.routes_empty":"No map is assigned to a floor yet.","vac.route_map_default":"no map id","vac.route_active":"Active","vac.route_space":"Space","vac.route_space_none":"not selected","vac.route_status_ready":"ready","vac.route_status_needs_calibration":"needs calibration","vac.route_status_ambiguous":"ambiguous","vac.route_status_missing_space":"space deleted","vac.route_missing_space_group":"Deleted space","vac.route_add_current":"Add current map","vac.route_delete":"Remove map","vac.route_delete_title":"Remove the map from its floor?","vac.route_delete_body":"Calibration and saved paths for this map will be removed. Continue?","vac.route_delete_confirm":"Remove","vac.route_space_title":"Move the map to another space?","vac.route_space_body":"Calibration and saved paths for this map will be removed. Continue?","vac.route_space_confirm":"Move","vac.route_missing_space_hint":"One of the maps points at a deleted space: pick a new one or remove the map. Until then the robot is not drawn for that map.","vac.route_default_hint":"The source reports no stable map id. Several floors cannot be told apart without another source or the robot's own selected map.","vac.route_target_hint":"The dock stays in the “{space}” space regardless of the current map.","vac.route_add_source":"Add a map source","vac.route_add_source_hint":"For integrations that give each map its own camera. The “All cameras” section above widens this list.","vac.route_source_no_map":"no map reported"};const zo={en:To,ru:{"gs.hint":"Цвета заливок действуют на все пространства; у каждого цвета своя прозрачность. Какой режим заливки использует пространство — задаётся в его диалоге.","gs.show_room_tooltip":"Показывать окно с информацией при наведении на комнату","support.about_group":"О карточке","support.guide_group":"Документация","support.guide":"Руководство пользователя","support.form_group":"Отправить репорт или предложение","support.contact":"Контакт для связи (email/tg/WhatsApp), необязательно.","support.message":"Сообщение","support.attach":"Прикрепить обезличенную информацию из вашего плана","support.attach_hint":"В пакет входят только разрешённые геометрия, настройки и ограниченные сведения о среде. Не входят имена, HA id, текущие состояния, URL, файлы, сообщение и контакт.","support.geometry_warning":"Пакет не содержит имён и HA id, но содержит точную геометрию и размеры дома.","support.close_busy_title":"Прервать текущую операцию?","support.close_busy_body":"House Plan подготавливает или отправляет репорт. При закрытии ожидание результата прекратится.","support.building":"Подготавливаем обезличенные данные…","support.preview_summary":"Пакет v{version} · пространств: {spaces} · {size} КиБ","support.prepared":"Снимок подготовлен {n} мин назад","support.show_data":"Показать данные","support.download":"Скачать JSON","support.refresh":"Обновить снимок","support.privacy":"При отправке сообщение, необязательный контакт и, если выбран пакет, точная геометрия покидают ваш Home Assistant через relay проекта House Plan и доступны мейнтейнерам. Узел проекта хранит репорт до 30 дней. Сетевая инфраструктура видит адрес сервера HA, но House Plan не сохраняет его в исходном виде; метаданные лимитов и идемпотентности хранятся до 24 часов.","support.error_title":"Репорт не отправлен","support.manual_recovery":"Сообщение и вложение можно сохранить и продолжить вручную:","support.copy_message":"Копировать сообщение","support.success":"Репорт отправлен: {id}. Сохраните номер для связи с поддержкой.","support.copy_id":"Копировать ID","support.sending":"Отправляем…","support.retry":"Повторить","support.send":"Отправить","support.update_required":"Обновите карточку и интеграцию House Plan до совместимых версий, чтобы отправлять репорты.","support.message_copied":"Сообщение скопировано","support.id_copied":"ID репорта скопирован","support.copy_failed":"Не удалось получить доступ к буферу обмена. Выделите и скопируйте текст вручную.","support.validation.message_required":"Введите сообщение.","support.validation.message_too_long":"Сообщение должно содержать не более 10 000 символов.","support.validation.contact_too_long":"Контакт должен содержать не более 320 символов.","support.validation.preview_missing":"Дождитесь предпросмотра вложения или отключите его.","support.validation.preview_expired":"Предпросмотр вложения истёк. Обновите снимок.","support.error.support_invalid_message":"Проверьте сообщение и повторите попытку.","support.error.support_preview_expired":"Предпросмотр вложения истёк или больше недоступен. Обновите снимок.","support.error.support_package_too_large":"Обезличенный пакет превышает лимит 8 МиБ.","support.error.support_rate_limited":"Запрошено слишком много репортов или предпросмотров. Повторите позже.","support.error.support_unavailable":"Закрытая служба поддержки временно недоступна. Черновик сохранён в этом окне.","support.error.support_rejected":"Репорт не прошёл проверку службы поддержки.","support.error.unauthorized":"У вас нет прав на отправку этого репорта.","vac.routes_section":"Карты и этажи","vac.routes_current_map":"Текущая карта","vac.routes_no_map":"источник молчит","vac.routes_status":"Маршрутизация","vac.routes_state_ready":"карта сопоставлена и откалибрована","vac.routes_state_needs_calibration":"карта сопоставлена, нужна калибровка","vac.routes_state_unmapped":"текущая карта не сопоставлена этажу","vac.routes_state_ambiguous":"две карты неразличимы — этаж не выбирается","vac.routes_state_missing_space":"пространство карты удалено","vac.routes_state_none":"нет данных о карте","vac.routes_empty":"Ни одна карта ещё не сопоставлена этажу.","vac.route_map_default":"без идентификатора","vac.route_active":"Текущая","vac.route_space":"Пространство","vac.route_space_none":"не выбрано","vac.route_status_ready":"готова","vac.route_status_needs_calibration":"нужна калибровка","vac.route_status_ambiguous":"неоднозначна","vac.route_status_missing_space":"пространство удалено","vac.route_missing_space_group":"Пространство удалено","vac.route_add_current":"Добавить текущую карту","vac.route_delete":"Удалить карту","vac.route_delete_title":"Удалить карту с этажа?","vac.route_delete_body":"Калибровка и сохранённые пути этой карты будут удалены. Продолжить?","vac.route_delete_confirm":"Удалить","vac.route_space_title":"Перенести карту в другое пространство?","vac.route_space_body":"Калибровка и сохранённые пути этой карты будут удалены. Продолжить?","vac.route_space_confirm":"Перенести","vac.route_missing_space_hint":"Одна из карт ссылается на удалённое пространство: выберите новое или удалите карту. Пока ссылка не исправлена, робот на этой карте не рисуется.","vac.route_default_hint":"Источник не сообщает стабильный идентификатор карты. Несколько этажей нельзя различить без другого источника или собственной карты робота.","vac.route_target_hint":"Док остаётся в пространстве «{space}» независимо от текущей карты.","vac.route_add_source":"Добавить источник карты","vac.route_add_source_hint":"Для интеграций, где у каждой карты своя камера. Список расширяется разделом «Все камеры» выше.","vac.route_source_no_map":"карта не читается"},de:{"gs.hint":"Füllfarben gelten für jeden Bereich; jede Farbe hat ihre eigene Deckkraft. Der Füllmodus wird in den Einstellungen des jeweiligen Bereichs festgelegt.","gs.show_room_tooltip":"Rauminformationen beim Darüberfahren anzeigen","support.about_group":"Über die Karte","support.guide_group":"Dokumentation","support.guide":"Benutzerhandbuch","support.form_group":"Bericht oder Vorschlag senden","support.contact":"Kontakt (E-Mail/tg/WhatsApp), optional.","support.message":"Nachricht","support.attach":"Anonymisierte Informationen aus dem Plan anhängen","support.attach_hint":"Enthält nur erlaubte Plangeometrie, Einstellungen und begrenzte Laufzeitdaten. Namen, Home-Assistant-IDs, Live-Zustände, URLs, Dateien, Nachricht und Kontakt werden ausgeschlossen.","support.geometry_warning":"Das Paket enthält keine Namen oder Home-Assistant-IDs, aber die exakte Geometrie und die Maße Ihres Hauses.","support.close_busy_title":"Aktuellen Vorgang abbrechen?","support.close_busy_body":"House Plan bereitet den Bericht vor oder sendet ihn. Beim Schließen wird nicht weiter auf das Ergebnis gewartet.","support.building":"Anonymisierte Daten werden vorbereitet…","support.preview_summary":"Paket v{version} · {spaces} Bereiche · {size} KiB","support.prepared":"Schnappschuss vor {n} Min. erstellt","support.show_data":"Daten anzeigen","support.download":"JSON herunterladen","support.refresh":"Schnappschuss aktualisieren","support.privacy":"Beim Senden verlassen Ihre Nachricht, der optionale Kontakt und, falls ausgewählt, die exakte Geometrie Ihren Home Assistant über das House-Plan-Projektrelay und sind für die Maintainer sichtbar. Der Projektserver speichert den Bericht bis zu 30 Tage. Die Netzwerkinfrastruktur sieht die Adresse Ihres HA-Servers, House Plan speichert sie jedoch nicht im Rohformat; Limit- und Idempotenzdaten bleiben bis zu 24 Stunden erhalten.","support.error_title":"Der Bericht wurde nicht gesendet","support.manual_recovery":"Nachricht und Anhang können gespeichert und manuell weitergegeben werden:","support.copy_message":"Nachricht kopieren","support.success":"Bericht gesendet: {id}. Bewahren Sie diese Nummer für den Support auf.","support.copy_id":"ID kopieren","support.sending":"Wird gesendet…","support.retry":"Erneut versuchen","support.send":"Senden","support.update_required":"Aktualisieren Sie House-Plan-Karte und Integration auf kompatible Versionen, um Berichte zu senden.","support.message_copied":"Nachricht kopiert","support.id_copied":"Berichts-ID kopiert","support.copy_failed":"Kein Zugriff auf die Zwischenablage. Markieren und kopieren Sie den Text manuell.","support.validation.message_required":"Geben Sie eine Nachricht ein.","support.validation.message_too_long":"Die Nachricht darf höchstens 10.000 Zeichen enthalten.","support.validation.contact_too_long":"Der Kontakt darf höchstens 320 Zeichen enthalten.","support.validation.preview_missing":"Warten Sie auf die Vorschau oder deaktivieren Sie den Anhang.","support.validation.preview_expired":"Die Anhangsvorschau ist abgelaufen. Aktualisieren Sie den Schnappschuss.","support.error.support_invalid_message":"Prüfen Sie die Nachricht und versuchen Sie es erneut.","support.error.support_preview_expired":"Die Anhangsvorschau ist abgelaufen oder nicht mehr verfügbar. Aktualisieren Sie den Schnappschuss.","support.error.support_package_too_large":"Das anonymisierte Paket überschreitet das Limit von 8 MiB.","support.error.support_rate_limited":"Zu viele Berichte oder Vorschauen wurden angefordert. Versuchen Sie es später erneut.","support.error.support_unavailable":"Der private Supportdienst ist vorübergehend nicht verfügbar. Der Entwurf bleibt in diesem Fenster erhalten.","support.error.support_rejected":"Der Bericht hat die Prüfung des Supportdienstes nicht bestanden.","support.error.unauthorized":"Sie dürfen diesen Bericht nicht senden.","vac.routes_section":"Karten und Etagen","vac.routes_current_map":"Aktuelle Karte","vac.routes_no_map":"keine Telemetrie","vac.routes_status":"Zuordnung","vac.routes_state_ready":"Karte zugeordnet und kalibriert","vac.routes_state_needs_calibration":"Karte zugeordnet, Kalibrierung nötig","vac.routes_state_unmapped":"aktuelle Karte keiner Etage zugeordnet","vac.routes_state_ambiguous":"zwei Karten nicht unterscheidbar — keine Etage gewählt","vac.routes_state_missing_space":"der Raum der Karte wurde gelöscht","vac.routes_state_none":"keine Kartendaten","vac.routes_empty":"Noch keine Karte einer Etage zugeordnet.","vac.route_map_default":"ohne Karten-ID","vac.route_active":"Aktiv","vac.route_space":"Raum","vac.route_space_none":"nicht gewählt","vac.route_status_ready":"bereit","vac.route_status_needs_calibration":"Kalibrierung nötig","vac.route_status_ambiguous":"mehrdeutig","vac.route_status_missing_space":"Raum gelöscht","vac.route_missing_space_group":"Gelöschter Bereich","vac.route_add_current":"Aktuelle Karte hinzufügen","vac.route_delete":"Karte entfernen","vac.route_delete_title":"Karte von der Etage entfernen?","vac.route_delete_body":"Kalibrierung und gespeicherte Pfade dieser Karte werden entfernt. Fortfahren?","vac.route_delete_confirm":"Entfernen","vac.route_space_title":"Karte in einen anderen Raum verschieben?","vac.route_space_body":"Kalibrierung und gespeicherte Pfade dieser Karte werden entfernt. Fortfahren?","vac.route_space_confirm":"Verschieben","vac.route_missing_space_hint":"Eine Karte verweist auf einen gelöschten Raum: neuen wählen oder Karte entfernen. Bis dahin wird der Roboter für diese Karte nicht gezeichnet.","vac.route_default_hint":"Die Quelle meldet keine stabile Karten-ID. Mehrere Etagen lassen sich ohne andere Quelle oder die vom Roboter gewählte Karte nicht unterscheiden.","vac.route_target_hint":"Die Station bleibt unabhängig von der aktuellen Karte im Raum „{space}“.","vac.route_add_source":"Kartenquelle hinzufügen","vac.route_add_source_hint":"Für Integrationen, die jeder Karte eine eigene Kamera geben. Der Abschnitt „Alle Kameras“ oben erweitert diese Liste.","vac.route_source_no_map":"keine Karte gemeldet"},fr:{"gs.hint":"Les couleurs de remplissage s’appliquent à tous les espaces ; chaque couleur possède sa propre opacité. Le mode de remplissage utilisé par un espace se règle dans la boîte de dialogue de cet espace.","gs.show_room_tooltip":"Afficher les informations de la pièce au survol","support.about_group":"À propos de la carte","support.guide_group":"Documentation d’aide","support.guide":"Guide utilisateur","support.form_group":"Envoyer un rapport ou une suggestion","support.contact":"Contact (e-mail/tg/WhatsApp), facultatif.","support.message":"Votre message","support.attach":"Joindre des informations anonymisées de votre plan","support.attach_hint":"Inclut uniquement la géométrie, les réglages autorisés et des données d’exécution limitées. Exclut les noms, identifiants Home Assistant, états en direct, URL, fichiers, message et contact.","support.geometry_warning":"Le paquet ne contient ni noms ni identifiants Home Assistant, mais il contient la géométrie et les dimensions exactes de votre logement.","support.close_busy_title":"Interrompre l’opération en cours ?","support.close_busy_body":"House Plan prépare ou envoie le rapport. Fermer maintenant arrête l’attente du résultat.","support.building":"Préparation des données anonymisées…","support.preview_summary":"Paquet v{version} · {spaces} espaces · {size} Kio","support.prepared":"Instantané préparé il y a {n} min","support.show_data":"Afficher les données","support.download":"Télécharger le JSON","support.refresh":"Actualiser l’instantané","support.privacy":"Lors de l’envoi, votre message, le contact facultatif et, si elle est sélectionnée, la géométrie exacte quittent votre Home Assistant via le relais du projet House Plan et sont visibles par les mainteneurs. Le serveur du projet conserve le rapport jusqu’à 30 jours. L’infrastructure réseau voit l’adresse de votre serveur HA, mais House Plan ne la conserve pas en clair ; les métadonnées de limitation et d’idempotence sont gardées jusqu’à 24 heures.","support.error_title":"Le rapport n’a pas été envoyé","support.manual_recovery":"Vous pouvez conserver le message et la pièce jointe puis continuer manuellement :","support.copy_message":"Copier le message","support.success":"Rapport envoyé : {id}. Conservez ce numéro pour contacter l’assistance.","support.copy_id":"Copier l’ID","support.sending":"Envoi…","support.retry":"Réessayer","support.send":"Envoyer","support.update_required":"Mettez à jour la carte et l’intégration House Plan vers des versions compatibles pour envoyer des rapports.","support.message_copied":"Message copié","support.id_copied":"ID du rapport copié","support.copy_failed":"Impossible d’accéder au presse-papiers. Sélectionnez et copiez le texte manuellement.","support.validation.message_required":"Saisissez un message.","support.validation.message_too_long":"Le message ne doit pas dépasser 10 000 caractères.","support.validation.contact_too_long":"Le contact ne doit pas dépasser 320 caractères.","support.validation.preview_missing":"Attendez l’aperçu de la pièce jointe ou désactivez-la.","support.validation.preview_expired":"L’aperçu de la pièce jointe a expiré. Actualisez l’instantané.","support.error.support_invalid_message":"Vérifiez le message et réessayez.","support.error.support_preview_expired":"L’aperçu de la pièce jointe a expiré ou n’est plus disponible. Actualisez l’instantané.","support.error.support_package_too_large":"Le paquet anonymisé dépasse la limite de 8 Mio.","support.error.support_rate_limited":"Trop de rapports ou d’aperçus ont été demandés. Réessayez plus tard.","support.error.support_unavailable":"Le service d’assistance privé est temporairement indisponible. Le brouillon reste dans cette fenêtre.","support.error.support_rejected":"Le rapport n’a pas passé la validation du service d’assistance.","support.error.unauthorized":"Vous n’êtes pas autorisé à envoyer ce rapport.","vac.routes_section":"Cartes et étages","vac.routes_current_map":"Carte actuelle","vac.routes_no_map":"aucune télémétrie","vac.routes_status":"Routage","vac.routes_state_ready":"carte assignée et calibrée","vac.routes_state_needs_calibration":"carte assignée, calibrage requis","vac.routes_state_unmapped":"carte actuelle non assignée à un étage","vac.routes_state_ambiguous":"deux cartes indiscernables — aucun étage choisi","vac.routes_state_missing_space":"l'espace de la carte a été supprimé","vac.routes_state_none":"aucune donnée de carte","vac.routes_empty":"Aucune carte n'est encore assignée à un étage.","vac.route_map_default":"sans identifiant","vac.route_active":"Active","vac.route_space":"Espace","vac.route_space_none":"non sélectionné","vac.route_status_ready":"prête","vac.route_status_needs_calibration":"calibrage requis","vac.route_status_ambiguous":"ambiguë","vac.route_status_missing_space":"espace supprimé","vac.route_missing_space_group":"Espace supprimé","vac.route_add_current":"Ajouter la carte actuelle","vac.route_delete":"Supprimer la carte","vac.route_delete_title":"Retirer la carte de son étage ?","vac.route_delete_body":"Le calibrage et les trajets enregistrés de cette carte seront supprimés. Continuer ?","vac.route_delete_confirm":"Supprimer","vac.route_space_title":"Déplacer la carte vers un autre espace ?","vac.route_space_body":"Le calibrage et les trajets enregistrés de cette carte seront supprimés. Continuer ?","vac.route_space_confirm":"Déplacer","vac.route_missing_space_hint":"Une carte pointe vers un espace supprimé : choisissez-en un autre ou supprimez la carte. D'ici là, le robot n'est pas dessiné pour cette carte.","vac.route_default_hint":"La source ne fournit pas d'identifiant de carte stable. Plusieurs étages ne peuvent pas être distingués sans une autre source ou la carte sélectionnée du robot.","vac.route_target_hint":"La station reste dans l'espace « {space} » quelle que soit la carte actuelle.","vac.route_add_source":"Ajouter une source de carte","vac.route_add_source_hint":"Pour les intégrations qui donnent à chaque carte sa propre caméra. La section « Toutes les caméras » ci-dessus élargit cette liste.","vac.route_source_no_map":"aucune carte signalée"}};function Ro(t,e,s){return i(zo[t]?.[e]??To[e]??e,s)}function Ao(t,e,s,i,o){return{markerId:t,source:i,mapId:o,space:e.length?"":s}}function Fo(t,e,s){return{...t,space:s.has(e)?e:""}}function No(t,e=Math.random){const s=new Set(t);for(let t=0;t<64;t+=1){const t="vr_"+Math.floor(16777215*e()).toString(36).padStart(5,"0");if(!s.has(t))return t}return"vr_"+Date.now().toString(36)}function Eo(t,e,s){return t.map(t=>t.id===e?{...t,calibration:s}:t)}const Ho=new WeakMap,Oo=(t,e)=>{const s=(t._serverCfg?.spaces||[]).find(t=>t?.id===e);return String(s?.name||s?.id||e)};function Lo(t,e,s){const i=t.host,n=l(i.hass,i._config?.language),r=(t,e)=>Ro(n,t,e),u=e.marker?.vacuum||{},_=Array.isArray(u.map_routes),m=i._vacSource(e)||"",g=o(e.id,u,e.space,m),f=(i._serverCfg?.spaces||[]).filter(t=>"string"==typeof t?.id&&!!t.id).map(t=>({id:t.id,name:String(t.name||t.id)})),b=new Set(f.map(t=>t.id)),v=h(g,[m],t=>i._vacObservedMapId(e,t)),y=c({routes:g,observed:v,spaceIds:b}),$="ready"===y.kind||"needs_calibration"===y.kind||"missing_space"===y.kind?y.route.id:"",w=m?v[m]:void 0,k=async s=>{let o=_?u.map_routes??null:null;if(!o&&(o=function(t,e,s,i){if(!s)return null;const o=t?.calibration;if(!o||"object"!=typeof o)return null;const n=new Set,r=[];for(const t of Object.keys(o)){const l=a(o[t]);if(!l)continue;const h=i(n);n.add(h),r.push({id:h,source:s,map_id:t,space:e,calibration:l})}return r.length?r:null}(u,e.space,m,t=>No(t))??[],!m&&Object.keys(u.calibration||{}).length))return!1;const n=s(o);return!!n&&(async s=>{const o=i._serverCfg;if(!o)return!1;const a=JSON.parse(JSON.stringify(o));a.markers=a.markers||[];let n=a.markers.find(t=>t.id===e.id);if(!n){if("device"!==e.bindingKind&&"entity"!==e.bindingKind||!e.bindingRef)return!1;n={id:e.id,binding:`${e.bindingKind}:${e.bindingRef}`,space:e.space||null,area:e.area||null,hidden:!!e.hidden},a.markers.push(n)}n.vacuum={...n.vacuum||{},map_routes:s},delete n.vacuum.calibration;const r=i._adoption.beginOptimistic(o,a);i._adoption.stageLocalConfig(a),i._regSignature="",i._maybeRebuildDevices(),i.requestUpdate(),i._saveConfigDebounced.pending()&&i._saveConfigDebounced.cancel();try{return await t._saveConfigNow(),!0}catch(t){return i._rollbackOptimistic(r),i._regSignature="",i._maybeRebuildDevices(),i.requestUpdate(),i._showToast(i._t("toast.cfg_save_failed",{err:i._errText(t)})),!1}})(n)},x=s.candidates.filter(t=>t.entityId!==m&&!g.some(e=>e.source===t.entityId)),S=async(t,e)=>{if(!e||e===t.space)return;await i._confirmDanger({key:"vacuum_route_space",kind:"warning",title:r("vac.route_space_title"),message:r("vac.route_space_body"),objectName:t.map_id||r("vac.route_map_default"),confirmLabel:r("vac.route_space_confirm"),cancelLabel:i._t("btn.cancel")})&&await k(s=>function(t,e,s,i){return t.map(t=>t.id===e?{...t,id:i,space:s,calibration:null}:t)}(s,t.id,e,No(new Set(g.map(t=>t.id)))))},M=new Map(f.map((t,e)=>[t.id,e])),C=(t,e)=>t.map_id.localeCompare(e.map_id)||t.source.localeCompare(e.source)||t.id.localeCompare(e.id),P=g.filter(t=>b.has(t.space)).sort((t,e)=>(M.get(t.space)??0)-(M.get(e.space)??0)||C(t,e)),D=g.filter(t=>!b.has(t.space)).sort(C),I=[...P,...D],T=!!m&&void 0!==w&&!g.some(t=>t.source===m&&t.map_id===w);let z=Ho.get(t);const R=z?.source||"",A=z?.mapId||"",F=!!z&&g.some(t=>t.source===R&&t.map_id===A);z&&(z.markerId!==e.id||i._vacObservedMapId(e,z.source)!==z.mapId||F&&!z.saving)&&(Ho.delete(t),z=void 0),z?.space&&!b.has(z.space)&&(z=Fo(z,"",b),Ho.set(t,z));const N=s=>p` +
  • - ${e.map_id||p("vac.route_map_default")} - ${e.id===$?h`${p("vac.route_active")}`:l} + ${s.map_id||r("vac.route_map_default")} + ${s.id===$?p`${r("vac.route_active")}`:d}
    - ${e.source} -
    ${(t=>b.has(t.space)?t.calibration?"ambiguous"===y.kind&&y.routeIds.includes(t.id)?p("vac.route_status_ambiguous"):p("vac.route_status_ready"):p("vac.route_status_needs_calibration"):p("vac.route_status_missing_space"))(e)}
    + ${s.source} +
    ${(t=>b.has(t.space)?t.calibration?"ambiguous"===y.kind&&y.routeIds.includes(t.id)?r("vac.route_status_ambiguous"):r("vac.route_status_ready"):r("vac.route_status_needs_calibration"):r("vac.route_status_missing_space"))(s)}
    + @click=${()=>t._vacStartFit(e,s.id)}>${i._t("vac.fit")} + @click=${()=>{(async t=>{await i._confirmDanger({key:"vacuum_route_delete",kind:"destructive",title:r("vac.route_delete_title"),message:r("vac.route_delete_body"),objectName:t.map_id||r("vac.route_map_default"),confirmLabel:r("vac.route_delete_confirm"),cancelLabel:i._t("btn.cancel")})&&await k(e=>function(t,e){return t.filter(t=>t.id!==e)}(e,t.id))})(s)}}>${r("vac.route_delete")}
    -
  • `,E=`vacroute-missing-${i.id.replace(/[^a-zA-Z0-9_-]/g,"-")}`;return h` - + `,E=`vacroute-missing-${e.id.replace(/[^a-zA-Z0-9_-]/g,"-")}`;return p` +
    -
    ${p("vac.routes_current_map")}${void 0===w?p("vac.routes_no_map"):w||p("vac.route_map_default")}
    -
    ${p("vac.routes_status")}${p(`vac.routes_state_${y.kind}`)}
    +
    ${r("vac.routes_current_map")}${void 0===w?r("vac.routes_no_map"):w||r("vac.route_map_default")}
    +
    ${r("vac.routes_status")}${r(`vac.routes_state_${y.kind}`)}
    - ${P.length||z?h`
      - ${z?h` + ${P.length||z?p`
        + ${z?p`
      • -
        ${z.mapId||p("vac.route_map_default")}
        +
        ${z.mapId||r("vac.route_map_default")}
        ${z.source}
        + @click=${()=>{Ho.get(t)?.saving||(Ho.delete(t),i.requestUpdate())}}>${i._t("btn.cancel")} + @click=${()=>{(async()=>{const e=Ho.get(t);if(!e||e.saving||!b.has(e.space))return;Ho.set(t,{...e,saving:!0}),i.requestUpdate();const s=await k(t=>function(t,e,s,i){return e.source&&s.has(e.space)&&!t.some(t=>t.source===e.source&&t.map_id===e.mapId)?function(t,e,s){return[...t,{...e,id:s,calibration:e.calibration??null}]}(t,{source:e.source,map_id:e.mapId,space:e.space},i):null}(t,e,b,No(new Set(t.map(t=>t.id))))),o=Ho.get(t);o?.markerId===e.markerId&&o.source===e.source&&o.mapId===e.mapId&&(s?Ho.delete(t):Ho.set(t,e)),i.requestUpdate()})()}}>${i._t("btn.save")}
        -
      • `:l} + `:d} ${P.map(N)} -
      `:l} - ${D.length?h` +
    `:d} + ${D.length?p`

    - ${p("vac.route_missing_space_group")} + ${r("vac.route_missing_space_group")}

      ${D.map(N)}
    -
    `:l} - ${I.length||z?l:h`
    ${p("vac.routes_empty")}
    `} + `:d} + ${I.length||z?d:p`
    ${r("vac.routes_empty")}
    `}
    + @click=${()=>{m&&void 0!==w&&(Ho.set(t,Ao(e.id,g,e.space,m,w)),i.requestUpdate())}}>${r("vac.route_add_current")}
    - ${x.length?h`
    - ${p("vac.route_add_source")} -
    ${p("vac.route_add_source_hint")}
    + ${x.length?p`
    + ${r("vac.route_add_source")} +
    ${r("vac.route_add_source_hint")}
    - ${x.map(e=>{const s=c._vacObservedMapId(i,e.entityId);return h``})}
    -
    `:l} - ${I.some(t=>!b.has(t.space))?h` -
    ${p("vac.route_missing_space_hint")}
    `:l} - ${g.some(t=>"default"===t.map_id)?h` -
    ${p("vac.route_default_hint")}
    `:l} - ${I.length?h`
    ${p("vac.route_target_hint",{space:Fo(c,i.space)})}
    `:l} -
    `}const Eo=new WeakMap;function Ho(t,e,s){let i=Eo.get(t);i||(i=new Map,Eo.set(t,i));const o=i.get(e);if(o)return void(o.run=s);const a={run:s};i.set(e,a),queueMicrotask(()=>{i.get(e)===a&&(i.delete(e),a.run())})}function Oo(t,e){const s=Eo.get(t),i=s?.get(e);i&&(s.delete(e),i.run())}function Lo(t,e){const s=Eo.get(t);if(!s)return;const i=e?[...s].filter(([t])=>t===e):[...s];for(const[t]of i)s.delete(t);s.size||Eo.delete(t)}const Bo=new WeakMap,Wo=new Set(["_cursorPt","_opMeasure","_physicalDrag","_physicalRotate","_decorDraft","_dtBox","_dtDrag","_bdDrag","_furnPreviewInput","_layout"]),jo=new Set(["_cursorPt","_opMeasure","_furnPreviewInput"]),Go=new Set(["_physicalDrag","_physicalRotate","_decorDraft","_dtDrag","_bdDrag"]),qo=t=>{let e=Bo.get(t);return e||(e={raf:0,requestedRevision:0,paintedRevision:0,waiters:[],hidden:[],transparent:[],dimmed:[]},Bo.set(t,e)),e},Uo=(t,e)=>{t.paintedRevision=Math.max(t.paintedRevision,e);const s=t.waiters.filter(e=>e.revision<=t.paintedRevision);t.waiters=t.waiters.filter(e=>e.revision>t.paintedRevision);for(const t of s)t.resolve()},Ko=t=>!!("view"!==t._mode&&(t._deviceDrag||t._physicalDrag||t._physicalRotate||t._decorDraft||t._decorMove||t._dtDrag||t._bdDrag||t._opDrag||t._resize?.dragging));function Vo(t,e,s){const i=t;if(!i?.isConnected||"view"===i._mode)return!1;const o=void 0!==e&&Wo.has(e);if("_layout"===e&&!i._deviceDrag)return!1;if("_dtBox"===e&&!i._dtDrag)return!1;if(void 0!==e&&Go.has(e)&&null==s&&null!=i[e]&&Ko(i))return!1;if(void 0!==e&&Go.has(e)&&null==i[e])return!1;if(void 0!==e&&jo.has(e)&&null==i[e])return!1;return!!(o&&(jo.has(e)||Ko(i))||void 0===e&&Ko(i))&&(function(t){const e=qo(t);if(e.requestedRevision++,e.raf||"function"!=typeof requestAnimationFrame)return;e.raf=requestAnimationFrame(()=>{e.raf=0;const s=e.requestedRevision;!function(t){const e=t,s=e.renderRoot;if(!s)return;const i=qo(e);Xo(i),ta(e,s);const o=s.querySelector("[data-hp-live-editor]");if(!o)return;if(Yo(i,s,".hp-editor-only-layer:not(.hp-plan-snap-layer)"),"plan"===e._mode)e._opDrag&&Jo(i,s,".wallbodies"),e._resize?.dragging&&(ia(i,s,".wallbodies"),Yo(i,s,".resize-layer"),sa(i,s,e._resize.plan?.movingOpeningIds||[])),e._opDrag&&Yo(i,s,".openinglayer");else if("decor"===e._mode){const t=e._dtDrag?.id||e._decorMove?.id;t&&ea(i,s,t),Yo(i,s,".dtframe, .backdropframe")}c(Qo(e),o);const a=s.querySelector("[data-hp-live-editor-html]");if(a){const t=e._viewOr(e._baseVb());c(e._renderLiveEditorMeasurements(t),a)}e._liveEditorPaintCount=(e._liveEditorPaintCount||0)+1}(t),Uo(e,s)})}(i),!0)}const Jo=(t,e,s)=>{for(const i of e.querySelectorAll(s))i.closest("[data-hp-live-editor]")||"hidden"!==i.style.visibility&&(i.style.visibility="hidden",t.hidden.push(i))},Yo=(t,e,s)=>{for(const i of e.querySelectorAll(s))i.closest("[data-hp-live-editor]")||"0"!==i.style.opacity&&(i.style.opacity="0",t.transparent.push(i))},Xo=t=>{for(const e of t.hidden)e.style.removeProperty("visibility");t.hidden.length=0;for(const e of t.transparent)e.style.removeProperty("opacity");t.transparent.length=0;for(const e of t.dimmed)e.style.removeProperty("opacity");t.dimmed.length=0},Zo=(t,e,s=[])=>{if("iso"===t._renderProjection)return d``;const i=t._spaceModel();if(!i)return d``;const o=new Set(s),a=(i.rooms||[]).filter(t=>!!t.id&&o.has(t.id)).flatMap(t=>{const e=t.poly||[];return e.map((t,s)=>[t,e[(s+1)%e.length]])}),n=(t,e)=>{const[s,i]=e,o=i[0]-s[0],a=i[1]-s[1],n=o*o+a*a;if(!(n>0))return!1;const r=((t[0]-s[0])*o+(t[1]-s[1])*a)/n,l=Math.max(0,Math.min(1,r));return Math.hypot(t[0]-s[0]-o*l,t[1]-s[1]-a*l)<1e-4},r=[...t._spaceWalls.filter(t=>{const e=(t.a||[]).map(t=>t*p),s=(t.b||[]).map(t=>t*p);return a.some(t=>n(e,t)&&n(s,t))}).map((e,s)=>((e,s,i,o)=>{const a=Math.hypot(s[0]-e[0],s[1]-e[1]);if(!(a>1e-9&&i>0))return null;const n=b(i,t._cellCm,t._gridPitch)/2,r=-(s[1]-e[1])/a*n,l=(s[0]-e[0])/a*n;return{key:o,kind:"outer",cm:i,a:e,b:s,depthUnits:2*n,quad:[[e[0]+r,e[1]+l],[s[0]+r,s[1]+l],[s[0]-r,s[1]-l],[e[0]-r,e[1]-l]]}})((e.a||[]).map(t=>t*p),(e.b||[]).map(t=>t*p),e.cm,e.key||`wall-${s}`))].filter(t=>!!t),l=t._openingsR.map(t=>({x:t.rx,y:t.ry,angle:t.angle,length:t.rlen})),h=r.map(t=>u(t,l)).filter(Boolean);if(!h.length)return d``;const c=Math.max(...r.map(t=>t.depthUnits),0),v=t._viewOr(t._baseVb()),y=t._stageEl?.clientWidth&&v.w?t._stageEl.clientWidth/v.w:1,$=_(c,y)||m(g(t._cellCm),y),w=e?.color||"#607d8b",k=t._fillColors.wall_fill,x=h.join(" ");return d``:d} + ${I.some(t=>!b.has(t.space))?p` +
    ${r("vac.route_missing_space_hint")}
    `:d} + ${g.some(t=>"default"===t.map_id)?p` +
    ${r("vac.route_default_hint")}
    `:d} + ${I.length?p`
    ${r("vac.route_target_hint",{space:Oo(i,e.space)})}
    `:d} + `}const Bo=new WeakMap;function Wo(t,e,s){let i=Bo.get(t);i||(i=new Map,Bo.set(t,i));const o=i.get(e);if(o)return void(o.run=s);const a={run:s};i.set(e,a),queueMicrotask(()=>{i.get(e)===a&&(i.delete(e),a.run())})}function jo(t,e){const s=Bo.get(t),i=s?.get(e);i&&(s.delete(e),i.run())}function Go(t,e){const s=Bo.get(t);if(!s)return;const i=e?[...s].filter(([t])=>t===e):[...s];for(const[t]of i)s.delete(t);s.size||Bo.delete(t)}const qo=new WeakMap,Uo=new Set(["_cursorPt","_opMeasure","_physicalDrag","_physicalRotate","_decorDraft","_dtBox","_dtDrag","_bdDrag","_furnPreviewInput","_layout"]),Ko=new Set(["_cursorPt","_opMeasure","_furnPreviewInput"]),Vo=new Set(["_physicalDrag","_physicalRotate","_decorDraft","_dtDrag","_bdDrag"]),Jo=t=>{let e=qo.get(t);return e||(e={raf:0,requestedRevision:0,paintedRevision:0,waiters:[],hidden:[],transparent:[],dimmed:[]},qo.set(t,e)),e},Yo=(t,e)=>{t.paintedRevision=Math.max(t.paintedRevision,e);const s=t.waiters.filter(e=>e.revision<=t.paintedRevision);t.waiters=t.waiters.filter(e=>e.revision>t.paintedRevision);for(const t of s)t.resolve()},Xo=t=>!!("view"!==t._mode&&(t._deviceDrag||t._physicalDrag||t._physicalRotate||t._decorDraft||t._decorMove||t._dtDrag||t._bdDrag||t._opDrag||t._resize?.dragging));function Zo(t,e,s){const i=t;if(!i?.isConnected||"view"===i._mode)return!1;const o=void 0!==e&&Uo.has(e);if("_layout"===e&&!i._deviceDrag)return!1;if("_dtBox"===e&&!i._dtDrag)return!1;if(void 0!==e&&Vo.has(e)&&null==s&&null!=i[e]&&Xo(i))return!1;if(void 0!==e&&Vo.has(e)&&null==i[e])return!1;if(void 0!==e&&Ko.has(e)&&null==i[e])return!1;return!!(o&&(Ko.has(e)||Xo(i))||void 0===e&&Xo(i))&&(function(t){const e=Jo(t);if(e.requestedRevision++,e.raf||"function"!=typeof requestAnimationFrame)return;e.raf=requestAnimationFrame(()=>{e.raf=0;const s=e.requestedRevision;!function(t){const e=t,s=e.renderRoot;if(!s)return;const i=Jo(e);ea(i),oa(e,s);const o=s.querySelector("[data-hp-live-editor]");if(!o)return;if(ta(i,s,".hp-editor-only-layer:not(.hp-plan-snap-layer)"),"plan"===e._mode)e._opDrag&&Qo(i,s,".wallbodies"),e._resize?.dragging&&(ra(i,s,".wallbodies"),ta(i,s,".resize-layer"),na(i,s,e._resize.plan?.movingOpeningIds||[])),e._opDrag&&ta(i,s,".openinglayer");else if("decor"===e._mode){const t=e._dtDrag?.id||e._decorMove?.id;t&&aa(i,s,t),ta(i,s,".dtframe, .backdropframe")}u(ia(e),o);const a=s.querySelector("[data-hp-live-editor-html]");if(a){const t=e._viewOr(e._baseVb());u(e._renderLiveEditorMeasurements(t),a)}e._liveEditorPaintCount=(e._liveEditorPaintCount||0)+1}(t),Yo(e,s)})}(i),!0)}const Qo=(t,e,s)=>{for(const i of e.querySelectorAll(s))i.closest("[data-hp-live-editor]")||"hidden"!==i.style.visibility&&(i.style.visibility="hidden",t.hidden.push(i))},ta=(t,e,s)=>{for(const i of e.querySelectorAll(s))i.closest("[data-hp-live-editor]")||"0"!==i.style.opacity&&(i.style.opacity="0",t.transparent.push(i))},ea=t=>{for(const e of t.hidden)e.style.removeProperty("visibility");t.hidden.length=0;for(const e of t.transparent)e.style.removeProperty("opacity");t.transparent.length=0;for(const e of t.dimmed)e.style.removeProperty("opacity");t.dimmed.length=0},sa=(t,e,s=[])=>{if("iso"===t._renderProjection)return _``;const i=t._spaceModel();if(!i)return _``;const o=new Set(s),a=(i.rooms||[]).filter(t=>!!t.id&&o.has(t.id)).flatMap(t=>{const e=t.poly||[];return e.map((t,s)=>[t,e[(s+1)%e.length]])}),n=(t,e)=>{const[s,i]=e,o=i[0]-s[0],a=i[1]-s[1],n=o*o+a*a;if(!(n>0))return!1;const r=((t[0]-s[0])*o+(t[1]-s[1])*a)/n,l=Math.max(0,Math.min(1,r));return Math.hypot(t[0]-s[0]-o*l,t[1]-s[1]-a*l)<1e-4},r=[...t._spaceWalls.filter(t=>{const e=(t.a||[]).map(t=>t*m),s=(t.b||[]).map(t=>t*m);return a.some(t=>n(e,t)&&n(s,t))}).map((e,s)=>((e,s,i,o)=>{const a=Math.hypot(s[0]-e[0],s[1]-e[1]);if(!(a>1e-9&&i>0))return null;const n=$(i,t._cellCm,t._gridPitch)/2,r=-(s[1]-e[1])/a*n,l=(s[0]-e[0])/a*n;return{key:o,kind:"outer",cm:i,a:e,b:s,depthUnits:2*n,quad:[[e[0]+r,e[1]+l],[s[0]+r,s[1]+l],[s[0]-r,s[1]-l],[e[0]-r,e[1]-l]]}})((e.a||[]).map(t=>t*m),(e.b||[]).map(t=>t*m),e.cm,e.key||`wall-${s}`))].filter(t=>!!t),l=t._openingsR.map(t=>({x:t.rx,y:t.ry,angle:t.angle,length:t.rlen})),h=r.map(t=>g(t,l)).filter(Boolean);if(!h.length)return _``;const c=Math.max(...r.map(t=>t.depthUnits),0),d=t._viewOr(t._baseVb()),p=t._stageEl?.clientWidth&&d.w?t._stageEl.clientWidth/d.w:1,u=f(c,p)||b(v(t._cellCm),p),w=e?.color||"#607d8b",k=t._fillColors.wall_fill,x=h.join(" ");return _` - - `},Qo=t=>{if("plan"===t._mode)return(t=>{const e=t._baseVb(),s=t._viewOr(e),i=t._opMeasureView;if(t._resize?.dragging){const e=t._spaceDisplayForRender(),i=t._resize.plan;return d`
    +
    `},ia=t=>{if("plan"===t._mode)return(t=>{const e=t._baseVb(),s=t._viewOr(e),i=t._opMeasureView;if(t._resize?.dragging){const e=t._spaceDisplayForRender(),i=t._resize.plan;return _``}const o=t._spaceDisplayForRender();return d``}const o=t._spaceDisplayForRender();return _``})(t);if("decor"===t._mode){const e=t._viewOr(t._baseVb()),s=t._dtDrag?.id||t._decorMove?.id||null;return d``})(t);if("decor"===t._mode){const e=t._viewOr(t._baseVb()),s=t._dtDrag?.id||t._decorMove?.id||null;return _``}return d``}return _``},ta=(t,e)=>{const s=t._deviceDrag;if(!s)return;const i=t._devices.find(t=>t.id===s.id),o=[...e.querySelectorAll('[data-hp="device"]')].find(t=>t.dataset.id===s.id);if(!i||!o)return;const a=t._livePos(i),n=t._scenePoint([a.x,a.y]),r=t._viewOr(t._baseVb());o.style.left=(n[0]-r.x)/r.w*100+"%",o.style.top=(n[1]-r.y)/r.h*100+"%"},ea=(t,e,s)=>{for(const i of e.querySelectorAll('.decorlayer [data-hp="decor"]'))i.closest("[data-hp-live-editor]")||i.dataset.id!==s||"0"!==i.style.opacity&&(i.style.opacity="0",t.transparent.push(i))},sa=(t,e,s)=>{const i=new Set(s);for(const s of e.querySelectorAll('.openinglayer [data-hp="opening"]'))!s.closest("[data-hp-live-editor]")&&i.has(s.dataset.id||"")&&(s.style.opacity="0",t.transparent.push(s))},ia=(t,e,s)=>{for(const i of e.querySelectorAll(s))i.closest("[data-hp-live-editor]")||(i.style.opacity="0.35",t.dimmed.push(i))};const oa=(t,e,s)=>Math.min(s,Math.max(e,Number.isFinite(t)?t:e));function aa(t){return Number.isFinite(t)?(t%360+360)%360:0}function na(t){if("string"!=typeof t)return null;const e=t.trim().replace(/^#/,""),s=/^[0-9a-fA-F]{3}$/.test(e)?e.split("").map(t=>`${t}${t}`).join(""):e;return/^[0-9a-fA-F]{6}$/.test(s)?`#${s.toLowerCase()}`:null}function ra(t){const e=na(t);return e?{r:Number.parseInt(e.slice(1,3),16),g:Number.parseInt(e.slice(3,5),16),b:Number.parseInt(e.slice(5,7),16)}:null}function la(t){const e=oa(t.r,0,255)/255,s=oa(t.g,0,255)/255,i=oa(t.b,0,255)/255,o=Math.max(e,s,i),a=o-Math.min(e,s,i);let n=0;return a>0&&(n=o===e?(s-i)/a%6*60:o===s?60*((i-e)/a+2):60*((e-s)/a+4)),{h:aa(n),s:0===o?0:a/o*100,v:100*o}}function ha(t){return function(t){const e=t=>Math.round(oa(t,0,255)).toString(16).padStart(2,"0");return`#${e(t.r)}${e(t.g)}${e(t.b)}`}(function(t){const e=aa(t.h),s=oa(t.s,0,100)/100,i=oa(t.v,0,100)/100,o=i*s,a=o*(1-Math.abs(e/60%2-1)),n=i-o;let r;return r=e<60?[o,a,0]:e<120?[a,o,0]:e<180?[0,o,a]:e<240?[0,a,o]:e<300?[a,0,o]:[o,0,a],{r:Math.round(255*(r[0]+n)),g:Math.round(255*(r[1]+n)),b:Math.round(255*(r[2]+n))}}(t))}const ca={title:"Color picker",hue:"Hue",saturation:"Saturation",value:"Brightness",hex:"Hex color",invalidHex:"Enter a 3- or 6-digit hex color",confirm:"OK"};class da extends y{constructor(){super(...arguments),this.label="",this.opacityLabel="Opacity",this.color="#607d8b",this.opacity=1,this.disabled=!1,this.showOpacity=!0,this.pickerLabels=ca,this._open=!1,this._pickerRaf=0,this._emitRaf=0,this._forceFallback=!1,this._overlayDispose=null,this._hue=0,this._saturation=0,this._value=0,this._hexDraft="#607d8b",this._hexInvalid=!1,this._hexNeedsValidInput=!1,this._lastValidColor="#607d8b",this._activePointerId=null,this._outsidePointerDown=t=>{if(!this._open)return;const e=t.composedPath();this._floating.containsPath(e)||this._closePicker(!1,"outside")},this._keyDown=t=>{this._open&&"Escape"===t.key&&(t.preventDefault(),t.stopImmediatePropagation(),this._closePicker(this._floating.ownsActiveElement(),"escape"))},this._floating=new uo(this,"color-opacity",this._keyDown),this._queuePickerPosition=()=>{if(!this._open)return;this._pickerRaf&&cancelAnimationFrame(this._pickerRaf);const t=this._window();t&&(this._pickerRaf=t.requestAnimationFrame(()=>{this._pickerRaf=0,this._positionPicker()||this._closePicker()}))}}connectedCallback(){super.connectedCallback(),this._syncFromColor(this.color,!1),this.ownerDocument.addEventListener("pointerdown",this._outsidePointerDown,!0),this.ownerDocument.addEventListener("scroll",this._queuePickerPosition,!0);const t=this.ownerDocument.defaultView;t?.addEventListener("resize",this._queuePickerPosition),t?.addEventListener("orientationchange",this._queuePickerPosition),t?.visualViewport?.addEventListener("resize",this._queuePickerPosition),t?.visualViewport?.addEventListener("scroll",this._queuePickerPosition),this.addEventListener("keydown",this._keyDown,!0)}disconnectedCallback(){this.ownerDocument.removeEventListener("pointerdown",this._outsidePointerDown,!0),this.ownerDocument.removeEventListener("scroll",this._queuePickerPosition,!0);const t=this.ownerDocument.defaultView;t?.removeEventListener("resize",this._queuePickerPosition),t?.removeEventListener("orientationchange",this._queuePickerPosition),t?.visualViewport?.removeEventListener("resize",this._queuePickerPosition),t?.visualViewport?.removeEventListener("scroll",this._queuePickerPosition),this.removeEventListener("keydown",this._keyDown,!0),this._pickerRaf&&cancelAnimationFrame(this._pickerRaf),this._emitRaf&&cancelAnimationFrame(this._emitRaf),this._pickerRaf=0,this._emitRaf=0,this._closePicker(!1,"disconnect"),super.disconnectedCallback()}updated(t){if(t.has("color")){const t=na(this.color);t&&t!==this._lastValidColor&&this._syncFromColor(t,this._open)}this.disabled&&this._open?this._closePicker():this._open&&(this._supportsPopover()||this._renderFallback(),(t.has("color")||t.has("opacity")||t.has("showOpacity")||t.has("label")||t.has("opacityLabel")||t.has("pickerLabels"))&&this._queuePickerPosition())}_window(){return this._floating.window()}_supportsPopover(){return this._floating.usesPopover(this._forceFallback)}_dialog(){return this._floating.dialog()}async _toggle(){this.disabled||(this._open?this._closePicker():(this._forceFallback=!1,this._syncFromColor(this.color,!1),this._hexInvalid=!1,this._hexNeedsValidInput=!1,this._activePointerId=null,this._open=!0,await this.updateComplete,this._open&&(this._supportsPopover()||this._renderFallback(),this._positionPicker()?this._overlayDispose=this._dialog()?.registerOverlay({owner:this,group:"transient",close:t=>this._closePicker("escape"===t&&this._floating.ownsActiveElement(),t)})||null:this._closePicker())))}_closePicker(t=!1,e="exclusive"){if(!this._open&&!this._floating.hasFallback)return;const s=this._overlayDispose;this._overlayDispose=null,s?.();const i=this.renderRoot.querySelector(".picker");if(i?.hidePopover)try{i.matches(":popover-open")&&i.hidePopover()}catch{}this._open=!1,this._cancelQueuedEmit(),this._activePointerId=null,this._floating.destroy(),t&&this.updateComplete.then(()=>this.renderRoot.querySelector(".trigger")?.focus())}_surface(){return this._floating.surface(".picker",this._supportsPopover())}_renderFallback(){const t=da.styles.cssText;this._floating.renderFallback(this._pickerTemplate(!1),t)}_positionPicker(){if(!this._open)return!1;const t=this._window(),e=this.renderRoot.querySelector(".trigger");let s=this._surface();if(!t||!e?.isConnected||!s?.isConnected)return!1;const i=_o(t);if(s.style.maxWidth=`${Math.max(0,i.width-16)}px`,s.style.maxHeight=`${Math.max(0,i.height-16)}px`,s.style.visibility="hidden",this._supportsPopover()&&s.showPopover)try{s.matches(":popover-open")||s.showPopover()}catch{if(this._forceFallback=!0,this._renderFallback(),s=this._surface(),!s?.isConnected)return!1;s.style.maxWidth=`${Math.max(0,i.width-16)}px`,s.style.maxHeight=`${Math.max(0,i.height-16)}px`,s.style.visibility="hidden"}const o=e.getBoundingClientRect(),a=s.getBoundingClientRect();if(!(o.width&&o.height&&a.width&&a.height))return!1;const n=mo(o,a,i);return s.style.left=`${n.left}px`,s.style.top=`${n.top}px`,s.dataset.side=n.side,s.style.visibility="",!0}_labels(){const t=this.pickerLabels||ca;return{title:t.title||ca.title,hue:t.hue||ca.hue,saturation:t.saturation||ca.saturation,value:t.value||ca.value,hex:t.hex||ca.hex,invalidHex:t.invalidHex||ca.invalidHex,confirm:t.confirm||ca.confirm}}_syncFromColor(t,e){const s=na($(t,"#607d8b"))||"#607d8b",i=ra(s);if(!i)return;const o=la(i);(!e||o.s>1e-4)&&(this._hue=o.h),this._saturation=o.s,this._value=o.v,this._hexDraft=s,this._hexInvalid=!1,this._hexNeedsValidInput=!1,this._lastValidColor=s}_cancelQueuedEmit(t=!1){this._emitRaf&&cancelAnimationFrame(this._emitRaf),this._emitRaf=0,t&&this._syncFromColor(this._lastValidColor,!0)}_queueHsvEmit(){if(this._emitRaf)return;const t=this._window();t?this._emitRaf=t.requestAnimationFrame(()=>{this._emitRaf=0,this._emitHsv()}):this._emitHsv()}_emitHsv(){this._emit(ha({h:this._hue,s:this._saturation,v:this._value}),this.opacity)}_setHue(t){this._hue=Math.min(359,Math.max(0,Number.isFinite(t)?t:0)),this._emitHsv()}_setSaturation(t){this._saturation=Math.min(100,Math.max(0,Number.isFinite(t)?t:0)),this._emitHsv()}_setValue(t){this._value=Math.min(100,Math.max(0,Number.isFinite(t)?t:0)),this._emitHsv()}_setOpacity(t){this._emit(this._lastValidColor,t)}_shiftRangeKey(t,e,s,i,o){if(!t.shiftKey)return;const a="ArrowRight"===t.key||"ArrowUp"===t.key?10:"ArrowLeft"===t.key||"ArrowDown"===t.key?-10:0;a&&(t.preventDefault(),t.stopPropagation(),o(Math.min(i,Math.max(s,e+a))))}_setSvFromPointer(t,e){const s=t.currentTarget.getBoundingClientRect();s.width&&s.height&&(this._saturation=Math.min(100,Math.max(0,(t.clientX-s.left)/s.width*100)),this._value=Math.min(100,Math.max(0,100*(1-(t.clientY-s.top)/s.height))),e?(this._cancelQueuedEmit(),this._emitHsv()):this._queueHsvEmit())}_svPointerDown(t){if(t.preventDefault(),t.stopPropagation(),null===this._activePointerId){this._activePointerId=t.pointerId;try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}this._setSvFromPointer(t,!0)}}_svPointerMove(t){t.pointerId===this._activePointerId&&(t.preventDefault(),t.stopPropagation(),this._setSvFromPointer(t,!1))}_svPointerUp(t){if(t.pointerId===this._activePointerId){t.preventDefault(),t.stopPropagation(),this._setSvFromPointer(t,!0),this._activePointerId=null;try{t.currentTarget.releasePointerCapture(t.pointerId)}catch{}}}_svPointerCancel(t){t.pointerId===this._activePointerId&&(t.preventDefault(),t.stopPropagation(),this._activePointerId=null,this._cancelQueuedEmit(!0))}_svLostPointerCapture(t){t.pointerId===this._activePointerId&&(this._activePointerId=null,this._cancelQueuedEmit(!0))}_hexInput(t){const e=t.target.value;this._hexDraft=e;const s=na(e),i=s?ra(s):null;if(!s||!i)return void(this._hexInvalid=this._hexNeedsValidInput);this._hexNeedsValidInput=!1,this._hexInvalid=!1;const o=la(i);o.s>1e-4&&(this._hue=o.h),this._saturation=o.s,this._value=o.v,this._emit(s,this.opacity,!0)}_commitHex(){const t=na(this._hexDraft);if(!t)return this._hexDraft=this._lastValidColor,this._hexInvalid=!0,void(this._hexNeedsValidInput=!0);this._hexDraft=t,this._hexNeedsValidInput?this._hexInvalid=!0:(this._hexInvalid=!1,t!==this._lastValidColor&&this._emit(t,this.opacity))}_confirm(t){t.preventDefault(),t.stopPropagation(),this._commitHex(),this._hexInvalid||this._hexNeedsValidInput?this.updateComplete.then(()=>{this._surface()?.querySelector('input[type="text"]')?.focus()}):this._closePicker(!0)}_hexKeyDown(t){"Enter"===t.key&&(t.preventDefault(),t.stopPropagation(),this._commitHex())}_emit(t,e,s=!1){const i=na(t)||this._lastValidColor,o=Number.isFinite(e)?e:Number(this.opacity)||0,a=Math.min(1,Math.max(0,o));this.color=i,this.opacity=a,this._lastValidColor=i,s||(this._hexDraft=i),this._hexInvalid=this._hexNeedsValidInput,this.dispatchEvent(new CustomEvent("hp-color-opacity-change",{detail:{color:i,opacity:a},bubbles:!0,composed:!0}))}_pickerTemplate(t){const e=Math.round(100*Math.min(1,Math.max(0,Number(this.opacity)||0))),s=ha({h:this._hue,s:this._saturation,v:this._value}),i=ha({h:this._hue,s:100,v:100}),o=this._labels(),a=Math.round(this._hue),n=Math.round(this._saturation),r=Math.round(this._value);return h` - - ${t.visualSources.length||t.criticalSources.length?h`
    + ${t.visualSources.length||t.criticalSources.length?p`
    ${this._t("marker.preview.details")}
    - ${[...t.visualSources,...t.criticalSources].map(t=>h` + ${[...t.visualSources,...t.criticalSources].map(t=>p`
    ${t.name}${t.eid} ${t.stateText||t.state} ${this._sourceProvider(t.eid)}
    `)}
    -
    `:l} - ${"icon_ripple"===t.display?h`
    +
    `:d} + ${"icon_ripple"===t.display?p`
    -
    `:l} - `}}$a.properties={hass:{attribute:!1},presentation:{attribute:!1},registry:{attribute:!1},deviceName:{attribute:!1}},$a.styles=[w,v`:host{display:block;min-width:0;}.devicepreview{margin:4px 0 14px;padding:14px;border:1px solid var(--divider-color,rgba(127,127,127,0.28));border-radius:14px;background:color-mix(in srgb,var(--card-background-color,#20232b) 92%,var(--primary-color,#03a9f4));color:var(--primary-text-color,#fff);overflow:hidden;}.previewhead{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;}.previewbadge{padding:3px 9px;border-radius:999px;color:var(--secondary-text-color,#9aa0aa);background:color-mix(in srgb,var(--secondary-text-color,#9aa0aa) 12%,transparent);font-size:12px;font-weight:700;}.previewbadge.example{color:var(--warning-color,#ffb300);}.previewgrid{display:grid;grid-template-columns:minmax(170px,0.8fr) minmax(240px,1.2fr);gap:16px;align-items:stretch;}.previewstage{position:relative;min-height:168px;border-radius:12px;background:var(--secondary-background-color,rgba(0,0,0,0.16));overflow:hidden;pointer-events:none;container-type:inline-size;--icon-size:54px;--device-base-size:48.6px;}.previewfit{position:absolute;left:50%;top:50%;transform-origin:center;}.previewstage .dev{left:0;top:0;cursor:default;}:host([data-pointer-hover]) .previewstage .dev:hover{z-index:2;}.previewfacts{min-width:0;display:grid;align-content:start;gap:8px;}.previewfacts>div{display:grid;grid-template-columns:minmax(115px,0.8fr) minmax(0,1.3fr);gap:8px;}.previewfacts span{color:var(--secondary-text-color,#9aa0aa);}.previewfacts b{min-width:0;overflow-wrap:anywhere;}.previewnotice{margin:2px 0 0;color:var(--secondary-text-color,#9aa0aa);font-size:13px;}.previewdetails{margin-top:12px;}.previewdetails summary{cursor:pointer;color:var(--secondary-text-color,#9aa0aa);}.previewtable{display:grid;gap:8px;margin-top:9px;}.previewsource{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:3px 10px;font-size:13px;}.previewsource>*{min-width:0;overflow-wrap:anywhere;}.previewsource code{color:var(--secondary-text-color,#9aa0aa);}.previewdemo{min-height:40px;display:inline-flex;align-items:center;gap:8px;padding:8px 12px;border:1px solid var(--divider-color,rgba(127,127,127,0.35));border-radius:10px;background:transparent;color:inherit;cursor:pointer;}.previewdemos{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px;}.previewdemo:focus-visible{outline:2px solid var(--primary-color,#03a9f4);outline-offset:2px;}.previewdemo:disabled{opacity:0.5;cursor:not-allowed;}@media (max-width:640px){.previewgrid{grid-template-columns:minmax(0,1fr);}.previewstage{min-height:142px;}.previewfacts>div{grid-template-columns:minmax(0,1fr);gap:2px;}}`],customElements.get("hp-device-preview")||customElements.define("hp-device-preview",$a);const wa={revision:0,topologies:[],states:{}};class ka extends y{constructor(){super(...arguments),this.value={enabled:!1,z2mBaseTopics:[]},this.savedEnabled=!1,this.devices=[],this._runtime=null,this._snapshot=wa,this._topicText="zigbee2mqtt",this._invalidTopic=!1}disconnectedCallback(){this._release?.(),this._release=void 0,super.disconnectedCallback()}updated(t){t.has("hass")&&(this._release?.(),this._release=void 0,this._runtime=null,this._snapshot=wa),this.savedEnabled&&this._admin&&this._ensureRuntime()}willUpdate(t){t.has("value")&&(this._topicText=(this.value.z2mBaseTopics.length?this.value.z2mBaseTopics:["zigbee2mqtt"]).join("\n"),this._invalidTopic=!1)}get _admin(){return!0===this.hass?.user?.is_admin}_t(t,e){return $o(a(this.hass),t,e)}_help(){const t=a(this.hass);return wo(t,"help")&&wo(t,"help_aria")?h``:l}async _ensureRuntime(){return this._runtime||(this._runtime=await import("./zigbee-topology-runtime-sByomcRQ.js"),this._snapshot=this._runtime.zigbeeTopologyRuntimeSnapshot(this.hass),this._release=this._runtime.subscribeZigbeeTopology(this.hass,()=>{this._snapshot=this._runtime.zigbeeTopologyRuntimeSnapshot(this.hass),this.requestUpdate()}),this.requestUpdate()),this._runtime}_emit(t){this._admin&&this.dispatchEvent(new CustomEvent("hp-topology-settings-change",{detail:t,bubbles:!0,composed:!0}))}_topics(){return this.value.z2mBaseTopics.length?this.value.z2mBaseTopics:["zigbee2mqtt"]}_editTopics(t){this._topicText=t;const e=t.split(/[\r\n,]+/).map(t=>t.trim()).filter(Boolean),s=e.map(D).filter(Boolean);this._invalidTopic=s.length!==e.length,this._invalidTopic?this.requestUpdate():this._emit({...this.value,z2mBaseTopics:[...new Set(s)].slice(0,8)})}_status(t){const e=this._snapshot.states[t];if(!e)return this._t("status_idle");if("loading"===e.phase)return this._t("status_loading");if("error"===e.phase)return this._t(`error_${e.error||"provider"}`);if("ready"!==e.phase||!e.obtainedAt)return this._t("status_idle");const s=new Date(e.obtainedAt).toLocaleTimeString(a(this.hass),{hour:"2-digit",minute:"2-digit"}),i=this._snapshot.topologies.find(e=>"zha"===t?"zha"===e.provider:`z2m:${e.instanceId}`===t),o=!!i&&!!this.registry&&ko(i,this.devices,this.registry).warnings.length>0;return e.partial||o?this._t("status_partial",{time:s}):i&&!i.links.length?this._t("status_no_links",{time:s}):this._t(Date.now()-e.obtainedAt>xo?"status_stale":"status_ready",{time:s})}_busy(t){return"loading"===this._snapshot.states[t]?.phase}async _readZha(){this.savedEnabled&&this._admin&&(await this._ensureRuntime()).readZhaTopology(this.hass)}async _refreshZ2m(t){this.savedEnabled&&this._admin&&(await this._ensureRuntime()).refreshZ2mTopology(this.hass,t)}render(){const t=this._admin,e=this.value.enabled,s=t&&this.savedEnabled,i=this._topics();return h` + `:d} + `}}Sa.properties={hass:{attribute:!1},presentation:{attribute:!1},registry:{attribute:!1},deviceName:{attribute:!1}},Sa.styles=[S,w`:host{display:block;min-width:0;}.devicepreview{margin:4px 0 14px;padding:14px;border:1px solid var(--divider-color,rgba(127,127,127,0.28));border-radius:14px;background:color-mix(in srgb,var(--card-background-color,#20232b) 92%,var(--primary-color,#03a9f4));color:var(--primary-text-color,#fff);overflow:hidden;}.previewhead{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;}.previewbadge{padding:3px 9px;border-radius:999px;color:var(--secondary-text-color,#9aa0aa);background:color-mix(in srgb,var(--secondary-text-color,#9aa0aa) 12%,transparent);font-size:12px;font-weight:700;}.previewbadge.example{color:var(--warning-color,#ffb300);}.previewgrid{display:grid;grid-template-columns:minmax(170px,0.8fr) minmax(240px,1.2fr);gap:16px;align-items:stretch;}.previewstage{position:relative;min-height:168px;border-radius:12px;background:var(--secondary-background-color,rgba(0,0,0,0.16));overflow:hidden;pointer-events:none;container-type:inline-size;--icon-size:54px;--device-base-size:48.6px;}.previewfit{position:absolute;left:50%;top:50%;transform-origin:center;}.previewstage .dev{left:0;top:0;cursor:default;}:host([data-pointer-hover]) .previewstage .dev:hover{z-index:2;}.previewfacts{min-width:0;display:grid;align-content:start;gap:8px;}.previewfacts>div{display:grid;grid-template-columns:minmax(115px,0.8fr) minmax(0,1.3fr);gap:8px;}.previewfacts span{color:var(--secondary-text-color,#9aa0aa);}.previewfacts b{min-width:0;overflow-wrap:anywhere;}.previewnotice{margin:2px 0 0;color:var(--secondary-text-color,#9aa0aa);font-size:13px;}.previewdetails{margin-top:12px;}.previewdetails summary{cursor:pointer;color:var(--secondary-text-color,#9aa0aa);}.previewtable{display:grid;gap:8px;margin-top:9px;}.previewsource{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:3px 10px;font-size:13px;}.previewsource>*{min-width:0;overflow-wrap:anywhere;}.previewsource code{color:var(--secondary-text-color,#9aa0aa);}.previewdemo{min-height:40px;display:inline-flex;align-items:center;gap:8px;padding:8px 12px;border:1px solid var(--divider-color,rgba(127,127,127,0.35));border-radius:10px;background:transparent;color:inherit;cursor:pointer;}.previewdemos{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px;}.previewdemo:focus-visible{outline:2px solid var(--primary-color,#03a9f4);outline-offset:2px;}.previewdemo:disabled{opacity:0.5;cursor:not-allowed;}@media (max-width:640px){.previewgrid{grid-template-columns:minmax(0,1fr);}.previewstage{min-height:142px;}.previewfacts>div{grid-template-columns:minmax(0,1fr);gap:2px;}}`],customElements.get("hp-device-preview")||customElements.define("hp-device-preview",Sa);const Ma={revision:0,topologies:[],states:{}};class Ca extends k{constructor(){super(...arguments),this.value={enabled:!1,z2mBaseTopics:[]},this.savedEnabled=!1,this.devices=[],this._runtime=null,this._snapshot=Ma,this._topicText="zigbee2mqtt",this._invalidTopic=!1}disconnectedCallback(){this._release?.(),this._release=void 0,super.disconnectedCallback()}updated(t){t.has("hass")&&(this._release?.(),this._release=void 0,this._runtime=null,this._snapshot=Ma),this.savedEnabled&&this._admin&&this._ensureRuntime()}willUpdate(t){t.has("value")&&(this._topicText=(this.value.z2mBaseTopics.length?this.value.z2mBaseTopics:["zigbee2mqtt"]).join("\n"),this._invalidTopic=!1)}get _admin(){return!0===this.hass?.user?.is_admin}_t(t,e){return ko(l(this.hass),t,e)}_help(){const t=l(this.hass);return xo(t,"help")&&xo(t,"help_aria")?p``:d}async _ensureRuntime(){return this._runtime||(this._runtime=await import("./zigbee-topology-runtime-Db3SaXOn.js"),this._snapshot=this._runtime.zigbeeTopologyRuntimeSnapshot(this.hass),this._release=this._runtime.subscribeZigbeeTopology(this.hass,()=>{this._snapshot=this._runtime.zigbeeTopologyRuntimeSnapshot(this.hass),this.requestUpdate()}),this.requestUpdate()),this._runtime}_emit(t){this._admin&&this.dispatchEvent(new CustomEvent("hp-topology-settings-change",{detail:t,bubbles:!0,composed:!0}))}_topics(){return this.value.z2mBaseTopics.length?this.value.z2mBaseTopics:["zigbee2mqtt"]}_editTopics(t){this._topicText=t;const e=t.split(/[\r\n,]+/).map(t=>t.trim()).filter(Boolean),s=e.map(z).filter(Boolean);this._invalidTopic=s.length!==e.length,this._invalidTopic?this.requestUpdate():this._emit({...this.value,z2mBaseTopics:[...new Set(s)].slice(0,8)})}_status(t){const e=this._snapshot.states[t];if(!e)return this._t("status_idle");if("loading"===e.phase)return this._t("status_loading");if("error"===e.phase)return this._t(`error_${e.error||"provider"}`);if("ready"!==e.phase||!e.obtainedAt)return this._t("status_idle");const s=new Date(e.obtainedAt).toLocaleTimeString(l(this.hass),{hour:"2-digit",minute:"2-digit"}),i=this._snapshot.topologies.find(e=>"zha"===t?"zha"===e.provider:`z2m:${e.instanceId}`===t),o=!!i&&!!this.registry&&So(i,this.devices,this.registry).warnings.length>0;return e.partial||o?this._t("status_partial",{time:s}):i&&!i.links.length?this._t("status_no_links",{time:s}):this._t(Date.now()-e.obtainedAt>Mo?"status_stale":"status_ready",{time:s})}_busy(t){return"loading"===this._snapshot.states[t]?.phase}async _readZha(){this.savedEnabled&&this._admin&&(await this._ensureRuntime()).readZhaTopology(this.hass)}async _refreshZ2m(t){this.savedEnabled&&this._admin&&(await this._ensureRuntime()).refreshZ2mTopology(this.hass,t)}render(){const t=this._admin,e=this.value.enabled,s=t&&this.savedEnabled,i=this._topics();return p`
    ${this._t("title")}${this._help()}
    ${this._t("hint")}
    - ${t?l:h`
    ${this._t("admin_only")}
    `} - ${e?h`
    - ${this.savedEnabled?l:h`
    ${this._t("save_first")}
    `} + ${t?d:p`
    ${this._t("admin_only")}
    `} + ${e?p`
    + ${this.savedEnabled?d:p`
    ${this._t("save_first")}
    `}
    ${this._t("zha")}
    ${this._t("zha_hint")}
    @@ -262,9 +262,9 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae - ${this._invalidTopic?h`
    ${this._t("error_invalid_topic")}
    `:l} + ${this._invalidTopic?p`
    ${this._t("error_invalid_topic")}
    `:d}
    ${this._t("z2m_warning")}
    - ${i.map(t=>h`
    + ${i.map(t=>p`
    `)}
    -
    `:l} - `}}ka.properties={hass:{attribute:!1},value:{attribute:!1},savedEnabled:{type:Boolean,attribute:"saved-enabled"},devices:{attribute:!1},registry:{attribute:!1}},ka.styles=v`:host{display:block;color:inherit;font:inherit;}.section{margin-top:18px;font-weight:700;display:flex;align-items:center;gap:2px;}.toggle{display:flex;align-items:center;gap:10px;margin-top:10px;}.hint,.status{color:var(--secondary-text-color,#9aa0aa);font-size:12px;line-height:1.45;}.hint{margin-top:6px;}.providers{display:grid;gap:14px;margin-top:12px;padding-left:34px;}.provider{display:grid;gap:7px;}.provider-title{font-weight:650;}.actions{display:flex;align-items:center;flex-wrap:wrap;gap:8px;}textarea{box-sizing:border-box;width:100%;min-height:58px;resize:vertical;border:1px solid var(--divider-color,#666);border-radius:8px;padding:8px;color:var(--primary-text-color,inherit);background:var(--card-background-color,#202126);font:inherit;}button{display:inline-flex;align-items:center;gap:6px;min-height:36px;border:1px solid var(--divider-color,#666);border-radius:9px;padding:7px 11px;color:inherit;background:transparent;cursor:pointer;font:inherit;font-weight:600;}button:disabled,textarea:disabled{opacity:.5;cursor:default;}.warning{color:var(--warning-color,#d89300);font-size:12px;line-height:1.45;}`,customElements.get("hp-zigbee-topology-settings")||customElements.define("hp-zigbee-topology-settings",ka);const xa=(t,e)=>[t[0]-e[0],t[1]-e[1]],Sa=(t,e)=>[t[0]+e[0],t[1]+e[1]],Ma=(t,e)=>t[0]*e[0]+t[1]*e[1],Ca=t=>Math.hypot(t[0],t[1]);function Pa(t){let e=0;for(let s=0;st[1]!=l>t[1]&&t[0]<(r-a)*(t[1]-n)/(l-n)+a&&(s=!s)}return s}([r[0]+n[0]*l,r[1]+n[1]*l],t)&&(n=[-n[0],-n[1]]),n}function Ta(t){const e=t.length;if(e<3)return!1;for(let s=0;s(t[0]-o[0])*r[1]-(t[1]-o[1])*r[0],h=t=>(t[0]-o[0])*r[0]+(t[1]-o[1])*r[1],c=s,d=n-s;for(const e of t){const t=Math.abs(l(e));if(t<=s)continue;const o=h(e);o<=c||o>=d||tMath.abs(n+(t-p)/g*(r-n));i=Math.min(i,f(_),f(m))}}return i}function Ra(t,e,s){if(R(t,e,s))return!0;if(z(t,e,s)||z(e,t,s))return!1;let i=0;try{const s=A([[...t.map(t=>[t[0],t[1]]),[t[0][0],t[0][1]]]],[[...e.map(t=>[t[0],t[1]]),[e[0][0],e[0][1]]]]);for(const t of s)t?.[0]&&(i+=F(t[0]))}catch{return!1}return i>Math.max(1e-7,s*s)}function Aa(t,e,s){for(const i of e)for(let e=0;es)continue;const h=(t.x-o[0])*l[0]+(t.y-o[1])*l[1];if(h-t.length/2>=-s&&h+t.length/2<=r+s)return!0}return!1}function Fa(t,e,s){const i=Math.abs(e[0]-t[0]),o=Math.abs(e[1]-t[1]);return i<=s&&o>s?"v":o<=s&&i>s?"h":null}function Na(t,e,s){return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s}function Ea(t,e,s,i,o){return Na(t,s,o)&&Na(e,i,o)||Na(t,i,o)&&Na(e,s,o)}function Ha(t,e,s,i,o){const a=Fa(t,e,o);return a&&Fa(s,i,o)===a?"h"===a?Math.abs(t[1]-s[1])>o||Math.abs(t[1]-i[1])>o?0:Math.max(0,Math.min(Math.max(t[0],e[0]),Math.max(s[0],i[0]))-Math.max(Math.min(t[0],e[0]),Math.min(s[0],i[0]))):Math.abs(t[0]-s[0])>o||Math.abs(t[0]-i[0])>o?0:Math.max(0,Math.min(Math.max(t[1],e[1]),Math.max(s[1],i[1]))-Math.max(Math.min(t[1],e[1]),Math.min(s[1],i[1]))):0}function Oa(t,e,s,i){const o=t.length,a=Fa(t[(e-1+o)%o],t[e],i),n=Fa(t[(e+1)%o],t[(e+2)%o],i),r="h"===s?"v":"h";return a===r&&n===r}function La(t){let e=1/0,s=1/0,i=-1/0,o=-1/0;for(const a of t)e=Math.min(e,a[0]),s=Math.min(s,a[1]),i=Math.max(i,a[0]),o=Math.max(o,a[1]);return[e,s,i,o]}function Ba(t,e,s){const i=La(t),o=La(e);return i[2]o}const ja=(t,e)=>"h"===e?t[0]:t[1],Ga=(t,e)=>"h"===e?t[1]:t[0];function qa(t,e,s,i,o){const a=t.find(t=>t.id===e);if(!a)return null;const n=a.poly[s],r=a.poly[(s+1)%a.poly.length],l=Fa(n,r,o);if(!l)return null;const h=0===i?r:n,c=0===i?n:r,d=ja(h,l),p=ja(c,l),u=Ga(h,l),_=function(t,e,s,i){const o=[];for(const a of t)for(let t=0;ti||Math.abs(Ga(r,e)-s)>i)continue;const l=ja(n,e),h=ja(r,e),c=Math.min(l,h),d=Math.max(l,h);d-c>i&&o.push({roomId:a.id,edge:t,lo:c,hi:d})}return o.sort((t,e)=>t.lo-e.lo||t.hi-e.hi||t.roomId.localeCompare(e.roomId)||t.edge-e.edge)}(t,l,u,o),m=function(t,e,s,i){const o=[e,s];for(const a of t){const t=Math.max(e,a.lo),n=Math.min(s,a.hi);n-t>i&&o.push(t,n)}const a=[...new Set(o)].sort((t,e)=>t-e),n=[];for(let e=0;e+1r>t.lo-i&&rt.roomId))].sort();n.push({lo:s,hi:o,owners:l})}return n}(_,Math.min(d,p),Math.max(d,p),o);return!m.length||m.some(t=>t.owners.length<1||t.owners.length>2)?null:{roomId:e,edge:s,movedEndpoint:i,axis:l,line:u,fixed:d,moving:p,intervals:_,baseline:m}}function Ua(t,e,s){const i=[];for(const o of t.intervals){const a=e.polys[o.roomId];if(!a){i.push(o);continue}if(o.edge<0||o.edge>=a.length)continue;const n=a[o.edge],r=a[(o.edge+1)%a.length];if(Fa(n,r,s)!==t.axis||Math.abs(Ga(n,t.axis)-t.line)>s||Math.abs(Ga(r,t.axis)-t.line)>s)continue;const l=ja(n,t.axis),h=ja(r,t.axis),c=Math.min(l,h),d=Math.max(l,h);d-c>s&&i.push({...o,lo:c,hi:d})}return i}function Ka(t,e,s){return new Set(t.filter(t=>e>t.lo-s&&et.roomId)).size}function Va(t,e,s){for(const i of e.sideOwnership){const e=t.polys[i.roomId];if(!e)return!1;const o=e[i.edge],a=e[(i.edge+1)%e.length];if(Fa(o,a,s)!==i.axis)return!1;const n=ja(0===i.movedEndpoint?o:a,i.axis),r=Ua(i,t,s),l=(i.moving>=i.fixed?i.baseline[i.baseline.length-1]:i.baseline[0]).owners.length;if(l<1||l>2)return!1;const h=Math.min(i.fixed,i.moving,n),c=Math.max(i.fixed,i.moving,n),d=[h,c,i.fixed,i.moving,n];for(const t of i.intervals)d.push(t.lo,t.hi);for(const t of r)d.push(t.lo,t.hi);const p=[...new Set(d.filter(t=>t>=h&&t<=c))].sort((t,e)=>t-e),u=Math.min(i.fixed,i.moving),_=Math.max(i.fixed,i.moving),m=Math.min(i.fixed,n),g=Math.max(i.fixed,n);for(let t=0;t+1u-s&&a<_+s,h=a>m-s&&a2||d>2)return!1;if(n&&h){if(c!==d)return!1}else if(!n&&h){if(d!==l||c>0&&c!==d)return!1}else if(2===c?2!==d:d>1)return!1}}return!0}function Ja(t,e,s,i){const o=[s.n[0]*i,s.n[1]*i],a={polys:{},openings:{},movedSpans:{}};for(const e of s.roomIds){const i=t.find(t=>t.id===e),n=s.edgeByRoom[e];if(!i||null==n)continue;const r=(n+1)%i.poly.length;a.polys[e]=i.poly.map((t,e)=>e===n||e===r?Sa(t,o):[...t]),a.movedSpans[e]=[[Sa(i.poly[n],o),Sa(i.poly[r],o)]]}for(const t of e)s.movingOpeningIds.includes(t.id)&&(a.openings[t.id]=[t.x+o[0],t.y+o[1]]);return a}function Ya(t,e,s,i,o,a,n,r){if(!function(t,e,s,i){if(Da([t.x,t.y],e,s)>2*i)return!1;const o=Ca(xa(s,e));if(o<=i)return!1;const a=[(s[0]-e[0])/o,(s[1]-e[1])/o],n=(t.x-e[0])*a[0]+(t.y-e[1])*a[1];return n>=-i&&n<=o+i}(t,e,s,r))return!0;if(Da([t.x,t.y],i,o)>2*r)return!1;const l=0===a?i:o;return Ca(xa([t.x,t.y],l))>=t.length/2+n-r}function Xa(t,e,s,i){const o=i.movingHalf||0;return"circle"===t.kind?Da(t.center,e,s)2)return!1;const r=Ja(t,e,s,i);if(Object.keys(r.polys).length!==s.roomIds.length)return!1;if(!Va(r,s,a))return!1;const l=new Set(s.roomIds),h=t=>r.polys[t.id]||t.poly;for(const i of s.roomIds){const l=t.find(t=>t.id===i),h=r.polys[i],c=s.edgeByRoom[i];if(!l||!h||h.length!==s.topology[i]||h.length!==l.poly.length||!Ta(h))return!1;const d=l.poly.length,p=(c-1+d)%d,u=[p,c,(c+1)%d];for(const t of u)if(T(h[t],h[(t+1)%d]))return!1;const _=Pa(l.poly),m=Pa(h);if(Math.abs(m)t.id===e),i=r.polys[e];for(const o of t){if(o.id===e||l.has(o.id))continue;const t=h(o);if(!Ba(s.poly,o.poly,a)||!Ba(i,t,a))if(z(s.poly,o.poly,a)){if(!z(i,t,a))return!1}else if(z(o.poly,s.poly,a)){if(!z(t,i,a))return!1}else if(z(i,t,a)||z(t,i,a)||Ra(i,t,a))return!1}}t.find(t=>t.id===s.roomId);const c=r.polys[s.roomId],d=s.edgeByRoom[s.roomId],p=c[d],u=c[(d+1)%c.length];if(Math.abs(i)>a)for(const t of o.obstacles||[])if(Xa(t,p,u,o))return!1;for(const t of e){if(!s.movingOpeningIds.includes(t.id))continue;const e=r.openings[t.id];if(!e||t.hosted)return!1;if(!Aa({...t,x:e[0],y:e[1]},[c],2*a))return!1}return!0}const Qa=new WeakMap,tn=t=>"number"==typeof t&&Number.isFinite(t),en=(t,e)=>{const s=new Map;for(const i of t||[])!tn(i?.cm)||!e&&i.cm<=0||s.set(i.cm,(s.get(i.cm)||0)+1);return s},sn=t=>[String(t),"см"].join(" ");function on(t,e,s={}){if(s.allowClear)return[];const i=!0===s.exactMultiplicity,o=en(t,i),a=en(e,i),n=[];for(const[t,e]of o){const s=a.get(t)||0;0===s?n.push({invariant:"wall_records",kind:"lost",owner:sn(t),reference:`было ${e}`,detail:"записи этой толщины исчезли целиком"}):i&&s!==e&&n.push({invariant:"wall_records",kind:"count",owner:sn(t),reference:`было ${e}, стало ${s}`,detail:"изменилось число записей этой толщины"})}if(i)for(const[t,e]of a)o.has(t)||n.push({invariant:"wall_records",kind:"count",owner:sn(t),reference:`было 0, стало ${e}`,detail:"появились записи новой толщины"});return n}class an{constructor(){this._selectedRoomId=null,this._session=null,this._eligibility=null}get dragging(){return null!==this._session}ownsPointer(t){return this._session?.pointerId===t}get selectedRoomId(){return this._selectedRoomId}get snapshotIdentity(){return this._session?.snapshotIdentity||null}get activePointerId(){return this._session?.pointerId??null}get moved(){return!0===this._session?.moved}get delta(){return this._session?.delta||0}get rooms(){return this._session?.rooms||null}get openings(){return this._session?.openings||null}get plan(){return this._session?.plan||null}get preview(){return this._session?.accepted?.preview||null}get liveLabels(){return this._session?.accepted?.labels||null}selectRoom(t){this._selectedRoomId=t}restoreSelection(t){this._selectedRoomId=t}escapeIdle(){return this._selectedRoomId?(this._selectedRoomId=null,"selection-cleared"):"exit-tool"}resolve(t,e,s){this._eligibility&&this._eligibility.context===t||(this._eligibility={context:t,values:new Map});const i=this._eligibility.values.get(e);if(i)return i;const o=s();return this._eligibility.values.set(e,o),o}begin(t){return!this._session&&(this._session={pointerId:t.pointerId,start:[...t.start],roomId:t.roomId,plan:t.plan,options:t.options,rooms:t.rooms,openings:t.openings,snapshotIdentity:t.snapshotIdentity,before:t.before,moved:!1,delta:0,changedRoomIds:[...t.plan.roomIds],rejectionNotified:!1,wallUnionBefore:t.wallUnionBefore,epochBefore:t.epochBefore,accepted:null},!0)}move(t){const e=this._session;if(!e||e.pointerId!==t.pointerId)return{kind:"no-op"};const s=(i=e.start,o=t.point,a=e.plan.n,[i?.[0],i?.[1],o?.[0],o?.[1],a?.[0],a?.[1]].every(Number.isFinite)?(o[0]-i[0])*a[0]+(o[1]-i[1])*a[1]:0);var i,o,a;const n=t.snap([e.plan.a[0]+e.plan.n[0]*s,e.plan.a[1]+e.plan.n[1]*s]),r=(n[0]-e.plan.a[0])*e.plan.n[0]+(n[1]-e.plan.a[1])*e.plan.n[1],l=function(t,e,s,i,o,a){if(!Number.isFinite(i)||Math.abs(i)<1e-9)return 0;const n=Math.sign(i),r=Math.abs(i),l=Math.max(Math.abs(o),1e-6);let h=Qa.get(s);h&&h.opts===a||(h={opts:a,values:new Map},Qa.set(s,h));const c=h.values;let d=0;for(let i=Math.min(l,r),o=0;o<4096&&i<=r+1e-9;o++,i=Math.min(r,i+l)){const o=n*i,h=`${o.toFixed(9)}|${l.toFixed(9)}`;let p=c.get(h);if(void 0===p&&(p=Za(t,e,s,o,a),c.size<4096&&c.set(h,p)),!p)break;if(d=o,Math.abs(i-r)<=1e-9)break}return d}(e.rooms,e.openings,e.plan,r,t.step,e.options);if(e.moved&&l===e.delta)return{kind:"no-op"};const h=Ja(e.rooms,e.openings,e.plan,l);let c;try{if(c=t.project(e.snapshotIdentity,h.polys,h.openings,e.changedRoomIds,e.rooms),!c.ok)return this._projectionRejected(e);if(on(c.value.beforeWalls,c.value.afterWalls,{exactMultiplicity:!0}).length)return this._projectionRejected(e)}catch{return this._projectionRejected(e)}const d=e.accepted,p={preview:c.value.preview,labels:null,artifact:c.value.artifact,beforeWalls:c.value.beforeWalls,afterWalls:c.value.afterWalls};e.accepted=p;try{t.publish(p.preview,p.artifact),p.labels=t.measure(h,e.plan)}catch{e.accepted=d;try{t.publish(d?.preview||null,d?.artifact||null)}catch{}return this._projectionRejected(e)}return e.moved=!0,e.delta=l,{kind:"accepted",preview:c.value.preview,labels:p.labels,artifact:c.value.artifact}}finish(t){const e=this._session;if(!e||e.pointerId!==t.pointerId)return{kind:"no-op"};const s=e.accepted;let i;if(e.moved&&Math.abs(e.delta)>1e-9&&s)if(t.currentSnapshotIdentity!==e.snapshotIdentity)i={kind:"rejected",reason:"stale-snapshot"};else if(Za(e.rooms,e.openings,e.plan,e.delta,e.options))if(on(s.beforeWalls,s.afterWalls,{exactMultiplicity:!0}).length)i={kind:"rejected",reason:"wall-records"};else{let o=!1;try{o=t.validatePreview(s.preview)}catch{o=!1}i=o?{kind:"commit",preview:s.preview,before:e.before}:{kind:"rejected",reason:"invalid-candidate"}}else i={kind:"rejected",reason:"invalid-topology"};else i={kind:"no-op"};return this._session=null,"commit"===i.kind&&(this._eligibility=null),i}cancel(t,e){const s=this._session;if(!s||void 0!==e&&s.pointerId!==e)return{kind:"no-op"};this._session=null,this._eligibility=null;const i=t===s.snapshotIdentity;return{kind:"cancelled",restoreWallUnion:i?s.wallUnionBefore:null,restoreEpoch:i?s.epochBefore:null}}reset(){this._selectedRoomId=null,this._session=null,this._eligibility=null}_projectionRejected(t){const e=!t.rejectionNotified;return t.rejectionNotified=!0,{kind:"rejected",notify:e}}}const nn=t=>"object"==typeof t&&null!==t?t:null,rn=t=>Array.isArray(t)?t.flatMap(t=>{const e=nn(t);return e?[e]:[]}):[],ln=t=>{if(!Array.isArray(t))return null;const e=Number(t[0]),s=Number(t[1]);return Number.isFinite(e)&&Number.isFinite(s)?[e,s]:null};function hn(t){const e=(s=t.poly,Array.isArray(s)?s.flatMap(t=>{const e=ln(t);return e?[e]:[]}):[]);var s;if(e.length>=3)return e;const i=Number(t.x),o=Number(t.y),a=Number(t.w),n=Number(t.h);return[i,o,a,n].every(Number.isFinite)?[[i,o],[i+a,o],[i+a,o+n],[i,o+n]]:[]}function cn(t){if(!t.length)return null;const e=t.map(t=>t[0]),s=t.map(t=>t[1]);return{minX:Math.min(...e),minY:Math.min(...s),maxX:Math.max(...e),maxY:Math.max(...s)}}function dn(t,e){const s=nn(t);if(!s)return null;const i=rn(s.rooms),o=new Set(function(t,e){const s=rn(t),i=new Set(e);return s.flatMap(t=>{const e=String(t.id||"");return e&&i.has(e)?[e]:[]})}(i,e)),a=i.filter(t=>o.has(String(t.id||"")));if(!cn(a.flatMap(hn))||!a.length)return null;const n=Number(s.cell_cm),r=Number.isFinite(n)&&n>0?n:5,l=a.flatMap(t=>{const e=hn(t);return e.map((t,s)=>[t,e[(s+1)%e.length]])}),h=.02*N,c=(t,e,s)=>{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o,n=a>0?Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a)):0;return Math.hypot(t[0]-e[0]-n*i,t[1]-e[1]-n*o)},d=(t,e)=>Math.min(...l.map(([s,i])=>((t,e,s,i)=>{const o=(t,e,s)=>(e[0]-t[0])*(s[1]-t[1])-(e[1]-t[1])*(s[0]-t[0]),a=o(t,e,s),n=o(t,e,i),r=o(s,i,t),l=o(s,i,e);return a*n<=h*h&&r*l<=h*h&&Math.min(t[0],e[0])<=Math.max(s[0],i[0])+h&&Math.min(s[0],i[0])<=Math.max(t[0],e[0])+h&&Math.min(t[1],e[1])<=Math.max(s[1],i[1])+h&&Math.min(s[1],i[1])<=Math.max(t[1],e[1])+h?0:Math.min(c(t,s,i),c(e,s,i),c(s,t,e),c(i,t,e))})(t,e,s,i))),p=t=>{const e=ln(t.a),s=ln(t.b);if(e&&s)return((t,e)=>l.some(([s,i])=>{const o=i[0]-s[0],a=i[1]-s[1],n=Math.hypot(o,a);if(!(n>h))return!1;const r=t=>Math.abs((t[0]-s[0])*a-(t[1]-s[1])*o)/n;if(r(t)>h||r(e)>h)return!1;const l=t=>((t[0]-s[0])*o+(t[1]-s[1])*a)/(n*n),c=l(t),d=l(e);return Math.min(1,Math.max(c,d))-Math.max(0,Math.min(c,d))>h}))(e,s);const[i]=String(t.key||"").split("@"),o=i?.split(",").map(Number)||[];return 2!==o.length||!o.every(Number.isFinite)||l.some(([t,e])=>c(o,t,e)<=h)},u=rn(s.walls).filter(p),_=rn(s.wall_segments).filter(p),m=Math.max(0,...[...u,..._].map(t=>Number(t.cm)).filter(Number.isFinite))/r*N/2,g=rn(s.partitions).filter(t=>{const e=ln(t.a),s=ln(t.b);if(!e||!s)return!0;const i=Math.max(0,Number(t.cm)||0)/r*N/2;return d(e,s)<=m+i+h}),f=rn(s.wall_columns).filter(t=>{const e=ln(t.center);if(!e)return!0;const s=Math.max(0,Number(t.cm)||0)/r*N;return l.some(([t,i])=>c(e,t,i)<=m+s+h)}),b=new Set(g.map(t=>String(t.id||"")).filter(Boolean)),v=rn(s.openings).filter(t=>{const e=nn(t.host);if("partition"===e?.kind)return b.has(String(e.id||""));const s=ln([t.x,t.y]);return!s||l.some(([t,e])=>c(s,t,e)<=h)});return{...s,rooms:a,walls:u,wall_segments:_,open_spans:rn(s.open_spans).filter(p),partitions:g,wall_columns:f,openings:v}}const pn=1e-9;class un extends Error{constructor(t,e=""){super(e?`${t}: ${e}`:t),this.reason=t,this.name="WallSegmentModelError"}}const _n=t=>JSON.parse(JSON.stringify(t)),mn=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(Number(t[0]))&&Number.isFinite(Number(t[1])),gn=t=>[Number(t[0]),Number(t[1])],fn=t=>`${Number(t[0]).toFixed(12)},${Number(t[1]).toFixed(12)}`,bn=(t,e)=>{const s=fn(t),i=fn(e);return sfn(t)<=fn(e)?[gn(t),gn(e)]:[gn(e),gn(t)],yn=(t,e)=>Math.hypot(e[0]-t[0],e[1]-t[1]),$n=(t,e=[])=>{const s=new Set,i=t=>{const e=Number(t);if(!Number.isFinite(e))return;const i=e/N;Math.abs(i-Math.round(i))>=j&&s.add(e.toFixed(12))};for(const e of Array.isArray(t?.rooms)?t.rooms:[])for(const t of H(e)||[])i(t[0]),i(t[1]);for(const e of[t?.wall_segments,t?.walls])for(const t of Array.isArray(e)?e:[])i(t?.a?.[0]),i(t?.a?.[1]),i(t?.b?.[0]),i(t?.b?.[1]);for(const t of e)i(t?.[0]),i(t?.[1]);return s.size},wn=(t,e,s)=>{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o;return a>1e-18?((t[0]-e[0])*i+(t[1]-e[1])*o)/a:0},kn=(t,e,s)=>{const i=Math.max(0,Math.min(1,wn(t,e,s)));return Math.hypot(t[0]-(e[0]+(s[0]-e[0])*i),t[1]-(e[1]+(s[1]-e[1])*i))},xn=(t,e,s,i,o=1e-9)=>{const a=e[0]-t[0],n=e[1]-t[1],r=Math.hypot(a,n);if(r<=o)return 0;const l=e=>Math.abs((e[0]-t[0])*n-(e[1]-t[1])*a)/r;if(l(s)>o||l(i)>o)return 0;const h=wn(s,t,e),c=wn(i,t,e);return Math.max(0,Math.min(1,Math.max(h,c))-Math.max(0,Math.min(h,c)))*r},Sn=t=>{const e=(new TextEncoder).encode(t),s=8*e.length,i=64*Math.ceil((e.length+9)/64),o=new Uint8Array(i);o.set(e),o[e.length]=128;const a=new DataView(o.buffer);a.setUint32(i-8,Math.floor(s/4294967296),!1),a.setUint32(i-4,s>>>0,!1);const n=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),r=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),l=new Uint32Array(64),h=(t,e)=>t>>>e|t<<32-e;for(let t=0;t>>3,o=h(s,17)^h(s,19)^s>>>10;l[t]=l[t-16]+i+l[t-7]+o>>>0}let[e,s,i,o,c,d,p,u]=r;for(let t=0;t<64;t++){const a=u+(h(c,6)^h(c,11)^h(c,25))+(c&d^~c&p)+n[t]+l[t]>>>0,r=e&s^e&i^s&i;u=p,p=d,d=c,c=o+a>>>0,o=i,i=s,s=e,e=a+((h(e,2)^h(e,13)^h(e,22))+r>>>0)>>>0}r[0]=r[0]+e>>>0,r[1]=r[1]+s>>>0,r[2]=r[2]+i>>>0,r[3]=r[3]+o>>>0,r[4]=r[4]+c>>>0,r[5]=r[5]+d>>>0,r[6]=r[6]+p>>>0,r[7]=r[7]+u>>>0}const c=new Uint8Array(32),d=new DataView(c.buffer);for(let t=0;t{const e="abcdefghijklmnopqrstuvwxyz234567";let s=0,i=0,o="";for(const a of t)for(i=i<<8|a,s+=8;s>=5;)o+=e[i>>>s-5&31],s-=5;return s&&(o+=e[i<<5-s&31]),o},Cn=(t,e,s,i,o="")=>{const[a,n]=vn(e,s),r=`${t}|${fn(a)}|${fn(n)}|${[...i].sort().join(",")}${o}`;return`wall-${Mn(Sn(r)).slice(0,20)}`};let Pn=0;const Dn=t=>{for(let e=0;e<1e3;e++){const e=globalThis.crypto?.randomUUID?.(),s=`wall-${e||Mn(Sn(`${Date.now()}|${Pn++}|${Math.random()}`)).slice(0,26)}`;if(!t.has(s))return s}throw new un("duplicate-id","id factory exhausted")},In=t=>{const e=new Map;for(const s of Array.isArray(t?.wall_segments)?t.wall_segments:[])if(s&&"string"==typeof s.id&&mn(s.a)&&mn(s.b)){if(e.has(s.id))throw new un("duplicate-id",s.id);e.set(s.id,s)}return e},Tn=(t,e,s)=>{const i=(s,i)=>{const o=t[0]-s[0],a=t[1]-s[1];return Math.abs(e[0]-i[0]-o)<=pn&&Math.abs(e[1]-i[1]-a)<=pn?[o,a]:null};return i(s.a,s.b)||i(s.b,s.a)},zn=(t,e)=>{const s=Array.isArray(t.rooms)?t.rooms:[],i=L(t.open_spans).map(t=>[t.a[0],t.a[1],t.b[0],t.b[1]]),o=i.length?i:B(s,null,1,.04*N,!0),a=[];for(const t of s){const s=H(t),i=Array.isArray(t?.wall_ids)?t.wall_ids:[];if(s&&i.length===s.length)for(let t=0;t"partition"!==t.host?.kind&&[Number(t.x),Number(t.y)].every(Number.isFinite)&&Number.isFinite(Number(t.angle))&&Number(t.length)>0&&o.some(e=>kn([Number(t.x),Number(t.y)],[e[0],e[1]],[e[2],e[3]])<=.04*N)):[],l=r.map(t=>{const e=Number(t.angle)*Math.PI/180,s=[Math.cos(e),Math.sin(e)],i=Number(t.length)/2,o=[Number(t.x),Number(t.y)];return{a:[o[0]-s[0]*i,o[1]-s[1]*i],b:[o[0]+s[0]*i,o[1]+s[1]*i]}}),h=(t,e)=>r.some(s=>{const i=[Number(s.x),Number(s.y)];if(!G(t,e,Number(s.angle)))return!1;if(kn(i,t,e)>.02*N)return!1;const o=yn(t,e),a=wn(i,t,e)*o,n=Number(s.length)/2;return a+n>=-1e-9&&a-n<=o+pn}),c=new Map,d=[];for(const i of s){const r=String(i?.id||""),p=H(i);if(!r||!p||p.length<3)throw new un("invalid-room",r);const u=W(s,r,n,N,1,[...t.walls||[],...l]);if(!u||u.poly.length<3)throw new un("invalid-room",r);const _=Array.isArray(i.wall_ids)?i.wall_ids:[],m=_.length===p.length;let g=null,f=m;if(f)for(let t=0;tpn||Math.abs(i[1]-g[1])>pn)){f=!1;break}g=i}const b=[];for(let t=0;t2)throw new un("third-owner",n);const d=m?_[u.parent[t]]:void 0;if("string"==typeof d&&d){const o=e.get(d);f||!o||xn(s,i,o.a,o.b)>pn?l.preferredIds.add(d):l.positionalIds.add(d),l.preferredCarriers.set(d,{a:gn(p[u.parent[t]]),b:gn(p[(u.parent[t]+1)%p.length])})}const g=u.parent[t];l.parentKeys.add(O(p[g],p[(g+1)%p.length],N));const v=[(s[0]+i[0])/2,(s[1]+i[1])/2],y=t=>t.some(t=>kn(v,[t[0],t[1]],[t[2],t[3]])<=.04*N);l.zeroWall||=y(a)||y(o)&&!h(s,i),b.push(n)}const v={...i};delete v.wall_ids,d.push({...v,poly:u.poly.map(t=>[t[0],t[1]]),wall_ids:b})}return{atoms:[...c.values()].sort((t,e)=>t.key.localeCompare(e.key)),rooms:d}},Rn=(t,e,s,i,o)=>{const a=new Map([...s.values()].map(t=>[bn(t.a,t.b),t])),n=(t=>{const e=new Map;for(const s of t)"wall"===s.host?.kind&&e.set(s.host.id,(e.get(s.host.id)||0)+1);return e})(t.openings||[]),r=new Map;for(const t of e){const e=o?.get(t.key);if(e){const i=s.get(e);if(!i)throw new un("duplicate-id",e);r.set(t,i);continue}if(t.preferredIds.size>1)throw new un("duplicate-id",[...t.preferredIds].sort().join(","));const i=[...t.preferredIds][0],l=i?s.get(i):void 0;if(l){r.set(t,l);continue}const h=i?t.preferredCarriers.get(i):void 0;if(i&&h){r.set(t,{id:i,a:h.a,b:h.b,cm:0});continue}const c=a.get(t.key);if(c){r.set(t,c);continue}const d=[...s.values()].filter(e=>xn(t.a,t.b,e.a,e.b)>pn),p=[...new Map(d.map(t=>[t.id,t])).values()];if(p.sort((t,e)=>(n.get(e.id)||0)-(n.get(t.id)||0)||yn(e.a,e.b)-yn(t.a,t.b)||t.id.localeCompare(e.id)),p[0])r.set(t,p[0]);else if(1===t.positionalIds.size){const e=s.get([...t.positionalIds][0]);e&&r.set(t,e)}}const l=new Map;for(const[t,e]of r){const s=l.get(e.id)||[];s.push(t),l.set(e.id,s)}for(const[t,e]of l){const i=s.get(t)||r.get(e[0]);if(!i)throw new un("duplicate-id",t);const o=[(i.a[0]+i.b[0])/2,(i.a[1]+i.b[1])/2];e.sort((t,e)=>{const s=kn(o,t.a,t.b)<=pn?0:1,a=kn(o,e.a,e.b)<=pn?0:1;if(s!==a)return s-a;return(kn(i.a,t.a,t.b)<=pn?0:1)-(kn(i.a,e.a,e.b)<=pn?0:1)||t.key.localeCompare(e.key)}),e[0].id=t}const h=(t=>{const e=new Set;for(const s of[t.rooms,t.openings,t.decor,t.room_drafts,t.partitions,t.wall_columns])for(const t of Array.isArray(s)?s:[])"string"==typeof t?.id&&t.id&&e.add(t.id);for(const s of Array.isArray(t.room_drafts)?t.room_drafts:[])for(const t of Array.isArray(s?.segments)?s.segments:[])"string"==typeof t?.id&&t.id&&e.add(t.id);return e})(t);for(const t of e)if(t.id){if(h.has(t.id))throw new un("duplicate-id",t.id);h.add(t.id)}const c=e.filter(t=>!t.id);if(i){const e=c.map(e=>{const[s,i]=vn(e.a,e.b),o=`${String(t.id||"")}|${fn(s)}|${fn(i)}|${[...e.owners].sort().join(",")}`,a=Mn(Sn(o));return{atom:e,seed:o,digest:a,base:`wall-${a.slice(0,20)}`}}).sort((t,e)=>t.digest.localeCompare(e.digest)||t.atom.key.localeCompare(e.atom.key)),s=new Map;for(const t of e){const e=s.get(t.digest);if(e&&e!==t.seed)throw new un("duplicate-id",t.digest);s.set(t.digest,t.seed);let i=1,o=t.base;for(;h.has(o);)o=`${t.base}-${++i}`;t.atom.id=o,h.add(o)}}else for(const t of c)t.id=Dn(h),h.add(t.id)},An=(t,e)=>{if("partition"===t.host?.kind)return null;const s=[Number(t.x),Number(t.y)];if(!s.every(Number.isFinite))return null;const i=e=>{if(!(Number(e.cm)>0))return!1;const i=wn(s,e.a,e.b),o=yn(e.a,e.b),a=Number(t.length)/2;return i>=-1e-9&&i<=1+pn&&kn(s,e.a,e.b)<=.02*N&&G(e.a,e.b,Number(t.angle))&&Number.isFinite(a)&&a>=0&&i*o-a>=-1e-9&&i*o+a<=o+pn},o="wall"===t.host?.kind?e.find(e=>e.id===t.host.id):null,a=o&&i(o)?[o]:e.filter(i);if(1!==a.length)return null;const n=a[0];return{kind:"wall",id:n.id,t:Math.max(0,Math.min(1,wn(s,n.a,n.b)))}},Fn=(t,e)=>{const s=[Number(t.x),Number(t.y)];if(!s.every(Number.isFinite))return null;const i=Number(t.length)/2,o=e.filter(e=>{if(!(Number(e.cm)>0))return!1;const o=wn(s,e.a,e.b),a=yn(e.a,e.b);return o>=-1e-9&&o<=1+pn&&kn(s,e.a,e.b)<=.02*N&&G(e.a,e.b,Number(t.angle))&&Number.isFinite(i)&&i>=0&&o*a-i>=-1e-9&&o*a+i<=a+pn}),a=(e=>{if(!e.length)return null;const i="wall"===t.host?.kind?e.find(e=>e.id===t.host.id):null;return i||[...e].sort((t,e)=>kn(s,t.a,t.b)-kn(s,e.a,e.b)||Number(e.cm)-Number(t.cm)||(t.ide.id?1:0))[0]})(o);return a?{kind:"wall",id:a.id,t:Math.max(0,Math.min(1,wn(s,a.a,a.b)))}:null},Nn=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/,En=t=>{if("number"!=typeof t&&"string"!=typeof t)return null;if("string"==typeof t&&!Nn.test(t.trim()))return null;const e=Number(t);return Number.isFinite(e)?e:null},Hn=t=>{if(!Array.isArray(t)||t.length<2)return null;const e=En(t[0]),s=En(t[1]);return null==e||null==s?null:[e,s]},On=t=>"string"==typeof t?t:"",Ln=t=>{if(!Object.prototype.hasOwnProperty.call(t,"room_drafts"))return{drafts:0,segments:0};const e=Array.isArray(t.room_drafts)?t.room_drafts:[];if(!e.length)return delete t.room_drafts,{drafts:0,segments:0};const s=new Set;for(const e of[t.rooms,t.openings,t.decor,t.partitions,t.wall_columns,t.wall_segments])for(const t of Array.isArray(e)?e:[])"string"==typeof t?.id&&t.id&&s.add(t.id);for(const t of e)"string"==typeof t?.id&&t.id&&s.add(t.id);const i=Array.isArray(t.partitions)?[...t.partitions]:[];let o=0;for(const a of e){const e=On(a?.id),n=Array.isArray(a?.points)?a.points:[],r=Array.isArray(a?.segments)?a.segments:[];if(n.length<2||r.length!==n.length-1)throw new un("zero-length",e);for(let a=0;a+1100)throw new un("thickness-conflict",e);let p="string"==typeof c?.id&&c.id?c.id:"";if(!p||s.has(p)){const i=Cn(On(t.id),l,h,[`draft:${e}:${a}`]);p=i;for(let t=2;s.has(p);t++)p=`${i}-${t}`}s.add(p),i.push({id:p,a:gn(l),b:gn(h),cm:d}),o++}}return i.length?t.partitions=i:delete t.partitions,delete t.room_drafts,{drafts:e.length,segments:o}},Bn=t=>Ln(t),Wn=(t,e,s)=>{const i=Ln(t),o=In(t),{atoms:a,rooms:n}=zn(t,o);Rn(t,a,o,e,s);const r=a.map(e=>{const s=e.id?o.get(e.id):void 0,i=((t,e,s)=>{if(e.zeroWall)return 0;const i=Array.isArray(t.walls)?t.walls:[],o=O(e.a,e.b,N),a=i.filter(t=>Number(t.cm)>0&&(!(t.key!==o&&!e.parentKeys.has(t.key))||!(!mn(t.a)||!mn(t.b))&&xn(e.a,e.b,t.a,t.b)>=yn(e.a,e.b)-pn)).map(t=>Math.max(1,Math.min(100,Number(t.cm))));if(new Set(a.map(t=>t.toFixed(9))).size>1)throw new un("thickness-conflict",e.key);if(a.length)return a[0];const n=U(i,e.a,e.b,N,1);return n>0?n:Number(s?.cm)>0?Number(s.cm):0})(t,e,s);return{...s||{},id:e.id,a:[...e.a],b:[...e.b],cm:i}}),l=new Map(a.map(t=>[t.key,t.id]));for(const t of n)t.wall_ids=t.wall_ids.map(t=>l.get(t));t.rooms=n,t.wall_segments=r,t.walls=r.filter(t=>t.cm>0).map(t=>({key:O(t.a,t.b,N),cm:t.cm,a:[...t.a],b:[...t.b]})),t.walls.length||delete t.walls,delete t.open_spans;for(const e of t.rooms)delete e.open_to;return((t,e,s)=>{const i=Array.isArray(t.openings)?t.openings:[];for(const t of i){if("partition"===t.host?.kind)continue;if(!t.host&&!s){const s=An(t,e);s&&(t.host=s);continue}const i=An(t,e)??(s?Fn(t,e):null);if(i)t.host=i;else{if(!s)throw new un("opening-host",t.id);delete t.host}}})(t,r,e),{wallSegments:r.reduce((t,e)=>t+(o.has(e.id)?0:1),0),drafts:i.drafts,draftSegments:i.segments}};function jn(t,e={}){const s=JSON.stringify(t),i=_n(t);E(i);let o=0,a=0,n=0;const r=Number(i?.model_version||0)<10;for(const t of Array.isArray(i?.spaces)?i.spaces:[]){const s=e.lineageSpaceId===String(t?.id||"")?e.lineageHints:void 0,i=Wn(t,r,s);o+=i.wallSegments,a+=i.drafts,n+=i.draftSegments}return i.model_version=10,E(i),{config:i,changed:s!==JSON.stringify(i),migratedSegments:o,migratedDrafts:a,migratedDraftSegments:n}}const Gn=t=>!!t&&"object"==typeof t&&!Array.isArray(t);function qn(t,e){const s=(t,e)=>{if(Array.isArray(t)&&Array.isArray(e)){const i=new Map;for(const e of t)Gn(e)&&"string"==typeof e.id&&e.id&&i.set(e.id,e);const o=e.map((e,o)=>{if(Gn(e)&&"string"==typeof e.id&&e.id){const t=i.get(e.id);return t?s(t,e):_n(e)}return o[e,e in t?s(t[e],i):_n(i)]);for(const e of Object.keys(t))delete t[e];for(const[e,s]of i)t[e]=s;return t}return _n(e)};return s(t,e)}const Un=t=>"object"==typeof t&&null!==t?t:null,Kn=t=>Array.isArray(t)?t.flatMap(t=>{const e=Un(t);return e?[e]:[]}):[],Vn=t=>{if(!Array.isArray(t))return null;const e=Number(t[0]),s=Number(t[1]);return Number.isFinite(e)&&Number.isFinite(s)?[e,s]:null},Jn=t=>JSON.stringify(t??null),Yn=(t,e=1e8)=>`${Math.round(t[0]*e)},${Math.round(t[1]*e)}`,Xn=(t,e,s=1e-8)=>Math.hypot(t[0]-e[0],t[1]-e[1])<=s,Zn=(t,e,s)=>{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o,n=a>0?Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a)):0;return Math.hypot(t[0]-e[0]-n*i,t[1]-e[1]-n*o)},Qn=(t,e,s)=>(e[0]-t[0])*(s[1]-t[1])-(e[1]-t[1])*(s[0]-t[0]),tr=(t,e,s,i)=>{const o=2e-4*N,a=Qn(t,e,s),n=Qn(t,e,i),r=Qn(s,i,t),l=Qn(s,i,e);return a*n<=o*o&&r*l<=o*o&&Math.min(t[0],e[0])<=Math.max(s[0],i[0])+o&&Math.min(s[0],i[0])<=Math.max(t[0],e[0])+o&&Math.min(t[1],e[1])<=Math.max(s[1],i[1])+o&&Math.min(s[1],i[1])<=Math.max(t[1],e[1])+o?0:Math.min(Zn(t,s,i),Zn(e,s,i),Zn(s,t,e),Zn(i,t,e))},er=t=>{const e=(s=t.poly,Array.isArray(s)?s.flatMap(t=>{const e=Vn(t);return e?[e]:[]}):[]);var s;if(e.length>=3)return e;const i=Number(t.x),o=Number(t.y),a=Number(t.w),n=Number(t.h);return[i,o,a,n].every(Number.isFinite)?[[i,o],[i+a,o],[i+a,o+n],[i,o+n]]:[]},sr=t=>{const e=er(t);return e.map((t,s)=>[t,e[(s+1)%e.length]])},ir=(t,e)=>Math.max(0,Number(t)||0)/e*N,or=(t,e=15)=>{const s=Number(t.cm);return Number.isFinite(s)?Math.max(0,s):e},ar=t=>Math.atan2(t.b[1]-t.a[1],t.b[0]-t.a[0]),nr=(t,e)=>{let s=Math.abs(ar(t)-ar(e));return s%=Math.PI,s=Math.min(s,Math.PI-s),s<=Math.PI/180&&Math.abs(t.cm-e.cm)<=1e-6};function rr(t,e){const s=Un(t),i=Kn(s?.partitions).find(t=>t.id===e);if(!i)return null;const o=Vn(i.a),a=Vn(i.b),n=Number(i.cm);return!o||!a||!Number.isFinite(n)||n<0||Xn(o,a)?null:{partitionId:e,a:o,b:a,cm:n}}function lr(t,e){const s=Un(t);if(!s)return null;const i=Number(s.cell_cm),o=Number.isFinite(i)&&i>0?i:5,a=ir(5,o),n=ir(e.cm,o)/2,r=Kn(s.rooms),l=Kn(s.wall_segments),h=new Map(l.map(t=>[String(t.id||""),t])),c=Kn(s.walls),d=t=>{const e=Array.isArray(t.wall_ids)?t.wall_ids.map(String):[];return sr(t).map(([t,s],i)=>{const a=[h.get(e[i]),...c.filter(e=>{const i=Vn(e.a),o=Vn(e.b);if(i&&o)return tr(t,s,i,o)<=.02*N;const[a]=String(e.key||"").split("@"),n=Vn(a?.split(",").map(Number));return!!n&&Zn(n,t,s)<=.02*N})].filter(t=>!!t),n=Math.max(15,...a.map(t=>or(t,15)));return{a:t,b:s,half:ir(n,o)/2}})},p=r.flatMap(t=>{const s=String(t.id||""),i=d(t).some(({a:t,b:s,half:i})=>tr(e.a,e.b,t,s)<=n+i+a);return s&&i?[s]:[]}),u=new Set(p);if(p.length){const t=r.filter(t=>u.has(String(t.id||""))).flatMap(d);for(const e of r){const s=String(e.id||"");s&&!u.has(s)&&(d(e).some(({a:e,b:s,half:i})=>t.some(t=>tr(e,s,t.a,t.b)<=i+t.half+.02*N))&&u.add(s))}}const _=[...u],m=r.filter(t=>u.has(String(t.id||""))),g=new Set(m.flatMap(t=>Array.isArray(t.wall_ids)?t.wall_ids.map(String):[])),f=Kn(s.wall_segments).filter(t=>g.has(String(t.id||""))),b=m.flatMap(sr),v=Kn(s.walls).filter(t=>{const e=Vn(t.a),s=Vn(t.b);if(e&&s)return b.some(([t,i])=>tr(e,s,t,i)<=.02*N);const[i]=String(t.key||"").split("@"),o=Vn(i?.split(",").map(Number));return!o||b.some(([t,e])=>Zn(o,t,e)<=.02*N)}),{segments:y,malformedPartitions:$}=function(t){const e=[],s=[];for(const i of Kn(t.partitions)){const t=Vn(i.a),o=Vn(i.b);t&&o?e.push({key:`partition:${String(i.id||Jn(i))}`,source:i,a:t,b:o,cm:or(i,0)}):s.push(i)}return{segments:e,malformedPartitions:s}}(s),w=new Set(y.flatMap(t=>tr(e.a,e.b,t.a,t.b)<=n+ir(t.cm,o)/2+a?[t.key]:[]));let k=!0;for(;k;){k=!1;const t=y.filter(t=>w.has(t.key));for(const e of y)w.has(e.key)||t.some(t=>nr(t,e)&&(Xn(t.a,e.a)||Xn(t.a,e.b)||Xn(t.b,e.a)||Xn(t.b,e.b)))&&(w.add(e.key),k=!0)}const x=new Set(y.filter(t=>w.has(t.key)).flatMap(t=>[Yn(t.a),Yn(t.b)]));for(const t of y)(x.has(Yn(t.a))||x.has(Yn(t.b)))&&w.add(t.key);const S=y.filter(t=>w.has(t.key)),M=S.map(t=>t.source).concat($),C=Kn(s.wall_columns).filter(t=>{const s=Vn(t.center);if(!s)return!0;const i=ir(Number(t.cm),o)/2,r="circle"===t.shape?i:i*Math.SQRT2;return Zn(s,e.a,e.b)<=n+r+a}),P=new Set(M.map(t=>String(t.id||""))),D=new Set(f.map(t=>String(t.id||""))),I=Kn(s.openings).filter(t=>{const s=Un(t.host);if("partition"===s?.kind)return P.has(String(s.id||""));if("wall"===s?.kind&&D.has(String(s.id||"")))return!0;const i=Vn([t.x,t.y]);return!i||Zn(i,e.a,e.b)<=n+a}),T=Kn(s.open_spans).filter(t=>{const s=Vn(t.a),i=Vn(t.b);return!s||!i||tr(e.a,e.b,s,i)<=n+a});return{space:{...s,rooms:m,walls:v,wall_segments:f,open_spans:T,openings:I,partitions:M,wall_columns:C},roomIds:_,segmentCount:f.length+S.length}}const hr=1e3;const cr=(t,e)=>(t._clearGeometryGesture(),t._restoreGeometryStateLocal(e),t.host._showToast(t.host._t("toast.geometry_unsafe")),!1);function dr(t,e,s){const{host:i}=t,o=i._serverCfg,a=i._activeWallChainPartitionIds[i._activeWallChainPartitionIds.length-1]||null,n=()=>t._commitPhysicalGeometry(e,s);if(!s||!o||!a||10!==Number(o.model_version||0))return n();const r=o.spaces.find(t=>t.id===s.spaceId);if(!r||!function(t,e,s){const i=Un(t),o=Un(e);if(!i||!o||String(i.spaceId||"")!==String(o.id||""))return!1;if(["rooms","openings","walls","wall_segments","open_spans","wall_columns","decor"].some(t=>Jn(i[t]??[])!==Jn(o[t]??[])))return!1;const a=Un(i.plan_transform)||{},n={};for(const t of["plan_x","plan_y","plan_scale","plan_scale_x","plan_scale_y","plan_angle"])void 0!==o[t]&&(n[t]=o[t]);if(Jn(a)!==Jn(n))return!1;const r=Kn(i.partitions),l=Kn(o.partitions);if(l.length!==r.length+1||Jn(l.slice(0,-1))!==Jn(r))return!1;const h=l[l.length-1],c=Vn(h.a),d=Vn(h.b);return h.id===s&&!!c&&!!d&&!Xn(c,d)&&Number.isFinite(Number(h.cm))&&Number(h.cm)>=0}(s,r,a))return n();let l;try{l=jn(o).config}catch(e){return t._clearGeometryGesture(),t._restoreGeometryStateLocal(s),t._showWallModelMigrationBlocked(e),!1}const h=l.spaces.find(t=>t.id===s.spaceId),c=rr(h,a);if(!h||!c)return n();const d=JSON.parse(JSON.stringify(o));if(!t._restoreGeometryStateInConfig(d,s))return n();const p=d.spaces.find(t=>t.id===s.spaceId),u=lr(h,c),_=lr(p,c);if(!u||!_)return n();const m={...l,spaces:[u.space]},g={...d,spaces:[_.space]};let f=null,b=!1;try{const t=i._path.length>=2?i._path.map(t=>[t[0]/hr,t[1]/hr]):[];b=$n(h)<=$n(s,t)&&i._checkSpacePhysicalGeometry(m,s.spaceId,t=>{f=t}).ok}catch{b=!1}if(!b)return cr(t,s);const v=t._junctionLimitsIntroduced(m,g,s.spaceId,f,u.roomIds);if(v.length)return t._clearGeometryGesture(),t._restoreGeometryStateLocal(s),i._showToast(t._junctionLimitLabel(v[0])),!1;qn(o,l);const y=o.spaces.find(t=>t.id===s.spaceId),$=y?.partitions?.find(t=>t.id===a),w=i._activeWallChainPartitionIds.length-1;$&&w>=0&&i._path.length===i._wallChainSegmentCms.length+1&&(i._path[w]=[$.a[0]*hr,$.a[1]*hr],i._path[w+1]=[$.b[0]*hr,$.b[1]*hr],i._wallChainSegmentCms[w]=Number($.cm)),t._recordGeometry(e,s);const k=i._pendingPhysicalWrites.get(s.spaceId);return i._pendingPhysicalWrites.set(s.spaceId,{before:k?.before||s,fingerprint:K(y)}),t._saveConfig(),!0}const pr=(t,e)=>[(t[0]-e.x)/Math.max(1e-9,e.w)*e.stageWidth,(t[1]-e.y)/Math.max(1e-9,e.h)*e.stageHeight];function ur(t){const{poly:e,edge:s,text:i,view:o}=t,a=e[s],n=e[(s+1)%e.length],r=[(a[0]+n[0])/2,(a[1]+n[1])/2],l=function(t,e){const s=t[e],i=t[(e+1)%t.length],o=i[0]-s[0],a=i[1]-s[1],n=Math.hypot(o,a)||1;return(t=>{let e=0;for(let s=0;s=0?[-a/n,o/n]:[a/n,-o/n]}(e,s),h=Math.hypot(n[0]-a[0],n[1]-a[1])||1,c=[(n[0]-a[0])/h,(n[1]-a[1])/h],d=pr(r,o),p=pr(t.gearCenter,o),u=Math.max(34,7.2*i.length+12),_=Math.abs(l[0])>=Math.abs(l[1])?Math.max(28,u/2+4):Math.max(28,13),m=d[0]+l[0]*_,g=d[1]+l[1]*_,f=e=>{return s=m+c[0]*e,i=g+c[1]*e,o=u,a=18,n=p[0],r=p[1],l=t.gearWidthPx,h=t.gearHeightPx,2*Math.abs(s-n)=Math.abs(c[1])?c[0]:c[1])>0?-1:1,e=Math.max(o.stageWidth,o.stageHeight,64);for(let s=4;s<=e;s+=4){const e=s*t;if(!f(e)){b=e;break}const i=-e;if(!f(i)){b=i;break}}}const v=l[0]*_+c[0]*b,y=l[1]*_+c[1]*b,$=Math.hypot(v,y)||1,w=y/$*12,k=[r[0]+v/$*12*o.w/Math.max(1,o.stageWidth),r[1]+w*o.h/Math.max(1,o.stageHeight)];return{anchor:r,offsetXPx:v,offsetYPx:y,tangentOffsetPx:b,side:Math.abs(l[0])>=Math.abs(l[1])?l[0]<0?"left":"right":l[1]<0?"above":"below",leader:{a:r,b:k}}}const _r=t=>{let e=(t%360+360)%360;return e>180&&(e-=360),e};function mr(t,e,s,i,o,a=0,n=[t,e],r){const l=1e-7,h=(t,e,s,i,o)=>{const a=Math.max(0,Math.min(1,((t[0]-e[0])*s+(t[1]-e[1])*i)/o));return{t:a,x:e[0]+a*s,y:e[1]+a*i}},c=t=>{if(!t||!Number.isFinite(t[0])||!Number.isFinite(t[1]))return null;const e=Math.hypot(t[0],t[1]);return e>1e-9?[t[0]/e,t[1]/e]:null},d=c(r);let p=null;for(const r of i){const i=Number(r?.a?.[0]),u=Number(r?.a?.[1]),_=Number(r?.b?.[0]),m=Number(r?.b?.[1]);if(![i,u,_,m].every(Number.isFinite))continue;const g=_-i,f=m-u,b=g*g+f*f;if(!(b>1e-18))continue;const v=Math.sqrt(b),y=h(n,[i,u],g,f,b),$=Math.hypot(n[0]-y.x,n[1]-y.y);if(!($=2?r.axisA:r.a,e=r.axisB?.length>=2?r.axisB:r.b,s=Number(e[0])-Number(t[0]),i=Number(e[1])-Number(t[1]),o=s*s+i*i;if(o>1e-18&&[t[0],t[1],e[0],e[1]].every(Number.isFinite)){const e=h(n,t,s,i,o),a=(n[0]-e.x)*w[0]+(n[1]-e.y)*w[1];if(a>l)k=2;else if(a<-1e-7){if(r.roomSide)continue;k=-2}else d&&(k=w[0]*d[0]+w[1]*d[1])}}else{let t=n[0]-y.x,e=n[1]-y.y;const s=Math.hypot(t,e);if(s>l)t/=s,e/=s,k=2;else if(d)[t,e]=d,k=1;else{const s=i<_||i===_&&u<=m;t=-(s?f:-f)/v,e=(s?g:-g)/v}w=[t,e]}const x=h([t,e],[i,u],g,f,b);let S=x.t,M=x.x,C=x.y;if(Number.isFinite(a)&&a>0){const t=Math.round(S*v/a)*a;S=Math.max(0,Math.min(1,t/v)),M=i+S*g,C=u+S*f}const P=_r(180*Math.atan2(-w[0],w[1])/Math.PI),D={cx:M+w[0]*(s/2),cy:C+w[1]*(s/2),angle:P,dist:$,sideScore:k,stableId:"string"==typeof r.stableId?r.stableId:""};(!p||D.distp.sideScore+l||Math.abs(D.sideScore-p.sideScore)<=l&&D.stableId.localeCompare(p.stableId)<0))&&(p=D)}return p&&{cx:p.cx,cy:p.cy,angle:p.angle,dist:p.dist}}const gr=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1]),fr=(t,e)=>{const s=t=>`${t[0].toFixed(9)},${t[1].toFixed(9)}`,i=s(t),o=s(e);return i<=o?`${i}|${o}`:`${o}|${i}`};function br(t,e,s,i,o,a,n=1){const r=[],l=new Map;for(const h of t||[]){const c="string"==typeof h?.id?h.id:"";if(!c)continue;const d=Z(t,c,e,s,i,o,a,n);if(d)for(let t=0;t1e-9))continue;const a=Q(d.poly,t),n=Number(d.offsets[t]),h=Number.isFinite(n)&&n>0?n:0,p=[e[0],e[1]],u=[s[0],s[1]],_=fr(p,u),m=l.get(_)||new Set;m.add(c),l.set(_,m),r.push({a:[p[0]+a[0]*h,p[1]+a[1]*h],b:[u[0]+a[0]*h,u[1]+a[1]*h],axisA:p,axisB:u,normal:a,owner:"room",stableId:`room:${c}:${_}`,roomId:c,atomId:_,half:h})}}const h=[];for(const t of r){const{atomId:e,half:s,...i}=t;if(!(1===l.get(e)?.size&&s>1e-9)){h.push(i);continue}const o=i.normal;h.push({...i,roomSide:"inside",stableId:`${i.stableId}:inside`}),h.push({...i,a:[i.axisA[0]-o[0]*s,i.axisA[1]-o[1]*s],b:[i.axisB[0]-o[0]*s,i.axisB[1]-o[1]*s],normal:[-o[0],-o[1]],roomSide:"outside",stableId:`${i.stableId}:outside`})}return h}function vr(t){const e=[],s=new Set;for(const i of t||[])if(Array.isArray(i)&&!(i.length<2))for(let t=0;t1e-9))continue;const n=[o[0],o[1]],r=[a[0],a[1]],l=`physical:${fr(n,r)}`;s.has(l)||(s.add(l),e.push({a:n,b:r,axisA:[...n],axisB:[...r],normal:null,owner:"physical",stableId:l}))}return e}const yr=new WeakMap;const $r=1e-9,wr=2e-7,kr=1e7,xr=t=>{const e=Math.sign(t)*Math.floor(Math.abs(t)*kr+.5)/kr;return Object.is(e,-0)?0:e},Sr=t=>`${xr(t[0])},${xr(t[1])}`,Mr=(t,e)=>Math.hypot(e[0]-t[0],e[1]-t[1]),Cr=(t,e,s)=>t/(e||1)*s,Pr=(t,e)=>Math.atan2(e[1]-t[1],e[0]-t[0]),Dr=t=>Array.isArray(t)&&t.length>=2&&t.every(t=>Number.isFinite(t)),Ir=t=>(t||[]).filter(t=>Dr(t?.a)&&Dr(t?.b)&&Mr(t.a,t.b)>$r);function Tr(t,{minAngleDeg:e=15,maxValence:s=6}={}){const i=new Map;for(const e of Ir(t))for(const[t,s]of[[e.a,e.b],[e.b,e.a]]){const e=i.get(Sr(t))||[];e.push(Pr(t,s)),i.set(Sr(t),e)}const o=[];for(const[t,a]of i){if(a.length>s&&o.push({rule:"valence",subject:t,actual:a.length,limit:s}),a.length<2)continue;const i=[...a].sort((t,e)=>t-e);let n=1/0;for(let t=0;t$r&&s(180*Math.atan2(t.b[1]-t.a[1],t.b[0]-t.a[0])/Math.PI%180+180)%180,Rr=(t,e,s=1)=>{const i=Math.abs(zr(t)-zr(e));return Math.min(i,180-i)<=s},Ar=t=>{const e=new Map;for(const s of t)for(const t of[s.a,s.b]){const i=e.get(Sr(t));i?i.push(s):e.set(Sr(t),[s])}return e};function Fr(t,e,s){const i=Ir(e),o=s??Ar(i),a=new Set([t]);let n=Mr(t.a,t.b);const r=[t.a,t.b];for(;r.length;){const e=r.pop();for(const s of o.get(Sr(e))||[])a.has(s)||Rr(s,t)&&Number(s.cm||0)===Number(t.cm||0)&&(a.add(s),n+=Mr(s.a,s.b),r.push(s.a,s.b))}return n}function Nr(t,e,s,{minLengthCm:i=20}={}){const o=[],a=Ir(t),n=Ar(a);for(const t of a){const r=Fr(t,a,n)/s*(e||1),l=Math.max(i,Number(t.cm)>0?Number(t.cm):0);r{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o,n=a<=$r?0:Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a));return Math.hypot(t[0]-(e[0]+i*n),t[1]-(e[1]+o*n))};function Hr(t,e,s,{minDistanceCm:i=5}={}){const o=Ir(t),a=new Map;for(const t of o)a.set(Sr(t.a),t.a),a.set(Sr(t.b),t.b);const n=Cr(i,e,s),r=n>$r?n:1,l=(t,e)=>`${Math.floor(t/r)},${Math.floor(e/r)}`,h=new Map;for(const[t,e]of a){const s=l(e[0],e[1]),i=h.get(s);i?i.push([t,e]):h.set(s,[[t,e]])}const c=new Map;for(const t of o){const e=Math.min(t.a[0],t.b[0])-n,s=Math.max(t.a[0],t.b[0])+n,i=Math.min(t.a[1],t.b[1])-n,o=Math.max(t.a[1],t.b[1])+n;for(let a=Math.floor(e/r);a<=Math.floor(s/r);a++)for(let e=Math.floor(i/r);e<=Math.floor(o/r);e++){const s=`${a},${e}`,i=c.get(s);i?i.push(t):c.set(s,[t])}}const d=[];for(const[t,o]of a){const a=Math.floor(o[0]/r),l=Math.floor(o[1]/r);for(let r=-1;r<=1;r++)for(let c=-1;c<=1;c++)for(const[p,u]of h.get(`${a+r},${l+c}`)||[]){if(t>=p)continue;const a=Mr(o,u);a<=wr||a{const i=a[(s+1)%a.length];return t+(e[0]*i[1]-i[0]*e[1])},0))/2,r=(s||1)/i,l=n*r*r;return l0&&o.push(...e.slice(0,i))}return o}async function Br(t,e,s){t._saveConfigDebounced.pending()&&t._saveConfigDebounced.flush(),await t._writeChain;const i=await t.hass.callWS({type:"houseplan/plan/optimize",config:e,layout:s,expected_config_rev:t._cfgRev,expected_layout_rev:t._layoutRev});t._adoption.acceptPairWrite(e,s,i),t._geometryHistory.clear(),t._cancelDeviceDrag(),t._devicePositionHistory.clear(),t._canOptimizeUndo=!0===i.can_undo,t._undoKind=!0===i.can_undo?"optimize":null,t._dirtyPos.clear(),t._sentPos.clear(),t._cfgEpoch++,t._modelCache=null,t._frame=null,t._regSignature="",t._maybeRebuildDevices(),t._cacheSnapshot(),t.requestUpdate()}const Wr=1e-6*N,jr=6*N;function Gr(t){return Number.isFinite(t)?Math.round(t/N)*N:t}const qr=(t,e,s,i)=>Math.hypot(s-t,i-e),Ur=(t,e,s,i,o,a,n,r)=>Math.hypot(Math.max(Math.abs(o-t),Math.abs(o+n-(t+s))),Math.max(Math.abs(a-e),Math.abs(a+r-(e+i)))),Kr=(t,e,s,i,o,a,n)=>{const r=Math.max(Number(i)||0,0)/2,l=Math.PI/180,h=Math.cos(s*l)*r,c=Math.sin(s*l)*r,d=Math.cos(n*l)*r,p=Math.sin(n*l)*r,u=Math.max(qr(t+h,e+c,o+d,a+p),qr(t-h,e-c,o-d,a-p)),_=Math.max(qr(t+h,e+c,o-d,a-p),qr(t-h,e-c,o+d,a+p));return Math.min(u,_)},Vr=t=>{const e=Number(t?.cell_cm);return e>0?e:5};function Jr(t,e){const s=JSON.parse(JSON.stringify(t||[])),i=JSON.parse(JSON.stringify(e||{}));let o=0,a=0,n=0,r=0,l="",h=0,c=0;const d=(t,e)=>{Number.isFinite(t)&&Number.isFinite(e)&&t!==e&&Math.abs(e-t)<=Wr&&c++},p=(t,e)=>{d(t[0],e[0]),d(t[1],e[1])},u={};let _=5;for(const t of s){const e=Vr(t);null!=t?.id&&(u[String(t.id)]=e),e>_&&(_=e)}const m=(t,e,s,i=!1)=>{if(!(t>Wr||i))return;o++,t>n&&(n=t);const a=t*nt*e;a>r&&(r=a,l=s)};for(const t of s){const e=Vr(t),s=null!=t?.id?String(t.id):"";for(const i of t.rooms||[]){a++;let t=0;if(i.poly?.length)i.poly=i.poly.map(e=>{const s=[Gr(e[0]),Gr(e[1])];return t=Math.max(t,qr(e[0],e[1],s[0],s[1])),p(e,s),s});else if(null!=i.x&&null!=i.y){const e=i.x,s=i.y,o=i.w||0,a=i.h||0,n=Gr(e+o),r=Gr(s+a),l=Gr(e),h=Gr(s),c=Math.max(N,n-l),p=Math.max(N,r-h);t=Ur(e,s,o,a,l,h,c,p),i.x=l,i.y=h,i.w=c,i.h=p,d(e,l),d(s,h),d(e+o,l+c),d(s+a,h+p)}m(t,e,s)}for(const i of t.partitions||[]){a++;const o=[i.a[0],i.a[1]],n=[i.b[0],i.b[1]],r=[Gr(o[0]),Gr(o[1])],l=[Gr(n[0]),Gr(n[1])];let h=Math.max(qr(o[0],o[1],r[0],r[1]),qr(n[0],n[1],l[0],l[1]));const c=qr(r[0],r[1],l[0],l[1]),d=(t.openings||[]).filter(t=>"partition"===t.host?.kind&&t.host.id===i.id).every(t=>{const e=Number(t.length),s=Number(t.host.t),i=s*c;return Number.isFinite(e)&&e>0&&Number.isFinite(s)&&s>=0&&s<=1&&i-e/2>=-Wr&&i+e/2<=c+Wr});c>Wr&&d?(i.a=r,i.b=l,p(o,r),p(n,l)):h=0,m(h,e,s)}for(const i of t.wall_columns||[]){a++;const t=[i.center[0],i.center[1]],o=[Gr(t[0]),Gr(t[1])],n=qr(t[0],t[1],o[0],o[1]);i.center=o,p(t,o),m(n,e,s)}for(const i of t.decor||[]){if("furniture"===i.kind||"image"===i.kind)continue;a++;let t=0;if("line"===i.kind){const e=[i.x1,i.y1],s=[i.x2,i.y2],o=[Gr(e[0]),Gr(e[1])],a=[Gr(s[0]),Gr(s[1])];t=Math.max(qr(e[0],e[1],o[0],o[1]),qr(s[0],s[1],a[0],a[1])),i.x1=o[0],i.y1=o[1],i.x2=a[0],i.y2=a[1],p(e,o),p(s,a)}else{const e=i.x,s=i.y,o=i.w,a=i.h,n=Gr(e),r=Gr(s);if(null!=i.w&&null!=i.h){const l=Gr(e+o),h=Gr(s+a),c=Math.max(N,l-n),p=Math.max(N,h-r);t=Ur(e,s,o,a,n,r,c,p),i.w=c,i.h=p,d(e+o,n+c),d(s+a,r+p)}else t=qr(e,s,n,r);i.x=n,i.y=r,d(e,n),d(s,r)}m(t,e,s)}for(const i of t.openings||[]){if(a++,"partition"===i.host?.kind){const o=(t.partitions||[]).find(t=>t.id===i.host.id),a=Number(i.host.t);if(!o||!Number.isFinite(a)||a<0||a>1)continue;const n=o.b[0]-o.a[0],r=o.b[1]-o.a[1];if(Math.hypot(n,r)<=Wr)continue;const l=o.a[0]+n*a,c=o.a[1]+r*a;let d=180*Math.atan2(r,n)/Math.PI;d>=90?d-=180:d<-90&&(d+=180);const p=Number(i.angle),u=!(Number.isFinite(p)&&p===d),_=Kr(i.x,i.y,Number.isFinite(p)?p:d,Number(i.length)||0,l,c,d);i.x=l,i.y=c,i.angle=d,u&&h++,m(_,e,s,u);continue}const o=at([i.x,i.y],t.rooms||[],jr,{step:N,length:Number(i.length)||0});if(!o)continue;const n=Number(i.angle),r=!(Number.isFinite(n)&&n===o.angle),l=Kr(i.x,i.y,Number.isFinite(n)?n:o.angle,Number(i.length)||0,o.x,o.y,o.angle);i.x=o.x,i.y=o.y,i.angle=o.angle,r&&h++,m(l,e,s,r)}}for(const[t,e]of Object.entries(i)){if(!e||"object"!=typeof e)continue;const s=e;if("number"!=typeof s.x||"number"!=typeof s.y)continue;a++;const o=Gr(s.x),n=Gr(s.y),r=qr(s.x,s.y,o,n);i[t]={...s,x:o,y:n},d(s.x,o),d(s.y,n);const l="string"==typeof s.s?s.s:"";m(r,u[l]??_,l)}return{spaces:s,layout:i,report:{moved:o,coordsCanonicalized:c,total:a,maxShift:n,maxShiftCm:r,maxSpace:l,rotated:h},changed:o>0||c>0}}function Yr(t,e){const s=e.base+t*e.span;return Math.min(1,Math.max(0,s))}const Xr=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1]),Zr=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1]);function Qr(t,e,s){const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o;if(a<=0)return Zr(t,e);let n=((t[0]-e[0])*i+(t[1]-e[1])*o)/a;return n=Math.max(0,Math.min(1,n)),Math.hypot(t[0]-(e[0]+i*n),t[1]-(e[1]+o*n))}function tl(t,e,s,i,o){for(const i of e)if(i&&!s.has(i.id)&&Xr(i.a)&&Xr(i.b)&&(Zr(t,i.a)<=o||Zr(t,i.b)<=o))return!0;for(const e of i?.roomPolygons||[])for(let s=0;s0&&r>0))return null;if(Math.abs(o[0]/n*(a[1]/r)-o[1]/n*(a[0]/r))>s)return null;for(const[s,o]of[[t.a,e.a],[t.a,e.b],[t.b,e.a],[t.b,e.b]])if(Zr(s,o)<=i)return[(s[0]+o[0])/2,(s[1]+o[1])/2];return null}function sl(t,e){const s=.05*(Number(e.pitch)>0?Number(e.pitch):1),i=new Map;let o=(t||[]).filter(t=>!!t&&"string"==typeof t.id&&Xr(t.a)&&Xr(t.b));if(o.length<2)return{partitions:[...t||[]],merged:0,openingMoves:[]};const a=e.seedIds&&e.seedIds.length?new Set(e.seedIds):null;let n=0;for(let t=0;tZr(e,t.at)>s);let c=h[0]??r.a,d=h[h.length-1]??l.b;if(h.length<2&&(c=r.a,d=l.b),d[0]0?(d[0]-c[0])/u:0,m=u>0?(d[1]-c[1])/u:0,g=t=>u>0?((t[0]-c[0])*_+(t[1]-c[1])*m)/u:0;for(const t of[r,l]){const e=g(t.a),s=g(t.b)-e;for(const[o,a]of i)a.toId===t.id&&i.set(o,{fromId:a.fromId,toId:p.id,base:e+a.base*s,span:a.span*s});i.set(t.id,{fromId:t.id,toId:p.id,base:e,span:s})}a&&a.add(p.id),o=o.filter((e,s)=>s!==t.i&&s!==t.j),o.splice(t.i,0,p),n++}return{partitions:o,merged:n,openingMoves:[...i.values()]}}function il(t,e,s,i){if(!t?.length||!s.length)return 0;const o=new Map(s.map(t=>[t.fromId,t]));let a=0;for(const s of t){const t=s?.host;if(!t||"partition"!==t.kind)continue;const n=o.get(t.id);if(!n)continue;s.host={...t,id:n.toId,t:Yr(t.t,n)},a++;const r=rt(s,e,i.coordScale,i.cellCm,i.gridPitch).resolved;r&&Object.assign(s,lt(s,r,i.coordScale))}return a}function ol(t){return{roomPolygons:(t?.rooms||[]).map(t=>H(t)).filter(t=>!!t),columns:t?.wall_columns||[]}}const al=t=>!!t&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1]),nl=(t,e)=>t[0]-e[0]||t[1]-e[1],rl=(t,e,s,i)=>[t[0]+e*i,t[1]+s*i],ll=(t,e,s,i)=>(t[0]-e[0])*s+(t[1]-e[1])*i,hl=(t,e,s,i,o)=>{const a=e[0]-t[0],n=e[1]-t[1],r=Math.hypot(a,n);if(!(r>o))return null;const l=a/r,h=n/r,c=e=>Math.abs((e[0]-t[0])*h-(e[1]-t[1])*l);if(c(s)>o||c(i)>o)return null;const d=ll(s,t,l,h),p=ll(i,t,l,h),u=Math.max(0,Math.min(d,p)),_=Math.min(r,Math.max(d,p));return _-u>o?{lo:u,hi:_}:null},cl=(t,e,s)=>Math.min(t.hi,e.hi)-Math.max(t.lo,e.lo)>s,dl=t=>{const e=new Set(["id","a","b","cm"]);return Object.keys(t||{}).every(t=>e.has(t))},pl=(t,e,s,i)=>{const o=t.b[0]-t.a[0],a=t.b[1]-t.a[1],n=Math.hypot(o,a);if(!(n>i))return!0;const r=o/n,l=a/n,h=b(t.cm,s.cellCm,s.gridPitch)/2;return e.some(e=>{const o=e?.center;if(!al(o))return!0;const a=ll(o,t.a,r,l),c=Math.abs((o[0]-t.a[0])*l-(o[1]-t.a[1])*r),d=b(Number(e.cm),s.cellCm,s.gridPitch)*("square"===e.shape?Math.SQRT1_2:.5);return!(Number.isFinite(d)&&d>0)||a>=-d-i&&a<=n+d+i&&c<=h+d+i})},ul=(t,e,s)=>{if(t.host){const i=rt(t,e,s.coordScale,s.cellCm,s.gridPitch).resolved;return i?{center:i.center,angle:i.angle,length:i.length}:null}const i=Number(t.x)*s.coordScale,o=Number(t.y)*s.coordScale,a=Number(t.angle),n=Number(t.length)*s.coordScale;return[i,o,a,n].every(Number.isFinite)&&n>0?{center:[i,o],angle:a,length:n}:null},_l=(t,e,s)=>{const i=t.angle*Math.PI/180,o=Math.cos(i),a=Math.sin(i),n=e.angle*Math.PI/180,r=Math.cos(n),l=Math.sin(n);if(Math.abs(o*l-a*r)>1e-6)return!1;const h=e.center[0]-t.center[0],c=e.center[1]-t.center[1];if(Math.abs(h*a-c*o)>s)return!1;const d=h*o+c*a;return Math.max(-t.length/2,d-e.length/2)({...t,a:[t.a[0]*e,t.a[1]*e],b:[t.b[0]*e,t.b[1]*e]}),gl=(t,e,s,i)=>{const o=`~r-${(t=>{let e=2166136261;for(let s=0;s>>0;return e.toString(36)})(`${t}|${e[0].toFixed(9)},${e[1].toFixed(9)}|${s[0].toFixed(9)},${s[1].toFixed(9)}`)}`,a=`${t.slice(0,Math.max(1,64-o.length))}${o}`;let n=a;for(let t=2;i.has(n);t++){const e=`-${t}`;n=`${a.slice(0,64-e.length)}${e}`}return i.add(n),n},fl=(t,e)=>{const s=[];for(const i of t){const t=s[s.length-1];!(t&&Math.abs(t.hi-i.lo)<=e&&t.safe===i.safe)||i.safe&&t.signature!==i.signature?s.push({lo:i.lo,hi:i.hi,a:i.a,b:i.b,safe:i.safe,signature:i.signature,roomIds:i.roomIds,finalCm:i.finalCm}):(t.hi=i.hi,t.b=i.b)}return s};function bl(t,e,s,i,o){const a=s||[],n=Array.isArray(t?.partitions)?t.partitions:[],r=Array.isArray(t?.openings)?t.openings:[],l={walls:a,partitions:n,openings:r,partitionsReconciled:0,openingsRehosted:0};if(!n.length)return l;const h=Math.max(2e-4*o.gridPitch,1e-9);let c=a,d=n,p=r,u=0,_=0;const m=o.partitionIds?new Set(o.partitionIds):null,g=new Map(e.partitions.map(t=>[t.id,t]));for(const t of[...n].sort((t,e)=>t.id.localeCompare(e.id))){if(m&&!m.has(t.id))continue;if(!d.some(e=>e.id===t.id))continue;if(!dl(t))continue;const s=g.get(t.id);if(!(s&&al(s.a)&&al(s.b)&&Number.isFinite(s.cm)&&(o.allowCoincidentPartitions?!(s.cm<0):s.cm>0)))continue;const[a,n]=nl(s.a,s.b)<=0?[[s.a[0],s.a[1]],[s.b[0],s.b[1]]]:[[s.b[0],s.b[1]],[s.a[0],s.a[1]]],r=n[0]-a[0],l=n[1]-a[1],f=Math.hypot(r,l);if(!(f>h))continue;const b=r/f,v=l/f,y=ht(e.rooms,c,i,o.pitch,o.cellCm,o.gridPitch,o.coordScale),$=y.flatMap(t=>{if(t.open||"outer"!==t.kind&&"shared"!==t.kind)return[];const e=hl(a,n,t.a,t.b,h);return e?[{interval:t,range:e}]:[]});if(!$.length)continue;const w=p.filter(t=>"partition"===t.host?.kind&&t.host.id===s.id).map(t=>({opening:t,resolved:rt(t,e.partitions,o.coordScale,o.cellCm,o.gridPitch).resolved}));if(w.some(t=>!t.resolved))continue;const k=[0,f];for(const{range:t}of $)k.push(t.lo,t.hi);const x=k.slice(),S=new Map;for(const{opening:t,resolved:e}of w){const s=ll(e.center,a,b,v),i={lo:s-e.length/2,hi:s+e.length/2};S.set(t.id,i),x.push(Math.max(0,i.lo),Math.min(f,i.hi))}const M=[...new Set(x.filter(t=>Number.isFinite(t)&&t>=-h&&t<=f+h).map(t=>Math.max(0,Math.min(f,t)).toFixed(9)))].map(Number).sort((t,e)=>t-e),C=d.map(t=>ml(t,o.coordScale)).filter(t=>t.id!==s.id),P=[];for(let t=0;t+1h))continue;const r=rl(a,b,v,i),l=rl(a,b,v,n),c=$.filter(({range:t})=>t.lo<=i+h&&t.hi>=n-h).map(({interval:t})=>t),d=new Map;for(const t of c)d.set(t.roomId,t);const p=[...d.values()],u=new Set(p.map(t=>t.kind)),_=new Set(p.map(t=>o.allowCoincidentPartitions||t.cm>0?t.cm:ct)),m=p[0]?.kind,g=[...d.keys()].sort(),f=1===u.size&&1===_.size&&("outer"===m&&1===g.length||"shared"===m&&2===g.length),y={id:s.id,a:r,b:l,cm:s.cm},w=C.some(t=>!!hl(r,l,t.a,t.b,h)),k=f&&(o.allowCoincidentPartitions||!w)&&!pl(y,e.wall_columns,o,h),x=f?o.allowCoincidentPartitions||p[0].cm>0?p[0].cm:ct:0,S=f?Math.max(x,s.cm):s.cm;P.push({lo:i,hi:n,a:r,b:l,safe:k,signature:k?`${m}|${g.join(",")}|${S}`:"",roomIds:g,roomCm:x,finalCm:S})}if(!P.some(t=>t.safe))continue;const D=new Map;for(const{opening:t,resolved:e}of w){const i=S.get(t.id),a=k.some(t=>t>i.lo+h&&tcl(t,i,h)),r=new Set(n.filter(t=>t.safe).map(t=>t.signature));if(!a&&n.length>0&&n.every(t=>t.safe)&&1===r.size&&dt(e,y,h)){D.set(t.id,{resolved:e,signature:[...r][0]});continue}const l=pt(s,o.cellCm,o.gridPitch),c={lo:i.lo-l,hi:i.hi+l};for(const t of P)cl(t,c,h)&&(t.safe=!1,t.signature="")}let I=!0;for(;I;){I=!1;for(const[t,e]of[...D.entries()]){const i=S.get(t),a=P.filter(t=>cl(t,i,h));if(a.length>0&&a.every(t=>t.safe)&&a.every(t=>t.signature===e.signature))continue;D.delete(t);const n=pt(s,o.cellCm,o.gridPitch),r={lo:i.lo-n,hi:i.hi+n};for(const t of P)cl(t,r,h)&&(t.safe=!1,t.signature="");I=!0}}const T=fl(P,h),z=T.filter(t=>t.safe),R=T.filter(t=>!t.safe);if(!z.length)continue;if(d.length-1+R.length>2e3)continue;let A=c;for(const t of z){const[e,i]=nl(s.a,s.b)<=0?[t.a,t.b]:[t.b,t.a];A=ut(A,e,i,t.finalCm,o.pitch,o.coordScale)}if(A=_t(e.rooms,A,i,o.pitch,o.cellCm,o.gridPitch,o.coordScale),A.length>500)continue;const F=new Set(d.map(t=>t.id));F.delete(s.id);const N=R.map((t,e)=>{const i=[t.a[0]/o.coordScale,t.a[1]/o.coordScale],a=[t.b[0]/o.coordScale,t.b[1]/o.coordScale],n=0===e?s.id:gl(s.id,i,a,F);return F.add(n),{id:n,a:i,b:a,cm:s.cm}}),E=d.findIndex(t=>t.id===s.id),H=d.slice();H.splice(E,1,...N);const O=H.map(t=>ml(t,o.coordScale)),L=new Map;let B=!0;for(const{opening:t,resolved:e}of w){const s=D.get(t.id);if(s){const e=lt(t,s.resolved,o.coordScale),{host:i,...a}=e;L.set(t.id,a);continue}const i=S.get(t.id),a=N[R.findIndex(t=>t.lo<=i.lo+h&&t.hi>=i.hi-h)],n=a&&O.find(t=>t.id===a.id);if(!a||!n){B=!1;break}const r=n.b[0]-n.a[0],l=n.b[1]-n.a[1],c=Math.hypot(r,l),d=ll(e.center,n.a,r/c,l/c),p={...lt(t,e,o.coordScale),host:{kind:"partition",id:a.id,t:d/c}};if(!mt(p,O,o.coordScale,o.cellCm,o.gridPitch).resolved){B=!1;break}L.set(t.id,p)}if(!B)continue;const W=p.map(t=>L.get(t.id)||t),j=[...D.keys()].map(t=>L.get(t)),G=j.map(t=>ul(t,O,o));if(G.some(t=>!t))continue;let q=!1;for(let t=0;tt.id));for(const t of W){if(U.has(t.id))continue;const e=ul(t,O,o);e&&G.some(t=>_l(t,e,h))&&(q=!0)}if(q)continue;const K=gt(e.rooms,A,i,o.pitch,o.cellCm,o.gridPitch,o.coordScale);[...D.entries()].every(([t,e])=>{const s=L.get(t),i=ft(K,{x:s.x*o.coordScale,y:s.y*o.coordScale,angle:s.angle,length:s.length*o.coordScale},!0),a=[i.negative,i.positive].filter(t=>!!t?.full),n=e.signature.split("|")[1].split(","),r=new Set(a.map(t=>t.roomId));return a.length===n.length&&r.size===n.length&&n.every(t=>r.has(t))})&&(c=A,d=H,p=W,u+=z.length,_+=D.size)}return{walls:c,partitions:d,openings:p,partitionsReconciled:u,openingsRehosted:_}}const vl=t=>JSON.parse(JSON.stringify(t)),yl=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),$l=(t,e)=>e.length>0&&e.length<=35&&("space"===t?/^[a-z0-9_-]+$/.test(e):/^[A-Za-z0-9_-]+$/.test(e));function wl(t,e){let s=String(e??"");const i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`^${i}_(.+)_([0-9a-f]{8})$`);let a=0;for(;a<16;a++){const t=o.exec(s);if(!t)return{root:s,layers:a,bounded:!1};s=t[1]}return{root:s,layers:a,bounded:o.test(s)}}const kl=(t,e,s)=>{const i=t.get(e)||[];i.push(s),t.set(e,i)};const xl=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Sl=(t,e,s)=>Math.min(s,Math.max(e,t)),Ml=t=>Tt({spaces:[t]})[0],Cl=(t,e,s)=>{const i=s>0?s:1,o=t=>`${(t[0]/i).toFixed(12)},${(t[1]/i).toFixed(12)}`,a=o(t),n=o(e);return a0?n:1,l=Math.max(i*r*.02,1e-9),h=[];for(const e of t||[])for(const t of H(e)||[])h.push([t[0],t[1]]);const c=[];for(const t of s||[])Array.isArray(t)&&t.length>=4&&t.slice(0,4).every(Number.isFinite)&&c.push([t[0],t[1]],[t[2],t[3]]);const d=(t,e)=>e.some(e=>Math.hypot(t[0]-e[0],t[1]-e[1])<=2*l),p=new Map;for(const n of t||[]){if(!n?.id)continue;const u=Z(t,n.id,e,s,i,o,a,r);if(u)for(let t=0;t0&&_>0&&n===m&&_!==n))continue;const g=u.poly[i],f=u.poly[(i+1)%u.poly.length],b=Math.hypot(f[0]-g[0],f[1]-g[1]);if(!(b>l&&b<.5*a-1e-9*a))continue;if(d(g,c)||d(f,c))continue;if(d(g,h)&&d(f,h))continue;const v=Cl(g,f,r),y=p.get(v);y?y.targets.add(n):p.set(v,{a:[g[0],g[1]],b:[f[0],f[1]],targets:new Set([n])})}}}let u=e.slice();const _=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1])<=2*l,m=(t,e)=>{if(!Array.isArray(t.a)||!Array.isArray(t.b)||t.a.length<2||t.b.length<2)return!1;const s=[Number(t.a[0])*r,Number(t.a[1])*r],i=[Number(t.b[0])*r,Number(t.b[1])*r];return!![...s,...i].every(Number.isFinite)&&(_(s,e.a)&&_(i,e.b)||_(s,e.b)&&_(i,e.a))};for(const t of[...p.values()].filter(t=>1===t.targets.size).sort((t,e)=>Cl(t.a,t.b,r).localeCompare(Cl(e.a,e.b,r)))){const e=[...t.targets][0],s=u.filter(e=>m(e,t));if(new Set(s.map(t=>t.cm)).size>1)continue;let o=!1;u=u.map(s=>m(s,t)?(o=!0,s.cm===e?s:{...s,cm:e}):s),o||(u=ut(u,t.a,t.b,e,i,r))}return u}const Dl=t=>{const e=[];for(const s of t||[]){const t=H(s);if(t?.length)for(let s=0;s"string"==typeof t?.id?t.id:"").filter(Boolean),c=new Set(h),d=new Map;for(const t of h){const e=wl("space",t);e.layers>0&&$l("space",e.root)&&kl(d,e.root,t)}const p=new Map,u=new Map,_=new Map,m=new Map;for(const t of r){const e="string"==typeof t?.id?t.id:"";if(!e)continue;const s=new Map;for(const i of Array.isArray(t.rooms)?t.rooms:[]){const t="string"==typeof i?.id?i.id:"";if(!t)continue;const o=wl("room",t);o.layers>0&&$l("room",o.root)&&kl(s,o.root,t),u.has(t)||u.set(t,e),_.has(t)||_.set(t,String(i.name||""));const a="string"==typeof i.area?i.area:"";if(a){const s=m.get(a)||[];s.push({spaceId:e,roomId:t}),m.set(a,s)}}p.set(e,s)}const g=new Set(u.keys()),f=new Map,b=new Map;for(const t of l)"string"==typeof t?.id&&t.id&&(!0===t.removed?b.set(t.id,t):f.set(t.id,t));const v={spaceRefsRemapped:0,roomRefsRemapped:0,positionsRemapped:0,markersDetached:0,positionsUnresolved:0,nestedRefsUnresolved:0,deadSpaceIds:[],orphanRoomLabelsRemoved:0,orphanDevicePositionsRemoved:0,orphanGroupPositionsRemoved:0,liveMissingPositionsRemoved:0,removedPositions:[],liveMissingPositions:[],unverifiedPositions:[]},y=new Set,$=t=>c.has(t)?null:(()=>{const e=wl("space",t).root;if(!$l("space",e))return null;const s=d.get(e)||[];return 1===s.length?s[0]:null})(),w=(t,e)=>{const s=wl("room",t).root;if(!$l("room",s))return null;const i=p.get(e)?.get(s)||[];return 1===i.length?i[0]:null},k=t=>{const e=s.effectiveAreaByMarker?.[t]||"",i=e&&m.get(e)||[];return 1===i.length?i[0]:null},x=(t,e,s)=>{if("string"==typeof t.room_id&&t.room_id&&!g.has(t.room_id)){const i=e?w(t.room_id,e):null;i?(t.room_id=i,v.roomRefsRemapped++):s?(t.room_id=s.roomId,v.roomRefsRemapped++):!0!==t.removed&&delete t.room_id}const i=t.vacuum?.segment_map;if(i&&"object"==typeof i&&!Array.isArray(i))for(const t of Object.keys(i)){const s=i[t];if("string"!=typeof s||!s||g.has(s))continue;const o=e?w(s,e):null;o?(i[t]=o,v.roomRefsRemapped++):v.nestedRefsUnresolved++}};for(const t of l){const e="string"==typeof t?.id?t.id:"";if(!e)continue;const s="string"==typeof t.space?t.space:"",i=s&&!c.has(s),a=o[e],n="string"==typeof a?.s?a.s:"",r=n&&!c.has(n),l=!0===t.removed;let h=s&&c.has(s)?s:null,d=null,p=!1;if(i){const i=$(s);i?(t.space=i,h=i,p=!0,v.spaceRefsRemapped++):l||"virtual"===t.binding?l||(delete t.space,h=null,v.markersDetached++):(d=k(e),d?(t.space=d.spaceId,h=d.spaceId,v.spaceRefsRemapped++):(delete t.space,h=null,v.markersDetached++))}l&&!p||x(t,h,d),r&&p&&n===s&&h&&(o[e]={...a,s:h},v.positionsRemapped++,y.add(e))}for(const t of Object.keys(o)){if(y.has(t))continue;const e=o[t],s="string"==typeof e?.s?e.s:"";if(!s||c.has(s))continue;const i=$(s);if(i){if(t.startsWith("rl_")){const s=t.slice(3),a=w(s,i);if(a){const s=`rl_${a}`;yl(o,s)||(o[s]={...e,s:i}),delete o[t],v.roomRefsRemapped++,v.positionsRemapped++;continue}}o[t]={...e,s:i},v.positionsRemapped++}}const S=s.ownerRoster,M=!0===S?.authoritative,C=new Set(S?.deviceIds||[]),P=new Set(S?.entityIds||[]),D=new Set(Array.isArray(i.settings?.known_devices)?i.settings.known_devices.filter(t=>"string"==typeof t):[]),I=(t,e="")=>{const s=String(S?.names?.[t]||e||"").trim();return s&&s!==t?s:""},T=(t,e,s,i="",o)=>({id:t,spaceId:e,kind:s,name:I(t,i),...o?{reason:o}:{}}),z=t=>{"room_label"===t?v.orphanRoomLabelsRemoved++:"group"===t?v.orphanGroupPositionsRemoved++:v.orphanDevicePositionsRemoved++},R=new Set;for(const[t,e]of Object.entries(o)){const i="string"==typeof e?.s?e.s:"";if(!i||c.has(i))continue;let a,n;const r=f.get(t),l=b.get(t);if(r)a=T(t,i,"device",String(r.name||"")),n="live";else if(l)a=T(t,i,"device",String(l.name||"")),n="absent";else if(t.startsWith("rl_")){const e=t.slice(3);a=T(t,i,"room_label",_.get(e)||""),n=g.has(e)?"live":"absent"}else if(t.startsWith("lg_")){const e=t.slice(3);a=T(t,i,"group"),n=P.has(e)?"live":M?"absent":"unverified","unverified"===n&&(a.reason="registry_unavailable")}else C.has(t)?(a=T(t,i,"device"),n="live"):D.has(t)?(a=T(t,i,"device"),n=M?"absent":"unverified","unverified"===n&&(a.reason="registry_unavailable")):(a=T(t,i,"unknown","","unknown_owner"),n="unverified");if("absent"!==n){if("live"===n){if(v.liveMissingPositions.push(a),!0===s.removeLiveMissingPositions){delete o[t],v.liveMissingPositionsRemoved++,z(a.kind),v.removedPositions.push(a);continue}}else v.unverifiedPositions.push(a);v.positionsUnresolved++,R.add(i)}else delete o[t],z(a.kind),v.removedPositions.push(a)}return v.deadSpaceIds=[...R].sort((t,e)=>t.localeCompare(e)),{config:i,layout:o,report:v,changed:JSON.stringify(i)!==a||JSON.stringify(o)!==n}}(t,e,s),n=a.config,r=bt(n,a.layout);E(n),vt(a.layout);const l=JSON.stringify(t||{}),h=JSON.stringify(e||{}),c=Number.isInteger(Number(n.model_version))?Number(n.model_version):0,d=(t=>{let e=0,s=0,i=0;for(const s of t.markers||[]){if("ripple"===s.display&&(s.display="icon_ripple",e++),Array.isArray(s.controls)){const t="string"==typeof s.binding&&s.binding.startsWith("entity:")?s.binding.slice(7):"",i=t?s.controls.filter(e=>e!==t):s.controls;JSON.stringify(i)!==JSON.stringify(s.controls)&&(s.controls=i.length?i:null,e++)}const t=s.vacuum;t&&xl(t,"trail")&&(["never","cleaning","always"].includes(t.trail_mode)||(t.trail_mode=!1===t.trail?"never":"cleaning"),delete t.trail,e++)}for(const o of t.spaces||[]){const t=o.settings;"glow"===t?.fill_mode&&("boolean"!=typeof t.glow_enabled&&(t.glow_enabled=!0),t.fill_mode="none",e++,s++);for(const t of o.rooms||[]){const s=t.settings;"glow"===s?.fill_mode&&("boolean"!=typeof s.glow&&(s.glow=!0),delete s.fill_mode,e++,i++)}if(xl(o,"segments")&&(delete o.segments,e++),xl(o,"plan_scale")){const t=Number(o.plan_scale);Number.isFinite(t)&&t>=St&&t<=Mt&&(xl(o,"plan_scale_x")||(o.plan_scale_x=t),xl(o,"plan_scale_y")||(o.plan_scale_y=t),delete o.plan_scale,e++)}const a=Number(o.cell_cm);xl(o,"cell_cm")&&(!Number.isFinite(a)||a<.1||a>1e3)&&(o.cell_cm=Number.isFinite(a)&&a>0?Sl(a,.1,1e3):5,e++);const n=Number(o.cell_cm),r=Number.isFinite(n)&&n>0?n:5;for(const t of o.wall_columns||[])if("circle"===t.shape)xl(t,"angle")&&(delete t.angle,e++);else if("square"===t.shape&&xl(t,"angle")){const s=((Number(t.angle)||0)%90+90)%90;t.angle!==s&&(t.angle=s,e++)}for(const t of o.decor||[]){if(xl(t,"width")){const s=Number(t.width);(xl(t,"width_cm")||Number.isFinite(s))&&(xl(t,"width_cm")||(t.width_cm=Number(Sl(s/kt*r,.1,100).toFixed(6))),delete t.width,e++)}if("rect"!==t?.kind&&"ellipse"!==t?.kind||!0!==t.fill||(xl(t,"fill_color")||(t.fill_color=t.color||"#607d8b",e++),xl(t,"fill_opacity")||(t.fill_opacity=.25,e++)),"text"!==t?.kind)continue;void 0===t.size_cm?(t.size_cm=Number(Sl(Ct*Pt(t)/kt*r,.1,2e3).toFixed(6)),delete t.scale,delete t.size,e++):(xl(t,"scale")||xl(t,"size"))&&(delete t.scale,delete t.size,e++);let s=String(t.text??"");const i=[...s.matchAll(/\{([^{}\r\n]+)\}/g)].some(t=>!!Dt(t[1]));if(!(xl(t,"entity")||xl(t,"attr")||xl(t,"unit")))continue;const o=String(t.unit??"").trim(),a="state"===String(t.attr??"").trim().toLowerCase()?null:t.attr,n=i||o?"":It(t.entity,a);if(i||n){if(n){const e=s.indexOf("{}");s=e>=0?s.slice(0,e)+n+s.slice(e+2):`${s}${s?" ":""}${n}`,t.text=s}delete t.entity,delete t.attr,delete t.unit,e++}}}return{total:e,glowSpaces:s,glowRooms:i}})(n);let u=d.total,_=0,m=0,g=0;if(c<10)for(const t of Array.isArray(n.spaces)?n.spaces:[]){const e=Bn(t);m+=e.drafts,g+=e.segments}const f=(b=n.spaces||[],JSON.parse(JSON.stringify(b)));var b;const v=Jr(n.spaces||[],a.layout);let y=0,$=0,w=0,k="";const x=v.spaces.map(t=>{const e=yt(t);y+=e.report.wallsStraightened,$+=e.report.wallsStraightenSkipped;const s=Number(t?.cell_cm)>0?Number(t.cell_cm):5,i=e.report.maxStraightenShift/N*s;return i>w&&(w=i,k=String(t?.id||"")),e.space}),S=y?Jr(x,v.layout):{...v,spaces:x};n.spaces=S.spaces;const M=y?{...v.report,moved:v.report.moved+S.report.moved,coordsCanonicalized:v.report.coordsCanonicalized+S.report.coordsCanonicalized,maxShift:Math.max(v.report.maxShift,S.report.maxShift),maxShiftCm:Math.max(v.report.maxShiftCm,S.report.maxShiftCm),maxSpace:S.report.maxShiftCm>v.report.maxShiftCm?S.report.maxSpace:v.report.maxSpace,rotated:v.report.rotated+S.report.rotated}:{...v.report};let C=0,P=0,D=0,I=0,T=0,z=0,R=0;for(let t=0;t0===Number(t.cm)),walls:e.walls||[]}),a=Ml(e),r=Ml(s);if(!a||!r)continue;const l=Dl(a.rooms),h=Dl(r.rooms),c=.02*kt,d=(e.wall_segments||[]).filter(t=>0===Number(t.cm)).map(t=>({...t,key:O(t.a,t.b,N),cm:0})),u=new Set(d.map(t=>t.key)),_=$t(e,a.rooms,p,c);P+=_.length;for(const t of _){const e=[t[0]/p,t[1]/p],s=[t[2]/p,t[3]/p],i=O(e,s,N);u.has(i)||(u.add(i),d.push({key:i,a:e,b:s,cm:0}))}const m=d.length,g=wt(d,l,h,N,p),b=(t,e,s)=>{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o;if(!(a>0))return Math.hypot(t[0]-e[0],t[1]-e[1]);const n=Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a));return Math.hypot(t[0]-(e[0]+i*n),t[1]-(e[1]+o*n))},v=g.filter(t=>{if(!Array.isArray(t.a)||!Array.isArray(t.b))return!1;const e=t.a.map(t=>t*p),s=t.b.map(t=>t*p);return h.some(([t,i])=>b(e,t,i)<=4*c&&b(s,t,i)<=4*c)});D+=Math.max(0,m-v.length);const y=(s.wall_segments||[]).filter(t=>Number(t.cm)>0);s.wall_segments=[...y,...v.map(({key:t,...e})=>e)];const $=v.map(t=>[t.a[0]*p,t.a[1]*p,t.b[0]*p,t.b[1]*p]),w=Array.isArray(e.walls)?e.walls.length:0;let k=wt(e.walls,l,h,N,p);k=Pl(r.rooms,k,$,N,Number(s.cell_cm)>0?Number(s.cell_cm):5,kt,p),k=_t(r.rooms,k,$,N,Number(s.cell_cm)>0?Number(s.cell_cm):5,kt,p),k=xt(k,s.rooms||[],N,1,$.map(t=>[t[0]/p,t[1]/p,t[2]/p,t[3]/p])),C+=Math.max(0,w-k.length),k.length?s.walls=k:delete s.walls;const x=sl(s.partitions||[],{pitch:N,geometry:ol(s)});x.merged&&(I+=x.merged,s.partitions=x.partitions,il(s.openings,s.partitions,x.openingMoves,{coordScale:p,cellCm:Number(s.cell_cm)>0?Number(s.cell_cm):5,gridPitch:kt}));const S=Ml(s);if(S){const t=o(s,S,s.walls||[],$,{pitch:N,cellCm:Number(s.cell_cm)>0?Number(s.cell_cm):5,gridPitch:kt,coordScale:p});t.partitionsReconciled&&(T+=t.partitionsReconciled,z+=t.openingsRehosted,t.partitions.length?s.partitions=t.partitions:delete s.partitions,t.openings.length?s.openings=t.openings:delete s.openings,t.walls.length?s.walls=t.walls:delete s.walls)}JSON.stringify({zero:(s.wall_segments||[]).filter(t=>0===Number(t.cm)),walls:s.walls||[]})!==i&&R++}if(c<=10){const t=function(t){const e=jn(t);return qn(t,e.config),{...e,config:t}}(n);_+=t.migratedSegments,m+=t.migratedDrafts,g+=t.migratedDraftSegments}const A=E(n),F=vt(S.layout),H=JSON.stringify(A)!==l||JSON.stringify(F)!==h;c<10&&H&&(A.model_version=10);const L=JSON.stringify(A)!==l||JSON.stringify(F)!==h,B=Number.isInteger(Number(A.model_version))?Number(A.model_version):c,W=L?M:{...M,moved:0,coordsCanonicalized:0,maxShift:0,maxShiftCm:0,maxSpace:"",rotated:0},j=L?a.report:{...a.report,spaceRefsRemapped:0,roomRefsRemapped:0,positionsRemapped:0,markersDetached:0,orphanRoomLabelsRemoved:0,orphanDevicePositionsRemoved:0,orphanGroupPositionsRemoved:0,liveMissingPositionsRemoved:0};return{config:A,layout:F,report:{...W,modelFrom:c,modelTo:B,migrated:L?u:0,glowSpacesMigrated:L?d.glowSpaces:0,glowRoomsMigrated:L?d.glowRooms:0,canonicalized:L?R:0,wallSegmentsMigrated:L?_:0,roomDraftsMigrated:L?m:0,roomDraftSegmentsMigrated:L?g:0,legacyZeroWallsMigrated:L?P:0,wallsMerged:L?C:0,spansMerged:L?D:0,partitionsMerged:L?I:0,partitionsReconciled:L?T:0,openingsRehosted:L?z:0,wallsStraightened:L?y:0,wallsStraightenSkipped:$,maxStraightenShiftCm:L?w:0,maxStraightenSpace:L?k:"",latticeCoordinatesCanonicalized:L?r.canonicalized:0,latticeCoordinatesFar:L?r.far:0,latticeMaxShift:L?r.maxShift:0,latticeMaxShiftCm:L?r.maxShiftCm:0,latticeSpaces:L?r.spaces:[],...j},changed:L}}const Tl=Object.freeze({spaces:50,partitions:2e3,openings:500,decor:1e3,columns:500});class zl extends Error{constructor(t){super(t),this.code=t,this.name="SpaceCopyError"}}const Rl=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Al=t=>void 0===t?t:JSON.parse(JSON.stringify(t)),Fl=t=>null===t||"object"!=typeof t||Array.isArray(t)?null:t;function Nl(t,e=!1){if(void 0===t&&!e)return[];if(!Array.isArray(t))throw new zl("source_invalid");return t.map(t=>{const e=Fl(t);if(!e||"string"!=typeof e.id||!e.id)throw new zl("source_invalid");return e})}const El=t=>Array.isArray(t)&&2===t.length&&t.every(t=>Number.isFinite(t));function Hl(t,e,s){const i=String(t??"").trim()||s,o=new Set(e.map(t=>{const e=Fl(t);return String(e?.title??"").trim()}));let a=2;for(;o.has(`${i} (${a})`);)a++;return`${i} (${a})`}const Ol=["settings","zero_wall_style","cell_cm","view_box","plan_url","plan_aspect","plan_x","plan_y","plan_scale","plan_scale_x","plan_scale_y","plan_angle"];const Ll={source_missing:"space.copy_error_source_missing",source_invalid:"space.copy_error_source_invalid",spaces_limit:"space.copy_error_spaces_limit",partitions_limit:"space.copy_error_partitions_limit",openings_limit:"space.copy_error_openings_limit",decor_limit:"space.copy_error_decor_limit",columns_limit:"space.copy_error_columns_limit",opening_host_missing:"space.copy_error_opening_host",opening_host_unknown:"space.copy_error_opening_host",geometry_unsafe:"space.copy_error_geometry"};let Bl=0;function Wl(t,e,s){const i=t._spaceDialog;return!(!i?.copy||i.copy.token!==e)&&(t._spaceDialog={...i,busy:s,copy:{...i.copy,busy:s}},!0)}function jl(t){t._cfgEpoch++,t._modelCache=null,t._frame=null,t._regSignature="",t._maybeRebuildDevices(),t.requestUpdate()}async function Gl(t,e){const s=t._spaceDialog;if(!s?.copy||"edit"!==s.mode||s.busy||s.copy.busy||!s.copy.title.trim()||!s.spaceId||!t._serverCfg)return;const i=++Bl,o=s.spaceId,a=s.copy.title.trim();t._spaceDialog={...s,busy:!0,copy:{...s.copy,title:a,busy:!0,token:i}};let n=!1;try{if(t._saveConfigDebounced.pending()&&t._saveConfigDebounced.flush(),await t._writeChain,!Wl(t,i,!0)||!t._serverCfg)return;const s=t._cfgRev,r=t._layoutRev,l=zt(t._serverCfg),h=zt(t._layout);let c;try{c=(e.optimize??Il)(t._serverCfg,t._layout,e.optimizeReferenceContext())}catch(s){return Wl(t,i,!1),void e.showWallModelMigrationBlocked(s)}if(c.changed){const d=t._checkOptimizeGeometry(c.config);if(e.reportPreflightFailure(d,c.config),!d.ok)return Wl(t,i,!1),void t._showToast(t._t("space.copy_error_optimize_geometry"));const p=await t._confirmDanger({key:`copy-space:${o}`,kind:"warning",title:t._t("space.copy_optimize_title"),message:t._t("space.copy_optimize_body",{name:a}),objectName:a,confirmLabel:t._t("space.copy_optimize_confirm"),cancelLabel:t._t("btn.cancel"),icon:"mdi:broom"});if(!Wl(t,i,p))return;if(!p)return;if(t._cfgRev!==s||t._layoutRev!==r||!t._serverCfg||zt(t._serverCfg)!==l||zt(t._layout)!==h)return Wl(t,i,!1),void t._showToast(t._t("space.copy_error_changed"));e.clearGeometryGesture(),await Br(t,c.config,c.layout),n=!0}if(!Wl(t,i,!0)||!t._serverCfg)return;const d=t._serverCfg,p=function(t,e,s,i){const o=t.spaces;if(!s.trim())throw new zl("source_invalid");if(o.length>=Tl.spaces)throw new zl("spaces_limit");const a=o.findIndex(t=>t.id===e);if(a<0)throw new zl("source_missing");const n=o[a];if(!Array.isArray(n.view_box))throw new zl("source_invalid");const r=Nl(n.wall_segments,!0),l=Nl(n.partitions),h=Nl(n.openings),c=Nl(n.decor),d=Nl(n.wall_columns);if(r.length+l.length>Tl.partitions)throw new zl("partitions_limit");if(h.length>Tl.openings)throw new zl("openings_limit");if(c.length>Tl.decor)throw new zl("decor_limit");if(d.length>Tl.columns)throw new zl("columns_limit");let p=0;const u=t=>`${t}${i}${(p++).toString(36)}`,_=new Map,m=new Map,g=[];for(const t of r){if(_.has(t.id)||!El(t.a)||!El(t.b)||"number"!=typeof t.cm||!Number.isFinite(t.cm))throw new zl("source_invalid");const e=u("cw");_.set(t.id,e),g.push({id:e,a:Al(t.a),b:Al(t.b),cm:t.cm})}for(const t of l){if(m.has(t.id)||!El(t.a)||!El(t.b)||"number"!=typeof t.cm||!Number.isFinite(t.cm))throw new zl("source_invalid");const e=u("cp");m.set(t.id,e),g.push({id:e,a:Al(t.a),b:Al(t.b),cm:t.cm})}const f=h.map(t=>{const e=Fl(t.host);if(!e||"string"!=typeof e.id||"string"!=typeof e.kind)throw new zl("opening_host_missing");const s="wall"===e.kind?_.get(e.id):"partition"===e.kind?m.get(e.id):void 0;if(!s)throw new zl("opening_host_unknown");const i={...Al(t),id:u("co"),host:{...Al(e),kind:"partition",id:s}};return delete i.contact,delete i.lock,i}),b=c.map(t=>({...Al(t),id:u("cd")})),v=d.map(t=>({...Al(t),id:u("cc")})),y=`s${i}`;if(o.some(t=>t.id===y))throw new zl("source_invalid");const $={id:y,title:s.trim(),rooms:[],wall_segments:[],view_box:Al(n.view_box)};for(const t of Ol)"view_box"!==t&&Rl(n,t)&&($[t]=Al(n[t]));g.length&&($.partitions=g),f.length&&($.openings=f),b.length&&($.decor=b),v.length&&($.wall_columns=v);const w=Al(t);return w.spaces.splice(a+1,0,$),{config:w,space:$,sourceIndex:a}}(d,o,a,e.newSeed?.()??function(t=Date.now(),e=Math.random()){const s=Math.floor(16777216*Math.max(0,Math.min(.999999999,e))).toString(36).padStart(5,"0");return`${Math.max(0,Math.floor(t)).toString(36)}${s}`}());let u=!1;try{u=t._checkSpacePhysicalGeometry(p.config,p.space.id).ok}catch{u=!1}if(!u||t._junctionLimitViolations(p.config,p.space.id).length)throw new zl("geometry_unsafe");const _=t._adoption.beginOptimistic(d,p.config);t._adoption.stageLocalConfig(p.config),jl(t);try{await e.saveConfigNow(_)}catch(e){throw t._rollbackOptimistic(_)&&jl(t),"conflict"!==e?.code&&await t._reloadConfigOnly(!0),e}t._canOptimizeUndo=!1,t._undoKind=null,e.clearGeometryGesture(),t._selId=null,t._physicalSel=null,t._spaceDialog=null,t._commitSpace(p.space.id,!0),e.setMode("plan"),t._tool="draw",t._path=[],t._cursorPt=null,t._activeWallChainId=null,t._activeWallChainPartitionIds=[],t._primeDrawWallField(),t._saveNav(),t.requestUpdate(),t._showToast(t._t("toast.space_copied",{name:a}))}catch(e){"conflict"===e?.code&&await Promise.all([t._reloadConfigOnly(!0),t._reloadLayoutOnly()]),Wl(t,i,!1),function(t,e){if(e instanceof zl)return void t._showToast(t._t(Ll[e.code]));const s=e?.code;"wall_model_client_outdated"!==s?t._showToast(t._t("toast.error",{err:t._errText(e)})):t._showToast(t._t("toast.wall_model_client_outdated"))}(t,e),n&&t.requestUpdate()}}const ql=new Set(["group","template","derivative","min_max","threshold","integration","statistics","trend","utility_meter","tod","switch_as_x","schedule"]);function Ul(t){const{hass:e,devices:s,markers:i,showEntities:o,currentBinding:a,currentDeviceId:n,labels:r}=t,l=Rt(i),h=new Set(i.filter(t=>t.removed).map(t=>t.binding)),c=new Set;for(const t of s)t.id!==n&&("device"===t.bindingKind&&t.bindingRef&&c.add(`device:${t.bindingRef}`),"entity"===t.bindingKind&&t.bindingRef&&c.add(`entity:${t.bindingRef}`));const d=new Set;for(const t of s)"device"===t.bindingKind&&t.name&&d.add(`${t.name.trim()}|${t.area||""}`);const p=[];for(const t of Object.values(e?.devices||{})){if(!t||"service"===t.entry_type)continue;const e=`device:${t.id}`;if(c.has(e))continue;const s=String(t.name_by_user||t.name||t.id).trim();e!==a&&!h.has(e)&&d.has(`${s}|${t.area_id||""}`)||p.push({value:e,label:s,sub:(t.model||r.device)+("Group"===t.model?r.z2mGroup:""),kind:"device",ref:t.id,areaId:t.area_id||"",model:t.model||""})}for(const[t,s]of Object.entries(e?.entities||{})){const i=`entity:${t}`;if(c.has(i))continue;if(At(e,t,l)&&!h.has(i))continue;const o=ql.has(s?.platform),a="group"===s?.platform;if(!o&&!a)continue;if(s?.hidden&&!h.has(i))continue;const n=e?.states?.[t];p.push({value:i,label:s?.name||n?.attributes?.friendly_name||t,sub:`${t.split(".")[0]} · ${a?r.group:r.helper}`,kind:"entity",ref:t,areaId:s?.area_id||s?.device_id&&e?.devices?.[s.device_id]?.area_id||"",model:"",parentDeviceId:s?.device_id||void 0})}if(o){const t=new Set(p.map(t=>t.value));for(const[s,i]of Object.entries(e?.entities||{})){const o=`entity:${s}`;if(c.has(o)||t.has(o)||i?.hidden&&!h.has(o))continue;const a=!!i?.device_id&&l.devices.has(i.device_id);if(At(e,s,l)&&!h.has(o)&&!a)continue;const n=e?.states?.[s],d=i?.device_id?e?.devices?.[i.device_id]:null,u=d?String(d.name_by_user||d.name||""):"";p.push({value:o,label:i?.name||n?.attributes?.friendly_name||s,sub:`${s.split(".")[0]} · ${r.entity}${u?` · ${u}`:""}`,kind:"entity",ref:s,areaId:i?.area_id||d?.area_id||"",model:"",parentDeviceId:i?.device_id||void 0})}}return p.sort((t,e)=>t.label.localeCompare(e.label)||t.value.localeCompare(e.value))}const Kl={kind:"active",enabledEntityIds:[],allEntityIds:[]};function Vl(t){return t.startsWith("entity:")?"entity":"device"}function Jl(t){const e=t.binding.indexOf(":"),s=e>=0?t.binding.slice(e+1):"",i=Object.keys(t).filter(t=>!["id","binding","hidden"].includes(t));return t.id===`h${s}`&&0===i.length}const Yl=new Set(["ld2450","hlkld2450","hilinkld2450"]),Xl=()=>globalThis.crypto?.randomUUID?.()||`radar_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`,Zl=(t,e,s)=>{const i=!!t?.original;return{radar:i?t:null,radarEligible:i,radarTouched:i?e:e||!!t,radarRemove:i?s:s||!!t}},Ql=(t,e="")=>"number"==typeof t&&Number.isFinite(t)?String(t):e,th=t=>Array.from(new Set([...t.allEntities||t.entities||[],..."entity"===t.bindingKind&&t.bindingRef?[t.bindingRef]:[]])).filter(t=>/^[a-z0-9_]+\.[a-z0-9_]+$/.test(t)),eh=(t,e,s)=>{const i=t.split(".",2)[1]||"";return new RegExp(`(?:^|_)target_?${s}_${e}(?:_|$)`).test(i)||new RegExp(`(?:^|_)target_${e}_${s}(?:_|$)`).test(i)};function sh(t,e){if(t.marker?.radar&&"object"==typeof t.marker.radar)return Ft(t.marker.radar)?{eligible:!0,profile:t.marker.radar.profile,reason:"saved"}:{eligible:!0,profile:"presence_v1",reason:"saved_unsupported"};const s="entity"===t.bindingKind?e?.entities?.[t.bindingRef||""]:null,i="device"===t.bindingKind?t.bindingRef:s?.device_id,o=i?e?.devices?.[i]:null,a=th(t);return Yl.has((n=o?.model||t.model,String(n||"").toLowerCase().replace(/[^a-z0-9]/g,"")))&&a.some(t=>eh(t,"x",1))&&a.some(t=>eh(t,"y",1))?{eligible:!0,profile:"esphome_ld2450_v1",reason:"ld2450"}:{eligible:!1,profile:"presence_v1",reason:"none"};var n}function ih(t,e){return t.find(t=>e.some(e=>e.test(t)))||""}function oh(t,e,s,i,o=!1){const a=sh(t,i),n=Ft(t.marker?.radar)?t.marker.radar:null;if(!n&&!a.eligible&&!o)return null;const r=n?.profile||a.profile,l=o&&!a.eligible||"ld2450"!==a.reason?{xEntities:["","",""],yEntities:["","",""],distanceEntity:"",angleEntity:"",occupancyEntity:"",countEntity:"",zoneEntity:""}:function(t,e,s){const i=th(t).filter(t=>!!s?.states?.[t]),o=[],a=[];for(let t=1;t<=3;t++)o.push(i.find(e=>eh(e,"x",t))||""),a.push(i.find(e=>eh(e,"y",t))||"");const n=i.filter(t=>t.startsWith("binary_sensor.")),r=i.filter(t=>t.startsWith("sensor.")),l=ih(n,[/(?:occupancy|presence|target)(?:_|$)/]);return{xEntities:o,yEntities:a,distanceEntity:ih(r,[/(?:target_)?distance(?:_|$)/,/distance/]),angleEntity:ih(r,[/(?:target_)?angle(?:_|$)/,/angle/]),occupancyEntity:l,countEntity:ih(r,[/(?:target|people|presence)_count(?:_|$)/,/target_count/]),zoneEntity:"zones_v1"===e?ih(n,[/(?:zone|region).*(?:occupancy|presence)/,/zone/]):""}}(t,r,i),h=n?.sources||{},c=h.slots||[],d=c.filter(t=>"x_entity"in t),p=c.filter(t=>"distance_entity"in t),u=h.ranges||[],_=h.zones?.[0],m="esphome_ld2450_v1"===r?3:"cartesian_v1"===r?Math.max(1,d.length):"polar_v1"===r?Math.max(1,p.length):1,g=n?.room_id||t.marker?.room_id||e.rooms.find(e=>e.area&&e.area===t.area)?.id||"";return{original:n,enabled:!0===n?.enabled,showLive:!1!==n?.show_live,profile:r,roomId:g,installationId:n?.mount?.installation_id||Xl(),mountX:Ql(null==n?.mount?.x?void 0:1e3*n.mount.x,Ql(s[0],"0")),mountY:Ql(null==n?.mount?.y?void 0:1e3*n.mount.y,Ql(s[1],"0")),heading:Ql(n?.mount?.heading_deg,"0"),rangeCm:Ql(n?.mount?.range_cm,"esphome_ld2450_v1"===r?"600":""),fovDeg:Ql(n?.mount?.fov_deg,"esphome_ld2450_v1"===r?"120":""),mirror:!0===n?.calibration?.mirror,unit:d[0]?.unit||p[0]?.unit||u[0]?.unit||("esphome_ld2450_v1"===r?"mm":"cm"),xEntities:Array.from({length:m},(t,e)=>d[e]?.x_entity||l.xEntities[e]||""),yEntities:Array.from({length:m},(t,e)=>d[e]?.y_entity||l.yEntities[e]||""),distanceEntities:Array.from({length:m},(t,e)=>p[e]?.distance_entity||(0===e?l.distanceEntity:"")),angleEntities:Array.from({length:m},(t,e)=>p[e]?.angle_entity||(0===e?l.angleEntity:"")),rangeEntities:u.length?u.map(t=>t.entity_id):[l.distanceEntity],slotPresenceEntities:Array.from({length:m},(t,e)=>(d[e]||p[e])?.presence_entity||""),rangePresenceEntities:(u.length?u:[{}]).map(t=>"presence_entity"in t&&t.presence_entity||""),swapXY:Array.from({length:m},(t,e)=>!0===d[e]?.swap_xy),xSigns:Array.from({length:m},(t,e)=>-1===d[e]?.x_sign?-1:1),ySigns:Array.from({length:m},(t,e)=>-1===d[e]?.y_sign?-1:1),angleUnit:p[0]?.angle_unit||"degrees",angleZero:p[0]?.angle_zero||"forward",angleClockwise:!1!==p[0]?.angle_clockwise,occupancyEntity:h.occupancy_entity||l.occupancyEntity,countEntity:h.count_entity||l.countEntity,availabilityEntity:h.availability_entity||"",zoneEntity:_?.entity_id||l.zoneEntity,zoneKind:_?.kind||"occupancy"}}const ah=t=>JSON.stringify(t,(t,e)=>e&&"object"==typeof e&&!Array.isArray(e)?Object.fromEntries(Object.entries(e).sort(([t],[e])=>te?1:0)):e),nh=t=>{if(!t.trim())return null;const e=Number(t.replace(",","."));return Number.isFinite(e)?e:null};function rh(t,e){const s=nh(t.mountX),i=nh(t.mountY),o=nh(t.heading);if(!t.roomId||null==s||null==i||null==o)return null;const a={...t.original?.sources||{}};if(delete a.slots,delete a.ranges,delete a.zones,delete a.occupancy_entity,delete a.count_entity,"esphome_ld2450_v1"===t.profile||"cartesian_v1"===t.profile){if(a.slots=t.xEntities.flatMap((e,s)=>{const i=t.yEntities[s]||"";return e&&i?[{id:`target_${s+1}`,x_entity:e,y_entity:i,unit:"esphome_ld2450_v1"===t.profile?"mm":t.unit,..."cartesian_v1"===t.profile&&t.swapXY[s]?{swap_xy:!0}:{},..."cartesian_v1"===t.profile&&-1===t.xSigns[s]?{x_sign:-1}:{},..."cartesian_v1"===t.profile&&-1===t.ySigns[s]?{y_sign:-1}:{},...t.slotPresenceEntities[s]?{presence_entity:t.slotPresenceEntities[s]}:{}}]:[]}),!a.slots.length)return null}else if("polar_v1"===t.profile){if(a.slots=t.distanceEntities.flatMap((e,s)=>{const i=t.angleEntities[s]||"";return e&&i?[{id:`target_${s+1}`,distance_entity:e,angle_entity:i,unit:t.unit,angle_unit:t.angleUnit,angle_zero:t.angleZero,angle_clockwise:t.angleClockwise,...t.slotPresenceEntities[s]?{presence_entity:t.slotPresenceEntities[s]}:{}}]:[]}),!a.slots.length)return null}else if("range_v1"===t.profile){if(a.ranges=t.rangeEntities.flatMap((e,s)=>e?[{id:`range_${s+1}`,entity_id:e,unit:t.unit,...t.rangePresenceEntities[s]?{presence_entity:t.rangePresenceEntities[s]}:{}}]:[]),!a.ranges.length)return null}else if("zones_v1"===t.profile){if(!t.zoneEntity)return null;a.zones=[{id:"zone_1",kind:t.zoneKind,entity_id:t.zoneEntity}]}else if("presence_v1"===t.profile&&!t.occupancyEntity)return null;t.occupancyEntity&&(a.occupancy_entity=t.occupancyEntity),t.countEntity&&(a.count_entity=t.countEntity),t.availabilityEntity&&(a.availability_entity=t.availabilityEntity);const n=nh(t.rangeCm),r=nh(t.fovDeg),l=(o%360+360)%360,h={...t.original?.mount||{},installation_id:t.installationId,x:s/1e3,y:i/1e3,heading_deg:l};null!=n&&n>0?h.range_cm=n:delete h.range_cm,null!=r&&r>0?h.fov_deg=r:delete h.fov_deg;const c=t.original,d="two_point"===c?.calibration?.method&&c.profile===t.profile&&ah(c.sources)===ah(a)&&c.mount.installation_id===t.installationId&&Math.abs(c.mount.x-h.x)<1e-12&&Math.abs(c.mount.y-h.y)<1e-12&&Math.abs(c.mount.heading_deg-l)<1e-9&&c.calibration.mirror===t.mirror&&Math.abs(c.calibration.cell_cm-e)<1e-9,p=t.calibrationOverride?{...t.calibrationOverride}:d?{...c.calibration}:{...c?.calibration||{},method:"zones_v1"===t.profile||"presence_v1"===t.profile?"not_required":"manual",mirror:t.mirror,cell_cm:e};t.calibrationOverride||d||(delete p.refs,delete p.rms_cm);const u={...t.original||{},version:1,enabled:t.enabled,profile:t.profile,sources:a,mount:h,room_id:t.roomId,calibration:p};return t.showLive?delete u.show_live:u.show_live=!1,u}function lh(t,e="main"){const{dialog:s,device:i}=t;if(!i)return h``;t.setup.syncMarker(i.marker?.id||i.id);const o=sh(i,t.registryHass),a="saved_unsupported"===o.reason,n=()=>t.updateDialog({radar:null,radarTouched:!0,radarRemove:!0}),r=()=>{const e=t.spaceModelById(i.space)||t.currentSpace();if(!e)return;const s=t.position(i),o=oh(i,e,[s.x,s.y],t.registryHass,!0);o&&t.updateDialog({radar:o,radarEligible:!0,radarTouched:!0,radarRemove:!1})},c=!a&&"virtual"!==s.bindingMode&&(!s.radar||s.radarRemove)&&!o.eligible;if("additional"===e)return c?h`
    +
    `:d} + `}}Ca.properties={hass:{attribute:!1},value:{attribute:!1},savedEnabled:{type:Boolean,attribute:"saved-enabled"},devices:{attribute:!1},registry:{attribute:!1}},Ca.styles=w`:host{display:block;color:inherit;font:inherit;}.section{margin-top:18px;font-weight:700;display:flex;align-items:center;gap:2px;}.toggle{display:flex;align-items:center;gap:10px;margin-top:10px;}.hint,.status{color:var(--secondary-text-color,#9aa0aa);font-size:12px;line-height:1.45;}.hint{margin-top:6px;}.providers{display:grid;gap:14px;margin-top:12px;padding-left:34px;}.provider{display:grid;gap:7px;}.provider-title{font-weight:650;}.actions{display:flex;align-items:center;flex-wrap:wrap;gap:8px;}textarea{box-sizing:border-box;width:100%;min-height:58px;resize:vertical;border:1px solid var(--divider-color,#666);border-radius:8px;padding:8px;color:var(--primary-text-color,inherit);background:var(--card-background-color,#202126);font:inherit;}button{display:inline-flex;align-items:center;gap:6px;min-height:36px;border:1px solid var(--divider-color,#666);border-radius:9px;padding:7px 11px;color:inherit;background:transparent;cursor:pointer;font:inherit;font-weight:600;}button:disabled,textarea:disabled{opacity:.5;cursor:default;}.warning{color:var(--warning-color,#d89300);font-size:12px;line-height:1.45;}`,customElements.get("hp-zigbee-topology-settings")||customElements.define("hp-zigbee-topology-settings",Ca);const Pa=(t,e)=>[t[0]-e[0],t[1]-e[1]],Da=(t,e)=>[t[0]+e[0],t[1]+e[1]],Ia=(t,e)=>t[0]*e[0]+t[1]*e[1],Ta=t=>Math.hypot(t[0],t[1]);function za(t){let e=0;for(let s=0;st[1]!=l>t[1]&&t[0]<(r-a)*(t[1]-n)/(l-n)+a&&(s=!s)}return s}([r[0]+n[0]*l,r[1]+n[1]*l],t)&&(n=[-n[0],-n[1]]),n}function Fa(t){const e=t.length;if(e<3)return!1;for(let s=0;s(t[0]-o[0])*r[1]-(t[1]-o[1])*r[0],h=t=>(t[0]-o[0])*r[0]+(t[1]-o[1])*r[1],c=s,d=n-s;for(const e of t){const t=Math.abs(l(e));if(t<=s)continue;const o=h(e);o<=c||o>=d||tMath.abs(n+(t-p)/g*(r-n));i=Math.min(i,f(_),f(m))}}return i}function Ea(t,e,s){if(N(t,e,s))return!0;if(F(t,e,s)||F(e,t,s))return!1;let i=0;try{const s=E([[...t.map(t=>[t[0],t[1]]),[t[0][0],t[0][1]]]],[[...e.map(t=>[t[0],t[1]]),[e[0][0],e[0][1]]]]);for(const t of s)t?.[0]&&(i+=H(t[0]))}catch{return!1}return i>Math.max(1e-7,s*s)}function Ha(t,e,s){for(const i of e)for(let e=0;es)continue;const h=(t.x-o[0])*l[0]+(t.y-o[1])*l[1];if(h-t.length/2>=-s&&h+t.length/2<=r+s)return!0}return!1}function Oa(t,e,s){const i=Math.abs(e[0]-t[0]),o=Math.abs(e[1]-t[1]);return i<=s&&o>s?"v":o<=s&&i>s?"h":null}function La(t,e,s){return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s}function Ba(t,e,s,i,o){return La(t,s,o)&&La(e,i,o)||La(t,i,o)&&La(e,s,o)}function Wa(t,e,s,i,o){const a=Oa(t,e,o);return a&&Oa(s,i,o)===a?"h"===a?Math.abs(t[1]-s[1])>o||Math.abs(t[1]-i[1])>o?0:Math.max(0,Math.min(Math.max(t[0],e[0]),Math.max(s[0],i[0]))-Math.max(Math.min(t[0],e[0]),Math.min(s[0],i[0]))):Math.abs(t[0]-s[0])>o||Math.abs(t[0]-i[0])>o?0:Math.max(0,Math.min(Math.max(t[1],e[1]),Math.max(s[1],i[1]))-Math.max(Math.min(t[1],e[1]),Math.min(s[1],i[1]))):0}function ja(t,e,s,i){const o=t.length,a=Oa(t[(e-1+o)%o],t[e],i),n=Oa(t[(e+1)%o],t[(e+2)%o],i),r="h"===s?"v":"h";return a===r&&n===r}function Ga(t){let e=1/0,s=1/0,i=-1/0,o=-1/0;for(const a of t)e=Math.min(e,a[0]),s=Math.min(s,a[1]),i=Math.max(i,a[0]),o=Math.max(o,a[1]);return[e,s,i,o]}function qa(t,e,s){const i=Ga(t),o=Ga(e);return i[2]o}const Ka=(t,e)=>"h"===e?t[0]:t[1],Va=(t,e)=>"h"===e?t[1]:t[0];function Ja(t,e,s,i,o){const a=t.find(t=>t.id===e);if(!a)return null;const n=a.poly[s],r=a.poly[(s+1)%a.poly.length],l=Oa(n,r,o);if(!l)return null;const h=0===i?r:n,c=0===i?n:r,d=Ka(h,l),p=Ka(c,l),u=Va(h,l),_=function(t,e,s,i){const o=[];for(const a of t)for(let t=0;ti||Math.abs(Va(r,e)-s)>i)continue;const l=Ka(n,e),h=Ka(r,e),c=Math.min(l,h),d=Math.max(l,h);d-c>i&&o.push({roomId:a.id,edge:t,lo:c,hi:d})}return o.sort((t,e)=>t.lo-e.lo||t.hi-e.hi||t.roomId.localeCompare(e.roomId)||t.edge-e.edge)}(t,l,u,o),m=function(t,e,s,i){const o=[e,s];for(const a of t){const t=Math.max(e,a.lo),n=Math.min(s,a.hi);n-t>i&&o.push(t,n)}const a=[...new Set(o)].sort((t,e)=>t-e),n=[];for(let e=0;e+1r>t.lo-i&&rt.roomId))].sort();n.push({lo:s,hi:o,owners:l})}return n}(_,Math.min(d,p),Math.max(d,p),o);return!m.length||m.some(t=>t.owners.length<1||t.owners.length>2)?null:{roomId:e,edge:s,movedEndpoint:i,axis:l,line:u,fixed:d,moving:p,intervals:_,baseline:m}}function Ya(t,e,s){const i=[];for(const o of t.intervals){const a=e.polys[o.roomId];if(!a){i.push(o);continue}if(o.edge<0||o.edge>=a.length)continue;const n=a[o.edge],r=a[(o.edge+1)%a.length];if(Oa(n,r,s)!==t.axis||Math.abs(Va(n,t.axis)-t.line)>s||Math.abs(Va(r,t.axis)-t.line)>s)continue;const l=Ka(n,t.axis),h=Ka(r,t.axis),c=Math.min(l,h),d=Math.max(l,h);d-c>s&&i.push({...o,lo:c,hi:d})}return i}function Xa(t,e,s){return new Set(t.filter(t=>e>t.lo-s&&et.roomId)).size}function Za(t,e,s){for(const i of e.sideOwnership){const e=t.polys[i.roomId];if(!e)return!1;const o=e[i.edge],a=e[(i.edge+1)%e.length];if(Oa(o,a,s)!==i.axis)return!1;const n=Ka(0===i.movedEndpoint?o:a,i.axis),r=Ya(i,t,s),l=(i.moving>=i.fixed?i.baseline[i.baseline.length-1]:i.baseline[0]).owners.length;if(l<1||l>2)return!1;const h=Math.min(i.fixed,i.moving,n),c=Math.max(i.fixed,i.moving,n),d=[h,c,i.fixed,i.moving,n];for(const t of i.intervals)d.push(t.lo,t.hi);for(const t of r)d.push(t.lo,t.hi);const p=[...new Set(d.filter(t=>t>=h&&t<=c))].sort((t,e)=>t-e),u=Math.min(i.fixed,i.moving),_=Math.max(i.fixed,i.moving),m=Math.min(i.fixed,n),g=Math.max(i.fixed,n);for(let t=0;t+1u-s&&a<_+s,h=a>m-s&&a2||d>2)return!1;if(n&&h){if(c!==d)return!1}else if(!n&&h){if(d!==l||c>0&&c!==d)return!1}else if(2===c?2!==d:d>1)return!1}}return!0}function Qa(t,e,s,i){const o=[s.n[0]*i,s.n[1]*i],a={polys:{},openings:{},movedSpans:{}};for(const e of s.roomIds){const i=t.find(t=>t.id===e),n=s.edgeByRoom[e];if(!i||null==n)continue;const r=(n+1)%i.poly.length;a.polys[e]=i.poly.map((t,e)=>e===n||e===r?Da(t,o):[...t]),a.movedSpans[e]=[[Da(i.poly[n],o),Da(i.poly[r],o)]]}for(const t of e)s.movingOpeningIds.includes(t.id)&&(a.openings[t.id]=[t.x+o[0],t.y+o[1]]);return a}function tn(t,e,s,i,o,a,n,r){if(!function(t,e,s,i){if(Ra([t.x,t.y],e,s)>2*i)return!1;const o=Ta(Pa(s,e));if(o<=i)return!1;const a=[(s[0]-e[0])/o,(s[1]-e[1])/o],n=(t.x-e[0])*a[0]+(t.y-e[1])*a[1];return n>=-i&&n<=o+i}(t,e,s,r))return!0;if(Ra([t.x,t.y],i,o)>2*r)return!1;const l=0===a?i:o;return Ta(Pa([t.x,t.y],l))>=t.length/2+n-r}function en(t,e,s,i){const o=i.movingHalf||0;return"circle"===t.kind?Ra(t.center,e,s)2)return!1;const r=Qa(t,e,s,i);if(Object.keys(r.polys).length!==s.roomIds.length)return!1;if(!Za(r,s,a))return!1;const l=new Set(s.roomIds),h=t=>r.polys[t.id]||t.poly;for(const i of s.roomIds){const l=t.find(t=>t.id===i),h=r.polys[i],c=s.edgeByRoom[i];if(!l||!h||h.length!==s.topology[i]||h.length!==l.poly.length||!Fa(h))return!1;const d=l.poly.length,p=(c-1+d)%d,u=[p,c,(c+1)%d];for(const t of u)if(A(h[t],h[(t+1)%d]))return!1;const _=za(l.poly),m=za(h);if(Math.abs(m)t.id===e),i=r.polys[e];for(const o of t){if(o.id===e||l.has(o.id))continue;const t=h(o);if(!qa(s.poly,o.poly,a)||!qa(i,t,a))if(F(s.poly,o.poly,a)){if(!F(i,t,a))return!1}else if(F(o.poly,s.poly,a)){if(!F(t,i,a))return!1}else if(F(i,t,a)||F(t,i,a)||Ea(i,t,a))return!1}}t.find(t=>t.id===s.roomId);const c=r.polys[s.roomId],d=s.edgeByRoom[s.roomId],p=c[d],u=c[(d+1)%c.length];if(Math.abs(i)>a)for(const t of o.obstacles||[])if(en(t,p,u,o))return!1;for(const t of e){if(!s.movingOpeningIds.includes(t.id))continue;const e=r.openings[t.id];if(!e||t.hosted)return!1;if(!Ha({...t,x:e[0],y:e[1]},[c],2*a))return!1}return!0}const on=new WeakMap,an=t=>"number"==typeof t&&Number.isFinite(t),nn=(t,e)=>{const s=new Map;for(const i of t||[])!an(i?.cm)||!e&&i.cm<=0||s.set(i.cm,(s.get(i.cm)||0)+1);return s},rn=t=>[String(t),"см"].join(" ");function ln(t,e,s={}){if(s.allowClear)return[];const i=!0===s.exactMultiplicity,o=nn(t,i),a=nn(e,i),n=[];for(const[t,e]of o){const s=a.get(t)||0;0===s?n.push({invariant:"wall_records",kind:"lost",owner:rn(t),reference:`было ${e}`,detail:"записи этой толщины исчезли целиком"}):i&&s!==e&&n.push({invariant:"wall_records",kind:"count",owner:rn(t),reference:`было ${e}, стало ${s}`,detail:"изменилось число записей этой толщины"})}if(i)for(const[t,e]of a)o.has(t)||n.push({invariant:"wall_records",kind:"count",owner:rn(t),reference:`было 0, стало ${e}`,detail:"появились записи новой толщины"});return n}class hn{constructor(){this._selectedRoomId=null,this._session=null,this._eligibility=null}get dragging(){return null!==this._session}ownsPointer(t){return this._session?.pointerId===t}get selectedRoomId(){return this._selectedRoomId}get snapshotIdentity(){return this._session?.snapshotIdentity||null}get activePointerId(){return this._session?.pointerId??null}get moved(){return!0===this._session?.moved}get delta(){return this._session?.delta||0}get rooms(){return this._session?.rooms||null}get openings(){return this._session?.openings||null}get plan(){return this._session?.plan||null}get preview(){return this._session?.accepted?.preview||null}get liveLabels(){return this._session?.accepted?.labels||null}selectRoom(t){this._selectedRoomId=t}restoreSelection(t){this._selectedRoomId=t}escapeIdle(){return this._selectedRoomId?(this._selectedRoomId=null,"selection-cleared"):"exit-tool"}resolve(t,e,s){this._eligibility&&this._eligibility.context===t||(this._eligibility={context:t,values:new Map});const i=this._eligibility.values.get(e);if(i)return i;const o=s();return this._eligibility.values.set(e,o),o}begin(t){return!this._session&&(this._session={pointerId:t.pointerId,start:[...t.start],roomId:t.roomId,plan:t.plan,options:t.options,rooms:t.rooms,openings:t.openings,snapshotIdentity:t.snapshotIdentity,before:t.before,moved:!1,delta:0,changedRoomIds:[...t.plan.roomIds],rejectionNotified:!1,wallUnionBefore:t.wallUnionBefore,epochBefore:t.epochBefore,accepted:null},!0)}move(t){const e=this._session;if(!e||e.pointerId!==t.pointerId)return{kind:"no-op"};const s=(i=e.start,o=t.point,a=e.plan.n,[i?.[0],i?.[1],o?.[0],o?.[1],a?.[0],a?.[1]].every(Number.isFinite)?(o[0]-i[0])*a[0]+(o[1]-i[1])*a[1]:0);var i,o,a;const n=t.snap([e.plan.a[0]+e.plan.n[0]*s,e.plan.a[1]+e.plan.n[1]*s]),r=(n[0]-e.plan.a[0])*e.plan.n[0]+(n[1]-e.plan.a[1])*e.plan.n[1],l=function(t,e,s,i,o,a){if(!Number.isFinite(i)||Math.abs(i)<1e-9)return 0;const n=Math.sign(i),r=Math.abs(i),l=Math.max(Math.abs(o),1e-6);let h=on.get(s);h&&h.opts===a||(h={opts:a,values:new Map},on.set(s,h));const c=h.values;let d=0;for(let i=Math.min(l,r),o=0;o<4096&&i<=r+1e-9;o++,i=Math.min(r,i+l)){const o=n*i,h=`${o.toFixed(9)}|${l.toFixed(9)}`;let p=c.get(h);if(void 0===p&&(p=sn(t,e,s,o,a),c.size<4096&&c.set(h,p)),!p)break;if(d=o,Math.abs(i-r)<=1e-9)break}return d}(e.rooms,e.openings,e.plan,r,t.step,e.options);if(e.moved&&l===e.delta)return{kind:"no-op"};const h=Qa(e.rooms,e.openings,e.plan,l);let c;try{if(c=t.project(e.snapshotIdentity,h.polys,h.openings,e.changedRoomIds,e.rooms),!c.ok)return this._projectionRejected(e);if(ln(c.value.beforeWalls,c.value.afterWalls,{exactMultiplicity:!0}).length)return this._projectionRejected(e)}catch{return this._projectionRejected(e)}const d=e.accepted,p={preview:c.value.preview,labels:null,artifact:c.value.artifact,beforeWalls:c.value.beforeWalls,afterWalls:c.value.afterWalls};e.accepted=p;try{t.publish(p.preview,p.artifact),p.labels=t.measure(h,e.plan)}catch{e.accepted=d;try{t.publish(d?.preview||null,d?.artifact||null)}catch{}return this._projectionRejected(e)}return e.moved=!0,e.delta=l,{kind:"accepted",preview:c.value.preview,labels:p.labels,artifact:c.value.artifact}}finish(t){const e=this._session;if(!e||e.pointerId!==t.pointerId)return{kind:"no-op"};const s=e.accepted;let i;if(e.moved&&Math.abs(e.delta)>1e-9&&s)if(t.currentSnapshotIdentity!==e.snapshotIdentity)i={kind:"rejected",reason:"stale-snapshot"};else if(sn(e.rooms,e.openings,e.plan,e.delta,e.options))if(ln(s.beforeWalls,s.afterWalls,{exactMultiplicity:!0}).length)i={kind:"rejected",reason:"wall-records"};else{let o=!1;try{o=t.validatePreview(s.preview)}catch{o=!1}i=o?{kind:"commit",preview:s.preview,before:e.before}:{kind:"rejected",reason:"invalid-candidate"}}else i={kind:"rejected",reason:"invalid-topology"};else i={kind:"no-op"};return this._session=null,"commit"===i.kind&&(this._eligibility=null),i}cancel(t,e){const s=this._session;if(!s||void 0!==e&&s.pointerId!==e)return{kind:"no-op"};this._session=null,this._eligibility=null;const i=t===s.snapshotIdentity;return{kind:"cancelled",restoreWallUnion:i?s.wallUnionBefore:null,restoreEpoch:i?s.epochBefore:null}}reset(){this._selectedRoomId=null,this._session=null,this._eligibility=null}_projectionRejected(t){const e=!t.rejectionNotified;return t.rejectionNotified=!0,{kind:"rejected",notify:e}}}const cn=t=>"object"==typeof t&&null!==t?t:null,dn=t=>Array.isArray(t)?t.flatMap(t=>{const e=cn(t);return e?[e]:[]}):[],pn=t=>{if(!Array.isArray(t))return null;const e=Number(t[0]),s=Number(t[1]);return Number.isFinite(e)&&Number.isFinite(s)?[e,s]:null};function un(t){const e=(s=t.poly,Array.isArray(s)?s.flatMap(t=>{const e=pn(t);return e?[e]:[]}):[]);var s;if(e.length>=3)return e;const i=Number(t.x),o=Number(t.y),a=Number(t.w),n=Number(t.h);return[i,o,a,n].every(Number.isFinite)?[[i,o],[i+a,o],[i+a,o+n],[i,o+n]]:[]}function _n(t){if(!t.length)return null;const e=t.map(t=>t[0]),s=t.map(t=>t[1]);return{minX:Math.min(...e),minY:Math.min(...s),maxX:Math.max(...e),maxY:Math.max(...s)}}function mn(t,e){const s=cn(t);if(!s)return null;const i=dn(s.rooms),o=new Set(function(t,e){const s=dn(t),i=new Set(e);return s.flatMap(t=>{const e=String(t.id||"");return e&&i.has(e)?[e]:[]})}(i,e)),a=i.filter(t=>o.has(String(t.id||"")));if(!_n(a.flatMap(un))||!a.length)return null;const n=Number(s.cell_cm),r=Number.isFinite(n)&&n>0?n:5,l=a.flatMap(t=>{const e=un(t);return e.map((t,s)=>[t,e[(s+1)%e.length]])}),h=.02*O,c=(t,e,s)=>{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o,n=a>0?Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a)):0;return Math.hypot(t[0]-e[0]-n*i,t[1]-e[1]-n*o)},d=(t,e)=>Math.min(...l.map(([s,i])=>((t,e,s,i)=>{const o=(t,e,s)=>(e[0]-t[0])*(s[1]-t[1])-(e[1]-t[1])*(s[0]-t[0]),a=o(t,e,s),n=o(t,e,i),r=o(s,i,t),l=o(s,i,e);return a*n<=h*h&&r*l<=h*h&&Math.min(t[0],e[0])<=Math.max(s[0],i[0])+h&&Math.min(s[0],i[0])<=Math.max(t[0],e[0])+h&&Math.min(t[1],e[1])<=Math.max(s[1],i[1])+h&&Math.min(s[1],i[1])<=Math.max(t[1],e[1])+h?0:Math.min(c(t,s,i),c(e,s,i),c(s,t,e),c(i,t,e))})(t,e,s,i))),p=t=>{const e=pn(t.a),s=pn(t.b);if(e&&s)return((t,e)=>l.some(([s,i])=>{const o=i[0]-s[0],a=i[1]-s[1],n=Math.hypot(o,a);if(!(n>h))return!1;const r=t=>Math.abs((t[0]-s[0])*a-(t[1]-s[1])*o)/n;if(r(t)>h||r(e)>h)return!1;const l=t=>((t[0]-s[0])*o+(t[1]-s[1])*a)/(n*n),c=l(t),d=l(e);return Math.min(1,Math.max(c,d))-Math.max(0,Math.min(c,d))>h}))(e,s);const[i]=String(t.key||"").split("@"),o=i?.split(",").map(Number)||[];return 2!==o.length||!o.every(Number.isFinite)||l.some(([t,e])=>c(o,t,e)<=h)},u=dn(s.walls).filter(p),_=dn(s.wall_segments).filter(p),m=Math.max(0,...[...u,..._].map(t=>Number(t.cm)).filter(Number.isFinite))/r*O/2,g=dn(s.partitions).filter(t=>{const e=pn(t.a),s=pn(t.b);if(!e||!s)return!0;const i=Math.max(0,Number(t.cm)||0)/r*O/2;return d(e,s)<=m+i+h}),f=dn(s.wall_columns).filter(t=>{const e=pn(t.center);if(!e)return!0;const s=Math.max(0,Number(t.cm)||0)/r*O;return l.some(([t,i])=>c(e,t,i)<=m+s+h)}),b=new Set(g.map(t=>String(t.id||"")).filter(Boolean)),v=dn(s.openings).filter(t=>{const e=cn(t.host);if("partition"===e?.kind)return b.has(String(e.id||""));const s=pn([t.x,t.y]);return!s||l.some(([t,e])=>c(s,t,e)<=h)});return{...s,rooms:a,walls:u,wall_segments:_,open_spans:dn(s.open_spans).filter(p),partitions:g,wall_columns:f,openings:v}}const gn=1e-9;class fn extends Error{constructor(t,e=""){super(e?`${t}: ${e}`:t),this.reason=t,this.name="WallSegmentModelError"}}const bn=t=>JSON.parse(JSON.stringify(t)),vn=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(Number(t[0]))&&Number.isFinite(Number(t[1])),yn=t=>[Number(t[0]),Number(t[1])],$n=t=>`${Number(t[0]).toFixed(12)},${Number(t[1]).toFixed(12)}`,wn=(t,e)=>{const s=$n(t),i=$n(e);return s$n(t)<=$n(e)?[yn(t),yn(e)]:[yn(e),yn(t)],xn=(t,e)=>Math.hypot(e[0]-t[0],e[1]-t[1]),Sn=(t,e=[])=>{const s=new Set,i=t=>{const e=Number(t);if(!Number.isFinite(e))return;const i=e/O;Math.abs(i-Math.round(i))>=U&&s.add(e.toFixed(12))};for(const e of Array.isArray(t?.rooms)?t.rooms:[])for(const t of B(e)||[])i(t[0]),i(t[1]);for(const e of[t?.wall_segments,t?.walls])for(const t of Array.isArray(e)?e:[])i(t?.a?.[0]),i(t?.a?.[1]),i(t?.b?.[0]),i(t?.b?.[1]);for(const t of e)i(t?.[0]),i(t?.[1]);return s.size},Mn=(t,e,s)=>{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o;return a>1e-18?((t[0]-e[0])*i+(t[1]-e[1])*o)/a:0},Cn=(t,e,s)=>{const i=Math.max(0,Math.min(1,Mn(t,e,s)));return Math.hypot(t[0]-(e[0]+(s[0]-e[0])*i),t[1]-(e[1]+(s[1]-e[1])*i))},Pn=(t,e,s,i,o=1e-9)=>{const a=e[0]-t[0],n=e[1]-t[1],r=Math.hypot(a,n);if(r<=o)return 0;const l=e=>Math.abs((e[0]-t[0])*n-(e[1]-t[1])*a)/r;if(l(s)>o||l(i)>o)return 0;const h=Mn(s,t,e),c=Mn(i,t,e);return Math.max(0,Math.min(1,Math.max(h,c))-Math.max(0,Math.min(h,c)))*r},Dn=t=>{const e=(new TextEncoder).encode(t),s=8*e.length,i=64*Math.ceil((e.length+9)/64),o=new Uint8Array(i);o.set(e),o[e.length]=128;const a=new DataView(o.buffer);a.setUint32(i-8,Math.floor(s/4294967296),!1),a.setUint32(i-4,s>>>0,!1);const n=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),r=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),l=new Uint32Array(64),h=(t,e)=>t>>>e|t<<32-e;for(let t=0;t>>3,o=h(s,17)^h(s,19)^s>>>10;l[t]=l[t-16]+i+l[t-7]+o>>>0}let[e,s,i,o,c,d,p,u]=r;for(let t=0;t<64;t++){const a=u+(h(c,6)^h(c,11)^h(c,25))+(c&d^~c&p)+n[t]+l[t]>>>0,r=e&s^e&i^s&i;u=p,p=d,d=c,c=o+a>>>0,o=i,i=s,s=e,e=a+((h(e,2)^h(e,13)^h(e,22))+r>>>0)>>>0}r[0]=r[0]+e>>>0,r[1]=r[1]+s>>>0,r[2]=r[2]+i>>>0,r[3]=r[3]+o>>>0,r[4]=r[4]+c>>>0,r[5]=r[5]+d>>>0,r[6]=r[6]+p>>>0,r[7]=r[7]+u>>>0}const c=new Uint8Array(32),d=new DataView(c.buffer);for(let t=0;t{const e="abcdefghijklmnopqrstuvwxyz234567";let s=0,i=0,o="";for(const a of t)for(i=i<<8|a,s+=8;s>=5;)o+=e[i>>>s-5&31],s-=5;return s&&(o+=e[i<<5-s&31]),o},Tn=(t,e,s,i,o="")=>{const[a,n]=kn(e,s),r=`${t}|${$n(a)}|${$n(n)}|${[...i].sort().join(",")}${o}`;return`wall-${In(Dn(r)).slice(0,20)}`};let zn=0;const Rn=t=>{for(let e=0;e<1e3;e++){const e=globalThis.crypto?.randomUUID?.(),s=`wall-${e||In(Dn(`${Date.now()}|${zn++}|${Math.random()}`)).slice(0,26)}`;if(!t.has(s))return s}throw new fn("duplicate-id","id factory exhausted")},An=t=>{const e=new Map;for(const s of Array.isArray(t?.wall_segments)?t.wall_segments:[])if(s&&"string"==typeof s.id&&vn(s.a)&&vn(s.b)){if(e.has(s.id))throw new fn("duplicate-id",s.id);e.set(s.id,s)}return e},Fn=(t,e,s)=>{const i=(s,i)=>{const o=t[0]-s[0],a=t[1]-s[1];return Math.abs(e[0]-i[0]-o)<=gn&&Math.abs(e[1]-i[1]-a)<=gn?[o,a]:null};return i(s.a,s.b)||i(s.b,s.a)},Nn=(t,e)=>{const s=Array.isArray(t.rooms)?t.rooms:[],i=j(t.open_spans).map(t=>[t.a[0],t.a[1],t.b[0],t.b[1]]),o=i.length?i:G(s,null,1,.04*O,!0),a=[];for(const t of s){const s=B(t),i=Array.isArray(t?.wall_ids)?t.wall_ids:[];if(s&&i.length===s.length)for(let t=0;t"partition"!==t.host?.kind&&[Number(t.x),Number(t.y)].every(Number.isFinite)&&Number.isFinite(Number(t.angle))&&Number(t.length)>0&&o.some(e=>Cn([Number(t.x),Number(t.y)],[e[0],e[1]],[e[2],e[3]])<=.04*O)):[],l=r.map(t=>{const e=Number(t.angle)*Math.PI/180,s=[Math.cos(e),Math.sin(e)],i=Number(t.length)/2,o=[Number(t.x),Number(t.y)];return{a:[o[0]-s[0]*i,o[1]-s[1]*i],b:[o[0]+s[0]*i,o[1]+s[1]*i]}}),h=(t,e)=>r.some(s=>{const i=[Number(s.x),Number(s.y)];if(!K(t,e,Number(s.angle)))return!1;if(Cn(i,t,e)>.02*O)return!1;const o=xn(t,e),a=Mn(i,t,e)*o,n=Number(s.length)/2;return a+n>=-1e-9&&a-n<=o+gn}),c=new Map,d=[];for(const i of s){const r=String(i?.id||""),p=B(i);if(!r||!p||p.length<3)throw new fn("invalid-room",r);const u=q(s,r,n,O,1,[...t.walls||[],...l]);if(!u||u.poly.length<3)throw new fn("invalid-room",r);const _=Array.isArray(i.wall_ids)?i.wall_ids:[],m=_.length===p.length;let g=null,f=m;if(f)for(let t=0;tgn||Math.abs(i[1]-g[1])>gn)){f=!1;break}g=i}const b=[];for(let t=0;t2)throw new fn("third-owner",n);const d=m?_[u.parent[t]]:void 0;if("string"==typeof d&&d){const o=e.get(d);f||!o||Pn(s,i,o.a,o.b)>gn?l.preferredIds.add(d):l.positionalIds.add(d),l.preferredCarriers.set(d,{a:yn(p[u.parent[t]]),b:yn(p[(u.parent[t]+1)%p.length])})}const g=u.parent[t];l.parentKeys.add(W(p[g],p[(g+1)%p.length],O));const v=[(s[0]+i[0])/2,(s[1]+i[1])/2],y=t=>t.some(t=>Cn(v,[t[0],t[1]],[t[2],t[3]])<=.04*O);l.zeroWall||=y(a)||y(o)&&!h(s,i),b.push(n)}const v={...i};delete v.wall_ids,d.push({...v,poly:u.poly.map(t=>[t[0],t[1]]),wall_ids:b})}return{atoms:[...c.values()].sort((t,e)=>t.key.localeCompare(e.key)),rooms:d}},En=(t,e,s,i,o)=>{const a=new Map([...s.values()].map(t=>[wn(t.a,t.b),t])),n=(t=>{const e=new Map;for(const s of t)"wall"===s.host?.kind&&e.set(s.host.id,(e.get(s.host.id)||0)+1);return e})(t.openings||[]),r=new Map;for(const t of e){const e=o?.get(t.key);if(e){const i=s.get(e);if(!i)throw new fn("duplicate-id",e);r.set(t,i);continue}if(t.preferredIds.size>1)throw new fn("duplicate-id",[...t.preferredIds].sort().join(","));const i=[...t.preferredIds][0],l=i?s.get(i):void 0;if(l){r.set(t,l);continue}const h=i?t.preferredCarriers.get(i):void 0;if(i&&h){r.set(t,{id:i,a:h.a,b:h.b,cm:0});continue}const c=a.get(t.key);if(c){r.set(t,c);continue}const d=[...s.values()].filter(e=>Pn(t.a,t.b,e.a,e.b)>gn),p=[...new Map(d.map(t=>[t.id,t])).values()];if(p.sort((t,e)=>(n.get(e.id)||0)-(n.get(t.id)||0)||xn(e.a,e.b)-xn(t.a,t.b)||t.id.localeCompare(e.id)),p[0])r.set(t,p[0]);else if(1===t.positionalIds.size){const e=s.get([...t.positionalIds][0]);e&&r.set(t,e)}}const l=new Map;for(const[t,e]of r){const s=l.get(e.id)||[];s.push(t),l.set(e.id,s)}for(const[t,e]of l){const i=s.get(t)||r.get(e[0]);if(!i)throw new fn("duplicate-id",t);const o=[(i.a[0]+i.b[0])/2,(i.a[1]+i.b[1])/2];e.sort((t,e)=>{const s=Cn(o,t.a,t.b)<=gn?0:1,a=Cn(o,e.a,e.b)<=gn?0:1;if(s!==a)return s-a;return(Cn(i.a,t.a,t.b)<=gn?0:1)-(Cn(i.a,e.a,e.b)<=gn?0:1)||t.key.localeCompare(e.key)}),e[0].id=t}const h=(t=>{const e=new Set;for(const s of[t.rooms,t.openings,t.decor,t.room_drafts,t.partitions,t.wall_columns])for(const t of Array.isArray(s)?s:[])"string"==typeof t?.id&&t.id&&e.add(t.id);for(const s of Array.isArray(t.room_drafts)?t.room_drafts:[])for(const t of Array.isArray(s?.segments)?s.segments:[])"string"==typeof t?.id&&t.id&&e.add(t.id);return e})(t);for(const t of e)if(t.id){if(h.has(t.id))throw new fn("duplicate-id",t.id);h.add(t.id)}const c=e.filter(t=>!t.id);if(i){const e=c.map(e=>{const[s,i]=kn(e.a,e.b),o=`${String(t.id||"")}|${$n(s)}|${$n(i)}|${[...e.owners].sort().join(",")}`,a=In(Dn(o));return{atom:e,seed:o,digest:a,base:`wall-${a.slice(0,20)}`}}).sort((t,e)=>t.digest.localeCompare(e.digest)||t.atom.key.localeCompare(e.atom.key)),s=new Map;for(const t of e){const e=s.get(t.digest);if(e&&e!==t.seed)throw new fn("duplicate-id",t.digest);s.set(t.digest,t.seed);let i=1,o=t.base;for(;h.has(o);)o=`${t.base}-${++i}`;t.atom.id=o,h.add(o)}}else for(const t of c)t.id=Rn(h),h.add(t.id)},Hn=(t,e)=>{if("partition"===t.host?.kind)return null;const s=[Number(t.x),Number(t.y)];if(!s.every(Number.isFinite))return null;const i=e=>{if(!(Number(e.cm)>0))return!1;const i=Mn(s,e.a,e.b),o=xn(e.a,e.b),a=Number(t.length)/2;return i>=-1e-9&&i<=1+gn&&Cn(s,e.a,e.b)<=.02*O&&K(e.a,e.b,Number(t.angle))&&Number.isFinite(a)&&a>=0&&i*o-a>=-1e-9&&i*o+a<=o+gn},o="wall"===t.host?.kind?e.find(e=>e.id===t.host.id):null,a=o&&i(o)?[o]:e.filter(i);if(1!==a.length)return null;const n=a[0];return{kind:"wall",id:n.id,t:Math.max(0,Math.min(1,Mn(s,n.a,n.b)))}},On=(t,e)=>{const s=[Number(t.x),Number(t.y)];if(!s.every(Number.isFinite))return null;const i=Number(t.length)/2,o=e.filter(e=>{if(!(Number(e.cm)>0))return!1;const o=Mn(s,e.a,e.b),a=xn(e.a,e.b);return o>=-1e-9&&o<=1+gn&&Cn(s,e.a,e.b)<=.02*O&&K(e.a,e.b,Number(t.angle))&&Number.isFinite(i)&&i>=0&&o*a-i>=-1e-9&&o*a+i<=a+gn}),a=(e=>{if(!e.length)return null;const i="wall"===t.host?.kind?e.find(e=>e.id===t.host.id):null;return i||[...e].sort((t,e)=>Cn(s,t.a,t.b)-Cn(s,e.a,e.b)||Number(e.cm)-Number(t.cm)||(t.ide.id?1:0))[0]})(o);return a?{kind:"wall",id:a.id,t:Math.max(0,Math.min(1,Mn(s,a.a,a.b)))}:null},Ln=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/,Bn=t=>{if("number"!=typeof t&&"string"!=typeof t)return null;if("string"==typeof t&&!Ln.test(t.trim()))return null;const e=Number(t);return Number.isFinite(e)?e:null},Wn=t=>{if(!Array.isArray(t)||t.length<2)return null;const e=Bn(t[0]),s=Bn(t[1]);return null==e||null==s?null:[e,s]},jn=t=>"string"==typeof t?t:"",Gn=t=>{if(!Object.prototype.hasOwnProperty.call(t,"room_drafts"))return{drafts:0,segments:0};const e=Array.isArray(t.room_drafts)?t.room_drafts:[];if(!e.length)return delete t.room_drafts,{drafts:0,segments:0};const s=new Set;for(const e of[t.rooms,t.openings,t.decor,t.partitions,t.wall_columns,t.wall_segments])for(const t of Array.isArray(e)?e:[])"string"==typeof t?.id&&t.id&&s.add(t.id);for(const t of e)"string"==typeof t?.id&&t.id&&s.add(t.id);const i=Array.isArray(t.partitions)?[...t.partitions]:[];let o=0;for(const a of e){const e=jn(a?.id),n=Array.isArray(a?.points)?a.points:[],r=Array.isArray(a?.segments)?a.segments:[];if(n.length<2||r.length!==n.length-1)throw new fn("zero-length",e);for(let a=0;a+1100)throw new fn("thickness-conflict",e);let p="string"==typeof c?.id&&c.id?c.id:"";if(!p||s.has(p)){const i=Tn(jn(t.id),l,h,[`draft:${e}:${a}`]);p=i;for(let t=2;s.has(p);t++)p=`${i}-${t}`}s.add(p),i.push({id:p,a:yn(l),b:yn(h),cm:d}),o++}}return i.length?t.partitions=i:delete t.partitions,delete t.room_drafts,{drafts:e.length,segments:o}},qn=t=>Gn(t),Un=(t,e,s)=>{const i=Gn(t),o=An(t),{atoms:a,rooms:n}=Nn(t,o);En(t,a,o,e,s);const r=a.map(e=>{const s=e.id?o.get(e.id):void 0,i=((t,e,s)=>{if(e.zeroWall)return 0;const i=Array.isArray(t.walls)?t.walls:[],o=W(e.a,e.b,O),a=i.filter(t=>Number(t.cm)>0&&(!(t.key!==o&&!e.parentKeys.has(t.key))||!(!vn(t.a)||!vn(t.b))&&Pn(e.a,e.b,t.a,t.b)>=xn(e.a,e.b)-gn)).map(t=>Math.max(1,Math.min(100,Number(t.cm))));if(new Set(a.map(t=>t.toFixed(9))).size>1)throw new fn("thickness-conflict",e.key);if(a.length)return a[0];const n=J(i,e.a,e.b,O,1);return n>0?n:Number(s?.cm)>0?Number(s.cm):0})(t,e,s);return{...s||{},id:e.id,a:[...e.a],b:[...e.b],cm:i}}),l=new Map(a.map(t=>[t.key,t.id]));for(const t of n)t.wall_ids=t.wall_ids.map(t=>l.get(t));t.rooms=n,t.wall_segments=r,t.walls=r.filter(t=>t.cm>0).map(t=>({key:W(t.a,t.b,O),cm:t.cm,a:[...t.a],b:[...t.b]})),t.walls.length||delete t.walls,delete t.open_spans;for(const e of t.rooms)delete e.open_to;return((t,e,s)=>{const i=Array.isArray(t.openings)?t.openings:[];for(const t of i){if("partition"===t.host?.kind)continue;if(!t.host&&!s){const s=Hn(t,e);s&&(t.host=s);continue}const i=Hn(t,e)??(s?On(t,e):null);if(i)t.host=i;else{if(!s)throw new fn("opening-host",t.id);delete t.host}}})(t,r,e),{wallSegments:r.reduce((t,e)=>t+(o.has(e.id)?0:1),0),drafts:i.drafts,draftSegments:i.segments}};function Kn(t,e={}){const s=JSON.stringify(t),i=bn(t);L(i);let o=0,a=0,n=0;const r=Number(i?.model_version||0)<10;for(const t of Array.isArray(i?.spaces)?i.spaces:[]){const s=e.lineageSpaceId===String(t?.id||"")?e.lineageHints:void 0,i=Un(t,r,s);o+=i.wallSegments,a+=i.drafts,n+=i.draftSegments}return i.model_version=10,L(i),{config:i,changed:s!==JSON.stringify(i),migratedSegments:o,migratedDrafts:a,migratedDraftSegments:n}}const Vn=t=>!!t&&"object"==typeof t&&!Array.isArray(t);function Jn(t,e){const s=(t,e)=>{if(Array.isArray(t)&&Array.isArray(e)){const i=new Map;for(const e of t)Vn(e)&&"string"==typeof e.id&&e.id&&i.set(e.id,e);const o=e.map((e,o)=>{if(Vn(e)&&"string"==typeof e.id&&e.id){const t=i.get(e.id);return t?s(t,e):bn(e)}return o[e,e in t?s(t[e],i):bn(i)]);for(const e of Object.keys(t))delete t[e];for(const[e,s]of i)t[e]=s;return t}return bn(e)};return s(t,e)}const Yn=t=>"object"==typeof t&&null!==t?t:null,Xn=t=>Array.isArray(t)?t.flatMap(t=>{const e=Yn(t);return e?[e]:[]}):[],Zn=t=>{if(!Array.isArray(t))return null;const e=Number(t[0]),s=Number(t[1]);return Number.isFinite(e)&&Number.isFinite(s)?[e,s]:null},Qn=t=>JSON.stringify(t??null),tr=(t,e=1e8)=>`${Math.round(t[0]*e)},${Math.round(t[1]*e)}`,er=(t,e,s=1e-8)=>Math.hypot(t[0]-e[0],t[1]-e[1])<=s,sr=(t,e,s)=>{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o,n=a>0?Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a)):0;return Math.hypot(t[0]-e[0]-n*i,t[1]-e[1]-n*o)},ir=(t,e,s)=>(e[0]-t[0])*(s[1]-t[1])-(e[1]-t[1])*(s[0]-t[0]),or=(t,e,s,i)=>{const o=2e-4*O,a=ir(t,e,s),n=ir(t,e,i),r=ir(s,i,t),l=ir(s,i,e);return a*n<=o*o&&r*l<=o*o&&Math.min(t[0],e[0])<=Math.max(s[0],i[0])+o&&Math.min(s[0],i[0])<=Math.max(t[0],e[0])+o&&Math.min(t[1],e[1])<=Math.max(s[1],i[1])+o&&Math.min(s[1],i[1])<=Math.max(t[1],e[1])+o?0:Math.min(sr(t,s,i),sr(e,s,i),sr(s,t,e),sr(i,t,e))},ar=t=>{const e=(s=t.poly,Array.isArray(s)?s.flatMap(t=>{const e=Zn(t);return e?[e]:[]}):[]);var s;if(e.length>=3)return e;const i=Number(t.x),o=Number(t.y),a=Number(t.w),n=Number(t.h);return[i,o,a,n].every(Number.isFinite)?[[i,o],[i+a,o],[i+a,o+n],[i,o+n]]:[]},nr=t=>{const e=ar(t);return e.map((t,s)=>[t,e[(s+1)%e.length]])},rr=(t,e)=>Math.max(0,Number(t)||0)/e*O,lr=(t,e=15)=>{const s=Number(t.cm);return Number.isFinite(s)?Math.max(0,s):e},hr=t=>Math.atan2(t.b[1]-t.a[1],t.b[0]-t.a[0]),cr=(t,e)=>{let s=Math.abs(hr(t)-hr(e));return s%=Math.PI,s=Math.min(s,Math.PI-s),s<=Math.PI/180&&Math.abs(t.cm-e.cm)<=1e-6};function dr(t,e){const s=Yn(t),i=Xn(s?.partitions).find(t=>t.id===e);if(!i)return null;const o=Zn(i.a),a=Zn(i.b),n=Number(i.cm);return!o||!a||!Number.isFinite(n)||n<0||er(o,a)?null:{partitionId:e,a:o,b:a,cm:n}}function pr(t,e){const s=Yn(t);if(!s)return null;const i=Number(s.cell_cm),o=Number.isFinite(i)&&i>0?i:5,a=rr(5,o),n=rr(e.cm,o)/2,r=Xn(s.rooms),l=Xn(s.wall_segments),h=new Map(l.map(t=>[String(t.id||""),t])),c=Xn(s.walls),d=t=>{const e=Array.isArray(t.wall_ids)?t.wall_ids.map(String):[];return nr(t).map(([t,s],i)=>{const a=[h.get(e[i]),...c.filter(e=>{const i=Zn(e.a),o=Zn(e.b);if(i&&o)return or(t,s,i,o)<=.02*O;const[a]=String(e.key||"").split("@"),n=Zn(a?.split(",").map(Number));return!!n&&sr(n,t,s)<=.02*O})].filter(t=>!!t),n=Math.max(15,...a.map(t=>lr(t,15)));return{a:t,b:s,half:rr(n,o)/2}})},p=r.flatMap(t=>{const s=String(t.id||""),i=d(t).some(({a:t,b:s,half:i})=>or(e.a,e.b,t,s)<=n+i+a);return s&&i?[s]:[]}),u=new Set(p);if(p.length){const t=r.filter(t=>u.has(String(t.id||""))).flatMap(d);for(const e of r){const s=String(e.id||"");s&&!u.has(s)&&(d(e).some(({a:e,b:s,half:i})=>t.some(t=>or(e,s,t.a,t.b)<=i+t.half+.02*O))&&u.add(s))}}const _=[...u],m=r.filter(t=>u.has(String(t.id||""))),g=new Set(m.flatMap(t=>Array.isArray(t.wall_ids)?t.wall_ids.map(String):[])),f=Xn(s.wall_segments).filter(t=>g.has(String(t.id||""))),b=m.flatMap(nr),v=Xn(s.walls).filter(t=>{const e=Zn(t.a),s=Zn(t.b);if(e&&s)return b.some(([t,i])=>or(e,s,t,i)<=.02*O);const[i]=String(t.key||"").split("@"),o=Zn(i?.split(",").map(Number));return!o||b.some(([t,e])=>sr(o,t,e)<=.02*O)}),{segments:y,malformedPartitions:$}=function(t){const e=[],s=[];for(const i of Xn(t.partitions)){const t=Zn(i.a),o=Zn(i.b);t&&o?e.push({key:`partition:${String(i.id||Qn(i))}`,source:i,a:t,b:o,cm:lr(i,0)}):s.push(i)}return{segments:e,malformedPartitions:s}}(s),w=new Set(y.flatMap(t=>or(e.a,e.b,t.a,t.b)<=n+rr(t.cm,o)/2+a?[t.key]:[]));let k=!0;for(;k;){k=!1;const t=y.filter(t=>w.has(t.key));for(const e of y)w.has(e.key)||t.some(t=>cr(t,e)&&(er(t.a,e.a)||er(t.a,e.b)||er(t.b,e.a)||er(t.b,e.b)))&&(w.add(e.key),k=!0)}const x=new Set(y.filter(t=>w.has(t.key)).flatMap(t=>[tr(t.a),tr(t.b)]));for(const t of y)(x.has(tr(t.a))||x.has(tr(t.b)))&&w.add(t.key);const S=y.filter(t=>w.has(t.key)),M=S.map(t=>t.source).concat($),C=Xn(s.wall_columns).filter(t=>{const s=Zn(t.center);if(!s)return!0;const i=rr(Number(t.cm),o)/2,r="circle"===t.shape?i:i*Math.SQRT2;return sr(s,e.a,e.b)<=n+r+a}),P=new Set(M.map(t=>String(t.id||""))),D=new Set(f.map(t=>String(t.id||""))),I=Xn(s.openings).filter(t=>{const s=Yn(t.host);if("partition"===s?.kind)return P.has(String(s.id||""));if("wall"===s?.kind&&D.has(String(s.id||"")))return!0;const i=Zn([t.x,t.y]);return!i||sr(i,e.a,e.b)<=n+a}),T=Xn(s.open_spans).filter(t=>{const s=Zn(t.a),i=Zn(t.b);return!s||!i||or(e.a,e.b,s,i)<=n+a});return{space:{...s,rooms:m,walls:v,wall_segments:f,open_spans:T,openings:I,partitions:M,wall_columns:C},roomIds:_,segmentCount:f.length+S.length}}const ur=1e3;const _r=(t,e)=>(t._clearGeometryGesture(),t._restoreGeometryStateLocal(e),t.host._showToast(t.host._t("toast.geometry_unsafe")),!1);function mr(t,e,s){const{host:i}=t,o=i._serverCfg,a=i._activeWallChainPartitionIds[i._activeWallChainPartitionIds.length-1]||null,n=()=>t._commitPhysicalGeometry(e,s);if(!s||!o||!a||10!==Number(o.model_version||0))return n();const r=o.spaces.find(t=>t.id===s.spaceId);if(!r||!function(t,e,s){const i=Yn(t),o=Yn(e);if(!i||!o||String(i.spaceId||"")!==String(o.id||""))return!1;if(["rooms","openings","walls","wall_segments","open_spans","wall_columns","decor"].some(t=>Qn(i[t]??[])!==Qn(o[t]??[])))return!1;const a=Yn(i.plan_transform)||{},n={};for(const t of["plan_x","plan_y","plan_scale","plan_scale_x","plan_scale_y","plan_angle"])void 0!==o[t]&&(n[t]=o[t]);if(Qn(a)!==Qn(n))return!1;const r=Xn(i.partitions),l=Xn(o.partitions);if(l.length!==r.length+1||Qn(l.slice(0,-1))!==Qn(r))return!1;const h=l[l.length-1],c=Zn(h.a),d=Zn(h.b);return h.id===s&&!!c&&!!d&&!er(c,d)&&Number.isFinite(Number(h.cm))&&Number(h.cm)>=0}(s,r,a))return n();let l;try{l=Kn(o).config}catch(e){return t._clearGeometryGesture(),t._restoreGeometryStateLocal(s),t._showWallModelMigrationBlocked(e),!1}const h=l.spaces.find(t=>t.id===s.spaceId),c=dr(h,a);if(!h||!c)return n();const d=JSON.parse(JSON.stringify(o));if(!t._restoreGeometryStateInConfig(d,s))return n();const p=d.spaces.find(t=>t.id===s.spaceId),u=pr(h,c),_=pr(p,c);if(!u||!_)return n();const m={...l,spaces:[u.space]},g={...d,spaces:[_.space]};let f=null,b=!1;try{const t=i._path.length>=2?i._path.map(t=>[t[0]/ur,t[1]/ur]):[];b=Sn(h)<=Sn(s,t)&&i._checkSpacePhysicalGeometry(m,s.spaceId,t=>{f=t}).ok}catch{b=!1}if(!b)return _r(t,s);const v=t._junctionLimitsIntroduced(m,g,s.spaceId,f,u.roomIds);if(v.length)return t._clearGeometryGesture(),t._restoreGeometryStateLocal(s),i._showToast(t._junctionLimitLabel(v[0])),!1;Jn(o,l);const y=o.spaces.find(t=>t.id===s.spaceId),$=y?.partitions?.find(t=>t.id===a),w=i._activeWallChainPartitionIds.length-1;$&&w>=0&&i._path.length===i._wallChainSegmentCms.length+1&&(i._path[w]=[$.a[0]*ur,$.a[1]*ur],i._path[w+1]=[$.b[0]*ur,$.b[1]*ur],i._wallChainSegmentCms[w]=Number($.cm)),t._recordGeometry(e,s);const k=i._pendingPhysicalWrites.get(s.spaceId);return i._pendingPhysicalWrites.set(s.spaceId,{before:k?.before||s,fingerprint:Y(y)}),t._saveConfig(),!0}const gr=(t,e)=>[(t[0]-e.x)/Math.max(1e-9,e.w)*e.stageWidth,(t[1]-e.y)/Math.max(1e-9,e.h)*e.stageHeight];function fr(t){const{poly:e,edge:s,text:i,view:o}=t,a=e[s],n=e[(s+1)%e.length],r=[(a[0]+n[0])/2,(a[1]+n[1])/2],l=function(t,e){const s=t[e],i=t[(e+1)%t.length],o=i[0]-s[0],a=i[1]-s[1],n=Math.hypot(o,a)||1;return(t=>{let e=0;for(let s=0;s=0?[-a/n,o/n]:[a/n,-o/n]}(e,s),h=Math.hypot(n[0]-a[0],n[1]-a[1])||1,c=[(n[0]-a[0])/h,(n[1]-a[1])/h],d=gr(r,o),p=gr(t.gearCenter,o),u=Math.max(34,7.2*i.length+12),_=Math.abs(l[0])>=Math.abs(l[1])?Math.max(28,u/2+4):Math.max(28,13),m=d[0]+l[0]*_,g=d[1]+l[1]*_,f=e=>{return s=m+c[0]*e,i=g+c[1]*e,o=u,a=18,n=p[0],r=p[1],l=t.gearWidthPx,h=t.gearHeightPx,2*Math.abs(s-n)=Math.abs(c[1])?c[0]:c[1])>0?-1:1,e=Math.max(o.stageWidth,o.stageHeight,64);for(let s=4;s<=e;s+=4){const e=s*t;if(!f(e)){b=e;break}const i=-e;if(!f(i)){b=i;break}}}const v=l[0]*_+c[0]*b,y=l[1]*_+c[1]*b,$=Math.hypot(v,y)||1,w=y/$*12,k=[r[0]+v/$*12*o.w/Math.max(1,o.stageWidth),r[1]+w*o.h/Math.max(1,o.stageHeight)];return{anchor:r,offsetXPx:v,offsetYPx:y,tangentOffsetPx:b,side:Math.abs(l[0])>=Math.abs(l[1])?l[0]<0?"left":"right":l[1]<0?"above":"below",leader:{a:r,b:k}}}const br=t=>{let e=(t%360+360)%360;return e>180&&(e-=360),e};function vr(t,e,s,i,o,a=0,n=[t,e],r){const l=1e-7,h=(t,e,s,i,o)=>{const a=Math.max(0,Math.min(1,((t[0]-e[0])*s+(t[1]-e[1])*i)/o));return{t:a,x:e[0]+a*s,y:e[1]+a*i}},c=t=>{if(!t||!Number.isFinite(t[0])||!Number.isFinite(t[1]))return null;const e=Math.hypot(t[0],t[1]);return e>1e-9?[t[0]/e,t[1]/e]:null},d=c(r);let p=null;for(const r of i){const i=Number(r?.a?.[0]),u=Number(r?.a?.[1]),_=Number(r?.b?.[0]),m=Number(r?.b?.[1]);if(![i,u,_,m].every(Number.isFinite))continue;const g=_-i,f=m-u,b=g*g+f*f;if(!(b>1e-18))continue;const v=Math.sqrt(b),y=h(n,[i,u],g,f,b),$=Math.hypot(n[0]-y.x,n[1]-y.y);if(!($=2?r.axisA:r.a,e=r.axisB?.length>=2?r.axisB:r.b,s=Number(e[0])-Number(t[0]),i=Number(e[1])-Number(t[1]),o=s*s+i*i;if(o>1e-18&&[t[0],t[1],e[0],e[1]].every(Number.isFinite)){const e=h(n,t,s,i,o),a=(n[0]-e.x)*w[0]+(n[1]-e.y)*w[1];if(a>l)k=2;else if(a<-1e-7){if(r.roomSide)continue;k=-2}else d&&(k=w[0]*d[0]+w[1]*d[1])}}else{let t=n[0]-y.x,e=n[1]-y.y;const s=Math.hypot(t,e);if(s>l)t/=s,e/=s,k=2;else if(d)[t,e]=d,k=1;else{const s=i<_||i===_&&u<=m;t=-(s?f:-f)/v,e=(s?g:-g)/v}w=[t,e]}const x=h([t,e],[i,u],g,f,b);let S=x.t,M=x.x,C=x.y;if(Number.isFinite(a)&&a>0){const t=Math.round(S*v/a)*a;S=Math.max(0,Math.min(1,t/v)),M=i+S*g,C=u+S*f}const P=br(180*Math.atan2(-w[0],w[1])/Math.PI),D={cx:M+w[0]*(s/2),cy:C+w[1]*(s/2),angle:P,dist:$,sideScore:k,stableId:"string"==typeof r.stableId?r.stableId:""};(!p||D.distp.sideScore+l||Math.abs(D.sideScore-p.sideScore)<=l&&D.stableId.localeCompare(p.stableId)<0))&&(p=D)}return p&&{cx:p.cx,cy:p.cy,angle:p.angle,dist:p.dist}}const yr=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1]),$r=(t,e)=>{const s=t=>`${t[0].toFixed(9)},${t[1].toFixed(9)}`,i=s(t),o=s(e);return i<=o?`${i}|${o}`:`${o}|${i}`};function wr(t,e,s,i,o,a,n=1){const r=[],l=new Map;for(const h of t||[]){const c="string"==typeof h?.id?h.id:"";if(!c)continue;const d=et(t,c,e,s,i,o,a,n);if(d)for(let t=0;t1e-9))continue;const a=st(d.poly,t),n=Number(d.offsets[t]),h=Number.isFinite(n)&&n>0?n:0,p=[e[0],e[1]],u=[s[0],s[1]],_=$r(p,u),m=l.get(_)||new Set;m.add(c),l.set(_,m),r.push({a:[p[0]+a[0]*h,p[1]+a[1]*h],b:[u[0]+a[0]*h,u[1]+a[1]*h],axisA:p,axisB:u,normal:a,owner:"room",stableId:`room:${c}:${_}`,roomId:c,atomId:_,half:h})}}const h=[];for(const t of r){const{atomId:e,half:s,...i}=t;if(!(1===l.get(e)?.size&&s>1e-9)){h.push(i);continue}const o=i.normal;h.push({...i,roomSide:"inside",stableId:`${i.stableId}:inside`}),h.push({...i,a:[i.axisA[0]-o[0]*s,i.axisA[1]-o[1]*s],b:[i.axisB[0]-o[0]*s,i.axisB[1]-o[1]*s],normal:[-o[0],-o[1]],roomSide:"outside",stableId:`${i.stableId}:outside`})}return h}function kr(t){const e=[],s=new Set;for(const i of t||[])if(Array.isArray(i)&&!(i.length<2))for(let t=0;t1e-9))continue;const n=[o[0],o[1]],r=[a[0],a[1]],l=`physical:${$r(n,r)}`;s.has(l)||(s.add(l),e.push({a:n,b:r,axisA:[...n],axisB:[...r],normal:null,owner:"physical",stableId:l}))}return e}const xr=new WeakMap;const Sr=1e-9,Mr=2e-7,Cr=1e7,Pr=t=>{const e=Math.sign(t)*Math.floor(Math.abs(t)*Cr+.5)/Cr;return Object.is(e,-0)?0:e},Dr=t=>`${Pr(t[0])},${Pr(t[1])}`,Ir=(t,e)=>Math.hypot(e[0]-t[0],e[1]-t[1]),Tr=(t,e,s)=>t/(e||1)*s,zr=(t,e)=>Math.atan2(e[1]-t[1],e[0]-t[0]),Rr=t=>Array.isArray(t)&&t.length>=2&&t.every(t=>Number.isFinite(t)),Ar=t=>(t||[]).filter(t=>Rr(t?.a)&&Rr(t?.b)&&Ir(t.a,t.b)>Sr);function Fr(t,{minAngleDeg:e=15,maxValence:s=6}={}){const i=new Map;for(const e of Ar(t))for(const[t,s]of[[e.a,e.b],[e.b,e.a]]){const e=i.get(Dr(t))||[];e.push(zr(t,s)),i.set(Dr(t),e)}const o=[];for(const[t,a]of i){if(a.length>s&&o.push({rule:"valence",subject:t,actual:a.length,limit:s}),a.length<2)continue;const i=[...a].sort((t,e)=>t-e);let n=1/0;for(let t=0;tSr&&s(180*Math.atan2(t.b[1]-t.a[1],t.b[0]-t.a[0])/Math.PI%180+180)%180,Er=(t,e,s=1)=>{const i=Math.abs(Nr(t)-Nr(e));return Math.min(i,180-i)<=s},Hr=t=>{const e=new Map;for(const s of t)for(const t of[s.a,s.b]){const i=e.get(Dr(t));i?i.push(s):e.set(Dr(t),[s])}return e};function Or(t,e,s){const i=Ar(e),o=s??Hr(i),a=new Set([t]);let n=Ir(t.a,t.b);const r=[t.a,t.b];for(;r.length;){const e=r.pop();for(const s of o.get(Dr(e))||[])a.has(s)||Er(s,t)&&Number(s.cm||0)===Number(t.cm||0)&&(a.add(s),n+=Ir(s.a,s.b),r.push(s.a,s.b))}return n}function Lr(t,e,s,{minLengthCm:i=20}={}){const o=[],a=Ar(t),n=Hr(a);for(const t of a){const r=Or(t,a,n)/s*(e||1),l=Math.max(i,Number(t.cm)>0?Number(t.cm):0);r{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o,n=a<=Sr?0:Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a));return Math.hypot(t[0]-(e[0]+i*n),t[1]-(e[1]+o*n))};function Wr(t,e,s,{minDistanceCm:i=5}={}){const o=Ar(t),a=new Map;for(const t of o)a.set(Dr(t.a),t.a),a.set(Dr(t.b),t.b);const n=Tr(i,e,s),r=n>Sr?n:1,l=(t,e)=>`${Math.floor(t/r)},${Math.floor(e/r)}`,h=new Map;for(const[t,e]of a){const s=l(e[0],e[1]),i=h.get(s);i?i.push([t,e]):h.set(s,[[t,e]])}const c=new Map;for(const t of o){const e=Math.min(t.a[0],t.b[0])-n,s=Math.max(t.a[0],t.b[0])+n,i=Math.min(t.a[1],t.b[1])-n,o=Math.max(t.a[1],t.b[1])+n;for(let a=Math.floor(e/r);a<=Math.floor(s/r);a++)for(let e=Math.floor(i/r);e<=Math.floor(o/r);e++){const s=`${a},${e}`,i=c.get(s);i?i.push(t):c.set(s,[t])}}const d=[];for(const[t,o]of a){const a=Math.floor(o[0]/r),l=Math.floor(o[1]/r);for(let r=-1;r<=1;r++)for(let c=-1;c<=1;c++)for(const[p,u]of h.get(`${a+r},${l+c}`)||[]){if(t>=p)continue;const a=Ir(o,u);a<=Mr||a{const i=a[(s+1)%a.length];return t+(e[0]*i[1]-i[0]*e[1])},0))/2,r=(s||1)/i,l=n*r*r;return l0&&o.push(...e.slice(0,i))}return o}async function qr(t,e,s){t._saveConfigDebounced.pending()&&t._saveConfigDebounced.flush(),await t._writeChain;const i=await t.hass.callWS({type:"houseplan/plan/optimize",config:e,layout:s,expected_config_rev:t._cfgRev,expected_layout_rev:t._layoutRev});t._adoption.acceptPairWrite(e,s,i),t._geometryHistory.clear(),t._cancelDeviceDrag(),t._devicePositionHistory.clear(),t._canOptimizeUndo=!0===i.can_undo,t._undoKind=!0===i.can_undo?"optimize":null,t._dirtyPos.clear(),t._sentPos.clear(),t._cfgEpoch++,t._modelCache=null,t._frame=null,t._regSignature="",t._maybeRebuildDevices(),t._cacheSnapshot(),t.requestUpdate()}const Ur=1e-6*O,Kr=6*O;function Vr(t){return Number.isFinite(t)?Math.round(t/O)*O:t}const Jr=(t,e,s,i)=>Math.hypot(s-t,i-e),Yr=(t,e,s,i,o,a,n,r)=>Math.hypot(Math.max(Math.abs(o-t),Math.abs(o+n-(t+s))),Math.max(Math.abs(a-e),Math.abs(a+r-(e+i)))),Xr=(t,e,s,i,o,a,n)=>{const r=Math.max(Number(i)||0,0)/2,l=Math.PI/180,h=Math.cos(s*l)*r,c=Math.sin(s*l)*r,d=Math.cos(n*l)*r,p=Math.sin(n*l)*r,u=Math.max(Jr(t+h,e+c,o+d,a+p),Jr(t-h,e-c,o-d,a-p)),_=Math.max(Jr(t+h,e+c,o-d,a-p),Jr(t-h,e-c,o+d,a+p));return Math.min(u,_)},Zr=t=>{const e=Number(t?.cell_cm);return e>0?e:5};function Qr(t,e){const s=JSON.parse(JSON.stringify(t||[])),i=JSON.parse(JSON.stringify(e||{}));let o=0,a=0,n=0,r=0,l="",h=0,c=0;const d=(t,e)=>{Number.isFinite(t)&&Number.isFinite(e)&&t!==e&&Math.abs(e-t)<=Ur&&c++},p=(t,e)=>{d(t[0],e[0]),d(t[1],e[1])},u={};let _=5;for(const t of s){const e=Zr(t);null!=t?.id&&(u[String(t.id)]=e),e>_&&(_=e)}const m=(t,e,s,i=!1)=>{if(!(t>Ur||i))return;o++,t>n&&(n=t);const a=t*ht*e;a>r&&(r=a,l=s)};for(const t of s){const e=Zr(t),s=null!=t?.id?String(t.id):"";for(const i of t.rooms||[]){a++;let t=0;if(i.poly?.length)i.poly=i.poly.map(e=>{const s=[Vr(e[0]),Vr(e[1])];return t=Math.max(t,Jr(e[0],e[1],s[0],s[1])),p(e,s),s});else if(null!=i.x&&null!=i.y){const e=i.x,s=i.y,o=i.w||0,a=i.h||0,n=Vr(e+o),r=Vr(s+a),l=Vr(e),h=Vr(s),c=Math.max(O,n-l),p=Math.max(O,r-h);t=Yr(e,s,o,a,l,h,c,p),i.x=l,i.y=h,i.w=c,i.h=p,d(e,l),d(s,h),d(e+o,l+c),d(s+a,h+p)}m(t,e,s)}for(const i of t.partitions||[]){a++;const o=[i.a[0],i.a[1]],n=[i.b[0],i.b[1]],r=[Vr(o[0]),Vr(o[1])],l=[Vr(n[0]),Vr(n[1])];let h=Math.max(Jr(o[0],o[1],r[0],r[1]),Jr(n[0],n[1],l[0],l[1]));const c=Jr(r[0],r[1],l[0],l[1]),d=(t.openings||[]).filter(t=>"partition"===t.host?.kind&&t.host.id===i.id).every(t=>{const e=Number(t.length),s=Number(t.host.t),i=s*c;return Number.isFinite(e)&&e>0&&Number.isFinite(s)&&s>=0&&s<=1&&i-e/2>=-Ur&&i+e/2<=c+Ur});c>Ur&&d?(i.a=r,i.b=l,p(o,r),p(n,l)):h=0,m(h,e,s)}for(const i of t.wall_columns||[]){a++;const t=[i.center[0],i.center[1]],o=[Vr(t[0]),Vr(t[1])],n=Jr(t[0],t[1],o[0],o[1]);i.center=o,p(t,o),m(n,e,s)}for(const i of t.decor||[]){if("furniture"===i.kind||"image"===i.kind)continue;a++;let t=0;if("line"===i.kind){const e=[i.x1,i.y1],s=[i.x2,i.y2],o=[Vr(e[0]),Vr(e[1])],a=[Vr(s[0]),Vr(s[1])];t=Math.max(Jr(e[0],e[1],o[0],o[1]),Jr(s[0],s[1],a[0],a[1])),i.x1=o[0],i.y1=o[1],i.x2=a[0],i.y2=a[1],p(e,o),p(s,a)}else{const e=i.x,s=i.y,o=i.w,a=i.h,n=Vr(e),r=Vr(s);if(null!=i.w&&null!=i.h){const l=Vr(e+o),h=Vr(s+a),c=Math.max(O,l-n),p=Math.max(O,h-r);t=Yr(e,s,o,a,n,r,c,p),i.w=c,i.h=p,d(e+o,n+c),d(s+a,r+p)}else t=Jr(e,s,n,r);i.x=n,i.y=r,d(e,n),d(s,r)}m(t,e,s)}for(const i of t.openings||[]){if(a++,"partition"===i.host?.kind){const o=(t.partitions||[]).find(t=>t.id===i.host.id),a=Number(i.host.t);if(!o||!Number.isFinite(a)||a<0||a>1)continue;const n=o.b[0]-o.a[0],r=o.b[1]-o.a[1];if(Math.hypot(n,r)<=Ur)continue;const l=o.a[0]+n*a,c=o.a[1]+r*a;let d=180*Math.atan2(r,n)/Math.PI;d>=90?d-=180:d<-90&&(d+=180);const p=Number(i.angle),u=!(Number.isFinite(p)&&p===d),_=Xr(i.x,i.y,Number.isFinite(p)?p:d,Number(i.length)||0,l,c,d);i.x=l,i.y=c,i.angle=d,u&&h++,m(_,e,s,u);continue}const o=lt([i.x,i.y],t.rooms||[],Kr,{step:O,length:Number(i.length)||0});if(!o)continue;const n=Number(i.angle),r=!(Number.isFinite(n)&&n===o.angle),l=Xr(i.x,i.y,Number.isFinite(n)?n:o.angle,Number(i.length)||0,o.x,o.y,o.angle);i.x=o.x,i.y=o.y,i.angle=o.angle,r&&h++,m(l,e,s,r)}}for(const[t,e]of Object.entries(i)){if(!e||"object"!=typeof e)continue;const s=e;if("number"!=typeof s.x||"number"!=typeof s.y)continue;a++;const o=Vr(s.x),n=Vr(s.y),r=Jr(s.x,s.y,o,n);i[t]={...s,x:o,y:n},d(s.x,o),d(s.y,n);const l="string"==typeof s.s?s.s:"";m(r,u[l]??_,l)}return{spaces:s,layout:i,report:{moved:o,coordsCanonicalized:c,total:a,maxShift:n,maxShiftCm:r,maxSpace:l,rotated:h},changed:o>0||c>0}}function tl(t,e){const s=e.base+t*e.span;return Math.min(1,Math.max(0,s))}const el=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1]),sl=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1]);function il(t,e,s){const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o;if(a<=0)return sl(t,e);let n=((t[0]-e[0])*i+(t[1]-e[1])*o)/a;return n=Math.max(0,Math.min(1,n)),Math.hypot(t[0]-(e[0]+i*n),t[1]-(e[1]+o*n))}function ol(t,e,s,i,o){for(const i of e)if(i&&!s.has(i.id)&&el(i.a)&&el(i.b)&&(sl(t,i.a)<=o||sl(t,i.b)<=o))return!0;for(const e of i?.roomPolygons||[])for(let s=0;s0&&r>0))return null;if(Math.abs(o[0]/n*(a[1]/r)-o[1]/n*(a[0]/r))>s)return null;for(const[s,o]of[[t.a,e.a],[t.a,e.b],[t.b,e.a],[t.b,e.b]])if(sl(s,o)<=i)return[(s[0]+o[0])/2,(s[1]+o[1])/2];return null}function nl(t,e){const s=.05*(Number(e.pitch)>0?Number(e.pitch):1),i=new Map;let o=(t||[]).filter(t=>!!t&&"string"==typeof t.id&&el(t.a)&&el(t.b));if(o.length<2)return{partitions:[...t||[]],merged:0,openingMoves:[]};const a=e.seedIds&&e.seedIds.length?new Set(e.seedIds):null;let n=0;for(let t=0;tsl(e,t.at)>s);let c=h[0]??r.a,d=h[h.length-1]??l.b;if(h.length<2&&(c=r.a,d=l.b),d[0]0?(d[0]-c[0])/u:0,m=u>0?(d[1]-c[1])/u:0,g=t=>u>0?((t[0]-c[0])*_+(t[1]-c[1])*m)/u:0;for(const t of[r,l]){const e=g(t.a),s=g(t.b)-e;for(const[o,a]of i)a.toId===t.id&&i.set(o,{fromId:a.fromId,toId:p.id,base:e+a.base*s,span:a.span*s});i.set(t.id,{fromId:t.id,toId:p.id,base:e,span:s})}a&&a.add(p.id),o=o.filter((e,s)=>s!==t.i&&s!==t.j),o.splice(t.i,0,p),n++}return{partitions:o,merged:n,openingMoves:[...i.values()]}}function rl(t,e,s,i){if(!t?.length||!s.length)return 0;const o=new Map(s.map(t=>[t.fromId,t]));let a=0;for(const s of t){const t=s?.host;if(!t||"partition"!==t.kind)continue;const n=o.get(t.id);if(!n)continue;s.host={...t,id:n.toId,t:tl(t.t,n)},a++;const r=ct(s,e,i.coordScale,i.cellCm,i.gridPitch).resolved;r&&Object.assign(s,dt(s,r,i.coordScale))}return a}function ll(t){return{roomPolygons:(t?.rooms||[]).map(t=>B(t)).filter(t=>!!t),columns:t?.wall_columns||[]}}const hl=t=>!!t&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1]),cl=(t,e)=>t[0]-e[0]||t[1]-e[1],dl=(t,e,s,i)=>[t[0]+e*i,t[1]+s*i],pl=(t,e,s,i)=>(t[0]-e[0])*s+(t[1]-e[1])*i,ul=(t,e,s,i,o)=>{const a=e[0]-t[0],n=e[1]-t[1],r=Math.hypot(a,n);if(!(r>o))return null;const l=a/r,h=n/r,c=e=>Math.abs((e[0]-t[0])*h-(e[1]-t[1])*l);if(c(s)>o||c(i)>o)return null;const d=pl(s,t,l,h),p=pl(i,t,l,h),u=Math.max(0,Math.min(d,p)),_=Math.min(r,Math.max(d,p));return _-u>o?{lo:u,hi:_}:null},_l=(t,e,s)=>Math.min(t.hi,e.hi)-Math.max(t.lo,e.lo)>s,ml=t=>{const e=new Set(["id","a","b","cm"]);return Object.keys(t||{}).every(t=>e.has(t))},gl=(t,e,s,i)=>{const o=t.b[0]-t.a[0],a=t.b[1]-t.a[1],n=Math.hypot(o,a);if(!(n>i))return!0;const r=o/n,l=a/n,h=$(t.cm,s.cellCm,s.gridPitch)/2;return e.some(e=>{const o=e?.center;if(!hl(o))return!0;const a=pl(o,t.a,r,l),c=Math.abs((o[0]-t.a[0])*l-(o[1]-t.a[1])*r),d=$(Number(e.cm),s.cellCm,s.gridPitch)*("square"===e.shape?Math.SQRT1_2:.5);return!(Number.isFinite(d)&&d>0)||a>=-d-i&&a<=n+d+i&&c<=h+d+i})},fl=(t,e,s)=>{if(t.host){const i=ct(t,e,s.coordScale,s.cellCm,s.gridPitch).resolved;return i?{center:i.center,angle:i.angle,length:i.length}:null}const i=Number(t.x)*s.coordScale,o=Number(t.y)*s.coordScale,a=Number(t.angle),n=Number(t.length)*s.coordScale;return[i,o,a,n].every(Number.isFinite)&&n>0?{center:[i,o],angle:a,length:n}:null},bl=(t,e,s)=>{const i=t.angle*Math.PI/180,o=Math.cos(i),a=Math.sin(i),n=e.angle*Math.PI/180,r=Math.cos(n),l=Math.sin(n);if(Math.abs(o*l-a*r)>1e-6)return!1;const h=e.center[0]-t.center[0],c=e.center[1]-t.center[1];if(Math.abs(h*a-c*o)>s)return!1;const d=h*o+c*a;return Math.max(-t.length/2,d-e.length/2)({...t,a:[t.a[0]*e,t.a[1]*e],b:[t.b[0]*e,t.b[1]*e]}),yl=(t,e,s,i)=>{const o=`~r-${(t=>{let e=2166136261;for(let s=0;s>>0;return e.toString(36)})(`${t}|${e[0].toFixed(9)},${e[1].toFixed(9)}|${s[0].toFixed(9)},${s[1].toFixed(9)}`)}`,a=`${t.slice(0,Math.max(1,64-o.length))}${o}`;let n=a;for(let t=2;i.has(n);t++){const e=`-${t}`;n=`${a.slice(0,64-e.length)}${e}`}return i.add(n),n},$l=(t,e)=>{const s=[];for(const i of t){const t=s[s.length-1];!(t&&Math.abs(t.hi-i.lo)<=e&&t.safe===i.safe)||i.safe&&t.signature!==i.signature?s.push({lo:i.lo,hi:i.hi,a:i.a,b:i.b,safe:i.safe,signature:i.signature,roomIds:i.roomIds,finalCm:i.finalCm}):(t.hi=i.hi,t.b=i.b)}return s};function wl(t,e,s,i,o){const a=s||[],n=Array.isArray(t?.partitions)?t.partitions:[],r=Array.isArray(t?.openings)?t.openings:[],l={walls:a,partitions:n,openings:r,partitionsReconciled:0,openingsRehosted:0};if(!n.length)return l;const h=Math.max(2e-4*o.gridPitch,1e-9);let c=a,d=n,p=r,u=0,_=0;const m=o.partitionIds?new Set(o.partitionIds):null,g=new Map(e.partitions.map(t=>[t.id,t]));for(const t of[...n].sort((t,e)=>t.id.localeCompare(e.id))){if(m&&!m.has(t.id))continue;if(!d.some(e=>e.id===t.id))continue;if(!ml(t))continue;const s=g.get(t.id);if(!(s&&hl(s.a)&&hl(s.b)&&Number.isFinite(s.cm)&&(o.allowCoincidentPartitions?!(s.cm<0):s.cm>0)))continue;const[a,n]=cl(s.a,s.b)<=0?[[s.a[0],s.a[1]],[s.b[0],s.b[1]]]:[[s.b[0],s.b[1]],[s.a[0],s.a[1]]],r=n[0]-a[0],l=n[1]-a[1],f=Math.hypot(r,l);if(!(f>h))continue;const b=r/f,v=l/f,y=pt(e.rooms,c,i,o.pitch,o.cellCm,o.gridPitch,o.coordScale),$=y.flatMap(t=>{if(t.open||"outer"!==t.kind&&"shared"!==t.kind)return[];const e=ul(a,n,t.a,t.b,h);return e?[{interval:t,range:e}]:[]});if(!$.length)continue;const w=p.filter(t=>"partition"===t.host?.kind&&t.host.id===s.id).map(t=>({opening:t,resolved:ct(t,e.partitions,o.coordScale,o.cellCm,o.gridPitch).resolved}));if(w.some(t=>!t.resolved))continue;const k=[0,f];for(const{range:t}of $)k.push(t.lo,t.hi);const x=k.slice(),S=new Map;for(const{opening:t,resolved:e}of w){const s=pl(e.center,a,b,v),i={lo:s-e.length/2,hi:s+e.length/2};S.set(t.id,i),x.push(Math.max(0,i.lo),Math.min(f,i.hi))}const M=[...new Set(x.filter(t=>Number.isFinite(t)&&t>=-h&&t<=f+h).map(t=>Math.max(0,Math.min(f,t)).toFixed(9)))].map(Number).sort((t,e)=>t-e),C=d.map(t=>vl(t,o.coordScale)).filter(t=>t.id!==s.id),P=[];for(let t=0;t+1h))continue;const r=dl(a,b,v,i),l=dl(a,b,v,n),c=$.filter(({range:t})=>t.lo<=i+h&&t.hi>=n-h).map(({interval:t})=>t),d=new Map;for(const t of c)d.set(t.roomId,t);const p=[...d.values()],u=new Set(p.map(t=>t.kind)),_=new Set(p.map(t=>o.allowCoincidentPartitions||t.cm>0?t.cm:ut)),m=p[0]?.kind,g=[...d.keys()].sort(),f=1===u.size&&1===_.size&&("outer"===m&&1===g.length||"shared"===m&&2===g.length),y={id:s.id,a:r,b:l,cm:s.cm},w=C.some(t=>!!ul(r,l,t.a,t.b,h)),k=f&&(o.allowCoincidentPartitions||!w)&&!gl(y,e.wall_columns,o,h),x=f?o.allowCoincidentPartitions||p[0].cm>0?p[0].cm:ut:0,S=f?Math.max(x,s.cm):s.cm;P.push({lo:i,hi:n,a:r,b:l,safe:k,signature:k?`${m}|${g.join(",")}|${S}`:"",roomIds:g,roomCm:x,finalCm:S})}if(!P.some(t=>t.safe))continue;const D=new Map;for(const{opening:t,resolved:e}of w){const i=S.get(t.id),a=k.some(t=>t>i.lo+h&&t_l(t,i,h)),r=new Set(n.filter(t=>t.safe).map(t=>t.signature));if(!a&&n.length>0&&n.every(t=>t.safe)&&1===r.size&&_t(e,y,h)){D.set(t.id,{resolved:e,signature:[...r][0]});continue}const l=mt(s,o.cellCm,o.gridPitch),c={lo:i.lo-l,hi:i.hi+l};for(const t of P)_l(t,c,h)&&(t.safe=!1,t.signature="")}let I=!0;for(;I;){I=!1;for(const[t,e]of[...D.entries()]){const i=S.get(t),a=P.filter(t=>_l(t,i,h));if(a.length>0&&a.every(t=>t.safe)&&a.every(t=>t.signature===e.signature))continue;D.delete(t);const n=mt(s,o.cellCm,o.gridPitch),r={lo:i.lo-n,hi:i.hi+n};for(const t of P)_l(t,r,h)&&(t.safe=!1,t.signature="");I=!0}}const T=$l(P,h),z=T.filter(t=>t.safe),R=T.filter(t=>!t.safe);if(!z.length)continue;if(d.length-1+R.length>2e3)continue;let A=c;for(const t of z){const[e,i]=cl(s.a,s.b)<=0?[t.a,t.b]:[t.b,t.a];A=gt(A,e,i,t.finalCm,o.pitch,o.coordScale)}if(A=ft(e.rooms,A,i,o.pitch,o.cellCm,o.gridPitch,o.coordScale),A.length>500)continue;const F=new Set(d.map(t=>t.id));F.delete(s.id);const N=R.map((t,e)=>{const i=[t.a[0]/o.coordScale,t.a[1]/o.coordScale],a=[t.b[0]/o.coordScale,t.b[1]/o.coordScale],n=0===e?s.id:yl(s.id,i,a,F);return F.add(n),{id:n,a:i,b:a,cm:s.cm}}),E=d.findIndex(t=>t.id===s.id),H=d.slice();H.splice(E,1,...N);const O=H.map(t=>vl(t,o.coordScale)),L=new Map;let B=!0;for(const{opening:t,resolved:e}of w){const s=D.get(t.id);if(s){const e=dt(t,s.resolved,o.coordScale),{host:i,...a}=e;L.set(t.id,a);continue}const i=S.get(t.id),a=N[R.findIndex(t=>t.lo<=i.lo+h&&t.hi>=i.hi-h)],n=a&&O.find(t=>t.id===a.id);if(!a||!n){B=!1;break}const r=n.b[0]-n.a[0],l=n.b[1]-n.a[1],c=Math.hypot(r,l),d=pl(e.center,n.a,r/c,l/c),p={...dt(t,e,o.coordScale),host:{kind:"partition",id:a.id,t:d/c}};if(!bt(p,O,o.coordScale,o.cellCm,o.gridPitch).resolved){B=!1;break}L.set(t.id,p)}if(!B)continue;const W=p.map(t=>L.get(t.id)||t),j=[...D.keys()].map(t=>L.get(t)),G=j.map(t=>fl(t,O,o));if(G.some(t=>!t))continue;let q=!1;for(let t=0;tt.id));for(const t of W){if(U.has(t.id))continue;const e=fl(t,O,o);e&&G.some(t=>bl(t,e,h))&&(q=!0)}if(q)continue;const K=vt(e.rooms,A,i,o.pitch,o.cellCm,o.gridPitch,o.coordScale);[...D.entries()].every(([t,e])=>{const s=L.get(t),i=yt(K,{x:s.x*o.coordScale,y:s.y*o.coordScale,angle:s.angle,length:s.length*o.coordScale},!0),a=[i.negative,i.positive].filter(t=>!!t?.full),n=e.signature.split("|")[1].split(","),r=new Set(a.map(t=>t.roomId));return a.length===n.length&&r.size===n.length&&n.every(t=>r.has(t))})&&(c=A,d=H,p=W,u+=z.length,_+=D.size)}return{walls:c,partitions:d,openings:p,partitionsReconciled:u,openingsRehosted:_}}const kl=t=>JSON.parse(JSON.stringify(t)),xl=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Sl=(t,e)=>e.length>0&&e.length<=35&&("space"===t?/^[a-z0-9_-]+$/.test(e):/^[A-Za-z0-9_-]+$/.test(e));function Ml(t,e){let s=String(e??"");const i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`^${i}_(.+)_([0-9a-f]{8})$`);let a=0;for(;a<16;a++){const t=o.exec(s);if(!t)return{root:s,layers:a,bounded:!1};s=t[1]}return{root:s,layers:a,bounded:o.test(s)}}const Cl=(t,e,s)=>{const i=t.get(e)||[];i.push(s),t.set(e,i)};const Pl=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Dl=(t,e,s)=>Math.min(s,Math.max(e,t)),Il=t=>At({spaces:[t]})[0],Tl=(t,e,s)=>{const i=s>0?s:1,o=t=>`${(t[0]/i).toFixed(12)},${(t[1]/i).toFixed(12)}`,a=o(t),n=o(e);return a0?n:1,l=Math.max(i*r*.02,1e-9),h=[];for(const e of t||[])for(const t of B(e)||[])h.push([t[0],t[1]]);const c=[];for(const t of s||[])Array.isArray(t)&&t.length>=4&&t.slice(0,4).every(Number.isFinite)&&c.push([t[0],t[1]],[t[2],t[3]]);const d=(t,e)=>e.some(e=>Math.hypot(t[0]-e[0],t[1]-e[1])<=2*l),p=new Map;for(const n of t||[]){if(!n?.id)continue;const u=et(t,n.id,e,s,i,o,a,r);if(u)for(let t=0;t0&&_>0&&n===m&&_!==n))continue;const g=u.poly[i],f=u.poly[(i+1)%u.poly.length],b=Math.hypot(f[0]-g[0],f[1]-g[1]);if(!(b>l&&b<.5*a-1e-9*a))continue;if(d(g,c)||d(f,c))continue;if(d(g,h)&&d(f,h))continue;const v=Tl(g,f,r),y=p.get(v);y?y.targets.add(n):p.set(v,{a:[g[0],g[1]],b:[f[0],f[1]],targets:new Set([n])})}}}let u=e.slice();const _=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1])<=2*l,m=(t,e)=>{if(!Array.isArray(t.a)||!Array.isArray(t.b)||t.a.length<2||t.b.length<2)return!1;const s=[Number(t.a[0])*r,Number(t.a[1])*r],i=[Number(t.b[0])*r,Number(t.b[1])*r];return!![...s,...i].every(Number.isFinite)&&(_(s,e.a)&&_(i,e.b)||_(s,e.b)&&_(i,e.a))};for(const t of[...p.values()].filter(t=>1===t.targets.size).sort((t,e)=>Tl(t.a,t.b,r).localeCompare(Tl(e.a,e.b,r)))){const e=[...t.targets][0],s=u.filter(e=>m(e,t));if(new Set(s.map(t=>t.cm)).size>1)continue;let o=!1;u=u.map(s=>m(s,t)?(o=!0,s.cm===e?s:{...s,cm:e}):s),o||(u=gt(u,t.a,t.b,e,i,r))}return u}const Rl=t=>{const e=[];for(const s of t||[]){const t=B(s);if(t?.length)for(let s=0;s"string"==typeof t?.id?t.id:"").filter(Boolean),c=new Set(h),d=new Map;for(const t of h){const e=Ml("space",t);e.layers>0&&Sl("space",e.root)&&Cl(d,e.root,t)}const p=new Map,u=new Map,_=new Map,m=new Map;for(const t of r){const e="string"==typeof t?.id?t.id:"";if(!e)continue;const s=new Map;for(const i of Array.isArray(t.rooms)?t.rooms:[]){const t="string"==typeof i?.id?i.id:"";if(!t)continue;const o=Ml("room",t);o.layers>0&&Sl("room",o.root)&&Cl(s,o.root,t),u.has(t)||u.set(t,e),_.has(t)||_.set(t,String(i.name||""));const a="string"==typeof i.area?i.area:"";if(a){const s=m.get(a)||[];s.push({spaceId:e,roomId:t}),m.set(a,s)}}p.set(e,s)}const g=new Set(u.keys()),f=new Map,b=new Map;for(const t of l)"string"==typeof t?.id&&t.id&&(!0===t.removed?b.set(t.id,t):f.set(t.id,t));const v={spaceRefsRemapped:0,roomRefsRemapped:0,positionsRemapped:0,markersDetached:0,positionsUnresolved:0,nestedRefsUnresolved:0,deadSpaceIds:[],orphanRoomLabelsRemoved:0,orphanDevicePositionsRemoved:0,orphanGroupPositionsRemoved:0,liveMissingPositionsRemoved:0,removedPositions:[],liveMissingPositions:[],unverifiedPositions:[]},y=new Set,$=t=>c.has(t)?null:(()=>{const e=Ml("space",t).root;if(!Sl("space",e))return null;const s=d.get(e)||[];return 1===s.length?s[0]:null})(),w=(t,e)=>{const s=Ml("room",t).root;if(!Sl("room",s))return null;const i=p.get(e)?.get(s)||[];return 1===i.length?i[0]:null},k=t=>{const e=s.effectiveAreaByMarker?.[t]||"",i=e&&m.get(e)||[];return 1===i.length?i[0]:null},x=(t,e,s)=>{if("string"==typeof t.room_id&&t.room_id&&!g.has(t.room_id)){const i=e?w(t.room_id,e):null;i?(t.room_id=i,v.roomRefsRemapped++):s?(t.room_id=s.roomId,v.roomRefsRemapped++):!0!==t.removed&&delete t.room_id}const i=t.vacuum?.segment_map;if(i&&"object"==typeof i&&!Array.isArray(i))for(const t of Object.keys(i)){const s=i[t];if("string"!=typeof s||!s||g.has(s))continue;const o=e?w(s,e):null;o?(i[t]=o,v.roomRefsRemapped++):v.nestedRefsUnresolved++}};for(const t of l){const e="string"==typeof t?.id?t.id:"";if(!e)continue;const s="string"==typeof t.space?t.space:"",i=s&&!c.has(s),a=o[e],n="string"==typeof a?.s?a.s:"",r=n&&!c.has(n),l=!0===t.removed;let h=s&&c.has(s)?s:null,d=null,p=!1;if(i){const i=$(s);i?(t.space=i,h=i,p=!0,v.spaceRefsRemapped++):l||"virtual"===t.binding?l||(delete t.space,h=null,v.markersDetached++):(d=k(e),d?(t.space=d.spaceId,h=d.spaceId,v.spaceRefsRemapped++):(delete t.space,h=null,v.markersDetached++))}l&&!p||x(t,h,d),r&&p&&n===s&&h&&(o[e]={...a,s:h},v.positionsRemapped++,y.add(e))}for(const t of Object.keys(o)){if(y.has(t))continue;const e=o[t],s="string"==typeof e?.s?e.s:"";if(!s||c.has(s))continue;const i=$(s);if(i){if(t.startsWith("rl_")){const s=t.slice(3),a=w(s,i);if(a){const s=`rl_${a}`;xl(o,s)||(o[s]={...e,s:i}),delete o[t],v.roomRefsRemapped++,v.positionsRemapped++;continue}}o[t]={...e,s:i},v.positionsRemapped++}}const S=s.ownerRoster,M=!0===S?.authoritative,C=new Set(S?.deviceIds||[]),P=new Set(S?.entityIds||[]),D=new Set(Array.isArray(i.settings?.known_devices)?i.settings.known_devices.filter(t=>"string"==typeof t):[]),I=(t,e="")=>{const s=String(S?.names?.[t]||e||"").trim();return s&&s!==t?s:""},T=(t,e,s,i="",o)=>({id:t,spaceId:e,kind:s,name:I(t,i),...o?{reason:o}:{}}),z=t=>{"room_label"===t?v.orphanRoomLabelsRemoved++:"group"===t?v.orphanGroupPositionsRemoved++:v.orphanDevicePositionsRemoved++},R=new Set;for(const[t,e]of Object.entries(o)){const i="string"==typeof e?.s?e.s:"";if(!i||c.has(i))continue;let a,n;const r=f.get(t),l=b.get(t);if(r)a=T(t,i,"device",String(r.name||"")),n="live";else if(l)a=T(t,i,"device",String(l.name||"")),n="absent";else if(t.startsWith("rl_")){const e=t.slice(3);a=T(t,i,"room_label",_.get(e)||""),n=g.has(e)?"live":"absent"}else if(t.startsWith("lg_")){const e=t.slice(3);a=T(t,i,"group"),n=P.has(e)?"live":M?"absent":"unverified","unverified"===n&&(a.reason="registry_unavailable")}else C.has(t)?(a=T(t,i,"device"),n="live"):D.has(t)?(a=T(t,i,"device"),n=M?"absent":"unverified","unverified"===n&&(a.reason="registry_unavailable")):(a=T(t,i,"unknown","","unknown_owner"),n="unverified");if("absent"!==n){if("live"===n){if(v.liveMissingPositions.push(a),!0===s.removeLiveMissingPositions){delete o[t],v.liveMissingPositionsRemoved++,z(a.kind),v.removedPositions.push(a);continue}}else v.unverifiedPositions.push(a);v.positionsUnresolved++,R.add(i)}else delete o[t],z(a.kind),v.removedPositions.push(a)}return v.deadSpaceIds=[...R].sort((t,e)=>t.localeCompare(e)),{config:i,layout:o,report:v,changed:JSON.stringify(i)!==a||JSON.stringify(o)!==n}}(t,e,s),n=a.config,r=$t(n,a.layout);L(n),wt(a.layout);const l=JSON.stringify(t||{}),h=JSON.stringify(e||{}),c=Number.isInteger(Number(n.model_version))?Number(n.model_version):0,d=(t=>{let e=0,s=0,i=0;for(const s of t.markers||[]){if("ripple"===s.display&&(s.display="icon_ripple",e++),Array.isArray(s.controls)){const t="string"==typeof s.binding&&s.binding.startsWith("entity:")?s.binding.slice(7):"",i=t?s.controls.filter(e=>e!==t):s.controls;JSON.stringify(i)!==JSON.stringify(s.controls)&&(s.controls=i.length?i:null,e++)}const t=s.vacuum;t&&Pl(t,"trail")&&(["never","cleaning","always"].includes(t.trail_mode)||(t.trail_mode=!1===t.trail?"never":"cleaning"),delete t.trail,e++)}for(const o of t.spaces||[]){const t=o.settings;"glow"===t?.fill_mode&&("boolean"!=typeof t.glow_enabled&&(t.glow_enabled=!0),t.fill_mode="none",e++,s++);for(const t of o.rooms||[]){const s=t.settings;"glow"===s?.fill_mode&&("boolean"!=typeof s.glow&&(s.glow=!0),delete s.fill_mode,e++,i++)}if(Pl(o,"segments")&&(delete o.segments,e++),Pl(o,"plan_scale")){const t=Number(o.plan_scale);Number.isFinite(t)&&t>=Pt&&t<=Dt&&(Pl(o,"plan_scale_x")||(o.plan_scale_x=t),Pl(o,"plan_scale_y")||(o.plan_scale_y=t),delete o.plan_scale,e++)}const a=Number(o.cell_cm);Pl(o,"cell_cm")&&(!Number.isFinite(a)||a<.1||a>1e3)&&(o.cell_cm=Number.isFinite(a)&&a>0?Dl(a,.1,1e3):5,e++);const n=Number(o.cell_cm),r=Number.isFinite(n)&&n>0?n:5;for(const t of o.wall_columns||[])if("circle"===t.shape)Pl(t,"angle")&&(delete t.angle,e++);else if("square"===t.shape&&Pl(t,"angle")){const s=((Number(t.angle)||0)%90+90)%90;t.angle!==s&&(t.angle=s,e++)}for(const t of o.decor||[]){if(Pl(t,"width")){const s=Number(t.width);(Pl(t,"width_cm")||Number.isFinite(s))&&(Pl(t,"width_cm")||(t.width_cm=Number(Dl(s/Mt*r,.1,100).toFixed(6))),delete t.width,e++)}if("rect"!==t?.kind&&"ellipse"!==t?.kind||!0!==t.fill||(Pl(t,"fill_color")||(t.fill_color=t.color||"#607d8b",e++),Pl(t,"fill_opacity")||(t.fill_opacity=.25,e++)),"text"!==t?.kind)continue;void 0===t.size_cm?(t.size_cm=Number(Dl(It*Tt(t)/Mt*r,.1,2e3).toFixed(6)),delete t.scale,delete t.size,e++):(Pl(t,"scale")||Pl(t,"size"))&&(delete t.scale,delete t.size,e++);let s=String(t.text??"");const i=[...s.matchAll(/\{([^{}\r\n]+)\}/g)].some(t=>!!zt(t[1]));if(!(Pl(t,"entity")||Pl(t,"attr")||Pl(t,"unit")))continue;const o=String(t.unit??"").trim(),a="state"===String(t.attr??"").trim().toLowerCase()?null:t.attr,n=i||o?"":Rt(t.entity,a);if(i||n){if(n){const e=s.indexOf("{}");s=e>=0?s.slice(0,e)+n+s.slice(e+2):`${s}${s?" ":""}${n}`,t.text=s}delete t.entity,delete t.attr,delete t.unit,e++}}}return{total:e,glowSpaces:s,glowRooms:i}})(n);let p=d.total,u=0,_=0,g=0;if(c<10)for(const t of Array.isArray(n.spaces)?n.spaces:[]){const e=qn(t);_+=e.drafts,g+=e.segments}const f=(b=n.spaces||[],JSON.parse(JSON.stringify(b)));var b;const v=Qr(n.spaces||[],a.layout);let y=0,$=0,w=0,k="";const x=v.spaces.map(t=>{const e=kt(t);y+=e.report.wallsStraightened,$+=e.report.wallsStraightenSkipped;const s=Number(t?.cell_cm)>0?Number(t.cell_cm):5,i=e.report.maxStraightenShift/O*s;return i>w&&(w=i,k=String(t?.id||"")),e.space}),S=y?Qr(x,v.layout):{...v,spaces:x};n.spaces=S.spaces;const M=y?{...v.report,moved:v.report.moved+S.report.moved,coordsCanonicalized:v.report.coordsCanonicalized+S.report.coordsCanonicalized,maxShift:Math.max(v.report.maxShift,S.report.maxShift),maxShiftCm:Math.max(v.report.maxShiftCm,S.report.maxShiftCm),maxSpace:S.report.maxShiftCm>v.report.maxShiftCm?S.report.maxSpace:v.report.maxSpace,rotated:v.report.rotated+S.report.rotated}:{...v.report};let C=0,P=0,D=0,I=0,T=0,z=0,R=0;for(let t=0;t0===Number(t.cm)),walls:e.walls||[]}),a=Il(e),r=Il(s);if(!a||!r)continue;const l=Rl(a.rooms),h=Rl(r.rooms),c=.02*Mt,d=(e.wall_segments||[]).filter(t=>0===Number(t.cm)).map(t=>({...t,key:W(t.a,t.b,O),cm:0})),p=new Set(d.map(t=>t.key)),u=xt(e,a.rooms,m,c);P+=u.length;for(const t of u){const e=[t[0]/m,t[1]/m],s=[t[2]/m,t[3]/m],i=W(e,s,O);p.has(i)||(p.add(i),d.push({key:i,a:e,b:s,cm:0}))}const _=d.length,g=St(d,l,h,O,m),b=(t,e,s)=>{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o;if(!(a>0))return Math.hypot(t[0]-e[0],t[1]-e[1]);const n=Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a));return Math.hypot(t[0]-(e[0]+i*n),t[1]-(e[1]+o*n))},v=g.filter(t=>{if(!Array.isArray(t.a)||!Array.isArray(t.b))return!1;const e=t.a.map(t=>t*m),s=t.b.map(t=>t*m);return h.some(([t,i])=>b(e,t,i)<=4*c&&b(s,t,i)<=4*c)});D+=Math.max(0,_-v.length);const y=(s.wall_segments||[]).filter(t=>Number(t.cm)>0);s.wall_segments=[...y,...v.map(({key:t,...e})=>e)];const $=v.map(t=>[t.a[0]*m,t.a[1]*m,t.b[0]*m,t.b[1]*m]),w=Array.isArray(e.walls)?e.walls.length:0;let k=St(e.walls,l,h,O,m);k=zl(r.rooms,k,$,O,Number(s.cell_cm)>0?Number(s.cell_cm):5,Mt,m),k=ft(r.rooms,k,$,O,Number(s.cell_cm)>0?Number(s.cell_cm):5,Mt,m),k=Ct(k,s.rooms||[],O,1,$.map(t=>[t[0]/m,t[1]/m,t[2]/m,t[3]/m])),C+=Math.max(0,w-k.length),k.length?s.walls=k:delete s.walls;const x=nl(s.partitions||[],{pitch:O,geometry:ll(s)});x.merged&&(I+=x.merged,s.partitions=x.partitions,rl(s.openings,s.partitions,x.openingMoves,{coordScale:m,cellCm:Number(s.cell_cm)>0?Number(s.cell_cm):5,gridPitch:Mt}));const S=Il(s);if(S){const t=o(s,S,s.walls||[],$,{pitch:O,cellCm:Number(s.cell_cm)>0?Number(s.cell_cm):5,gridPitch:Mt,coordScale:m});t.partitionsReconciled&&(T+=t.partitionsReconciled,z+=t.openingsRehosted,t.partitions.length?s.partitions=t.partitions:delete s.partitions,t.openings.length?s.openings=t.openings:delete s.openings,t.walls.length?s.walls=t.walls:delete s.walls)}JSON.stringify({zero:(s.wall_segments||[]).filter(t=>0===Number(t.cm)),walls:s.walls||[]})!==i&&R++}if(c<=10){const t=function(t){const e=Kn(t);return Jn(t,e.config),{...e,config:t}}(n);u+=t.migratedSegments,_+=t.migratedDrafts,g+=t.migratedDraftSegments}const A=L(n),F=wt(S.layout),N=JSON.stringify(A)!==l||JSON.stringify(F)!==h;c<10&&N&&(A.model_version=10);const E=JSON.stringify(A)!==l||JSON.stringify(F)!==h,H=Number.isInteger(Number(A.model_version))?Number(A.model_version):c,B=E?M:{...M,moved:0,coordsCanonicalized:0,maxShift:0,maxShiftCm:0,maxSpace:"",rotated:0},j=E?a.report:{...a.report,spaceRefsRemapped:0,roomRefsRemapped:0,positionsRemapped:0,markersDetached:0,orphanRoomLabelsRemoved:0,orphanDevicePositionsRemoved:0,orphanGroupPositionsRemoved:0,liveMissingPositionsRemoved:0};return{config:A,layout:F,report:{...B,modelFrom:c,modelTo:H,migrated:E?p:0,glowSpacesMigrated:E?d.glowSpaces:0,glowRoomsMigrated:E?d.glowRooms:0,canonicalized:E?R:0,wallSegmentsMigrated:E?u:0,roomDraftsMigrated:E?_:0,roomDraftSegmentsMigrated:E?g:0,legacyZeroWallsMigrated:E?P:0,wallsMerged:E?C:0,spansMerged:E?D:0,partitionsMerged:E?I:0,partitionsReconciled:E?T:0,openingsRehosted:E?z:0,wallsStraightened:E?y:0,wallsStraightenSkipped:$,maxStraightenShiftCm:E?w:0,maxStraightenSpace:E?k:"",latticeCoordinatesCanonicalized:E?r.canonicalized:0,latticeCoordinatesFar:E?r.far:0,latticeMaxShift:E?r.maxShift:0,latticeMaxShiftCm:E?r.maxShiftCm:0,latticeSpaces:E?r.spaces:[],...j},changed:E}}const Fl=Object.freeze({spaces:50,partitions:2e3,openings:500,decor:1e3,columns:500});class Nl extends Error{constructor(t){super(t),this.code=t,this.name="SpaceCopyError"}}const El=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Hl=t=>void 0===t?t:JSON.parse(JSON.stringify(t)),Ol=t=>null===t||"object"!=typeof t||Array.isArray(t)?null:t;function Ll(t,e=!1){if(void 0===t&&!e)return[];if(!Array.isArray(t))throw new Nl("source_invalid");return t.map(t=>{const e=Ol(t);if(!e||"string"!=typeof e.id||!e.id)throw new Nl("source_invalid");return e})}const Bl=t=>Array.isArray(t)&&2===t.length&&t.every(t=>Number.isFinite(t));function Wl(t,e,s){const i=String(t??"").trim()||s,o=new Set(e.map(t=>{const e=Ol(t);return String(e?.title??"").trim()}));let a=2;for(;o.has(`${i} (${a})`);)a++;return`${i} (${a})`}const jl=["settings","zero_wall_style","cell_cm","view_box","plan_url","plan_aspect","plan_x","plan_y","plan_scale","plan_scale_x","plan_scale_y","plan_angle"];const Gl={source_missing:"space.copy_error_source_missing",source_invalid:"space.copy_error_source_invalid",spaces_limit:"space.copy_error_spaces_limit",partitions_limit:"space.copy_error_partitions_limit",openings_limit:"space.copy_error_openings_limit",decor_limit:"space.copy_error_decor_limit",columns_limit:"space.copy_error_columns_limit",opening_host_missing:"space.copy_error_opening_host",opening_host_unknown:"space.copy_error_opening_host",geometry_unsafe:"space.copy_error_geometry"};let ql=0;function Ul(t,e,s){const i=t._spaceDialog;return!(!i?.copy||i.copy.token!==e)&&(t._spaceDialog={...i,busy:s,copy:{...i.copy,busy:s}},!0)}function Kl(t){t._cfgEpoch++,t._modelCache=null,t._frame=null,t._regSignature="",t._maybeRebuildDevices(),t.requestUpdate()}async function Vl(t,e){const s=t._spaceDialog;if(!s?.copy||"edit"!==s.mode||s.busy||s.copy.busy||!s.copy.title.trim()||!s.spaceId||!t._serverCfg)return;const i=++ql,o=s.spaceId,a=s.copy.title.trim();t._spaceDialog={...s,busy:!0,copy:{...s.copy,title:a,busy:!0,token:i}};let n=!1;try{if(t._saveConfigDebounced.pending()&&t._saveConfigDebounced.flush(),await t._writeChain,!Ul(t,i,!0)||!t._serverCfg)return;const s=t._cfgRev,r=t._layoutRev,l=Ft(t._serverCfg),h=Ft(t._layout);let c;try{c=(e.optimize??Al)(t._serverCfg,t._layout,e.optimizeReferenceContext())}catch(s){return Ul(t,i,!1),void e.showWallModelMigrationBlocked(s)}if(c.changed){const d=t._checkOptimizeGeometry(c.config);if(e.reportPreflightFailure(d,c.config),!d.ok)return Ul(t,i,!1),void t._showToast(t._t("space.copy_error_optimize_geometry"));const p=await t._confirmDanger({key:`copy-space:${o}`,kind:"warning",title:t._t("space.copy_optimize_title"),message:t._t("space.copy_optimize_body",{name:a}),objectName:a,confirmLabel:t._t("space.copy_optimize_confirm"),cancelLabel:t._t("btn.cancel"),icon:"mdi:broom"});if(!Ul(t,i,p))return;if(!p)return;if(t._cfgRev!==s||t._layoutRev!==r||!t._serverCfg||Ft(t._serverCfg)!==l||Ft(t._layout)!==h)return Ul(t,i,!1),void t._showToast(t._t("space.copy_error_changed"));e.clearGeometryGesture(),await qr(t,c.config,c.layout),n=!0}if(!Ul(t,i,!0)||!t._serverCfg)return;const d=t._serverCfg,p=function(t,e,s,i){const o=t.spaces;if(!s.trim())throw new Nl("source_invalid");if(o.length>=Fl.spaces)throw new Nl("spaces_limit");const a=o.findIndex(t=>t.id===e);if(a<0)throw new Nl("source_missing");const n=o[a];if(!Array.isArray(n.view_box))throw new Nl("source_invalid");const r=Ll(n.wall_segments,!0),l=Ll(n.partitions),h=Ll(n.openings),c=Ll(n.decor),d=Ll(n.wall_columns);if(r.length+l.length>Fl.partitions)throw new Nl("partitions_limit");if(h.length>Fl.openings)throw new Nl("openings_limit");if(c.length>Fl.decor)throw new Nl("decor_limit");if(d.length>Fl.columns)throw new Nl("columns_limit");let p=0;const u=t=>`${t}${i}${(p++).toString(36)}`,_=new Map,m=new Map,g=[];for(const t of r){if(_.has(t.id)||!Bl(t.a)||!Bl(t.b)||"number"!=typeof t.cm||!Number.isFinite(t.cm))throw new Nl("source_invalid");const e=u("cw");_.set(t.id,e),g.push({id:e,a:Hl(t.a),b:Hl(t.b),cm:t.cm})}for(const t of l){if(m.has(t.id)||!Bl(t.a)||!Bl(t.b)||"number"!=typeof t.cm||!Number.isFinite(t.cm))throw new Nl("source_invalid");const e=u("cp");m.set(t.id,e),g.push({id:e,a:Hl(t.a),b:Hl(t.b),cm:t.cm})}const f=h.map(t=>{const e=Ol(t.host);if(!e||"string"!=typeof e.id||"string"!=typeof e.kind)throw new Nl("opening_host_missing");const s="wall"===e.kind?_.get(e.id):"partition"===e.kind?m.get(e.id):void 0;if(!s)throw new Nl("opening_host_unknown");const i={...Hl(t),id:u("co"),host:{...Hl(e),kind:"partition",id:s}};return delete i.contact,delete i.lock,i}),b=c.map(t=>({...Hl(t),id:u("cd")})),v=d.map(t=>({...Hl(t),id:u("cc")})),y=`s${i}`;if(o.some(t=>t.id===y))throw new Nl("source_invalid");const $={id:y,title:s.trim(),rooms:[],wall_segments:[],view_box:Hl(n.view_box)};for(const t of jl)"view_box"!==t&&El(n,t)&&($[t]=Hl(n[t]));g.length&&($.partitions=g),f.length&&($.openings=f),b.length&&($.decor=b),v.length&&($.wall_columns=v);const w=Hl(t);return w.spaces.splice(a+1,0,$),{config:w,space:$,sourceIndex:a}}(d,o,a,e.newSeed?.()??function(t=Date.now(),e=Math.random()){const s=Math.floor(16777216*Math.max(0,Math.min(.999999999,e))).toString(36).padStart(5,"0");return`${Math.max(0,Math.floor(t)).toString(36)}${s}`}());let u=!1;try{u=t._checkSpacePhysicalGeometry(p.config,p.space.id).ok}catch{u=!1}if(!u||t._junctionLimitViolations(p.config,p.space.id).length)throw new Nl("geometry_unsafe");const _=t._adoption.beginOptimistic(d,p.config);t._adoption.stageLocalConfig(p.config),Kl(t);try{await e.saveConfigNow(_)}catch(e){throw t._rollbackOptimistic(_)&&Kl(t),"conflict"!==e?.code&&await t._reloadConfigOnly(!0),e}t._canOptimizeUndo=!1,t._undoKind=null,e.clearGeometryGesture(),t._selId=null,t._physicalSel=null,t._spaceDialog=null,t._commitSpace(p.space.id,!0),e.setMode("plan"),t._tool="draw",t._path=[],t._cursorPt=null,t._activeWallChainId=null,t._activeWallChainPartitionIds=[],t._primeDrawWallField(),t._saveNav(),t.requestUpdate(),t._showToast(t._t("toast.space_copied",{name:a}))}catch(e){"conflict"===e?.code&&await Promise.all([t._reloadConfigOnly(!0),t._reloadLayoutOnly()]),Ul(t,i,!1),function(t,e){if(e instanceof Nl)return void t._showToast(t._t(Gl[e.code]));const s=e?.code;"wall_model_client_outdated"!==s?t._showToast(t._t("toast.error",{err:t._errText(e)})):t._showToast(t._t("toast.wall_model_client_outdated"))}(t,e),n&&t.requestUpdate()}}const Jl=new Set(["group","template","derivative","min_max","threshold","integration","statistics","trend","utility_meter","tod","switch_as_x","schedule"]);function Yl(t){const{hass:e,devices:s,markers:i,showEntities:o,currentBinding:a,currentDeviceId:n,labels:r}=t,l=Nt(i),h=new Set(i.filter(t=>t.removed).map(t=>t.binding)),c=new Set;for(const t of s)t.id!==n&&("device"===t.bindingKind&&t.bindingRef&&c.add(`device:${t.bindingRef}`),"entity"===t.bindingKind&&t.bindingRef&&c.add(`entity:${t.bindingRef}`));const d=new Set;for(const t of s)"device"===t.bindingKind&&t.name&&d.add(`${t.name.trim()}|${t.area||""}`);const p=[];for(const t of Object.values(e?.devices||{})){if(!t||"service"===t.entry_type)continue;const e=`device:${t.id}`;if(c.has(e))continue;const s=String(t.name_by_user||t.name||t.id).trim();e!==a&&!h.has(e)&&d.has(`${s}|${t.area_id||""}`)||p.push({value:e,label:s,sub:(t.model||r.device)+("Group"===t.model?r.z2mGroup:""),kind:"device",ref:t.id,areaId:t.area_id||"",model:t.model||""})}for(const[t,s]of Object.entries(e?.entities||{})){const i=`entity:${t}`;if(c.has(i))continue;if(Et(e,t,l)&&!h.has(i))continue;const o=Jl.has(s?.platform),a="group"===s?.platform;if(!o&&!a)continue;if(s?.hidden&&!h.has(i))continue;const n=e?.states?.[t];p.push({value:i,label:s?.name||n?.attributes?.friendly_name||t,sub:`${t.split(".")[0]} · ${a?r.group:r.helper}`,kind:"entity",ref:t,areaId:s?.area_id||s?.device_id&&e?.devices?.[s.device_id]?.area_id||"",model:"",parentDeviceId:s?.device_id||void 0})}if(o){const t=new Set(p.map(t=>t.value));for(const[s,i]of Object.entries(e?.entities||{})){const o=`entity:${s}`;if(c.has(o)||t.has(o)||i?.hidden&&!h.has(o))continue;const a=!!i?.device_id&&l.devices.has(i.device_id);if(Et(e,s,l)&&!h.has(o)&&!a)continue;const n=e?.states?.[s],d=i?.device_id?e?.devices?.[i.device_id]:null,u=d?String(d.name_by_user||d.name||""):"";p.push({value:o,label:i?.name||n?.attributes?.friendly_name||s,sub:`${s.split(".")[0]} · ${r.entity}${u?` · ${u}`:""}`,kind:"entity",ref:s,areaId:i?.area_id||d?.area_id||"",model:"",parentDeviceId:i?.device_id||void 0})}}return p.sort((t,e)=>t.label.localeCompare(e.label)||t.value.localeCompare(e.value))}const Xl={kind:"active",enabledEntityIds:[],allEntityIds:[]};function Zl(t){return t.startsWith("entity:")?"entity":"device"}function Ql(t){const e=t.binding.indexOf(":"),s=e>=0?t.binding.slice(e+1):"",i=Object.keys(t).filter(t=>!["id","binding","hidden"].includes(t));return t.id===`h${s}`&&0===i.length}const th=new Set(["ld2450","hlkld2450","hilinkld2450"]),eh=()=>globalThis.crypto?.randomUUID?.()||`radar_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`,sh=(t,e,s)=>{const i=!!t?.original;return{radar:i?t:null,radarEligible:i,radarTouched:i?e:e||!!t,radarRemove:i?s:s||!!t}},ih=(t,e="")=>"number"==typeof t&&Number.isFinite(t)?String(t):e,oh=t=>Array.from(new Set([...t.allEntities||t.entities||[],..."entity"===t.bindingKind&&t.bindingRef?[t.bindingRef]:[]])).filter(t=>/^[a-z0-9_]+\.[a-z0-9_]+$/.test(t)),ah=(t,e,s)=>{const i=t.split(".",2)[1]||"";return new RegExp(`(?:^|_)target_?${s}_${e}(?:_|$)`).test(i)||new RegExp(`(?:^|_)target_${e}_${s}(?:_|$)`).test(i)};function nh(t,e){if(t.marker?.radar&&"object"==typeof t.marker.radar)return Ht(t.marker.radar)?{eligible:!0,profile:t.marker.radar.profile,reason:"saved"}:{eligible:!0,profile:"presence_v1",reason:"saved_unsupported"};const s="entity"===t.bindingKind?e?.entities?.[t.bindingRef||""]:null,i="device"===t.bindingKind?t.bindingRef:s?.device_id,o=i?e?.devices?.[i]:null,a=oh(t);return th.has((n=o?.model||t.model,String(n||"").toLowerCase().replace(/[^a-z0-9]/g,"")))&&a.some(t=>ah(t,"x",1))&&a.some(t=>ah(t,"y",1))?{eligible:!0,profile:"esphome_ld2450_v1",reason:"ld2450"}:{eligible:!1,profile:"presence_v1",reason:"none"};var n}function rh(t,e){return t.find(t=>e.some(e=>e.test(t)))||""}function lh(t,e,s,i,o=!1){const a=nh(t,i),n=Ht(t.marker?.radar)?t.marker.radar:null;if(!n&&!a.eligible&&!o)return null;const r=n?.profile||a.profile,l=o&&!a.eligible||"ld2450"!==a.reason?{xEntities:["","",""],yEntities:["","",""],distanceEntity:"",angleEntity:"",occupancyEntity:"",countEntity:"",zoneEntity:""}:function(t,e,s){const i=oh(t).filter(t=>!!s?.states?.[t]),o=[],a=[];for(let t=1;t<=3;t++)o.push(i.find(e=>ah(e,"x",t))||""),a.push(i.find(e=>ah(e,"y",t))||"");const n=i.filter(t=>t.startsWith("binary_sensor.")),r=i.filter(t=>t.startsWith("sensor.")),l=rh(n,[/(?:occupancy|presence|target)(?:_|$)/]);return{xEntities:o,yEntities:a,distanceEntity:rh(r,[/(?:target_)?distance(?:_|$)/,/distance/]),angleEntity:rh(r,[/(?:target_)?angle(?:_|$)/,/angle/]),occupancyEntity:l,countEntity:rh(r,[/(?:target|people|presence)_count(?:_|$)/,/target_count/]),zoneEntity:"zones_v1"===e?rh(n,[/(?:zone|region).*(?:occupancy|presence)/,/zone/]):""}}(t,r,i),h=n?.sources||{},c=h.slots||[],d=c.filter(t=>"x_entity"in t),p=c.filter(t=>"distance_entity"in t),u=h.ranges||[],_=h.zones?.[0],m="esphome_ld2450_v1"===r?3:"cartesian_v1"===r?Math.max(1,d.length):"polar_v1"===r?Math.max(1,p.length):1,g=n?.room_id||t.marker?.room_id||e.rooms.find(e=>e.area&&e.area===t.area)?.id||"";return{original:n,enabled:!0===n?.enabled,showLive:!1!==n?.show_live,profile:r,roomId:g,installationId:n?.mount?.installation_id||eh(),mountX:ih(null==n?.mount?.x?void 0:1e3*n.mount.x,ih(s[0],"0")),mountY:ih(null==n?.mount?.y?void 0:1e3*n.mount.y,ih(s[1],"0")),heading:ih(n?.mount?.heading_deg,"0"),rangeCm:ih(n?.mount?.range_cm,"esphome_ld2450_v1"===r?"600":""),fovDeg:ih(n?.mount?.fov_deg,"esphome_ld2450_v1"===r?"120":""),mirror:!0===n?.calibration?.mirror,unit:d[0]?.unit||p[0]?.unit||u[0]?.unit||("esphome_ld2450_v1"===r?"mm":"cm"),xEntities:Array.from({length:m},(t,e)=>d[e]?.x_entity||l.xEntities[e]||""),yEntities:Array.from({length:m},(t,e)=>d[e]?.y_entity||l.yEntities[e]||""),distanceEntities:Array.from({length:m},(t,e)=>p[e]?.distance_entity||(0===e?l.distanceEntity:"")),angleEntities:Array.from({length:m},(t,e)=>p[e]?.angle_entity||(0===e?l.angleEntity:"")),rangeEntities:u.length?u.map(t=>t.entity_id):[l.distanceEntity],slotPresenceEntities:Array.from({length:m},(t,e)=>(d[e]||p[e])?.presence_entity||""),rangePresenceEntities:(u.length?u:[{}]).map(t=>"presence_entity"in t&&t.presence_entity||""),swapXY:Array.from({length:m},(t,e)=>!0===d[e]?.swap_xy),xSigns:Array.from({length:m},(t,e)=>-1===d[e]?.x_sign?-1:1),ySigns:Array.from({length:m},(t,e)=>-1===d[e]?.y_sign?-1:1),angleUnit:p[0]?.angle_unit||"degrees",angleZero:p[0]?.angle_zero||"forward",angleClockwise:!1!==p[0]?.angle_clockwise,occupancyEntity:h.occupancy_entity||l.occupancyEntity,countEntity:h.count_entity||l.countEntity,availabilityEntity:h.availability_entity||"",zoneEntity:_?.entity_id||l.zoneEntity,zoneKind:_?.kind||"occupancy"}}const hh=t=>JSON.stringify(t,(t,e)=>e&&"object"==typeof e&&!Array.isArray(e)?Object.fromEntries(Object.entries(e).sort(([t],[e])=>te?1:0)):e),ch=t=>{if(!t.trim())return null;const e=Number(t.replace(",","."));return Number.isFinite(e)?e:null};function dh(t,e){const s=ch(t.mountX),i=ch(t.mountY),o=ch(t.heading);if(!t.roomId||null==s||null==i||null==o)return null;const a={...t.original?.sources||{}};if(delete a.slots,delete a.ranges,delete a.zones,delete a.occupancy_entity,delete a.count_entity,"esphome_ld2450_v1"===t.profile||"cartesian_v1"===t.profile){if(a.slots=t.xEntities.flatMap((e,s)=>{const i=t.yEntities[s]||"";return e&&i?[{id:`target_${s+1}`,x_entity:e,y_entity:i,unit:"esphome_ld2450_v1"===t.profile?"mm":t.unit,..."cartesian_v1"===t.profile&&t.swapXY[s]?{swap_xy:!0}:{},..."cartesian_v1"===t.profile&&-1===t.xSigns[s]?{x_sign:-1}:{},..."cartesian_v1"===t.profile&&-1===t.ySigns[s]?{y_sign:-1}:{},...t.slotPresenceEntities[s]?{presence_entity:t.slotPresenceEntities[s]}:{}}]:[]}),!a.slots.length)return null}else if("polar_v1"===t.profile){if(a.slots=t.distanceEntities.flatMap((e,s)=>{const i=t.angleEntities[s]||"";return e&&i?[{id:`target_${s+1}`,distance_entity:e,angle_entity:i,unit:t.unit,angle_unit:t.angleUnit,angle_zero:t.angleZero,angle_clockwise:t.angleClockwise,...t.slotPresenceEntities[s]?{presence_entity:t.slotPresenceEntities[s]}:{}}]:[]}),!a.slots.length)return null}else if("range_v1"===t.profile){if(a.ranges=t.rangeEntities.flatMap((e,s)=>e?[{id:`range_${s+1}`,entity_id:e,unit:t.unit,...t.rangePresenceEntities[s]?{presence_entity:t.rangePresenceEntities[s]}:{}}]:[]),!a.ranges.length)return null}else if("zones_v1"===t.profile){if(!t.zoneEntity)return null;a.zones=[{id:"zone_1",kind:t.zoneKind,entity_id:t.zoneEntity}]}else if("presence_v1"===t.profile&&!t.occupancyEntity)return null;t.occupancyEntity&&(a.occupancy_entity=t.occupancyEntity),t.countEntity&&(a.count_entity=t.countEntity),t.availabilityEntity&&(a.availability_entity=t.availabilityEntity);const n=ch(t.rangeCm),r=ch(t.fovDeg),l=(o%360+360)%360,h={...t.original?.mount||{},installation_id:t.installationId,x:s/1e3,y:i/1e3,heading_deg:l};null!=n&&n>0?h.range_cm=n:delete h.range_cm,null!=r&&r>0?h.fov_deg=r:delete h.fov_deg;const c=t.original,d="two_point"===c?.calibration?.method&&c.profile===t.profile&&hh(c.sources)===hh(a)&&c.mount.installation_id===t.installationId&&Math.abs(c.mount.x-h.x)<1e-12&&Math.abs(c.mount.y-h.y)<1e-12&&Math.abs(c.mount.heading_deg-l)<1e-9&&c.calibration.mirror===t.mirror&&Math.abs(c.calibration.cell_cm-e)<1e-9,p=t.calibrationOverride?{...t.calibrationOverride}:d?{...c.calibration}:{...c?.calibration||{},method:"zones_v1"===t.profile||"presence_v1"===t.profile?"not_required":"manual",mirror:t.mirror,cell_cm:e};t.calibrationOverride||d||(delete p.refs,delete p.rms_cm);const u={...t.original||{},version:1,enabled:t.enabled,profile:t.profile,sources:a,mount:h,room_id:t.roomId,calibration:p};return t.showLive?delete u.show_live:u.show_live=!1,u}function ph(t,e="main"){const{dialog:s,device:i}=t;if(!i)return p``;t.setup.syncMarker(i.marker?.id||i.id);const o=nh(i,t.registryHass),a="saved_unsupported"===o.reason,n=()=>t.updateDialog({radar:null,radarTouched:!0,radarRemove:!0}),r=()=>{const e=t.spaceModelById(i.space)||t.currentSpace();if(!e)return;const s=t.position(i),o=lh(i,e,[s.x,s.y],t.registryHass,!0);o&&t.updateDialog({radar:o,radarEligible:!0,radarTouched:!0,radarRemove:!1})},l=!a&&"virtual"!==s.bindingMode&&(!s.radar||s.radarRemove)&&!o.eligible;if("additional"===e)return l?p`
    ${t.t("radar.additional_actions")} -
    `:h``;if(s.radar&&!s.radarRemove||!t.setup.isActive()||t.setup.reset(),a||"virtual"===s.bindingMode&&i.marker?.radar)return h`
    + `:p``;if(s.radar&&!s.radarRemove||!t.setup.isActive()||t.setup.reset(),a||"virtual"===s.bindingMode&&i.marker?.radar)return p`
    ${t.t("radar.title")}

    ${t.t("radar.saved_unsupported")}

    @@ -286,189 +286,189 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae ${t.t("radar.remove")}
    -
    `;if("virtual"===s.bindingMode)return h``;if(!s.radar||s.radarRemove)return o.eligible?h`
    +
    `;if("virtual"===s.bindingMode)return p``;if(!s.radar||s.radarRemove)return o.eligible?p`
    ${t.t("radar.title")}

    ${t.t("ld2450"===o.reason?"radar.detected_ld2450":"radar.detected")}

    -
    `:h``;const d=s.radar,p=function(t,e){const s=Object.keys(e?.states||{});return{numeric:s.filter(t=>t.startsWith("sensor.")).sort(),binary:s.filter(t=>t.startsWith("binary_sensor.")).sort()}}(0,t.planHass),u=(e,s,i,o="radar.source_choose")=>h`i(t.target.value)}> - ${e&&!s.includes(e)?h``:l} - ${s.map(s=>{const i=t.registryHass.entities?.[s],o=i?.device_id?t.registryHass.devices?.[i.device_id]:void 0,a=o?.name_by_user||o?.name||"",n=t.planHass.states?.[s]?.attributes?.friendly_name||s;return h``:d} + ${s.map(s=>{const i=t.registryHass.entities?.[s],o=i?.device_id?t.registryHass.devices?.[i.device_id]:void 0,a=o?.name_by_user||o?.name||"",n=t.planHass.states?.[s]?.attributes?.friendly_name||s;return p``})} - `,_=(e,s=!0)=>{t.setup.reset(),t.updateDialog({radar:{...d,...e,calibrationOverride:s?void 0:d.calibrationOverride,inspection:void 0,inspectError:void 0},radarTouched:!0,radarRemove:!1})},m=t.spaceModelById(i.space)||t.currentSpace(),g=m?.rooms||[],f="esphome_ld2450_v1"===d.profile||"cartesian_v1"===d.profile,b=(e=d)=>{const s=g.find(t=>t.id===e.roomId);m&&s&&rh(e,m.cellCm||5)?((!Array.isArray(s.poly)||s.poly.length<3)&&t.toast(t.t("radar.no_contour")),t.setup.begin(i.marker?.id||i.id,e,s,m.cellCm||5,t.configRev)||t.toast(t.t("radar.invalid"))):t.toast(t.t("radar.invalid"))},v=(t,e,s)=>{const i=[...d[t]];i[e]=s,_({[t]:i})},y=(t,e,s)=>{const i=[...d[t]];i[e]=s,_({[t]:i})},$=(t,e,s)=>{const i=[...d[t]];i[e]=s,_({[t]:i})},w=()=>{d.xEntities.length>=8||_({xEntities:[...d.xEntities,""],yEntities:[...d.yEntities,""],distanceEntities:[...d.distanceEntities,""],angleEntities:[...d.angleEntities,""],slotPresenceEntities:[...d.slotPresenceEntities,""],swapXY:[...d.swapXY,!1],xSigns:[...d.xSigns,1],ySigns:[...d.ySigns,1]})},k=t=>_({xEntities:d.xEntities.filter((e,s)=>s!==t),yEntities:d.yEntities.filter((e,s)=>s!==t),distanceEntities:d.distanceEntities.filter((e,s)=>s!==t),angleEntities:d.angleEntities.filter((e,s)=>s!==t),slotPresenceEntities:d.slotPresenceEntities.filter((e,s)=>s!==t),swapXY:d.swapXY.filter((e,s)=>s!==t),xSigns:d.xSigns.filter((e,s)=>s!==t),ySigns:d.ySigns.filter((e,s)=>s!==t)});return h`
    + `,_=(e,s=!0)=>{t.setup.reset(),t.updateDialog({radar:{...h,...e,calibrationOverride:s?void 0:h.calibrationOverride,inspection:void 0,inspectError:void 0},radarTouched:!0,radarRemove:!1})},m=t.spaceModelById(i.space)||t.currentSpace(),g=m?.rooms||[],f="esphome_ld2450_v1"===h.profile||"cartesian_v1"===h.profile,b=(e=h)=>{const s=g.find(t=>t.id===e.roomId);m&&s&&dh(e,m.cellCm||5)?((!Array.isArray(s.poly)||s.poly.length<3)&&t.toast(t.t("radar.no_contour")),t.setup.begin(i.marker?.id||i.id,e,s,m.cellCm||5,t.configRev)||t.toast(t.t("radar.invalid"))):t.toast(t.t("radar.invalid"))},v=(t,e,s)=>{const i=[...h[t]];i[e]=s,_({[t]:i})},y=(t,e,s)=>{const i=[...h[t]];i[e]=s,_({[t]:i})},$=(t,e,s)=>{const i=[...h[t]];i[e]=s,_({[t]:i})},w=()=>{h.xEntities.length>=8||_({xEntities:[...h.xEntities,""],yEntities:[...h.yEntities,""],distanceEntities:[...h.distanceEntities,""],angleEntities:[...h.angleEntities,""],slotPresenceEntities:[...h.slotPresenceEntities,""],swapXY:[...h.swapXY,!1],xSigns:[...h.xSigns,1],ySigns:[...h.ySigns,1]})},k=t=>_({xEntities:h.xEntities.filter((e,s)=>s!==t),yEntities:h.yEntities.filter((e,s)=>s!==t),distanceEntities:h.distanceEntities.filter((e,s)=>s!==t),angleEntities:h.angleEntities.filter((e,s)=>s!==t),slotPresenceEntities:h.slotPresenceEntities.filter((e,s)=>s!==t),swapXY:h.swapXY.filter((e,s)=>s!==t),xSigns:h.xSigns.filter((e,s)=>s!==t),ySigns:h.ySigns.filter((e,s)=>s!==t)});return p`
    ${t.t("radar.title")}${t.help("radar.help")} - ${f?d.xEntities.map((e,s)=>h` + ${f?h.xEntities.map((e,s)=>p`
    ${t.t("radar.target",{n:s+1})} - ${"cartesian_v1"===d.profile&&d.xEntities.length>1?h``:l} + ${"cartesian_v1"===h.profile&&h.xEntities.length>1?p``:d}
    - ${u(e,p.numeric,t=>v("xEntities",s,t))} + ${u(e,c.numeric,t=>v("xEntities",s,t))} - ${u(d.yEntities[s]||"",p.numeric,t=>v("yEntities",s,t))} - ${"cartesian_v1"===d.profile?h` + ${u(h.yEntities[s]||"",c.numeric,t=>v("yEntities",s,t))} + ${"cartesian_v1"===h.profile?p`
    - `:l} + `:d} - ${u(d.slotPresenceEntities[s]||"",p.binary,t=>y("slotPresenceEntities",s,t),"radar.source_optional")} - `):l} - ${"cartesian_v1"===d.profile&&d.xEntities.length<8?h``:l} - ${"polar_v1"===d.profile?h` - ${d.distanceEntities.map((e,s)=>h` + `:d} + ${"polar_v1"===h.profile?p` + ${h.distanceEntities.map((e,s)=>p`
    ${t.t("radar.target",{n:s+1})} - ${d.distanceEntities.length>1?h``:l} + `:d}
    - ${u(e,p.numeric,t=>y("distanceEntities",s,t))} + ${u(e,c.numeric,t=>y("distanceEntities",s,t))} - ${u(d.angleEntities[s]||"",p.numeric,t=>y("angleEntities",s,t))} + ${u(h.angleEntities[s]||"",c.numeric,t=>y("angleEntities",s,t))} - ${u(d.slotPresenceEntities[s]||"",p.binary,t=>y("slotPresenceEntities",s,t),"radar.source_optional")} + ${u(h.slotPresenceEntities[s]||"",c.binary,t=>y("slotPresenceEntities",s,t),"radar.source_optional")} `)} - ${d.distanceEntities.length<8?h``:l} + ${h.distanceEntities.length<8?p``:d} - `:l} - ${"range_v1"===d.profile?h` - ${d.rangeEntities.map((e,s)=>h` + `:d} + ${"range_v1"===h.profile?p` + ${h.rangeEntities.map((e,s)=>p`
    ${t.t("radar.range_channel",{n:s+1})} - ${d.rangeEntities.length>1?h``:l} + ${h.rangeEntities.length>1?p``:d}
    - ${u(e,p.numeric,t=>y("rangeEntities",s,t))} + ${u(e,c.numeric,t=>y("rangeEntities",s,t))} - ${u(d.rangePresenceEntities[s]||"",p.binary,t=>y("rangePresenceEntities",s,t),"radar.source_optional")} + ${u(h.rangePresenceEntities[s]||"",c.binary,t=>y("rangePresenceEntities",s,t),"radar.source_optional")} `)} - ${d.rangeEntities.length<2?h``:l} - `:l} - ${"zones_v1"===d.profile?h` + ${h.rangeEntities.length<2?p``:d} + `:d} + ${"zones_v1"===h.profile?p` - ${u(d.zoneEntity,"occupancy"===d.zoneKind?p.binary:p.numeric,t=>_({zoneEntity:t}))} + ${u(h.zoneEntity,"occupancy"===h.zoneKind?c.binary:c.numeric,t=>_({zoneEntity:t}))} - `:l} + `:d} - ${u(d.occupancyEntity,p.binary,t=>_({occupancyEntity:t}),"radar.source_optional")} + ${u(h.occupancyEntity,c.binary,t=>_({occupancyEntity:t}),"radar.source_optional")} - ${u(d.countEntity,p.numeric,t=>_({countEntity:t}),"radar.source_optional")} + ${u(h.countEntity,c.numeric,t=>_({countEntity:t}),"radar.source_optional")} - ${u(d.availabilityEntity,p.binary,t=>_({availabilityEntity:t}),"radar.source_optional")} + ${u(h.availabilityEntity,c.binary,t=>_({availabilityEntity:t}),"radar.source_optional")}

    ${t.t("radar.mount_hint")}

    - - + .value=${h.heading} @input=${t=>_({heading:t.target.value})}>
    + .value=${h.rangeCm} @input=${t=>_({rangeCm:t.target.value})}> + .value=${h.fovDeg} @input=${t=>_({fovDeg:t.target.value})}>
    - ${"esphome_ld2450_v1"!==d.profile&&"zones_v1"!==d.profile&&"presence_v1"!==d.profile?h` + ${"esphome_ld2450_v1"!==h.profile&&"zones_v1"!==h.profile&&"presence_v1"!==h.profile?p` - - `:l} + + `:d}
    - ${d.original?h``:l} - `:d} +
    - ${d.inspectError?h``:l} - ${d.inspection?.frame?h`
    + ${h.inspectError?p``:d} + ${h.inspection?.frame?p`
    ${t.t("radar.health")} - ${t.t(`radar.health_${d.inspection.frame.health||"unknown"}`)} - ${t.t("radar.live_summary",{targets:d.inspection.frame.targets?.length||0,ranges:d.inspection.frame.ranges?.length||0})} - ${(d.inspection.sources||[]).map(e=>{const s="number"==typeof e.reported_at&&Number.isFinite(e.reported_at)?Math.max(0,Math.round(Date.now()/1e3-e.reported_at)):null;return h`${e.entity_id}: ${e.state??"—"}${null==s?"":` · ${t.t("radar.report_age",{seconds:s})}`}`})} -
    `:l} + ${t.t(`radar.health_${h.inspection.frame.health||"unknown"}`)} + ${t.t("radar.live_summary",{targets:h.inspection.frame.targets?.length||0,ranges:h.inspection.frame.ranges?.length||0})} + ${(h.inspection.sources||[]).map(e=>{const s="number"==typeof e.reported_at&&Number.isFinite(e.reported_at)?Math.max(0,Math.round(Date.now()/1e3-e.reported_at)):null;return p`${e.entity_id}: ${e.state??"—"}${null==s?"":` · ${t.t("radar.report_age",{seconds:s})}`}`})} +
    `:d} ${t.setup.render()}
    -
    `}function hh(t,e,s,i,o){if(![...t,e,i,...o].every(Number.isFinite)||i<=0||Math.hypot(...o)>1e4)throw new Error("invalid_radar");const a=e*Math.PI/180,n=s?-1:1,r=240*i;return[t[0]+(n*o[0]*Math.cos(a)+o[1]*Math.sin(a))/r,t[1]+(n*o[0]*Math.sin(a)-o[1]*Math.cos(a))/r]}class ch{constructor(t){this.host=t,this.active=null,this.generation=0,this.timer=0}begin(t,e,s,i,o){return!!this.host.configFromDraft(e,i)&&(this.reset(),this.active={markerId:t,draft:e,room:s,cellCm:i,configRev:o,phase:"mount",mount:null,headingPoint:null,pendingPlan:null,refs:[],samples:[],ambiguous:!1,trail:[]},this.host.requestUpdate(),!0)}reset(){this.generation++,this.unsubscribe?.(),this.unsubscribe=void 0,clearInterval(this.timer),this.timer=0,this.active=null}async discardIfAllowed(){if(!this.active)return!0;return!!(null===this.active.mount&&"mount"===this.active.phase||await this.host.confirmDiscard())&&(this.reset(),this.host.requestUpdate(),!0)}cancel(){return this.discardIfAllowed()}isActive(){return null!==this.active}isDirty(){return!!this.active&&(null!==this.active.mount||"mount"!==this.active.phase)}syncMarker(t){this.active&&this.active.markerId!==t&&this.reset()}coordinateProfile(){return!!this.active&&["esphome_ld2450_v1","cartesian_v1","polar_v1"].includes(this.active.draft.profile)}choosePoint(t){const e=this.active,s=function(t){const e=t.currentTarget.getBoundingClientRect();return e.width>0&&e.height>0?[Math.max(0,Math.min(1,(t.clientX-e.left)/e.width)),Math.max(0,Math.min(1,(t.clientY-e.top)/e.height))]:null}(t);var i,o;e&&s&&!1!==t.isPrimary&&"capture"!==e.phase&&"checking"!==e.phase&&(e.error=void 0,"mount"===e.phase?(e.mount=s,e.phase="heading"):"heading"===e.phase&&e.mount?(e.headingPoint=s,e.draft={...e.draft,mountX:String(Number((1e3*e.mount[0]).toFixed(3))),mountY:String(Number((1e3*e.mount[1]).toFixed(3))),heading:String(Number((i=e.mount,o=s,(180*Math.atan2(o[0]-i[0],i[1]-o[1])/Math.PI%360+360)%360).toFixed(3)))},e.phase=this.coordinateProfile()?"reference_1":"solved",this.coordinateProfile()&&this.subscribe()):"reference_1"!==e.phase&&"reference_2"!==e.phase&&"check_reference"!==e.phase||(e.pendingPlan=s),this.host.requestUpdate())}async subscribe(){const t=this.active,e=this.host.hass()?.connection;if(!t||this.unsubscribe||"function"!=typeof e?.subscribeMessage)return;const s=this.host.configFromDraft(t.draft,t.cellCm);if(!s)return;const i=++this.generation;try{const o=await e.subscribeMessage(t=>{i===this.generation&&this.active&&this.receive(t)},{type:"houseplan/radar/setup/subscribe",marker_id:t.markerId,expected_config_rev:t.configRev,draft_sources:{radar:s}});i===this.generation&&this.active?"function"==typeof o&&(this.unsubscribe=o):"function"==typeof o&&o()}catch(t){if(i!==this.generation||!this.active)return;const e=`radar.error_${String(t&&"object"==typeof t&&"code"in t&&t.code||"not_ready")}`;this.active.error=this.host.t(e)===e?"radar.error_not_ready":e,this.host.requestUpdate()}}receive(t){const e=this.active;if(!e)return;const s=Date.now(),i=Array.isArray(t.local_targets)?t.local_targets.filter(t=>{return e=[t.x_cm,t.y_cm],Array.isArray(e)&&2===e.length&&e.every(t=>"number"==typeof t&&Number.isFinite(t));var e}):[],o=new Set(i.map(t=>String(t.slot||"target")));e.trail=e.trail.filter(t=>t.at>=s-8e3&&o.has(t.slot));for(const t of i){const i=[t.x_cm,t.y_cm],o=String(t.slot||"target"),a=e.solved?.headingDeg??Number(e.draft.heading),n=e.solved?.mirror??e.draft.mirror;if(e.mount)try{const t=hh(e.mount,a,n,e.cellCm,i),r=[...e.trail].reverse().find(t=>t.slot===o);r&&240*Math.hypot(t[0]-r.point[0],t[1]-r.point[1])*e.cellCm>100&&(e.trail=e.trail.filter(t=>t.slot!==o)),e.trail.push({at:s,slot:o,point:t})}catch{}}const a=[];for(const t of o)a.push(...e.trail.filter(e=>e.slot===t).slice(-32));if(e.trail=a.sort((t,e)=>t.at-e.at),("capture"===e.phase||"checking"===e.phase)&&s>=(e.countdownUntil||0)&&s<(e.captureUntil||0))if(1===i.length){const t=Number(i[0].reported_at);e.samples.push({at:Number.isFinite(t)?1e3*t:s,point:[i[0].x_cm,i[0].y_cm]})}else i.length>1&&(e.ambiguous=!0);this.host.requestUpdate()}startCapture(){const t=this.active;t?.pendingPlan&&this.coordinateProfile()&&(t.samples=[],t.ambiguous=!1,t.error=void 0,t.captureFor="reference_1"===t.phase?0:"reference_2"===t.phase?1:2,t.phase=2===t.captureFor?"checking":"capture",t.countdownUntil=Date.now()+1e4,t.captureUntil=t.countdownUntil+5e3,clearInterval(this.timer),this.timer=window.setInterval(()=>this.tick(),200),this.subscribe(),this.host.requestUpdate())}tick(){const t=this.active;if(!t||!t.captureUntil||Date.now()t.at))-Math.min(...t.samples.map(t=>t.at))<2e3)throw new Error("insufficient_samples");e=function(t){if(t.length<3)throw new Error("insufficient_samples");const e=t=>{const e=[...t].sort((t,e)=>t-e),s=Math.floor(e.length/2);return e.length%2?e[s]:(e[s-1]+e[s])/2},s=[e(t.map(t=>t[0])),e(t.map(t=>t[1]))];if(t.some(t=>Math.hypot(t[0]-s[0],t[1]-s[1])>15))throw new Error("bad_fit");return s}(t.samples.map(t=>t.point))}catch(e){return t.error="ambiguous_target"===String(e?.message)?"radar.ambiguous_target":"radar.insufficient_samples",t.phase=0===t.captureFor?"reference_1":1===t.captureFor?"reference_2":"check_reference",void this.host.requestUpdate()}if(2===t.captureFor&&t.solved&&t.mount&&t.pendingPlan){const s=hh(t.mount,t.solved.headingDeg,t.solved.mirror,t.cellCm,e);t.checkErrorCm=240*Math.hypot(s[0]-t.pendingPlan[0],s[1]-t.pendingPlan[1])*t.cellCm,t.phase="checked"}else t.pendingPlan&&(t.refs[t.captureFor||0]={plan:t.pendingPlan,local:e},t.pendingPlan=null,t.refs.length<2?t.phase="reference_2":this.solve());this.host.requestUpdate()}solve(){const t=this.active;if(t?.mount&&2===t.refs.length)try{t.solved=function(t,e,s,i){if(![...t,i,...e.flat(),...s.flat()].every(Number.isFinite)||i<=0)throw new Error("invalid_selection");if(e.some(t=>Math.hypot(...t)<50))throw new Error("bad_references");const o=Math.hypot(...e[0])*Math.hypot(...e[1]),a=(e[0][0]*e[1][0]+e[0][1]*e[1][1])/o,n=180*Math.acos(Math.max(-1,Math.min(1,a)))/Math.PI;if(n<20||n>160)throw new Error("bad_references");const r=240*i,l=s.map(e=>[(e[0]-t[0])*r,-(e[1]-t[1])*r]),h=[];for(const t of[!1,!0]){const s=e.map(([e,s])=>[t?-e:e,s]),i=s.reduce((t,e,s)=>t+e[0]*l[s][0]+e[1]*l[s][1],0),o=s.reduce((t,e,s)=>t+e[0]*l[s][1]-e[1]*l[s][0],0),a=Math.atan2(o,i),n=s.map(([t,e],s)=>{const i=t*Math.cos(a)-e*Math.sin(a),o=t*Math.sin(a)+e*Math.cos(a);return Math.hypot(i-l[s][0],o-l[s][1])}),r=e.every((t,e)=>{const s=Math.hypot(...t),i=Math.hypot(...l[e]);return Math.abs(s-i)<=Math.max(20,.15*i)}),c=Math.sqrt((n[0]**2+n[1]**2)/2);r&&c<=20&&Math.max(...n)<=30&&h.push({headingDeg:(180*-a/Math.PI%360+360)%360,mirror:t,rmsCm:c,errorsCm:n})}if(h.sort((t,e)=>t.rmsCm-e.rmsCm),!h.length)throw new Error("invalid_selection");if(h.length>1&&Math.abs(h[0].rmsCm-h[1].rmsCm)<10)throw new Error("ambiguous_sources");return h[0]}(t.mount,[t.refs[0].local,t.refs[1].local],[t.refs[0].plan,t.refs[1].plan],t.cellCm),t.draft={...t.draft,heading:String(Number(t.solved.headingDeg.toFixed(3))),mirror:t.solved.mirror},t.phase="solved",t.error=void 0}catch(e){const s=String(e?.message);t.error="ambiguous_sources"===s?"radar.ambiguous_sources":"bad_references"===s?"radar.bad_references":"radar.bad_fit",t.refs=[],t.phase="reference_1"}}beginCheck(){this.active?.solved&&(this.active.pendingPlan=null,this.active.phase="check_reference",this.host.requestUpdate())}interrupt(){this.active&&(this.reset(),this.host.requestUpdate())}apply(){const t=this.active;if(!t?.mount||!t.headingPoint)return;const e=t.solved?{method:"two_point",mirror:t.solved.mirror,cell_cm:t.cellCm,refs:t.refs.map(t=>({plan:{x:t.plan[0],y:t.plan[1]},local_cm:{x:t.local[0],y:t.local[1]}})),rms_cm:t.solved.rmsCm}:{method:this.coordinateProfile()?"manual":"not_required",mirror:t.draft.mirror,cell_cm:t.cellCm},s={...t.draft,calibrationOverride:e};this.reset(),this.host.apply(s),this.host.requestUpdate()}instruction(t){if("mount"===t.phase)return this.host.t("radar.step_place_mount");if("heading"===t.phase)return this.host.t("radar.step_place_heading");if("reference_1"===t.phase)return this.host.t("radar.step_reference",{n:1});if("reference_2"===t.phase)return this.host.t("radar.step_reference",{n:2});if("check_reference"===t.phase)return this.host.t("radar.step_check_reference");if("capture"===t.phase||"checking"===t.phase){const e=Math.max(0,Math.ceil(((t.countdownUntil||0)-Date.now())/1e3));return e>0?this.host.t("radar.countdown",{seconds:e}):this.host.t("radar.capturing")}return this.host.t("checked"===t.phase?"radar.check_complete":"radar.fit_ready")}render(){const t=this.active;if(!t)return l;const e=(t.room.poly||[]).map(t=>`${1e3*t[0]},${1e3*t[1]}`).join(" "),s=[...t.mount?[{point:t.mount,cls:"mount",label:"R"}]:[],...t.refs.map((t,e)=>({point:t.plan,cls:"reference",label:String(e+1)})),...t.pendingPlan?[{point:t.pendingPlan,cls:"pending",label:"+"}]:[]],i=!!t.pendingPlan&&["reference_1","reference_2","check_reference"].includes(t.phase),o=[...new Set(t.trail.map(t=>t.slot))].map(e=>t.trail.filter(t=>t.slot===e));return h`
    +
    `}function uh(t,e,s,i,o){if(![...t,e,i,...o].every(Number.isFinite)||i<=0||Math.hypot(...o)>1e4)throw new Error("invalid_radar");const a=e*Math.PI/180,n=s?-1:1,r=240*i;return[t[0]+(n*o[0]*Math.cos(a)+o[1]*Math.sin(a))/r,t[1]+(n*o[0]*Math.sin(a)-o[1]*Math.cos(a))/r]}class _h{constructor(t){this.host=t,this.active=null,this.generation=0,this.timer=0}begin(t,e,s,i,o){return!!this.host.configFromDraft(e,i)&&(this.reset(),this.active={markerId:t,draft:e,room:s,cellCm:i,configRev:o,phase:"mount",mount:null,headingPoint:null,pendingPlan:null,refs:[],samples:[],ambiguous:!1,trail:[]},this.host.requestUpdate(),!0)}reset(){this.generation++,this.unsubscribe?.(),this.unsubscribe=void 0,clearInterval(this.timer),this.timer=0,this.active=null}async discardIfAllowed(){if(!this.active)return!0;return!!(null===this.active.mount&&"mount"===this.active.phase||await this.host.confirmDiscard())&&(this.reset(),this.host.requestUpdate(),!0)}cancel(){return this.discardIfAllowed()}isActive(){return null!==this.active}isDirty(){return!!this.active&&(null!==this.active.mount||"mount"!==this.active.phase)}syncMarker(t){this.active&&this.active.markerId!==t&&this.reset()}coordinateProfile(){return!!this.active&&["esphome_ld2450_v1","cartesian_v1","polar_v1"].includes(this.active.draft.profile)}choosePoint(t){const e=this.active,s=function(t){const e=t.currentTarget.getBoundingClientRect();return e.width>0&&e.height>0?[Math.max(0,Math.min(1,(t.clientX-e.left)/e.width)),Math.max(0,Math.min(1,(t.clientY-e.top)/e.height))]:null}(t);var i,o;e&&s&&!1!==t.isPrimary&&"capture"!==e.phase&&"checking"!==e.phase&&(e.error=void 0,"mount"===e.phase?(e.mount=s,e.phase="heading"):"heading"===e.phase&&e.mount?(e.headingPoint=s,e.draft={...e.draft,mountX:String(Number((1e3*e.mount[0]).toFixed(3))),mountY:String(Number((1e3*e.mount[1]).toFixed(3))),heading:String(Number((i=e.mount,o=s,(180*Math.atan2(o[0]-i[0],i[1]-o[1])/Math.PI%360+360)%360).toFixed(3)))},e.phase=this.coordinateProfile()?"reference_1":"solved",this.coordinateProfile()&&this.subscribe()):"reference_1"!==e.phase&&"reference_2"!==e.phase&&"check_reference"!==e.phase||(e.pendingPlan=s),this.host.requestUpdate())}async subscribe(){const t=this.active,e=this.host.hass()?.connection;if(!t||this.unsubscribe||"function"!=typeof e?.subscribeMessage)return;const s=this.host.configFromDraft(t.draft,t.cellCm);if(!s)return;const i=++this.generation;try{const o=await e.subscribeMessage(t=>{i===this.generation&&this.active&&this.receive(t)},{type:"houseplan/radar/setup/subscribe",marker_id:t.markerId,expected_config_rev:t.configRev,draft_sources:{radar:s}});i===this.generation&&this.active?"function"==typeof o&&(this.unsubscribe=o):"function"==typeof o&&o()}catch(t){if(i!==this.generation||!this.active)return;const e=`radar.error_${String(t&&"object"==typeof t&&"code"in t&&t.code||"not_ready")}`;this.active.error=this.host.t(e)===e?"radar.error_not_ready":e,this.host.requestUpdate()}}receive(t){const e=this.active;if(!e)return;const s=Date.now(),i=Array.isArray(t.local_targets)?t.local_targets.filter(t=>{return e=[t.x_cm,t.y_cm],Array.isArray(e)&&2===e.length&&e.every(t=>"number"==typeof t&&Number.isFinite(t));var e}):[],o=new Set(i.map(t=>String(t.slot||"target")));e.trail=e.trail.filter(t=>t.at>=s-8e3&&o.has(t.slot));for(const t of i){const i=[t.x_cm,t.y_cm],o=String(t.slot||"target"),a=e.solved?.headingDeg??Number(e.draft.heading),n=e.solved?.mirror??e.draft.mirror;if(e.mount)try{const t=uh(e.mount,a,n,e.cellCm,i),r=[...e.trail].reverse().find(t=>t.slot===o);r&&240*Math.hypot(t[0]-r.point[0],t[1]-r.point[1])*e.cellCm>100&&(e.trail=e.trail.filter(t=>t.slot!==o)),e.trail.push({at:s,slot:o,point:t})}catch{}}const a=[];for(const t of o)a.push(...e.trail.filter(e=>e.slot===t).slice(-32));if(e.trail=a.sort((t,e)=>t.at-e.at),("capture"===e.phase||"checking"===e.phase)&&s>=(e.countdownUntil||0)&&s<(e.captureUntil||0))if(1===i.length){const t=Number(i[0].reported_at);e.samples.push({at:Number.isFinite(t)?1e3*t:s,point:[i[0].x_cm,i[0].y_cm]})}else i.length>1&&(e.ambiguous=!0);this.host.requestUpdate()}startCapture(){const t=this.active;t?.pendingPlan&&this.coordinateProfile()&&(t.samples=[],t.ambiguous=!1,t.error=void 0,t.captureFor="reference_1"===t.phase?0:"reference_2"===t.phase?1:2,t.phase=2===t.captureFor?"checking":"capture",t.countdownUntil=Date.now()+1e4,t.captureUntil=t.countdownUntil+5e3,clearInterval(this.timer),this.timer=window.setInterval(()=>this.tick(),200),this.subscribe(),this.host.requestUpdate())}tick(){const t=this.active;if(!t||!t.captureUntil||Date.now()t.at))-Math.min(...t.samples.map(t=>t.at))<2e3)throw new Error("insufficient_samples");e=function(t){if(t.length<3)throw new Error("insufficient_samples");const e=t=>{const e=[...t].sort((t,e)=>t-e),s=Math.floor(e.length/2);return e.length%2?e[s]:(e[s-1]+e[s])/2},s=[e(t.map(t=>t[0])),e(t.map(t=>t[1]))];if(t.some(t=>Math.hypot(t[0]-s[0],t[1]-s[1])>15))throw new Error("bad_fit");return s}(t.samples.map(t=>t.point))}catch(e){return t.error="ambiguous_target"===String(e?.message)?"radar.ambiguous_target":"radar.insufficient_samples",t.phase=0===t.captureFor?"reference_1":1===t.captureFor?"reference_2":"check_reference",void this.host.requestUpdate()}if(2===t.captureFor&&t.solved&&t.mount&&t.pendingPlan){const s=uh(t.mount,t.solved.headingDeg,t.solved.mirror,t.cellCm,e);t.checkErrorCm=240*Math.hypot(s[0]-t.pendingPlan[0],s[1]-t.pendingPlan[1])*t.cellCm,t.phase="checked"}else t.pendingPlan&&(t.refs[t.captureFor||0]={plan:t.pendingPlan,local:e},t.pendingPlan=null,t.refs.length<2?t.phase="reference_2":this.solve());this.host.requestUpdate()}solve(){const t=this.active;if(t?.mount&&2===t.refs.length)try{t.solved=function(t,e,s,i){if(![...t,i,...e.flat(),...s.flat()].every(Number.isFinite)||i<=0)throw new Error("invalid_selection");if(e.some(t=>Math.hypot(...t)<50))throw new Error("bad_references");const o=Math.hypot(...e[0])*Math.hypot(...e[1]),a=(e[0][0]*e[1][0]+e[0][1]*e[1][1])/o,n=180*Math.acos(Math.max(-1,Math.min(1,a)))/Math.PI;if(n<20||n>160)throw new Error("bad_references");const r=240*i,l=s.map(e=>[(e[0]-t[0])*r,-(e[1]-t[1])*r]),h=[];for(const t of[!1,!0]){const s=e.map(([e,s])=>[t?-e:e,s]),i=s.reduce((t,e,s)=>t+e[0]*l[s][0]+e[1]*l[s][1],0),o=s.reduce((t,e,s)=>t+e[0]*l[s][1]-e[1]*l[s][0],0),a=Math.atan2(o,i),n=s.map(([t,e],s)=>{const i=t*Math.cos(a)-e*Math.sin(a),o=t*Math.sin(a)+e*Math.cos(a);return Math.hypot(i-l[s][0],o-l[s][1])}),r=e.every((t,e)=>{const s=Math.hypot(...t),i=Math.hypot(...l[e]);return Math.abs(s-i)<=Math.max(20,.15*i)}),c=Math.sqrt((n[0]**2+n[1]**2)/2);r&&c<=20&&Math.max(...n)<=30&&h.push({headingDeg:(180*-a/Math.PI%360+360)%360,mirror:t,rmsCm:c,errorsCm:n})}if(h.sort((t,e)=>t.rmsCm-e.rmsCm),!h.length)throw new Error("invalid_selection");if(h.length>1&&Math.abs(h[0].rmsCm-h[1].rmsCm)<10)throw new Error("ambiguous_sources");return h[0]}(t.mount,[t.refs[0].local,t.refs[1].local],[t.refs[0].plan,t.refs[1].plan],t.cellCm),t.draft={...t.draft,heading:String(Number(t.solved.headingDeg.toFixed(3))),mirror:t.solved.mirror},t.phase="solved",t.error=void 0}catch(e){const s=String(e?.message);t.error="ambiguous_sources"===s?"radar.ambiguous_sources":"bad_references"===s?"radar.bad_references":"radar.bad_fit",t.refs=[],t.phase="reference_1"}}beginCheck(){this.active?.solved&&(this.active.pendingPlan=null,this.active.phase="check_reference",this.host.requestUpdate())}interrupt(){this.active&&(this.reset(),this.host.requestUpdate())}apply(){const t=this.active;if(!t?.mount||!t.headingPoint)return;const e=t.solved?{method:"two_point",mirror:t.solved.mirror,cell_cm:t.cellCm,refs:t.refs.map(t=>({plan:{x:t.plan[0],y:t.plan[1]},local_cm:{x:t.local[0],y:t.local[1]}})),rms_cm:t.solved.rmsCm}:{method:this.coordinateProfile()?"manual":"not_required",mirror:t.draft.mirror,cell_cm:t.cellCm},s={...t.draft,calibrationOverride:e};this.reset(),this.host.apply(s),this.host.requestUpdate()}instruction(t){if("mount"===t.phase)return this.host.t("radar.step_place_mount");if("heading"===t.phase)return this.host.t("radar.step_place_heading");if("reference_1"===t.phase)return this.host.t("radar.step_reference",{n:1});if("reference_2"===t.phase)return this.host.t("radar.step_reference",{n:2});if("check_reference"===t.phase)return this.host.t("radar.step_check_reference");if("capture"===t.phase||"checking"===t.phase){const e=Math.max(0,Math.ceil(((t.countdownUntil||0)-Date.now())/1e3));return e>0?this.host.t("radar.countdown",{seconds:e}):this.host.t("radar.capturing")}return this.host.t("checked"===t.phase?"radar.check_complete":"radar.fit_ready")}render(){const t=this.active;if(!t)return d;const e=(t.room.poly||[]).map(t=>`${1e3*t[0]},${1e3*t[1]}`).join(" "),s=[...t.mount?[{point:t.mount,cls:"mount",label:"R"}]:[],...t.refs.map((t,e)=>({point:t.plan,cls:"reference",label:String(e+1)})),...t.pendingPlan?[{point:t.pendingPlan,cls:"pending",label:"+"}]:[]],i=!!t.pendingPlan&&["reference_1","reference_2","check_reference"].includes(t.phase),o=[...new Set(t.trail.map(t=>t.slot))].map(e=>t.trail.filter(t=>t.slot===e));return p`
    ${this.instruction(t)} `:l} - ${"solved"===t.phase?h``:l} - ${"solved"===t.phase||"checked"===t.phase?h``:l} + ${i?p``:d} + ${"solved"===t.phase?p``:d} + ${"solved"===t.phase||"checked"===t.phase?p``:d}
    -
    `}}const dh=.001;function ph(t){return!!t&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1])}function uh(t){return`${t[0].toFixed(6)},${t[1].toFixed(6)}`}function _h(t,e,s){return Math.abs(t[0]-e[0])"room"!==t.kind&&s.some(s=>s!==t&&function(t,e,s){const i=t.b[0]-t.a[0],o=t.b[1]-t.a[1],a=Math.hypot(i,o);if(!(a>s))return!1;const n=i/a,r=o/a,l=e=>Math.abs((e[0]-t.a[0])*r-(e[1]-t.a[1])*n);if(l(e.a)>s||l(e.b)>s)return!1;const h=(e.a[0]-t.a[0])*n+(e.a[1]-t.a[1])*r,c=(e.b[0]-t.a[0])*n+(e.b[1]-t.a[1])*r;return Math.min(a,Math.max(h,c))-Math.max(0,Math.min(h,c))>s}(t,s,e))),o=i.map(t=>{const[e,s]=mh(t.a,t.b);return{a:e,b:s,key:`hidden|${fh(t,e,s)}`,sourceKind:t.kind,sourceId:t.id}}).sort((t,e)=>t.key.localeCompare(e.key)),a=i.flatMap(t=>[t.a,t.b].map((e,s)=>({point:[e[0],e[1]],key:`hidden|${gh(t)}|endpoint-${s}`,sourceKind:"partition",sourceId:t.id}))).sort((t,e)=>t.key.localeCompare(e.key));return{segments:o,endpoints:a}}function $h(t){const e=t.epsilon??dh,s=t.roomCuts||[],i=new Map;for(const e of t.partitionCuts||[]){if("string"!=typeof e.hostId||!e.hostId||!ph(e.a)||!ph(e.b))continue;const t=i.get(e.hostId)||[];t.push([e.a[0],e.a[1],e.b[0],e.b[1]]),i.set(e.hostId,t)}const o=[];for(const[e,i]of Et(t.space.rooms).entries())i.length<4||o.push({a:[i[0],i[1]],b:[i[2],i[3]],kind:"room",id:`room-edge-${e}`,cuts:s});for(const e of t.space.partitions||[])ph(e.a)&&ph(e.b)&&o.push({a:[e.a[0],e.a[1]],b:[e.b[0],e.b[1]],kind:"partition",id:e.id,cuts:i.get(e.id)||[]});const a=new Map,n=new Map;for(const t of o){const s=[t.a[0],t.a[1],t.b[0],t.b[1]],i=Ht([s],t.cuts,e);if(i.length){for(const s of i){if(s.length<4)continue;const[i,o]=mh([s[0],s[1]],[s[2],s[3]]);if(_h(i,o,e))continue;const n=`${uh(i)}|${uh(o)}`,r={a:i,b:o,key:fh(t,i,o),sourceKind:t.kind,sourceId:t.id},l=a.get(n);(!l||bh(r.sourceKind)vh(s,t,e)))continue;const t=uh(s);n.has(t)||n.set(t,{point:[s[0],s[1]],key:t})}}}return{segments:[...a.values()].sort((t,e)=>t.key.localeCompare(e.key)),endpoints:[...n.values()].sort((t,e)=>t.key.localeCompare(e.key))}}function wh(t,e,s){return e.some(e=>ph(e)&&_h(t,e,s))}function kh(t,e,s){if(!s)return!0;const i=t-s.distance;return i<-1e-9||Math.abs(i)<=1e-9&&e.localeCompare(s.key)<0}function xh(t,e,s){const i=s.epsilon??dh,o=s.excludePoints||[],a=[...t.endpoints,...(s.extraEndpoints||[]).filter(t=>ph(t.point)).map(t=>({point:[t.point[0],t.point[1]],key:t.key}))],n=new Map;for(const t of a){if(wh(t.point,o,i))continue;const e=uh(t.point),s=n.get(e);(!s||t.key.localeCompare(s.key)<0)&&n.set(e,t)}return[...n.values()].map(t=>({kind:"endpoint",point:[...t.point],key:t.key,distance:Math.hypot(e[0]-t.point[0],e[1]-t.point[1])})).filter(t=>t.distance<=s.tolerance).sort((t,e)=>t.distance-e.distance||t.key.localeCompare(e.key))}function Sh(t,e){if(!t.length)return null;if(e>0){const s=new Set;for(let i=0;i1)return{kind:"ambiguous",candidate:null,conflicts:t.filter(t=>s.has(t.key)).map(t=>({point:[...t.point],key:t.key}))}}return{kind:"resolved",candidate:t[0],conflicts:[]}}function Mh(t,e,s){const i=t.b[0]-t.a[0],o=t.b[1]-t.a[1],a=Math.hypot(i,o);if(!(a>0))return[...t.a];const n=i/a,r=o/a,l=Math.max(0,Math.min(a,(e[0]-t.a[0])*n+(e[1]-t.a[1])*r)),h=s>0?Math.max(0,Math.min(a,Math.round(l/s)*s)):l;return[t.a[0]+n*h,t.a[1]+r*h]}function Ch(t,e,s){if(!(ph(e)&&ph(s.anchor)&&s.tolerance>=0))return{kind:"none",candidate:null,conflicts:[]};const i=s.epsilon??dh,o=function(t,e){const s=e[0]-t[0],i=e[1]-t[1];if(!(Math.hypot(s,i)>Number.EPSILON))return null;const o=Math.round(Math.atan2(i,s)/(Math.PI/4))*(Math.PI/4);return[Math.cos(o),Math.sin(o)]}(s.anchor,e);if(!o)return{kind:"none",candidate:null,conflicts:[]};const a=xh(t,e,s).filter(t=>function(t,e,s,i){const o=t[0]-e[0],a=t[1]-e[1];return o*s[0]+a*s[1]>i&&Math.abs(o*s[1]-a*s[0])<=i*Math.max(Math.hypot(o,a),1)}(t.point,s.anchor,o,i)),n=Sh(a,s.distinguishTolerance||0);if(n)return n;let r=null;for(const a of t.segments){const t=a.b[0]-a.a[0],n=a.b[1]-a.a[1],l=a.a[0]-s.anchor[0],h=a.a[1]-s.anchor[1],c=o[0]*n-o[1]*t;let d=null;if(Math.abs(c)<=i*Math.max(Math.hypot(t,n),1)){if(Math.abs(l*o[1]-h*o[0])>i*Math.max(Math.hypot(l,h),1))continue;const t=[a.a,a.b].map(t=>({point:t,along:(t[0]-s.anchor[0])*o[0]+(t[1]-s.anchor[1])*o[1]})).filter(t=>t.along>i).sort((t,e)=>t.along-e.along);t.length&&(d=[...t[0].point])}else{const e=(l*n-h*t)/c,a=(l*o[1]-h*o[0])/c;e>i&&a>=-i&&a<=1+i&&(d=[s.anchor[0]+o[0]*e,s.anchor[1]+o[1]*e])}if(!d)continue;const p=Math.hypot(e[0]-d[0],e[1]-d[1]);p>s.tolerance||wh(d,s.excludePoints||[],i)||!kh(p,a.key,r)||(r={kind:"line",point:d,key:a.key,distance:p,segment:a})}return r?{kind:"resolved",candidate:r,conflicts:[]}:{kind:"none",candidate:null,conflicts:[]}}const Ph=.001;function Dh(t,e,s,i){const o=Number.isFinite(t)&&t>0?Math.floor(t):0,a=t=>"number"==typeof t&&Number.isFinite(t)&&t>=0?t:null,n=a(s),r=a(i)??0,l=[];let h=null;for(let t=0;t=2&&Number.isFinite(t[0])&&Number.isFinite(t[1])}function Th(t,e,s,i){return t*i-e*s}function zh(t){let e=0;for(let s=0;st.localeCompare(e)),e[0]}function Eh(t,e,s){const i=[...t];for(let t=!0;t&&i.length>=3;){t=!1;for(let o=0;o=0){i.splice(o,1),t=!0;break}}}return i}function Hh(t,e){const s=t.map(t=>Math.max(0,Math.min(1,t))).sort((t,e)=>t-e),i=[];for(const t of s)(!i.length||Math.abs(t-i[i.length-1])>e)&&i.push(t);return i}function Oh(t,e){return[t.a[0]+(t.b[0]-t.a[0])*e,t.a[1]+(t.b[1]-t.a[1])*e]}function Lh(t,e,s){const i=function(t,e){const s=e.b[0]-e.a[0],i=e.b[1]-e.a[1],o=s*s+i*i;return o>0?((t[0]-e.a[0])*s+(t[1]-e.a[1])*i)/o:0}(t,e);if(i<-s||i>1+s)return null;const o=Oh(e,i);return Math.hypot(o[0]-t[0],o[1]-t[1])<=s?Math.max(0,Math.min(1,i)):null}function Bh(t,e,s,i,o){const a=t.b[0]-t.a[0],n=t.b[1]-t.a[1],r=e.b[0]-e.a[0],l=e.b[1]-e.a[1],h=e.a[0]-t.a[0],c=e.a[1]-t.a[1],d=Th(a,n,r,l),p=Math.max(Math.hypot(a,n),Math.hypot(r,l),1);if(Math.abs(d)>o*p){const t=Th(h,c,r,l)/d,e=Th(h,c,a,n)/d;return void(t>=-o&&t<=1+o&&e>=-o&&e<=1+o&&(s.push(Math.max(0,Math.min(1,t))),i.push(Math.max(0,Math.min(1,e)))))}if(!(Math.abs(Th(h,c,a,n))>o*p)){for(const i of[e.a,e.b]){const e=Lh(i,t,o);null!=e&&s.push(e)}for(const s of[t.a,t.b]){const t=Lh(s,e,o);null!=t&&i.push(t)}}}function Wh(t){let e=t+1|0;return e^=e<<13,e^=e>>>17,e^=e<<5,e>>>0}function jh(t,e){return t.minY-e.minY||t.index-e.index}function Gh(t){return t.subtreeMaxY=Math.max(t.item.maxY,t.left?.subtreeMaxY??-1/0,t.right?.subtreeMaxY??-1/0),t}function qh(t){const e=t.right;return t.right=e.left,e.left=Gh(t),Gh(e)}function Uh(t){const e=t.left;return t.left=e.right,e.right=Gh(t),Gh(e)}function Kh(t,e){return t?(jh(e,t.item)<0?(t.left=Kh(t.left,e),t.left.priority0)t.right=Vh(t.right,e);else{if(!t.left)return t.right;if(!t.right)return t.left;t.left.priority=e&&Jh(t.left,e,s,i),t.item.minY<=s&&t.item.maxY>=e&&i.push(t.item),t.item.minY<=s&&Jh(t.right,e,s,i))}function Yh(t,e=.001){const s=Number.isFinite(e)&&e>0?e:Ph,i=t.filter(t=>Ih(t.a)&&Ih(t.b)&&"string"==typeof t.key&&t.key.length>0&&Math.hypot(t.b[0]-t.a[0],t.b[1]-t.a[1])>s),o=i.map(()=>[0,1]);!function(t,e,s){const i=t.map((t,e)=>({index:e,minX:Math.min(t.a[0],t.b[0])-s,maxX:Math.max(t.a[0],t.b[0])+s,minY:Math.min(t.a[1],t.b[1])-s,maxY:Math.max(t.a[1],t.b[1])+s})),o=[...i].sort((t,e)=>t.minX-e.minX||t.minY-e.minY||t.index-e.index),a=[...i].sort((t,e)=>t.maxX-e.maxX||t.index-e.index),n=new Set;let r=null,l=0;for(const i of o){for(;lt.index-e.index);for(const a of o)Bh(t[a.index],t[i.index],e[a.index],e[i.index],s);n.add(i.index),r=Kh(r,i)}}(i,o,s);const a=new Map;for(let t=0;t({key:t,a:e.a,b:e.b,sourceKeys:[...e.sourceKeys].sort((t,e)=>t.localeCompare(e))})).sort((t,e)=>t.key.localeCompare(e.key))}function Xh(t,e=.001){const s=Number.isFinite(e)&&e>0?e:Ph,i=Yh(t,s),o=new Map,a=new Map,n=new Map(i.map(t=>[t.key,t]));for(const t of i){const e=Ah(t.a,s),i=Ah(t.b,s);o.set(e,t.a),o.set(i,t.b),a.has(e)||a.set(e,new Set),a.has(i)||a.set(i,new Set),a.get(e).add(i),a.get(i).add(e)}const r=new Map;for(const[t,e]of a){const s=o.get(t);r.set(t,[...e].sort((t,e)=>{const i=o.get(t),a=o.get(e);return Math.atan2(i[1]-s[1],i[0]-s[0])-Math.atan2(a[1]-s[1],a[0]-s[0])||t.localeCompare(e)}))}const l=new Set,h=new Map,c=(t,e)=>`${t}>${e}`;for(const t of i){const e=[Ah(t.a,s),Ah(t.b,s)];for(const[t,a]of[e,[e[1],e[0]]]){if(l.has(c(t,a)))continue;const e=[],d=[];let p=t,u=a,_=!1;for(let s=0;s<=2*i.length+2;s++){const s=c(p,u);if(l.has(s)){_=p===t&&u===a;break}l.add(s),e.push(p),d.push(Fh(p,u));const i=r.get(u)||[],o=i.indexOf(p);if(o<0||!i.length)break;if(p=u,u=i[(o-1+i.length)%i.length],p===t&&u===a){_=!0;break}}if(!_||new Set(e).size<3||new Set(e).size!==e.length)continue;const m=e.map(t=>o.get(t)),g=zh(m);if(!(g>s*s))continue;const f=Nh(Eh(e,o,s)),b=new Set;for(const t of d)for(const e of n.get(t)?.sourceKeys||[])b.add(e);const v={ring:m,key:f,area:g,atomKeys:[...d],sourceKeys:[...b].sort((t,e)=>t.localeCompare(e))};h.has(f)||h.set(f,v)}}return{atoms:i,faces:[...h.values()].sort((t,e)=>t.area-e.area||t.key.localeCompare(e.key))}}function Zh(t,e,s=.001){if(!Ih(e))return null;const i=t.faces.filter(t=>{if(t.ring.some((i,o)=>function(t,e,s,i){const o=s[0]-e[0],a=s[1]-e[1],n=o*o+a*a;if(!(n>0))return Math.hypot(t[0]-e[0],t[1]-e[1])<=i;const r=((t[0]-e[0])*o+(t[1]-e[1])*a)/n;return!(r<0||r>1)&&Math.hypot(e[0]+o*r-t[0],e[1]+a*r-t[1])<=i}(e,i,t.ring[(o+1)%t.ring.length],s)))return!1;let i=!1;for(let s=0,o=t.ring.length-1;se[1]!=n[1]>e[1]&&e[0]<(n[0]-a[0])*(e[1]-a[1])/(n[1]-a[1])+a[0]&&(i=!i)}return i});return[...i].sort((t,e)=>t.area-e.area||t.key.localeCompare(e.key))[0]||null}function Qh(t,e,s){const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o,n=a>0?Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a)):0;return Math.hypot(e[0]+i*n-t[0],e[1]+o*n-t[1])}function tc(t,e,s=.5){let i=Math.abs(t-e)%180;return i>90&&(i=180-i),i<=s}function ec(t,e,s,i){const o=t.filter(t=>"outer"===t.kind&&!t.open&&t.cm>0).map(t=>({interval:t,reusePartitionId:e.find(e=>function(t,e,s){return!(Math.abs(t.cm-e.cm)>1e-6)&&(tc(180*Math.atan2(t.b[1]-t.a[1],t.b[0]-t.a[0])/Math.PI,180*Math.atan2(e.b[1]-e.a[1],e.b[0]-e.a[0])/Math.PI,.001)&&Qh(e.a,t.a,t.b)<=s&&Qh(e.b,t.a,t.b)<=s)}(e,t,i))?.id||null})),a=new Map;for(const e of s){if("partition"===e.host?.kind)continue;const s=t.map(t=>{const s=180*Math.atan2(t.b[1]-t.a[1],t.b[0]-t.a[0])/Math.PI;return{interval:t,distance:tc(e.angle,s)?Qh([e.x,e.y],t.a,t.b):1/0}}).filter(t=>t.distance<=i).sort((t,e)=>t.distance-e.distance||t.interval.key.localeCompare(e.interval.key)),o=s[0]?.interval;"outer"===o?.kind&&!o.open&&o.cm>0&&a.set(e.id,o.key)}return{materialize:o,openingIntervals:a,removeOpeningIds:[...a.keys()].sort((t,e)=>t.localeCompare(e))}}function sc(t,e){const s=e.b[0]-e.a[0],i=e.b[1]-e.a[1],o=s*s+i*i;return o>0?Math.max(0,Math.min(1,((t[0]-e.a[0])*s+(t[1]-e.a[1])*i)/o)):0}const ic=t=>!t.key.startsWith("static:room|");function oc(t,e){const s=e.b[0]-e.a[0],i=e.b[1]-e.a[1],o=s*s+i*i;if(!(o>0))return null;const a=((t[0]-e.a[0])*s+(t[1]-e.a[1])*i)/o,n=[e.a[0]+s*a,e.a[1]+i*a];return{point:n,t:a,distance:Math.hypot(n[0]-t[0],n[1]-t[1])}}function ac(t,e){return e>0?Math.hypot(t[0]-Math.round(t[0]/e)*e,t[1]-Math.round(t[1]/e)*e):0}function nc(t,e,s){if(ic(t.source)!==ic(e.source))return ic(t.source)?t:e;const i=ac(t.point,s),o=ac(e.point,s);return Math.abs(i-o)>1e-9?i>o?t:e:function(t,e){return t[0]-e[0]||t[1]-e[1]}(t.point,e.point)>0?t:e}function rc(t){return[t.from[0],t.from[1],t.to[0],t.to[1],t.targetKind].map(t=>"number"==typeof t?t.toFixed(6):t).join("|")}function lc(t,e){return t.map(t=>t.key!==e.sourceKey?t:{...t,[e.endpoint]:[...e.to]})}function hc(t,e){const s=e.epsilon??.001;if(!(e.maxDistance>=0)||!e.point&&!e.requiredSourceKey)return{kind:"none"};const i=new Map,o=t.flatMap(t=>[{source:t,endpoint:"a",point:t.a},{source:t,endpoint:"b",point:t.b}]);for(let t=0;ts)||l>e.maxDistance)continue;const h=nc(n,r,e.gridStep||0),c=h===n?r:n;if(!ic(h.source))continue;const d={sourceKey:h.source.key,endpoint:h.endpoint,from:[h.point[0],h.point[1]],to:[c.point[0],c.point[1]],targetSourceKey:c.source.key,targetKind:"endpoint",distance:l};i.set(rc(d),d)}for(const a of o)if(ic(a.source))for(const o of t){if(o===a.source)continue;const t=oc(a.point,o);if(!t||t.t<=s||t.t>=1-s||!(t.distance>s)||t.distance>e.maxDistance)continue;const n={sourceKey:a.source.key,endpoint:a.endpoint,from:[a.point[0],a.point[1]],to:t.point,targetSourceKey:o.key,targetKind:"line",distance:t.distance};i.set(rc(n),n)}const a=[];for(const o of i.values()){const i=Xh(lc(t,o),s),n=e.point?Zh(i,e.point,s):i.faces.find(t=>!e.requiredSourceKey||t.sourceKeys.includes(e.requiredSourceKey))||null;n&&a.push({proposal:o,face:n})}if(a.sort((t,e)=>t.proposal.distance-e.proposal.distance||rc(t.proposal).localeCompare(rc(e.proposal))),!a.length)return{kind:"none"};return new Set(a.map(t=>`${rc(t.proposal)}|${t.face.key}`)).size>1?{kind:"ambiguous",proposals:a.map(t=>t.proposal)}:{kind:"repair",...a[0]}}const cc=(t,e)=>(t.composedPath?.()||[t.target]).some(t=>(t=>!!t&&"function"==typeof t.matches)(t)&&e(t));class dc{constructor(t){this.host=t,this._openGroupId=null,this._groupGeneration=0,this._renderedContext="",this._focusOwned=!1,this._currentModel=null,this._blocked=!1,this._dismissPointerTarget=null,this._globalDismissListening=!1,this._globalDismissGuard=t=>{this.handleOutsideDismiss(t)}}get hasOpenGroup(){return null!==this._openGroupId}get groupGeneration(){return this._groupGeneration}activeGroup(t){return this._openGroupId&&t.find(t=>t.id===this._openGroupId)||null}reset(){this._openGroupId=null,this._contentAnimation?.cancel(),this._contentAnimation=void 0,this._renderedContext="",this._focusOwned=!1,this._currentModel=null,this._blocked=!1,this._dismissPointerTarget=null,clearTimeout(this._dismissTimer),this._dismissTimer=void 0,this._syncGlobalDismissListener()}closeForNavigation(){const t="palette"===this._currentModel?.kind?this._currentModel.dismiss:void 0,e=!!this._openGroupId||!!t;this._openGroupId=null,t?.(),t&&(this._currentModel=null),this._clearDismissClick(),e&&this.host.requestUpdate(),this._syncGlobalDismissListener()}openPalette(){this._openGroupId&&this.closeGroup(!1)}toggleGroup(t,e){this._openGroupId!==e?t.some(t=>t.id===e)&&("palette"===this._currentModel?.kind&&this._currentModel.dismiss?.(),this._groupGeneration+=1,this._openGroupId=e,this.host.clearTip(),this.host.requestUpdate(),this._syncGlobalDismissListener()):this.closeGroup(!1)}closeGroup(t){const e=this._openGroupId;this._openGroupId=null,this.host.requestUpdate(),this._syncGlobalDismissListener(),t&&e&&this.host.updateComplete().then(()=>{const t=this.host.root(),s=[...t.querySelectorAll("[data-editor-group]")].find(t=>t.dataset.editorGroup===e&&null!==t.offsetParent);(s||t.querySelector(".editbar-tools"))?.focus?.()})}renderGroupLauncher(t,e,s){const i=this._openGroupId===t.id,o=t.items.find(e=>e.id===t.activeItemId&&!e.disabled);return h``}renderGroupModel(t,e,s){const i=t.items.find(t=>!t.disabled)?.id,o=t.items.some(e=>e.id===t.activeItemId&&!e.disabled)?t.activeItemId:void 0;return{contextId:e,kind:"group",launcherId:t.id,ariaLabel:s.openGroup(t.label),visibleLabel:t.label,content:h`
    `}renderGroupModel(t,e,s){const i=t.items.find(t=>!t.disabled)?.id,o=t.items.some(e=>e.id===t.activeItemId&&!e.disabled)?t.activeItemId:void 0;return{contextId:e,kind:"group",launcherId:t.id,ariaLabel:s.openGroup(t.label),visibleLabel:t.label,content:p`
    this._groupKeydown(t)}> - ${t.items.map(e=>h``)} -
    `}}runContext(t,e,s){if(t===e)return s()}render(t,e){this._currentModel=t,this._blocked=e;const s=t?.kind||"hidden";return h`
    `}}runContext(t,e,s){if(t===e)return s()}render(t,e){this._currentModel=t,this._blocked=e;const s=t?.kind||"hidden";return p`
    -
    `}afterRender(){const t=this.host.root();this._blocked&&(this._openGroupId?this.closeGroup(!1):"palette"===this._currentModel?.kind&&this._currentModel.dismiss?.()),this._syncGlobalDismissListener();const e=t.querySelector(".editor-secondary"),s=this._renderedContext,i=e?.dataset.contextId||"";if(i&&s&&i!==s&&!window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches&&(this._contentAnimation?.cancel(),this._contentAnimation=e?.querySelector(".editor-secondary-content")?.animate([{opacity:.35,transform:"translateY(-4px)"},{opacity:1,transform:"translateY(0)"}],{duration:100,easing:"ease-out"})),this._renderedContext=i,s&&i!==s&&this._focusOwned){const s=i?e?.querySelector('[tabindex="0"], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'):t.querySelector(".editbar-tools");s?.focus?.(),this._focusOwned=!!i}if("palette"===this._currentModel?.kind&&this._currentModel.launcherId){const e=[...t.querySelectorAll("[data-editor-palette]")].find(t=>t.dataset.editorPalette===this._currentModel?.launcherId);e&&null!==e.offsetParent||this._currentModel.dismiss?.()}if(!this._openGroupId)return;const o=[...t.querySelectorAll("[data-editor-group]")].find(t=>t.dataset.editorGroup===this._openGroupId);o&&null!==o.offsetParent||this.closeGroup(!0)}handleOutsideDismiss(t){if(cc(t,t=>t.hasAttribute("data-editor-navigation")))return"pointerdown"===t.type?this.closeForNavigation():"click"===t.type&&this._dismissPointerTarget&&this._clearDismissClick(),!1;if("click"===t.type&&this._dismissPointerTarget){return!!(t.composedPath?.()||[t.target]).includes(this._dismissPointerTarget)&&(this._clearDismissClick(),t.preventDefault(),t.stopImmediatePropagation(),!0)}const e=this._openGroupId||this._blocked||"palette"!==this._currentModel?.kind?null:this._currentModel;if("pointerdown"===t.type&&(this._openGroupId||e)){const s=cc(t,t=>t.classList.contains("editor-secondary")),i=cc(t,t=>!!t.dataset.editorGroup),o=cc(t,t=>!!t.dataset.editorPalette),a=cc(t,t=>t.classList.contains("stage"));if(!(s||i||o||"stay-open-on-canvas"===e?.dismissPolicy&&a))return t.preventDefault(),t.stopImmediatePropagation(),this._dismissPointerTarget=t.target,clearTimeout(this._dismissTimer),this._dismissTimer=window.setTimeout(()=>{this._clearDismissClick()},800),this._openGroupId?this.closeGroup(!1):e?.dismiss?.(),this._syncGlobalDismissListener(),!0}return!1}_activateGroupItem(t,e,s){if(t.id!==this._openGroupId)return;const i=t.items.find(t=>t.id===e);if(!i||i.disabled)return;const o="toggle"===i.role&&"stay-open"===i.closePolicy,a=0===s.detail;o||(this._openGroupId=null,this.host.requestUpdate(),this._syncGlobalDismissListener()),i.invoke(),!o&&a&&this.host.updateComplete().then(()=>{const e=[...this.host.root().querySelectorAll("[data-editor-group]")].find(e=>e.dataset.editorGroup===t.id&&null!==e.offsetParent);e?.focus()})}_groupKeydown(t){if(!["ArrowLeft","ArrowRight","Home","End"].includes(t.key))return;const e=[...t.currentTarget.querySelectorAll(".editor-group-item:not([disabled])")];if(!e.length)return;t.preventDefault();const s=e.indexOf(this.host.root().activeElement),i="Home"===t.key?0:"End"===t.key?e.length-1:"ArrowLeft"===t.key?s<=0?e.length-1:s-1:(s+1)%e.length;e[i]?.focus()}_clearDismissClick(){this._dismissPointerTarget=null,clearTimeout(this._dismissTimer),this._dismissTimer=void 0,this._syncGlobalDismissListener()}_syncGlobalDismissListener(){const t=!this._blocked&&"palette"===this._currentModel?.kind,e=!!this._openGroupId||t||!!this._dismissPointerTarget;e!==this._globalDismissListening&&(this._globalDismissListening=e,e?(window.addEventListener("pointerdown",this._globalDismissGuard,!0),window.addEventListener("click",this._globalDismissGuard,!0)):(window.removeEventListener("pointerdown",this._globalDismissGuard,!0),window.removeEventListener("click",this._globalDismissGuard,!0)))}}const pc=t=>t.stopPropagation(),uc=new WeakSet,_c=t=>{t._regSignature="",t._maybeRebuildDevices(),t.requestUpdate()};async function mc(t,e,s,i,o,a=""){const n=t.host,r=n._serverCfg;if(!r)return!1;let l=JSON.parse(JSON.stringify(r));l.markers=l.markers||[];let h=l.markers.find(t=>t.id===e);if(!h){const t=n._devices.find(t=>t.id===e);if(!t||"device"!==t.bindingKind&&"entity"!==t.bindingKind||!t.bindingRef)return!1;h={id:t.id,binding:`${t.bindingKind}:${t.bindingRef}`,space:t.space||null,area:t.area||null,hidden:!!t.hidden},l.markers.push(h)}h.vacuum=function(t,e){const s=e.matrix.map(t=>Number(t.toFixed(6))),i=t?.map_routes;if(Array.isArray(i)&&i.length){const o=i.find(t=>t.id===e.routeId)||i.find(t=>t.source===e.source&&t.map_id===e.mapId);if(o)return{...t,map_routes:Ro(i,o.id,s)}}return{...t,source:e.source,calibration:{...t?.calibration||{},[e.mapId]:s}}}(h.vacuum||{},{source:s,mapId:i,routeId:a,matrix:o}),l=t._prepareConfigCandidate(l);const c=n._adoption.beginOptimistic(r,l);n._adoption.stageLocalConfig(l),_c(n),n._saveConfigDebounced.pending()&&n._saveConfigDebounced.cancel();try{return await t._saveConfigNow(c),!0}catch(t){return n._rollbackOptimistic(c),_c(n),n._showToast(n._t("toast.cfg_save_failed",{err:n._errText(t)})),!1}}function gc(t){return 1===t}function fc(t){return`${t}-${globalThis.crypto?.randomUUID?.()??`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function bc(t){const e=function(t){return JSON.stringify({message:t.message.trim(),contact:t.contact.trim(),previewToken:t.attach&&t.preview?t.preview.token:""})}(t);return{idempotencyKey:t.submissionFingerprint&&t.submissionFingerprint!==e?fc("report"):t.idempotencyKey,fingerprint:e}}function vc(t){return[...t].length}function yc(t,e=Date.now()){const s=t.message.trim();return s?vc(s)>1e4?"message_too_long":vc(t.contact.trim())>320?"contact_too_long":t.attach&&!t.preview?"preview_missing":t.attach&&t.preview.expiresAt<=e?"preview_expired":null:"message_required"}function $c(t,e=Date.now()){return"building"!==t.status&&"sending"!==t.status&&"success"!==t.status&&null===yc(t,e)}function wc(t){const e=function(t){const e=/Firefox\/(\d+)/i.exec(t);if(e)return{family:"firefox",major:Number(e[1])||0};const s=/(?:Chrome|Chromium|Edg)\/(\d+)/i.exec(t);if(s)return{family:"chromium",major:Number(s[1])||0};const i=/Version\/(\d+).+Safari\//i.exec(t);return i?{family:"webkit",major:Number(i[1])||0}:{family:"unknown",major:0}}(t.userAgent??globalThis.navigator?.userAgent??""),s=t.now??Date.now(),i=Number(t.registryLastSuccess||0),o=i<=0?"unknown":s-i<=6e5?"fresh":"stale",a=["en","ru","de","fr"].includes(t.language)?t.language:"en",n=globalThis.matchMedia?.bind(globalThis);return{browser_family:e.family,browser_major:Math.max(0,Math.min(999,e.major)),language:a,coarse_pointer:t.coarsePointer??!!n?.("(pointer: coarse)").matches,hover_capable:t.hoverCapable??!!n?.("(hover: hover)").matches,registry_access:"full"===t.registryAccess?"full":"limited"===t.registryAccess?"partial":"unavailable",registry_age_bucket:o}}function kc(t){const e=t&&"object"==typeof t&&"code"in t?String(t.code||""):"";return new Set(["support_invalid_message","support_preview_expired","support_package_too_large","support_rate_limited","support_unavailable","support_rejected","unauthorized"]).has(e)?e:"support_unavailable"}const xc=[{id:"air_conditioner",group:"appliance",art:{d:"M20.5 39h69a2.5 2.5 0 0 1 2.5 2.5V69a2.5 2.5 0 0 1-2.5 2.5h-69A2.5 2.5 0 0 1 18 69V41.5a2.5 2.5 0 0 1 2.5-2.5 M25 63a2.5 2.5 0 0 1 2.5-2.5h55A2.5 2.5 0 0 1 85 63v8.5H25z M25 63a2.5 2.5 0 0 1 2.5-2.5h55A2.5 2.5 0 0 1 85 63v3.5H25z",viewW:110,viewH:110}},{id:"armchair",group:"furniture",art:{d:"M42.5 29h25a10 10 0 0 1 10 10v26.5a10 10 0 0 1-10 10h-25a10 10 0 0 1-10-10V39a10 10 0 0 1 10-10 M77.5 48.5a6 6 0 0 1 2 11.657V71.5a4 4 0 0 1-4 4H34a4 4 0 0 1-4-4V60.157A6.001 6.001 0 0 1 32 48.5a6 6 0 0 1 5.419 3.424A4 4 0 0 1 38 54v7h33.5v-6.5q0-.107.005-.213A6 6 0 0 1 77.5 48.5 M42.75 57h24.5A4.75 4.75 0 0 1 72 61.75a4.75 4.75 0 0 1-4.75 4.75h-24.5A4.75 4.75 0 0 1 38 61.75 4.75 4.75 0 0 1 42.75 57M36.5 75.5h8l-1.674 5.441A1.5 1.5 0 0 1 41.392 82H38a1.5 1.5 0 0 1-1.5-1.5zm36 0h-8l1.674 5.441A1.5 1.5 0 0 0 67.608 82H71a1.5 1.5 0 0 0 1.5-1.5z",viewW:110,viewH:110}},{id:"bathtub",group:"sanitary",art:{d:"M28 75h8l-1.674 5.441a1.5 1.5 0 0 1-1.434 1.059H29.5A1.5 1.5 0 0 1 28 80zm53 0h-8l1.674 5.441a1.5 1.5 0 0 0 1.434 1.059H79.5A1.5 1.5 0 0 0 81 80zM19.5 46.5H90a2.5 2.5 0 0 1 2.5 2.5 2.5 2.5 0 0 1-2.5 2.5H19.5A2.5 2.5 0 0 1 17 49a2.5 2.5 0 0 1 2.5-2.5 M19.5 51.5H90L86.633 68a10 10 0 0 1-9.798 8h-44.17a10 10 0 0 1-9.798-8zM30 36v-2a5 5 0 1 0-10 0v12.5",viewW:110,viewH:110}},{id:"bed",group:"furniture",art:{d:"M16 75.5h8l-1.674 5.441A1.5 1.5 0 0 1 20.892 82H17.5a1.5 1.5 0 0 1-1.5-1.5zm78.5 0h-8l1.674 5.441A1.5 1.5 0 0 0 89.608 82H93a1.5 1.5 0 0 0 1.5-1.5zM25 29h60.5a2.5 2.5 0 0 1 2.5 2.5V68a2.5 2.5 0 0 1-2.5 2.5H25a2.5 2.5 0 0 1-2.5-2.5V31.5A2.5 2.5 0 0 1 25 29 M16 59.5c0-5.523 4.477-10 10-10h58.5c5.523 0 10 4.477 10 10v6H16zm-1 6h80.5a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1m15.5-20a5 5 0 0 1 5-5h11a5 5 0 0 1 5 5v4h-21zm28.5 0a5 5 0 0 1 5-5h11a5 5 0 0 1 5 5v4H59z",viewW:110,viewH:110}},{id:"bidet",group:"sanitary",art:{d:"M36 57.5c0 5.523 4.477 10 10 10h18.5c5.523 0 10-4.477 10-10V53H36zm8.5 22a1 1 0 0 0 1 1H65a1 1 0 0 0 1-1v-12H44.5zm-8.5-32a1 1 0 0 1 1-1h36.5a1 1 0 0 1 1 1V53H36zM50.5 41a1 1 0 0 1 1-1H59a1 1 0 0 1 1 1v5.5h-9.5zM53 30a1 1 0 0 1 1-1h2.5a1 1 0 0 1 1 1v10H53zm-4 6a1 1 0 0 1-1-1v-2.5a1 1 0 0 1 1-1h4V36z",viewW:110,viewH:110}},{id:"boiler",group:"appliance",art:{d:"M46.5 81.5h5V86a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1zm12.5 0h5V86a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1zM44 23h22.5a8 8 0 0 1 8 8v42.5a8 8 0 0 1-8 8H44a8 8 0 0 1-8-8V31a8 8 0 0 1 8-8 M36 31a8 8 0 0 1 8-8h22.5a8 8 0 0 1 8 8v42H36z M48.5 42.5a7 7 0 1 0 14 0 7 7 0 1 0-14 0m6.5 0 3.5-3.5",viewW:110,viewH:110}},{id:"chair",group:"furniture",art:{d:"M40.5 39.5C40.5 32.596 46.096 27 53 27h4c6.904 0 12.5 5.596 12.5 12.5v13a5 5 0 0 1-5 5h-19a5 5 0 0 1-5-5z M41.25 54h27.5A3.25 3.25 0 0 1 72 57.25a3.25 3.25 0 0 1-3.25 3.25h-27.5A3.25 3.25 0 0 1 38 57.25 3.25 3.25 0 0 1 41.25 54m28.25 6.5H64l1.88 21.63a1.5 1.5 0 0 0 1.495 1.37H68a1.5 1.5 0 0 0 1.5-1.5zm-29 0H46l-1.88 21.63a1.5 1.5 0 0 1-1.495 1.37H42a1.5 1.5 0 0 1-1.5-1.5z",viewW:110,viewH:110}},{id:"coffee_table",group:"furniture",art:{d:"M25 51h5.238l-1.534 15.646A1.5 1.5 0 0 1 27.211 68H26.5a1.5 1.5 0 0 1-1.5-1.5zm60.238 0H80l1.534 15.646A1.5 1.5 0 0 0 83.027 68h.711a1.5 1.5 0 0 0 1.5-1.5z M24.34 43.485A2.5 2.5 0 0 1 26.625 42h56.75a2.5 2.5 0 0 1 2.285 1.485l2.715 6.109A1 1 0 0 1 87.461 51H22.54a1 1 0 0 1-.914-1.406z M87.5 51h-66v3a1 1 0 0 0 1 1h64a1 1 0 0 0 1-1z",viewW:110,viewH:110}},{id:"computer",group:"appliance",art:{d:"M24.5 38h40a2.5 2.5 0 0 1 2.5 2.5v22a2.5 2.5 0 0 1-2.5 2.5h-40a2.5 2.5 0 0 1-2.5-2.5v-22a2.5 2.5 0 0 1 2.5-2.5m50 0h11a2.5 2.5 0 0 1 2.5 2.5v29a2.5 2.5 0 0 1-2.5 2.5h-11a2.5 2.5 0 0 1-2.5-2.5v-29a2.5 2.5 0 0 1 2.5-2.5M43 65h5v7h-5zm-6 7h16m23-12h8m-8-17h8 M35 56V46h5m-5 7h5 M39.5 53a3.5 3.5 0 1 0 0-7m15.036 8.536a5 5 0 1 1 0-7.071",viewW:110,viewH:110}},{id:"cooktop",group:"appliance",art:{d:"M27.5 29h55a2.5 2.5 0 0 1 2.5 2.5v47a2.5 2.5 0 0 1-2.5 2.5h-55a2.5 2.5 0 0 1-2.5-2.5v-47a2.5 2.5 0 0 1 2.5-2.5 M33.5 66.5a8 8 0 1 0 16 0 8 8 0 1 0-16 0m26.5-23a8 8 0 1 0 16 0 8 8 0 1 0-16 0m3 23a5 5 0 1 0 10 0 5 5 0 1 0-10 0m-29.5-23a8 8 0 1 0 16 0 8 8 0 1 0-16 0",viewW:110,viewH:110}},{id:"dining_table",group:"furniture",art:{d:"M83.5 43H78l6.742 30.82A1.5 1.5 0 0 0 86.207 75h.54a1.5 1.5 0 0 0 1.482-1.732zm-56 0H33l-6.742 30.82A1.5 1.5 0 0 1 24.793 75h-.54a1.5 1.5 0 0 1-1.482-1.732zm-2.62-7.406A2.5 2.5 0 0 1 27.21 34h56.58a2.5 2.5 0 0 1 2.33 1.594l2.35 6.044A1 1 0 0 1 87.538 43H23.462a1 1 0 0 1-.932-1.362z M88.5 43h-66v3a1 1 0 0 0 1 1h64a1 1 0 0 0 1-1z",viewW:110,viewH:110}},{id:"dishwasher",group:"appliance",art:{d:"M31.5 25h47a2.5 2.5 0 0 1 2.5 2.5v55a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5v-55a2.5 2.5 0 0 1 2.5-2.5 M31.5 37.5h47A2.5 2.5 0 0 1 81 40v36a2.5 2.5 0 0 1-2.5 2.5h-47A2.5 2.5 0 0 1 29 76V40a2.5 2.5 0 0 1 2.5-2.5M43 42h24m-1.5-11a2 2 0 1 0 4 0 2 2 0 1 0-4 0m7.5 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-37.25 0h9.5",viewW:110,viewH:110}},{id:"dryer",group:"appliance",art:{d:"M31.5 25h47a2.5 2.5 0 0 1 2.5 2.5v55a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5v-55a2.5 2.5 0 0 1 2.5-2.5 M31.5 37.5h47A2.5 2.5 0 0 1 81 40v42.5a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5V40a2.5 2.5 0 0 1 2.5-2.5 M38 60.5a17 17 0 1 0 34 0 17 17 0 1 0-34 0 M43.5 60.5a11.5 11.5 0 1 0 23 0 11.5 11.5 0 1 0-23 0m22-29.5a2 2 0 1 0 4 0 2 2 0 1 0-4 0m7.5 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-37.25 0h9.5 M55.994 55.5s-1.329 1.81-1.479 3.143c-.198 1.761 1.599 2.554 1.48 4.321-.1 1.479-1.48 3.536-1.48 3.536m5.979-11s-1.329 1.81-1.479 3.143c-.198 1.761 1.599 2.554 1.48 4.321-.1 1.479-1.48 3.536-1.48 3.536m-8.519-11s-.886 1.81-.986 3.143c-.132 1.761 1.066 2.554.986 4.321-.067 1.479-.986 3.536-.986 3.536",viewW:110,viewH:110}},{id:"exercise",group:"other",art:{d:"m60.752 62.03-5.379-2.312 11.066-25.75a1.5 1.5 0 0 1 1.97-.786l2.624 1.127a1.5 1.5 0 0 1 .786 1.97zm-18.648-4.512-4.353 1.189-4.474-16.382a1.5 1.5 0 0 1 1.052-1.842l1.459-.398a1.5 1.5 0 0 1 1.842 1.052z M41.297 38.173a2.215 2.215 0 0 1 0 4.43H29.781a2.215 2.215 0 0 1 0-4.43zm33.219 38.091a2.657 2.657 0 1 1 0 5.315H28.453a2.657 2.657 0 1 1 0-5.315zm8.641-51.366a1.795 1.795 0 0 1 .68 2.41l-3.03 5.59a5 5 0 0 1-4.396 2.618H65.657a1.772 1.772 0 1 1 0-3.544h9.61a3 3 0 0 0 2.598-1.5l2.84-4.917a1.795 1.795 0 0 1 2.452-.657M29.339 65.787c0-6.699 6.457-11.503 12.873-9.579l24.291 7.288a10 10 0 0 1 7.127 9.578v3.19H29.339zm0 15.852h7.086l-1.394 3.486a1.5 1.5 0 0 1-1.393.943h-2.8a1.5 1.5 0 0 1-1.5-1.5zm44.291 0h-7.087l1.395 3.486a1.5 1.5 0 0 0 1.392.943h2.8a1.5 1.5 0 0 0 1.5-1.5z M35.54 66.077a4.872 4.872 0 1 0 9.743 0 4.872 4.872 0 1 0-9.744 0",viewW:110,viewH:110}},{id:"fireplace",group:"other",art:{d:"M26.672 34.425h55.99v39.47h-55.99Z M23 74.894a1 1 0 0 1 1-1h61.334a1 1 0 0 1 1 1v5.802a1 1 0 0 1-1 1H24a1 1 0 0 1-1-1zM23 29a1 1 0 0 1 1-1h61.334a1 1 0 0 1 1 1v4.425a1 1 0 0 1-1 1H24a1 1 0 0 1-1-1zm15.145 21.44a5 5 0 0 1 5-5h23.043a5 5 0 0 1 5 5v23.454H38.145z M44.57 65.633a2.754 2.754 0 0 1 2.754-2.753H62.01v5.507H47.324a2.754 2.754 0 0 1-2.754-2.754m20.194 5.507a2.754 2.754 0 0 0-2.754-2.753H47.324v5.507H62.01a2.754 2.754 0 0 0 2.754-2.754 M44.57 71.14a2.754 2.754 0 1 0 5.508 0 2.754 2.754 0 1 0-5.508 0m14.688-5.507a2.754 2.754 0 1 0 5.507 0 2.754 2.754 0 1 0-5.507 0",viewW:110,viewH:110}},{id:"fridge",group:"appliance",art:{d:"M35.5 18H75a2.5 2.5 0 0 1 2.5 2.5v64A2.5 2.5 0 0 1 75 87H35.5a2.5 2.5 0 0 1-2.5-2.5v-64a2.5 2.5 0 0 1 2.5-2.5 M33 46.5h44.5v38A2.5 2.5 0 0 1 75 87H35.5a2.5 2.5 0 0 1-2.5-2.5zm2.5 44a1 1 0 0 0 1 1h37a1 1 0 0 0 1-1V87h-39zm3-49.5v-9.5m0 30.5v-9.5",viewW:110,viewH:110}},{id:"hood",group:"appliance",art:{d:"M44.308 57h21.384L83 69H27zM44 37.5a2.5 2.5 0 0 1 2.5-2.5h17a2.5 2.5 0 0 1 2.5 2.5V57H44zM80.5 74h-51a2.5 2.5 0 0 1-2.5-2.5V70a1 1 0 0 1 1-1h54a1 1 0 0 1 1 1v1.5a2.5 2.5 0 0 1-2.5 2.5",viewW:110,viewH:110}},{id:"kitchen_cabinet",group:"furniture",art:{d:"M38 88a1 1 0 0 0 1 1h32a1 1 0 0 0 1-1v-3H38zm17-68h16.5a2.5 2.5 0 0 1 2.5 2.5v17a2.5 2.5 0 0 1-2.5 2.5H55zm-19 2.5a2.5 2.5 0 0 1 2.5-2.5H55v22H38.5a2.5 2.5 0 0 1-2.5-2.5zM59 33v5m-8-5v5m4 47h16.5a2.5 2.5 0 0 0 2.5-2.5v-17a2.5 2.5 0 0 0-2.5-2.5H55zm-19-2.5a2.5 2.5 0 0 0 2.5 2.5H55V63H38.5a2.5 2.5 0 0 0-2.5 2.5zM67 67h-5m-14 0h-5",viewW:110,viewH:110}},{id:"kitchen_sink",group:"sanitary",art:{d:"M21.5 84h68a2.5 2.5 0 0 0 2.5-2.5v-35a2.5 2.5 0 0 0-2.5-2.5h-68a2.5 2.5 0 0 0-2.5 2.5v35a2.5 2.5 0 0 0 2.5 2.5 M26 78h26.5a1 1 0 0 0 1-1V51a1 1 0 0 0-1-1H26a1 1 0 0 0-1 1v26a1 1 0 0 0 1 1m23-24v5m9.5 19H85a1 1 0 0 0 1-1V51a1 1 0 0 0-1-1H58.5a1 1 0 0 0-1 1v26a1 1 0 0 0 1 1m-6-39.5a1 1 0 0 0-1-1H44a1 1 0 0 0-1 1V44h9.5zM58 33v-2a5 5 0 1 0-10 0v6.5M62 54v5",viewW:110,viewH:110}},{id:"nightstand",group:"furniture",art:{d:"M76.5 73.5h-8l1.674 5.441A1.5 1.5 0 0 0 71.608 80H75a1.5 1.5 0 0 0 1.5-1.5zm-42.5 0h8l-1.674 5.441A1.5 1.5 0 0 1 38.892 80H35.5a1.5 1.5 0 0 1-1.5-1.5z M34.5 30.5h41A2.5 2.5 0 0 1 78 33v40.5a2.5 2.5 0 0 1-2.5 2.5h-41a2.5 2.5 0 0 1-2.5-2.5V33a2.5 2.5 0 0 1 2.5-2.5 M32 39.5h46v18H32Zm18.5 9H60M50.5 66H60",viewW:110,viewH:110}},{id:"oven",group:"appliance",art:{d:"M31.5 25h47a2.5 2.5 0 0 1 2.5 2.5v55a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5v-55a2.5 2.5 0 0 1 2.5-2.5 M31.5 37.5h47A2.5 2.5 0 0 1 81 40v36a2.5 2.5 0 0 1-2.5 2.5h-47A2.5 2.5 0 0 1 29 76V40a2.5 2.5 0 0 1 2.5-2.5 M40.5 47h29a2.5 2.5 0 0 1 2.5 2.5v20a2.5 2.5 0 0 1-2.5 2.5h-29a2.5 2.5 0 0 1-2.5-2.5v-20a2.5 2.5 0 0 1 2.5-2.5m25-16a2 2 0 1 0 4 0 2 2 0 1 0-4 0m7.5 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-37.25 0h9.5M43 42h24",viewW:110,viewH:110}},{id:"plant",group:"other",art:{d:"M45.952 75.849a2.5 2.5 0 0 0 2.485 2.231H63.43a2.5 2.5 0 0 0 2.485-2.231l1.571-14.532H44.381zM60.236 44.78C58.423 36.174 66.805 29.605 77 31.87c0 8.155-8.609 16.763-16.763 12.912m-9.761 5.147c1.517-8.665-7.085-14.943-17.195-12.33.28 8.15 9.178 16.458 17.195 12.33 M55.706 55.88v-2.944m0 0c1.133-5.89 7.09-10.956 12.912-15.404M55.706 52.936c-4.938-4.146-7.982-6.16-14.044-9.061m1.453 12.005h25.636a1 1 0 0 1 1 1v3.437a1 1 0 0 1-1 1H43.115a1 1 0 0 1-1-1v-3.436a1 1 0 0 1 1-1",viewW:110,viewH:110}},{id:"rug",group:"other",art:{d:"M90.27 33.874h-5.622m-59.028 0H20m70.27 5.152h-5.622m-59.028 0H20m70.27 5.154h-5.622m-59.028 0H20m70.27 5.152h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20M28.12 32h54.025a2.5 2.5 0 0 1 2.5 2.5v40.439a2.5 2.5 0 0 1-2.5 2.5H28.12a2.5 2.5 0 0 1-2.5-2.5V34.5a2.5 2.5 0 0 1 2.5-2.5 M25.62 34.5a2.5 2.5 0 0 1 2.5-2.5h1.717v45.439H28.12a2.5 2.5 0 0 1-2.5-2.5zm59.026 0a2.5 2.5 0 0 0-2.5-2.5H80.43v45.439h1.716a2.5 2.5 0 0 0 2.5-2.5zM37.8 54.485l17.801-8.432 17.801 8.432-17.8 8.432z",viewW:110,viewH:110}},{id:"shelving",group:"furniture",art:{d:"M28 58.5h53V39H28Z M64 58.5h5V47a1 1 0 0 0-1-1h-3a1 1 0 0 0-1 1zM52.5 39h-5V27.5a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zm-12 0h-5V27.5a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zm-5 29.5V71a1 1 0 0 1 1 1H49a1 1 0 0 1 1-1v-2.5a1 1 0 0 1-1-1H36.5a1 1 0 0 1-1 1m33.5-10h7v-14a1 1 0 0 0-1-1h-5a1 1 0 0 0-1 1zM47.5 39h-7V25a1 1 0 0 1 1-1h5a1 1 0 0 1 1 1zm-12 34v4a1 1 0 0 1 1 1h14a1 1 0 0 1 1-1v-4a1 1 0 0 1-1-1h-14a1 1 0 0 1-1 1M28 78h53v7H28Z M28 89.5V23a2.5 2.5 0 0 1 2.5-2.5h48A2.5 2.5 0 0 1 81 23v66.5",viewW:110,viewH:110}},{id:"shower",group:"sanitary",art:{d:"M31 84h49a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H31a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1m31.5-47.6v-4.686a11.7 11.7 0 0 0-3.441-8.283A11.77 11.77 0 0 0 50.75 20a11.77 11.77 0 0 0-8.309 3.431A11.7 11.7 0 0 0 39 31.714V84 M72 39.25a10.25 10.25 0 1 0-20.5 0zm-17.25 5v2.5m7.25-2.5v2.5m7.25-2.5v2.5m-14.5 3.75V53M62 50.5V53m7.25-2.5V53m-14.5 3.75v2.5m7.25-2.5v2.5m7.25-2.5v2.5M54.75 63v2.5M62 63v2.5m7.25-2.5v2.5",viewW:110,viewH:110}},{id:"sink",group:"sanitary",art:{d:"M30 57c0 5.523 4.477 10 10 10h29.5c5.523 0 10-4.477 10-10v-6.5A2.5 2.5 0 0 0 77 48H32.5a2.5 2.5 0 0 0-2.5 2.5zm14 22a1 1 0 0 0 1 1h19.5a1 1 0 0 0 1-1V67H44zm6-36.5a1 1 0 0 1 1-1h7.5a1 1 0 0 1 1 1V48H50zM45 37v-2a5 5 0 1 1 10 0v6.5",viewW:110,viewH:110}},{id:"sofa",group:"furniture",art:{d:"M59.5 29h24a5 5 0 0 1 5 5v32a5 5 0 0 1-5 5h-24a5 5 0 0 1-5-5V34a5 5 0 0 1 5-5m-34 0h24a5 5 0 0 1 5 5v32a5 5 0 0 1-5 5h-24a5 5 0 0 1-5-5V34a5 5 0 0 1 5-5 M18.5 44a5 5 0 0 1 5 5v12H86V49a5 5 0 0 1 5-5h.5a5 5 0 0 1 5 5v21.5a5 5 0 0 1-5 5H18a5 5 0 0 1-5-5V49a5 5 0 0 1 5-5z M25.25 57h24.5a4.75 4.75 0 0 1 4.75 4.75 4.75 4.75 0 0 1-4.75 4.75h-24.5a4.75 4.75 0 0 1-4.75-4.75A4.75 4.75 0 0 1 25.25 57m34 0h24.5a4.75 4.75 0 0 1 4.75 4.75 4.75 4.75 0 0 1-4.75 4.75h-24.5a4.75 4.75 0 0 1-4.75-4.75A4.75 4.75 0 0 1 59.25 57M18.5 75.5h8l-1.674 5.441A1.5 1.5 0 0 1 23.392 82H20a1.5 1.5 0 0 1-1.5-1.5zm72 0h-8l1.674 5.441A1.5 1.5 0 0 0 85.608 82H89a1.5 1.5 0 0 0 1.5-1.5z",viewW:110,viewH:110}},{id:"stairs",group:"other",art:{d:"M73.47 46.365v-17.62m-10.571 25.55V36.674M52.326 61.783V45.484M42.193 69.273v-15.86M28.979 77.761a1 1 0 0 1 1-1h53.624v6.489a1 1 0 0 1-1 1H29.98a1 1 0 0 1-1-1z M26.777 57.497a1 1 0 0 1 1-1h2.846a1 1 0 0 1 1 1V83.25a1 1 0 0 1-1 1h-2.846a1 1 0 0 1-1-1z m73.113 28.633-41.492 32.93v-4.405l39.9-32.007a.7.7 0 0 1 .428-.151h3.724a1.762 1.762 0 1 1 0 3.524h-2.248a.5.5 0 0 0-.312.109M25.895 53.414a3.084 3.084 0 1 0 6.167 0 3.084 3.084 0 1 0-6.167 0m14.978 16.859a1 1 0 0 1 1-1h41.73v7.488h-42.73zm10.131-7.489a1 1 0 0 1 1-1h31.598v7.488H51.004z M61.576 55.294a1 1 0 0 1 1-1h21.026v7.49H61.576z M72.15 47.806a1 1 0 0 1 1-1h9.454a1 1 0 0 1 1 1v6.489H72.15z",viewW:110,viewH:110}},{id:"toilet",group:"sanitary",art:{d:"M32 26.5a2.5 2.5 0 0 1 2.5-2.5H45a2.5 2.5 0 0 1 2.5 2.5V57H32zM47.5 52h29a2.5 2.5 0 0 1 2.5 2.5V57H47.5zm17.037 20.102C73.95 70.288 79 62.01 79 57H32c.5 7.5 8.072 7 7 11l-2.342 16.862a1 1 0 0 0 .99 1.138H66.72a1 1 0 0 0 .97-1.243z",viewW:110,viewH:110}},{id:"tv",group:"appliance",art:{d:"M23.5 31H86a2.5 2.5 0 0 1 2.5 2.5v34A2.5 2.5 0 0 1 86 70H23.5a2.5 2.5 0 0 1-2.5-2.5v-34a2.5 2.5 0 0 1 2.5-2.5M50 70h9.5v8H50Zm-10 8h30M42.5 45.5h5m5 0h-5m0 0v9.75 m56.75 45.5 5 10 5-10",viewW:110,viewH:110}},{id:"wardrobe",group:"furniture",art:{d:"M28 23a2.5 2.5 0 0 1 2.5-2.5h24V85h-24a2.5 2.5 0 0 1-2.5-2.5zm2 65.5a1 1 0 0 0 1 1h47a1 1 0 0 0 1-1V85H30zM81 23a2.5 2.5 0 0 0-2.5-2.5h-24V85h24a2.5 2.5 0 0 0 2.5-2.5zM50.5 48v9.5m8-9.5v9.5",viewW:110,viewH:110}},{id:"washer",group:"appliance",art:{d:"M31.5 25h47a2.5 2.5 0 0 1 2.5 2.5v55a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5v-55a2.5 2.5 0 0 1 2.5-2.5 M31.5 37.5h47A2.5 2.5 0 0 1 81 40v42.5a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5V40a2.5 2.5 0 0 1 2.5-2.5 M38 60.5a17 17 0 1 0 34 0 17 17 0 1 0-34 0 M43.5 60.5a11.5 11.5 0 1 0 23 0 11.5 11.5 0 1 0-23 0m22-29.5a2 2 0 1 0 4 0 2 2 0 1 0-4 0m7.5 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-37.25 0h9.5",viewW:110,viewH:110}},{id:"work_table",group:"furniture",art:{d:"M88.5 47h-20v14h20zm-12 4h4m7.984-8h-66v4h66zm-66 4h4v26.5a1.5 1.5 0 0 1-1.5 1.5h-1a1.5 1.5 0 0 1-1.5-1.5z M24.866 35.597A2.5 2.5 0 0 1 27.197 34h56.577a2.5 2.5 0 0 1 2.33 1.594l2.35 6.044a1 1 0 0 1-.93 1.362H23.46a1 1 0 0 1-.933-1.361zM88.5 61h-20v12.5A1.5 1.5 0 0 0 70 75h17a1.5 1.5 0 0 0 1.5-1.5zm-12 4h4",viewW:110,viewH:110}}];class Sc{constructor(t,e){this.host=t,this.hooks=e}place(t,e="mouse"){const s=this.host._decorImagePalette,i=this.host._curSpaceCfg;if(!s||!i)return;const o=this.hooks.decorSnap(t,e),a=Lt(s.width,s.height),n=Bt(a.w,this.host._cellCm,this.host._gridPitch)/p,r=Bt(a.h,this.host._cellCm,this.host._gridPitch)/this.host._decorH,l="di"+Date.now().toString(36)+Math.random().toString(36).slice(2,5),h=this.hooks.geometrySnapshot();i.decor=[...this.host._decorList,{id:l,kind:"image",asset_id:s.asset_id,x:J(o[0]/p-n/2),y:J(o[1]/this.host._decorH-r/2),w:n,h:r,opacity:1}],this.host._decorSel=l,this.host._decorTool="select",this.host._decorImagePalette=null,this.hooks.clearFurniturePreview(),this.hooks.recordGeometry(this.host._t("history.decor_add"),h),this.hooks.saveConfig(),this.host.requestUpdate()}renderPlacementPreview(){const t=this.host._furnPreviewInput,e=this.host._decorImagePalette;if(!t||!e||"decor"!==this.host._mode||"image"!==this.host._decorTool||!this.host._pointerModality.hoverEnabled)return l;const s=this.hooks.decorSnap(t.raw,"mouse"),i=Lt(e.width,e.height),o=Bt(i.w,this.host._cellCm,this.host._gridPitch)/p,a=Bt(i.h,this.host._cellCm,this.host._gridPitch)/this.host._decorH,n=this.host._display(e.url);return n?d``:l}renderMissing(t,e,s,i,o,a,n,r,l){const h=i+a/2,c=o+n/2;return d``}afterRender(){const t=this.host.root();this._blocked&&(this._openGroupId?this.closeGroup(!1):"palette"===this._currentModel?.kind&&this._currentModel.dismiss?.()),this._syncGlobalDismissListener();const e=t.querySelector(".editor-secondary"),s=this._renderedContext,i=e?.dataset.contextId||"";if(i&&s&&i!==s&&!window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches&&(this._contentAnimation?.cancel(),this._contentAnimation=e?.querySelector(".editor-secondary-content")?.animate([{opacity:.35,transform:"translateY(-4px)"},{opacity:1,transform:"translateY(0)"}],{duration:100,easing:"ease-out"})),this._renderedContext=i,s&&i!==s&&this._focusOwned){const s=i?e?.querySelector('[tabindex="0"], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'):t.querySelector(".editbar-tools");s?.focus?.(),this._focusOwned=!!i}if("palette"===this._currentModel?.kind&&this._currentModel.launcherId){const e=[...t.querySelectorAll("[data-editor-palette]")].find(t=>t.dataset.editorPalette===this._currentModel?.launcherId);e&&null!==e.offsetParent||this._currentModel.dismiss?.()}if(!this._openGroupId)return;const o=[...t.querySelectorAll("[data-editor-group]")].find(t=>t.dataset.editorGroup===this._openGroupId);o&&null!==o.offsetParent||this.closeGroup(!0)}handleOutsideDismiss(t){if(_c(t,t=>t.hasAttribute("data-editor-navigation")))return"pointerdown"===t.type?this.closeForNavigation():"click"===t.type&&this._dismissPointerTarget&&this._clearDismissClick(),!1;if("click"===t.type&&this._dismissPointerTarget){return!!(t.composedPath?.()||[t.target]).includes(this._dismissPointerTarget)&&(this._clearDismissClick(),t.preventDefault(),t.stopImmediatePropagation(),!0)}const e=this._openGroupId||this._blocked||"palette"!==this._currentModel?.kind?null:this._currentModel;if("pointerdown"===t.type&&(this._openGroupId||e)){const s=_c(t,t=>t.classList.contains("editor-secondary")),i=_c(t,t=>!!t.dataset.editorGroup),o=_c(t,t=>!!t.dataset.editorPalette),a=_c(t,t=>t.classList.contains("stage"));if(!(s||i||o||"stay-open-on-canvas"===e?.dismissPolicy&&a))return t.preventDefault(),t.stopImmediatePropagation(),this._dismissPointerTarget=t.target,clearTimeout(this._dismissTimer),this._dismissTimer=window.setTimeout(()=>{this._clearDismissClick()},800),this._openGroupId?this.closeGroup(!1):e?.dismiss?.(),this._syncGlobalDismissListener(),!0}return!1}_activateGroupItem(t,e,s){if(t.id!==this._openGroupId)return;const i=t.items.find(t=>t.id===e);if(!i||i.disabled)return;const o="toggle"===i.role&&"stay-open"===i.closePolicy,a=0===s.detail;o||(this._openGroupId=null,this.host.requestUpdate(),this._syncGlobalDismissListener()),i.invoke(),!o&&a&&this.host.updateComplete().then(()=>{const e=[...this.host.root().querySelectorAll("[data-editor-group]")].find(e=>e.dataset.editorGroup===t.id&&null!==e.offsetParent);e?.focus()})}_groupKeydown(t){if(!["ArrowLeft","ArrowRight","Home","End"].includes(t.key))return;const e=[...t.currentTarget.querySelectorAll(".editor-group-item:not([disabled])")];if(!e.length)return;t.preventDefault();const s=e.indexOf(this.host.root().activeElement),i="Home"===t.key?0:"End"===t.key?e.length-1:"ArrowLeft"===t.key?s<=0?e.length-1:s-1:(s+1)%e.length;e[i]?.focus()}_clearDismissClick(){this._dismissPointerTarget=null,clearTimeout(this._dismissTimer),this._dismissTimer=void 0,this._syncGlobalDismissListener()}_syncGlobalDismissListener(){const t=!this._blocked&&"palette"===this._currentModel?.kind,e=!!this._openGroupId||t||!!this._dismissPointerTarget;e!==this._globalDismissListening&&(this._globalDismissListening=e,e?(window.addEventListener("pointerdown",this._globalDismissGuard,!0),window.addEventListener("click",this._globalDismissGuard,!0)):(window.removeEventListener("pointerdown",this._globalDismissGuard,!0),window.removeEventListener("click",this._globalDismissGuard,!0)))}}const gc=t=>t.stopPropagation(),fc=new WeakSet,bc=t=>{t._regSignature="",t._maybeRebuildDevices(),t.requestUpdate()};async function vc(t,e,s,i,o,a=""){const n=t.host,r=n._serverCfg;if(!r)return!1;let l=JSON.parse(JSON.stringify(r));l.markers=l.markers||[];let h=l.markers.find(t=>t.id===e);if(!h){const t=n._devices.find(t=>t.id===e);if(!t||"device"!==t.bindingKind&&"entity"!==t.bindingKind||!t.bindingRef)return!1;h={id:t.id,binding:`${t.bindingKind}:${t.bindingRef}`,space:t.space||null,area:t.area||null,hidden:!!t.hidden},l.markers.push(h)}h.vacuum=function(t,e){const s=e.matrix.map(t=>Number(t.toFixed(6))),i=t?.map_routes;if(Array.isArray(i)&&i.length){const o=i.find(t=>t.id===e.routeId)||i.find(t=>t.source===e.source&&t.map_id===e.mapId);if(o)return{...t,map_routes:Eo(i,o.id,s)}}return{...t,source:e.source,calibration:{...t?.calibration||{},[e.mapId]:s}}}(h.vacuum||{},{source:s,mapId:i,routeId:a,matrix:o}),l=t._prepareConfigCandidate(l);const c=n._adoption.beginOptimistic(r,l);n._adoption.stageLocalConfig(l),bc(n),n._saveConfigDebounced.pending()&&n._saveConfigDebounced.cancel();try{return await t._saveConfigNow(c),!0}catch(t){return n._rollbackOptimistic(c),bc(n),n._showToast(n._t("toast.cfg_save_failed",{err:n._errText(t)})),!1}}function yc(t){return 1===t}function $c(t){return`${t}-${globalThis.crypto?.randomUUID?.()??`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function wc(t){const e=function(t){return JSON.stringify({message:t.message.trim(),contact:t.contact.trim(),previewToken:t.attach&&t.preview?t.preview.token:""})}(t);return{idempotencyKey:t.submissionFingerprint&&t.submissionFingerprint!==e?$c("report"):t.idempotencyKey,fingerprint:e}}function kc(t){return[...t].length}function xc(t,e=Date.now()){const s=t.message.trim();return s?kc(s)>1e4?"message_too_long":kc(t.contact.trim())>320?"contact_too_long":t.attach&&!t.preview?"preview_missing":t.attach&&t.preview.expiresAt<=e?"preview_expired":null:"message_required"}function Sc(t,e=Date.now()){return"building"!==t.status&&"sending"!==t.status&&"success"!==t.status&&null===xc(t,e)}function Mc(t){const e=function(t){const e=/Firefox\/(\d+)/i.exec(t);if(e)return{family:"firefox",major:Number(e[1])||0};const s=/(?:Chrome|Chromium|Edg)\/(\d+)/i.exec(t);if(s)return{family:"chromium",major:Number(s[1])||0};const i=/Version\/(\d+).+Safari\//i.exec(t);return i?{family:"webkit",major:Number(i[1])||0}:{family:"unknown",major:0}}(t.userAgent??globalThis.navigator?.userAgent??""),s=t.now??Date.now(),i=Number(t.registryLastSuccess||0),o=i<=0?"unknown":s-i<=6e5?"fresh":"stale",a=["en","ru","de","fr"].includes(t.language)?t.language:"en",n=globalThis.matchMedia?.bind(globalThis);return{browser_family:e.family,browser_major:Math.max(0,Math.min(999,e.major)),language:a,coarse_pointer:t.coarsePointer??!!n?.("(pointer: coarse)").matches,hover_capable:t.hoverCapable??!!n?.("(hover: hover)").matches,registry_access:"full"===t.registryAccess?"full":"limited"===t.registryAccess?"partial":"unavailable",registry_age_bucket:o}}function Cc(t){const e=t&&"object"==typeof t&&"code"in t?String(t.code||""):"";return new Set(["support_invalid_message","support_preview_expired","support_package_too_large","support_rate_limited","support_unavailable","support_rejected","unauthorized"]).has(e)?e:"support_unavailable"}const Pc=[{id:"air_conditioner",group:"appliance",art:{d:"M20.5 39h69a2.5 2.5 0 0 1 2.5 2.5V69a2.5 2.5 0 0 1-2.5 2.5h-69A2.5 2.5 0 0 1 18 69V41.5a2.5 2.5 0 0 1 2.5-2.5 M25 63a2.5 2.5 0 0 1 2.5-2.5h55A2.5 2.5 0 0 1 85 63v8.5H25z M25 63a2.5 2.5 0 0 1 2.5-2.5h55A2.5 2.5 0 0 1 85 63v3.5H25z",viewW:110,viewH:110}},{id:"armchair",group:"furniture",art:{d:"M42.5 29h25a10 10 0 0 1 10 10v26.5a10 10 0 0 1-10 10h-25a10 10 0 0 1-10-10V39a10 10 0 0 1 10-10 M77.5 48.5a6 6 0 0 1 2 11.657V71.5a4 4 0 0 1-4 4H34a4 4 0 0 1-4-4V60.157A6.001 6.001 0 0 1 32 48.5a6 6 0 0 1 5.419 3.424A4 4 0 0 1 38 54v7h33.5v-6.5q0-.107.005-.213A6 6 0 0 1 77.5 48.5 M42.75 57h24.5A4.75 4.75 0 0 1 72 61.75a4.75 4.75 0 0 1-4.75 4.75h-24.5A4.75 4.75 0 0 1 38 61.75 4.75 4.75 0 0 1 42.75 57M36.5 75.5h8l-1.674 5.441A1.5 1.5 0 0 1 41.392 82H38a1.5 1.5 0 0 1-1.5-1.5zm36 0h-8l1.674 5.441A1.5 1.5 0 0 0 67.608 82H71a1.5 1.5 0 0 0 1.5-1.5z",viewW:110,viewH:110}},{id:"bathtub",group:"sanitary",art:{d:"M28 75h8l-1.674 5.441a1.5 1.5 0 0 1-1.434 1.059H29.5A1.5 1.5 0 0 1 28 80zm53 0h-8l1.674 5.441a1.5 1.5 0 0 0 1.434 1.059H79.5A1.5 1.5 0 0 0 81 80zM19.5 46.5H90a2.5 2.5 0 0 1 2.5 2.5 2.5 2.5 0 0 1-2.5 2.5H19.5A2.5 2.5 0 0 1 17 49a2.5 2.5 0 0 1 2.5-2.5 M19.5 51.5H90L86.633 68a10 10 0 0 1-9.798 8h-44.17a10 10 0 0 1-9.798-8zM30 36v-2a5 5 0 1 0-10 0v12.5",viewW:110,viewH:110}},{id:"bed",group:"furniture",art:{d:"M16 75.5h8l-1.674 5.441A1.5 1.5 0 0 1 20.892 82H17.5a1.5 1.5 0 0 1-1.5-1.5zm78.5 0h-8l1.674 5.441A1.5 1.5 0 0 0 89.608 82H93a1.5 1.5 0 0 0 1.5-1.5zM25 29h60.5a2.5 2.5 0 0 1 2.5 2.5V68a2.5 2.5 0 0 1-2.5 2.5H25a2.5 2.5 0 0 1-2.5-2.5V31.5A2.5 2.5 0 0 1 25 29 M16 59.5c0-5.523 4.477-10 10-10h58.5c5.523 0 10 4.477 10 10v6H16zm-1 6h80.5a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1m15.5-20a5 5 0 0 1 5-5h11a5 5 0 0 1 5 5v4h-21zm28.5 0a5 5 0 0 1 5-5h11a5 5 0 0 1 5 5v4H59z",viewW:110,viewH:110}},{id:"bidet",group:"sanitary",art:{d:"M36 57.5c0 5.523 4.477 10 10 10h18.5c5.523 0 10-4.477 10-10V53H36zm8.5 22a1 1 0 0 0 1 1H65a1 1 0 0 0 1-1v-12H44.5zm-8.5-32a1 1 0 0 1 1-1h36.5a1 1 0 0 1 1 1V53H36zM50.5 41a1 1 0 0 1 1-1H59a1 1 0 0 1 1 1v5.5h-9.5zM53 30a1 1 0 0 1 1-1h2.5a1 1 0 0 1 1 1v10H53zm-4 6a1 1 0 0 1-1-1v-2.5a1 1 0 0 1 1-1h4V36z",viewW:110,viewH:110}},{id:"boiler",group:"appliance",art:{d:"M46.5 81.5h5V86a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1zm12.5 0h5V86a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1zM44 23h22.5a8 8 0 0 1 8 8v42.5a8 8 0 0 1-8 8H44a8 8 0 0 1-8-8V31a8 8 0 0 1 8-8 M36 31a8 8 0 0 1 8-8h22.5a8 8 0 0 1 8 8v42H36z M48.5 42.5a7 7 0 1 0 14 0 7 7 0 1 0-14 0m6.5 0 3.5-3.5",viewW:110,viewH:110}},{id:"chair",group:"furniture",art:{d:"M40.5 39.5C40.5 32.596 46.096 27 53 27h4c6.904 0 12.5 5.596 12.5 12.5v13a5 5 0 0 1-5 5h-19a5 5 0 0 1-5-5z M41.25 54h27.5A3.25 3.25 0 0 1 72 57.25a3.25 3.25 0 0 1-3.25 3.25h-27.5A3.25 3.25 0 0 1 38 57.25 3.25 3.25 0 0 1 41.25 54m28.25 6.5H64l1.88 21.63a1.5 1.5 0 0 0 1.495 1.37H68a1.5 1.5 0 0 0 1.5-1.5zm-29 0H46l-1.88 21.63a1.5 1.5 0 0 1-1.495 1.37H42a1.5 1.5 0 0 1-1.5-1.5z",viewW:110,viewH:110}},{id:"coffee_table",group:"furniture",art:{d:"M25 51h5.238l-1.534 15.646A1.5 1.5 0 0 1 27.211 68H26.5a1.5 1.5 0 0 1-1.5-1.5zm60.238 0H80l1.534 15.646A1.5 1.5 0 0 0 83.027 68h.711a1.5 1.5 0 0 0 1.5-1.5z M24.34 43.485A2.5 2.5 0 0 1 26.625 42h56.75a2.5 2.5 0 0 1 2.285 1.485l2.715 6.109A1 1 0 0 1 87.461 51H22.54a1 1 0 0 1-.914-1.406z M87.5 51h-66v3a1 1 0 0 0 1 1h64a1 1 0 0 0 1-1z",viewW:110,viewH:110}},{id:"computer",group:"appliance",art:{d:"M24.5 38h40a2.5 2.5 0 0 1 2.5 2.5v22a2.5 2.5 0 0 1-2.5 2.5h-40a2.5 2.5 0 0 1-2.5-2.5v-22a2.5 2.5 0 0 1 2.5-2.5m50 0h11a2.5 2.5 0 0 1 2.5 2.5v29a2.5 2.5 0 0 1-2.5 2.5h-11a2.5 2.5 0 0 1-2.5-2.5v-29a2.5 2.5 0 0 1 2.5-2.5M43 65h5v7h-5zm-6 7h16m23-12h8m-8-17h8 M35 56V46h5m-5 7h5 M39.5 53a3.5 3.5 0 1 0 0-7m15.036 8.536a5 5 0 1 1 0-7.071",viewW:110,viewH:110}},{id:"cooktop",group:"appliance",art:{d:"M27.5 29h55a2.5 2.5 0 0 1 2.5 2.5v47a2.5 2.5 0 0 1-2.5 2.5h-55a2.5 2.5 0 0 1-2.5-2.5v-47a2.5 2.5 0 0 1 2.5-2.5 M33.5 66.5a8 8 0 1 0 16 0 8 8 0 1 0-16 0m26.5-23a8 8 0 1 0 16 0 8 8 0 1 0-16 0m3 23a5 5 0 1 0 10 0 5 5 0 1 0-10 0m-29.5-23a8 8 0 1 0 16 0 8 8 0 1 0-16 0",viewW:110,viewH:110}},{id:"dining_table",group:"furniture",art:{d:"M83.5 43H78l6.742 30.82A1.5 1.5 0 0 0 86.207 75h.54a1.5 1.5 0 0 0 1.482-1.732zm-56 0H33l-6.742 30.82A1.5 1.5 0 0 1 24.793 75h-.54a1.5 1.5 0 0 1-1.482-1.732zm-2.62-7.406A2.5 2.5 0 0 1 27.21 34h56.58a2.5 2.5 0 0 1 2.33 1.594l2.35 6.044A1 1 0 0 1 87.538 43H23.462a1 1 0 0 1-.932-1.362z M88.5 43h-66v3a1 1 0 0 0 1 1h64a1 1 0 0 0 1-1z",viewW:110,viewH:110}},{id:"dishwasher",group:"appliance",art:{d:"M31.5 25h47a2.5 2.5 0 0 1 2.5 2.5v55a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5v-55a2.5 2.5 0 0 1 2.5-2.5 M31.5 37.5h47A2.5 2.5 0 0 1 81 40v36a2.5 2.5 0 0 1-2.5 2.5h-47A2.5 2.5 0 0 1 29 76V40a2.5 2.5 0 0 1 2.5-2.5M43 42h24m-1.5-11a2 2 0 1 0 4 0 2 2 0 1 0-4 0m7.5 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-37.25 0h9.5",viewW:110,viewH:110}},{id:"dryer",group:"appliance",art:{d:"M31.5 25h47a2.5 2.5 0 0 1 2.5 2.5v55a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5v-55a2.5 2.5 0 0 1 2.5-2.5 M31.5 37.5h47A2.5 2.5 0 0 1 81 40v42.5a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5V40a2.5 2.5 0 0 1 2.5-2.5 M38 60.5a17 17 0 1 0 34 0 17 17 0 1 0-34 0 M43.5 60.5a11.5 11.5 0 1 0 23 0 11.5 11.5 0 1 0-23 0m22-29.5a2 2 0 1 0 4 0 2 2 0 1 0-4 0m7.5 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-37.25 0h9.5 M55.994 55.5s-1.329 1.81-1.479 3.143c-.198 1.761 1.599 2.554 1.48 4.321-.1 1.479-1.48 3.536-1.48 3.536m5.979-11s-1.329 1.81-1.479 3.143c-.198 1.761 1.599 2.554 1.48 4.321-.1 1.479-1.48 3.536-1.48 3.536m-8.519-11s-.886 1.81-.986 3.143c-.132 1.761 1.066 2.554.986 4.321-.067 1.479-.986 3.536-.986 3.536",viewW:110,viewH:110}},{id:"exercise",group:"other",art:{d:"m60.752 62.03-5.379-2.312 11.066-25.75a1.5 1.5 0 0 1 1.97-.786l2.624 1.127a1.5 1.5 0 0 1 .786 1.97zm-18.648-4.512-4.353 1.189-4.474-16.382a1.5 1.5 0 0 1 1.052-1.842l1.459-.398a1.5 1.5 0 0 1 1.842 1.052z M41.297 38.173a2.215 2.215 0 0 1 0 4.43H29.781a2.215 2.215 0 0 1 0-4.43zm33.219 38.091a2.657 2.657 0 1 1 0 5.315H28.453a2.657 2.657 0 1 1 0-5.315zm8.641-51.366a1.795 1.795 0 0 1 .68 2.41l-3.03 5.59a5 5 0 0 1-4.396 2.618H65.657a1.772 1.772 0 1 1 0-3.544h9.61a3 3 0 0 0 2.598-1.5l2.84-4.917a1.795 1.795 0 0 1 2.452-.657M29.339 65.787c0-6.699 6.457-11.503 12.873-9.579l24.291 7.288a10 10 0 0 1 7.127 9.578v3.19H29.339zm0 15.852h7.086l-1.394 3.486a1.5 1.5 0 0 1-1.393.943h-2.8a1.5 1.5 0 0 1-1.5-1.5zm44.291 0h-7.087l1.395 3.486a1.5 1.5 0 0 0 1.392.943h2.8a1.5 1.5 0 0 0 1.5-1.5z M35.54 66.077a4.872 4.872 0 1 0 9.743 0 4.872 4.872 0 1 0-9.744 0",viewW:110,viewH:110}},{id:"fireplace",group:"other",art:{d:"M26.672 34.425h55.99v39.47h-55.99Z M23 74.894a1 1 0 0 1 1-1h61.334a1 1 0 0 1 1 1v5.802a1 1 0 0 1-1 1H24a1 1 0 0 1-1-1zM23 29a1 1 0 0 1 1-1h61.334a1 1 0 0 1 1 1v4.425a1 1 0 0 1-1 1H24a1 1 0 0 1-1-1zm15.145 21.44a5 5 0 0 1 5-5h23.043a5 5 0 0 1 5 5v23.454H38.145z M44.57 65.633a2.754 2.754 0 0 1 2.754-2.753H62.01v5.507H47.324a2.754 2.754 0 0 1-2.754-2.754m20.194 5.507a2.754 2.754 0 0 0-2.754-2.753H47.324v5.507H62.01a2.754 2.754 0 0 0 2.754-2.754 M44.57 71.14a2.754 2.754 0 1 0 5.508 0 2.754 2.754 0 1 0-5.508 0m14.688-5.507a2.754 2.754 0 1 0 5.507 0 2.754 2.754 0 1 0-5.507 0",viewW:110,viewH:110}},{id:"fridge",group:"appliance",art:{d:"M35.5 18H75a2.5 2.5 0 0 1 2.5 2.5v64A2.5 2.5 0 0 1 75 87H35.5a2.5 2.5 0 0 1-2.5-2.5v-64a2.5 2.5 0 0 1 2.5-2.5 M33 46.5h44.5v38A2.5 2.5 0 0 1 75 87H35.5a2.5 2.5 0 0 1-2.5-2.5zm2.5 44a1 1 0 0 0 1 1h37a1 1 0 0 0 1-1V87h-39zm3-49.5v-9.5m0 30.5v-9.5",viewW:110,viewH:110}},{id:"hood",group:"appliance",art:{d:"M44.308 57h21.384L83 69H27zM44 37.5a2.5 2.5 0 0 1 2.5-2.5h17a2.5 2.5 0 0 1 2.5 2.5V57H44zM80.5 74h-51a2.5 2.5 0 0 1-2.5-2.5V70a1 1 0 0 1 1-1h54a1 1 0 0 1 1 1v1.5a2.5 2.5 0 0 1-2.5 2.5",viewW:110,viewH:110}},{id:"kitchen_cabinet",group:"furniture",art:{d:"M38 88a1 1 0 0 0 1 1h32a1 1 0 0 0 1-1v-3H38zm17-68h16.5a2.5 2.5 0 0 1 2.5 2.5v17a2.5 2.5 0 0 1-2.5 2.5H55zm-19 2.5a2.5 2.5 0 0 1 2.5-2.5H55v22H38.5a2.5 2.5 0 0 1-2.5-2.5zM59 33v5m-8-5v5m4 47h16.5a2.5 2.5 0 0 0 2.5-2.5v-17a2.5 2.5 0 0 0-2.5-2.5H55zm-19-2.5a2.5 2.5 0 0 0 2.5 2.5H55V63H38.5a2.5 2.5 0 0 0-2.5 2.5zM67 67h-5m-14 0h-5",viewW:110,viewH:110}},{id:"kitchen_sink",group:"sanitary",art:{d:"M21.5 84h68a2.5 2.5 0 0 0 2.5-2.5v-35a2.5 2.5 0 0 0-2.5-2.5h-68a2.5 2.5 0 0 0-2.5 2.5v35a2.5 2.5 0 0 0 2.5 2.5 M26 78h26.5a1 1 0 0 0 1-1V51a1 1 0 0 0-1-1H26a1 1 0 0 0-1 1v26a1 1 0 0 0 1 1m23-24v5m9.5 19H85a1 1 0 0 0 1-1V51a1 1 0 0 0-1-1H58.5a1 1 0 0 0-1 1v26a1 1 0 0 0 1 1m-6-39.5a1 1 0 0 0-1-1H44a1 1 0 0 0-1 1V44h9.5zM58 33v-2a5 5 0 1 0-10 0v6.5M62 54v5",viewW:110,viewH:110}},{id:"nightstand",group:"furniture",art:{d:"M76.5 73.5h-8l1.674 5.441A1.5 1.5 0 0 0 71.608 80H75a1.5 1.5 0 0 0 1.5-1.5zm-42.5 0h8l-1.674 5.441A1.5 1.5 0 0 1 38.892 80H35.5a1.5 1.5 0 0 1-1.5-1.5z M34.5 30.5h41A2.5 2.5 0 0 1 78 33v40.5a2.5 2.5 0 0 1-2.5 2.5h-41a2.5 2.5 0 0 1-2.5-2.5V33a2.5 2.5 0 0 1 2.5-2.5 M32 39.5h46v18H32Zm18.5 9H60M50.5 66H60",viewW:110,viewH:110}},{id:"oven",group:"appliance",art:{d:"M31.5 25h47a2.5 2.5 0 0 1 2.5 2.5v55a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5v-55a2.5 2.5 0 0 1 2.5-2.5 M31.5 37.5h47A2.5 2.5 0 0 1 81 40v36a2.5 2.5 0 0 1-2.5 2.5h-47A2.5 2.5 0 0 1 29 76V40a2.5 2.5 0 0 1 2.5-2.5 M40.5 47h29a2.5 2.5 0 0 1 2.5 2.5v20a2.5 2.5 0 0 1-2.5 2.5h-29a2.5 2.5 0 0 1-2.5-2.5v-20a2.5 2.5 0 0 1 2.5-2.5m25-16a2 2 0 1 0 4 0 2 2 0 1 0-4 0m7.5 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-37.25 0h9.5M43 42h24",viewW:110,viewH:110}},{id:"plant",group:"other",art:{d:"M45.952 75.849a2.5 2.5 0 0 0 2.485 2.231H63.43a2.5 2.5 0 0 0 2.485-2.231l1.571-14.532H44.381zM60.236 44.78C58.423 36.174 66.805 29.605 77 31.87c0 8.155-8.609 16.763-16.763 12.912m-9.761 5.147c1.517-8.665-7.085-14.943-17.195-12.33.28 8.15 9.178 16.458 17.195 12.33 M55.706 55.88v-2.944m0 0c1.133-5.89 7.09-10.956 12.912-15.404M55.706 52.936c-4.938-4.146-7.982-6.16-14.044-9.061m1.453 12.005h25.636a1 1 0 0 1 1 1v3.437a1 1 0 0 1-1 1H43.115a1 1 0 0 1-1-1v-3.436a1 1 0 0 1 1-1",viewW:110,viewH:110}},{id:"rug",group:"other",art:{d:"M90.27 33.874h-5.622m-59.028 0H20m70.27 5.152h-5.622m-59.028 0H20m70.27 5.154h-5.622m-59.028 0H20m70.27 5.152h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20M28.12 32h54.025a2.5 2.5 0 0 1 2.5 2.5v40.439a2.5 2.5 0 0 1-2.5 2.5H28.12a2.5 2.5 0 0 1-2.5-2.5V34.5a2.5 2.5 0 0 1 2.5-2.5 M25.62 34.5a2.5 2.5 0 0 1 2.5-2.5h1.717v45.439H28.12a2.5 2.5 0 0 1-2.5-2.5zm59.026 0a2.5 2.5 0 0 0-2.5-2.5H80.43v45.439h1.716a2.5 2.5 0 0 0 2.5-2.5zM37.8 54.485l17.801-8.432 17.801 8.432-17.8 8.432z",viewW:110,viewH:110}},{id:"shelving",group:"furniture",art:{d:"M28 58.5h53V39H28Z M64 58.5h5V47a1 1 0 0 0-1-1h-3a1 1 0 0 0-1 1zM52.5 39h-5V27.5a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zm-12 0h-5V27.5a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zm-5 29.5V71a1 1 0 0 1 1 1H49a1 1 0 0 1 1-1v-2.5a1 1 0 0 1-1-1H36.5a1 1 0 0 1-1 1m33.5-10h7v-14a1 1 0 0 0-1-1h-5a1 1 0 0 0-1 1zM47.5 39h-7V25a1 1 0 0 1 1-1h5a1 1 0 0 1 1 1zm-12 34v4a1 1 0 0 1 1 1h14a1 1 0 0 1 1-1v-4a1 1 0 0 1-1-1h-14a1 1 0 0 1-1 1M28 78h53v7H28Z M28 89.5V23a2.5 2.5 0 0 1 2.5-2.5h48A2.5 2.5 0 0 1 81 23v66.5",viewW:110,viewH:110}},{id:"shower",group:"sanitary",art:{d:"M31 84h49a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H31a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1m31.5-47.6v-4.686a11.7 11.7 0 0 0-3.441-8.283A11.77 11.77 0 0 0 50.75 20a11.77 11.77 0 0 0-8.309 3.431A11.7 11.7 0 0 0 39 31.714V84 M72 39.25a10.25 10.25 0 1 0-20.5 0zm-17.25 5v2.5m7.25-2.5v2.5m7.25-2.5v2.5m-14.5 3.75V53M62 50.5V53m7.25-2.5V53m-14.5 3.75v2.5m7.25-2.5v2.5m7.25-2.5v2.5M54.75 63v2.5M62 63v2.5m7.25-2.5v2.5",viewW:110,viewH:110}},{id:"sink",group:"sanitary",art:{d:"M30 57c0 5.523 4.477 10 10 10h29.5c5.523 0 10-4.477 10-10v-6.5A2.5 2.5 0 0 0 77 48H32.5a2.5 2.5 0 0 0-2.5 2.5zm14 22a1 1 0 0 0 1 1h19.5a1 1 0 0 0 1-1V67H44zm6-36.5a1 1 0 0 1 1-1h7.5a1 1 0 0 1 1 1V48H50zM45 37v-2a5 5 0 1 1 10 0v6.5",viewW:110,viewH:110}},{id:"sofa",group:"furniture",art:{d:"M59.5 29h24a5 5 0 0 1 5 5v32a5 5 0 0 1-5 5h-24a5 5 0 0 1-5-5V34a5 5 0 0 1 5-5m-34 0h24a5 5 0 0 1 5 5v32a5 5 0 0 1-5 5h-24a5 5 0 0 1-5-5V34a5 5 0 0 1 5-5 M18.5 44a5 5 0 0 1 5 5v12H86V49a5 5 0 0 1 5-5h.5a5 5 0 0 1 5 5v21.5a5 5 0 0 1-5 5H18a5 5 0 0 1-5-5V49a5 5 0 0 1 5-5z M25.25 57h24.5a4.75 4.75 0 0 1 4.75 4.75 4.75 4.75 0 0 1-4.75 4.75h-24.5a4.75 4.75 0 0 1-4.75-4.75A4.75 4.75 0 0 1 25.25 57m34 0h24.5a4.75 4.75 0 0 1 4.75 4.75 4.75 4.75 0 0 1-4.75 4.75h-24.5a4.75 4.75 0 0 1-4.75-4.75A4.75 4.75 0 0 1 59.25 57M18.5 75.5h8l-1.674 5.441A1.5 1.5 0 0 1 23.392 82H20a1.5 1.5 0 0 1-1.5-1.5zm72 0h-8l1.674 5.441A1.5 1.5 0 0 0 85.608 82H89a1.5 1.5 0 0 0 1.5-1.5z",viewW:110,viewH:110}},{id:"stairs",group:"other",art:{d:"M73.47 46.365v-17.62m-10.571 25.55V36.674M52.326 61.783V45.484M42.193 69.273v-15.86M28.979 77.761a1 1 0 0 1 1-1h53.624v6.489a1 1 0 0 1-1 1H29.98a1 1 0 0 1-1-1z M26.777 57.497a1 1 0 0 1 1-1h2.846a1 1 0 0 1 1 1V83.25a1 1 0 0 1-1 1h-2.846a1 1 0 0 1-1-1z m73.113 28.633-41.492 32.93v-4.405l39.9-32.007a.7.7 0 0 1 .428-.151h3.724a1.762 1.762 0 1 1 0 3.524h-2.248a.5.5 0 0 0-.312.109M25.895 53.414a3.084 3.084 0 1 0 6.167 0 3.084 3.084 0 1 0-6.167 0m14.978 16.859a1 1 0 0 1 1-1h41.73v7.488h-42.73zm10.131-7.489a1 1 0 0 1 1-1h31.598v7.488H51.004z M61.576 55.294a1 1 0 0 1 1-1h21.026v7.49H61.576z M72.15 47.806a1 1 0 0 1 1-1h9.454a1 1 0 0 1 1 1v6.489H72.15z",viewW:110,viewH:110}},{id:"toilet",group:"sanitary",art:{d:"M32 26.5a2.5 2.5 0 0 1 2.5-2.5H45a2.5 2.5 0 0 1 2.5 2.5V57H32zM47.5 52h29a2.5 2.5 0 0 1 2.5 2.5V57H47.5zm17.037 20.102C73.95 70.288 79 62.01 79 57H32c.5 7.5 8.072 7 7 11l-2.342 16.862a1 1 0 0 0 .99 1.138H66.72a1 1 0 0 0 .97-1.243z",viewW:110,viewH:110}},{id:"tv",group:"appliance",art:{d:"M23.5 31H86a2.5 2.5 0 0 1 2.5 2.5v34A2.5 2.5 0 0 1 86 70H23.5a2.5 2.5 0 0 1-2.5-2.5v-34a2.5 2.5 0 0 1 2.5-2.5M50 70h9.5v8H50Zm-10 8h30M42.5 45.5h5m5 0h-5m0 0v9.75 m56.75 45.5 5 10 5-10",viewW:110,viewH:110}},{id:"wardrobe",group:"furniture",art:{d:"M28 23a2.5 2.5 0 0 1 2.5-2.5h24V85h-24a2.5 2.5 0 0 1-2.5-2.5zm2 65.5a1 1 0 0 0 1 1h47a1 1 0 0 0 1-1V85H30zM81 23a2.5 2.5 0 0 0-2.5-2.5h-24V85h24a2.5 2.5 0 0 0 2.5-2.5zM50.5 48v9.5m8-9.5v9.5",viewW:110,viewH:110}},{id:"washer",group:"appliance",art:{d:"M31.5 25h47a2.5 2.5 0 0 1 2.5 2.5v55a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5v-55a2.5 2.5 0 0 1 2.5-2.5 M31.5 37.5h47A2.5 2.5 0 0 1 81 40v42.5a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5V40a2.5 2.5 0 0 1 2.5-2.5 M38 60.5a17 17 0 1 0 34 0 17 17 0 1 0-34 0 M43.5 60.5a11.5 11.5 0 1 0 23 0 11.5 11.5 0 1 0-23 0m22-29.5a2 2 0 1 0 4 0 2 2 0 1 0-4 0m7.5 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-37.25 0h9.5",viewW:110,viewH:110}},{id:"work_table",group:"furniture",art:{d:"M88.5 47h-20v14h20zm-12 4h4m7.984-8h-66v4h66zm-66 4h4v26.5a1.5 1.5 0 0 1-1.5 1.5h-1a1.5 1.5 0 0 1-1.5-1.5z M24.866 35.597A2.5 2.5 0 0 1 27.197 34h56.577a2.5 2.5 0 0 1 2.33 1.594l2.35 6.044a1 1 0 0 1-.93 1.362H23.46a1 1 0 0 1-.933-1.361zM88.5 61h-20v12.5A1.5 1.5 0 0 0 70 75h17a1.5 1.5 0 0 0 1.5-1.5zm-12 4h4",viewW:110,viewH:110}}];class Dc{constructor(t,e){this.host=t,this.hooks=e}place(t,e="mouse"){const s=this.host._decorImagePalette,i=this.host._curSpaceCfg;if(!s||!i)return;const o=this.hooks.decorSnap(t,e),a=jt(s.width,s.height),n=Gt(a.w,this.host._cellCm,this.host._gridPitch)/m,r=Gt(a.h,this.host._cellCm,this.host._gridPitch)/this.host._decorH,l="di"+Date.now().toString(36)+Math.random().toString(36).slice(2,5),h=this.hooks.geometrySnapshot();i.decor=[...this.host._decorList,{id:l,kind:"image",asset_id:s.asset_id,x:Z(o[0]/m-n/2),y:Z(o[1]/this.host._decorH-r/2),w:n,h:r,opacity:1}],this.host._decorSel=l,this.host._decorTool="select",this.host._decorImagePalette=null,this.hooks.clearFurniturePreview(),this.hooks.recordGeometry(this.host._t("history.decor_add"),h),this.hooks.saveConfig(),this.host.requestUpdate()}renderPlacementPreview(){const t=this.host._furnPreviewInput,e=this.host._decorImagePalette;if(!t||!e||"decor"!==this.host._mode||"image"!==this.host._decorTool||!this.host._pointerModality.hoverEnabled)return d;const s=this.hooks.decorSnap(t.raw,"mouse"),i=jt(e.width,e.height),o=Gt(i.w,this.host._cellCm,this.host._gridPitch)/m,a=Gt(i.h,this.host._cellCm,this.host._gridPitch)/this.host._decorH,n=this.host._display(e.url);return n?_``:d}renderMissing(t,e,s,i,o,a,n,r,l){const h=i+a/2,c=o+n/2;return _` ${this.host._t("decor.image_unavailable")} @@ -554,7 +554,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae font-size=${Math.min(18,.25*n)} text-anchor="middle" dominant-baseline="middle" textLength=${Math.max(1,Math.min(.8*a,160))} lengthAdjust="spacingAndGlyphs">${this.host._t("decor.image_unavailable")} - `}async uploadFromInput(t,e=!1){const s=t.target,i=s.files?.[0];if(s.value="",!i||this.host._decorAssetBusy)return;let o;try{o=await go(i,2097152)}catch{return void this.host._showToast(this.host._t("backup.error.invalid_image"))}if("reject"!==o.kind)return"guard"===o.kind?(this.hooks.setGuardReplace(e),void(this.host._backdropGuard=o.state)):void await this.upload(i,i.name,e);this.host._showToast(this.host._t("toast.plan_formats"))}async upload(t,e,s){if(!this.host._decorAssetBusy){this.host._decorAssetBusy=!0;try{const i=new FormData;i.append("file",t,e);const o=this.host.hass?.fetchWithAuth?await this.host.hass.fetchWithAuth("/api/houseplan/assets/upload",{method:"POST",body:i}):await fetch("/api/houseplan/assets/upload",{method:"POST",body:i,headers:this.host.hass?.auth?.data?.access_token?{authorization:`Bearer ${this.host.hass.auth.data.access_token}`}:{}}),a=await o.json().catch(()=>({}));if(!o.ok||a.error||!a.asset){const t={invalid_format:"backup.error.invalid_image",invalid_image:"backup.error.invalid_image",unsupported_image:"backup.error.unsupported_image",too_large:"backdrop.too_large_title",capacity_exceeded:"decor.image_error_capacity"};throw new Error(this.host._t(t[String(a.error)]||"backup.error.io_error"))}const n=Wt({assets:[a.asset]}).values().next().value;if(!n)throw new Error(this.host._t("backup.error.io_error"));this.host._decorAssets=new Map(this.host._decorAssets).set(n.asset_id,n),this.host._decorAssetCatalog=[n,...this.host._decorAssetCatalog.filter(t=>t.asset_id!==n.asset_id)],s&&"image"===this.host._decorShapeDialog?.kind?this.host._decorShapeDialog={...this.host._decorShapeDialog,assetId:n.asset_id}:this.host._decorImagePalette=n,this.host.requestUpdate()}catch(t){this.host._showToast(this.host._t("decor.image_upload_failed",{err:this.host._errText(t)}))}finally{this.host._decorAssetBusy=!1}}}async delete(t){if(t.used_by?.length)return void this.host._showToast(this.host._t("decor.image_in_use"));if(await this.host._confirmDanger({key:`delete-decor-asset:${t.asset_id}`,kind:"destructive",title:this.host._t("decor.image_delete_title"),message:this.host._t("decor.image_delete_message",{name:t.name}),confirmLabel:this.host._t("btn.delete"),cancelLabel:this.host._t("btn.cancel")}))try{await this.host.hass.callWS({type:"houseplan/assets/delete",asset_id:t.asset_id}),this.host._decorAssetCatalog=this.host._decorAssetCatalog.filter(e=>e.asset_id!==t.asset_id),this.host._decorAssets.delete(t.asset_id),this.host._decorImagePalette?.asset_id===t.asset_id&&(this.host._decorImagePalette=null),this.host.requestUpdate()}catch(t){this.host._showToast("in_use"===t?.code?this.host._t("decor.image_in_use"):this.host._t("backup.error.io_error"))}}async loadCatalog(){try{const t=await this.host.hass.callWS({type:"houseplan/assets/list"}),e=Wt(t);this.host._decorAssetCatalog=[...e.values()],this.host._decorAssets=new Map([...this.host._decorAssets,...e]),this.host.requestUpdate()}catch{this.host._showToast(this.host._t("backup.error.io_error"))}}renderImagePalette(){const t=this.host._decorImagePalette;return h` @@ -1381,7 +1381,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae ${this._boolInput(this.host._settingsDialog.sunRays,t=>this.host._settingsDialog={...this.host._settingsDialog,sunRays:t})} ${this.host._t("gs.sun_rays")} - ${this.host._canEdit?h` + ${this.host._canEdit?p`
    ${this.host._t("gs.backup_hint")}
    @@ -1394,12 +1394,12 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae this._pickBackupImport(t)} /> - ${this.host._canOptimizeUndo&&"import"===this.host._undoKind?h` + ${this.host._canOptimizeUndo&&"import"===this.host._undoKind?p` `:l} -
    `:l} + `:d} +
    `:d}
    ${this.host._t("gs.grid_hint")}
    @@ -1407,15 +1407,15 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae ${this.host._t("gs.align_all")}
    - ${this.host._canOptimizeUndo&&"import"!==this.host._undoKind?h`
    + ${this.host._canOptimizeUndo&&"import"!==this.host._undoKind?p`
    -
    `:l} +
    `:d}
    - @@ -1424,7 +1424,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae ${this.host._settingsDialog.busy?"…":this.host._t("btn.save")}
    - `}_rulesSet(t){this.host._rulesDialog={...this.host._rulesDialog,rules:t}}async _saveRules(){const t=this.host._rulesDialog;if(!t||t.busy)return;const e=t.rules.filter(t=>t.pattern.trim()&&t.icon.trim());this.host._rulesDialog={...t,busy:!0};try{const t=this.host._serverCfg,s=JSON.stringify(e)===JSON.stringify(he),i={...t.settings};s?delete i.icon_rules:i.icon_rules=e,this.host._serverCfg={...t,settings:i},await this._saveConfigNow(),this.host._rulesDialog=null,this.host._regSignature="",this.host._maybeRebuildDevices(),this.host._showToast(this.host._t("rules.saved"))}catch(t){this.host._rulesDialog&&(this.host._rulesDialog={...this.host._rulesDialog,busy:!1}),this.host._showToast(this.host._t("toast.error",{err:this.host._errText(t)}))}}_renderRulesDialog(){const t=this.host._rulesDialog,e=ai(t.rules),s=t.test.trim()?ni(t.test,"",e):null,i=(e,s)=>{const i=[...t.rules],o=e+s;o<0||o>=i.length||([i[e],i[o]]=[i[o],i[e]],this._rulesSet(i))};return h``}_rulesSet(t){this.host._rulesDialog={...this.host._rulesDialog,rules:t}}async _saveRules(){const t=this.host._rulesDialog;if(!t||t.busy)return;const e=t.rules.filter(t=>t.pattern.trim()&&t.icon.trim());this.host._rulesDialog={...t,busy:!0};try{const t=this.host._serverCfg,s=JSON.stringify(e)===JSON.stringify(pe),i={...t.settings};s?delete i.icon_rules:i.icon_rules=e,this.host._serverCfg={...t,settings:i},await this._saveConfigNow(),this.host._rulesDialog=null,this.host._regSignature="",this.host._maybeRebuildDevices(),this.host._showToast(this.host._t("rules.saved"))}catch(t){this.host._rulesDialog&&(this.host._rulesDialog={...this.host._rulesDialog,busy:!1}),this.host._showToast(this.host._t("toast.error",{err:this.host._errText(t)}))}}_renderRulesDialog(){const t=this.host._rulesDialog,e=li(t.rules),s=t.test.trim()?hi(t.test,"",e):null,i=(e,s)=>{const i=[...t.rules],o=e+s;o<0||o>=i.length||([i[e],i[o]]=[i[o],i[e]],this._rulesSet(i))};return p`this.host._rulesDialog=null}>
    ${this.host._t("rules.hint")}
    @@ -1432,9 +1432,9 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae this.host._rulesDialog={...t,test:e.target.value}} /> - ${s?h`${s}`:l} + ${s?p`${s}`:d}
    - ${t.rules.map((e,s)=>{const o=""!==e.pattern.trim()&&!ri(e.pattern);return h`
    + ${t.rules.map((e,s)=>{const o=""!==e.pattern.trim()&&!ci(e.pattern);return p`
    - @@ -1465,11 +1465,11 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae ${t.busy?"…":this.host._t("btn.save")}
    - `}_saveKioskScale(t){this.host._kioskScale={...this.host._kioskScale,...t};try{localStorage.setItem("houseplan_card_kiosk_v1",JSON.stringify(this.host._kioskScale))}catch{}this.host.requestUpdate()}_renderKioskDialog(){const t=this.host._kioskScale,e=(e,s)=>h` + `}_saveKioskScale(t){this.host._kioskScale={...this.host._kioskScale,...t};try{localStorage.setItem("houseplan_card_kiosk_v1",JSON.stringify(this.host._kioskScale))}catch{}this.host.requestUpdate()}_renderKioskDialog(){const t=this.host._kioskScale,e=(e,s)=>p`
    ${this._rangeInput(50,300,5,Math.round(100*t[e]),t=>this._saveKioskScale({[e]:t/100}))} ${Math.round(100*t[e])}% -
    `;return h``;return p`this.host._kioskDialog=!1}>
    ${this.host._t("kiosk.hint")}
    @@ -1481,36 +1481,36 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    -
    `}_renderVacSection(e){const s=this.host._devices.find(t=>t.id===e.devId);if(!s||!this.host._isVacDev(s))return l;const i=s.marker?.vacuum||{},o=this.host._vacAllCamerasFor===s.id,a=this.host._vacSourceResolution(s,o),n=a.entityId,r=a.candidates.find(t=>t.entityId===n)||null,c=n?li(this.host.hass?.states[n]?.attributes):null,d=!1!==i.live&&("ok"===a.status||"unsupported"===a.status),p=this._vacPlanRoomAnchors(s.space),u=c?hi(c.rooms,p.map(t=>t.name)):0,_=!!(d&&c&&u>=3),m=t=>{const e=this.host._vacEnsureMarker(s);e&&(e.vacuum={...e.vacuum||{},...t},this.host._regSignature="",this.host._maybeRebuildDevices(),this._saveConfig(),this.host.requestUpdate())},g=new Set(s.entities||[]),f=a.candidates.filter(t=>g.has(t.entityId)||t.entityId===i.source),b=o?a.candidates.filter(t=>t.entityId.startsWith("camera.")&&!f.some(e=>e.entityId===t.entityId)):[],v=t=>[t.hasPosition?this.host._t("vac.cap_position"):"",t.hasRooms?this.host._t("vac.cap_rooms_short"):"",t.hasPath?this.host._t("vac.cap_path"):"",t.hasMapId?this.host._t("vac.cap_map"):""].filter(Boolean).join(" · ")||this.host._t("vac.cap_none"),y=t=>h` +
    `}_renderVacSection(t){const e=this.host._devices.find(e=>e.id===t.devId);if(!e||!this.host._isVacDev(e))return d;const s=e.marker?.vacuum||{},o=this.host._vacAllCamerasFor===e.id,a=this.host._vacSourceResolution(e,o),n=a.entityId,r=a.candidates.find(t=>t.entityId===n)||null,l=n?di(this.host.hass?.states[n]?.attributes):null,h=!1!==s.live&&("ok"===a.status||"unsupported"===a.status),c=this._vacPlanRoomAnchors(e.space),u=l?pi(l.rooms,c.map(t=>t.name)):0,_=!!(h&&l&&u>=3),m=t=>{const s=this.host._vacEnsureMarker(e);s&&(s.vacuum={...s.vacuum||{},...t},this.host._regSignature="",this.host._maybeRebuildDevices(),this._saveConfig(),this.host.requestUpdate())},g=new Set(e.entities||[]),f=a.candidates.filter(t=>g.has(t.entityId)||t.entityId===s.source),b=o?a.candidates.filter(t=>t.entityId.startsWith("camera.")&&!f.some(e=>e.entityId===t.entityId)):[],v=t=>[t.hasPosition?this.host._t("vac.cap_position"):"",t.hasRooms?this.host._t("vac.cap_rooms_short"):"",t.hasPath?this.host._t("vac.cap_path"):"",t.hasMapId?this.host._t("vac.cap_map"):""].filter(Boolean).join(" · ")||this.host._t("vac.cap_none"),y=t=>p` `,$=a.candidates.some(t=>g.has(t.entityId)&&"known_xcme_incomplete"===t.category)||!!a.pinned&&!!n?.startsWith("camera.")&&!r?.hasPosition;return h` + `,$=a.candidates.some(t=>g.has(t.entityId)&&"known_xcme_incomplete"===t.category)||!!a.pinned&&!!n?.startsWith("camera.")&&!r?.hasPosition;return p`
    ${this.host._t("vac.diag_source")}${n||this.host._t("vac.source_none")}
    - ${r?.platform?h`
    ${this.host._t("vac.diag_platform")}${r.platform}
    `:l} + ${r?.platform?p`
    ${this.host._t("vac.diag_platform")}${r.platform}
    `:d}
    ${this.host._t("vac.diag_status")}${this.host._t(`vac.source_status_${a.status}`)}
    -
    ${this.host._t("vac.diag_position")}${c?.pos?this.host._t("common.yes"):this.host._t("common.no")}
    -
    ${this.host._t("vac.diag_rooms")}${t(this.host._t("vac.diag_rooms_value"),{total:String(c?.rooms.length||0),matched:String(u),readiness:this.host._t(u>=3?"vac.autocal_ready":"vac.autocal_not_ready")})}
    -
    ${this.host._t("vac.diag_path")}${c?.path.length?this.host._t("common.yes"):this.host._t("common.no")}
    -
    ${this.host._t("vac.diag_map")}${c?.mapId??"default"}
    +
    ${this.host._t("vac.diag_position")}${l?.pos?this.host._t("common.yes"):this.host._t("common.no")}
    +
    ${this.host._t("vac.diag_rooms")}${i(this.host._t("vac.diag_rooms_value"),{total:String(l?.rooms.length||0),matched:String(u),readiness:this.host._t(u>=3?"vac.autocal_ready":"vac.autocal_not_ready")})}
    +
    ${this.host._t("vac.diag_path")}${l?.path.length?this.host._t("common.yes"):this.host._t("common.no")}
    +
    ${this.host._t("vac.diag_map")}${l?.mapId??"default"}
    - ${"missing"===a.status||"disabled"===a.status||"unverified"===a.status?h`
    + ${"missing"===a.status||"disabled"===a.status||"unverified"===a.status?p`
    ${this.host._t(`vac.source_banner_${a.status}`)} - -
    `:l} - ${$?h`
    + +
    `:d} + ${$?p`
    ${this.host._t("vac.xcme_hint")}
    attributes:
       - vacuum_position
       - rooms
       - path
       - map_name
    -
    `:l} -
    +
    `:d} +
    ${this.host._t("vac.choose_source")}
    - ${_?h``:l} - ${d?h``:l} + ${_?p``:d} + ${h?p``:d} ${this.host._t("vac.documentation")}
    - ${c?h` + ${l?p` - ${No(this,s,a)} - `:l} -
    `}_vacMapId(t,e,s=this.host._planHass){return this.host._vacMapId(t,e,s)}_vacSaveMatrix(t,e,s,i,o=""){return mc(this,t,e,s,i,o)}_vacPlanRoomAnchors(t){return(this.host._spaceModelById(t)?.rooms||[]).map(t=>({room:t,poly:H(t)})).filter(({room:t,poly:e})=>t.name&&e).map(({room:t,poly:e})=>{const s=di(e);return s?{name:String(t.name),cx:s[0],cy:s[1]}:null}).filter(Boolean)}async _vacAutoCalibrate(t){if(this.host._markerDialog?.busy)return;const s=this.host._vacSource(t),i=s?li(this.host.hass?.states[s]?.attributes):null;if(!s||!i||i.rooms.length<3)return void this.host._showToast(this.host._t("vac.autocal_no_rooms"));const o=this._vacMapId(t,i),a=function(t,s,i,o,a){const n=e(t,s,i,o).find(t=>t.source===o&&t.map_id===a);return{space:n?.space||i,routeId:n?.id||""}}(t.id,t.marker?.vacuum??null,t.space,s,o),n=pi(i.rooms,this._vacPlanRoomAnchors(a.space));if(!n)return void this.host._showToast(this.host._t("vac.autocal_no_match"));const r=this.host._serverCfg?.spaces?.find(t=>t.id===a.space),l=Number(r?.cell_cm),h=Number.isFinite(l)&&l>0?l:5,c=ui(n.residual,this.host._gridPitch,h);c>_i?this.host._vacCalConfirm={markerId:t.id,source:s,mapId:o,routeId:a.routeId,space:a.space,matrix:n.matrix,rooms:n.matched.length,error:Nt(c,"mi"===this.host.hass?.config?.unit_system?.length)}:await async function(t,e){if(uc.has(t))return;uc.add(t);const s=t.host,i=s._markerDialog,o=i?{...i,busy:!0}:null;o&&(s._markerDialog=o,s.requestUpdate());try{await mc(t,e.markerId,e.source,e.mapId,e.matrix,e.routeId)&&s._showToast(s._t("vac.autocal_done",{rooms:String(e.rooms)}))}finally{uc.delete(t),o&&s._markerDialog===o&&(s._markerDialog={...o,busy:!1},s.requestUpdate())}}(this,{markerId:t.id,source:s,mapId:o,routeId:a.routeId,space:a.space,matrix:n.matrix,rooms:n.matched.length})}_vacApplyCalibrationProposal(t){return async function(t,e){const s=t.host,o=s._vacCalConfirm;if(!o||o.busy)return;if(e){const t=s._devices.find(t=>t.id===o.markerId),e=i(o.matrix);if(!t||!e)return;const a=o.space||t.space;if(a!==s._space&&!s._commitSpace(a))return;return s._vacCalConfirm=null,s._markerDialog=null,void(s._vacFit={markerId:o.markerId,source:o.source,routeId:o.routeId,mapId:o.mapId,p:e,drag:null})}const a={...o,busy:!0};s._vacCalConfirm=a,s.requestUpdate();const n=await mc(t,o.markerId,o.source,o.mapId,o.matrix,o.routeId);s._vacCalConfirm===a&&(s._vacCalConfirm=n?null:{...o,busy:!1},s.requestUpdate()),n&&s._showToast(s._t("vac.autocal_done",{rooms:String(o.rooms)}))}(this,t)}_vacStartFit(t,a=""){if(this.host._markerDialog?.busy)return;const n=this.host._vacSource(t),r=n?li(this.host.hass?.states[n]?.attributes):null;if(!n||!r)return void this.host._showToast(this.host._t("vac.cal_need_pos"));const l=this._vacMapId(t,r),h=function(t,a,n){const r=e(t,a,n.dockSpace,n.source),l=r.find(t=>t.id===n.routeId)||r.find(t=>t.source===n.source&&t.map_id===n.mapId)||null,h=l?.space||n.dockSpace,c=n.viewBoxOf(h);if(!c)return null;const d=s(l?l.calibration:a?.calibration?.[n.mapId]),p=d&&i(d)||o(n.rooms,c);return{space:h,routeId:l?.id||"",params:p}}(t.id,t.marker?.vacuum??null,{routeId:a,source:n,mapId:l,dockSpace:t.space,rooms:r.rooms,viewBoxOf:t=>this.host._spaceModelById(t)?.vb??null});h&&(this.host._markerDialog=null,(h.space===this.host._space||this.host._commitSpace(h.space))&&(this.host._vacFit={markerId:t.id,source:n,mapId:l,routeId:h.routeId,p:h.params,drag:null}))}_vacFitSave(){return async function(t,e){const s=t.host,i=s._vacFit;if(!i||i.busy)return;const o={...i,busy:!0,drag:null};s._vacFit=o,s.requestUpdate();const a=await mc(t,i.markerId,i.source,i.mapId,e(i.p),i.routeId);s._vacFit===o&&(s._vacFit=a?null:{...i,busy:!1,drag:null},s.requestUpdate()),a&&s._showToast(s._t("vac.cal_done"))}(this,gi)}_vacFitTurn(t){const e=this.host._vacFit;if(!e||e.busy)return;const s=li(this.host.hass?.states[e.source]?.attributes),i=this._vacGhostCentre(s?.rooms||[]),o={...e.p,...t};this.host._vacFit={...e,p:mi(o,e.p,i[0],i[1])}}_vacGhostCentre(t){const e=[],s=[];for(const i of t)e.push(i.x0??i.cx,i.x1??i.cx),s.push(i.y0??i.cy,i.y1??i.cy);return e.length?[(Math.min(...e)+Math.max(...e))/2,(Math.min(...s)+Math.max(...s))/2]:[0,0]}_vacDelta(t,e,s){const i=this.host._stageEl,o=i?.clientWidth||1,a=i?.clientHeight||1;return[e/o*t.w,s/a*t.h]}_vacFitPointer(t,e){const s=this.host._vacFit;if(!s)return;if(t.stopPropagation(),s.busy)return;if("pointerdown"===t.type){const e=t.target,i=e.getAttribute?.("data-corner");try{t.currentTarget.setPointerCapture?.(t.pointerId)}catch{}return void(this.host._vacFit={...s,drag:i?{kind:"scale",sx:t.clientX,sy:t.clientY,p0:{...s.p},fx:Number(i.split(",")[0]),fy:Number(i.split(",")[1])}:{kind:"move",sx:t.clientX,sy:t.clientY,p0:{...s.p},fx:0,fy:0}})}const i=s.drag;if(i){if("pointermove"===t.type){const[o,a]=this._vacDelta(e,t.clientX-i.sx,t.clientY-i.sy);if("move"===i.kind)this.host._vacFit={...s,p:{...i.p0,ox:i.p0.ox+o,oy:i.p0.oy+a}};else{const t=li(this.host.hass?.states[s.source]?.attributes),e=this._vacGhostCentre(t?.rooms||[]),n=gi(i.p0),[r,l]=fi(n,e[0],e[1]),[h,c]=fi(n,i.fx,i.fy),d=Math.hypot(r-h,l-c)||1,[p,u]=[2*r-h,2*l-c],_=Math.hypot(p+2*o-h,u+2*a-c)/2,m=Math.max(.05,_/d),g={...i.p0,s:i.p0.s*m};this.host._vacFit={...s,p:mi(g,i.p0,i.fx,i.fy)}}return}"pointerup"!==t.type&&"pointercancel"!==t.type||(this.host._vacFit={...s,drag:null})}}_renderVacFit(t){const e=this.host._vacFit;if(!e)return l;const s=li(this.host._renderPlanHass?.states?.[e.source]?.attributes);if(!s)return l;const i=gi(e.p),o=[],a=[],n=[];for(const t of s.rooms){if(null==t.x0)continue;const e=[[t.x0,t.y0],[t.x1,t.y0],[t.x1,t.y1],[t.x0,t.y1]].map(([t,e])=>fi(i,t,e));e.forEach(([t,e])=>{a.push(t),n.push(e)});const[s,r]=fi(i,t.cx,t.cy);o.push(d` - ${t.name}`)}let r=l;if(s.pos){const[e,o]=fi(i,s.pos.x,s.pos.y);r=d``}const c=[];if(a.length){const e=(()=>{const t=i[0]*i[4]-i[1]*i[3];return(e,s)=>[(i[4]*(e-i[2])-i[1]*(s-i[5]))/t,(-i[3]*(e-i[2])+i[0]*(s-i[5]))/t]})(),s=Math.min(...a),o=Math.max(...a),r=Math.min(...n),l=Math.max(...n),h=.022*t.w,p=h/4;for(const[t,i,a,n]of[[s,r,o,l],[o,r,s,l],[o,l,s,r],[s,l,o,r]]){const s=e(a,n);c.push(d` - `)}}return h``}_vacMapId(t,e,s=this.host._planHass){return this.host._vacMapId(t,e,s)}_vacSaveMatrix(t,e,s,i,o=""){return vc(this,t,e,s,i,o)}_vacPlanRoomAnchors(t){return(this.host._spaceModelById(t)?.rooms||[]).map(t=>({room:t,poly:B(t)})).filter(({room:t,poly:e})=>t.name&&e).map(({room:t,poly:e})=>{const s=_i(e);return s?{name:String(t.name),cx:s[0],cy:s[1]}:null}).filter(Boolean)}async _vacAutoCalibrate(t){if(this.host._markerDialog?.busy)return;const e=this.host._vacSource(t),s=e?di(this.host.hass?.states[e]?.attributes):null;if(!e||!s||s.rooms.length<3)return void this.host._showToast(this.host._t("vac.autocal_no_rooms"));const i=this._vacMapId(t,s),a=function(t,e,s,i,a){const n=o(t,e,s,i).find(t=>t.source===i&&t.map_id===a);return{space:n?.space||s,routeId:n?.id||""}}(t.id,t.marker?.vacuum??null,t.space,e,i),n=mi(s.rooms,this._vacPlanRoomAnchors(a.space));if(!n)return void this.host._showToast(this.host._t("vac.autocal_no_match"));const r=this.host._serverCfg?.spaces?.find(t=>t.id===a.space),l=Number(r?.cell_cm),h=Number.isFinite(l)&&l>0?l:5,c=gi(n.residual,this.host._gridPitch,h);c>fi?this.host._vacCalConfirm={markerId:t.id,source:e,mapId:i,routeId:a.routeId,space:a.space,matrix:n.matrix,rooms:n.matched.length,error:Ot(c,"mi"===this.host.hass?.config?.unit_system?.length)}:await async function(t,e){if(fc.has(t))return;fc.add(t);const s=t.host,i=s._markerDialog,o=i?{...i,busy:!0}:null;o&&(s._markerDialog=o,s.requestUpdate());try{await vc(t,e.markerId,e.source,e.mapId,e.matrix,e.routeId)&&s._showToast(s._t("vac.autocal_done",{rooms:String(e.rooms)}))}finally{fc.delete(t),o&&s._markerDialog===o&&(s._markerDialog={...o,busy:!1},s.requestUpdate())}}(this,{markerId:t.id,source:e,mapId:i,routeId:a.routeId,space:a.space,matrix:n.matrix,rooms:n.matched.length})}_vacApplyCalibrationProposal(t){return async function(t,e){const s=t.host,i=s._vacCalConfirm;if(!i||i.busy)return;if(e){const t=s._devices.find(t=>t.id===i.markerId),e=n(i.matrix);if(!t||!e)return;const o=i.space||t.space;if(o!==s._space&&!s._commitSpace(o))return;return s._vacCalConfirm=null,s._markerDialog=null,void(s._vacFit={markerId:i.markerId,source:i.source,routeId:i.routeId,mapId:i.mapId,p:e,drag:null})}const o={...i,busy:!0};s._vacCalConfirm=o,s.requestUpdate();const a=await vc(t,i.markerId,i.source,i.mapId,i.matrix,i.routeId);s._vacCalConfirm===o&&(s._vacCalConfirm=a?null:{...i,busy:!1},s.requestUpdate()),a&&s._showToast(s._t("vac.autocal_done",{rooms:String(i.rooms)}))}(this,t)}_vacStartFit(t,e=""){if(this.host._markerDialog?.busy)return;const s=this.host._vacSource(t),i=s?di(this.host.hass?.states[s]?.attributes):null;if(!s||!i)return void this.host._showToast(this.host._t("vac.cal_need_pos"));const l=this._vacMapId(t,i),h=function(t,e,s){const i=o(t,e,s.dockSpace,s.source),l=i.find(t=>t.id===s.routeId)||i.find(t=>t.source===s.source&&t.map_id===s.mapId)||null,h=l?.space||s.dockSpace,c=s.viewBoxOf(h);if(!c)return null;const d=a(l?l.calibration:e?.calibration?.[s.mapId]),p=d&&n(d)||r(s.rooms,c);return{space:h,routeId:l?.id||"",params:p}}(t.id,t.marker?.vacuum??null,{routeId:e,source:s,mapId:l,dockSpace:t.space,rooms:i.rooms,viewBoxOf:t=>this.host._spaceModelById(t)?.vb??null});h&&(this.host._markerDialog=null,(h.space===this.host._space||this.host._commitSpace(h.space))&&(this.host._vacFit={markerId:t.id,source:s,mapId:l,routeId:h.routeId,p:h.params,drag:null}))}_vacFitSave(){return async function(t,e){const s=t.host,i=s._vacFit;if(!i||i.busy)return;const o={...i,busy:!0,drag:null};s._vacFit=o,s.requestUpdate();const a=await vc(t,i.markerId,i.source,i.mapId,e(i.p),i.routeId);s._vacFit===o&&(s._vacFit=a?null:{...i,busy:!1,drag:null},s.requestUpdate()),a&&s._showToast(s._t("vac.cal_done"))}(this,vi)}_vacFitTurn(t){const e=this.host._vacFit;if(!e||e.busy)return;const s=di(this.host.hass?.states[e.source]?.attributes),i=this._vacGhostCentre(s?.rooms||[]),o={...e.p,...t};this.host._vacFit={...e,p:bi(o,e.p,i[0],i[1])}}_vacGhostCentre(t){const e=[],s=[];for(const i of t)e.push(i.x0??i.cx,i.x1??i.cx),s.push(i.y0??i.cy,i.y1??i.cy);return e.length?[(Math.min(...e)+Math.max(...e))/2,(Math.min(...s)+Math.max(...s))/2]:[0,0]}_vacDelta(t,e,s){const i=this.host._stageEl,o=i?.clientWidth||1,a=i?.clientHeight||1;return[e/o*t.w,s/a*t.h]}_vacFitPointer(t,e){const s=this.host._vacFit;if(!s)return;if(t.stopPropagation(),s.busy)return;if("pointerdown"===t.type){const e=t.target,i=e.getAttribute?.("data-corner");try{t.currentTarget.setPointerCapture?.(t.pointerId)}catch{}return void(this.host._vacFit={...s,drag:i?{kind:"scale",sx:t.clientX,sy:t.clientY,p0:{...s.p},fx:Number(i.split(",")[0]),fy:Number(i.split(",")[1])}:{kind:"move",sx:t.clientX,sy:t.clientY,p0:{...s.p},fx:0,fy:0}})}const i=s.drag;if(i){if("pointermove"===t.type){const[o,a]=this._vacDelta(e,t.clientX-i.sx,t.clientY-i.sy);if("move"===i.kind)this.host._vacFit={...s,p:{...i.p0,ox:i.p0.ox+o,oy:i.p0.oy+a}};else{const t=di(this.host.hass?.states[s.source]?.attributes),e=this._vacGhostCentre(t?.rooms||[]),n=vi(i.p0),[r,l]=yi(n,e[0],e[1]),[h,c]=yi(n,i.fx,i.fy),d=Math.hypot(r-h,l-c)||1,[p,u]=[2*r-h,2*l-c],_=Math.hypot(p+2*o-h,u+2*a-c)/2,m=Math.max(.05,_/d),g={...i.p0,s:i.p0.s*m};this.host._vacFit={...s,p:bi(g,i.p0,i.fx,i.fy)}}return}"pointerup"!==t.type&&"pointercancel"!==t.type||(this.host._vacFit={...s,drag:null})}}_renderVacFit(t){const e=this.host._vacFit;if(!e)return d;const s=di(this.host._renderPlanHass?.states?.[e.source]?.attributes);if(!s)return d;const i=vi(e.p),o=[],a=[],n=[];for(const t of s.rooms){if(null==t.x0)continue;const e=[[t.x0,t.y0],[t.x1,t.y0],[t.x1,t.y1],[t.x0,t.y1]].map(([t,e])=>yi(i,t,e));e.forEach(([t,e])=>{a.push(t),n.push(e)});const[s,r]=yi(i,t.cx,t.cy);o.push(_` + ${t.name}`)}let r=d;if(s.pos){const[e,o]=yi(i,s.pos.x,s.pos.y);r=_``}const l=[];if(a.length){const e=(()=>{const t=i[0]*i[4]-i[1]*i[3];return(e,s)=>[(i[4]*(e-i[2])-i[1]*(s-i[5]))/t,(-i[3]*(e-i[2])+i[0]*(s-i[5]))/t]})(),s=Math.min(...a),o=Math.max(...a),r=Math.min(...n),h=Math.max(...n),c=.022*t.w,d=c/4;for(const[t,i,a,n]of[[s,r,o,h],[o,r,s,h],[o,h,s,r],[s,h,o,r]]){const s=e(a,n);l.push(_` + `)}}return p`this._vacFitPointer(e,t)} @pointermove=${e=>this._vacFitPointer(e,t)} @pointerup=${e=>this._vacFitPointer(e,t)} - @pointercancel=${e=>this._vacFitPointer(e,t)}>${o}${r}${c}`}_resetRoomDialogFields(){this.host._roomEditId=null,this.host._roomFill="",this.host._roomCustomFill=null,this.host._roomTempMin="",this.host._roomTempMax="",this.host._roomTempSrc="",this.host._roomHumSrc="",this.host._roomSrcOpen=null,this.host._roomSrcFilter="",this.host._roomNameScale=1,this.host._roomLabelScale=1}_openRoomEdit(t){if(!t.id)return;this.host._roomEditId=t.id,this.host._nameSel=t.name||"",this.host._areaSel=t.area||"",this.host._roomFill="glow"===t.settings?.fill_mode?"":t.settings?.fill_mode||"";const e=t.settings?.custom_fill;this.host._roomCustomFill=e&&"object"==typeof e?Ls(e,Os(this.host._curSpaceCfg).customFill):null,[this.host._roomTempMin,this.host._roomTempMax]=bi(t.settings),this.host._roomTempSrc=t.settings?.temp_source||"",this.host._roomHumSrc=t.settings?.hum_source||"",this.host._roomNameScale=vi(t.settings?.name_scale),this.host._roomLabelScale=vi(t.settings?.label_scale),this.host._roomSrcOpen=null,this.host._roomSrcFilter="",this.host._roomDialog=!0}_roomSettingsFromDialog(){const t={};return this.host._roomFill&&(t.fill_mode=this.host._roomFill),this.host._roomCustomFill&&(t.custom_fill=this.host._roomCustomFill),this.host._roomTempSrc&&(t.temp_source=this.host._roomTempSrc),this.host._roomHumSrc&&(t.hum_source=this.host._roomHumSrc),yi(t,this.host._roomTempMin,this.host._roomTempMax),1!==this.host._roomNameScale&&(t.name_scale=this.host._roomNameScale),1!==this.host._roomLabelScale&&(t.label_scale=this.host._roomLabelScale),Object.keys(t).length?t:null}_saveRoomEdit(){const t=this.host._curSpaceCfg,e=t?.rooms.find(t=>t.id===this.host._roomEditId);if(!e)return this.host._roomDialog=!1,void(this.host._roomEditId=null);e.name=this.host._nameSel.trim()||e.name,e.area=this.host._areaSel||null;const s=e.settings||{},i={...s};yi(i,this.host._roomTempMin,this.host._roomTempMax)&&(this.host._roomFill?i.fill_mode=this.host._roomFill:delete i.fill_mode,this.host._roomCustomFill?i.custom_fill=this.host._roomCustomFill:delete i.custom_fill,"glow"===s.fill_mode&&"boolean"!=typeof s.glow&&(i.glow=!0),this.host._roomTempSrc?i.temp_source=this.host._roomTempSrc:delete i.temp_source,this.host._roomHumSrc?i.hum_source=this.host._roomHumSrc:delete i.hum_source,1!==this.host._roomNameScale?i.name_scale=this.host._roomNameScale:delete i.name_scale,1!==this.host._roomLabelScale?i.label_scale=this.host._roomLabelScale:delete i.label_scale,Object.keys(i).length?e.settings=i:delete e.settings,this._saveConfig(),this.host._roomDialog=!1,this.host._roomEditId=null,this.host._nameSel="",this.host._areaSel="",this.host._regSignature="",this.host._maybeRebuildDevices(),this.host.requestUpdate(),this.host._showToast(this.host._t("toast.room_updated")))}_roomSrcCandidates(){const t=this.host._planHass,e=Rt(this.host._markers),s=this.host._roomSrcFilter.trim().toLowerCase(),i=[];for(const o of Object.values(t.devices)){if("service"===o.entry_type)continue;if(e.devices.has(o.id))continue;const t=(o.name_by_user||o.name||o.id).trim();s&&!t.toLowerCase().includes(s)||i.push({value:"device:"+o.id,label:t,sub:o.model||this.host._t("marker.sub_device")})}for(const[o,a]of Object.entries(t.entities)){if(!o.startsWith("sensor.")||a.hidden)continue;if(At(t,o,e))continue;const n=a.name||t.states[o]?.attributes?.friendly_name||o;s&&!(n+" "+o).toLowerCase().includes(s)||i.push({value:"entity:"+o,label:n,sub:o})}return i.sort((t,e)=>t.label.localeCompare(e.label)),i.slice(0,200)}_roomSrcLabel(t){const e=t.indexOf(":"),s=t.slice(0,e),i=t.slice(e+1);return"device"===s?this.host._fullRegistryHass.devices[i]?.name_by_user||this.host._fullRegistryHass.devices[i]?.name||i:this.host._fullRegistryHass.entities[i]?.name||this.host.hass.states[i]?.attributes?.friendly_name||i}_labelPos(t,e){const s=this.host._layout["rl_"+(t.id||"")];if(s&&s.s===e)return{x:s.x*Zc,y:s.y*Zc};const i=this._snap(this.host._roomCenter(t));return{x:i[0],y:i[1]}}_labelDown(t,e,s){if("plan"!==this.host._mode)return;t.preventDefault(),t.stopPropagation();const i=this._labelPos(e,s);this.host._drag={id:"rl_"+(e.id||""),sx:t.clientX,sy:t.clientY,ox:i.x,oy:i.y,moved:!1},td(t),this.host._tip=null}_labelMove(t,e,s){const i="rl_"+(e.id||"");if(!this.host._drag||this.host._drag.id!==i)return;const o=this.host._stageEl;if(!o)return;const a=this.host._spaceModelById(s);if(!a)return;const n=a.vb,r=o.getBoundingClientRect(),l=this.host._viewOr(n),h=(t.clientX-this.host._drag.sx)/r.width*l.w,c=(t.clientY-this.host._drag.sy)/r.height*l.h;Math.abs(t.clientX-this.host._drag.sx)+Math.abs(t.clientY-this.host._drag.sy)>3&&(this.host._drag.moved=!0);const d=ue(this.host._drag.ox+h),p=ue(this.host._drag.oy+c);this.host._savePos({id:i,space:s},d,p)}_labelUp(t){const e="rl_"+(t.id||"");if(!this.host._drag||this.host._drag.id!==e)return;const s=this.host._drag.moved;this.host._drag=s?this.host._drag:null,s&&window.setTimeout(()=>this.host._drag=null,0)}_labelScale(t){const e=this.host._layout["rl_"+(t.id||"")]?.k;return"number"==typeof e&&Number.isFinite(e)?Math.min(3,Math.max(.5,e)):1}_rlResizeDown(t,e,s){if("plan"!==this.host._mode)return;t.preventDefault(),t.stopPropagation();const i=t.target.closest(".roomlabel");if(!i)return;const o=i.getBoundingClientRect(),a=o.left+o.width/2,n=o.top+o.height/2,r=Math.max(8,Math.hypot(t.clientX-a,t.clientY-n));this.host._rlResize={id:"rl_"+(e.id||""),space:s,k0:this._labelScale(e),cx:a,cy:n,d0:r},td(t)}_rlResizeMove(t){const e=this.host._rlResize;if(!e)return;t.stopPropagation();const s=Math.max(8,Math.hypot(t.clientX-e.cx,t.clientY-e.cy)),i=Math.min(3,Math.max(.5,e.k0*(s/e.d0))),o=this.host._layout[e.id];if(o)this.host._layout={...this.host._layout,[e.id]:{...o,k:i}};else{const t=e.id.slice(3),s=this.host._spaceModelById(e.space);if(!s)return;const o=s.rooms.find(e=>e.id===t);if(!o)return;const a=this._labelPos(o,e.space);this.host._layout={...this.host._layout,[e.id]:{s:e.space,x:a.x/Zc,y:a.y/Zc,k:i}}}this.host._dirtyPos.add(e.id)}_rlResizeUp(){this.host._rlResize&&(this.host._rlResize=null,this.host._persistLayout())}_renderRoomGear(t,e,s){if(!t.id)return l;let i=null;if(t.poly?(i=this.host._gearPtCache.get(t.poly)||null,i||(i=Ee(t.poly),this.host._gearPtCache.set(t.poly,i))):null!=t.x&&null!=t.y&&(i=[t.x+(t.w||0)/2,t.y+(t.h||0)/2]),!i)return l;const o=(i[0]-s.x)/s.w*100,a=(i[1]-s.y)/s.h*100;return h``}_resetRoomDialogFields(){this.host._roomEditId=null,this.host._roomFill="",this.host._roomCustomFill=null,this.host._roomTempMin="",this.host._roomTempMax="",this.host._roomTempSrc="",this.host._roomHumSrc="",this.host._roomSrcOpen=null,this.host._roomSrcFilter="",this.host._roomNameScale=1,this.host._roomLabelScale=1}_openRoomEdit(t){if(!t.id)return;this.host._roomEditId=t.id,this.host._nameSel=t.name||"",this.host._areaSel=t.area||"",this.host._roomFill="glow"===t.settings?.fill_mode?"":t.settings?.fill_mode||"";const e=t.settings?.custom_fill;this.host._roomCustomFill=e&&"object"==typeof e?js(e,Ws(this.host._curSpaceCfg).customFill):null,[this.host._roomTempMin,this.host._roomTempMax]=$i(t.settings),this.host._roomTempSrc=t.settings?.temp_source||"",this.host._roomHumSrc=t.settings?.hum_source||"",this.host._roomNameScale=wi(t.settings?.name_scale),this.host._roomLabelScale=wi(t.settings?.label_scale),this.host._roomSrcOpen=null,this.host._roomSrcFilter="",this.host._roomDialog=!0}_roomSettingsFromDialog(){const t={};return this.host._roomFill&&(t.fill_mode=this.host._roomFill),this.host._roomCustomFill&&(t.custom_fill=this.host._roomCustomFill),this.host._roomTempSrc&&(t.temp_source=this.host._roomTempSrc),this.host._roomHumSrc&&(t.hum_source=this.host._roomHumSrc),ki(t,this.host._roomTempMin,this.host._roomTempMax),1!==this.host._roomNameScale&&(t.name_scale=this.host._roomNameScale),1!==this.host._roomLabelScale&&(t.label_scale=this.host._roomLabelScale),Object.keys(t).length?t:null}_saveRoomEdit(){const t=this.host._curSpaceCfg,e=t?.rooms.find(t=>t.id===this.host._roomEditId);if(!e)return this.host._roomDialog=!1,void(this.host._roomEditId=null);e.name=this.host._nameSel.trim()||e.name,e.area=this.host._areaSel||null;const s=e.settings||{},i={...s};ki(i,this.host._roomTempMin,this.host._roomTempMax)&&(this.host._roomFill?i.fill_mode=this.host._roomFill:delete i.fill_mode,this.host._roomCustomFill?i.custom_fill=this.host._roomCustomFill:delete i.custom_fill,"glow"===s.fill_mode&&"boolean"!=typeof s.glow&&(i.glow=!0),this.host._roomTempSrc?i.temp_source=this.host._roomTempSrc:delete i.temp_source,this.host._roomHumSrc?i.hum_source=this.host._roomHumSrc:delete i.hum_source,1!==this.host._roomNameScale?i.name_scale=this.host._roomNameScale:delete i.name_scale,1!==this.host._roomLabelScale?i.label_scale=this.host._roomLabelScale:delete i.label_scale,Object.keys(i).length?e.settings=i:delete e.settings,this._saveConfig(),this.host._roomDialog=!1,this.host._roomEditId=null,this.host._nameSel="",this.host._areaSel="",this.host._regSignature="",this.host._maybeRebuildDevices(),this.host.requestUpdate(),this.host._showToast(this.host._t("toast.room_updated")))}_roomSrcCandidates(){const t=this.host._planHass,e=Nt(this.host._markers),s=this.host._roomSrcFilter.trim().toLowerCase(),i=[];for(const o of Object.values(t.devices)){if("service"===o.entry_type)continue;if(e.devices.has(o.id))continue;const t=(o.name_by_user||o.name||o.id).trim();s&&!t.toLowerCase().includes(s)||i.push({value:"device:"+o.id,label:t,sub:o.model||this.host._t("marker.sub_device")})}for(const[o,a]of Object.entries(t.entities)){if(!o.startsWith("sensor.")||a.hidden)continue;if(Et(t,o,e))continue;const n=a.name||t.states[o]?.attributes?.friendly_name||o;s&&!(n+" "+o).toLowerCase().includes(s)||i.push({value:"entity:"+o,label:n,sub:o})}return i.sort((t,e)=>t.label.localeCompare(e.label)),i.slice(0,200)}_roomSrcLabel(t){const e=t.indexOf(":"),s=t.slice(0,e),i=t.slice(e+1);return"device"===s?this.host._fullRegistryHass.devices[i]?.name_by_user||this.host._fullRegistryHass.devices[i]?.name||i:this.host._fullRegistryHass.entities[i]?.name||this.host.hass.states[i]?.attributes?.friendly_name||i}_labelPos(t,e){const s=this.host._layout["rl_"+(t.id||"")];if(s&&s.s===e)return{x:s.x*sd,y:s.y*sd};const i=this._snap(this.host._roomCenter(t));return{x:i[0],y:i[1]}}_labelDown(t,e,s){if("plan"!==this.host._mode)return;t.preventDefault(),t.stopPropagation();const i=this._labelPos(e,s);this.host._drag={id:"rl_"+(e.id||""),sx:t.clientX,sy:t.clientY,ox:i.x,oy:i.y,moved:!1},od(t),this.host._tip=null}_labelMove(t,e,s){const i="rl_"+(e.id||"");if(!this.host._drag||this.host._drag.id!==i)return;const o=this.host._stageEl;if(!o)return;const a=this.host._spaceModelById(s);if(!a)return;const n=a.vb,r=o.getBoundingClientRect(),l=this.host._viewOr(n),h=(t.clientX-this.host._drag.sx)/r.width*l.w,c=(t.clientY-this.host._drag.sy)/r.height*l.h;Math.abs(t.clientX-this.host._drag.sx)+Math.abs(t.clientY-this.host._drag.sy)>3&&(this.host._drag.moved=!0);const d=ge(this.host._drag.ox+h),p=ge(this.host._drag.oy+c);this.host._savePos({id:i,space:s},d,p)}_labelUp(t){const e="rl_"+(t.id||"");if(!this.host._drag||this.host._drag.id!==e)return;const s=this.host._drag.moved;this.host._drag=s?this.host._drag:null,s&&window.setTimeout(()=>this.host._drag=null,0)}_labelScale(t){const e=this.host._layout["rl_"+(t.id||"")]?.k;return"number"==typeof e&&Number.isFinite(e)?Math.min(3,Math.max(.5,e)):1}_rlResizeDown(t,e,s){if("plan"!==this.host._mode)return;t.preventDefault(),t.stopPropagation();const i=t.target.closest(".roomlabel");if(!i)return;const o=i.getBoundingClientRect(),a=o.left+o.width/2,n=o.top+o.height/2,r=Math.max(8,Math.hypot(t.clientX-a,t.clientY-n));this.host._rlResize={id:"rl_"+(e.id||""),space:s,k0:this._labelScale(e),cx:a,cy:n,d0:r},od(t)}_rlResizeMove(t){const e=this.host._rlResize;if(!e)return;t.stopPropagation();const s=Math.max(8,Math.hypot(t.clientX-e.cx,t.clientY-e.cy)),i=Math.min(3,Math.max(.5,e.k0*(s/e.d0))),o=this.host._layout[e.id];if(o)this.host._layout={...this.host._layout,[e.id]:{...o,k:i}};else{const t=e.id.slice(3),s=this.host._spaceModelById(e.space);if(!s)return;const o=s.rooms.find(e=>e.id===t);if(!o)return;const a=this._labelPos(o,e.space);this.host._layout={...this.host._layout,[e.id]:{s:e.space,x:a.x/sd,y:a.y/sd,k:i}}}this.host._dirtyPos.add(e.id)}_rlResizeUp(){this.host._rlResize&&(this.host._rlResize=null,this.host._persistLayout())}_renderRoomGear(t,e,s){if(!t.id)return d;let i=null;if(t.poly?(i=this.host._gearPtCache.get(t.poly)||null,i||(i=Le(t.poly),this.host._gearPtCache.set(t.poly,i))):null!=t.x&&null!=t.y&&(i=[t.x+(t.w||0)/2,t.y+(t.h||0)/2]),!i)return d;const o=(i[0]-s.x)/s.w*100,a=(i[1]-s.y)/s.h*100;return p``}_alignCandidates(){const t=[],e=this.host._spaceModel();if(this.host._markup){if(!e)return t;if(this.host._drag?.id.startsWith("rl_")){const s=this.host._drag.id.slice(3);for(const i of e.rooms){if(!i.name||i.id===s)continue;const e=this._labelPos(i,this.host._space);t.push([e.x,e.y])}return t}for(const s of e.rooms){const e=H(s);if(e)for(const s of e)t.push(s)}if("draw"===this.host._tool)for(const e of this.host._path)t.push(e);if("split"===this.host._tool&&this.host._splitSel?.pts)for(const e of this.host._splitSel.pts)t.push(e);return t}if("devices"===this.host._mode){const e=this.host._deviceDrag?.id??this.host._drag?.id;for(const s of this.host._devices){if(s.space!==this.host._space||s.id===e||"ha_disabled"===s.bindingStatus?.kind)continue;const i=this.host._pos(s);t.push([i.x,i.y])}return t}if("decor"===this.host._mode){const e=this.host._decorMove?.id;return t.push(...this._decorSnapGeometry(e).points),this.host._decorDraft&&t.push(this.host._decorDraft.a),t}return t}_renderAlignGuides(){const t=this.host._alignPoint;if(!t)return d``;const e=this.host._drag?.id.startsWith("rl_")?.5*this.host._gridPitch:.05*this.host._gridPitch,s=$i(t,this._alignCandidates(),e);if(!s.length)return d``;const i=this.host._gridPitch,o=1.5*i;return d` - ${s.map(e=>{const[s,a,n,r]="x"===e.axis?[e.at,e.from[1],e.at,t[1]+Math.sign(t[1]-e.from[1])*o]:[e.from[0],e.at,t[0]+Math.sign(t[0]-e.from[0])*o,e.at];return d` + `}_alignCandidates(){const t=[],e=this.host._spaceModel();if(this.host._markup){if(!e)return t;if(this.host._drag?.id.startsWith("rl_")){const s=this.host._drag.id.slice(3);for(const i of e.rooms){if(!i.name||i.id===s)continue;const e=this._labelPos(i,this.host._space);t.push([e.x,e.y])}return t}for(const s of e.rooms){const e=B(s);if(e)for(const s of e)t.push(s)}if("draw"===this.host._tool)for(const e of this.host._path)t.push(e);if("split"===this.host._tool&&this.host._splitSel?.pts)for(const e of this.host._splitSel.pts)t.push(e);return t}if("devices"===this.host._mode){const e=this.host._deviceDrag?.id??this.host._drag?.id;for(const s of this.host._devices){if(s.space!==this.host._space||s.id===e||"ha_disabled"===s.bindingStatus?.kind)continue;const i=this.host._pos(s);t.push([i.x,i.y])}return t}if("decor"===this.host._mode){const e=this.host._decorMove?.id;return t.push(...this._decorSnapGeometry(e).points),this.host._decorDraft&&t.push(this.host._decorDraft.a),t}return t}_renderAlignGuides(){const t=this.host._alignPoint;if(!t)return _``;const e=this.host._drag?.id.startsWith("rl_")?.5*this.host._gridPitch:.05*this.host._gridPitch,s=xi(t,this._alignCandidates(),e);if(!s.length)return _``;const i=this.host._gridPitch,o=1.5*i;return _` + ${s.map(e=>{const[s,a,n,r]="x"===e.axis?[e.at,e.from[1],e.at,t[1]+Math.sign(t[1]-e.from[1])*o]:[e.from[0],e.at,t[0]+Math.sign(t[0]-e.from[0])*o,e.at];return _` `})} - `}_renderOpeningCenterTick(t){const e=(t.angle+90)*Math.PI/180,s=f(15,this.host._cellCm);return d``})} + `}_renderOpeningCenterTick(t){const e=(t.angle+90)*Math.PI/180,s=y(15,this.host._cellCm);return _``}_renderOpeningDimensionGuides(t){const e=t.labels.flatMap(t=>t.dimension?[t.dimension]:[]);if(!e.length)return d``;const s=this._cssPxToRender(4);return d`
    - `}_renderPhysicalDialog(){const t=this.host._physicalDialog,e="column"===t.kind;return h``}_renderPhysicalDialog(){const t=this.host._physicalDialog,e="column"===t.kind;return p`this.host._physicalDialog=null}>
    - ${e?h` + ${e?p` `:l} + `:d}
    this.host._physicalDialog={...t,cm:e.target.value}} /> ${this.host._t(this.host._imperial?"wallthick.unit_in":"wallthick.unit_cm")}
    - ${e&&"square"===t.shape?h` + ${e&&"square"===t.shape?p` this.host._physicalDialog={...t,angle:e.target.value}} />`:l} - ${t.length?h`
    ${this.host._t("physical.length")}: ${t.length}
    `:l} + @input=${e=>this.host._physicalDialog={...t,angle:e.target.value}} />`:d} + ${t.length?p`
    ${this.host._t("physical.length")}: ${t.length}
    `:d}
    -
    `}_renderMarkupBar(){const t=this.host._geometryHistory.undoName,e=this.host._geometryHistory.redoName,s=t?this.host._t("history.undo_named",{name:t}):this.host._t("history.undo_empty"),i=e?this.host._t("history.redo_named",{name:e}):this.host._t("history.redo_empty");return h`
    + `}_renderMarkupBar(){const t=this.host._geometryHistory.undoName,e=this.host._geometryHistory.redoName,s=t?this.host._t("history.undo_named",{name:t}):this.host._t("history.undo_empty"),i=e?this.host._t("history.redo_named",{name:e}):this.host._t("history.redo_empty");return p`
    @@ -1932,7 +1932,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    -
    `}_renderDevicesBar(){const t=this.host._devicePositionHistory.undoName,e=this.host._devicePositionHistory.redoName,s=t?this.host._t("history.undo_named",{name:t}):this.host._t("history.undo_empty"),i=e?this.host._t("history.redo_named",{name:e}):this.host._t("history.redo_empty");return h`
    +
    `}_renderDevicesBar(){const t=this.host._devicePositionHistory.undoName,e=this.host._devicePositionHistory.redoName,s=t?this.host._t("history.undo_named",{name:t}):this.host._t("history.undo_empty"),i=e?this.host._t("history.redo_named",{name:e}):this.host._t("history.redo_empty");return p`
    -
    `}_discoveryFilterState(t){const e=this.host._settings,s=void 0!==t.draftGroupLights?t.draftGroupLights:!1!==e.group_lights,i=e.exclude_integrations,o=void 0!==t.draftExcluded?null===t.draftExcluded?[...Ii]:t.draftExcluded:i?[...i]:[...Ii],a=void 0!==t.draftExcluded?null===t.draftExcluded:!i,n=void 0!==t.draftGroupLights||void 0!==t.draftExcluded;return{groupLights:s,excluded:o.sort(),usesProductList:a,dirty:n}}_registryIntegrations(){const t=new Set,e=this.host._fullRegistryHass;for(const s of Object.values(e?.entities||{}))s?.platform&&t.add(String(s.platform));for(const s of Object.values(e?.devices||{})){const e=s?.identifiers?.[0],i=Array.isArray(e)?e[0]:null;i&&t.add(String(i))}return[...t].sort()}_discoveryFilterPreview(t){const e=this._discoveryFilterState(t),s=[e.groupLights?1:0,e.usesProductList?"p":e.excluded.join(","),this.host._cfgEpoch,this.host._regSignature].join("|");if(this._discoveryPreviewMemo?.key===s)return this._discoveryPreviewMemo.value;const i={hass:this.host.hass,registry:this.host._haRegistry,areaToSpace:Object.fromEntries(Object.entries(this.host._areaToSpace).map(([t,e])=>[t,e.space])),markers:this.host._markers,showAll:this.host._showAll,firstSpaceId:this.host._model[0]?.id||"",loc:t=>this.host._t(t),iconRules:this.host._iconRules},o=(t,e)=>new Set(ro({...i,settings:t,excluded:e})),a=(t,e)=>new Set(lo({...i,settings:t,excluded:e}).map(t=>t.bindingRef||t.id)),n=Ti(this.host._settings),r={...this.host._settings,group_lights:e.groupLights},l=new Set(e.excluded),h=o(this.host._settings,n),c=o(r,l),d=a(this.host._settings,n),p=a(r,l);let u=0,_=0,m=0;const g=t=>t.includes("light.");for(const t of h)c.has(t)||(u++,g(t)&&m++);for(const t of c)h.has(t)||(_++,g(t)&&m++);for(const t of p)d.has(t)||(u++,g(t)&&m++);for(const t of d)p.has(t)||(_++,g(t)&&m++);const f={appear:u,hide:_,lights:m};return this._discoveryPreviewMemo={key:s,value:f},f}async _saveDiscoveryFilters(t){const e=this.host._serverCfg;if(!e)return;const s=this._discoveryFilterState(t),i={...e.settings};s.groupLights?delete i.group_lights:i.group_lights=!1,s.usesProductList?delete i.exclude_integrations:i.exclude_integrations=s.excluded,this.host._serverCfg={...e,settings:i},this.host._deviceInboxMemo=null,this._discoveryPreviewMemo=null,this.host._regSignature="",this.host._deviceInbox&&(this.host._deviceInbox={...t,draftGroupLights:void 0,draftExcluded:void 0}),this._saveConfig(),this.host._maybeRebuildDevices(),this.host.requestUpdate()}_renderDiscoveryFilters(t){const e=this._discoveryFilterState(t),s=e=>this.host._deviceInbox={...t,...e},i=t.filtersOpen&&e.dirty?this._discoveryFilterPreview(t):null,o=this._registryIntegrations().filter(t=>!e.excluded.includes(t));return h`
    `}_discoveryFilterState(t){const e=this.host._settings,s=void 0!==t.draftGroupLights?t.draftGroupLights:!1!==e.group_lights,i=e.exclude_integrations,o=void 0!==t.draftExcluded?null===t.draftExcluded?[...Ri]:t.draftExcluded:i?[...i]:[...Ri],a=void 0!==t.draftExcluded?null===t.draftExcluded:!i,n=void 0!==t.draftGroupLights||void 0!==t.draftExcluded;return{groupLights:s,excluded:o.sort(),usesProductList:a,dirty:n}}_registryIntegrations(){const t=new Set,e=this.host._fullRegistryHass;for(const s of Object.values(e?.entities||{}))s?.platform&&t.add(String(s.platform));for(const s of Object.values(e?.devices||{})){const e=s?.identifiers?.[0],i=Array.isArray(e)?e[0]:null;i&&t.add(String(i))}return[...t].sort()}_discoveryFilterPreview(t){const e=this._discoveryFilterState(t),s=[e.groupLights?1:0,e.usesProductList?"p":e.excluded.join(","),this.host._cfgEpoch,this.host._regSignature].join("|");if(this._discoveryPreviewMemo?.key===s)return this._discoveryPreviewMemo.value;const i={hass:this.host.hass,registry:this.host._haRegistry,areaToSpace:Object.fromEntries(Object.entries(this.host._areaToSpace).map(([t,e])=>[t,e.space])),markers:this.host._markers,showAll:this.host._showAll,firstSpaceId:this.host._model[0]?.id||"",loc:t=>this.host._t(t),iconRules:this.host._iconRules},o=(t,e)=>new Set(co({...i,settings:t,excluded:e})),a=(t,e)=>new Set(po({...i,settings:t,excluded:e}).map(t=>t.bindingRef||t.id)),n=Ai(this.host._settings),r={...this.host._settings,group_lights:e.groupLights},l=new Set(e.excluded),h=o(this.host._settings,n),c=o(r,l),d=a(this.host._settings,n),p=a(r,l);let u=0,_=0,m=0;const g=t=>t.includes("light.");for(const t of h)c.has(t)||(u++,g(t)&&m++);for(const t of c)h.has(t)||(_++,g(t)&&m++);for(const t of p)d.has(t)||(u++,g(t)&&m++);for(const t of d)p.has(t)||(_++,g(t)&&m++);const f={appear:u,hide:_,lights:m};return this._discoveryPreviewMemo={key:s,value:f},f}async _saveDiscoveryFilters(t){const e=this.host._serverCfg;if(!e)return;const s=this._discoveryFilterState(t),i={...e.settings};s.groupLights?delete i.group_lights:i.group_lights=!1,s.usesProductList?delete i.exclude_integrations:i.exclude_integrations=s.excluded,this.host._serverCfg={...e,settings:i},this.host._deviceInboxMemo=null,this._discoveryPreviewMemo=null,this.host._regSignature="",this.host._deviceInbox&&(this.host._deviceInbox={...t,draftGroupLights:void 0,draftExcluded:void 0}),this._saveConfig(),this.host._maybeRebuildDevices(),this.host.requestUpdate()}_renderDiscoveryFilters(t){const e=this._discoveryFilterState(t),s=e=>this.host._deviceInbox={...t,...e},i=t.filtersOpen&&e.dirty?this._discoveryFilterPreview(t):null,o=this._registryIntegrations().filter(t=>!e.excluded.includes(t));return p`
    s({filtersOpen:t.target.open})}> ${this.host._t("device_inbox.filters_title")}
    `}_renderDeviceInbox(){const t=this.host._deviceInbox,e=this._deviceInboxRows(),s=Object.fromEntries(["on_plan","available","hidden","readd"].map(t=>[t,e.filter(e=>e.category===t).length])),i=function(t,e,s,i=!1){const o=s.trim().toLocaleLowerCase();return t.filter(t=>t.category===e&&(!i||t.isNew)&&(!o||t.searchText.includes(o)))}(e,t.tab,t.search,"on_plan"===t.tab&&t.onlyNew),o=i.slice(0,t.limit),a=t=>this.host._t(`device_inbox.tab_${t}`),n=`device_inbox.empty_${t.tab}`;return h``}_renderDeviceInbox(){const t=this.host._deviceInbox,e=this._deviceInboxRows(),s=Object.fromEntries(["on_plan","available","hidden","readd"].map(t=>[t,e.filter(e=>e.category===t).length])),i=function(t,e,s,i=!1){const o=s.trim().toLocaleLowerCase();return t.filter(t=>t.category===e&&(!i||t.isNew)&&(!o||t.searchText.includes(o)))}(e,t.tab,t.search,"on_plan"===t.tab&&t.onlyNew),o=i.slice(0,t.limit),a=t=>this.host._t(`device_inbox.tab_${t}`),n=`device_inbox.empty_${t.tab}`;return p`this.host._deviceInbox=null}> @@ -2018,7 +2018,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    this._deviceInboxTabKey(t)}> - ${["on_plan","available","hidden","readd"].map(e=>h` + ${["on_plan","available","hidden","readd"].map(e=>p` `)}
    - ${"on_plan"===t.tab?h``:d}
    - ${"available"===t.tab?this._renderDiscoveryFilters(t):l} + ${"available"===t.tab?this._renderDiscoveryFilters(t):d}
    - ${o.length?o.map(t=>{const e="on_plan"===t.category?t.canFind?h``:h``:"hidden"===t.category?h``:p``:"hidden"===t.category?p``:h``,s="active"===t.status.kind?"":this.host._t(`device_inbox.status_${t.status.kind}`);return h`
    ${this.host._t("device_inbox.show")}`:p``,s="active"===t.status.kind?"":this.host._t(`device_inbox.status_${t.status.kind}`);return p`
    ${t.name} - ${t.isNew?h`${this.host._t("device_inbox.new")}`:l} + ${t.isNew?p`${this.host._t("device_inbox.new")}`:d}
    ${[t.model,t.integration,t.spaceName,t.areaName].filter(Boolean).join(" · ")}
    ${"excluded_integration"===t.reason&&t.integration?this.host._t("device_inbox.reason_excluded_integration",{integration:t.integration}):this.host._t(`device_inbox.reason_${t.reason}`)} - ${s?h`${s}`:l} + ${s?p`${s}`:d}
    ${t.binding}
    ${e} - ${t.canEdit||t.canHide||"available"===t.category||"hidden"===t.category||this.host._bindingHasHaPage(t.binding)?h` + ${t.canEdit||t.canHide||"available"===t.category||"hidden"===t.category||this.host._bindingHasHaPage(t.binding)?p`
    - ${t.canEdit&&("on_plan"!==t.category||t.canFind)?h``:l} - ${t.canHide?h``:l} - ${"available"===t.category?h``:l} - ${"hidden"===t.category?h``:d} + ${t.canHide?p``:d} + ${"available"===t.category?p``:d} + ${"hidden"===t.category?p``:l} - ${this.host._bindingHasHaPage(t.binding)?h``:l} + ${this.host._t("device_inbox.find")}`:d} + ${this.host._bindingHasHaPage(t.binding)?p``:d}
    -
    `:l} + `:d}
    -
    `}):h`
    ${this.host._t(n)}
    `} +
    `}):p`
    ${this.host._t(n)}
    `}
    - ${i.length>o.length?h``:l} + `:d}
    -
    `}_markerValueBadgeFields(t){return zi({touched:t.valueBadgeTouched,originalHas:t.originalHasValueBadge,original:t.originalValueBadge,enabled:t.valueBadgeEnabled,source:t.valueBadgeSource,position:t.valueBadgePosition})}_markerValueSourceFields(t){return Ri({touched:t.valueSourceTouched,originalHas:t.originalHasValueSource,original:t.originalValueSource,source:t.valueSource})}_markerDraft(t){if("ha"===t.bindingMode&&(!t.binding||"virtual"===t.binding))return null;const e=zs(t.room),s=xs(t.binding,t.devId,()=>"__hp_device_preview__"),i=this.host._markers.find(e=>e.id===s||e.id===t.devId),o=Ps(t.binding,t.controls,this.host._bindingEntities(t.binding)),a=this._effectiveStoredTapAction(t),n={id:s,binding:t.binding,name:t.name.trim()||null,icon:t.icon||null,display:"badge"!==t.display?t.display:null,ripple_color:"icon_ripple"===t.display&&t.rippleColor?t.rippleColor:null,ripple_size:"icon_ripple"===t.display&&1.5!==t.rippleSize?t.rippleSize:null,size:1!==t.size?t.size:null,angle:t.angle||null,...this._markerTapActionFields(t),...this._markerToggleEntityFields(t),tap_target:"run"===a&&t.tapTarget||null,tap_confirm:!!t.tapConfirm||null,controls:o.length?o:null,...this._markerLightFields(t),...this._markerValueBadgeFields(t),...this._markerValueSourceFields(t),use_climate_temp:!!t.useClimateTemp||null,glow_radius_cm:(()=>{const e=ot(t.glowRadius);return null==e||e<=0?null:Math.round(this.host._imperial?30.48*e:100*e)})(),model:t.model.trim()||null,link:t.link.trim()||null,description:t.description.trim()||null,pdfs:t.pdfs,hidden:t.hideFromPlan,vacuum:i?.vacuum||null},r=!!i&&("string"==typeof i.area&&i.area.length>0||null===i.area&&!!i.space&&!!i.room_id);return"virtual"===t.binding||t.roomTouched?(n.space=e?.space||("virtual"===t.binding?this.host._space:null),n.area=e?.area||null,n.room_id=e?.roomId||null):r&&(n.space=i.space,n.area=i.area,n.room_id=i.room_id),n}_markerPreviewDevice(t){const e=this._markerDraft(t);if(!e)return null;const s=`${this.host._haRegistry.revision}\n${zt(this.host._markers)}\n${JSON.stringify(e)}`;if(this.host._markerPreviewMemo?.key===s)return this.host._markerPreviewMemo.device;const i=Ai({hass:this.host.hass,registry:this.host._haRegistry,areaToSpace:Object.fromEntries(Object.entries(this.host._areaToSpace).map(([t,e])=>[t,e.space])),marker:e,siblingMarkers:this.host._markers,settings:this.host._settings,excluded:this.host._excluded,showAll:this.host._showAll,firstSpaceId:this.host._model[0]?.id||this.host._space,loc:t=>this.host._t(t),iconRules:this.host._iconRules});return this.host._markerPreviewMemo={key:s,device:i},i}_markerPreviewDevices(t){const e=this.host._markerPreviewDevicesMemo;if(e?.base===this.host._devices&&e.preview===t)return e.devices;const s=[...this.host._devices.filter(e=>e.id!==t.id),t];return this.host._markerPreviewDevicesMemo={base:this.host._devices,preview:t,devices:s},s}_toggleIntent(t,e=this.host._devices){return this.host._toggleIntent(t,e)}_toggleIntentForDialog(t){const e=this._markerPreviewDevice(t);if(!e)return null;const s=this._markerPreviewDevices(e);return this._toggleIntent(e,s)}_toggleStateText(t,e){return this.host._toggleStateText(t,e)}_toggleConfirmationStateText(t){return this.host._toggleConfirmationStateText(t)}_toggleConfirmationLines(t){return this.host._toggleConfirmationLines(t)}_toggleHintLines(t){if(!t)return[];const e=t=>this.host._t(`marker.toggle_effect_${t.replace("-","_")}`),s=t=>this.host._t(`marker.toggle_skip_${t.replace("-","_")}`);return Fi(t,{single:t=>{if("via"in t&&"virtual-light"===t.via)return this.host._t("marker.virtual_light_target",{name:t.name});const e=t.entityId||("ref"in t?t.ref:""),s=t.name||e;return this.host._t("marker.toggle_hint_single",{name:s,id:e})},group:t=>this.host._t("marker.toggle_hint_group",{count:t.length,names:t.map(t=>`${t.name} (${t.entityId})`).join(", ")}),currentNext:(t,s)=>"virtual-light"===t.via?this.host._t("marker.virtual_light_current",{state:this.host._t("on"===t.state?"marker.virtual_light_state_on":"marker.virtual_light_state_off"),effect:e(s)}):this.host._t("marker.toggle_hint_current",{state:this._toggleStateText(t.entityId,t.state),effect:e(s)}),groupCurrentNext:(t,s)=>this.host._t("marker.toggle_hint_group_current",{on:t.filter(t=>"on"===t.state).length,count:t.length,effect:e(s)}),skipped:t=>this.host._t("marker.toggle_hint_skipped",{count:t.length,targets:t.map(t=>{const e=t.entityId||t.ref;return`${t.name||e} (${e}: ${s(t.reason)})`}).join(", ")}),none:t=>this.host._t(`marker.toggle_none_${t.replaceAll("-","_")}`)})}_effectiveStoredTapAction(t,e){return t.tapActionTouched?t.tapAction:Ds(t.originalHasTapAction?t.originalTapAction:null,e)}_effectiveMarkerTapAction(t,e=this._markerPreviewDevice(t)){return this._effectiveStoredTapAction(t,e?.primary?.split(".")[0])}_announceToggleDraft(t){const e=this._markerPreviewDevice(t),s=t.tapActionTouched?t:{...t,tapAction:this._effectiveMarkerTapAction(t,e)},i="toggle"===s.tapAction?this._toggleHintLines(this._toggleIntentForDialog(s)).join(" "):"";return{...s,tapHintAnnouncement:i}}_valueBadgeForBinding(t,e){const s={...t,binding:e,valueBadgeEnabled:!1,valueBadgeSource:null,valueBadgeTouched:!0},i=this._markerPreviewDevice(s);if(!i)return{valueBadgeEnabled:!1,valueBadgeSource:null,valueBadgeTouched:!0};const o=[...this.host._devices.filter(t=>t.id!==i.id),i],a=Ms(this.host._planHass,i,o),n=Cs(this.host._planHass,i,a);return{valueBadgeEnabled:t.valueBadgeEnabled&&!!n,valueBadgeSource:n,valueBadgeTouched:!0}}_markerSpatialSource(t){const e=this._markerPreviewDevice(t);if(!e)return null;const s={...e,hidden:!1};return Ni(Ei(this.host._planHass,[...this.host._devices.filter(t=>t.id!==s.id),s],null,this.host._virtualLights).filter(t=>t.device.id===s.id))}_markerAutoHasSpatialSource(t){const e={...t,lightRole:"auto",lightRoleTouched:!0},s=this._markerPreviewDevice(e);return!!s&&Hi(this.host._planHass,{...s})}_setMarkerLightRole(t){const e=this.host._markerDialog;e&&(this.host._markerDialog={...e,lightRole:t,lightRoleTouched:!0})}_controlRefInfo(t){if(!t.startsWith("marker:"))return{label:this.host.hass.states[t]?.attributes?.friendly_name||t,sub:t,icon:t.startsWith("light.")?"mdi:lightbulb":"mdi:toggle-switch",warning:!this.host._planEntityAvailable(t)};const e=t.slice(7),s=this.host._markers.find(t=>t.id===e),i=this.host._devices.find(t=>t.id===e);if(!s||s.removed||!0!==s.is_light)return{label:this.host._t("marker.control_missing_label"),sub:`${this.host._t("marker.control_broken")} (${t})`,icon:"mdi:alert-outline",warning:!0};const o=this.host._serverCfg?.spaces.find(t=>t.id===(i?.space||s.space)),a=!!i&&Oi(i).length>0;return{label:s.name||i?.name||e,sub:[o?.title||i?.space||s.space,s.room_id||i?.area,a?"":this.host._t("marker.control_passive")].filter(Boolean).join(" · "),icon:s.icon||i?.icon||"mdi:lightbulb-outline",warning:!0===s.hidden||!0===i?.hidden}}_valueBadgeCandidateLabel(t){const e=t.source;if("derived_lqi"===e.kind)return this.host._t("marker.value_badge_lqi");if("derived_marker_state"===e.kind)return this.host._t("marker.value_badge_marker_state",{name:t.label});if("entity_state"===e.kind)return this.host._t("marker.value_badge_state",{name:t.label});const s=this.host.hass.states[e.entity_id]?.attributes?.friendly_name||this.host._fullRegistryHass.entities[e.entity_id]?.name||e.entity_id;return this.host._t(`marker.value_badge_attr_${e.attribute}`,{name:s})}_controlCandidates(t){const e=this._markerDraft(t)?.id||t.devId||"",s=[],i=new Set;for(const t of this.host._markers){if(t.id===e||t.removed||t.hidden||!0!==t.is_light)continue;if("virtual"!==t.binding&&"active"!==this.host._bindingStatus(t.binding).kind)continue;const o=this.host._devices.find(e=>e.id===t.id);if(!o||o.hidden)continue;const a=this._controlRefInfo(`marker:${t.id}`);for(const t of Oi(o))i.add(t);s.push({value:`marker:${t.id}`,label:a.label,sub:a.sub,icon:a.icon,search:`${a.label} ${a.sub} ${t.id} ${Oi(o).join(" ")}`.toLowerCase()})}const o=Object.keys(this.host.hass.states||{}).filter(e=>Li(e)&&!i.has(e)&&Bi(t.binding,[e],this.host._bindingEntities(t.binding)).length>0&&this.host._planEntityAvailable(e)).map(t=>{const e=this._controlRefInfo(t);return{value:t,label:e.label,sub:t,icon:e.icon,search:`${e.label} ${t}`.toLowerCase()}}),a=t.controlsFilter.trim().toLowerCase();return[...s,...o].filter(e=>!t.controls.includes(e.value)&&(!a||e.search.includes(a))).slice(0,12).map(({search:t,...e})=>e)}_addControlRef(t,e){if(e.startsWith("marker:")){const s=this._markerDraft(t)?.id||t.devId||"";if(!s)return void this.host._showToast(this.host._t("toast.marker_binding_required"));const i=e.slice(7),o=this._markerDraft(t),a=o?[...this.host._markers.filter(t=>t.id!==s),o]:this.host._markers;if(Wi(a,s,i))return void this.host._showToast(this.host._t("toast.marker_control_cycle"))}this.host._markerDialog=this._announceToggleDraft({...t,controls:[...t.controls,e],controlsFilter:""})}_setMarkerGlowMode(t){const e=this.host._markerDialog;if(!e)return;if("auto"===t)return void(this.host._markerDialog={...e,glowMode:t,glowTouched:!0});const s=this._markerSpatialSource(e),i=ji(s?this.host._planHass.states[s.eid]:void 0,null,this.host._fillColors.glow_light.c),o=!e.glowColorDrafted,a="fixed"===t&&!e.glowBrightnessDrafted;this.host._markerDialog={...e,glowMode:t,glowColor:o?i.c:e.glowColor,glowBrightness:a?Math.max(1,Math.round(100*i.bri)):e.glowBrightness,glowColorDrafted:!0,glowBrightnessDrafted:e.glowBrightnessDrafted||"fixed"===t,glowTouched:!0}}_renderRadarSection(t,e,s="main"){return lh({dialog:t,device:e,registryHass:this.host._fullRegistryHass,planHass:this.host._planHass,hass:this.host.hass,spaceModelById:t=>this.host._spaceModelById(t),currentSpace:()=>this.host._spaceModel(),position:t=>this.host._pos(t),updateDialog:t=>{this.host._markerDialog&&(this.host._markerDialog={...this.host._markerDialog,...t})},dialogDeviceId:()=>this.host._markerDialog?.devId,t:(t,e)=>this.host._t(t,e),help:t=>this._help(t),boolInput:(t,e)=>this._boolInput(t,e),toast:t=>this.host._showToast(t),setup:this._radarSetup,configRev:this.host._cfgRev},s)}_renderMarkerDialog(){const t=this.host._markerDialog,e="virtual"===t.bindingMode,s=this._bindingCandidates();this.host._bindingEntities(t.binding);const i=e?null:this.host._bindingStatus(t.binding),o=!e&&this.host._bindingHasHaPage(t.binding),a=this._markerPreviewDevice(t),n=this._effectiveMarkerTapAction(t,a),r=a?Os(this.host._serverCfg?.spaces.find(t=>t.id===a.space)):null,c=a?this._markerPreviewDevices(a):this.host._devices,d="toggle"===n&&a?this._toggleIntent(a,c):null,p=this._toggleHintLines(d),u=a?Gi(this.host._planHass,a,{liveStates:!1!==this.host._config?.live_states,showTemperature:!1!==this.host._config?.show_temperature,showSignal:r?.showLqi??!1!==this.host._config?.show_signal,designPreview:!0,activityRuntime:this.host._activityRt.get(a.id),lightDevices:c,registryHass:this.host._fullRegistryHass,reducedMotion:this.host._reducedMotion}):null,_=a?Ms(this.host._planHass,a,c):[],m=a?Cs(this.host._planHass,a,_):null,g=t.valueBadgeTouched?t.valueBadgeEnabled:!!u?.valueBadge,f=t.valueBadgeTouched?t.valueBadgeSource:u?.valueBadge?.source||t.valueBadgeSource,b=t.valueBadgeTouched?t.valueBadgePosition:u?.valueBadge?.position||t.valueBadgePosition,v=qi(f),y=!!f&&!_.some(t=>t.key===v),$=_.find(t=>t.key===v),w=qi(t.valueSource),k=!(!t.valueSource||w&&_.some(t=>t.key===w)),x=_.find(t=>t.key===w),S=u?.valueSource?.sourceKey||"",M=this._markerAutoHasSpatialSource(t),C=!!a&&Ui(this.host._planHass,{...a}),P=Ki(t.lightRole,M,C,t.glowMode),D=!P.sourceExists,I=!P.fromSourceEnabled,T=P.passive,z=P.effectiveMode,R="never"===t.lightRole?this.host._t("marker.glow_disabled_never"):"auto"!==t.lightRole||M?T?this.host._t("marker.glow_passive_hint"):this.host._t("marker.glow_disabled_no_entity"):this.host._t("marker.glow_disabled_auto"),A=a?Oi(a):[],F=a&&Vi(a)||"",N=!!t.lightEntity&&!A.includes(t.lightEntity),E=a?Ji(a):[],H=!!t.toggleEntity&&!E.includes(t.toggleEntity),O="toggle"===n?this._toggleIntentForDialog({...t,toggleEntity:"",toggleEntityTouched:!0}):null,L=O?[...O.targets,...O.skippedTargets].map(t=>t.entityId||("ref"in t?t.ref:"")).filter(Boolean).join(", "):"",B=(()=>{if(e)return null;const i=s.find(e=>e.value===t.binding);if(i)return i.label;const[o,a]=t.binding.split(":");return"device"===o?this.host._fullRegistryHass.devices[a]?.name_by_user||this.host._fullRegistryHass.devices[a]?.name||a:this.host._fullRegistryHass.entities[a]?.name||this.host.hass.states[a]?.attributes?.friendly_name||a})();return h``}_markerValueBadgeFields(t){return Fi({touched:t.valueBadgeTouched,originalHas:t.originalHasValueBadge,original:t.originalValueBadge,enabled:t.valueBadgeEnabled,source:t.valueBadgeSource,position:t.valueBadgePosition})}_markerValueSourceFields(t){return Ni({touched:t.valueSourceTouched,originalHas:t.originalHasValueSource,original:t.originalValueSource,source:t.valueSource})}_markerDraft(t){if("ha"===t.bindingMode&&(!t.binding||"virtual"===t.binding))return null;const e=Fs(t.room),s=Cs(t.binding,t.devId,()=>"__hp_device_preview__"),i=this.host._markers.find(e=>e.id===s||e.id===t.devId),o=Ts(t.binding,t.controls,this.host._bindingEntities(t.binding)),a=this._effectiveStoredTapAction(t),n={id:s,binding:t.binding,name:t.name.trim()||null,icon:t.icon||null,display:"badge"!==t.display?t.display:null,ripple_color:"icon_ripple"===t.display&&t.rippleColor?t.rippleColor:null,ripple_size:"icon_ripple"===t.display&&1.5!==t.rippleSize?t.rippleSize:null,size:1!==t.size?t.size:null,angle:t.angle||null,...this._markerTapActionFields(t),...this._markerToggleEntityFields(t),tap_target:"run"===a&&t.tapTarget||null,tap_confirm:!!t.tapConfirm||null,controls:o.length?o:null,...this._markerLightFields(t),...this._markerValueBadgeFields(t),...this._markerValueSourceFields(t),use_climate_temp:!!t.useClimateTemp||null,glow_radius_cm:(()=>{const e=rt(t.glowRadius);return null==e||e<=0?null:Math.round(this.host._imperial?30.48*e:100*e)})(),model:t.model.trim()||null,link:t.link.trim()||null,description:t.description.trim()||null,pdfs:t.pdfs,hidden:t.hideFromPlan,vacuum:i?.vacuum||null},r=!!i&&("string"==typeof i.area&&i.area.length>0||null===i.area&&!!i.space&&!!i.room_id);return"virtual"===t.binding||t.roomTouched?(n.space=e?.space||("virtual"===t.binding?this.host._space:null),n.area=e?.area||null,n.room_id=e?.roomId||null):r&&(n.space=i.space,n.area=i.area,n.room_id=i.room_id),n}_markerPreviewDevice(t){const e=this._markerDraft(t);if(!e)return null;const s=`${this.host._haRegistry.revision}\n${Ft(this.host._markers)}\n${JSON.stringify(e)}`;if(this.host._markerPreviewMemo?.key===s)return this.host._markerPreviewMemo.device;const i=Ei({hass:this.host.hass,registry:this.host._haRegistry,areaToSpace:Object.fromEntries(Object.entries(this.host._areaToSpace).map(([t,e])=>[t,e.space])),marker:e,siblingMarkers:this.host._markers,settings:this.host._settings,excluded:this.host._excluded,showAll:this.host._showAll,firstSpaceId:this.host._model[0]?.id||this.host._space,loc:t=>this.host._t(t),iconRules:this.host._iconRules});return this.host._markerPreviewMemo={key:s,device:i},i}_markerPreviewDevices(t){const e=this.host._markerPreviewDevicesMemo;if(e?.base===this.host._devices&&e.preview===t)return e.devices;const s=[...this.host._devices.filter(e=>e.id!==t.id),t];return this.host._markerPreviewDevicesMemo={base:this.host._devices,preview:t,devices:s},s}_toggleIntent(t,e=this.host._devices){return this.host._toggleIntent(t,e)}_toggleIntentForDialog(t){const e=this._markerPreviewDevice(t);if(!e)return null;const s=this._markerPreviewDevices(e);return this._toggleIntent(e,s)}_toggleStateText(t,e){return this.host._toggleStateText(t,e)}_toggleConfirmationStateText(t){return this.host._toggleConfirmationStateText(t)}_toggleConfirmationLines(t){return this.host._toggleConfirmationLines(t)}_toggleHintLines(t){if(!t)return[];const e=t=>this.host._t(`marker.toggle_effect_${t.replace("-","_")}`),s=t=>this.host._t(`marker.toggle_skip_${t.replace("-","_")}`);return Hi(t,{single:t=>{if("via"in t&&"virtual-light"===t.via)return this.host._t("marker.virtual_light_target",{name:t.name});const e=t.entityId||("ref"in t?t.ref:""),s=t.name||e;return this.host._t("marker.toggle_hint_single",{name:s,id:e})},group:t=>this.host._t("marker.toggle_hint_group",{count:t.length,names:t.map(t=>`${t.name} (${t.entityId})`).join(", ")}),currentNext:(t,s)=>"virtual-light"===t.via?this.host._t("marker.virtual_light_current",{state:this.host._t("on"===t.state?"marker.virtual_light_state_on":"marker.virtual_light_state_off"),effect:e(s)}):this.host._t("marker.toggle_hint_current",{state:this._toggleStateText(t.entityId,t.state),effect:e(s)}),groupCurrentNext:(t,s)=>this.host._t("marker.toggle_hint_group_current",{on:t.filter(t=>"on"===t.state).length,count:t.length,effect:e(s)}),skipped:t=>this.host._t("marker.toggle_hint_skipped",{count:t.length,targets:t.map(t=>{const e=t.entityId||t.ref;return`${t.name||e} (${e}: ${s(t.reason)})`}).join(", ")}),none:t=>this.host._t(`marker.toggle_none_${t.replaceAll("-","_")}`)})}_effectiveStoredTapAction(t,e){return t.tapActionTouched?t.tapAction:zs(t.originalHasTapAction?t.originalTapAction:null,e)}_effectiveMarkerTapAction(t,e=this._markerPreviewDevice(t)){return this._effectiveStoredTapAction(t,e?.primary?.split(".")[0])}_announceToggleDraft(t){const e=this._markerPreviewDevice(t),s=t.tapActionTouched?t:{...t,tapAction:this._effectiveMarkerTapAction(t,e)},i="toggle"===s.tapAction?this._toggleHintLines(this._toggleIntentForDialog(s)).join(" "):"";return{...s,tapHintAnnouncement:i}}_valueBadgeForBinding(t,e){const s={...t,binding:e,valueBadgeEnabled:!1,valueBadgeSource:null,valueBadgeTouched:!0},i=this._markerPreviewDevice(s);if(!i)return{valueBadgeEnabled:!1,valueBadgeSource:null,valueBadgeTouched:!0};const o=[...this.host._devices.filter(t=>t.id!==i.id),i],a=Ds(this.host._planHass,i,o),n=Is(this.host._planHass,i,a);return{valueBadgeEnabled:t.valueBadgeEnabled&&!!n,valueBadgeSource:n,valueBadgeTouched:!0}}_markerSpatialSource(t){const e=this._markerPreviewDevice(t);if(!e)return null;const s={...e,hidden:!1};return Oi(Li(this.host._planHass,[...this.host._devices.filter(t=>t.id!==s.id),s],null,this.host._virtualLights).filter(t=>t.device.id===s.id))}_markerAutoHasSpatialSource(t){const e={...t,lightRole:"auto",lightRoleTouched:!0},s=this._markerPreviewDevice(e);return!!s&&Bi(this.host._planHass,{...s})}_setMarkerLightRole(t){const e=this.host._markerDialog;e&&(this.host._markerDialog={...e,lightRole:t,lightRoleTouched:!0})}_controlRefInfo(t){if(!t.startsWith("marker:"))return{label:this.host.hass.states[t]?.attributes?.friendly_name||t,sub:t,icon:t.startsWith("light.")?"mdi:lightbulb":"mdi:toggle-switch",warning:!this.host._planEntityAvailable(t)};const e=t.slice(7),s=this.host._markers.find(t=>t.id===e),i=this.host._devices.find(t=>t.id===e);if(!s||s.removed||!0!==s.is_light)return{label:this.host._t("marker.control_missing_label"),sub:`${this.host._t("marker.control_broken")} (${t})`,icon:"mdi:alert-outline",warning:!0};const o=this.host._serverCfg?.spaces.find(t=>t.id===(i?.space||s.space)),a=!!i&&Wi(i).length>0;return{label:s.name||i?.name||e,sub:[o?.title||i?.space||s.space,s.room_id||i?.area,a?"":this.host._t("marker.control_passive")].filter(Boolean).join(" · "),icon:s.icon||i?.icon||"mdi:lightbulb-outline",warning:!0===s.hidden||!0===i?.hidden}}_valueBadgeCandidateLabel(t){const e=t.source;if("derived_lqi"===e.kind)return this.host._t("marker.value_badge_lqi");if("derived_marker_state"===e.kind)return this.host._t("marker.value_badge_marker_state",{name:t.label});if("entity_state"===e.kind)return this.host._t("marker.value_badge_state",{name:t.label});const s=this.host.hass.states[e.entity_id]?.attributes?.friendly_name||this.host._fullRegistryHass.entities[e.entity_id]?.name||e.entity_id;return this.host._t(`marker.value_badge_attr_${e.attribute}`,{name:s})}_controlCandidates(t){const e=this._markerDraft(t)?.id||t.devId||"",s=[],i=new Set;for(const t of this.host._markers){if(t.id===e||t.removed||t.hidden||!0!==t.is_light)continue;if("virtual"!==t.binding&&"active"!==this.host._bindingStatus(t.binding).kind)continue;const o=this.host._devices.find(e=>e.id===t.id);if(!o||o.hidden)continue;const a=this._controlRefInfo(`marker:${t.id}`);for(const t of Wi(o))i.add(t);s.push({value:`marker:${t.id}`,label:a.label,sub:a.sub,icon:a.icon,search:`${a.label} ${a.sub} ${t.id} ${Wi(o).join(" ")}`.toLowerCase()})}const o=Object.keys(this.host.hass.states||{}).filter(e=>ji(e)&&!i.has(e)&&Gi(t.binding,[e],this.host._bindingEntities(t.binding)).length>0&&this.host._planEntityAvailable(e)).map(t=>{const e=this._controlRefInfo(t);return{value:t,label:e.label,sub:t,icon:e.icon,search:`${e.label} ${t}`.toLowerCase()}}),a=t.controlsFilter.trim().toLowerCase();return[...s,...o].filter(e=>!t.controls.includes(e.value)&&(!a||e.search.includes(a))).slice(0,12).map(({search:t,...e})=>e)}_addControlRef(t,e){if(e.startsWith("marker:")){const s=this._markerDraft(t)?.id||t.devId||"";if(!s)return void this.host._showToast(this.host._t("toast.marker_binding_required"));const i=e.slice(7),o=this._markerDraft(t),a=o?[...this.host._markers.filter(t=>t.id!==s),o]:this.host._markers;if(qi(a,s,i))return void this.host._showToast(this.host._t("toast.marker_control_cycle"))}this.host._markerDialog=this._announceToggleDraft({...t,controls:[...t.controls,e],controlsFilter:""})}_setMarkerGlowMode(t){const e=this.host._markerDialog;if(!e)return;if("auto"===t)return void(this.host._markerDialog={...e,glowMode:t,glowTouched:!0});const s=this._markerSpatialSource(e),i=Ui(s?this.host._planHass.states[s.eid]:void 0,null,this.host._fillColors.glow_light.c),o=!e.glowColorDrafted,a="fixed"===t&&!e.glowBrightnessDrafted;this.host._markerDialog={...e,glowMode:t,glowColor:o?i.c:e.glowColor,glowBrightness:a?Math.max(1,Math.round(100*i.bri)):e.glowBrightness,glowColorDrafted:!0,glowBrightnessDrafted:e.glowBrightnessDrafted||"fixed"===t,glowTouched:!0}}_renderRadarSection(t,e,s="main"){return ph({dialog:t,device:e,registryHass:this.host._fullRegistryHass,planHass:this.host._planHass,hass:this.host.hass,spaceModelById:t=>this.host._spaceModelById(t),currentSpace:()=>this.host._spaceModel(),position:t=>this.host._pos(t),updateDialog:t=>{this.host._markerDialog&&(this.host._markerDialog={...this.host._markerDialog,...t})},dialogDeviceId:()=>this.host._markerDialog?.devId,t:(t,e)=>this.host._t(t,e),help:t=>this._help(t),boolInput:(t,e)=>this._boolInput(t,e),toast:t=>this.host._showToast(t),setup:this._radarSetup,configRev:this.host._cfgRev},s)}_renderMarkerDialog(){const t=this.host._markerDialog,e="virtual"===t.bindingMode,s=this._bindingCandidates();this.host._bindingEntities(t.binding);const i=e?null:this.host._bindingStatus(t.binding),o=!e&&this.host._bindingHasHaPage(t.binding),a=this._markerPreviewDevice(t),n=this._effectiveMarkerTapAction(t,a),r=a?Ws(this.host._serverCfg?.spaces.find(t=>t.id===a.space)):null,l=a?this._markerPreviewDevices(a):this.host._devices,h="toggle"===n&&a?this._toggleIntent(a,l):null,c=this._toggleHintLines(h),u=a?Ki(this.host._planHass,a,{liveStates:!1!==this.host._config?.live_states,showTemperature:!1!==this.host._config?.show_temperature,showSignal:r?.showLqi??!1!==this.host._config?.show_signal,designPreview:!0,activityRuntime:this.host._activityRt.get(a.id),lightDevices:l,registryHass:this.host._fullRegistryHass,reducedMotion:this.host._reducedMotion}):null,_=a?Ds(this.host._planHass,a,l):[],m=a?Is(this.host._planHass,a,_):null,g=t.valueBadgeTouched?t.valueBadgeEnabled:!!u?.valueBadge,f=t.valueBadgeTouched?t.valueBadgeSource:u?.valueBadge?.source||t.valueBadgeSource,b=t.valueBadgeTouched?t.valueBadgePosition:u?.valueBadge?.position||t.valueBadgePosition,v=Vi(f),y=!!f&&!_.some(t=>t.key===v),$=_.find(t=>t.key===v),w=Vi(t.valueSource),k=!(!t.valueSource||w&&_.some(t=>t.key===w)),x=_.find(t=>t.key===w),S=u?.valueSource?.sourceKey||"",M=this._markerAutoHasSpatialSource(t),C=!!a&&Ji(this.host._planHass,{...a}),P=Yi(t.lightRole,M,C,t.glowMode),D=!P.sourceExists,I=!P.fromSourceEnabled,T=P.passive,z=P.effectiveMode,R="never"===t.lightRole?this.host._t("marker.glow_disabled_never"):"auto"!==t.lightRole||M?T?this.host._t("marker.glow_passive_hint"):this.host._t("marker.glow_disabled_no_entity"):this.host._t("marker.glow_disabled_auto"),A=a?Wi(a):[],F=a&&Xi(a)||"",N=!!t.lightEntity&&!A.includes(t.lightEntity),E=a?Zi(a):[],H=!!t.toggleEntity&&!E.includes(t.toggleEntity),O="toggle"===n?this._toggleIntentForDialog({...t,toggleEntity:"",toggleEntityTouched:!0}):null,L=O?[...O.targets,...O.skippedTargets].map(t=>t.entityId||("ref"in t?t.ref:"")).filter(Boolean).join(", "):"",B=(()=>{if(e)return null;const i=s.find(e=>e.value===t.binding);if(i)return i.label;const[o,a]=t.binding.split(":");return"device"===o?this.host._fullRegistryHass.devices[a]?.name_by_user||this.host._fullRegistryHass.devices[a]?.name||a:this.host._fullRegistryHass.entities[a]?.name||this.host.hass.states[a]?.attributes?.friendly_name||a})();return p`this._closeMarkerDialog()}>
    - ${"ha_disabled"===i?.kind?h`
    + ${"ha_disabled"===i?.kind?p`
    ${this.host._t(`marker.ha_disabled_${i.reason}`)} - ${o?h``:l} -
    `:"unverified"===i?.kind&&t.binding?h`
    + `:d} +
    `:"unverified"===i?.kind&&t.binding?p`
    ${this.host._t("marker.ha_registry_limited")} -
    `:l} +
    `:d}
    @@ -2137,32 +2137,32 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae ${this.host._t("marker.show_entities")}
    - ${"ha"===t.bindingMode?h` - ${t.bindingOpen?h`
    + ${t.bindingOpen?p`
    this.host._markerDialog={...t,bindingFilter:e.target.value}} />
    - ${s.map(e=>h`
    {if(e.value===t.binding)return void(this.host._markerDialog={...t,bindingOpen:!1});const s={...t,binding:e.value,bindingOpen:!1,controls:Ps(e.value,t.controls,this.host._bindingEntities(e.value)),autoIcon:this.host._autoIconForBinding(e.value),...Zl(t.radar,t.radarTouched,t.radarRemove)};this.host._markerDialog=this._announceToggleDraft({...s,...this._valueBadgeForBinding(s,e.value),valueSource:null,valueSourceTouched:!0})}}> + ${s.map(e=>p`
    {if(e.value===t.binding)return void(this.host._markerDialog={...t,bindingOpen:!1});const s={...t,binding:e.value,bindingOpen:!1,controls:Ts(e.value,t.controls,this.host._bindingEntities(e.value)),autoIcon:this.host._autoIconForBinding(e.value),...sh(t.radar,t.radarTouched,t.radarRemove)};this.host._markerDialog=this._announceToggleDraft({...s,...this._valueBadgeForBinding(s,e.value),valueSource:null,valueSourceTouched:!0})}}> ${e.label}${e.sub}
    `)} - ${s.length?l:h`
    ${this.host._t("marker.nothing_found")}
    `} + ${s.length?d:p`
    ${this.host._t("marker.nothing_found")}
    `}
    -
    `:l}`:l} +
    `:d}`:d}
    ${this._renderRadarSection(t,a)} @@ -2170,13 +2170,13 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae - ${"toggle"===n&&(E.length>1||H)?h`
    + ${"toggle"===n&&(E.length>1||H)?p`
    ${this._help("marker.toggle_entity.help")} @@ -2186,65 +2186,65 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae - ${E.map(e=>h``)} - ${H?h`

    + ${H?p`

    ${this.host._t("marker.toggle_entity_missing",{entity:t.toggleEntity,fallback:L||this.host._t("marker.toggle_entity_none")})} -

    `:l} -
    `:l} - ${"toggle"===n?h`
    - ${p.map(t=>h`
    ${t}
    `)} +

    `:d} +
    `:d} + ${"toggle"===n?p`
    + ${c.map(t=>p`
    ${t}
    `)}
    -
    ${t.tapHintAnnouncement}
    `:l} - ${"run"===n?(()=>{const e=t.runFilter.trim().toLowerCase(),s=this._runCandidates().filter(t=>!e||t.label.toLowerCase().includes(e)||t.value.includes(e)),i=t.tapTarget?this._runCandidates().find(e=>e.value===t.tapTarget):null;return h` +
    ${t.tapHintAnnouncement}
    `:d} + ${"run"===n?(()=>{const e=t.runFilter.trim().toLowerCase(),s=this._runCandidates().filter(t=>!e||t.label.toLowerCase().includes(e)||t.value.includes(e)),i=t.tapTarget?this._runCandidates().find(e=>e.value===t.tapTarget):null;return p` - ${t.tapTarget&&!i?h`
    ${this.host._t("marker.run_target_gone",{id:t.tapTarget})}
    `:l} + ${t.tapTarget&&!i?p`
    ${this.host._t("marker.run_target_gone",{id:t.tapTarget})}
    `:d} {t.target.select()}} @input=${e=>this.host._markerDialog={...t,runFilter:e.target.value,tapTarget:""}} /> - ${i?l:h`
    - ${s.slice(0,40).map(e=>h`
    + ${s.slice(0,40).map(e=>p`
    this.host._markerDialog={...t,tapTarget:e.value,runFilter:""}}> ${e.label}${e.sub}
    `)} - ${s.length?l:h`
    ${this.host._t("marker.nothing_found")}
    `} -
    `}`})():l} - ${"run"===n||"toggle"===n?h`
    `}`})():d} + ${"run"===n||"toggle"===n?p``:l} + `:d}
    ${this._help("marker.controls.help")}
    - ${t.controls.length?h`
    - ${t.controls.map(e=>{const s=this._controlRefInfo(e);return h` + ${t.controls.length?p`
    + ${t.controls.map(e=>{const s=this._controlRefInfo(e);return p` ${s.label} this.host._markerDialog=this._announceToggleDraft({...t,controls:t.controls.filter(t=>t!==e)})}> `})} -
    `:l} +
    `:d} this.host._markerDialog={...t,controlsFilter:e.target.value}} /> - ${t.controlsFilter.trim()?h`
    - ${this._controlCandidates(t).map(e=>h``)} -
    `:l} +
    `:d} - ${this.host._bindingHasClimate(t.binding)?h``:d}
    ${this.host._t("marker.light_role_label")}${this._help("marker.light_role.help")}
    @@ -2260,7 +2260,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    - ${"always"===t.lightRole&&(A.length>1||N)?h`
    + ${"always"===t.lightRole&&(A.length>1||N)?p`
    ${this._help("marker.light_entity.help")} @@ -2270,47 +2270,47 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae - ${A.map(e=>h``)} - ${N?h`

    + ${N?p`

    ${this.host._t("marker.light_entity_missing",{entity:t.lightEntity,fallback:F||"—"})} -

    `:l} -
    `:l} +

    `:d} +
    `:d}
    ${this.host._t("marker.glow_color_label")}${this._help("marker.glow_mode.help")}
    - ${"auto"!==z?h`
    + ${"auto"!==z?p`
    {this.host._markerDialog={...t,glowMode:z,glowColor:e.detail.color,glowColorDrafted:!0,glowTouched:!0}}}> - ${"fixed"===z?h` + ${"fixed"===z?p` ${this.host._t("marker.glow_brightness")} ${this._rangeInput(1,100,1,t.glowBrightness,e=>{this.host._markerDialog={...t,glowMode:z,glowBrightness:e,glowBrightnessDrafted:!0,glowTouched:!0}},D,this.host._t("marker.glow_brightness"))} - ${Math.round(t.glowBrightness)}%`:l} -
    `:l} + ${Math.round(t.glowBrightness)}%`:d} +
    `:d}
    @@ -2320,127 +2320,127 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    this.host._markerDialog={...t,glowRadius:e.target.value}} /> ${this.host._imperial?this.host._t("gs.unit_ft"):this.host._t("gs.unit_m")}
    - ${D||T?h`

    + ${D||T?p`

    ${R} -

    `:l} +

    `:d} - ${customElements.get("ha-icon-picker")?h`{const s=e.detail.value||"";(t.icon||s!==t.autoIcon)&&(this.host._markerDialog={...t,icon:s})}}>`:h`{const s=e.detail.value||"";(t.icon||s!==t.autoIcon)&&(this.host._markerDialog={...t,icon:s})}}>`:p`this.host._markerDialog={...t,icon:e.target.value}} />`} - ${!t.icon&&t.autoIcon?h`

    + ${!t.icon&&t.autoIcon?p`

    ${this.host._t("marker.icon_auto",{icon:t.autoIcon})}

    `:l} +

    `:d} -

    ${this.host._t(Vc[t.display])}

    - ${"value"===t.display?h`
    +

    ${this.host._t(Zc[t.display])}

    + ${"value"===t.display?p`
    ${this._help("marker.value_source.help")}
    - ${x?h`

    ${x.technical}

    `:l} - ${e?h`

    + ${x?p`

    ${x.technical}

    `:d} + ${e?p`

    ${this.host._t("marker.preview.reason.value_virtual")} -

    `:k?h`

    +

    `:k?p`

    ${this.host._t("marker.value_source_missing_hint")} -

    `:l} -
    `:l} - ${"static_icon"===t.display&&this.host._bindingHasAlarm(t.binding)?h`
    +

    `:d} +
    `:d} + ${"static_icon"===t.display&&this.host._bindingHasAlarm(t.binding)?p`
    ${this.host._t("marker.static_alarm_warning")} -
    `:l} +
    `:d}
    ${this.host._t("marker.value_badge_title")}${this._help("marker.value_badge.help")} - ${"static_icon"===t.display?h`

    + ${"static_icon"===t.display?p`

    ${this.host._t("marker.value_badge_static")} -

    `:_.length||t.valueBadgeSource?l:h`

    +

    `:_.length||t.valueBadgeSource?d:p`

    ${this.host._t("marker.value_badge_empty")}

    `} - ${g?h` + ${g?p`
    ${this._help("marker.value_badge_source.help")}
    - ${$?h`

    ${$.technical}

    `:l} - ${y?h`

    + ${$?p`

    ${$.technical}

    `:d} + ${y?p`

    ${this.host._t("marker.value_badge_missing_hint")} -

    `:l} - ${"value"===t.display&&v===S?h`

    +

    `:d} + ${"value"===t.display&&v===S?p`

    ${this.host._t("marker.value_badge_duplicate")} -

    `:l} +

    `:d}
    ${this._help("marker.value_badge_position.help")}
    - `:l} + `:d}
    - ${u?h` - `:h`
    + `:p`
    ${this.host._t("marker.preview.select_source")}
    `} - ${"icon_ripple"===t.display?h`
    + ${"icon_ripple"===t.display?p`
    ×${t.rippleSize}
    -

    ${this.host._t("marker.activity_alarm_note")}

    `:l} +

    ${this.host._t("marker.activity_alarm_note")}

    `:d}
    @@ -2480,8 +2480,8 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    - ${t.pdfs.map(t=>h` - ${t.name} + ${t.pdfs.map(t=>p` + ${t.name} this._removeMarkerPdf(t.url)}>`)}
    - ${t.devId?h``:l} - ${t.devId?h``:l} + `:d}
    - `}(this.host,()=>{this._saveSpaceCopy()});const e=this.host._importTotal>0&&"create"===t.mode?this.host._t("import.progress",{i:this.host._importTotal-this.host._importQueue.length,n:this.host._importTotal}):"",s=()=>{this.host._spaceDialog=null,this.host._importQueue=[],this.host._importTotal=0};return h``}(this.host,()=>{this._saveSpaceCopy()});const e=this.host._importTotal>0&&"create"===t.mode?this.host._t("import.progress",{i:this.host._importTotal-this.host._importQueue.length,n:this.host._importTotal}):"",s=()=>{this.host._spaceDialog=null,this.host._importQueue=[],this.host._importTotal=0};return p`
    @@ -2551,11 +2551,11 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae - ${"file"===t.source?h`
    - ${t.planFile?h`${t.planFile.name}`:t.planUrl?h`${this.host._t("space.plan_alt")}`:h`${this.host._t("space.no_plan")}`} + ${"file"===t.source?p`
    + ${t.planFile?p`${t.planFile.name}`:t.planUrl?p`${this.host._t("space.plan_alt")}`:p`${this.host._t("space.no_plan")}`}
    - ${t.pickSaved?this._renderServerPlans(t):l}`:l} + ${t.pickSaved?this._renderServerPlans(t):d}`:d} @@ -2581,16 +2581,16 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    {const s=e.target.value,i=ot(s),o=null==i?null:eo(i,this.host._imperial);this.host._spaceDialog={...t,cellCmInput:s,cellCmTouched:!0,cellCm:null!=o&&o>0?Math.max(.1,Math.min(Yc,o)):t.cellCm}}} /> + min=${qs(.1,this.host._imperial)} + max=${qs(td,this.host._imperial)} + step="0.1" .value=${t.cellCmInput??qs(t.cellCm,this.host._imperial)} + @input=${e=>{const s=e.target.value,i=rt(s),o=null==i?null:oo(i,this.host._imperial);this.host._spaceDialog={...t,cellCmInput:s,cellCmTouched:!0,cellCm:null!=o&&o>0?Math.max(.1,Math.min(td,o)):t.cellCm}}} /> ${this.host._t(this.host._imperial?"space.scale_unit_imperial":"space.scale_unit")}
    @@ -2607,7 +2607,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    ${this.host._t("space.hide_openings_tip")}
    - ${[["labelTemp","space.label_temp"],["labelHum","space.label_hum"],["labelLqi","space.label_lqi"],["labelLight","space.label_light"]].map(([e,s])=>h` - ${"custom"===e&&"custom"===t.fillMode?h`
    + ${"custom"===e&&"custom"===t.fillMode?p`
    ${this.host._t("space.custom_fill")} {this.host._spaceDialog={...t,customFill:{c:e.detail.color,a:e.detail.opacity}}}}> - ${t.customFill?h``:l} -
    `:l}`)} + ${this.host._t("btn.reset")}`:d} +
    `:d}`)} - ${t.deleteBlockers?h``:l} + ${t.deleteBlockers?p``:d}
    `:d}
    - ${this.host._importTotal>0&&"create"===t.mode?h``:l} + ${this.host._importTotal>0&&"create"===t.mode?p``:d}
    -
    `}_renderMergeDialog(){const t=this.host._mergeDialog,e=this.host._spaceModel()?.rooms||[],s=(s,i)=>{const o=e.find(t=>t.id===s),a=o?.area?this.host.hass.areas[o.area]?.name:null;return h`
    `}_renderMergeDialog(){const t=this.host._mergeDialog,e=this.host._spaceModel()?.rooms||[],s=(s,i)=>{const o=e.find(t=>t.id===s),a=o?.area?this.host.hass.areas[o.area]?.name:null;return p``};return h``};return p`this.host._mergeDialog=null}>

    ${this.host._t("merge.hint")}

    @@ -2756,7 +2756,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae ${this.host._t("btn.save")}
    -
    `}_renderRoomSource(t){const e="temp"===t?this.host._roomTempSrc:this.host._roomHumSrc,s=e=>{"temp"===t?this.host._roomTempSrc=e:this.host._roomHumSrc=e,this.host.requestUpdate()},i=this.host._roomSrcOpen===t;return h` +
    `}_renderRoomSource(t){const e="temp"===t?this.host._roomTempSrc:this.host._roomHumSrc,s=e=>{"temp"===t?this.host._roomTempSrc=e:this.host._roomHumSrc=e,this.host.requestUpdate()},i=this.host._roomSrcOpen===t;return p` - ${e||i?h` - ${i?h`
    + ${i?p`
    {this.host._roomSrcFilter=t.target.value,this.host.requestUpdate()}} />
    - ${this._roomSrcCandidates().map(t=>h`
    p`
    {s(t.value),this.host._roomSrcOpen=null}}> ${t.label}${t.sub}
    `)}
    -
    `:l}`:l}`}_renderRoomDialog(){const t=!!this.host._roomEditId,e=t?null:this.host._wallFaceBatch,s=e&&e.candidates.length>1?this.host._t("room.queue_progress",{current:e.index+1,total:e.candidates.length}):"",i=Os(this.host._curSpaceCfg),o=this.host._roomFill||i.fill,a=this.host._roomCustomFill||i.customFill,n=it(this.host._roomTempMin,this.host._roomTempMax).valid,r=(!!this.host._areaSel||!!this.host._nameSel.trim())&&n,c=[...this.host._freeAreas];if(t&&this.host._areaSel&&!c.some(t=>t.area_id===this.host._areaSel)){const t=this.host.hass.areas[this.host._areaSel];t&&c.unshift(t)}return h``:d}`:d}`}_renderRoomDialog(){const t=!!this.host._roomEditId,e=t?null:this.host._wallFaceBatch,s=e&&e.candidates.length>1?this.host._t("room.queue_progress",{current:e.index+1,total:e.candidates.length}):"",i=Ws(this.host._curSpaceCfg),o=this.host._roomFill||i.fill,a=this.host._roomCustomFill||i.customFill,n=nt(this.host._roomTempMin,this.host._roomTempMax).valid,r=(!!this.host._areaSel||!!this.host._nameSel.trim())&&n,l=[...this.host._freeAreas];if(t&&this.host._areaSel&&!l.some(t=>t.area_id===this.host._areaSel)){const t=this.host.hass.areas[this.host._areaSel];t&&l.unshift(t)}return p`this._roomDialogCancel()}>
    - ${s?h`

    + ${s?p`

    ${s} -

    `:l} +

    `:d} {this.host._areaSel=t.target.value,!this.host._nameSel&&this.host._areaSel&&(this.host._nameSel=this.host.hass.areas[this.host._areaSel]?.name||""),this.host.requestUpdate()}}> - ${c.map(t=>h``)} + ${l.map(t=>p``)} - ${[["","fill.inherit"],...oo.map(t=>[t,"fill."+t])].map(([t,e])=>h`
    `}const xr={color:"#607d8b",opacity:1,widthCm:3.6,fill:!1,fillColor:"#607d8b",fillOpacity:.25},Sr=(e,t=1)=>{const i=Number(e);return Number.isFinite(i)?Math.min(1,Math.max(0,i)):t},$r=e=>{let t=Number(e);return Number.isFinite(t)?(t=(t%360+360)%360,t>180?t-360:t):0};function Mr(e,t,i){return $r(t)?[e.x,e.y]:i([e.x,e.y])}function Rr(e,t,i,n){const r=Math.abs(i[0]-t[0]),o=Math.abs(i[1]-t[1]);return"line"===e?Math.hypot(r,o)>=n:r>=n&&o>=n}const Cr=(e,t,i)=>{const n=Number(e),r=Number.isFinite(t)&&t>0?t:5;return Number.isFinite(n)&&n>0?n/r*i:0},Tr=(e,t,i)=>{const n=Number(e),r=Number.isFinite(t)&&t>0?t:5;return Number.isFinite(n)&&i>0?n/i*r:0},Dr=(e,t,i,n=xr.widthCm)=>{const r=Number(e?.width_cm);if(Number.isFinite(r)&&r>0)return r;const o=Number(e?.width);return Number.isFinite(o)&&o>0?Tr(o,t,i):n};function Ar(e){const t=xr;return e.color===t.color&&e.opacity===t.opacity&&e.widthCm===t.widthCm&&e.fill===t.fill&&e.fillColor===t.fillColor&&e.fillOpacity===t.fillOpacity?null:{color:e.color,opacity:Sr(e.opacity),width_cm:Math.max(.1,Math.min(100,Number(e.widthCm)||.1)),fill:!!e.fill,fill_color:e.fillColor,fill_opacity:Sr(e.fillOpacity,.25)}}function Pr(e,t){return{color:e.color,opacity:Sr(e.opacity),width_cm:Math.max(.1,Math.min(100,Number(e.widthCm)||.1)),...t?{fill:e.fill,fill_color:e.fillColor,fill_opacity:Sr(e.fillOpacity,.25)}:{}}}function Fr(e){const t=e.x+e.w/2,i=e.y+e.h/2,n=$r(e.angle)*Math.PI/180,r=Math.cos(n),o=Math.sin(n),s=(e,n)=>{const s=e-t,a=n-i;return[t+s*r-a*o,i+s*o+a*r]};return[s(e.x,e.y),s(e.x+e.w,e.y),s(e.x+e.w,e.y+e.h),s(e.x,e.y+e.h)]}function zr(e){const t=Fr(e),i=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],n=[(t[0][0]+t[2][0])/2,(t[0][1]+t[2][1])/2];return{points:[...t,i(t[0],t[1]),i(t[1],t[2]),i(t[2],t[3]),i(t[3],t[0]),n],segments:t.map((e,i)=>({a:e,b:t[(i+1)%4]}))}}function Ir(e,t,i,n,r,o,s,a){const l=$r(e.angle)*Math.PI/180,c=Math.cos(l),h=Math.sin(l),d=-Math.sin(l),u=Math.cos(l),p=e.x+e.w/2,_=e.y+e.h/2,m=t>0?-e.w/2:e.w/2,g=i>0?-e.h/2:e.h/2,f=p+m*c+g*d,v=_+m*h+g*u,y=n-f,b=r-v;let w=(y*c+b*h)*(t>0?1:-1),k=(y*d+b*u)*(i>0?1:-1),x=null;if(o){const t=w/Math.max(e.w,a),i=k/Math.max(e.h,a);x=Math.max(a/Math.max(e.w,a),a/Math.max(e.h,a),t,i),w=e.w*x,k=e.h*x}if(s>0)if(o){const t=Math.max(1,Math.round(e.w/s)),i=Math.max(1,Math.round(e.h/s));if(Math.abs(e.w-t*s)<1e-6&&Math.abs(e.h-i*s)<1e-6){const n=(e,t)=>{let i=Math.abs(e),n=Math.abs(t);for(;n;)[i,n]=[n,i%n];return Math.max(1,i)},r=1/n(t,i),o=Math.max(a/e.w,a/e.h),s=Math.max(o,Math.round((x??1)/r)*r);w=e.w*s,k=e.h*s}else{e.w>=e.h?(w=Math.round(w/s)*s,k=w*(e.h/Math.max(e.w,a))):(k=Math.round(k/s)*s,w=k*(e.w/Math.max(e.h,a)))}}else w=Math.round(w/s)*s,k=Math.round(k/s)*s;w=Math.max(a,w),k=Math.max(a,k);return{x:f+(t>0?w/2:-w/2)*c+(i>0?k/2:-k/2)*d-w/2,y:v+(t>0?w/2:-w/2)*h+(i>0?k/2:-k/2)*u-k/2,w:w,h:k,angle:$r(e.angle)||void 0}}const Or=(e,t,i)=>{const n=i[0]-t[0],r=i[1]-t[1],o=n*n+r*r;if(o<1e-12)return[...t];const s=Math.max(0,Math.min(1,((e[0]-t[0])*n+(e[1]-t[1])*r)/o));return[t[0]+n*s,t[1]+r*s]};function Er(e,t,i,n){const r=n(e);let o=null;for(const r of t.points){const t=n(r),s=Math.hypot(t[0]-e[0],t[1]-e[1]);s<=i&&(!o||se.points),segments:e.flatMap(e=>e.segments)}}const Hr=Math.tan(.25*Math.PI/180);function Lr(e,t){const i=Math.abs(Number(t[0])-Number(e[0])),n=Math.abs(Number(t[1])-Number(e[1]));if(!([i,n].every(Number.isFinite)&&i>0&&n>0))return null;const r=i>=n?"horizontal":"vertical",o=Math.max(i,n),s=Math.min(i,n);return s/o>Hr?null:{axis:r,major:o,minor:s,angleDegrees:180*Math.atan2(s,o)/Math.PI}}function Br(e,t){const i=Lr(e,t);return i?"horizontal"===i.axis?[Number(t[0]),Number(e[1])]:[Number(e[0]),Number(t[1])]:[Number(t[0]),Number(t[1])]}const qr=e=>`${e[0]},${e[1]}`,jr=(e,t)=>e[0]===t[0]&&e[1]===t[1],Wr=(e,t)=>{const i=qr(e),n=qr(t);return i{let t=0;for(let i=0;i{if(e.length<3)return!1;for(let t=0;t1e-12},Vr=(e,t)=>jr(e,t.from)?[...t.to]:[...e],Kr=(e,t)=>e.map(e=>Array.isArray(e?.poly)?{...e,poly:e.poly.map(e=>Vr(e,t))}:e),Yr=(e,t,i)=>{const n=e.flatMap((e,t)=>ni(e)?.some(e=>jr(e,i.from))?[t]:[]);if(!n.length)return!1;for(const i of n){const n=ni(e[i]),r=ni(t[i]);if(!n||!r)continue;if(!Gr(r))return!1;const o=Math.sign(Ur(n)),s=Math.sign(Ur(r));if(o&&s&&o!==s)return!1}const r=new Set;for(const e of n){const i=ni(t[e]);if(i)for(let n=0;n{let i=0;for(const n of e){const e=ni(n);if(e)for(let n=0;n{const{a:i,b:n,axis:r}=e,o="horizontal"===r?{from:n,to:[n[0],i[1]]}:{from:n,to:[i[0],n[1]]},s="horizontal"===r?{from:i,to:[i[0],n[1]]}:{from:i,to:[n[0],i[1]]};return[{move:o,preservedDegree:Xr(t,i)},{move:s,preservedDegree:Xr(t,n)}].sort((e,t)=>t.preservedDegree-e.preservedDegree||qr(e.move.to).localeCompare(qr(t.move.to))||qr(e.move.from).localeCompare(qr(t.move.from))).map(e=>e.move)};function Jr(e){const t=JSON.parse(JSON.stringify(e||{}));let i=Array.isArray(t.rooms)?t.rooms:[];const n=new Map;for(const e of i){const t=ni(e);if(t)for(let e=0;ee.key.localeCompare(t.key))){let t=null;for(const n of Zr(e,i)){const e=a.get(qr(n.from));if(e&&e!==qr(n.to))continue;const r=Kr(i,n);if(Yr(i,r,n)){t=n,i=r;break}}t?(a.set(qr(t.from),qr(t.to)),r++,s=Math.max(s,Math.hypot(t.to[0]-t.from[0],t.to[1]-t.from[1]))):o++}t.rooms=i;for(const e of t.partitions||[]){if(!Array.isArray(e?.a)||!Array.isArray(e?.b))continue;const i=Lr(e.a,e.b);if(!i)continue;const n={key:String(e.id||Wr(e.a,e.b)),a:[...e.a],b:[...e.b],axis:i.axis};let a=null;for(const i of Zr(n,[{poly:[e.a,e.b]}])){const n=Vr(e.a,i),r=Vr(e.b,i),o=Math.hypot(r[0]-n[0],r[1]-n[1]);if(!(o>0))continue;const s=(t.openings||[]).filter(t=>"partition"===t?.host?.kind&&t.host.id===e.id).every(e=>{const t=Number(e.host.t),i=Number(e.length);return Number.isFinite(t)&&t>=0&&t<=1&&Number.isFinite(i)&&i>0&&t*o-i/2>=-1e-12&&t*o+i/2<=o+1e-12});if(s){a=i,e.a=n,e.b=r;break}}a?(r++,s=Math.max(s,Math.hypot(a.to[0]-a.from[0],a.to[1]-a.from[1]))):o++}return{space:t,report:{wallsStraightened:r,wallsStraightenSkipped:o,maxStraightenShift:s},changed:r>0}}const Qr=["rect","ellipse","furniture","image"],eo=10**9,to=240,io=1e-4;function no(e){if(Array.isArray(e))return e.map(e=>no(e));if(null!==e&&"object"==typeof e){const t={};for(const[i,n]of Object.entries(e))t[i]=no(n);return t}return e}function ro(e){if("number"!=typeof e||!Number.isFinite(e))return e;const t=(e<0||Object.is(e,-0)?-1:1)*(Math.floor(Math.abs(e)*eo+.5)/eo);return 0===t?0:t}function oo(e){if("number"!=typeof e||!Number.isFinite(e))return e;const t=e*to,i=Math.round(t);if(Math.abs(t-i)null!==ao(e)):[]}function co(e){return"string"==typeof e&&Qr.includes(e)}function ho(e,t){for(const i of t)Object.prototype.hasOwnProperty.call(e,i)&&(e[i]=ro(e[i]))}function uo(e,t){for(const i of t)Object.prototype.hasOwnProperty.call(e,i)&&(e[i]=oo(e[i]))}function po(e){if(Array.isArray(e))for(let t=0;t{for(const r of n){const n=t[r];"number"==typeof n&&Number.isFinite(n)&&i(n,e)}},n=t=>{if(Array.isArray(t))for(let n=0;n{if(Array.isArray(e))for(const t of e)n(t)};for(const i of lo(e.rooms))t(i,["x","y","w","h"]),r(i.poly);for(const t of lo(e.walls))n(t.a),n(t.b);for(const t of lo(e.wall_segments))n(t.a),n(t.b);for(const i of lo(e.openings))t(i,["x","y"]);for(const i of lo(e.decor))"line"===i.kind?t(i,["x1","y1","x2","y2"]):co(i.kind)?t(i,["x","y","w","h"]):"text"===i.kind&&t(i,["x","y"]);for(const t of lo(e.room_drafts))r(t.points);for(const t of lo(e.partitions))n(t.a),n(t.b);for(const t of lo(e.wall_columns))n(t.center);for(const t of lo(e.open_spans))n(t.a),n(t.b)}const r=ao(t);if(!r)return;const o=new Map;if(n)for(const e of lo(n.spaces))null!=e.id&&o.set(String(e.id),e);for(const e of Object.values(r)){const t=ao(e);if(!t)continue;const n=null!=t.s&&o.get(String(t.s))||null;for(const e of["x","y"]){const r=t[e];"number"==typeof r&&Number.isFinite(r)&&i(r,n)}}}function go(e){const t=Number(e?.cell_cm);return t>0?t:5}function fo(e,t={}){const i={canonicalized:0,far:0,maxShift:0,maxShiftCm:0,spaces:[],bySpace:new Map},n=lo(ao(e)?.spaces);let r=5;for(const e of n)r=Math.max(r,go(e));mo(e,t,(e,t)=>{const n=e*to,o=Math.abs(n-Math.round(n)),s=oo(e),a=o>0&&o=io))return;const l=a&&"number"==typeof s?Math.abs(s-e):0;if(a?i.canonicalized++:i.far++,i.maxShift=Math.max(i.maxShift,l),i.maxShiftCm=Math.max(i.maxShiftCm,l*to*(t?go(t):r)),!t?.id||!a)return;const c=String(t.id);let h=i.bySpace.get(c);h||(h={spaceId:c,space:String(t.title||c),canonicalized:0,far:0,maxShift:0,maxShiftCm:0},i.bySpace.set(c,h)),h.canonicalized++,h.maxShift=Math.max(h.maxShift,l),h.maxShiftCm=Math.max(h.maxShiftCm,l*to*go(t))}),i.bySpace.size&&mo(e,t,(e,t)=>{if(!t?.id)return;const n=i.bySpace.get(String(t.id));if(!n)return;const r=e*to;Math.abs(r-Math.round(r))>=io&&n.far++}),i.spaces=[...i.bySpace.values()];const{bySpace:o,...s}=i;return s}function vo(e){return function(e){const t=e,i=ao(t);i&&uo(i,["x","y"]);return t}(no(e))}function yo(e){const t=e,i=ao(t);if(!i)return t;for(const e of Object.values(i)){const t=ao(e);t&&uo(t,["x","y"])}return t}function bo(e){return wo(no(e))}function wo(e){const t=e,i=ao(t);if(!i)return t;for(const e of lo(i.spaces)){ho(e,["plan_x","plan_y","plan_scale","plan_scale_x","plan_scale_y","plan_angle"]);for(const t of lo(e.rooms))uo(t,["x","y","w","h"]),_o(t.poly);for(const t of lo(e.walls))po(t.a),po(t.b);for(const t of lo(e.wall_segments))po(t.a),po(t.b);for(const t of lo(e.openings)){uo(t,["x","y"]),ho(t,["angle","length"]);const e=ao(t.host);e&&ho(e,["t"])}for(const t of lo(e.decor))"line"===t.kind?uo(t,["x1","y1","x2","y2"]):co(t.kind)?(uo(t,["x","y","w","h"]),ho(t,["angle"])):"text"===t.kind&&(uo(t,["x","y"]),ho(t,["scale","angle"]));for(const t of lo(e.room_drafts))_o(t.points);for(const t of lo(e.partitions))po(t.a),po(t.b);for(const t of lo(e.wall_columns))po(t.center),"square"===t.shape&&ho(t,["angle"]);for(const t of lo(e.open_spans))po(t.a),po(t.b)}for(const e of lo(i.markers))ho(e,["angle"]);return t}const ko=15,xo=8;function So(e,t,i,n,r){const o=i[0]-e[0],s=i[1]-e[1],a=Math.hypot(o,s);if(!(a>0)||a<=r+1e-9)return null;const l=o/a,c=s/a,h=t=>{const n=(t[0]-e[0])*l+(t[1]-e[1])*c,o=(r-n)/(a-n);return!Number.isFinite(o)||o<-1e-9||o>1+1e-9?null:[t[0]+(i[0]-t[0])*o,t[1]+(i[1]-t[1])*o]},d=h(t),u=h(n);return d&&u?[[e[0],e[1]],t,d,u,n]:null}const $o=Math.sin(.25*Math.PI/180);function Mo(e,t){return Number.isFinite(e)&&e>0&&Number.isFinite(t)&&t>0&&e*t<3}function Ro(e){const t=Number(e)>0?Number(e):5;if(5===t)return 8;const i=5/t*8;return Math.min(80,Math.max(.5,i))}function Co(e,t){return Number.isFinite(e)&&e>0&&Number.isFinite(t)&&t>0&&e*t<2}function To(e){return Number.isFinite(e)?Math.max(1,Math.min(100,e)):1}function Do(e,t){return!Number.isFinite(e)||e<0?"":String(t?Math.round(e/2.54*100)/100:Math.round(100*e)/100)}function Ao(e,t,i){if(!Number.isFinite(e)||e<=0)return 0;const n=Number(t)>0?Number(t):5;return To(e)/n*i}function Po(e,t){return t>0&&Number.isFinite(e)?Math.round(e/t)*t:e}function Fo(e){return Math.max(1e-6*Math.abs(e),1e-9)}function zo(e,t){if(!(t>0&&Number.isFinite(e)))return e;const i=Po(e,t);return Math.abs(i-e)<=Fo(t)?i:e}function Io(e,t){let i=t[0]-e[0],n=t[1]-e[1];const r=Math.hypot(i,n);return r<1e-12?[1,0]:(i/=r,n/=r,(i<-1e-12||Math.abs(i)<=1e-12&&n<0)&&(i=-i,n=-n),[i,n])}function Oo(e,t,i){const n=[zo(e[0],i),zo(e[1],i)],r=[zo(t[0],i),zo(t[1],i)],o=Po((n[0]+r[0])/2,i),s=Po((n[1]+r[1])/2,i),[a,l]=Io(n,r);let c=Math.atan2(l,a);c<0&&(c+=Math.PI);const h=Math.round(1800*c)/1800,d=i>0&&i<.01?6:i<1?4:2;return`${o.toFixed(d)},${s.toFixed(d)}@${h.toFixed(4)}`}function Eo(e,t,i,n){return 1===n?Oo(e,t,i):Oo([e[0]/n,e[1]/n],[t[0]/n,t[1]/n],i)}function No(e,t){if(!Array.isArray(e.a)||!Array.isArray(e.b)||e.a.length<2||e.b.length<2)return null;const i=[Number(e.a[0]),Number(e.a[1]),Number(e.b[0]),Number(e.b[1])];if(!i.every(Number.isFinite))return null;const n=t>0?t:1;return[[i[0]*n,i[1]*n],[i[2]*n,i[3]*n]]}function Ho(e,t,i,n,r){const o=r>0?r:1;return{key:Eo(e,t,n,o),cm:To(i),a:[e[0]/o,e[1]/o],b:[t[0]/o,t[1]/o]}}function Lo(e,t){const i=t>0?t:1,n=[];for(const t of e){const e=t.key.lastIndexOf("@");if(e<0)continue;const[r,o]=t.key.slice(0,e).split(",").map(Number),s=Number(t.key.slice(e+1));[r,o,s].every(Number.isFinite)&&n.push({w:t,x:r*i,y:o*i,ang:s})}return n}function Bo(e,t){const[i,n]=Io(e,t);let r=Math.atan2(n,i);return r<0&&(r+=Math.PI),r}function qo(e,t){let i=Math.abs(e-t);return i>Math.PI/2&&(i=Math.PI-i),i<.02}function jo(e,t,i,n,r=1){if(!e?.length)return null;const o=Eo(t,i,n,r),s=e.find(e=>e.key===o);if(s)return s;const a=r>0?r:1,l=Fo(n)*a,c=(e,t)=>Math.abs(e[0]-t[0])<=l&&Math.abs(e[1]-t[1])<=l;for(const n of e){const e=No(n,a);if(e&&(c(e[0],t)&&c(e[1],i)||c(e[0],i)&&c(e[1],t)))return n}const h=(t[0]+i[0])/2,d=(t[1]+i[1])/2,u=Bo(t,i),p=Math.max(.5*n,1e-9)*a;for(const t of Lo(e,a))if(qo(t.ang,u)&&Math.hypot(t.x-h,t.y-d)<=p)return t.w;return null}function Wo(e,t,i,n,r=1){const o=jo(e,t,i,n,r);if(o&&o.cm>0)return To(o.cm);const s=function(e,t,i,n,r){if(!e?.length)return null;const o=r>0?r:1,s=Math.hypot(i[0]-t[0],i[1]-t[1]);if(s<1e-12)return null;const a=Bo(t,i),l=Math.max(.5*n,1e-9)*o;let c=null;for(const n of e){if(!(n.cm>0))continue;const e=No(n,o);if(!e)continue;const r=Math.hypot(e[1][0]-e[0][0],e[1][1]-e[0][1]);if(r<1e-12||!qo(Bo(e[0],e[1]),a))continue;if(Fs(t[0],t[1],e[0][0],e[0][1],e[1][0],e[1][1])>l||Fs(i[0],i[1],e[0][0],e[0][1],e[1][0],e[1][1])>l)continue;if(r+l(o.has(e.key)||(e=>{const t=No(e,n);if(!t)return!1;const[i,o]=t,a=o[0]-i[0],c=o[1]-i[1],h=Math.hypot(a,c);if(h<=l)return!1;if(!s.some(e=>{const t=[e[0],e[1]],n=[e[2],e[3]];return qo(Bo(i,o),Bo(t,n))&&Fs(i[0],i[1],t[0],t[1],n[0],n[1])<=l&&Fs(o[0],o[1],t[0],t[1],n[0],n[1])<=l}))return!1;const d=(r||[]).some(e=>{const t=[e[0],e[1]],n=[e[2],e[3]];if(!qo(Bo(i,o),Bo(t,n)))return!1;const r=e=>Math.abs((e[0]-i[0])*c-(e[1]-i[1])*a)/h;if(r(t)>l||r(n)>l)return!1;const s=h*h,d=((t[0]-i[0])*a+(t[1]-i[1])*c)/s,u=((n[0]-i[0])*a+(n[1]-i[1])*c)/s;return Math.min(1,Math.max(d,u))-Math.max(0,Math.min(d,u))>l/h});return!d})(e))&&e.cm>=1&&e.cm<=100)}function Go(e,t,i,n=8){const[r,o]=Io(e,t);let s=Math.atan2(o,r);s<0&&(s+=Math.PI);let a=i*Math.PI/180%Math.PI;a<0&&(a+=Math.PI);let l=Math.abs(s-a);return l>Math.PI/2&&(l=Math.PI-l),l<=n*Math.PI/180}function Vo(e,t,i,n,r=1,o="affine",s){if(!e?.length)return[];if(t.length!==i.length)return"fixed-topology"===o&&s?.(),e.slice();const a=r>0?r:1,l=Math.max(.5*n,1e-9)*a,c=Math.max(n*a*1e-6,1e-9),h=[],d=new Map,u=new Map,p=(e,t,i)=>{const n=e.get(t)||new Set;n.add(i),e.set(t,n)};for(let e=0;e[e[0]+(t[0]-e[0])*i,e[1]+(t[1]-e[1])*i],m=(e,t)=>Math.hypot(e[0]-t[0],e[1]-t[1])<=c,g=(e,t)=>{if("fixed-topology"===o){const i=t.na[0]-t.oa[0],n=t.na[1]-t.oa[1],r=t.nb[0]-t.ob[0],o=t.nb[1]-t.ob[1];return Math.hypot(i-r,n-o)<=c?[e[0]+i,e[1]+n]:m(e,t.oa)?[...t.na]:m(e,t.ob)?[...t.nb]:[...e]}const i=Math.max(0,Math.min(1,((e[0]-t.oa[0])*t.dx+(e[1]-t.oa[1])*t.dy)/t.len2));return _(t.na,t.nb,i)},f=(e,t)=>{const[i,n]=Io(e,t);return(t[0]-e[0])*i+(t[1]-e[1])*n>=0?[[...e],[...t]]:[[...t],[...e]]},v=[],y=[],b=(e,t,i)=>{if(Math.hypot(t[0]-e[0],t[1]-e[1])<=c)return;const[r,o]=f(e,t),s=To(i);if(y.some(e=>e.entry.cm===s&&m(e.span[0],r)&&m(e.span[1],o)))return;const l=Ho(r,o,s,n,a);v.push(l),y.push({entry:l,span:[r,o]})};for(const t of e){const e=No(t,a);if(e){const[i,n]=f(e[0],e[1]),r=n[0]-i[0],s=n[1]-i[1],a=r*r+s*s,d=Math.sqrt(a);if(d<=c){v.push({...t,cm:To(t.cm)});continue}const u=[];for(const e of h){if(!qo(Bo(i,n),Bo(e.oa,e.ob)))continue;const t=e=>Math.abs((e[0]-i[0])*s-(e[1]-i[1])*r)/d;if(t(e.oa)>l||t(e.ob)>l)continue;const o=((e.oa[0]-i[0])*r+(e.oa[1]-i[1])*s)/a,h=((e.ob[0]-i[0])*r+(e.ob[1]-i[1])*s)/a,p=Math.max(0,Math.min(o,h)),_=Math.min(1,Math.max(o,h));(_-p)*d>c&&u.push({lo:p,hi:_,move:e})}if(!u.length){"fixed-topology"===o?v.push({...t}):b(i,n,t.cm);continue}const p=[0,1,...u.flatMap(({lo:e,hi:t})=>[e,t])].sort((e,t)=>e-t).filter((e,t,i)=>0===t||Math.abs(e-i[t-1])*d>c),y=[];for(let e=0;e+1a>=e.lo-1e-12&&a<=e.hi+1e-12);if(!l.length){y.push([o,s]);continue}const h=[g(o,l[0].move),g(s,l[0].move)],f=l.slice(1).some(e=>{const t=g(o,e.move),i=g(s,e.move);return!m(h[0],t)||!m(h[1],i)});y.push(f?[o,s]:h)}const w=(e,t)=>{const i=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.hypot(i,n);return!(s<=c||i*r+n*o<=0)&&Math.abs(i*o-n*r)/s<=c},k=[];for(const e of y){const t=k[k.length-1];t&&m(t[1],e[0])&&w(t,e)?t[1]=e[1]:k.push([[...e[0]],[...e[1]]])}if("fixed-topology"===o&&1===k.length){const[i,n]=k[0];if(m(i,e[0])&&m(n,e[1])||m(i,e[1])&&m(n,e[0])){v.push({...t});continue}}for(const[e,i]of k)b(e,i,t.cm);continue}if("fixed-topology"===o){const e=u.get(t.key);if(1===e?.size){const i=[...e][0];v.push(i===t.key?{...t}:{...t,key:i});continue}const i=[Lo([t],a)[0]];1!==a&&i.push(Lo([t],1)[0]);const n=i.filter(Boolean).some(e=>h.some(t=>{if(!qo(e.ang,Bo(t.oa,t.ob)))return!1;const i=((e.x-t.oa[0])*t.dx+(e.y-t.oa[1])*t.dy)/t.len2;return i>=-1e-6&&i<=1.000001&&Fs(e.x,e.y,t.oa[0],t.oa[1],t.ob[0],t.ob[1])<=l}));((e?.size||0)>1||n)&&s?.(),v.push({...t});continue}let i="";const r=d.get(t.key);if(1===r?.size&&(i=[...r][0]),!i){const e=Lo([t],a)[0];if(e){const t=new Set;for(const i of h){if(!qo(e.ang,Bo(i.oa,i.ob)))continue;const r=((e.x-i.oa[0])*i.dx+(e.y-i.oa[1])*i.dy)/i.len2;if(r<-1e-6||r>1.000001)continue;if(Fs(e.x,e.y,i.oa[0],i.oa[1],i.ob[0],i.ob[1])>l)continue;const o=g([e.x,e.y],i),[s,c]=Io(i.na,i.nb),h=Math.max(n*a,1e-6);t.add(Eo([o[0]-s*h,o[1]-c*h],[o[0]+s*h,o[1]+c*h],n,a))}1===t.size&&(i=[...t][0])}}v.push({...t,key:i||t.key,cm:To(t.cm)})}return v}function Ko(e,t,i,n,r=1,o="affine"){return Vo(e,t,i,n,r,o)}function Yo(e,t,i,n,r=1,o="fixed-topology"){let s=!1;const a=Vo(e,t,i,n,r,o,()=>{s=!0});return{walls:s?(e||[]).map(e=>({...e})):a,rejected:s}}function Xo(e,t,i,n=1,r=[]){const o=n>0?n:1,s=Math.abs(i),a=Math.max(s*o*io,1e-9),l=(r||[]).flatMap(e=>{const t=No(e,o);return t?t.map(e=>[...e]):[]}),c=e=>e.every((e,t)=>(e=>{if(!(s>0))return!0;const t=e/o/s;return Math.abs(t-Math.round(t))Math.abs(e-i[t])<=a)),h=[],d=e=>JSON.stringify([e.key,e.cm,e.a,e.b]);for(const i of e||[]){const e=No(i,o);if(!e)continue;const[n,r]=e;if(![n[0],n[1],r[0],r[1]].every(Number.isFinite)||!c(n)||!c(r)){h.push(d(i));continue}const s=r[0]-n[0],l=r[1]-n[1],u=Math.hypot(s,l);if(u<=a){h.push(d(i));continue}const p=s/u,_=l/u,m=[];for(const e of t){const[t,i]=e;if(![t?.[0],t?.[1],i?.[0],i?.[1]].every(Number.isFinite))continue;const r=e=>Math.abs((e[0]-n[0])*_-(e[1]-n[1])*p);if(r(t)>a||r(i)>a)continue;const o=(t[0]-n[0])*p+(t[1]-n[1])*_,s=(i[0]-n[0])*p+(i[1]-n[1])*_,l=Math.max(0,Math.min(o,s)),c=Math.min(u,Math.max(o,s));c-l>a&&m.push([l,c])}m.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let g=0;for(const[e,t]of m){if(e>g+a)break;if(g=Math.max(g,t),g>=u-a)break}ge.key!==s);return null==n||n<1?a:[...a,Ho(t,i,n,r,o)]}function Jo(e,t,i,n,r,o=[],s=1){let a=e?e.slice():[];for(const e of function(e,t,i,n,r=1,o=[]){const s=ys(e,t,i,n,r,o);if(!s)return[];const a=[];for(let e=0;e0||(c=Zo(c,t,i,n,r,s)))}return c}function es(e){const{a:t,b:i,halfDepth:n}=e;if(!Array.isArray(t)||!Array.isArray(i)||t.length<2||i.length<2||![t[0],t[1],i[0],i[1]].every(Number.isFinite))return null;const r=i[0]-t[0],o=i[1]-t[1],s=Math.hypot(r,o);if(!(s>1e-9&&n>0&&Number.isFinite(n)))return null;const a=-o/s*n,l=r/s*n;return[[t[0]+a,t[1]+l],[i[0]+a,i[1]+l],[i[0]-a,i[1]-l],[t[0]-a,t[1]-l]]}function ts(e,t,i){return Math.hypot(e[0]-t[0],e[1]-t[1])<=i}function is(e,t,i){const n=t.b[0]-t.a[0],r=t.b[1]-t.a[1],o=n*n+r*r;if(!(o>i*i))return!1;const s=((e[0]-t.a[0])*n+(e[1]-t.a[1])*r)/o;if(!(s>0&&s<1))return!1;const a=[t.a[0]+n*s,t.a[1]+r*s];return Math.hypot(e[0]-a[0],e[1]-a[1])<=i}function ns(e,t,i,n){const r=Math.hypot(t,i);if(!(r>1e-9&&n>0))return;const o=[t/r,i/r],s=e.find(e=>Math.abs(e.u[0]*o[1]-e.u[1]*o[0])<1e-9&&e.u[0]*o[0]+e.u[1]*o[1]>1-1e-9);s?s.halfDepth=Math.max(s.halfDepth,n):e.push({u:o,halfDepth:n})}function rs(e,t){try{const i=Gt(Os(e),Os(t));let n=null,r=0;for(const e of i||[]){const t=e?.[0]||[],i=Math.abs(hs(t));t.length>=4&&i>r&&(r=i,n=t.slice(0,-1).map(e=>[e[0],e[1]]))}return n}catch{return null}}function os(e,t=1e-6){const i=(e||[]).map((e,t)=>({segment:e,index:t})).filter(({segment:e})=>e&&Array.isArray(e.a)&&Array.isArray(e.b)&&e.a.length>=2&&e.b.length>=2&&e.a.every(Number.isFinite)&&e.b.every(Number.isFinite)&&Number.isFinite(e.halfDepth)&&e.halfDepth>0&&Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])>1e-9);if(i.length<2)return[];const n=Math.max(Number.isFinite(t)?t:0,1e-9),r=i.flatMap(({segment:e})=>[e.a,e.b]).map(e=>[e[0],e[1]]).sort((e,t)=>e[0]-t[0]||e[1]-t[1]),o=[];for(const e of r)o.some(t=>ts(t,e,n))||o.push(e);const s=[];for(const e of o){const t=[];let r=!1;for(const{segment:o,index:s}of i){const i=Math.hypot(o.b[0]-o.a[0],o.b[1]-o.a[1]);ts(e,o.a,n)?t.push({u:[(o.b[0]-o.a[0])/i,(o.b[1]-o.a[1])/i],halfDepth:o.halfDepth,length:i,index:s}):ts(e,o.b,n)?t.push({u:[(o.a[0]-o.b[0])/i,(o.a[1]-o.b[1])/i],halfDepth:o.halfDepth,length:i,index:s}):is(e,o,n)&&(r=!0)}if(r||2!==t.length)continue;const[o,a]=t,l=o.u[0]*a.u[1]-o.u[1]*a.u[0];if(Math.abs(l)<1e-9)continue;const c=l<0?1:-1,h=[-o.u[1],o.u[0]],d=[-a.u[1],a.u[0]],u=[e[0]+h[0]*o.halfDepth*c,e[1]+h[1]*o.halfDepth*c],p=[e[0]-d[0]*a.halfDepth*c,e[1]-d[1]*a.halfDepth*c];if(!ps(u,o.u,p,a.u))continue;const _=[[o,a,p,[d[0]*-c,d[1]*-c]],[a,o,u,[h[0]*c,h[1]*c]]];for(const[t,,i,r]of _){const o=Math.min(2*t.halfDepth,t.length),a=[-t.u[1]*t.halfDepth,t.u[0]*t.halfDepth],l=[[e[0]+a[0],e[1]+a[1]],[e[0]+t.u[0]*o+a[0],e[1]+t.u[1]*o+a[1]],[e[0]+t.u[0]*o-a[0],e[1]+t.u[1]*o-a[1]],[e[0]-a[0],e[1]-a[1]]],c=e=>(e[0]-i[0])*r[0]+(e[1]-i[1])*r[1],h=[];for(let e=0;e=-1e-12&&h.push(t),n>1e-12&&r<-1e-12||n<-1e-12&&r>1e-12){const e=n/(n-r);h.push([t[0]+(i[0]-t[0])*e,t[1]+(i[1]-t[1])*e])}}h.length>=3&&Math.abs(hs(h))>n*n&&s.push({segmentIndex:t.index,wedge:h})}}return s}function ss(e,t=1e-6){const i=(e||[]).filter(e=>e&&Array.isArray(e.a)&&Array.isArray(e.b)&&e.a.length>=2&&e.b.length>=2&&e.a.every(Number.isFinite)&&e.b.every(Number.isFinite)&&Number.isFinite(e.halfDepth)&&e.halfDepth>0&&Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])>1e-9);if(i.length<2)return[];const n=Math.max(Number.isFinite(t)?t:0,1e-9),r=i.flatMap(e=>[e.a,e.b]).map(e=>[e[0],e[1]]).sort((e,t)=>e[0]-t[0]||e[1]-t[1]),o=[];for(const e of r)o.some(t=>ts(t,e,n))||o.push(e);const s=[],a=i.map((e,t)=>({roomId:"",a:[e.a[0],e.a[1]],b:[e.b[0],e.b[1]],key:`join-${t}`,kind:"outer",cm:0,open:!1,half:e.halfDepth})),l=Ss(a,n);for(const e of $s(l).fans)s.push(e);const c=e=>!!Ms(l,e);for(const e of o){if(c(e))continue;const t=[];for(const r of i)ts(e,r.a,n)?ns(t,r.b[0]-r.a[0],r.b[1]-r.a[1],r.halfDepth):ts(e,r.b,n)?ns(t,r.a[0]-r.b[0],r.a[1]-r.b[1],r.halfDepth):is(e,r,n)&&(ns(t,r.a[0]-e[0],r.a[1]-e[1],r.halfDepth),ns(t,r.b[0]-e[0],r.b[1]-e[1],r.halfDepth));if(!(t.length<2)){t.sort((e,t)=>Math.atan2(e.u[1],e.u[0])-Math.atan2(t.u[1],t.u[0])||e.halfDepth-t.halfDepth);for(let i=0;in*n&&s.push(m)}}}return s}function as(e,t,i,n){if(!(t>0)||!e||e.length<2)return"";if(i&&e.length>=3){let i=e;const r=e[e.length-1];if(e.length>=4&&Math.hypot(e[0][0]-r[0],e[0][1]-r[1])<1e-9&&(i=e.slice(0,-1)),i.length>=3){const e=i.map((e,i)=>n?.[i]||t),r=ia(i,e),o=gs(i,e);if(r&&o)return`${fs(r)} ${fs(vs(o))}`}}const r=[];for(let i=0;i=1e-9&&a>0&&r.push({a:o,b:s,halfDepth:a})}const o=r.map(es);for(const{segmentIndex:e,wedge:t}of os(r)){const i=o[e];if(!i)continue;const n=rs(i,t);n&&(o[e]=n)}const s=[...o.filter(e=>!!e),...ss(r)],a=function(e){let t=null;try{for(const i of e){if(i.length<3)continue;const e=Os(i);t=t?Wt(t,e):[e]}return t}catch{return null}}(s);return a?Ks(a):s.map(e=>fs(e)).join(" ")}function ls(e,t,i,n,r=1){if(!i.length)return!1;const o=cs(n,r),s=(e[0]+t[0])/2,a=(e[1]+t[1])/2,[l,c]=Io(e,t);for(const e of i){const[t,i]=Io([e[0],e[1]],[e[2],e[3]]);if(!(Math.abs(l*i-c*t)>.05)&&Fs(s,a,e[0],e[1],e[2],e[3])<=o)return!0}return!1}function cs(e,t){return Math.max(e*(t>0?t:1)*.04,1e-9)}function hs(e){let t=0;for(let i=0;ie[1]!=l>e[1]&&e[0]<(a-o)*(e[1]-s)/(l-s+0)+o&&(i=!i)}return i}([c[0]+.001*a,c[1]+.001*l],e)||(a=-a,l=-l),[a,l]}function us(e,t){const i=e[0]*t[1]-e[1]*t[0],n=e[0]*t[0]+e[1]*t[1];return Math.abs(i)<1e-9&&n>0}function ps(e,t,i,n){const r=t[0]*n[1]-t[1]*n[0];if(Math.abs(r)<1e-12)return null;const o=[i[0]-e[0],i[1]-e[1]],s=(o[0]*n[1]-o[1]*n[0])/r;return[e[0]+s*t[0],e[1]+s*t[1]]}function _s(e,t,i){const n=e?.length||0;if(n<3||!Array.isArray(i)||i.length!==n)return 0;const r=(Math.trunc(t)%n+n)%n,o=e[r],s=e[(r+1)%n],a=s[0]-o[0],l=s[1]-o[1],c=Math.hypot(a,l);if(!(c>0))return 0;const h=Math.max(0,Number(i[r])||0);if(!(h>0))return c;const d=[a/c,l/c],u=ds(e,r),p=[o[0]+u[0]*h,o[1]+u[1]*h],_=t=>{const r=Math.max(0,Number(i[t])||0);if(!(r>0))return null;const s=e[t],a=e[(t+1)%n],l=a[0]-s[0],c=a[1]-s[1],h=Math.hypot(l,c);if(!(h>0))return null;const u=ds(e,t),_=ps(p,d,[s[0]+u[0]*r,s[1]+u[1]*r],[l/h,c/h]);return _?(_[0]-o[0])*d[0]+(_[1]-o[1])*d[1]:null},m=_((r-1+n)%n)??0,g=(_((r+1)%n)??c)-m;return g>0?g:0}function ms(e,t,i,n,r,o,s,a=1){const l=(e||[]).find(e=>e?.id===t),c=ni(l);if(!c||c.length<3)return null;const h=Cs(e,t,i,n,r,o,s,a);if(!h)return c.map(()=>0);const d=4*cs(r,a);return c.map((e,t)=>{const i=c[(t+1)%c.length],n=[(e[0]+i[0])/2,(e[1]+i[1])/2];for(let e=0;e!(e>0)))return e.map(e=>[e[0],e[1]]);const r=[];for(let o=0;o0||u>0)){r.push([e[o][0],e[o][1]]);continue}if(d>0!=u>0){const t=e[o],i=d>0?[t[0]+p*d,t[1]+_*d]:[t[0],t[1]],n=u>0?[t[0]+m*u,t[1]+g*u]:[t[0],t[1]];r.push(i),Math.hypot(n[0]-i[0],n[1]-i[1])>1e-9&&r.push(n);continue}if(us(w,k)){const t=e[o],i=[t[0]+p*d,t[1]+_*d],n=[t[0]+m*u,t[1]+g*u];r.push(i),Math.hypot(n[0]-i[0],n[1]-i[1])>1e-9&&r.push(n);continue}const $=ps(x,w,S,k),M=Math.max(d,u,1e-9),R=Ms(i,e[o])?.limit??4*M;if($){const i=Math.hypot($[0]-e[o][0],$[1]-e[o][1]);if(Number.isFinite(i)&&i<=R){r.push($);continue}if(Xs(e,t,o)){r.push($);continue}}d>0&&r.push([e[o][0]+p*d,e[o][1]+_*d]),u>0&&r.push([e[o][0]+m*u,e[o][1]+g*u]),d>0||u>0||r.push([e[o][0],e[o][1]])}return r.length>=3?r:null}function fs(e,t=!0){if(!e.length)return"";let i=`M ${e[0][0]} ${e[0][1]}`;for(let t=1;te?.id===t),a=ni(s);if(!a||a.length<3)return null;const l=cs(n,r),c=[];for(const i of e||[]){if(!i||i.id===t)continue;const e=ni(i);if(e)for(const t of An(a,e,l))c.push([t[0],t[1]],[t[2],t[3]])}for(const e of i||[])c.push([e[0],e[1]],[e[2],e[3]]);for(const e of o||[]){const t=No(e,r);t&&c.push(t[0],t[1])}const h=[],d=[];for(let e=0;el)continue;const s=((e[0]-t[0])*(i[0]-t[0])+(e[1]-t[1])*(i[1]-t[1]))/(n*n);s<=r||s>=1-r||(o.some(e=>Math.abs(e-s)*n<=2*l)||o.push(s))}o.sort((e,t)=>e-t);for(const n of o)h.push([t[0]+(i[0]-t[0])*n,t[1]+(i[1]-t[1])*n]),d.push(e)}return{poly:h,parent:d,orig:a}}function bs(e,t,i,n){const r=t.poly.length,o=new Array(r).fill(0);if(!e?.length)return o;const s=new Set,a=[];for(let l=0;l0?(o[l]=To(c.cm),s.add(c.key)):a.push(l)}if(!a.length)return o;const l=n>0?n:1,c=Math.max(.5*i,1e-9)*l,h=Lo(e,l).filter(e=>e.w.cm>0);for(let e=a.length-1;e>=0;e--){const i=a[e],n=t.poly[i],s=t.poly[(i+1)%r],d=Bo(n,s);let u=null;for(const e of h){const t=No(e.w,l);if(!t||!qo(Bo(t[0],t[1]),d))continue;if(Fs(n[0],n[1],t[0][0],t[0][1],t[1][0],t[1][1])>c||Fs(s[0],s[1],t[0][0],t[0][1],t[1][0],t[1][1])>c)continue;const i=Math.hypot(s[0]-n[0],s[1]-n[1]),r=Math.hypot(t[1][0]-t[0][0],t[1][1]-t[0][1]),o=Math.max(0,r-i);(!u||oc||Fs(r[0],r[1],t[0][0],t[0][1],t[1][0],t[1][1])>c)continue;i=!0,o=Math.max(0,Math.hypot(t[1][0]-t[0][0],t[1][1]-t[0][1])-_)}else{if(Fs(e.x,e.y,n[0],n[1],r[0],r[1])>c)continue;o=Math.hypot(e.x-d,e.y-u)}(!p||i&&!p.exact||i===p.exact&&o0?i:1,o=(e||[]).filter(e=>e&&!e.open&&null!==e.kind&&Number.isFinite(e.half)&&e.half>0&&Array.isArray(e.a)&&Array.isArray(e.b)&&e.a.length>=2&&e.b.length>=2&&[e.a[0],e.a[1],e.b[0],e.b[1]].every(Number.isFinite)&&Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])>n).sort((e,t)=>e.key.localeCompare(t.key)||e.a[0]-t.a[0]||e.a[1]-t.a[1]||e.b[0]-t.b[0]||e.b[1]-t.b[1]||e.half-t.half),s=new Map;for(const e of o){const t=s.get(e.key);t?e.half>t.half&&s.set(e.key,{...t,half:e.half}):s.set(e.key,e)}const a=[...s.values()].flatMap(e=>[{point:[e.a[0],e.a[1]],other:e.b,halfDepth:e.half,kind:e.kind,key:e.key},{point:[e.b[0],e.b[1]],other:e.a,halfDepth:e.half,kind:e.kind,key:e.key}]).sort((e,t)=>e.point[0]-t.point[0]||e.point[1]-t.point[1]||e.other[0]-t.other[0]||e.other[1]-t.other[1]||e.halfDepth-t.halfDepth),l=new Map;for(const e of a){const[t,i]=ws(e.point,n),r=ks(t,i),o=l.get(r)||[];o.push(e),l.set(r,o)}const c=[],h=new Map;for(const e of a){const t=xs(h,e.point,n).filter(t=>Math.hypot(t.point[0]-e.point[0],t.point[1]-e.point[1])<=n).sort((t,i)=>Math.hypot(t.point[0]-e.point[0],t.point[1]-e.point[1])-Math.hypot(i.point[0]-e.point[0],i.point[1]-e.point[1])||t.point[0]-i.point[0]||t.point[1]-i.point[1]);let i=t[0];if(!i){i={point:[...e.point],rays:[]},c.push(i);const[t,r]=ws(i.point,n),o=ks(t,r),s=h.get(o)||[];s.push(i),h.set(o,s)}const r=e.other[0]-e.point[0],o=e.other[1]-e.point[1],s=Math.hypot(r,o);if(!(s>n))continue;const a=[r/s,o/s];let l=Math.atan2(a[1],a[0]);l<0&&(l+=2*Math.PI),i.rays.push({u:a,halfDepth:e.halfDepth,length:s,angle:l})}const d=[],u=e=>{const t=1e-9*Math.max(1,r),i=e.filter(e=>Number.isFinite(e.halfDepth)&&e.halfDepth>0&&Number.isFinite(e.length)&&e.length>n);return i.filter((e,n)=>!i.some((i,r)=>r!==n&&i.halfDepth>=e.halfDepth-t&&i.length>=e.length-t&&(i.halfDepth>e.halfDepth+t||i.length>e.length+t||re.length-t.length||e.halfDepth-t.halfDepth).map(e=>({...e}))};for(const e of c){const t=e.rays.sort((e,t)=>e.angle-t.angle||e.length-t.length||e.halfDepth-t.halfDepth),i=[];for(const e of t){const t=i[i.length-1];t&&Math.abs(e.angle-t.angle)<=1e-9?t.supports.push({halfDepth:e.halfDepth,length:e.length}):i.push({u:[...e.u],angle:e.angle,supports:[{halfDepth:e.halfDepth,length:e.length}]})}if(i.length>1&&2*Math.PI-i[i.length-1].angle+i[0].angle<=1e-9){const e=i.pop();i[0].supports.push(...e.supports)}if(i.length<3)continue;const r=i.map(t=>{const i=u(t.supports),r=new Set,o=[];for(const s of i){const i=[e.point[0]+t.u[0]*s.length,e.point[1]+t.u[1]*s.length];for(const t of xs(l,i,n)){if("shared"!==t.kind||Math.hypot(t.point[0]-i[0],t.point[1]-i[1])>n)continue;const s=t.other[0]-t.point[0],a=t.other[1]-t.point[1],l=Math.hypot(s,a);if(!(l>n))continue;const c=s/l,h=a/l;if(Math.hypot(t.other[0]-e.point[0],t.other[1]-e.point[1])<=n)continue;const d=`${t.key}|${t.point[0]}|${t.point[1]}|${t.other[0]}|${t.other[1]}|${t.halfDepth}`;r.has(d)||(r.add(d),o.push({start:[t.point[0],t.point[1]],u:[c,h],length:l,halfDepth:t.halfDepth}))}}return o.sort((e,t)=>e.start[0]-t.start[0]||e.start[1]-t.start[1]||e.u[0]-t.u[0]||e.u[1]-t.u[1]||e.length-t.length||e.halfDepth-t.halfDepth),{u:[...t.u],halfDepth:Math.max(...i.map(e=>e.halfDepth)),length:Math.max(...i.map(e=>e.length)),supports:i,continuations:o}}).filter(e=>Number.isFinite(e.halfDepth)&&e.halfDepth>0&&Number.isFinite(e.length)&&e.length>n);if(r.length<3)continue;const o=Math.max(...r.map(e=>e.halfDepth));o>0&&Number.isFinite(o)&&d.push({point:[...e.point],rays:r,halfDepth:o,limit:1.25*o})}d.sort((e,t)=>e.point[0]-t.point[0]||e.point[1]-t.point[1]);const p=new Map;for(const e of d){const[t,i]=ws(e.point,n),r=ks(t,i),o=p.get(r)||[];o.push(e),p.set(r,o)}return{epsilon:n,coordinateScale:r,nodes:d,index:p}}function $s(e){const t={fans:[],supports:[]};if(!e?.nodes?.length)return t;const i=Math.max(e.epsilon,1e-9)**2;for(const n of e.nodes){const e=n.rays.filter(e=>Number.isFinite(e.halfDepth)&&e.halfDepth>0).map(e=>({...e,thickLength:Math.max(...e.supports.filter(t=>t.halfDepth>=e.halfDepth-1e-12).map(e=>e.length),0),angle:(()=>{const t=Math.atan2(e.u[1],e.u[0]);return t<0?t+2*Math.PI:t})()})).sort((e,t)=>e.angle-t.angle);if(e.length<2)continue;const r=n.point;for(const i of e)for(const e of i.supports){if(!(e.halfDepth>0&&e.length>0))continue;const n=-i.u[1]*e.halfDepth,o=i.u[0]*e.halfDepth,s=[r[0]+i.u[0]*e.length,r[1]+i.u[1]*e.length];t.supports.push([[r[0]+n,r[1]+o],[s[0]+n,s[1]+o],[s[0]-n,s[1]-o],[r[0]-n,r[1]-o]])}for(let n=0;n{const e=s.angle-o.angle;return e>0?e:e+2*Math.PI})();if(a<1e-9)continue;const l=a>Math.PI+1e-9,c=4*Math.max(o.halfDepth,s.halfDepth),h=[r[0]-o.u[1]*o.halfDepth,r[1]+o.u[0]*o.halfDepth],d=[r[0]+s.u[1]*s.halfDepth,r[1]-s.u[0]*s.halfDepth],u=o.u[0]*s.u[1]-o.u[1]*s.u[0],p=e=>{let t=Math.atan2(e[1]-r[1],e[0]-r[0])-o.angle;for(;t<0;)t+=2*Math.PI;return t<=a+1e-9};let _=null;if(Math.abs(u)>1e-9){const e=((d[0]-h[0])*s.u[1]-(d[1]-h[1])*s.u[0])/u,t=((d[0]-h[0])*o.u[1]-(d[1]-h[1])*o.u[0])/u,i=[h[0]+o.u[0]*e,h[1]+o.u[1]*e];(l?e<=1e-9&&t<=1e-9:e>1e-9&&e<=o.thickLength&&t<=s.thickLength)&&Math.hypot(i[0]-r[0],i[1]-r[1])<=c&&p(i)&&(_=i)}const m=e=>{Math.abs(hs(e))>i&&t.fans.push(e)};if(_){const e=1.5*Math.max(o.halfDepth,s.halfDepth);m(So([r[0],r[1]],h,_,d,e)??[[r[0],r[1]],h,_,d]);continue}if(l){m([[r[0],r[1]],h,d]);continue}const g=(e,t)=>Math.min(t,Math.sqrt(Math.max(c**2-e**2,0)),2*Math.max(o.halfDepth,s.halfDepth)),f=[h[0]+o.u[0]*g(o.halfDepth,o.thickLength),h[1]+o.u[1]*g(o.halfDepth,o.thickLength)],v=[d[0]+s.u[0]*g(s.halfDepth,s.thickLength),d[1]+s.u[1]*g(s.halfDepth,s.thickLength)];m([[r[0],r[1]],h,f,v,d])}}return t}function Ms(e,t){return!e||!Array.isArray(t)||t.length<2||!t.slice(0,2).every(Number.isFinite)?null:xs(e.index,t,e.epsilon).filter(i=>Math.hypot(i.point[0]-t[0],i.point[1]-t[1])<=e.epsilon).sort((e,i)=>Math.hypot(e.point[0]-t[0],e.point[1]-t[1])-Math.hypot(i.point[0]-t[0],i.point[1]-t[1])||e.point[0]-i.point[0]||e.point[1]-i.point[1])[0]||null}function Rs(e,t,i,n,r,o,s){return Ss(Ts(e,t,i,n,r,o,s),4*cs(n,s),s)}function Cs(e,t,i,n,r,o,s,a=1){const l=ys(e,t,n,r,a,i);if(!l)return null;const c=function(e,t,i){const n=(e||[]).find(e=>e?.id===t),r=ni(n);if(!r)return[];const o=[];for(const n of e||[]){if(!n||n.id===t)continue;const e=ni(n);if(e)for(const t of An(r,e,i))o.push(t)}return o}(e,t,cs(r,a)),h=function(e,t,i,n,r){const o=cs(n,r),s=[];for(let a=0;aFs(h,d,e[0],e[1],e[2],e[3])<=o);s.push(u?"shared":"outer")}return s}(l.poly,c,n,r,a),d=bs(i,l,r,a),u=d.map((e,t)=>h[t]&&e>0?Ao(e,o,s)/2:0);return{...l,kinds:h,cms:d,offsets:u}}function Ts(e,t,i,n,r,o,s=1){const a=[];for(const l of e||[]){if(!l?.id)continue;const c=Cs(e,l.id,t,i,n,r,o,s);if(c)for(let e=0;e0&&(a=Zo(a,e.a,e.b,e.cm,n,s));return a}function As(e,t,i,n,r,o,s=1){if(!t?.length)return[];const a=Ts(e,t,i,n,r,o,s),l=new Map;for(const e of a){if(e.open||!e.kind||!e.roomId)continue;const t=l.get(e.key)||new Set;t.add(e.roomId),l.set(e.key,t)}const c=e=>{const t=[...l.get(e)||[]].sort();return 1!==t.length&&2!==t.length?`ambiguous:${e}`:`${1===t.length?"outer":"shared"}:${t.join("|")}`},h=[],d=new Set;for(const e of a)!e.open&&e.cm>0&&!d.has(e.key)&&(d.add(e.key),h.push({...e,ownerSignature:c(e.key)}));const u=[];for(const a of e||[]){if(!a?.id)continue;const l=Cs(e,a.id,t,i,n,r,o,s);if(l)for(let e=0;e0)||null===l.kinds[i]){e++;continue}const o=c(Eo(l.poly[i],l.poly[(i+1)%l.poly.length],n,s));let a=e;for(;a+10&&u.push({a:[d[0],d[1]],b:[p[0],p[1]],key:Eo(d,p,n,s),cm:r,len:_,ownerSignature:o}),e=a+1}}}u.sort((e,t)=>t.len-e.len||e.key.localeCompare(t.key));const p=[],_=new Set,m=new Set,g=4*cs(n,s);for(const e of u){const t=h.filter(t=>!m.has(t.key)&&t.cm===e.cm&&t.ownerSignature===e.ownerSignature&&qo(Bo(t.a,t.b),Bo(e.a,e.b))&&Fs(t.a[0],t.a[1],e.a[0],e.a[1],e.b[0],e.b[1])<=g&&Fs(t.b[0],t.b[1],e.a[0],e.a[1],e.b[0],e.b[1])<=g);if(t.length){for(const e of t)m.add(e.key);_.has(e.key)||(_.add(e.key),p.push(Ho(e.a,e.b,e.cm,n,s)))}}for(const e of h)m.has(e.key)||_.has(e.key)||(_.add(e.key),p.push(Ho(e.a,e.b,e.cm,n,s)));return p}function Ps(e,t,i,n,r,o,s,a=1){const l=cs(r,a),c=(n[0]+n[2])/2,h=(n[1]+n[3])/2,d=Bo([n[0],n[1]],[n[2],n[3]]);let u=null;for(const n of Ts(e,t,i,r,o,s,a)){if(!qo(Bo(n.a,n.b),d))continue;const e=Fs(c,h,n.a[0],n.a[1],n.b[0],n.b[1]);e>4*l||(!u||e[e[0],e[1]]),o=Math.abs(hs(r));r.length>=3&&o>i&&(t=r,i=o)}return t}function Is(e,t,i,n,r,o,s,a=1,l,c){const h=(e||[]).find(e=>e?.id===t),d=ni(h);if(!d||d.length<3)return null;if(!i?.length)return d.map(e=>[e[0],e[1]]);const u=Cs(e,t,i,n,r,o,s,a);if(!u||!u.offsets.some(e=>e>0))return d.map(e=>[e[0],e[1]]);const p=c||Rs(e,i,n,r,o,s,a),_=gs(u.poly,u.offsets,p);if(!_)return d.map(e=>[e[0],e[1]]);if(!p.nodes.length)return _;const m=void 0===l?Zs(e,i,n,[],r,o,s,a):null,g=l??("ok"===m?.status||"degraded-extra"===m?.status?m.roomGeom:void 0);if(g)try{const e=zs(Gt(Os(u.poly),g));if(e)return e}catch{}return function(e,t){try{return zs(Ut(Os(e),Os(t)))}catch{return null}}(_,u.poly)||d.map(e=>[e[0],e[1]])}function Os(e){const t=e.map(e=>[e[0],e[1]]);return t.push([e[0][0],e[0][1]]),[t]}function Es(e){return!(!Array.isArray(e)||!e.length)&&e.every(e=>Array.isArray(e)&&e.length&&e.every(e=>Array.isArray(e)&&e.length>=4&&e.every(e=>Array.isArray(e)&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])))&&Math.abs(Ci(e[0]))>1e-9)}function Ns(e,t,i,n){const r=n?new Set(n):null;let o=null;for(let n=0;nt.epsilon))continue;const l=js([[e.point[0]+a[0]*n.halfDepth,e.point[1]+a[1]*n.halfDepth],[e.point[0]+s.u[0]*r+a[0]*n.halfDepth,e.point[1]+s.u[1]*r+a[1]*n.halfDepth],[e.point[0]+s.u[0]*r-a[0]*n.halfDepth,e.point[1]+s.u[1]*r-a[1]*n.halfDepth],[e.point[0]-a[0]*n.halfDepth,e.point[1]-a[1]*n.halfDepth]],t.coordinateScale);if(!l)continue;const c=Os(l);o=o?Wt(o,c):c}}return o}function Hs(e,t,i){let n=null;for(const r of e.rays)for(const e of r.continuations){const r=[-e.u[1],e.u[0]],o=[e.start[0]+e.u[0]*e.length,e.start[1]+e.u[1]*e.length],s=js([[e.start[0]+r[0]*e.halfDepth,e.start[1]+r[1]*e.halfDepth],[o[0]+r[0]*e.halfDepth,o[1]+r[1]*e.halfDepth],[o[0]-r[0]*e.halfDepth,o[1]-r[1]*e.halfDepth],[e.start[0]-r[0]*e.halfDepth,e.start[1]-r[1]*e.halfDepth]],t.coordinateScale);if(!s)continue;const a=Ut(Os(s),i);Array.isArray(a)&&0!==a.length&&(n=n?Wt(n,a):a)}return n}function Ls(e,t,i=2*(4*e.halfDepth+2*t.epsilon)){const n=function(e,t=$o){const i=new Set,n=Number.isFinite(t)&&t>=0?t:$o;for(let t=0;te-t)}(e);return n.length?Ns(e,t,i,n):null}function Bs(e,t,i,n,r){const o=function(e){let t=null;for(const i of e){const e=Os(i);try{t=t?Wt(t,e):e}catch{}}return t}(function(e,t,i=!1){if(!e)return[];const n=[];for(const r of e.nodes)for(let o=0;o1e-9)||h>=Math.PI-1e-9)continue;const d=[-s.u[1],s.u[0]],u=[-a.u[1],a.u[0]],p=[r.point[0]+d[0]*s.halfDepth,r.point[1]+d[1]*s.halfDepth],_=[r.point[0]-u[0]*a.halfDepth,r.point[1]-u[1]*a.halfDepth],m=ps(p,s.u,_,a.u);if(!m)continue;const g=Math.hypot(m[0]-r.point[0],m[1]-r.point[1]);if(!Number.isFinite(g)||g<=r.limit)continue;const f=t?Math.sqrt(Math.max(0,r.limit*r.limit-s.halfDepth*s.halfDepth)):0,v=t?Math.sqrt(Math.max(0,r.limit*r.limit-a.halfDepth*a.halfDepth)):0,y=js([[p[0]+s.u[0]*f,p[1]+s.u[1]*f],[_[0]+a.u[0]*v,_[1]+a.u[1]*v],m],e.coordinateScale);if(y&&n.push(y),i){const t=m[0]-r.point[0],i=m[1]-r.point[1],o=Math.hypot(t,i),s=g-r.limit;if(o>e.epsilon&&s>e.epsilon){const a=Math.min(Math.max(8*e.epsilon,.05*r.halfDepth),.25*s),l=t/o,c=i/o,h=-c,d=l,u=js([[m[0]-l*a+h*a,m[1]-c*a+d*a],[m[0]-l*a-h*a,m[1]-c*a-d*a],[m[0]+l*a,m[1]+c*a]],e.coordinateScale);u&&n.push(u)}}}return n}({...t,nodes:[e]},i,n));return o&&r?Gt(o,r):o}function qs(e,t,i,n){if(!e||!t.nodes.length)return e;let r=null;try{r=function(e){let t=null;for(const i of e.nodes){const n=Ls(i,e);n&&(t=t?Wt(t,n):n)}return t}(t)}catch{return e}let o=e;for(const e of t.nodes){const s=4*e.halfDepth+2*t.epsilon,a=2*s,l=[[e.point[0]-s,e.point[1]-s],[e.point[0]+s,e.point[1]-s],[e.point[0]+s,e.point[1]+s],[e.point[0]-s,e.point[1]+s]];try{let s=o;const c=Bs(e,t,!1,!0,r);c&&(s=Gt(s,c));let h=Ns(e,t,a);const d=Bs(e,t,!0,!0,r);d&&(h=Gt(h,d)),r&&(h=Wt(h,r));const u=.02*Math.min(...e.rays.map(e=>e.halfDepth));if(h=Wt(h,Os([[e.point[0]-u,e.point[1]-u],[e.point[0]+u,e.point[1]-u],[e.point[0]+u,e.point[1]+u],[e.point[0]-u,e.point[1]+u]])),!h)continue;let p=Ut(h,Os(l));n?p=Ut(p,n):i&&(p=Ut(p,i));const _=Os(l),m=Gt(s,_),g=i?Gt(Ut(s,_),i):null,f=Hs(e,t,_);o=Wt(m,...g?[g]:[],...f?[f]:[],p)}catch{}}if(r)try{let e=r;n?e=Ut(e,n):i&&(e=Ut(e,i)),o=Wt(o,e)}catch{}return o}function js(e,t=1){if(!Array.isArray(e)||e.length<3)return null;const i=Number.isFinite(t)&&t>0?t:1,n=1e-12*Math.max(1,i),r=[];for(const t of e){if(!Array.isArray(t)||t.length<2)return null;const e=Number(t[0]),i=Number(t[1]);if(!Number.isFinite(e)||!Number.isFinite(i))return null;const o=Math.round(e/n)*n,s=Math.round(i/n)*n;if(!Number.isFinite(o)||!Number.isFinite(s))return null;r.push([Object.is(o,-0)?0:o,Object.is(s,-0)?0:s])}return Math.abs(hs(r))>n*n?r:null}function Ws(e,t,i,n){if(Fs(e[0],e[1],t[0],t[1],i[0],i[1])>n)return!1;const r=i[0]-t[0],o=i[1]-t[1],s=(e[0]-t[0])*r+(e[1]-t[1])*o,a=r*r+o*o,l=n*Math.sqrt(a);return s>=-l&&s<=a+l}function Us(e,t,i){const n=[],r=[];for(let o=0;oi*i))continue;const d=i/Math.sqrt(h),u=[0,1];for(const e of t)for(const t of[e.a,e.b]){if(!Ws(t,s,a,i))continue;const e=((t[0]-s[0])*l+(t[1]-s[1])*c)/h;e>d&&e<1-d&&u.push(e)}u.sort((e,t)=>e-t);const p=u.filter((e,t)=>0===t||Math.abs(e-u[t-1])>d);for(let e=0;e=3&&r.length===n.length?{poly:n,offsets:r}:null}function Gs(e,t,i,n,r,o,s,a){const l=(e||[]).map(ni).filter(e=>!!e&&e.length>=3);if(!l.length)return null;let c=Wt(Os(l[0]));for(let e=1;e"outer"===e.kind&&e.half>0),u=4*cs(n,s),p=a||Ss(h,u,s);let _=null;for(const e of function(e){const t=[];for(const i of Array.isArray(e)?e:[])if(Array.isArray(i))for(const e of i){if(!Array.isArray(e)||e.length<4)continue;const i=e.slice(0,-1).map(e=>[e[0],e[1]]);i.length>=3&&t.push(i)}return t}(c)){const t=Us(e,d,u);if(!t||!t.offsets.some(e=>e>0))continue;const i=ia(t.poly,t.offsets,p),n=gs(t.poly,t.offsets,p);if(!i||!n)continue;const r=Gt(Os(i),Os(n));_=_?Wt(_,r):r}return{centre:c,shell:_||[]}}function Vs(e,t,i,n,r,o,s=1){try{const a=Gs(e,t,i,n,r,o,s,Rs(e,t,i,n,r,o,s));if(!a)return[];return a.shell?.length?Wt(a.centre,a.shell):a.centre}catch{return null}}function Ks(e){if(!e)return"";let t="";for(const i of e)if(Array.isArray(i))for(const e of i){if(!Array.isArray(e)||e.length<4)continue;const i=e.slice(0,e.length-1);i.length<3||(t+=(t?" ":"")+fs(i.map(e=>[e[0],e[1]])))}return t}const Ys=15;function Xs(e,t,i){const n=e?.length||0;if(n<3||t?.length!==n)return!1;const r=e[(i-1+n)%n],o=e[i],s=e[(i+1)%n],a=[r[0]-o[0],r[1]-o[1]],l=[s[0]-o[0],s[1]-o[1]],c=Math.hypot(a[0],a[1]),h=Math.hypot(l[0],l[1]);if(!(c>1e-9&&h>1e-9))return!1;const d=Math.max(-1,Math.min(1,(a[0]*l[0]+a[1]*l[1])/(c*h))),u=Math.acos(d);if(!(u>1e-9))return!1;if(u>=Ys*Math.PI/180)return!1;const p=Math.max(0,t[(i-1+n)%n]),_=Math.max(0,t[i]);if(!(p>0||_>0))return!1;const m=Math.sin(u);if(!(m>1e-12))return!1;const g=(_+p*d)/m,f=(p+_*d)/m;return Number.isFinite(g)&&Number.isFinite(f)&&g>0&&f>0&&ge>0))continue;for(const e of l.offsets)e>0&&(u=Math.max(u,2*e));const c=ia(l.poly,l.offsets,d),p=gs(l.poly,l.offsets,d);c&&h.push({outset:c,inset:p})}for(const e of l){const t=e.map(e=>e[0]),i=e.map(e=>e[1]);if(t.length){const n=Math.min(Math.max(...t)-Math.min(...t),Math.max(...i)-Math.min(...i)),r=Math.min(...e.map((t,i)=>{const n=e[(i+1)%e.length];return Math.hypot(n[0]-t[0],n[1]-t[1])}));u=Math.max(u,e.length>16?n:r)}}const p=function(e,t,i,n,r,o,s,a){if(!t?.length||!i?.length)return[];const l=4*cs(n,s),c=new Map;for(const a of Ts(e,t,i,n,r,o,s))!a.open&&a.half>0&&!c.has(a.key)&&c.set(a.key,a);const h=[...c.values()];if(h.length<2)return[];const d=a||Ss(h,l),u=[];for(const e of i)for(const t of[[e[0],e[1]],[e[2],e[3]]])u.some(e=>Math.hypot(e[0]-t[0],e[1]-t[1])<=l)||u.push(t);const p=[],_=(e,t)=>{let i=0,n=0;if(Math.hypot(e.a[0]-t[0],e.a[1]-t[1])<=l)i=e.b[0]-e.a[0],n=e.b[1]-e.a[1];else{if(!(Math.hypot(e.b[0]-t[0],e.b[1]-t[1])<=l))return null;i=e.a[0]-e.b[0],n=e.a[1]-e.b[1]}const r=Math.hypot(i,n);return r>l?[i/r,n/r]:null};for(const e of u){const t=h.map(t=>({iv:t,u:_(t,e)})).filter(e=>!!e.u);for(let i=0;i0?[e.slice(),u,m,_]:[e.slice(),_,m,u];else{if(!f)continue;{const t=[-r.u[1],r.u[0]],i=[-o.u[1],o.u[0]],n=s<0?1:-1,a=[e[0]+t[0]*r.iv.half*n,e[1]+t[1]*r.iv.half*n],l=[e[0]-i[0]*o.iv.half*n,e[1]-i[1]*o.iv.half*n];y=s>0?[e.slice(),a,l]:[e.slice(),l,a]}}Math.abs(hs(y))>l*l&&p.push(y)}}return p}(e,t,i,r,o,s,a,d),_=n.length?na(e,t,i,r,o,s,a):null;let m="exterior";try{const v=Gs(e,t,i,r,o,s,a,d);m="paper";const y=v?v.shell?.length?Wt(v.centre,v.shell):v.centre:[],b=e=>{const t=Os(e.outset);if(!e.inset)return t;const i=Os(e.inset);return Gt(t,i)};m="room-rings";let w=null;for(const e of h)try{const t=b(e);w=w?Wt(w,t):t}catch{}if(m="edge-bodies",v)for(const n of ea(e,t,i,r,o,s,a))try{const e=Ut(Os(n.quad),v.centre);w=w?Wt(w,e):e}catch{}m="junctions",w=function(e,t,i=1,n=Wt){let r=e;for(const e of t||[]){const t=js(e,i);if(t)try{const e=Os(t);r=r?n(r,e):e}catch{}}return r}(w,p,a),m="facade-clip",w&&v&&(w=Ut(w,v.centre)),m="exterior-shell";const k=[];let x=0;if(v?.shell?.length)if(w)try{const e=Wt(w,v.shell);if(!Es(e))throw new Error("invalid shell union");w=e}catch{if(!Es(w)||!Es(v.shell))throw new Error("invalid shell");k.push({id:"exterior-shell",geom:v.shell}),x++}else w=v.shell;if(m="multi-wall-trim",w&&d.nodes.length){const e=e=>e.rays.some(e=>e.supports.some(e=>e.length<2*e.halfDepth)),t=d.nodes.filter(e);if(t.length){w=qs(w,{...d,nodes:t},v?.centre,y)}}if(m="junction-corners",d.nodes.length){const n=$s(d),l=function(e,t,i,n,r,o,s,a){try{const l=Gs(e,t,i,n,r,o,s,{epsilon:a.epsilon,coordinateScale:a.coordinateScale,nodes:[],index:new Map});return l?l.shell?.length?Wt(l.centre,l.shell):l.centre:null}catch{return null}}(e,t,i,r,o,s,a,d);for(const e of n.fans)try{let t=[Os(e)];if(l&&(t=Ut(t,l)),!t?.length)continue;w=w?Wt(w,t):t}catch{}g=w,f=Math.max(d.epsilon,1e-9)**2,w=Array.isArray(g)?g.map(e=>{if(!Array.isArray(e)||!e.length)return e;const[t,...i]=e;return Math.abs(hs(t||[]))<=f?null:[t,...i.filter(e=>Math.abs(hs(e||[]))>f)]}).filter(e=>!!e):g}const S=w||[],$=[...Es(S)?[{id:"room-primary",geom:S}]:[],...k.map((e,t)=>({id:`room-isolated-${t}`,geom:e.geom}))];m="openings";for(const e of n){if(!(e.length>0))continue;const t=sa(_,e,!0);if(!t.negative&&!t.positive)continue;const i=e.angle*Math.PI/180,n=Math.cos(i),o=Math.sin(i),s=-o,l=n,c=e.length/2,h=1.25*Math.max(u,r*a),d=[[e.x-n*c-s*h,e.y-o*c-l*h],[e.x+n*c-s*h,e.y+o*c-l*h],[e.x+n*c+s*h,e.y+o*c+l*h],[e.x-n*c+s*h,e.y-o*c+l*h]];w&&(w=Gt(w,Os(d)));for(const e of k)e.geom=Gt(e.geom,Os(d))}m="extras";const M=[];let R=0;const C=c.mergeExtra||((e,t)=>e?Wt(e,t):t);for(let e=0;ee.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1]))||Math.abs(Ci(t))<=1e-9){R++;continue}const i=[Os(t)];try{const t=C(w,i,e);if(!Es(t))throw new Error("invalid extra union");w=t}catch{R++,Es(i)&&M.push({id:`extra-${e}`,geom:i})}}M.push(...k),M.sort((e,t)=>Ks(e.geom).localeCompare(Ks(t.geom)));const T=w||[];return{status:R||x?"degraded-extra":"ok",geom:T,components:[...Es(T)?[{id:"primary",geom:T}]:[],...M.map((e,t)=>({...e,id:`isolated-${t}`}))],roomGeom:S,roomComponents:$,paperGeom:y,depthUnits:u,openingPadUnits:1.25*Math.max(u,r*a),openingIndex:_,multiWallNodes:d,degradedExtraCount:R+x}}catch{return c.onCoreFailure?.(m),{status:"failed-core",geom:[],components:[],roomGeom:[],paperGeom:[],roomComponents:[],depthUnits:u,openingIndex:null,multiWallNodes:d,degradedExtraCount:0}}var g,f}function Js(e,t,i,n=[],r,o,s,a=1,l=[],c={}){if(!t?.length&&!l.length)return null;return Qs(Zs(e,t,i,n,r,o,s,a,l,c))}function Qs(e){if("failed-core"===e.status||"not-applicable"===e.status)return null;const t=e.components.map(e=>({id:e.id,d:Ks(e.geom),fillRule:"evenodd"})).filter(e=>!!e.d),i=t[0]?.d||"",n=Ks(e.paperGeom);if(t.length){const r={status:e.status,d:i,paths:t,components:e.components,roomGeom:e.roomGeom,multiWallNodes:e.multiWallNodes,paperD:n,depthUnits:e.depthUnits,fillRule:"evenodd"};return Object.defineProperties(r,{roomComponents:{value:e.roomComponents||[],enumerable:!1},openingIndex:{value:e.openingIndex,enumerable:!1},openingPadUnits:{value:e.openingPadUnits,enumerable:!1}}),r}return null}function ea(e,t,i,n,r,o,s=1){if(!t?.length)return[];const a=new Set,l=[];for(const c of e||[]){if(!c?.id)continue;const h=Cs(e,c.id,t,i,n,r,o,s);if(!h)continue;const d=h.poly;for(let e=0;e0))continue;const p=Eo(t,i,n,s);if(a.has(p))continue;a.add(p);const _=Ao(u,r,o),[m,g]=ds(d,e),f=-m,v=-g,y=_/2,b=[[t[0]+f*y,t[1]+v*y],[i[0]+f*y,i[1]+v*y],[i[0]+m*y,i[1]+g*y],[t[0]+m*y,t[1]+g*y]];l.push({key:p,kind:c,cm:u,quad:b,a:[t[0],t[1]],b:[i[0],i[1]],depthUnits:_})}}return l}function ta(e,t=[]){let i=fs(e.quad);const[n,r]=Io(e.a,e.b),o=n,s=r,a=-s,l=o;for(const n of t){if(!Go(e.a,e.b,n.angle))continue;if(Fs(n.x,n.y,e.a[0],e.a[1],e.b[0],e.b[1])>Math.max(.55*e.depthUnits,.001))continue;const t=n.length/2,r=e.depthUnits,c=n.x,h=n.y;i+=` ${fs(vs([[c-o*t-a*r,h-s*t-l*r],[c+o*t-a*r,h+s*t-l*r],[c+o*t+a*r,h+s*t+l*r],[c-o*t+a*r,h-s*t+l*r]]))}`}return i}function ia(e,t,i){const n=e?.length||0;if(n<3||t.length!==n)return null;if(t.every(e=>!(e>0)))return e.map(e=>[e[0],e[1]]);vs(e),t.slice().reverse();const r=[];for(let o=0;o0||l>0)){r.push([e[o][0],e[o][1]]);continue}if(a>0!=l>0){const t=e[o],i=a>0?[t[0]-c*a,t[1]-h*a]:[t[0],t[1]],n=l>0?[t[0]-d*l,t[1]-u*l]:[t[0],t[1]];r.push(i),Math.hypot(n[0]-i[0],n[1]-i[1])>1e-9&&r.push(n);continue}if(us(w,k)){const t=e[o],i=[t[0]-c*a,t[1]-h*a],n=[t[0]-d*l,t[1]-u*l];r.push(i),Math.hypot(n[0]-i[0],n[1]-i[1])>1e-9&&r.push(n);continue}const $=ps(x,w,S,k),M=Math.max(a,l,1e-9),R=Ms(i,e[o])?.limit??4*M;if($){const i=Math.hypot($[0]-e[o][0],$[1]-e[o][1]);if(Number.isFinite(i)&&i<=R){r.push($);continue}if(Xs(e,t,o)){r.push([e[o][0],e[o][1]]);continue}}a>0&&r.push([e[o][0]-c*a,e[o][1]-h*a]),l>0&&r.push([e[o][0]-d*l,e[o][1]-u*l])}return r.length>=3?r:null}function na(e,t,i,n,r,o,s=1){const a=[];for(const l of e||[]){if(!l?.id)continue;const c=Cs(e,l.id,t,i,n,r,o,s);if(!c)continue;const h=Math.abs(Ci(c.poly));for(let e=0;e[Math.max(t,e.x0),Math.min(i,e.x1)]).filter(e=>e[1]-e[0]>n).sort((e,t)=>e[0]-t[0]||e[1]-t[1]);if(!r.length)return{coverage:0,full:!1};let o=r[0][0],s=r[0][1],a=0,l=o<=t+n;for(let e=1;e=i-n,{coverage:a,full:l}}function oa(e,t){return Number(t.full)-Number(e.full)||e.faceDistance-t.faceDistance||e.area-t.area||e.roomId.localeCompare(t.roomId)}function sa(e,t,i=!1){const n=Number(t?.x),r=Number(t?.y),o=Number(t?.angle),s=Number(t?.length);if(!([n,r,o,s].every(Number.isFinite)&&s>0))return{negative:null,positive:null};const a=o*Math.PI/180,l=Math.cos(a),c=Math.sin(a),h=-c,d=l,u=s/2,p=Math.max(1e-9,e.adjacencyEps),_=new Map;let m=0;for(const t of e.edges){if(i&&!(t.half>0))continue;if(!Go(t.a,t.b,o))continue;const[e,s]=Io(t.a,t.b);if(Math.abs((n-t.a[0])*s-(r-t.a[1])*e)>p)continue;const a=(t.a[0]-n)*l+(t.a[1]-r)*c,g=(t.b[0]-n)*l+(t.b[1]-r)*c,f=Math.max(-u,Math.min(a,g)),v=Math.min(u,Math.max(a,g));if(v-f<=p)continue;const y=t.inward[0]*h+t.inward[1]*d>=0?1:-1,b=((t.a[0]+t.b[0])/2-n)*h+((t.a[1]+t.b[1])/2-r)*d,w=Math.abs(b+y*t.half),k=`${y}|${t.roomId}`,x={x0:f,x1:v,half:t.half,cm:t.cm,key:t.key,axis:[e,s]},S=_.get(k);S?(S.pieces.push(x),S.faceDistance=Math.min(S.faceDistance,w)):_.set(k,{roomId:t.roomId,side:y,order:m++,pieces:[x],faceDistance:w,area:t.area,coverage:0,full:!1})}for(const e of _.values()){const t=ra(e.pieces,-u,u,p);e.coverage=t.coverage,e.full=t.full}const g=e=>{const t=[..._.values()].filter(t=>t.side===e&&t.coverage>p);return t.sort(oa),t[0]||null};return{negative:g(-1),positive:g(1)}}function aa(e,t,i,n,r,o,s=1,a=[]){return la(na(e,i,a,n,r,o,s),t)}function la(e,t){const i=sa(e,t),n=[i.negative,i.positive].filter(e=>!!e);if(!n.length)return{ox:0,oy:0,cm:0,side:-1};const r=i.negative&&i.positive?-1:n[0].side,o=t.flip_v?-r:r,s=(-1===o?i.negative:i.positive)||n[0],a=[...s.pieces].sort((e,t)=>(e.x0<=0&&e.x1>=0?0:Math.min(Math.abs(e.x0),Math.abs(e.x1)))-(t.x0<=0&&t.x1>=0?0:Math.min(Math.abs(t.x0),Math.abs(t.x1)))||t.x1-t.x0-(e.x1-e.x0)||e.key.localeCompare(t.key))[0];if(!(a.half>0&&a.cm>0))return{ox:0,oy:0,cm:0,side:o};const l=t.angle*Math.PI/180,c=-Math.sin(l),h=Math.cos(l);return{ox:c*o*a.half,oy:h*o*a.half,cm:a.cm,side:o}}function ca(e,t){const i=1e-9,n=t.filter(e=>Number.isFinite(e.x0)&&Number.isFinite(e.x1)&&Number.isFinite(e.half)&&e.x1>e.x0&&e.half>0);if(!n.length)return"";const r=n.flatMap(e=>[e.x0,e.x1]).sort((e,t)=>e-t),o=[];for(const e of r){const t=o[o.length-1];(void 0===t||e>t+i)&&o.push(e)}const s=[];for(let e=0;e+1t+i))continue;const a=(t+r)/2,l=n.reduce((e,t)=>a>=t.x0-i&&a<=t.x1+i?Math.max(e,t.half):e,0);if(!(l>0))continue;const c=s[s.length-1];c&&t<=c.x1+i&&Math.abs(l-c.half)<=i?c.x1=r:s.push({x0:t,x1:r,half:l})}const a=[];for(const e of s){const t=a[a.length-1],n=t?.[t.length-1];n&&e.x0<=n.x1+i?(e.x0=n.x1,t.push(e)):a.push([e])}return a.map(t=>{const i=t[0],n=t[t.length-1],r=Math.min(.25*Math.min(...t.map(e=>e.half)),.75),o=-e*r,s=[];if(1===e){s.push(`M ${i.x0} ${o} L ${n.x1} ${o}`);for(let e=t.length-1;e>=0;e--){const i=t[e];s.push(`L ${i.x1} ${i.half} L ${i.x0} ${i.half}`)}}else{s.push(`M ${n.x1} ${o} L ${i.x0} ${o}`);for(const e of t)s.push(`L ${e.x0} ${-e.half} L ${e.x1} ${-e.half}`)}return s.push("Z"),s.join(" ")}).join(" ")}function ha(e,t,i,n){if(!n)return i;const r=e.angle*Math.PI/180,o=Math.cos(r),s=Math.sin(r),a=[],l=1e-9;for(const r of i){const[i,c]=r.axis,h=o*i+s*c;if(Math.abs(h)<=l)continue;const d=e.x*i+e.y*c,u=d+h*r.x0,p=d+h*r.x1,_=Math.min(u,p),m=Math.max(u,p),g=`${r.key}|${t}`,f=n.get(g)||[];let v=[[_,m]];for(const[e,t]of f){const i=[];for(const[n,r]of v)t<=n+l||e>=r-l?i.push([n,r]):(e>n+l&&i.push([n,Math.min(r,e)]),te[0]-t[0]||e[1]-t[1]),b=[];for(const e of y){const t=b[b.length-1];t&&e[0]<=t[1]+l?t[1]=Math.max(t[1],e[1]):b.push([e[0],e[1]])}n.set(g,b)}return a}function da(e,t){const i=new Map;return t.map(t=>function(e,t,i){const n=sa(e,t,!0),r=n.negative,o=n.positive;if(!r&&!o)return null;let s;if(r&&o)s=[{candidate:r,side:-1},{candidate:o,side:1}];else{const e=r||o;s=[{candidate:e,side:-1},{candidate:e,side:1}]}const a=s.map(({candidate:e,side:n})=>({candidate:e,side:n,pieces:ha(t,n,e.pieces,i)})),l=a.map(({candidate:e,side:t,pieces:i})=>({side:t,roomId:e.roomId,d:ca(t,i)})),c=a.flatMap(({pieces:e})=>e);if(!c.length)return null;const h=Math.max(...c.map(e=>e.half));return{faces:l,minY:-h,maxY:h,wallKey:[...new Set(c.map(e=>e.key))].sort().join("|")}}(e,t,i))}const ua=150,pa=1e-6;function _a(e){return Number.isFinite(e)?Math.max(1,Math.min(ua,e)):1}function ma(e){return((Number.isFinite(Number(e))?Number(e):0)%90+90)%90}const ga=e=>{const t=e.map(e=>[e[0],e[1]]);return!t.length||t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]||t.push([...t[0]]),[t]},fa=(e,t)=>e[0]===t[0]&&e[1]===t[1];function va(e,t=1e-6){const i=Number.isFinite(t)&&t>0?t:pa,n=[];for(const t of e||[]){if(!Array.isArray(t)||t.length<2)return null;const e=Number(t[0]),r=Number(t[1]);if(!Number.isFinite(e)||!Number.isFinite(r))return null;const o=Math.round(e/i)*i,s=Math.round(r/i)*i;if(!Number.isFinite(o)||!Number.isFinite(s))return null;const a=[Object.is(o,-0)?0:o,Object.is(s,-0)?0:s];n.length&&fa(n[n.length-1],a)||n.push(a)}return n.length>1&&fa(n[0],n[n.length-1])&&n.pop(),n.length<3||new Set(n.map(e=>`${e[0]},${e[1]}`)).size<3?null:Ci(n)>i*i?n:null}function ya(e){const t=[];for(const i of e||[])for(const e of i||[]){const i=(e||[]).filter(e=>Array.isArray(e)&&e.length>=2);i.length<4||t.push(`M ${i.slice(0,-1).map(e=>`${e[0]} ${e[1]}`).join(" L ")} Z`)}return t.join(" ")}function ba(e,t,i,n,r){return es({a:e,b:t,halfDepth:Ao(i,n,r)/2})}function wa(e,t,i){const n=Number(t)>0?Number(t):5,r=_a(e.cm)/n*i,o=e.center[0],s=e.center[1];if("circle"===e.shape){const e=r/2;return Array.from({length:96},(t,i)=>{const n=i/96*Math.PI*2;return[o+Math.cos(n)*e,s+Math.sin(n)*e]})}const a=r/2,l=ma(e.angle)*Math.PI/180,c=Math.cos(l),h=Math.sin(l);return[[-a,-a],[a,-a],[a,a],[-a,a]].map(([e,t])=>[o+e*c-t*h,s+e*h+t*c])}function ka(e,t){const i=Number.isFinite(t)?Math.max(0,Math.min(1,t)):0,n=(e.a[0]+e.b[0])/2,r=(e.a[1]+e.b[1])/2,o=(e.b[0]-e.a[0])*i/2,s=(e.b[1]-e.a[1])*i/2;return{...e,a:[n-o,r-s],b:[n+o,r+s]}}function xa(e,t,i=1e-9){if(!t.length)return[e];let n=[ga(e)];try{for(const e of t){const t=e.b[0]-e.a[0],r=e.b[1]-e.a[1],o=Math.hypot(t,r);if(!(o>i))continue;const s=t/o,a=r/o,l=-a,c=s,h=1.25*Math.max(Number(e.depth)||0,4*i),d=Math.max(2*i,1e-9*o),u=[[e.a[0]-s*d-l*h,e.a[1]-a*d-c*h],[e.b[0]+s*d-l*h,e.b[1]+a*d-c*h],[e.b[0]+s*d+l*h,e.b[1]+a*d+c*h],[e.a[0]-s*d+l*h,e.a[1]-a*d+c*h]];n=Gt(n,ga(u))}return Fa(n)}catch{return[e]}}function Sa(e,t){try{const i=Gt([[...e.map(e=>[e[0],e[1]]),[e[0][0],e[0][1]]]],[[...t.map(e=>[e[0],e[1]]),[t[0][0],t[0][1]]]]);let n=null,r=0;for(const e of i||[]){const t=e?.[0]||[],i=Math.abs(Ci(t));t.length>=4&&i>r&&(r=i,n=t.slice(0,-1).map(e=>[e[0],e[1]]))}return n}catch{return null}}function $a(e,t,i,n=Math.max(2e-4*i,1e-9),r=[]){const o=[],s=new Map;for(const e of r){const t=s.get(e.hostId)||[];t.push(e),s.set(e.hostId,t)}const a=[],l=[],c=[];for(const n of e.partitions||[]){const e={a:n.a,b:n.b,halfDepth:Ao(n.cm,t,i)/2};if(!(e.halfDepth>0))continue;const r=es(e);r&&(o.push(e),a.push(r),c.push({id:n.id,body:r}))}const h=o;for(const{segmentIndex:e,wedge:t}of os(h,n)){const i={list:a,at:e},n=Sa(i.list[i.at],t);n&&(i.list[i.at]=n,c[i.at].body=n)}for(const e of c)l.push(...xa(e.body,s.get(e.id)||[],n));const d=(e.wall_columns||[]).map(e=>wa(e,t,i)),u=ss(o,n).flatMap(e=>xa(e,r,n));return{partitions:a,columns:d,patches:u,all:[...l,...u,...d]}}function Ma(e){try{const t=e.map(e=>va(e)).filter(e=>!!e).map(e=>ga(e));return t.length?Wt(t[0],...t.slice(1)):null}catch{return null}}const Ra=e=>`M ${e.map(e=>`${e[0]} ${e[1]}`).join(" L ")} Z`;function Ca(e){const t=[];for(const i of e||[]){if(Aa([i])<=1e-6)continue;const e=[];for(const t of i||[]){const i=(t||[]).filter(e=>Array.isArray(e)&&e.length>=2);i.length<4||e.push(Ra(i.slice(0,-1)))}e.length&&t.push(e.join(" "))}return t}function Ta(e,t,i={}){const n=Ma(e.filter(e=>e.length>=3)),r=t.some(e=>!va(e))?null:Ma(t);if(!n)return[];if(r)try{return Ca(Ut(n,r))}catch{}return function(e,t,i){let n=null;for(let r=0;r=4&&t.push(e.slice(0,-1).map(e=>[e[0],e[1]]));return t}function Fa(e){const t=[];for(const i of e||[]){const e=i?.[0];e?.length>=4&&t.push(e.slice(0,-1).map(e=>[e[0],e[1]]))}return t}function za(e,t){let i=!1;for(let n=0,r=t.length-1;ne[1]!=l>e[1]&&e[0]<(a-o)*(e[1]-s)/(l-s||1e-12)+o&&(i=!i)}return i}function Ia(e,t){for(const i of t||[]){const t=i?.[0];if(!t?.length||!za(e,t))continue;let n=!1;for(let t=1;ti)return!1;if(Math.abs(_a(e.cm)-_a(t.cm))>1e-6)return!1;if(e.shape!==t.shape)return!0;if("circle"===e.shape||"circle"===t.shape)return!0;const n=Math.abs(ma(e.angle)-ma(t.angle));return Math.min(n,90-n)<=1e-6}const Ea=2.54;function Na(e){const t="number"==typeof e?e:NaN;return!Number.isFinite(t)||t<=0||5===t?1:5/t}function Ha(e,t){return e*Na(t)}function La(e){return e?Ea:1}function Ba(e,t){if(!t)return String(e);const i=e/Ea;return String(Math.round(1e6*i)/1e6)}function qa(e,t){return t?e*Ea:e}const ja=1e3;function Wa(e,t){const i=Number(e),n=Number.isFinite(i)&&i>0?i:1,r=n>=1?t:t*n,o=n>=1?t/n:t;return{x:(t-r)/2,y:(t-o)/2,w:r,h:o}}const Ua=.01,Ga=100;function Va(e,t=1e3){const i=Wa(e?.plan_aspect,t),n=Number(e?.plan_scale),r=Number.isFinite(n)&&n>0?Math.min(Ga,Math.max(Ua,n)):1,o=Number(e?.plan_scale_x),s=Number(e?.plan_scale_y),a=Number.isFinite(o)&&o>0?Math.min(Ga,Math.max(Ua,o)):r,l=Number.isFinite(s)&&s>0?Math.min(Ga,Math.max(Ua,s)):r,c=Number(e?.plan_x),h=Number(e?.plan_y),d=$r(e?.plan_angle);return{x:i.x+(Number.isFinite(c)?rl(c):0)*t,y:i.y+(Number.isFinite(h)?rl(h):0)*t,w:i.w*a,h:i.h*l,...d?{angle:d}:{}}}function Ka(e){if(null==e.x||null==e.y)return{x:e.x,y:e.y,w:e.w,h:e.h};const t=Number(e.w)||0,i=Number(e.h)||0;return{x:t<0?e.x+t:e.x,y:i<0?e.y+i:e.y,w:Math.abs(t),h:Math.abs(i)}}function Ya(e){return e&&Array.isArray(e.spaces)?e.spaces.map(e=>{const t=ja,i=function(e){return Array.isArray(e)&&4===e.length&&e.every(e=>Number.isFinite(e))&&e[2]>1e-6&&e[3]>1e-6?e:[0,0,1,1]}(e.view_box);return{id:e.id,title:e.title,cellCm:Number.isFinite(Number(e.cell_cm))&&Number(e.cell_cm)>0?Number(e.cell_cm):5,vb:[i[0]*ja,i[1]*t,i[2]*ja,i[3]*t],bg:e.plan_url?{href:En(e.plan_url),...Va(e,ja)}:null,rooms:(e.rooms||[]).map(e=>{const i={...e,...Ka(e)};return{id:i.id,name:i.name,area:i.area??null,open_to:i.open_to||void 0,settings:i.settings||void 0,x:null!=i.x?i.x*ja:void 0,y:null!=i.y?i.y*t:void 0,w:null!=i.w?i.w*ja:void 0,h:null!=i.h?i.h*t:void 0,poly:i.poly?i.poly.map(e=>[e[0]*ja,e[1]*t]):void 0,wall_ids:Array.isArray(i.wall_ids)?[...i.wall_ids]:void 0}}),wall_segments:(e.wall_segments||[]).map(e=>({...e,id:String(e.id),a:[Number(e.a?.[0])*ja,Number(e.a?.[1])*t],b:[Number(e.b?.[0])*ja,Number(e.b?.[1])*t],cm:Number(e.cm)})),partitions:(e.partitions||[]).map(e=>({id:e.id,a:[e.a[0]*ja,e.a[1]*t],b:[e.b[0]*ja,e.b[1]*t],cm:Number(e.cm)})),wall_columns:(e.wall_columns||[]).map(e=>({id:e.id,shape:"circle"===e.shape?"circle":"square",center:[e.center[0]*ja,e.center[1]*t],cm:Number(e.cm),..."circle"===e.shape?{}:{angle:ma(e.angle)}}))}}):[]}const Xa=5e3,Za=Xa*ja,Ja=240,Qa=ja/Ja,el=1/Ja;function tl(e){if(!Number.isFinite(e))return e;const t=Math.round(e*Ja/ja)*ja/Ja;return Math.abs(t-e)<=1e-9*Qa?e:t}function il(e){return{x:tl(e.x),y:tl(e.y)}}function nl(e){return Number.isFinite(e)?Math.min(Za,Math.max(-Za,e)):0}function rl(e){return Number.isFinite(e)?Math.min(Xa,Math.max(-Xa,e)):0}const ol=1/3,sl=200;function al(e){return"house"===e?"house":"content"}function ll(e){let t=1/0,i=1/0,n=-1/0,r=-1/0;for(const o of e){const e=Number(o[0]),s=Number(o[1]);Number.isFinite(e)&&Number.isFinite(s)&&(en&&(n=e),s>r&&(r=s))}return t>n?null:{minX:t,minY:i,maxX:n,maxY:r}}function cl(e){const t=[],i=e=>{if(Array.isArray(e))if(e.length>=2&&Number.isFinite(Number(e[0]))&&Number.isFinite(Number(e[1])))t.push([Number(e[0]),Number(e[1])]);else for(const t of e)i(t)};return i(e),ll(t)}function hl(e,t){const i=Number.isFinite(t)&&t>0?t:0;return{minX:e.minX-i,minY:e.minY-i,maxX:e.maxX+i,maxY:e.maxY+i}}function dl(e){return e.poly&&e.poly.length?ll(e.poly):null==e.x||null==e.y?null:ll([[e.x,e.y],[e.x+(e.w||0),e.y+(e.h||0)]])}function ul(e,t=1e3,i=1e3){const n=Number(e.x)*t,r=Number(e.y)*i,o=Number(e.w)*t,s=Number(e.h)*i;return![n,r,o,s].every(Number.isFinite)||o<=0||s<=0?null:ll(Fr({x:n,y:r,w:o,h:s,angle:$r(e.angle)||void 0}))}function pl(e,t){const i=[];for(const t of e.rooms||[]){const e=dl(t);e&&i.push(e)}if(e.bg){const t=ll(Fr(e.bg));t&&i.push(t)}for(const e of t||[])if(Array.isArray(e)){const t=ll([e]);t&&i.push(t)}else i.push(e);return i}const _l=e=>{if(!e.length)return 0;const t=[...e].sort((e,t)=>e-t),i=t.length>>1;return t.length%2?t[i]:(t[i-1]+t[i])/2},ml=e=>{let t=1/0,i=1/0,n=-1/0,r=-1/0;for(const o of e)o.minXn&&(n=o.maxX),o.maxY>r&&(r=o.maxY);return t>n||i>r?null:{x:t,y:i,w:n-t,h:r-i}};function gl(e,t){let{x:i,y:n,w:r,h:o}=e;r<30&&(i=i+r/2-100,r=sl),o<30&&(n=n+o/2-100,o=sl);const s="number"==typeof t?{top:t,right:t,bottom:t,left:t}:t,a=Math.max(r,o),l=a*s.top,c=a*s.right,h=a*s.bottom,d=a*s.left;return{x:i-d,y:n-l,w:r+d+c,h:o+l+h}}function fl(e,t={}){const i=t.pad??.05,n=t.k??10,r=t.minSpread??50,o=e.filter(e=>Number.isFinite(e.minX)&&Number.isFinite(e.minY)&&Number.isFinite(e.maxX)&&Number.isFinite(e.maxY)&&Math.abs(e.minX)<=Za&&Math.abs(e.maxX)<=Za&&Math.abs(e.minY)<=Za&&Math.abs(e.maxY)<=Za);if(!o.length)return{core:null,all:null,outliers:0};const s=ml(o);if(o.length<4){const e=gl(s,i);return{core:e,all:e,outliers:0}}const a=o.map(e=>(e.minX+e.maxX)/2),l=o.map(e=>(e.minY+e.maxY)/2),c=_l(a),h=_l(l),d=o.map((e,t)=>Math.max(Math.abs(a[t]-c),Math.abs(l[t]-h))),u=Math.max(((e,t)=>e.length?e[Math.min(e.length-1,Math.max(0,Math.round(t*(e.length-1))))]:0)([...d].sort((e,t)=>e-t),.75),r),p=d.map(e=>e>n*u),_=p.filter(Boolean).length,m=_&&_<=o.length*ol?o.filter((e,t)=>!p[t]):o;return{core:gl(ml(m)||s,i),all:gl(s,i),outliers:m===o?0:_}}function vl(e){return fl(e,{pad:0}).all}function yl(e,t,i=.05){const n=fl(pl(e,t),{pad:i});if(n.core)return n.core;const r=e.vb&&4===e.vb.length&&e.vb[2]>0&&e.vb[3]>0?e.vb:[0,0,ja,ja];return{x:r[0],y:r[1],w:r[2],h:r[3]}}function bl(e){const t=yl(e);return{x:t.x+t.w/2,y:t.y+t.h/2}}function wl(e){const t=[];for(const i of e.rooms||[]){const e=dl(i);e&&t.push(e)}const i=fl(t,{pad:0}).core,n=ja*Na(e.cellCm??5);return i?Math.max(n,Math.min(Za,Math.max(i.w,i.h))):n}function kl(e,t,i,n=1){const r=Number(i),o=Number.isFinite(n)&&n>0?n:1;return!Number.isFinite(r)||r<=0?e*o:e*wl(t)*o/r}const xl=[1,2,5,10,20,50,100,200,500,1e3];function Sl(e,t,i=7){if(!(e>0&&t>0&&Number.isFinite(t)))return null;const n=xl.find(n=>e*n*t>=i);if(void 0===n)return null;const r=xl.find(e=>e>=5*n)??5*n;return{fine:n,coarse:r}}function $l(e){if(e.poly&&e.poly.length){const t=e.poly.map(e=>e[0]),i=e.poly.map(e=>e[1]),n=Math.min(...t),r=Math.min(...i);return{x:n,y:r,w:Math.max(...t)-n,h:Math.max(...i)-r}}return{x:e.x??0,y:e.y??0,w:e.w??0,h:e.h??0}}function Ml(e,t,i,n,r,o=new Set){const s=t[e.id];return!o.has(e.id)&&s&&s.s===e.space?{x:s.x*ja,y:s.y*ja}:n[e.id]?n[e.id]:il(bl(r))}function Rl(e,t,i,n){const r=i["rl_"+(e.id||"")];if(r&&r.s===t)return{x:r.x*ja,y:r.y*ja};const o=function(e){if(e.poly){const t=e.poly.length;return[e.poly.reduce((e,t)=>e+t[0],0)/t,e.poly.reduce((e,t)=>e+t[1],0)/t]}return[e.x+e.w/2,e.y+.1*Math.min(e.w,e.h)]}(e);return il({x:o[0],y:o[1]})}function Cl(e,t){for(const i of e?.spaces??[])for(const e of i?.decor??[])if("furniture"===e?.kind&&"string"==typeof e.symbol&&t(e.symbol))return!0;return!1}let Tl=0;const Dl=new Set;const Al=new class{constructor(e){this.options=e,this._art=null,this._failed=!1,this._terminal=!1,this._inFlight=null,this._hosts=new Set,this._settled=[]}state(){return this._art?"ready":this._failed?"fallback":"pending"}get terminal(){return this._terminal}art(e,t){if(this._art)return this._art[e];t&&!this._failed&&this._hosts.add(t)}adopt(e,t){return!!this._art||(t!==this.options.expectedFingerprint?((this.options.warn??console.warn)("[houseplan] furniture artwork from another build ignored",{fingerprint:t}),!1):(this._install(e),!0))}ensure(){return"pending"!==this.state()?Promise.resolve():(this._inFlight||(this._inFlight=this._loadWithRetry().finally(()=>{this._inFlight=null})),this._inFlight)}onSettled(e){"pending"===this.state()?this._settled.push(e):Promise.resolve().then(e)}async _loadWithRetry(){let e=new Error("furniture artwork did not load");for(const t of[0,1])try{const i=await this.options.load(t);if(i.FURNITURE_ART_FINGERPRINT!==this.options.expectedFingerprint){this._terminal=!0,e=new Error(`furniture artwork fingerprint mismatch: expected ${this.options.expectedFingerprint}, got ${i.FURNITURE_ART_FINGERPRINT}`);break}if(this._art)return;return void this._install(i.GENERATED_FURNITURE_ART)}catch(t){e=t}this._art||(this._failed=!0,(this.options.warn??console.warn)("[houseplan] furniture artwork unavailable",e),this.options.loadFailed?.(this._terminal),this._flush())}_install(e){this._art=e,this._failed=!1,this._flush()}_flush(){const e=[...this._hosts];this._hosts.clear();for(const t of e)t.isConnected&&t.requestUpdate();const t=this._settled.splice(0);for(const e of t)e()}}({expectedFingerprint:"74cbeb9792716ab64cfbcf339d3044c6e8ae33533bdef7216a6d7d513ae04091",load:async e=>0===e?await import("./furniture-plan-art.generated-CrvWoAvu.js"):await import((()=>{const e=new URL("./furniture-plan-art.generated-CrvWoAvu.js",import.meta.url);return e.searchParams.set("hp_retry","art-"+ ++Tl),e.href})()),loadFailed:e=>{for(const t of Dl)t(e)}}),Pl=["furniture","appliance","sanitary","other"],Fl=[{id:"sofa",group:"furniture",category:"sofa",w:220,h:90,g:[["r",0,0,1,1],["l",.09,.26,.91,.26],["l",.09,.26,.09,1],["l",.91,.26,.91,1],["l",.5,.26,.5,1]]},{id:"armchair",group:"furniture",category:"armchair",w:90,h:85,g:[["r",0,0,1,1],["l",.14,.28,.86,.28],["l",.14,.28,.14,1],["l",.86,.28,.86,1]]},{id:"coffee_table",group:"furniture",category:"coffee_table",w:110,h:60,g:[["r",0,0,1,1],["r",.08,.14,.84,.72]]},{id:"table_dining",group:"furniture",category:"dining_table",w:140,h:80,g:[["r",0,0,1,1],["r",.06,.11,.88,.78]]},{id:"table_round",group:"furniture",category:"dining_table",w:120,h:120,g:[["e",.5,.5,.5,.5],["e",.5,.5,.41,.41]]},{id:"chair",group:"furniture",category:"chair",w:45,h:45,g:[["r",0,0,1,.18],["r",.06,.18,.88,.8]]},{id:"desk",group:"furniture",category:"work_table",w:120,h:60,g:[["r",0,0,1,1],["r",.63,.07,.31,.86],["l",.63,.5,.94,.5]]},{id:"bed_double",group:"furniture",category:"bed",w:160,h:200,g:[["r",0,0,1,1],["r",0,0,1,.07],["r",.06,.1,.4,.15],["r",.54,.1,.4,.15],["l",0,.33,1,.33]]},{id:"bed_single",group:"furniture",category:"bed",w:90,h:200,g:[["r",0,0,1,1],["r",0,0,1,.07],["r",.15,.1,.7,.15],["l",0,.33,1,.33]]},{id:"nightstand",group:"furniture",category:"nightstand",w:45,h:40,g:[["r",0,0,1,1],["r",.12,.14,.76,.33],["r",.12,.53,.76,.33]]},{id:"wardrobe",group:"furniture",category:"wardrobe",w:100,h:60,g:[["r",0,0,1,1],["l",0,.72,1,.72],["l",.5,.72,.5,1]]},{id:"bookshelf",group:"furniture",category:"wardrobe",w:80,h:30,g:[["r",0,0,1,1],["l",.34,0,.34,1],["l",.67,0,.67,1]]},{id:"fridge",group:"appliance",category:"fridge",w:60,h:65,g:[["r",0,0,1,1],["l",0,.36,1,.36],["l",.83,.44,.83,.64]]},{id:"stove",group:"appliance",category:"cooktop",w:60,h:60,g:[["r",0,0,1,1],["e",.29,.31,.15,.15],["e",.71,.31,.15,.15],["e",.29,.71,.15,.15],["e",.71,.71,.15,.15]]},{id:"dishwasher",group:"appliance",category:"dishwasher",w:60,h:60,g:[["r",0,0,1,1],["r",.1,.12,.8,.76],["e",.5,.5,.27,.27],["e",.5,.5,.13,.13]]},{id:"washer",group:"appliance",category:"washer",w:60,h:60,g:[["r",0,0,1,1],["l",.08,.17,.92,.17],["e",.5,.57,.3,.3],["e",.5,.57,.14,.14]]},{id:"dryer",group:"appliance",category:"dryer",w:60,h:60,g:[["r",0,0,1,1],["l",.08,.17,.92,.17],["e",.5,.57,.3,.3],["p",.36,.5,.5,.64,.64,.5]]},{id:"tv",group:"appliance",category:"tv",w:120,h:30,g:[["r",0,0,1,.42],["l",.5,.42,.5,.72],["l",.3,.72,.7,.72]]},{id:"ac",group:"appliance",category:"air_conditioner",w:90,h:25,g:[["r",0,0,1,1],["l",.05,.55,.95,.55],["l",.05,.79,.95,.79]]},{id:"water_heater",group:"appliance",category:"boiler",w:45,h:45,g:[["e",.5,.5,.5,.5],["e",.5,.5,.31,.31]]},{id:"toilet",group:"sanitary",category:"toilet",w:40,h:70,g:[["r",.06,0,.88,.2],["e",.5,.58,.37,.35],["e",.5,.58,.22,.2]]},{id:"bathtub",group:"sanitary",category:"bathtub",w:170,h:75,g:[["r",0,0,1,1],["r",.05,.11,.77,.78],["e",.89,.5,.045,.1]]},{id:"shower",group:"sanitary",category:"shower",w:90,h:90,g:[["r",0,0,1,1],["l",0,0,1,1],["l",1,0,0,1],["e",.5,.5,.08,.08]]},{id:"sink",group:"sanitary",category:"sink",w:60,h:45,g:[["r",0,0,1,1],["e",.5,.6,.34,.3],["e",.5,.15,.07,.07]]},{id:"kitchen_sink",group:"sanitary",category:"kitchen_sink",w:80,h:60,g:[["r",0,0,1,1],["r",.06,.24,.44,.64],["r",.54,.24,.4,.64],["e",.5,.12,.06,.06]]},{id:"bidet",group:"sanitary",category:"bidet",w:40,h:55,g:[["e",.5,.5,.44,.5],["e",.5,.5,.26,.3]]},{id:"stairs",group:"other",category:"stairs",w:100,h:280,g:[["r",0,0,1,1],["l",0,.111,1,.111],["l",0,.222,1,.222],["l",0,.333,1,.333],["l",0,.444,1,.444],["l",0,.556,1,.556],["l",0,.667,1,.667],["l",0,.778,1,.778],["l",0,.889,1,.889],["l",.5,.93,.5,.06],["p",.38,.16,.5,.06,.62,.16]]},{id:"fireplace",group:"other",category:"fireplace",w:120,h:40,g:[["r",0,0,1,1],["p",.22,1,.22,.42,.78,.42,.78,1]]},{id:"plant",group:"other",category:"plant",w:40,h:40,g:[["e",.5,.5,.22,.22],["l",.5,.28,.5,.02],["l",.5,.72,.5,.98],["l",.28,.5,.02,.5],["l",.72,.5,.98,.5],["l",.34,.34,.13,.13],["l",.66,.66,.87,.87],["l",.66,.34,.87,.13],["l",.34,.66,.13,.87]]},{id:"rug",group:"other",category:"rug",w:200,h:140,g:[["r",0,0,1,1],["r",.06,.09,.88,.82]]}],zl=new Set(["fridge","dishwasher","washer","dryer","ac","water_heater","shower","sink","stairs","fireplace","plant","rug"]),Il=[...[{id:"coffee_table",group:"furniture",category:"coffee_table",w:120,h:60},{id:"coffee_table_round",group:"furniture",category:"coffee_table",w:80,h:80},{id:"coffee_table_oval",group:"furniture",category:"coffee_table",w:120,h:60},{id:"coffee_table_rounded",group:"furniture",category:"coffee_table",w:120,h:60},{id:"table_dining",group:"furniture",category:"dining_table",w:160,h:90},{id:"table_round",group:"furniture",category:"dining_table",w:110,h:110},{id:"table_dining_oval",group:"furniture",category:"dining_table",w:180,h:100},{id:"table_dining_rounded",group:"furniture",category:"dining_table",w:160,h:90},{id:"desk",group:"furniture",category:"work_table",w:140,h:70},{id:"desk_corner",group:"furniture",category:"work_table",w:160,h:160},{id:"chair",group:"furniture",category:"chair",w:50,h:50},{id:"chair_bar",group:"furniture",category:"chair",w:45,h:48},{id:"armchair",group:"furniture",category:"armchair",w:90,h:90},{id:"armchair_office",group:"furniture",category:"armchair",w:65,h:65},{id:"sofa",group:"furniture",category:"sofa",w:180,h:90},{id:"sofa_three_seat",group:"furniture",category:"sofa",w:240,h:90},{id:"sofa_corner_right",group:"furniture",category:"sofa",w:260,h:170},{id:"bed_single",group:"furniture",category:"bed",w:90,h:200},{id:"bed_double",group:"furniture",category:"bed",w:160,h:200},{id:"nightstand",group:"furniture",category:"nightstand",w:50,h:40},{id:"cabinet_tv",group:"furniture",category:"nightstand",w:140,h:45},{id:"cabinet_shoe",group:"furniture",category:"nightstand",w:80,h:35},{id:"cabinet_sink",group:"furniture",category:"nightstand",w:80,h:50},{id:"bookshelf",group:"furniture",category:"wardrobe",w:100,h:35},{id:"wall_unit",group:"furniture",category:"wardrobe",w:240,h:45},{id:"wardrobe",group:"furniture",category:"wardrobe",w:180,h:60},{id:"kitchen_floor",group:"furniture",category:"kitchen_cabinet",w:60,h:60},{id:"kitchen_floor_corner",group:"furniture",category:"kitchen_cabinet",w:90,h:90},{id:"kitchen_wall",group:"furniture",category:"kitchen_cabinet",w:60,h:35},{id:"kitchen_wall_corner",group:"furniture",category:"kitchen_cabinet",w:60,h:60},{id:"shelf_floor",group:"furniture",category:"shelving",w:100,h:35},{id:"shelf_wall",group:"furniture",category:"shelving",w:100,h:25},{id:"cooktop_two",group:"appliance",category:"cooktop",w:30,h:50},{id:"stove",group:"appliance",category:"cooktop",w:60,h:60},{id:"tv",group:"appliance",category:"tv",w:120,h:28},{id:"tv_wall",group:"appliance",category:"tv",w:120,h:15},{id:"toilet",group:"sanitary",category:"toilet",w:40,h:70},{id:"toilet_built_in",group:"sanitary",category:"toilet",w:40,h:55},{id:"bathtub",group:"sanitary",category:"bathtub",w:170,h:75},{id:"bathtub_corner",group:"sanitary",category:"bathtub",w:140,h:140},{id:"bidet",group:"sanitary",category:"bidet",w:40,h:60},{id:"bidet_built_in",group:"sanitary",category:"bidet",w:40,h:50},{id:"kitchen_sink",group:"sanitary",category:"kitchen_sink",w:60,h:50},{id:"kitchen_sink_double",group:"sanitary",category:"kitchen_sink",w:90,h:50}].map(e=>({id:e.id,group:e.group,category:e.category,w:e.w,h:e.h,designer:!0})),...Fl.filter(e=>zl.has(e.id))],Ol=new Map(Il.map(e=>[e.id,e]));function El(e){return e&&Ol.get(e)||null}function Nl(e){return!0===Ol.get(e)?.designer}function Hl(e){return Il.filter(t=>t.group===e)}function Ll(e){const t=El(e);return t?{w:t.w,h:t.h}:{w:60,h:60}}function Bl(e,t,i=Qa,n=1e3){const r=Number(t)>0?Number(t):5;return(Number(e)||0)/r*i/n}const ql=5e-4,jl=Xa;function Wl(e){return Number.isFinite(e)?Math.max(ql,Math.min(jl,e)):ql}function Ul(e){return Number.isFinite(e)?Math.max(1,Math.min(1e4,e)):1}const Gl=e=>{const t=Math.round(1e3*e)/1e3;return Object.is(t,-0)?"0":String(t)};function Vl(e,t){const i=El(e);if(!i)return null;if(i.designer)return Al.art(e,t)??null;const n=function(e,t,i){if(!e.g)return"";const n=e=>Gl(e*t),r=e=>Gl(e*i),o=[];for(const s of e.g)if("r"===s[0]){const[,e,t,i,a]=s;o.push(`M${n(e)} ${r(t)}H${n(e+i)}V${r(t+a)}H${n(e)}Z`)}else if("l"===s[0]){const[,e,t,i,a]=s;o.push(`M${n(e)} ${r(t)}L${n(i)} ${r(a)}`)}else if("e"===s[0]){const[,e,a,l,c]=s;o.push(`M${n(e-l)} ${r(a)}A${Gl(l*t)} ${Gl(c*i)} 0 0 1 ${n(e+l)} ${r(a)}A${Gl(l*t)} ${Gl(c*i)} 0 0 1 ${n(e-l)} ${r(a)}Z`)}else{const e=s.slice(1);if(e.length<4)continue;let t=`M${n(e[0])} ${r(e[1])}`;for(let i=2;i+10?n:Number.isFinite(r)&&r>0?r:1,s=Number(t),a=o*(Number.isFinite(s)&&s>0?s:1);return Number.isFinite(a)&&a>0?a:o}function Yl(e,t,i,n,r){const o=e+i/2,s=t+n/2,a=(Number(r)||0)*Math.PI/180,l=Math.cos(a),c=Math.sin(a),h=(e,t)=>{const i=e-o,n=t-s;return[o+i*l-n*c,s+i*c+n*l]};return[h(e,t),h(e+i,t),h(e+i,t+n),h(e,t+n)]}function Xl(e,t,i,n,r,o,s){const a=Number.isFinite(s)&&s>0?s:1e-6,l=(Number(e.angle)||0)*Math.PI/180,c=Math.cos(l),h=Math.sin(l),d=-Math.sin(l),u=Math.cos(l),p=e.x+e.w/2,_=e.y+e.h/2,m=t>0?-e.w/2:t<0?e.w/2:0,g=i>0?-e.h/2:i<0?e.h/2:0,f=p+m*c+g*d,v=_+m*h+g*u,y=n-f,b=r-v,w=t?(y*c+b*h)*(t>0?1:-1):e.w,k=i?(y*d+b*u)*(i>0?1:-1):e.h;let x=t?Math.abs(w):e.w,S=i?Math.abs(k):e.h;if(o&&t&&i){const t=x/Math.max(e.w,a),i=S/Math.max(e.h,a),n=Math.abs(t-1)>=Math.abs(i-1)?t:i,r=Math.max(a/e.w,a/e.h),o=Math.max(r,Number.isFinite(n)?n:r);x=e.w*o,S=e.h*o}x=Math.max(a,Number.isFinite(x)?x:a),S=Math.max(a,Number.isFinite(S)?S:a);const $=!!t&&w<0,M=!!i&&k<0,R=t?(t>0?1:-1)*($?-1:1):0,C=i?(i>0?1:-1)*(M?-1:1):0,T=f+R*(x/2)*c+C*(S/2)*d,D=v+R*(x/2)*h+C*(S/2)*u,A=!!e.flip_h!==$,P=!!e.flip_v!==M;return{x:T-x/2,y:D-S/2,w:x,h:S,...Number(e.angle)?{angle:Number(e.angle)}:{},...A?{flip_h:!0}:{},...P?{flip_v:!0}:{}}}function Zl(e,t,i,n){let r=Number(e)+(Number(i)-Number(t));if([r,t,i].every(Number.isFinite)||(r=0),n){const e=r/45;r=45*(e<0?-Math.round(Math.abs(e)):Math.round(e))}return r=(r%360+360)%360,r>180?r-360:r}function Jl(e,t,i,n,r){const o=e.x*t,s=e.y*i,a=e.w*t,l=e.h*i,c=o+a/2,h=s+l/2,d=o+(e.flip_h?a:0),u=s+(e.flip_v?l:0),p=(e.flip_h?-1:1)*a/n,_=(e.flip_v?-1:1)*l/r,m=Number(e.angle)||0;return(m?`rotate(${m} ${c} ${h}) `:"")+`translate(${d} ${u}) scale(${p} ${_})`}function Ql(e,t,i,n=.1){if("string"==typeof e&&!e.trim())return null;const r=Number(e);if(!Number.isFinite(r)||0===r)return null;const o=r*(t?30.48:100),s=Math.abs(o);return si?null:o}function ec(e,t,i){const n=Math.abs(Number(e))/(i?30.48:100),r=Number(n.toFixed(6));return String(t?-r:r)}const tc=15e3,ic=2e3,nc=new WeakMap;function rc(e,t){let i=nc.get(e);if(!i){const t=new Set;i={hiddenAt:"hidden"===e.visibilityState?Date.now():0,token:0,subscribers:t,onVisibility:()=>{const t=nc.get(e);if(!t)return;const i=Date.now();if("hidden"===e.visibilityState){t.hiddenAt||(t.hiddenAt=i);const e={kind:"hidden",token:t.token,at:i,hiddenFor:0,long:!1};for(const i of[...t.subscribers])i(e);return}const n=t.hiddenAt?Math.max(0,i-t.hiddenAt):0;t.hiddenAt=0,t.token++;const r={kind:"visible",token:t.token,at:i,hiddenFor:n,long:n>=tc};for(const e of[...t.subscribers])e(r)},onPageShow:t=>{const i=nc.get(e);if(!i)return;const n=Date.now();i.token++;const r={kind:"pageshow",token:i.token,at:n,hiddenFor:0,long:!!t.persisted,persisted:!!t.persisted};for(const e of[...i.subscribers])e(r)}},nc.set(e,i),e.addEventListener("visibilitychange",i.onVisibility),e.defaultView?.addEventListener("pageshow",i.onPageShow)}return i.subscribers.add(t),()=>{const i=nc.get(e);i&&(i.subscribers.delete(t),i.subscribers.size||(e.removeEventListener("visibilitychange",i.onVisibility),e.defaultView?.removeEventListener("pageshow",i.onPageShow),nc.delete(e)))}}const oc={now:()=>Date.now(),setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e),requestAnimationFrame:e=>window.requestAnimationFrame(e),cancelAnimationFrame:e=>window.cancelAnimationFrame(e)};class sc{constructor(e,t=oc){this.onChange=e,this.clock=t,this._state="steady",this._token=0,this._frameFingerprint="",this._hasCompleteFrame=!1,this._overlayPhase="none",this._recoveryReason=null,this._overlayTimer=0,this._overlayRaf=0,this._overlayOpaqueAt=0,this._barrierRafs=new Set,this._trace=[],this._disposed=!1}get state(){return this._state}get token(){return this._token}get frameFingerprint(){return this._frameFingerprint}get hasCompleteFrame(){return this._hasCompleteFrame}get overlayPhase(){return this._overlayPhase}get overlayVisible(){return"none"!==this._overlayPhase}get overlayBlocksInteraction(){return this.overlayVisible}get recoveryReason(){return this._recoveryReason}get trace(){return this._trace.map(e=>({...e,...e.stage?{stage:[...e.stage]}:{}}))}note(e,t={}){this.record(e,void 0,t)}record(e,t,i={}){this._trace.push({at:this.clock.now(),token:this._token,event:e,state:this._state,...t?{reason:t}:{},...i}),this._trace.length>80&&this._trace.splice(0,this._trace.length-80)}changed(){this._disposed||this.onChange()}adoptCompleteFrame(e){e&&(this._hasCompleteFrame=!0,this._frameFingerprint=e,this._state="steady",this._recoveryReason=null,this.clearOverlay(),this.record("frame-adopted"),this.changed())}markCompleteFrame(e){e&&(this._hasCompleteFrame=!0,this._frameFingerprint=e,this._state="steady",this._recoveryReason=null,this.clearOverlay(),this.record("frame-complete"),this.changed())}refreshCompleteFrame(e){!this._disposed&&this._hasCompleteFrame&&"steady"===this._state&&e&&e!==this._frameFingerprint&&(this._frameFingerprint=e,this.record("frame-refreshed"))}visibility(e){return"hidden"===e.kind?(this.record("visibility-hidden"),this._token):e.long||"visible"!==e.kind&&"pageshow"!==e.kind?this.beginCandidate("pageshow"===e.kind?"pageshow":"long-resume"):(this.record("pageshow"===e.kind?"pageshow-noop":"visibility-visible-quick"),this._token)}beginCandidate(e,t="plan"){return this._token++,this._recoveryReason=t,this._hasCompleteFrame?(this._state="connection"===t?"offline-stale":"holding",this.clearOverlay()):this.overlayVisible?this._state="overlay-visible":(this._state="overlay-pending",this.scheduleOverlay(t)),this.record("candidate-start",e),this.changed(),this._token}connectionLost(){return this.beginCandidate("connection-lost","connection")}candidateReady(e){return!this._disposed&&e===this._token&&(this._state="candidate-ready",this.record("candidate-ready"),this.changed(),!0)}async commitAfterPaint(e,t){if(this._disposed||e!==this._token)return!1;let i=!0;const n=(async()=>{for(await t.updateComplete();i&&!this._disposed&&e===this._token;)if(t.stageValid()&&t.assetsReady()){if(await this.nextFrame(),e!==this._token||!t.stageValid()||!t.assetsReady())continue;if(await this.nextFrame(),e===this._token&&t.stageValid()&&t.assetsReady())return!0}else await this.nextFrame();return!1})();let r=0;const o=new Promise(e=>{r=this.clock.setTimeout(()=>e({ready:!1,timedOut:!0}),ic)}),s=await Promise.race([n.then(e=>({ready:e,timedOut:!1})),o]);return i=!1,this.clock.clearTimeout(r),!this._disposed&&e===this._token&&(!(!s.ready&&!s.timedOut)&&(s.ready?(this._hasCompleteFrame=!0,this._frameFingerprint=t.frameFingerprint(),this.record("paint-barrier"),this.finishOverlayAfterCommit(),!0):(this.record("paint-barrier-timeout"),this._hasCompleteFrame?(this._state="connection"===this._recoveryReason?"offline-stale":"steady",this.clearOverlay()):(this._state="recovery-error","opaque"!==this._overlayPhase&&this.showOverlayNow()),this.changed(),!1)))}retry(e=this._recoveryReason||"plan"){return this.beginCandidate("retry",e)}nextFrame(){return new Promise(e=>{const t=this.clock.requestAnimationFrame(()=>{this._barrierRafs.delete(t),e()});this._barrierRafs.add(t)})}scheduleOverlay(e){this.clearOverlayTimer(),this._recoveryReason=e,this._overlayTimer=this.clock.setTimeout(()=>{this._overlayTimer=0,this._hasCompleteFrame||"overlay-pending"!==this._state&&"candidate-ready"!==this._state||(this._state="overlay-visible",this._overlayPhase="entering",this.record("overlay-enter"),this.changed(),this._overlayRaf=this.clock.requestAnimationFrame(()=>{this._overlayRaf=0,"entering"===this._overlayPhase&&(this._overlayPhase="fading-in",this.changed(),this._overlayTimer=this.clock.setTimeout(()=>{this._overlayTimer=0,"fading-in"===this._overlayPhase&&(this._overlayPhase="opaque",this._overlayOpaqueAt=this.clock.now(),this.record("overlay-opaque"),this.changed())},150))}))},150)}showOverlayNow(){this.clearOverlayTimer(),this._overlayPhase="opaque",this._overlayOpaqueAt=this.clock.now(),this.record("overlay-error")}finishOverlayAfterCommit(){if(this.clearOverlayTimer(),"none"===this._overlayPhase||"entering"===this._overlayPhase||"fading-in"===this._overlayPhase)return this.clearOverlay(),this._state="steady",this._recoveryReason=null,this.record("candidate-committed"),void this.changed();const e=Math.max(0,this._overlayOpaqueAt+250-this.clock.now());this._overlayTimer=this.clock.setTimeout(()=>{this._overlayTimer=0,this._overlayPhase="leaving",this.record("overlay-leave"),this.changed(),this._overlayTimer=this.clock.setTimeout(()=>{this._overlayTimer=0,this._overlayPhase="none",this._state="steady",this._recoveryReason=null,this.record("candidate-committed"),this.changed()},180)},e)}clearOverlayTimer(){this._overlayTimer&&this.clock.clearTimeout(this._overlayTimer),this._overlayTimer=0}clearOverlay(){this.clearOverlayTimer(),this._overlayRaf&&this.clock.cancelAnimationFrame(this._overlayRaf),this._overlayRaf=0,this._overlayPhase="none",this._overlayOpaqueAt=0}dispose(){this._disposed=!0,this._token++,this.clearOverlay();for(const e of this._barrierRafs)this.clock.cancelAnimationFrame(e);this._barrierRafs.clear()}}function ac(e){let t=2166136261,i=2654435769;const n=new WeakSet,r=e=>{for(let n=0;n>>0)+(i>>>2)}},o=e=>{if(null===e)return void r("n");const t=typeof e;if("string"===t)return void r(`s${e.length}:${e}`);if("number"===t)return void r(`d${Number.isNaN(e)?"NaN":String(e)}`);if("boolean"===t)return void r(e?"t":"f");if("undefined"===t)return void r("u");if("object"!==t)return void r(`${t}:${String(e)}`);const i=e;if(n.has(i))r("[cycle]");else{if(n.add(i),Array.isArray(e)){r("[");for(const t of e)o(t);return r("]"),void n.delete(i)}r("{");for(const t of Object.keys(e).sort())r(t),o(e[t]);r("}"),n.delete(i)}};return o(e),`${(t>>>0).toString(16).padStart(8,"0")}${(i>>>0).toString(16).padStart(8,"0")}`}function lc(e){return ac(e)}const cc=new WeakMap;class hc{constructor(e,t=()=>Date.now()){this.onUpdate=e,this.now=t,this.fallbackAuthority={},this.referenceOwner={},this.referenced=new Set,this.queued=new Set,this.disposed=!1,this.sharedUpdate=()=>{this.disposed||this.onUpdate()}}bind(e){const t=((e,t)=>{const i=e?.connection||e?.callWS||t;return!i||"object"!=typeof i&&"function"!=typeof i?t:i})(e,this.fallbackAuthority);return this.shared&&this.authority===t||(this.shared&&(this.shared.listeners.delete(this.sharedUpdate),this.shared.references.delete(this.referenceOwner)),this.authority=t,this.shared=(e=>{let t=cc.get(e);return t||(t={signed:{},queued:new Set,inFlight:new Map,retry:new Map,listeners:new Set,settlers:new Set,references:new Map},cc.set(e,t)),t})(t),this.disposed||(this.shared.listeners.add(this.sharedUpdate),this.shared.references.set(this.referenceOwner,new Set(this.referenced)))),this.shared}start(e,t){this.disposed=!1,this.referenced=new Set(t());const i=this.bind(e());i.listeners.add(this.sharedUpdate),i.references.set(this.referenceOwner,new Set(this.referenced)),this.stopTimer(),this.resignTimer=setInterval(()=>this.resign(e(),t()),288e5)}dispose(){if(this.disposed=!0,this.stopTimer(),clearTimeout(this.batchTimer),this.shared){this.shared.listeners.delete(this.sharedUpdate),this.shared.references.delete(this.referenceOwner);for(const e of this.queued)this.shared.queued.delete(e)}this.queued.clear()}invalidate(e){const t=this.bind(e);clearTimeout(this.batchTimer),this.queued.clear(),t.queued.clear(),t.inFlight.clear(),t.retry.clear(),t.signed={}}stopTimer(){void 0!==this.resignTimer&&clearInterval(this.resignTimer),this.resignTimer=void 0}display(e,t){const i=En(t);if(!i.startsWith("/api/houseplan/content/"))return i;const n=this.bind(e);this.referenced.add(i),n.references.set(this.referenceOwner,new Set(this.referenced));const r=n.signed[i],o=r?this.now()-r.at:1/0;return o{const t=[...this.queued];this.queued.clear();for(const e of t)i.queued.delete(e);this.sign(e,t)},30))}sign(e,t){if(!t.length||!e?.callWS)return;const i=this.bind(e);for(const n of function(e,t){const i=Math.max(1,Math.floor(t)),n=[];for(let t=0;t{const n=i.inFlight.get(e);return!(void 0!==n&&t-n<15e3)&&(i.inFlight.set(e,t),!0)});r.length&&e.callWS({type:"houseplan/content/sign",paths:r}).then(e=>{const t=this.now();let n=0,o=!1;for(const s of r){const r=e?.urls?.[s];if("string"==typeof r&&r){const e=i.signed[s];e?.loaded&&e.url!==r?(e.pending={url:r,at:t},this.preloadReplacement(i,s,r,t)):(i.signed[s]={url:r,at:t,loaded:e?.url===r&&!!e.loaded},o=!0),i.retry.delete(s),n++}else this.backOff(i,s)}if(n&&(this.trimShared(i),o))for(const e of[...i.listeners])e()}).catch(()=>{for(const e of r)this.backOff(i,e)}).finally(()=>{for(const e of r)i.inFlight.get(e)===t&&i.inFlight.delete(e);for(const e of[...i.settlers])e()})}}preloadReplacement(e,t,i,n){const r=()=>{const r=e.signed[t];if(r?.pending?.url===i){e.signed[t]={url:i,at:n,loaded:!0},e.retry.delete(t),this.trimShared(e);for(const t of[...e.listeners])t()}},o=()=>{const n=e.signed[t];n?.pending?.url===i&&(delete n.pending,this.backOff(e,t))};if("undefined"==typeof Image)return void r();const s=new Image;s.onload=()=>{("function"==typeof s.decode?s.decode():Promise.resolve()).then(r).catch(o)},s.onerror=o,s.src=i}preloadCurrentImage(e,t,i){if(i.loaded)return Promise.resolve(!0);if(i.preload)return i.preload;if("undefined"==typeof Image)return i.loaded=!0,Promise.resolve(!0);const n=i.url;return i.preload=new Promise(r=>{const o=new Image;let s=!1;const a=o=>{if(s)return;s=!0,clearTimeout(l);const a=e.signed[t];if(a===i&&delete a.preload,o&&a===i&&a.url===n){a.loaded=!0;for(const t of[...e.listeners])t();r(!0)}else o||a!==i||this.backOff(e,t),r(!1)};o.onload=()=>{("function"==typeof o.decode?o.decode():Promise.resolve()).then(()=>a(!0)).catch(()=>a(!1))},o.onerror=()=>a(!1);const l=setTimeout(()=>a(!1),ic);o.src=n}),i.preload}prepareImage(e,t){const i=En(t);if(!i.startsWith("/api/houseplan/content/"))return Promise.resolve(!0);const n=this.bind(e),r=()=>{const t=n.signed[i];if(t&&this.now()-t.atthis.now()&&!n.inFlight.has(i)&&!n.queued.has(i)?Promise.resolve(!1):null},o=r();return o?(s=o,new Promise(e=>{let t=!1;const i=i=>{t||(t=!0,clearTimeout(n),e(i))},n=setTimeout(()=>i(!1),ic);s.then(i).catch(()=>i(!1))})):new Promise(e=>{let t=!1,i=null;const o=i=>{t||(t=!0,clearTimeout(a),n.settlers.delete(s),e(i))},s=()=>{t||i||(i=r(),i&&i.then(o).catch(()=>o(!1)))},a=setTimeout(()=>o(!1),ic);n.settlers.add(s),s()});var s}backOff(e,t){const i=e.retry.get(t)?.delay||0,n=Math.min(6e4,i?2*i:2e3);e.retry.set(t,{notBefore:this.now()+n,delay:n})}trimShared(e){const t=Object.entries(e.signed);if(t.length<=512)return;const i=new Set(e.inFlight.keys());for(const t of e.references.values())for(const e of t)i.add(e);for(const[e,n]of t)(n.pending||n.preload)&&i.add(e);t.sort((e,t)=>t[1].at-e[1].at);const n=t.filter(([e])=>i.has(e));for(const e of t){if(n.length>=512)break;i.has(e[0])||n.push(e)}e.signed=Object.fromEntries(n)}resign(e,t){const i=this.bind(e);this.referenced=new Set(t),i.references.set(this.referenceOwner,new Set(this.referenced));const n=this.now(),r=new Set;for(const e of i.references.values())for(const t of e)r.add(t);const o={};for(const[e,t]of Object.entries(i.signed))r.has(e)&&n-t.at!!o[e]&&!o[e].pending))}markLoaded(e,t,i){const n=En(t);if(!n.startsWith("/api/houseplan/content/"))return;const r=this.bind(e).signed[n];if(r&&(!i||r.url===i)&&!r.loaded){r.loaded=!0;for(const t of[...this.bind(e).listeners])t()}}isReady(e,t){const i=En(t);if(!i.startsWith("/api/houseplan/content/"))return!0;const n=this.bind(e).signed[i];return!!n&&this.now()-n.at=2&&(this._sequenceMultitouch=!0,this._postGestureClickBlocked=!0))}pointerTerminal(e,t){if("touch"!==t)return!1;const i=this._sequenceMultitouch;return this._activeTouchPointers.delete(e),0===this._activeTouchPointers.size&&(this._sequenceMultitouch=!1),i}reset(){this._activeTouchPointers.clear(),this._sequenceMultitouch=!1,this._postGestureClickBlocked=!1}}const uc=1e-7,pc=(e,t)=>{const i=e.x-t.x,n=e.y-t.y;return i*i+n*n};function _c(e){const t=Math.max(0,e.floorRadius);return{left:Math.min(e.painted.left,e.center.x-t),top:Math.min(e.painted.top,e.center.y-t),right:Math.max(e.painted.right,e.center.x+t),bottom:Math.max(e.painted.bottom,e.center.y+t)}}function mc(e,t){let i=null,n=Number.POSITIVE_INFINITY;for(const r of e){const e=pc(t,r.center);(efunction(e,t){const i=Math.max(0,t.right-t.left),n=Math.max(0,t.bottom-t.top);if(i<=0||n<=0)return!1;const r=Math.min(i,n)/2,o=Math.max(t.left+r,Math.min(t.right-r,e.x)),s=Math.max(t.top+r,Math.min(t.bottom-r,e.y));return pc(e,{x:o,y:s})<=r*r+uc}(t,e.painted));if(i.length)return mc(i,t);return mc(e.filter(e=>{const i=Math.max(0,e.floorRadius);return pc(t,e.center)<=i*i+uc}),t)}class fc{constructor(e,t=44){this.cellSize=t,this.buckets=new Map;const i=Number.isFinite(t)&&t>0?t:44;this.cellSize=i;for(const t of e){const e=_c(t),n=Math.floor(e.left/i),r=Math.floor(e.right/i),o=Math.floor(e.top/i),s=Math.floor(e.bottom/i);for(let e=n;e<=r;e++)for(let i=o;i<=s;i++){const n=`${e}:${i}`,r=this.buckets.get(n);r?r.push(t):this.buckets.set(n,[t])}}}resolve(e){const t=`${Math.floor(e.x/this.cellSize)}:${Math.floor(e.y/this.cellSize)}`;return gc(this.buckets.get(t)||[],e)}}class vc{constructor(){this.active=new Map,this.released=new Map}begin(e,t){this.released.delete(e),this.active.set(e,t)}owner(e){return this.active.get(e)||null}release(e){const t=this.active.get(e)||null;if(!t)return this.released.get(e)||null;for(this.active.delete(e),this.released.set(e,t);this.released.size>16;){const e=this.released.keys().next().value;if(void 0===e)break;this.released.delete(e)}return t}consumeClick(e){const t=this.released.get(e)||null;return this.released.delete(e),t}cancel(e){const t=this.active.get(e)||null;return this.active.delete(e),t}clear(){this.active.clear(),this.released.clear()}}class yc{constructor(){this.index=null,this.pointers=new vc,this.hoverId=null,this.hoverElement=null}invalidate(){this.index=null}reset(e){this.invalidate(),this.pointers.clear(),this.hover(e,null)}clearPointers(){this.pointers.clear()}cancel(e){return this.pointers.cancel(e)}release(e){return this.pointers.release(e)}indexFor(e){if(this.index)return this.index;const t=[];for(const i of e.querySelectorAll('.devlayer > .dev[data-hp="device"][data-id]')){const e=i.querySelector(".device-shell-frame"),n=i.getBoundingClientRect(),r=e?.getBoundingClientRect();!i.dataset.id||!i.isConnected||!r||n.width<=0||n.height<=0||r.width<=0||r.height<=0||t.push({id:i.dataset.id,center:{x:n.left+n.width/2,y:n.top+n.height/2},painted:{left:r.left,top:r.top,right:r.right,bottom:r.bottom},floorRadius:Math.max(22,Math.min(r.width,r.height)/2)})}return this.index=new fc(t),this.index}at(e,t,i,n,r){const o=this.indexFor(e).resolve({x:n,y:r})?.id;return o&&t.find(e=>e.id===o&&e.space===i)||null}byId(e,t,i){return i&&e.find(e=>e.id===i&&e.space===t)||null}begin(e,t,i,n,r){const o=this.at(e,t,i,n.clientX,n.clientY)||r;return this.pointers.begin(n.pointerId,o.id),o}pointer(e,t,i,n,r){const o=n.pointerId;return(Number.isFinite(o)?this.byId(t,i,this.pointers.owner(o)):null)||this.at(e,t,i,n.clientX,n.clientY)||r}click(e,t,i,n,r){if(!(n instanceof PointerEvent))return r;const o=n,s=Number.isFinite(o.pointerId)?this.pointers.consumeClick(o.pointerId):null;return this.byId(t,i,s)||this.at(e,t,i,o.clientX,o.clientY)||r}hover(e,t){this.hoverId===t&&this.hoverElement?.isConnected||(this.hoverElement?.removeAttribute("data-hp-device-hover"),this.hoverId=t,this.hoverElement=t&&[...e.querySelectorAll('.devlayer > .dev[data-hp="device"][data-id]')].find(e=>e.dataset.id===t)||null,this.hoverElement?.setAttribute("data-hp-device-hover",""))}}function bc(e,t){if(t)return e.find(e=>e.id===t)}function wc(e,t){return{id:e,title:t,plan_url:null,view_box:[0,0,1,1],rooms:[],wall_segments:[]}}function kc(e="file"){const t="draw"===e;return{source:e,showBorders:t,showNames:t,displayTouched:!1}}function xc(e,t){if(e.displayTouched)return{...e,source:t};const i="draw"===t;return{...e,source:t,showBorders:i,showNames:i}}function Sc(e,t,i){return{...e,[t]:i,displayTouched:!0}}function $c(e){const t=String(e??"").trim().replace(",",".");if(!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(t))return null;const i=Number(t);return Number.isFinite(i)?i:null}function Mc(e,t){const i=e=>{if(""===String(e??"").trim())return{valid:!0,value:null};const t=$c(e);return{valid:null!==t,value:t}},n=i(e),r=i(t);return n.valid&&r.valid?null!==n.value&&null!==r.value&&n.value>r.value?{valid:!0,min:r.value,max:n.value}:{valid:!0,min:n.value,max:r.value}:{valid:!1,min:n.value,max:r.value}}function Rc(e,t,i,n,r,o){const s=Mc(n,r);return dn(e,t,o&&s.valid?{settings:{...i.settings||{},temp_min:s.min,temp_max:s.max}}:i)}function Cc(e){const t=e=>"number"==typeof e&&Number.isFinite(e)?String(e):"";return[t(e?.temp_min),t(e?.temp_max)]}function Tc(e,t,i){const n=Mc(t,i);return!!n.valid&&(null===n.min?delete e.temp_min:e.temp_min=n.min,null===n.max?delete e.temp_max:e.temp_max=n.max,!0)}var Dc="M11,18H13V16H11V18M12,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,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,6A4,4 0 0,0 8,10H10A2,2 0 0,1 12,8A2,2 0 0,1 14,10C14,12 11,11.75 11,15H13C13,12.75 16,12.5 16,10A4,4 0 0,0 12,6Z";function Ac(e,t,i){return[e[0]*t+e[1]*i+e[2],e[3]*t+e[4]*i+e[5]]}function Pc(e,t){let i=0;for(const[n,r]of t){const t=Ac(e,n[0],n[1]);i=Math.max(i,Math.hypot(t[0]-r[0],t[1]-r[1]))}return i}const Fc=e=>{if(null==e||""===e)return null;const t=Number(e);return Number.isFinite(t)?t:null},zc=e=>{const t=e,i=Fc(Array.isArray(t)?t[0]:t?.x),n=Fc(Array.isArray(t)?t[1]:t?.y);return null==i||null==n?null:[i,n]};function Ic(e){if(!Array.isArray(e))return null;const t=[];for(const i of e){const e=zc(i);if(!e)return null;t.push(e)}if(t.length>1){const e=t[0],i=t[t.length-1];e[0]===i[0]&&e[1]===i[1]&&t.pop()}if(t.length<3)return null;let i=0,n=0,r=0;for(let e=0;ee+t[0],0)/t.length,t.reduce((e,t)=>e+t[1],0)/t.length]:[n/(3*i),r/(3*i)]}function Oc(e){if(!Array.isArray(e))return null;const t=[];for(const i of e){const e=zc(i);if(!e)return null;t.push(e)}if(t.length>1){const e=t[0],i=t[t.length-1];e[0]===i[0]&&e[1]===i[1]&&t.pop()}const i=Ic(t);if(!i)return null;const n=t.map(e=>e[0]),r=t.map(e=>e[1]);return{centroid:i,bbox:[Math.min(...n),Math.min(...r),Math.max(...n),Math.max(...r)]}}function Ec(e){let t=e;if(t&&"object"==typeof t&&!Array.isArray(t)){const e=t;t=e.path??e.points??t}if(!Array.isArray(t)||!t.length)return[];let i=(t.some(e=>(e=>Array.isArray(e)?e.length>=2&&!Array.isArray(e[0])&&("object"!=typeof e[0]||null==e[0]):!!e&&"object"==typeof e&&("x"in e||"y"in e))(e))?[t]:t.filter(Array.isArray)).map(e=>e.map(zc).filter(e=>null!=e)).filter(e=>e.length>=2);i.length>64&&(i=i.slice(-64));const n=i.reduce((e,t)=>e+t.length,0);if(n<=4e3)return i.map(e=>e.slice());const r=4e3-2*i.length,o=i.map(e=>e.length-2),s=o.reduce((e,t)=>e+t,0),a=o.map(e=>r*e/s),l=a.map(Math.floor);let c=r-l.reduce((e,t)=>e+t,0);const h=a.map((e,t)=>({index:t,fraction:e-Math.floor(e)})).sort((e,t)=>t.fraction-e.fraction||e.index-t.index);for(let e=0;efunction(e,t){if(t>=e.length)return e.slice();if(t<=2)return[e[0],e[e.length-1]];const i=[];for(let n=0;ne.slice()),i=t[t.length-1];return i?(i.length>2?i.pop():t.pop(),t):[]}const Lc=e=>Number.isFinite(e[0])&&Number.isFinite(e[1]),Bc=(e,t)=>e[0]===t[0]&&e[1]===t[1];function qc(e){if(!e)return null;const t=e.vacuum_position||e.robot_position||null,i=t&&null!=Fc(t.x)&&null!=Fc(t.y)?{x:Fc(t.x),y:Fc(t.y),a:Fc(t.a??t.angle??t.theta)}:null,n=Ec(e.path?.path??e.path?.points??e.path),r=[],o=e.rooms,s=Array.isArray(o)?o.map((e,t)=>[String(e?.id??t),e]):o&&"object"==typeof o?Object.entries(o):[];for(const[e,t]of s){if(!t||"object"!=typeof t)continue;const i=String(t.name??t.label??"").trim(),n=[[Fc(t.cx),Fc(t.cy)],[Fc(t.center?.x),Fc(t.center?.y)],[Fc(t.x),Fc(t.y)]].find(([e,t])=>null!=e&&null!=t);let o=n?.[0]??null,s=n?.[1]??null;const a=Oc(t.outline),l=Fc(t.x0),c=Fc(t.y0),h=Fc(t.x1),d=Fc(t.y1),u=(null!=l&&null!=c&&null!=h&&null!=d?[Math.min(l,h),Math.min(c,d),Math.max(l,h),Math.max(c,d)]:null)||a?.bbox||null;if(null!=o&&null!=s||!a||([o,s]=a.centroid),null!=o&&null!=s||!u||(o=(u[0]+u[2])/2,s=(u[1]+u[3])/2),i&&null!=o&&null!=s){const t={id:e,name:i,cx:o,cy:s};u&&([t.x0,t.y0,t.x1,t.y1]=u),r.push(t)}}const a=function(e){return String(e.map_name??e.current_map??e.map_index??e.selected_map??"default")}(e);return i||r.length||n.length?{pos:i,path:n,rooms:r,mapId:a}:null}function jc(e,t,i){return![e,t,i].every(Number.isFinite)||e<0||t<=0||i<=0?Number.POSITIVE_INFINITY:e/t*i}const Wc=40;function Uc(e,t,i){if(!e||!t)return null;const n=t.attributes||{},r=e.split(".")[0]||"",o=null!=i?.platform?String(i.platform):null,s=!!zc(n.vacuum_position??n.robot_position),a=!(!n.rooms||"object"!=typeof n.rooms),l=Ec(n.path?.path??n.path?.points??n.path).length>0,c=[n.map_name,n.current_map,n.map_index,n.selected_map].some(e=>null!=e),h="xiaomi_cloud_map_extractor"===o,d=a||l||c;let u=null;if(s?u="compatible":h?u="known_xcme_incomplete":d?u="partial":"camera"===r&&(u="camera"),!u)return null;const p=s?"camera"===r?300:200:h?100:d?50:0;return{entityId:e,name:String(n.friendly_name||e),platform:o,category:u,hasPosition:s,hasRooms:a,hasPath:l,hasMapId:c,score:p}}const Gc=e=>e.toLowerCase().replace(/[\s_\-.,]+/g,"");function Vc(e,t){const i=new Set(t.map(Gc).filter(Boolean)),n=new Set;for(const t of e){const e=Gc(t.name||"");e&&i.has(e)&&n.add(e)}return n.size}function Kc(e,t){const i=new Map(t.map(e=>[Gc(e.name),e])),n=[],r=[];for(const t of e){const e=i.get(Gc(t.name));e&&(n.push([[t.cx,t.cy],[e.cx,e.cy]]),r.push(t.name))}if(n.length<3)return null;const o=function(e){if(e.length<3)return null;let t=0,i=0,n=0,r=0,o=0,s=0,a=0,l=0,c=0,h=0,d=0,u=0;for(const[[p,_],[m,g]]of e){if(![p,_,m,g].every(Number.isFinite))return null;t+=p*p,i+=p*_,n+=p,r+=_*_,o+=_,s+=1,a+=p*m,l+=_*m,c+=m,h+=p*g,d+=_*g,u+=g}const p=[t,i,n,i,r,o,n,o,s],_=e=>{const[t,i,n,r,o,s,a,l,c]=p,h=t*(o*c-s*l)-i*(r*c-s*a)+n*(r*l-o*a);if(!Number.isFinite(h)||Math.abs(h)<1e-9)return null;const d=[(o*c-s*l)/h,(n*l-i*c)/h,(i*s-n*o)/h,(s*a-r*c)/h,(t*c-n*a)/h,(n*r-t*s)/h,(r*l-o*a)/h,(i*a-t*l)/h,(t*o-i*r)/h];return[d[0]*e[0]+d[1]*e[1]+d[2]*e[2],d[3]*e[0]+d[4]*e[1]+d[5]*e[2],d[6]*e[0]+d[7]*e[1]+d[8]*e[2]]},m=_([a,l,c]),g=_([h,d,u]);if(!m||!g)return null;const f=[m[0],m[1],m[2],g[0],g[1],g[2]];return f.every(Number.isFinite)?f:null}(n);return o?{matrix:o,matched:r,residual:Pc(o,n)}:null}function Yc(e,t,i){const n=e[e.length-1];if(n&&n[0]===t[0]&&n[1]===t[1])return e;if(e.push(t),e.length<=600)return e;let r=function(e,t){if(e.length<3)return e.slice();const i=new Uint8Array(e.length);i[0]=i[e.length-1]=1;const n=[[0,e.length-1]];for(;n.length;){const[r,o]=n.pop(),[s,a]=e[r],[l,c]=e[o],h=l-s,d=c-a,u=Math.hypot(h,d)||1e-9;let p=0,_=-1;for(let t=r+1;tp&&(p=i,_=t)}_>0&&p>t&&(i[_]=1,n.push([r,_],[_,o]))}const r=[];for(let t=0;t600&&(r=r.filter((e,t)=>t%2==0||t===r.length-1)),r}function Xc(e){return"cleaning"===e||"returning"===e||"on"===e}const Zc={0:[1,0],90:[0,1],180:[-1,0],270:[0,-1]};function Jc(e){const[t,i]=Zc[e.rot]||[1,0],n=e.mir?-1:1;return[e.s*t*n,-e.s*i,e.ox,e.s*i*n,e.s*t,e.oy]}function Qc(e){const t=e[0]*e[4]-e[1]*e[3];if(!Number.isFinite(t)||Math.abs(t)<1e-12)return null;const i=t<0,n=Math.sqrt(Math.abs(t));let r=180*Math.atan2(-e[1],e[4])/Math.PI;return r=(90*Math.round(r/90)%360+360)%360,{ox:e[2],oy:e[5],s:n,rot:r,mir:i}}function eh(e,t){const i=[],n=[];for(const t of e)null!=t.x0?(i.push(t.x0,t.x1),n.push(t.y0,t.y1)):(i.push(t.cx),n.push(t.cy));if(!i.length)return{ox:t[0]+t[2]/2,oy:t[1]+t[3]/2,s:t[2]/1e4,rot:0,mir:!0};const r=Math.min(...i),o=Math.max(...i),s=Math.min(...n),a=Math.max(...n),l=Math.max(o-r,a-s)||1,c={ox:0,oy:0,s:.6*Math.min(t[2],t[3])/l,rot:0,mir:!0},h=Jc(c),[d,u]=Ac(h,(r+o)/2,(s+a)/2);return c.ox=t[0]+t[2]/2-d,c.oy=t[1]+t[3]/2-u,c}function th(e,t,i,n){const[r,o]=Ac(Jc(t),i,n),s=Jc({...e,ox:0,oy:0}),[a,l]=Ac(s,i,n);return{...e,ox:r-a,oy:o-l}}function ih(e){const t=e?.trail_mode;return"never"===t||"cleaning"===t||"always"===t?t:!1===e?.trail?"never":"cleaning"}const nh=e=>"number"==typeof e&&Number.isFinite(e);function rh(e){return Array.isArray(e)&&6===e.length&&e.every(nh)?[e[0],e[1],e[2],e[3],e[4],e[5]]:null}function oh(e,t,i){return"legacy:"+e+" "+t+" "+i}function sh(e,t,i,n){const r=t?.map_routes;if(Array.isArray(r))return r.filter(e=>e&&"string"==typeof e.id&&e.id).map(e=>({id:e.id,source:String(e.source??""),map_id:String(e.map_id??""),space:String(e.space??""),calibration:rh(e.calibration)}));const o="string"==typeof t?.source&&t.source?t.source:n||"";if(!o)return[];const s=t?.calibration;if(!s||"object"!=typeof s)return[];const a=[];for(const t of Object.keys(s)){const n=rh(s[t]);n&&a.push({id:oh(e,o,t),source:o,map_id:t,space:i,calibration:n})}return a}const ah=(e,t)=>e instanceof Map?e.get(t):e?.[t];function lh(e){const t=[];let i=!1,n="",r="";for(const o of e.routes){const s=ah(e.observed,o.source);void 0!==s&&(i=!0,n||(n=o.source,r=s),s===o.map_id&&t.push(o))}if(t.length>1)return{kind:"ambiguous",routeIds:t.map(e=>e.id).sort()};if(1===t.length){const i=t[0];if(e.spaceIds&&!e.spaceIds.has(i.space))return{kind:"missing_space",route:i};const n=rh(i.calibration);return n?{kind:"ready",route:{...i,calibration:n}}:{kind:"needs_calibration",route:i}}if(i)return{kind:"unmapped",source:n,mapId:r};const o=e.observed instanceof Map?[...e.observed.entries()]:Object.entries(e.observed||{});if(o.length){const e=o.slice().sort((e,t)=>e[0].localeCompare(t[0]))[0];return{kind:"unmapped",source:e[0],mapId:e[1]}}return{kind:"none"}}function ch(e,t,i){const n=new Set;for(const t of e)t.source&&n.add(t.source);for(const e of t)e&&n.add(e);const r={};for(const e of[...n].sort()){const t=i(e);void 0!==t&&(r[e]=t)}return r}function hh(e,t,i){if(!e)return null;const n="string"==typeof e.route_id?e.route_id:"";if(n)return t.find(e=>e.id===n)||null;const r=function(e,t,i){if(!e||"string"!=typeof e.map_id)return{kind:"orphan_run"};const n=e.map_id,r="string"==typeof i?i:"";let o=t.filter(e=>e.map_id===n);return r&&(o=o.filter(e=>e.source===r)),1===o.length?{kind:"adopted",route:o[0]}:0===o.length?{kind:"orphan_run"}:{kind:"ambiguous_run",routeIds:o.map(e=>e.id).sort()}}(e,t,i);return"adopted"===r.kind?r.route:null}function dh(e){const t="ready"===e.resolution.kind?e.resolution.route:null,i=t&&t.space===e.renderSpace?rh(t.calibration):null,n=hh(e.serverCurrent,e.routes,e.rootSource),r=!!t&&!!n&&n.id===t.id,o=hh(e.serverPrevious,e.routes,e.rootSource);return{live:i,currentRunMatches:r,previous:!!o&&o.space===e.renderSpace&&(e.explicitRoutes||!!t&&o.id===t.id)?rh(o.calibration):null}}const uh={availability:"available",status:"alarm",activity:"none"},ph=new Set(["motion","vibration","sound"]),_h=new Set(["occupancy","presence"]),mh=new Set(["door","window","garage_door","opening"]),gh=new Set(["running","power"]),fh=new Set(["smoke","gas","carbon_monoxide","moisture","safety","tamper","problem"]);const vh=new Set(["running","working","washing","rinsing","spinning","drying","heating","cooling","cleaning","cooking","playing","recording","pumping","irrigating","humidifying","dehumidifying","fan","preheating","defrosting"]),yh=new Set([...vh,"start","started","run","active","in_progress","wash","rinse","spin","dry"]),bh=new Set(["off","idle","paused","standby","docked","finished","complete","completed","stopped","ready","sleeping","stop","end","done","inactive"]),wh=new Set(["heat","cool","heat_cool","auto","dry","fan_only"]),kh=e=>""===e||"unknown"===e||"unavailable"===e||"__missing__"===e,xh=e=>String(e??"").trim().toLowerCase(),Sh=e=>xh(e).replace(/[\s-]+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),$h=new Map([["run_state",0],["job_state",0],["operation_state",0],["activity_state",0],["machine_state",1],["running_state",1],["status",2],["device_status",2],["machine_status",2]]),Mh=new Set(["wifi","connection","signal","battery"]);function Rh(e,t){const i=e?.entities?.[t]||{};if("config"===i.entity_category)return null;const n=String(t||"").split(".").slice(1).join("."),r=[i.translation_key,i.original_name,i.name],o=[...r,n];r.some(e=>xh(e))||o.push(e?.states?.[t]?.attributes?.friendly_name);const s=o.map(Sh).filter(Boolean);if(s.some(e=>e.split("_").some(e=>Mh.has(e))))return null;let a=null;for(const e of s)for(const[t,i]of $h)(e===t||e.endsWith(`_${t}`))&&(a=null==a?i:Math.min(a,i));return a}const Ch=(e,t)=>null!=Rh(e,t);function Th(e,t){if(!t.startsWith("switch."))return!1;const i=e?.entities?.[t]||{},n=e?.states?.[t],r=t.slice(7).toLowerCase();if(/(?:^|_)(?:main_)?power$/.test(r))return!0;if([i.translation_key,i.original_name,i.name].map(xh).some(e=>["power","main power","power switch","питание"].includes(e)))return!0;const o=xh(n?.attributes?.friendly_name);return/(?:^|[\s._-])(?:main[\s._-]+)?power$/.test(o)||/(?:^|[\s._-])питание$/.test(o)}function Dh(e){for(const t of["hvac_action","action","current_operation","run_state","job_state","operation","activity"]){const i=xh(e?.[t]);if(vh.has(i)||bh.has(i))return i}return""}function Ah(e,t){const i=e?.states?.[t],n=i?xh(i.state):"__missing__",r=String(t||"").split(".")[0],o=xh(i?.attributes?.device_class),s={eid:t,state:n,availability:kh(n)?"unavailable":"available",status:"neutral",activity:"none",edge:"none"};if("unavailable"===s.availability)return s;if(function(e,t,i){return"alarm_control_panel"===e?"triggered"===i:"on"===i&&Vn(e,t)}(r,o,n))return{...s,status:"alarm"};if("binary_sensor"===r)return ph.has(o)?{...s,edge:"rising"}:_h.has(o)?{...s,activity:"on"===n?"presence":"none"}:mh.has(o)?{...s,status:"on"===n?"open":"neutral",edge:"rising"}:"moving"===o?{...s,activity:"on"===n?"transition":"none"}:gh.has(o)&&"on"===n?{...s,status:"working",activity:"running"}:s;if("cover"===r)return{...s,activity:"opening"===n||"closing"===n?"transition":"none",edge:"terminal_transition"};if("lock"===r)return{...s,status:"unlocked"===n||"open"===n?"open":"neutral",activity:"locking"===n||"unlocking"===n?"transition":"none",edge:"terminal_transition"};if("valve"===r)return{...s,status:["open","opening","closing"].includes(n)?"open":"neutral",activity:"opening"===n||"closing"===n?"transition":"none",edge:"terminal_transition"};if("climate"===r){const e=Dh(i.attributes),t=Array.isArray(i.attributes?.hvac_modes)?i.attributes.hvac_modes.map(xh):[],r=!bh.has(n)&&(wh.has(n)||vh.has(n)||t.includes(n));return(e?vh.has(e):r)?{...s,status:"working",activity:"running"}:s}if(["light","switch","fan","humidifier"].includes(r))return"on"===n?{...s,status:"working",activity:"running"}:s;if("media_player"===r)return"off"===n?{...s,availability:"unavailable"}:s;if("vacuum"===r)return"cleaning"===n?{...s,status:"working",activity:"running"}:"returning"===n?{...s,status:"working",activity:"transition"}:s;if("script"===r)return"on"===n?{...s,status:"working",activity:"running"}:s;if("automation"===r)return s;if("button"===r||"event"===r)return{...s,edge:"change"};const a=Dh(i.attributes);return vh.has(a)||vh.has(n)&&!bh.has(n)?{...s,status:"working",activity:"running"}:s}function Ph(e,t,i){const n=i.filter(t=>t.startsWith("switch.")&&!e?.entities?.[t]?.entity_category),r=t.find(t=>Th(e,t));if(!(n.length>1&&!!r))return t.map(t=>Ah(e,t));const o=t.find(t=>t!==r&&Ch(e,t)),s=Ah(e,r);return"unavailable"===s.availability||"off"===s.state?t.map(t=>({eid:t,state:e?.states?.[t]?xh(e.states[t].state):"__missing__",availability:"unavailable",status:"neutral",activity:"none",edge:"none"})):t.map(t=>{if(t===o)return function(e,t){const i=e?.states?.[t],n=i?xh(i.state):"__missing__",r={eid:t,state:n,availability:kh(n)?"unavailable":"available",status:"neutral",activity:"none",edge:"none"};if("unavailable"===r.availability)return r;const o=Dh(i?.attributes);return vh.has(o)||yh.has(n)&&!bh.has(n)?{...r,status:"working",activity:"running"}:r}(e,t);return{...t===r?s:Ah(e,t),status:"neutral",activity:"none",edge:"none"}})}function Fh(e){if(!e.length)return{availability:"available",status:"neutral",activity:"none"};const t=e.filter(e=>"available"===e.availability);if(!t.length)return{availability:"unavailable",status:"neutral",activity:"none"};if(t.some(e=>"alarm"===e.status))return uh;const i=t.some(e=>"working"===e.status)?"working":t.some(e=>"open"===e.status)?"open":"neutral",n=t.some(e=>"transition"===e.activity)?"transition":t.some(e=>"presence"===e.activity)?"presence":t.some(e=>"running"===e.activity)?"running":"none";return{availability:"available",status:i,activity:n}}function zh(e,t){if(!(e=>!!e&&!kh(e))(e)||"unavailable"===t.availability||e===t.state)return null;if("rising"===t.edge)return"off"===e&&"on"===t.state?"event":null;if("change"===t.edge)return"event";if("terminal_transition"===t.edge){const i=new Set([e,t.state]);if(i.has("closed")&&i.has("open")||i.has("locked")&&i.has("unlocked"))return"transition"}return null}const Ih=(e,t=0)=>{const i=Number(e);return Number.isInteger(i)&&i>=0?i:t},Oh=(e,t)=>{const i={rev:0,configRev:Ih(t),off:new Set};if(null==e)return{snapshot:i,valid:!1};const n=e.off;return!Number.isInteger(e.rev)||Number(e.rev)<0||!Number.isInteger(e.config_rev)||Number(e.config_rev)<0||!Array.isArray(n)||n.some(e=>"string"!=typeof e||!e)?{snapshot:i,valid:!1}:{snapshot:{rev:Number(e.rev),configRev:Number(e.config_rev),off:new Set(n)},valid:!0}};function Eh(e,t=0){return Oh(e,t).snapshot}function Nh(e,t,i,n){const r=Oh(t,i);return n&&r.valid&&r.snapshot.configRev===i?e.configRev===i&&r.snapshot.rev{try{const[i,n]=await Promise.all([e.callWS({type:"config/device_registry/list"}),e.callWS({type:"config/entity_registry/list"})]),r=Yh(i,"id"),o=Yh(n,"entity_id");if(!r||!o)throw new Error("invalid_registry_response");t.devices=r,t.entities=o,t.authoritative=!0,t.access="full",t.lastSuccess=Date.now(),t.error=void 0}catch(e){t.authoritative=!1,t.access="limited",t.error=function(e){if(e&&"object"==typeof e){const t=e;return String(t.message||t.code||t.error||"registry_unavailable")}return String(e||"registry_unavailable")}(e)}finally{t.revision++,t.loading=void 0,function(e){for(const t of[...e.listeners])try{t()}catch{}}(t)}})()),t.loading}function Zh(e,t){void 0===t.reloadTimer&&(t.reloadTimer=globalThis.setTimeout(()=>{t.reloadTimer=void 0,Xh(e,t)},80))}async function Jh(e,t){if(t.subscribing||t.unsubDevice&&t.unsubEntity)return t.subscribing;const i=e?.connection?.subscribeEvents;return"function"==typeof i?(t.subscribing=(async()=>{try{t.unsubDevice||(t.unsubDevice=await i.call(e.connection,()=>Zh(e,t),"device_registry_updated")),t.unsubEntity||(t.unsubEntity=await i.call(e.connection,()=>Zh(e,t),"entity_registry_updated"))}catch{}finally{0===t.refs&&(t.unsubDevice?.(),t.unsubEntity?.(),t.unsubDevice=void 0,t.unsubEntity=void 0),t.subscribing=void 0}})(),t.subscribing):void 0}function Qh(e,t){const i=Kh(e);if(!i)return()=>{};const n=0===i.refs;i.refs++,i.listeners.add(t),("pending"===i.access||n)&&Xh(e,i),Jh(e,i);let r=!1;return()=>{r||(r=!0,i.listeners.delete(t),i.refs=Math.max(0,i.refs-1),i.refs>0||(i.unsubDevice?.(),i.unsubEntity?.(),i.unsubDevice=void 0,i.unsubEntity=void 0,void 0!==i.reloadTimer&&globalThis.clearTimeout(i.reloadTimer),i.reloadTimer=void 0))}}function ed(e){const t=Kh(e);t&&(Zh(e,t),Jh(e,t))}function td(e){const t=Kh(e);if(!t)return{revision:0,authoritative:!1,access:"limited",devices:e?.devices||{},entities:e?.entities||{},lastSuccess:0,error:"registry_unavailable"};let i=e?.devices||{},n=e?.entities||{};if(t.authoritative){const r=t.liveDevices!==i||t.liveEntities!==n,o=void 0!==t.liveDevices||void 0!==t.liveEntities;if(r&&(t.liveDevices=i,t.liveEntities=n,t.projectedRevision=void 0,o&&Zh(e,t)),t.projectedRevision!==t.revision||!t.projectedDevices||!t.projectedEntities){const e={...t.devices},r={...t.entities};for(const[t,n]of Object.entries(i))Object.prototype.hasOwnProperty.call(e,t)||(e[t]=n);for(const[e,t]of Object.entries(n))Object.prototype.hasOwnProperty.call(r,e)||(r[e]=t);t.projectedDevices=e,t.projectedEntities=r,t.projectedRevision=t.revision}i=t.projectedDevices,n=t.projectedEntities}return{revision:t.revision,authoritative:t.authoritative,access:t.access,devices:i,entities:n,lastSuccess:t.lastSuccess,error:t.error}}function id(e){if(!e||"object"!=typeof e&&"function"!=typeof e)return 0;let t=Wh.get(e);return t||(t=Uh++,Wh.set(e,t)),t}function nd(e,t=td(e)){return[t.revision,t.access,id(t.devices),id(t.entities)].join(":")}function rd(e){return!!e&&null==e.disabled_by}function od(e,t=td(e)){const i={},n={},r={};for(const[e,n]of Object.entries(t.devices||{}))rd(n)&&(i[e]=n);for(const[e,i]of Object.entries(t.entities||{})){if(!rd(i))continue;const r=i.device_id?t.devices?.[i.device_id]:null;t.authoritative&&i.device_id&&!r||(r&&!rd(r)||(n[e]=i))}for(const[i,n]of Object.entries(e?.states||{})){const e=t.entities?.[i];if(e&&!rd(e))continue;const o=e?.device_id?t.devices?.[e.device_id]:null;t.authoritative&&e?.device_id&&!o||(o&&!rd(o)||(r[i]=n))}return{...e,devices:i,entities:n,states:r}}function sd(e,t=td(e)){return{...e,devices:t.devices||{},entities:t.entities||{}}}function ad(e,t){const i=[];for(const[n,r]of Object.entries(e||{}))r?.device_id===t&&i.push(n);return i}function ld(){if(Vh)return Vh;if("undefined"==typeof localStorage)return{};try{const e=JSON.parse(localStorage.getItem(Gh)||"{}");if(!e||"object"!=typeof e||Array.isArray(e))return{};const t=Date.now(),i={};for(const[n,r]of Object.entries(e))!r||"active"!==r.kind&&"ha_disabled"!==r.kind||!Number.isFinite(r.ts)||t-r.ts>7776e6||(i[n]=r);return Vh=i,Vh}catch{return{}}}function cd(e,t,i=td(e)){if(!t||"virtual"===t)return{kind:"active",enabledEntityIds:[],allEntityIds:[]};const n=t.indexOf(":");if(n<1)return{kind:"unverified",reason:"registry_unavailable",enabledEntityIds:[],allEntityIds:[]};const r=t.slice(0,n),o=t.slice(n+1);if("device"!==r&&"entity"!==r||!o)return{kind:"unverified",reason:"registry_unavailable",enabledEntityIds:[],allEntityIds:[]};const s=i.devices||{},a=i.entities||{};if(i.authoritative){if("device"===r){const e=s[o];if(!e)return{kind:"orphaned",reason:"device_missing",enabledEntityIds:[],allEntityIds:[]};const t=ad(a,o);if(!rd(e))return{kind:"ha_disabled",reason:"device",enabledEntityIds:[],allEntityIds:t};const i=t.filter(e=>rd(a[e]));return t.length&&!i.length?{kind:"ha_disabled",reason:"all_entities",enabledEntityIds:[],allEntityIds:t}:{kind:"active",enabledEntityIds:i,allEntityIds:t}}const t=a[o];return t&&!rd(t)?{kind:"ha_disabled",reason:"entity",enabledEntityIds:[],allEntityIds:[o]}:t?.device_id&&!s[t.device_id]?{kind:"orphaned",reason:"device_missing",enabledEntityIds:[],allEntityIds:[o]}:t?.device_id&&!rd(s[t.device_id])?{kind:"ha_disabled",reason:"device",enabledEntityIds:[],allEntityIds:[o]}:t||e?.states?.[o]?{kind:"active",enabledEntityIds:[o],allEntityIds:[o]}:{kind:"orphaned",reason:"entity_missing",enabledEntityIds:[],allEntityIds:[]}}const l=function(e){return ld()[e]||null}(t);if("device"===r){const t=s[o],i=ad(a,o);if(null!=t?.disabled_by)return{kind:"ha_disabled",reason:"device",enabledEntityIds:[],allEntityIds:i};const n=i.filter(e=>{const t=a[e];return null==t?.disabled_by&&(!t.device_id||null==s[t.device_id]?.disabled_by)});if(i.length&&!n.length&&i.every(e=>null!=a[e]?.disabled_by))return{kind:"ha_disabled",reason:"all_entities",enabledEntityIds:[],allEntityIds:i};if("ha_disabled"===l?.kind)return{kind:"ha_disabled",reason:l.reason||"device",enabledEntityIds:[],allEntityIds:i};if(t||n.some(t=>!!e?.states?.[t]))return{kind:"active",enabledEntityIds:n,allEntityIds:i}}else{const t=a[o];if(null!=t?.disabled_by)return{kind:"ha_disabled",reason:"entity",enabledEntityIds:[],allEntityIds:[o]};if(t?.device_id&&null!=s[t.device_id]?.disabled_by)return{kind:"ha_disabled",reason:"device",enabledEntityIds:[],allEntityIds:[o]};if("ha_disabled"===l?.kind)return{kind:"ha_disabled",reason:l.reason||"entity",enabledEntityIds:[],allEntityIds:[o]};if(t||e?.states?.[o])return{kind:"active",enabledEntityIds:[o],allEntityIds:[o]}}return{kind:"unverified",reason:"registry_unavailable",enabledEntityIds:[],allEntityIds:[]}}function hd(e){const t=td(e);return{access:t.access,authoritative:t.authoritative,revision:t.revision,lastSuccess:t.lastSuccess,error:t.error}}function dd(e){const t={};for(const[i,n]of Object.entries(e.entities)){if(!n?.device_id||!rd(n))continue;const r=e.devices?.[n.device_id];r&&!rd(r)||(t[n.device_id]=t[n.device_id]||[]).push(i)}return t}function ud(e,t){const i=new Map;for(const n of e){if(!0===n?.removed)continue;const e=n?.binding||"";if(!e.startsWith("entity:"))continue;const r=e.slice(7);if(!r)continue;const o=t?.entities?.[r]?.device_id;if(!o)continue;const s=i.get(o)||new Set;s.add(r),i.set(o,s)}return{byDevice:i}}function pd(e,t,i,n){const r=n.byDevice.get(t);return r?.size?{partial:!0,entityIds:i.filter(t=>!r.has(t)&&!e?.entities?.[t]?.hidden)}:{partial:!1,entityIds:[...i]}}function _d(e,t,i){if(t.identifiers?.[0]?.[0])return t.identifiers[0][0];for(const t of i){const i=e.entities[t]?.platform;if(i)return i}return""}function md(e,t){if(/_device_temperature$/.test(t))return!1;if(e.entities?.[t]?.entity_category)return!1;const i=e.states[t];if(!i)return/_temperature$/.test(t);const n=i.attributes||{};return"temperature"===n.device_class||/°C|°F/.test(n.unit_of_measurement||"")||/_temperature$/.test(t)}const gd=["vacuum","lawn_mower","climate","media_player","light","cover","lock","valve","alarm_control_panel","water_heater","fan","humidifier","siren","camera","remote"],fd=e=>[...e.filter(e=>!e.reg?.hidden),...e.filter(e=>!!e.reg?.hidden)];function vd(e,t){const i=t.map(t=>({eid:t,reg:e?.entities?.[t]})).filter(e=>!!e.reg);if(!i.length)return[];const n=i.filter(e=>!e.reg.entity_category),r=n.length?n:i;for(const e of gd){const t=r.filter(t=>t.eid.startsWith(e+"."));if(t.length)return fd(t).map(e=>e.eid)}const o=r.filter(t=>function(e,t){if(!t.startsWith("binary_sensor."))return!1;const i=xh(e?.states?.[t]?.attributes?.device_class||e?.entities?.[t]?.device_class||e?.entities?.[t]?.original_device_class);return ph.has(i)||_h.has(i)||mh.has(i)||gh.has(i)||"moving"===i||fh.has(i)}(e,t.eid));if(o.length)return fd(o).map(e=>e.eid);const s=r.filter(e=>e.eid.startsWith("switch."));if(s.length){const t=fd(s),n=t.find(t=>Th(e,t.eid));if(s.length>1&&n){const t=i.filter(t=>t.eid!==n.eid&&"config"!==t.reg?.entity_category&&null!=Rh(e,t.eid)),r=t.filter(e=>!e.reg?.entity_category),o=r.length?r:t;for(const t of[0,1,2]){const i=fd(o.filter(i=>Rh(e,i.eid)===t));if(i.length)return[i[0].eid,n.eid]}}return[(n||t[0]).eid]}const a=[];for(const e of je)a.push(...fd(r.filter(t=>t.eid.startsWith(e+"."))));return a.push(...fd(r.filter(e=>!je.includes(e.eid.split(".")[0])))),a.map(e=>e.eid)}function yd(e,t,i){const n=t.map(t=>({eid:t,reg:e.entities[t],st:e.states[t]})).filter(e=>e.reg),r=[n.filter(e=>!e.reg.hidden&&!e.reg.entity_category),n.filter(e=>!e.reg.entity_category),n.filter(e=>!e.reg.hidden),n];if("mdi:thermometer"===i||"mdi:air-filter"===i)for(const t of r){const i=t.find(t=>md(e,t.eid));if(i)return i.eid}const o=vd(e,t);return o.find(Dn)||o[0]}function bd(e,t,i=[]){return[...new Set(wd(e,t,i))].filter(e=>Dn(e))}function wd(e,t,i=[]){const n=e?.startsWith("entity:")?new Set([e.slice(7)]):new Set(i);return(t||[]).filter(e=>"string"==typeof e&&!n.has(e))}function kd(e,t){if("string"==typeof t)return e.area===t;const i=e.marker?.room_id;return i?!!t.id&&i===t.id:!!t.area&&e.area===t.area}function xd(e){const t=e.marker?.binding?.startsWith("entity:")?e.marker.binding.slice(7):null,i=e.entities.filter(Dn),n=e.primary&&Dn(e.primary)?e.primary:null;return[...new Set([t,n,...i].filter(e=>!!e&&Dn(e)))]}function Sd(e){const t=xd(e),i=e.marker?.light_entity;return i&&t.includes(i)?i:t[0]||null}function $d(e,t){if(!1===t.marker?.is_light)return[];if(!0===t.marker?.is_light){return[{eid:Sd(t),via:"forced"}]}const i=t.primary||vd(e,t.entities)[0];return i&&!i.startsWith("light.")?[]:t.entities.filter(t=>t.startsWith("light.")&&!!e.states?.[t]).map(e=>({eid:e,via:"light"}))}const Md=new WeakMap,Rd=new WeakMap;function Cd(e){return e.map(e=>[e.id||"",!0===e.hidden?1:0,e.primary||"",[...e.entities].join(","),void 0===e.controls?"":[...e.controls].join(","),e.marker?.id||"",e.marker?.binding||"",e.marker?.is_light,e.marker?.tap_action||"",!0===e.marker?.removed?1:0,e.marker?.light_entity||"",null==e.marker?.controls?"":[...e.marker.controls].join(",")].join("")).join("")}function Td(e){const t=Cd(e),i=Md.get(e);if(i?.fingerprint===t)return i;const n=e.filter(e=>!e.hidden),r=new Map,o=new Map;for(const t of e){o.set(t,wd(t.marker?.binding,t.marker?.controls??t.controls,t.entities));const e=t.hidden||!0!==t.marker?.is_light?null:t.marker?.id||t.id;e&&r.set(String(e),t)}const s=new Map;for(const t of e){const e=o.get(t)||[],i=new Set(void 0===t.controls?e.filter(Dn):t.controls.filter(Dn)),n=Sd(t),a=i.size?[...i]:n?[n]:[];for(const i of e){if(!i.startsWith("marker:"))continue;const e=i.slice(7);if(!e||e===String(t.marker?.id||t.id||""))continue;if(!r.has(e))continue;const n=s.get(e)||{markerId:e,controllers:[],driverEids:[]};n.controllers.push({device:t,driverEids:[...a]}),n.driverEids=[...new Set([...n.driverEids,...a])],s.set(e,n)}}const a={fingerprint:t,visible:n,markerById:r,persistedByDevice:o,incomingByMarker:s};return Md.set(e,a),a}function Dd(e){return Td(e).incomingByMarker}function Ad(e,t){const i=bd(t.marker?.binding,t.controls??t.marker?.controls,t.entities),n=wd(t.marker?.binding,t.marker?.controls??t.controls,t.entities);return(null!=t.marker?.is_light||!i.length&&!n.some(e=>e.startsWith("marker:")))&&$d(e,t).length>0}function Pd(e,t){return $d(e,t).some(e=>!!e.eid)}function Fd(e,t,i,n){const r="always"===e||"auto"===e&&t,o=r&&!i;return{sourceExists:r,fromSourceEnabled:r&&i,manualEnabled:r,radiusEnabled:r,passive:o,effectiveMode:o&&"auto"===n?"fixed":n}}function zd(e,t){const i=bd(t.marker?.binding,t.controls??t.marker?.controls,t.entities).map(e=>({eid:e,via:"controls"})),n=Ad(e,t)?$d(e,t):[];for(const e of n)e.eid&&i.some(t=>t.eid===e.eid)||i.push(e);return i}function Id(e,t,i,n){if(null!=i)return Id(e,t,null,n).filter(e=>kd(e.device,i));const r=Cd(t),o=function(e,t){const i=new Set;for(const e of t){for(const t of e.entities)i.add(t);for(const t of e.controls||e.marker?.controls||[])"string"!=typeof t||t.startsWith("marker:")||i.add(t)}return[...i].sort().map(t=>`${t}:${e?.states?.[t]?.state??""}`).join("|")}(e,t),s=Hh(n),a=Rd.get(t);if(a?.graphFingerprint===r&&a.stateFingerprint===o&&a.virtualLightFingerprint===s&&a.registry===e?.entities)return a.sources;const{visible:l,markerById:c,persistedByDevice:h,incomingByMarker:d}=Td(t),u=null==i?l:l.filter(e=>kd(e,i)),p=new Map,_=new Map;for(const t of u){const i=zd(e,t).filter(e=>"controls"!==e.via);for(const n of i){const i=!0===t.marker?.is_light?String(t.marker?.id||t.id||""):"",r=i?`marker:${i}`:`entity:${n.eid}`,o=n.eid?[n.eid]:[],s={key:r,eid:n.eid||"",stateEids:o,serviceEids:o,device:t,via:n.via,castsGlow:!0,passive:!n.eid,on:!n.eid||"on"===e.states?.[n.eid]?.state};p.set(t,[...p.get(t)||[],s]),n.eid&&_.set(n.eid,s)}}const m=new Map;for(const e of t){const t=h.get(e)||[],i=new Set(void 0===e.controls?t.filter(Dn):e.controls);m.set(e,i)}for(const t of p.values())for(const i of t){if(!i.passive)continue;const t=i.key.slice(7),r=d.get(t);i.on=!r||r.driverEids.some(t=>"on"===e.states?.[t]?.state),!r&&Lh(i.device.marker)&&(i.on=Bh(i.device.marker,n))}const g=new Map,f=e=>{const t=g.get(e.key);(!t||e.castsGlow&&!t.castsGlow)&&g.set(e.key,e)};for(const t of l){const n=h.get(t)||[],r=null==i||kd(t,i);for(const i of n){if(i.startsWith("marker:")){const e=c.get(i.slice(7)),t=e?p.get(e):null;if(t)for(const e of t)f(e);continue}if(!Dn(i)||!m.get(t)?.has(i))continue;const n=_.get(i);n?f(n):r&&f({key:`entity:${i}`,eid:i,stateEids:[i],serviceEids:[i],device:t,via:"controls",castsGlow:!1,passive:!1,on:"on"===e.states?.[i]?.state})}for(const e of p.get(t)||[])f(e)}const v=[...g.values()];return Rd.set(t,{graphFingerprint:r,stateFingerprint:o,virtualLightFingerprint:s,registry:e?.entities,sources:v}),v}function Od(e){const t=e.filter(e=>e.castsGlow);return t.find(e=>e.on)||t[0]||null}function Ed(e){return e.length?e.some(e=>e.on)?"on":"off":"none"}function Nd(e,t){const i=[];for(const n of t){const t=e.states[n];if(!t)continue;const r=(t.attributes?.unit_of_measurement||"").toLowerCase();if(/_(linkquality|lqi)$/.test(n)||"lqi"===r){const e=parseFloat(t.state);isNaN(e)||i.push(e);continue}const o=t.attributes?.linkquality??t.attributes?.lqi;if(null!=o){const e=parseFloat(o);isNaN(e)||i.push(e)}}return Ii(i)}function Hd(e,t){for(const i of t){if(!md(e,i))continue;const t=e.states[i];if(!t)continue;const n=parseFloat(t.state);if(!isNaN(n))return Math.round(10*n)/10}return null}function Ld(e,t){for(const i of t){if(!i.startsWith("climate."))continue;const t=e.states[i];if(!t||"unavailable"===t.state||"unknown"===t.state)continue;const n=parseFloat(t.attributes?.current_temperature);if(Number.isFinite(n))return Math.round(10*n)/10}return null}function Bd(e,t){if(e.entities?.[t]?.entity_category)return!1;const i=e.states[t];if(!i)return/_humidity$/.test(t);const n=i.attributes||{};return"humidity"===n.device_class||"%"===n.unit_of_measurement&&/_humidity$/.test(t)||/_humidity$/.test(t)}function qd(e,t){for(const i of t){if(!Bd(e,i))continue;const t=e.states[i];if(!t)continue;const n=parseFloat(t.state);if(!isNaN(n))return Math.round(n)}return null}function jd(e,t){if(!t)return[];const i=[];for(const[t,n]of Object.entries(e.entities)){if(!t.startsWith("light.")||n.hidden||!rd(n))continue;let r=null;if("group"===n.platform)r=n.area_id||null;else{if(!n.device_id)continue;{const t=e.devices[n.device_id];if(!rd(t))continue;if("Group"!==t?.model)continue;r=t.area_id||n.area_id||null}}if(!r)continue;const o=e.states[t];i.push({eid:t,name:n.name||o?.attributes?.friendly_name||t,area:r})}return i}function Wd(e,t,i,n,r){const o=qe(t,i,r);if(o!==Be)return o;const s=[];for(const t of n){const i=e.states[t]?.attributes?.device_class;i&&s.push(i)}return function(e){for(const t of e){const e=Le[t];if(e)return e}return null}(s)??Be}function Ud(e,t){return e.map(e=>{if(!Array.isArray(e.controls))return e;const i=e.controls.filter(e=>!("string"==typeof e&&e.startsWith("marker:")&&t.has(e.slice(7))));return i.length===e.controls.length?e:{...e,controls:i.length?i:null}})}function Gd(e,t,i){if(!t||!i||t===i)return[...e];const n=`marker:${t}`,r=`marker:${i}`;return e.map(e=>{const t=Array.isArray(e.controls)?e.controls.map(e=>e===n?r:e):e.controls,i="derived_marker_state"===e.value_badge?.source?.kind&&e.value_badge.source.ref===n?{...e.value_badge,source:{...e.value_badge.source,ref:r}}:e.value_badge,o="derived_marker_state"===e.value_source?.kind&&e.value_source.ref===n?{...e.value_source,ref:r}:e.value_source;return t===e.controls&&i===e.value_badge&&o===e.value_source?e:{...e,controls:t,...void 0!==i?{value_badge:i}:{},...void 0!==o?{value_source:o}:{}}})}function Vd(e,t,i){if(!t||t===i)return!0;const n=new Map;for(const t of e)n.set(t.id,(t.controls||[]).filter(e=>"string"==typeof e&&e.startsWith("marker:")).map(e=>e.slice(7)));const r=new Set,o=[i];for(;o.length;){const e=o.pop();if(e===t)return!0;r.has(e)||(r.add(e),o.push(...n.get(e)||[]))}return!1}function Kd(e,t,i,n){const r=new Set([t]),o=e.filter(e=>{const o=e.id===t||!n&&e.binding===i;return o&&r.add(e.id),!o});return{markers:n?o:[...o,{id:t,binding:i,removed:!0,hidden:!0}],cleanupIds:r}}function Yd(e){const t=new Set,i=new Set,n=new Set;for(const r of e||[]){const e=String(r.binding||"").indexOf(":");if(e<1)continue;const o=r.binding.slice(0,e),s=r.binding.slice(e+1);s&&(!0===r?.removed?"device"===o?t.add(s):"entity"===o&&i.add(s):"entity"===o&&n.add(s))}return{devices:t,entities:i,liveEntities:n}}function Xd(e,t,i){if(i.liveEntities.has(t))return!1;if(i.entities.has(t))return!0;const n=e?.entities?.[t]?.device_id;return!!n&&i.devices.has(n)}function Zd(e,t,i,n,r){const o=bd(t.binding,t.controls,e.entities).filter(e=>!Xd(i,e,n)).filter(e=>"active"===cd(i,"entity:"+e,r).kind);e.marker=t,e.controls=o,e.userHidden=!0===t.hidden,e.hidden=e.userHidden||"ha_disabled"===e.bindingStatus?.kind,t.name&&(e.name=t.name),t.icon&&(e.icon=t.icon),null!=t.model&&(e.model=t.model),e.link=t.link??null,e.description=t.description??null,e.pdfs=t.pdfs||[],e.tapAction=t.tap_action??null}function Jd(e){const t=e.hass,i=e.registry||td(t),n=od(t,i),r=sd(t,i),{areaToSpace:o,markers:s,settings:a,excluded:l,iconRules:c}=e,h=!1!==a.group_lights,d=Yd(s),u=jd(n,h).filter(e=>!Xd(n,e.eid,d)),p=new Set(u.map(e=>e.area)),_=dd(n),m=ud(s,r),g=new Set(s.map(e=>e.binding)),f=[];for(const e of Object.values(n.devices)){const r=e.area_id;if(!r||!o[r])continue;if("service"===e.entry_type)continue;if(g.has("device:"+e.id))continue;if("active"!==cd(t,"device:"+e.id,i).kind)continue;const s=pd(n,e.id,_[e.id]||[],m);if(s.partial&&!s.entityIds.length)continue;const a=s.entityIds,d=_d(n,e,a);let u=l.has(d)||"Group"===e.model||/scene/i.test(e.model||"")||/bridge/i.test((e.model||"")+(e.name||""))||"myheat"===d&&!!e.via_device_id;if(!u&&h&&p.has(r)){const t=(e.name_by_user||e.name||"").trim();"mdi:lightbulb"===Wd(n,t,e.model,a,c)&&(u=!0)}u&&f.push("device:"+e.id)}return f}function Qd(e,t,i,n){if("string"==typeof e.room_id&&e.room_id.length>0&&null===e.area)return{area:"",space:e.space||n};const r=e.area||t||"";return{area:r,space:r&&i[r]||e.space||n}}function eu(e){const t=e.hass,i=e.registry||td(t),n=od(t,i),r=sd(t,i),{areaToSpace:o,markers:s,settings:a,excluded:l,showAll:c,firstSpaceId:h,loc:d,iconRules:u}=e,p=!1!==a.group_lights,_=Yd(s),m=jd(n,p).filter(e=>!Xd(n,e.eid,_)),g=new Set(m.map(e=>e.area)),f=dd(n),v=function(e){const t={};for(const[i,n]of Object.entries(e.entities||{}))n?.device_id&&(t[n.device_id]=t[n.device_id]||[]).push(i);return t}(r),y=ud(s,r),b=new Set;for(const e of s){const[t,i]=e.binding.split(":");"device"!==t&&"entity"!==t||!i||b.add(e.binding)}const w=(e,t)=>s.find(i=>i.binding===e+":"+t),k={},x=[];for(const e of Object.values(n.devices)){const r=e.area_id;if(!r||!o[r])continue;if("service"===e.entry_type)continue;if(b.has("device:"+e.id))continue;const s=cd(t,"device:"+e.id,i);if("active"!==s.kind)continue;const h=w("device",e.id);if(h&&h.hidden&&!a.filter_seeded)continue;const _=pd(n,e.id,f[e.id]||[],y);if(_.partial&&!_.entityIds.length)continue;const m=_.entityIds,v=_.partial?{kind:"active",enabledEntityIds:m,allEntityIds:m}:s,S=_d(n,e,m),$=!a.filter_seeded;if($&&!c){if(l.has(S))continue;if("Group"===e.model)continue;if(/scene/i.test(e.model||""))continue;if(/bridge/i.test((e.model||"")+(e.name||"")))continue;if("myheat"===S&&e.via_device_id)continue}const M=(e.name_by_user||e.name||d("device.unnamed")).trim(),R=M+"|"+r;let C=Wd(n,M,e.model,m,u);if(m.some(e=>e.startsWith("lock."))&&(C="mdi:lock"),$&&!c&&p&&"mdi:lightbulb"===C&&g.has(r))continue;k[R]=(k[R]||0)+1;const T=k[R]>1?M+" "+k[R]:M,D={id:e.id,name:T,model:e.model||"",area:r,space:o[r],icon:C,entities:m,allEntities:v.allEntityIds,bindingStatus:v,bindingKind:"device",bindingRef:e.id,pdfs:[]};D.primary=yd(n,m,C),"mdi:thermometer"!==C&&"mdi:air-filter"!==C||(D.temp=Hd(n,m)),D.primary&&Bd(n,D.primary)&&(D.hum=qd(n,m)),x.push(D)}for(const e of m)o[e.area]&&(b.has("entity:"+e.eid)||x.push({id:"lg_"+e.eid,name:e.name,model:d("device.light_group"),area:e.area,space:o[e.area],icon:"mdi:lightbulb-group",entities:[e.eid],allEntities:[e.eid],bindingStatus:{kind:"active",enabledEntityIds:[e.eid],allEntityIds:[e.eid]},primary:e.eid,bindingKind:"entity",bindingRef:e.eid,pdfs:[]}));for(const e of s){if(e.removed)continue;const[s,l]=e.binding.split(":"),c="device"===s||"entity"===s?cd(t,e.binding,i):null;if(!e.hidden||a.filter_seeded||"ha_disabled"===c?.kind)if("device"===s){const t=c;if("unverified"===t.kind)continue;const s=r.devices[l],{area:a,space:p}=Qd(e,s?.area_id,o,h),m="active"===t.kind?t.enabledEntityIds:[];let g=s?Wd(n,s.name_by_user||s.name||"",s.model,m,u):"mdi:help-circle";m.some(e=>e.startsWith("lock."))&&(g="mdi:lock");const f={id:e.id,name:s?.name_by_user||s?.name||d("device.fallback"),model:s?.model||"",area:a,space:p,icon:g,entities:m,allEntities:t.allEntityIds.length?t.allEntityIds:s&&v[s.id]||[],bindingStatus:t,bindingKind:"device",bindingRef:l};f.primary=yd(n,m,g),"mdi:thermometer"!==g&&"mdi:air-filter"!==g||(f.temp=Hd(n,m)),f.primary&&Bd(n,f.primary)&&(f.hum=qd(n,m)),Zd(f,e,r,_,i),x.push(f)}else if("entity"===s){if(Xd(r,l,_))continue;const t=c;if("unverified"===t.kind)continue;const s=r.entities[l],a=s?.area_id||s?.device_id&&r.devices[s.device_id]?.area_id||"",{area:d,space:p}=Qd(e,a,o,h),m=n.states[l],g=s?.name||m?.attributes?.friendly_name||l;let f=Wd(n,g,"",[l],u);l.startsWith("lock.")&&(f="mdi:lock");const v={id:e.id,name:g,model:"",area:d,space:p,icon:f,entities:"active"===t.kind?[l]:[],allEntities:[l],bindingStatus:t,primary:"active"===t.kind?l:void 0,bindingKind:"entity",bindingRef:l};"mdi:thermometer"!==f&&"mdi:air-filter"!==f||!v.entities.length||(v.temp=Hd(n,v.entities)),v.entities.length&&Bd(n,l)&&(v.hum=qd(n,v.entities)),Zd(v,e,r,_,i),x.push(v)}else{const t=e.area||"",n=e.space||t&&o[t]||h,s={id:e.id,name:e.name||d("device.virtual"),model:e.model||"",area:t,space:n,icon:e.icon||"mdi:map-marker",entities:[],allEntities:[],bindingStatus:{kind:"active",enabledEntityIds:[],allEntityIds:[]},bindingKind:"virtual",virtual:!0};Zd(s,e,r,_,i),x.push(s)}}return x}function tu(e){const{marker:t,siblingMarkers:i=[],...n}=e;return eu({...n,markers:[...i.filter(e=>e.id!==t.id),t]}).find(e=>e.id===t.id)||null}function iu(e,t,i,n){if(!t)return null;if(function(e,t,i){if(!t)return!1;const n=t.indexOf(":");if(n<1)return!1;const r=t.slice(0,n),o=t.slice(n+1),s=Yd(i);return"device"===r?s.devices.has(o):"entity"===r&&Xd(e,o,s)}(e,t,n))return null;const r=t.indexOf(":");if(r<0)return null;const o=t.slice(0,r),s=t.slice(r+1);if(!s)return null;if("entity"===o){const t=parseFloat(e.states[s]?.state);return Number.isFinite(t)?"temp"===i?Math.round(10*t)/10:Math.round(t):null}if("device"===o){const t=Object.entries(e.entities).filter(([,e])=>e.device_id===s).map(([e])=>e);return"temp"===i?Hd(e,t):qd(e,t)}return null}const nu=new RegExp(["water","voda","coolant","flow_?temp","return_?temp","target","setpoint","chip","cpu","processor","board","core_temp","device_temp","batter","akkum","freezer","fridge","oven","kettle","boiler"].join("|"),"i");function ru(e,t){return t.area?t.area:e&&t.id?`@room/${encodeURIComponent(e)}/${encodeURIComponent(t.id)}`:null}function ou(e){return null==e.area&&e.space&&e.room_id?ru(e.space,{id:e.room_id,area:null}):e.area||null}function su(e){const t=e?.exclude_integrations;return t?new Set(t):Ie}function au(e,t,i,n=Ie){const r=new Map;if(!e?.entities)return r;const o=Yd(i),s=new Set,a=new Map,l=new Map;for(const e of i||[]){if(e?.removed)continue;const t=(e.binding||"").indexOf(":");if(t<=0)continue;const i=e.binding.slice(0,t),n=e.binding.slice(t+1);if(!n)continue;!0===e.use_climate_temp&&s.add(n);const r=ou(e);r&&("entity"!==i||a.has(n)?"device"!==i||l.has(n)||l.set(n,r):a.set(n,r))}const c=new Map;for(const[t,i]of Object.entries(e.entities)){if(i.device_id&&o.devices.has(i.device_id)&&!o.liveEntities.has(t)||!i.device_id&&o.entities.has(t)&&!o.liveEntities.has(t))continue;const r=i.device_id?e.devices?.[i.device_id]:null;if(!rd(i)||r&&!rd(r))continue;const h=a.get(t)||(i.device_id?l.get(i.device_id):null)||i.area_id||r?.area_id||null;if(!h)continue;if(i.entity_category)continue;if(!(s.size>0&&t.startsWith("climate.")&&(s.has(t)||i.device_id&&s.has(i.device_id)))){if(n.has(i.platform))continue;if(nu.test(t))continue}let d=c.get(h);d||(d=new Map,c.set(h,d));const u=i.device_id||t;let p=d.get(u);if(!p){const n=e.states?.[t];p={name:(r?r.name_by_user||r.name:i.name||n?.attributes?.friendly_name||t)||t,model:r?.model,ents:[]},d.set(u,p)}p.ents.push(t)}for(const[i,n]of c){const o=[],a=[];for(const[i,r]of n){const n=Wd(e,r.name,r.model,r.ents,t),l="mdi:thermometer"===n||"mdi:air-filter"===n;if(l){const t=Hd(e,r.ents);null!=t&&o.push(t)}if(s.size>0&&(s.has(i)||r.ents.some(e=>s.has(e)))){const t=Ld(e,r.ents);null!=t&&o.push(t)}if(l||"mdi:water-percent"===n){const t=qd(e,r.ents);null!=t&&a.push(t)}}(o.length||a.length)&&r.set(i,{temp:o.length?Math.round(o.reduce((e,t)=>e+t,0)/o.length*10)/10:null,hum:a.length?Math.round(a.reduce((e,t)=>e+t,0)/a.length):null})}return r}function lu(e,t,i){const n=[];for(const r of t){if(r.area!==i||r.virtual)continue;const t=Nd(e,r.entities);null!=t&&n.push(t)}return Ii(n)}const cu={offStates:["off"],unknownUsesToggle:!0},hu={light:cu,switch:cu,fan:cu,humidifier:cu,input_boolean:cu,automation:cu,remote:cu,group:cu,climate:{...cu,featureMasks:{turn_on:256,turn_off:128,toggle:384}},media_player:{...cu,featureMasks:{turn_on:128,turn_off:256,toggle:384}},siren:{...cu,featureMasks:{turn_on:1,turn_off:2,toggle:3}},vacuum:{...cu,featureMasks:{turn_on:1,turn_off:2,toggle:3}},water_heater:{...cu,featureMasks:{turn_on:8,turn_off:8,toggle:8}},camera:{...cu,featureMasks:{turn_on:1,turn_off:1,toggle:1}}};function du(e){return e.slice(0,e.indexOf("."))}function uu(e,t,i){if(!e?.services||"object"!=typeof e.services)return!1;const n=e.services?.[t];return!!n&&Object.prototype.hasOwnProperty.call(n,i)}function pu(e,t,i){return uu(e,t,i)?{domain:t,service:i}:uu(e,"homeassistant",i)?{domain:"homeassistant",service:i}:null}function _u(e,t){return e?.entities?.[t]||null}function mu(e,t,i){const n=e?.states?.[i],r=_u(t,i);return n?.attributes?.friendly_name||r?.name||r?.original_name||i}function gu(e,t){const i=_u(e,t);if(null!=i?.disabled_by)return!0;const n=i?.device_id?e?.devices?.[i.device_id]:null;return null!=n?.disabled_by}function fu(e,t){const i=e?.attributes?.supported_features;if(null==i||""===i)return!1;const n=Number(i);return Number.isFinite(n)&&(n&t)===t}function vu(e,t,i){const n=du(i);if("lock"===n||"alarm_control_panel"===n)return!0;if("cover"!==n)return!1;const r=e?.states?.[i],o=_u(t,i),s=String(r?.attributes?.device_class||o?.device_class||o?.original_device_class||"");return Wi.has(s)}function yu(e,t,i,n,r){return{ref:i,entityId:n,name:n?mu(e,t,n):null,reason:r}}function bu(e,t,i,n,r,o=null){return{target:null,skipped:yu(e,t,i,n,r),semantics:o,nextEffect:null,command:null}}function wu(e,t,i,n,r=i){const o=du(i);if("cover"!==o&&"valve"!==o)return function(e,t,i,n,r=i){const o=du(i),s=e?.states?.[i];if(gu(t,i))return bu(e,t,r,i,"ha-disabled","power");if(vu(e,t,i))return bu(e,t,r,i,"secure");if(!s)return bu(e,t,r,i,"missing","power");if("unavailable"===s.state)return bu(e,t,r,i,"unavailable","power");const a=hu[o];if(!a)return bu(e,t,r,i,"unsupported");let l,c;if("unknown"===s.state||""===s.state){if(!a.unknownUsesToggle)return bu(e,t,r,i,"unsupported","power");l="toggle",c="toggle"}else a.offStates.includes(String(s.state))?(l="turn-on",c="turn_on"):(l="turn-off",c="turn_off");const h=a.featureMasks?.[c];if(h&&!fu(s,h))return bu(e,t,r,i,"unsupported","power");const d=pu(e,o,c);return d?{target:{entityId:i,name:mu(e,t,i),state:String(s.state||""),via:n},skipped:null,semantics:"power",nextEffect:l,command:{...d,data:{entity_id:i}}}:bu(e,t,r,i,"unsupported","power")}(e,t,i,n,r);if(gu(t,i))return bu(e,t,r,i,"ha-disabled",o);if(vu(e,t,i))return bu(e,t,r,i,"secure",o);const s=e?.states?.[i];if(!s)return bu(e,t,r,i,"missing",o);if("unavailable"===s.state)return bu(e,t,r,i,"unavailable",o);const a=function(e,t,i){const n=String(i?.state||""),r="closed"===n?{service:`open_${t}`,effect:"open",feature:1}:"open"===n?{service:`close_${t}`,effect:"close",feature:2}:"opening"===n||"closing"===n?{service:`stop_${t}`,effect:"stop",feature:8}:null;return r&&fu(i,r.feature)&&uu(e,t,r.service)?r:fu(i,3)&&uu(e,t,"toggle")?{service:"toggle",effect:"toggle"}:null}(e,o,s);if(!a)return bu(e,t,r,i,"unsupported",o);return{target:{entityId:i,name:mu(e,t,i),state:String(s.state||""),via:n},skipped:null,semantics:o,nextEffect:a.effect,command:{domain:o,service:a.service,data:{entity_id:i}}}}function ku(e){return"entity"===e.bindingKind?e.bindingRef&&Dn(e.bindingRef)?[e.bindingRef]:[]:"virtual"===e.bindingKind?[]:xd(e)}function xu(e){const t=e.marker?.toggle_entity;return t&&ku(e).includes(t)?t:null}function Su(e,t,i){const n=function(e,t){if("entity"===e.bindingKind&&e.bindingRef){const t=e.marker?.light_entity?Sd(e):null;return[...new Set([t,e.bindingRef].filter(e=>!!e))]}const i=e.entities.length?e.entities:e.allEntities||[],n=e.marker?.light_entity||e.primary&&Dn(e.primary)?Sd(e):null;return[...new Set([n,...vd(t,i)].filter(e=>!!e))]}(i,t);if(!n.length)return null;const r="entity"===i.bindingKind?"binding":"device-role";if("binding"===r)return wu(e,t,n[0],r);let o=null,s=null;for(const i of n){const n=wu(e,t,i,r);if(n.command)return n;const a=n.skipped?.reason;if("missing"===a||"unavailable"===a||"secure"===a)return n;"ha-disabled"!==a?o||=n:s||=n}return o||s}function $u(e){const t=e.skipped?.reason;return"missing"===t?"unavailable":t||"unsupported"}function Mu(e,t){return{origin:e,kind:"none",semantics:null,targets:[],skippedTargets:[],noneReason:t,nextEffect:null,command:null}}function Ru(e,t){return"cover"===e||"toggle"===e?"toggle":"more-info"===e||"run"===e||"info"===e||"none"===e?e:(null==e||""===e)&&"light"===t?"toggle":"info"}function Cu(e,t){return{origin:e,kind:"single",semantics:t.semantics,targets:t.target?[t.target]:[],skippedTargets:t.skipped?[t.skipped]:[],noneReason:t.command?null:$u(t),nextEffect:t.nextEffect,command:t.command}}function Tu(e,t,i,n=[]){const r=new Map,o=[],s=new Set,a=e=>{const t=`${e.ref}\n${e.entityId||""}\n${e.reason}`;s.has(t)||(s.add(t),o.push(e))};for(const e of n)a(e);for(const n of i){const i=wu(e,t,n.entityId,n.via,n.ref);i.target?r.set(n.entityId,r.get(n.entityId)||i.target):i.skipped&&a(i.skipped)}const l=[...r.values()];if(!l.length)return{origin:"explicit-toggle",kind:"group",semantics:"group-power",targets:l,skippedTargets:o,noneReason:o.length&&o.every(e=>"secure"===e.reason)?"secure":"configured-targets-missing",nextEffect:null,command:null};const c=l.some(e=>"on"===e.state)?"turn_off":"turn_on",h=pu(e,"homeassistant",c);return h?{origin:"explicit-toggle",kind:"group",semantics:"group-power",targets:l,skippedTargets:o,noneReason:null,nextEffect:"turn_on"===c?"turn-on":"turn-off",command:{...h,data:{entity_id:l.map(e=>e.entityId)}}}:{origin:"explicit-toggle",kind:"group",semantics:"group-power",targets:[],skippedTargets:[...o,...l.map(i=>yu(e,t,i.entityId,i.entityId,"unsupported"))],noneReason:"unsupported",nextEffect:null,command:null}}function Du(e){return String(e.marker?.id||e.id||"")}function Au(e){const{hass:t,device:i}=e,n=e.registryHass||t,r=function(e){return"toggle"===e.tapAction?"explicit-toggle":"cover"===e.tapAction?"legacy-cover":!e.tapAction&&e.primary?.startsWith("light.")?"default-light":null}(i);if(!r)return null;const o=i.marker;if("explicit-toggle"===r&&Lh(o)){const t=String(o?.id||i.id||""),n=Dd(e.devices).get(t);if(n)return function(e,t){const i=e.registryHass||e.hass;return Tu(e.hass,i,t.driverEids.map(e=>({entityId:e,via:"control-marker-driver",ref:`marker:${t.markerId}`})))}(e,n);const s=Bh(o,e.virtualLights);return{origin:r,kind:"single",semantics:"power",targets:[{entityId:"",name:i.name,state:s?"on":"off",via:"virtual-light"}],skippedTargets:[],noneReason:null,nextEffect:s?"turn-off":"turn-on",command:null,operation:{kind:"virtual-light",markerId:o.id}}}if("explicit-toggle"===r){if(wd(i.marker?.binding,i.marker?.controls??i.controls,i.entities).length)return function(e,t=null){const{hass:i,device:n,devices:r}=e,o=e.registryHass||i,s=wd(n.marker?.binding,n.marker?.controls??n.controls,n.entities),a=e.lightSources||Id(i,r,null,e.virtualLights),l=new Map;for(const e of a){if(!e.key.startsWith("marker:"))continue;const t=l.get(e.key)||[];t.push(e),l.set(e.key,t)}const c=Dd(r),h=new Map;for(const e of r){const t=String(e.marker?.id||e.id||"");t&&h.set(t,e)}const d=[],u=[];t&&d.push({entityId:t,via:"entity"===n.bindingKind?"binding":"device-role",ref:t});for(const e of s){if(!e.startsWith("marker:")){Dn(e)?d.push({entityId:e,via:"control-entity",ref:e}):u.push(yu(i,o,e,e.includes(".")?e:null,"unsupported"));continue}const t=l.get(e)||[];if(!t.length){const t=h.get(e.slice(7));if("ha_disabled"===t?.bindingStatus?.kind){const n=t.bindingStatus.allEntityIds[0]||null;u.push({ref:e,entityId:n,name:t.name||(n?mu(i,o,n):null),reason:"ha-disabled"})}else u.push(yu(i,o,e,null,"missing"));continue}const r=[...new Set(t.flatMap(e=>e.serviceEids))];if(r.length){for(const t of r)d.push({entityId:t,via:"control-entity",ref:e});continue}const s=t.some(e=>e.passive),a=e.slice(7),p=Du(n),_=c.get(a)?.controllers.find(e=>Du(e.device)===p);if(s&&_?.driverEids.length)for(const t of _.driverEids)d.push({entityId:t,via:"control-marker-driver",ref:e});else u.push(yu(i,o,e,null,s?"missing":"unsupported"))}return Tu(i,o,d,u)}(e,xu(i))}if("legacy-cover"===r){const e=i.entities.find(e=>e.startsWith("cover."))||i.allEntities?.find(e=>e.startsWith("cover."));return e?Cu(r,wu(t,n,e,"device-role")):Mu(r,"no-actionable-entity")}const s=xu(i),a=s?wu(t,n,s,"entity"===i.bindingKind?"binding":"device-role"):Su(t,n,i);return a?Cu(r,a):Mu(r,i.virtual||"virtual"===i.bindingKind?"no-actionable-entity":"no-binding")}function Pu(e){if(!e)return[];const t=Array.isArray(e.data.entity_id)?e.data.entity_id:[e.data.entity_id];return[...new Set(t)].sort()}function Fu(e){return e?e.operation?e.operation:e.command?{kind:"ha-service",command:e.command}:null:null}const zu=new Set(["missing","ha-disabled","unavailable"]);function Iu(e,t){const i=Fu(e),n=Fu(t);return!(!i||!n||i.kind!==n.kind)&&("virtual-light"===i.kind&&"virtual-light"===n.kind?i.markerId===n.markerId:"ha-service"===i.kind&&"ha-service"===n.kind&&function(e,t){const i=Pu(e),n=Pu(t);return i.length===n.length&&i.every((e,t)=>e===n[t])}(i.command,n.command))}function Ou(e,t){const i=e.targets[0]||e.skippedTargets[0],n=[];return"group"===e.kind?e.targets.length&&n.push(t.group(e.targets)):i&&n.push(t.single(i)),e.nextEffect&&e.targets.length&&n.push("group"===e.kind?t.groupCurrentNext(e.targets,e.nextEffect):t.currentNext(e.targets[0],e.nextEffect)),e.skippedTargets.length&&n.push(t.skipped(e.skippedTargets)),!e.command&&e.noneReason&&n.push(t.none(e.noneReason)),n}function Eu(e,t){return e.catch(()=>{}).then(t)}const Nu=e=>{const t=e?.config;return t&&Array.isArray(t.spaces)?t:null},Hu=(e,t)=>"number"==typeof e&&Number.isFinite(e)?e:t;class Lu{constructor(e){this.onBodyReplaced=e,this.config=null,this.configRev=0,this.configFingerprint="",this.layout={},this.layoutRev=0,this.layoutFingerprint=""}setConfig(e){const t=this.config;e!==t&&(this.config=e,this.onBodyReplaced?.("_serverCfg",t))}setLayout(e){const t=this.layout;e!==t&&(this.layout=e,this.onBodyReplaced?.("_layout",t))}currentConfigFingerprint(){return this.configFingerprint||ac(this.config)}currentLayoutFingerprint(){return this.layoutFingerprint||ac(this.layout)}adoptResponses(e,t,i,n){const r=Nu(e),o=ac(r),s=o!==this.currentConfigFingerprint();s&&(i(),this.setConfig(r),this.configFingerprint=o),this.configRev=e?.rev??this.configRev;let a=!1;if(void 0!==t){const e=t?.layout??{},i=ac(e);a=i!==this.currentLayoutFingerprint(),a&&(n(),this.setLayout(e),this.layoutFingerprint=i),this.layoutRev=t?.rev??this.layoutRev}return{configChanged:s,layoutChanged:a}}adoptMergedLayout(e,t,i){const n=ac(e),r=n!==ac(this.layout);return r&&(i?.(),this.setLayout(e)),this.layoutFingerprint=n,this.layoutRev=t?.rev??this.layoutRev,r}stageConfigCandidate(e){const t=ac(e);t!==ac(this.config)&&this.setConfig(e),this.configFingerprint=t}acceptConfigWrite(e,t){this.configFingerprint=ac(e),this.configRev=Hu(t?.rev,this.configRev+1)}acceptPairWrite(e,t,i){this.setConfig(e),this.configFingerprint=ac(e),this.setLayout(t),this.layoutFingerprint=ac(t),this.configRev=Hu(i?.config_rev,this.configRev+1),this.layoutRev=Hu(i?.layout_rev,this.layoutRev+1)}noteLayoutRevision(e){"number"==typeof e&&e>this.layoutRev&&(this.layoutRev=e)}stageLocalConfig(e){this.setConfig(e)}stageLocalLayout(e){this.setLayout(e)}seedIdentity(e){Object.assign(this,e)}refreshConfigFingerprint(){this.configFingerprint=ac(this.config)}refreshLayoutFingerprint(){this.layoutFingerprint=ac(this.layout)}beginOptimistic(e,t){return function(e,t,i,n,r){return{previous:JSON.parse(JSON.stringify(e)),previousFingerprint:i,revision:n,attempted:t,attemptedFingerprint:r(t)}}(e,t,this.configFingerprint,this.configRev,ac)}rollbackOptimistic(e){const t=this.config;return!(!t||this.configRev!==e.revision||ac(t)!==e.attemptedFingerprint)&&(this.setConfig(e.previous),this.configFingerprint=e.previousFingerprint,!0)}restoreCached(e){const t=e?.config;return!(!t||!Array.isArray(t.spaces))&&(this.setConfig(t),this.configRev=e?.rev||0,this.configFingerprint=e?.config_fingerprint||ac(t),this.setLayout(e?.layout||{}),this.layoutRev=e?.layout_rev||0,this.layoutFingerprint=e?.layout_fingerprint||ac(this.layout),!0)}snapshot(e){return this.config?(this.refreshConfigFingerprint(),this.refreshLayoutFingerprint(),{config:this.config,rev:this.configRev,config_fingerprint:this.configFingerprint,layout:this.layout,layout_rev:this.layoutRev,layout_fingerprint:this.layoutFingerprint,virtual_lights:e}):null}}async function Bu(e,t){const i=t.isCurrent??(()=>!0);if(!i())return{status:"superseded"};const{cfgResp:n,layResp:r}=t,o=e._adoption,s=Nu(n),a=null!=n&&ac(s)!==o.currentConfigFingerprint()||null!=r&&ac(r.layout??{})!==o.currentLayoutFingerprint();if(a){const t=await e._signer.prepareImage(e.hass,e._candidateBackdrop(s));if(!i())return{status:"superseded"};if(!t)return e._continuity.note("asset-failed"),e._scheduleLoadRetry(!0),{status:"asset-wait"}}if(!i())return{status:"superseded"};a&&e._continuity.hasCompleteFrame&&"steady"===e._continuity.state&&e._beginContinuityCandidate(t.reason,!0),t.beforeAdopt?.();const l=e._space;return function(e,t,i){const n=e._adoption,r=!!n.config,{configChanged:o,layoutChanged:s}=n.adoptResponses(t??{},i,()=>{e._geometryHistory.clear(),e._devicePositionHistory.clear(),e._cancelDeviceDrag(),e._pendingPhysicalWrites.clear(),e._clearRoomFocus(!0),e._cancelCameraTransition(!1),r&&e._clearGeometryGesture()},()=>{e._cancelCameraTransition(!1),e._devicePositionHistory.clear(),e._cancelDeviceDrag()});if(o&&e._seedDecorStyle(n.config),t&&("virtual_lights"in t||"config"in t)){const i=Nh(e._virtualLights,t.virtual_lights,n.configRev,"virtual_lights"in t);Hh(i)!==Hh(e._virtualLights)&&(e._virtualLights=i,e._capturedSnapshotVirtual="")}e._canOptimizeUndo=!(!t?.can_optimize_undo&&!i?.can_optimize_undo),e._adoptConfigCapabilities(t),e._undoKind=t?.undo_kind||i?.undo_kind||null,"boolean"==typeof t?.can_write&&(e._serverCanWrite=t.can_write),o&&e._continuity.note("config-candidate",{configRev:n.configRev}),s&&e._continuity.note("layout-candidate",{layoutRev:n.layoutRev})}(e,n,r),"reload"===t.profile&&(e._syncDecorAssets(s).catch(()=>{}),e._adoptInitialSpace(e._model,!0),e._resumePendingNavMode(),e._cacheSnapshot()),t.afterAdopt?.(),{status:"adopted",spaceChanged:e._space!==l}}const qu=(e,t)=>e.connection===t.connection&&e.userId===t.userId&&e.route===t.route,ju=e=>"number"==typeof e&&Number.isFinite(e)?e:null;class Wu{constructor(){this.sequence=0,this.currentSequence=0,this.lifecycle=0,this.observedHighWater=null,this.context=null}observeContext(e){this.context?qu(this.context,e)||(this.context={...e},this.invalidateLifecycle()):this.context={...e}}invalidateLifecycle(){this.lifecycle+=1,this.currentSequence=++this.sequence,this.observedHighWater=null}observeRevision(e,t,i){this.observeContext(i);const n=ju(e);if(null===n)return null;const r=ju(t)??Number.NEGATIVE_INFINITY;return n<=Math.max(r,this.observedHighWater??Number.NEGATIVE_INFINITY)?null:(this.observedHighWater=n,Object.freeze({sequence:this.currentSequence,lifecycle:this.lifecycle,context:{...i},observedRevision:n}))}isReservationCurrent(e,t,i){this.observeContext(t);const n=ju(i)??Number.NEGATIVE_INFINITY;return e.sequence===this.currentSequence&&e.lifecycle===this.lifecycle&&qu(e.context,t)&&e.observedRevision===this.observedHighWater&&e.observedRevision>n}begin(e){this.observeContext(e.context),e.force&&this.invalidateLifecycle();const t=++this.sequence;return this.currentSequence=t,Object.freeze({sequence:t,lifecycle:this.lifecycle,force:e.force,context:{...e.context},baselineRevision:e.baselineRevision,baselineFingerprint:e.baselineFingerprint})}isCurrent(e){this.observeContext(e.context);const t=e.claim;return e.connected&&(t.force||!e.writePending)&&t.sequence===this.currentSequence&&t.lifecycle===this.lifecycle&&qu(t.context,e.context)&&t.baselineRevision===e.baselineRevision&&t.baselineFingerprint===e.baselineFingerprint}}const Uu=e=>{const t=e.hass,i=t?.user?.id;return{connection:t?.connection??null,userId:"string"==typeof i?i:null,route:location.pathname}};async function Gu(e,t=!1,i){let n=null;const r=e._configReloadAuthority;if(!t){if(void 0!==i&&(n=r.observeRevision(i,e._cfgRev,Uu(e)),!n))return;if(e._saveConfigDebounced.pending()&&e._saveConfigDebounced.flush(),e._cfgWriting)return clearTimeout(e._reloadRetry),void(e._reloadRetry=window.setTimeout(()=>{n&&!r.isReservationCurrent(n,Uu(e),e._cfgRev)||Gu(e,!1)},400))}const o=r.begin({force:t,context:Uu(e),baselineRevision:e._cfgRev,baselineFingerprint:e._adoption.currentConfigFingerprint()}),s=()=>((e,t)=>e._configReloadAuthority.isCurrent({claim:t,context:Uu(e),connected:e.isConnected,baselineRevision:e._cfgRev,baselineFingerprint:e._adoption.currentConfigFingerprint(),writePending:e._saveConfigDebounced.pending()||e._cfgWriting}))(e,o);let a=!1;try{const t=await e._getAuthoritativeConfig();if(!s())return;const i=await e._adoptAuthoritative({cfgResp:t,reason:"config-reload",profile:"reload",isCurrent:s,afterAdopt:()=>{e._regSignature="",e._maybeRebuildDevices()}});if("superseded"===i.status)return;if(a=!0,"adopted"!==i.status)return;i.spaceChanged&&e._restoreZoom(),e.requestUpdate()}catch(t){if(!s())return;a=!0,e._showToast(e._t("toast.cfg_reload_failed",{err:e._errText(t)}))}finally{(a||s())&&(e._continuityDataReady=!0,e.requestUpdate())}}const Vu=e=>!!e&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1]);function Ku(e,t=5,i=5){return Ao(e.cm,t,i)/2}function Yu(e,t,i=1,n=5,r=5,o=0){const s=e.host;if(!s||"partition"!==s.kind||"string"!=typeof s.id||!s.id)return{resolved:null,reason:"invalid-host"};const a=t.find(e=>e.id===s.id);if(!a)return{resolved:null,reason:"missing-partition"};if(!Vu(a.a)||!Vu(a.b)||!Number.isFinite(s.t)||s.t<0||s.t>1)return{resolved:null,reason:"invalid-position"};const l=a.b[0]-a.a[0],c=a.b[1]-a.a[1],h=Math.hypot(l,c),d=Number(e.length)*i;if(!(h>1e-9&&d>0&&Number.isFinite(d)))return{resolved:null,reason:"invalid-length"};const u=s.t*h;if(u-d/2h-o+1e-9)return{resolved:null,reason:"does-not-fit"};const p=l/h,_=c/h;let m=180*Math.atan2(c,l)/Math.PI;return m>=90?m-=180:m<-90&&(m+=180),{reason:null,resolved:{opening:e,host:s,partition:a,center:[a.a[0]+l*s.t,a.a[1]+c*s.t],angle:m,length:d,depth:Ao(a.cm,n,r),t:s.t,axis:{a:[a.a[0],a.a[1]],b:[a.b[0],a.b[1]],ux:p,uy:_,length:h}}}}function Xu(e,t,i=1,n=5,r=5){return Yu(e,t,i,n,r,0)}function Zu(e,t,i=1,n=5,r=5){const o=e.host,s="partition"===o?.kind?t.find(e=>e.id===o.id):void 0;if(!s)return Xu(e,t,i,n,r);const a=Yu(e,t,i,n,r,Ku(s,n,r));return"does-not-fit"===a.reason?{resolved:null,reason:"does-not-fit-jamb"}:a}function Ju(e,t){return!e||(e.length!==t.length||e.host?.kind!==t.host?.kind||e.host?.id!==t.host?.id||e.host?.t!==t.host?.t)}function Qu(e){const{center:t,length:i,axis:n,host:r}=e,o=i/2;return{hostId:r.id,a:[t[0]-n.ux*o,t[1]-n.uy*o],b:[t[0]+n.ux*o,t[1]+n.uy*o],depth:e.depth}}function ep(e,t=!1){const i=t?1:-1,n=e.depth/2;return{ox:-e.axis.uy*i*n,oy:e.axis.ux*i*n,cm:e.partition.cm,side:i}}function tp(e,t,i){return e.flatMap(e=>!Vu(e.a)||!Vu(e.b)||Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])<=1e-9?[]:[{roomId:"",a:[e.a[0],e.a[1]],b:[e.b[0],e.b[1]],key:`partition:${e.id}`,kind:"outer",cm:e.cm,open:!1,half:Ao(e.cm,t,i)/2,partitionHost:{kind:"partition",id:e.id}}])}function ip(e,t,i){const{center:n,length:r,axis:o}=e,s=r/2,a=t.flatMap(e=>{if(!e.kind||e.open)return[];const t=e.b[0]-e.a[0],r=e.b[1]-e.a[1],a=Math.hypot(t,r);if(!(a>i))return[];const l=t/a,c=r/a;if(Math.abs(o.ux*c-o.uy*l)>1e-6)return[];if(Math.abs((n[0]-e.a[0])*c-(n[1]-e.a[1])*l)>i)return[];const h=e=>(e[0]-n[0])*o.ux+(e[1]-n[1])*o.uy,d=h(e.a),u=h(e.b),p=Math.max(-s,Math.min(d,u)),_=Math.min(s,Math.max(d,u));return _>=p-i?[[p,_]]:[]});if(!a.length)return!1;a.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let l=-s;for(const[e,t]of a){if(e>l+i)return!1;if(l=Math.max(l,t),l>=s-i)return!0}return!1}function np(e,t,i=1e-9){const n=e.length/(2*e.axis.length),r=e.t-n,o=e.t+n;return t.some(t=>{if(t.host.id!==e.host.id||t.opening.id===e.opening.id)return!1;const n=t.length/(2*t.axis.length);return Math.max(r,t.t-n)ha-icon{align-self:start;color:var(--hp-accent);}.version-recovery-copy{min-width:0;display:flex;flex-direction:column;gap:var(--sp-2);font-size:var(--fs-m);line-height:1.35;}.version-recovery-copy>span{color:var(--hp-muted);}.version-recovery-versions{display:flex;flex-wrap:wrap;gap:var(--sp-2) var(--sp-5);}.version-recovery-versions span,.version-recovery-versions b{overflow-wrap:anywhere;}.version-recovery-reload{min-height:44px;white-space:normal;}@keyframes hp-version-recovery-in{from{opacity:0;}to{opacity:1;}}@keyframes hp-version-recovery-out{from{opacity:1;}to{opacity:0;}}@media (max-width:520px){.version-recovery-card{grid-template-columns:auto minmax(0,1fr);}.version-recovery-reload{grid-column:1 / -1;width:100%;}}@keyframes fixedfloor-spin{to{transform:rotate(360deg);}}.spacer{flex:1;}.bootveil{position:absolute;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;background:var(--hp-bg,#16212e);opacity:1;transition:opacity 0.15s ease;pointer-events:none;}.bootveil.off{opacity:0;}.bootveil .boothouse{position:static;width:56px;height:56px;fill:var(--hp-accent);opacity:0.85;animation:hp-boot-pulse 1.3s ease-in-out infinite;}@keyframes hp-boot-pulse{0%,100%{opacity:0.3;transform:scale(0.94);}50%{opacity:0.9;transform:scale(1);}}@media (prefers-reduced-motion:reduce){.bootveil .boothouse{animation:none;opacity:0.7;}.version-recovery.phase-visible,.version-recovery.phase-leaving{animation:none;}}@keyframes hp-pulse-short{0%{transform:scale(1);opacity:0.55;}70%{opacity:0.22;}100%{transform:scale(var(--ripple-scale,1.5));opacity:0;}}@keyframes hp-pulse-short-b{0%{transform:scale(1);opacity:0.55;}70%{opacity:0.22;}100%{transform:scale(var(--ripple-scale,1.5));opacity:0;}}@keyframes hp-pulse-continuous{0%{transform:scale(1);opacity:0.55;}65%{opacity:0.18;}100%{transform:scale(var(--ripple-scale,1.5));opacity:0;}}@keyframes hp-pulse-alarm{0%{transform:scale(1);opacity:0.72;}100%{transform:scale(1.5);opacity:0;}}@keyframes hp-slide-left{0%{transform:translateX(4%);opacity:0.72;}100%{transform:translateX(0);opacity:1;}}@keyframes hp-slide-right{0%{transform:translateX(-4%);opacity:0.72;}100%{transform:translateX(0);opacity:1;}}@keyframes hp-sunfade-in{from{opacity:0;}to{opacity:1;}}@keyframes hp-sunfade-out{from{opacity:1;}to{opacity:0;}}.sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0,0,0,0) !important;white-space:nowrap !important;border:0 !important;}.toast{position:fixed;pointer-events:none;left:50%;bottom:22px;transform:translateX(-50%);background:var(--hp-bg);border:1px solid var(--hp-accent);color:var(--hp-txt);padding:var(--sp-4) var(--sp-6);border-radius:var(--rad-l);font-size:var(--fs-m);box-shadow:var(--shadow-2);z-index:120;max-width:90vw;}`,o`.fixedfloor-loading{animation:fixedfloor-spin 1.1s linear infinite;}.fixedfloor-error p{max-width:42rem;margin:0;overflow-wrap:anywhere;}@media (prefers-reduced-motion:reduce){.fixedfloor-loading{animation:none;}.radar-target{transition:none;}}.stage.noplan{background:#ffffff;}.stage.mode-plan,.stage.mode-devices,.stage.mode-decor{background:#ffffff;}.stage{position:relative;width:100%;container-type:inline-size;overflow:hidden;touch-action:none;background:var(--ha-card-background,var(--card-background-color,#111));}.zoomwrap{position:absolute;inset:0;z-index:1;}.stage.mode-transition,.stage.mode-transition .zoomwrap{transition:none !important;}.stage.mode-transition .hp-view-only-layer,.stage.mode-transition .hp-editor-only-layer{pointer-events:none;will-change:opacity;}.stage.mode-transition .hp-paper{fill:var(--hp-mode-paper) !important;}.hp-day-cycle-env{position:absolute;inset:0;z-index:0;overflow:hidden;pointer-events:none;isolation:isolate;}.hp-day-cycle-bg{position:absolute;inset:0;opacity:0;overflow:hidden;transition:opacity 1100ms cubic-bezier(.22,.61,.36,1);}.hp-day-cycle-bg.active{opacity:1;}.hp-day-cycle-sun{position:absolute;left:var(--hp-day-cycle-sun-x);top:var(--hp-day-cycle-sun-y);width:clamp(140px,25cqw,250px);height:clamp(140px,25cqw,250px);transform:translate(-50%,-50%);border-radius:50%;filter:blur(10px);opacity:var(--hp-day-cycle-sun-opacity);transition:left 1100ms cubic-bezier(.22,.61,.36,1),top 1100ms cubic-bezier(.22,.61,.36,1),opacity 1100ms cubic-bezier(.22,.61,.36,1);}.stage.mode-transition .hp-day-cycle-env{transition:none;}.stage.daycycle .hp-paperg,.hp-static-stage.daycycle .hp-paperg{filter:drop-shadow(0 0 1px var(--hp-day-cycle-outline-near)) drop-shadow(0 0 5px var(--hp-day-cycle-outline-mid)) drop-shadow(0 0 10px var(--hp-day-cycle-outline-far));will-change:filter;transition:filter 1100ms cubic-bezier(.22,.61,.36,1);}@media (prefers-reduced-motion:reduce){.hp-day-cycle-bg,.hp-day-cycle-sun,.stage.daycycle .hp-paperg,.hp-static-stage.daycycle .hp-paperg{transition:none;}}.sunlayer{pointer-events:none;}.compass{width:120px;height:120px;flex:none;touch-action:none;cursor:grab;user-select:none;}.compass:active{cursor:grabbing;}.compass .cring{fill:rgba(255,255,255,0.04);stroke:var(--divider-color,#444);stroke-width:2;}.compass .ctick{stroke:var(--secondary-text-color,#9aa4ad);stroke-width:2;}.compass .ctick.minor{stroke-width:1;opacity:0.6;}.compass .cneedle line{stroke:var(--primary-color,#3ea6ff);stroke-width:2.5;stroke-linecap:round;}.compass .cneedle path{fill:var(--primary-color,#3ea6ff);}.compass .cneedle text{fill:var(--text-primary-color,#fff);font-size:11px;font-weight:700;}.compass .cdeg{fill:var(--secondary-text-color,#9aa4ad);font-size:13px;}.compass.unset .cneedle{opacity:0.35;}.stage.hpboot .zoomwrap,.stage.hpboot .zoombadge{visibility:hidden;}.stage.hpsettle{transition:height 0.25s ease;}@media (prefers-reduced-motion:reduce){.stage.hpsettle{transition:none;}}.zoomctl{display:inline-flex;gap:var(--sp-1);background:rgba(127,127,127,0.12);border-radius:var(--rad-m);padding:var(--sp-1);}.zoomctl .zb{border:none;padding:var(--sp-3) var(--sp-4);}.zoomctl .zb[disabled]{opacity:0.4;pointer-events:none;}.projection-toggle{min-width:44px;min-height:44px;justify-content:center;padding:var(--sp-3);}.header-action{min-width:44px;min-height:44px;justify-content:center;padding:var(--sp-3);}.homearrow{position:absolute;z-index:12;transform:translate(-50%,-50%);width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;background:var(--card-background-color,var(--hp-bg));color:var(--hp-accent);border:1px solid var(--hp-accent);opacity:0.9;padding:0;}.homearrow ha-icon{--mdc-icon-size:22px;line-height:1;}.zoombadge{position:absolute;z-index:12;left:var(--sp-4);bottom:var(--sp-4);background:var(--card-background-color,var(--hp-bg));opacity:0.92;color:var(--hp-txt);border:1px solid var(--hp-accent);border-radius:var(--rad-m);padding:var(--sp-1) var(--sp-4);font-size:var(--fs-s);font-weight:600;pointer-events:none;}.zoomwrap>svg{position:absolute;inset:0;width:100%;height:100%;display:block;}.plan-svg{z-index:1;}.iso-underlay-svg{z-index:0;overflow:visible;}.iso-shadows-svg{z-index:3;overflow:visible;}.iso-walls-svg{z-index:4;overflow:visible;}.iso-overlays-svg{z-index:5;overflow:visible;}.iso-underlay-svg,.iso-shadows-svg,.iso-walls-svg,.iso-overlays-svg,.iso-underlay,.iso-shadows,.iso-walls,.iso-openings{pointer-events:none;}.iso-side-hi{stop-color:#b9bdbe;}.iso-side-lo{stop-color:#969c9f;}.iso-top-hi{stop-color:#fafaf7;}.iso-top-lo{stop-color:#e2e4e2;}.iso-wall-side{fill:url(#hp-iso-wall-side) #a8acae;stroke:#92989b;stroke-width:0.7;vector-effect:non-scaling-stroke;}.iso-wall-top{fill:url(#hp-iso-wall-top) #f3f3f1;stroke:#d7d9d8;stroke-width:0.8;vector-effect:non-scaling-stroke;}.iso-material-texture{fill:url(#hp-iso-wall-texture);stroke:none;opacity:0.12;pointer-events:none;}.iso-floor-texture{fill:url(#hp-iso-floor-texture);opacity:0.1;}.iso-texture-mark{fill:rgba(36,43,47,0.34);}.iso-texture-line{fill:none;stroke:rgba(36,43,47,0.24);stroke-width:0.55;}.iso-floor-side{fill:#858b8d;stroke:#71787b;stroke-width:0.7;vector-effect:non-scaling-stroke;}.iso-opening-panel{fill:#d7d9d7;fill-opacity:0.96;stroke:#7f878b;stroke-width:0.9;vector-effect:non-scaling-stroke;}.iso-opening-panel.iso-window{fill:#dfeff4;fill-opacity:0.72;stroke:#8aa7b1;}.iso-opening-panel.iso-material-reveal{fill:#c7cbca;stroke:#8b9294;}.iso-opening-panel.iso-material-matte-leaf{fill:#a6abad;stroke:#737b7f;}.iso-opening-panel.iso-opening-leaf-edge,.iso-opening-panel.iso-opening-leaf-top{fill:#8d9497;}.iso-opening-panel.iso-material-light-window,.iso-opening-panel.iso-material-light-frame,.iso-opening-panel.iso-material-light-sill{fill:#edf7f9;fill-opacity:0.94;stroke:#94adb4;}.iso-overlay-ground{fill:rgba(20,26,29,0.3);filter:url(#hp-iso-overlay-ground);pointer-events:none;}.iso-overlay-tether{stroke:rgba(54,65,71,0.48);stroke-width:1;stroke-dasharray:3 2;vector-effect:non-scaling-stroke;pointer-events:none;}.iso-ambient-shadow{fill:rgba(15,21,25,0.22);filter:url(#hp-iso-ambient-shadow);}.iso-contact-shadow{fill:none;stroke:rgba(22,28,31,0.25);stroke-width:3;filter:url(#hp-iso-contact-shadow);vector-effect:non-scaling-stroke;}.iso-leaf-shadow{fill:none;stroke:rgba(18,23,27,0.24);stroke-width:4;filter:url(#hp-iso-leaf-shadow);vector-effect:non-scaling-stroke;}.stage.theme-dark .iso-side-hi{stop-color:#4c555a;}.stage.theme-dark .iso-side-lo{stop-color:#343c40;}.stage.theme-dark .iso-top-hi{stop-color:#687176;}.stage.theme-dark .iso-top-lo{stop-color:#50585d;}.stage.theme-dark .iso-wall-side{stroke:#30373b;}.stage.theme-dark .iso-wall-top{stroke:#7b858a;}.stage.theme-dark .iso-floor-side{fill:#2d3438;stroke:#20272a;}.stage.theme-dark .iso-opening-panel{fill:#626b70;stroke:#899399;}.stage.theme-dark .iso-opening-panel.iso-window{fill:#75919b;stroke:#abc6ce;}.stage.theme-dark .iso-opening-panel.iso-material-reveal{fill:#454e52;stroke:#727d82;}.stage.theme-dark .iso-opening-panel.iso-material-matte-leaf{fill:#626a6e;stroke:#899398;}.stage.theme-dark .iso-opening-panel.iso-opening-leaf-edge,.stage.theme-dark .iso-opening-panel.iso-opening-leaf-top{fill:#4b5458;}.stage.theme-dark .iso-opening-panel.iso-material-light-window,.stage.theme-dark .iso-opening-panel.iso-material-light-frame,.stage.theme-dark .iso-opening-panel.iso-material-light-sill{fill:#d8e8eb;stroke:#9eb8bf;}.stage.theme-dark .iso-ambient-shadow{fill:rgba(0,0,0,0.34);}.stage.theme-dark .iso-contact-shadow,.stage.theme-dark .iso-leaf-shadow{stroke:rgba(0,0,0,0.38);}.stage.theme-dark .iso-texture-mark{fill:rgba(255,255,255,0.24);}.stage.theme-dark .iso-texture-line{stroke:rgba(255,255,255,0.18);}.stage.theme-dark .iso-overlay-ground{fill:rgba(0,0,0,0.42);}.stage.theme-dark .iso-overlay-tether{stroke:rgba(224,232,235,0.5);}@media (prefers-color-scheme:dark){.stage:not(.theme-light) .iso-side-hi{stop-color:#4c555a;}.stage:not(.theme-light) .iso-side-lo{stop-color:#343c40;}.stage:not(.theme-light) .iso-top-hi{stop-color:#687176;}.stage:not(.theme-light) .iso-top-lo{stop-color:#50585d;}.stage:not(.theme-light) .iso-wall-side{stroke:#30373b;}.stage:not(.theme-light) .iso-wall-top{stroke:#7b858a;}.stage:not(.theme-light) .iso-floor-side{fill:#2d3438;stroke:#20272a;}.stage:not(.theme-light) .iso-opening-panel{fill:#626b70;stroke:#899399;}.stage:not(.theme-light) .iso-opening-panel.iso-window{fill:#75919b;stroke:#abc6ce;}.stage:not(.theme-light) .iso-opening-panel.iso-material-reveal{fill:#454e52;stroke:#727d82;}.stage:not(.theme-light) .iso-opening-panel.iso-material-matte-leaf{fill:#626a6e;stroke:#899398;}.stage:not(.theme-light) .iso-opening-panel.iso-opening-leaf-edge,.stage:not(.theme-light) .iso-opening-panel.iso-opening-leaf-top{fill:#4b5458;}.stage:not(.theme-light) .iso-opening-panel.iso-material-light-window,.stage:not(.theme-light) .iso-opening-panel.iso-material-light-frame,.stage:not(.theme-light) .iso-opening-panel.iso-material-light-sill{fill:#d8e8eb;stroke:#9eb8bf;}.stage:not(.theme-light) .iso-ambient-shadow{fill:rgba(0,0,0,0.34);}.stage:not(.theme-light) .iso-contact-shadow,.stage:not(.theme-light) .iso-leaf-shadow{stroke:rgba(0,0,0,0.38);}.stage:not(.theme-light) .iso-texture-mark{fill:rgba(255,255,255,0.24);}.stage:not(.theme-light) .iso-texture-line{stroke:rgba(255,255,255,0.18);}.stage:not(.theme-light) .iso-overlay-ground{fill:rgba(0,0,0,0.42);}.stage:not(.theme-light) .iso-overlay-tether{stroke:rgba(224,232,235,0.5);}}@media (forced-colors:active){.iso-wall-side,.iso-wall-top,.iso-floor-side,.iso-opening-panel{fill:Canvas;stroke:CanvasText;forced-color-adjust:auto;}.iso-ambient-shadow,.iso-contact-shadow,.iso-leaf-shadow,.iso-overlay-ground,.iso-material-texture{display:none;}.iso-overlay-tether{stroke:CanvasText;}}@supports not (filter:blur(1px)){.iso-ambient-shadow,.iso-contact-shadow,.iso-leaf-shadow,.iso-overlay-ground,.iso-material-texture{display:none;}}.hp-paper{fill:var(--ha-card-background,var(--card-background-color,#111));stroke:none;}.stage.noplan .hp-paper,.stage.mode-plan .hp-paper,.stage.mode-devices .hp-paper,.stage.mode-decor .hp-paper{fill:#ffffff;}.room{transition:0.12s;cursor:default;stroke-linejoin:round;stroke-linecap:round;}.stage.mode-view .room{cursor:pointer;}.room.overlay{fill:transparent;stroke:transparent;stroke-width:calc(2px * var(--hp-cell-visual-scale,1));}:host([data-pointer-hover]) .stage.mode-view .room.overlay:not(.styled):hover{stroke:var(--hp-accent);stroke-opacity:1;}.room.yard{fill:rgba(75,140,90,0.14);stroke:#4b8c5a;stroke-width:calc(2px * var(--hp-cell-visual-scale,1));}:host([data-pointer-hover]) .stage.mode-view .room.yard:not(.styled):hover{stroke:var(--hp-accent);stroke-opacity:1;}.room.styled{stroke:var(--room-stroke,transparent);stroke-opacity:var(--room-stroke-op,0);stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));fill:var(--room-fill,transparent);fill-opacity:var(--room-fill-op,0);}.glow-base-layer,.glow-base-tunnels,.glow-pools-frame,.glow-pools,.glow-spot{pointer-events:none;}.glow-pools-frame,.glow-pools,.glow-spot{isolation:isolate;}.glow-pools.blend-screen .glow-spot{mix-blend-mode:screen;}.glow-spot{opacity:1;transition:opacity 500ms ease;}.glow-spot.is-entering,.glow-spot.is-leaving{opacity:0;}@media (prefers-reduced-motion:reduce){.glow-spot{transition:none;}}:host([data-pointer-hover]) .stage.mode-view .room.styled:hover{stroke:var(--hp-accent);stroke-opacity:1;}.op-leaf{transition:transform 0.6s ease;}.op-arc{stroke-width:calc(1.5px * var(--hp-cell-visual-scale,1));transition:stroke-dashoffset 0.6s ease;}.op-outline{fill:none;stroke:var(--hp-accent);stroke-width:calc(1.5px * var(--hp-cell-visual-scale,1));opacity:0;transition:opacity 0.15s;pointer-events:none;}:host([data-pointer-hover]) .stage.markup g.opening:hover .op-outline{opacity:0.9;}.op-hit{fill:transparent;pointer-events:none;cursor:default;}.stage.markup .op-hit{pointer-events:auto;cursor:grab;touch-action:none;}.stage.markup .op-hit:active{cursor:grabbing;}.stage.markup .opening.orphan{pointer-events:auto;cursor:pointer;color:var(--error-color,#db4437);}.stage.markup .opening.orphan circle{fill:var(--hp-bg);stroke:currentColor;stroke-width:calc(2px * var(--hp-cell-visual-scale,1));}.stage.markup .opening.orphan text{fill:currentColor;font-weight:800;font-size:calc(12px * var(--hp-cell-visual-scale,1));pointer-events:none;}.stage.markup.tool-resize .op-hit{pointer-events:none;cursor:default;}.stage.mode-view .oplock{pointer-events:auto;cursor:pointer;}.stage.projection-iso.mode-view .oplock::before{content:'';position:absolute;left:50%;top:50%;width:max(44px,100%);height:max(44px,100%);transform:translate(-50%,-50%);border-radius:50%;pointer-events:auto;}@media (prefers-reduced-motion:reduce){.op-leaf,.op-arc{transition:none;}}.roomlabel{pointer-events:none;position:absolute;transform:translate(-50%,-50%);font-size:calc(var(--rl-icon-size,var(--icon-size,2.5cqw)) * 0.5 * var(--rl-scale,1) * var(--rl-font,1) * var(--rl-space,1));font-weight:700;letter-spacing:0.04em;white-space:nowrap;cursor:grab;user-select:none;z-index:1;display:flex;flex-direction:column;align-items:center;gap:0.15em;text-align:center;}.rlname{display:inline-flex;align-items:center;gap:0.25em;font-size:calc(1em * var(--rl-name,1));}.zoomwrap.slide-left{animation:hp-slide-left 0.18s cubic-bezier(0.2,0.7,0.2,1);}.zoomwrap.slide-right{animation:hp-slide-right 0.18s cubic-bezier(0.2,0.7,0.2,1);}@media (prefers-reduced-motion:reduce){.zoomwrap.slide-left,.zoomwrap.slide-right{animation:none;}}.rlgearbtn{--gear-h:calc(var(--icon-size,2.5cqw) * 0.77);position:absolute;transform:translate(-50%,-50%);display:inline-flex;align-items:center;gap:0.35em;height:var(--gear-h);padding:0 calc(var(--gear-h) * 0.38);border:0;border-radius:999px;background:var(--hp-accent);color:var(--text-primary-color,#fff);font:inherit;font-size:calc(var(--gear-h) * 0.42);font-weight:600;line-height:1;white-space:nowrap;cursor:pointer;pointer-events:auto;opacity:0.92;box-shadow:var(--shadow-1);z-index:2;}.rlgearbtn{transition:opacity 0.15s,filter 0.15s;}:host([data-pointer-hover]) .rlgearbtn:hover{opacity:1;filter:brightness(1.18);}.rlgearbtn ha-icon{--mdc-icon-size:calc(var(--gear-h) * 0.55);display:inline-flex;}.rlgear{--mdc-icon-size:0.9em;display:inline-flex;margin-right:0.2em;opacity:0.6;cursor:pointer;pointer-events:auto;}:host([data-pointer-hover]) .rlgear:hover{opacity:1;}.rlgo{--mdc-icon-size:0.85em;display:inline-flex;opacity:0.55;}.stage.mode-view .rlgo{pointer-events:auto;cursor:pointer;}:host([data-pointer-hover]) .stage.mode-view .rlgo:hover{opacity:1;}.roomlabel .rlmetrics{position:absolute;top:calc(100% + 0.15em);left:50%;transform:translateX(-50%);white-space:nowrap;display:flex;align-items:center;gap:0.55em;font-size:calc(0.75em * var(--rl-meta,1));font-weight:600;letter-spacing:0.02em;opacity:0.9;}.roomlabel .rlm{display:inline-flex;align-items:center;gap:0.12em;}.roomlabel .rlm ha-icon{--mdc-icon-size:1.05em;display:inline-flex;}.roomlabel .rlm.lit{opacity:1;}.rlhandle{display:none;position:absolute;width:9px;height:9px;border-radius:2px;background:var(--hp-accent);border:1px solid var(--card-background-color,#fff);z-index:2;}.rlhandle.tl{left:-6px;top:-6px;cursor:nwse-resize;}.rlhandle.br{right:-6px;bottom:-6px;cursor:nwse-resize;}.rlhandle.tr{right:-6px;top:-6px;cursor:nesw-resize;}.rlhandle.bl{left:-6px;bottom:-6px;cursor:nesw-resize;}:host([data-pointer-hover]) .stage.markup .roomlabel:hover .rlhandle{display:block;}.stage.markup .roomlabel{pointer-events:auto;}.stage.mode-view .roomlabel{pointer-events:auto;cursor:pointer;border-radius:0.2em;}.stage.projection-iso.mode-view .roomlabel{box-sizing:border-box;min-width:44px;min-height:44px;justify-content:center;}.stage.mode-view .roomlabel:focus-visible{outline:2px solid var(--hp-accent);outline-offset:4px;}.roomlabel:active{cursor:grabbing;}.measurelayer{position:absolute;inset:0;pointer-events:none;}.alignline{stroke:var(--hp-accent);stroke-width:calc(1.2px * var(--hp-cell-visual-scale,1));stroke-dasharray:calc(4px * var(--hp-cell-visual-scale,1)) calc(4px * var(--hp-cell-visual-scale,1));pointer-events:none;opacity:0.9;}.aligndot{fill:var(--hp-accent);pointer-events:none;}.measurelabel.on45{color:#4bd28f;border-color:#4bd28f;}.measurelabel{position:absolute;transform:translate(12px,-150%);font-size:var(--fs-s);font-weight:600;padding:1px var(--sp-3);border-radius:var(--rad-s);background:rgba(0,0,0,0.72);color:#fff;white-space:nowrap;pointer-events:none;user-select:none;z-index:3;}.measurelabel.opdimension{transform:translate(calc(-50% + var(--op-label-shift-x,0px)),calc(-50% + var(--op-label-shift-y,-12px)));border:1px solid var(--hp-open,#ff9800);}.decorlayer .dshape{pointer-events:none;}.stage.mode-decor .decorlayer .dshape{pointer-events:visiblePainted;cursor:pointer;}.stage.mode-decor.dtool-select .decorlayer .dshape{cursor:move;}.stage.mode-decor.dtool-line .decorlayer .dshape,.stage.mode-decor.dtool-rect .decorlayer .dshape,.stage.mode-decor.dtool-ellipse .decorlayer .dshape,.stage.mode-decor.dtool-text .decorlayer .dshape,.stage.mode-decor.dtool-furniture .decorlayer .dshape,.stage.mode-decor.dtool-image .decorlayer .dshape,.stage.mode-decor.dtool-backdrop .decorlayer .dshape{pointer-events:none;}.stage.mode-decor.dtool-furniture,.stage.mode-decor.dtool-image{cursor:copy;}.stage.mode-decor.dtool-select .decorlayer .dimage,.stage.mode-decor.dtool-erase .decorlayer .dimage,.stage.mode-decor.dtool-select .decorlayer .dimage-missing,.stage.mode-decor.dtool-erase .decorlayer .dimage-missing{pointer-events:bounding-box;}.decorlayer .dimage-missing rect{fill:rgba(127,127,127,0.12);stroke:var(--hp-accent);stroke-dasharray:8 5;vector-effect:non-scaling-stroke;}.decorlayer .dimage-missing path{fill:none;stroke:var(--hp-accent);vector-effect:non-scaling-stroke;}.decorlayer .decor-image-placement-preview{opacity:0.65;}.stage.mode-decor.dtool-text .decorlayer .dshape.dtext,.stage.mode-decor.dtool-select .decorlayer .dshape.dtext,.stage.mode-decor.dtool-erase .decorlayer .dshape.dtext{pointer-events:visiblePainted;pointer-events:bounding-box;}.stage.mode-decor.dtool-text .decorlayer .dshape.dtext{cursor:text;}.decorlayer .derasehit{fill:none;stroke:transparent;stroke-width:16px;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;pointer-events:none;}.stage.mode-decor.dtool-erase .decorlayer .derasehit{pointer-events:stroke;}.decorlayer .dselecthit{fill:none;stroke:transparent;stroke-width:16px;stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:none;}.stage.mode-decor.dtool-select .decorlayer .dselecthit{pointer-events:stroke;cursor:move;}.stage.mode-decor .decorlayer .dshape.dfurniturehit{fill:none;stroke:transparent;pointer-events:none;}.stage.mode-decor.dtool-select .decorlayer .dshape.dfurniturehit{pointer-events:stroke;cursor:move;}.decorlayer .dsel{filter:drop-shadow(0 0 3px var(--hp-accent));}.decorlayer .ddraft{stroke-dasharray:calc(6px * var(--hp-cell-visual-scale,1)) calc(5px * var(--hp-cell-visual-scale,1));pointer-events:none;}.decorlayer .furniture-placement-preview{opacity:0.55;pointer-events:none;}.decorlayer text{font-weight:600;user-select:none;dominant-baseline:middle;text-anchor:middle;}.stage.mode-decor{outline:2px solid #26a69a;outline-offset:-2px;}.bdframe .bdbox{fill:none;stroke:var(--hp-accent);stroke-width:2;stroke-dasharray:10 7;vector-effect:non-scaling-stroke;pointer-events:none;opacity:0.9;}.bdframe .bdhandle{fill:transparent;stroke:none;pointer-events:all;touch-action:none;}.bdframe .bdknob{fill:var(--hp-accent);stroke:#fff;stroke-width:1;vector-effect:non-scaling-stroke;pointer-events:none;}:host([data-pointer-hover]) .bdframe .bdhandle:hover + .bdknob{fill:#fff;stroke:var(--hp-accent);}.bdframe .bd-nwse{cursor:nwse-resize;}.bdframe .bd-nesw{cursor:nesw-resize;}.stage.mode-decor.bdgrab{cursor:grab;}.stage.mode-decor.bdgrabbing,.stage.mode-decor.bdgrabbing .bdframe .bdhandle{cursor:grabbing;}.measurelabel.bdmeasure{transform:translate(-50%,-50%);border:1px solid var(--hp-accent);}.dtframe .dtbox{fill:none;stroke:var(--hp-accent);stroke-width:1.5;stroke-dasharray:7 5;vector-effect:non-scaling-stroke;pointer-events:none;opacity:0.85;}.dtframe .dtstem,.bdframe .dtstem{stroke:var(--hp-accent);stroke-width:1.5;vector-effect:non-scaling-stroke;pointer-events:none;opacity:0.85;}.dtframe .dthandle{fill:transparent;stroke:none;pointer-events:all;touch-action:none;}.dtframe .dtknob{fill:var(--hp-accent);stroke:#fff;stroke-width:1;vector-effect:non-scaling-stroke;pointer-events:none;}:host([data-pointer-hover]) .dtframe .dthandle:hover + .dtknob{fill:#fff;stroke:var(--hp-accent);}.dtframe .dt-nwse{cursor:nwse-resize;}.dtframe .dt-nesw{cursor:nesw-resize;}.dtframe .dtrot{cursor:grab;}.dtframe .dt-ew{cursor:ew-resize;}.dtframe .dt-ns{cursor:ns-resize;}.dtfurnitureframe .dtrot{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M18.4 7.2A8 8 0 1 0 20 12' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='m15.5 3.8 3.2 3.5-4.6.8' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 12 12,grab;}.dtfurnitureframe .dtrot:active{cursor:grabbing;}.dtframe .dtendpoint{cursor:crosshair;}.bdframe .dtrot{cursor:grab;}.dtarea{resize:vertical;min-height:3.4em;font:inherit;line-height:1.35;}.stage.mode-decor.dtool-line,.stage.mode-decor.dtool-rect,.stage.mode-decor.dtool-ellipse,.stage.mode-decor.dtool-text{cursor:crosshair;}.stage.mode-decor.dtool-erase,.stage.mode-decor.dtool-erase .decorlayer .dshape{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cg transform='rotate(-45 12 12)'%3E%3Crect x='7' y='2' width='10' height='18' rx='2' fill='%23fff' stroke='%23111' stroke-width='1.5'/%3E%3Cpath d='M7 13h10v5a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2z' fill='%23ff9f43' stroke='%23111' stroke-width='1.5'/%3E%3C/g%3E%3C/svg%3E") 5 22,pointer;}.stage.mode-decor .room{pointer-events:none;}.stage.mode-decor .devlayer,.stage.mode-decor .devlayer *,.stage.mode-decor .dev::before{pointer-events:none;}.stage .room,.stage .devlayer,.stage .opening,.stage .room-outline,.stage .wallbodies,.stage .opening-tunnels,.stage .glow-base-layer,.stage .glow-pools-frame,.stage .zero-walls{opacity:var(--hp-mode-architecture-opacity,1);}.opening-preview{opacity:0.5;pointer-events:none;}.opening-preview[data-kind="passage"]{opacity:1;}.passage-preview-cut{fill:var(--wall-fill,#ffffff);fill-opacity:0.35;stroke:none;pointer-events:none;}.passage-preview-boundary{stroke:var(--hp-open,#ff9800);stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));pointer-events:none;}.opening-preview .op-leaf,.opening-preview .op-arc{transition:none;}.opening-preview-dot{fill:var(--hp-open,#ff9800);pointer-events:none;}.opening-dimensions,.opening-dimension{pointer-events:none;}.opening-dimension-line,.opening-dimension-tick{fill:none;stroke:var(--hp-open,#ff9800);stroke-width:1.5;vector-effect:non-scaling-stroke;pointer-events:none;}.opening-dimension-tick{stroke-width:2;}.stage.edit .room{pointer-events:none;}.stage.markup{cursor:crosshair;}.stage.markup.tool-merge,.stage.markup.tool-split.pickstage,.stage.markup.tool-delroom{cursor:pointer;}.stage.markup.tool-wallthick{cursor:default;}.stage.markup.tool-wallthick.wallhot{cursor:pointer;}.wallbody-fill{fill:var(--wall-fill,#ffffff);fill-opacity:var(--wall-fill-op,1);fill-rule:evenodd;stroke:none;pointer-events:none;}.wallbody{fill:url(#hp-wall-hatch);fill-rule:evenodd;stroke:var(--room-stroke,var(--hp-muted));stroke-width:calc(0.6px * var(--hp-cell-visual-scale,1));pointer-events:none;}.wallbody.solid{fill:none;}.wallthick-hover{fill:var(--accent-color,#03a9f4);fill-opacity:0.38;stroke:var(--accent-color,#03a9f4);stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));stroke-linejoin:round;stroke-linecap:round;pointer-events:none;}.wallthick-hover.isopen{fill:var(--error-color,#f44336);stroke:var(--error-color,#f44336);}.zero-wall{stroke:var(--zero-wall-stroke,var(--hp-muted));stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));stroke-dasharray:calc(7px * var(--hp-cell-visual-scale,1)) calc(7px * var(--hp-cell-visual-scale,1));stroke-linecap:butt;pointer-events:none;opacity:0.9;}.zero-walls.solid .zero-wall{stroke-dasharray:none;}.room.noedge{stroke-opacity:0 !important;}.room-outline{fill:none;stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));stroke-linejoin:round;stroke-linecap:round;pointer-events:none;}.room-outline.outlined{stroke:rgba(62,166,255,0.55);stroke-opacity:1;}.room-hover-fill{fill:#000;fill-opacity:0.22;pointer-events:none;}.room-hover-halo{fill:none;stroke:var(--hp-accent);stroke-opacity:0.28;stroke-width:calc(8px * var(--hp-cell-visual-scale,1));stroke-linejoin:round;stroke-linecap:round;pointer-events:none;}.room-hover-outline{fill:none;stroke:var(--hp-accent);stroke-width:calc(3px * var(--hp-cell-visual-scale,1));stroke-linejoin:round;stroke-linecap:round;pointer-events:none;}.stage.markup .room{pointer-events:none;}.stage.markup .devlayer .dev{display:none;}.stage.mode-plan{outline:2px solid #ffc14d;outline-offset:-2px;}.stage.mode-devices{outline:2px solid var(--hp-accent);outline-offset:-2px;}.room.outlined{stroke:rgba(62,166,255,0.55);fill:rgba(62,166,255,0.06);}.room.picked{stroke:#ffc14d;stroke-width:calc(3px * var(--hp-cell-visual-scale,1));fill:rgba(255,193,77,0.25);}.griddot{fill:var(--hp-accent);opacity:0.35;stroke:rgba(0,0,0,0.35);stroke-width:0.4;}.griddot.major{opacity:0.5;stroke-width:0;}.seg{stroke:var(--hp-accent);stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));stroke-linecap:round;stroke-linejoin:round;}.pathline{stroke:#ffc14d;stroke-width:calc(3px * var(--hp-cell-visual-scale,1));fill:none;stroke-linecap:round;stroke-linejoin:round;}.preview{stroke:#ffc14d;stroke-width:calc(2px * var(--hp-cell-visual-scale,1));stroke-dasharray:calc(6px * var(--hp-cell-visual-scale,1)) calc(5px * var(--hp-cell-visual-scale,1));opacity:0.7;}.active-axis{stroke:#ffc14d;stroke-width:2;stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:none;}.active-vertex{fill:#ffc14d;stroke:#171006;stroke-width:2;vector-effect:non-scaling-stroke;pointer-events:none;}.wall-repair-preview{stroke:#d93025;stroke-width:4;stroke-linecap:round;stroke-dasharray:5 4;vector-effect:non-scaling-stroke;pointer-events:none;}.drawwall-preview-fill{fill:var(--wall-fill,#ffffff);fill-opacity:calc(var(--wall-fill-op,1) * 0.55);fill-rule:evenodd;stroke:none;pointer-events:none;}.drawwall-preview{fill:url(#hp-wall-hatch);fill-opacity:0.55;fill-rule:evenodd;stroke:var(--accent-color,#03a9f4);stroke-width:calc(0.5px * var(--hp-cell-visual-scale,1));stroke-opacity:0.7;pointer-events:none;}.drawwall-zero-preview{fill:none;stroke:var(--accent-color,#03a9f4);stroke-width:calc(3px * var(--hp-cell-visual-scale,1));stroke-linecap:butt;stroke-linejoin:round;opacity:0.72;pointer-events:none;}.drawwall-zero-preview.dashed{stroke-dasharray:calc(7px * var(--hp-cell-visual-scale,1)) calc(7px * var(--hp-cell-visual-scale,1));}.vertex{fill:#ffc14d;stroke:#4a2800;stroke-width:calc(1px * var(--hp-cell-visual-scale,1));}.vertex.first{fill:#4bd28f;stroke:#04121f;}.plan-snap-overlay,.plan-snap-overlay *,.hidden-wall-diagnostic,.hidden-wall-diagnostic *{pointer-events:none;}.plan-snap-line,.hidden-wall-line{fill:none;stroke:color-mix(in srgb,var(--hp-accent) 82%,white 18%);stroke-width:1;stroke-linecap:round;opacity:0.92;}.plan-snap-node,.hidden-wall-node{fill:var(--ha-card-background,var(--card-background-color,#fff));stroke:color-mix(in srgb,var(--hp-accent) 88%,#07131c 12%);stroke-width:1;vector-effect:non-scaling-stroke;}.plan-snap-node.active{fill:#ffc14d;stroke:#171006;stroke-width:2;}.plan-snap-node.active.dynamic{fill:#4bd28f;stroke:#04121f;}.plan-snap-node.conflict{fill:#fff;stroke:#d93025;stroke-width:3;}@media (prefers-color-scheme:dark){.plan-snap-line{stroke:color-mix(in srgb,var(--hp-accent) 72%,white 28%);}.hidden-wall-line{stroke:color-mix(in srgb,var(--hp-accent) 72%,white 28%);}.plan-snap-node,.hidden-wall-node{fill:#17242c;stroke:#9bdcf5;}.plan-snap-node.active{fill:#ffc14d;stroke:#fff4d6;}.plan-snap-node.active.dynamic{fill:#4bd28f;stroke:#eafff4;}}@media (forced-colors:active){.plan-snap-line,.hidden-wall-line{stroke:CanvasText;opacity:1;forced-color-adjust:auto;}.plan-snap-node,.hidden-wall-node{fill:Canvas;stroke:CanvasText;forced-color-adjust:auto;}.plan-snap-node.active,.plan-snap-node.active.dynamic{fill:Highlight;stroke:HighlightText;forced-color-adjust:auto;}}.sunlayer{animation:hp-sunfade-in 2s linear both;}.sunlayer.out{animation:hp-sunfade-out 2s linear both;}@media (prefers-reduced-motion:reduce){.sunlayer,.sunlayer.out{animation:none;}.sunlayer.out{opacity:0;}}.devlayer{position:absolute;inset:0;pointer-events:none;z-index:6;}.radar-target{position:absolute;width:8px;height:8px;box-sizing:border-box;transform:translate(-50%,-50%);border-radius:50%;background:var(--success-color,#43a047);border:2px solid var(--primary-text-color,#1f1f1f);box-shadow:0 0 0 1px color-mix(in srgb,var(--card-background-color,#fff) 80%,transparent);pointer-events:none;z-index:0;}.radar-target.smooth{transition:left 200ms linear,top 200ms linear;}.radar-ranges{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;z-index:0;}.radar-ranges path,.radar-ranges polyline{fill:none;stroke:var(--success-color,#43a047);stroke-width:2px;stroke-dasharray:5 4;vector-effect:non-scaling-stroke;opacity:0.72;}.radar-ranges .radar-zone{fill:color-mix(in srgb,var(--success-color,#43a047) 8%,transparent);stroke:var(--success-color,#43a047);stroke-width:2px;vector-effect:non-scaling-stroke;opacity:0.8;}.stage.mode-devices .dev{cursor:grab;}.stage.mode-devices .dev:active{cursor:grabbing;}.physical-hit{fill:transparent;stroke:transparent;pointer-events:none;cursor:grab;}.stage.tool-select .physical-hit{pointer-events:all;}.physical-hit:active{cursor:grabbing;}line.physical-hit{cursor:pointer;}.physical-hit.selected{fill:rgba(255,193,77,0.24);stroke:transparent;}line.physical-hit.selected{stroke:transparent;}.physical-drag{fill:rgba(255,193,77,0.38);stroke:#ffc14d;stroke-width:2.5;vector-effect:non-scaling-stroke;pointer-events:none;}.physical-chrome{pointer-events:none;}.physical-chrome .frame,.physical-chrome .stem{fill:none;stroke:#ffc14d;stroke-width:2;vector-effect:non-scaling-stroke;}.physical-chrome .frame{fill:rgba(255,193,77,0.22);}.physical-chrome polyline.frame{fill:none;}.physical-chrome .move-dot{fill:#ffc14d;stroke:#24262d;stroke-width:1.5;vector-effect:non-scaling-stroke;}.physical-chrome .rotate-handle{fill:#24262d;stroke:#ffc14d;stroke-width:2.5;vector-effect:non-scaling-stroke;pointer-events:all;cursor:crosshair;}.drawwall.invalid input{border-color:var(--error-color,#db4437);}.drawwall .rangehint{margin-inline-start:4px;font-size:0.78em;opacity:0.72;}.drawwall.invalid .rangehint{color:var(--error-color,#db4437);opacity:1;}.stage.markup.tool-partition,.stage.markup.tool-column{cursor:crosshair;}.rszhandle{fill:transparent;stroke:none;pointer-events:all;cursor:grab;touch-action:none;}.rszhandle:active{cursor:grabbing;}.rszhandle.disabled,.rszhandle.disabled:active{cursor:not-allowed;}.rszicon{pointer-events:none;}.rszicon path{fill:none;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;}.rszhalo{stroke:var(--hp-bg);stroke-width:6;}.rszink{stroke:var(--hp-accent);stroke-width:2;}:host([data-pointer-hover]) .rszhandle:hover + .rszicon .rszink{stroke-width:3;}.rszicon.disabled{opacity:0.38;}:host([data-pointer-hover]) .rszhandle.disabled:hover + .rszicon .rszink{stroke-width:2;}.rszmeasurelayer,.rszmeasurelayer *{pointer-events:none;}.rszmeasurehalo,.rszmeasureink,.rszleader{fill:none;stroke-linecap:round;vector-effect:non-scaling-stroke;}.rszmeasurehalo{stroke:var(--hp-bg);stroke-width:7px;opacity:0.9;}.rszmeasureink{stroke:var(--hp-accent);stroke-width:3px;}.rszleader{stroke:var(--hp-accent);stroke-width:2px;opacity:0.95;}.measurelabel.dmeasure{transform:translate(-50%,-160%);}.measurelabel.rszarea{transform:translate(calc(-50% + var(--rsz-label-x,0px)),calc(-50% + var(--rsz-label-y,0px)));background:rgba(0,0,0,0.6);border:1px solid var(--hp-accent);}.measurelabel.furnmeasure{transform:translate(-50%,-50%);border:1px solid var(--hp-accent);}.alignmsg{margin:0 0 8px;font-size:13px;line-height:1.45;}`,o`.dev ha-icon{position:relative;z-index:1;}.device-pulse{position:absolute;left:50%;top:50%;width:var(--dev-size);height:var(--dev-size);transform:translate(-50%,-50%);pointer-events:none;z-index:0;}.device-pulse i{position:absolute;inset:0;border-radius:50%;border:2px solid var(--ripple-color,var(--hp-accent));opacity:0;}.device-pulse.short i{animation:hp-pulse-short 1.1s cubic-bezier(.22,.61,.36,1) 1 forwards;}.device-pulse.short i:nth-child(2){animation-delay:1.1s;}.device-pulse.short i:nth-child(3){animation-delay:2.2s;}.device-pulse.short.gen2 i{animation-name:hp-pulse-short-b;}.device-pulse.continuous i:nth-child(n + 2),.device-pulse.alarm i:nth-child(n + 3){display:none;}.device-pulse.continuous i:first-child{animation:hp-pulse-continuous 3.6s cubic-bezier(.45,.05,.55,.95) infinite;}.device-pulse.alarm i{border-width:3px;border-color:#F0410C;animation:hp-pulse-alarm 2.4s cubic-bezier(.22,.61,.36,1) infinite;}.device-pulse.alarm i:nth-child(2){animation-delay:1.2s;}.activity-dot{position:absolute;right:8%;bottom:8%;width:18%;height:18%;min-width:4px;min-height:4px;border-radius:50%;background:var(--ripple-color,var(--hp-accent));border:1px solid color-mix(in srgb,var(--hp-bg) 82%,transparent);pointer-events:none;z-index:3;}.kioskdots{position:absolute;left:50%;bottom:var(--sp-5);transform:translateX(-50%);display:flex;gap:var(--sp-4);z-index:5;pointer-events:none;}.kdot{width:9px;height:9px;border-radius:50%;background:var(--hp-muted);opacity:0.55;}.kdot.on{background:var(--hp-accent);opacity:1;}.dev.valonly{width:var(--dev-size,var(--icon-size,2.5cqw));}.dev.valonly .device-core{width:max-content;min-width:var(--dev-size,var(--icon-size,2.5cqw));padding-inline:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.16);border-radius:calc(var(--dev-size,var(--icon-size,2.5cqw)) / 2);}.dev .valtext{overflow:visible;font-size:calc(var(--dev-size,var(--icon-size,2.5cqw)) * var(--value-font-scale,.45));font-weight:600;white-space:nowrap;}@media (prefers-reduced-motion:reduce){.device-pulse{display:none;}}.dev .newdot{position:absolute;top:calc(var(--dev-size,var(--icon-size,2.5cqw)) * -0.12);right:calc(var(--dev-size,var(--icon-size,2.5cqw)) * -0.12);width:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.34);height:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.34);border-radius:50%;background:#f0301f;border:2px solid var(--card-background-color,var(--hp-bg));pointer-events:none;z-index:2;}.dev{position:absolute;--dev-size:calc(var(--device-base-size,2.25cqw) * var(--dev-scale,1));--device-shell-size:calc(var(--dev-size) * 1.26875);--device-shell-inset:calc(var(--dev-size) * 0.134375);--device-shell-stroke-ratio:0.01875;--device-shell-border-width:max(1px,calc(var(--dev-size) * var(--device-shell-stroke-ratio)));--device-core-bg:var(--card-background-color,#fff);--device-core-fg:var(--primary-text-color,#252525);--device-core-bg:light-dark(#fff,#252525);--device-core-fg:light-dark(#252525,#fff);--device-face-bg:var(--device-core-bg);--device-face-fg:var(--device-core-fg);--device-shell-base-stroke:light-dark(#BCBCBC,rgb(37 37 37 / 75%));--device-shell-stroke:var(--device-shell-base-stroke);--device-shell-shadow:0 calc(var(--dev-size) * .025) calc(var(--dev-size) * .05) rgb(37 40 45 / 12%),0 calc(var(--dev-size) * .1) calc(var(--dev-size) * .175) calc(var(--dev-size) * -.025) rgb(37 40 45 / 18%);--device-core-inset-shadow:0 0 0 0 transparent;--device-ring-color:transparent;--device-ring-width:0px;width:var(--dev-size);height:var(--dev-size);margin:calc(var(--dev-size) / -2) 0 0 calc(var(--dev-size) / -2);border:0;background:transparent;display:block;color:var(--device-core-fg);cursor:pointer;pointer-events:none;transition:opacity 0.2s;box-shadow:none;outline:none;z-index:auto;}.dev.theme-light{--device-core-bg:#fff;--device-core-fg:#000;--device-shell-base-stroke:#BCBCBC;--device-shell-stroke:var(--device-shell-base-stroke);--device-shell-shadow:0 calc(var(--dev-size) * .025) calc(var(--dev-size) * .05) rgb(37 40 45 / 12%),0 calc(var(--dev-size) * .1) calc(var(--dev-size) * .175) calc(var(--dev-size) * -.025) rgb(37 40 45 / 18%);--device-core-inset-shadow:0 0 0 0 transparent;}.dev.theme-dark{--device-core-bg:#252525;--device-core-fg:#fff;--device-shell-base-stroke:rgb(37 37 37 / 75%);--device-shell-stroke:var(--device-shell-base-stroke);--device-shell-shadow:0 calc(var(--dev-size) * .025) calc(var(--dev-size) * .0375) rgb(37 40 45 / 12%),0 calc(var(--dev-size) * .1) calc(var(--dev-size) * .175) calc(var(--dev-size) * -.025) rgb(37 40 45 / 18%);--device-core-inset-shadow:inset 0 calc(var(--dev-size) * 0.0125) calc(var(--dev-size) * 0.0125) rgb(255 255 255 / 70%);}.dev::before{content:'';position:absolute;left:50%;top:50%;width:max(44px,var(--device-shell-size));height:max(44px,var(--device-shell-size));transform:translate(-50%,-50%);border-radius:50%;pointer-events:auto;z-index:1;}.device-shell{position:absolute;box-sizing:border-box;display:flex;align-items:center;gap:calc(var(--dev-size) * 0.1);padding:0;min-width:var(--dev-size);min-height:var(--dev-size);border:0;background:transparent;box-shadow:none;transition:opacity .2s;pointer-events:none;z-index:2;}.device-shell-frame{position:absolute;z-index:0;box-sizing:border-box;inset:calc(var(--device-shell-inset) / -1);border:var(--device-shell-border-width) solid var(--device-shell-stroke);border-radius:9999px;background:transparent;box-shadow:var(--device-shell-shadow);transition:border-color .15s,opacity .2s;pointer-events:auto;backdrop-filter:none;}.device-shell:not(.with-values){left:0;top:0;}.device-shell:not(.with-values):not(.text-shell) .device-shell-frame{border-radius:50%;}.device-shell.with-values.pos-right{left:0;top:50%;transform:translateY(-50%);}.device-shell.with-values.pos-left{right:0;top:50%;transform:translateY(-50%);flex-direction:row-reverse;}.device-shell.with-values.pos-bottom{left:50%;top:0;transform:translateX(-50%);flex-direction:column;}.device-shell.with-values.pos-top{left:50%;bottom:0;transform:translateX(-50%);flex-direction:column-reverse;}.device-core{position:relative;z-index:1;box-sizing:border-box;flex:0 0 auto;width:var(--dev-size);height:var(--dev-size);display:flex;align-items:center;justify-content:center;border-radius:50%;background:var(--device-face-bg);color:var(--device-face-fg);box-shadow:var(--device-core-inset-shadow),0 0 0 var(--device-ring-width) var(--device-ring-color);line-height:0;transition:background .15s,color .15s,opacity .2s;pointer-events:none;}.device-sections{display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:calc(var(--dev-size) * .08);min-width:0;pointer-events:none;}.device-shell.pos-top .device-sections,.device-shell.pos-bottom .device-sections{flex-direction:row;}.dev ha-icon{--mdc-icon-size:calc(var(--dev-size,var(--device-base-size,2.25cqw)) * 0.55);display:flex;align-items:center;justify-content:center;line-height:0;}.dev.on{--device-face-bg:#F0A00C;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:#F0A00C;}.dev.theme-light.on{--device-face-fg:#fff;}.dev.theme-dark.on{--device-face-fg:#252525;--device-shell-stroke-ratio:.0375;}.dev.open{--device-face-bg:var(--hp-open);--device-face-fg:light-dark(#fff,#252525);}.dev.theme-light.open{--device-face-fg:#fff;}.dev.theme-dark.open{--device-face-fg:#252525;}.dev.lock-locked{--device-face-bg:#66D17A;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:#66D17A;}.dev.theme-light.lock-locked{--device-face-fg:#fff;}.dev.theme-dark.lock-locked{--device-face-fg:#252525;--device-shell-stroke-ratio:.025;}.dev.lock-unlocked{--device-face-bg:#F0410C;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:#F0410C;}.dev.theme-light.lock-unlocked{--device-face-fg:#fff;}.dev.theme-dark.lock-unlocked{--device-face-fg:#252525;--device-shell-stroke-ratio:.025;}:host([data-pointer-hover]) .dev:not(.unavail)[data-hp-device-hover]{--device-face-bg:#0C82F0;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:var(--device-shell-base-stroke);}:host([data-pointer-hover]) .dev.theme-light:not(.unavail)[data-hp-device-hover]{--device-face-fg:#fff;}:host([data-pointer-hover]) .dev.theme-dark:not(.unavail)[data-hp-device-hover]{--device-face-fg:#252525;}:host([data-pointer-hover]) .dev[data-hp-device-hover],.dev:focus-visible{z-index:5;}.dev[data-hp-zigbee-topology-endpoint]{z-index:8;}:host([data-pointer-hover]) .dev[data-hp-zigbee-topology-endpoint][data-hp-device-hover]{z-index:8;}.dev.unavail{opacity:0.35;--device-face-bg:#B5BAC1;--device-shell-stroke:var(--device-shell-base-stroke);}.dev.virtual .device-shell-frame{border-style:dashed;}.dev.ghost{opacity:0.6;color:var(--hp-accent);}.dev.ghost .device-shell-frame{border-style:dashed;border-color:var(--hp-accent);box-shadow:none;}.dev.ghost .device-core{background:rgba(62,166,255,0.22);background:color-mix(in srgb,var(--hp-accent) 30%,var(--card-background-color,#1c2530));color:var(--hp-accent);}.dev.ghost.ha-disabled{opacity:0.62;color:var(--secondary-text-color,#9aa0aa);}.dev.ghost.ha-disabled .device-shell-frame{border-color:var(--secondary-text-color,#9aa0aa);}.dev.ghost.ha-disabled .device-core{background:rgba(120,124,134,0.2);background:color-mix(in srgb,var(--secondary-text-color,#9aa0aa) 24%,var(--card-background-color,#1c2530));color:var(--secondary-text-color,#9aa0aa);}.dev .habadge{position:absolute;right:-18%;bottom:-18%;display:grid;place-items:center;width:46%;height:46%;min-width:12px;min-height:12px;border-radius:50%;background:var(--card-background-color,#242832);border:1px solid currentColor;}.dev .habadge ha-icon{width:72%;height:72%;}.dev.sel{--device-ring-color:#F0A00C;--device-ring-width:calc(var(--dev-size) * 0.0375);}.dev:focus-visible{--device-ring-color:#0C82F0;--device-ring-width:calc(var(--dev-size) * 0.0375);}.dev:not(.on):not(.open):not(.alarm):not(.lock-locked):not(.lock-unlocked):not(.unavail):focus-visible{--device-face-fg:#0C82F0;}.dev.alarm,:host([data-pointer-hover]) .dev.alarm[data-hp-device-hover],.dev.alarm:focus-visible{--device-face-bg:#F0410C;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:#F0410C;}.dev.theme-light.alarm{--device-face-fg:#fff;}.dev.theme-dark.alarm{--device-face-fg:#252525;--device-shell-stroke-ratio:.025;}.dev .value-badge{position:relative;z-index:2;box-sizing:border-box;width:max-content;min-width:calc(var(--dev-size,var(--icon-size,2.5cqw)) * .7875);height:calc(var(--dev-size,var(--icon-size,2.5cqw)) * .7875);display:flex;align-items:center;justify-content:center;overflow:visible;background:var(--device-core-bg);border:0;border-radius:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.39375);padding:0 calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.14);font-size:calc(var(--dev-size,var(--icon-size,2.5cqw)) * var(--value-font-scale,.45));font-weight:600;line-height:1;color:var(--device-core-fg);white-space:nowrap;pointer-events:none;}.dev .value-badge.unavailable,.dev .value-badge.missing{opacity:0.66;}.dev .lqi{position:absolute;top:calc(50% + var(--device-shell-size) / 2 + var(--dev-size) * .05);left:50%;transform:translateX(-50%);margin-top:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.05);font-size:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.38);font-weight:600;line-height:1;text-shadow:0 0 3px rgba(0,0,0,0.9),0 0 2px rgba(0,0,0,0.9);white-space:nowrap;pointer-events:none;}.dev .lqi.below-value-badge{margin-top:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.8875);}.temprange{display:inline-flex;align-items:center;gap:var(--sp-3);margin-left:auto;color:var(--hp-muted);font-size:var(--fs-s);}.vacwarn{position:absolute;top:-12%;right:-12%;width:calc(var(--device-base-size,2.25cqw) * 0.42);height:calc(var(--device-base-size,2.25cqw) * 0.42);border-radius:50%;display:flex;align-items:center;justify-content:center;background:light-dark(#fff,#252525);border:1px solid #E5A100;color:#E5A100;z-index:7;pointer-events:none;}.vacwarn ha-icon{--mdc-icon-size:calc(var(--device-base-size,2.25cqw) * 0.32);color:inherit;}.vacpuck{position:absolute;--puck-size:calc(var(--device-base-size,2.25cqw) * 0.8);width:var(--puck-size);height:var(--puck-size);border-radius:50%;transform:translate(-50%,-50%);--vac-core-bg:light-dark(#fff,#252525);--vac-core-fg:light-dark(#252525,#fff);background:var(--vac-core-bg);border:1px solid #BCBCBC;box-shadow:0 1px 2px rgb(37 40 45 / 12%),0 4px 8px -1.07px rgb(37 40 45 / 18%);color:var(--vac-core-fg);display:flex;align-items:center;justify-content:center;cursor:pointer;z-index:6;transition:left 1.2s linear,top 1.2s linear;animation:vacpulse 2.2s ease-out infinite;}.vacpuck.theme-light{--vac-core-bg:#fff;--vac-core-fg:#252525;}.vacpuck.theme-dark{--vac-core-bg:#252525;--vac-core-fg:#fff;}.vacpuck.jump{transition:none;}.vacpuck.stale{opacity:0.45;animation:none;}.vacpuck ha-icon{--mdc-icon-size:calc(var(--puck-size) * 0.68);color:var(--vac-core-fg);display:flex;align-items:center;justify-content:center;line-height:0;width:var(--mdc-icon-size);height:var(--mdc-icon-size);}@keyframes vacpulse{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--hp-accent) 45%,transparent);}70%{box-shadow:0 0 0 12px transparent;}100%{box-shadow:0 0 0 0 transparent;}}@media (prefers-reduced-motion:reduce){.vacpuck{animation:none;}}.vactrail{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:5;overflow:visible;}.vactrail polyline,.vactrail path{fill:none;stroke-linejoin:round;stroke-linecap:round;vector-effect:non-scaling-stroke;}.vactrail g.prev{opacity:0.4;}.vactrail .case{stroke:rgba(0,0,0,0.4);stroke-width:2.25;}.vactrail .core{stroke:rgba(255,255,255,0.82);stroke-width:0.9;}.devicepreview-empty{min-height:82px;margin:4px 0 14px;padding:var(--sp-4);display:flex;align-items:center;justify-content:center;gap:var(--sp-3);border:1px dashed var(--hp-line);border-radius:var(--rad-m);color:var(--hp-muted);text-align:center;}`,o`.hdr{position:sticky;top:var(--header-height,56px);z-index:20;background:var(--card-background-color,var(--hp-bg));border-radius:var(--ha-card-border-radius,12px) var(--ha-card-border-radius,12px) 0 0;}.tabs{display:flex;gap:var(--sp-2);background:rgba(127,127,127,0.12);padding:var(--sp-2);border-radius:var(--rad-l);flex-wrap:wrap;}.tab{border:0;background:transparent;color:var(--hp-muted);display:inline-flex;align-items:center;padding:var(--sp-3) var(--sp-5);border-radius:var(--rad-m);font-size:var(--fs-m);font-weight:600;cursor:pointer;transition:0.15s;font-family:inherit;}:host([data-pointer-hover]) .tab:hover{color:var(--hp-txt);}.tab.active{background:var(--hp-accent);color:var(--text-primary-color,#fff);}.farhint{position:absolute;left:50%;transform:translateX(-50%);bottom:var(--sp-4);z-index:12;display:flex;align-items:center;gap:var(--sp-2);max-width:calc(100% - var(--sp-8));background:var(--card-background-color,var(--hp-bg));opacity:0.94;color:var(--hp-txt);border:1px solid var(--divider-color,#33404d);border-radius:var(--rad-m);padding:var(--sp-1) var(--sp-3);font-size:var(--fs-s);}.farhint ha-icon{--mdc-icon-size:18px;color:var(--hp-warn,#e2a03f);flex:none;}.farhint span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.dropbtn{display:flex;align-items:center;gap:var(--sp-4);width:100%;text-align:left;border:1px solid var(--hp-muted);border-radius:var(--rad-m);background:transparent;color:var(--hp-txt);padding:var(--sp-4) 10px;cursor:pointer;font-family:inherit;font-size:var(--fs-m);margin-top:var(--sp-3);}.dropbtn .ref{color:var(--hp-muted);font-size:var(--fs-s);margin-left:auto;}.dropbtn ha-icon{--mdc-icon-size:18px;margin-left:var(--sp-2);}.dropbtn.open{border-color:var(--hp-accent);}.droppanel{border:1px solid var(--hp-accent);border-top:none;border-radius:0 0 var(--rad-m) var(--rad-m);padding:var(--sp-3);margin-top:-4px;}.hdr.kioskhide{display:none;}.decorbar .dcolor{width:30px;height:26px;padding:0;border:none;background:none;cursor:pointer;}.decorbar .dwidth{font-family:inherit;font-size:var(--fs-s);border-radius:var(--rad-s);background:var(--hp-bg2,transparent);color:var(--hp-txt);border:1px solid var(--hp-muted);padding:var(--sp-2) var(--sp-3);}.decorbar .bdhint{font-size:var(--fs-s);color:var(--hp-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.decorbar .dfill{display:inline-flex;align-items:center;gap:var(--sp-2);font-size:var(--fs-s);cursor:pointer;}.decorbar .dfill input[type="checkbox"]{width:16px;height:16px;flex:none;margin:0;padding:0;}.decorbar hp-color-opacity{flex:0 0 auto;}.modes{display:inline-flex;gap:var(--sp-1);background:rgba(127,127,127,0.12);border-radius:var(--rad-l);padding:var(--sp-2);}.modetab{display:inline-flex;align-items:center;gap:var(--sp-3);border:0;background:transparent;color:var(--hp-muted);padding:var(--sp-3) 10px;border-radius:var(--rad-m);font-size:var(--fs-m);font-weight:600;cursor:pointer;font-family:inherit;transition:background-color 0.14s ease,color 0.14s ease,transform 0.14s ease;}.modetab:active{transform:scale(0.97);}.modetab ha-icon{--mdc-icon-size:15px;}.tab[data-reorderable]{cursor:grab;}.tab.dragging{cursor:grabbing;opacity:0.55;}.tab.drop-before{box-shadow:inset 2px 0 0 0 var(--primary-color,#03a9f4);}.tab.drop-after{box-shadow:inset -2px 0 0 0 var(--primary-color,#03a9f4);}.modetab .closex{--mdc-icon-size:13px;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;min-width:24px;min-height:24px;margin:-5.5px -5.5px -5.5px -3.5px;opacity:0.75;cursor:pointer;border-radius:var(--rad-s);}:host([data-pointer-hover]) .modetab .closex:hover{opacity:1;}.editbar .barclose{box-sizing:border-box;width:40px;height:40px;padding:0;margin:0;min-width:40px;min-height:40px;justify-content:center;gap:0;line-height:0;}.editbar .barclose ha-icon{flex:none;margin:0;}.modetab.active{background:var(--hp-accent);color:var(--text-primary-color,#fff);}@media (max-width:720px){.modetab .ml{display:none;}}.editbar{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:stretch;border-bottom:1px solid var(--hp-line);font-size:var(--fs-m);}.editbar-tools{display:flex;align-items:center;gap:10px;padding:var(--sp-4) var(--sp-5);flex-wrap:wrap;min-width:0;outline:none;}.editbar-end{display:flex;align-items:center;padding:var(--sp-4) var(--sp-5);border-inline-start:1px solid var(--hp-line);background:var(--card-background-color,var(--hp-bg));position:relative;z-index:2;}.tab .tabedit{--mdc-icon-size:13px;display:inline-flex;align-items:center;margin-left:var(--sp-3);opacity:0.4;}:host([data-pointer-hover]) .tab:hover .tabedit{opacity:0.9;}.tab.tabadd{padding:var(--sp-3) var(--sp-4);}.tab.tabadd ha-icon{--mdc-icon-size:15px;}.rhint{font-size:var(--fs-s);color:var(--hp-muted);margin-bottom:var(--sp-3);}.togglehint{overflow-wrap:anywhere;}.togglehint>div + div{margin-top:var(--sp-1);}.editorchrome{display:block;height:0;opacity:0;visibility:hidden;overflow:hidden;}.editorchrome:not(.open){pointer-events:none;}.editorchrome.open{height:auto;opacity:1;visibility:visible;overflow:visible;}.editorchrome.transitioning{overflow:hidden;will-change:height;pointer-events:none;}.editorchrome.transitioning .barclose{pointer-events:auto;}.editorchrome-inner{min-height:0;transform-origin:top center;}.editorchrome.transitioning .editorchrome-inner{will-change:opacity;}@media (prefers-reduced-motion:reduce){.modetab{transition:none;}}.editbar .warn{color:#ffc14d;}.editbar .sname{font-weight:600;}.editbar input{width:74px;background:transparent;border:1px solid var(--hp-line);color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-m);}.editbar label,.editbar .hint{color:var(--hp-muted);font-size:var(--fs-s);}.editbar .drawwall{display:inline-flex;align-items:center;gap:var(--sp-3);white-space:nowrap;}.editbar .wallsgroup{display:inline-flex;align-items:center;gap:10px;white-space:nowrap;}.editbar .drawwall input{width:4.2em;}.editbar .drawwall .opl{color:var(--hp-muted);font-size:var(--fs-s);}.menuwrap{position:fixed;inset:0;z-index:80;}.menu{position:fixed;background:var(--hp-bg);border:1px solid var(--hp-accent);border-radius:var(--rad-l);box-shadow:var(--shadow-2);min-width:210px;max-width:300px;overflow:hidden;transform:translate(0,8px);}.menu .hd{padding:var(--sp-4) var(--sp-5);font-weight:600;font-size:var(--fs-m);border-bottom:1px solid var(--hp-line);display:flex;align-items:center;gap:var(--sp-3);}.menu .hd ha-icon,.menu .it.all ha-icon{color:var(--hp-accent);--mdc-icon-size:16px;}.menu .it{padding:var(--sp-4) var(--sp-5);font-size:var(--fs-m);cursor:pointer;display:flex;align-items:center;gap:var(--sp-4);}.menu .it ha-icon{--mdc-icon-size:16px;color:var(--hp-muted);}:host([data-pointer-hover]) .menu .it:hover{background:rgba(127,127,127,0.15);}.menu .it.all{color:var(--hp-accent);font-weight:600;}.tip{position:fixed;pointer-events:none;background:var(--hp-bg);border:1px solid var(--hp-accent);color:var(--hp-txt);padding:var(--sp-3) 10px;border-radius:var(--rad-m);font-size:var(--fs-m);box-shadow:var(--shadow-2);z-index:60;max-width:260px;}.tip .m{color:var(--hp-muted);font-size:var(--fs-s);display:block;}`,o`.head{display:flex;align-items:center;gap:10px;padding:10px var(--sp-5);border-bottom:1px solid var(--hp-line);flex-wrap:wrap;}.title{font-size:var(--fs-l);font-weight:600;display:flex;align-items:center;gap:var(--sp-3);white-space:nowrap;}.title ha-icon{color:var(--hp-accent);--mdc-icon-size:18px;}@media (max-width:1100px){.head .count{display:none;}}@media (max-width:620px){.head{gap:var(--sp-3);padding:var(--sp-4) 10px;}.head .title{font-size:var(--fs-m);}}.count{font-size:var(--fs-s);color:var(--hp-muted);}.btn{display:inline-flex;align-items:center;gap:var(--sp-3);border:1px solid var(--hp-line);background:transparent;color:var(--hp-txt);padding:var(--sp-3) 10px;border-radius:var(--rad-m);cursor:pointer;transition:0.15s;font-family:inherit;font-size:var(--fs-m);}.btn ha-icon{--mdc-icon-size:17px;}:host([data-pointer-hover]) .btn:hover{border-color:var(--hp-accent);}.btn.on{background:var(--hp-accent);color:var(--text-primary-color,#fff);border-color:var(--hp-accent);}.btn.ghost{border:none;}.btn[disabled]{opacity:0.5;pointer-events:none;}.sunrow{display:flex;align-items:center;gap:var(--sp-5);margin:var(--sp-3) 0;}.suncol{flex:1;display:flex;flex-direction:column;gap:var(--sp-3);min-width:0;}.recoveryoverlay{position:absolute;inset:0;z-index:75;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--sp-4);padding:var(--sp-6);box-sizing:border-box;background:linear-gradient(var(--ha-card-background,var(--card-background-color,#111)),var(--ha-card-background,var(--card-background-color,#111))),#111;color:var(--primary-text-color,#fff);text-align:center;pointer-events:auto;transition:opacity 0.15s ease;}.recoveryoverlay.phase-entering,.recoveryoverlay.phase-leaving{opacity:0;}.recoveryoverlay.phase-fading-in,.recoveryoverlay.phase-opaque{opacity:1;}.recoveryoverlay ha-icon{--mdc-icon-size:44px;color:var(--hp-accent);}.editorloading{position:absolute;z-index:74;left:50%;top:50%;display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-3) var(--sp-5);border:1px solid color-mix(in srgb,var(--hp-accent) 45%,transparent);border-radius:999px;background:color-mix(in srgb,var(--ha-card-background,var(--card-background-color,#111)) 92%,transparent);color:var(--primary-text-color);box-shadow:0 6px 22px rgb(0 0 0 / 18%);transform:translate(-50%,-50%);pointer-events:none;animation:editor-loading-in 0.15s ease both;}.editorloading ha-icon{--mdc-icon-size:22px;color:var(--hp-accent);animation:editor-loading-spin 0.9s linear infinite;}@keyframes editor-loading-in{from{opacity:0;transform:translate(-50%,calc(-50% + 4px));}to{opacity:1;transform:translate(-50%,-50%);}}@keyframes editor-loading-spin{to{transform:rotate(360deg);}}@media (prefers-reduced-motion:reduce){.recoveryoverlay,.editorloading,.editorloading ha-icon{transition:none;animation:none;}}.oplock{--oplock-size:calc(var(--icon-size,2.5cqw) * 0.62);--oplock-core-size:calc(var(--oplock-size) / 1.26875);--oplock-stroke-ratio:0.01875;--oplock-stroke-width:max(1px,calc(var(--oplock-core-size) * var(--oplock-stroke-ratio)));--oplock-core-bg:light-dark(#fff,#252525);--oplock-core-fg:light-dark(#252525,#fff);--oplock-shell-stroke:light-dark(#BCBCBC,rgb(37 37 37 / 75%));--oplock-shell-shadow:0 calc(var(--oplock-core-size) * .025) calc(var(--oplock-core-size) * .05) rgb(37 40 45 / 12%),0 calc(var(--oplock-core-size) * .1) calc(var(--oplock-core-size) * .175) calc(var(--oplock-core-size) * -.025) rgb(37 40 45 / 18%);--oplock-core-shadow:0 0 0 0 transparent;pointer-events:none;position:absolute;transform:translate(-50%,-50%);width:var(--oplock-size);height:var(--oplock-size);display:grid;place-items:center;border:0;background:transparent;z-index:1;}.oplock.theme-light{--oplock-core-bg:#fff;--oplock-core-fg:#252525;--oplock-shell-stroke:#BCBCBC;}.oplock.theme-dark{--oplock-core-bg:#252525;--oplock-core-fg:#fff;--oplock-shell-stroke:rgb(37 37 37 / 75%);--oplock-core-shadow:inset 0 calc(var(--oplock-core-size) * .0125) calc(var(--oplock-core-size) * .0125) rgb(255 255 255 / 70%);}.oplock-shell{box-sizing:border-box;width:100%;height:100%;border:var(--oplock-stroke-width) solid var(--oplock-shell-stroke);border-radius:50%;background:transparent;box-shadow:var(--oplock-shell-shadow);display:grid;place-items:center;pointer-events:none;backdrop-filter:none;}.oplock-core{width:var(--oplock-core-size);height:var(--oplock-core-size);border-radius:50%;background:var(--oplock-core-bg);color:var(--oplock-core-fg);box-shadow:var(--oplock-core-shadow);display:grid;place-items:center;pointer-events:none;}.oplock ha-icon{--mdc-icon-size:calc(var(--oplock-core-size) * 0.55);display:flex;line-height:0;}.oplock.locked{--oplock-core-bg:#66D17A;--oplock-core-fg:light-dark(#fff,#252525);--oplock-shell-stroke:#66D17A;}.oplock.theme-light.locked{--oplock-core-fg:#fff;}.oplock.theme-dark.locked{--oplock-core-fg:#252525;--oplock-stroke-ratio:.025;}.oplock.unlocked{--oplock-core-bg:#F0410C;--oplock-core-fg:light-dark(#fff,#252525);--oplock-shell-stroke:#F0410C;}.oplock.theme-light.unlocked{--oplock-core-fg:#fff;}.oplock.theme-dark.unlocked{--oplock-core-fg:#252525;--oplock-stroke-ratio:.025;}.oplock.unknown{--oplock-core-fg:var(--hp-muted);}.btn.lockact{width:100%;justify-content:center;display:flex;align-items:center;gap:var(--sp-3);margin-top:var(--sp-4);}.btn.lockact.warn{color:var(--error-color,#d33);border-color:var(--error-color,#d33);}.oprow{display:flex;align-items:center;gap:var(--sp-4);padding:var(--sp-3) 0;}.oprow b{margin-left:auto;}.oprow.ok b{color:#66d17a;}.oprow.warn b{color:var(--hp-open);}.bindharow{display:flex;align-items:center;gap:var(--sp-5);flex-wrap:wrap;}.bindharow .entcheck{opacity:0.9;}.ctrlchips{display:flex;flex-wrap:wrap;gap:var(--sp-3);margin:var(--sp-2) 0;}.ctrlchip{display:inline-flex;align-items:center;gap:var(--sp-2);background:var(--hp-accent);color:var(--text-primary-color,#fff);border-radius:var(--rad-l);padding:var(--sp-2) var(--sp-4);font-size:var(--fs-s);}.ctrlchip ha-icon{--mdc-icon-size:14px;cursor:pointer;}.ctrllist{display:flex;flex-direction:column;gap:var(--sp-1);margin-top:var(--sp-2);}.ctrlopt{display:flex;align-items:center;gap:var(--sp-4);text-align:left;border:0;background:transparent;color:var(--hp-txt);padding:var(--sp-3) var(--sp-4);border-radius:var(--rad-s);cursor:pointer;font-family:inherit;font-size:var(--fs-m);}:host([data-pointer-hover]) .ctrlopt:hover{background:var(--secondary-background-color,rgba(128,128,128,0.15));}.ctrlopt .sub{color:var(--hp-muted);font-size:var(--fs-s);margin-left:auto;}.ctrlopt ha-icon{--mdc-icon-size:16px;}.ctrlstates{display:flex;flex-direction:column;gap:var(--sp-2);}.ctrlstate{display:inline-flex;align-items:center;gap:var(--sp-3);color:var(--hp-muted);}.ctrlstate.on{color:var(--hp-txt);}.ctrlstate ha-icon{--mdc-icon-size:15px;}.cardpreview{display:flex;flex-direction:column;align-items:center;gap:var(--sp-2);margin:var(--sp-4) 0 var(--sp-1);padding:10px;border:1px dashed var(--hp-muted);border-radius:var(--rad-m);}.cardpreview .cpname{font-weight:700;letter-spacing:0.04em;}.cardpreview .cpmeta{display:inline-flex;align-items:center;gap:0.3em;font-weight:600;opacity:0.85;}.cardpreview .cpmeta ha-icon{--mdc-icon-size:1.05em;}.iconauto{display:flex;align-items:center;gap:var(--sp-3);font-size:var(--fs-s);margin:var(--sp-2) 0 0;}.iconauto ha-icon{--mdc-icon-size:18px;}.iconauto span{flex:1;}.iconauto .btn{min-height:32px;padding:0 var(--sp-3);}hp-dialog .dfill{display:inline-flex;align-items:center;gap:var(--sp-3);cursor:pointer;}.wallthick-dlg{position:absolute;z-index:40;min-width:200px;transform:translate(-50%,8px);padding:10px 12px;border-radius:10px;background:var(--card-background-color,#fff);box-shadow:0 8px 28px rgba(0,0,0,.22);display:flex;flex-direction:column;gap:8px;pointer-events:auto;}.wallthick-dlg .row{display:flex;align-items:center;gap:8px;}.wallthick-dlg input[type="number"]{width:5.5em;padding:4px 6px;border:1px solid var(--divider-color,#ccc);border-radius:6px;background:var(--input-fill,transparent);color:var(--primary-text-color);}.areasel,.namein{background:var(--hp-bg);border:1px solid var(--hp-line);color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-m);font-family:inherit;}.namein{width:130px;}.habindingbanner{display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-3) var(--sp-4);margin-bottom:var(--sp-4);border:1px solid var(--warning-color,#ff9800);border-radius:var(--rad-m);background:color-mix(in srgb,var(--warning-color,#ff9800) 12%,transparent);color:var(--primary-text-color,#f1f3f6);}.habindingbanner>span{flex:1;min-width:0;}.habindingbanner>ha-icon{color:var(--warning-color,#ff9800);flex:0 0 auto;}.habindingbanner.limited{border-color:var(--secondary-text-color,#9aa0aa);background:color-mix(in srgb,var(--secondary-text-color,#9aa0aa) 10%,transparent);}.habindingbanner.limited>ha-icon{color:var(--secondary-text-color,#9aa0aa);}.srcrow{display:flex;align-items:center;gap:var(--sp-4);font-size:var(--fs-m);cursor:pointer;padding:var(--sp-1) 0;}.dispsection{margin-top:var(--sp-5) !important;padding-top:var(--sp-4);border-top:1px solid var(--hp-line);font-weight:600;color:var(--hp-txt) !important;}.colorrow{display:flex;align-items:center;gap:var(--sp-4);}.roomtemprange{display:grid;gap:8px;min-width:0;}.roomtemprange-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px;}.roomtemprange-fields{display:flex;flex-wrap:wrap;align-items:center;gap:8px;min-width:0;}.roomtemprange-fields input{flex:0 1 104px;min-width:72px;}.roomtemprange-fields input[aria-invalid='true']{border-color:var(--error-color,#db4437);}.gsrow>hp-color-opacity{min-width:min(100%,210px);justify-content:space-between;}.ripple-colorrow>hp-color-opacity{width:100%;justify-content:space-between;}.ripple-sizerow>.opl{min-width:0;}.colorrow input[type='range']{flex:1;}.colorrow .tempin{width:70px;flex:none;}hp-dialog .body .temprange .tempin{width:56px;flex:none;padding:var(--sp-2) var(--sp-3);}hp-dialog .body .colorrow .tempin{width:72px;flex:none;}.srcrow{flex-wrap:nowrap;}.srcrow ha-switch{flex:none;}.colorrow ha-slider{flex:1;min-width:0;}.srcrow>span:first-of-type{white-space:nowrap;}.colorrow .opl{color:var(--hp-muted);font-size:var(--fs-s);}.colorrow .opv{font-size:var(--fs-s);min-width:34px;text-align:right;}.markerlightgroup{min-width:0;margin:var(--sp-5) 0 0;padding:var(--sp-4);border:1px solid var(--hp-line);border-radius:var(--rad-m);}.markerlightgroup legend{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-1);padding:0 var(--sp-2);color:var(--hp-txt);font-weight:600;}.markerlightgroup legend>span{min-width:0;overflow-wrap:anywhere;}.markerlightgroup[disabled]>:not(legend){opacity:.62;}.radargroup{display:grid;gap:var(--sp-2);}.radargroup>p{margin:0;}.radargroup>label:not(.srcrow){margin-top:var(--sp-2);}.radarcoordinates{align-items:flex-end;flex-wrap:wrap;}.radarcoordinates>label{display:grid;flex:1 1 92px;gap:var(--sp-1);min-width:0;margin:0;}hp-dialog .body .radarcoordinates .tempin{box-sizing:border-box;width:100%;}.radaradditional{margin-top:var(--sp-5);}.radaradditional summary{cursor:pointer;font-weight:600;}.radaradditional .btn{margin-top:var(--sp-3);}.radarinspection{display:grid;gap:6px;padding:10px 12px;border-radius:10px;background:color-mix(in srgb,var(--primary-color) 7%,transparent);}.radarinspection code{overflow-wrap:anywhere;font-size:12px;}.radarsetup{display:grid;gap:10px;margin-top:10px;padding:12px;border:1px solid var(--hp-accent);border-radius:var(--rad-m);background:color-mix(in srgb,var(--secondary-background-color) 88%,transparent);}.radarsetup-head{display:flex;align-items:center;gap:8px;}.radarsetup-head strong{flex:1;}.radarsetup>svg{width:min(100%,460px);aspect-ratio:1;justify-self:center;border-radius:var(--rad-m);background:var(--primary-background-color);touch-action:none;cursor:crosshair;}.radarsetup .room{fill:color-mix(in srgb,var(--hp-accent) 8%,transparent);stroke:var(--divider-color);stroke-width:3;vector-effect:non-scaling-stroke;}.radarsetup .heading{stroke:var(--hp-accent);stroke-width:4;vector-effect:non-scaling-stroke;}.radarsetup .trail{fill:none;stroke:var(--success-color,#43a047);stroke-width:3;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;opacity:.55;}.radarsetup g circle{fill:var(--hp-bg);stroke:var(--hp-accent);stroke-width:3;vector-effect:non-scaling-stroke;}.radarsetup g.pending circle{stroke-dasharray:5 4;}.radarsetup g text{fill:var(--hp-txt);font-size:22px;font-weight:700;text-anchor:middle;dominant-baseline:middle;pointer-events:none;}.markerhelpfield{margin-top:var(--sp-4);}.markerhelplabel{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-1);margin-bottom:var(--sp-1);}.markerhelplabel>label{min-width:0;overflow-wrap:anywhere;}.helpfieldlabel{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-1);min-width:0;margin-top:var(--sp-3);color:var(--hp-muted);font-size:var(--fs-s);}.helpfieldlabel.compact{margin-top:0;}hp-dialog .body .helpfieldlabel>label{min-width:0;margin-top:0;overflow-wrap:anywhere;}.help-inline-label{display:inline-flex;align-items:center;flex-wrap:wrap;gap:var(--sp-1);}hp-dialog .body .help-inline-label>label{min-width:0;margin-top:0;overflow-wrap:anywhere;}.markerradios{display:grid;gap:var(--sp-1);min-width:0;}.markerlightgroup .srcrow>span:first-of-type{min-width:0;white-space:normal;overflow-wrap:anywhere;}.markerglowvalue{margin:var(--sp-3) 0;flex-wrap:wrap;}.markerglowvalue hp-color-opacity{flex:none;}.markerlightdisabled{display:flex;align-items:center;gap:var(--sp-2);margin-top:var(--sp-2) !important;}.markerlightdisabled ha-icon{--mdc-icon-size:18px;flex:none;}.markerbadgetechnical{min-width:0;margin:var(--sp-1) 0 var(--sp-2) !important;overflow-wrap:anywhere;}.markerbadgetechnical code{white-space:normal;}.planrow{display:flex;align-items:center;gap:10px;}.savedplans{display:flex;flex-direction:column;gap:var(--sp-3);max-height:240px;overflow:auto;margin:var(--sp-3) 0 var(--sp-1);padding:var(--sp-3);border:1px solid var(--hp-line);border-radius:var(--rad-m);background:var(--hp-bg2,rgba(255,255,255,0.03));flex:0 0 auto;min-height:2.6em;}.savedplan{display:flex;align-items:center;gap:10px;}.savedplan.cur{outline:1px solid var(--hp-accent);border-radius:var(--rad-s);}.savedplan img{width:56px;height:40px;object-fit:contain;border:1px solid var(--hp-line);border-radius:var(--rad-s);background:#fff;flex:none;}.savedmeta{display:flex;flex-direction:column;min-width:0;flex:1;}.savedmeta b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.savedmeta .muted{font-size:var(--fs-s);}.savedplan .btn.danger ha-icon{color:#f25a4a;}.savedplan .btn[disabled]{opacity:0.4;pointer-events:none;}.planprev{max-width:120px;max-height:70px;border:1px solid var(--hp-line);border-radius:var(--rad-s);background:#fff;}.planname{font-size:var(--fs-m);max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.planname.muted{color:var(--hp-muted);}.filebtn{cursor:pointer;}.fileupload{display:inline-flex;min-width:0;}.fileupload>input{display:none;}.btn.danger{border-color:#b3402a;color:#ff7a5c;}hp-dialog .row .spacer{flex:1;}hp-dialog .body{max-height:66vh;overflow-y:auto;}hp-confirm{display:contents;}hp-dialog .danger-confirm-body{display:flex;flex-direction:column;gap:var(--sp-4);}hp-dialog .danger-confirm-body p{margin:0;line-height:1.45;}hp-dialog .danger-confirm-object{overflow-wrap:anywhere;font-size:var(--fs-l);line-height:1.3;}.descin{width:100%;box-sizing:border-box;background:var(--hp-bg);border:1px solid var(--hp-line);color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-m);font-family:inherit;resize:vertical;min-height:92px;flex-shrink:0;line-height:1.35;}.bindsel{display:flex;flex-direction:column;gap:var(--sp-3);border:1px solid var(--hp-line);border-radius:var(--rad-m);padding:var(--sp-4);}.bindsel .opt{display:flex;align-items:center;gap:var(--sp-3);border:1px solid var(--hp-line);background:transparent;color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);cursor:pointer;font-size:var(--fs-m);font-family:inherit;}.bindsel .opt.on{background:var(--hp-accent);color:var(--text-primary-color,#fff);border-color:var(--hp-accent);}.curbind{display:flex;align-items:center;gap:var(--sp-3);font-size:var(--fs-m);color:var(--hp-txt);flex-wrap:wrap;}.curbind .ref{color:var(--hp-muted);font-size:var(--fs-s);}.vacbox .vacbtns{display:flex;gap:var(--sp-4);margin:var(--sp-3) 0;flex-wrap:wrap;}.vacdiag{display:grid;gap:4px;margin-bottom:var(--sp-3);}.vacdiag>div{display:flex;justify-content:space-between;gap:var(--sp-5);}.vacdiag>div>span{color:var(--secondary-text-color);}.vacdiag>div>b{text-align:right;overflow-wrap:anywhere;}.vacroute-missing-group{margin-top:var(--sp-4);padding-top:var(--sp-4);border-top:1px solid var(--hp-line);}.vacroute-group-title{margin:0 0 var(--sp-3);color:var(--secondary-text-color);font-size:var(--fs-m);font-weight:600;}.vacroute-missing-group .vacroute-list{margin-top:0;}.vacpicker{margin:var(--sp-3) 0;}.vacsource-warning{display:grid;gap:8px;}.vacsource-warning .btn{justify-self:start;}.vacpicker>summary{display:inline-flex;width:auto;list-style:none;cursor:pointer;}.vacpicker>summary::-webkit-details-marker{display:none;}.vacsource-list{display:grid;gap:6px;margin-top:8px;}.vacsource-list details{padding:6px 0 0;}.vacsource-list details>summary{cursor:pointer;font-weight:600;}.vacsource{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-width:0;padding:9px 10px;border:1px solid var(--divider-color);border-radius:10px;color:var(--primary-text-color);background:var(--secondary-background-color);text-align:left;cursor:pointer;}.vacsource.on{border-color:var(--accent-color);box-shadow:inset 3px 0 var(--accent-color);}.vacsource>span:first-child{min-width:0;display:grid;gap:2px;}.vacsource small{color:var(--secondary-text-color);overflow-wrap:anywhere;}.vacsource-meta{color:var(--secondary-text-color);text-align:right;font-size:0.82em;}.vacxcme pre{margin:8px 0 0;white-space:pre-wrap;user-select:text;}.vacfit{position:absolute;inset:0;width:100%;height:100%;z-index:12;overflow:visible;touch-action:none;cursor:grab;pointer-events:auto;}.vacfit:active{cursor:grabbing;}.vacfit polygon{fill:color-mix(in srgb,var(--hp-accent) 16%,transparent);stroke:var(--hp-accent);stroke-width:2;vector-effect:non-scaling-stroke;stroke-dasharray:6 4;}.vacfit text{fill:var(--hp-accent);font-size:26px;text-anchor:middle;dominant-baseline:middle;pointer-events:none;user-select:none;}.furnpalette{display:flex;flex-direction:column;max-height:38vh;border-top:1px solid var(--hp-border,rgba(255,255,255,0.12));background:var(--card-background-color,var(--hp-bg));font-size:0.85em;}.furnhd{display:flex;align-items:center;gap:6px;padding:4px 8px;font-weight:600;opacity:0.9;}.furnhd .spacer{flex:1;}.furnbody{overflow:auto;padding:0 8px 6px;}.furngroup{margin:6px 0 3px;font-size:0.85em;text-transform:uppercase;letter-spacing:0.04em;opacity:0.6;}.furnrow{display:flex;flex-wrap:wrap;gap:4px;}.furnback{min-height:34px;gap:5px;margin:2px 0 4px;}.furnitem{display:flex;flex-direction:column;align-items:center;gap:2px;width:74px;padding:4px 2px;border:1px solid transparent;border-radius:8px;background:rgba(127,127,127,0.08);color:inherit;font:inherit;font-size:0.8em;line-height:1.15;text-align:center;cursor:pointer;}:host([data-pointer-hover]) .furnitem:hover{background:rgba(127,127,127,0.18);}.furnitem.on{border-color:var(--hp-accent);background:rgba(38,166,154,0.18);}.furnprev{width:40px;height:40px;color:var(--primary-text-color,currentColor);}.furncategory{width:92px;min-height:76px;}.furncatprev{width:48px;height:48px;}.furnvariants .furnitem{min-height:74px;}.furnsize{display:flex;align-items:center;flex-wrap:wrap;gap:6px;padding:6px 8px;border-top:1px solid var(--hp-border,rgba(255,255,255,0.12));}.furnsize label{display:flex;align-items:baseline;gap:3px;opacity:0.8;}.furnsize .furnunit{opacity:0.6;font-size:0.85em;}.furnsize input{width:5.5em;padding:3px 5px;}.furnhint{opacity:0.6;}.imageupload{display:inline-flex;gap:6px;margin:4px 0 8px;cursor:pointer;}.imageupload.disabled{opacity:0.55;pointer-events:none;}.imageupload input{display:none;}.imageassets{align-items:stretch;}.imageempty{padding:12px 6px;}.imageasset{position:relative;}.imageasset .furnitem{width:104px;min-height:92px;}.imageasset img{width:64px;height:54px;object-fit:contain;border-radius:4px;background:repeating-conic-gradient(#ddd 0 25%,#fff 0 50%) 50% / 12px 12px;}.imageasset .furnitem span{max-width:96px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.imageasset .furnitem small{opacity:0.65;font-size:0.72em;}.imageassetdelete{position:absolute;top:0;right:0;min-width:30px;width:30px;min-height:30px;padding:3px;}.imagepropertypreview{display:flex;align-items:center;gap:10px;min-width:0;}.imagepropertypreview img{width:72px;height:54px;object-fit:contain;border-radius:4px;background:repeating-conic-gradient(#ddd 0 25%,#fff 0 50%) 50% / 12px 12px;}.imagepropertypreview span{overflow-wrap:anywhere;}.vacfitdot{fill:var(--hp-accent);pointer-events:none;}.vacfithandle{fill:transparent;stroke:none;cursor:nwse-resize;}.vacfitknob{fill:var(--hp-bg);stroke:var(--hp-accent);stroke-width:2;vector-effect:non-scaling-stroke;pointer-events:none;}.vaccalbar{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);display:flex;gap:var(--sp-5);align-items:center;background:var(--hp-bg);color:var(--hp-txt);border:1px solid var(--hp-accent);border-radius:var(--rad-l);padding:10px var(--sp-5);z-index:60;box-shadow:var(--shadow-2);}.candlist{max-height:160px;overflow-y:auto;border-top:1px solid var(--hp-line);flex:0 0 auto;min-height:2.6em;}.cand{display:flex;justify-content:space-between;gap:var(--sp-4);padding:var(--sp-3) var(--sp-4);cursor:pointer;border-radius:var(--rad-s);font-size:var(--fs-m);}:host([data-pointer-hover]) .cand:hover{background:rgba(127,127,127,0.15);}.cand.sel{background:var(--hp-accent);color:var(--text-primary-color,#fff);}.cand .cs{color:var(--hp-muted);font-size:var(--fs-s);white-space:nowrap;}.opening-entity-candidate{width:100%;border:0;background:transparent;color:inherit;font:inherit;text-align:left;}.opening-entity-candidate.sel{background:var(--hp-accent);color:var(--text-primary-color,#fff);}.opening-entity-empty{cursor:default;}.cand.sel .cs{color:var(--text-primary-color,#fff);opacity:0.85;}.cand.muted{color:var(--hp-muted);cursor:default;}.pdfedit{display:flex;flex-wrap:wrap;gap:var(--sp-3);align-items:center;}.pdftag{display:inline-flex;align-items:center;gap:var(--sp-2);border:1px solid var(--hp-line);border-radius:var(--rad-s);padding:var(--sp-2) var(--sp-3);font-size:var(--fs-s);}.pdftag a{color:var(--hp-txt);text-decoration:none;max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.pdftag .x{--mdc-icon-size:15px;cursor:pointer;color:var(--hp-muted);}:host([data-pointer-hover]) .pdftag .x:hover{color:#ff7a5c;}.entlist{display:flex;flex-direction:column;gap:var(--sp-2);margin-bottom:10px;}.entrow{display:flex;align-items:center;gap:var(--sp-4);padding:var(--sp-3) var(--sp-4);border-radius:var(--rad-m);background:var(--secondary-background-color,rgba(128,128,128,0.12));}.entrow ha-icon{--mdc-icon-size:20px;color:var(--hp-muted);}.entrow.on ha-icon{color:var(--hp-accent);}.entrow .en{flex:1;font-size:var(--fs-m);}.entrow .ev{font-size:var(--fs-m);color:var(--hp-muted);}.entbtn{min-width:74px;min-height:32px;padding:var(--sp-2) var(--sp-5);border:1px solid var(--hp-muted);border-radius:999px;background:transparent;color:var(--hp-txt);font:inherit;font-size:var(--fs-m);cursor:pointer;}.entbtn.on{background:var(--hp-accent);border-color:var(--hp-accent);color:var(--text-primary-color,#fff);font-weight:600;}.inforow{display:flex;gap:10px;font-size:var(--fs-m);margin:var(--sp-2) 0;}.inforow .k{color:var(--hp-muted);min-width:84px;}.inforow a{color:var(--hp-accent);word-break:break-all;}.infodesc{font-size:var(--fs-m);white-space:pre-wrap;margin-top:var(--sp-3);}.infodesc.muted{color:var(--hp-muted);}.pdflist{display:flex;flex-direction:column;gap:var(--sp-2);}.pdf{display:inline-flex;align-items:center;gap:var(--sp-2);color:var(--hp-accent);text-decoration:none;}ha-icon-picker{display:block;}.floorrow{display:flex;align-items:center;gap:var(--sp-4);padding:var(--sp-3) var(--sp-2);font-size:var(--fs-m);cursor:pointer;}.floorrow .floorlvl{color:var(--hp-muted);font-size:var(--fs-s);border:1px solid var(--hp-line);border-radius:var(--rad-s);padding:0 var(--sp-3);}.rtest{display:flex;align-items:center;gap:var(--sp-4);margin-bottom:var(--sp-4);}.rtest .namein{flex:1;}.rtest ha-icon{color:var(--hp-accent);}.rtesticon{font-size:var(--fs-s);color:var(--hp-muted);}.rrow{display:flex;align-items:center;gap:var(--sp-3);margin:var(--sp-1) 0;}.rrow .rpat{flex:2;}.rrow .ricon{flex:1.4;}.rrow .rpat.bad{border-color:#ff7a5c;}.rrow .rprev{--mdc-icon-size:18px;color:var(--hp-txt);min-width:18px;}.rrow .ract{--mdc-icon-size:16px;color:var(--hp-muted);cursor:pointer;}:host([data-pointer-hover]) .rrow .ract:hover{color:var(--hp-txt);}:host([data-pointer-hover]) .rrow .ract.del:hover{color:#ff7a5c;}.gsrow .gsl{min-width:150px;font-size:var(--fs-m);color:var(--hp-muted);}.optimize-live{display:grid;justify-items:start;gap:var(--sp-2);margin-bottom:var(--sp-3);}.optimize-live .alignmsg,.optimize-live .rhint{margin-bottom:0;}.optimize-cleanup{min-height:44px;}.optimize-selected{color:var(--hp-txt);}.optimize-details{margin-top:var(--sp-3);color:var(--hp-muted);font-size:var(--fs-s);overflow-wrap:anywhere;}.optimize-details>summary{width:fit-content;color:var(--hp-txt);cursor:pointer;font-weight:600;}.optimize-details>summary:focus-visible{outline:2px solid var(--hp-accent);outline-offset:3px;border-radius:var(--rad-s);}.optimize-details ul{margin:var(--sp-3) 0;padding-inline-start:22px;}.optimize-details li + li{margin-top:var(--sp-1);}.btn.alignall{width:100%;justify-content:center;}.backupactions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--sp-3);}.backupactions .btn{justify-content:center;min-width:0;}.backupupload{display:inline-flex;min-width:0;}.backupupload>.btn{width:100%;justify-content:center;}.backupupload input{display:none;}.backupbody{min-width:0;}.backupplanonly{margin-inline-start:var(--sp-4) !important;align-items:flex-start !important;}.backupplanonly>span:first-of-type{display:grid;gap:2px;white-space:normal;}.backupplanonly small{color:var(--secondary-text-color);line-height:1.35;}.backupplanonlystatus{color:var(--hp-accent) !important;font-weight:700;}.backupfile,.backupsummary,.backupcontent{display:flex;flex-direction:column;min-width:0;gap:var(--sp-1);}.backupfile b,.backupcontent span{overflow-wrap:anywhere;}.backupfile span,.backupsummary span,.backupcontent span{color:var(--hp-muted);font-size:var(--fs-s);}.backupcounts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--sp-2) var(--sp-4);font-size:var(--fs-s);}.backupwarn,.backuperror{border-radius:var(--rad-s);padding:var(--sp-3);font-size:var(--fs-s);line-height:1.45;overflow-wrap:anywhere;}.backupwarn{background:color-mix(in srgb,var(--hp-accent) 12%,transparent);}.backuperror{background:rgba(179,64,42,.16);color:#ff7a5c;}.backupdetails{border:1px solid var(--hp-line);border-radius:var(--rad-s);padding:var(--sp-2) var(--sp-3);font-size:var(--fs-s);}.backupdetails summary{cursor:pointer;font-weight:700;}.backupdetails>div{display:grid;gap:var(--sp-1);padding-block-start:var(--sp-2);}.backupdetails code{overflow-wrap:anywhere;color:var(--hp-muted);}.backupchoices{display:flex;flex-direction:column;gap:var(--sp-2);border:1px solid var(--hp-line);border-radius:var(--rad-s);min-width:0;}.backupchoices label{margin:0 !important;display:flex;gap:var(--sp-2);}.backupconfirm{align-items:flex-start !important;}.backupconfirm>span:first-of-type{min-width:0;white-space:normal;overflow-wrap:anywhere;}@media (max-width:520px){.backupactions,.backupcounts{grid-template-columns:1fr;}}.aboutver{font-size:var(--fs-s);color:var(--hp-muted);margin:var(--sp-2) 0 var(--sp-3);}.aboutlink{display:flex;align-items:center;gap:var(--sp-3);width:fit-content;color:var(--hp-accent);text-decoration:none;font-size:var(--fs-m);padding:var(--sp-1) 0;}:host([data-pointer-hover]) .aboutlink:hover{text-decoration:underline;}.aboutlink ha-icon{--mdc-icon-size:18px;line-height:1;}hp-dialog .supportbody{min-width:0;overflow-x:hidden;gap:var(--sp-5);}.supportsection{display:grid;min-width:0;gap:var(--sp-2);}.supportsection + .supportsection{padding-top:var(--sp-4);border-top:1px solid var(--hp-line);}.supportsection h3{margin:0;color:var(--hp-txt);font-size:var(--fs-m);}.supportlinks,.supportactions{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-2) var(--sp-4);min-width:0;}.supportform>label:not(.srcrow){margin-top:var(--sp-2);color:var(--hp-muted);font-size:var(--fs-s);}.supportmessage,.supportraw{width:100%;min-width:0;box-sizing:border-box;resize:vertical;border:1px solid var(--hp-line);border-radius:var(--rad-s);padding:var(--sp-3);color:var(--hp-txt);background:color-mix(in srgb,var(--card-background-color,var(--hp-bg)) 92%,var(--hp-txt));font:inherit;}.supportmessage{min-height:120px;background:var(--hp-bg);}.supportraw{min-height:220px;margin-top:var(--sp-2);resize:none;white-space:pre;overflow:auto;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;}.supportattach{min-width:0;align-items:flex-start;margin:var(--sp-2) 0 0 !important;}.supportattach>span:first-of-type{min-width:0;white-space:normal;overflow-wrap:anywhere;}.supportwarning,.supportstatus,.supportupdate{display:flex;align-items:flex-start;gap:var(--sp-2);min-width:0;margin:0;padding:var(--sp-3);border-radius:var(--rad-s);background:color-mix(in srgb,var(--hp-accent) 14%,transparent);overflow-wrap:anywhere;font-size:var(--fs-s);line-height:1.45;}.supportwarning ha-icon,.supportstatus ha-icon,.supportupdate ha-icon{flex:none;color:var(--hp-accent);--mdc-icon-size:20px;}.supportpreview,.supportmanual,.supporterror,.supportsuccess{display:grid;min-width:0;gap:var(--sp-2);padding:var(--sp-3);border:1px solid var(--hp-line);border-radius:var(--rad-s);}.supportsummary{font-weight:600;overflow-wrap:anywhere;}.supporthash{display:grid;min-width:0;gap:var(--sp-1);color:var(--hp-muted);font-size:var(--fs-s);}.supporthash code{overflow-wrap:anywhere;color:var(--hp-txt);}.supportpreview details{min-width:0;}.supportpreview summary{cursor:pointer;color:var(--hp-accent);}.supportprivacy{margin:0 !important;line-height:1.45;}.supporterror{background:color-mix(in srgb,var(--error-color,#db4437) 12%,transparent);border-color:color-mix(in srgb,var(--error-color,#db4437) 45%,var(--hp-line));}.supportsuccess{background:color-mix(in srgb,var(--success-color,#43a047) 12%,transparent);border-color:color-mix(in srgb,var(--success-color,#43a047) 45%,var(--hp-line));}.supportfooter{flex-wrap:wrap;}@media (max-width:520px){hp-dialog .supportbody{padding-inline:var(--sp-4);}hp-dialog .supportfooter{padding-inline:var(--sp-4);}.supportactions .btn,.supportactions .aboutlink{max-width:100%;}}hp-dialog .body{padding:var(--sp-5) var(--sp-6);display:flex;flex-direction:column;gap:var(--sp-3);}hp-dialog .tapconfirm-body{min-width:0;overflow-x:hidden;}hp-dialog .tapconfirm-body p{max-width:100%;min-width:0;margin:0;overflow-wrap:anywhere;white-space:normal;}hp-dialog .tapconfirm-line{color:var(--hp-muted);}hp-dialog .body label{font-size:var(--fs-s);color:var(--hp-muted);margin-top:var(--sp-3);}hp-dialog .body .namein,hp-dialog .body .areasel{width:100%;box-sizing:border-box;}hp-dialog.roomdialog .body{min-width:0;overflow-x:hidden;}hp-dialog.roomdialog .body>*{min-width:0;max-width:100%;box-sizing:border-box;}hp-dialog.roomdialog .srcrow{min-width:0;align-items:flex-start;}hp-dialog.roomdialog .srcrow>span:first-of-type{min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.35;}hp-dialog.roomdialog .dropbtn>b,hp-dialog.roomdialog .dropbtn>.ref{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}hp-dialog .row{display:flex;justify-content:flex-end;gap:var(--sp-4);width:100%;min-width:0;box-sizing:border-box;padding:var(--sp-5) var(--sp-6);border-top:1px solid var(--hp-line);}hp-dialog>.row[slot='footer'] button{min-height:44px;}hp-dialog .row.dialog-action-footer{align-items:center;justify-content:flex-start;flex-wrap:wrap;row-gap:var(--sp-4);}hp-dialog .dialog-action-group{display:flex;flex:0 1 auto;flex-wrap:wrap;align-items:center;gap:var(--sp-4);max-width:100%;min-width:0;}hp-dialog .dialog-action-group .btn{flex:0 0 auto;min-height:44px;}hp-dialog .dialog-action-danger{margin-right:auto;}hp-dialog .dialog-action-commit{margin-left:auto;justify-content:flex-end;}hp-dialog .row.markerfooter{justify-content:space-between;align-items:center;flex-wrap:wrap;}hp-dialog .row.roomfooter{align-items:center;flex-wrap:wrap;}hp-dialog .row.infofooter{align-items:center;justify-content:flex-start;flex-wrap:wrap;gap:var(--sp-3);}hp-dialog .row.infofooter .btn{flex-shrink:0;}hp-dialog .row.infofooter .infofooter-close{margin-left:auto;}@media (max-width:480px){hp-dialog .row.infofooter{padding:var(--sp-4) var(--sp-5);}}.markeractions,.markersaveactions{display:flex;align-items:center;gap:var(--sp-4);}.markeractions:empty{display:none;}.markersaveactions{margin-left:auto;}.device-inbox{display:flex;flex-direction:column;gap:var(--sp-4);padding:var(--sp-5) var(--sp-6);min-width:0;}.device-inbox-dialog{--hp-dialog-wide-width:920px;}.device-inbox-head{display:grid;grid-template-columns:minmax(180px,1fr) auto;align-items:center;gap:var(--sp-4);}.device-inbox-search{width:100%;min-width:0;box-sizing:border-box;border:1px solid var(--hp-line);border-radius:var(--rad-m);background:transparent;color:var(--hp-txt);font:inherit;padding:11px 14px;}.device-inbox-tabs{display:flex;gap:var(--sp-2);overflow-x:auto;scrollbar-width:thin;padding-bottom:var(--sp-1);}.device-inbox-tabs button{flex:0 0 auto;border:1px solid var(--hp-line);border-radius:999px;background:transparent;color:var(--hp-txt);font:inherit;padding:8px 12px;cursor:pointer;}.device-inbox-tabs button.on{border-color:var(--hp-accent);background:color-mix(in srgb,var(--hp-accent) 18%,transparent);}.device-inbox-tabs button span{color:var(--hp-muted);margin-inline-start:4px;}.device-inbox-discovery{margin:8px 0;padding:8px 10px;border:1px solid var(--divider-color,#e0e0e0);border-radius:8px;}.device-inbox-discovery summary{cursor:pointer;font-weight:600;}.device-inbox-discovery .srcrow{display:flex;gap:6px;align-items:center;margin:8px 0;}.device-inbox-excluded{display:flex;flex-wrap:wrap;gap:6px;align-items:center;}.device-inbox-excluded>span{font-weight:500;}.device-inbox-chips{display:flex;flex-wrap:wrap;gap:4px;}.device-inbox-chips .chip{display:inline-flex;align-items:center;gap:2px;padding:1px 6px;border-radius:10px;background:var(--secondary-background-color,#f0f0f0);font-size:12px;}.device-inbox-chips .chip button{border:none;background:none;cursor:pointer;padding:0 2px;color:var(--secondary-text-color,#666);}.device-inbox-excluded input[type="text"]{flex:1 1 140px;min-width:120px;padding:4px 6px;border:1px solid var(--divider-color,#e0e0e0);border-radius:6px;background:var(--card-background-color,#fff);color:var(--primary-text-color,#212121);}.device-inbox-preview{margin:8px 0 4px;font-size:13px;opacity:0.85;}.device-inbox-filters{display:flex;flex-wrap:wrap;gap:var(--sp-4) var(--sp-6);color:var(--hp-muted);}.device-inbox-filters label{display:inline-flex;align-items:center;gap:var(--sp-2);cursor:pointer;}.device-inbox-filter-help{display:inline-flex;align-items:center;gap:var(--sp-1);min-width:0;}.device-inbox-results{display:grid;gap:var(--sp-3);min-width:0;}.device-inbox-row{display:grid;grid-template-columns:42px minmax(180px,1fr) minmax(180px,auto);align-items:center;gap:var(--sp-4);min-width:0;border:1px solid var(--hp-line);border-radius:var(--rad-m);padding:var(--sp-4);background:color-mix(in srgb,var(--hp-txt) 3%,transparent);}.device-inbox-icon{--mdc-icon-size:28px;color:var(--hp-txt);justify-self:center;}.device-inbox-copy{min-width:0;}.device-inbox-name{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-2);}.device-inbox-new{border-radius:999px;background:var(--hp-accent);color:var(--text-primary-color,#fff);font-size:var(--fs-s);padding:2px 7px;}.device-inbox-meta,.device-inbox-reason,.device-inbox-copy code{display:block;color:var(--hp-muted);font-size:var(--fs-s);overflow-wrap:anywhere;white-space:normal;}.device-inbox-status{color:var(--error-color,#db4437);margin-inline-start:var(--sp-2);}.device-inbox-actions{display:flex;justify-content:flex-end;align-items:center;flex-wrap:wrap;gap:var(--sp-2);}.device-inbox-actions .btn{min-height:36px;padding:7px 10px;}.device-inbox-menu{position:relative;}.device-inbox-menu summary{list-style:none;cursor:pointer;}.device-inbox-menu summary::-webkit-details-marker{display:none;}.device-inbox-menu-items{position:absolute;z-index:2;inset-inline-end:0;top:calc(100% + var(--sp-1));display:grid;gap:var(--sp-1);min-width:180px;padding:var(--sp-2);border:1px solid var(--hp-line);border-radius:var(--rad-m);background:var(--hp-panel,var(--card-background-color,#fff));box-shadow:0 8px 24px rgba(0,0,0,.22);}.device-inbox-menu-items .btn{justify-content:flex-start;width:100%;}.device-inbox-empty{color:var(--hp-muted);text-align:center;padding:var(--sp-8);}.device-inbox-more{align-self:center;}@media (max-width:680px){.device-inbox{padding:var(--sp-4);}.device-inbox-head{grid-template-columns:minmax(0,1fr);}.device-inbox-head .btn{justify-self:stretch;}.device-inbox-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));overflow-x:visible;}.device-inbox-tabs button{min-width:0;overflow-wrap:anywhere;}.device-inbox-row{grid-template-columns:36px minmax(0,1fr);}.device-inbox-actions{grid-column:1 / -1;justify-content:flex-start;}}`];var sp={"editor.context_actions":"Actions: {object}","editor.tool_options":"Tool options: {tool}","editor.palette":"Palette: {tool}","editor.open_group":"Tool group: {group}","editor.group_active":"{group} — active: {item}","editor.disabled_action":"{action} is unavailable: {reason}","editor.loading":"Loading editor…","editor.loading_aria":"The plan editor is loading","editor.load_failed":"Could not load the editor.","editor.refresh_advice":"Refresh the page and try again.","editor.retry_advice":"Check your connection and press again.","version_mismatch.title":"House Plan versions do not match","version_mismatch.body":"If Home Assistant is still restarting, let it finish, then reload this page.","version_mismatch.frontend":"Card","version_mismatch.backend":"Integration","version_mismatch.reload":"Reload page","color_picker.title":"Color picker","color_picker.hue":"Hue","color_picker.saturation":"Saturation","color_picker.value":"Brightness","color_picker.hex":"Hex color","color_picker.invalid_hex":"Enter a 3- or 6-digit hex color","color_picker.confirm":"OK","btn.properties":"Properties","btn.keep_as_walls":"Keep as walls","btn.delete_room_keep_walls":"Delete room, keep walls","btn.delete_room_with_walls":"Delete room and walls","title.markup_select":"Select and edit walls and columns","title.markup_column":"Column: click a grid point to place a square column","markup.partition":"Partition","markup.column":"Column","markup.hint_column":"click a grid point to place a square column","history.wall_segment":"Add wall segment","history.column_add":"Add column","history.physical_edit":"Change physical object","history.physical_delete":"Delete physical object","history.physical_move":"Move physical object","history.wall_face_batch":"Create rooms from walls","toast.column_duplicate":"A column with the same centre and outer size already exists","physical.partition_properties":"Partition properties","physical.column_properties":"Column properties","physical.shape":"Shape","physical.square":"Square","physical.circle":"Circle","physical.diameter":"Diameter","physical.side":"Side","physical.rotation":"Rotation angle","physical.length":"Length","physical.allowed_range":"Allowed: {min}–{max} {unit}","physical.column_size_title":"Outer side of the square column placed by the click (1–150 cm).","card.title":"House plan","count.devices":"{n} dev.","empty.no_spaces":"No spaces yet.","nav.spaces":"House Plan spaces","empty.add_first":"Add the first space and upload a floor plan.","empty.read_only":"No spaces are configured. Ask an administrator to add one.","empty.install":'Install the House Plan integration and add it in "Devices & services".',"btn.add_space":"Add space","btn.cancel":"Cancel","btn.save":"Save","btn.close":"Close","btn.delete":"Delete","btn.copy":"Copy","btn.edit":"Edit","btn.open_in_ha":"Open in HA","btn.reset":"Reset","btn.attach":"Attach…","btn.upload":"Upload…","btn.replace":"Replace…","title.zoom_in":"Zoom in","title.zoom_out":"Zoom out","title.zoom_fit":"Fit all","title.configure_space":"Configure space","title.add_space":"Add space","title.markup_add":"Walls: draw a continuous chain; each accepted segment is saved independently. Shift locks to 45°","title.markup_merge":"Merge: click one room, then the neighbour it shares a wall with","title.markup_split":"Split a room: click the room, then two points on its walls","title.markup_delroom":"Delete room: click inside a room and confirm","title.need_plan":"Upload a floor-plan image","markup.add":"Walls","markup.merge":"Merge","markup.split":"Split","markup.resize":"Resize","title.markup_resize":"Resize rooms: drag an available horizontal or vertical wall handle","markup.hint_resize":"drag an available wall handle · the wall stops at the first unsafe position · Esc cancels · Ctrl+Z — undo","resize.disabled.diagonal":"This wall is angled; Resize supports only horizontal and vertical walls","resize.disabled.side-angle":"An adjoining wall is angled; Resize requires both adjoining walls to meet this wall at right angles","resize.disabled.duplicate-physical-wall":"A separate partition or column overlaps this wall; remove or move it before resizing","resize.disabled.partial-shared":"A neighbouring room uses only part of this wall, so it cannot be moved safely as one shared wall","resize.disabled.unequal-shared":"The neighbouring room uses different endpoints or wall length, so the walls cannot move together safely","resize.disabled.multiple-rooms":"Moving this wall would affect more than two rooms","resize.disabled.thickness-conflict":"The wall thickness cannot be preserved safely","resize.disabled.opening-conflict":"An opening on this wall cannot be moved safely","resize.disabled.invalid-geometry":"This wall cannot be resized without changing the plan structure","resize.limit_stopped":"Wall stopped: the next step would break a junction limit","resize.commit_failed":"Resize was cancelled because the final plan did not pass the geometry check","resize.preview_failed":"Resize stopped at the last safe position because the plan geometry could not be preserved","markup.opening":"Opening","markup.delete_room":"Delete room","history.undo":"Undo","history.redo":"Redo","history.undo_named":"Undo: {name} (Ctrl+Z)","history.redo_named":"Redo: {name} (Ctrl+Shift+Z / Ctrl+Y)","history.undo_empty":"Nothing to undo","history.redo_empty":"Nothing to redo","history.undone":"Undone: {name}","history.redone":"Redone: {name}","history.add_room":"Create room","history.split_room":"Split room","history.merge_rooms":"Merge rooms","history.resize_room":"Resize room","history.wall_thickness":"Change wall thickness","history.add_opening":"Add door or window opening","history.edit_opening":"Edit opening","history.move_opening":"Move opening","history.delete_opening":"Delete opening","history.delete_room_keep_walls":"Delete room, keep walls","history.delete_room_with_walls":"Delete room and walls","history.decor_add":"Add decor object","history.decor_edit":"Edit decor object","history.decor_move":"Move decor object","history.decor_transform":"Transform decor object","history.decor_delete":"Delete decor object","history.backdrop_transform":"Transform plan backdrop","history.device_move":"Move {name}","history.device_stale":"Device position history is no longer applicable and was cleared","opening.new":"New opening","opening.edit":"Opening","opening.door":"Door","opening.window":"Window","opening.gate":"Gate","opening.passage":"Open passage","opening.passage_binding_warning":"Saving will remove the open/close sensor and lock.","opening.invalid_passage_fields":"The open passage on plan “{room}” has unsupported settings: {fields}.","opening.type_label":"Type","opening.length_label":"Length, cm","opening.contact_label":"Open/close sensor","opening.lock_label":"Lock","opening.none":"— none —","opening.search_ph":"Search: name or entity id…","opening.invert":"Invert open/closed","opening.flip_h":"Hinge on the other jamb","opening.flip_v":"Opens to the other side","opening.open":"Open","opening.closed":"Closed","opening.locked":"Locked","opening.unlocked":"Unlocked","opening.state_unknown":"unavailable","opening.no_entities":"No sensors bound — a static symbol on the plan.","toast.opening_no_wall":"Click next to a room wall or independent wall","opening.host_partition":"Independent wall","opening.partition_orphan":"The independent wall for this opening no longer exists","opening.partition_jamb_margin":"Leave at least {distance} between the opening and the end of the wall","opening.rebind_partition":"Attach to another independent wall","confirm.delete_partition_openings_title":"Delete wall and openings?","confirm.delete_partition_openings_body":"This wall contains {count} opening(s). They will be deleted together.","confirm.delete_partition_openings_item":"• {type}, {length}","markup.hint_points":"points: {n} · Shift — 45° steps · Esc — finish chain · Ctrl+Z — undo a point · closing an area offers a room","markup.hint_start":"click a grid dot to start a wall chain","tip.lqi":"average zigbee signal:","tip.area":"area: {value}","info.device_header":"Device on the plan","info.model":"Model","info.state":"State","info.link":"Link","info.manuals":"Manuals","info.none":"No additional information","marker.new_device":"New device","marker.name_label":"Name (shown on the plan)","marker.name_ph":"Name","marker.binding_label":"Bind to an HA device","marker.binding_disabled":"disabled in Home Assistant","marker.virtual_option":"Virtual device (no binding)","marker.search_ph":"Search device / group…","marker.nothing_found":"nothing found","marker.room_label":"Room","marker.room_override":" (override placement)","marker.room_choose":"— select a room —","marker.room_auto":"— by device area (auto) —","marker.icon_label":"Icon","marker.icon_ph":"mdi:… (empty = auto)","marker.display_label":"Display","display.badge":"Icon + state","display.icon_ripple":"Icon + state and activity","display.static_icon":"Always static icon","marker.display_hint_badge":"The icon and dynamic plate show device state without the ordinary activity pulse. Red alarms remain visible.","marker.display_hint_icon_ripple":"The icon, dynamic plate and pulse show a short pulse for events and a continuous pulse for work, motion or presence. Red alarms have separate priority.","marker.display_hint_value":"A selected or automatically resolved Home Assistant value replaces the icon while the plate continues to show state. Red alarms remain visible.","marker.display_hint_static_icon":"The theme-aware shell and icon always stay the same. State, activity, unavailability and alarms do not change the face.","marker.static_alarm_warning":"This device can report alarms. Static display hides the marker's visual alarm indication.","marker.preview.title":"Display preview","marker.preview.actual":"Now","marker.preview.example":"Example","marker.preview.integration":"Provided by","marker.preview.source":"Display source","marker.preview.current_state":"Current state","marker.preview.result":"On the plan","marker.preview.details":"Source details","marker.preview.select_source":"Choose a Home Assistant device or entity to see its actual display.","marker.preview.unknown_provider":"Unknown integration","marker.preview.virtual_provider":"House Plan · virtual device","marker.preview.no_source":"No active source","marker.preview.no_state":"No current state","marker.preview.mixed_states":"Several different states","marker.preview.multiple_sources":"{n} sources","marker.preview.more_sources":"+{n} more","marker.preview.scaled":"The preview is scaled to {n}% to fit. The saved size is unchanged.","marker.preview.demo_short":"Show short activity","marker.preview.demo_continuous":"Show continuous activity","marker.preview.stop_continuous":"Stop continuous activity","marker.preview.demo_short_notice":"Short activity example; the actual device state is unchanged.","marker.preview.demo_continuous_notice":"Continuous activity example; the actual device state is unchanged.","marker.preview.demo_already_visible":"The current state already shows a real activity or alarm effect.","marker.preview.reduced_motion":"System reduced-motion is enabled, so ordinary activity is shown as a dot.","marker.preview.reason.neutral":"Neutral dark plate","marker.preview.reason.working":"Yellow plate: the device is working now","marker.preview.reason.working_activity":"Yellow plate and activity effect: the device is working now","marker.preview.reason.open":"Orange plate: physically open or unlocked","marker.preview.reason.cover_icon_state":"Neutral plate; the cover entity controls the displayed state and icon","marker.preview.reason.presence":"Activity effect while presence is detected","marker.preview.reason.event":"Short activity effect after a detected event","marker.preview.reason.transition":"Activity effect while the device is moving or changing state","marker.preview.reason.media_neutral":"Media devices stay on a neutral dark plate while available","marker.preview.reason.unavailable":"Subdued neutral plate: unavailable or off","marker.preview.reason.alarm":"Red alarm plate; alarm indication is always shown","marker.preview.reason.live_states_disabled":"Live-state styling is disabled for this card","marker.preview.reason.value_no_state":"No usable state value; the icon is shown instead","marker.preview.reason.value_ambiguous_sources":"Several possible value sources; the icon is shown instead","marker.preview.reason.value_non_scalar":"The source did not return a simple value; the icon is shown instead","marker.preview.reason.value_virtual":"A virtual device has no Home Assistant value; the icon is shown instead","marker.preview.reason.vacuum_live_plan_only":"Live vacuum position and trail are available only on the full plan","marker.preview.reason.hidden_design_preview":"The device is hidden on the plan; this design preview remains visible","marker.preview.reason.composite_power_source":"State comes from the device Power entity; auxiliary switches are ignored","marker.preview.reason.activity_display_disabled":"The selected display mode does not show ordinary activity effects","marker.preview.reason.ha_disabled":"The Home Assistant binding is disabled and will be hidden on the plan","marker.preview.reason.orphaned":"The saved Home Assistant binding can no longer be found","marker.preview.reason.static_icon":"Static mode: device state does not change the icon","marker.activity_color":"Activity pulse color","marker.ripple_size":"Activity pulse size","marker.activity_alarm_note":"Color and size affect ordinary activity only and do not change red alarms.","marker.pulse_a11y_alarm":"Alarm","marker.pulse_a11y_event":"Recent event","marker.pulse_a11y_presence":"Presence detected","marker.pulse_a11y_transition":"Changing state","marker.pulse_a11y_running":"Working","marker.state_a11y_neutral":"Default state","marker.state_a11y_working":"Working","marker.state_a11y_open":"Open","marker.state_a11y_locked":"Locked","marker.state_a11y_unlocked":"Unlocked","marker.state_a11y_alarm":"Alarm","marker.state_a11y_unavailable":"Unavailable","marker.lqi_a11y_low":"LQI {value}, low signal","marker.lqi_a11y_mid":"LQI {value}, medium signal","marker.lqi_a11y_high":"LQI {value}, high signal","marker.size_label":"Icon size / rotation","marker.angle_label":"Rotate","marker.model_label":"Model","marker.model_ph":"e.g. Aqara T&H","marker.link_label":"Link","marker.desc_label":"Description","marker.desc_ph":"Notes, specs…","marker.manuals_label":"Manuals (PDF etc.)","marker.sub_device":"device","marker.sub_z2m_group":" · Z2M group","marker.sub_group":"group","marker.sub_helper":"helper","space.new":"New space","space.copy_title":"Copy space","space.copy_name":"New space name","space.copy_fallback":"Space","space.copy_create":"Create copy","space.copy_optimize_title":"Optimize before copying?","space.copy_optimize_body":"Before creating “{name}”, House Plan must optimize the entire plan, including other spaces. Continue?","space.copy_optimize_confirm":"Optimize and copy","space.copy_error_changed":"The plan changed while confirmation was open. Review it and try again.","space.copy_error_source_missing":"The source space no longer exists. Reopen its settings and try again.","space.copy_error_source_invalid":"House Plan could not validate every wall in this space. Fix the source space and try again.","space.copy_error_spaces_limit":"House Plan already has the maximum number of spaces.","space.copy_error_partitions_limit":"This space has too many walls to copy.","space.copy_error_openings_limit":"This space has too many openings to copy.","space.copy_error_decor_limit":"This space has too many background objects to copy.","space.copy_error_columns_limit":"This space has too many columns to copy.","space.copy_error_opening_host":"One of the openings is no longer attached to a wall. Fix or delete it before copying.","space.copy_error_geometry":"The copy would create unsafe wall geometry. Fix the source space and try again.","space.copy_error_optimize_geometry":"Copy stopped because optimizing the entire plan is unsafe for one of the spaces.","space.header":"Space","space.title_label":"Title","space.title_ph":"e.g. Garage","space.plan_label":"Floor plan (background)","space.no_plan":"no plan image","space.plan_alt":"plan","room.new":"New room","room.name_label":"Display name","room.name_ph":"e.g. Terrace","room.area_label":"Home Assistant area (unassigned)","room.no_area_option":"— no area —","room.default_name":"Room","device.unnamed":"unnamed","device.light_group":"light group","device.fallback":"device","device.virtual":"virtual device","confirm.delete_room_title":'Delete room "{name}"?',"confirm.delete_room_body":"Choose whether the room's exclusive physical walls should remain. Walls shared with another room are always kept.","confirm.remove_marker_title":"Delete device from the plan?","confirm.remove_marker_body":"The device will disappear completely and stop contributing to plan data. You can add it again later.","confirm.erase_decor":"Erase the {kind} object? You can undo this action from the editor history.","confirm.delete_space_title":"Delete space?","confirm.delete_space_body":"The space, all its rooms and all its plan markup will be deleted.","confirm.delete_space_vac_routes":"Robot map assignments will also be removed: {count}.","space.delete_blocked":"This space is still used by {n} device(s). Move them to another space or delete them first.","toast.pos_save_failed":"Failed to save position: {err}","toast.no_entity":"The device has no suitable entity","toast.ha_disabled_action":"A Home Assistant object that is disabled cannot be used on the plan.","toast.ha_disabled_show_device":"A device disabled in Home Assistant cannot be shown on the plan. Enable it in Home Assistant first.","toast.ha_disabled_show_entity":"An entity disabled in Home Assistant cannot be shown on the plan. Enable it in Home Assistant first.","toast.ha_disabled_add":"A disabled Home Assistant object cannot be added to the plan. Enable it in Home Assistant first.","toast.ha_binding_unverified":"The object status could not be verified through the Home Assistant registry. Display and actions are temporarily unavailable.","toast.markup_needs_server":"Markup is available after the config is moved to the server","toast.space_order_changed":"Order changed. If any card pins its floor by number, check those panels.","toast.conflict":"Config was changed in another window — data refreshed, repeat your last action","toast.cfg_save_failed":"Failed to save config: {err}","toast.room_overlap":"The outline overlaps room “{name}” — rooms must not overlap","toast.contour_cannot_close":"The outline cannot close because it is degenerate or intersects itself","toast.merge_not_adjacent":"Only rooms that share a wall can be merged","toast.rooms_merged":"Rooms merged into “{name}”","toast.split_pick_wall":"Start the cut on the room’s wall","toast.split_bad_cut":"The cut must run wall to wall inside the room, without crossing walls or itself","merge.header":"Merge rooms","merge.hint":"The merged room keeps one name and one area. The other area is released — its devices leave the plan until another room claims it.","merge.keep":"Keep","merge.no_area":"no area","toast.room_saved":"Room saved ({n}). Devices added: {added}. Outline the next one or exit markup.","toast.room_saved_no_area":"Room saved ({n}, no area). Outline the next one or exit markup.","toast.marker_needs_server":"Device editing is available after the config is moved to the server","toast.virtual_name_required":"Enter a name for the virtual device","toast.marker_saved":"Device saved","toast.marker_removed":"Device deleted from the plan","toast.integration_missing":"The House Plan integration is not installed — management unavailable","toast.plan_formats":"Supported formats: SVG, PNG, JPG, WebP","toast.plan_required":"Upload a floor plan — it is required","toast.space_added_onboard":"Space added. Outline the rooms: click grid dots and close the contour.","toast.space_added":"Space added","toast.space_copied":"Space “{name}” created","toast.space_saved":"Space saved","toast.space_deleted":"Space deleted","toast.delete_failed":"Delete failed: {err}","toast.error":"Error: {err}","toast.toggle_target_unavailable":"Target “{name}” is unavailable — no action was performed","toast.toggle_targets_unavailable":"Targets are unavailable: {names}. No action was performed","toast.file_failed":'File "{name}" was not uploaded: {err}',"toast.files_attached":"Files attached: {n}","err.unknown":"unknown error","err.code":"code {code}","err.too_large":"file larger than {mb} MB","err.bad_ext":"unsupported type (PDF/image expected)","err.unauthorized":"administrator rights required","editor.title":"Title","editor.default_floor":"Initial space","editor.default_floor_missing":"Initial space “{id}” no longer exists. Choose another space.","editor.floor":"Fixed space","editor.floor_none":"— not fixed —","editor.floor_index":"YAML index {index} (preserved)","fixed_floor.loading":"Loading the fixed space…","fixed_floor.invalid_title":"The fixed space is unavailable","fixed_floor.invalid_body":"Check floor in the card configuration. The configured value is: {value}","editor.icon_size":"Icon size, % of plan width","editor.show_temperature":"Show temperature","editor.live_states":"Live states (on/off, open…)","editor.light_pools":"Light pools and wall shadows","editor.show_signal":"Show zigbee signal (LQI)","editor.language":"Interface language","editor.lang_auto":"Auto (HA profile)","title.icon_rules":"Icon rules: which MDI icon devices get by name","rules.title":"Icon rules","rules.hint":"Rules are checked top-down against “device name + model” (case-insensitive regex); the first match wins. When nothing matches, the entity device class decides, then the generic chip icon.","rules.pattern_ph":"regex, e.g. plug|socket","rules.icon_ph":"mdi:power-socket-de","rules.add":"Add rule","rules.reset":"Reset to defaults","rules.test_ph":"Try a device name…","rules.invalid":"invalid regex","rules.saved":"Icon rules saved","btn.up":"Up","btn.down":"Down","tap.info":"Device card","tap.more_info":"HA more-info dialog","tap.toggle":"Toggle state","marker.tap_label":"Tap action for this device","tap.toggle_note":"The resolved state is shown below. Secure devices are never toggled from the plan.","import.title":"Create spaces from HA floors","import.hint":"Your Home Assistant already knows these floors. Pick the ones to turn into plan spaces — you will upload a floor-plan image for each one next. Rooms are then outlined by hand on the plan.","import.start":"Create {n} space(s)","import.manual":"Start from scratch","import.progress":"Floor {i} of {n}","import.done":"Spaces created. Outline the rooms: click grid dots and close the contour.","btn.skip":"Skip","space.scale_label":"Scale (grid cell size)","space.cell_cm.help":"Links the grid to real dimensions: lengths, areas, wall thickness, opening sizes and glow radius depend on it. Changing it after drawing changes the calculated dimensions of the whole space without moving its points on the plan.","space.cell_cm.help.aria":"Help: space scale","space.scale_unit":"cm per cell","space.scale_unit_imperial":"in per cell","space.display_section":"Display","space.show_borders":"Always show room borders","space.zero_wall_style":"Zero-thickness walls","space.zero_wall_style.help":"Dashed zero-thickness walls pass Glow and sun rays, while solid ones block them as zero-area barriers. The choice affects every such wall in the space even when its line is hidden in View.","space.zero_wall_style.help.aria":"Help: zero-thickness wall style","space.zero_wall_dashed":"Dashed","space.zero_wall_solid":"Solid","space.show_names":"Show room names (drag to move)","space.room_color":"Border & name color","space.opacity":"Opacity","space.fill_label":"Room fill","space.fill_mode.help":"“Custom colour” is styling, while “Light”, “Temperature” and “LQI” use current Home Assistant data; Glow is enabled separately.","space.fill_mode.help.aria":"Help: room fill mode","fill.none":"None","fill.lqi":"Zigbee signal","fill.light":"Lights","fill.custom":"Custom color","space.custom_fill":"Fill color","space.source_file":"I have a floor-plan image","space.source_draw":"No image — I'll outline rooms by hand","fill.temp":"Temperature","tip.temp_avg":"average temperature:","tip.hum_avg":"average humidity:","space_card.button":"Open the space plan","space_card.not_found":"Space “{id}” not found","space_card.loading":"Loading…","continuity.restore_plan":"Restoring floor plan…","continuity.restore_connection":"Restoring device connection…","continuity.retry":"Try again","editor.space":"Space","editor.framing":"Framing","editor.fit_content":"All visible content","editor.fit_house":"Tight to house geometry","editor.show_button":"Show button","editor.button_label":"Button label","editor.button_target":"Target dashboard path","marker.sub_entity":"entity","title.general_settings":"General settings","title.export_pdf":"Save as PDF","pdf.title":"Save as PDF","pdf.dimensions":"Show dimensions and areas","pdf.decor":"Show furniture and other decor","pdf.room_names":"Show room names","pdf.backdrop":"Show backdrop","pdf.save":"Save","pdf.saving":"Creating…","pdf.failed":"Could not create the PDF.","pdf.too_large":"The images exceed the 25 MB PDF limit.","pdf.asset_failed":"A backdrop or decor image could not be loaded.","pdf.scale":"Scale 1:{n}","pdf.north":"North","gs.title":"General settings","gs.light_group":"Fill: lights","gs.light_on":"Lights on","gs.light_off":"All lights off","gs.temp_group":"Fill: temperature","gs.temp_cold":"Cold","gs.temp_ok":"Comfortable","gs.temp_hot":"Hot","gs.lqi_group":"Fill: zigbee signal","gs.lqi_low":"Weak signal","gs.lqi_high":"Strong signal","gs.reset":"Reset to defaults","gs.saved":"General settings saved","gs.radar_show_live":"Show live presence on the plan","gs.radar_show_live_hint":"Hides or shows all live radar targets. This does not start or stop observation recording.","radar.title":"Presence on the plan","radar.help":"Connect this marker to exact Home Assistant radar entities, place the sensor and choose its coordinate profile. Live positions are clipped to the selected room.","radar.help.aria":"Help: presence radar settings","radar.enabled":"Use this presence radar","radar.show_live":"Show live targets","radar.configure":"Configure radar","radar.configure_on_plan":"Configure on plan","radar.change_installation":"Change installation","radar.no_contour":"This room has no boundary. Radar points will not be clipped.","radar.discard_setup_title":"Discard radar setup?","radar.discard_setup":"The unsaved radar setup will be lost.","radar.step_place_mount":"Mark the physical sensor position","radar.step_place_heading":"Mark a point straight ahead of the sensor","radar.step_reference":"Mark reference position {n}, then start measurement","radar.step_check_reference":"Mark an independent check position","radar.start_measure":"Start measurement","radar.countdown":"Stand at the mark in {seconds} s","radar.capturing":"Stand still and alone while measuring…","radar.fit_ready":"Calibration is ready","radar.check_third":"Check at another position","radar.check_complete":"Independent check completed","radar.error_distance":"Position difference: {distance}","radar.ambiguous_target":"More than one target was reported. Repeat the measurement alone.","radar.insufficient_samples":"Not enough current coordinates. Retry or use manual setup.","radar.bad_references":"Choose separated references in different directions from the sensor.","radar.ambiguous_sources":"The measurements allow two equally plausible directions. Choose reference points that distinguish left from right.","radar.bad_fit":"Measurements do not match. Check units, mounting point and references.","radar.desktop_hint":"Use a computer for precise setup. Editing on touch devices is best effort.","radar.detected":"House Plan recognized radar metadata for this device. Review the exact sources before saving.","radar.detected_ld2450":"House Plan found an ESPHome LD2450 coordinate set. Review the exact X/Y sources before saving.","radar.additional_actions":"Additional actions","radar.declare":"This is a presence radar","radar.profile":"Data profile","radar.profile_esphome_ld2450_v1":"ESPHome LD2450 (X/Y targets)","radar.profile_cartesian_v1":"Cartesian targets (X/Y)","radar.profile_polar_v1":"Polar target (distance/angle)","radar.profile_range_v1":"Distance only","radar.profile_zones_v1":"Zone states","radar.profile_presence_v1":"Presence only","radar.room":"Radar room","radar.room_choose":"Choose a room","radar.target":"Target {n}","radar.axis_x":"X coordinate entity","radar.axis_y":"Y coordinate entity","radar.add_target":"Add target slot","radar.range_channel":"Range channel {n}","radar.add_range":"Add range channel","radar.presence_gate":"Presence gate entity","radar.swap_axes":"Swap X and Y axes","radar.axis_x_sign":"X direction","radar.axis_y_sign":"Y direction","radar.distance_source":"Distance entity","radar.angle_source":"Angle entity","radar.angle_unit":"Angle unit","radar.degrees":"Degrees","radar.radians":"Radians","radar.angle_zero":"Zero-angle direction","radar.angle_forward":"Forward","radar.angle_right":"Right","radar.angle_clockwise":"Angles increase clockwise","radar.zone_source":"Zone entity","radar.occupancy_source":"Presence entity","radar.count_source":"Target count entity","radar.availability_source":"Availability entity","radar.source_choose":"Choose an entity","radar.source_optional":"Optional","radar.source_missing":"currently unavailable","radar.saved_unsupported":"This saved radar setup is unsupported or incomplete. It remains inactive; remove it or update House Plan before configuring it again.","radar.occupancy":"Presence (on/off)","radar.count":"Count","radar.mount":"Position and direction","radar.mount_hint":"This is the physical sensor position. Moving its decorative marker does not change it.","radar.heading":"Direction, °","radar.range_cm":"Range, cm","radar.fov_deg":"Field of view, °","radar.unit":"Source unit","radar.mirror":"Mirror the left/right axis","radar.remove":"Remove radar settings","radar.invalid":"Complete the radar room, sources and position before saving.","radar.check_sources":"Check live data","radar.checking":"Checking…","radar.health":"Connection status","radar.live_summary":"Current targets: {targets}; range arcs: {ranges}","radar.health_ok":"Current data received","radar.health_off":"No targets detected","radar.health_stale":"Some coordinate data is out of date","radar.health_partial":"Some sources are current; others are out of date","radar.health_restricted":"Access to one or more sources is restricted","radar.health_incomplete":"The current radar report is incomplete","radar.health_position_unavailable":"Presence reported; current position unavailable","radar.health_unavailable":"Sensor data unavailable","radar.health_needs_setup":"Installation needs setup","radar.health_inconsistent":"The sources report conflicting values","radar.health_unknown":"Current state is unknown","radar.health_disabled":"Radar is disabled","radar.error_invalid_radar":"Check the radar settings.","radar.error_invalid_selection":"Select an existing room and valid sources.","radar.error_source_restricted":"You do not have access to all selected sources.","radar.error_rate_limited":"Too many requests. Try again shortly.","radar.error_not_ready":"Radar processing is not ready.","radar.error_conflict":"The plan changed. Reopen the radar setup and try again.","radar.error_source_unavailable":"One or more selected radar sources are unavailable.","radar.error_unsupported_capability":"This radar capability is not supported by the installed integration.","radar.report_age":"{seconds} s ago","space.show_lqi":"Show zigbee signal (LQI) next to devices","space.hide_decor":"Hide the decorative layer","space.hide_decor_tip":"Lines, shapes, labels and furniture stay where they are — visible in the backdrop editor, not on the plan.","space.hide_openings":"Hide openings","space.hide_openings_tip":"Door, window and gate symbols are not drawn, but the openings keep working: light passes through, the sun comes in at a window, contact sensors still open them. The plan editor always shows them.","gs.light_none":"No light sources","mode.plan":"Plan editor","mode.devices":"Device editor","display.value":"Value + state","marker.subarea":"no area, manual","device.new":"New device — open its editor to dismiss","opening.unlock_action":"Unlock","opening.lock_action":"Lock","opening.lock_pending":"Working…","title.close_editor":"Close editor (back to view)","title.add_device":"Add a device to the plan","devbar.add":"Add","devbar.rules":"Icon rules","device_inbox.button":"Devices","device_inbox.title":"Devices on the plan","device_inbox.search":"Search devices, entities and integrations…","device_inbox.add_virtual":"Add virtual device","device_inbox.tab_on_plan":"On plan","device_inbox.tab_available":"Available","device_inbox.tab_hidden":"Hidden","device_inbox.tab_readd":"Available again","device_inbox.only_new":"New only","device_inbox.show_entities":"Show entities","device_inbox.show_hidden":"Show hidden on plan","device_inbox.show_hidden.help":"Temporarily shows hidden and disabled markers as editor-only ghosts on the plan. Saved device visibility does not change.","device_inbox.show_hidden.help.aria":"Help: show hidden devices on the plan","device_inbox.new":"New","device_inbox.find":"Find on plan","device_inbox.edit":"Edit","device_inbox.hide":"Hide","device_inbox.show":"Show","device_inbox.add":"Add","device_inbox.readd":"Add again","device_inbox.hide_available":"Hide from list","device_inbox.show_more":"Show more","device_inbox.more_actions":"More actions","device_inbox.find_hidden_hint":"Enable “Show hidden on plan” first","device_inbox.show_disabled":"Activate this binding in Home Assistant before showing it","device_inbox.empty_on_plan":"No matching devices are on the plan yet.","device_inbox.empty_available":"No devices are available to add.","device_inbox.empty_hidden":"There are no hidden devices.","device_inbox.empty_readd":"No removed devices are available to add again.","device_inbox.reason_visible_auto":"Discovered automatically","device_inbox.reason_visible_explicit":"Added explicitly","device_inbox.reason_manual_hidden":"Hidden by user","device_inbox.reason_automatic_hidden":"Hidden automatically","device_inbox.reason_service_entry":"Service-only registry entry","device_inbox.reason_excluded_integration":"Integration “{integration}” excluded by discovery filters","device_inbox.reason_excluded_domain":"Non-spatial entity type","device_inbox.reason_grouped_light":"Represented by a room light group","device_inbox.reason_represented_by_parent":"Represented by its parent device","device_inbox.reason_removed":"Previously removed from the plan","device_inbox.reason_available":"Available to add to the plan","device_inbox.reason_no_bound_room":"HA area is not linked to a plan room","device_inbox.status_ha_disabled":"Disabled in Home Assistant","device_inbox.status_orphaned":"Binding is no longer present in Home Assistant","device_inbox.status_unverified":"Home Assistant registry is temporarily unavailable","device_inbox.saved":"Device list updated","device_inbox.filters_excluded":"Excluded integrations","device_inbox.filters_group_lights":"Group room lights into one marker","device_inbox.filters_preview_appear":"will appear: {count}","device_inbox.filters_preview_hide":"will disappear: {count}","device_inbox.filters_preview_lights":"lights affected: {count}","device_inbox.filters_reset":"Restore recommended","device_inbox.filters_save":"Save filters","device_inbox.filters_search_ph":"Add an integration…","device_inbox.filters_title":"Discovery filters","space.roomcard_section":"Room card shows:","space.label_temp":"Temperature","space.label_hum":"Humidity","space.label_lqi":"Average Zigbee signal","space.label_light":"Lights on/off","roomcard.light_on":"On","roomcard.light_off":"Off","roomcard.light_partial":"{on} of {total}","toast.split_pick_inside":"Intermediate cut points must be inside the room","mode.decor":"Background editor","decor.select":"Select","decor.line":"Line","decor.rect":"Rectangle","decor.ellipse":"Oval","decor.text":"Text","decor.erase":"Erase","decor.erase_confirm_title":"Erase object?","decor.color":"Color","decor.width":"Line width","decor.line_style":"Line style","decor.line_style_solid":"Solid","decor.line_style_dashed":"Dashed","decor.fill":"Fill","decor.fill_color":"Fill color","decor.length":"Length","decor.size":"Size","decor.flip_h":"Flip horizontally","decor.flip_v":"Flip vertically","decor.angle":"Rotation angle, °","decor.text_size":"Text size","decor.backdrop_properties":"Plan backdrop properties","decor.text_title":"Text label","decor.object_title":"Edit {kind}","decor.text_label":"Text","decor.live_group":"Insert HA variable","decor.live_entity":"Entity","decor.live_entity_ph":"choose an entity","decor.live_attr":"Value","decor.live_attr_ph":"choose state or attribute","decor.live_state":"State","decor.backdrop":"Backdrop image","decor.backdrop_hint":"Drag to move; pull a corner to resize; use the top handle to rotate. Shift changes proportions or frees the angle.","decor.backdrop_reset":"Reset the picture","decor.backdrop_reset_done":"The picture is back at its original place and size","marker.icon_auto":"Auto: {icon} (by icon rules; pick one to override)","marker.icon_pin_auto":"Pin","mode.plan_tip":"Plan editor — the geometry of the home: draw and split/merge rooms, bind them to HA areas, place doors, windows and gates, move room cards, set the scale","mode.devices_tip":"Device editor — everything about icons: drag to position, click to edit binding/icon/display, add virtual devices, icon rules","mode.decor_tip":"Background editor — purely visual decor under the plan: lines, rectangles, ovals and text labels that never react to clicks","space.glow_enabled":"Light-source glow","gs.glow_group":"Light-source glow","gs.glow_base":"House darkness","gs.glow_light":"Default light color / intensity","gs.wall_group":"Walls","gs.wall_fill":"Wall fill","gs.glow_radius":"Glow radius","gs.glow_radius.help":"Sets the default glow radius in metres or feet; a device-specific radius overrides it.","gs.glow_radius.help.aria":"Help: default glow radius","gs.unit_m":"m","gs.unit_ft":"ft","marker.controls_label":"Controls other light sources","marker.controls.help":"With the “Toggle state” action, the listed sources toggle together with this marker. Their glow stays at their own markers, and the link alone does not turn the controlling marker into a light source.","marker.controls.help.aria":"Help: controlling other light sources","marker.controls_filter":"Search lights and switches…","info.controls":"Controls","marker.glow_radius_label":"Glow radius","marker.glow_radius.help":"Sets the glow radius in metres or feet; an empty value uses the radius from general settings.","marker.glow_radius.help.aria":"Help: glow radius","markup.wallthick":"Thickness","markup.select":"Select","title.markup_wallthick":"Thickness — click a wall to set its thickness from 0 to 100 cm.","markup.hint_wallthick":"click a wall · Esc closes without applying","wallthick.field":"Thickness","wallthick.unit_cm":"cm","wallthick.unit_in":"in","wallthick.apply_room":"Apply to all walls of this room","markup.draw_wall_title":"Thickness of each new wall segment (0–100 cm). Shared walls keep the existing value.","room.queue_progress":"Room {current} of {total}","toast.wall_rooms_saved":"Created rooms: {n}","toast.wall_chain_saved":"Wall chain saved","toast.wallthick_pick":"Click a wall","toast.wallthick_set":"Wall thickness set","toast.wallthick_cleared":"Wall thickness removed","toast.physical_range":"Enter a value from {min} to {max} {unit}","toast.zero_wall_opening_conflict":"Remove the opening on this wall segment first.","toast.zero_wall_ambiguous":"The wall segment is ambiguous. Simplify or adjust the junction.","toast.zero_wall_migration_blocked":"The space was not converted: {reason}. No data was changed.","toast.physical_angle":"Enter a rotation angle from 0° up to, but not including, 90°","toast.physical_limit":"The space has reached the limit for this type of geometry","toast.geometry_unsafe":"Change canceled: wall geometry could not be built safely.","junction.limit_angle":"The angle between walls is too sharp: {actual}°, minimum {limit}°.","junction.limit_valence":"Too many walls meet in one node: {actual}, maximum {limit}.","junction.limit_length":"The wall segment is too short: {actual} cm, minimum {limit} cm.","junction.limit_distance":"Walls and nodes are too close: {actual} cm, minimum {limit} cm.","junction.limit_clearance":"No room interior is left: {actual} cm², minimum {limit} cm².","junction.limit_check_failed":"The junction check could not run — the change was not saved","toast.wall_model_migration_blocked":"The wall model could not be updated: {reason}. The plan was not changed. Run “Optimize plans”; if the error repeats, fix the conflicting wall geometry.","toast.wall_model_client_outdated":"Update the card and reload the page before editing the plan.","wall_model.reason.invalid-room":"invalid room contour","wall_model.reason.zero-length":"zero-length wall segment","wall_model.reason.third-owner":"wall shared by more than two rooms","wall_model.reason.duplicate-id":"conflicting wall identifiers","wall_model.reason.thickness-conflict":"conflicting wall thickness values","wall_model.reason.opening-host":"opening cannot be assigned to one wall","toast.delete_room_pick":"Click inside the room you want to delete","toast.plan_snap_ambiguous":"Zoom in to choose the wall node","toast.wall_repair_ambiguous":"The room outline has more than one possible connection. Zoom in and connect it explicitly.","toast.wall_repair_too_large":"The gap is larger than 2 cm. Connect the walls before creating the room.","toast.wall_repair_changed":"The wall geometry changed. Try creating the room again.","toast.opening_on_zero_wall":"Openings cannot sit on a zero-thickness wall","marker.from_ha_option":"Pick from the HA list","marker.show_entities":"Show entities","marker.show_entities_tip":"Adds not only devices to the list, but all their entities too","marker.pick_ph":"Choose a device…","room.open_area":"Open the HA area","room.fit_action":"Fit room {name}","view.volumetric":"Volumetric view","view.flat":"Flat view","kiosk.title":"This screen's sizes","kiosk.hint":"Stored on this device only — every wall tablet or TV can have its own comfortable sizes.","kiosk.icon_scale":"Device icon size","kiosk.font_scale":"Room card text size","editor.kiosk":"Wall device (kiosk) mode","editor.cycle":"Auto-switch spaces every N seconds (kiosk, 0 = off)","room.settings_title":"Room settings","room.settings_section":"Room settings (override the space)","room.fill_label":"Fill in THIS room","fill.inherit":"As the space","room.custom_fill_space":"Space color","room.custom_fill_own":"Room color","room.temp_range_label":"Comfort range","room.temp_range_min":"Lower comfort-temperature bound","room.temp_range_max":"Upper comfort-temperature bound","room.temp_range_reset":"As the space","room.temp_range.help":"This range applies only to this room. Empty fields inherit the corresponding space bounds; if the bounds are reversed, House Plan uses the smaller value as the lower bound and the larger value as the upper bound.","room.temp_range.help.aria":"About the room comfort range","room.temp_src_label":"Temperature source","room.hum_src_label":"Humidity source","room.src_average":"Average over the room's sensors (default)","room.src_pick":"A specific HA device or entity","room.src_ph":"Choose a source…","toast.room_updated":"Room updated","space.card_font":"Room-card font size (whole space)","room.sizes_section":"Font sizes","room.name_scale":"Room name size","room.label_scale":"Metrics size","preview.room_name":"Living room","toast.cfg_reload_failed":"Could not reload the plan from the server: {err}","toast.locale_load_failed":"Could not load the language pack. English is used until the page reloads.","toast.furniture_art_load_failed":"Could not load the furniture drawings. Reload the page to show them.","room.settings_short":"Room settings","room.unnamed":"Unnamed room","marker.use_climate_temp":"Include the device temperature in the room","marker.use_climate_temp_tip":"Adds an air conditioner or thermostat current_temperature to the room average. Configure the external value badge separately below.","marker.value_badge_title":"Value badge","marker.value_badge.help":"Shows one selected value next to the icon. It does not affect room metrics, light, Glow or the tap action.","marker.value_badge.help.aria":"Help: device value badge","marker.value_badge_enabled":"Show a value badge","marker.value_badge_source":"Value","marker.value_badge_source.help":"Choose a specific state, supported attribute, or derived value of this device.","marker.value_badge_source.help.aria":"Help: value badge source","marker.value_badge_position":"Position","marker.value_badge_position.help":"The chosen side stays fixed and does not flip automatically at a plan edge.","marker.value_badge_position.help.aria":"Help: value badge position","marker.value_badge_right":"Right","marker.value_badge_bottom":"Below","marker.value_badge_left":"Left","marker.value_badge_top":"Above","marker.value_badge_empty":"This device has no available values","marker.value_badge_static":"A static icon does not show live values. The setting is preserved.","marker.value_badge_missing":"Source unavailable","marker.value_badge_missing_hint":"The saved source is currently unavailable. Keep it, disable the badge, or choose another value.","marker.value_badge_duplicate":"The same value is already shown inside the icon.","marker.value_badge_state":"State · {name}","marker.value_badge_marker_state":"Light-source state · {name}","marker.value_badge_lqi":"Average Zigbee signal quality","marker.value_badge_attr_current_temperature":"Current temperature · {name}","marker.value_badge_attr_temperature":"Target temperature · {name}","marker.value_badge_attr_current_humidity":"Current humidity · {name}","marker.value_badge_attr_humidity":"Humidity · {name}","marker.value_badge_attr_current_position":"Position · {name}","marker.value_badge_attr_percentage":"Speed · {name}","marker.value_badge_attr_brightness":"Brightness · {name}","marker.value_badge_attr_volume_level":"Volume · {name}","marker.value_badge_attr_battery_level":"Battery · {name}","marker.value_badge_attr_fan_speed":"Fan speed · {name}","marker.value_source":"Value source","marker.value_source.help":"Choose the value that replaces the icon. The tap action does not change.","marker.value_source.help.aria":"Help: value face source","marker.value_source_auto":"Automatic (as before)","marker.value_source_missing_hint":"The saved source is currently unavailable. The face shows — until it recovers or you choose another value.","marker.light_role_label":"Is this device a light source?","marker.light_role.help":"“Auto” uses the bound device's resolved role, “Always” forces its own source and “Never” excludes it; linked lights above remain independent.","marker.light_role.help.aria":"Help: whether this device is a light source","marker.light_role_auto_yes":"Auto (light source)","marker.light_role_auto_no":"Auto (not a light source)","marker.light_role_always":"Always a light source","marker.light_role_never":"Never a light source","marker.light_entity_label":"Leading light entity","marker.light_entity.help":"For a composite device, choose the entity whose state, colour and brightness represent this plan source. The automatic fallback remains compatible with older plans.","marker.light_entity.help.aria":"Help: leading light entity","marker.light_entity_auto":"Automatic ({entity})","marker.light_entity_none":"no controllable entity","marker.light_entity_missing":"The saved entity {entity} is unavailable. House Plan temporarily uses {fallback}; the saved choice will be restored if it returns.","marker.toggle_entity_label":"Entity to toggle","marker.toggle_entity.help":"For a composite device, choose the exact own light or switch operated by a tap. Automatic keeps the previous target rules and is independent from the leading light entity.","marker.toggle_entity.help.aria":"Help: entity to toggle","marker.toggle_entity_auto":"Automatic ({entity})","marker.toggle_entity_none":"no own controllable entity","marker.toggle_entity_missing":"The saved entity {entity} is no longer among this marker’s selectable channels. House Plan temporarily uses {fallback}; the saved choice will be restored if it returns.","marker.glow_color_label":"Glow colour and brightness","marker.glow_mode.help":"Use live source values, override only its colour, or fix both colour and brightness. The minimum is 1%; to disable the source, choose “Never”.","marker.glow_mode.help.aria":"Help: glow colour and brightness","marker.glow_mode_auto":"From source","marker.glow_mode_color":"Set colour","marker.glow_mode_fixed":"Set colour and brightness","marker.glow_color":"Glow colour","marker.glow_brightness":"Brightness","marker.glow_disabled_never":"Glow settings are unavailable because this marker is explicitly not a light source.","marker.glow_disabled_auto":"Auto mode found no spatial light source for this marker.","marker.glow_disabled_no_entity":"No active controllable Home Assistant entity is available for this spatial source.","marker.glow_passive_hint":"This source has no own Home Assistant data. Set its colour and brightness manually; its radius remains available.","marker.control_broken":"Saved source is missing or no longer marked as a light","marker.control_missing_label":"Missing plan light","marker.control_passive":"passive source","toast.marker_control_cycle":"This link would create a circular chain of light controls.","toast.marker_binding_required":"Choose a Home Assistant device before linking another light source.","confirm.unlock_title":"Unlock?","confirm.unlock_body":"House Plan will send an unlock command to this lock.","toast.files_migrate_failed":"Attachments could not be moved to the new binding, links keep pointing at the old files: {err}","space.pick_saved":"Already uploaded","space.pick_saved_hint":"Plans stored on the server, including ones you detached earlier","space.no_saved":"No plans stored on the server yet.","space.loading":"Loading…","space.used_by":"in use: {list}","space.in_use":"A space still uses this plan — detach it first","btn.use":"Use","confirm.delete_plan_title":"Delete plan file?","confirm.delete_plan_body":"The file will be deleted from the server. This action cannot be undone.","toast.plans_list_failed":"Could not list the stored plans: {err}","toast.plan_delete_failed":"Could not delete the plan: {err}","marker.hide":"Hide","marker.hide_tip":'The device will disappear from the plan after saving but will still count toward the room signal. Restore it through the "Devices" catalog in the device editor.',"marker.show":"Show","marker.show_tip":"The device will appear on the plan again after saving.","marker.hidden_ghost":"Device hidden by the user","marker.ha_disabled_device":"The device is disabled in Home Assistant and hidden from the plan.","marker.ha_disabled_entity":"The entity is disabled in Home Assistant and hidden from the plan.","marker.ha_disabled_all_entities":"The device has no active Home Assistant entities, so it is hidden from the plan.","marker.ha_registry_limited":"The full Home Assistant registry is unavailable to this user. The unverified object cannot be shown or used for now.","marker.delete_tip":"Completely delete the device from the plan and every aggregate. You can add it again later.","tap.run":"Run automation/script/scene","tap.none":"Do nothing","marker.run_target_label":"What to run","marker.run_search_ph":"Search: automation, script or scene…","marker.run_target_gone":"Target {id} not found — pick again","marker.tap_confirm":"Ask for confirmation","marker.tap_confirm_tip":"Show a confirmation dialog before acting — a guard against accidental taps.","marker.toggle_hint_single":"Target: {name} ({id}).","marker.virtual_light_target":"Virtual light: {name}.","marker.virtual_light_current":"Manual state: {state} → {effect}.","marker.virtual_light_state_on":"on","marker.virtual_light_state_off":"off","marker.toggle_hint_group":"Will toggle {count} source(s): {names}.","marker.toggle_hint_current":"Now: {state} → {effect}.","marker.toggle_hint_group_current":"Currently on: {on} of {count} → {effect}.","marker.toggle_hint_skipped":"Will be skipped ({count}): {targets}.","marker.toggle_effect_turn_on":"will turn on","marker.toggle_effect_turn_off":"will turn off","marker.toggle_effect_open":"will open","marker.toggle_effect_close":"will close","marker.toggle_effect_stop":"will stop","marker.toggle_effect_toggle":"state will toggle","marker.toggle_skip_missing":"not found","marker.toggle_skip_ha_disabled":"disabled in HA","marker.toggle_skip_unavailable":"unavailable","marker.toggle_skip_unsupported":"toggle is unsupported","marker.toggle_skip_secure":"blocked for security","marker.toggle_none_no_binding":"This device has no binding, so there is no state to toggle. Tapping will do nothing.","marker.toggle_none_no_actionable_entity":"This device has no state that can be toggled. Tapping will do nothing.","marker.toggle_none_configured_targets_missing":"The configured targets are unavailable. The device's own entity will not be substituted for them.","marker.toggle_none_ha_disabled":"The target is disabled in Home Assistant and cannot be used on the plan.","marker.toggle_none_unavailable":"The target is currently unavailable. Tapping will do nothing.","marker.toggle_none_unsupported":"Home Assistant exposes no safe toggle operation for this entity. Tapping will do nothing.","marker.toggle_none_secure":"Toggling locks, alarms and secure gates from the plan is blocked for security.","run.automation":"automation","run.script":"script","run.scene":"scene","confirm.tap_run":'Run "{name}"?',"confirm.tap_toggle":'Toggle "{name}"?',"confirm.current_state":"Current state: {state}","confirm.expected_state":"After switching: {state}","confirm.group_current":"on {on} of {total}","confirm.group_all_on":"all are on","confirm.group_all_off":"all are off","confirm.unavailable_targets":"Unavailable: {count}","confirm.expected_by_ha":"Home Assistant will determine the state","confirm.state_on":"On","confirm.state_off":"Off","confirm.state_open":"Open","confirm.state_closed":"Closed","confirm.state_opening":"Opening","confirm.state_closing":"Closing","confirm.state_stopped":"Stopped","confirm.state_unknown":"Unknown","toast.run_started":"Started: {name}","toast.run_target_missing":"Run target not found — check the device settings","toast.run_target_required":"Pick an automation, script or scene","toast.tap_target_changed":"The action target changed. Try again.","toast.virtual_light_toggle_failed":"Could not toggle the virtual light: {err}","toast.value_badge_source_required":"Choose a value for the badge","btn.run":"Run","vac.section":"Robot vacuum: live position","vac.autocal":"Set up automatically","vac.live":"Live position on the plan","vac.trail":"Show the robot's path","vac.autocal_no_rooms":"The integration reports no room list — open “Fit manually”","vac.route_warn_unmapped":"The robot is cleaning a map that is not assigned to any floor","vac.route_warn_needs_calibration":"The map is assigned to a floor but not calibrated","vac.route_warn_ambiguous":"Two maps are indistinguishable — no floor was chosen","vac.route_warn_missing_space":"The space of this map was deleted","vac.autocal_no_match":"Room names did not match (need ≥3 in common) — open “Fit manually”","vac.autocal_done":"Done: bound via {rooms} rooms. Start a cleanup and check","vac.cal_need_pos":"The robot is not reporting coordinates — start a cleanup and pause it","vac.cal_done":"Calibration saved. Start a cleanup and check","vac.cal_cancelled":"Calibration cancelled","vac.fit":"Fit manually","vac.fit_hint":"Drag the robot map into place, stretch by the corners","vac.fit_rotate":"Rotate 90°","vac.fit_mirror":"Mirror","vac.trail_never":"Never","vac.trail_cleaning":"While cleaning","vac.trail_always":"Always","gs.bg_group":"Stage background","gs.bg_color":"Background around the plan","gs.bg_default":"Theme default","gs.bg_theme":"theme default","gs.bg_mode":"Plan background","gs.bg_mode.help":"“Follows the Sun” uses sun.sun, falling back to the browser's local clock; Static always shows the selected colour.","gs.bg_mode.help.aria":"Help: general plan background","gs.bg_static":"Static color","gs.bg_daynight":"Follows the Sun","gs.sun_group":"Sun","gs.sun_missing":"The sun.sun entity was not found — the background follows your local clock; window rays are unavailable.","gs.north":"North on the plan","gs.north.help":"The angle is measured clockwise from the plan's upward vertical; north is required for window rays, not for the “Follows the Sun” background.","gs.north.help.aria":"Help: general north direction","gs.north_ph":"not set","gs.north_clear":"Clear","gs.north_letter":"N","gs.sun_rays":"Sunlight through windows","gs.about_version":"Houseplan Card v{v}","gs.about_github":"GitHub · docs & issues","gs.about_telegram":"Telegram chat","support.title":"Help & feedback","space.bg_color":"Background around the plan","space.bg_inherit":"Inherit general","space.bg_inherited":"inherits general settings","space.bg_mode":"Plan background","space.bg_mode.help":"Inherit the general background or override this space with a static colour or “Follows the Sun”.","space.bg_mode.help.aria":"Help: space background","space.north":"North on the plan (override)","space.north.help":"Overrides general north for this space; the angle is measured clockwise from the plan's upward vertical and is used by window rays.","space.north.help.aria":"Help: north for this space","space.north_inherited":"inherited: {v}","space.sun_rays":"Sunlight through windows","space.sun_inherit":"Inherit general","space.sun_on":"On","space.sun_off":"Off","canvas.far_objects":"{n} object(s) far from the plan","canvas.show_far":"Show","canvas.home_tip":"The plan is over there — click to fit it","gs.grid_group":"Plan maintenance","gs.grid_hint":"Updates data models, aligns plan elements to the grid and merges redundant wall fragments. An exact report is shown before anything is stored.","gs.align_all":"Optimize plans","gs.align_title":"Optimize plans","gs.align_none":"All plans already use the current optimized data model.","gs.optimize_no_automatic_changes":"There are no automatic changes to apply. Review the items below.","gs.align_count":"{n} of {total} elements will move, by at most {cm} cm.","gs.align_where":"The largest shift is in “{s}”.","gs.align_turned":"Openings whose angle is corrected: {n}.","gs.align_preflight_failed":"Could not safely verify the geometry of the following spaces: {spaces}{more}.","gs.align_preflight_hint":"Plans were not changed. Copy the diagnostics with the button below and attach them to the bug report together with a space export.","gs.preflight_reason_prepare-exception":"Could not prepare the space geometry (exception while building the model)","gs.preflight_reason_wall-null":"The wall body did not build (the union came back empty)","gs.preflight_reason_wall-degraded-extra":"The wall body degraded with extra geometry","gs.preflight_reason_wall-failed-core":"The wall body core failed to assemble","gs.preflight_reason_wall-exception":"Wall construction threw an exception","gs.preflight_reason_floor-null":"The floor outline did not build","gs.preflight_reason_floor-exception":"Floor construction threw an exception","gs.preflight_copy":"Copy diagnostics","gs.preflight_copied":"Diagnostics copied","gs.preflight_update_hint":"The card and integration versions differ — update House Plan and retry.","gs.align_preflight_space":"Space {n}","gs.align_preflight_more":", and {n} more","gs.optimize_changes":"Model migrations: {m}; spaces updated: {c}; noisy coordinate values removed: {p}; merged real-wall fragments: {w}; merged zero-thickness wall fragments: {s}; independent walls: {i}.","gs.zero_walls_migrated":"Virtual wall spans converted: {n}.","gs.wall_segments_migrated":"Wall segments stabilised: {n}.","gs.room_drafts_migrated":"Unfinished contours converted to ordinary walls: {drafts}; wall segments: {segments}.","gs.optimize_lattice_summary":"Noisy coordinate values canonicalized: {n}; maximum movement: {cm} cm.","gs.optimize_lattice_space":"{space}: coordinate values canonicalized: {n}; off-grid values left unchanged: {far}.","gs.optimize_coincident_partitions":"Hidden independent wall sections absorbed into room walls: {n}.","gs.optimize_openings_rehosted":"Openings reattached to room walls: {n}.","gs.optimize_walls_straightened":"Walls straightened: {n}; maximum movement: {cm} cm.","gs.optimize_walls_straightened_where":"Largest wall correction: {s}.","gs.optimize_walls_straighten_skipped":"Near-axis walls left unchanged because they could not be repaired safely: {n}.","gs.optimize_glow_migration":"Legacy Glow: {spaces} spaces → no data fill + independent Glow; {rooms} rooms → inherited data fill + independent Glow.","gs.optimize_references":"References repaired: spaces — {spaces}; rooms — {rooms}; positions — {positions}; devices detached from missing spaces — {detached}.","gs.optimize_reference_more":", and {n} more","gs.optimize_orphans_removed":"Forgotten records removed: {total} — room labels: {rooms}; devices: {devices}; group markers: {groups}. They belonged to spaces deleted earlier.","gs.optimize_live_positions":"Old positions in deleted spaces belong to existing objects: {n}{names}. They will be kept.","gs.optimize_live_positions_remove":"Old positions in deleted spaces belong to existing objects: {n}{names}. They are selected for removal.","gs.optimize_live_names":": {names}{more}","gs.optimize_live_remove":"Remove old positions","gs.optimize_live_keep":"Keep old positions","gs.optimize_live_selected":"Old positions will be removed after Optimize is applied.","gs.optimize_unverified":"Could not safely verify positions: {n}. They were left unchanged.","gs.optimize_registry_limited":"Full administrator access to the Home Assistant registries is required for a safe check.","gs.optimize_vacuum_warning":"Vacuum room mappings that still need review: {n}.","gs.optimize_details":"Details","gs.optimize_details_more":"And {n} more records.","gs.optimize_detail_removed":"will be removed","gs.optimize_detail_live":"will be kept","gs.optimize_detail_unverified":"not verified","gs.optimize_detail_room_label":"room label","gs.optimize_detail_device":"device","gs.optimize_detail_group":"group marker","gs.optimize_detail_unknown":"unknown owner","gs.optimize_detail_item":"{status}: {kind} {id}; old space {space}","gs.align_warn":"Elements deliberately placed between grid nodes will move. One undo is available after the operation, only until the next plan edit.","gs.align_run":"Optimize","gs.align_done":"Plans optimized: {n} elements moved, {m} records maintained, {r} references repaired","gs.optimize_undo":"Undo last optimization","gs.optimize_undone":"The last optimization was undone","decor.furniture":"Furniture","decor.image":"Image","decor.image_title":"Custom images","decor.image_upload":"Upload image","decor.image_replace":"Replace image","decor.image_uploading":"Uploading…","decor.image_asset":"Image file","decor.image_pick_hint":"Upload an image or choose one already used in House Plan.","decor.image_place_hint":"Click on the plan to place the image.","decor.image_none":"No uploaded images yet.","decor.image_unavailable":"Image unavailable","decor.image_used":"Used in {n} objects","decor.image_upload_failed":"Could not upload the image: {err}","decor.image_error_capacity":"The custom image storage limit has been reached.","decor.image_in_use":"Remove every placed copy before deleting this image.","decor.image_delete_title":"Delete image file?","decor.image_delete_message":"Delete “{name}” from House Plan? This cannot be undone.","furn.title":"Furniture library","furn.symbol":"Symbol","furn.group_furniture":"Furniture","furn.group_appliance":"Appliances","furn.group_sanitary":"Plumbing","furn.group_other":"Other","furn.width":"Width","furn.depth":"Depth","furn.back_to_categories":"All categories","furn.pick_hint":"Choose a category, then a symbol.","furn.place_hint":"Click on the plan — the piece lands against the nearest wall. Shift places it free.","furn.cat_air_conditioner":"Air conditioners","furn.cat_armchair":"Armchairs","furn.cat_bathtub":"Bathtubs","furn.cat_bed":"Beds","furn.cat_bidet":"Bidets","furn.cat_boiler":"Water heaters","furn.cat_chair":"Chairs","furn.cat_coffee_table":"Coffee tables","furn.cat_cooktop":"Cooktops","furn.cat_dining_table":"Dining tables","furn.cat_dishwasher":"Dishwashers","furn.cat_dryer":"Dryers","furn.cat_fireplace":"Fireplaces","furn.cat_fridge":"Refrigerators","furn.cat_kitchen_cabinet":"Kitchen cabinets","furn.cat_kitchen_sink":"Kitchen sinks","furn.cat_nightstand":"Cabinets","furn.cat_plant":"Plants","furn.cat_rug":"Rugs","furn.cat_shelving":"Shelving","furn.cat_shower":"Showers","furn.cat_sink":"Sinks","furn.cat_sofa":"Sofas","furn.cat_stairs":"Stairs","furn.cat_toilet":"Toilets","furn.cat_tv":"Televisions","furn.cat_wardrobe":"Wardrobes","furn.cat_washer":"Washing machines","furn.cat_work_table":"Desks","furn.sym_sofa":"Two-seat sofa","furn.sym_sofa_three_seat":"Three-seat sofa","furn.sym_sofa_corner_right":"Right sectional sofa","furn.sym_armchair":"Soft armchair","furn.sym_armchair_office":"Office chair","furn.sym_coffee_table":"Rectangular coffee table","furn.sym_coffee_table_round":"Round coffee table","furn.sym_coffee_table_oval":"Oval coffee table","furn.sym_coffee_table_rounded":"Rounded coffee table","furn.sym_table_dining":"Rectangular dining table","furn.sym_table_round":"Round table","furn.sym_table_dining_oval":"Oval dining table","furn.sym_table_dining_rounded":"Rounded dining table","furn.sym_chair":"Chair","furn.sym_chair_bar":"Bar stool","furn.sym_desk":"Rectangular desk","furn.sym_desk_corner":"Corner desk","furn.sym_bed_double":"Double bed","furn.sym_bed_single":"Single bed","furn.sym_nightstand":"Bedside table","furn.sym_cabinet_tv":"TV cabinet","furn.sym_cabinet_shoe":"Shoe cabinet","furn.sym_cabinet_sink":"Sink cabinet","furn.sym_wardrobe":"Wardrobe","furn.sym_bookshelf":"Bookcase","furn.sym_wall_unit":"Wall unit","furn.sym_kitchen_floor":"Kitchen floor module","furn.sym_kitchen_floor_corner":"Kitchen floor corner module","furn.sym_kitchen_wall":"Kitchen wall module","furn.sym_kitchen_wall_corner":"Kitchen wall corner module","furn.sym_shelf_floor":"Floor shelving unit","furn.sym_shelf_wall":"Wall shelf","furn.sym_fridge":"Fridge","furn.sym_stove":"Four-burner cooktop","furn.sym_cooktop_two":"Two-burner cooktop","furn.sym_dishwasher":"Dishwasher","furn.sym_washer":"Washing machine","furn.sym_dryer":"Tumble dryer","furn.sym_tv":"TV on stand","furn.sym_tv_wall":"Wall-mounted TV","furn.sym_ac":"Air conditioner","furn.sym_water_heater":"Water heater","furn.sym_toilet":"Floor-standing toilet","furn.sym_toilet_built_in":"Built-in toilet","furn.sym_bathtub":"Rectangular bathtub","furn.sym_bathtub_corner":"Corner bathtub","furn.sym_shower":"Shower","furn.sym_sink":"Washbasin","furn.sym_kitchen_sink":"Single kitchen sink","furn.sym_kitchen_sink_double":"Double kitchen sink","furn.sym_bidet":"Floor-standing bidet","furn.sym_bidet_built_in":"Built-in bidet","furn.sym_stairs":"Stairs","furn.sym_fireplace":"Fireplace","furn.sym_plant":"Plant","furn.sym_rug":"Rug","common.yes":"Yes","common.no":"No","vac.diag_source":"Source","vac.diag_platform":"Integration","vac.diag_status":"Status","vac.diag_position":"Position","vac.diag_rooms":"Rooms","vac.diag_rooms_value":"{total} · {matched} names match · {readiness}","vac.autocal_ready":"auto-calibration available","vac.autocal_not_ready":"need 3 matching names","vac.diag_path":"Integration path","vac.diag_map":"Map ID","vac.source_none":"not selected","vac.source_status_ok":"Ready","vac.source_status_missing":"Missing","vac.source_status_disabled":"Disabled in Home Assistant","vac.source_status_unavailable":"Unavailable","vac.source_status_unverified":"Cannot verify with current permissions","vac.source_status_unsupported":"No position data","vac.source_status_none":"No source","vac.source_banner_missing":"The saved source no longer exists. It was not replaced automatically; choose another source or restore it in Home Assistant.","vac.source_banner_disabled":"The saved source is disabled in Home Assistant. Enable it there or choose another source.","vac.source_banner_unverified":"Current Home Assistant permissions cannot verify this saved source. It remains pinned and will not be replaced automatically.","vac.choose_source":"Choose source","vac.source_auto":"Automatic","vac.source_auto_hint":"Use a compatible entity from this device","vac.all_cameras":"All cameras","vac.all_cameras_warn":"A camera may not provide robot data. Choose one only if it is your vacuum map.","vac.all_cameras_empty":"No other camera entities found.","vac.platform_unknown":"unknown integration","vac.cap_position":"position","vac.cap_rooms_short":"rooms","vac.cap_path":"path","vac.cap_map":"map ID","vac.cap_none":"no robot data detected","vac.xcme_hint":"Enable these Xiaomi Cloud Map Extractor attributes:","vac.documentation":"Documentation","vac.residual_title":"Check automatic calibration","vac.residual_message":"The matched rooms disagree by up to {error}. Apply this approximate calibration, refine it manually, or cancel without changing the saved setup.","vac.apply_proposal":"Apply","gs.backup_group":"Backup and transfer","gs.backup_hint":"Download a portable JSON backup or preview and import a backup made by House Plan.","backup.export_open":"Export","backup.import_open":"Import","backup.export_title":"Export House Plan","backup.import_title":"Import House Plan","backup.export_hint":"Choose whether the backup should contain the whole House Plan configuration or only the current space.","backup.full":"Full backup","backup.current_space":"Current space","backup.current_space_title":"Current space: {title}","backup.no_current_space":"No current space","backup.plan_only":"Plan only","backup.plan_only_hint":"Keep rooms, walls, openings, decor and room-label positions without devices or Home Assistant bindings.","backup.plan_only_preview":"This file contains the plan only","backup.privacy_warning":"The archive keeps names, Home Assistant identifiers and exact coordinates. Internal plans and attachments are referenced, not embedded; runtime states and vacuum trails are not included.","backup.download":"Download JSON","backup.export_done":"Backup downloaded","backup.reading":"Checking the backup…","backup.revalidated":"The plan changed after this preview. The summary was refreshed; review it and confirm again.","backup.error.support_invalid_message":"Check the support message and try again.","backup.error.support_package_too_large":"The anonymized support package exceeds the 8 MiB limit.","backup.error.support_preview_expired":"The support attachment preview expired or is no longer available.","backup.error.support_rate_limited":"Too many support reports or previews were requested. Try again later.","backup.error.support_rejected":"The report did not pass support service validation.","backup.error.support_unavailable":"The private support service is temporarily unavailable.","backup.error.unauthorized":"You do not have permission to export or import this plan.","backup.error.not_ready":"House Plan is not ready yet. Try again in a moment.","backup.error.too_large":"The backup exceeds the 8 MiB limit.","backup.error.invalid_json":"The selected file is not valid JSON.","backup.error.invalid_format":"The selected file is not a House Plan backup.","backup.error.invalid_image":"The image is damaged or does not match its format.","backup.error.unsupported_export_version":"This backup format is not supported by the installed version.","backup.error.unsupported_image":"Use a supported PNG, JPEG, WebP or SVG image.","backup.error.future_model":"The backup was created by a newer House Plan data model.","backup.error.invalid_config":"The backup contains an invalid House Plan configuration.","backup.error.wall_model_migration_blocked":"The backup wall model could not be upgraded safely. Optimize the source plan first, then export it again.","backup.error.invalid_layout":"The backup contains invalid object positions.","backup.error.invalid_content":"The backup contains invalid or inconsistent content references.","backup.error.space_not_found":"The selected space no longer exists.","backup.error.capacity_exceeded":"Adding this backup would exceed the plan limits.","backup.error.preview_expired":"The preview expired. Select the backup file again.","backup.error.preview_owner_mismatch":"This preview belongs to another Home Assistant user.","backup.error.conflict":"The plan changed after the preview. Review the refreshed summary.","backup.error.content_confirmation_required":"Confirm that unavailable local content may be detached.","backup.error.commit_failed":"The backup could not be applied safely. The previous plan was restored or is pending recovery.","backup.error.missing_plan":"A referenced plan file disappeared after the preview. Review the backup again.","backup.error.missing_content":"A referenced local attachment disappeared after the preview. Review the backup again.","backup.error.marker_control_missing":"A linked plan light is missing from the backup.","backup.error.marker_control_not_light":"A linked plan target is no longer marked as a light source.","backup.error.marker_control_self":"A light source cannot control itself.","backup.error.marker_control_cycle":"The backup contains a circular chain of light controls.","backup.error.duplicate_marker_control":"The backup contains a duplicate plan-light link.","backup.error.no_backup":"There is no import or optimization snapshot to restore.","backup.error.in_use":"The item is still in use","backup.error.invalid_data":"The request carries invalid data","backup.error.invalid_light_entity":"The leading light must be a light.* or switch.* entity","backup.error.invalid_marker_control":"Invalid marker control reference","backup.error.invalid_name":"The name is invalid","backup.error.invalid_partition_opening_host":"The opening must keep its partition host","backup.error.invalid_partition_opening_jamb_margin":"The opening leaves no physical jamb at the wall end","backup.error.invalid_passage_fields":"An open passage cannot carry door-only settings","backup.error.invalid_space_id":"Unknown space","backup.error.invalid_toggle_entity":"The toggle entity must be light.* or switch.*","backup.error.invalid_value_badge":"Invalid value badge settings","backup.error.invalid_value_badge_attribute":"Invalid value badge attribute","backup.error.invalid_value_badge_position":"Invalid value badge position","backup.error.invalid_value_badge_source":"Invalid value badge source","backup.error.invalid_vacuum_map_route":"Check how the robot's maps are assigned to spaces.","backup.error.invalid_value_source":"Invalid value source","backup.error.invalid_value_source_attribute":"Invalid value source attribute","backup.error.io_error":"A file operation failed on the server","backup.error.not_toggleable":"This device cannot be toggled","backup.error.nothing_to_repair":"Nothing to repair","backup.error.space_in_use":"The space is still referenced","backup.error.value_badge_source_required":"The value badge needs a source","backup.error.wall_model_client_outdated":"The plan was updated elsewhere — reload the page","backup.same_source":"Created on this Home Assistant instance","backup.foreign_source":"Created on another Home Assistant instance","backup.created":"Created: {value}","backup.versions":"Card {card}; integration {integration}; data model {model}","backup.count_spaces":"Spaces: {n}","backup.count_rooms":"Rooms: {n}","backup.count_walls":"Walls: {n}","backup.count_openings":"Openings: {n}","backup.count_decor":"Decor objects: {n}","backup.count_markers":"Devices: {n}","backup.count_layout":"Positions: {n}","backup.bindings":"Bindings — devices: {device}, entities: {entity}, virtual: {virtual}; positions without a space: {legacy}","backup.binding_status":"Target status — active: {active}, disabled: {disabled}, missing: {missing}","backup.missing_areas":"Areas missing on the target: {areas}","backup.dropped_marker_links":"Plan-light links outside this transferred space were omitted: {n}.","backup.room_drafts_migrated":"Legacy unfinished contours converted to ordinary walls: {drafts}; wall segments: {segments}.","backup.repaired_target_refs":"Existing references restored by this space import: {n}.","backup.preserved_unresolved_refs":"References that could not be restored unambiguously were preserved: {n}.","backup.preserved_unresolved_hint":"No data was guessed or deleted. After the import, run Optimize plans to inspect the remaining references.","backup.import_details":"Import reference details","backup.import_detail.incoming_remapped":"References updated inside the imported copy: {n}","backup.import_detail.target_repaired":"Existing references restored: {n}","backup.import_detail.preserved_unresolved":"Unresolved references preserved: {n}","backup.import_detail.collisions":"Destination conflicts preserved safely: {n}","backup.import_detail.dropped_links":"Incoming links omitted by transfer rules: {n}","backup.import_detail.bounded_lineages":"Overly nested identifiers left bounded: {n}","backup.replace_warning":"This replaces the current configuration and layout. Uploaded files are never deleted. One undo remains available until the next plan edit.","backup.foreign_bookkeeping":"Instance-specific known/new-device bookkeeping will not be imported.","backup.final_name":"New space name","backup.target_settings":"The target instance's global settings remain unchanged.","backup.duplicates":"Bindings already present: {n}","backup.skip":"Skip duplicate devices","backup.virtual_copy":"Add safe static virtual copies","backup.content":"Referenced content","backup.decor_images_summary":"Custom images: {objects} objects, {assets} files; missing files: {missing}.","backup.content_available":"available locally","backup.content_external":"external link","backup.content_detach_required":"will be detached","backup.confirm_detach":"I understand that unavailable internal plans and attachments will be detached from the imported configuration.","backup.confirm_missing_images":"I understand that missing custom images will remain as repair placeholders and other unavailable local files will be detached.","backup.replace":"Replace","backup.add":"Add space","backup.space_done":"Space imported: {rooms} rooms, {markers} devices, {refs} existing references restored","backup.full_done":"Backup restored: {spaces} spaces, {rooms} rooms, {markers} devices","backup.undo_import":"Undo last full import","backup.import_undone":"Full import undone","backdrop.large_title":"Large image","backdrop.large_body":"This image is {w}×{h} ({fileMb} MB file) and needs about {decodedMb} MB of memory to display. On tablets this can crash the page.","backdrop.unknown_body":"The image dimensions could not be read — the file may be damaged. Continuing may crash the page on tablets.","backdrop.reduced_dimensions":"Reduced copy: {w}×{h} px.","backdrop.use_downscaled":"Upload a reduced copy","backdrop.reducing":"Reducing…","backdrop.keep_original":"Keep the original","backdrop.too_large_title":"Image is too large","backdrop.too_large_body":"This image exceeds what browsers can display ({w}×{h}, limit {limit} px per side). Please reduce it in a desktop editor and upload again.","backdrop.downscale_failed":"Could not create the reduced copy. The original plan was not changed."};const ap=new WeakSet,lp=new WeakSet;function cp(e,t,i){const n=i?t.state(i):"ready";return i&&"pending"===n?(lp.has(e)||(e.inert=!0,e.setAttribute("aria-busy","true"),lp.add(e)),t.ensure(i).then(()=>{e.isConnected&&e.requestUpdate()}),ap.has(e)?"warm":"cold"):(lp.delete(e)&&(e.inert=!1,e.removeAttribute("aria-busy")),i&&(e.setAttribute("lang","fallback"===n?"en":i),ap.add(e)),"ready")}function hp(){return j``}const dp=[{code:"en",nativeLabel:"English",dictionary:sp},{code:"ru",nativeLabel:"Русский",dictionary:{"editor.context_actions":"Действия: {object}","editor.tool_options":"Параметры инструмента: {tool}","editor.palette":"Палитра: {tool}","editor.open_group":"Группа инструментов: {group}","editor.group_active":"{group} — активно: {item}","editor.disabled_action":"{action} недоступно: {reason}","editor.loading":"Загружаем редактор…","editor.loading_aria":"Редактор плана загружается","editor.load_failed":"Не удалось загрузить редактор.","editor.refresh_advice":"Обновите страницу и повторите попытку.","editor.retry_advice":"Проверьте сеть и нажмите ещё раз.","version_mismatch.title":"Версии House Plan не совпадают","version_mismatch.body":"Если Home Assistant ещё перезапускается, дождитесь завершения, затем перезагрузите эту страницу.","version_mismatch.frontend":"Карточка","version_mismatch.backend":"Интеграция","version_mismatch.reload":"Перезагрузить страницу","color_picker.title":"Выбор цвета","color_picker.hue":"Оттенок","color_picker.saturation":"Насыщенность","color_picker.value":"Яркость","color_picker.hex":"Цвет HEX","color_picker.invalid_hex":"Введите цвет HEX из 3 или 6 цифр","color_picker.confirm":"ОК","btn.properties":"Свойства","btn.keep_as_walls":"Оставить стенами","btn.delete_room_keep_walls":"Удалить комнату, оставить стены","btn.delete_room_with_walls":"Удалить комнату и стены","title.markup_select":"Выбор и редактирование стен и колонн","title.markup_column":"Колонна: кликните точку сетки для квадратной колонны","markup.partition":"Перегородка","markup.column":"Колонна","markup.hint_column":"кликните точку сетки, чтобы поставить квадратную колонну","history.wall_segment":"Добавление отрезка стены","history.column_add":"Добавление колонны","history.physical_edit":"Изменение физического объекта","history.physical_delete":"Удаление физического объекта","history.physical_move":"Перемещение физического объекта","history.wall_face_batch":"Создание комнат из стен","toast.column_duplicate":"Колонна с тем же центром и внешним размером уже существует","physical.partition_properties":"Свойства перегородки","physical.column_properties":"Свойства колонны","physical.shape":"Форма","physical.square":"Квадрат","physical.circle":"Круг","physical.diameter":"Диаметр","physical.side":"Сторона","physical.rotation":"Угол поворота","physical.length":"Длина","physical.allowed_range":"Допустимо: {min}–{max} {unit}","physical.column_size_title":"Внешняя сторона квадратной колонны, создаваемой кликом (1–150 см).","card.title":"План дома","count.devices":"{n} устр.","empty.no_spaces":"Пространств пока нет.","nav.spaces":"Пространства House Plan","empty.add_first":"Добавьте первое пространство и загрузите план этажа.","empty.read_only":"Пространства не настроены. Попросите администратора добавить первое.","empty.install":"Установите интеграцию House Plan и добавьте запись в «Устройства и службы».","btn.add_space":"Добавить пространство","btn.cancel":"Отмена","btn.save":"Сохранить","btn.close":"Закрыть","btn.delete":"Удалить","btn.copy":"Копировать","btn.edit":"Редактировать","btn.open_in_ha":"Открыть в HA","btn.reset":"Сброс","btn.attach":"Прикрепить…","btn.upload":"Загрузить…","btn.replace":"Заменить…","title.zoom_in":"Приблизить","title.zoom_out":"Отдалить","title.zoom_fit":"Вписать всё","title.configure_space":"Настроить пространство","title.add_space":"Добавить пространство","title.markup_add":"Стены: рисуйте непрерывную цепочку; каждый принятый отрезок сохраняется отдельно. Shift фиксирует 45°","title.markup_merge":"Объединить: клик по одной комнате, затем по соседней с общей стеной","title.markup_split":"Разделить комнату: клик по комнате, затем две точки на её стенах","title.markup_delroom":"Удалить комнату: кликните внутри комнаты и подтвердите удаление","title.need_plan":"Загрузите подложку (план этажа)","markup.add":"Стены","markup.merge":"Объединить","markup.split":"Разделить","markup.resize":"Размер","title.markup_resize":"Изменение размера комнат: тяните доступную ручку горизонтальной или вертикальной стены","markup.hint_resize":"тяните доступную ручку стены · стена упирается в первую небезопасную позицию · Esc — отмена · Ctrl+Z — отмена шага","resize.disabled.diagonal":"Стена расположена под углом: Resize поддерживает только горизонтальные и вертикальные стены","resize.disabled.side-angle":"Примыкающая стена расположена под углом: для Resize обе примыкающие стены должны образовывать прямой угол","resize.disabled.duplicate-physical-wall":"Стену перекрывает отдельная перегородка или колонна; удалите или переместите её перед изменением размера","resize.disabled.partial-shared":"Соседняя комната использует только часть этой стены, поэтому её нельзя безопасно двигать как одну общую стену","resize.disabled.unequal-shared":"У соседней комнаты другие конечные точки или длина стены, поэтому стены нельзя безопасно двигать вместе","resize.disabled.multiple-rooms":"Перемещение затронуло бы больше двух комнат","resize.disabled.thickness-conflict":"Толщину стены нельзя безопасно сохранить","resize.disabled.opening-conflict":"Проём на этой стене нельзя безопасно переместить","resize.disabled.invalid-geometry":"Эту стену нельзя переместить без изменения структуры плана","resize.limit_stopped":"Стена остановлена: дальше нарушается ограничение стыков","resize.commit_failed":"Изменение размера отменено: итоговый план не прошёл проверку геометрии","resize.preview_failed":"Стена остановлена в последней безопасной позиции: геометрию плана нельзя сохранить без потерь","markup.opening":"Проём","markup.delete_room":"Удалить комнату","history.undo":"Отменить","history.redo":"Повторить","history.undo_named":"Отменить: {name} (Ctrl+Z)","history.redo_named":"Повторить: {name} (Ctrl+Shift+Z / Ctrl+Y)","history.undo_empty":"Нет операций для отмены","history.redo_empty":"Нет операций для повтора","history.undone":"Отменено: {name}","history.redone":"Повторено: {name}","history.add_room":"Создание комнаты","history.split_room":"Разделение комнаты","history.merge_rooms":"Объединение комнат","history.resize_room":"Изменение размера комнаты","history.wall_thickness":"Изменение толщины стены","history.add_opening":"Добавление дверного или оконного проёма","history.edit_opening":"Изменение проёма","history.move_opening":"Перемещение проёма","history.delete_opening":"Удаление проёма","history.delete_room_keep_walls":"Удаление комнаты с сохранением стен","history.delete_room_with_walls":"Удаление комнаты и её стен","history.decor_add":"Добавление объекта декора","history.decor_edit":"Изменение объекта декора","history.decor_move":"Перемещение объекта декора","history.decor_transform":"Трансформация объекта декора","history.decor_delete":"Удаление объекта декора","history.backdrop_transform":"Трансформация подложки плана","history.device_move":"Перемещение: {name}","history.device_stale":"История позиций больше неприменима и была очищена","opening.new":"Новый проём","opening.edit":"Проём","opening.door":"Дверь","opening.window":"Окно","opening.gate":"Ворота","opening.passage":"Открытый проём","opening.passage_binding_warning":"При сохранении датчик открытия и замок будут удалены.","opening.invalid_passage_fields":"У открытого проёма на плане «{room}» есть недопустимые параметры: {fields}.","opening.type_label":"Тип","opening.length_label":"Длина, см","opening.contact_label":"Датчик открытия","opening.lock_label":"Замок","opening.none":"— нет —","opening.search_ph":"Поиск: имя или entity_id…","opening.invert":"Инвертировать открыто/закрыто","opening.flip_h":"Петли с другой стороны","opening.flip_v":"Открывается в другую сторону","opening.open":"Открыто","opening.closed":"Закрыто","opening.locked":"Заперто","opening.unlocked":"Не заперто","opening.state_unknown":"недоступно","opening.no_entities":"Датчики не привязаны — статичный символ на плане.","toast.opening_no_wall":"Кликните рядом со стеной комнаты или независимой стеной","opening.host_partition":"Независимая стена","opening.partition_orphan":"Независимая стена этого проёма больше не существует","opening.partition_jamb_margin":"Оставьте от края проёма до торца стены минимум {distance}","opening.rebind_partition":"Привязать к другой независимой стене","confirm.delete_partition_openings_title":"Удалить стену и проёмы?","confirm.delete_partition_openings_body":"В стене есть проёмы: {count}. Они будут удалены вместе со стеной.","confirm.delete_partition_openings_item":"• {type}, {length}","markup.hint_points":"точек: {n} · Shift — шаг 45° · Esc — завершить цепочку · Ctrl+Z — убрать точку · при замыкании будет предложена комната","markup.hint_start":"кликните точку сетки, чтобы начать цепочку стен","tip.lqi":"средний сигнал zigbee:","tip.area":"площадь: {value}","info.device_header":"Устройство на плане","info.model":"Модель","info.state":"Состояние","info.link":"Ссылка","info.manuals":"Инструкции","info.none":"Нет дополнительной информации","marker.new_device":"Новое устройство","marker.name_label":"Имя (отображается на плане)","marker.name_ph":"Название","marker.binding_label":"Привязка к устройству HA","marker.binding_disabled":"деактивировано в Home Assistant","marker.virtual_option":"Виртуальное устройство (без привязки)","marker.search_ph":"Поиск устройства / группы…","marker.nothing_found":"ничего не найдено","marker.room_label":"Комната","marker.room_override":" (переопределить размещение)","marker.room_choose":"— выберите комнату —","marker.room_auto":"— по зоне устройства (авто) —","marker.icon_label":"Иконка","marker.icon_ph":"mdi:… (пусто = авто)","marker.display_label":"Отображение","display.badge":"Значок + состояние","display.icon_ripple":"Значок + состояние и активность","display.static_icon":"Всегда статичный значок","marker.display_hint_badge":"Значок и динамическая подложка показывают состояние устройства без обычной пульсации активности. Красная тревога сохраняется.","marker.display_hint_icon_ripple":"Значок, динамическая подложка и пульсация: короткая — для событий, постоянная — для работы, движения или присутствия. Красная тревога имеет отдельный приоритет.","marker.display_hint_value":"Значок заменяется выбранным или автоматически найденным значением Home Assistant; подложка продолжает показывать состояние. Красная тревога сохраняется.","marker.display_hint_static_icon":"Подложка в цветах темы и значок всегда остаются одинаковыми. Состояния, активность, недоступность и тревоги не меняют отображение.","marker.static_alarm_warning":"Это устройство может сообщать о тревогах. Статичный режим скрывает визуальную тревогу маркера.","marker.preview.title":"Предпросмотр отображения","marker.preview.actual":"Сейчас","marker.preview.example":"Пример","marker.preview.integration":"Интеграция","marker.preview.source":"Источник отображения","marker.preview.current_state":"Текущее состояние","marker.preview.result":"На плане","marker.preview.details":"Подробнее об источниках","marker.preview.select_source":"Выберите устройство или сущность Home Assistant, чтобы увидеть фактическое отображение.","marker.preview.unknown_provider":"Интеграция неизвестна","marker.preview.virtual_provider":"House Plan · виртуальное устройство","marker.preview.no_source":"Нет активного источника","marker.preview.no_state":"Нет текущего состояния","marker.preview.mixed_states":"Несколько разных состояний","marker.preview.multiple_sources":"Источников: {n}","marker.preview.more_sources":"ещё {n}","marker.preview.scaled":"Предпросмотр уменьшен до {n}%, чтобы поместиться. Сохранённый размер не изменится.","marker.preview.demo_short":"Показать краткую активность","marker.preview.demo_continuous":"Показать постоянную активность","marker.preview.stop_continuous":"Остановить постоянную активность","marker.preview.demo_short_notice":"Пример краткой активности; фактическое состояние устройства не меняется.","marker.preview.demo_continuous_notice":"Пример постоянной активности; фактическое состояние устройства не меняется.","marker.preview.demo_already_visible":"Текущее состояние уже показывает реальную активность или тревогу.","marker.preview.reduced_motion":"В системе включено уменьшение движения, поэтому обычная активность показана точкой.","marker.preview.reason.neutral":"Нейтральная тёмная подложка","marker.preview.reason.working":"Жёлтая подложка: устройство сейчас работает","marker.preview.reason.working_activity":"Жёлтая подложка и эффект активности: устройство сейчас работает","marker.preview.reason.open":"Оранжевая подложка: физически открыто или разблокировано","marker.preview.reason.cover_icon_state":"Нейтральная подложка; состояние и значок определяет сущность шторы или заслонки","marker.preview.reason.presence":"Эффект активности, пока обнаружено присутствие","marker.preview.reason.event":"Короткий эффект активности после события","marker.preview.reason.transition":"Эффект активности во время движения или смены состояния","marker.preview.reason.media_neutral":"Медиаустройство остаётся на нейтральной тёмной подложке, пока доступно","marker.preview.reason.unavailable":"Приглушённая нейтральная подложка: отключено или недоступно","marker.preview.reason.alarm":"Красная тревожная подложка; тревога отображается всегда","marker.preview.reason.live_states_disabled":"Оформление по живым состояниям отключено в настройках карточки","marker.preview.reason.value_no_state":"Нет подходящего значения состояния — вместо него показан значок","marker.preview.reason.value_ambiguous_sources":"Подходит несколько источников значения — вместо него показан значок","marker.preview.reason.value_non_scalar":"Источник вернул не простое значение — вместо него показан значок","marker.preview.reason.value_virtual":"У виртуального устройства нет значения HA — вместо него показан значок","marker.preview.reason.vacuum_live_plan_only":"Живая позиция и след пылесоса доступны только на полном плане","marker.preview.reason.hidden_design_preview":"Устройство скрыто на плане, но его оформление видно в предпросмотре","marker.preview.reason.composite_power_source":"Состояние берётся из сущности питания устройства; вспомогательные переключатели не учитываются","marker.preview.reason.activity_display_disabled":"Выбранный режим отображения не показывает обычные эффекты активности","marker.preview.reason.ha_disabled":"Привязка отключена в Home Assistant, поэтому устройство будет скрыто на плане","marker.preview.reason.orphaned":"Сохранённая привязка Home Assistant больше не найдена","marker.preview.reason.static_icon":"Статичный режим: состояние устройства не меняет значок","marker.activity_color":"Цвет пульсации активности","marker.ripple_size":"Размер пульсации активности","marker.activity_alarm_note":"Цвет и размер относятся только к обычной активности и не влияют на красную тревогу.","marker.pulse_a11y_alarm":"Тревога","marker.pulse_a11y_event":"Недавнее событие","marker.pulse_a11y_presence":"Обнаружено присутствие","marker.pulse_a11y_transition":"Изменение состояния","marker.pulse_a11y_running":"Работает","marker.state_a11y_neutral":"Обычное состояние","marker.state_a11y_working":"Работает","marker.state_a11y_open":"Открыто","marker.state_a11y_locked":"Заблокировано","marker.state_a11y_unlocked":"Разблокировано","marker.state_a11y_alarm":"Тревога","marker.state_a11y_unavailable":"Недоступно","marker.lqi_a11y_low":"LQI {value}, слабый сигнал","marker.lqi_a11y_mid":"LQI {value}, средний сигнал","marker.lqi_a11y_high":"LQI {value}, сильный сигнал","marker.size_label":"Размер / поворот значка","marker.angle_label":"Поворот","marker.model_label":"Модель","marker.model_ph":"напр. Aqara T&H","marker.link_label":"Ссылка","marker.desc_label":"Описание","marker.desc_ph":"Заметки, характеристики…","marker.manuals_label":"Инструкции (PDF и т.п.)","marker.sub_device":"устройство","marker.sub_z2m_group":" · Z2M-группа","marker.sub_group":"группа","marker.sub_helper":"хелпер","space.new":"Новое пространство","space.copy_title":"Копирование пространства","space.copy_name":"Название нового пространства","space.copy_fallback":"Пространство","space.copy_create":"Создать копию","space.copy_optimize_title":"Оптимизировать перед копированием?","space.copy_optimize_body":"Перед созданием «{name}» House Plan должен оптимизировать весь план, включая другие пространства. Продолжить?","space.copy_optimize_confirm":"Оптимизировать и скопировать","space.copy_error_changed":"План изменился, пока было открыто подтверждение. Проверьте его и повторите попытку.","space.copy_error_source_missing":"Исходного пространства больше нет. Снова откройте его настройки и повторите попытку.","space.copy_error_source_invalid":"House Plan не смог проверить все стены этого пространства. Исправьте исходное пространство и повторите попытку.","space.copy_error_spaces_limit":"В House Plan уже создано максимальное число пространств.","space.copy_error_partitions_limit":"В этом пространстве слишком много стен для копирования.","space.copy_error_openings_limit":"В этом пространстве слишком много проёмов для копирования.","space.copy_error_decor_limit":"В этом пространстве слишком много элементов подложки для копирования.","space.copy_error_columns_limit":"В этом пространстве слишком много колонн для копирования.","space.copy_error_opening_host":"Один из проёмов больше не привязан к стене. Исправьте или удалите его перед копированием.","space.copy_error_geometry":"Копия создаст небезопасную геометрию стен. Исправьте исходное пространство и повторите попытку.","space.copy_error_optimize_geometry":"Копирование остановлено: оптимизация всего плана небезопасна для одного из пространств.","space.header":"Пространство","space.title_label":"Название","space.title_ph":"Например: Гараж","space.plan_label":"Подложка (план)","space.no_plan":"нет подложки","space.plan_alt":"план","room.new":"Новая комната","room.name_label":"Отображаемое имя","room.name_ph":"Например: Терраса","room.area_label":"Зона Home Assistant (свободные)","room.no_area_option":"— без зоны —","room.default_name":"Комната","device.unnamed":"без имени","device.light_group":"группа света","device.fallback":"устройство","device.virtual":"виртуальное устройство","confirm.delete_room_title":"Удалить комнату «{name}»?","confirm.delete_room_body":"Выберите, нужно ли оставить физические стены, принадлежащие только этой комнате. Общие с другой комнатой стены сохраняются всегда.","confirm.remove_marker_title":"Удалить устройство с плана?","confirm.remove_marker_body":"Устройство исчезнет полностью и перестанет участвовать в данных плана. Позже его можно будет добавить заново.","confirm.erase_decor":"Стереть объект «{kind}»? Действие можно отменить из истории редактора.","confirm.delete_space_title":"Удалить пространство?","confirm.delete_space_body":"Пространство, все его комнаты и вся разметка плана будут удалены.","confirm.delete_space_vac_routes":"Также будет снято сопоставление карт роботов: {count}.","space.delete_blocked":"Это пространство всё ещё используется устройствами: {n}. Сначала перенесите их в другое пространство или удалите.","toast.pos_save_failed":"Не удалось сохранить позицию: {err}","toast.no_entity":"У устройства нет подходящей сущности","toast.ha_disabled_action":"Деактивированный объект Home Assistant нельзя использовать на плане.","toast.ha_disabled_show_device":"Деактивированное в Home Assistant устройство нельзя показать на плане. Сначала активируйте его в Home Assistant.","toast.ha_disabled_show_entity":"Деактивированную в Home Assistant сущность нельзя показать на плане. Сначала активируйте её в Home Assistant.","toast.ha_disabled_add":"Деактивированный объект Home Assistant нельзя добавить на план. Сначала активируйте его в Home Assistant.","toast.ha_binding_unverified":"Статус объекта не удалось подтвердить по реестру Home Assistant. Отображение и действия временно недоступны.","toast.markup_needs_server":"Разметка доступна после переноса конфига на сервер","toast.space_order_changed":"Порядок изменён. Если где-то этаж карточки задан номером, проверьте такие панели.","toast.conflict":"Конфиг изменён в другом окне — данные обновлены, повторите последнее действие","toast.cfg_save_failed":"Не удалось сохранить конфиг: {err}","toast.room_overlap":"Контур накладывается на комнату «{name}» — комнаты не должны накладываться","toast.contour_cannot_close":"Контур нельзя замкнуть: он вырожден или пересекает сам себя","toast.merge_not_adjacent":"Объединять можно только комнаты с общей стеной","toast.rooms_merged":"Комнаты объединены в «{name}»","toast.split_pick_wall":"Начните разрез на стене комнаты","toast.split_bad_cut":"Разрез — от стены до стены внутри комнаты, без пересечения стен и самого себя","merge.header":"Объединение комнат","merge.hint":"У объединённой комнаты одно имя и одна зона. Вторая зона освобождается — её устройства уйдут с плана, пока их не заберёт другая комната.","merge.keep":"Оставить","merge.no_area":"без зоны","toast.room_saved":"Комната сохранена ({n}). Устройств добавлено: {added}. Обведите следующую или выйдите из разметки.","toast.room_saved_no_area":"Комната сохранена ({n}, без зоны). Обведите следующую или выйдите из разметки.","toast.marker_needs_server":"Редактирование устройств доступно после переноса конфига на сервер","toast.virtual_name_required":"Укажите имя виртуального устройства","toast.marker_saved":"Устройство сохранено","toast.marker_removed":"Устройство удалено с плана","toast.integration_missing":"Интеграция House Plan не установлена — управление недоступно","toast.plan_formats":"Поддерживаются SVG, PNG, JPG, WebP","toast.plan_required":"Загрузите подложку — план этажа обязателен","toast.space_added_onboard":"Пространство добавлено. Обведите комнаты: кликайте по точкам сетки и замкните контур.","toast.space_added":"Пространство добавлено","toast.space_copied":"Пространство «{name}» создано","toast.space_saved":"Пространство сохранено","toast.space_deleted":"Пространство удалено","toast.delete_failed":"Ошибка удаления: {err}","toast.error":"Ошибка: {err}","toast.toggle_target_unavailable":"Цель «{name}» недоступна — действие не выполнено","toast.toggle_targets_unavailable":"Цели недоступны: {names}. Действие не выполнено","toast.file_failed":"Файл «{name}» не загружен: {err}","toast.files_attached":"Прикреплено файлов: {n}","err.unknown":"неизвестная ошибка","err.code":"код {code}","err.too_large":"файл больше {mb} МБ","err.bad_ext":"недопустимый тип (нужен PDF/изображение)","err.unauthorized":"нужны права администратора","editor.title":"Заголовок","editor.default_floor":"Стартовое пространство","editor.default_floor_missing":"Стартовое пространство «{id}» больше не существует. Выберите другое.","editor.floor":"Закреплённое пространство","editor.floor_none":"— не закреплять —","editor.floor_index":"YAML-индекс {index} (сохранён)","fixed_floor.loading":"Загружаем закреплённое пространство…","fixed_floor.invalid_title":"Закреплённое пространство недоступно","fixed_floor.invalid_body":"Проверьте floor в конфигурации карточки. Настроенное значение: {value}","editor.icon_size":"Размер иконок, % ширины плана","editor.show_temperature":"Показывать температуру","editor.live_states":"Живые состояния (вкл/выкл, открыто…)","editor.light_pools":"Световые пулы и тени от стен","editor.show_signal":"Показывать сигнал zigbee (LQI)","editor.language":"Язык интерфейса","editor.lang_auto":"Авто (профиль HA)","title.icon_rules":"Правила иконок: какая MDI-иконка достаётся устройству по имени","rules.title":"Правила иконок","rules.hint":"Правила проверяются сверху вниз по строке «имя устройства + модель» (regex без учёта регистра); срабатывает первое совпадение. Если ничего не подошло — решает device class сущности, затем — иконка-заглушка.","rules.pattern_ph":"regex, напр. розетк|plug","rules.icon_ph":"mdi:power-socket-de","rules.add":"Добавить правило","rules.reset":"Сбросить к умолчаниям","rules.test_ph":"Проверьте имя устройства…","rules.invalid":"некорректный regex","rules.saved":"Правила иконок сохранены","btn.up":"Вверх","btn.down":"Вниз","tap.info":"Карточка устройства","tap.more_info":"Диалог HA (more-info)","tap.toggle":"Переключить состояние","marker.tap_label":"Действие по нажатию для этого устройства","tap.toggle_note":"Под селектором показано, какое состояние изменится. Защищённые устройства не переключаются с плана.","import.title":"Создать пространства из этажей HA","import.hint":"Home Assistant уже знает эти этажи. Отметьте, какие превратить в пространства плана — далее для каждого попросим картинку плана. Комнаты затем обводятся вручную по плану.","import.start":"Создать: {n}","import.manual":"Начать с нуля","import.progress":"Этаж {i} из {n}","import.done":"Пространства созданы. Обведите комнаты: кликайте по точкам сетки и замкните контур.","btn.skip":"Пропустить","space.scale_label":"Масштаб (размер клетки сетки)","space.cell_cm.help":"Связывает сетку с реальными размерами: от значения зависят длины и площади, толщина стен, размеры проёмов и радиус свечения. Изменение после разметки меняет расчётные размеры всего пространства, но не двигает его точки на плане.","space.cell_cm.help.aria":"Подсказка: масштаб пространства","space.scale_unit":"см на клетку","space.scale_unit_imperial":"дюйм на клетку","space.display_section":"Отображение","space.show_borders":"Всегда отображать границы комнат","space.zero_wall_style":"Стены нулевой толщины","space.zero_wall_style.help":"Пунктирные стены нулевой толщины пропускают Glow и солнечные лучи, сплошные блокируют их как барьер нулевой площади. Выбор меняет все такие стены пространства, даже когда их линии скрыты в просмотре.","space.zero_wall_style.help.aria":"Подсказка: вид стен нулевой толщины","space.zero_wall_dashed":"Пунктирные","space.zero_wall_solid":"Сплошные","space.show_names":"Отображать названия комнат (перетаскиваются)","space.room_color":"Цвет границ и названий","space.opacity":"Прозрачность","space.fill_label":"Заливка комнат","space.fill_mode.help":"«Свой цвет» задаёт оформление, а «Свет», «Температура» и «LQI» используют текущие данные Home Assistant; Glow включается отдельно.","space.fill_mode.help.aria":"Подсказка: режим заливки комнат","fill.none":"Нет","fill.lqi":"По силе зигби-сигнала","fill.light":"По освещению","fill.custom":"Свой цвет","space.custom_fill":"Цвет заливки","space.source_file":"У меня есть картинка плана","space.source_draw":"Нет подложки — нарисую комнаты вручную","fill.temp":"По температуре","tip.temp_avg":"средняя температура:","tip.hum_avg":"средняя влажность:","space_card.button":"Перейти к пространству","space_card.not_found":"Пространство «{id}» не найдено","space_card.loading":"Загрузка…","continuity.restore_plan":"Восстанавливаем план…","continuity.restore_connection":"Восстанавливаем подключение к устройствам…","continuity.retry":"Повторить","editor.space":"Пространство","editor.framing":"Кадрирование","editor.fit_content":"Всё видимое содержимое","editor.fit_house":"Плотно по геометрии дома","editor.show_button":"Показывать кнопку","editor.button_label":"Текст кнопки","editor.button_target":"Путь дашборда (куда вести)","marker.sub_entity":"сущность","title.general_settings":"Общие настройки","title.export_pdf":"Сохранить в PDF","pdf.title":"Сохранение в PDF","pdf.dimensions":"Отображать размеры и площади","pdf.decor":"Отображать мебель и другой декор","pdf.room_names":"Отображать названия комнат","pdf.backdrop":"Отображать подложку","pdf.save":"Сохранить","pdf.saving":"Формируем…","pdf.failed":"Не удалось создать PDF.","pdf.too_large":"Размер изображений превышает лимит PDF 25 МБ.","pdf.asset_failed":"Не удалось загрузить подложку или изображение декора.","pdf.scale":"Масштаб 1:{n}","pdf.north":"Север","gs.title":"Общие настройки","gs.light_group":"Заливка: освещение","gs.light_on":"Свет включён","gs.light_off":"Весь свет выключен","gs.temp_group":"Заливка: температура","gs.temp_cold":"Холодно","gs.temp_ok":"Комфорт","gs.temp_hot":"Жарко","gs.lqi_group":"Заливка: зигби-сигнал","gs.lqi_low":"Слабый сигнал","gs.lqi_high":"Сильный сигнал","gs.reset":"Сбросить к умолчаниям","gs.saved":"Общие настройки сохранены","gs.radar_show_live":"Показывать текущее присутствие на плане","gs.radar_show_live_hint":"Скрывает или показывает все живые цели радаров. Это не запускает и не останавливает запись наблюдений.","radar.title":"Присутствие на плане","radar.help":"Свяжите маркер с точными сущностями радара Home Assistant, укажите положение датчика и профиль координат. Живые позиции обрезаются по выбранной комнате.","radar.help.aria":"Подсказка: настройки радара присутствия","radar.enabled":"Использовать этот радар присутствия","radar.show_live":"Показывать живые цели","radar.configure":"Настроить радар","radar.configure_on_plan":"Настроить на плане","radar.change_installation":"Сменить установку","radar.no_contour":"У комнаты нет контура. Точки радара не будут обрезаться по комнате.","radar.discard_setup_title":"Отменить настройку радара?","radar.discard_setup":"Несохранённая настройка радара будет потеряна.","radar.step_place_mount":"Укажите физическое положение датчика","radar.step_place_heading":"Укажите точку прямо перед датчиком","radar.step_reference":"Укажите контрольное положение {n}, затем начните измерение","radar.step_check_reference":"Укажите независимое проверочное положение","radar.start_measure":"Начать измерение","radar.countdown":"Встаньте в отмеченное место через {seconds} с","radar.capturing":"Стойте неподвижно и в одиночестве…","radar.fit_ready":"Калибровка готова","radar.check_third":"Проверить в другом положении","radar.check_complete":"Независимая проверка завершена","radar.error_distance":"Расхождение положения: {distance}","radar.ambiguous_target":"Обнаружено несколько целей. Повторите измерение в одиночестве.","radar.insufficient_samples":"Недостаточно актуальных координат. Повторите или настройте вручную.","radar.bad_references":"Выберите разнесённые положения в разных направлениях от датчика.","radar.ambiguous_sources":"Измерения допускают два одинаково вероятных направления. Выберите точки, по которым можно различить левую и правую стороны.","radar.bad_fit":"Измерения не совпадают. Проверьте единицы, положение датчика и контрольные точки.","radar.desktop_hint":"Для точной настройки используйте компьютер. Редактирование на тач-устройствах поддерживается по остаточному принципу.","radar.detected":"House Plan распознал признаки радара у этого устройства. Перед сохранением проверьте точные источники.","radar.detected_ld2450":"House Plan нашёл набор координат ESPHome LD2450. Перед сохранением проверьте точные источники X/Y.","radar.additional_actions":"Дополнительные действия","radar.declare":"Это радар присутствия","radar.profile":"Профиль данных","radar.profile_esphome_ld2450_v1":"ESPHome LD2450 (цели X/Y)","radar.profile_cartesian_v1":"Декартовы цели (X/Y)","radar.profile_polar_v1":"Полярная цель (дальность/угол)","radar.profile_range_v1":"Только дальность","radar.profile_zones_v1":"Состояния зон","radar.profile_presence_v1":"Только присутствие","radar.room":"Комната радара","radar.room_choose":"Выберите комнату","radar.target":"Цель {n}","radar.axis_x":"Сущность координаты X","radar.axis_y":"Сущность координаты Y","radar.add_target":"Добавить слот цели","radar.range_channel":"Канал дальности {n}","radar.add_range":"Добавить канал дальности","radar.presence_gate":"Сущность присутствия для слота","radar.swap_axes":"Поменять оси X и Y местами","radar.axis_x_sign":"Направление X","radar.axis_y_sign":"Направление Y","radar.distance_source":"Сущность дальности","radar.angle_source":"Сущность угла","radar.angle_unit":"Единица угла","radar.degrees":"Градусы","radar.radians":"Радианы","radar.angle_zero":"Направление нулевого угла","radar.angle_forward":"Вперёд","radar.angle_right":"Вправо","radar.angle_clockwise":"Угол растёт по часовой стрелке","radar.zone_source":"Сущность зоны","radar.occupancy_source":"Сущность присутствия","radar.count_source":"Сущность количества целей","radar.availability_source":"Сущность доступности","radar.source_choose":"Выберите сущность","radar.source_optional":"Необязательно","radar.source_missing":"сейчас недоступна","radar.saved_unsupported":"Сохранённая настройка радара не поддерживается или неполна. Она неактивна; удалите её либо обновите House Plan перед повторной настройкой.","radar.occupancy":"Присутствие (вкл/выкл)","radar.count":"Количество","radar.mount":"Положение и направление","radar.mount_hint":"Это физическое положение датчика. Перемещение его декоративного маркера не меняет установку.","radar.heading":"Направление, °","radar.range_cm":"Дальность, см","radar.fov_deg":"Угол обзора, °","radar.unit":"Единица источника","radar.mirror":"Отразить ось влево/вправо","radar.remove":"Удалить настройки радара","radar.invalid":"Перед сохранением заполните комнату, источники и положение радара.","radar.check_sources":"Проверить живые данные","radar.checking":"Проверяем…","radar.health":"Состояние подключения","radar.live_summary":"Текущих целей: {targets}; дуг дальности: {ranges}","radar.health_ok":"Актуальные данные получены","radar.health_off":"Цели не обнаружены","radar.health_stale":"Часть координат устарела","radar.health_partial":"Часть источников актуальна, часть устарела","radar.health_restricted":"Нет доступа к одному или нескольким источникам","radar.health_incomplete":"Текущий отчёт радара неполон","radar.health_position_unavailable":"Есть присутствие, но актуальное положение недоступно","radar.health_unavailable":"Данные датчика недоступны","radar.health_needs_setup":"Требуется настроить установку","radar.health_inconsistent":"Источники передают противоречивые данные","radar.health_unknown":"Текущее состояние неизвестно","radar.health_disabled":"Радар отключён","radar.error_invalid_radar":"Проверьте настройки радара.","radar.error_invalid_selection":"Выберите существующую комнату и допустимые источники.","radar.error_source_restricted":"Нет доступа ко всем выбранным источникам.","radar.error_rate_limited":"Слишком много запросов. Повторите чуть позже.","radar.error_not_ready":"Обработка данных радара ещё не готова.","radar.error_conflict":"План изменился. Откройте настройку радара заново и повторите попытку.","radar.error_source_unavailable":"Один или несколько выбранных источников радара недоступны.","radar.error_unsupported_capability":"Установленная интеграция не поддерживает эту возможность радара.","radar.report_age":"{seconds} с назад","space.show_lqi":"Показывать зигби-сигнал (LQI) у устройств","space.hide_decor":"Скрыть декоративный слой","space.hide_decor_tip":"Линии, фигуры, надписи и мебель остаются на месте — их видно в редакторе подложки, но не на плане.","space.hide_openings":"Скрыть проёмы","space.hide_openings_tip":"Двери, окна и ворота не рисуются, но продолжают работать: свет проходит, солнце светит в окна, датчики открытия срабатывают. В редакторе плана проёмы видно всегда.","gs.light_none":"Нет источников света","mode.plan":"Редактор плана","mode.devices":"Редактор устройств","display.value":"Значение + состояние","marker.subarea":"без зоны, вручную","device.new":"Новое устройство — откройте его редактор, чтобы снять отметку","opening.unlock_action":"Открыть замок","opening.lock_action":"Закрыть замок","opening.lock_pending":"Выполняется…","title.close_editor":"Закрыть редактор (вернуться к просмотру)","title.add_device":"Добавить устройство на план","devbar.add":"Добавить","devbar.rules":"Правила иконок","device_inbox.button":"Устройства","device_inbox.title":"Устройства на плане","device_inbox.search":"Поиск по устройствам, сущностям и интеграциям…","device_inbox.add_virtual":"Добавить виртуальное устройство","device_inbox.tab_on_plan":"На плане","device_inbox.tab_available":"Доступны","device_inbox.tab_hidden":"Скрытые","device_inbox.tab_readd":"Доступны снова","device_inbox.only_new":"Только новые","device_inbox.show_entities":"Показывать сущности","device_inbox.show_hidden":"Показывать скрытые на плане","device_inbox.show_hidden.help":"Временно показывает на плане скрытые и деактивированные маркеры служебными призраками только в редакторе устройств. Сохранённая видимость устройств не меняется.","device_inbox.show_hidden.help.aria":"Подсказка: показывать скрытые устройства на плане","device_inbox.new":"Новое","device_inbox.find":"Найти на плане","device_inbox.edit":"Настроить","device_inbox.hide":"Скрыть","device_inbox.show":"Показать","device_inbox.add":"Добавить","device_inbox.readd":"Добавить заново","device_inbox.hide_available":"Скрыть из списка","device_inbox.show_more":"Показать ещё","device_inbox.more_actions":"Другие действия","device_inbox.find_hidden_hint":"Сначала включите «Показывать скрытые на плане»","device_inbox.show_disabled":"Перед показом активируйте эту привязку в Home Assistant","device_inbox.empty_on_plan":"На плане пока нет подходящих устройств.","device_inbox.empty_available":"Нет доступных устройств для добавления.","device_inbox.empty_hidden":"Скрытых устройств нет.","device_inbox.empty_readd":"Нет удалённых устройств, доступных для повторного добавления.","device_inbox.reason_visible_auto":"Найдено автоматически","device_inbox.reason_visible_explicit":"Добавлено явно","device_inbox.reason_manual_hidden":"Скрыто пользователем","device_inbox.reason_automatic_hidden":"Скрыто автоматически","device_inbox.reason_service_entry":"Служебная запись реестра","device_inbox.reason_excluded_integration":"Исключена интеграция «{integration}»","device_inbox.reason_excluded_domain":"Непространственный тип сущности","device_inbox.reason_grouped_light":"Представлено группой света комнаты","device_inbox.reason_represented_by_parent":"Представлено родительским устройством","device_inbox.reason_removed":"Ранее удалено с плана","device_inbox.reason_available":"Можно добавить на план","device_inbox.reason_no_bound_room":"Зона HA не связана с комнатой плана","device_inbox.status_ha_disabled":"Отключено в Home Assistant","device_inbox.status_orphaned":"Привязка больше не найдена в Home Assistant","device_inbox.status_unverified":"Реестр Home Assistant временно недоступен","device_inbox.saved":"Список устройств обновлён","device_inbox.filters_excluded":"Исключённые интеграции","device_inbox.filters_group_lights":"Объединять светильники комнаты в один маркер","device_inbox.filters_preview_appear":"появится: {count}","device_inbox.filters_preview_hide":"скроется: {count}","device_inbox.filters_preview_lights":"затронет светильников: {count}","device_inbox.filters_reset":"Вернуть рекомендуемые","device_inbox.filters_save":"Сохранить фильтры","device_inbox.filters_search_ph":"Добавить интеграцию…","device_inbox.filters_title":"Фильтры обнаружения","space.roomcard_section":"В карточке комнаты:","space.label_temp":"Температура","space.label_hum":"Влажность","space.label_lqi":"Средний Zigbee-сигнал","space.label_light":"Свет вкл/выкл","roomcard.light_on":"Вкл","roomcard.light_off":"Выкл","roomcard.light_partial":"{on} из {total}","toast.split_pick_inside":"Промежуточные точки разреза — внутри комнаты","mode.decor":"Редактор подложки","decor.select":"Выбрать","decor.line":"Линия","decor.rect":"Прямоугольник","decor.ellipse":"Овал","decor.text":"Надпись","decor.erase":"Стереть","decor.erase_confirm_title":"Стереть объект?","decor.color":"Цвет","decor.width":"Толщина линии","decor.line_style":"Стиль линии","decor.line_style_solid":"Сплошная","decor.line_style_dashed":"Пунктирная","decor.fill":"Заливка","decor.fill_color":"Цвет заливки","decor.length":"Длина","decor.size":"Размер","decor.flip_h":"Отзеркалить по горизонтали","decor.flip_v":"Отзеркалить по вертикали","decor.angle":"Угол поворота, °","decor.text_size":"Размер текста","decor.backdrop_properties":"Свойства картинки-подложки","decor.text_title":"Надпись","decor.object_title":"Редактирование: {kind}","decor.text_label":"Текст","decor.live_group":"Вставить переменную HA","decor.live_entity":"Сущность","decor.live_entity_ph":"выберите сущность","decor.live_attr":"Значение","decor.live_attr_ph":"выберите состояние или атрибут","decor.live_state":"Состояние","decor.backdrop":"Картинка-подложка","decor.backdrop_hint":"Тяните картинку — перемещение; угол — размер; верхнюю ручку — поворот. Shift меняет пропорции или снимает шаг угла.","decor.backdrop_reset":"Вернуть картинку","decor.backdrop_reset_done":"Картинка вернулась на своё место и в свой размер","marker.icon_auto":"Авто: {icon} (по правилам иконок; выберите свою, чтобы заменить)","marker.icon_pin_auto":"Закрепить","mode.plan_tip":"Редактор плана — геометрия дома: рисование и объединение/разделение комнат, привязка к зонам HA, двери, окна и ворота, карточки комнат, масштаб","mode.devices_tip":"Редактор устройств — всё про значки: перетаскивание, клик — настройка привязки/иконки/отображения, виртуальные устройства, правила иконок","mode.decor_tip":"Редактор подложки — чисто визуальный декор под планом: линии, прямоугольники, овалы и надписи, не реагирующие на клики","space.glow_enabled":"Свечение источников света","gs.glow_group":"Свечение источников света","gs.glow_base":"Темнота дома","gs.glow_light":"Цвет света по умолчанию / интенсивность","gs.wall_group":"Стены","gs.wall_fill":"Цвет заливки стен","gs.glow_radius":"Радиус свечения","gs.glow_radius.help":"Задаёт общий радиус светового пятна в метрах или футах; персональный радиус устройства заменяет это значение.","gs.glow_radius.help.aria":"Подсказка: общий радиус свечения","gs.unit_m":"м","gs.unit_ft":"фут","marker.controls_label":"Управляет другими источниками света","marker.controls.help":"При действии «Переключить состояние» перечисленные источники переключаются вместе с этим маркером. Их световые пятна остаются у собственных маркеров, а эта связь сама по себе не делает управляющий маркер источником света.","marker.controls.help.aria":"Подсказка: управление другими источниками света","marker.controls_filter":"Поиск ламп и выключателей…","info.controls":"Управляет","marker.glow_radius_label":"Радиус свечения","marker.glow_radius.help":"Задаёт радиус свечения в метрах или футах; пустое значение использует радиус из общих настроек.","marker.glow_radius.help.aria":"Подсказка: радиус свечения","markup.wallthick":"Толщина","markup.select":"Выбрать","title.markup_wallthick":"Толщина — клик по стене задаёт толщину от 0 до 100 см.","markup.hint_wallthick":"клик по стене · Esc закрывает без применения","wallthick.field":"Толщина","wallthick.unit_cm":"см","wallthick.unit_in":"дюйм","wallthick.apply_room":"Применить ко всем стенам комнаты","markup.draw_wall_title":"Толщина каждого нового сегмента стены (0–100 см). Общие стены сохраняют существующее значение.","room.queue_progress":"Комната {current} из {total}","toast.wall_rooms_saved":"Создано комнат: {n}","toast.wall_chain_saved":"Цепочка стен сохранена","toast.wallthick_pick":"Кликните по стене","toast.wallthick_set":"Толщина стены задана","toast.wallthick_cleared":"Толщина стены убрана","toast.physical_range":"Введите значение от {min} до {max} {unit}","toast.zero_wall_opening_conflict":"Сначала удалите проём на этом участке стены.","toast.zero_wall_ambiguous":"Не удалось однозначно выбрать участок стены. Уточните геометрию узла.","toast.zero_wall_migration_blocked":"Пространство не преобразовано: {reason}. Данные не изменены.","toast.physical_angle":"Введите угол поворота от 0° до 90°, не включая 90°","toast.physical_limit":"В пространстве достигнут лимит объектов этого типа","toast.geometry_unsafe":"Изменение отменено: геометрию стен нельзя безопасно построить.","junction.limit_angle":"Слишком острый угол между стенами: {actual}°, минимум {limit}°.","junction.limit_valence":"Слишком много стен в одном узле: {actual}, максимум {limit}.","junction.limit_length":"Слишком короткий участок стены: {actual} см, минимум {limit} см.","junction.limit_distance":"Стены и узлы слишком близко: {actual} см, минимум {limit} см.","junction.limit_clearance":"Внутри комнаты не остаётся места: {actual} см², минимум {limit} см².","junction.limit_check_failed":"Проверку стыков выполнить не удалось — изменение не сохранено","toast.wall_model_migration_blocked":"Не удалось обновить модель стен: {reason}. План не изменён. Запустите «Оптимизировать планы»; если ошибка повторится, исправьте конфликтующую геометрию стен.","toast.wall_model_client_outdated":"Обновите карточку и перезагрузите страницу перед редактированием плана.","wall_model.reason.invalid-room":"некорректный контур комнаты","wall_model.reason.zero-length":"отрезок стены нулевой длины","wall_model.reason.third-owner":"стена принадлежит более чем двум комнатам","wall_model.reason.duplicate-id":"конфликт идентификаторов стен","wall_model.reason.thickness-conflict":"конфликт значений толщины стены","wall_model.reason.opening-host":"проём нельзя однозначно привязать к стене","toast.delete_room_pick":"Кликните внутри комнаты, которую нужно удалить","toast.plan_snap_ambiguous":"Увеличьте масштаб, чтобы выбрать узел стены","toast.wall_repair_ambiguous":"У контура несколько возможных соединений. Увеличьте масштаб и соедините стены явно.","toast.wall_repair_too_large":"Разрыв больше 2 см. Соедините стены перед созданием комнаты.","toast.wall_repair_changed":"Геометрия стен изменилась. Попробуйте создать комнату ещё раз.","toast.opening_on_zero_wall":"Проёмы на стене нулевой толщины запрещены","marker.from_ha_option":"Выбрать из списка HA","marker.show_entities":"Показывать сущности","marker.show_entities_tip":"Добавляет в список не только устройства, но и все их сущности","marker.pick_ph":"Выберите устройство…","room.open_area":"Открыть зону в HA","room.fit_action":"Вписать комнату {name}","view.volumetric":"Объёмный вид","view.flat":"Плоский вид","kiosk.title":"Размеры на этом экране","kiosk.hint":"Хранится только на этом устройстве — у каждого настенного планшета или ТВ свои удобные размеры.","kiosk.icon_scale":"Размер значков устройств","kiosk.font_scale":"Размер текста карточек комнат","editor.kiosk":"Режим настенного устройства (киоск)","editor.cycle":"Автосмена пространств каждые N секунд (киоск, 0 = выкл)","room.settings_title":"Настройки комнаты","room.settings_section":"Настройки комнаты (переопределяют пространство)","room.fill_label":"Заливка в ЭТОЙ комнате","fill.inherit":"Как у пространства","room.custom_fill_space":"Цвет пространства","room.custom_fill_own":"Цвет комнаты","room.temp_range_label":"Диапазон комфорта","room.temp_range_min":"Нижняя граница комфортной температуры","room.temp_range_max":"Верхняя граница комфортной температуры","room.temp_range_reset":"Как у пространства","room.temp_range.help":"Диапазон применяется только к этой комнате. Пустое поле наследует соответствующую границу пространства; если границы поменялись местами, House Plan использует меньшую как нижнюю, а большую как верхнюю.","room.temp_range.help.aria":"О диапазоне комфорта комнаты","room.temp_src_label":"Источник температуры","room.hum_src_label":"Источник влажности","room.src_average":"Средняя по датчикам комнаты (по умолчанию)","room.src_pick":"Конкретное устройство или сущность HA","room.src_ph":"Выберите источник…","toast.room_updated":"Комната обновлена","space.card_font":"Размер шрифта карточек комнат (всё пространство)","room.sizes_section":"Размеры шрифтов","room.name_scale":"Размер названия","room.label_scale":"Размер подписей","preview.room_name":"Гостиная","toast.cfg_reload_failed":"Не удалось перечитать план с сервера: {err}","toast.locale_load_failed":"Не удалось загрузить языковой пакет. До перезагрузки страницы используется английский.","toast.furniture_art_load_failed":"Не удалось загрузить изображения мебели. Обновите страницу, чтобы их показать.","room.settings_short":"Настройки комнаты","room.unnamed":"Комната без имени","marker.use_climate_temp":"Учитывать температуру устройства в комнате","marker.use_climate_temp_tip":"Добавляет current_temperature кондиционера или термостата в среднюю температуру комнаты. Внешний бейдж со значением настраивается отдельно ниже.","marker.value_badge_title":"Бейдж со значением","marker.value_badge.help":"Показывает одно выбранное значение рядом со значком. Не влияет на комнатные показатели, свет, Glow и действие по нажатию.","marker.value_badge.help.aria":"Подсказка: бейдж со значением устройства","marker.value_badge_enabled":"Отображать бейдж со значением","marker.value_badge_source":"Значение","marker.value_badge_source.help":"Выберите конкретное состояние, поддерживаемый атрибут или производное значение этого устройства.","marker.value_badge_source.help.aria":"Подсказка: источник значения бейджа","marker.value_badge_position":"Расположение","marker.value_badge_position.help":"Выбранная сторона сохраняется постоянно и не переворачивается автоматически у края плана.","marker.value_badge_position.help.aria":"Подсказка: расположение бейджа","marker.value_badge_right":"Справа","marker.value_badge_bottom":"Снизу","marker.value_badge_left":"Слева","marker.value_badge_top":"Сверху","marker.value_badge_empty":"У этого устройства нет доступных значений","marker.value_badge_static":"Статичный значок не показывает живые значения. Настройка сохранится.","marker.value_badge_missing":"Источник недоступен","marker.value_badge_missing_hint":"Сохранённый источник сейчас недоступен. Можно сохранить его, отключить бейдж или выбрать другой.","marker.value_badge_duplicate":"То же значение уже показано внутри значка.","marker.value_badge_state":"Состояние · {name}","marker.value_badge_marker_state":"Состояние источника света · {name}","marker.value_badge_lqi":"Качество Zigbee-сигнала (среднее)","marker.value_badge_attr_current_temperature":"Текущая температура · {name}","marker.value_badge_attr_temperature":"Целевая температура · {name}","marker.value_badge_attr_current_humidity":"Текущая влажность · {name}","marker.value_badge_attr_humidity":"Влажность · {name}","marker.value_badge_attr_current_position":"Положение · {name}","marker.value_badge_attr_percentage":"Скорость · {name}","marker.value_badge_attr_brightness":"Яркость · {name}","marker.value_badge_attr_volume_level":"Громкость · {name}","marker.value_badge_attr_battery_level":"Заряд батареи · {name}","marker.value_badge_attr_fan_speed":"Скорость вентилятора · {name}","marker.value_source":"Источник значения","marker.value_source.help":"Выберите, что заменит значок. Действие по нажатию не изменится.","marker.value_source.help.aria":"Подсказка: источник значения внутри значка","marker.value_source_auto":"Автоматически (как раньше)","marker.value_source_missing_hint":"Сохранённый источник сейчас недоступен. До его восстановления или выбора другого значения внутри будет показано —.","marker.light_role_label":"Является источником света","marker.light_role.help":"«Авто» использует фактическую роль привязанного устройства, «Всегда» принудительно создаёт собственный источник, а «Никогда» исключает его; связанные лампы выше остаются независимыми.","marker.light_role.help.aria":"Подсказка: является ли устройство источником света","marker.light_role_auto_yes":"Автоматически (источник света)","marker.light_role_auto_no":"Автоматически (не источник света)","marker.light_role_always":"Всегда источник света","marker.light_role_never":"Никогда не источник света","marker.light_entity_label":"Ведущая сущность света","marker.light_entity.help":"Для составного устройства выберите сущность, состояние, цвет и яркость которой представляют этот источник на плане. Автоматический вариант сохраняет совместимость со старыми планами.","marker.light_entity.help.aria":"Подсказка: ведущая сущность света","marker.light_entity_auto":"Автоматически ({entity})","marker.light_entity_none":"нет управляемой сущности","marker.light_entity_missing":"Сохранённая сущность {entity} недоступна. Временно используется {fallback}; выбор восстановится, если сущность вернётся.","marker.toggle_entity_label":"Переключаемая сущность","marker.toggle_entity.help":"Для составного устройства выберите собственную лампу или переключатель, которой управляет нажатие. Автоматический вариант сохраняет прежние правила цели и не зависит от ведущей сущности света.","marker.toggle_entity.help.aria":"Подсказка: переключаемая сущность","marker.toggle_entity_auto":"Автоматически ({entity})","marker.toggle_entity_none":"нет собственной управляемой сущности","marker.toggle_entity_missing":"Сохранённой сущности {entity} больше нет среди выбираемых каналов этого маркера. Временно используется {fallback}; выбор восстановится, если сущность вернётся.","marker.glow_color_label":"Цвет и яркость свечения","marker.glow_mode.help":"Используйте данные источника, задайте только цвет или зафиксируйте цвет и яркость. Минимум — 1%; чтобы отключить источник, выберите «Никогда».","marker.glow_mode.help.aria":"Подсказка: цвет и яркость свечения","marker.glow_mode_auto":"Из источника","marker.glow_mode_color":"Задать цвет","marker.glow_mode_fixed":"Задать цвет и яркость","marker.glow_color":"Цвет свечения","marker.glow_brightness":"Яркость","marker.glow_disabled_never":"Настройки свечения недоступны: маркер явно исключён из источников света.","marker.glow_disabled_auto":"В автоматическом режиме у этого маркера не найден пространственный источник света.","marker.glow_disabled_no_entity":"Для пространственного источника нет активной управляемой сущности Home Assistant.","marker.glow_passive_hint":"У источника нет собственных данных Home Assistant. Задайте цвет и яркость вручную; радиус остаётся доступным.","marker.control_broken":"Сохранённый источник отсутствует или больше не отмечен как источник света","marker.control_missing_label":"Отсутствующий источник на плане","marker.control_passive":"пассивный источник","toast.marker_control_cycle":"Такая связь создаст циклическую цепочку управления светом.","toast.marker_binding_required":"Сначала выберите устройство Home Assistant, затем добавьте управляемый источник света.","confirm.unlock_title":"Открыть замок?","confirm.unlock_body":"House Plan отправит этому замку команду открытия.","toast.files_migrate_failed":"Не удалось перенести вложения к новой привязке, ссылки остались на старые файлы: {err}","space.pick_saved":"Уже загруженные","space.pick_saved_hint":"Планы, сохранённые на сервере, включая отцеплённые ранее","space.no_saved":"На сервере пока нет сохранённых планов.","space.loading":"Загрузка…","space.used_by":"используется: {list}","space.in_use":"План используется пространством — сначала отцепите его","btn.use":"Выбрать","confirm.delete_plan_title":"Удалить файл плана?","confirm.delete_plan_body":"Файл будет удалён с сервера. Это действие нельзя отменить.","toast.plans_list_failed":"Не удалось получить список планов: {err}","toast.plan_delete_failed":"Не удалось удалить план: {err}","marker.hide":"Скрыть","marker.hide_tip":"Устройство исчезнет с плана после сохранения, но продолжит участвовать в расчёте сигнала комнаты. Вернуть его можно через каталог «Устройства» в редакторе устройств.","marker.show":"Показать","marker.show_tip":"Устройство снова появится на плане после сохранения.","marker.hidden_ghost":"Устройство скрыто пользователем","marker.ha_disabled_device":"Устройство деактивировано в Home Assistant и скрыто с плана.","marker.ha_disabled_entity":"Сущность деактивирована в Home Assistant и скрыта с плана.","marker.ha_disabled_all_entities":"У устройства нет активных сущностей Home Assistant, поэтому оно скрыто с плана.","marker.ha_registry_limited":"Полный реестр Home Assistant недоступен этому пользователю. Неподтверждённый объект временно нельзя показывать или использовать.","marker.delete_tip":"Полностью удалить устройство с плана и из всех расчётов. Позже его можно добавить заново.","tap.run":"Запустить автоматизацию/скрипт/сцену","tap.none":"Ничего не делать","marker.run_target_label":"Что запускать","marker.run_search_ph":"Поиск: автоматизация, скрипт или сцена…","marker.run_target_gone":"Цель {id} не найдена — выберите заново","marker.tap_confirm":"Спрашивать подтверждение","marker.tap_confirm_tip":"Перед выполнением показать диалог подтверждения — защита от случайных нажатий.","marker.toggle_hint_single":"Цель: {name} ({id}).","marker.virtual_light_target":"Виртуальный свет: {name}.","marker.virtual_light_current":"Ручное состояние: {state} → {effect}.","marker.virtual_light_state_on":"включён","marker.virtual_light_state_off":"выключен","marker.toggle_hint_group":"Переключатся источники ({count}): {names}.","marker.toggle_hint_current":"Сейчас: {state} → {effect}.","marker.toggle_hint_group_current":"Сейчас включено {on} из {count} → {effect}.","marker.toggle_hint_skipped":"Не будут затронуты ({count}): {targets}.","marker.toggle_effect_turn_on":"включится","marker.toggle_effect_turn_off":"выключится","marker.toggle_effect_open":"откроется","marker.toggle_effect_close":"закроется","marker.toggle_effect_stop":"остановится","marker.toggle_effect_toggle":"состояние переключится","marker.toggle_skip_missing":"не найдено","marker.toggle_skip_ha_disabled":"деактивировано в HA","marker.toggle_skip_unavailable":"недоступно","marker.toggle_skip_unsupported":"переключение не поддерживается","marker.toggle_skip_secure":"заблокировано из соображений безопасности","marker.toggle_none_no_binding":"У устройства нет привязки, состояние переключать нечем. По нажатию ничего не произойдёт.","marker.toggle_none_no_actionable_entity":"У устройства нет состояния, которое можно переключить. По нажатию ничего не произойдёт.","marker.toggle_none_configured_targets_missing":"Настроенные цели сейчас недоступны. Собственная сущность устройства не будет подставлена вместо них.","marker.toggle_none_ha_disabled":"Цель деактивирована в Home Assistant и не может использоваться на плане.","marker.toggle_none_unavailable":"Цель сейчас недоступна. По нажатию ничего не произойдёт.","marker.toggle_none_unsupported":"Для этой сущности Home Assistant не предоставляет безопасного переключения. По нажатию ничего не произойдёт.","marker.toggle_none_secure":"Переключение замков, сигнализации и защитных ворот с плана заблокировано из соображений безопасности.","run.automation":"автоматизация","run.script":"скрипт","run.scene":"сцена","confirm.tap_run":"Запустить «{name}»?","confirm.tap_toggle":"Переключить «{name}»?","confirm.current_state":"Текущее состояние: {state}","confirm.expected_state":"После переключения: {state}","confirm.group_current":"включено {on} из {total}","confirm.group_all_on":"все включены","confirm.group_all_off":"все выключены","confirm.unavailable_targets":"Недоступно: {count}","confirm.expected_by_ha":"Состояние определит Home Assistant","confirm.state_on":"Включено","confirm.state_off":"Выключено","confirm.state_open":"Открыто","confirm.state_closed":"Закрыто","confirm.state_opening":"Открывается","confirm.state_closing":"Закрывается","confirm.state_stopped":"Остановлено","confirm.state_unknown":"Неизвестно","toast.run_started":"Запущено: {name}","toast.run_target_missing":"Цель запуска не найдена — проверьте настройки устройства","toast.run_target_required":"Выберите автоматизацию, скрипт или сцену","toast.tap_target_changed":"Цель действия изменилась. Повторите попытку.","toast.virtual_light_toggle_failed":"Не удалось переключить виртуальный свет: {err}","toast.value_badge_source_required":"Выберите значение для бейджа","btn.run":"Выполнить","vac.section":"Робот-пылесос: живая позиция","vac.autocal":"Настроить автоматически","vac.live":"Живая позиция на плане","vac.trail":"Показывать путь робота","vac.autocal_no_rooms":"Интеграция не отдаёт список комнат — откройте «Подогнать вручную»","vac.route_warn_unmapped":"Робот убирает на карте, которая не сопоставлена ни одному этажу","vac.route_warn_needs_calibration":"Карта сопоставлена этажу, но не откалибрована","vac.route_warn_ambiguous":"Две карты неразличимы — этаж не выбран","vac.route_warn_missing_space":"Пространство этой карты удалено","vac.autocal_no_match":"Не совпали имена комнат (нужно ≥3 общих) — откройте «Подогнать вручную»","vac.autocal_done":"Готово: привязка по {rooms} комнатам. Запустите уборку и проверьте","vac.cal_need_pos":"Робот сейчас не отдаёт координаты — запустите уборку и поставьте на паузу","vac.cal_done":"Калибровка сохранена. Запустите уборку и проверьте","vac.cal_cancelled":"Калибровка отменена","vac.fit":"Подогнать вручную","vac.fit_hint":"Перетащите карту робота на место, растяните за уголки","vac.fit_rotate":"Повернуть 90°","vac.fit_mirror":"Отразить","vac.trail_never":"Не показывать никогда","vac.trail_cleaning":"Во время уборки","vac.trail_always":"Показывать всегда","gs.bg_group":"Фон сцены","gs.bg_color":"Цвет фона вокруг плана","gs.bg_default":"Как в теме","gs.bg_theme":"по умолчанию — из темы","gs.bg_mode":"Фон плана","gs.bg_mode.help":"«Следует за Солнцем» использует sun.sun, а при недоступности — локальные часы браузера; статичный режим всегда показывает выбранный цвет.","gs.bg_mode.help.aria":"Подсказка: общий фон плана","gs.bg_static":"Статичный цвет","gs.bg_daynight":"Следует за Солнцем","gs.sun_group":"Солнце","gs.sun_missing":"Сущность sun.sun не найдена — фон следует локальным часам, а оконные лучи недоступны.","gs.north":"Север на плане","gs.north.help":"Угол отсчитывается по часовой стрелке от верхней вертикали плана; север нужен для оконных лучей, а не для фона «Следует за Солнцем».","gs.north.help.aria":"Подсказка: общее направление севера","gs.north_ph":"не задан","gs.north_clear":"Сбросить","gs.north_letter":"С","gs.sun_rays":"Солнце в окнах","gs.about_version":"Houseplan Card v{v}","gs.about_github":"GitHub · документация и issues","gs.about_telegram":"Чат в Telegram","support.title":"Помощь и обратная связь","space.bg_color":"Цвет фона вокруг плана","space.bg_inherit":"Наследовать общий","space.bg_inherited":"наследуется из общих настроек","space.bg_mode":"Фон плана","space.bg_mode.help":"Выберите наследование общего фона либо переопределите это пространство статичным цветом или режимом «Следует за Солнцем».","space.bg_mode.help.aria":"Подсказка: фон пространства","space.north":"Север на плане (переопределение)","space.north.help":"Переопределяет общий север для этого пространства; угол отсчитывается по часовой стрелке от верхней вертикали плана и используется оконными лучами.","space.north.help.aria":"Подсказка: север для пространства","space.north_inherited":"наследуется: {v}","space.sun_rays":"Солнце в окнах","space.sun_inherit":"Наследовать общий","space.sun_on":"Вкл","space.sun_off":"Выкл","canvas.far_objects":"Объектов далеко от плана: {n}","canvas.show_far":"Показать","canvas.home_tip":"План там — нажмите, чтобы вписать","gs.grid_group":"Обслуживание планов","gs.grid_hint":"Обновляет модели данных, выравнивает элементы по сетке и объединяет лишние фрагменты стен. Перед записью будет показан точный отчёт.","gs.align_all":"Оптимизировать планы","gs.align_title":"Оптимизировать планы","gs.align_none":"Все планы уже используют актуальную и оптимальную модель данных.","gs.optimize_no_automatic_changes":"Автоматических изменений нет. Проверьте пункты ниже.","gs.align_count":"Сдвинется элементов: {n} из {total}, максимум на {cm} см.","gs.align_where":"Наибольший сдвиг — в пространстве «{s}».","gs.align_turned":"Проёмов с исправлением угла: {n}.","gs.align_preflight_failed":"Не удалось безопасно проверить геометрию следующих пространств: {spaces}{more}.","gs.align_preflight_hint":"Планы не изменены. Скопируйте диагностику кнопкой ниже и приложите её к отчёту об ошибке вместе с экспортом пространства.","gs.preflight_reason_prepare-exception":"Не удалось подготовить геометрию пространства (исключение при сборке модели)","gs.preflight_reason_wall-null":"Тело стен не построилось (объединение вернуло пустоту)","gs.preflight_reason_wall-degraded-extra":"Тело стен деградировало с лишней геометрией","gs.preflight_reason_wall-failed-core":"Ядро тела стен не собралось","gs.preflight_reason_wall-exception":"Построение стен упало с исключением","gs.preflight_reason_floor-null":"Контур пола не построился","gs.preflight_reason_floor-exception":"Построение пола упало с исключением","gs.preflight_copy":"Скопировать диагностику","gs.preflight_copied":"Диагностика скопирована","gs.preflight_update_hint":"Версии карточки и интеграции различаются — обновите House Plan и повторите.","gs.align_preflight_space":"Пространство {n}","gs.align_preflight_more":" и ещё {n}","gs.optimize_changes":"Миграций модели: {m}; обновлено пространств: {c}; устранён шум координат: {p}; объединено отрезков реальных стен: {w}; объединено отрезков стен нулевой толщины: {s}; независимых: {i}.","gs.zero_walls_migrated":"Преобразовано виртуальных участков: {n}.","gs.wall_segments_migrated":"Стабилизировано сегментов стен: {n}.","gs.room_drafts_migrated":"Незавершённые контуры преобразованы в обычные стены: {drafts}; отрезков: {segments}.","gs.optimize_lattice_summary":"Канонизировано шумовых значений координат: {n}; максимальный сдвиг: {cm} см.","gs.optimize_lattice_space":"{space}: канонизировано значений координат: {n}; оставлено значений вне сетки: {far}.","gs.optimize_coincident_partitions":"Скрытые участки независимых стен поглощены стенами комнат: {n}.","gs.optimize_openings_rehosted":"Проёмы перепривязаны к стенам комнат: {n}.","gs.optimize_walls_straightened":"Выпрямлено стен: {n}; максимальное перемещение: {cm} см.","gs.optimize_walls_straightened_where":"Максимальная правка стены: {s}.","gs.optimize_walls_straighten_skipped":"Оставлено почти осевых стен, которые нельзя безопасно выпрямить: {n}.","gs.optimize_glow_migration":"Старый Glow: пространств — {spaces} → без заливки данных + независимый Glow; комнат — {rooms} → наследуемая заливка + независимый Glow.","gs.optimize_references":"Исправлено ссылок: пространства — {spaces}; комнаты — {rooms}; позиции — {positions}; устройств отвязано от отсутствующих пространств — {detached}.","gs.optimize_reference_more":", и ещё {n}","gs.optimize_orphans_removed":"Убрано забытых записей: {total} — подписи комнат: {rooms}; устройства: {devices}; групповые метки: {groups}. Все они принадлежали пространствам, удалённым ранее.","gs.optimize_live_positions":"Старые позиции в удалённых пространствах принадлежат существующим объектам: {n}{names}. Они будут сохранены.","gs.optimize_live_positions_remove":"Старые позиции в удалённых пространствах принадлежат существующим объектам: {n}{names}. Они выбраны для удаления.","gs.optimize_live_names":": {names}{more}","gs.optimize_live_remove":"Убрать старые позиции","gs.optimize_live_keep":"Сохранить старые позиции","gs.optimize_live_selected":"Старые позиции будут убраны после применения оптимизации.","gs.optimize_unverified":"Не удалось безопасно проверить позиций: {n}. Они оставлены без изменений.","gs.optimize_registry_limited":"Для безопасной проверки нужен полный доступ администратора к реестрам Home Assistant.","gs.optimize_vacuum_warning":"Сопоставления комнат пылесоса требуют проверки: {n}.","gs.optimize_details":"Подробности","gs.optimize_details_more":"И ещё записей: {n}.","gs.optimize_detail_removed":"будет удалено","gs.optimize_detail_live":"будет сохранено","gs.optimize_detail_unverified":"не проверено","gs.optimize_detail_room_label":"подпись комнаты","gs.optimize_detail_device":"устройство","gs.optimize_detail_group":"групповая метка","gs.optimize_detail_unknown":"неизвестный владелец","gs.optimize_detail_item":"{status}: {kind} {id}; прежнее пространство {space}","gs.align_warn":"Элементы, намеренно поставленные между узлами, будут сдвинуты. После операции доступна одна отмена — только до следующего изменения плана.","gs.align_run":"Оптимизировать","gs.align_done":"Планы оптимизированы: сдвинуто элементов — {n}, обслужено записей — {m}, исправлено ссылок — {r}","gs.optimize_undo":"Отменить последнюю оптимизацию","gs.optimize_undone":"Последняя оптимизация отменена","decor.furniture":"Мебель","decor.image":"Изображение","decor.image_title":"Свои изображения","decor.image_upload":"Загрузить изображение","decor.image_replace":"Заменить изображение","decor.image_uploading":"Загрузка…","decor.image_asset":"Файл изображения","decor.image_pick_hint":"Загрузите изображение или выберите уже используемое в House Plan.","decor.image_place_hint":"Кликните по плану, чтобы разместить изображение.","decor.image_none":"Загруженных изображений пока нет.","decor.image_unavailable":"Изображение недоступно","decor.image_used":"Используется в объектах: {n}","decor.image_upload_failed":"Не удалось загрузить изображение: {err}","decor.image_error_capacity":"Хранилище пользовательских изображений заполнено.","decor.image_in_use":"Перед удалением файла удалите все размещённые копии.","decor.image_delete_title":"Удалить файл изображения?","decor.image_delete_message":"Удалить «{name}» из House Plan? Это действие нельзя отменить.","furn.title":"Библиотека мебели","furn.symbol":"Символ","furn.group_furniture":"Мебель","furn.group_appliance":"Техника","furn.group_sanitary":"Сантехника","furn.group_other":"Прочее","furn.width":"Ширина","furn.depth":"Глубина","furn.back_to_categories":"Все категории","furn.pick_hint":"Выберите категорию, затем символ.","furn.place_hint":"Кликните по плану — предмет встанет к ближайшей стене. Shift — свободно.","furn.cat_air_conditioner":"Кондиционеры","furn.cat_armchair":"Кресла","furn.cat_bathtub":"Ванны","furn.cat_bed":"Кровати","furn.cat_bidet":"Биде","furn.cat_boiler":"Бойлеры","furn.cat_chair":"Стулья","furn.cat_coffee_table":"Журнальные столы","furn.cat_cooktop":"Варочные панели","furn.cat_dining_table":"Обеденные столы","furn.cat_dishwasher":"Посудомоечные машины","furn.cat_dryer":"Сушильные машины","furn.cat_fireplace":"Камины","furn.cat_fridge":"Холодильники","furn.cat_kitchen_cabinet":"Кухонные шкафы","furn.cat_kitchen_sink":"Кухонные мойки","furn.cat_nightstand":"Тумбы","furn.cat_plant":"Растения","furn.cat_rug":"Ковры","furn.cat_shelving":"Стеллажи","furn.cat_shower":"Душевые","furn.cat_sink":"Раковины","furn.cat_sofa":"Диваны","furn.cat_stairs":"Лестницы","furn.cat_toilet":"Унитазы","furn.cat_tv":"Телевизоры","furn.cat_wardrobe":"Шкафы","furn.cat_washer":"Стиральные машины","furn.cat_work_table":"Рабочие столы","furn.sym_sofa":"Диван двухместный","furn.sym_sofa_three_seat":"Диван трёхместный","furn.sym_sofa_corner_right":"Угловой диван, правый","furn.sym_armchair":"Кресло мягкое","furn.sym_armchair_office":"Кресло офисное","furn.sym_coffee_table":"Журнальный стол, прямоугольный","furn.sym_coffee_table_round":"Журнальный стол, круглый","furn.sym_coffee_table_oval":"Журнальный стол, овальный","furn.sym_coffee_table_rounded":"Журнальный стол, скруглённый","furn.sym_table_dining":"Обеденный стол, прямоугольный","furn.sym_table_round":"Круглый стол","furn.sym_table_dining_oval":"Обеденный стол, овальный","furn.sym_table_dining_rounded":"Обеденный стол, скруглённый","furn.sym_chair":"Стул","furn.sym_chair_bar":"Барный стул","furn.sym_desk":"Рабочий стол, прямоугольный","furn.sym_desk_corner":"Рабочий стол, угловой","furn.sym_bed_double":"Двуспальная кровать","furn.sym_bed_single":"Односпальная кровать","furn.sym_nightstand":"Тумба прикроватная","furn.sym_cabinet_tv":"Тумба под телевизор","furn.sym_cabinet_shoe":"Тумба для обуви","furn.sym_cabinet_sink":"Тумба под раковину","furn.sym_wardrobe":"Шкаф гардеробный","furn.sym_bookshelf":"Шкаф книжный","furn.sym_wall_unit":"Шкаф-стенка","furn.sym_kitchen_floor":"Кухонный напольный модуль","furn.sym_kitchen_floor_corner":"Кухонный напольный угловой модуль","furn.sym_kitchen_wall":"Кухонный навесной модуль","furn.sym_kitchen_wall_corner":"Кухонный навесной угловой модуль","furn.sym_shelf_floor":"Стеллаж напольный","furn.sym_shelf_wall":"Полка настенная","furn.sym_fridge":"Холодильник","furn.sym_stove":"Варочная панель, 4 конфорки","furn.sym_cooktop_two":"Варочная панель, 2 конфорки","furn.sym_dishwasher":"Посудомоечная машина","furn.sym_washer":"Стиральная машина","furn.sym_dryer":"Сушильная машина","furn.sym_tv":"Телевизор на подставке","furn.sym_tv_wall":"Телевизор на кронштейне","furn.sym_ac":"Кондиционер","furn.sym_water_heater":"Бойлер","furn.sym_toilet":"Унитаз напольный","furn.sym_toilet_built_in":"Унитаз встроенный","furn.sym_bathtub":"Ванна прямоугольная","furn.sym_bathtub_corner":"Ванна угловая","furn.sym_shower":"Душ","furn.sym_sink":"Раковина","furn.sym_kitchen_sink":"Кухонная мойка одинарная","furn.sym_kitchen_sink_double":"Кухонная мойка двойная","furn.sym_bidet":"Биде напольное","furn.sym_bidet_built_in":"Биде встроенное","furn.sym_stairs":"Лестница","furn.sym_fireplace":"Камин","furn.sym_plant":"Растение","furn.sym_rug":"Ковёр","common.yes":"Да","common.no":"Нет","vac.diag_source":"Источник","vac.diag_platform":"Интеграция","vac.diag_status":"Статус","vac.diag_position":"Позиция","vac.diag_rooms":"Комнаты","vac.diag_rooms_value":"{total} · совпало имён: {matched} · {readiness}","vac.autocal_ready":"автокалибровка доступна","vac.autocal_not_ready":"нужно 3 совпавших имени","vac.diag_path":"Путь интеграции","vac.diag_map":"ID карты","vac.source_none":"не выбран","vac.source_status_ok":"Готов","vac.source_status_missing":"Не найден","vac.source_status_disabled":"Деактивирован в Home Assistant","vac.source_status_unavailable":"Недоступен","vac.source_status_unverified":"Нельзя проверить с текущими правами","vac.source_status_unsupported":"Нет данных позиции","vac.source_status_none":"Нет источника","vac.source_banner_missing":"Сохранённый источник больше не существует. Он не заменён автоматически: выберите другой или восстановите его в Home Assistant.","vac.source_banner_disabled":"Сохранённый источник деактивирован в Home Assistant. Активируйте его там или выберите другой.","vac.source_banner_unverified":"Текущих прав Home Assistant недостаточно для проверки источника. Привязка сохранена и не будет заменена автоматически.","vac.choose_source":"Выбрать источник","vac.source_auto":"Автоматически","vac.source_auto_hint":"Использовать совместимую сущность этого устройства","vac.all_cameras":"Все камеры","vac.all_cameras_warn":"Камера может не отдавать данные робота. Выбирайте её только если это карта вашего пылесоса.","vac.all_cameras_empty":"Других сущностей камеры не найдено.","vac.platform_unknown":"интеграция неизвестна","vac.cap_position":"позиция","vac.cap_rooms_short":"комнаты","vac.cap_path":"путь","vac.cap_map":"ID карты","vac.cap_none":"данные робота не обнаружены","vac.xcme_hint":"Включите атрибуты Xiaomi Cloud Map Extractor:","vac.documentation":"Документация","vac.residual_title":"Проверьте автокалибровку","vac.residual_message":"Совпавшие комнаты расходятся максимум на {error}. Примените приблизительную калибровку, подгоните её вручную либо отмените без изменения сохранённых настроек.","vac.apply_proposal":"Применить","gs.backup_group":"Резервная копия и перенос","gs.backup_hint":"Скачайте переносимую JSON-копию или проверьте и импортируйте копию, созданную House Plan.","backup.export_open":"Экспорт","backup.import_open":"Импорт","backup.export_title":"Экспорт House Plan","backup.import_title":"Импорт House Plan","backup.export_hint":"Выберите, должна ли копия содержать всю конфигурацию House Plan или только текущее пространство.","backup.full":"Полная копия","backup.current_space":"Текущее пространство","backup.current_space_title":"Текущее пространство: {title}","backup.no_current_space":"Нет текущего пространства","backup.plan_only":"Только планировка","backup.plan_only_hint":"Сохранить комнаты, стены, проёмы, декор и позиции подписей комнат без устройств и привязок Home Assistant.","backup.plan_only_preview":"Файл содержит только планировку","backup.privacy_warning":"Архив сохраняет названия, идентификаторы Home Assistant и точные координаты. Внутренние планы и вложения указываются ссылками, но не вкладываются; текущие состояния и маршруты пылесосов не включаются.","backup.download":"Скачать JSON","backup.export_done":"Резервная копия скачана","backup.reading":"Проверяем резервную копию…","backup.revalidated":"После предпросмотра план изменился. Сводка обновлена — проверьте её и подтвердите ещё раз.","backup.error.support_invalid_message":"Проверьте сообщение для поддержки и повторите попытку.","backup.error.support_package_too_large":"Обезличенный пакет для поддержки превышает лимит 8 МиБ.","backup.error.support_preview_expired":"Предпросмотр вложения для поддержки истёк или больше недоступен.","backup.error.support_rate_limited":"Запрошено слишком много репортов или предпросмотров. Повторите позже.","backup.error.support_rejected":"Репорт не прошёл проверку службы поддержки.","backup.error.support_unavailable":"Закрытая служба поддержки временно недоступна.","backup.error.unauthorized":"У вас нет прав на экспорт или импорт этого плана.","backup.error.not_ready":"House Plan ещё не готов. Повторите попытку через несколько секунд.","backup.error.too_large":"Размер резервной копии превышает 8 МиБ.","backup.error.invalid_json":"Выбранный файл не является корректным JSON.","backup.error.invalid_format":"Выбранный файл не является резервной копией House Plan.","backup.error.invalid_image":"Изображение повреждено или не соответствует своему формату.","backup.error.unsupported_export_version":"Эта версия формата резервной копии не поддерживается установленной версией.","backup.error.unsupported_image":"Используйте поддерживаемое изображение PNG, JPEG, WebP или SVG.","backup.error.future_model":"Резервная копия создана в более новой версии модели данных House Plan.","backup.error.invalid_config":"Резервная копия содержит некорректную конфигурацию House Plan.","backup.error.wall_model_migration_blocked":"Не удалось безопасно обновить модель стен из резервной копии. Сначала оптимизируйте исходный план и повторите экспорт.","backup.error.invalid_layout":"Резервная копия содержит некорректные позиции объектов.","backup.error.invalid_content":"Резервная копия содержит некорректные или несогласованные ссылки на файлы.","backup.error.space_not_found":"Выбранное пространство больше не существует.","backup.error.capacity_exceeded":"Добавление этой копии превысит ограничения размера плана.","backup.error.preview_expired":"Время предпросмотра истекло. Выберите файл резервной копии заново.","backup.error.preview_owner_mismatch":"Этот предпросмотр принадлежит другому пользователю Home Assistant.","backup.error.conflict":"После предпросмотра план изменился. Проверьте обновлённую сводку.","backup.error.content_confirmation_required":"Подтвердите отсоединение недоступных локальных файлов.","backup.error.commit_failed":"Не удалось безопасно применить копию. Предыдущий план восстановлен или ожидает восстановления.","backup.error.missing_plan":"После предпросмотра исчез связанный файл плана. Проверьте копию ещё раз.","backup.error.missing_content":"После предпросмотра исчез связанный локальный файл. Проверьте копию ещё раз.","backup.error.marker_control_missing":"В резервной копии отсутствует связанный источник света на плане.","backup.error.marker_control_not_light":"Связанная цель больше не отмечена как источник света.","backup.error.marker_control_self":"Источник света не может управлять самим собой.","backup.error.marker_control_cycle":"Резервная копия содержит циклическую цепочку управления светом.","backup.error.duplicate_marker_control":"Резервная копия содержит повторяющуюся связь с источником света.","backup.error.no_backup":"Нет снимка импорта или оптимизации, который можно восстановить.","backup.error.in_use":"Элемент ещё используется","backup.error.invalid_data":"Запрос содержит некорректные данные","backup.error.invalid_light_entity":"Ведущий свет должен быть сущностью light.* или switch.*","backup.error.invalid_marker_control":"Некорректная ссылка управления маркером","backup.error.invalid_name":"Некорректное имя","backup.error.invalid_partition_opening_host":"Проём должен сохранить свою перегородку-носитель","backup.error.invalid_partition_opening_jamb_margin":"Проём не оставляет физического простенка у края стены","backup.error.invalid_passage_fields":"Открытый проход не может нести настройки двери","backup.error.invalid_space_id":"Неизвестное пространство","backup.error.invalid_toggle_entity":"Сущность переключения должна быть light.* или switch.*","backup.error.invalid_value_badge":"Некорректные настройки бейджа значения","backup.error.invalid_value_badge_attribute":"Некорректный атрибут бейджа значения","backup.error.invalid_value_badge_position":"Некорректная позиция бейджа значения","backup.error.invalid_value_badge_source":"Некорректный источник бейджа значения","backup.error.invalid_vacuum_map_route":"Проверьте сопоставление карт робота пространствам.","backup.error.invalid_value_source":"Некорректный источник значения","backup.error.invalid_value_source_attribute":"Некорректный атрибут источника значения","backup.error.io_error":"Файловая операция на сервере не удалась","backup.error.not_toggleable":"Это устройство нельзя переключить","backup.error.nothing_to_repair":"Нечего чинить","backup.error.space_in_use":"На пространство ещё есть ссылки","backup.error.value_badge_source_required":"Бейджу значения нужен источник","backup.error.wall_model_client_outdated":"План обновлён в другом месте — перезагрузите страницу","backup.same_source":"Создано на этом экземпляре Home Assistant","backup.foreign_source":"Создано на другом экземпляре Home Assistant","backup.created":"Создано: {value}","backup.versions":"Карточка {card}; интеграция {integration}; модель данных {model}","backup.count_spaces":"Пространств: {n}","backup.count_rooms":"Комнат: {n}","backup.count_walls":"Стен: {n}","backup.count_openings":"Проёмов: {n}","backup.count_decor":"Объектов декора: {n}","backup.count_markers":"Устройств: {n}","backup.count_layout":"Позиций: {n}","backup.bindings":"Привязки — устройства: {device}, сущности: {entity}, виртуальные: {virtual}; позиций без пространства: {legacy}","backup.binding_status":"Статус на целевом экземпляре — активных: {active}, деактивированных: {disabled}, отсутствующих: {missing}","backup.missing_areas":"На целевом экземпляре отсутствуют зоны: {areas}","backup.dropped_marker_links":"Связи с источниками света вне переносимого пространства пропущены: {n}.","backup.room_drafts_migrated":"Старые незавершённые контуры преобразованы в обычные стены: {drafts}; отрезков: {segments}.","backup.repaired_target_refs":"Существующих ссылок восстановлено этим импортом: {n}.","backup.preserved_unresolved_refs":"Неоднозначные ссылки сохранены без изменений: {n}.","backup.preserved_unresolved_hint":"House Plan ничего не угадывал и не удалял. После импорта запустите «Оптимизировать планы», чтобы проверить оставшиеся ссылки.","backup.import_details":"Подробности восстановления ссылок","backup.import_detail.incoming_remapped":"Ссылок обновлено внутри импортируемой копии: {n}","backup.import_detail.target_repaired":"Существующих ссылок восстановлено: {n}","backup.import_detail.preserved_unresolved":"Неразрешимых ссылок сохранено: {n}","backup.import_detail.collisions":"Конфликтов назначения безопасно сохранено: {n}","backup.import_detail.dropped_links":"Входящих связей пропущено по правилам переноса: {n}","backup.import_detail.bounded_lineages":"Чрезмерно вложенных идентификаторов ограничено: {n}","backup.replace_warning":"Текущая конфигурация и расположение будут заменены. Загруженные файлы не удаляются. Одну отмену можно выполнить до следующего изменения плана.","backup.foreign_bookkeeping":"Служебные списки известных и новых устройств другого экземпляра импортированы не будут.","backup.final_name":"Название нового пространства","backup.target_settings":"Глобальные настройки целевого экземпляра не изменятся.","backup.duplicates":"Уже существующих привязок: {n}","backup.skip":"Пропустить повторяющиеся устройства","backup.virtual_copy":"Добавить безопасные статичные виртуальные копии","backup.content":"Связанное содержимое","backup.decor_images_summary":"Свои изображения: объектов — {objects}, файлов — {assets}; отсутствует файлов — {missing}.","backup.content_available":"доступно локально","backup.content_external":"внешняя ссылка","backup.content_detach_required":"будет отвязано","backup.confirm_detach":"Я понимаю, что недоступные внутренние планы и вложения будут отвязаны от импортируемой конфигурации.","backup.confirm_missing_images":"Я понимаю, что отсутствующие свои изображения останутся восстанавливаемыми заглушками, а остальные недоступные локальные файлы будут отвязаны.","backup.replace":"Заменить","backup.add":"Добавить пространство","backup.space_done":"Пространство импортировано: комнат — {rooms}, устройств — {markers}, существующих ссылок восстановлено — {refs}","backup.full_done":"Копия восстановлена: пространств — {spaces}, комнат — {rooms}, устройств — {markers}","backup.undo_import":"Отменить последний полный импорт","backup.import_undone":"Полный импорт отменён","backdrop.large_title":"Большое изображение","backdrop.large_body":"Изображение {w}×{h} ({fileMb} МБ), для показа потребуется около {decodedMb} МБ памяти. На планшетах это может привести к падению страницы.","backdrop.unknown_body":"Не удалось прочитать размеры изображения — файл может быть повреждён. Продолжение может привести к падению страницы на планшете.","backdrop.reduced_dimensions":"Уменьшенная копия: {w}×{h} px.","backdrop.use_downscaled":"Загрузить уменьшенную копию","backdrop.reducing":"Уменьшаем…","backdrop.keep_original":"Оставить оригинал","backdrop.too_large_title":"Изображение слишком большое","backdrop.too_large_body":"Изображение превышает возможности браузера ({w}×{h}, предел {limit} px по стороне). Уменьшите его в редакторе на компьютере и загрузите снова.","backdrop.downscale_failed":"Не удалось создать уменьшенную копию. Текущий план не изменён."}},{code:"de",nativeLabel:"Deutsch",loadDictionary:async function(e){const t=0===e?await import("./de-CqAe7_tE.js"):await import(new URL("./de-CqAe7_tE.js?retry",import.meta.url).href);return{dictionary:t.dictionary,fingerprint:t.fingerprint}}},{code:"fr",nativeLabel:"Français",loadDictionary:async function(e){const t=0===e?await import("./fr-6DtT8TWD.js"):await import(new URL("./fr-6DtT8TWD.js?retry",import.meta.url).href);return{dictionary:t.dictionary,fingerprint:t.fingerprint}}}],up=sp,pp=new Set;const _p=new class{constructor(e,t,i=console.warn,n){this.entries=e,this.expectedFingerprint=t,this.warn=i,this.loadFailed=n,this.dictionaries=new Map,this.pending=new Map,this.failed=new Set;for(const t of e)t.dictionary&&this.dictionaries.set(t.code,t.dictionary)}state(e){return this.dictionaries.has(e)?"ready":this.failed.has(e)?"fallback":"pending"}dictionary(e){return this.dictionaries.get(e)}ensure(e){if("pending"!==this.state(e))return Promise.resolve();const t=this.pending.get(e);if(t)return t;const i=this.entries.find(t=>t.code===e),n=this.load(i).finally(()=>this.pending.delete(e));return this.pending.set(e,n),n}async load(e){if(!e?.loadDictionary)return void(e&&this.failed.add(e.code));let t;for(const i of[0,1])try{const t=await e.loadDictionary(i);if(t.fingerprint!==this.expectedFingerprint)throw new Error(`locale fingerprint mismatch for ${e.code}`);return this.dictionaries.set(e.code,t.dictionary),void this.failed.delete(e.code)}catch(e){t=e}this.failed.add(e.code),this.warn(`[houseplan] unable to load ${e.code} locale; using English`,t),this.loadFailed?.(e.code)}}(dp,"74cbeb9792716ab64cfbcf339d3044c6e8ae33533bdef7216a6d7d513ae04091",console.warn,function(e){for(const t of pp)t(e)});function mp(e){const t=vp(e)?.code??"en";return _p.dictionary(t)??up}function gp(e){return"string"==typeof e?e.trim().replaceAll("_","-").toLowerCase():""}const fp=new Map(dp.map(e=>[gp(e.code),e]));function vp(e){return fp.get(gp(e))}function yp(e,t){const i=[{value:"",label:e},...dp.map(({code:e,nativeLabel:t})=>({value:e,label:t}))],n="string"==typeof t?t:"";return n&&!i.some(e=>e.value===n)&&i.push({value:n,label:vp(n)?.nativeLabel??n}),i}function bp(e,t){return function(e,t,i,n){const r=new Map(i.map(e=>[gp(e),e])),o=r.get(gp(e));if(o)return o;const s=gp(t),a=r.get(s);return a||(r.get(s.split("-")[0]||"")??n)}(t,e?.locale?.language||e?.language,dp.map(({code:e})=>e),"en")}function wp(e,t,i){return nn(mp(e)[t]??up[t]??t,i)}function kp(e,t){const i=mp(e)[t]??up[t];return"string"==typeof i&&i.trim().length>0}function xp(e,t,i,n){return{ox:0,oy:0}}function Sp(e,t){const i=(e.angle+90)*Math.PI/180,n=Ha(16,t),r=e.gateFace?-n*e.gateFace.side:n*(e.flipV?-1:1);return[[e.x+Math.cos(i)*r,e.y+Math.sin(i)*r],r<0]}function $p(e){const t=e.length/2,i=e.face.cm>0?e.face.cm/e.cellCm*e.gridPitch/2:Ha(4,e.cellCm),n="gate"===e.type?Math.sin(10*Math.PI/180)*t:0;return{half:t,jambHalf:i,gateDepth:n,outlineHalf:Math.max(Ha(16,e.cellCm),i+Ha(8,e.cellCm),n+Ha(8,e.cellCm)),hitHalf:Math.max(Ha(20,e.cellCm),i+Ha(10,e.cellCm),n+Ha(12,e.cellCm))}}function Mp(e,t,i){e.minX=Math.min(e.minX,t),e.minY=Math.min(e.minY,i),e.maxX=Math.max(e.maxX,t),e.maxY=Math.max(e.maxY,i)}function Rp(e,t,i,n,r,o,s,a){const l=Math.min(s,a)*Math.PI/180,c=Math.max(s,a)*Math.PI/180,h=(e,t)=>{const i=Math.atan2(t,e),n=[l,c];for(let e=-3;e<=3;e++){const t=e*Math.PI-i,r=Math.PI/2+e*Math.PI-i;t>l&&tl&&r0&&[e.length,e.angle,t[0],t[1]].every(Number.isFinite)))return null;const{half:i,jambHalf:n}=$p(e),r=Na(e.cellCm),o=1.75*r,s=1.25*r,a=.75*r,l={minX:-i-s,minY:-n-s,maxX:i+s,maxY:n+s},c={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("window"===e.type)Rp(c,-i,0,i,-o,o,-90,0),Rp(c,i,-i,0,-o,o,0,90),Mp(c,-i-a,-i-a),Mp(c,i+a,a);else if("gate"===e.type){const t=10*e.face.side;Rp(c,-i,0,i,-o,o,0,t),Rp(c,i,-i,0,-o,o,-t,0)}else Rp(c,-i,0,e.length,-o,o,-90,0),Mp(c,-i-a,-e.length-a),Mp(c,i+a,a);const[h,d]=Cp(e),u={...l};Mp(u,c.minX+h,c.minY+d),Mp(u,c.maxX+h,c.maxY+d);const p=e.flipH?-1:1,_="gate"===e.type?1:e.flipV?-1:1,m=e.angle*Math.PI/180,g=Math.cos(m),f=Math.sin(m),v={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const e of[u.minX,u.maxX])for(const i of[u.minY,u.maxY]){const n=e*p,r=i*_;Mp(v,t[0]+n*g-r*f,t[1]+n*f+r*g)}return v}function Dp(e){if("passage"===e.type)return W``;const t=Math.max(0,Math.min(1,e.amount)),{half:i,jambHalf:n}=$p(e),r=Na(e.cellCm),o=1.75*r,s=e.flipH?-1:1,a=e.flipV?-1:1,l="gate"===e.type?1:a,[c,h]=Cp(e);let d;if("window"===e.type){const o=Math.PI/2*i,s=e.face.cm>0?W``}const xr={color:"#607d8b",opacity:1,widthCm:3.6,fill:!1,fillColor:"#607d8b",fillOpacity:.25},Sr=(e,t=1)=>{const i=Number(e);return Number.isFinite(i)?Math.min(1,Math.max(0,i)):t},$r=e=>{let t=Number(e);return Number.isFinite(t)?(t=(t%360+360)%360,t>180?t-360:t):0};function Mr(e,t,i){return $r(t)?[e.x,e.y]:i([e.x,e.y])}function Rr(e,t,i,n){const r=Math.abs(i[0]-t[0]),o=Math.abs(i[1]-t[1]);return"line"===e?Math.hypot(r,o)>=n:r>=n&&o>=n}const Cr=(e,t,i)=>{const n=Number(e),r=Number.isFinite(t)&&t>0?t:5;return Number.isFinite(n)&&n>0?n/r*i:0},Tr=(e,t,i)=>{const n=Number(e),r=Number.isFinite(t)&&t>0?t:5;return Number.isFinite(n)&&i>0?n/i*r:0},Dr=(e,t,i,n=xr.widthCm)=>{const r=Number(e?.width_cm);if(Number.isFinite(r)&&r>0)return r;const o=Number(e?.width);return Number.isFinite(o)&&o>0?Tr(o,t,i):n};function Ar(e){const t=xr;return e.color===t.color&&e.opacity===t.opacity&&e.widthCm===t.widthCm&&e.fill===t.fill&&e.fillColor===t.fillColor&&e.fillOpacity===t.fillOpacity?null:{color:e.color,opacity:Sr(e.opacity),width_cm:Math.max(.1,Math.min(100,Number(e.widthCm)||.1)),fill:!!e.fill,fill_color:e.fillColor,fill_opacity:Sr(e.fillOpacity,.25)}}function Pr(e,t){return{color:e.color,opacity:Sr(e.opacity),width_cm:Math.max(.1,Math.min(100,Number(e.widthCm)||.1)),...t?{fill:e.fill,fill_color:e.fillColor,fill_opacity:Sr(e.fillOpacity,.25)}:{}}}function Fr(e){const t=e.x+e.w/2,i=e.y+e.h/2,n=$r(e.angle)*Math.PI/180,r=Math.cos(n),o=Math.sin(n),s=(e,n)=>{const s=e-t,a=n-i;return[t+s*r-a*o,i+s*o+a*r]};return[s(e.x,e.y),s(e.x+e.w,e.y),s(e.x+e.w,e.y+e.h),s(e.x,e.y+e.h)]}function zr(e){const t=Fr(e),i=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],n=[(t[0][0]+t[2][0])/2,(t[0][1]+t[2][1])/2];return{points:[...t,i(t[0],t[1]),i(t[1],t[2]),i(t[2],t[3]),i(t[3],t[0]),n],segments:t.map((e,i)=>({a:e,b:t[(i+1)%4]}))}}function Ir(e,t,i,n,r,o,s,a){const l=$r(e.angle)*Math.PI/180,c=Math.cos(l),h=Math.sin(l),d=-Math.sin(l),u=Math.cos(l),p=e.x+e.w/2,_=e.y+e.h/2,m=t>0?-e.w/2:e.w/2,g=i>0?-e.h/2:e.h/2,f=p+m*c+g*d,v=_+m*h+g*u,y=n-f,b=r-v;let w=(y*c+b*h)*(t>0?1:-1),k=(y*d+b*u)*(i>0?1:-1),x=null;if(o){const t=w/Math.max(e.w,a),i=k/Math.max(e.h,a);x=Math.max(a/Math.max(e.w,a),a/Math.max(e.h,a),t,i),w=e.w*x,k=e.h*x}if(s>0)if(o){const t=Math.max(1,Math.round(e.w/s)),i=Math.max(1,Math.round(e.h/s));if(Math.abs(e.w-t*s)<1e-6&&Math.abs(e.h-i*s)<1e-6){const n=(e,t)=>{let i=Math.abs(e),n=Math.abs(t);for(;n;)[i,n]=[n,i%n];return Math.max(1,i)},r=1/n(t,i),o=Math.max(a/e.w,a/e.h),s=Math.max(o,Math.round((x??1)/r)*r);w=e.w*s,k=e.h*s}else{e.w>=e.h?(w=Math.round(w/s)*s,k=w*(e.h/Math.max(e.w,a))):(k=Math.round(k/s)*s,w=k*(e.w/Math.max(e.h,a)))}}else w=Math.round(w/s)*s,k=Math.round(k/s)*s;w=Math.max(a,w),k=Math.max(a,k);return{x:f+(t>0?w/2:-w/2)*c+(i>0?k/2:-k/2)*d-w/2,y:v+(t>0?w/2:-w/2)*h+(i>0?k/2:-k/2)*u-k/2,w:w,h:k,angle:$r(e.angle)||void 0}}const Or=(e,t,i)=>{const n=i[0]-t[0],r=i[1]-t[1],o=n*n+r*r;if(o<1e-12)return[...t];const s=Math.max(0,Math.min(1,((e[0]-t[0])*n+(e[1]-t[1])*r)/o));return[t[0]+n*s,t[1]+r*s]};function Er(e,t,i,n){const r=n(e);let o=null;for(const r of t.points){const t=n(r),s=Math.hypot(t[0]-e[0],t[1]-e[1]);s<=i&&(!o||se.points),segments:e.flatMap(e=>e.segments)}}const Hr=Math.tan(.25*Math.PI/180);function Lr(e,t){const i=Math.abs(Number(t[0])-Number(e[0])),n=Math.abs(Number(t[1])-Number(e[1]));if(!([i,n].every(Number.isFinite)&&i>0&&n>0))return null;const r=i>=n?"horizontal":"vertical",o=Math.max(i,n),s=Math.min(i,n);return s/o>Hr?null:{axis:r,major:o,minor:s,angleDegrees:180*Math.atan2(s,o)/Math.PI}}function Br(e,t){const i=Lr(e,t);return i?"horizontal"===i.axis?[Number(t[0]),Number(e[1])]:[Number(e[0]),Number(t[1])]:[Number(t[0]),Number(t[1])]}const qr=e=>`${e[0]},${e[1]}`,jr=(e,t)=>e[0]===t[0]&&e[1]===t[1],Wr=(e,t)=>{const i=qr(e),n=qr(t);return i{let t=0;for(let i=0;i{if(e.length<3)return!1;for(let t=0;t1e-12},Vr=(e,t)=>jr(e,t.from)?[...t.to]:[...e],Kr=(e,t)=>e.map(e=>Array.isArray(e?.poly)?{...e,poly:e.poly.map(e=>Vr(e,t))}:e),Yr=(e,t,i)=>{const n=e.flatMap((e,t)=>ni(e)?.some(e=>jr(e,i.from))?[t]:[]);if(!n.length)return!1;for(const i of n){const n=ni(e[i]),r=ni(t[i]);if(!n||!r)continue;if(!Gr(r))return!1;const o=Math.sign(Ur(n)),s=Math.sign(Ur(r));if(o&&s&&o!==s)return!1}const r=new Set;for(const e of n){const i=ni(t[e]);if(i)for(let n=0;n{let i=0;for(const n of e){const e=ni(n);if(e)for(let n=0;n{const{a:i,b:n,axis:r}=e,o="horizontal"===r?{from:n,to:[n[0],i[1]]}:{from:n,to:[i[0],n[1]]},s="horizontal"===r?{from:i,to:[i[0],n[1]]}:{from:i,to:[n[0],i[1]]};return[{move:o,preservedDegree:Xr(t,i)},{move:s,preservedDegree:Xr(t,n)}].sort((e,t)=>t.preservedDegree-e.preservedDegree||qr(e.move.to).localeCompare(qr(t.move.to))||qr(e.move.from).localeCompare(qr(t.move.from))).map(e=>e.move)};function Jr(e){const t=JSON.parse(JSON.stringify(e||{}));let i=Array.isArray(t.rooms)?t.rooms:[];const n=new Map;for(const e of i){const t=ni(e);if(t)for(let e=0;ee.key.localeCompare(t.key))){let t=null;for(const n of Zr(e,i)){const e=a.get(qr(n.from));if(e&&e!==qr(n.to))continue;const r=Kr(i,n);if(Yr(i,r,n)){t=n,i=r;break}}t?(a.set(qr(t.from),qr(t.to)),r++,s=Math.max(s,Math.hypot(t.to[0]-t.from[0],t.to[1]-t.from[1]))):o++}t.rooms=i;for(const e of t.partitions||[]){if(!Array.isArray(e?.a)||!Array.isArray(e?.b))continue;const i=Lr(e.a,e.b);if(!i)continue;const n={key:String(e.id||Wr(e.a,e.b)),a:[...e.a],b:[...e.b],axis:i.axis};let a=null;for(const i of Zr(n,[{poly:[e.a,e.b]}])){const n=Vr(e.a,i),r=Vr(e.b,i),o=Math.hypot(r[0]-n[0],r[1]-n[1]);if(!(o>0))continue;const s=(t.openings||[]).filter(t=>"partition"===t?.host?.kind&&t.host.id===e.id).every(e=>{const t=Number(e.host.t),i=Number(e.length);return Number.isFinite(t)&&t>=0&&t<=1&&Number.isFinite(i)&&i>0&&t*o-i/2>=-1e-12&&t*o+i/2<=o+1e-12});if(s){a=i,e.a=n,e.b=r;break}}a?(r++,s=Math.max(s,Math.hypot(a.to[0]-a.from[0],a.to[1]-a.from[1]))):o++}return{space:t,report:{wallsStraightened:r,wallsStraightenSkipped:o,maxStraightenShift:s},changed:r>0}}const Qr=["rect","ellipse","furniture","image"],eo=10**9,to=240,io=1e-4;function no(e){if(Array.isArray(e))return e.map(e=>no(e));if(null!==e&&"object"==typeof e){const t={};for(const[i,n]of Object.entries(e))t[i]=no(n);return t}return e}function ro(e){if("number"!=typeof e||!Number.isFinite(e))return e;const t=(e<0||Object.is(e,-0)?-1:1)*(Math.floor(Math.abs(e)*eo+.5)/eo);return 0===t?0:t}function oo(e){if("number"!=typeof e||!Number.isFinite(e))return e;const t=e*to,i=Math.round(t);if(Math.abs(t-i)null!==ao(e)):[]}function co(e){return"string"==typeof e&&Qr.includes(e)}function ho(e,t){for(const i of t)Object.prototype.hasOwnProperty.call(e,i)&&(e[i]=ro(e[i]))}function uo(e,t){for(const i of t)Object.prototype.hasOwnProperty.call(e,i)&&(e[i]=oo(e[i]))}function po(e){if(Array.isArray(e))for(let t=0;t{for(const r of n){const n=t[r];"number"==typeof n&&Number.isFinite(n)&&i(n,e)}},n=t=>{if(Array.isArray(t))for(let n=0;n{if(Array.isArray(e))for(const t of e)n(t)};for(const i of lo(e.rooms))t(i,["x","y","w","h"]),r(i.poly);for(const t of lo(e.walls))n(t.a),n(t.b);for(const t of lo(e.wall_segments))n(t.a),n(t.b);for(const i of lo(e.openings))t(i,["x","y"]);for(const i of lo(e.decor))"line"===i.kind?t(i,["x1","y1","x2","y2"]):co(i.kind)?t(i,["x","y","w","h"]):"text"===i.kind&&t(i,["x","y"]);for(const t of lo(e.room_drafts))r(t.points);for(const t of lo(e.partitions))n(t.a),n(t.b);for(const t of lo(e.wall_columns))n(t.center);for(const t of lo(e.open_spans))n(t.a),n(t.b)}const r=ao(t);if(!r)return;const o=new Map;if(n)for(const e of lo(n.spaces))null!=e.id&&o.set(String(e.id),e);for(const e of Object.values(r)){const t=ao(e);if(!t)continue;const n=null!=t.s&&o.get(String(t.s))||null;for(const e of["x","y"]){const r=t[e];"number"==typeof r&&Number.isFinite(r)&&i(r,n)}}}function go(e){const t=Number(e?.cell_cm);return t>0?t:5}function fo(e,t={}){const i={canonicalized:0,far:0,maxShift:0,maxShiftCm:0,spaces:[],bySpace:new Map},n=lo(ao(e)?.spaces);let r=5;for(const e of n)r=Math.max(r,go(e));mo(e,t,(e,t)=>{const n=e*to,o=Math.abs(n-Math.round(n)),s=oo(e),a=o>0&&o=io))return;const l=a&&"number"==typeof s?Math.abs(s-e):0;if(a?i.canonicalized++:i.far++,i.maxShift=Math.max(i.maxShift,l),i.maxShiftCm=Math.max(i.maxShiftCm,l*to*(t?go(t):r)),!t?.id||!a)return;const c=String(t.id);let h=i.bySpace.get(c);h||(h={spaceId:c,space:String(t.title||c),canonicalized:0,far:0,maxShift:0,maxShiftCm:0},i.bySpace.set(c,h)),h.canonicalized++,h.maxShift=Math.max(h.maxShift,l),h.maxShiftCm=Math.max(h.maxShiftCm,l*to*go(t))}),i.bySpace.size&&mo(e,t,(e,t)=>{if(!t?.id)return;const n=i.bySpace.get(String(t.id));if(!n)return;const r=e*to;Math.abs(r-Math.round(r))>=io&&n.far++}),i.spaces=[...i.bySpace.values()];const{bySpace:o,...s}=i;return s}function vo(e){return function(e){const t=e,i=ao(t);i&&uo(i,["x","y"]);return t}(no(e))}function yo(e){const t=e,i=ao(t);if(!i)return t;for(const e of Object.values(i)){const t=ao(e);t&&uo(t,["x","y"])}return t}function bo(e){return wo(no(e))}function wo(e){const t=e,i=ao(t);if(!i)return t;for(const e of lo(i.spaces)){ho(e,["plan_x","plan_y","plan_scale","plan_scale_x","plan_scale_y","plan_angle"]);for(const t of lo(e.rooms))uo(t,["x","y","w","h"]),_o(t.poly);for(const t of lo(e.walls))po(t.a),po(t.b);for(const t of lo(e.wall_segments))po(t.a),po(t.b);for(const t of lo(e.openings)){uo(t,["x","y"]),ho(t,["angle","length"]);const e=ao(t.host);e&&ho(e,["t"])}for(const t of lo(e.decor))"line"===t.kind?uo(t,["x1","y1","x2","y2"]):co(t.kind)?(uo(t,["x","y","w","h"]),ho(t,["angle"])):"text"===t.kind&&(uo(t,["x","y"]),ho(t,["scale","angle"]));for(const t of lo(e.room_drafts))_o(t.points);for(const t of lo(e.partitions))po(t.a),po(t.b);for(const t of lo(e.wall_columns))po(t.center),"square"===t.shape&&ho(t,["angle"]);for(const t of lo(e.open_spans))po(t.a),po(t.b)}for(const e of lo(i.markers))ho(e,["angle"]);return t}const ko=15,xo=8;function So(e,t,i,n,r){const o=i[0]-e[0],s=i[1]-e[1],a=Math.hypot(o,s);if(!(a>0)||a<=r+1e-9)return null;const l=o/a,c=s/a,h=t=>{const n=(t[0]-e[0])*l+(t[1]-e[1])*c,o=(r-n)/(a-n);return!Number.isFinite(o)||o<-1e-9||o>1+1e-9?null:[t[0]+(i[0]-t[0])*o,t[1]+(i[1]-t[1])*o]},d=h(t),u=h(n);return d&&u?[[e[0],e[1]],t,d,u,n]:null}const $o=Math.sin(.25*Math.PI/180);function Mo(e,t){return Number.isFinite(e)&&e>0&&Number.isFinite(t)&&t>0&&e*t<3}function Ro(e){const t=Number(e)>0?Number(e):5;if(5===t)return 8;const i=5/t*8;return Math.min(80,Math.max(.5,i))}function Co(e,t){return Number.isFinite(e)&&e>0&&Number.isFinite(t)&&t>0&&e*t<2}function To(e){return Number.isFinite(e)?Math.max(1,Math.min(100,e)):1}function Do(e,t){return!Number.isFinite(e)||e<0?"":String(t?Math.round(e/2.54*100)/100:Math.round(100*e)/100)}function Ao(e,t,i){if(!Number.isFinite(e)||e<=0)return 0;const n=Number(t)>0?Number(t):5;return To(e)/n*i}function Po(e,t){return t>0&&Number.isFinite(e)?Math.round(e/t)*t:e}function Fo(e){return Math.max(1e-6*Math.abs(e),1e-9)}function zo(e,t){if(!(t>0&&Number.isFinite(e)))return e;const i=Po(e,t);return Math.abs(i-e)<=Fo(t)?i:e}function Io(e,t){let i=t[0]-e[0],n=t[1]-e[1];const r=Math.hypot(i,n);return r<1e-12?[1,0]:(i/=r,n/=r,(i<-1e-12||Math.abs(i)<=1e-12&&n<0)&&(i=-i,n=-n),[i,n])}function Oo(e,t,i){const n=[zo(e[0],i),zo(e[1],i)],r=[zo(t[0],i),zo(t[1],i)],o=Po((n[0]+r[0])/2,i),s=Po((n[1]+r[1])/2,i),[a,l]=Io(n,r);let c=Math.atan2(l,a);c<0&&(c+=Math.PI);const h=Math.round(1800*c)/1800,d=i>0&&i<.01?6:i<1?4:2;return`${o.toFixed(d)},${s.toFixed(d)}@${h.toFixed(4)}`}function Eo(e,t,i,n){return 1===n?Oo(e,t,i):Oo([e[0]/n,e[1]/n],[t[0]/n,t[1]/n],i)}function No(e,t){if(!Array.isArray(e.a)||!Array.isArray(e.b)||e.a.length<2||e.b.length<2)return null;const i=[Number(e.a[0]),Number(e.a[1]),Number(e.b[0]),Number(e.b[1])];if(!i.every(Number.isFinite))return null;const n=t>0?t:1;return[[i[0]*n,i[1]*n],[i[2]*n,i[3]*n]]}function Ho(e,t,i,n,r){const o=r>0?r:1;return{key:Eo(e,t,n,o),cm:To(i),a:[e[0]/o,e[1]/o],b:[t[0]/o,t[1]/o]}}function Lo(e,t){const i=t>0?t:1,n=[];for(const t of e){const e=t.key.lastIndexOf("@");if(e<0)continue;const[r,o]=t.key.slice(0,e).split(",").map(Number),s=Number(t.key.slice(e+1));[r,o,s].every(Number.isFinite)&&n.push({w:t,x:r*i,y:o*i,ang:s})}return n}function Bo(e,t){const[i,n]=Io(e,t);let r=Math.atan2(n,i);return r<0&&(r+=Math.PI),r}function qo(e,t){let i=Math.abs(e-t);return i>Math.PI/2&&(i=Math.PI-i),i<.02}function jo(e,t,i,n,r=1){if(!e?.length)return null;const o=Eo(t,i,n,r),s=e.find(e=>e.key===o);if(s)return s;const a=r>0?r:1,l=Fo(n)*a,c=(e,t)=>Math.abs(e[0]-t[0])<=l&&Math.abs(e[1]-t[1])<=l;for(const n of e){const e=No(n,a);if(e&&(c(e[0],t)&&c(e[1],i)||c(e[0],i)&&c(e[1],t)))return n}const h=(t[0]+i[0])/2,d=(t[1]+i[1])/2,u=Bo(t,i),p=Math.max(.5*n,1e-9)*a;for(const t of Lo(e,a))if(qo(t.ang,u)&&Math.hypot(t.x-h,t.y-d)<=p)return t.w;return null}function Wo(e,t,i,n,r=1){const o=jo(e,t,i,n,r);if(o&&o.cm>0)return To(o.cm);const s=function(e,t,i,n,r){if(!e?.length)return null;const o=r>0?r:1,s=Math.hypot(i[0]-t[0],i[1]-t[1]);if(s<1e-12)return null;const a=Bo(t,i),l=Math.max(.5*n,1e-9)*o;let c=null;for(const n of e){if(!(n.cm>0))continue;const e=No(n,o);if(!e)continue;const r=Math.hypot(e[1][0]-e[0][0],e[1][1]-e[0][1]);if(r<1e-12||!qo(Bo(e[0],e[1]),a))continue;if(Fs(t[0],t[1],e[0][0],e[0][1],e[1][0],e[1][1])>l||Fs(i[0],i[1],e[0][0],e[0][1],e[1][0],e[1][1])>l)continue;if(r+l(o.has(e.key)||(e=>{const t=No(e,n);if(!t)return!1;const[i,o]=t,a=o[0]-i[0],c=o[1]-i[1],h=Math.hypot(a,c);if(h<=l)return!1;if(!s.some(e=>{const t=[e[0],e[1]],n=[e[2],e[3]];return qo(Bo(i,o),Bo(t,n))&&Fs(i[0],i[1],t[0],t[1],n[0],n[1])<=l&&Fs(o[0],o[1],t[0],t[1],n[0],n[1])<=l}))return!1;const d=(r||[]).some(e=>{const t=[e[0],e[1]],n=[e[2],e[3]];if(!qo(Bo(i,o),Bo(t,n)))return!1;const r=e=>Math.abs((e[0]-i[0])*c-(e[1]-i[1])*a)/h;if(r(t)>l||r(n)>l)return!1;const s=h*h,d=((t[0]-i[0])*a+(t[1]-i[1])*c)/s,u=((n[0]-i[0])*a+(n[1]-i[1])*c)/s;return Math.min(1,Math.max(d,u))-Math.max(0,Math.min(d,u))>l/h});return!d})(e))&&e.cm>=1&&e.cm<=100)}function Go(e,t,i,n=8){const[r,o]=Io(e,t);let s=Math.atan2(o,r);s<0&&(s+=Math.PI);let a=i*Math.PI/180%Math.PI;a<0&&(a+=Math.PI);let l=Math.abs(s-a);return l>Math.PI/2&&(l=Math.PI-l),l<=n*Math.PI/180}function Vo(e,t,i,n,r=1,o="affine",s){if(!e?.length)return[];if(t.length!==i.length)return"fixed-topology"===o&&s?.(),e.slice();const a=r>0?r:1,l=Math.max(.5*n,1e-9)*a,c=Math.max(n*a*1e-6,1e-9),h=[],d=new Map,u=new Map,p=(e,t,i)=>{const n=e.get(t)||new Set;n.add(i),e.set(t,n)};for(let e=0;e[e[0]+(t[0]-e[0])*i,e[1]+(t[1]-e[1])*i],m=(e,t)=>Math.hypot(e[0]-t[0],e[1]-t[1])<=c,g=(e,t)=>{if("fixed-topology"===o){const i=t.na[0]-t.oa[0],n=t.na[1]-t.oa[1],r=t.nb[0]-t.ob[0],o=t.nb[1]-t.ob[1];return Math.hypot(i-r,n-o)<=c?[e[0]+i,e[1]+n]:m(e,t.oa)?[...t.na]:m(e,t.ob)?[...t.nb]:[...e]}const i=Math.max(0,Math.min(1,((e[0]-t.oa[0])*t.dx+(e[1]-t.oa[1])*t.dy)/t.len2));return _(t.na,t.nb,i)},f=(e,t)=>{const[i,n]=Io(e,t);return(t[0]-e[0])*i+(t[1]-e[1])*n>=0?[[...e],[...t]]:[[...t],[...e]]},v=[],y=[],b=(e,t,i)=>{if(Math.hypot(t[0]-e[0],t[1]-e[1])<=c)return;const[r,o]=f(e,t),s=To(i);if(y.some(e=>e.entry.cm===s&&m(e.span[0],r)&&m(e.span[1],o)))return;const l=Ho(r,o,s,n,a);v.push(l),y.push({entry:l,span:[r,o]})};for(const t of e){const e=No(t,a);if(e){const[i,n]=f(e[0],e[1]),r=n[0]-i[0],s=n[1]-i[1],a=r*r+s*s,d=Math.sqrt(a);if(d<=c){v.push({...t,cm:To(t.cm)});continue}const u=[];for(const e of h){if(!qo(Bo(i,n),Bo(e.oa,e.ob)))continue;const t=e=>Math.abs((e[0]-i[0])*s-(e[1]-i[1])*r)/d;if(t(e.oa)>l||t(e.ob)>l)continue;const o=((e.oa[0]-i[0])*r+(e.oa[1]-i[1])*s)/a,h=((e.ob[0]-i[0])*r+(e.ob[1]-i[1])*s)/a,p=Math.max(0,Math.min(o,h)),_=Math.min(1,Math.max(o,h));(_-p)*d>c&&u.push({lo:p,hi:_,move:e})}if(!u.length){"fixed-topology"===o?v.push({...t}):b(i,n,t.cm);continue}const p=[0,1,...u.flatMap(({lo:e,hi:t})=>[e,t])].sort((e,t)=>e-t).filter((e,t,i)=>0===t||Math.abs(e-i[t-1])*d>c),y=[];for(let e=0;e+1a>=e.lo-1e-12&&a<=e.hi+1e-12);if(!l.length){y.push([o,s]);continue}const h=[g(o,l[0].move),g(s,l[0].move)],f=l.slice(1).some(e=>{const t=g(o,e.move),i=g(s,e.move);return!m(h[0],t)||!m(h[1],i)});y.push(f?[o,s]:h)}const w=(e,t)=>{const i=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.hypot(i,n);return!(s<=c||i*r+n*o<=0)&&Math.abs(i*o-n*r)/s<=c},k=[];for(const e of y){const t=k[k.length-1];t&&m(t[1],e[0])&&w(t,e)?t[1]=e[1]:k.push([[...e[0]],[...e[1]]])}if("fixed-topology"===o&&1===k.length){const[i,n]=k[0];if(m(i,e[0])&&m(n,e[1])||m(i,e[1])&&m(n,e[0])){v.push({...t});continue}}for(const[e,i]of k)b(e,i,t.cm);continue}if("fixed-topology"===o){const e=u.get(t.key);if(1===e?.size){const i=[...e][0];v.push(i===t.key?{...t}:{...t,key:i});continue}const i=[Lo([t],a)[0]];1!==a&&i.push(Lo([t],1)[0]);const n=i.filter(Boolean).some(e=>h.some(t=>{if(!qo(e.ang,Bo(t.oa,t.ob)))return!1;const i=((e.x-t.oa[0])*t.dx+(e.y-t.oa[1])*t.dy)/t.len2;return i>=-1e-6&&i<=1.000001&&Fs(e.x,e.y,t.oa[0],t.oa[1],t.ob[0],t.ob[1])<=l}));((e?.size||0)>1||n)&&s?.(),v.push({...t});continue}let i="";const r=d.get(t.key);if(1===r?.size&&(i=[...r][0]),!i){const e=Lo([t],a)[0];if(e){const t=new Set;for(const i of h){if(!qo(e.ang,Bo(i.oa,i.ob)))continue;const r=((e.x-i.oa[0])*i.dx+(e.y-i.oa[1])*i.dy)/i.len2;if(r<-1e-6||r>1.000001)continue;if(Fs(e.x,e.y,i.oa[0],i.oa[1],i.ob[0],i.ob[1])>l)continue;const o=g([e.x,e.y],i),[s,c]=Io(i.na,i.nb),h=Math.max(n*a,1e-6);t.add(Eo([o[0]-s*h,o[1]-c*h],[o[0]+s*h,o[1]+c*h],n,a))}1===t.size&&(i=[...t][0])}}v.push({...t,key:i||t.key,cm:To(t.cm)})}return v}function Ko(e,t,i,n,r=1,o="affine"){return Vo(e,t,i,n,r,o)}function Yo(e,t,i,n,r=1,o="fixed-topology"){let s=!1;const a=Vo(e,t,i,n,r,o,()=>{s=!0});return{walls:s?(e||[]).map(e=>({...e})):a,rejected:s}}function Xo(e,t,i,n=1,r=[]){const o=n>0?n:1,s=Math.abs(i),a=Math.max(s*o*io,1e-9),l=(r||[]).flatMap(e=>{const t=No(e,o);return t?t.map(e=>[...e]):[]}),c=e=>e.every((e,t)=>(e=>{if(!(s>0))return!0;const t=e/o/s;return Math.abs(t-Math.round(t))Math.abs(e-i[t])<=a)),h=[],d=e=>JSON.stringify([e.key,e.cm,e.a,e.b]);for(const i of e||[]){const e=No(i,o);if(!e)continue;const[n,r]=e;if(![n[0],n[1],r[0],r[1]].every(Number.isFinite)||!c(n)||!c(r)){h.push(d(i));continue}const s=r[0]-n[0],l=r[1]-n[1],u=Math.hypot(s,l);if(u<=a){h.push(d(i));continue}const p=s/u,_=l/u,m=[];for(const e of t){const[t,i]=e;if(![t?.[0],t?.[1],i?.[0],i?.[1]].every(Number.isFinite))continue;const r=e=>Math.abs((e[0]-n[0])*_-(e[1]-n[1])*p);if(r(t)>a||r(i)>a)continue;const o=(t[0]-n[0])*p+(t[1]-n[1])*_,s=(i[0]-n[0])*p+(i[1]-n[1])*_,l=Math.max(0,Math.min(o,s)),c=Math.min(u,Math.max(o,s));c-l>a&&m.push([l,c])}m.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let g=0;for(const[e,t]of m){if(e>g+a)break;if(g=Math.max(g,t),g>=u-a)break}ge.key!==s);return null==n||n<1?a:[...a,Ho(t,i,n,r,o)]}function Jo(e,t,i,n,r,o=[],s=1){let a=e?e.slice():[];for(const e of function(e,t,i,n,r=1,o=[]){const s=ys(e,t,i,n,r,o);if(!s)return[];const a=[];for(let e=0;e0||(c=Zo(c,t,i,n,r,s)))}return c}function es(e){const{a:t,b:i,halfDepth:n}=e;if(!Array.isArray(t)||!Array.isArray(i)||t.length<2||i.length<2||![t[0],t[1],i[0],i[1]].every(Number.isFinite))return null;const r=i[0]-t[0],o=i[1]-t[1],s=Math.hypot(r,o);if(!(s>1e-9&&n>0&&Number.isFinite(n)))return null;const a=-o/s*n,l=r/s*n;return[[t[0]+a,t[1]+l],[i[0]+a,i[1]+l],[i[0]-a,i[1]-l],[t[0]-a,t[1]-l]]}function ts(e,t,i){return Math.hypot(e[0]-t[0],e[1]-t[1])<=i}function is(e,t,i){const n=t.b[0]-t.a[0],r=t.b[1]-t.a[1],o=n*n+r*r;if(!(o>i*i))return!1;const s=((e[0]-t.a[0])*n+(e[1]-t.a[1])*r)/o;if(!(s>0&&s<1))return!1;const a=[t.a[0]+n*s,t.a[1]+r*s];return Math.hypot(e[0]-a[0],e[1]-a[1])<=i}function ns(e,t,i,n){const r=Math.hypot(t,i);if(!(r>1e-9&&n>0))return;const o=[t/r,i/r],s=e.find(e=>Math.abs(e.u[0]*o[1]-e.u[1]*o[0])<1e-9&&e.u[0]*o[0]+e.u[1]*o[1]>1-1e-9);s?s.halfDepth=Math.max(s.halfDepth,n):e.push({u:o,halfDepth:n})}function rs(e,t){try{const i=Gt(Os(e),Os(t));let n=null,r=0;for(const e of i||[]){const t=e?.[0]||[],i=Math.abs(hs(t));t.length>=4&&i>r&&(r=i,n=t.slice(0,-1).map(e=>[e[0],e[1]]))}return n}catch{return null}}function os(e,t=1e-6){const i=(e||[]).map((e,t)=>({segment:e,index:t})).filter(({segment:e})=>e&&Array.isArray(e.a)&&Array.isArray(e.b)&&e.a.length>=2&&e.b.length>=2&&e.a.every(Number.isFinite)&&e.b.every(Number.isFinite)&&Number.isFinite(e.halfDepth)&&e.halfDepth>0&&Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])>1e-9);if(i.length<2)return[];const n=Math.max(Number.isFinite(t)?t:0,1e-9),r=i.flatMap(({segment:e})=>[e.a,e.b]).map(e=>[e[0],e[1]]).sort((e,t)=>e[0]-t[0]||e[1]-t[1]),o=[];for(const e of r)o.some(t=>ts(t,e,n))||o.push(e);const s=[];for(const e of o){const t=[];let r=!1;for(const{segment:o,index:s}of i){const i=Math.hypot(o.b[0]-o.a[0],o.b[1]-o.a[1]);ts(e,o.a,n)?t.push({u:[(o.b[0]-o.a[0])/i,(o.b[1]-o.a[1])/i],halfDepth:o.halfDepth,length:i,index:s}):ts(e,o.b,n)?t.push({u:[(o.a[0]-o.b[0])/i,(o.a[1]-o.b[1])/i],halfDepth:o.halfDepth,length:i,index:s}):is(e,o,n)&&(r=!0)}if(r||2!==t.length)continue;const[o,a]=t,l=o.u[0]*a.u[1]-o.u[1]*a.u[0];if(Math.abs(l)<1e-9)continue;const c=l<0?1:-1,h=[-o.u[1],o.u[0]],d=[-a.u[1],a.u[0]],u=[e[0]+h[0]*o.halfDepth*c,e[1]+h[1]*o.halfDepth*c],p=[e[0]-d[0]*a.halfDepth*c,e[1]-d[1]*a.halfDepth*c];if(!ps(u,o.u,p,a.u))continue;const _=[[o,a,p,[d[0]*-c,d[1]*-c]],[a,o,u,[h[0]*c,h[1]*c]]];for(const[t,,i,r]of _){const o=Math.min(2*t.halfDepth,t.length),a=[-t.u[1]*t.halfDepth,t.u[0]*t.halfDepth],l=[[e[0]+a[0],e[1]+a[1]],[e[0]+t.u[0]*o+a[0],e[1]+t.u[1]*o+a[1]],[e[0]+t.u[0]*o-a[0],e[1]+t.u[1]*o-a[1]],[e[0]-a[0],e[1]-a[1]]],c=e=>(e[0]-i[0])*r[0]+(e[1]-i[1])*r[1],h=[];for(let e=0;e=-1e-12&&h.push(t),n>1e-12&&r<-1e-12||n<-1e-12&&r>1e-12){const e=n/(n-r);h.push([t[0]+(i[0]-t[0])*e,t[1]+(i[1]-t[1])*e])}}h.length>=3&&Math.abs(hs(h))>n*n&&s.push({segmentIndex:t.index,wedge:h})}}return s}function ss(e,t=1e-6){const i=(e||[]).filter(e=>e&&Array.isArray(e.a)&&Array.isArray(e.b)&&e.a.length>=2&&e.b.length>=2&&e.a.every(Number.isFinite)&&e.b.every(Number.isFinite)&&Number.isFinite(e.halfDepth)&&e.halfDepth>0&&Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])>1e-9);if(i.length<2)return[];const n=Math.max(Number.isFinite(t)?t:0,1e-9),r=i.flatMap(e=>[e.a,e.b]).map(e=>[e[0],e[1]]).sort((e,t)=>e[0]-t[0]||e[1]-t[1]),o=[];for(const e of r)o.some(t=>ts(t,e,n))||o.push(e);const s=[],a=i.map((e,t)=>({roomId:"",a:[e.a[0],e.a[1]],b:[e.b[0],e.b[1]],key:`join-${t}`,kind:"outer",cm:0,open:!1,half:e.halfDepth})),l=Ss(a,n);for(const e of $s(l).fans)s.push(e);const c=e=>!!Ms(l,e);for(const e of o){if(c(e))continue;const t=[];for(const r of i)ts(e,r.a,n)?ns(t,r.b[0]-r.a[0],r.b[1]-r.a[1],r.halfDepth):ts(e,r.b,n)?ns(t,r.a[0]-r.b[0],r.a[1]-r.b[1],r.halfDepth):is(e,r,n)&&(ns(t,r.a[0]-e[0],r.a[1]-e[1],r.halfDepth),ns(t,r.b[0]-e[0],r.b[1]-e[1],r.halfDepth));if(!(t.length<2)){t.sort((e,t)=>Math.atan2(e.u[1],e.u[0])-Math.atan2(t.u[1],t.u[0])||e.halfDepth-t.halfDepth);for(let i=0;in*n&&s.push(m)}}}return s}function as(e,t,i,n){if(!(t>0)||!e||e.length<2)return"";if(i&&e.length>=3){let i=e;const r=e[e.length-1];if(e.length>=4&&Math.hypot(e[0][0]-r[0],e[0][1]-r[1])<1e-9&&(i=e.slice(0,-1)),i.length>=3){const e=i.map((e,i)=>n?.[i]||t),r=ia(i,e),o=gs(i,e);if(r&&o)return`${fs(r)} ${fs(vs(o))}`}}const r=[];for(let i=0;i=1e-9&&a>0&&r.push({a:o,b:s,halfDepth:a})}const o=r.map(es);for(const{segmentIndex:e,wedge:t}of os(r)){const i=o[e];if(!i)continue;const n=rs(i,t);n&&(o[e]=n)}const s=[...o.filter(e=>!!e),...ss(r)],a=function(e){let t=null;try{for(const i of e){if(i.length<3)continue;const e=Os(i);t=t?Wt(t,e):[e]}return t}catch{return null}}(s);return a?Ks(a):s.map(e=>fs(e)).join(" ")}function ls(e,t,i,n,r=1){if(!i.length)return!1;const o=cs(n,r),s=(e[0]+t[0])/2,a=(e[1]+t[1])/2,[l,c]=Io(e,t);for(const e of i){const[t,i]=Io([e[0],e[1]],[e[2],e[3]]);if(!(Math.abs(l*i-c*t)>.05)&&Fs(s,a,e[0],e[1],e[2],e[3])<=o)return!0}return!1}function cs(e,t){return Math.max(e*(t>0?t:1)*.04,1e-9)}function hs(e){let t=0;for(let i=0;ie[1]!=l>e[1]&&e[0]<(a-o)*(e[1]-s)/(l-s+0)+o&&(i=!i)}return i}([c[0]+.001*a,c[1]+.001*l],e)||(a=-a,l=-l),[a,l]}function us(e,t){const i=e[0]*t[1]-e[1]*t[0],n=e[0]*t[0]+e[1]*t[1];return Math.abs(i)<1e-9&&n>0}function ps(e,t,i,n){const r=t[0]*n[1]-t[1]*n[0];if(Math.abs(r)<1e-12)return null;const o=[i[0]-e[0],i[1]-e[1]],s=(o[0]*n[1]-o[1]*n[0])/r;return[e[0]+s*t[0],e[1]+s*t[1]]}function _s(e,t,i){const n=e?.length||0;if(n<3||!Array.isArray(i)||i.length!==n)return 0;const r=(Math.trunc(t)%n+n)%n,o=e[r],s=e[(r+1)%n],a=s[0]-o[0],l=s[1]-o[1],c=Math.hypot(a,l);if(!(c>0))return 0;const h=Math.max(0,Number(i[r])||0);if(!(h>0))return c;const d=[a/c,l/c],u=ds(e,r),p=[o[0]+u[0]*h,o[1]+u[1]*h],_=t=>{const r=Math.max(0,Number(i[t])||0);if(!(r>0))return null;const s=e[t],a=e[(t+1)%n],l=a[0]-s[0],c=a[1]-s[1],h=Math.hypot(l,c);if(!(h>0))return null;const u=ds(e,t),_=ps(p,d,[s[0]+u[0]*r,s[1]+u[1]*r],[l/h,c/h]);return _?(_[0]-o[0])*d[0]+(_[1]-o[1])*d[1]:null},m=_((r-1+n)%n)??0,g=(_((r+1)%n)??c)-m;return g>0?g:0}function ms(e,t,i,n,r,o,s,a=1){const l=(e||[]).find(e=>e?.id===t),c=ni(l);if(!c||c.length<3)return null;const h=Cs(e,t,i,n,r,o,s,a);if(!h)return c.map(()=>0);const d=4*cs(r,a);return c.map((e,t)=>{const i=c[(t+1)%c.length],n=[(e[0]+i[0])/2,(e[1]+i[1])/2];for(let e=0;e!(e>0)))return e.map(e=>[e[0],e[1]]);const r=[];for(let o=0;o0||u>0)){r.push([e[o][0],e[o][1]]);continue}if(d>0!=u>0){const t=e[o],i=d>0?[t[0]+p*d,t[1]+_*d]:[t[0],t[1]],n=u>0?[t[0]+m*u,t[1]+g*u]:[t[0],t[1]];r.push(i),Math.hypot(n[0]-i[0],n[1]-i[1])>1e-9&&r.push(n);continue}if(us(w,k)){const t=e[o],i=[t[0]+p*d,t[1]+_*d],n=[t[0]+m*u,t[1]+g*u];r.push(i),Math.hypot(n[0]-i[0],n[1]-i[1])>1e-9&&r.push(n);continue}const $=ps(x,w,S,k),M=Math.max(d,u,1e-9),R=Ms(i,e[o])?.limit??4*M;if($){const i=Math.hypot($[0]-e[o][0],$[1]-e[o][1]);if(Number.isFinite(i)&&i<=R){r.push($);continue}if(Xs(e,t,o)){r.push($);continue}}d>0&&r.push([e[o][0]+p*d,e[o][1]+_*d]),u>0&&r.push([e[o][0]+m*u,e[o][1]+g*u]),d>0||u>0||r.push([e[o][0],e[o][1]])}return r.length>=3?r:null}function fs(e,t=!0){if(!e.length)return"";let i=`M ${e[0][0]} ${e[0][1]}`;for(let t=1;te?.id===t),a=ni(s);if(!a||a.length<3)return null;const l=cs(n,r),c=[];for(const i of e||[]){if(!i||i.id===t)continue;const e=ni(i);if(e)for(const t of An(a,e,l))c.push([t[0],t[1]],[t[2],t[3]])}for(const e of i||[])c.push([e[0],e[1]],[e[2],e[3]]);for(const e of o||[]){const t=No(e,r);t&&c.push(t[0],t[1])}const h=[],d=[];for(let e=0;el)continue;const s=((e[0]-t[0])*(i[0]-t[0])+(e[1]-t[1])*(i[1]-t[1]))/(n*n);s<=r||s>=1-r||(o.some(e=>Math.abs(e-s)*n<=2*l)||o.push(s))}o.sort((e,t)=>e-t);for(const n of o)h.push([t[0]+(i[0]-t[0])*n,t[1]+(i[1]-t[1])*n]),d.push(e)}return{poly:h,parent:d,orig:a}}function bs(e,t,i,n){const r=t.poly.length,o=new Array(r).fill(0);if(!e?.length)return o;const s=new Set,a=[];for(let l=0;l0?(o[l]=To(c.cm),s.add(c.key)):a.push(l)}if(!a.length)return o;const l=n>0?n:1,c=Math.max(.5*i,1e-9)*l,h=Lo(e,l).filter(e=>e.w.cm>0);for(let e=a.length-1;e>=0;e--){const i=a[e],n=t.poly[i],s=t.poly[(i+1)%r],d=Bo(n,s);let u=null;for(const e of h){const t=No(e.w,l);if(!t||!qo(Bo(t[0],t[1]),d))continue;if(Fs(n[0],n[1],t[0][0],t[0][1],t[1][0],t[1][1])>c||Fs(s[0],s[1],t[0][0],t[0][1],t[1][0],t[1][1])>c)continue;const i=Math.hypot(s[0]-n[0],s[1]-n[1]),r=Math.hypot(t[1][0]-t[0][0],t[1][1]-t[0][1]),o=Math.max(0,r-i);(!u||oc||Fs(r[0],r[1],t[0][0],t[0][1],t[1][0],t[1][1])>c)continue;i=!0,o=Math.max(0,Math.hypot(t[1][0]-t[0][0],t[1][1]-t[0][1])-_)}else{if(Fs(e.x,e.y,n[0],n[1],r[0],r[1])>c)continue;o=Math.hypot(e.x-d,e.y-u)}(!p||i&&!p.exact||i===p.exact&&o0?i:1,o=(e||[]).filter(e=>e&&!e.open&&null!==e.kind&&Number.isFinite(e.half)&&e.half>0&&Array.isArray(e.a)&&Array.isArray(e.b)&&e.a.length>=2&&e.b.length>=2&&[e.a[0],e.a[1],e.b[0],e.b[1]].every(Number.isFinite)&&Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])>n).sort((e,t)=>e.key.localeCompare(t.key)||e.a[0]-t.a[0]||e.a[1]-t.a[1]||e.b[0]-t.b[0]||e.b[1]-t.b[1]||e.half-t.half),s=new Map;for(const e of o){const t=s.get(e.key);t?e.half>t.half&&s.set(e.key,{...t,half:e.half}):s.set(e.key,e)}const a=[...s.values()].flatMap(e=>[{point:[e.a[0],e.a[1]],other:e.b,halfDepth:e.half,kind:e.kind,key:e.key},{point:[e.b[0],e.b[1]],other:e.a,halfDepth:e.half,kind:e.kind,key:e.key}]).sort((e,t)=>e.point[0]-t.point[0]||e.point[1]-t.point[1]||e.other[0]-t.other[0]||e.other[1]-t.other[1]||e.halfDepth-t.halfDepth),l=new Map;for(const e of a){const[t,i]=ws(e.point,n),r=ks(t,i),o=l.get(r)||[];o.push(e),l.set(r,o)}const c=[],h=new Map;for(const e of a){const t=xs(h,e.point,n).filter(t=>Math.hypot(t.point[0]-e.point[0],t.point[1]-e.point[1])<=n).sort((t,i)=>Math.hypot(t.point[0]-e.point[0],t.point[1]-e.point[1])-Math.hypot(i.point[0]-e.point[0],i.point[1]-e.point[1])||t.point[0]-i.point[0]||t.point[1]-i.point[1]);let i=t[0];if(!i){i={point:[...e.point],rays:[]},c.push(i);const[t,r]=ws(i.point,n),o=ks(t,r),s=h.get(o)||[];s.push(i),h.set(o,s)}const r=e.other[0]-e.point[0],o=e.other[1]-e.point[1],s=Math.hypot(r,o);if(!(s>n))continue;const a=[r/s,o/s];let l=Math.atan2(a[1],a[0]);l<0&&(l+=2*Math.PI),i.rays.push({u:a,halfDepth:e.halfDepth,length:s,angle:l})}const d=[],u=e=>{const t=1e-9*Math.max(1,r),i=e.filter(e=>Number.isFinite(e.halfDepth)&&e.halfDepth>0&&Number.isFinite(e.length)&&e.length>n);return i.filter((e,n)=>!i.some((i,r)=>r!==n&&i.halfDepth>=e.halfDepth-t&&i.length>=e.length-t&&(i.halfDepth>e.halfDepth+t||i.length>e.length+t||re.length-t.length||e.halfDepth-t.halfDepth).map(e=>({...e}))};for(const e of c){const t=e.rays.sort((e,t)=>e.angle-t.angle||e.length-t.length||e.halfDepth-t.halfDepth),i=[];for(const e of t){const t=i[i.length-1];t&&Math.abs(e.angle-t.angle)<=1e-9?t.supports.push({halfDepth:e.halfDepth,length:e.length}):i.push({u:[...e.u],angle:e.angle,supports:[{halfDepth:e.halfDepth,length:e.length}]})}if(i.length>1&&2*Math.PI-i[i.length-1].angle+i[0].angle<=1e-9){const e=i.pop();i[0].supports.push(...e.supports)}if(i.length<3)continue;const r=i.map(t=>{const i=u(t.supports),r=new Set,o=[];for(const s of i){const i=[e.point[0]+t.u[0]*s.length,e.point[1]+t.u[1]*s.length];for(const t of xs(l,i,n)){if("shared"!==t.kind||Math.hypot(t.point[0]-i[0],t.point[1]-i[1])>n)continue;const s=t.other[0]-t.point[0],a=t.other[1]-t.point[1],l=Math.hypot(s,a);if(!(l>n))continue;const c=s/l,h=a/l;if(Math.hypot(t.other[0]-e.point[0],t.other[1]-e.point[1])<=n)continue;const d=`${t.key}|${t.point[0]}|${t.point[1]}|${t.other[0]}|${t.other[1]}|${t.halfDepth}`;r.has(d)||(r.add(d),o.push({start:[t.point[0],t.point[1]],u:[c,h],length:l,halfDepth:t.halfDepth}))}}return o.sort((e,t)=>e.start[0]-t.start[0]||e.start[1]-t.start[1]||e.u[0]-t.u[0]||e.u[1]-t.u[1]||e.length-t.length||e.halfDepth-t.halfDepth),{u:[...t.u],halfDepth:Math.max(...i.map(e=>e.halfDepth)),length:Math.max(...i.map(e=>e.length)),supports:i,continuations:o}}).filter(e=>Number.isFinite(e.halfDepth)&&e.halfDepth>0&&Number.isFinite(e.length)&&e.length>n);if(r.length<3)continue;const o=Math.max(...r.map(e=>e.halfDepth));o>0&&Number.isFinite(o)&&d.push({point:[...e.point],rays:r,halfDepth:o,limit:1.25*o})}d.sort((e,t)=>e.point[0]-t.point[0]||e.point[1]-t.point[1]);const p=new Map;for(const e of d){const[t,i]=ws(e.point,n),r=ks(t,i),o=p.get(r)||[];o.push(e),p.set(r,o)}return{epsilon:n,coordinateScale:r,nodes:d,index:p}}function $s(e){const t={fans:[],supports:[]};if(!e?.nodes?.length)return t;const i=Math.max(e.epsilon,1e-9)**2;for(const n of e.nodes){const e=n.rays.filter(e=>Number.isFinite(e.halfDepth)&&e.halfDepth>0).map(e=>({...e,thickLength:Math.max(...e.supports.filter(t=>t.halfDepth>=e.halfDepth-1e-12).map(e=>e.length),0),angle:(()=>{const t=Math.atan2(e.u[1],e.u[0]);return t<0?t+2*Math.PI:t})()})).sort((e,t)=>e.angle-t.angle);if(e.length<2)continue;const r=n.point;for(const i of e)for(const e of i.supports){if(!(e.halfDepth>0&&e.length>0))continue;const n=-i.u[1]*e.halfDepth,o=i.u[0]*e.halfDepth,s=[r[0]+i.u[0]*e.length,r[1]+i.u[1]*e.length];t.supports.push([[r[0]+n,r[1]+o],[s[0]+n,s[1]+o],[s[0]-n,s[1]-o],[r[0]-n,r[1]-o]])}for(let n=0;n{const e=s.angle-o.angle;return e>0?e:e+2*Math.PI})();if(a<1e-9)continue;const l=a>Math.PI+1e-9,c=4*Math.max(o.halfDepth,s.halfDepth),h=[r[0]-o.u[1]*o.halfDepth,r[1]+o.u[0]*o.halfDepth],d=[r[0]+s.u[1]*s.halfDepth,r[1]-s.u[0]*s.halfDepth],u=o.u[0]*s.u[1]-o.u[1]*s.u[0],p=e=>{let t=Math.atan2(e[1]-r[1],e[0]-r[0])-o.angle;for(;t<0;)t+=2*Math.PI;return t<=a+1e-9};let _=null;if(Math.abs(u)>1e-9){const e=((d[0]-h[0])*s.u[1]-(d[1]-h[1])*s.u[0])/u,t=((d[0]-h[0])*o.u[1]-(d[1]-h[1])*o.u[0])/u,i=[h[0]+o.u[0]*e,h[1]+o.u[1]*e];(l?e<=1e-9&&t<=1e-9:e>1e-9&&e<=o.thickLength&&t<=s.thickLength)&&Math.hypot(i[0]-r[0],i[1]-r[1])<=c&&p(i)&&(_=i)}const m=e=>{Math.abs(hs(e))>i&&t.fans.push(e)};if(_){const e=1.5*Math.max(o.halfDepth,s.halfDepth);m(So([r[0],r[1]],h,_,d,e)??[[r[0],r[1]],h,_,d]);continue}if(l){m([[r[0],r[1]],h,d]);continue}const g=(e,t)=>Math.min(t,Math.sqrt(Math.max(c**2-e**2,0)),2*Math.max(o.halfDepth,s.halfDepth)),f=[h[0]+o.u[0]*g(o.halfDepth,o.thickLength),h[1]+o.u[1]*g(o.halfDepth,o.thickLength)],v=[d[0]+s.u[0]*g(s.halfDepth,s.thickLength),d[1]+s.u[1]*g(s.halfDepth,s.thickLength)];m([[r[0],r[1]],h,f,v,d])}}return t}function Ms(e,t){return!e||!Array.isArray(t)||t.length<2||!t.slice(0,2).every(Number.isFinite)?null:xs(e.index,t,e.epsilon).filter(i=>Math.hypot(i.point[0]-t[0],i.point[1]-t[1])<=e.epsilon).sort((e,i)=>Math.hypot(e.point[0]-t[0],e.point[1]-t[1])-Math.hypot(i.point[0]-t[0],i.point[1]-t[1])||e.point[0]-i.point[0]||e.point[1]-i.point[1])[0]||null}function Rs(e,t,i,n,r,o,s){return Ss(Ts(e,t,i,n,r,o,s),4*cs(n,s),s)}function Cs(e,t,i,n,r,o,s,a=1){const l=ys(e,t,n,r,a,i);if(!l)return null;const c=function(e,t,i){const n=(e||[]).find(e=>e?.id===t),r=ni(n);if(!r)return[];const o=[];for(const n of e||[]){if(!n||n.id===t)continue;const e=ni(n);if(e)for(const t of An(r,e,i))o.push(t)}return o}(e,t,cs(r,a)),h=function(e,t,i,n,r){const o=cs(n,r),s=[];for(let a=0;aFs(h,d,e[0],e[1],e[2],e[3])<=o);s.push(u?"shared":"outer")}return s}(l.poly,c,n,r,a),d=bs(i,l,r,a),u=d.map((e,t)=>h[t]&&e>0?Ao(e,o,s)/2:0);return{...l,kinds:h,cms:d,offsets:u}}function Ts(e,t,i,n,r,o,s=1){const a=[];for(const l of e||[]){if(!l?.id)continue;const c=Cs(e,l.id,t,i,n,r,o,s);if(c)for(let e=0;e0&&(a=Zo(a,e.a,e.b,e.cm,n,s));return a}function As(e,t,i,n,r,o,s=1){if(!t?.length)return[];const a=Ts(e,t,i,n,r,o,s),l=new Map;for(const e of a){if(e.open||!e.kind||!e.roomId)continue;const t=l.get(e.key)||new Set;t.add(e.roomId),l.set(e.key,t)}const c=e=>{const t=[...l.get(e)||[]].sort();return 1!==t.length&&2!==t.length?`ambiguous:${e}`:`${1===t.length?"outer":"shared"}:${t.join("|")}`},h=[],d=new Set;for(const e of a)!e.open&&e.cm>0&&!d.has(e.key)&&(d.add(e.key),h.push({...e,ownerSignature:c(e.key)}));const u=[];for(const a of e||[]){if(!a?.id)continue;const l=Cs(e,a.id,t,i,n,r,o,s);if(l)for(let e=0;e0)||null===l.kinds[i]){e++;continue}const o=c(Eo(l.poly[i],l.poly[(i+1)%l.poly.length],n,s));let a=e;for(;a+10&&u.push({a:[d[0],d[1]],b:[p[0],p[1]],key:Eo(d,p,n,s),cm:r,len:_,ownerSignature:o}),e=a+1}}}u.sort((e,t)=>t.len-e.len||e.key.localeCompare(t.key));const p=[],_=new Set,m=new Set,g=4*cs(n,s);for(const e of u){const t=h.filter(t=>!m.has(t.key)&&t.cm===e.cm&&t.ownerSignature===e.ownerSignature&&qo(Bo(t.a,t.b),Bo(e.a,e.b))&&Fs(t.a[0],t.a[1],e.a[0],e.a[1],e.b[0],e.b[1])<=g&&Fs(t.b[0],t.b[1],e.a[0],e.a[1],e.b[0],e.b[1])<=g);if(t.length){for(const e of t)m.add(e.key);_.has(e.key)||(_.add(e.key),p.push(Ho(e.a,e.b,e.cm,n,s)))}}for(const e of h)m.has(e.key)||_.has(e.key)||(_.add(e.key),p.push(Ho(e.a,e.b,e.cm,n,s)));return p}function Ps(e,t,i,n,r,o,s,a=1){const l=cs(r,a),c=(n[0]+n[2])/2,h=(n[1]+n[3])/2,d=Bo([n[0],n[1]],[n[2],n[3]]);let u=null;for(const n of Ts(e,t,i,r,o,s,a)){if(!qo(Bo(n.a,n.b),d))continue;const e=Fs(c,h,n.a[0],n.a[1],n.b[0],n.b[1]);e>4*l||(!u||e[e[0],e[1]]),o=Math.abs(hs(r));r.length>=3&&o>i&&(t=r,i=o)}return t}function Is(e,t,i,n,r,o,s,a=1,l,c){const h=(e||[]).find(e=>e?.id===t),d=ni(h);if(!d||d.length<3)return null;if(!i?.length)return d.map(e=>[e[0],e[1]]);const u=Cs(e,t,i,n,r,o,s,a);if(!u||!u.offsets.some(e=>e>0))return d.map(e=>[e[0],e[1]]);const p=c||Rs(e,i,n,r,o,s,a),_=gs(u.poly,u.offsets,p);if(!_)return d.map(e=>[e[0],e[1]]);if(!p.nodes.length)return _;const m=void 0===l?Zs(e,i,n,[],r,o,s,a):null,g=l??("ok"===m?.status||"degraded-extra"===m?.status?m.roomGeom:void 0);if(g)try{const e=zs(Gt(Os(u.poly),g));if(e)return e}catch{}return function(e,t){try{return zs(Ut(Os(e),Os(t)))}catch{return null}}(_,u.poly)||d.map(e=>[e[0],e[1]])}function Os(e){const t=e.map(e=>[e[0],e[1]]);return t.push([e[0][0],e[0][1]]),[t]}function Es(e){return!(!Array.isArray(e)||!e.length)&&e.every(e=>Array.isArray(e)&&e.length&&e.every(e=>Array.isArray(e)&&e.length>=4&&e.every(e=>Array.isArray(e)&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])))&&Math.abs(Ci(e[0]))>1e-9)}function Ns(e,t,i,n){const r=n?new Set(n):null;let o=null;for(let n=0;nt.epsilon))continue;const l=js([[e.point[0]+a[0]*n.halfDepth,e.point[1]+a[1]*n.halfDepth],[e.point[0]+s.u[0]*r+a[0]*n.halfDepth,e.point[1]+s.u[1]*r+a[1]*n.halfDepth],[e.point[0]+s.u[0]*r-a[0]*n.halfDepth,e.point[1]+s.u[1]*r-a[1]*n.halfDepth],[e.point[0]-a[0]*n.halfDepth,e.point[1]-a[1]*n.halfDepth]],t.coordinateScale);if(!l)continue;const c=Os(l);o=o?Wt(o,c):c}}return o}function Hs(e,t,i){let n=null;for(const r of e.rays)for(const e of r.continuations){const r=[-e.u[1],e.u[0]],o=[e.start[0]+e.u[0]*e.length,e.start[1]+e.u[1]*e.length],s=js([[e.start[0]+r[0]*e.halfDepth,e.start[1]+r[1]*e.halfDepth],[o[0]+r[0]*e.halfDepth,o[1]+r[1]*e.halfDepth],[o[0]-r[0]*e.halfDepth,o[1]-r[1]*e.halfDepth],[e.start[0]-r[0]*e.halfDepth,e.start[1]-r[1]*e.halfDepth]],t.coordinateScale);if(!s)continue;const a=Ut(Os(s),i);Array.isArray(a)&&0!==a.length&&(n=n?Wt(n,a):a)}return n}function Ls(e,t,i=2*(4*e.halfDepth+2*t.epsilon)){const n=function(e,t=$o){const i=new Set,n=Number.isFinite(t)&&t>=0?t:$o;for(let t=0;te-t)}(e);return n.length?Ns(e,t,i,n):null}function Bs(e,t,i,n,r){const o=function(e){let t=null;for(const i of e){const e=Os(i);try{t=t?Wt(t,e):e}catch{}}return t}(function(e,t,i=!1){if(!e)return[];const n=[];for(const r of e.nodes)for(let o=0;o1e-9)||h>=Math.PI-1e-9)continue;const d=[-s.u[1],s.u[0]],u=[-a.u[1],a.u[0]],p=[r.point[0]+d[0]*s.halfDepth,r.point[1]+d[1]*s.halfDepth],_=[r.point[0]-u[0]*a.halfDepth,r.point[1]-u[1]*a.halfDepth],m=ps(p,s.u,_,a.u);if(!m)continue;const g=Math.hypot(m[0]-r.point[0],m[1]-r.point[1]);if(!Number.isFinite(g)||g<=r.limit)continue;const f=t?Math.sqrt(Math.max(0,r.limit*r.limit-s.halfDepth*s.halfDepth)):0,v=t?Math.sqrt(Math.max(0,r.limit*r.limit-a.halfDepth*a.halfDepth)):0,y=js([[p[0]+s.u[0]*f,p[1]+s.u[1]*f],[_[0]+a.u[0]*v,_[1]+a.u[1]*v],m],e.coordinateScale);if(y&&n.push(y),i){const t=m[0]-r.point[0],i=m[1]-r.point[1],o=Math.hypot(t,i),s=g-r.limit;if(o>e.epsilon&&s>e.epsilon){const a=Math.min(Math.max(8*e.epsilon,.05*r.halfDepth),.25*s),l=t/o,c=i/o,h=-c,d=l,u=js([[m[0]-l*a+h*a,m[1]-c*a+d*a],[m[0]-l*a-h*a,m[1]-c*a-d*a],[m[0]+l*a,m[1]+c*a]],e.coordinateScale);u&&n.push(u)}}}return n}({...t,nodes:[e]},i,n));return o&&r?Gt(o,r):o}function qs(e,t,i,n){if(!e||!t.nodes.length)return e;let r=null;try{r=function(e){let t=null;for(const i of e.nodes){const n=Ls(i,e);n&&(t=t?Wt(t,n):n)}return t}(t)}catch{return e}let o=e;for(const e of t.nodes){const s=4*e.halfDepth+2*t.epsilon,a=2*s,l=[[e.point[0]-s,e.point[1]-s],[e.point[0]+s,e.point[1]-s],[e.point[0]+s,e.point[1]+s],[e.point[0]-s,e.point[1]+s]];try{let s=o;const c=Bs(e,t,!1,!0,r);c&&(s=Gt(s,c));let h=Ns(e,t,a);const d=Bs(e,t,!0,!0,r);d&&(h=Gt(h,d)),r&&(h=Wt(h,r));const u=.02*Math.min(...e.rays.map(e=>e.halfDepth));if(h=Wt(h,Os([[e.point[0]-u,e.point[1]-u],[e.point[0]+u,e.point[1]-u],[e.point[0]+u,e.point[1]+u],[e.point[0]-u,e.point[1]+u]])),!h)continue;let p=Ut(h,Os(l));n?p=Ut(p,n):i&&(p=Ut(p,i));const _=Os(l),m=Gt(s,_),g=i?Gt(Ut(s,_),i):null,f=Hs(e,t,_);o=Wt(m,...g?[g]:[],...f?[f]:[],p)}catch{}}if(r)try{let e=r;n?e=Ut(e,n):i&&(e=Ut(e,i)),o=Wt(o,e)}catch{}return o}function js(e,t=1){if(!Array.isArray(e)||e.length<3)return null;const i=Number.isFinite(t)&&t>0?t:1,n=1e-12*Math.max(1,i),r=[];for(const t of e){if(!Array.isArray(t)||t.length<2)return null;const e=Number(t[0]),i=Number(t[1]);if(!Number.isFinite(e)||!Number.isFinite(i))return null;const o=Math.round(e/n)*n,s=Math.round(i/n)*n;if(!Number.isFinite(o)||!Number.isFinite(s))return null;r.push([Object.is(o,-0)?0:o,Object.is(s,-0)?0:s])}return Math.abs(hs(r))>n*n?r:null}function Ws(e,t,i,n){if(Fs(e[0],e[1],t[0],t[1],i[0],i[1])>n)return!1;const r=i[0]-t[0],o=i[1]-t[1],s=(e[0]-t[0])*r+(e[1]-t[1])*o,a=r*r+o*o,l=n*Math.sqrt(a);return s>=-l&&s<=a+l}function Us(e,t,i){const n=[],r=[];for(let o=0;oi*i))continue;const d=i/Math.sqrt(h),u=[0,1];for(const e of t)for(const t of[e.a,e.b]){if(!Ws(t,s,a,i))continue;const e=((t[0]-s[0])*l+(t[1]-s[1])*c)/h;e>d&&e<1-d&&u.push(e)}u.sort((e,t)=>e-t);const p=u.filter((e,t)=>0===t||Math.abs(e-u[t-1])>d);for(let e=0;e=3&&r.length===n.length?{poly:n,offsets:r}:null}function Gs(e,t,i,n,r,o,s,a){const l=(e||[]).map(ni).filter(e=>!!e&&e.length>=3);if(!l.length)return null;let c=Wt(Os(l[0]));for(let e=1;e"outer"===e.kind&&e.half>0),u=4*cs(n,s),p=a||Ss(h,u,s);let _=null;for(const e of function(e){const t=[];for(const i of Array.isArray(e)?e:[])if(Array.isArray(i))for(const e of i){if(!Array.isArray(e)||e.length<4)continue;const i=e.slice(0,-1).map(e=>[e[0],e[1]]);i.length>=3&&t.push(i)}return t}(c)){const t=Us(e,d,u);if(!t||!t.offsets.some(e=>e>0))continue;const i=ia(t.poly,t.offsets,p),n=gs(t.poly,t.offsets,p);if(!i||!n)continue;const r=Gt(Os(i),Os(n));_=_?Wt(_,r):r}return{centre:c,shell:_||[]}}function Vs(e,t,i,n,r,o,s=1){try{const a=Gs(e,t,i,n,r,o,s,Rs(e,t,i,n,r,o,s));if(!a)return[];return a.shell?.length?Wt(a.centre,a.shell):a.centre}catch{return null}}function Ks(e){if(!e)return"";let t="";for(const i of e)if(Array.isArray(i))for(const e of i){if(!Array.isArray(e)||e.length<4)continue;const i=e.slice(0,e.length-1);i.length<3||(t+=(t?" ":"")+fs(i.map(e=>[e[0],e[1]])))}return t}const Ys=15;function Xs(e,t,i){const n=e?.length||0;if(n<3||t?.length!==n)return!1;const r=e[(i-1+n)%n],o=e[i],s=e[(i+1)%n],a=[r[0]-o[0],r[1]-o[1]],l=[s[0]-o[0],s[1]-o[1]],c=Math.hypot(a[0],a[1]),h=Math.hypot(l[0],l[1]);if(!(c>1e-9&&h>1e-9))return!1;const d=Math.max(-1,Math.min(1,(a[0]*l[0]+a[1]*l[1])/(c*h))),u=Math.acos(d);if(!(u>1e-9))return!1;if(u>=Ys*Math.PI/180)return!1;const p=Math.max(0,t[(i-1+n)%n]),_=Math.max(0,t[i]);if(!(p>0||_>0))return!1;const m=Math.sin(u);if(!(m>1e-12))return!1;const g=(_+p*d)/m,f=(p+_*d)/m;return Number.isFinite(g)&&Number.isFinite(f)&&g>0&&f>0&&ge>0))continue;for(const e of l.offsets)e>0&&(u=Math.max(u,2*e));const c=ia(l.poly,l.offsets,d),p=gs(l.poly,l.offsets,d);c&&h.push({outset:c,inset:p})}for(const e of l){const t=e.map(e=>e[0]),i=e.map(e=>e[1]);if(t.length){const n=Math.min(Math.max(...t)-Math.min(...t),Math.max(...i)-Math.min(...i)),r=Math.min(...e.map((t,i)=>{const n=e[(i+1)%e.length];return Math.hypot(n[0]-t[0],n[1]-t[1])}));u=Math.max(u,e.length>16?n:r)}}const p=function(e,t,i,n,r,o,s,a){if(!t?.length||!i?.length)return[];const l=4*cs(n,s),c=new Map;for(const a of Ts(e,t,i,n,r,o,s))!a.open&&a.half>0&&!c.has(a.key)&&c.set(a.key,a);const h=[...c.values()];if(h.length<2)return[];const d=a||Ss(h,l),u=[];for(const e of i)for(const t of[[e[0],e[1]],[e[2],e[3]]])u.some(e=>Math.hypot(e[0]-t[0],e[1]-t[1])<=l)||u.push(t);const p=[],_=(e,t)=>{let i=0,n=0;if(Math.hypot(e.a[0]-t[0],e.a[1]-t[1])<=l)i=e.b[0]-e.a[0],n=e.b[1]-e.a[1];else{if(!(Math.hypot(e.b[0]-t[0],e.b[1]-t[1])<=l))return null;i=e.a[0]-e.b[0],n=e.a[1]-e.b[1]}const r=Math.hypot(i,n);return r>l?[i/r,n/r]:null};for(const e of u){const t=h.map(t=>({iv:t,u:_(t,e)})).filter(e=>!!e.u);for(let i=0;i0?[e.slice(),u,m,_]:[e.slice(),_,m,u];else{if(!f)continue;{const t=[-r.u[1],r.u[0]],i=[-o.u[1],o.u[0]],n=s<0?1:-1,a=[e[0]+t[0]*r.iv.half*n,e[1]+t[1]*r.iv.half*n],l=[e[0]-i[0]*o.iv.half*n,e[1]-i[1]*o.iv.half*n];y=s>0?[e.slice(),a,l]:[e.slice(),l,a]}}Math.abs(hs(y))>l*l&&p.push(y)}}return p}(e,t,i,r,o,s,a,d),_=n.length?na(e,t,i,r,o,s,a):null;let m="exterior";try{const v=Gs(e,t,i,r,o,s,a,d);m="paper";const y=v?v.shell?.length?Wt(v.centre,v.shell):v.centre:[],b=e=>{const t=Os(e.outset);if(!e.inset)return t;const i=Os(e.inset);return Gt(t,i)};m="room-rings";let w=null;for(const e of h)try{const t=b(e);w=w?Wt(w,t):t}catch{}if(m="edge-bodies",v)for(const n of ea(e,t,i,r,o,s,a))try{const e=Ut(Os(n.quad),v.centre);w=w?Wt(w,e):e}catch{}m="junctions",w=function(e,t,i=1,n=Wt){let r=e;for(const e of t||[]){const t=js(e,i);if(t)try{const e=Os(t);r=r?n(r,e):e}catch{}}return r}(w,p,a),m="facade-clip",w&&v&&(w=Ut(w,v.centre)),m="exterior-shell";const k=[];let x=0;if(v?.shell?.length)if(w)try{const e=Wt(w,v.shell);if(!Es(e))throw new Error("invalid shell union");w=e}catch{if(!Es(w)||!Es(v.shell))throw new Error("invalid shell");k.push({id:"exterior-shell",geom:v.shell}),x++}else w=v.shell;if(m="multi-wall-trim",w&&d.nodes.length){const e=e=>e.rays.some(e=>e.supports.some(e=>e.length<2*e.halfDepth)),t=d.nodes.filter(e);if(t.length){w=qs(w,{...d,nodes:t},v?.centre,y)}}if(m="junction-corners",d.nodes.length){const n=$s(d),l=function(e,t,i,n,r,o,s,a){try{const l=Gs(e,t,i,n,r,o,s,{epsilon:a.epsilon,coordinateScale:a.coordinateScale,nodes:[],index:new Map});return l?l.shell?.length?Wt(l.centre,l.shell):l.centre:null}catch{return null}}(e,t,i,r,o,s,a,d);for(const e of n.fans)try{let t=[Os(e)];if(l&&(t=Ut(t,l)),!t?.length)continue;w=w?Wt(w,t):t}catch{}g=w,f=Math.max(d.epsilon,1e-9)**2,w=Array.isArray(g)?g.map(e=>{if(!Array.isArray(e)||!e.length)return e;const[t,...i]=e;return Math.abs(hs(t||[]))<=f?null:[t,...i.filter(e=>Math.abs(hs(e||[]))>f)]}).filter(e=>!!e):g}const S=w||[],$=[...Es(S)?[{id:"room-primary",geom:S}]:[],...k.map((e,t)=>({id:`room-isolated-${t}`,geom:e.geom}))];m="openings";for(const e of n){if(!(e.length>0))continue;const t=sa(_,e,!0);if(!t.negative&&!t.positive)continue;const i=e.angle*Math.PI/180,n=Math.cos(i),o=Math.sin(i),s=-o,l=n,c=e.length/2,h=1.25*Math.max(u,r*a),d=[[e.x-n*c-s*h,e.y-o*c-l*h],[e.x+n*c-s*h,e.y+o*c-l*h],[e.x+n*c+s*h,e.y+o*c+l*h],[e.x-n*c+s*h,e.y-o*c+l*h]];w&&(w=Gt(w,Os(d)));for(const e of k)e.geom=Gt(e.geom,Os(d))}m="extras";const M=[];let R=0;const C=c.mergeExtra||((e,t)=>e?Wt(e,t):t);for(let e=0;ee.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1]))||Math.abs(Ci(t))<=1e-9){R++;continue}const i=[Os(t)];try{const t=C(w,i,e);if(!Es(t))throw new Error("invalid extra union");w=t}catch{R++,Es(i)&&M.push({id:`extra-${e}`,geom:i})}}M.push(...k),M.sort((e,t)=>Ks(e.geom).localeCompare(Ks(t.geom)));const T=w||[];return{status:R||x?"degraded-extra":"ok",geom:T,components:[...Es(T)?[{id:"primary",geom:T}]:[],...M.map((e,t)=>({...e,id:`isolated-${t}`}))],roomGeom:S,roomComponents:$,paperGeom:y,depthUnits:u,openingPadUnits:1.25*Math.max(u,r*a),openingIndex:_,multiWallNodes:d,degradedExtraCount:R+x}}catch{return c.onCoreFailure?.(m),{status:"failed-core",geom:[],components:[],roomGeom:[],paperGeom:[],roomComponents:[],depthUnits:u,openingIndex:null,multiWallNodes:d,degradedExtraCount:0}}var g,f}function Js(e,t,i,n=[],r,o,s,a=1,l=[],c={}){if(!t?.length&&!l.length)return null;return Qs(Zs(e,t,i,n,r,o,s,a,l,c))}function Qs(e){if("failed-core"===e.status||"not-applicable"===e.status)return null;const t=e.components.map(e=>({id:e.id,d:Ks(e.geom),fillRule:"evenodd"})).filter(e=>!!e.d),i=t[0]?.d||"",n=Ks(e.paperGeom);if(t.length){const r={status:e.status,d:i,paths:t,components:e.components,roomGeom:e.roomGeom,multiWallNodes:e.multiWallNodes,paperD:n,depthUnits:e.depthUnits,fillRule:"evenodd"};return Object.defineProperties(r,{roomComponents:{value:e.roomComponents||[],enumerable:!1},openingIndex:{value:e.openingIndex,enumerable:!1},openingPadUnits:{value:e.openingPadUnits,enumerable:!1}}),r}return null}function ea(e,t,i,n,r,o,s=1){if(!t?.length)return[];const a=new Set,l=[];for(const c of e||[]){if(!c?.id)continue;const h=Cs(e,c.id,t,i,n,r,o,s);if(!h)continue;const d=h.poly;for(let e=0;e0))continue;const p=Eo(t,i,n,s);if(a.has(p))continue;a.add(p);const _=Ao(u,r,o),[m,g]=ds(d,e),f=-m,v=-g,y=_/2,b=[[t[0]+f*y,t[1]+v*y],[i[0]+f*y,i[1]+v*y],[i[0]+m*y,i[1]+g*y],[t[0]+m*y,t[1]+g*y]];l.push({key:p,kind:c,cm:u,quad:b,a:[t[0],t[1]],b:[i[0],i[1]],depthUnits:_})}}return l}function ta(e,t=[]){let i=fs(e.quad);const[n,r]=Io(e.a,e.b),o=n,s=r,a=-s,l=o;for(const n of t){if(!Go(e.a,e.b,n.angle))continue;if(Fs(n.x,n.y,e.a[0],e.a[1],e.b[0],e.b[1])>Math.max(.55*e.depthUnits,.001))continue;const t=n.length/2,r=e.depthUnits,c=n.x,h=n.y;i+=` ${fs(vs([[c-o*t-a*r,h-s*t-l*r],[c+o*t-a*r,h+s*t-l*r],[c+o*t+a*r,h+s*t+l*r],[c-o*t+a*r,h-s*t+l*r]]))}`}return i}function ia(e,t,i){const n=e?.length||0;if(n<3||t.length!==n)return null;if(t.every(e=>!(e>0)))return e.map(e=>[e[0],e[1]]);vs(e),t.slice().reverse();const r=[];for(let o=0;o0||l>0)){r.push([e[o][0],e[o][1]]);continue}if(a>0!=l>0){const t=e[o],i=a>0?[t[0]-c*a,t[1]-h*a]:[t[0],t[1]],n=l>0?[t[0]-d*l,t[1]-u*l]:[t[0],t[1]];r.push(i),Math.hypot(n[0]-i[0],n[1]-i[1])>1e-9&&r.push(n);continue}if(us(w,k)){const t=e[o],i=[t[0]-c*a,t[1]-h*a],n=[t[0]-d*l,t[1]-u*l];r.push(i),Math.hypot(n[0]-i[0],n[1]-i[1])>1e-9&&r.push(n);continue}const $=ps(x,w,S,k),M=Math.max(a,l,1e-9),R=Ms(i,e[o])?.limit??4*M;if($){const i=Math.hypot($[0]-e[o][0],$[1]-e[o][1]);if(Number.isFinite(i)&&i<=R){r.push($);continue}if(Xs(e,t,o)){r.push([e[o][0],e[o][1]]);continue}}a>0&&r.push([e[o][0]-c*a,e[o][1]-h*a]),l>0&&r.push([e[o][0]-d*l,e[o][1]-u*l])}return r.length>=3?r:null}function na(e,t,i,n,r,o,s=1){const a=[];for(const l of e||[]){if(!l?.id)continue;const c=Cs(e,l.id,t,i,n,r,o,s);if(!c)continue;const h=Math.abs(Ci(c.poly));for(let e=0;e[Math.max(t,e.x0),Math.min(i,e.x1)]).filter(e=>e[1]-e[0]>n).sort((e,t)=>e[0]-t[0]||e[1]-t[1]);if(!r.length)return{coverage:0,full:!1};let o=r[0][0],s=r[0][1],a=0,l=o<=t+n;for(let e=1;e=i-n,{coverage:a,full:l}}function oa(e,t){return Number(t.full)-Number(e.full)||e.faceDistance-t.faceDistance||e.area-t.area||e.roomId.localeCompare(t.roomId)}function sa(e,t,i=!1){const n=Number(t?.x),r=Number(t?.y),o=Number(t?.angle),s=Number(t?.length);if(!([n,r,o,s].every(Number.isFinite)&&s>0))return{negative:null,positive:null};const a=o*Math.PI/180,l=Math.cos(a),c=Math.sin(a),h=-c,d=l,u=s/2,p=Math.max(1e-9,e.adjacencyEps),_=new Map;let m=0;for(const t of e.edges){if(i&&!(t.half>0))continue;if(!Go(t.a,t.b,o))continue;const[e,s]=Io(t.a,t.b);if(Math.abs((n-t.a[0])*s-(r-t.a[1])*e)>p)continue;const a=(t.a[0]-n)*l+(t.a[1]-r)*c,g=(t.b[0]-n)*l+(t.b[1]-r)*c,f=Math.max(-u,Math.min(a,g)),v=Math.min(u,Math.max(a,g));if(v-f<=p)continue;const y=t.inward[0]*h+t.inward[1]*d>=0?1:-1,b=((t.a[0]+t.b[0])/2-n)*h+((t.a[1]+t.b[1])/2-r)*d,w=Math.abs(b+y*t.half),k=`${y}|${t.roomId}`,x={x0:f,x1:v,half:t.half,cm:t.cm,key:t.key,axis:[e,s]},S=_.get(k);S?(S.pieces.push(x),S.faceDistance=Math.min(S.faceDistance,w)):_.set(k,{roomId:t.roomId,side:y,order:m++,pieces:[x],faceDistance:w,area:t.area,coverage:0,full:!1})}for(const e of _.values()){const t=ra(e.pieces,-u,u,p);e.coverage=t.coverage,e.full=t.full}const g=e=>{const t=[..._.values()].filter(t=>t.side===e&&t.coverage>p);return t.sort(oa),t[0]||null};return{negative:g(-1),positive:g(1)}}function aa(e,t,i,n,r,o,s=1,a=[]){return la(na(e,i,a,n,r,o,s),t)}function la(e,t){const i=sa(e,t),n=[i.negative,i.positive].filter(e=>!!e);if(!n.length)return{ox:0,oy:0,cm:0,side:-1};const r=i.negative&&i.positive?-1:n[0].side,o=t.flip_v?-r:r,s=(-1===o?i.negative:i.positive)||n[0],a=[...s.pieces].sort((e,t)=>(e.x0<=0&&e.x1>=0?0:Math.min(Math.abs(e.x0),Math.abs(e.x1)))-(t.x0<=0&&t.x1>=0?0:Math.min(Math.abs(t.x0),Math.abs(t.x1)))||t.x1-t.x0-(e.x1-e.x0)||e.key.localeCompare(t.key))[0];if(!(a.half>0&&a.cm>0))return{ox:0,oy:0,cm:0,side:o};const l=t.angle*Math.PI/180,c=-Math.sin(l),h=Math.cos(l);return{ox:c*o*a.half,oy:h*o*a.half,cm:a.cm,side:o}}function ca(e,t){const i=1e-9,n=t.filter(e=>Number.isFinite(e.x0)&&Number.isFinite(e.x1)&&Number.isFinite(e.half)&&e.x1>e.x0&&e.half>0);if(!n.length)return"";const r=n.flatMap(e=>[e.x0,e.x1]).sort((e,t)=>e-t),o=[];for(const e of r){const t=o[o.length-1];(void 0===t||e>t+i)&&o.push(e)}const s=[];for(let e=0;e+1t+i))continue;const a=(t+r)/2,l=n.reduce((e,t)=>a>=t.x0-i&&a<=t.x1+i?Math.max(e,t.half):e,0);if(!(l>0))continue;const c=s[s.length-1];c&&t<=c.x1+i&&Math.abs(l-c.half)<=i?c.x1=r:s.push({x0:t,x1:r,half:l})}const a=[];for(const e of s){const t=a[a.length-1],n=t?.[t.length-1];n&&e.x0<=n.x1+i?(e.x0=n.x1,t.push(e)):a.push([e])}return a.map(t=>{const i=t[0],n=t[t.length-1],r=Math.min(.25*Math.min(...t.map(e=>e.half)),.75),o=-e*r,s=[];if(1===e){s.push(`M ${i.x0} ${o} L ${n.x1} ${o}`);for(let e=t.length-1;e>=0;e--){const i=t[e];s.push(`L ${i.x1} ${i.half} L ${i.x0} ${i.half}`)}}else{s.push(`M ${n.x1} ${o} L ${i.x0} ${o}`);for(const e of t)s.push(`L ${e.x0} ${-e.half} L ${e.x1} ${-e.half}`)}return s.push("Z"),s.join(" ")}).join(" ")}function ha(e,t,i,n){if(!n)return i;const r=e.angle*Math.PI/180,o=Math.cos(r),s=Math.sin(r),a=[],l=1e-9;for(const r of i){const[i,c]=r.axis,h=o*i+s*c;if(Math.abs(h)<=l)continue;const d=e.x*i+e.y*c,u=d+h*r.x0,p=d+h*r.x1,_=Math.min(u,p),m=Math.max(u,p),g=`${r.key}|${t}`,f=n.get(g)||[];let v=[[_,m]];for(const[e,t]of f){const i=[];for(const[n,r]of v)t<=n+l||e>=r-l?i.push([n,r]):(e>n+l&&i.push([n,Math.min(r,e)]),te[0]-t[0]||e[1]-t[1]),b=[];for(const e of y){const t=b[b.length-1];t&&e[0]<=t[1]+l?t[1]=Math.max(t[1],e[1]):b.push([e[0],e[1]])}n.set(g,b)}return a}function da(e,t){const i=new Map;return t.map(t=>function(e,t,i){const n=sa(e,t,!0),r=n.negative,o=n.positive;if(!r&&!o)return null;let s;if(r&&o)s=[{candidate:r,side:-1},{candidate:o,side:1}];else{const e=r||o;s=[{candidate:e,side:-1},{candidate:e,side:1}]}const a=s.map(({candidate:e,side:n})=>({candidate:e,side:n,pieces:ha(t,n,e.pieces,i)})),l=a.map(({candidate:e,side:t,pieces:i})=>({side:t,roomId:e.roomId,d:ca(t,i)})),c=a.flatMap(({pieces:e})=>e);if(!c.length)return null;const h=Math.max(...c.map(e=>e.half));return{faces:l,minY:-h,maxY:h,wallKey:[...new Set(c.map(e=>e.key))].sort().join("|")}}(e,t,i))}const ua=150,pa=1e-6;function _a(e){return Number.isFinite(e)?Math.max(1,Math.min(ua,e)):1}function ma(e){return((Number.isFinite(Number(e))?Number(e):0)%90+90)%90}const ga=e=>{const t=e.map(e=>[e[0],e[1]]);return!t.length||t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]||t.push([...t[0]]),[t]},fa=(e,t)=>e[0]===t[0]&&e[1]===t[1];function va(e,t=1e-6){const i=Number.isFinite(t)&&t>0?t:pa,n=[];for(const t of e||[]){if(!Array.isArray(t)||t.length<2)return null;const e=Number(t[0]),r=Number(t[1]);if(!Number.isFinite(e)||!Number.isFinite(r))return null;const o=Math.round(e/i)*i,s=Math.round(r/i)*i;if(!Number.isFinite(o)||!Number.isFinite(s))return null;const a=[Object.is(o,-0)?0:o,Object.is(s,-0)?0:s];n.length&&fa(n[n.length-1],a)||n.push(a)}return n.length>1&&fa(n[0],n[n.length-1])&&n.pop(),n.length<3||new Set(n.map(e=>`${e[0]},${e[1]}`)).size<3?null:Ci(n)>i*i?n:null}function ya(e){const t=[];for(const i of e||[])for(const e of i||[]){const i=(e||[]).filter(e=>Array.isArray(e)&&e.length>=2);i.length<4||t.push(`M ${i.slice(0,-1).map(e=>`${e[0]} ${e[1]}`).join(" L ")} Z`)}return t.join(" ")}function ba(e,t,i,n,r){return es({a:e,b:t,halfDepth:Ao(i,n,r)/2})}function wa(e,t,i){const n=Number(t)>0?Number(t):5,r=_a(e.cm)/n*i,o=e.center[0],s=e.center[1];if("circle"===e.shape){const e=r/2;return Array.from({length:96},(t,i)=>{const n=i/96*Math.PI*2;return[o+Math.cos(n)*e,s+Math.sin(n)*e]})}const a=r/2,l=ma(e.angle)*Math.PI/180,c=Math.cos(l),h=Math.sin(l);return[[-a,-a],[a,-a],[a,a],[-a,a]].map(([e,t])=>[o+e*c-t*h,s+e*h+t*c])}function ka(e,t){const i=Number.isFinite(t)?Math.max(0,Math.min(1,t)):0,n=(e.a[0]+e.b[0])/2,r=(e.a[1]+e.b[1])/2,o=(e.b[0]-e.a[0])*i/2,s=(e.b[1]-e.a[1])*i/2;return{...e,a:[n-o,r-s],b:[n+o,r+s]}}function xa(e,t,i=1e-9){if(!t.length)return[e];let n=[ga(e)];try{for(const e of t){const t=e.b[0]-e.a[0],r=e.b[1]-e.a[1],o=Math.hypot(t,r);if(!(o>i))continue;const s=t/o,a=r/o,l=-a,c=s,h=1.25*Math.max(Number(e.depth)||0,4*i),d=Math.max(2*i,1e-9*o),u=[[e.a[0]-s*d-l*h,e.a[1]-a*d-c*h],[e.b[0]+s*d-l*h,e.b[1]+a*d-c*h],[e.b[0]+s*d+l*h,e.b[1]+a*d+c*h],[e.a[0]-s*d+l*h,e.a[1]-a*d+c*h]];n=Gt(n,ga(u))}return Fa(n)}catch{return[e]}}function Sa(e,t){try{const i=Gt([[...e.map(e=>[e[0],e[1]]),[e[0][0],e[0][1]]]],[[...t.map(e=>[e[0],e[1]]),[t[0][0],t[0][1]]]]);let n=null,r=0;for(const e of i||[]){const t=e?.[0]||[],i=Math.abs(Ci(t));t.length>=4&&i>r&&(r=i,n=t.slice(0,-1).map(e=>[e[0],e[1]]))}return n}catch{return null}}function $a(e,t,i,n=Math.max(2e-4*i,1e-9),r=[]){const o=[],s=new Map;for(const e of r){const t=s.get(e.hostId)||[];t.push(e),s.set(e.hostId,t)}const a=[],l=[],c=[];for(const n of e.partitions||[]){const e={a:n.a,b:n.b,halfDepth:Ao(n.cm,t,i)/2};if(!(e.halfDepth>0))continue;const r=es(e);r&&(o.push(e),a.push(r),c.push({id:n.id,body:r}))}const h=o;for(const{segmentIndex:e,wedge:t}of os(h,n)){const i={list:a,at:e},n=Sa(i.list[i.at],t);n&&(i.list[i.at]=n,c[i.at].body=n)}for(const e of c)l.push(...xa(e.body,s.get(e.id)||[],n));const d=(e.wall_columns||[]).map(e=>wa(e,t,i)),u=ss(o,n).flatMap(e=>xa(e,r,n));return{partitions:a,columns:d,patches:u,all:[...l,...u,...d]}}function Ma(e){try{const t=e.map(e=>va(e)).filter(e=>!!e).map(e=>ga(e));return t.length?Wt(t[0],...t.slice(1)):null}catch{return null}}const Ra=e=>`M ${e.map(e=>`${e[0]} ${e[1]}`).join(" L ")} Z`;function Ca(e){const t=[];for(const i of e||[]){if(Aa([i])<=1e-6)continue;const e=[];for(const t of i||[]){const i=(t||[]).filter(e=>Array.isArray(e)&&e.length>=2);i.length<4||e.push(Ra(i.slice(0,-1)))}e.length&&t.push(e.join(" "))}return t}function Ta(e,t,i={}){const n=Ma(e.filter(e=>e.length>=3)),r=t.some(e=>!va(e))?null:Ma(t);if(!n)return[];if(r)try{return Ca(Ut(n,r))}catch{}return function(e,t,i){let n=null;for(let r=0;r=4&&t.push(e.slice(0,-1).map(e=>[e[0],e[1]]));return t}function Fa(e){const t=[];for(const i of e||[]){const e=i?.[0];e?.length>=4&&t.push(e.slice(0,-1).map(e=>[e[0],e[1]]))}return t}function za(e,t){let i=!1;for(let n=0,r=t.length-1;ne[1]!=l>e[1]&&e[0]<(a-o)*(e[1]-s)/(l-s||1e-12)+o&&(i=!i)}return i}function Ia(e,t){for(const i of t||[]){const t=i?.[0];if(!t?.length||!za(e,t))continue;let n=!1;for(let t=1;ti)return!1;if(Math.abs(_a(e.cm)-_a(t.cm))>1e-6)return!1;if(e.shape!==t.shape)return!0;if("circle"===e.shape||"circle"===t.shape)return!0;const n=Math.abs(ma(e.angle)-ma(t.angle));return Math.min(n,90-n)<=1e-6}const Ea=2.54;function Na(e){const t="number"==typeof e?e:NaN;return!Number.isFinite(t)||t<=0||5===t?1:5/t}function Ha(e,t){return e*Na(t)}function La(e){return e?Ea:1}function Ba(e,t){if(!t)return String(e);const i=e/Ea;return String(Math.round(1e6*i)/1e6)}function qa(e,t){return t?e*Ea:e}const ja=1e3;function Wa(e,t){const i=Number(e),n=Number.isFinite(i)&&i>0?i:1,r=n>=1?t:t*n,o=n>=1?t/n:t;return{x:(t-r)/2,y:(t-o)/2,w:r,h:o}}const Ua=.01,Ga=100;function Va(e,t=1e3){const i=Wa(e?.plan_aspect,t),n=Number(e?.plan_scale),r=Number.isFinite(n)&&n>0?Math.min(Ga,Math.max(Ua,n)):1,o=Number(e?.plan_scale_x),s=Number(e?.plan_scale_y),a=Number.isFinite(o)&&o>0?Math.min(Ga,Math.max(Ua,o)):r,l=Number.isFinite(s)&&s>0?Math.min(Ga,Math.max(Ua,s)):r,c=Number(e?.plan_x),h=Number(e?.plan_y),d=$r(e?.plan_angle);return{x:i.x+(Number.isFinite(c)?rl(c):0)*t,y:i.y+(Number.isFinite(h)?rl(h):0)*t,w:i.w*a,h:i.h*l,...d?{angle:d}:{}}}function Ka(e){if(null==e.x||null==e.y)return{x:e.x,y:e.y,w:e.w,h:e.h};const t=Number(e.w)||0,i=Number(e.h)||0;return{x:t<0?e.x+t:e.x,y:i<0?e.y+i:e.y,w:Math.abs(t),h:Math.abs(i)}}function Ya(e){return e&&Array.isArray(e.spaces)?e.spaces.map(e=>{const t=ja,i=function(e){return Array.isArray(e)&&4===e.length&&e.every(e=>Number.isFinite(e))&&e[2]>1e-6&&e[3]>1e-6?e:[0,0,1,1]}(e.view_box);return{id:e.id,title:e.title,cellCm:Number.isFinite(Number(e.cell_cm))&&Number(e.cell_cm)>0?Number(e.cell_cm):5,vb:[i[0]*ja,i[1]*t,i[2]*ja,i[3]*t],bg:e.plan_url?{href:En(e.plan_url),...Va(e,ja)}:null,rooms:(e.rooms||[]).map(e=>{const i={...e,...Ka(e)};return{id:i.id,name:i.name,area:i.area??null,open_to:i.open_to||void 0,settings:i.settings||void 0,x:null!=i.x?i.x*ja:void 0,y:null!=i.y?i.y*t:void 0,w:null!=i.w?i.w*ja:void 0,h:null!=i.h?i.h*t:void 0,poly:i.poly?i.poly.map(e=>[e[0]*ja,e[1]*t]):void 0,wall_ids:Array.isArray(i.wall_ids)?[...i.wall_ids]:void 0}}),wall_segments:(e.wall_segments||[]).map(e=>({...e,id:String(e.id),a:[Number(e.a?.[0])*ja,Number(e.a?.[1])*t],b:[Number(e.b?.[0])*ja,Number(e.b?.[1])*t],cm:Number(e.cm)})),partitions:(e.partitions||[]).map(e=>({id:e.id,a:[e.a[0]*ja,e.a[1]*t],b:[e.b[0]*ja,e.b[1]*t],cm:Number(e.cm)})),wall_columns:(e.wall_columns||[]).map(e=>({id:e.id,shape:"circle"===e.shape?"circle":"square",center:[e.center[0]*ja,e.center[1]*t],cm:Number(e.cm),..."circle"===e.shape?{}:{angle:ma(e.angle)}}))}}):[]}const Xa=5e3,Za=Xa*ja,Ja=240,Qa=ja/Ja,el=1/Ja;function tl(e){if(!Number.isFinite(e))return e;const t=Math.round(e*Ja/ja)*ja/Ja;return Math.abs(t-e)<=1e-9*Qa?e:t}function il(e){return{x:tl(e.x),y:tl(e.y)}}function nl(e){return Number.isFinite(e)?Math.min(Za,Math.max(-Za,e)):0}function rl(e){return Number.isFinite(e)?Math.min(Xa,Math.max(-Xa,e)):0}const ol=1/3,sl=200;function al(e){return"house"===e?"house":"content"}function ll(e){let t=1/0,i=1/0,n=-1/0,r=-1/0;for(const o of e){const e=Number(o[0]),s=Number(o[1]);Number.isFinite(e)&&Number.isFinite(s)&&(en&&(n=e),s>r&&(r=s))}return t>n?null:{minX:t,minY:i,maxX:n,maxY:r}}function cl(e){const t=[],i=e=>{if(Array.isArray(e))if(e.length>=2&&Number.isFinite(Number(e[0]))&&Number.isFinite(Number(e[1])))t.push([Number(e[0]),Number(e[1])]);else for(const t of e)i(t)};return i(e),ll(t)}function hl(e,t){const i=Number.isFinite(t)&&t>0?t:0;return{minX:e.minX-i,minY:e.minY-i,maxX:e.maxX+i,maxY:e.maxY+i}}function dl(e){return e.poly&&e.poly.length?ll(e.poly):null==e.x||null==e.y?null:ll([[e.x,e.y],[e.x+(e.w||0),e.y+(e.h||0)]])}function ul(e,t=1e3,i=1e3){const n=Number(e.x)*t,r=Number(e.y)*i,o=Number(e.w)*t,s=Number(e.h)*i;return![n,r,o,s].every(Number.isFinite)||o<=0||s<=0?null:ll(Fr({x:n,y:r,w:o,h:s,angle:$r(e.angle)||void 0}))}function pl(e,t){const i=[];for(const t of e.rooms||[]){const e=dl(t);e&&i.push(e)}if(e.bg){const t=ll(Fr(e.bg));t&&i.push(t)}for(const e of t||[])if(Array.isArray(e)){const t=ll([e]);t&&i.push(t)}else i.push(e);return i}const _l=e=>{if(!e.length)return 0;const t=[...e].sort((e,t)=>e-t),i=t.length>>1;return t.length%2?t[i]:(t[i-1]+t[i])/2},ml=e=>{let t=1/0,i=1/0,n=-1/0,r=-1/0;for(const o of e)o.minXn&&(n=o.maxX),o.maxY>r&&(r=o.maxY);return t>n||i>r?null:{x:t,y:i,w:n-t,h:r-i}};function gl(e,t){let{x:i,y:n,w:r,h:o}=e;r<30&&(i=i+r/2-100,r=sl),o<30&&(n=n+o/2-100,o=sl);const s="number"==typeof t?{top:t,right:t,bottom:t,left:t}:t,a=Math.max(r,o),l=a*s.top,c=a*s.right,h=a*s.bottom,d=a*s.left;return{x:i-d,y:n-l,w:r+d+c,h:o+l+h}}function fl(e,t={}){const i=t.pad??.05,n=t.k??10,r=t.minSpread??50,o=e.filter(e=>Number.isFinite(e.minX)&&Number.isFinite(e.minY)&&Number.isFinite(e.maxX)&&Number.isFinite(e.maxY)&&Math.abs(e.minX)<=Za&&Math.abs(e.maxX)<=Za&&Math.abs(e.minY)<=Za&&Math.abs(e.maxY)<=Za);if(!o.length)return{core:null,all:null,outliers:0};const s=ml(o);if(o.length<4){const e=gl(s,i);return{core:e,all:e,outliers:0}}const a=o.map(e=>(e.minX+e.maxX)/2),l=o.map(e=>(e.minY+e.maxY)/2),c=_l(a),h=_l(l),d=o.map((e,t)=>Math.max(Math.abs(a[t]-c),Math.abs(l[t]-h))),u=Math.max(((e,t)=>e.length?e[Math.min(e.length-1,Math.max(0,Math.round(t*(e.length-1))))]:0)([...d].sort((e,t)=>e-t),.75),r),p=d.map(e=>e>n*u),_=p.filter(Boolean).length,m=_&&_<=o.length*ol?o.filter((e,t)=>!p[t]):o;return{core:gl(ml(m)||s,i),all:gl(s,i),outliers:m===o?0:_}}function vl(e){return fl(e,{pad:0}).all}function yl(e,t,i=.05){const n=fl(pl(e,t),{pad:i});if(n.core)return n.core;const r=e.vb&&4===e.vb.length&&e.vb[2]>0&&e.vb[3]>0?e.vb:[0,0,ja,ja];return{x:r[0],y:r[1],w:r[2],h:r[3]}}function bl(e){const t=yl(e);return{x:t.x+t.w/2,y:t.y+t.h/2}}function wl(e){const t=[];for(const i of e.rooms||[]){const e=dl(i);e&&t.push(e)}const i=fl(t,{pad:0}).core,n=ja*Na(e.cellCm??5);return i?Math.max(n,Math.min(Za,Math.max(i.w,i.h))):n}function kl(e,t,i,n=1){const r=Number(i),o=Number.isFinite(n)&&n>0?n:1;return!Number.isFinite(r)||r<=0?e*o:e*wl(t)*o/r}const xl=[1,2,5,10,20,50,100,200,500,1e3];function Sl(e,t,i=7){if(!(e>0&&t>0&&Number.isFinite(t)))return null;const n=xl.find(n=>e*n*t>=i);if(void 0===n)return null;const r=xl.find(e=>e>=5*n)??5*n;return{fine:n,coarse:r}}function $l(e){if(e.poly&&e.poly.length){const t=e.poly.map(e=>e[0]),i=e.poly.map(e=>e[1]),n=Math.min(...t),r=Math.min(...i);return{x:n,y:r,w:Math.max(...t)-n,h:Math.max(...i)-r}}return{x:e.x??0,y:e.y??0,w:e.w??0,h:e.h??0}}function Ml(e,t,i,n,r,o=new Set){const s=t[e.id];return!o.has(e.id)&&s&&s.s===e.space?{x:s.x*ja,y:s.y*ja}:n[e.id]?n[e.id]:il(bl(r))}function Rl(e,t,i,n){const r=i["rl_"+(e.id||"")];if(r&&r.s===t)return{x:r.x*ja,y:r.y*ja};const o=function(e){if(e.poly){const t=e.poly.length;return[e.poly.reduce((e,t)=>e+t[0],0)/t,e.poly.reduce((e,t)=>e+t[1],0)/t]}return[e.x+e.w/2,e.y+.1*Math.min(e.w,e.h)]}(e);return il({x:o[0],y:o[1]})}function Cl(e,t){for(const i of e?.spaces??[])for(const e of i?.decor??[])if("furniture"===e?.kind&&"string"==typeof e.symbol&&t(e.symbol))return!0;return!1}let Tl=0;const Dl=new Set;const Al=new class{constructor(e){this.options=e,this._art=null,this._failed=!1,this._terminal=!1,this._inFlight=null,this._hosts=new Set,this._settled=[]}state(){return this._art?"ready":this._failed?"fallback":"pending"}get terminal(){return this._terminal}art(e,t){if(this._art)return this._art[e];t&&!this._failed&&this._hosts.add(t)}adopt(e,t){return!!this._art||(t!==this.options.expectedFingerprint?((this.options.warn??console.warn)("[houseplan] furniture artwork from another build ignored",{fingerprint:t}),!1):(this._install(e),!0))}ensure(){return"pending"!==this.state()?Promise.resolve():(this._inFlight||(this._inFlight=this._loadWithRetry().finally(()=>{this._inFlight=null})),this._inFlight)}onSettled(e){"pending"===this.state()?this._settled.push(e):Promise.resolve().then(e)}async _loadWithRetry(){let e=new Error("furniture artwork did not load");for(const t of[0,1])try{const i=await this.options.load(t);if(i.FURNITURE_ART_FINGERPRINT!==this.options.expectedFingerprint){this._terminal=!0,e=new Error(`furniture artwork fingerprint mismatch: expected ${this.options.expectedFingerprint}, got ${i.FURNITURE_ART_FINGERPRINT}`);break}if(this._art)return;return void this._install(i.GENERATED_FURNITURE_ART)}catch(t){e=t}this._art||(this._failed=!0,(this.options.warn??console.warn)("[houseplan] furniture artwork unavailable",e),this.options.loadFailed?.(this._terminal),this._flush())}_install(e){this._art=e,this._failed=!1,this._flush()}_flush(){const e=[...this._hosts];this._hosts.clear();for(const t of e)t.isConnected&&t.requestUpdate();const t=this._settled.splice(0);for(const e of t)e()}}({expectedFingerprint:"012abf4b3924ad03971870eb8085ab1ac1a66b0d9b6676fe095285a8b0f201ab",load:async e=>0===e?await import("./furniture-plan-art.generated-C_WDX48s.js"):await import((()=>{const e=new URL("./furniture-plan-art.generated-C_WDX48s.js",import.meta.url);return e.searchParams.set("hp_retry","art-"+ ++Tl),e.href})()),loadFailed:e=>{for(const t of Dl)t(e)}}),Pl=["furniture","appliance","sanitary","other"],Fl=[{id:"sofa",group:"furniture",category:"sofa",w:220,h:90,g:[["r",0,0,1,1],["l",.09,.26,.91,.26],["l",.09,.26,.09,1],["l",.91,.26,.91,1],["l",.5,.26,.5,1]]},{id:"armchair",group:"furniture",category:"armchair",w:90,h:85,g:[["r",0,0,1,1],["l",.14,.28,.86,.28],["l",.14,.28,.14,1],["l",.86,.28,.86,1]]},{id:"coffee_table",group:"furniture",category:"coffee_table",w:110,h:60,g:[["r",0,0,1,1],["r",.08,.14,.84,.72]]},{id:"table_dining",group:"furniture",category:"dining_table",w:140,h:80,g:[["r",0,0,1,1],["r",.06,.11,.88,.78]]},{id:"table_round",group:"furniture",category:"dining_table",w:120,h:120,g:[["e",.5,.5,.5,.5],["e",.5,.5,.41,.41]]},{id:"chair",group:"furniture",category:"chair",w:45,h:45,g:[["r",0,0,1,.18],["r",.06,.18,.88,.8]]},{id:"desk",group:"furniture",category:"work_table",w:120,h:60,g:[["r",0,0,1,1],["r",.63,.07,.31,.86],["l",.63,.5,.94,.5]]},{id:"bed_double",group:"furniture",category:"bed",w:160,h:200,g:[["r",0,0,1,1],["r",0,0,1,.07],["r",.06,.1,.4,.15],["r",.54,.1,.4,.15],["l",0,.33,1,.33]]},{id:"bed_single",group:"furniture",category:"bed",w:90,h:200,g:[["r",0,0,1,1],["r",0,0,1,.07],["r",.15,.1,.7,.15],["l",0,.33,1,.33]]},{id:"nightstand",group:"furniture",category:"nightstand",w:45,h:40,g:[["r",0,0,1,1],["r",.12,.14,.76,.33],["r",.12,.53,.76,.33]]},{id:"wardrobe",group:"furniture",category:"wardrobe",w:100,h:60,g:[["r",0,0,1,1],["l",0,.72,1,.72],["l",.5,.72,.5,1]]},{id:"bookshelf",group:"furniture",category:"wardrobe",w:80,h:30,g:[["r",0,0,1,1],["l",.34,0,.34,1],["l",.67,0,.67,1]]},{id:"fridge",group:"appliance",category:"fridge",w:60,h:65,g:[["r",0,0,1,1],["l",0,.36,1,.36],["l",.83,.44,.83,.64]]},{id:"stove",group:"appliance",category:"cooktop",w:60,h:60,g:[["r",0,0,1,1],["e",.29,.31,.15,.15],["e",.71,.31,.15,.15],["e",.29,.71,.15,.15],["e",.71,.71,.15,.15]]},{id:"dishwasher",group:"appliance",category:"dishwasher",w:60,h:60,g:[["r",0,0,1,1],["r",.1,.12,.8,.76],["e",.5,.5,.27,.27],["e",.5,.5,.13,.13]]},{id:"washer",group:"appliance",category:"washer",w:60,h:60,g:[["r",0,0,1,1],["l",.08,.17,.92,.17],["e",.5,.57,.3,.3],["e",.5,.57,.14,.14]]},{id:"dryer",group:"appliance",category:"dryer",w:60,h:60,g:[["r",0,0,1,1],["l",.08,.17,.92,.17],["e",.5,.57,.3,.3],["p",.36,.5,.5,.64,.64,.5]]},{id:"tv",group:"appliance",category:"tv",w:120,h:30,g:[["r",0,0,1,.42],["l",.5,.42,.5,.72],["l",.3,.72,.7,.72]]},{id:"ac",group:"appliance",category:"air_conditioner",w:90,h:25,g:[["r",0,0,1,1],["l",.05,.55,.95,.55],["l",.05,.79,.95,.79]]},{id:"water_heater",group:"appliance",category:"boiler",w:45,h:45,g:[["e",.5,.5,.5,.5],["e",.5,.5,.31,.31]]},{id:"toilet",group:"sanitary",category:"toilet",w:40,h:70,g:[["r",.06,0,.88,.2],["e",.5,.58,.37,.35],["e",.5,.58,.22,.2]]},{id:"bathtub",group:"sanitary",category:"bathtub",w:170,h:75,g:[["r",0,0,1,1],["r",.05,.11,.77,.78],["e",.89,.5,.045,.1]]},{id:"shower",group:"sanitary",category:"shower",w:90,h:90,g:[["r",0,0,1,1],["l",0,0,1,1],["l",1,0,0,1],["e",.5,.5,.08,.08]]},{id:"sink",group:"sanitary",category:"sink",w:60,h:45,g:[["r",0,0,1,1],["e",.5,.6,.34,.3],["e",.5,.15,.07,.07]]},{id:"kitchen_sink",group:"sanitary",category:"kitchen_sink",w:80,h:60,g:[["r",0,0,1,1],["r",.06,.24,.44,.64],["r",.54,.24,.4,.64],["e",.5,.12,.06,.06]]},{id:"bidet",group:"sanitary",category:"bidet",w:40,h:55,g:[["e",.5,.5,.44,.5],["e",.5,.5,.26,.3]]},{id:"stairs",group:"other",category:"stairs",w:100,h:280,g:[["r",0,0,1,1],["l",0,.111,1,.111],["l",0,.222,1,.222],["l",0,.333,1,.333],["l",0,.444,1,.444],["l",0,.556,1,.556],["l",0,.667,1,.667],["l",0,.778,1,.778],["l",0,.889,1,.889],["l",.5,.93,.5,.06],["p",.38,.16,.5,.06,.62,.16]]},{id:"fireplace",group:"other",category:"fireplace",w:120,h:40,g:[["r",0,0,1,1],["p",.22,1,.22,.42,.78,.42,.78,1]]},{id:"plant",group:"other",category:"plant",w:40,h:40,g:[["e",.5,.5,.22,.22],["l",.5,.28,.5,.02],["l",.5,.72,.5,.98],["l",.28,.5,.02,.5],["l",.72,.5,.98,.5],["l",.34,.34,.13,.13],["l",.66,.66,.87,.87],["l",.66,.34,.87,.13],["l",.34,.66,.13,.87]]},{id:"rug",group:"other",category:"rug",w:200,h:140,g:[["r",0,0,1,1],["r",.06,.09,.88,.82]]}],zl=new Set(["fridge","dishwasher","washer","dryer","ac","water_heater","shower","sink","stairs","fireplace","plant","rug"]),Il=[...[{id:"coffee_table",group:"furniture",category:"coffee_table",w:120,h:60},{id:"coffee_table_round",group:"furniture",category:"coffee_table",w:80,h:80},{id:"coffee_table_oval",group:"furniture",category:"coffee_table",w:120,h:60},{id:"coffee_table_rounded",group:"furniture",category:"coffee_table",w:120,h:60},{id:"table_dining",group:"furniture",category:"dining_table",w:160,h:90},{id:"table_round",group:"furniture",category:"dining_table",w:110,h:110},{id:"table_dining_oval",group:"furniture",category:"dining_table",w:180,h:100},{id:"table_dining_rounded",group:"furniture",category:"dining_table",w:160,h:90},{id:"desk",group:"furniture",category:"work_table",w:140,h:70},{id:"desk_corner",group:"furniture",category:"work_table",w:160,h:160},{id:"chair",group:"furniture",category:"chair",w:50,h:50},{id:"chair_bar",group:"furniture",category:"chair",w:45,h:48},{id:"armchair",group:"furniture",category:"armchair",w:90,h:90},{id:"armchair_office",group:"furniture",category:"armchair",w:65,h:65},{id:"sofa",group:"furniture",category:"sofa",w:180,h:90},{id:"sofa_three_seat",group:"furniture",category:"sofa",w:240,h:90},{id:"sofa_corner_right",group:"furniture",category:"sofa",w:260,h:170},{id:"bed_single",group:"furniture",category:"bed",w:90,h:200},{id:"bed_double",group:"furniture",category:"bed",w:160,h:200},{id:"nightstand",group:"furniture",category:"nightstand",w:50,h:40},{id:"cabinet_tv",group:"furniture",category:"nightstand",w:140,h:45},{id:"cabinet_shoe",group:"furniture",category:"nightstand",w:80,h:35},{id:"cabinet_sink",group:"furniture",category:"nightstand",w:80,h:50},{id:"bookshelf",group:"furniture",category:"wardrobe",w:100,h:35},{id:"wall_unit",group:"furniture",category:"wardrobe",w:240,h:45},{id:"wardrobe",group:"furniture",category:"wardrobe",w:180,h:60},{id:"kitchen_floor",group:"furniture",category:"kitchen_cabinet",w:60,h:60},{id:"kitchen_floor_corner",group:"furniture",category:"kitchen_cabinet",w:90,h:90},{id:"kitchen_wall",group:"furniture",category:"kitchen_cabinet",w:60,h:35},{id:"kitchen_wall_corner",group:"furniture",category:"kitchen_cabinet",w:60,h:60},{id:"shelf_floor",group:"furniture",category:"shelving",w:100,h:35},{id:"shelf_wall",group:"furniture",category:"shelving",w:100,h:25},{id:"cooktop_two",group:"appliance",category:"cooktop",w:30,h:50},{id:"stove",group:"appliance",category:"cooktop",w:60,h:60},{id:"tv",group:"appliance",category:"tv",w:120,h:28},{id:"tv_wall",group:"appliance",category:"tv",w:120,h:15},{id:"toilet",group:"sanitary",category:"toilet",w:40,h:70},{id:"toilet_built_in",group:"sanitary",category:"toilet",w:40,h:55},{id:"bathtub",group:"sanitary",category:"bathtub",w:170,h:75},{id:"bathtub_corner",group:"sanitary",category:"bathtub",w:140,h:140},{id:"bidet",group:"sanitary",category:"bidet",w:40,h:60},{id:"bidet_built_in",group:"sanitary",category:"bidet",w:40,h:50},{id:"kitchen_sink",group:"sanitary",category:"kitchen_sink",w:60,h:50},{id:"kitchen_sink_double",group:"sanitary",category:"kitchen_sink",w:90,h:50}].map(e=>({id:e.id,group:e.group,category:e.category,w:e.w,h:e.h,designer:!0})),...Fl.filter(e=>zl.has(e.id))],Ol=new Map(Il.map(e=>[e.id,e]));function El(e){return e&&Ol.get(e)||null}function Nl(e){return!0===Ol.get(e)?.designer}function Hl(e){return Il.filter(t=>t.group===e)}function Ll(e){const t=El(e);return t?{w:t.w,h:t.h}:{w:60,h:60}}function Bl(e,t,i=Qa,n=1e3){const r=Number(t)>0?Number(t):5;return(Number(e)||0)/r*i/n}const ql=5e-4,jl=Xa;function Wl(e){return Number.isFinite(e)?Math.max(ql,Math.min(jl,e)):ql}function Ul(e){return Number.isFinite(e)?Math.max(1,Math.min(1e4,e)):1}const Gl=e=>{const t=Math.round(1e3*e)/1e3;return Object.is(t,-0)?"0":String(t)};function Vl(e,t){const i=El(e);if(!i)return null;if(i.designer)return Al.art(e,t)??null;const n=function(e,t,i){if(!e.g)return"";const n=e=>Gl(e*t),r=e=>Gl(e*i),o=[];for(const s of e.g)if("r"===s[0]){const[,e,t,i,a]=s;o.push(`M${n(e)} ${r(t)}H${n(e+i)}V${r(t+a)}H${n(e)}Z`)}else if("l"===s[0]){const[,e,t,i,a]=s;o.push(`M${n(e)} ${r(t)}L${n(i)} ${r(a)}`)}else if("e"===s[0]){const[,e,a,l,c]=s;o.push(`M${n(e-l)} ${r(a)}A${Gl(l*t)} ${Gl(c*i)} 0 0 1 ${n(e+l)} ${r(a)}A${Gl(l*t)} ${Gl(c*i)} 0 0 1 ${n(e-l)} ${r(a)}Z`)}else{const e=s.slice(1);if(e.length<4)continue;let t=`M${n(e[0])} ${r(e[1])}`;for(let i=2;i+10?n:Number.isFinite(r)&&r>0?r:1,s=Number(t),a=o*(Number.isFinite(s)&&s>0?s:1);return Number.isFinite(a)&&a>0?a:o}function Yl(e,t,i,n,r){const o=e+i/2,s=t+n/2,a=(Number(r)||0)*Math.PI/180,l=Math.cos(a),c=Math.sin(a),h=(e,t)=>{const i=e-o,n=t-s;return[o+i*l-n*c,s+i*c+n*l]};return[h(e,t),h(e+i,t),h(e+i,t+n),h(e,t+n)]}function Xl(e,t,i,n,r,o,s){const a=Number.isFinite(s)&&s>0?s:1e-6,l=(Number(e.angle)||0)*Math.PI/180,c=Math.cos(l),h=Math.sin(l),d=-Math.sin(l),u=Math.cos(l),p=e.x+e.w/2,_=e.y+e.h/2,m=t>0?-e.w/2:t<0?e.w/2:0,g=i>0?-e.h/2:i<0?e.h/2:0,f=p+m*c+g*d,v=_+m*h+g*u,y=n-f,b=r-v,w=t?(y*c+b*h)*(t>0?1:-1):e.w,k=i?(y*d+b*u)*(i>0?1:-1):e.h;let x=t?Math.abs(w):e.w,S=i?Math.abs(k):e.h;if(o&&t&&i){const t=x/Math.max(e.w,a),i=S/Math.max(e.h,a),n=Math.abs(t-1)>=Math.abs(i-1)?t:i,r=Math.max(a/e.w,a/e.h),o=Math.max(r,Number.isFinite(n)?n:r);x=e.w*o,S=e.h*o}x=Math.max(a,Number.isFinite(x)?x:a),S=Math.max(a,Number.isFinite(S)?S:a);const $=!!t&&w<0,M=!!i&&k<0,R=t?(t>0?1:-1)*($?-1:1):0,C=i?(i>0?1:-1)*(M?-1:1):0,T=f+R*(x/2)*c+C*(S/2)*d,D=v+R*(x/2)*h+C*(S/2)*u,A=!!e.flip_h!==$,P=!!e.flip_v!==M;return{x:T-x/2,y:D-S/2,w:x,h:S,...Number(e.angle)?{angle:Number(e.angle)}:{},...A?{flip_h:!0}:{},...P?{flip_v:!0}:{}}}function Zl(e,t,i,n){let r=Number(e)+(Number(i)-Number(t));if([r,t,i].every(Number.isFinite)||(r=0),n){const e=r/45;r=45*(e<0?-Math.round(Math.abs(e)):Math.round(e))}return r=(r%360+360)%360,r>180?r-360:r}function Jl(e,t,i,n,r){const o=e.x*t,s=e.y*i,a=e.w*t,l=e.h*i,c=o+a/2,h=s+l/2,d=o+(e.flip_h?a:0),u=s+(e.flip_v?l:0),p=(e.flip_h?-1:1)*a/n,_=(e.flip_v?-1:1)*l/r,m=Number(e.angle)||0;return(m?`rotate(${m} ${c} ${h}) `:"")+`translate(${d} ${u}) scale(${p} ${_})`}function Ql(e,t,i,n=.1){if("string"==typeof e&&!e.trim())return null;const r=Number(e);if(!Number.isFinite(r)||0===r)return null;const o=r*(t?30.48:100),s=Math.abs(o);return si?null:o}function ec(e,t,i){const n=Math.abs(Number(e))/(i?30.48:100),r=Number(n.toFixed(6));return String(t?-r:r)}const tc=15e3,ic=2e3,nc=new WeakMap;function rc(e,t){let i=nc.get(e);if(!i){const t=new Set;i={hiddenAt:"hidden"===e.visibilityState?Date.now():0,token:0,subscribers:t,onVisibility:()=>{const t=nc.get(e);if(!t)return;const i=Date.now();if("hidden"===e.visibilityState){t.hiddenAt||(t.hiddenAt=i);const e={kind:"hidden",token:t.token,at:i,hiddenFor:0,long:!1};for(const i of[...t.subscribers])i(e);return}const n=t.hiddenAt?Math.max(0,i-t.hiddenAt):0;t.hiddenAt=0,t.token++;const r={kind:"visible",token:t.token,at:i,hiddenFor:n,long:n>=tc};for(const e of[...t.subscribers])e(r)},onPageShow:t=>{const i=nc.get(e);if(!i)return;const n=Date.now();i.token++;const r={kind:"pageshow",token:i.token,at:n,hiddenFor:0,long:!!t.persisted,persisted:!!t.persisted};for(const e of[...i.subscribers])e(r)}},nc.set(e,i),e.addEventListener("visibilitychange",i.onVisibility),e.defaultView?.addEventListener("pageshow",i.onPageShow)}return i.subscribers.add(t),()=>{const i=nc.get(e);i&&(i.subscribers.delete(t),i.subscribers.size||(e.removeEventListener("visibilitychange",i.onVisibility),e.defaultView?.removeEventListener("pageshow",i.onPageShow),nc.delete(e)))}}const oc={now:()=>Date.now(),setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e),requestAnimationFrame:e=>window.requestAnimationFrame(e),cancelAnimationFrame:e=>window.cancelAnimationFrame(e)};class sc{constructor(e,t=oc){this.onChange=e,this.clock=t,this._state="steady",this._token=0,this._frameFingerprint="",this._hasCompleteFrame=!1,this._overlayPhase="none",this._recoveryReason=null,this._overlayTimer=0,this._overlayRaf=0,this._overlayOpaqueAt=0,this._barrierRafs=new Set,this._trace=[],this._disposed=!1}get state(){return this._state}get token(){return this._token}get frameFingerprint(){return this._frameFingerprint}get hasCompleteFrame(){return this._hasCompleteFrame}get overlayPhase(){return this._overlayPhase}get overlayVisible(){return"none"!==this._overlayPhase}get overlayBlocksInteraction(){return this.overlayVisible}get recoveryReason(){return this._recoveryReason}get trace(){return this._trace.map(e=>({...e,...e.stage?{stage:[...e.stage]}:{}}))}note(e,t={}){this.record(e,void 0,t)}record(e,t,i={}){this._trace.push({at:this.clock.now(),token:this._token,event:e,state:this._state,...t?{reason:t}:{},...i}),this._trace.length>80&&this._trace.splice(0,this._trace.length-80)}changed(){this._disposed||this.onChange()}adoptCompleteFrame(e){e&&(this._hasCompleteFrame=!0,this._frameFingerprint=e,this._state="steady",this._recoveryReason=null,this.clearOverlay(),this.record("frame-adopted"),this.changed())}markCompleteFrame(e){e&&(this._hasCompleteFrame=!0,this._frameFingerprint=e,this._state="steady",this._recoveryReason=null,this.clearOverlay(),this.record("frame-complete"),this.changed())}refreshCompleteFrame(e){!this._disposed&&this._hasCompleteFrame&&"steady"===this._state&&e&&e!==this._frameFingerprint&&(this._frameFingerprint=e,this.record("frame-refreshed"))}visibility(e){return"hidden"===e.kind?(this.record("visibility-hidden"),this._token):e.long||"visible"!==e.kind&&"pageshow"!==e.kind?this.beginCandidate("pageshow"===e.kind?"pageshow":"long-resume"):(this.record("pageshow"===e.kind?"pageshow-noop":"visibility-visible-quick"),this._token)}beginCandidate(e,t="plan"){return this._token++,this._recoveryReason=t,this._hasCompleteFrame?(this._state="connection"===t?"offline-stale":"holding",this.clearOverlay()):this.overlayVisible?this._state="overlay-visible":(this._state="overlay-pending",this.scheduleOverlay(t)),this.record("candidate-start",e),this.changed(),this._token}connectionLost(){return this.beginCandidate("connection-lost","connection")}candidateReady(e){return!this._disposed&&e===this._token&&(this._state="candidate-ready",this.record("candidate-ready"),this.changed(),!0)}async commitAfterPaint(e,t){if(this._disposed||e!==this._token)return!1;let i=!0;const n=(async()=>{for(await t.updateComplete();i&&!this._disposed&&e===this._token;)if(t.stageValid()&&t.assetsReady()){if(await this.nextFrame(),e!==this._token||!t.stageValid()||!t.assetsReady())continue;if(await this.nextFrame(),e===this._token&&t.stageValid()&&t.assetsReady())return!0}else await this.nextFrame();return!1})();let r=0;const o=new Promise(e=>{r=this.clock.setTimeout(()=>e({ready:!1,timedOut:!0}),ic)}),s=await Promise.race([n.then(e=>({ready:e,timedOut:!1})),o]);return i=!1,this.clock.clearTimeout(r),!this._disposed&&e===this._token&&(!(!s.ready&&!s.timedOut)&&(s.ready?(this._hasCompleteFrame=!0,this._frameFingerprint=t.frameFingerprint(),this.record("paint-barrier"),this.finishOverlayAfterCommit(),!0):(this.record("paint-barrier-timeout"),this._hasCompleteFrame?(this._state="connection"===this._recoveryReason?"offline-stale":"steady",this.clearOverlay()):(this._state="recovery-error","opaque"!==this._overlayPhase&&this.showOverlayNow()),this.changed(),!1)))}retry(e=this._recoveryReason||"plan"){return this.beginCandidate("retry",e)}nextFrame(){return new Promise(e=>{const t=this.clock.requestAnimationFrame(()=>{this._barrierRafs.delete(t),e()});this._barrierRafs.add(t)})}scheduleOverlay(e){this.clearOverlayTimer(),this._recoveryReason=e,this._overlayTimer=this.clock.setTimeout(()=>{this._overlayTimer=0,this._hasCompleteFrame||"overlay-pending"!==this._state&&"candidate-ready"!==this._state||(this._state="overlay-visible",this._overlayPhase="entering",this.record("overlay-enter"),this.changed(),this._overlayRaf=this.clock.requestAnimationFrame(()=>{this._overlayRaf=0,"entering"===this._overlayPhase&&(this._overlayPhase="fading-in",this.changed(),this._overlayTimer=this.clock.setTimeout(()=>{this._overlayTimer=0,"fading-in"===this._overlayPhase&&(this._overlayPhase="opaque",this._overlayOpaqueAt=this.clock.now(),this.record("overlay-opaque"),this.changed())},150))}))},150)}showOverlayNow(){this.clearOverlayTimer(),this._overlayPhase="opaque",this._overlayOpaqueAt=this.clock.now(),this.record("overlay-error")}finishOverlayAfterCommit(){if(this.clearOverlayTimer(),"none"===this._overlayPhase||"entering"===this._overlayPhase||"fading-in"===this._overlayPhase)return this.clearOverlay(),this._state="steady",this._recoveryReason=null,this.record("candidate-committed"),void this.changed();const e=Math.max(0,this._overlayOpaqueAt+250-this.clock.now());this._overlayTimer=this.clock.setTimeout(()=>{this._overlayTimer=0,this._overlayPhase="leaving",this.record("overlay-leave"),this.changed(),this._overlayTimer=this.clock.setTimeout(()=>{this._overlayTimer=0,this._overlayPhase="none",this._state="steady",this._recoveryReason=null,this.record("candidate-committed"),this.changed()},180)},e)}clearOverlayTimer(){this._overlayTimer&&this.clock.clearTimeout(this._overlayTimer),this._overlayTimer=0}clearOverlay(){this.clearOverlayTimer(),this._overlayRaf&&this.clock.cancelAnimationFrame(this._overlayRaf),this._overlayRaf=0,this._overlayPhase="none",this._overlayOpaqueAt=0}dispose(){this._disposed=!0,this._token++,this.clearOverlay();for(const e of this._barrierRafs)this.clock.cancelAnimationFrame(e);this._barrierRafs.clear()}}function ac(e){let t=2166136261,i=2654435769;const n=new WeakSet,r=e=>{for(let n=0;n>>0)+(i>>>2)}},o=e=>{if(null===e)return void r("n");const t=typeof e;if("string"===t)return void r(`s${e.length}:${e}`);if("number"===t)return void r(`d${Number.isNaN(e)?"NaN":String(e)}`);if("boolean"===t)return void r(e?"t":"f");if("undefined"===t)return void r("u");if("object"!==t)return void r(`${t}:${String(e)}`);const i=e;if(n.has(i))r("[cycle]");else{if(n.add(i),Array.isArray(e)){r("[");for(const t of e)o(t);return r("]"),void n.delete(i)}r("{");for(const t of Object.keys(e).sort())r(t),o(e[t]);r("}"),n.delete(i)}};return o(e),`${(t>>>0).toString(16).padStart(8,"0")}${(i>>>0).toString(16).padStart(8,"0")}`}function lc(e){return ac(e)}const cc=new WeakMap;class hc{constructor(e,t=()=>Date.now()){this.onUpdate=e,this.now=t,this.fallbackAuthority={},this.referenceOwner={},this.referenced=new Set,this.queued=new Set,this.disposed=!1,this.sharedUpdate=()=>{this.disposed||this.onUpdate()}}bind(e){const t=((e,t)=>{const i=e?.connection||e?.callWS||t;return!i||"object"!=typeof i&&"function"!=typeof i?t:i})(e,this.fallbackAuthority);return this.shared&&this.authority===t||(this.shared&&(this.shared.listeners.delete(this.sharedUpdate),this.shared.references.delete(this.referenceOwner)),this.authority=t,this.shared=(e=>{let t=cc.get(e);return t||(t={signed:{},queued:new Set,inFlight:new Map,retry:new Map,listeners:new Set,settlers:new Set,references:new Map},cc.set(e,t)),t})(t),this.disposed||(this.shared.listeners.add(this.sharedUpdate),this.shared.references.set(this.referenceOwner,new Set(this.referenced)))),this.shared}start(e,t){this.disposed=!1,this.referenced=new Set(t());const i=this.bind(e());i.listeners.add(this.sharedUpdate),i.references.set(this.referenceOwner,new Set(this.referenced)),this.stopTimer(),this.resignTimer=setInterval(()=>this.resign(e(),t()),288e5)}dispose(){if(this.disposed=!0,this.stopTimer(),clearTimeout(this.batchTimer),this.shared){this.shared.listeners.delete(this.sharedUpdate),this.shared.references.delete(this.referenceOwner);for(const e of this.queued)this.shared.queued.delete(e)}this.queued.clear()}invalidate(e){const t=this.bind(e);clearTimeout(this.batchTimer),this.queued.clear(),t.queued.clear(),t.inFlight.clear(),t.retry.clear(),t.signed={}}stopTimer(){void 0!==this.resignTimer&&clearInterval(this.resignTimer),this.resignTimer=void 0}display(e,t){const i=En(t);if(!i.startsWith("/api/houseplan/content/"))return i;const n=this.bind(e);this.referenced.add(i),n.references.set(this.referenceOwner,new Set(this.referenced));const r=n.signed[i],o=r?this.now()-r.at:1/0;return o{const t=[...this.queued];this.queued.clear();for(const e of t)i.queued.delete(e);this.sign(e,t)},30))}sign(e,t){if(!t.length||!e?.callWS)return;const i=this.bind(e);for(const n of function(e,t){const i=Math.max(1,Math.floor(t)),n=[];for(let t=0;t{const n=i.inFlight.get(e);return!(void 0!==n&&t-n<15e3)&&(i.inFlight.set(e,t),!0)});r.length&&e.callWS({type:"houseplan/content/sign",paths:r}).then(e=>{const t=this.now();let n=0,o=!1;for(const s of r){const r=e?.urls?.[s];if("string"==typeof r&&r){const e=i.signed[s];e?.loaded&&e.url!==r?(e.pending={url:r,at:t},this.preloadReplacement(i,s,r,t)):(i.signed[s]={url:r,at:t,loaded:e?.url===r&&!!e.loaded},o=!0),i.retry.delete(s),n++}else this.backOff(i,s)}if(n&&(this.trimShared(i),o))for(const e of[...i.listeners])e()}).catch(()=>{for(const e of r)this.backOff(i,e)}).finally(()=>{for(const e of r)i.inFlight.get(e)===t&&i.inFlight.delete(e);for(const e of[...i.settlers])e()})}}preloadReplacement(e,t,i,n){const r=()=>{const r=e.signed[t];if(r?.pending?.url===i){e.signed[t]={url:i,at:n,loaded:!0},e.retry.delete(t),this.trimShared(e);for(const t of[...e.listeners])t()}},o=()=>{const n=e.signed[t];n?.pending?.url===i&&(delete n.pending,this.backOff(e,t))};if("undefined"==typeof Image)return void r();const s=new Image;s.onload=()=>{("function"==typeof s.decode?s.decode():Promise.resolve()).then(r).catch(o)},s.onerror=o,s.src=i}preloadCurrentImage(e,t,i){if(i.loaded)return Promise.resolve(!0);if(i.preload)return i.preload;if("undefined"==typeof Image)return i.loaded=!0,Promise.resolve(!0);const n=i.url;return i.preload=new Promise(r=>{const o=new Image;let s=!1;const a=o=>{if(s)return;s=!0,clearTimeout(l);const a=e.signed[t];if(a===i&&delete a.preload,o&&a===i&&a.url===n){a.loaded=!0;for(const t of[...e.listeners])t();r(!0)}else o||a!==i||this.backOff(e,t),r(!1)};o.onload=()=>{("function"==typeof o.decode?o.decode():Promise.resolve()).then(()=>a(!0)).catch(()=>a(!1))},o.onerror=()=>a(!1);const l=setTimeout(()=>a(!1),ic);o.src=n}),i.preload}prepareImage(e,t){const i=En(t);if(!i.startsWith("/api/houseplan/content/"))return Promise.resolve(!0);const n=this.bind(e),r=()=>{const t=n.signed[i];if(t&&this.now()-t.atthis.now()&&!n.inFlight.has(i)&&!n.queued.has(i)?Promise.resolve(!1):null},o=r();return o?(s=o,new Promise(e=>{let t=!1;const i=i=>{t||(t=!0,clearTimeout(n),e(i))},n=setTimeout(()=>i(!1),ic);s.then(i).catch(()=>i(!1))})):new Promise(e=>{let t=!1,i=null;const o=i=>{t||(t=!0,clearTimeout(a),n.settlers.delete(s),e(i))},s=()=>{t||i||(i=r(),i&&i.then(o).catch(()=>o(!1)))},a=setTimeout(()=>o(!1),ic);n.settlers.add(s),s()});var s}backOff(e,t){const i=e.retry.get(t)?.delay||0,n=Math.min(6e4,i?2*i:2e3);e.retry.set(t,{notBefore:this.now()+n,delay:n})}trimShared(e){const t=Object.entries(e.signed);if(t.length<=512)return;const i=new Set(e.inFlight.keys());for(const t of e.references.values())for(const e of t)i.add(e);for(const[e,n]of t)(n.pending||n.preload)&&i.add(e);t.sort((e,t)=>t[1].at-e[1].at);const n=t.filter(([e])=>i.has(e));for(const e of t){if(n.length>=512)break;i.has(e[0])||n.push(e)}e.signed=Object.fromEntries(n)}resign(e,t){const i=this.bind(e);this.referenced=new Set(t),i.references.set(this.referenceOwner,new Set(this.referenced));const n=this.now(),r=new Set;for(const e of i.references.values())for(const t of e)r.add(t);const o={};for(const[e,t]of Object.entries(i.signed))r.has(e)&&n-t.at!!o[e]&&!o[e].pending))}markLoaded(e,t,i){const n=En(t);if(!n.startsWith("/api/houseplan/content/"))return;const r=this.bind(e).signed[n];if(r&&(!i||r.url===i)&&!r.loaded){r.loaded=!0;for(const t of[...this.bind(e).listeners])t()}}isReady(e,t){const i=En(t);if(!i.startsWith("/api/houseplan/content/"))return!0;const n=this.bind(e).signed[i];return!!n&&this.now()-n.at=2&&(this._sequenceMultitouch=!0,this._postGestureClickBlocked=!0))}pointerTerminal(e,t){if("touch"!==t)return!1;const i=this._sequenceMultitouch;return this._activeTouchPointers.delete(e),0===this._activeTouchPointers.size&&(this._sequenceMultitouch=!1),i}reset(){this._activeTouchPointers.clear(),this._sequenceMultitouch=!1,this._postGestureClickBlocked=!1}}const uc=1e-7,pc=(e,t)=>{const i=e.x-t.x,n=e.y-t.y;return i*i+n*n};function _c(e){const t=Math.max(0,e.floorRadius);return{left:Math.min(e.painted.left,e.center.x-t),top:Math.min(e.painted.top,e.center.y-t),right:Math.max(e.painted.right,e.center.x+t),bottom:Math.max(e.painted.bottom,e.center.y+t)}}function mc(e,t){let i=null,n=Number.POSITIVE_INFINITY;for(const r of e){const e=pc(t,r.center);(efunction(e,t){const i=Math.max(0,t.right-t.left),n=Math.max(0,t.bottom-t.top);if(i<=0||n<=0)return!1;const r=Math.min(i,n)/2,o=Math.max(t.left+r,Math.min(t.right-r,e.x)),s=Math.max(t.top+r,Math.min(t.bottom-r,e.y));return pc(e,{x:o,y:s})<=r*r+uc}(t,e.painted));if(i.length)return mc(i,t);return mc(e.filter(e=>{const i=Math.max(0,e.floorRadius);return pc(t,e.center)<=i*i+uc}),t)}class fc{constructor(e,t=44){this.cellSize=t,this.buckets=new Map;const i=Number.isFinite(t)&&t>0?t:44;this.cellSize=i;for(const t of e){const e=_c(t),n=Math.floor(e.left/i),r=Math.floor(e.right/i),o=Math.floor(e.top/i),s=Math.floor(e.bottom/i);for(let e=n;e<=r;e++)for(let i=o;i<=s;i++){const n=`${e}:${i}`,r=this.buckets.get(n);r?r.push(t):this.buckets.set(n,[t])}}}resolve(e){const t=`${Math.floor(e.x/this.cellSize)}:${Math.floor(e.y/this.cellSize)}`;return gc(this.buckets.get(t)||[],e)}}class vc{constructor(){this.active=new Map,this.released=new Map}begin(e,t){this.released.delete(e),this.active.set(e,t)}owner(e){return this.active.get(e)||null}release(e){const t=this.active.get(e)||null;if(!t)return this.released.get(e)||null;for(this.active.delete(e),this.released.set(e,t);this.released.size>16;){const e=this.released.keys().next().value;if(void 0===e)break;this.released.delete(e)}return t}consumeClick(e){const t=this.released.get(e)||null;return this.released.delete(e),t}cancel(e){const t=this.active.get(e)||null;return this.active.delete(e),t}clear(){this.active.clear(),this.released.clear()}}class yc{constructor(){this.index=null,this.pointers=new vc,this.hoverId=null,this.hoverElement=null}invalidate(){this.index=null}reset(e){this.invalidate(),this.pointers.clear(),this.hover(e,null)}clearPointers(){this.pointers.clear()}cancel(e){return this.pointers.cancel(e)}release(e){return this.pointers.release(e)}indexFor(e){if(this.index)return this.index;const t=[];for(const i of e.querySelectorAll('.devlayer > .dev[data-hp="device"][data-id]')){const e=i.querySelector(".device-shell-frame"),n=i.getBoundingClientRect(),r=e?.getBoundingClientRect();!i.dataset.id||!i.isConnected||!r||n.width<=0||n.height<=0||r.width<=0||r.height<=0||t.push({id:i.dataset.id,center:{x:n.left+n.width/2,y:n.top+n.height/2},painted:{left:r.left,top:r.top,right:r.right,bottom:r.bottom},floorRadius:Math.max(22,Math.min(r.width,r.height)/2)})}return this.index=new fc(t),this.index}at(e,t,i,n,r){const o=this.indexFor(e).resolve({x:n,y:r})?.id;return o&&t.find(e=>e.id===o&&e.space===i)||null}byId(e,t,i){return i&&e.find(e=>e.id===i&&e.space===t)||null}begin(e,t,i,n,r){const o=this.at(e,t,i,n.clientX,n.clientY)||r;return this.pointers.begin(n.pointerId,o.id),o}pointer(e,t,i,n,r){const o=n.pointerId;return(Number.isFinite(o)?this.byId(t,i,this.pointers.owner(o)):null)||this.at(e,t,i,n.clientX,n.clientY)||r}click(e,t,i,n,r){if(!(n instanceof PointerEvent))return r;const o=n,s=Number.isFinite(o.pointerId)?this.pointers.consumeClick(o.pointerId):null;return this.byId(t,i,s)||this.at(e,t,i,o.clientX,o.clientY)||r}hover(e,t){this.hoverId===t&&this.hoverElement?.isConnected||(this.hoverElement?.removeAttribute("data-hp-device-hover"),this.hoverId=t,this.hoverElement=t&&[...e.querySelectorAll('.devlayer > .dev[data-hp="device"][data-id]')].find(e=>e.dataset.id===t)||null,this.hoverElement?.setAttribute("data-hp-device-hover",""))}}function bc(e,t){if(t)return e.find(e=>e.id===t)}function wc(e,t){return{id:e,title:t,plan_url:null,view_box:[0,0,1,1],rooms:[],wall_segments:[]}}function kc(e="file"){const t="draw"===e;return{source:e,showBorders:t,showNames:t,displayTouched:!1}}function xc(e,t){if(e.displayTouched)return{...e,source:t};const i="draw"===t;return{...e,source:t,showBorders:i,showNames:i}}function Sc(e,t,i){return{...e,[t]:i,displayTouched:!0}}function $c(e){const t=String(e??"").trim().replace(",",".");if(!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(t))return null;const i=Number(t);return Number.isFinite(i)?i:null}function Mc(e,t){const i=e=>{if(""===String(e??"").trim())return{valid:!0,value:null};const t=$c(e);return{valid:null!==t,value:t}},n=i(e),r=i(t);return n.valid&&r.valid?null!==n.value&&null!==r.value&&n.value>r.value?{valid:!0,min:r.value,max:n.value}:{valid:!0,min:n.value,max:r.value}:{valid:!1,min:n.value,max:r.value}}function Rc(e,t,i,n,r,o){const s=Mc(n,r);return dn(e,t,o&&s.valid?{settings:{...i.settings||{},temp_min:s.min,temp_max:s.max}}:i)}function Cc(e){const t=e=>"number"==typeof e&&Number.isFinite(e)?String(e):"";return[t(e?.temp_min),t(e?.temp_max)]}function Tc(e,t,i){const n=Mc(t,i);return!!n.valid&&(null===n.min?delete e.temp_min:e.temp_min=n.min,null===n.max?delete e.temp_max:e.temp_max=n.max,!0)}var Dc="M11,18H13V16H11V18M12,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,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,6A4,4 0 0,0 8,10H10A2,2 0 0,1 12,8A2,2 0 0,1 14,10C14,12 11,11.75 11,15H13C13,12.75 16,12.5 16,10A4,4 0 0,0 12,6Z";function Ac(e,t,i){return[e[0]*t+e[1]*i+e[2],e[3]*t+e[4]*i+e[5]]}function Pc(e,t){let i=0;for(const[n,r]of t){const t=Ac(e,n[0],n[1]);i=Math.max(i,Math.hypot(t[0]-r[0],t[1]-r[1]))}return i}const Fc=e=>{if(null==e||""===e)return null;const t=Number(e);return Number.isFinite(t)?t:null},zc=e=>{const t=e,i=Fc(Array.isArray(t)?t[0]:t?.x),n=Fc(Array.isArray(t)?t[1]:t?.y);return null==i||null==n?null:[i,n]};function Ic(e){if(!Array.isArray(e))return null;const t=[];for(const i of e){const e=zc(i);if(!e)return null;t.push(e)}if(t.length>1){const e=t[0],i=t[t.length-1];e[0]===i[0]&&e[1]===i[1]&&t.pop()}if(t.length<3)return null;let i=0,n=0,r=0;for(let e=0;ee+t[0],0)/t.length,t.reduce((e,t)=>e+t[1],0)/t.length]:[n/(3*i),r/(3*i)]}function Oc(e){if(!Array.isArray(e))return null;const t=[];for(const i of e){const e=zc(i);if(!e)return null;t.push(e)}if(t.length>1){const e=t[0],i=t[t.length-1];e[0]===i[0]&&e[1]===i[1]&&t.pop()}const i=Ic(t);if(!i)return null;const n=t.map(e=>e[0]),r=t.map(e=>e[1]);return{centroid:i,bbox:[Math.min(...n),Math.min(...r),Math.max(...n),Math.max(...r)]}}function Ec(e){let t=e;if(t&&"object"==typeof t&&!Array.isArray(t)){const e=t;t=e.path??e.points??t}if(!Array.isArray(t)||!t.length)return[];let i=(t.some(e=>(e=>Array.isArray(e)?e.length>=2&&!Array.isArray(e[0])&&("object"!=typeof e[0]||null==e[0]):!!e&&"object"==typeof e&&("x"in e||"y"in e))(e))?[t]:t.filter(Array.isArray)).map(e=>e.map(zc).filter(e=>null!=e)).filter(e=>e.length>=2);i.length>64&&(i=i.slice(-64));const n=i.reduce((e,t)=>e+t.length,0);if(n<=4e3)return i.map(e=>e.slice());const r=4e3-2*i.length,o=i.map(e=>e.length-2),s=o.reduce((e,t)=>e+t,0),a=o.map(e=>r*e/s),l=a.map(Math.floor);let c=r-l.reduce((e,t)=>e+t,0);const h=a.map((e,t)=>({index:t,fraction:e-Math.floor(e)})).sort((e,t)=>t.fraction-e.fraction||e.index-t.index);for(let e=0;efunction(e,t){if(t>=e.length)return e.slice();if(t<=2)return[e[0],e[e.length-1]];const i=[];for(let n=0;ne.slice()),i=t[t.length-1];return i?(i.length>2?i.pop():t.pop(),t):[]}const Lc=e=>Number.isFinite(e[0])&&Number.isFinite(e[1]),Bc=(e,t)=>e[0]===t[0]&&e[1]===t[1];function qc(e){if(!e)return null;const t=e.vacuum_position||e.robot_position||null,i=t&&null!=Fc(t.x)&&null!=Fc(t.y)?{x:Fc(t.x),y:Fc(t.y),a:Fc(t.a??t.angle??t.theta)}:null,n=Ec(e.path?.path??e.path?.points??e.path),r=[],o=e.rooms,s=Array.isArray(o)?o.map((e,t)=>[String(e?.id??t),e]):o&&"object"==typeof o?Object.entries(o):[];for(const[e,t]of s){if(!t||"object"!=typeof t)continue;const i=String(t.name??t.label??"").trim(),n=[[Fc(t.cx),Fc(t.cy)],[Fc(t.center?.x),Fc(t.center?.y)],[Fc(t.x),Fc(t.y)]].find(([e,t])=>null!=e&&null!=t);let o=n?.[0]??null,s=n?.[1]??null;const a=Oc(t.outline),l=Fc(t.x0),c=Fc(t.y0),h=Fc(t.x1),d=Fc(t.y1),u=(null!=l&&null!=c&&null!=h&&null!=d?[Math.min(l,h),Math.min(c,d),Math.max(l,h),Math.max(c,d)]:null)||a?.bbox||null;if(null!=o&&null!=s||!a||([o,s]=a.centroid),null!=o&&null!=s||!u||(o=(u[0]+u[2])/2,s=(u[1]+u[3])/2),i&&null!=o&&null!=s){const t={id:e,name:i,cx:o,cy:s};u&&([t.x0,t.y0,t.x1,t.y1]=u),r.push(t)}}const a=function(e){return String(e.map_name??e.current_map??e.map_index??e.selected_map??"default")}(e);return i||r.length||n.length?{pos:i,path:n,rooms:r,mapId:a}:null}function jc(e,t,i){return![e,t,i].every(Number.isFinite)||e<0||t<=0||i<=0?Number.POSITIVE_INFINITY:e/t*i}const Wc=40;function Uc(e,t,i){if(!e||!t)return null;const n=t.attributes||{},r=e.split(".")[0]||"",o=null!=i?.platform?String(i.platform):null,s=!!zc(n.vacuum_position??n.robot_position),a=!(!n.rooms||"object"!=typeof n.rooms),l=Ec(n.path?.path??n.path?.points??n.path).length>0,c=[n.map_name,n.current_map,n.map_index,n.selected_map].some(e=>null!=e),h="xiaomi_cloud_map_extractor"===o,d=a||l||c;let u=null;if(s?u="compatible":h?u="known_xcme_incomplete":d?u="partial":"camera"===r&&(u="camera"),!u)return null;const p=s?"camera"===r?300:200:h?100:d?50:0;return{entityId:e,name:String(n.friendly_name||e),platform:o,category:u,hasPosition:s,hasRooms:a,hasPath:l,hasMapId:c,score:p}}const Gc=e=>e.toLowerCase().replace(/[\s_\-.,]+/g,"");function Vc(e,t){const i=new Set(t.map(Gc).filter(Boolean)),n=new Set;for(const t of e){const e=Gc(t.name||"");e&&i.has(e)&&n.add(e)}return n.size}function Kc(e,t){const i=new Map(t.map(e=>[Gc(e.name),e])),n=[],r=[];for(const t of e){const e=i.get(Gc(t.name));e&&(n.push([[t.cx,t.cy],[e.cx,e.cy]]),r.push(t.name))}if(n.length<3)return null;const o=function(e){if(e.length<3)return null;let t=0,i=0,n=0,r=0,o=0,s=0,a=0,l=0,c=0,h=0,d=0,u=0;for(const[[p,_],[m,g]]of e){if(![p,_,m,g].every(Number.isFinite))return null;t+=p*p,i+=p*_,n+=p,r+=_*_,o+=_,s+=1,a+=p*m,l+=_*m,c+=m,h+=p*g,d+=_*g,u+=g}const p=[t,i,n,i,r,o,n,o,s],_=e=>{const[t,i,n,r,o,s,a,l,c]=p,h=t*(o*c-s*l)-i*(r*c-s*a)+n*(r*l-o*a);if(!Number.isFinite(h)||Math.abs(h)<1e-9)return null;const d=[(o*c-s*l)/h,(n*l-i*c)/h,(i*s-n*o)/h,(s*a-r*c)/h,(t*c-n*a)/h,(n*r-t*s)/h,(r*l-o*a)/h,(i*a-t*l)/h,(t*o-i*r)/h];return[d[0]*e[0]+d[1]*e[1]+d[2]*e[2],d[3]*e[0]+d[4]*e[1]+d[5]*e[2],d[6]*e[0]+d[7]*e[1]+d[8]*e[2]]},m=_([a,l,c]),g=_([h,d,u]);if(!m||!g)return null;const f=[m[0],m[1],m[2],g[0],g[1],g[2]];return f.every(Number.isFinite)?f:null}(n);return o?{matrix:o,matched:r,residual:Pc(o,n)}:null}function Yc(e,t,i){const n=e[e.length-1];if(n&&n[0]===t[0]&&n[1]===t[1])return e;if(e.push(t),e.length<=600)return e;let r=function(e,t){if(e.length<3)return e.slice();const i=new Uint8Array(e.length);i[0]=i[e.length-1]=1;const n=[[0,e.length-1]];for(;n.length;){const[r,o]=n.pop(),[s,a]=e[r],[l,c]=e[o],h=l-s,d=c-a,u=Math.hypot(h,d)||1e-9;let p=0,_=-1;for(let t=r+1;tp&&(p=i,_=t)}_>0&&p>t&&(i[_]=1,n.push([r,_],[_,o]))}const r=[];for(let t=0;t600&&(r=r.filter((e,t)=>t%2==0||t===r.length-1)),r}function Xc(e){return"cleaning"===e||"returning"===e||"on"===e}const Zc={0:[1,0],90:[0,1],180:[-1,0],270:[0,-1]};function Jc(e){const[t,i]=Zc[e.rot]||[1,0],n=e.mir?-1:1;return[e.s*t*n,-e.s*i,e.ox,e.s*i*n,e.s*t,e.oy]}function Qc(e){const t=e[0]*e[4]-e[1]*e[3];if(!Number.isFinite(t)||Math.abs(t)<1e-12)return null;const i=t<0,n=Math.sqrt(Math.abs(t));let r=180*Math.atan2(-e[1],e[4])/Math.PI;return r=(90*Math.round(r/90)%360+360)%360,{ox:e[2],oy:e[5],s:n,rot:r,mir:i}}function eh(e,t){const i=[],n=[];for(const t of e)null!=t.x0?(i.push(t.x0,t.x1),n.push(t.y0,t.y1)):(i.push(t.cx),n.push(t.cy));if(!i.length)return{ox:t[0]+t[2]/2,oy:t[1]+t[3]/2,s:t[2]/1e4,rot:0,mir:!0};const r=Math.min(...i),o=Math.max(...i),s=Math.min(...n),a=Math.max(...n),l=Math.max(o-r,a-s)||1,c={ox:0,oy:0,s:.6*Math.min(t[2],t[3])/l,rot:0,mir:!0},h=Jc(c),[d,u]=Ac(h,(r+o)/2,(s+a)/2);return c.ox=t[0]+t[2]/2-d,c.oy=t[1]+t[3]/2-u,c}function th(e,t,i,n){const[r,o]=Ac(Jc(t),i,n),s=Jc({...e,ox:0,oy:0}),[a,l]=Ac(s,i,n);return{...e,ox:r-a,oy:o-l}}function ih(e){const t=e?.trail_mode;return"never"===t||"cleaning"===t||"always"===t?t:!1===e?.trail?"never":"cleaning"}const nh=e=>"number"==typeof e&&Number.isFinite(e);function rh(e){return Array.isArray(e)&&6===e.length&&e.every(nh)?[e[0],e[1],e[2],e[3],e[4],e[5]]:null}function oh(e,t,i){return"legacy:"+e+" "+t+" "+i}function sh(e,t,i,n){const r=t?.map_routes;if(Array.isArray(r))return r.filter(e=>e&&"string"==typeof e.id&&e.id).map(e=>({id:e.id,source:String(e.source??""),map_id:String(e.map_id??""),space:String(e.space??""),calibration:rh(e.calibration)}));const o="string"==typeof t?.source&&t.source?t.source:n||"";if(!o)return[];const s=t?.calibration;if(!s||"object"!=typeof s)return[];const a=[];for(const t of Object.keys(s)){const n=rh(s[t]);n&&a.push({id:oh(e,o,t),source:o,map_id:t,space:i,calibration:n})}return a}const ah=(e,t)=>e instanceof Map?e.get(t):e?.[t];function lh(e){const t=[];let i=!1,n="",r="";for(const o of e.routes){const s=ah(e.observed,o.source);void 0!==s&&(i=!0,n||(n=o.source,r=s),s===o.map_id&&t.push(o))}if(t.length>1)return{kind:"ambiguous",routeIds:t.map(e=>e.id).sort()};if(1===t.length){const i=t[0];if(e.spaceIds&&!e.spaceIds.has(i.space))return{kind:"missing_space",route:i};const n=rh(i.calibration);return n?{kind:"ready",route:{...i,calibration:n}}:{kind:"needs_calibration",route:i}}if(i)return{kind:"unmapped",source:n,mapId:r};const o=e.observed instanceof Map?[...e.observed.entries()]:Object.entries(e.observed||{});if(o.length){const e=o.slice().sort((e,t)=>e[0].localeCompare(t[0]))[0];return{kind:"unmapped",source:e[0],mapId:e[1]}}return{kind:"none"}}function ch(e,t,i){const n=new Set;for(const t of e)t.source&&n.add(t.source);for(const e of t)e&&n.add(e);const r={};for(const e of[...n].sort()){const t=i(e);void 0!==t&&(r[e]=t)}return r}function hh(e,t,i){if(!e)return null;const n="string"==typeof e.route_id?e.route_id:"";if(n)return t.find(e=>e.id===n)||null;const r=function(e,t,i){if(!e||"string"!=typeof e.map_id)return{kind:"orphan_run"};const n=e.map_id,r="string"==typeof i?i:"";let o=t.filter(e=>e.map_id===n);return r&&(o=o.filter(e=>e.source===r)),1===o.length?{kind:"adopted",route:o[0]}:0===o.length?{kind:"orphan_run"}:{kind:"ambiguous_run",routeIds:o.map(e=>e.id).sort()}}(e,t,i);return"adopted"===r.kind?r.route:null}function dh(e){const t="ready"===e.resolution.kind?e.resolution.route:null,i=t&&t.space===e.renderSpace?rh(t.calibration):null,n=hh(e.serverCurrent,e.routes,e.rootSource),r=!!t&&!!n&&n.id===t.id,o=hh(e.serverPrevious,e.routes,e.rootSource);return{live:i,currentRunMatches:r,previous:!!o&&o.space===e.renderSpace&&(e.explicitRoutes||!!t&&o.id===t.id)?rh(o.calibration):null}}const uh={availability:"available",status:"alarm",activity:"none"},ph=new Set(["motion","vibration","sound"]),_h=new Set(["occupancy","presence"]),mh=new Set(["door","window","garage_door","opening"]),gh=new Set(["running","power"]),fh=new Set(["smoke","gas","carbon_monoxide","moisture","safety","tamper","problem"]);const vh=new Set(["running","working","washing","rinsing","spinning","drying","heating","cooling","cleaning","cooking","playing","recording","pumping","irrigating","humidifying","dehumidifying","fan","preheating","defrosting"]),yh=new Set([...vh,"start","started","run","active","in_progress","wash","rinse","spin","dry"]),bh=new Set(["off","idle","paused","standby","docked","finished","complete","completed","stopped","ready","sleeping","stop","end","done","inactive"]),wh=new Set(["heat","cool","heat_cool","auto","dry","fan_only"]),kh=e=>""===e||"unknown"===e||"unavailable"===e||"__missing__"===e,xh=e=>String(e??"").trim().toLowerCase(),Sh=e=>xh(e).replace(/[\s-]+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),$h=new Map([["run_state",0],["job_state",0],["operation_state",0],["activity_state",0],["machine_state",1],["running_state",1],["status",2],["device_status",2],["machine_status",2]]),Mh=new Set(["wifi","connection","signal","battery"]);function Rh(e,t){const i=e?.entities?.[t]||{};if("config"===i.entity_category)return null;const n=String(t||"").split(".").slice(1).join("."),r=[i.translation_key,i.original_name,i.name],o=[...r,n];r.some(e=>xh(e))||o.push(e?.states?.[t]?.attributes?.friendly_name);const s=o.map(Sh).filter(Boolean);if(s.some(e=>e.split("_").some(e=>Mh.has(e))))return null;let a=null;for(const e of s)for(const[t,i]of $h)(e===t||e.endsWith(`_${t}`))&&(a=null==a?i:Math.min(a,i));return a}const Ch=(e,t)=>null!=Rh(e,t);function Th(e,t){if(!t.startsWith("switch."))return!1;const i=e?.entities?.[t]||{},n=e?.states?.[t],r=t.slice(7).toLowerCase();if(/(?:^|_)(?:main_)?power$/.test(r))return!0;if([i.translation_key,i.original_name,i.name].map(xh).some(e=>["power","main power","power switch","питание"].includes(e)))return!0;const o=xh(n?.attributes?.friendly_name);return/(?:^|[\s._-])(?:main[\s._-]+)?power$/.test(o)||/(?:^|[\s._-])питание$/.test(o)}function Dh(e){for(const t of["hvac_action","action","current_operation","run_state","job_state","operation","activity"]){const i=xh(e?.[t]);if(vh.has(i)||bh.has(i))return i}return""}function Ah(e,t){const i=e?.states?.[t],n=i?xh(i.state):"__missing__",r=String(t||"").split(".")[0],o=xh(i?.attributes?.device_class),s={eid:t,state:n,availability:kh(n)?"unavailable":"available",status:"neutral",activity:"none",edge:"none"};if("unavailable"===s.availability)return s;if(function(e,t,i){return"alarm_control_panel"===e?"triggered"===i:"on"===i&&Vn(e,t)}(r,o,n))return{...s,status:"alarm"};if("binary_sensor"===r)return ph.has(o)?{...s,edge:"rising"}:_h.has(o)?{...s,activity:"on"===n?"presence":"none"}:mh.has(o)?{...s,status:"on"===n?"open":"neutral",edge:"rising"}:"moving"===o?{...s,activity:"on"===n?"transition":"none"}:gh.has(o)&&"on"===n?{...s,status:"working",activity:"running"}:s;if("cover"===r)return{...s,activity:"opening"===n||"closing"===n?"transition":"none",edge:"terminal_transition"};if("lock"===r)return{...s,status:"unlocked"===n||"open"===n?"open":"neutral",activity:"locking"===n||"unlocking"===n?"transition":"none",edge:"terminal_transition"};if("valve"===r)return{...s,status:["open","opening","closing"].includes(n)?"open":"neutral",activity:"opening"===n||"closing"===n?"transition":"none",edge:"terminal_transition"};if("climate"===r){const e=Dh(i.attributes),t=Array.isArray(i.attributes?.hvac_modes)?i.attributes.hvac_modes.map(xh):[],r=!bh.has(n)&&(wh.has(n)||vh.has(n)||t.includes(n));return(e?vh.has(e):r)?{...s,status:"working",activity:"running"}:s}if(["light","switch","fan","humidifier"].includes(r))return"on"===n?{...s,status:"working",activity:"running"}:s;if("media_player"===r)return"off"===n?{...s,availability:"unavailable"}:s;if("vacuum"===r)return"cleaning"===n?{...s,status:"working",activity:"running"}:"returning"===n?{...s,status:"working",activity:"transition"}:s;if("script"===r)return"on"===n?{...s,status:"working",activity:"running"}:s;if("automation"===r)return s;if("button"===r||"event"===r)return{...s,edge:"change"};const a=Dh(i.attributes);return vh.has(a)||vh.has(n)&&!bh.has(n)?{...s,status:"working",activity:"running"}:s}function Ph(e,t,i){const n=i.filter(t=>t.startsWith("switch.")&&!e?.entities?.[t]?.entity_category),r=t.find(t=>Th(e,t));if(!(n.length>1&&!!r))return t.map(t=>Ah(e,t));const o=t.find(t=>t!==r&&Ch(e,t)),s=Ah(e,r);return"unavailable"===s.availability||"off"===s.state?t.map(t=>({eid:t,state:e?.states?.[t]?xh(e.states[t].state):"__missing__",availability:"unavailable",status:"neutral",activity:"none",edge:"none"})):t.map(t=>{if(t===o)return function(e,t){const i=e?.states?.[t],n=i?xh(i.state):"__missing__",r={eid:t,state:n,availability:kh(n)?"unavailable":"available",status:"neutral",activity:"none",edge:"none"};if("unavailable"===r.availability)return r;const o=Dh(i?.attributes);return vh.has(o)||yh.has(n)&&!bh.has(n)?{...r,status:"working",activity:"running"}:r}(e,t);return{...t===r?s:Ah(e,t),status:"neutral",activity:"none",edge:"none"}})}function Fh(e){if(!e.length)return{availability:"available",status:"neutral",activity:"none"};const t=e.filter(e=>"available"===e.availability);if(!t.length)return{availability:"unavailable",status:"neutral",activity:"none"};if(t.some(e=>"alarm"===e.status))return uh;const i=t.some(e=>"working"===e.status)?"working":t.some(e=>"open"===e.status)?"open":"neutral",n=t.some(e=>"transition"===e.activity)?"transition":t.some(e=>"presence"===e.activity)?"presence":t.some(e=>"running"===e.activity)?"running":"none";return{availability:"available",status:i,activity:n}}function zh(e,t){if(!(e=>!!e&&!kh(e))(e)||"unavailable"===t.availability||e===t.state)return null;if("rising"===t.edge)return"off"===e&&"on"===t.state?"event":null;if("change"===t.edge)return"event";if("terminal_transition"===t.edge){const i=new Set([e,t.state]);if(i.has("closed")&&i.has("open")||i.has("locked")&&i.has("unlocked"))return"transition"}return null}const Ih=(e,t=0)=>{const i=Number(e);return Number.isInteger(i)&&i>=0?i:t},Oh=(e,t)=>{const i={rev:0,configRev:Ih(t),off:new Set};if(null==e)return{snapshot:i,valid:!1};const n=e.off;return!Number.isInteger(e.rev)||Number(e.rev)<0||!Number.isInteger(e.config_rev)||Number(e.config_rev)<0||!Array.isArray(n)||n.some(e=>"string"!=typeof e||!e)?{snapshot:i,valid:!1}:{snapshot:{rev:Number(e.rev),configRev:Number(e.config_rev),off:new Set(n)},valid:!0}};function Eh(e,t=0){return Oh(e,t).snapshot}function Nh(e,t,i,n){const r=Oh(t,i);return n&&r.valid&&r.snapshot.configRev===i?e.configRev===i&&r.snapshot.rev{try{const[i,n]=await Promise.all([e.callWS({type:"config/device_registry/list"}),e.callWS({type:"config/entity_registry/list"})]),r=Yh(i,"id"),o=Yh(n,"entity_id");if(!r||!o)throw new Error("invalid_registry_response");t.devices=r,t.entities=o,t.authoritative=!0,t.access="full",t.lastSuccess=Date.now(),t.error=void 0}catch(e){t.authoritative=!1,t.access="limited",t.error=function(e){if(e&&"object"==typeof e){const t=e;return String(t.message||t.code||t.error||"registry_unavailable")}return String(e||"registry_unavailable")}(e)}finally{t.revision++,t.loading=void 0,function(e){for(const t of[...e.listeners])try{t()}catch{}}(t)}})()),t.loading}function Zh(e,t){void 0===t.reloadTimer&&(t.reloadTimer=globalThis.setTimeout(()=>{t.reloadTimer=void 0,Xh(e,t)},80))}async function Jh(e,t){if(t.subscribing||t.unsubDevice&&t.unsubEntity)return t.subscribing;const i=e?.connection?.subscribeEvents;return"function"==typeof i?(t.subscribing=(async()=>{try{t.unsubDevice||(t.unsubDevice=await i.call(e.connection,()=>Zh(e,t),"device_registry_updated")),t.unsubEntity||(t.unsubEntity=await i.call(e.connection,()=>Zh(e,t),"entity_registry_updated"))}catch{}finally{0===t.refs&&(t.unsubDevice?.(),t.unsubEntity?.(),t.unsubDevice=void 0,t.unsubEntity=void 0),t.subscribing=void 0}})(),t.subscribing):void 0}function Qh(e,t){const i=Kh(e);if(!i)return()=>{};const n=0===i.refs;i.refs++,i.listeners.add(t),("pending"===i.access||n)&&Xh(e,i),Jh(e,i);let r=!1;return()=>{r||(r=!0,i.listeners.delete(t),i.refs=Math.max(0,i.refs-1),i.refs>0||(i.unsubDevice?.(),i.unsubEntity?.(),i.unsubDevice=void 0,i.unsubEntity=void 0,void 0!==i.reloadTimer&&globalThis.clearTimeout(i.reloadTimer),i.reloadTimer=void 0))}}function ed(e){const t=Kh(e);t&&(Zh(e,t),Jh(e,t))}function td(e){const t=Kh(e);if(!t)return{revision:0,authoritative:!1,access:"limited",devices:e?.devices||{},entities:e?.entities||{},lastSuccess:0,error:"registry_unavailable"};let i=e?.devices||{},n=e?.entities||{};if(t.authoritative){const r=t.liveDevices!==i||t.liveEntities!==n,o=void 0!==t.liveDevices||void 0!==t.liveEntities;if(r&&(t.liveDevices=i,t.liveEntities=n,t.projectedRevision=void 0,o&&Zh(e,t)),t.projectedRevision!==t.revision||!t.projectedDevices||!t.projectedEntities){const e={...t.devices},r={...t.entities};for(const[t,n]of Object.entries(i))Object.prototype.hasOwnProperty.call(e,t)||(e[t]=n);for(const[e,t]of Object.entries(n))Object.prototype.hasOwnProperty.call(r,e)||(r[e]=t);t.projectedDevices=e,t.projectedEntities=r,t.projectedRevision=t.revision}i=t.projectedDevices,n=t.projectedEntities}return{revision:t.revision,authoritative:t.authoritative,access:t.access,devices:i,entities:n,lastSuccess:t.lastSuccess,error:t.error}}function id(e){if(!e||"object"!=typeof e&&"function"!=typeof e)return 0;let t=Wh.get(e);return t||(t=Uh++,Wh.set(e,t)),t}function nd(e,t=td(e)){return[t.revision,t.access,id(t.devices),id(t.entities)].join(":")}function rd(e){return!!e&&null==e.disabled_by}function od(e,t=td(e)){const i={},n={},r={};for(const[e,n]of Object.entries(t.devices||{}))rd(n)&&(i[e]=n);for(const[e,i]of Object.entries(t.entities||{})){if(!rd(i))continue;const r=i.device_id?t.devices?.[i.device_id]:null;t.authoritative&&i.device_id&&!r||(r&&!rd(r)||(n[e]=i))}for(const[i,n]of Object.entries(e?.states||{})){const e=t.entities?.[i];if(e&&!rd(e))continue;const o=e?.device_id?t.devices?.[e.device_id]:null;t.authoritative&&e?.device_id&&!o||(o&&!rd(o)||(r[i]=n))}return{...e,devices:i,entities:n,states:r}}function sd(e,t=td(e)){return{...e,devices:t.devices||{},entities:t.entities||{}}}function ad(e,t){const i=[];for(const[n,r]of Object.entries(e||{}))r?.device_id===t&&i.push(n);return i}function ld(){if(Vh)return Vh;if("undefined"==typeof localStorage)return{};try{const e=JSON.parse(localStorage.getItem(Gh)||"{}");if(!e||"object"!=typeof e||Array.isArray(e))return{};const t=Date.now(),i={};for(const[n,r]of Object.entries(e))!r||"active"!==r.kind&&"ha_disabled"!==r.kind||!Number.isFinite(r.ts)||t-r.ts>7776e6||(i[n]=r);return Vh=i,Vh}catch{return{}}}function cd(e,t,i=td(e)){if(!t||"virtual"===t)return{kind:"active",enabledEntityIds:[],allEntityIds:[]};const n=t.indexOf(":");if(n<1)return{kind:"unverified",reason:"registry_unavailable",enabledEntityIds:[],allEntityIds:[]};const r=t.slice(0,n),o=t.slice(n+1);if("device"!==r&&"entity"!==r||!o)return{kind:"unverified",reason:"registry_unavailable",enabledEntityIds:[],allEntityIds:[]};const s=i.devices||{},a=i.entities||{};if(i.authoritative){if("device"===r){const e=s[o];if(!e)return{kind:"orphaned",reason:"device_missing",enabledEntityIds:[],allEntityIds:[]};const t=ad(a,o);if(!rd(e))return{kind:"ha_disabled",reason:"device",enabledEntityIds:[],allEntityIds:t};const i=t.filter(e=>rd(a[e]));return t.length&&!i.length?{kind:"ha_disabled",reason:"all_entities",enabledEntityIds:[],allEntityIds:t}:{kind:"active",enabledEntityIds:i,allEntityIds:t}}const t=a[o];return t&&!rd(t)?{kind:"ha_disabled",reason:"entity",enabledEntityIds:[],allEntityIds:[o]}:t?.device_id&&!s[t.device_id]?{kind:"orphaned",reason:"device_missing",enabledEntityIds:[],allEntityIds:[o]}:t?.device_id&&!rd(s[t.device_id])?{kind:"ha_disabled",reason:"device",enabledEntityIds:[],allEntityIds:[o]}:t||e?.states?.[o]?{kind:"active",enabledEntityIds:[o],allEntityIds:[o]}:{kind:"orphaned",reason:"entity_missing",enabledEntityIds:[],allEntityIds:[]}}const l=function(e){return ld()[e]||null}(t);if("device"===r){const t=s[o],i=ad(a,o);if(null!=t?.disabled_by)return{kind:"ha_disabled",reason:"device",enabledEntityIds:[],allEntityIds:i};const n=i.filter(e=>{const t=a[e];return null==t?.disabled_by&&(!t.device_id||null==s[t.device_id]?.disabled_by)});if(i.length&&!n.length&&i.every(e=>null!=a[e]?.disabled_by))return{kind:"ha_disabled",reason:"all_entities",enabledEntityIds:[],allEntityIds:i};if("ha_disabled"===l?.kind)return{kind:"ha_disabled",reason:l.reason||"device",enabledEntityIds:[],allEntityIds:i};if(t||n.some(t=>!!e?.states?.[t]))return{kind:"active",enabledEntityIds:n,allEntityIds:i}}else{const t=a[o];if(null!=t?.disabled_by)return{kind:"ha_disabled",reason:"entity",enabledEntityIds:[],allEntityIds:[o]};if(t?.device_id&&null!=s[t.device_id]?.disabled_by)return{kind:"ha_disabled",reason:"device",enabledEntityIds:[],allEntityIds:[o]};if("ha_disabled"===l?.kind)return{kind:"ha_disabled",reason:l.reason||"entity",enabledEntityIds:[],allEntityIds:[o]};if(t||e?.states?.[o])return{kind:"active",enabledEntityIds:[o],allEntityIds:[o]}}return{kind:"unverified",reason:"registry_unavailable",enabledEntityIds:[],allEntityIds:[]}}function hd(e){const t=td(e);return{access:t.access,authoritative:t.authoritative,revision:t.revision,lastSuccess:t.lastSuccess,error:t.error}}function dd(e){const t={};for(const[i,n]of Object.entries(e.entities)){if(!n?.device_id||!rd(n))continue;const r=e.devices?.[n.device_id];r&&!rd(r)||(t[n.device_id]=t[n.device_id]||[]).push(i)}return t}function ud(e,t){const i=new Map;for(const n of e){if(!0===n?.removed)continue;const e=n?.binding||"";if(!e.startsWith("entity:"))continue;const r=e.slice(7);if(!r)continue;const o=t?.entities?.[r]?.device_id;if(!o)continue;const s=i.get(o)||new Set;s.add(r),i.set(o,s)}return{byDevice:i}}function pd(e,t,i,n){const r=n.byDevice.get(t);return r?.size?{partial:!0,entityIds:i.filter(t=>!r.has(t)&&!e?.entities?.[t]?.hidden)}:{partial:!1,entityIds:[...i]}}function _d(e,t,i){if(t.identifiers?.[0]?.[0])return t.identifiers[0][0];for(const t of i){const i=e.entities[t]?.platform;if(i)return i}return""}function md(e,t){if(/_device_temperature$/.test(t))return!1;if(e.entities?.[t]?.entity_category)return!1;const i=e.states[t];if(!i)return/_temperature$/.test(t);const n=i.attributes||{};return"temperature"===n.device_class||/°C|°F/.test(n.unit_of_measurement||"")||/_temperature$/.test(t)}const gd=["vacuum","lawn_mower","climate","media_player","light","cover","lock","valve","alarm_control_panel","water_heater","fan","humidifier","siren","camera","remote"],fd=e=>[...e.filter(e=>!e.reg?.hidden),...e.filter(e=>!!e.reg?.hidden)];function vd(e,t){const i=t.map(t=>({eid:t,reg:e?.entities?.[t]})).filter(e=>!!e.reg);if(!i.length)return[];const n=i.filter(e=>!e.reg.entity_category),r=n.length?n:i;for(const e of gd){const t=r.filter(t=>t.eid.startsWith(e+"."));if(t.length)return fd(t).map(e=>e.eid)}const o=r.filter(t=>function(e,t){if(!t.startsWith("binary_sensor."))return!1;const i=xh(e?.states?.[t]?.attributes?.device_class||e?.entities?.[t]?.device_class||e?.entities?.[t]?.original_device_class);return ph.has(i)||_h.has(i)||mh.has(i)||gh.has(i)||"moving"===i||fh.has(i)}(e,t.eid));if(o.length)return fd(o).map(e=>e.eid);const s=r.filter(e=>e.eid.startsWith("switch."));if(s.length){const t=fd(s),n=t.find(t=>Th(e,t.eid));if(s.length>1&&n){const t=i.filter(t=>t.eid!==n.eid&&"config"!==t.reg?.entity_category&&null!=Rh(e,t.eid)),r=t.filter(e=>!e.reg?.entity_category),o=r.length?r:t;for(const t of[0,1,2]){const i=fd(o.filter(i=>Rh(e,i.eid)===t));if(i.length)return[i[0].eid,n.eid]}}return[(n||t[0]).eid]}const a=[];for(const e of je)a.push(...fd(r.filter(t=>t.eid.startsWith(e+"."))));return a.push(...fd(r.filter(e=>!je.includes(e.eid.split(".")[0])))),a.map(e=>e.eid)}function yd(e,t,i){const n=t.map(t=>({eid:t,reg:e.entities[t],st:e.states[t]})).filter(e=>e.reg),r=[n.filter(e=>!e.reg.hidden&&!e.reg.entity_category),n.filter(e=>!e.reg.entity_category),n.filter(e=>!e.reg.hidden),n];if("mdi:thermometer"===i||"mdi:air-filter"===i)for(const t of r){const i=t.find(t=>md(e,t.eid));if(i)return i.eid}const o=vd(e,t);return o.find(Dn)||o[0]}function bd(e,t,i=[]){return[...new Set(wd(e,t,i))].filter(e=>Dn(e))}function wd(e,t,i=[]){const n=e?.startsWith("entity:")?new Set([e.slice(7)]):new Set(i);return(t||[]).filter(e=>"string"==typeof e&&!n.has(e))}function kd(e,t){if("string"==typeof t)return e.area===t;const i=e.marker?.room_id;return i?!!t.id&&i===t.id:!!t.area&&e.area===t.area}function xd(e){const t=e.marker?.binding?.startsWith("entity:")?e.marker.binding.slice(7):null,i=e.entities.filter(Dn),n=e.primary&&Dn(e.primary)?e.primary:null;return[...new Set([t,n,...i].filter(e=>!!e&&Dn(e)))]}function Sd(e){const t=xd(e),i=e.marker?.light_entity;return i&&t.includes(i)?i:t[0]||null}function $d(e,t){if(!1===t.marker?.is_light)return[];if(!0===t.marker?.is_light){return[{eid:Sd(t),via:"forced"}]}const i=t.primary||vd(e,t.entities)[0];return i&&!i.startsWith("light.")?[]:t.entities.filter(t=>t.startsWith("light.")&&!!e.states?.[t]).map(e=>({eid:e,via:"light"}))}const Md=new WeakMap,Rd=new WeakMap;function Cd(e){return e.map(e=>[e.id||"",!0===e.hidden?1:0,e.primary||"",[...e.entities].join(","),void 0===e.controls?"":[...e.controls].join(","),e.marker?.id||"",e.marker?.binding||"",e.marker?.is_light,e.marker?.tap_action||"",!0===e.marker?.removed?1:0,e.marker?.light_entity||"",null==e.marker?.controls?"":[...e.marker.controls].join(",")].join("")).join("")}function Td(e){const t=Cd(e),i=Md.get(e);if(i?.fingerprint===t)return i;const n=e.filter(e=>!e.hidden),r=new Map,o=new Map;for(const t of e){o.set(t,wd(t.marker?.binding,t.marker?.controls??t.controls,t.entities));const e=t.hidden||!0!==t.marker?.is_light?null:t.marker?.id||t.id;e&&r.set(String(e),t)}const s=new Map;for(const t of e){const e=o.get(t)||[],i=new Set(void 0===t.controls?e.filter(Dn):t.controls.filter(Dn)),n=Sd(t),a=i.size?[...i]:n?[n]:[];for(const i of e){if(!i.startsWith("marker:"))continue;const e=i.slice(7);if(!e||e===String(t.marker?.id||t.id||""))continue;if(!r.has(e))continue;const n=s.get(e)||{markerId:e,controllers:[],driverEids:[]};n.controllers.push({device:t,driverEids:[...a]}),n.driverEids=[...new Set([...n.driverEids,...a])],s.set(e,n)}}const a={fingerprint:t,visible:n,markerById:r,persistedByDevice:o,incomingByMarker:s};return Md.set(e,a),a}function Dd(e){return Td(e).incomingByMarker}function Ad(e,t){const i=bd(t.marker?.binding,t.controls??t.marker?.controls,t.entities),n=wd(t.marker?.binding,t.marker?.controls??t.controls,t.entities);return(null!=t.marker?.is_light||!i.length&&!n.some(e=>e.startsWith("marker:")))&&$d(e,t).length>0}function Pd(e,t){return $d(e,t).some(e=>!!e.eid)}function Fd(e,t,i,n){const r="always"===e||"auto"===e&&t,o=r&&!i;return{sourceExists:r,fromSourceEnabled:r&&i,manualEnabled:r,radiusEnabled:r,passive:o,effectiveMode:o&&"auto"===n?"fixed":n}}function zd(e,t){const i=bd(t.marker?.binding,t.controls??t.marker?.controls,t.entities).map(e=>({eid:e,via:"controls"})),n=Ad(e,t)?$d(e,t):[];for(const e of n)e.eid&&i.some(t=>t.eid===e.eid)||i.push(e);return i}function Id(e,t,i,n){if(null!=i)return Id(e,t,null,n).filter(e=>kd(e.device,i));const r=Cd(t),o=function(e,t){const i=new Set;for(const e of t){for(const t of e.entities)i.add(t);for(const t of e.controls||e.marker?.controls||[])"string"!=typeof t||t.startsWith("marker:")||i.add(t)}return[...i].sort().map(t=>`${t}:${e?.states?.[t]?.state??""}`).join("|")}(e,t),s=Hh(n),a=Rd.get(t);if(a?.graphFingerprint===r&&a.stateFingerprint===o&&a.virtualLightFingerprint===s&&a.registry===e?.entities)return a.sources;const{visible:l,markerById:c,persistedByDevice:h,incomingByMarker:d}=Td(t),u=null==i?l:l.filter(e=>kd(e,i)),p=new Map,_=new Map;for(const t of u){const i=zd(e,t).filter(e=>"controls"!==e.via);for(const n of i){const i=!0===t.marker?.is_light?String(t.marker?.id||t.id||""):"",r=i?`marker:${i}`:`entity:${n.eid}`,o=n.eid?[n.eid]:[],s={key:r,eid:n.eid||"",stateEids:o,serviceEids:o,device:t,via:n.via,castsGlow:!0,passive:!n.eid,on:!n.eid||"on"===e.states?.[n.eid]?.state};p.set(t,[...p.get(t)||[],s]),n.eid&&_.set(n.eid,s)}}const m=new Map;for(const e of t){const t=h.get(e)||[],i=new Set(void 0===e.controls?t.filter(Dn):e.controls);m.set(e,i)}for(const t of p.values())for(const i of t){if(!i.passive)continue;const t=i.key.slice(7),r=d.get(t);i.on=!r||r.driverEids.some(t=>"on"===e.states?.[t]?.state),!r&&Lh(i.device.marker)&&(i.on=Bh(i.device.marker,n))}const g=new Map,f=e=>{const t=g.get(e.key);(!t||e.castsGlow&&!t.castsGlow)&&g.set(e.key,e)};for(const t of l){const n=h.get(t)||[],r=null==i||kd(t,i);for(const i of n){if(i.startsWith("marker:")){const e=c.get(i.slice(7)),t=e?p.get(e):null;if(t)for(const e of t)f(e);continue}if(!Dn(i)||!m.get(t)?.has(i))continue;const n=_.get(i);n?f(n):r&&f({key:`entity:${i}`,eid:i,stateEids:[i],serviceEids:[i],device:t,via:"controls",castsGlow:!1,passive:!1,on:"on"===e.states?.[i]?.state})}for(const e of p.get(t)||[])f(e)}const v=[...g.values()];return Rd.set(t,{graphFingerprint:r,stateFingerprint:o,virtualLightFingerprint:s,registry:e?.entities,sources:v}),v}function Od(e){const t=e.filter(e=>e.castsGlow);return t.find(e=>e.on)||t[0]||null}function Ed(e){return e.length?e.some(e=>e.on)?"on":"off":"none"}function Nd(e,t){const i=[];for(const n of t){const t=e.states[n];if(!t)continue;const r=(t.attributes?.unit_of_measurement||"").toLowerCase();if(/_(linkquality|lqi)$/.test(n)||"lqi"===r){const e=parseFloat(t.state);isNaN(e)||i.push(e);continue}const o=t.attributes?.linkquality??t.attributes?.lqi;if(null!=o){const e=parseFloat(o);isNaN(e)||i.push(e)}}return Ii(i)}function Hd(e,t){for(const i of t){if(!md(e,i))continue;const t=e.states[i];if(!t)continue;const n=parseFloat(t.state);if(!isNaN(n))return Math.round(10*n)/10}return null}function Ld(e,t){for(const i of t){if(!i.startsWith("climate."))continue;const t=e.states[i];if(!t||"unavailable"===t.state||"unknown"===t.state)continue;const n=parseFloat(t.attributes?.current_temperature);if(Number.isFinite(n))return Math.round(10*n)/10}return null}function Bd(e,t){if(e.entities?.[t]?.entity_category)return!1;const i=e.states[t];if(!i)return/_humidity$/.test(t);const n=i.attributes||{};return"humidity"===n.device_class||"%"===n.unit_of_measurement&&/_humidity$/.test(t)||/_humidity$/.test(t)}function qd(e,t){for(const i of t){if(!Bd(e,i))continue;const t=e.states[i];if(!t)continue;const n=parseFloat(t.state);if(!isNaN(n))return Math.round(n)}return null}function jd(e,t){if(!t)return[];const i=[];for(const[t,n]of Object.entries(e.entities)){if(!t.startsWith("light.")||n.hidden||!rd(n))continue;let r=null;if("group"===n.platform)r=n.area_id||null;else{if(!n.device_id)continue;{const t=e.devices[n.device_id];if(!rd(t))continue;if("Group"!==t?.model)continue;r=t.area_id||n.area_id||null}}if(!r)continue;const o=e.states[t];i.push({eid:t,name:n.name||o?.attributes?.friendly_name||t,area:r})}return i}function Wd(e,t,i,n,r){const o=qe(t,i,r);if(o!==Be)return o;const s=[];for(const t of n){const i=e.states[t]?.attributes?.device_class;i&&s.push(i)}return function(e){for(const t of e){const e=Le[t];if(e)return e}return null}(s)??Be}function Ud(e,t){return e.map(e=>{if(!Array.isArray(e.controls))return e;const i=e.controls.filter(e=>!("string"==typeof e&&e.startsWith("marker:")&&t.has(e.slice(7))));return i.length===e.controls.length?e:{...e,controls:i.length?i:null}})}function Gd(e,t,i){if(!t||!i||t===i)return[...e];const n=`marker:${t}`,r=`marker:${i}`;return e.map(e=>{const t=Array.isArray(e.controls)?e.controls.map(e=>e===n?r:e):e.controls,i="derived_marker_state"===e.value_badge?.source?.kind&&e.value_badge.source.ref===n?{...e.value_badge,source:{...e.value_badge.source,ref:r}}:e.value_badge,o="derived_marker_state"===e.value_source?.kind&&e.value_source.ref===n?{...e.value_source,ref:r}:e.value_source;return t===e.controls&&i===e.value_badge&&o===e.value_source?e:{...e,controls:t,...void 0!==i?{value_badge:i}:{},...void 0!==o?{value_source:o}:{}}})}function Vd(e,t,i){if(!t||t===i)return!0;const n=new Map;for(const t of e)n.set(t.id,(t.controls||[]).filter(e=>"string"==typeof e&&e.startsWith("marker:")).map(e=>e.slice(7)));const r=new Set,o=[i];for(;o.length;){const e=o.pop();if(e===t)return!0;r.has(e)||(r.add(e),o.push(...n.get(e)||[]))}return!1}function Kd(e,t,i,n){const r=new Set([t]),o=e.filter(e=>{const o=e.id===t||!n&&e.binding===i;return o&&r.add(e.id),!o});return{markers:n?o:[...o,{id:t,binding:i,removed:!0,hidden:!0}],cleanupIds:r}}function Yd(e){const t=new Set,i=new Set,n=new Set;for(const r of e||[]){const e=String(r.binding||"").indexOf(":");if(e<1)continue;const o=r.binding.slice(0,e),s=r.binding.slice(e+1);s&&(!0===r?.removed?"device"===o?t.add(s):"entity"===o&&i.add(s):"entity"===o&&n.add(s))}return{devices:t,entities:i,liveEntities:n}}function Xd(e,t,i){if(i.liveEntities.has(t))return!1;if(i.entities.has(t))return!0;const n=e?.entities?.[t]?.device_id;return!!n&&i.devices.has(n)}function Zd(e,t,i,n,r){const o=bd(t.binding,t.controls,e.entities).filter(e=>!Xd(i,e,n)).filter(e=>"active"===cd(i,"entity:"+e,r).kind);e.marker=t,e.controls=o,e.userHidden=!0===t.hidden,e.hidden=e.userHidden||"ha_disabled"===e.bindingStatus?.kind,t.name&&(e.name=t.name),t.icon&&(e.icon=t.icon),null!=t.model&&(e.model=t.model),e.link=t.link??null,e.description=t.description??null,e.pdfs=t.pdfs||[],e.tapAction=t.tap_action??null}function Jd(e){const t=e.hass,i=e.registry||td(t),n=od(t,i),r=sd(t,i),{areaToSpace:o,markers:s,settings:a,excluded:l,iconRules:c}=e,h=!1!==a.group_lights,d=Yd(s),u=jd(n,h).filter(e=>!Xd(n,e.eid,d)),p=new Set(u.map(e=>e.area)),_=dd(n),m=ud(s,r),g=new Set(s.map(e=>e.binding)),f=[];for(const e of Object.values(n.devices)){const r=e.area_id;if(!r||!o[r])continue;if("service"===e.entry_type)continue;if(g.has("device:"+e.id))continue;if("active"!==cd(t,"device:"+e.id,i).kind)continue;const s=pd(n,e.id,_[e.id]||[],m);if(s.partial&&!s.entityIds.length)continue;const a=s.entityIds,d=_d(n,e,a);let u=l.has(d)||"Group"===e.model||/scene/i.test(e.model||"")||/bridge/i.test((e.model||"")+(e.name||""))||"myheat"===d&&!!e.via_device_id;if(!u&&h&&p.has(r)){const t=(e.name_by_user||e.name||"").trim();"mdi:lightbulb"===Wd(n,t,e.model,a,c)&&(u=!0)}u&&f.push("device:"+e.id)}return f}function Qd(e,t,i,n){if("string"==typeof e.room_id&&e.room_id.length>0&&null===e.area)return{area:"",space:e.space||n};const r=e.area||t||"";return{area:r,space:r&&i[r]||e.space||n}}function eu(e){const t=e.hass,i=e.registry||td(t),n=od(t,i),r=sd(t,i),{areaToSpace:o,markers:s,settings:a,excluded:l,showAll:c,firstSpaceId:h,loc:d,iconRules:u}=e,p=!1!==a.group_lights,_=Yd(s),m=jd(n,p).filter(e=>!Xd(n,e.eid,_)),g=new Set(m.map(e=>e.area)),f=dd(n),v=function(e){const t={};for(const[i,n]of Object.entries(e.entities||{}))n?.device_id&&(t[n.device_id]=t[n.device_id]||[]).push(i);return t}(r),y=ud(s,r),b=new Set;for(const e of s){const[t,i]=e.binding.split(":");"device"!==t&&"entity"!==t||!i||b.add(e.binding)}const w=(e,t)=>s.find(i=>i.binding===e+":"+t),k={},x=[];for(const e of Object.values(n.devices)){const r=e.area_id;if(!r||!o[r])continue;if("service"===e.entry_type)continue;if(b.has("device:"+e.id))continue;const s=cd(t,"device:"+e.id,i);if("active"!==s.kind)continue;const h=w("device",e.id);if(h&&h.hidden&&!a.filter_seeded)continue;const _=pd(n,e.id,f[e.id]||[],y);if(_.partial&&!_.entityIds.length)continue;const m=_.entityIds,v=_.partial?{kind:"active",enabledEntityIds:m,allEntityIds:m}:s,S=_d(n,e,m),$=!a.filter_seeded;if($&&!c){if(l.has(S))continue;if("Group"===e.model)continue;if(/scene/i.test(e.model||""))continue;if(/bridge/i.test((e.model||"")+(e.name||"")))continue;if("myheat"===S&&e.via_device_id)continue}const M=(e.name_by_user||e.name||d("device.unnamed")).trim(),R=M+"|"+r;let C=Wd(n,M,e.model,m,u);if(m.some(e=>e.startsWith("lock."))&&(C="mdi:lock"),$&&!c&&p&&"mdi:lightbulb"===C&&g.has(r))continue;k[R]=(k[R]||0)+1;const T=k[R]>1?M+" "+k[R]:M,D={id:e.id,name:T,model:e.model||"",area:r,space:o[r],icon:C,entities:m,allEntities:v.allEntityIds,bindingStatus:v,bindingKind:"device",bindingRef:e.id,pdfs:[]};D.primary=yd(n,m,C),"mdi:thermometer"!==C&&"mdi:air-filter"!==C||(D.temp=Hd(n,m)),D.primary&&Bd(n,D.primary)&&(D.hum=qd(n,m)),x.push(D)}for(const e of m)o[e.area]&&(b.has("entity:"+e.eid)||x.push({id:"lg_"+e.eid,name:e.name,model:d("device.light_group"),area:e.area,space:o[e.area],icon:"mdi:lightbulb-group",entities:[e.eid],allEntities:[e.eid],bindingStatus:{kind:"active",enabledEntityIds:[e.eid],allEntityIds:[e.eid]},primary:e.eid,bindingKind:"entity",bindingRef:e.eid,pdfs:[]}));for(const e of s){if(e.removed)continue;const[s,l]=e.binding.split(":"),c="device"===s||"entity"===s?cd(t,e.binding,i):null;if(!e.hidden||a.filter_seeded||"ha_disabled"===c?.kind)if("device"===s){const t=c;if("unverified"===t.kind)continue;const s=r.devices[l],{area:a,space:p}=Qd(e,s?.area_id,o,h),m="active"===t.kind?t.enabledEntityIds:[];let g=s?Wd(n,s.name_by_user||s.name||"",s.model,m,u):"mdi:help-circle";m.some(e=>e.startsWith("lock."))&&(g="mdi:lock");const f={id:e.id,name:s?.name_by_user||s?.name||d("device.fallback"),model:s?.model||"",area:a,space:p,icon:g,entities:m,allEntities:t.allEntityIds.length?t.allEntityIds:s&&v[s.id]||[],bindingStatus:t,bindingKind:"device",bindingRef:l};f.primary=yd(n,m,g),"mdi:thermometer"!==g&&"mdi:air-filter"!==g||(f.temp=Hd(n,m)),f.primary&&Bd(n,f.primary)&&(f.hum=qd(n,m)),Zd(f,e,r,_,i),x.push(f)}else if("entity"===s){if(Xd(r,l,_))continue;const t=c;if("unverified"===t.kind)continue;const s=r.entities[l],a=s?.area_id||s?.device_id&&r.devices[s.device_id]?.area_id||"",{area:d,space:p}=Qd(e,a,o,h),m=n.states[l],g=s?.name||m?.attributes?.friendly_name||l;let f=Wd(n,g,"",[l],u);l.startsWith("lock.")&&(f="mdi:lock");const v={id:e.id,name:g,model:"",area:d,space:p,icon:f,entities:"active"===t.kind?[l]:[],allEntities:[l],bindingStatus:t,primary:"active"===t.kind?l:void 0,bindingKind:"entity",bindingRef:l};"mdi:thermometer"!==f&&"mdi:air-filter"!==f||!v.entities.length||(v.temp=Hd(n,v.entities)),v.entities.length&&Bd(n,l)&&(v.hum=qd(n,v.entities)),Zd(v,e,r,_,i),x.push(v)}else{const t=e.area||"",n=e.space||t&&o[t]||h,s={id:e.id,name:e.name||d("device.virtual"),model:e.model||"",area:t,space:n,icon:e.icon||"mdi:map-marker",entities:[],allEntities:[],bindingStatus:{kind:"active",enabledEntityIds:[],allEntityIds:[]},bindingKind:"virtual",virtual:!0};Zd(s,e,r,_,i),x.push(s)}}return x}function tu(e){const{marker:t,siblingMarkers:i=[],...n}=e;return eu({...n,markers:[...i.filter(e=>e.id!==t.id),t]}).find(e=>e.id===t.id)||null}function iu(e,t,i,n){if(!t)return null;if(function(e,t,i){if(!t)return!1;const n=t.indexOf(":");if(n<1)return!1;const r=t.slice(0,n),o=t.slice(n+1),s=Yd(i);return"device"===r?s.devices.has(o):"entity"===r&&Xd(e,o,s)}(e,t,n))return null;const r=t.indexOf(":");if(r<0)return null;const o=t.slice(0,r),s=t.slice(r+1);if(!s)return null;if("entity"===o){const t=parseFloat(e.states[s]?.state);return Number.isFinite(t)?"temp"===i?Math.round(10*t)/10:Math.round(t):null}if("device"===o){const t=Object.entries(e.entities).filter(([,e])=>e.device_id===s).map(([e])=>e);return"temp"===i?Hd(e,t):qd(e,t)}return null}const nu=new RegExp(["water","voda","coolant","flow_?temp","return_?temp","target","setpoint","chip","cpu","processor","board","core_temp","device_temp","batter","akkum","freezer","fridge","oven","kettle","boiler"].join("|"),"i");function ru(e,t){return t.area?t.area:e&&t.id?`@room/${encodeURIComponent(e)}/${encodeURIComponent(t.id)}`:null}function ou(e){return null==e.area&&e.space&&e.room_id?ru(e.space,{id:e.room_id,area:null}):e.area||null}function su(e){const t=e?.exclude_integrations;return t?new Set(t):Ie}function au(e,t,i,n=Ie){const r=new Map;if(!e?.entities)return r;const o=Yd(i),s=new Set,a=new Map,l=new Map;for(const e of i||[]){if(e?.removed)continue;const t=(e.binding||"").indexOf(":");if(t<=0)continue;const i=e.binding.slice(0,t),n=e.binding.slice(t+1);if(!n)continue;!0===e.use_climate_temp&&s.add(n);const r=ou(e);r&&("entity"!==i||a.has(n)?"device"!==i||l.has(n)||l.set(n,r):a.set(n,r))}const c=new Map;for(const[t,i]of Object.entries(e.entities)){if(i.device_id&&o.devices.has(i.device_id)&&!o.liveEntities.has(t)||!i.device_id&&o.entities.has(t)&&!o.liveEntities.has(t))continue;const r=i.device_id?e.devices?.[i.device_id]:null;if(!rd(i)||r&&!rd(r))continue;const h=a.get(t)||(i.device_id?l.get(i.device_id):null)||i.area_id||r?.area_id||null;if(!h)continue;if(i.entity_category)continue;if(!(s.size>0&&t.startsWith("climate.")&&(s.has(t)||i.device_id&&s.has(i.device_id)))){if(n.has(i.platform))continue;if(nu.test(t))continue}let d=c.get(h);d||(d=new Map,c.set(h,d));const u=i.device_id||t;let p=d.get(u);if(!p){const n=e.states?.[t];p={name:(r?r.name_by_user||r.name:i.name||n?.attributes?.friendly_name||t)||t,model:r?.model,ents:[]},d.set(u,p)}p.ents.push(t)}for(const[i,n]of c){const o=[],a=[];for(const[i,r]of n){const n=Wd(e,r.name,r.model,r.ents,t),l="mdi:thermometer"===n||"mdi:air-filter"===n;if(l){const t=Hd(e,r.ents);null!=t&&o.push(t)}if(s.size>0&&(s.has(i)||r.ents.some(e=>s.has(e)))){const t=Ld(e,r.ents);null!=t&&o.push(t)}if(l||"mdi:water-percent"===n){const t=qd(e,r.ents);null!=t&&a.push(t)}}(o.length||a.length)&&r.set(i,{temp:o.length?Math.round(o.reduce((e,t)=>e+t,0)/o.length*10)/10:null,hum:a.length?Math.round(a.reduce((e,t)=>e+t,0)/a.length):null})}return r}function lu(e,t,i){const n=[];for(const r of t){if(r.area!==i||r.virtual)continue;const t=Nd(e,r.entities);null!=t&&n.push(t)}return Ii(n)}const cu={offStates:["off"],unknownUsesToggle:!0},hu={light:cu,switch:cu,fan:cu,humidifier:cu,input_boolean:cu,automation:cu,remote:cu,group:cu,climate:{...cu,featureMasks:{turn_on:256,turn_off:128,toggle:384}},media_player:{...cu,featureMasks:{turn_on:128,turn_off:256,toggle:384}},siren:{...cu,featureMasks:{turn_on:1,turn_off:2,toggle:3}},vacuum:{...cu,featureMasks:{turn_on:1,turn_off:2,toggle:3}},water_heater:{...cu,featureMasks:{turn_on:8,turn_off:8,toggle:8}},camera:{...cu,featureMasks:{turn_on:1,turn_off:1,toggle:1}}};function du(e){return e.slice(0,e.indexOf("."))}function uu(e,t,i){if(!e?.services||"object"!=typeof e.services)return!1;const n=e.services?.[t];return!!n&&Object.prototype.hasOwnProperty.call(n,i)}function pu(e,t,i){return uu(e,t,i)?{domain:t,service:i}:uu(e,"homeassistant",i)?{domain:"homeassistant",service:i}:null}function _u(e,t){return e?.entities?.[t]||null}function mu(e,t,i){const n=e?.states?.[i],r=_u(t,i);return n?.attributes?.friendly_name||r?.name||r?.original_name||i}function gu(e,t){const i=_u(e,t);if(null!=i?.disabled_by)return!0;const n=i?.device_id?e?.devices?.[i.device_id]:null;return null!=n?.disabled_by}function fu(e,t){const i=e?.attributes?.supported_features;if(null==i||""===i)return!1;const n=Number(i);return Number.isFinite(n)&&(n&t)===t}function vu(e,t,i){const n=du(i);if("lock"===n||"alarm_control_panel"===n)return!0;if("cover"!==n)return!1;const r=e?.states?.[i],o=_u(t,i),s=String(r?.attributes?.device_class||o?.device_class||o?.original_device_class||"");return Wi.has(s)}function yu(e,t,i,n,r){return{ref:i,entityId:n,name:n?mu(e,t,n):null,reason:r}}function bu(e,t,i,n,r,o=null){return{target:null,skipped:yu(e,t,i,n,r),semantics:o,nextEffect:null,command:null}}function wu(e,t,i,n,r=i){const o=du(i);if("cover"!==o&&"valve"!==o)return function(e,t,i,n,r=i){const o=du(i),s=e?.states?.[i];if(gu(t,i))return bu(e,t,r,i,"ha-disabled","power");if(vu(e,t,i))return bu(e,t,r,i,"secure");if(!s)return bu(e,t,r,i,"missing","power");if("unavailable"===s.state)return bu(e,t,r,i,"unavailable","power");const a=hu[o];if(!a)return bu(e,t,r,i,"unsupported");let l,c;if("unknown"===s.state||""===s.state){if(!a.unknownUsesToggle)return bu(e,t,r,i,"unsupported","power");l="toggle",c="toggle"}else a.offStates.includes(String(s.state))?(l="turn-on",c="turn_on"):(l="turn-off",c="turn_off");const h=a.featureMasks?.[c];if(h&&!fu(s,h))return bu(e,t,r,i,"unsupported","power");const d=pu(e,o,c);return d?{target:{entityId:i,name:mu(e,t,i),state:String(s.state||""),via:n},skipped:null,semantics:"power",nextEffect:l,command:{...d,data:{entity_id:i}}}:bu(e,t,r,i,"unsupported","power")}(e,t,i,n,r);if(gu(t,i))return bu(e,t,r,i,"ha-disabled",o);if(vu(e,t,i))return bu(e,t,r,i,"secure",o);const s=e?.states?.[i];if(!s)return bu(e,t,r,i,"missing",o);if("unavailable"===s.state)return bu(e,t,r,i,"unavailable",o);const a=function(e,t,i){const n=String(i?.state||""),r="closed"===n?{service:`open_${t}`,effect:"open",feature:1}:"open"===n?{service:`close_${t}`,effect:"close",feature:2}:"opening"===n||"closing"===n?{service:`stop_${t}`,effect:"stop",feature:8}:null;return r&&fu(i,r.feature)&&uu(e,t,r.service)?r:fu(i,3)&&uu(e,t,"toggle")?{service:"toggle",effect:"toggle"}:null}(e,o,s);if(!a)return bu(e,t,r,i,"unsupported",o);return{target:{entityId:i,name:mu(e,t,i),state:String(s.state||""),via:n},skipped:null,semantics:o,nextEffect:a.effect,command:{domain:o,service:a.service,data:{entity_id:i}}}}function ku(e){return"entity"===e.bindingKind?e.bindingRef&&Dn(e.bindingRef)?[e.bindingRef]:[]:"virtual"===e.bindingKind?[]:xd(e)}function xu(e){const t=e.marker?.toggle_entity;return t&&ku(e).includes(t)?t:null}function Su(e,t,i){const n=function(e,t){if("entity"===e.bindingKind&&e.bindingRef){const t=e.marker?.light_entity?Sd(e):null;return[...new Set([t,e.bindingRef].filter(e=>!!e))]}const i=e.entities.length?e.entities:e.allEntities||[],n=e.marker?.light_entity||e.primary&&Dn(e.primary)?Sd(e):null;return[...new Set([n,...vd(t,i)].filter(e=>!!e))]}(i,t);if(!n.length)return null;const r="entity"===i.bindingKind?"binding":"device-role";if("binding"===r)return wu(e,t,n[0],r);let o=null,s=null;for(const i of n){const n=wu(e,t,i,r);if(n.command)return n;const a=n.skipped?.reason;if("missing"===a||"unavailable"===a||"secure"===a)return n;"ha-disabled"!==a?o||=n:s||=n}return o||s}function $u(e){const t=e.skipped?.reason;return"missing"===t?"unavailable":t||"unsupported"}function Mu(e,t){return{origin:e,kind:"none",semantics:null,targets:[],skippedTargets:[],noneReason:t,nextEffect:null,command:null}}function Ru(e,t){return"cover"===e||"toggle"===e?"toggle":"more-info"===e||"run"===e||"info"===e||"none"===e?e:(null==e||""===e)&&"light"===t?"toggle":"info"}function Cu(e,t){return{origin:e,kind:"single",semantics:t.semantics,targets:t.target?[t.target]:[],skippedTargets:t.skipped?[t.skipped]:[],noneReason:t.command?null:$u(t),nextEffect:t.nextEffect,command:t.command}}function Tu(e,t,i,n=[]){const r=new Map,o=[],s=new Set,a=e=>{const t=`${e.ref}\n${e.entityId||""}\n${e.reason}`;s.has(t)||(s.add(t),o.push(e))};for(const e of n)a(e);for(const n of i){const i=wu(e,t,n.entityId,n.via,n.ref);i.target?r.set(n.entityId,r.get(n.entityId)||i.target):i.skipped&&a(i.skipped)}const l=[...r.values()];if(!l.length)return{origin:"explicit-toggle",kind:"group",semantics:"group-power",targets:l,skippedTargets:o,noneReason:o.length&&o.every(e=>"secure"===e.reason)?"secure":"configured-targets-missing",nextEffect:null,command:null};const c=l.some(e=>"on"===e.state)?"turn_off":"turn_on",h=pu(e,"homeassistant",c);return h?{origin:"explicit-toggle",kind:"group",semantics:"group-power",targets:l,skippedTargets:o,noneReason:null,nextEffect:"turn_on"===c?"turn-on":"turn-off",command:{...h,data:{entity_id:l.map(e=>e.entityId)}}}:{origin:"explicit-toggle",kind:"group",semantics:"group-power",targets:[],skippedTargets:[...o,...l.map(i=>yu(e,t,i.entityId,i.entityId,"unsupported"))],noneReason:"unsupported",nextEffect:null,command:null}}function Du(e){return String(e.marker?.id||e.id||"")}function Au(e){const{hass:t,device:i}=e,n=e.registryHass||t,r=function(e){return"toggle"===e.tapAction?"explicit-toggle":"cover"===e.tapAction?"legacy-cover":!e.tapAction&&e.primary?.startsWith("light.")?"default-light":null}(i);if(!r)return null;const o=i.marker;if("explicit-toggle"===r&&Lh(o)){const t=String(o?.id||i.id||""),n=Dd(e.devices).get(t);if(n)return function(e,t){const i=e.registryHass||e.hass;return Tu(e.hass,i,t.driverEids.map(e=>({entityId:e,via:"control-marker-driver",ref:`marker:${t.markerId}`})))}(e,n);const s=Bh(o,e.virtualLights);return{origin:r,kind:"single",semantics:"power",targets:[{entityId:"",name:i.name,state:s?"on":"off",via:"virtual-light"}],skippedTargets:[],noneReason:null,nextEffect:s?"turn-off":"turn-on",command:null,operation:{kind:"virtual-light",markerId:o.id}}}if("explicit-toggle"===r){if(wd(i.marker?.binding,i.marker?.controls??i.controls,i.entities).length)return function(e,t=null){const{hass:i,device:n,devices:r}=e,o=e.registryHass||i,s=wd(n.marker?.binding,n.marker?.controls??n.controls,n.entities),a=e.lightSources||Id(i,r,null,e.virtualLights),l=new Map;for(const e of a){if(!e.key.startsWith("marker:"))continue;const t=l.get(e.key)||[];t.push(e),l.set(e.key,t)}const c=Dd(r),h=new Map;for(const e of r){const t=String(e.marker?.id||e.id||"");t&&h.set(t,e)}const d=[],u=[];t&&d.push({entityId:t,via:"entity"===n.bindingKind?"binding":"device-role",ref:t});for(const e of s){if(!e.startsWith("marker:")){Dn(e)?d.push({entityId:e,via:"control-entity",ref:e}):u.push(yu(i,o,e,e.includes(".")?e:null,"unsupported"));continue}const t=l.get(e)||[];if(!t.length){const t=h.get(e.slice(7));if("ha_disabled"===t?.bindingStatus?.kind){const n=t.bindingStatus.allEntityIds[0]||null;u.push({ref:e,entityId:n,name:t.name||(n?mu(i,o,n):null),reason:"ha-disabled"})}else u.push(yu(i,o,e,null,"missing"));continue}const r=[...new Set(t.flatMap(e=>e.serviceEids))];if(r.length){for(const t of r)d.push({entityId:t,via:"control-entity",ref:e});continue}const s=t.some(e=>e.passive),a=e.slice(7),p=Du(n),_=c.get(a)?.controllers.find(e=>Du(e.device)===p);if(s&&_?.driverEids.length)for(const t of _.driverEids)d.push({entityId:t,via:"control-marker-driver",ref:e});else u.push(yu(i,o,e,null,s?"missing":"unsupported"))}return Tu(i,o,d,u)}(e,xu(i))}if("legacy-cover"===r){const e=i.entities.find(e=>e.startsWith("cover."))||i.allEntities?.find(e=>e.startsWith("cover."));return e?Cu(r,wu(t,n,e,"device-role")):Mu(r,"no-actionable-entity")}const s=xu(i),a=s?wu(t,n,s,"entity"===i.bindingKind?"binding":"device-role"):Su(t,n,i);return a?Cu(r,a):Mu(r,i.virtual||"virtual"===i.bindingKind?"no-actionable-entity":"no-binding")}function Pu(e){if(!e)return[];const t=Array.isArray(e.data.entity_id)?e.data.entity_id:[e.data.entity_id];return[...new Set(t)].sort()}function Fu(e){return e?e.operation?e.operation:e.command?{kind:"ha-service",command:e.command}:null:null}const zu=new Set(["missing","ha-disabled","unavailable"]);function Iu(e,t){const i=Fu(e),n=Fu(t);return!(!i||!n||i.kind!==n.kind)&&("virtual-light"===i.kind&&"virtual-light"===n.kind?i.markerId===n.markerId:"ha-service"===i.kind&&"ha-service"===n.kind&&function(e,t){const i=Pu(e),n=Pu(t);return i.length===n.length&&i.every((e,t)=>e===n[t])}(i.command,n.command))}function Ou(e,t){const i=e.targets[0]||e.skippedTargets[0],n=[];return"group"===e.kind?e.targets.length&&n.push(t.group(e.targets)):i&&n.push(t.single(i)),e.nextEffect&&e.targets.length&&n.push("group"===e.kind?t.groupCurrentNext(e.targets,e.nextEffect):t.currentNext(e.targets[0],e.nextEffect)),e.skippedTargets.length&&n.push(t.skipped(e.skippedTargets)),!e.command&&e.noneReason&&n.push(t.none(e.noneReason)),n}function Eu(e,t){return e.catch(()=>{}).then(t)}const Nu=e=>{const t=e?.config;return t&&Array.isArray(t.spaces)?t:null},Hu=(e,t)=>"number"==typeof e&&Number.isFinite(e)?e:t;class Lu{constructor(e){this.onBodyReplaced=e,this.config=null,this.configRev=0,this.configFingerprint="",this.layout={},this.layoutRev=0,this.layoutFingerprint=""}setConfig(e){const t=this.config;e!==t&&(this.config=e,this.onBodyReplaced?.("_serverCfg",t))}setLayout(e){const t=this.layout;e!==t&&(this.layout=e,this.onBodyReplaced?.("_layout",t))}currentConfigFingerprint(){return this.configFingerprint||ac(this.config)}currentLayoutFingerprint(){return this.layoutFingerprint||ac(this.layout)}adoptResponses(e,t,i,n){const r=Nu(e),o=ac(r),s=o!==this.currentConfigFingerprint();s&&(i(),this.setConfig(r),this.configFingerprint=o),this.configRev=e?.rev??this.configRev;let a=!1;if(void 0!==t){const e=t?.layout??{},i=ac(e);a=i!==this.currentLayoutFingerprint(),a&&(n(),this.setLayout(e),this.layoutFingerprint=i),this.layoutRev=t?.rev??this.layoutRev}return{configChanged:s,layoutChanged:a}}adoptMergedLayout(e,t,i){const n=ac(e),r=n!==ac(this.layout);return r&&(i?.(),this.setLayout(e)),this.layoutFingerprint=n,this.layoutRev=t?.rev??this.layoutRev,r}stageConfigCandidate(e){const t=ac(e);t!==ac(this.config)&&this.setConfig(e),this.configFingerprint=t}acceptConfigWrite(e,t){this.configFingerprint=ac(e),this.configRev=Hu(t?.rev,this.configRev+1)}acceptPairWrite(e,t,i){this.setConfig(e),this.configFingerprint=ac(e),this.setLayout(t),this.layoutFingerprint=ac(t),this.configRev=Hu(i?.config_rev,this.configRev+1),this.layoutRev=Hu(i?.layout_rev,this.layoutRev+1)}noteLayoutRevision(e){"number"==typeof e&&e>this.layoutRev&&(this.layoutRev=e)}stageLocalConfig(e){this.setConfig(e)}stageLocalLayout(e){this.setLayout(e)}seedIdentity(e){Object.assign(this,e)}refreshConfigFingerprint(){this.configFingerprint=ac(this.config)}refreshLayoutFingerprint(){this.layoutFingerprint=ac(this.layout)}beginOptimistic(e,t){return function(e,t,i,n,r){return{previous:JSON.parse(JSON.stringify(e)),previousFingerprint:i,revision:n,attempted:t,attemptedFingerprint:r(t)}}(e,t,this.configFingerprint,this.configRev,ac)}rollbackOptimistic(e){const t=this.config;return!(!t||this.configRev!==e.revision||ac(t)!==e.attemptedFingerprint)&&(this.setConfig(e.previous),this.configFingerprint=e.previousFingerprint,!0)}restoreCached(e){const t=e?.config;return!(!t||!Array.isArray(t.spaces))&&(this.setConfig(t),this.configRev=e?.rev||0,this.configFingerprint=e?.config_fingerprint||ac(t),this.setLayout(e?.layout||{}),this.layoutRev=e?.layout_rev||0,this.layoutFingerprint=e?.layout_fingerprint||ac(this.layout),!0)}snapshot(e){return this.config?(this.refreshConfigFingerprint(),this.refreshLayoutFingerprint(),{config:this.config,rev:this.configRev,config_fingerprint:this.configFingerprint,layout:this.layout,layout_rev:this.layoutRev,layout_fingerprint:this.layoutFingerprint,virtual_lights:e}):null}}async function Bu(e,t){const i=t.isCurrent??(()=>!0);if(!i())return{status:"superseded"};const{cfgResp:n,layResp:r}=t,o=e._adoption,s=Nu(n),a=null!=n&&ac(s)!==o.currentConfigFingerprint()||null!=r&&ac(r.layout??{})!==o.currentLayoutFingerprint();if(a){const t=await e._signer.prepareImage(e.hass,e._candidateBackdrop(s));if(!i())return{status:"superseded"};if(!t)return e._continuity.note("asset-failed"),e._scheduleLoadRetry(!0),{status:"asset-wait"}}if(!i())return{status:"superseded"};a&&e._continuity.hasCompleteFrame&&"steady"===e._continuity.state&&e._beginContinuityCandidate(t.reason,!0),t.beforeAdopt?.();const l=e._space;return function(e,t,i){const n=e._adoption,r=!!n.config,{configChanged:o,layoutChanged:s}=n.adoptResponses(t??{},i,()=>{e._geometryHistory.clear(),e._devicePositionHistory.clear(),e._cancelDeviceDrag(),e._pendingPhysicalWrites.clear(),e._clearRoomFocus(!0),e._cancelCameraTransition(!1),r&&e._clearGeometryGesture()},()=>{e._cancelCameraTransition(!1),e._devicePositionHistory.clear(),e._cancelDeviceDrag()});if(o&&e._seedDecorStyle(n.config),t&&("virtual_lights"in t||"config"in t)){const i=Nh(e._virtualLights,t.virtual_lights,n.configRev,"virtual_lights"in t);Hh(i)!==Hh(e._virtualLights)&&(e._virtualLights=i,e._capturedSnapshotVirtual="")}e._canOptimizeUndo=!(!t?.can_optimize_undo&&!i?.can_optimize_undo),e._adoptConfigCapabilities(t),e._undoKind=t?.undo_kind||i?.undo_kind||null,"boolean"==typeof t?.can_write&&(e._serverCanWrite=t.can_write),o&&e._continuity.note("config-candidate",{configRev:n.configRev}),s&&e._continuity.note("layout-candidate",{layoutRev:n.layoutRev})}(e,n,r),"reload"===t.profile&&(e._syncDecorAssets(s).catch(()=>{}),e._adoptInitialSpace(e._model,!0),e._resumePendingNavMode(),e._cacheSnapshot()),t.afterAdopt?.(),{status:"adopted",spaceChanged:e._space!==l}}const qu=(e,t)=>e.connection===t.connection&&e.userId===t.userId&&e.route===t.route,ju=e=>"number"==typeof e&&Number.isFinite(e)?e:null;class Wu{constructor(){this.sequence=0,this.currentSequence=0,this.lifecycle=0,this.observedHighWater=null,this.context=null}observeContext(e){this.context?qu(this.context,e)||(this.context={...e},this.invalidateLifecycle()):this.context={...e}}invalidateLifecycle(){this.lifecycle+=1,this.currentSequence=++this.sequence,this.observedHighWater=null}observeRevision(e,t,i){this.observeContext(i);const n=ju(e);if(null===n)return null;const r=ju(t)??Number.NEGATIVE_INFINITY;return n<=Math.max(r,this.observedHighWater??Number.NEGATIVE_INFINITY)?null:(this.observedHighWater=n,Object.freeze({sequence:this.currentSequence,lifecycle:this.lifecycle,context:{...i},observedRevision:n}))}isReservationCurrent(e,t,i){this.observeContext(t);const n=ju(i)??Number.NEGATIVE_INFINITY;return e.sequence===this.currentSequence&&e.lifecycle===this.lifecycle&&qu(e.context,t)&&e.observedRevision===this.observedHighWater&&e.observedRevision>n}begin(e){this.observeContext(e.context),e.force&&this.invalidateLifecycle();const t=++this.sequence;return this.currentSequence=t,Object.freeze({sequence:t,lifecycle:this.lifecycle,force:e.force,context:{...e.context},baselineRevision:e.baselineRevision,baselineFingerprint:e.baselineFingerprint})}isCurrent(e){this.observeContext(e.context);const t=e.claim;return e.connected&&(t.force||!e.writePending)&&t.sequence===this.currentSequence&&t.lifecycle===this.lifecycle&&qu(t.context,e.context)&&t.baselineRevision===e.baselineRevision&&t.baselineFingerprint===e.baselineFingerprint}}const Uu=e=>{const t=e.hass,i=t?.user?.id;return{connection:t?.connection??null,userId:"string"==typeof i?i:null,route:location.pathname}};async function Gu(e,t=!1,i){let n=null;const r=e._configReloadAuthority;if(!t){if(void 0!==i&&(n=r.observeRevision(i,e._cfgRev,Uu(e)),!n))return;if(e._saveConfigDebounced.pending()&&e._saveConfigDebounced.flush(),e._cfgWriting)return clearTimeout(e._reloadRetry),void(e._reloadRetry=window.setTimeout(()=>{n&&!r.isReservationCurrent(n,Uu(e),e._cfgRev)||Gu(e,!1)},400))}const o=r.begin({force:t,context:Uu(e),baselineRevision:e._cfgRev,baselineFingerprint:e._adoption.currentConfigFingerprint()}),s=()=>((e,t)=>e._configReloadAuthority.isCurrent({claim:t,context:Uu(e),connected:e.isConnected,baselineRevision:e._cfgRev,baselineFingerprint:e._adoption.currentConfigFingerprint(),writePending:e._saveConfigDebounced.pending()||e._cfgWriting}))(e,o);let a=!1;try{const t=await e._getAuthoritativeConfig();if(!s())return;const i=await e._adoptAuthoritative({cfgResp:t,reason:"config-reload",profile:"reload",isCurrent:s,afterAdopt:()=>{e._regSignature="",e._maybeRebuildDevices()}});if("superseded"===i.status)return;if(a=!0,"adopted"!==i.status)return;i.spaceChanged&&e._restoreZoom(),e.requestUpdate()}catch(t){if(!s())return;a=!0,e._showToast(e._t("toast.cfg_reload_failed",{err:e._errText(t)}))}finally{(a||s())&&(e._continuityDataReady=!0,e.requestUpdate())}}const Vu=e=>!!e&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1]);function Ku(e,t=5,i=5){return Ao(e.cm,t,i)/2}function Yu(e,t,i=1,n=5,r=5,o=0){const s=e.host;if(!s||"partition"!==s.kind||"string"!=typeof s.id||!s.id)return{resolved:null,reason:"invalid-host"};const a=t.find(e=>e.id===s.id);if(!a)return{resolved:null,reason:"missing-partition"};if(!Vu(a.a)||!Vu(a.b)||!Number.isFinite(s.t)||s.t<0||s.t>1)return{resolved:null,reason:"invalid-position"};const l=a.b[0]-a.a[0],c=a.b[1]-a.a[1],h=Math.hypot(l,c),d=Number(e.length)*i;if(!(h>1e-9&&d>0&&Number.isFinite(d)))return{resolved:null,reason:"invalid-length"};const u=s.t*h;if(u-d/2h-o+1e-9)return{resolved:null,reason:"does-not-fit"};const p=l/h,_=c/h;let m=180*Math.atan2(c,l)/Math.PI;return m>=90?m-=180:m<-90&&(m+=180),{reason:null,resolved:{opening:e,host:s,partition:a,center:[a.a[0]+l*s.t,a.a[1]+c*s.t],angle:m,length:d,depth:Ao(a.cm,n,r),t:s.t,axis:{a:[a.a[0],a.a[1]],b:[a.b[0],a.b[1]],ux:p,uy:_,length:h}}}}function Xu(e,t,i=1,n=5,r=5){return Yu(e,t,i,n,r,0)}function Zu(e,t,i=1,n=5,r=5){const o=e.host,s="partition"===o?.kind?t.find(e=>e.id===o.id):void 0;if(!s)return Xu(e,t,i,n,r);const a=Yu(e,t,i,n,r,Ku(s,n,r));return"does-not-fit"===a.reason?{resolved:null,reason:"does-not-fit-jamb"}:a}function Ju(e,t){return!e||(e.length!==t.length||e.host?.kind!==t.host?.kind||e.host?.id!==t.host?.id||e.host?.t!==t.host?.t)}function Qu(e){const{center:t,length:i,axis:n,host:r}=e,o=i/2;return{hostId:r.id,a:[t[0]-n.ux*o,t[1]-n.uy*o],b:[t[0]+n.ux*o,t[1]+n.uy*o],depth:e.depth}}function ep(e,t=!1){const i=t?1:-1,n=e.depth/2;return{ox:-e.axis.uy*i*n,oy:e.axis.ux*i*n,cm:e.partition.cm,side:i}}function tp(e,t,i){return e.flatMap(e=>!Vu(e.a)||!Vu(e.b)||Math.hypot(e.b[0]-e.a[0],e.b[1]-e.a[1])<=1e-9?[]:[{roomId:"",a:[e.a[0],e.a[1]],b:[e.b[0],e.b[1]],key:`partition:${e.id}`,kind:"outer",cm:e.cm,open:!1,half:Ao(e.cm,t,i)/2,partitionHost:{kind:"partition",id:e.id}}])}function ip(e,t,i){const{center:n,length:r,axis:o}=e,s=r/2,a=t.flatMap(e=>{if(!e.kind||e.open)return[];const t=e.b[0]-e.a[0],r=e.b[1]-e.a[1],a=Math.hypot(t,r);if(!(a>i))return[];const l=t/a,c=r/a;if(Math.abs(o.ux*c-o.uy*l)>1e-6)return[];if(Math.abs((n[0]-e.a[0])*c-(n[1]-e.a[1])*l)>i)return[];const h=e=>(e[0]-n[0])*o.ux+(e[1]-n[1])*o.uy,d=h(e.a),u=h(e.b),p=Math.max(-s,Math.min(d,u)),_=Math.min(s,Math.max(d,u));return _>=p-i?[[p,_]]:[]});if(!a.length)return!1;a.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let l=-s;for(const[e,t]of a){if(e>l+i)return!1;if(l=Math.max(l,t),l>=s-i)return!0}return!1}function np(e,t,i=1e-9){const n=e.length/(2*e.axis.length),r=e.t-n,o=e.t+n;return t.some(t=>{if(t.host.id!==e.host.id||t.opening.id===e.opening.id)return!1;const n=t.length/(2*t.axis.length);return Math.max(r,t.t-n)ha-icon{align-self:start;color:var(--hp-accent);}.version-recovery-copy{min-width:0;display:flex;flex-direction:column;gap:var(--sp-2);font-size:var(--fs-m);line-height:1.35;}.version-recovery-copy>span{color:var(--hp-muted);}.version-recovery-versions{display:flex;flex-wrap:wrap;gap:var(--sp-2) var(--sp-5);}.version-recovery-versions span,.version-recovery-versions b{overflow-wrap:anywhere;}.version-recovery-reload{min-height:44px;white-space:normal;}@keyframes hp-version-recovery-in{from{opacity:0;}to{opacity:1;}}@keyframes hp-version-recovery-out{from{opacity:1;}to{opacity:0;}}@media (max-width:520px){.version-recovery-card{grid-template-columns:auto minmax(0,1fr);}.version-recovery-reload{grid-column:1 / -1;width:100%;}}@keyframes fixedfloor-spin{to{transform:rotate(360deg);}}.spacer{flex:1;}.bootveil{position:absolute;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;background:var(--hp-bg,#16212e);opacity:1;transition:opacity 0.15s ease;pointer-events:none;}.bootveil.off{opacity:0;}.bootveil .boothouse{position:static;width:56px;height:56px;fill:var(--hp-accent);opacity:0.85;animation:hp-boot-pulse 1.3s ease-in-out infinite;}@keyframes hp-boot-pulse{0%,100%{opacity:0.3;transform:scale(0.94);}50%{opacity:0.9;transform:scale(1);}}@media (prefers-reduced-motion:reduce){.bootveil .boothouse{animation:none;opacity:0.7;}.version-recovery.phase-visible,.version-recovery.phase-leaving{animation:none;}}@keyframes hp-pulse-short{0%{transform:scale(1);opacity:0.55;}70%{opacity:0.22;}100%{transform:scale(var(--ripple-scale,1.5));opacity:0;}}@keyframes hp-pulse-short-b{0%{transform:scale(1);opacity:0.55;}70%{opacity:0.22;}100%{transform:scale(var(--ripple-scale,1.5));opacity:0;}}@keyframes hp-pulse-continuous{0%{transform:scale(1);opacity:0.55;}65%{opacity:0.18;}100%{transform:scale(var(--ripple-scale,1.5));opacity:0;}}@keyframes hp-pulse-alarm{0%{transform:scale(1);opacity:0.72;}100%{transform:scale(1.5);opacity:0;}}@keyframes hp-slide-left{0%{transform:translateX(4%);opacity:0.72;}100%{transform:translateX(0);opacity:1;}}@keyframes hp-slide-right{0%{transform:translateX(-4%);opacity:0.72;}100%{transform:translateX(0);opacity:1;}}@keyframes hp-sunfade-in{from{opacity:0;}to{opacity:1;}}@keyframes hp-sunfade-out{from{opacity:1;}to{opacity:0;}}.sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0,0,0,0) !important;white-space:nowrap !important;border:0 !important;}.toast{position:fixed;pointer-events:none;left:50%;bottom:22px;transform:translateX(-50%);background:var(--hp-bg);border:1px solid var(--hp-accent);color:var(--hp-txt);padding:var(--sp-4) var(--sp-6);border-radius:var(--rad-l);font-size:var(--fs-m);box-shadow:var(--shadow-2);z-index:120;max-width:90vw;}`,o`.fixedfloor-loading{animation:fixedfloor-spin 1.1s linear infinite;}.fixedfloor-error p{max-width:42rem;margin:0;overflow-wrap:anywhere;}@media (prefers-reduced-motion:reduce){.fixedfloor-loading{animation:none;}.radar-target{transition:none;}}.stage.noplan{background:#ffffff;}.stage.mode-plan,.stage.mode-devices,.stage.mode-decor{background:#ffffff;}.stage{position:relative;width:100%;container-type:inline-size;overflow:hidden;touch-action:none;background:var(--ha-card-background,var(--card-background-color,#111));}.zoomwrap{position:absolute;inset:0;z-index:1;}.stage.mode-transition,.stage.mode-transition .zoomwrap{transition:none !important;}.stage.mode-transition .hp-view-only-layer,.stage.mode-transition .hp-editor-only-layer{pointer-events:none;will-change:opacity;}.stage.mode-transition .hp-paper{fill:var(--hp-mode-paper) !important;}.hp-day-cycle-env{position:absolute;inset:0;z-index:0;overflow:hidden;pointer-events:none;isolation:isolate;}.hp-day-cycle-bg{position:absolute;inset:0;opacity:0;overflow:hidden;transition:opacity 1100ms cubic-bezier(.22,.61,.36,1);}.hp-day-cycle-bg.active{opacity:1;}.hp-day-cycle-sun{position:absolute;left:var(--hp-day-cycle-sun-x);top:var(--hp-day-cycle-sun-y);width:clamp(140px,25cqw,250px);height:clamp(140px,25cqw,250px);transform:translate(-50%,-50%);border-radius:50%;filter:blur(10px);opacity:var(--hp-day-cycle-sun-opacity);transition:left 1100ms cubic-bezier(.22,.61,.36,1),top 1100ms cubic-bezier(.22,.61,.36,1),opacity 1100ms cubic-bezier(.22,.61,.36,1);}.stage.mode-transition .hp-day-cycle-env{transition:none;}.stage.daycycle .hp-paperg,.hp-static-stage.daycycle .hp-paperg{filter:drop-shadow(0 0 1px var(--hp-day-cycle-outline-near)) drop-shadow(0 0 5px var(--hp-day-cycle-outline-mid)) drop-shadow(0 0 10px var(--hp-day-cycle-outline-far));will-change:filter;transition:filter 1100ms cubic-bezier(.22,.61,.36,1);}@media (prefers-reduced-motion:reduce){.hp-day-cycle-bg,.hp-day-cycle-sun,.stage.daycycle .hp-paperg,.hp-static-stage.daycycle .hp-paperg{transition:none;}}.sunlayer{pointer-events:none;}.compass{width:120px;height:120px;flex:none;touch-action:none;cursor:grab;user-select:none;}.compass:active{cursor:grabbing;}.compass .cring{fill:rgba(255,255,255,0.04);stroke:var(--divider-color,#444);stroke-width:2;}.compass .ctick{stroke:var(--secondary-text-color,#9aa4ad);stroke-width:2;}.compass .ctick.minor{stroke-width:1;opacity:0.6;}.compass .cneedle line{stroke:var(--primary-color,#3ea6ff);stroke-width:2.5;stroke-linecap:round;}.compass .cneedle path{fill:var(--primary-color,#3ea6ff);}.compass .cneedle text{fill:var(--text-primary-color,#fff);font-size:11px;font-weight:700;}.compass .cdeg{fill:var(--secondary-text-color,#9aa4ad);font-size:13px;}.compass.unset .cneedle{opacity:0.35;}.stage.hpboot .zoomwrap,.stage.hpboot .zoombadge{visibility:hidden;}.stage.hpsettle{transition:height 0.25s ease;}@media (prefers-reduced-motion:reduce){.stage.hpsettle{transition:none;}}.zoomctl{display:inline-flex;gap:var(--sp-1);background:rgba(127,127,127,0.12);border-radius:var(--rad-m);padding:var(--sp-1);}.zoomctl .zb{border:none;padding:var(--sp-3) var(--sp-4);}.zoomctl .zb[disabled]{opacity:0.4;pointer-events:none;}.projection-toggle{min-width:44px;min-height:44px;justify-content:center;padding:var(--sp-3);}.header-action{min-width:44px;min-height:44px;justify-content:center;padding:var(--sp-3);}.homearrow{position:absolute;z-index:12;transform:translate(-50%,-50%);width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;background:var(--card-background-color,var(--hp-bg));color:var(--hp-accent);border:1px solid var(--hp-accent);opacity:0.9;padding:0;}.homearrow ha-icon{--mdc-icon-size:22px;line-height:1;}.zoombadge{position:absolute;z-index:12;left:var(--sp-4);bottom:var(--sp-4);background:var(--card-background-color,var(--hp-bg));opacity:0.92;color:var(--hp-txt);border:1px solid var(--hp-accent);border-radius:var(--rad-m);padding:var(--sp-1) var(--sp-4);font-size:var(--fs-s);font-weight:600;pointer-events:none;}.zoomwrap>svg{position:absolute;inset:0;width:100%;height:100%;display:block;}.plan-svg{z-index:1;}.iso-underlay-svg{z-index:0;overflow:visible;}.iso-shadows-svg{z-index:3;overflow:visible;}.iso-walls-svg{z-index:4;overflow:visible;}.iso-overlays-svg{z-index:5;overflow:visible;}.iso-underlay-svg,.iso-shadows-svg,.iso-walls-svg,.iso-overlays-svg,.iso-underlay,.iso-shadows,.iso-walls,.iso-openings{pointer-events:none;}.iso-side-hi{stop-color:#b9bdbe;}.iso-side-lo{stop-color:#969c9f;}.iso-top-hi{stop-color:#fafaf7;}.iso-top-lo{stop-color:#e2e4e2;}.iso-wall-side{fill:url(#hp-iso-wall-side) #a8acae;stroke:#92989b;stroke-width:0.7;vector-effect:non-scaling-stroke;}.iso-wall-top{fill:url(#hp-iso-wall-top) #f3f3f1;stroke:#d7d9d8;stroke-width:0.8;vector-effect:non-scaling-stroke;}.iso-material-texture{fill:url(#hp-iso-wall-texture);stroke:none;opacity:0.12;pointer-events:none;}.iso-floor-texture{fill:url(#hp-iso-floor-texture);opacity:0.1;}.iso-texture-mark{fill:rgba(36,43,47,0.34);}.iso-texture-line{fill:none;stroke:rgba(36,43,47,0.24);stroke-width:0.55;}.iso-floor-side{fill:#858b8d;stroke:#71787b;stroke-width:0.7;vector-effect:non-scaling-stroke;}.iso-opening-panel{fill:#d7d9d7;fill-opacity:0.96;stroke:#7f878b;stroke-width:0.9;vector-effect:non-scaling-stroke;}.iso-opening-panel.iso-window{fill:#dfeff4;fill-opacity:0.72;stroke:#8aa7b1;}.iso-opening-panel.iso-material-reveal{fill:#c7cbca;stroke:#8b9294;}.iso-opening-panel.iso-material-matte-leaf{fill:#a6abad;stroke:#737b7f;}.iso-opening-panel.iso-opening-leaf-edge,.iso-opening-panel.iso-opening-leaf-top{fill:#8d9497;}.iso-opening-panel.iso-material-light-frame,.iso-opening-panel.iso-material-light-sill{fill:#fffef8;fill-opacity:0.94;stroke:#b3b5ae;}.iso-opening-panel.iso-material-light-window,.iso-opening-panel.iso-material-glass-side{fill:#c9e4f3;fill-opacity:0.88;stroke:#8fb4c7;}.iso-opening-panel.iso-material-glass-top{fill:#e3f2fa;fill-opacity:0.96;stroke:#9fc4d5;}.iso-ambient-shadow{fill:rgba(15,21,25,0.22);filter:url(#hp-iso-ambient-shadow);}.iso-contact-shadow{fill:none;stroke:rgba(22,28,31,0.25);stroke-width:3;filter:url(#hp-iso-contact-shadow);vector-effect:non-scaling-stroke;}.iso-leaf-shadow{fill:none;stroke:rgba(18,23,27,0.24);stroke-width:4;filter:url(#hp-iso-leaf-shadow);vector-effect:non-scaling-stroke;}.stage.theme-dark .iso-side-hi{stop-color:#4c555a;}.stage.theme-dark .iso-side-lo{stop-color:#343c40;}.stage.theme-dark .iso-top-hi{stop-color:#687176;}.stage.theme-dark .iso-top-lo{stop-color:#50585d;}.stage.theme-dark .iso-wall-side{stroke:#30373b;}.stage.theme-dark .iso-wall-top{stroke:#7b858a;}.stage.theme-dark .iso-floor-side{fill:#2d3438;stroke:#20272a;}.stage.theme-dark .iso-opening-panel{fill:#626b70;stroke:#899399;}.stage.theme-dark .iso-opening-panel.iso-window{fill:#75919b;stroke:#abc6ce;}.stage.theme-dark .iso-opening-panel.iso-material-reveal{fill:#454e52;stroke:#727d82;}.stage.theme-dark .iso-opening-panel.iso-material-matte-leaf{fill:#626a6e;stroke:#899398;}.stage.theme-dark .iso-opening-panel.iso-opening-leaf-edge,.stage.theme-dark .iso-opening-panel.iso-opening-leaf-top{fill:#4b5458;}.stage.theme-dark .iso-opening-panel.iso-material-light-frame,.stage.theme-dark .iso-opening-panel.iso-material-light-sill{fill:#e8e7df;stroke:#a9aca7;}.stage.theme-dark .iso-opening-panel.iso-material-light-window,.stage.theme-dark .iso-opening-panel.iso-material-glass-side{fill:#8fbfd5;stroke:#bad9e6;}.stage.theme-dark .iso-opening-panel.iso-material-glass-top{fill:#c9e6f2;stroke:#d9eef6;}.stage.theme-dark .iso-ambient-shadow{fill:rgba(0,0,0,0.34);}.stage.theme-dark .iso-contact-shadow,.stage.theme-dark .iso-leaf-shadow{stroke:rgba(0,0,0,0.38);}.stage.theme-dark .iso-texture-mark{fill:rgba(255,255,255,0.24);}.stage.theme-dark .iso-texture-line{stroke:rgba(255,255,255,0.18);}@media (prefers-color-scheme:dark){.stage:not(.theme-light) .iso-side-hi{stop-color:#4c555a;}.stage:not(.theme-light) .iso-side-lo{stop-color:#343c40;}.stage:not(.theme-light) .iso-top-hi{stop-color:#687176;}.stage:not(.theme-light) .iso-top-lo{stop-color:#50585d;}.stage:not(.theme-light) .iso-wall-side{stroke:#30373b;}.stage:not(.theme-light) .iso-wall-top{stroke:#7b858a;}.stage:not(.theme-light) .iso-floor-side{fill:#2d3438;stroke:#20272a;}.stage:not(.theme-light) .iso-opening-panel{fill:#626b70;stroke:#899399;}.stage:not(.theme-light) .iso-opening-panel.iso-window{fill:#75919b;stroke:#abc6ce;}.stage:not(.theme-light) .iso-opening-panel.iso-material-reveal{fill:#454e52;stroke:#727d82;}.stage:not(.theme-light) .iso-opening-panel.iso-material-matte-leaf{fill:#626a6e;stroke:#899398;}.stage:not(.theme-light) .iso-opening-panel.iso-opening-leaf-edge,.stage:not(.theme-light) .iso-opening-panel.iso-opening-leaf-top{fill:#4b5458;}.stage:not(.theme-light) .iso-opening-panel.iso-material-light-frame,.stage:not(.theme-light) .iso-opening-panel.iso-material-light-sill{fill:#e8e7df;stroke:#a9aca7;}.stage:not(.theme-light) .iso-opening-panel.iso-material-light-window,.stage:not(.theme-light) .iso-opening-panel.iso-material-glass-side{fill:#8fbfd5;stroke:#bad9e6;}.stage:not(.theme-light) .iso-opening-panel.iso-material-glass-top{fill:#c9e6f2;stroke:#d9eef6;}.stage:not(.theme-light) .iso-ambient-shadow{fill:rgba(0,0,0,0.34);}.stage:not(.theme-light) .iso-contact-shadow,.stage:not(.theme-light) .iso-leaf-shadow{stroke:rgba(0,0,0,0.38);}.stage:not(.theme-light) .iso-texture-mark{fill:rgba(255,255,255,0.24);}.stage:not(.theme-light) .iso-texture-line{stroke:rgba(255,255,255,0.18);}}@media (forced-colors:active){.iso-wall-side,.iso-wall-top,.iso-floor-side,.iso-opening-panel{fill:Canvas;stroke:CanvasText;forced-color-adjust:auto;}.iso-ambient-shadow,.iso-contact-shadow,.iso-leaf-shadow,.iso-material-texture{display:none;}}@supports not (filter:blur(1px)){.iso-ambient-shadow,.iso-contact-shadow,.iso-leaf-shadow,.iso-material-texture{display:none;}}.hp-paper{fill:var(--ha-card-background,var(--card-background-color,#111));stroke:none;}.stage.noplan .hp-paper,.stage.mode-plan .hp-paper,.stage.mode-devices .hp-paper,.stage.mode-decor .hp-paper{fill:#ffffff;}.room{transition:0.12s;cursor:default;stroke-linejoin:round;stroke-linecap:round;}.stage.mode-view .room{cursor:pointer;}.room.overlay{fill:transparent;stroke:transparent;stroke-width:calc(2px * var(--hp-cell-visual-scale,1));}:host([data-pointer-hover]) .stage.mode-view .room.overlay:not(.styled):hover{stroke:var(--hp-accent);stroke-opacity:1;}.room.yard{fill:rgba(75,140,90,0.14);stroke:#4b8c5a;stroke-width:calc(2px * var(--hp-cell-visual-scale,1));}:host([data-pointer-hover]) .stage.mode-view .room.yard:not(.styled):hover{stroke:var(--hp-accent);stroke-opacity:1;}.room.styled{stroke:var(--room-stroke,transparent);stroke-opacity:var(--room-stroke-op,0);stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));fill:var(--room-fill,transparent);fill-opacity:var(--room-fill-op,0);}.glow-base-layer,.glow-base-tunnels,.glow-pools-frame,.glow-pools,.glow-spot{pointer-events:none;}.glow-pools-frame,.glow-pools,.glow-spot{isolation:isolate;}.glow-pools.blend-screen .glow-spot{mix-blend-mode:screen;}.glow-spot{opacity:1;transition:opacity 500ms ease;}.glow-spot.is-entering,.glow-spot.is-leaving{opacity:0;}@media (prefers-reduced-motion:reduce){.glow-spot{transition:none;}}:host([data-pointer-hover]) .stage.mode-view .room.styled:hover{stroke:var(--hp-accent);stroke-opacity:1;}.op-leaf{transition:transform 0.6s ease;}.op-arc{stroke-width:calc(1.5px * var(--hp-cell-visual-scale,1));transition:stroke-dashoffset 0.6s ease;}.op-outline{fill:none;stroke:var(--hp-accent);stroke-width:calc(1.5px * var(--hp-cell-visual-scale,1));opacity:0;transition:opacity 0.15s;pointer-events:none;}:host([data-pointer-hover]) .stage.markup g.opening:hover .op-outline{opacity:0.9;}.op-hit{fill:transparent;pointer-events:none;cursor:default;}.stage.markup .op-hit{pointer-events:auto;cursor:grab;touch-action:none;}.stage.markup .op-hit:active{cursor:grabbing;}.stage.markup .opening.orphan{pointer-events:auto;cursor:pointer;color:var(--error-color,#db4437);}.stage.markup .opening.orphan circle{fill:var(--hp-bg);stroke:currentColor;stroke-width:calc(2px * var(--hp-cell-visual-scale,1));}.stage.markup .opening.orphan text{fill:currentColor;font-weight:800;font-size:calc(12px * var(--hp-cell-visual-scale,1));pointer-events:none;}.stage.markup.tool-resize .op-hit{pointer-events:none;cursor:default;}.stage.mode-view .oplock{pointer-events:auto;cursor:pointer;}.stage.projection-iso.mode-view .oplock::before{content:'';position:absolute;left:50%;top:50%;width:max(44px,100%);height:max(44px,100%);transform:translate(-50%,-50%);border-radius:50%;pointer-events:auto;}@media (prefers-reduced-motion:reduce){.op-leaf,.op-arc{transition:none;}}.roomlabel{pointer-events:none;position:absolute;transform:translate(-50%,-50%);font-size:calc(var(--rl-icon-size,var(--icon-size,2.5cqw)) * 0.5 * var(--rl-scale,1) * var(--rl-font,1) * var(--rl-space,1));font-weight:700;letter-spacing:0.04em;white-space:nowrap;cursor:grab;user-select:none;z-index:1;display:flex;flex-direction:column;align-items:center;gap:0.15em;text-align:center;}.rlname{display:inline-flex;align-items:center;gap:0.25em;font-size:calc(1em * var(--rl-name,1));}.zoomwrap.slide-left{animation:hp-slide-left 0.18s cubic-bezier(0.2,0.7,0.2,1);}.zoomwrap.slide-right{animation:hp-slide-right 0.18s cubic-bezier(0.2,0.7,0.2,1);}@media (prefers-reduced-motion:reduce){.zoomwrap.slide-left,.zoomwrap.slide-right{animation:none;}}.rlgearbtn{--gear-h:calc(var(--icon-size,2.5cqw) * 0.77);position:absolute;transform:translate(-50%,-50%);display:inline-flex;align-items:center;gap:0.35em;height:var(--gear-h);padding:0 calc(var(--gear-h) * 0.38);border:0;border-radius:999px;background:var(--hp-accent);color:var(--text-primary-color,#fff);font:inherit;font-size:calc(var(--gear-h) * 0.42);font-weight:600;line-height:1;white-space:nowrap;cursor:pointer;pointer-events:auto;opacity:0.92;box-shadow:var(--shadow-1);z-index:2;}.rlgearbtn{transition:opacity 0.15s,filter 0.15s;}:host([data-pointer-hover]) .rlgearbtn:hover{opacity:1;filter:brightness(1.18);}.rlgearbtn ha-icon{--mdc-icon-size:calc(var(--gear-h) * 0.55);display:inline-flex;}.rlgear{--mdc-icon-size:0.9em;display:inline-flex;margin-right:0.2em;opacity:0.6;cursor:pointer;pointer-events:auto;}:host([data-pointer-hover]) .rlgear:hover{opacity:1;}.rlgo{--mdc-icon-size:0.85em;display:inline-flex;opacity:0.55;}.stage.mode-view .rlgo{pointer-events:auto;cursor:pointer;}:host([data-pointer-hover]) .stage.mode-view .rlgo:hover{opacity:1;}.roomlabel .rlmetrics{position:absolute;top:calc(100% + 0.15em);left:50%;transform:translateX(-50%);white-space:nowrap;display:flex;align-items:center;gap:0.55em;font-size:calc(0.75em * var(--rl-meta,1));font-weight:600;letter-spacing:0.02em;opacity:0.9;}.roomlabel .rlm{display:inline-flex;align-items:center;gap:0.12em;}.roomlabel .rlm ha-icon{--mdc-icon-size:1.05em;display:inline-flex;}.roomlabel .rlm.lit{opacity:1;}.rlhandle{display:none;position:absolute;width:9px;height:9px;border-radius:2px;background:var(--hp-accent);border:1px solid var(--card-background-color,#fff);z-index:2;}.rlhandle.tl{left:-6px;top:-6px;cursor:nwse-resize;}.rlhandle.br{right:-6px;bottom:-6px;cursor:nwse-resize;}.rlhandle.tr{right:-6px;top:-6px;cursor:nesw-resize;}.rlhandle.bl{left:-6px;bottom:-6px;cursor:nesw-resize;}:host([data-pointer-hover]) .stage.markup .roomlabel:hover .rlhandle{display:block;}.stage.markup .roomlabel{pointer-events:auto;}.stage.mode-view .roomlabel{pointer-events:auto;cursor:pointer;border-radius:0.2em;}.stage.projection-iso.mode-view .roomlabel{box-sizing:border-box;min-width:44px;min-height:44px;justify-content:center;text-shadow:none;filter:none;-webkit-text-stroke:0 transparent;color:#303936 !important;}.stage.projection-iso.theme-dark.mode-view .roomlabel{color:#f2f0e8 !important;}@media (prefers-color-scheme:dark){.stage.projection-iso:not(.theme-light).mode-view .roomlabel{color:#f2f0e8 !important;}}.stage.mode-view .roomlabel:focus-visible{outline:2px solid var(--hp-accent);outline-offset:4px;}.roomlabel:active{cursor:grabbing;}.measurelayer{position:absolute;inset:0;pointer-events:none;}.alignline{stroke:var(--hp-accent);stroke-width:calc(1.2px * var(--hp-cell-visual-scale,1));stroke-dasharray:calc(4px * var(--hp-cell-visual-scale,1)) calc(4px * var(--hp-cell-visual-scale,1));pointer-events:none;opacity:0.9;}.aligndot{fill:var(--hp-accent);pointer-events:none;}.measurelabel.on45{color:#4bd28f;border-color:#4bd28f;}.measurelabel{position:absolute;transform:translate(12px,-150%);font-size:var(--fs-s);font-weight:600;padding:1px var(--sp-3);border-radius:var(--rad-s);background:rgba(0,0,0,0.72);color:#fff;white-space:nowrap;pointer-events:none;user-select:none;z-index:3;}.measurelabel.opdimension{transform:translate(calc(-50% + var(--op-label-shift-x,0px)),calc(-50% + var(--op-label-shift-y,-12px)));border:1px solid var(--hp-open,#ff9800);}.decorlayer .dshape{pointer-events:none;}.stage.mode-decor .decorlayer .dshape{pointer-events:visiblePainted;cursor:pointer;}.stage.mode-decor.dtool-select .decorlayer .dshape{cursor:move;}.stage.mode-decor.dtool-line .decorlayer .dshape,.stage.mode-decor.dtool-rect .decorlayer .dshape,.stage.mode-decor.dtool-ellipse .decorlayer .dshape,.stage.mode-decor.dtool-text .decorlayer .dshape,.stage.mode-decor.dtool-furniture .decorlayer .dshape,.stage.mode-decor.dtool-image .decorlayer .dshape,.stage.mode-decor.dtool-backdrop .decorlayer .dshape{pointer-events:none;}.stage.mode-decor.dtool-furniture,.stage.mode-decor.dtool-image{cursor:copy;}.stage.mode-decor.dtool-select .decorlayer .dimage,.stage.mode-decor.dtool-erase .decorlayer .dimage,.stage.mode-decor.dtool-select .decorlayer .dimage-missing,.stage.mode-decor.dtool-erase .decorlayer .dimage-missing{pointer-events:bounding-box;}.decorlayer .dimage-missing rect{fill:rgba(127,127,127,0.12);stroke:var(--hp-accent);stroke-dasharray:8 5;vector-effect:non-scaling-stroke;}.decorlayer .dimage-missing path{fill:none;stroke:var(--hp-accent);vector-effect:non-scaling-stroke;}.decorlayer .decor-image-placement-preview{opacity:0.65;}.stage.mode-decor.dtool-text .decorlayer .dshape.dtext,.stage.mode-decor.dtool-select .decorlayer .dshape.dtext,.stage.mode-decor.dtool-erase .decorlayer .dshape.dtext{pointer-events:visiblePainted;pointer-events:bounding-box;}.stage.mode-decor.dtool-text .decorlayer .dshape.dtext{cursor:text;}.decorlayer .derasehit{fill:none;stroke:transparent;stroke-width:16px;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;pointer-events:none;}.stage.mode-decor.dtool-erase .decorlayer .derasehit{pointer-events:stroke;}.decorlayer .dselecthit{fill:none;stroke:transparent;stroke-width:16px;stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:none;}.stage.mode-decor.dtool-select .decorlayer .dselecthit{pointer-events:stroke;cursor:move;}.stage.mode-decor .decorlayer .dshape.dfurniturehit{fill:none;stroke:transparent;pointer-events:none;}.stage.mode-decor.dtool-select .decorlayer .dshape.dfurniturehit{pointer-events:stroke;cursor:move;}.decorlayer .dsel{filter:drop-shadow(0 0 3px var(--hp-accent));}.decorlayer .ddraft{stroke-dasharray:calc(6px * var(--hp-cell-visual-scale,1)) calc(5px * var(--hp-cell-visual-scale,1));pointer-events:none;}.decorlayer .furniture-placement-preview{opacity:0.55;pointer-events:none;}.decorlayer text{font-weight:600;user-select:none;dominant-baseline:middle;text-anchor:middle;}.stage.mode-decor{outline:2px solid #26a69a;outline-offset:-2px;}.bdframe .bdbox{fill:none;stroke:var(--hp-accent);stroke-width:2;stroke-dasharray:10 7;vector-effect:non-scaling-stroke;pointer-events:none;opacity:0.9;}.bdframe .bdhandle{fill:transparent;stroke:none;pointer-events:all;touch-action:none;}.bdframe .bdknob{fill:var(--hp-accent);stroke:#fff;stroke-width:1;vector-effect:non-scaling-stroke;pointer-events:none;}:host([data-pointer-hover]) .bdframe .bdhandle:hover + .bdknob{fill:#fff;stroke:var(--hp-accent);}.bdframe .bd-nwse{cursor:nwse-resize;}.bdframe .bd-nesw{cursor:nesw-resize;}.stage.mode-decor.bdgrab{cursor:grab;}.stage.mode-decor.bdgrabbing,.stage.mode-decor.bdgrabbing .bdframe .bdhandle{cursor:grabbing;}.measurelabel.bdmeasure{transform:translate(-50%,-50%);border:1px solid var(--hp-accent);}.dtframe .dtbox{fill:none;stroke:var(--hp-accent);stroke-width:1.5;stroke-dasharray:7 5;vector-effect:non-scaling-stroke;pointer-events:none;opacity:0.85;}.dtframe .dtstem,.bdframe .dtstem{stroke:var(--hp-accent);stroke-width:1.5;vector-effect:non-scaling-stroke;pointer-events:none;opacity:0.85;}.dtframe .dthandle{fill:transparent;stroke:none;pointer-events:all;touch-action:none;}.dtframe .dtknob{fill:var(--hp-accent);stroke:#fff;stroke-width:1;vector-effect:non-scaling-stroke;pointer-events:none;}:host([data-pointer-hover]) .dtframe .dthandle:hover + .dtknob{fill:#fff;stroke:var(--hp-accent);}.dtframe .dt-nwse{cursor:nwse-resize;}.dtframe .dt-nesw{cursor:nesw-resize;}.dtframe .dtrot{cursor:grab;}.dtframe .dt-ew{cursor:ew-resize;}.dtframe .dt-ns{cursor:ns-resize;}.dtfurnitureframe .dtrot{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M18.4 7.2A8 8 0 1 0 20 12' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='m15.5 3.8 3.2 3.5-4.6.8' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 12 12,grab;}.dtfurnitureframe .dtrot:active{cursor:grabbing;}.dtframe .dtendpoint{cursor:crosshair;}.bdframe .dtrot{cursor:grab;}.dtarea{resize:vertical;min-height:3.4em;font:inherit;line-height:1.35;}.stage.mode-decor.dtool-line,.stage.mode-decor.dtool-rect,.stage.mode-decor.dtool-ellipse,.stage.mode-decor.dtool-text{cursor:crosshair;}.stage.mode-decor.dtool-erase,.stage.mode-decor.dtool-erase .decorlayer .dshape{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cg transform='rotate(-45 12 12)'%3E%3Crect x='7' y='2' width='10' height='18' rx='2' fill='%23fff' stroke='%23111' stroke-width='1.5'/%3E%3Cpath d='M7 13h10v5a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2z' fill='%23ff9f43' stroke='%23111' stroke-width='1.5'/%3E%3C/g%3E%3C/svg%3E") 5 22,pointer;}.stage.mode-decor .room{pointer-events:none;}.stage.mode-decor .devlayer,.stage.mode-decor .devlayer *,.stage.mode-decor .dev::before{pointer-events:none;}.stage .room,.stage .devlayer,.stage .opening,.stage .room-outline,.stage .wallbodies,.stage .opening-tunnels,.stage .glow-base-layer,.stage .glow-pools-frame,.stage .zero-walls{opacity:var(--hp-mode-architecture-opacity,1);}.opening-preview{opacity:0.5;pointer-events:none;}.opening-preview[data-kind="passage"]{opacity:1;}.passage-preview-cut{fill:var(--wall-fill,#ffffff);fill-opacity:0.35;stroke:none;pointer-events:none;}.passage-preview-boundary{stroke:var(--hp-open,#ff9800);stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));pointer-events:none;}.opening-preview .op-leaf,.opening-preview .op-arc{transition:none;}.opening-preview-dot{fill:var(--hp-open,#ff9800);pointer-events:none;}.opening-dimensions,.opening-dimension{pointer-events:none;}.opening-dimension-line,.opening-dimension-tick{fill:none;stroke:var(--hp-open,#ff9800);stroke-width:1.5;vector-effect:non-scaling-stroke;pointer-events:none;}.opening-dimension-tick{stroke-width:2;}.stage.edit .room{pointer-events:none;}.stage.markup{cursor:crosshair;}.stage.markup.tool-merge,.stage.markup.tool-split.pickstage,.stage.markup.tool-delroom{cursor:pointer;}.stage.markup.tool-wallthick{cursor:default;}.stage.markup.tool-wallthick.wallhot{cursor:pointer;}.wallbody-fill{fill:var(--wall-fill,#ffffff);fill-opacity:var(--wall-fill-op,1);fill-rule:evenodd;stroke:none;pointer-events:none;}.wallbody{fill:url(#hp-wall-hatch);fill-rule:evenodd;stroke:var(--room-stroke,var(--hp-muted));stroke-width:calc(0.6px * var(--hp-cell-visual-scale,1));pointer-events:none;}.wallbody.solid{fill:none;}.wallthick-hover{fill:var(--accent-color,#03a9f4);fill-opacity:0.38;stroke:var(--accent-color,#03a9f4);stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));stroke-linejoin:round;stroke-linecap:round;pointer-events:none;}.wallthick-hover.isopen{fill:var(--error-color,#f44336);stroke:var(--error-color,#f44336);}.zero-wall{stroke:var(--zero-wall-stroke,var(--hp-muted));stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));stroke-dasharray:calc(7px * var(--hp-cell-visual-scale,1)) calc(7px * var(--hp-cell-visual-scale,1));stroke-linecap:butt;pointer-events:none;opacity:0.9;}.zero-walls.solid .zero-wall{stroke-dasharray:none;}.room.noedge{stroke-opacity:0 !important;}.room-outline{fill:none;stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));stroke-linejoin:round;stroke-linecap:round;pointer-events:none;}.room-outline.outlined{stroke:rgba(62,166,255,0.55);stroke-opacity:1;}.room-hover-fill{fill:#000;fill-opacity:0.22;pointer-events:none;}.room-hover-halo{fill:none;stroke:var(--hp-accent);stroke-opacity:0.28;stroke-width:calc(8px * var(--hp-cell-visual-scale,1));stroke-linejoin:round;stroke-linecap:round;pointer-events:none;}.room-hover-outline{fill:none;stroke:var(--hp-accent);stroke-width:calc(3px * var(--hp-cell-visual-scale,1));stroke-linejoin:round;stroke-linecap:round;pointer-events:none;}.stage.markup .room{pointer-events:none;}.stage.markup .devlayer .dev{display:none;}.stage.mode-plan{outline:2px solid #ffc14d;outline-offset:-2px;}.stage.mode-devices{outline:2px solid var(--hp-accent);outline-offset:-2px;}.room.outlined{stroke:rgba(62,166,255,0.55);fill:rgba(62,166,255,0.06);}.room.picked{stroke:#ffc14d;stroke-width:calc(3px * var(--hp-cell-visual-scale,1));fill:rgba(255,193,77,0.25);}.griddot{fill:var(--hp-accent);opacity:0.35;stroke:rgba(0,0,0,0.35);stroke-width:0.4;}.griddot.major{opacity:0.5;stroke-width:0;}.seg{stroke:var(--hp-accent);stroke-width:calc(2.5px * var(--hp-cell-visual-scale,1));stroke-linecap:round;stroke-linejoin:round;}.pathline{stroke:#ffc14d;stroke-width:calc(3px * var(--hp-cell-visual-scale,1));fill:none;stroke-linecap:round;stroke-linejoin:round;}.preview{stroke:#ffc14d;stroke-width:calc(2px * var(--hp-cell-visual-scale,1));stroke-dasharray:calc(6px * var(--hp-cell-visual-scale,1)) calc(5px * var(--hp-cell-visual-scale,1));opacity:0.7;}.active-axis{stroke:#ffc14d;stroke-width:2;stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:none;}.active-vertex{fill:#ffc14d;stroke:#171006;stroke-width:2;vector-effect:non-scaling-stroke;pointer-events:none;}.wall-repair-preview{stroke:#d93025;stroke-width:4;stroke-linecap:round;stroke-dasharray:5 4;vector-effect:non-scaling-stroke;pointer-events:none;}.drawwall-preview-fill{fill:var(--wall-fill,#ffffff);fill-opacity:calc(var(--wall-fill-op,1) * 0.55);fill-rule:evenodd;stroke:none;pointer-events:none;}.drawwall-preview{fill:url(#hp-wall-hatch);fill-opacity:0.55;fill-rule:evenodd;stroke:var(--accent-color,#03a9f4);stroke-width:calc(0.5px * var(--hp-cell-visual-scale,1));stroke-opacity:0.7;pointer-events:none;}.drawwall-zero-preview{fill:none;stroke:var(--accent-color,#03a9f4);stroke-width:calc(3px * var(--hp-cell-visual-scale,1));stroke-linecap:butt;stroke-linejoin:round;opacity:0.72;pointer-events:none;}.drawwall-zero-preview.dashed{stroke-dasharray:calc(7px * var(--hp-cell-visual-scale,1)) calc(7px * var(--hp-cell-visual-scale,1));}.vertex{fill:#ffc14d;stroke:#4a2800;stroke-width:calc(1px * var(--hp-cell-visual-scale,1));}.vertex.first{fill:#4bd28f;stroke:#04121f;}.plan-snap-overlay,.plan-snap-overlay *,.hidden-wall-diagnostic,.hidden-wall-diagnostic *{pointer-events:none;}.plan-snap-line,.hidden-wall-line{fill:none;stroke:color-mix(in srgb,var(--hp-accent) 82%,white 18%);stroke-width:1;stroke-linecap:round;opacity:0.92;}.plan-snap-node,.hidden-wall-node{fill:var(--ha-card-background,var(--card-background-color,#fff));stroke:color-mix(in srgb,var(--hp-accent) 88%,#07131c 12%);stroke-width:1;vector-effect:non-scaling-stroke;}.plan-snap-node.active{fill:#ffc14d;stroke:#171006;stroke-width:2;}.plan-snap-node.active.dynamic{fill:#4bd28f;stroke:#04121f;}.plan-snap-node.conflict{fill:#fff;stroke:#d93025;stroke-width:3;}@media (prefers-color-scheme:dark){.plan-snap-line{stroke:color-mix(in srgb,var(--hp-accent) 72%,white 28%);}.hidden-wall-line{stroke:color-mix(in srgb,var(--hp-accent) 72%,white 28%);}.plan-snap-node,.hidden-wall-node{fill:#17242c;stroke:#9bdcf5;}.plan-snap-node.active{fill:#ffc14d;stroke:#fff4d6;}.plan-snap-node.active.dynamic{fill:#4bd28f;stroke:#eafff4;}}@media (forced-colors:active){.plan-snap-line,.hidden-wall-line{stroke:CanvasText;opacity:1;forced-color-adjust:auto;}.plan-snap-node,.hidden-wall-node{fill:Canvas;stroke:CanvasText;forced-color-adjust:auto;}.plan-snap-node.active,.plan-snap-node.active.dynamic{fill:Highlight;stroke:HighlightText;forced-color-adjust:auto;}}.sunlayer{animation:hp-sunfade-in 2s linear both;}.sunlayer.out{animation:hp-sunfade-out 2s linear both;}@media (prefers-reduced-motion:reduce){.sunlayer,.sunlayer.out{animation:none;}.sunlayer.out{opacity:0;}}.devlayer{position:absolute;inset:0;pointer-events:none;z-index:6;}.radar-target{position:absolute;width:8px;height:8px;box-sizing:border-box;transform:translate(-50%,-50%);border-radius:50%;background:var(--success-color,#43a047);border:2px solid var(--primary-text-color,#1f1f1f);box-shadow:0 0 0 1px color-mix(in srgb,var(--card-background-color,#fff) 80%,transparent);pointer-events:none;z-index:0;}.radar-target.smooth{transition:left 200ms linear,top 200ms linear;}.radar-ranges{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;z-index:0;}.radar-ranges path,.radar-ranges polyline{fill:none;stroke:var(--success-color,#43a047);stroke-width:2px;stroke-dasharray:5 4;vector-effect:non-scaling-stroke;opacity:0.72;}.radar-ranges .radar-zone{fill:color-mix(in srgb,var(--success-color,#43a047) 8%,transparent);stroke:var(--success-color,#43a047);stroke-width:2px;vector-effect:non-scaling-stroke;opacity:0.8;}.stage.mode-devices .dev{cursor:grab;}.stage.mode-devices .dev:active{cursor:grabbing;}.physical-hit{fill:transparent;stroke:transparent;pointer-events:none;cursor:grab;}.stage.tool-select .physical-hit{pointer-events:all;}.physical-hit:active{cursor:grabbing;}line.physical-hit{cursor:pointer;}.physical-hit.selected{fill:rgba(255,193,77,0.24);stroke:transparent;}line.physical-hit.selected{stroke:transparent;}.physical-drag{fill:rgba(255,193,77,0.38);stroke:#ffc14d;stroke-width:2.5;vector-effect:non-scaling-stroke;pointer-events:none;}.physical-chrome{pointer-events:none;}.physical-chrome .frame,.physical-chrome .stem{fill:none;stroke:#ffc14d;stroke-width:2;vector-effect:non-scaling-stroke;}.physical-chrome .frame{fill:rgba(255,193,77,0.22);}.physical-chrome polyline.frame{fill:none;}.physical-chrome .move-dot{fill:#ffc14d;stroke:#24262d;stroke-width:1.5;vector-effect:non-scaling-stroke;}.physical-chrome .rotate-handle{fill:#24262d;stroke:#ffc14d;stroke-width:2.5;vector-effect:non-scaling-stroke;pointer-events:all;cursor:crosshair;}.drawwall.invalid input{border-color:var(--error-color,#db4437);}.drawwall .rangehint{margin-inline-start:4px;font-size:0.78em;opacity:0.72;}.drawwall.invalid .rangehint{color:var(--error-color,#db4437);opacity:1;}.stage.markup.tool-partition,.stage.markup.tool-column{cursor:crosshair;}.rszhandle{fill:transparent;stroke:none;pointer-events:all;cursor:grab;touch-action:none;}.rszhandle:active{cursor:grabbing;}.rszhandle.disabled,.rszhandle.disabled:active{cursor:not-allowed;}.rszicon{pointer-events:none;}.rszicon path{fill:none;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;}.rszhalo{stroke:var(--hp-bg);stroke-width:6;}.rszink{stroke:var(--hp-accent);stroke-width:2;}:host([data-pointer-hover]) .rszhandle:hover + .rszicon .rszink{stroke-width:3;}.rszicon.disabled{opacity:0.38;}:host([data-pointer-hover]) .rszhandle.disabled:hover + .rszicon .rszink{stroke-width:2;}.rszmeasurelayer,.rszmeasurelayer *{pointer-events:none;}.rszmeasurehalo,.rszmeasureink,.rszleader{fill:none;stroke-linecap:round;vector-effect:non-scaling-stroke;}.rszmeasurehalo{stroke:var(--hp-bg);stroke-width:7px;opacity:0.9;}.rszmeasureink{stroke:var(--hp-accent);stroke-width:3px;}.rszleader{stroke:var(--hp-accent);stroke-width:2px;opacity:0.95;}.measurelabel.dmeasure{transform:translate(-50%,-160%);}.measurelabel.rszarea{transform:translate(calc(-50% + var(--rsz-label-x,0px)),calc(-50% + var(--rsz-label-y,0px)));background:rgba(0,0,0,0.6);border:1px solid var(--hp-accent);}.measurelabel.furnmeasure{transform:translate(-50%,-50%);border:1px solid var(--hp-accent);}.alignmsg{margin:0 0 8px;font-size:13px;line-height:1.45;}`,o`.dev ha-icon{position:relative;z-index:1;}.device-pulse{position:absolute;left:50%;top:50%;width:var(--dev-size);height:var(--dev-size);transform:translate(-50%,-50%);pointer-events:none;z-index:0;}.device-pulse i{position:absolute;inset:0;border-radius:50%;border:2px solid var(--ripple-color,var(--hp-accent));opacity:0;}.device-pulse.short i{animation:hp-pulse-short 1.1s cubic-bezier(.22,.61,.36,1) 1 forwards;}.device-pulse.short i:nth-child(2){animation-delay:1.1s;}.device-pulse.short i:nth-child(3){animation-delay:2.2s;}.device-pulse.short.gen2 i{animation-name:hp-pulse-short-b;}.device-pulse.continuous i:nth-child(n + 2),.device-pulse.alarm i:nth-child(n + 3){display:none;}.device-pulse.continuous i:first-child{animation:hp-pulse-continuous 3.6s cubic-bezier(.45,.05,.55,.95) infinite;}.device-pulse.alarm i{border-width:3px;border-color:#F0410C;animation:hp-pulse-alarm 2.4s cubic-bezier(.22,.61,.36,1) infinite;}.device-pulse.alarm i:nth-child(2){animation-delay:1.2s;}.activity-dot{position:absolute;right:8%;bottom:8%;width:18%;height:18%;min-width:4px;min-height:4px;border-radius:50%;background:var(--ripple-color,var(--hp-accent));border:1px solid color-mix(in srgb,var(--hp-bg) 82%,transparent);pointer-events:none;z-index:3;}.kioskdots{position:absolute;left:50%;bottom:var(--sp-5);transform:translateX(-50%);display:flex;gap:var(--sp-4);z-index:5;pointer-events:none;}.kdot{width:9px;height:9px;border-radius:50%;background:var(--hp-muted);opacity:0.55;}.kdot.on{background:var(--hp-accent);opacity:1;}.dev.valonly{width:var(--dev-size,var(--icon-size,2.5cqw));}.dev.valonly .device-core{width:max-content;min-width:var(--dev-size,var(--icon-size,2.5cqw));padding-inline:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.16);border-radius:calc(var(--dev-size,var(--icon-size,2.5cqw)) / 2);}.dev .valtext{overflow:visible;font-size:calc(var(--dev-size,var(--icon-size,2.5cqw)) * var(--value-font-scale,.45));font-weight:600;white-space:nowrap;}@media (prefers-reduced-motion:reduce){.device-pulse{display:none;}}.dev .newdot{position:absolute;top:calc(var(--dev-size,var(--icon-size,2.5cqw)) * -0.12);right:calc(var(--dev-size,var(--icon-size,2.5cqw)) * -0.12);width:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.34);height:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.34);border-radius:50%;background:#f0301f;border:2px solid var(--card-background-color,var(--hp-bg));pointer-events:none;z-index:2;}.dev{position:absolute;--dev-size:calc(var(--device-base-size,2.25cqw) * var(--dev-scale,1));--device-shell-size:calc(var(--dev-size) * 1.26875);--device-shell-inset:calc(var(--dev-size) * 0.134375);--device-shell-stroke-ratio:0.01875;--device-shell-border-width:max(1px,calc(var(--dev-size) * var(--device-shell-stroke-ratio)));--device-core-bg:var(--card-background-color,#fff);--device-core-fg:var(--primary-text-color,#252525);--device-core-bg:light-dark(#fff,#252525);--device-core-fg:light-dark(#252525,#fff);--device-face-bg:var(--device-core-bg);--device-face-fg:var(--device-core-fg);--device-shell-base-stroke:light-dark(#BCBCBC,rgb(37 37 37 / 75%));--device-shell-stroke:var(--device-shell-base-stroke);--device-shell-shadow:0 calc(var(--dev-size) * .025) calc(var(--dev-size) * .05) rgb(37 40 45 / 12%),0 calc(var(--dev-size) * .1) calc(var(--dev-size) * .175) calc(var(--dev-size) * -.025) rgb(37 40 45 / 18%);--device-core-inset-shadow:0 0 0 0 transparent;--device-ring-color:transparent;--device-ring-width:0px;width:var(--dev-size);height:var(--dev-size);margin:calc(var(--dev-size) / -2) 0 0 calc(var(--dev-size) / -2);border:0;background:transparent;display:block;color:var(--device-core-fg);cursor:pointer;pointer-events:none;transition:opacity 0.2s;box-shadow:none;outline:none;z-index:auto;}.dev.theme-light{--device-core-bg:#fff;--device-core-fg:#000;--device-shell-base-stroke:#BCBCBC;--device-shell-stroke:var(--device-shell-base-stroke);--device-shell-shadow:0 calc(var(--dev-size) * .025) calc(var(--dev-size) * .05) rgb(37 40 45 / 12%),0 calc(var(--dev-size) * .1) calc(var(--dev-size) * .175) calc(var(--dev-size) * -.025) rgb(37 40 45 / 18%);--device-core-inset-shadow:0 0 0 0 transparent;}.dev.theme-dark{--device-core-bg:#252525;--device-core-fg:#fff;--device-shell-base-stroke:rgb(37 37 37 / 75%);--device-shell-stroke:var(--device-shell-base-stroke);--device-shell-shadow:0 calc(var(--dev-size) * .025) calc(var(--dev-size) * .0375) rgb(37 40 45 / 12%),0 calc(var(--dev-size) * .1) calc(var(--dev-size) * .175) calc(var(--dev-size) * -.025) rgb(37 40 45 / 18%);--device-core-inset-shadow:inset 0 calc(var(--dev-size) * 0.0125) calc(var(--dev-size) * 0.0125) rgb(255 255 255 / 70%);}.dev::before{content:'';position:absolute;left:50%;top:50%;width:max(44px,var(--device-shell-size));height:max(44px,var(--device-shell-size));transform:translate(-50%,-50%);border-radius:50%;pointer-events:auto;z-index:1;}.device-shell{position:absolute;box-sizing:border-box;display:flex;align-items:center;gap:calc(var(--dev-size) * 0.1);padding:0;min-width:var(--dev-size);min-height:var(--dev-size);border:0;background:transparent;box-shadow:none;transition:opacity .2s;pointer-events:none;z-index:2;}.device-shell-frame{position:absolute;z-index:0;box-sizing:border-box;inset:calc(var(--device-shell-inset) / -1);border:var(--device-shell-border-width) solid var(--device-shell-stroke);border-radius:9999px;background:transparent;box-shadow:var(--device-shell-shadow);transition:border-color .15s,opacity .2s;pointer-events:auto;backdrop-filter:none;}.device-shell:not(.with-values){left:0;top:0;}.device-shell:not(.with-values):not(.text-shell) .device-shell-frame{border-radius:50%;}.device-shell.with-values.pos-right{left:0;top:50%;transform:translateY(-50%);}.device-shell.with-values.pos-left{right:0;top:50%;transform:translateY(-50%);flex-direction:row-reverse;}.device-shell.with-values.pos-bottom{left:50%;top:0;transform:translateX(-50%);flex-direction:column;}.device-shell.with-values.pos-top{left:50%;bottom:0;transform:translateX(-50%);flex-direction:column-reverse;}.device-core{position:relative;z-index:1;box-sizing:border-box;flex:0 0 auto;width:var(--dev-size);height:var(--dev-size);display:flex;align-items:center;justify-content:center;border-radius:50%;background:var(--device-face-bg);color:var(--device-face-fg);box-shadow:var(--device-core-inset-shadow),0 0 0 var(--device-ring-width) var(--device-ring-color);line-height:0;transition:background .15s,color .15s,opacity .2s;pointer-events:none;}.device-sections{display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:calc(var(--dev-size) * .08);min-width:0;pointer-events:none;}.device-shell.pos-top .device-sections,.device-shell.pos-bottom .device-sections{flex-direction:row;}.dev ha-icon{--mdc-icon-size:calc(var(--dev-size,var(--device-base-size,2.25cqw)) * 0.55);display:flex;align-items:center;justify-content:center;line-height:0;}.dev.on{--device-face-bg:#F0A00C;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:#F0A00C;}.dev.theme-light.on{--device-face-fg:#fff;}.dev.theme-dark.on{--device-face-fg:#252525;--device-shell-stroke-ratio:.0375;}.dev.open{--device-face-bg:var(--hp-open);--device-face-fg:light-dark(#fff,#252525);}.dev.theme-light.open{--device-face-fg:#fff;}.dev.theme-dark.open{--device-face-fg:#252525;}.dev.lock-locked{--device-face-bg:#66D17A;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:#66D17A;}.dev.theme-light.lock-locked{--device-face-fg:#fff;}.dev.theme-dark.lock-locked{--device-face-fg:#252525;--device-shell-stroke-ratio:.025;}.dev.lock-unlocked{--device-face-bg:#F0410C;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:#F0410C;}.dev.theme-light.lock-unlocked{--device-face-fg:#fff;}.dev.theme-dark.lock-unlocked{--device-face-fg:#252525;--device-shell-stroke-ratio:.025;}:host([data-pointer-hover]) .dev:not(.unavail)[data-hp-device-hover]{--device-face-bg:#0C82F0;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:var(--device-shell-base-stroke);}:host([data-pointer-hover]) .dev.theme-light:not(.unavail)[data-hp-device-hover]{--device-face-fg:#fff;}:host([data-pointer-hover]) .dev.theme-dark:not(.unavail)[data-hp-device-hover]{--device-face-fg:#252525;}:host([data-pointer-hover]) .dev[data-hp-device-hover],.dev:focus-visible{z-index:5;}.dev[data-hp-zigbee-topology-endpoint]{z-index:8;}:host([data-pointer-hover]) .dev[data-hp-zigbee-topology-endpoint][data-hp-device-hover]{z-index:8;}.dev.unavail{opacity:0.35;--device-face-bg:#B5BAC1;--device-shell-stroke:var(--device-shell-base-stroke);}.dev.virtual .device-shell-frame{border-style:dashed;}.dev.ghost{opacity:0.6;color:var(--hp-accent);}.dev.ghost .device-shell-frame{border-style:dashed;border-color:var(--hp-accent);box-shadow:none;}.dev.ghost .device-core{background:rgba(62,166,255,0.22);background:color-mix(in srgb,var(--hp-accent) 30%,var(--card-background-color,#1c2530));color:var(--hp-accent);}.dev.ghost.ha-disabled{opacity:0.62;color:var(--secondary-text-color,#9aa0aa);}.dev.ghost.ha-disabled .device-shell-frame{border-color:var(--secondary-text-color,#9aa0aa);}.dev.ghost.ha-disabled .device-core{background:rgba(120,124,134,0.2);background:color-mix(in srgb,var(--secondary-text-color,#9aa0aa) 24%,var(--card-background-color,#1c2530));color:var(--secondary-text-color,#9aa0aa);}.dev .habadge{position:absolute;right:-18%;bottom:-18%;display:grid;place-items:center;width:46%;height:46%;min-width:12px;min-height:12px;border-radius:50%;background:var(--card-background-color,#242832);border:1px solid currentColor;}.dev .habadge ha-icon{width:72%;height:72%;}.dev.sel{--device-ring-color:#F0A00C;--device-ring-width:calc(var(--dev-size) * 0.0375);}.dev:focus-visible{--device-ring-color:#0C82F0;--device-ring-width:calc(var(--dev-size) * 0.0375);}.dev:not(.on):not(.open):not(.alarm):not(.lock-locked):not(.lock-unlocked):not(.unavail):focus-visible{--device-face-fg:#0C82F0;}.dev.alarm,:host([data-pointer-hover]) .dev.alarm[data-hp-device-hover],.dev.alarm:focus-visible{--device-face-bg:#F0410C;--device-face-fg:light-dark(#fff,#252525);--device-shell-stroke:#F0410C;}.dev.theme-light.alarm{--device-face-fg:#fff;}.dev.theme-dark.alarm{--device-face-fg:#252525;--device-shell-stroke-ratio:.025;}.dev .value-badge{position:relative;z-index:2;box-sizing:border-box;width:max-content;min-width:calc(var(--dev-size,var(--icon-size,2.5cqw)) * .7875);height:calc(var(--dev-size,var(--icon-size,2.5cqw)) * .7875);display:flex;align-items:center;justify-content:center;overflow:visible;background:var(--device-core-bg);border:0;border-radius:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.39375);padding:0 calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.14);font-size:calc(var(--dev-size,var(--icon-size,2.5cqw)) * var(--value-font-scale,.45));font-weight:600;line-height:1;color:var(--device-core-fg);white-space:nowrap;pointer-events:none;}.dev .value-badge.unavailable,.dev .value-badge.missing{opacity:0.66;}.dev .lqi{position:absolute;top:calc(50% + var(--device-shell-size) / 2 + var(--dev-size) * .05);left:50%;transform:translateX(-50%);margin-top:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.05);font-size:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.38);font-weight:600;line-height:1;text-shadow:0 0 3px rgba(0,0,0,0.9),0 0 2px rgba(0,0,0,0.9);white-space:nowrap;pointer-events:none;}.dev .lqi.below-value-badge{margin-top:calc(var(--dev-size,var(--icon-size,2.5cqw)) * 0.8875);}.temprange{display:inline-flex;align-items:center;gap:var(--sp-3);margin-left:auto;color:var(--hp-muted);font-size:var(--fs-s);}.vacwarn{position:absolute;top:-12%;right:-12%;width:calc(var(--device-base-size,2.25cqw) * 0.42);height:calc(var(--device-base-size,2.25cqw) * 0.42);border-radius:50%;display:flex;align-items:center;justify-content:center;background:light-dark(#fff,#252525);border:1px solid #E5A100;color:#E5A100;z-index:7;pointer-events:none;}.vacwarn ha-icon{--mdc-icon-size:calc(var(--device-base-size,2.25cqw) * 0.32);color:inherit;}.vacpuck{position:absolute;--puck-size:calc(var(--device-base-size,2.25cqw) * 0.8);width:var(--puck-size);height:var(--puck-size);border-radius:50%;transform:translate(-50%,-50%);--vac-core-bg:light-dark(#fff,#252525);--vac-core-fg:light-dark(#252525,#fff);background:var(--vac-core-bg);border:1px solid #BCBCBC;box-shadow:0 1px 2px rgb(37 40 45 / 12%),0 4px 8px -1.07px rgb(37 40 45 / 18%);color:var(--vac-core-fg);display:flex;align-items:center;justify-content:center;cursor:pointer;z-index:6;transition:left 1.2s linear,top 1.2s linear;animation:vacpulse 2.2s ease-out infinite;}.vacpuck.theme-light{--vac-core-bg:#fff;--vac-core-fg:#252525;}.vacpuck.theme-dark{--vac-core-bg:#252525;--vac-core-fg:#fff;}.vacpuck.jump{transition:none;}.vacpuck.stale{opacity:0.45;animation:none;}.vacpuck ha-icon{--mdc-icon-size:calc(var(--puck-size) * 0.68);color:var(--vac-core-fg);display:flex;align-items:center;justify-content:center;line-height:0;width:var(--mdc-icon-size);height:var(--mdc-icon-size);}@keyframes vacpulse{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--hp-accent) 45%,transparent);}70%{box-shadow:0 0 0 12px transparent;}100%{box-shadow:0 0 0 0 transparent;}}@media (prefers-reduced-motion:reduce){.vacpuck{animation:none;}}.vactrail{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:5;overflow:visible;}.vactrail polyline,.vactrail path{fill:none;stroke-linejoin:round;stroke-linecap:round;vector-effect:non-scaling-stroke;}.vactrail g.prev{opacity:0.4;}.vactrail .case{stroke:rgba(0,0,0,0.4);stroke-width:2.25;}.vactrail .core{stroke:rgba(255,255,255,0.82);stroke-width:0.9;}.devicepreview-empty{min-height:82px;margin:4px 0 14px;padding:var(--sp-4);display:flex;align-items:center;justify-content:center;gap:var(--sp-3);border:1px dashed var(--hp-line);border-radius:var(--rad-m);color:var(--hp-muted);text-align:center;}`,o`.hdr{position:sticky;top:var(--header-height,56px);z-index:20;background:var(--card-background-color,var(--hp-bg));border-radius:var(--ha-card-border-radius,12px) var(--ha-card-border-radius,12px) 0 0;}.tabs{display:flex;gap:var(--sp-2);background:rgba(127,127,127,0.12);padding:var(--sp-2);border-radius:var(--rad-l);flex-wrap:wrap;}.tab{border:0;background:transparent;color:var(--hp-muted);display:inline-flex;align-items:center;padding:var(--sp-3) var(--sp-5);border-radius:var(--rad-m);font-size:var(--fs-m);font-weight:600;cursor:pointer;transition:0.15s;font-family:inherit;}:host([data-pointer-hover]) .tab:hover{color:var(--hp-txt);}.tab.active{background:var(--hp-accent);color:var(--text-primary-color,#fff);}.farhint{position:absolute;left:50%;transform:translateX(-50%);bottom:var(--sp-4);z-index:12;display:flex;align-items:center;gap:var(--sp-2);max-width:calc(100% - var(--sp-8));background:var(--card-background-color,var(--hp-bg));opacity:0.94;color:var(--hp-txt);border:1px solid var(--divider-color,#33404d);border-radius:var(--rad-m);padding:var(--sp-1) var(--sp-3);font-size:var(--fs-s);}.farhint ha-icon{--mdc-icon-size:18px;color:var(--hp-warn,#e2a03f);flex:none;}.farhint span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.dropbtn{display:flex;align-items:center;gap:var(--sp-4);width:100%;text-align:left;border:1px solid var(--hp-muted);border-radius:var(--rad-m);background:transparent;color:var(--hp-txt);padding:var(--sp-4) 10px;cursor:pointer;font-family:inherit;font-size:var(--fs-m);margin-top:var(--sp-3);}.dropbtn .ref{color:var(--hp-muted);font-size:var(--fs-s);margin-left:auto;}.dropbtn ha-icon{--mdc-icon-size:18px;margin-left:var(--sp-2);}.dropbtn.open{border-color:var(--hp-accent);}.droppanel{border:1px solid var(--hp-accent);border-top:none;border-radius:0 0 var(--rad-m) var(--rad-m);padding:var(--sp-3);margin-top:-4px;}.hdr.kioskhide{display:none;}.decorbar .dcolor{width:30px;height:26px;padding:0;border:none;background:none;cursor:pointer;}.decorbar .dwidth{font-family:inherit;font-size:var(--fs-s);border-radius:var(--rad-s);background:var(--hp-bg2,transparent);color:var(--hp-txt);border:1px solid var(--hp-muted);padding:var(--sp-2) var(--sp-3);}.decorbar .bdhint{font-size:var(--fs-s);color:var(--hp-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.decorbar .dfill{display:inline-flex;align-items:center;gap:var(--sp-2);font-size:var(--fs-s);cursor:pointer;}.decorbar .dfill input[type="checkbox"]{width:16px;height:16px;flex:none;margin:0;padding:0;}.decorbar hp-color-opacity{flex:0 0 auto;}.modes{display:inline-flex;gap:var(--sp-1);background:rgba(127,127,127,0.12);border-radius:var(--rad-l);padding:var(--sp-2);}.modetab{display:inline-flex;align-items:center;gap:var(--sp-3);border:0;background:transparent;color:var(--hp-muted);padding:var(--sp-3) 10px;border-radius:var(--rad-m);font-size:var(--fs-m);font-weight:600;cursor:pointer;font-family:inherit;transition:background-color 0.14s ease,color 0.14s ease,transform 0.14s ease;}.modetab:active{transform:scale(0.97);}.modetab ha-icon{--mdc-icon-size:15px;}.tab[data-reorderable]{cursor:grab;}.tab.dragging{cursor:grabbing;opacity:0.55;}.tab.drop-before{box-shadow:inset 2px 0 0 0 var(--primary-color,#03a9f4);}.tab.drop-after{box-shadow:inset -2px 0 0 0 var(--primary-color,#03a9f4);}.modetab .closex{--mdc-icon-size:13px;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;min-width:24px;min-height:24px;margin:-5.5px -5.5px -5.5px -3.5px;opacity:0.75;cursor:pointer;border-radius:var(--rad-s);}:host([data-pointer-hover]) .modetab .closex:hover{opacity:1;}.editbar .barclose{box-sizing:border-box;width:40px;height:40px;padding:0;margin:0;min-width:40px;min-height:40px;justify-content:center;gap:0;line-height:0;}.editbar .barclose ha-icon{flex:none;margin:0;}.modetab.active{background:var(--hp-accent);color:var(--text-primary-color,#fff);}@media (max-width:720px){.modetab .ml{display:none;}}.editbar{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:stretch;border-bottom:1px solid var(--hp-line);font-size:var(--fs-m);}.editbar-tools{display:flex;align-items:center;gap:10px;padding:var(--sp-4) var(--sp-5);flex-wrap:wrap;min-width:0;outline:none;}.editbar-end{display:flex;align-items:center;padding:var(--sp-4) var(--sp-5);border-inline-start:1px solid var(--hp-line);background:var(--card-background-color,var(--hp-bg));position:relative;z-index:2;}.tab .tabedit{--mdc-icon-size:13px;display:inline-flex;align-items:center;margin-left:var(--sp-3);opacity:0.4;}:host([data-pointer-hover]) .tab:hover .tabedit{opacity:0.9;}.tab.tabadd{padding:var(--sp-3) var(--sp-4);}.tab.tabadd ha-icon{--mdc-icon-size:15px;}.rhint{font-size:var(--fs-s);color:var(--hp-muted);margin-bottom:var(--sp-3);}.togglehint{overflow-wrap:anywhere;}.togglehint>div + div{margin-top:var(--sp-1);}.editorchrome{display:block;height:0;opacity:0;visibility:hidden;overflow:hidden;}.editorchrome:not(.open){pointer-events:none;}.editorchrome.open{height:auto;opacity:1;visibility:visible;overflow:visible;}.editorchrome.transitioning{overflow:hidden;will-change:height;pointer-events:none;}.editorchrome.transitioning .barclose{pointer-events:auto;}.editorchrome-inner{min-height:0;transform-origin:top center;}.editorchrome.transitioning .editorchrome-inner{will-change:opacity;}@media (prefers-reduced-motion:reduce){.modetab{transition:none;}}.editbar .warn{color:#ffc14d;}.editbar .sname{font-weight:600;}.editbar input{width:74px;background:transparent;border:1px solid var(--hp-line);color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-m);}.editbar label,.editbar .hint{color:var(--hp-muted);font-size:var(--fs-s);}.editbar .drawwall{display:inline-flex;align-items:center;gap:var(--sp-3);white-space:nowrap;}.editbar .wallsgroup{display:inline-flex;align-items:center;gap:10px;white-space:nowrap;}.editbar .drawwall input{width:4.2em;}.editbar .drawwall .opl{color:var(--hp-muted);font-size:var(--fs-s);}.menuwrap{position:fixed;inset:0;z-index:80;}.menu{position:fixed;background:var(--hp-bg);border:1px solid var(--hp-accent);border-radius:var(--rad-l);box-shadow:var(--shadow-2);min-width:210px;max-width:300px;overflow:hidden;transform:translate(0,8px);}.menu .hd{padding:var(--sp-4) var(--sp-5);font-weight:600;font-size:var(--fs-m);border-bottom:1px solid var(--hp-line);display:flex;align-items:center;gap:var(--sp-3);}.menu .hd ha-icon,.menu .it.all ha-icon{color:var(--hp-accent);--mdc-icon-size:16px;}.menu .it{padding:var(--sp-4) var(--sp-5);font-size:var(--fs-m);cursor:pointer;display:flex;align-items:center;gap:var(--sp-4);}.menu .it ha-icon{--mdc-icon-size:16px;color:var(--hp-muted);}:host([data-pointer-hover]) .menu .it:hover{background:rgba(127,127,127,0.15);}.menu .it.all{color:var(--hp-accent);font-weight:600;}.tip{position:fixed;pointer-events:none;background:var(--hp-bg);border:1px solid var(--hp-accent);color:var(--hp-txt);padding:var(--sp-3) 10px;border-radius:var(--rad-m);font-size:var(--fs-m);box-shadow:var(--shadow-2);z-index:60;max-width:260px;}.tip .m{color:var(--hp-muted);font-size:var(--fs-s);display:block;}`,o`.head{display:flex;align-items:center;gap:10px;padding:10px var(--sp-5);border-bottom:1px solid var(--hp-line);flex-wrap:wrap;}.title{font-size:var(--fs-l);font-weight:600;display:flex;align-items:center;gap:var(--sp-3);white-space:nowrap;}.title ha-icon{color:var(--hp-accent);--mdc-icon-size:18px;}@media (max-width:1100px){.head .count{display:none;}}@media (max-width:620px){.head{gap:var(--sp-3);padding:var(--sp-4) 10px;}.head .title{font-size:var(--fs-m);}}.count{font-size:var(--fs-s);color:var(--hp-muted);}.btn{display:inline-flex;align-items:center;gap:var(--sp-3);border:1px solid var(--hp-line);background:transparent;color:var(--hp-txt);padding:var(--sp-3) 10px;border-radius:var(--rad-m);cursor:pointer;transition:0.15s;font-family:inherit;font-size:var(--fs-m);}.btn ha-icon{--mdc-icon-size:17px;}:host([data-pointer-hover]) .btn:hover{border-color:var(--hp-accent);}.btn.on{background:var(--hp-accent);color:var(--text-primary-color,#fff);border-color:var(--hp-accent);}.btn.ghost{border:none;}.btn[disabled]{opacity:0.5;pointer-events:none;}.sunrow{display:flex;align-items:center;gap:var(--sp-5);margin:var(--sp-3) 0;}.suncol{flex:1;display:flex;flex-direction:column;gap:var(--sp-3);min-width:0;}.recoveryoverlay{position:absolute;inset:0;z-index:75;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--sp-4);padding:var(--sp-6);box-sizing:border-box;background:linear-gradient(var(--ha-card-background,var(--card-background-color,#111)),var(--ha-card-background,var(--card-background-color,#111))),#111;color:var(--primary-text-color,#fff);text-align:center;pointer-events:auto;transition:opacity 0.15s ease;}.recoveryoverlay.phase-entering,.recoveryoverlay.phase-leaving{opacity:0;}.recoveryoverlay.phase-fading-in,.recoveryoverlay.phase-opaque{opacity:1;}.recoveryoverlay ha-icon{--mdc-icon-size:44px;color:var(--hp-accent);}.editorloading{position:absolute;z-index:74;left:50%;top:50%;display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-3) var(--sp-5);border:1px solid color-mix(in srgb,var(--hp-accent) 45%,transparent);border-radius:999px;background:color-mix(in srgb,var(--ha-card-background,var(--card-background-color,#111)) 92%,transparent);color:var(--primary-text-color);box-shadow:0 6px 22px rgb(0 0 0 / 18%);transform:translate(-50%,-50%);pointer-events:none;animation:editor-loading-in 0.15s ease both;}.editorloading ha-icon{--mdc-icon-size:22px;color:var(--hp-accent);animation:editor-loading-spin 0.9s linear infinite;}@keyframes editor-loading-in{from{opacity:0;transform:translate(-50%,calc(-50% + 4px));}to{opacity:1;transform:translate(-50%,-50%);}}@keyframes editor-loading-spin{to{transform:rotate(360deg);}}@media (prefers-reduced-motion:reduce){.recoveryoverlay,.editorloading,.editorloading ha-icon{transition:none;animation:none;}}.oplock{--oplock-size:calc(var(--icon-size,2.5cqw) * 0.62);--oplock-core-size:calc(var(--oplock-size) / 1.26875);--oplock-stroke-ratio:0.01875;--oplock-stroke-width:max(1px,calc(var(--oplock-core-size) * var(--oplock-stroke-ratio)));--oplock-core-bg:light-dark(#fff,#252525);--oplock-core-fg:light-dark(#252525,#fff);--oplock-shell-stroke:light-dark(#BCBCBC,rgb(37 37 37 / 75%));--oplock-shell-shadow:0 calc(var(--oplock-core-size) * .025) calc(var(--oplock-core-size) * .05) rgb(37 40 45 / 12%),0 calc(var(--oplock-core-size) * .1) calc(var(--oplock-core-size) * .175) calc(var(--oplock-core-size) * -.025) rgb(37 40 45 / 18%);--oplock-core-shadow:0 0 0 0 transparent;pointer-events:none;position:absolute;transform:translate(-50%,-50%);width:var(--oplock-size);height:var(--oplock-size);display:grid;place-items:center;border:0;background:transparent;z-index:1;}.oplock.theme-light{--oplock-core-bg:#fff;--oplock-core-fg:#252525;--oplock-shell-stroke:#BCBCBC;}.oplock.theme-dark{--oplock-core-bg:#252525;--oplock-core-fg:#fff;--oplock-shell-stroke:rgb(37 37 37 / 75%);--oplock-core-shadow:inset 0 calc(var(--oplock-core-size) * .0125) calc(var(--oplock-core-size) * .0125) rgb(255 255 255 / 70%);}.oplock-shell{box-sizing:border-box;width:100%;height:100%;border:var(--oplock-stroke-width) solid var(--oplock-shell-stroke);border-radius:50%;background:transparent;box-shadow:var(--oplock-shell-shadow);display:grid;place-items:center;pointer-events:none;backdrop-filter:none;}.oplock-core{width:var(--oplock-core-size);height:var(--oplock-core-size);border-radius:50%;background:var(--oplock-core-bg);color:var(--oplock-core-fg);box-shadow:var(--oplock-core-shadow);display:grid;place-items:center;pointer-events:none;}.oplock ha-icon{--mdc-icon-size:calc(var(--oplock-core-size) * 0.55);display:flex;line-height:0;}.oplock.locked{--oplock-core-bg:#66D17A;--oplock-core-fg:light-dark(#fff,#252525);--oplock-shell-stroke:#66D17A;}.oplock.theme-light.locked{--oplock-core-fg:#fff;}.oplock.theme-dark.locked{--oplock-core-fg:#252525;--oplock-stroke-ratio:.025;}.oplock.unlocked{--oplock-core-bg:#F0410C;--oplock-core-fg:light-dark(#fff,#252525);--oplock-shell-stroke:#F0410C;}.oplock.theme-light.unlocked{--oplock-core-fg:#fff;}.oplock.theme-dark.unlocked{--oplock-core-fg:#252525;--oplock-stroke-ratio:.025;}.oplock.unknown{--oplock-core-fg:var(--hp-muted);}.btn.lockact{width:100%;justify-content:center;display:flex;align-items:center;gap:var(--sp-3);margin-top:var(--sp-4);}.btn.lockact.warn{color:var(--error-color,#d33);border-color:var(--error-color,#d33);}.oprow{display:flex;align-items:center;gap:var(--sp-4);padding:var(--sp-3) 0;}.oprow b{margin-left:auto;}.oprow.ok b{color:#66d17a;}.oprow.warn b{color:var(--hp-open);}.bindharow{display:flex;align-items:center;gap:var(--sp-5);flex-wrap:wrap;}.bindharow .entcheck{opacity:0.9;}.ctrlchips{display:flex;flex-wrap:wrap;gap:var(--sp-3);margin:var(--sp-2) 0;}.ctrlchip{display:inline-flex;align-items:center;gap:var(--sp-2);background:var(--hp-accent);color:var(--text-primary-color,#fff);border-radius:var(--rad-l);padding:var(--sp-2) var(--sp-4);font-size:var(--fs-s);}.ctrlchip ha-icon{--mdc-icon-size:14px;cursor:pointer;}.ctrllist{display:flex;flex-direction:column;gap:var(--sp-1);margin-top:var(--sp-2);}.ctrlopt{display:flex;align-items:center;gap:var(--sp-4);text-align:left;border:0;background:transparent;color:var(--hp-txt);padding:var(--sp-3) var(--sp-4);border-radius:var(--rad-s);cursor:pointer;font-family:inherit;font-size:var(--fs-m);}:host([data-pointer-hover]) .ctrlopt:hover{background:var(--secondary-background-color,rgba(128,128,128,0.15));}.ctrlopt .sub{color:var(--hp-muted);font-size:var(--fs-s);margin-left:auto;}.ctrlopt ha-icon{--mdc-icon-size:16px;}.ctrlstates{display:flex;flex-direction:column;gap:var(--sp-2);}.ctrlstate{display:inline-flex;align-items:center;gap:var(--sp-3);color:var(--hp-muted);}.ctrlstate.on{color:var(--hp-txt);}.ctrlstate ha-icon{--mdc-icon-size:15px;}.cardpreview{display:flex;flex-direction:column;align-items:center;gap:var(--sp-2);margin:var(--sp-4) 0 var(--sp-1);padding:10px;border:1px dashed var(--hp-muted);border-radius:var(--rad-m);}.cardpreview .cpname{font-weight:700;letter-spacing:0.04em;}.cardpreview .cpmeta{display:inline-flex;align-items:center;gap:0.3em;font-weight:600;opacity:0.85;}.cardpreview .cpmeta ha-icon{--mdc-icon-size:1.05em;}.iconauto{display:flex;align-items:center;gap:var(--sp-3);font-size:var(--fs-s);margin:var(--sp-2) 0 0;}.iconauto ha-icon{--mdc-icon-size:18px;}.iconauto span{flex:1;}.iconauto .btn{min-height:32px;padding:0 var(--sp-3);}hp-dialog .dfill{display:inline-flex;align-items:center;gap:var(--sp-3);cursor:pointer;}.wallthick-dlg{position:absolute;z-index:40;min-width:200px;transform:translate(-50%,8px);padding:10px 12px;border-radius:10px;background:var(--card-background-color,#fff);box-shadow:0 8px 28px rgba(0,0,0,.22);display:flex;flex-direction:column;gap:8px;pointer-events:auto;}.wallthick-dlg .row{display:flex;align-items:center;gap:8px;}.wallthick-dlg input[type="number"]{width:5.5em;padding:4px 6px;border:1px solid var(--divider-color,#ccc);border-radius:6px;background:var(--input-fill,transparent);color:var(--primary-text-color);}.areasel,.namein{background:var(--hp-bg);border:1px solid var(--hp-line);color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-m);font-family:inherit;}.namein{width:130px;}.habindingbanner{display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-3) var(--sp-4);margin-bottom:var(--sp-4);border:1px solid var(--warning-color,#ff9800);border-radius:var(--rad-m);background:color-mix(in srgb,var(--warning-color,#ff9800) 12%,transparent);color:var(--primary-text-color,#f1f3f6);}.habindingbanner>span{flex:1;min-width:0;}.habindingbanner>ha-icon{color:var(--warning-color,#ff9800);flex:0 0 auto;}.habindingbanner.limited{border-color:var(--secondary-text-color,#9aa0aa);background:color-mix(in srgb,var(--secondary-text-color,#9aa0aa) 10%,transparent);}.habindingbanner.limited>ha-icon{color:var(--secondary-text-color,#9aa0aa);}.srcrow{display:flex;align-items:center;gap:var(--sp-4);font-size:var(--fs-m);cursor:pointer;padding:var(--sp-1) 0;}.dispsection{margin-top:var(--sp-5) !important;padding-top:var(--sp-4);border-top:1px solid var(--hp-line);font-weight:600;color:var(--hp-txt) !important;}.colorrow{display:flex;align-items:center;gap:var(--sp-4);}.roomtemprange{display:grid;gap:8px;min-width:0;}.roomtemprange-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px;}.roomtemprange-fields{display:flex;flex-wrap:wrap;align-items:center;gap:8px;min-width:0;}.roomtemprange-fields input{flex:0 1 104px;min-width:72px;}.roomtemprange-fields input[aria-invalid='true']{border-color:var(--error-color,#db4437);}.gsrow>hp-color-opacity{min-width:min(100%,210px);justify-content:space-between;}.ripple-colorrow>hp-color-opacity{width:100%;justify-content:space-between;}.ripple-sizerow>.opl{min-width:0;}.colorrow input[type='range']{flex:1;}.colorrow .tempin{width:70px;flex:none;}hp-dialog .body .temprange .tempin{width:56px;flex:none;padding:var(--sp-2) var(--sp-3);}hp-dialog .body .colorrow .tempin{width:72px;flex:none;}.srcrow{flex-wrap:nowrap;}.srcrow ha-switch{flex:none;}.colorrow ha-slider{flex:1;min-width:0;}.srcrow>span:first-of-type{white-space:nowrap;}.colorrow .opl{color:var(--hp-muted);font-size:var(--fs-s);}.colorrow .opv{font-size:var(--fs-s);min-width:34px;text-align:right;}.markerlightgroup{min-width:0;margin:var(--sp-5) 0 0;padding:var(--sp-4);border:1px solid var(--hp-line);border-radius:var(--rad-m);}.markerlightgroup legend{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-1);padding:0 var(--sp-2);color:var(--hp-txt);font-weight:600;}.markerlightgroup legend>span{min-width:0;overflow-wrap:anywhere;}.markerlightgroup[disabled]>:not(legend){opacity:.62;}.radargroup{display:grid;gap:var(--sp-2);}.radargroup>p{margin:0;}.radargroup>label:not(.srcrow){margin-top:var(--sp-2);}.radarcoordinates{align-items:flex-end;flex-wrap:wrap;}.radarcoordinates>label{display:grid;flex:1 1 92px;gap:var(--sp-1);min-width:0;margin:0;}hp-dialog .body .radarcoordinates .tempin{box-sizing:border-box;width:100%;}.radaradditional{margin-top:var(--sp-5);}.radaradditional summary{cursor:pointer;font-weight:600;}.radaradditional .btn{margin-top:var(--sp-3);}.radarinspection{display:grid;gap:6px;padding:10px 12px;border-radius:10px;background:color-mix(in srgb,var(--primary-color) 7%,transparent);}.radarinspection code{overflow-wrap:anywhere;font-size:12px;}.radarsetup{display:grid;gap:10px;margin-top:10px;padding:12px;border:1px solid var(--hp-accent);border-radius:var(--rad-m);background:color-mix(in srgb,var(--secondary-background-color) 88%,transparent);}.radarsetup-head{display:flex;align-items:center;gap:8px;}.radarsetup-head strong{flex:1;}.radarsetup>svg{width:min(100%,460px);aspect-ratio:1;justify-self:center;border-radius:var(--rad-m);background:var(--primary-background-color);touch-action:none;cursor:crosshair;}.radarsetup .room{fill:color-mix(in srgb,var(--hp-accent) 8%,transparent);stroke:var(--divider-color);stroke-width:3;vector-effect:non-scaling-stroke;}.radarsetup .heading{stroke:var(--hp-accent);stroke-width:4;vector-effect:non-scaling-stroke;}.radarsetup .trail{fill:none;stroke:var(--success-color,#43a047);stroke-width:3;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;opacity:.55;}.radarsetup g circle{fill:var(--hp-bg);stroke:var(--hp-accent);stroke-width:3;vector-effect:non-scaling-stroke;}.radarsetup g.pending circle{stroke-dasharray:5 4;}.radarsetup g text{fill:var(--hp-txt);font-size:22px;font-weight:700;text-anchor:middle;dominant-baseline:middle;pointer-events:none;}.markerhelpfield{margin-top:var(--sp-4);}.markerhelplabel{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-1);margin-bottom:var(--sp-1);}.markerhelplabel>label{min-width:0;overflow-wrap:anywhere;}.helpfieldlabel{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-1);min-width:0;margin-top:var(--sp-3);color:var(--hp-muted);font-size:var(--fs-s);}.helpfieldlabel.compact{margin-top:0;}hp-dialog .body .helpfieldlabel>label{min-width:0;margin-top:0;overflow-wrap:anywhere;}.help-inline-label{display:inline-flex;align-items:center;flex-wrap:wrap;gap:var(--sp-1);}hp-dialog .body .help-inline-label>label{min-width:0;margin-top:0;overflow-wrap:anywhere;}.markerradios{display:grid;gap:var(--sp-1);min-width:0;}.markerlightgroup .srcrow>span:first-of-type{min-width:0;white-space:normal;overflow-wrap:anywhere;}.markerglowvalue{margin:var(--sp-3) 0;flex-wrap:wrap;}.markerglowvalue hp-color-opacity{flex:none;}.markerlightdisabled{display:flex;align-items:center;gap:var(--sp-2);margin-top:var(--sp-2) !important;}.markerlightdisabled ha-icon{--mdc-icon-size:18px;flex:none;}.markerbadgetechnical{min-width:0;margin:var(--sp-1) 0 var(--sp-2) !important;overflow-wrap:anywhere;}.markerbadgetechnical code{white-space:normal;}.planrow{display:flex;align-items:center;gap:10px;}.savedplans{display:flex;flex-direction:column;gap:var(--sp-3);max-height:240px;overflow:auto;margin:var(--sp-3) 0 var(--sp-1);padding:var(--sp-3);border:1px solid var(--hp-line);border-radius:var(--rad-m);background:var(--hp-bg2,rgba(255,255,255,0.03));flex:0 0 auto;min-height:2.6em;}.savedplan{display:flex;align-items:center;gap:10px;}.savedplan.cur{outline:1px solid var(--hp-accent);border-radius:var(--rad-s);}.savedplan img{width:56px;height:40px;object-fit:contain;border:1px solid var(--hp-line);border-radius:var(--rad-s);background:#fff;flex:none;}.savedmeta{display:flex;flex-direction:column;min-width:0;flex:1;}.savedmeta b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.savedmeta .muted{font-size:var(--fs-s);}.savedplan .btn.danger ha-icon{color:#f25a4a;}.savedplan .btn[disabled]{opacity:0.4;pointer-events:none;}.planprev{max-width:120px;max-height:70px;border:1px solid var(--hp-line);border-radius:var(--rad-s);background:#fff;}.planname{font-size:var(--fs-m);max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.planname.muted{color:var(--hp-muted);}.filebtn{cursor:pointer;}.fileupload{display:inline-flex;min-width:0;}.fileupload>input{display:none;}.btn.danger{border-color:#b3402a;color:#ff7a5c;}hp-dialog .row .spacer{flex:1;}hp-dialog .body{max-height:66vh;overflow-y:auto;}hp-confirm{display:contents;}hp-dialog .danger-confirm-body{display:flex;flex-direction:column;gap:var(--sp-4);}hp-dialog .danger-confirm-body p{margin:0;line-height:1.45;}hp-dialog .danger-confirm-object{overflow-wrap:anywhere;font-size:var(--fs-l);line-height:1.3;}.descin{width:100%;box-sizing:border-box;background:var(--hp-bg);border:1px solid var(--hp-line);color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-m);font-family:inherit;resize:vertical;min-height:92px;flex-shrink:0;line-height:1.35;}.bindsel{display:flex;flex-direction:column;gap:var(--sp-3);border:1px solid var(--hp-line);border-radius:var(--rad-m);padding:var(--sp-4);}.bindsel .opt{display:flex;align-items:center;gap:var(--sp-3);border:1px solid var(--hp-line);background:transparent;color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);cursor:pointer;font-size:var(--fs-m);font-family:inherit;}.bindsel .opt.on{background:var(--hp-accent);color:var(--text-primary-color,#fff);border-color:var(--hp-accent);}.curbind{display:flex;align-items:center;gap:var(--sp-3);font-size:var(--fs-m);color:var(--hp-txt);flex-wrap:wrap;}.curbind .ref{color:var(--hp-muted);font-size:var(--fs-s);}.vacbox .vacbtns{display:flex;gap:var(--sp-4);margin:var(--sp-3) 0;flex-wrap:wrap;}.vacdiag{display:grid;gap:4px;margin-bottom:var(--sp-3);}.vacdiag>div{display:flex;justify-content:space-between;gap:var(--sp-5);}.vacdiag>div>span{color:var(--secondary-text-color);}.vacdiag>div>b{text-align:right;overflow-wrap:anywhere;}.vacroute-missing-group{margin-top:var(--sp-4);padding-top:var(--sp-4);border-top:1px solid var(--hp-line);}.vacroute-group-title{margin:0 0 var(--sp-3);color:var(--secondary-text-color);font-size:var(--fs-m);font-weight:600;}.vacroute-missing-group .vacroute-list{margin-top:0;}.vacpicker{margin:var(--sp-3) 0;}.vacsource-warning{display:grid;gap:8px;}.vacsource-warning .btn{justify-self:start;}.vacpicker>summary{display:inline-flex;width:auto;list-style:none;cursor:pointer;}.vacpicker>summary::-webkit-details-marker{display:none;}.vacsource-list{display:grid;gap:6px;margin-top:8px;}.vacsource-list details{padding:6px 0 0;}.vacsource-list details>summary{cursor:pointer;font-weight:600;}.vacsource{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-width:0;padding:9px 10px;border:1px solid var(--divider-color);border-radius:10px;color:var(--primary-text-color);background:var(--secondary-background-color);text-align:left;cursor:pointer;}.vacsource.on{border-color:var(--accent-color);box-shadow:inset 3px 0 var(--accent-color);}.vacsource>span:first-child{min-width:0;display:grid;gap:2px;}.vacsource small{color:var(--secondary-text-color);overflow-wrap:anywhere;}.vacsource-meta{color:var(--secondary-text-color);text-align:right;font-size:0.82em;}.vacxcme pre{margin:8px 0 0;white-space:pre-wrap;user-select:text;}.vacfit{position:absolute;inset:0;width:100%;height:100%;z-index:12;overflow:visible;touch-action:none;cursor:grab;pointer-events:auto;}.vacfit:active{cursor:grabbing;}.vacfit polygon{fill:color-mix(in srgb,var(--hp-accent) 16%,transparent);stroke:var(--hp-accent);stroke-width:2;vector-effect:non-scaling-stroke;stroke-dasharray:6 4;}.vacfit text{fill:var(--hp-accent);font-size:26px;text-anchor:middle;dominant-baseline:middle;pointer-events:none;user-select:none;}.furnpalette{display:flex;flex-direction:column;max-height:38vh;border-top:1px solid var(--hp-border,rgba(255,255,255,0.12));background:var(--card-background-color,var(--hp-bg));font-size:0.85em;}.furnhd{display:flex;align-items:center;gap:6px;padding:4px 8px;font-weight:600;opacity:0.9;}.furnhd .spacer{flex:1;}.furnbody{overflow:auto;padding:0 8px 6px;}.furngroup{margin:6px 0 3px;font-size:0.85em;text-transform:uppercase;letter-spacing:0.04em;opacity:0.6;}.furnrow{display:flex;flex-wrap:wrap;gap:4px;}.furnback{min-height:34px;gap:5px;margin:2px 0 4px;}.furnitem{display:flex;flex-direction:column;align-items:center;gap:2px;width:74px;padding:4px 2px;border:1px solid transparent;border-radius:8px;background:rgba(127,127,127,0.08);color:inherit;font:inherit;font-size:0.8em;line-height:1.15;text-align:center;cursor:pointer;}:host([data-pointer-hover]) .furnitem:hover{background:rgba(127,127,127,0.18);}.furnitem.on{border-color:var(--hp-accent);background:rgba(38,166,154,0.18);}.furnprev{width:40px;height:40px;color:var(--primary-text-color,currentColor);}.furncategory{width:92px;min-height:76px;}.furncatprev{width:48px;height:48px;}.furnvariants .furnitem{min-height:74px;}.furnsize{display:flex;align-items:center;flex-wrap:wrap;gap:6px;padding:6px 8px;border-top:1px solid var(--hp-border,rgba(255,255,255,0.12));}.furnsize label{display:flex;align-items:baseline;gap:3px;opacity:0.8;}.furnsize .furnunit{opacity:0.6;font-size:0.85em;}.furnsize input{width:5.5em;padding:3px 5px;}.furnhint{opacity:0.6;}.imageupload{display:inline-flex;gap:6px;margin:4px 0 8px;cursor:pointer;}.imageupload.disabled{opacity:0.55;pointer-events:none;}.imageupload input{display:none;}.imageassets{align-items:stretch;}.imageempty{padding:12px 6px;}.imageasset{position:relative;}.imageasset .furnitem{width:104px;min-height:92px;}.imageasset img{width:64px;height:54px;object-fit:contain;border-radius:4px;background:repeating-conic-gradient(#ddd 0 25%,#fff 0 50%) 50% / 12px 12px;}.imageasset .furnitem span{max-width:96px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.imageasset .furnitem small{opacity:0.65;font-size:0.72em;}.imageassetdelete{position:absolute;top:0;right:0;min-width:30px;width:30px;min-height:30px;padding:3px;}.imagepropertypreview{display:flex;align-items:center;gap:10px;min-width:0;}.imagepropertypreview img{width:72px;height:54px;object-fit:contain;border-radius:4px;background:repeating-conic-gradient(#ddd 0 25%,#fff 0 50%) 50% / 12px 12px;}.imagepropertypreview span{overflow-wrap:anywhere;}.vacfitdot{fill:var(--hp-accent);pointer-events:none;}.vacfithandle{fill:transparent;stroke:none;cursor:nwse-resize;}.vacfitknob{fill:var(--hp-bg);stroke:var(--hp-accent);stroke-width:2;vector-effect:non-scaling-stroke;pointer-events:none;}.vaccalbar{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);display:flex;gap:var(--sp-5);align-items:center;background:var(--hp-bg);color:var(--hp-txt);border:1px solid var(--hp-accent);border-radius:var(--rad-l);padding:10px var(--sp-5);z-index:60;box-shadow:var(--shadow-2);}.candlist{max-height:160px;overflow-y:auto;border-top:1px solid var(--hp-line);flex:0 0 auto;min-height:2.6em;}.cand{display:flex;justify-content:space-between;gap:var(--sp-4);padding:var(--sp-3) var(--sp-4);cursor:pointer;border-radius:var(--rad-s);font-size:var(--fs-m);}:host([data-pointer-hover]) .cand:hover{background:rgba(127,127,127,0.15);}.cand.sel{background:var(--hp-accent);color:var(--text-primary-color,#fff);}.cand .cs{color:var(--hp-muted);font-size:var(--fs-s);white-space:nowrap;}.opening-entity-candidate{width:100%;border:0;background:transparent;color:inherit;font:inherit;text-align:left;}.opening-entity-candidate.sel{background:var(--hp-accent);color:var(--text-primary-color,#fff);}.opening-entity-empty{cursor:default;}.cand.sel .cs{color:var(--text-primary-color,#fff);opacity:0.85;}.cand.muted{color:var(--hp-muted);cursor:default;}.pdfedit{display:flex;flex-wrap:wrap;gap:var(--sp-3);align-items:center;}.pdftag{display:inline-flex;align-items:center;gap:var(--sp-2);border:1px solid var(--hp-line);border-radius:var(--rad-s);padding:var(--sp-2) var(--sp-3);font-size:var(--fs-s);}.pdftag a{color:var(--hp-txt);text-decoration:none;max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.pdftag .x{--mdc-icon-size:15px;cursor:pointer;color:var(--hp-muted);}:host([data-pointer-hover]) .pdftag .x:hover{color:#ff7a5c;}.entlist{display:flex;flex-direction:column;gap:var(--sp-2);margin-bottom:10px;}.entrow{display:flex;align-items:center;gap:var(--sp-4);padding:var(--sp-3) var(--sp-4);border-radius:var(--rad-m);background:var(--secondary-background-color,rgba(128,128,128,0.12));}.entrow ha-icon{--mdc-icon-size:20px;color:var(--hp-muted);}.entrow.on ha-icon{color:var(--hp-accent);}.entrow .en{flex:1;font-size:var(--fs-m);}.entrow .ev{font-size:var(--fs-m);color:var(--hp-muted);}.entbtn{min-width:74px;min-height:32px;padding:var(--sp-2) var(--sp-5);border:1px solid var(--hp-muted);border-radius:999px;background:transparent;color:var(--hp-txt);font:inherit;font-size:var(--fs-m);cursor:pointer;}.entbtn.on{background:var(--hp-accent);border-color:var(--hp-accent);color:var(--text-primary-color,#fff);font-weight:600;}.inforow{display:flex;gap:10px;font-size:var(--fs-m);margin:var(--sp-2) 0;}.inforow .k{color:var(--hp-muted);min-width:84px;}.inforow a{color:var(--hp-accent);word-break:break-all;}.infodesc{font-size:var(--fs-m);white-space:pre-wrap;margin-top:var(--sp-3);}.infodesc.muted{color:var(--hp-muted);}.pdflist{display:flex;flex-direction:column;gap:var(--sp-2);}.pdf{display:inline-flex;align-items:center;gap:var(--sp-2);color:var(--hp-accent);text-decoration:none;}ha-icon-picker{display:block;}.floorrow{display:flex;align-items:center;gap:var(--sp-4);padding:var(--sp-3) var(--sp-2);font-size:var(--fs-m);cursor:pointer;}.floorrow .floorlvl{color:var(--hp-muted);font-size:var(--fs-s);border:1px solid var(--hp-line);border-radius:var(--rad-s);padding:0 var(--sp-3);}.rtest{display:flex;align-items:center;gap:var(--sp-4);margin-bottom:var(--sp-4);}.rtest .namein{flex:1;}.rtest ha-icon{color:var(--hp-accent);}.rtesticon{font-size:var(--fs-s);color:var(--hp-muted);}.rrow{display:flex;align-items:center;gap:var(--sp-3);margin:var(--sp-1) 0;}.rrow .rpat{flex:2;}.rrow .ricon{flex:1.4;}.rrow .rpat.bad{border-color:#ff7a5c;}.rrow .rprev{--mdc-icon-size:18px;color:var(--hp-txt);min-width:18px;}.rrow .ract{--mdc-icon-size:16px;color:var(--hp-muted);cursor:pointer;}:host([data-pointer-hover]) .rrow .ract:hover{color:var(--hp-txt);}:host([data-pointer-hover]) .rrow .ract.del:hover{color:#ff7a5c;}.gsrow .gsl{min-width:150px;font-size:var(--fs-m);color:var(--hp-muted);}.optimize-live{display:grid;justify-items:start;gap:var(--sp-2);margin-bottom:var(--sp-3);}.optimize-live .alignmsg,.optimize-live .rhint{margin-bottom:0;}.optimize-cleanup{min-height:44px;}.optimize-selected{color:var(--hp-txt);}.optimize-details{margin-top:var(--sp-3);color:var(--hp-muted);font-size:var(--fs-s);overflow-wrap:anywhere;}.optimize-details>summary{width:fit-content;color:var(--hp-txt);cursor:pointer;font-weight:600;}.optimize-details>summary:focus-visible{outline:2px solid var(--hp-accent);outline-offset:3px;border-radius:var(--rad-s);}.optimize-details ul{margin:var(--sp-3) 0;padding-inline-start:22px;}.optimize-details li + li{margin-top:var(--sp-1);}.btn.alignall{width:100%;justify-content:center;}.backupactions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--sp-3);}.backupactions .btn{justify-content:center;min-width:0;}.backupupload{display:inline-flex;min-width:0;}.backupupload>.btn{width:100%;justify-content:center;}.backupupload input{display:none;}.backupbody{min-width:0;}.backupplanonly{margin-inline-start:var(--sp-4) !important;align-items:flex-start !important;}.backupplanonly>span:first-of-type{display:grid;gap:2px;white-space:normal;}.backupplanonly small{color:var(--secondary-text-color);line-height:1.35;}.backupplanonlystatus{color:var(--hp-accent) !important;font-weight:700;}.backupfile,.backupsummary,.backupcontent{display:flex;flex-direction:column;min-width:0;gap:var(--sp-1);}.backupfile b,.backupcontent span{overflow-wrap:anywhere;}.backupfile span,.backupsummary span,.backupcontent span{color:var(--hp-muted);font-size:var(--fs-s);}.backupcounts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--sp-2) var(--sp-4);font-size:var(--fs-s);}.backupwarn,.backuperror{border-radius:var(--rad-s);padding:var(--sp-3);font-size:var(--fs-s);line-height:1.45;overflow-wrap:anywhere;}.backupwarn{background:color-mix(in srgb,var(--hp-accent) 12%,transparent);}.backuperror{background:rgba(179,64,42,.16);color:#ff7a5c;}.backupdetails{border:1px solid var(--hp-line);border-radius:var(--rad-s);padding:var(--sp-2) var(--sp-3);font-size:var(--fs-s);}.backupdetails summary{cursor:pointer;font-weight:700;}.backupdetails>div{display:grid;gap:var(--sp-1);padding-block-start:var(--sp-2);}.backupdetails code{overflow-wrap:anywhere;color:var(--hp-muted);}.backupchoices{display:flex;flex-direction:column;gap:var(--sp-2);border:1px solid var(--hp-line);border-radius:var(--rad-s);min-width:0;}.backupchoices label{margin:0 !important;display:flex;gap:var(--sp-2);}.backupconfirm{align-items:flex-start !important;}.backupconfirm>span:first-of-type{min-width:0;white-space:normal;overflow-wrap:anywhere;}@media (max-width:520px){.backupactions,.backupcounts{grid-template-columns:1fr;}}.aboutver{font-size:var(--fs-s);color:var(--hp-muted);margin:var(--sp-2) 0 var(--sp-3);}.aboutlink{display:flex;align-items:center;gap:var(--sp-3);width:fit-content;color:var(--hp-accent);text-decoration:none;font-size:var(--fs-m);padding:var(--sp-1) 0;}:host([data-pointer-hover]) .aboutlink:hover{text-decoration:underline;}.aboutlink ha-icon{--mdc-icon-size:18px;line-height:1;}hp-dialog .supportbody{min-width:0;overflow-x:hidden;gap:var(--sp-5);}.supportsection{display:grid;min-width:0;gap:var(--sp-2);}.supportsection + .supportsection{padding-top:var(--sp-4);border-top:1px solid var(--hp-line);}.supportsection h3{margin:0;color:var(--hp-txt);font-size:var(--fs-m);}.supportlinks,.supportactions{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-2) var(--sp-4);min-width:0;}.supportform>label:not(.srcrow){margin-top:var(--sp-2);color:var(--hp-muted);font-size:var(--fs-s);}.supportmessage,.supportraw{width:100%;min-width:0;box-sizing:border-box;resize:vertical;border:1px solid var(--hp-line);border-radius:var(--rad-s);padding:var(--sp-3);color:var(--hp-txt);background:color-mix(in srgb,var(--card-background-color,var(--hp-bg)) 92%,var(--hp-txt));font:inherit;}.supportmessage{min-height:120px;background:var(--hp-bg);}.supportraw{min-height:220px;margin-top:var(--sp-2);resize:none;white-space:pre;overflow:auto;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;}.supportattach{min-width:0;align-items:flex-start;margin:var(--sp-2) 0 0 !important;}.supportattach>span:first-of-type{min-width:0;white-space:normal;overflow-wrap:anywhere;}.supportwarning,.supportstatus,.supportupdate{display:flex;align-items:flex-start;gap:var(--sp-2);min-width:0;margin:0;padding:var(--sp-3);border-radius:var(--rad-s);background:color-mix(in srgb,var(--hp-accent) 14%,transparent);overflow-wrap:anywhere;font-size:var(--fs-s);line-height:1.45;}.supportwarning ha-icon,.supportstatus ha-icon,.supportupdate ha-icon{flex:none;color:var(--hp-accent);--mdc-icon-size:20px;}.supportpreview,.supportmanual,.supporterror,.supportsuccess{display:grid;min-width:0;gap:var(--sp-2);padding:var(--sp-3);border:1px solid var(--hp-line);border-radius:var(--rad-s);}.supportsummary{font-weight:600;overflow-wrap:anywhere;}.supporthash{display:grid;min-width:0;gap:var(--sp-1);color:var(--hp-muted);font-size:var(--fs-s);}.supporthash code{overflow-wrap:anywhere;color:var(--hp-txt);}.supportpreview details{min-width:0;}.supportpreview summary{cursor:pointer;color:var(--hp-accent);}.supportprivacy{margin:0 !important;line-height:1.45;}.supporterror{background:color-mix(in srgb,var(--error-color,#db4437) 12%,transparent);border-color:color-mix(in srgb,var(--error-color,#db4437) 45%,var(--hp-line));}.supportsuccess{background:color-mix(in srgb,var(--success-color,#43a047) 12%,transparent);border-color:color-mix(in srgb,var(--success-color,#43a047) 45%,var(--hp-line));}.supportfooter{flex-wrap:wrap;}@media (max-width:520px){hp-dialog .supportbody{padding-inline:var(--sp-4);}hp-dialog .supportfooter{padding-inline:var(--sp-4);}.supportactions .btn,.supportactions .aboutlink{max-width:100%;}}hp-dialog .body{padding:var(--sp-5) var(--sp-6);display:flex;flex-direction:column;gap:var(--sp-3);}hp-dialog .tapconfirm-body{min-width:0;overflow-x:hidden;}hp-dialog .tapconfirm-body p{max-width:100%;min-width:0;margin:0;overflow-wrap:anywhere;white-space:normal;}hp-dialog .tapconfirm-line{color:var(--hp-muted);}hp-dialog .body label{font-size:var(--fs-s);color:var(--hp-muted);margin-top:var(--sp-3);}hp-dialog .body .namein,hp-dialog .body .areasel{width:100%;box-sizing:border-box;}hp-dialog.roomdialog .body{min-width:0;overflow-x:hidden;}hp-dialog.roomdialog .body>*{min-width:0;max-width:100%;box-sizing:border-box;}hp-dialog.roomdialog .srcrow{min-width:0;align-items:flex-start;}hp-dialog.roomdialog .srcrow>span:first-of-type{min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.35;}hp-dialog.roomdialog .dropbtn>b,hp-dialog.roomdialog .dropbtn>.ref{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}hp-dialog .row{display:flex;justify-content:flex-end;gap:var(--sp-4);width:100%;min-width:0;box-sizing:border-box;padding:var(--sp-5) var(--sp-6);border-top:1px solid var(--hp-line);}hp-dialog>.row[slot='footer'] button{min-height:44px;}hp-dialog .row.dialog-action-footer{align-items:center;justify-content:flex-start;flex-wrap:wrap;row-gap:var(--sp-4);}hp-dialog .dialog-action-group{display:flex;flex:0 1 auto;flex-wrap:wrap;align-items:center;gap:var(--sp-4);max-width:100%;min-width:0;}hp-dialog .dialog-action-group .btn{flex:0 0 auto;min-height:44px;}hp-dialog .dialog-action-danger{margin-right:auto;}hp-dialog .dialog-action-commit{margin-left:auto;justify-content:flex-end;}hp-dialog .row.markerfooter{justify-content:space-between;align-items:center;flex-wrap:wrap;}hp-dialog .row.roomfooter{align-items:center;flex-wrap:wrap;}hp-dialog .row.infofooter{align-items:center;justify-content:flex-start;flex-wrap:wrap;gap:var(--sp-3);}hp-dialog .row.infofooter .btn{flex-shrink:0;}hp-dialog .row.infofooter .infofooter-close{margin-left:auto;}@media (max-width:480px){hp-dialog .row.infofooter{padding:var(--sp-4) var(--sp-5);}}.markeractions,.markersaveactions{display:flex;align-items:center;gap:var(--sp-4);}.markeractions:empty{display:none;}.markersaveactions{margin-left:auto;}.device-inbox{display:flex;flex-direction:column;gap:var(--sp-4);padding:var(--sp-5) var(--sp-6);min-width:0;}.device-inbox-dialog{--hp-dialog-wide-width:920px;}.device-inbox-head{display:grid;grid-template-columns:minmax(180px,1fr) auto;align-items:center;gap:var(--sp-4);}.device-inbox-search{width:100%;min-width:0;box-sizing:border-box;border:1px solid var(--hp-line);border-radius:var(--rad-m);background:transparent;color:var(--hp-txt);font:inherit;padding:11px 14px;}.device-inbox-tabs{display:flex;gap:var(--sp-2);overflow-x:auto;scrollbar-width:thin;padding-bottom:var(--sp-1);}.device-inbox-tabs button{flex:0 0 auto;border:1px solid var(--hp-line);border-radius:999px;background:transparent;color:var(--hp-txt);font:inherit;padding:8px 12px;cursor:pointer;}.device-inbox-tabs button.on{border-color:var(--hp-accent);background:color-mix(in srgb,var(--hp-accent) 18%,transparent);}.device-inbox-tabs button span{color:var(--hp-muted);margin-inline-start:4px;}.device-inbox-discovery{margin:8px 0;padding:8px 10px;border:1px solid var(--divider-color,#e0e0e0);border-radius:8px;}.device-inbox-discovery summary{cursor:pointer;font-weight:600;}.device-inbox-discovery .srcrow{display:flex;gap:6px;align-items:center;margin:8px 0;}.device-inbox-excluded{display:flex;flex-wrap:wrap;gap:6px;align-items:center;}.device-inbox-excluded>span{font-weight:500;}.device-inbox-chips{display:flex;flex-wrap:wrap;gap:4px;}.device-inbox-chips .chip{display:inline-flex;align-items:center;gap:2px;padding:1px 6px;border-radius:10px;background:var(--secondary-background-color,#f0f0f0);font-size:12px;}.device-inbox-chips .chip button{border:none;background:none;cursor:pointer;padding:0 2px;color:var(--secondary-text-color,#666);}.device-inbox-excluded input[type="text"]{flex:1 1 140px;min-width:120px;padding:4px 6px;border:1px solid var(--divider-color,#e0e0e0);border-radius:6px;background:var(--card-background-color,#fff);color:var(--primary-text-color,#212121);}.device-inbox-preview{margin:8px 0 4px;font-size:13px;opacity:0.85;}.device-inbox-filters{display:flex;flex-wrap:wrap;gap:var(--sp-4) var(--sp-6);color:var(--hp-muted);}.device-inbox-filters label{display:inline-flex;align-items:center;gap:var(--sp-2);cursor:pointer;}.device-inbox-filter-help{display:inline-flex;align-items:center;gap:var(--sp-1);min-width:0;}.device-inbox-results{display:grid;gap:var(--sp-3);min-width:0;}.device-inbox-row{display:grid;grid-template-columns:42px minmax(180px,1fr) minmax(180px,auto);align-items:center;gap:var(--sp-4);min-width:0;border:1px solid var(--hp-line);border-radius:var(--rad-m);padding:var(--sp-4);background:color-mix(in srgb,var(--hp-txt) 3%,transparent);}.device-inbox-icon{--mdc-icon-size:28px;color:var(--hp-txt);justify-self:center;}.device-inbox-copy{min-width:0;}.device-inbox-name{display:flex;align-items:center;flex-wrap:wrap;gap:var(--sp-2);}.device-inbox-new{border-radius:999px;background:var(--hp-accent);color:var(--text-primary-color,#fff);font-size:var(--fs-s);padding:2px 7px;}.device-inbox-meta,.device-inbox-reason,.device-inbox-copy code{display:block;color:var(--hp-muted);font-size:var(--fs-s);overflow-wrap:anywhere;white-space:normal;}.device-inbox-status{color:var(--error-color,#db4437);margin-inline-start:var(--sp-2);}.device-inbox-actions{display:flex;justify-content:flex-end;align-items:center;flex-wrap:wrap;gap:var(--sp-2);}.device-inbox-actions .btn{min-height:36px;padding:7px 10px;}.device-inbox-menu{position:relative;}.device-inbox-menu summary{list-style:none;cursor:pointer;}.device-inbox-menu summary::-webkit-details-marker{display:none;}.device-inbox-menu-items{position:absolute;z-index:2;inset-inline-end:0;top:calc(100% + var(--sp-1));display:grid;gap:var(--sp-1);min-width:180px;padding:var(--sp-2);border:1px solid var(--hp-line);border-radius:var(--rad-m);background:var(--hp-panel,var(--card-background-color,#fff));box-shadow:0 8px 24px rgba(0,0,0,.22);}.device-inbox-menu-items .btn{justify-content:flex-start;width:100%;}.device-inbox-empty{color:var(--hp-muted);text-align:center;padding:var(--sp-8);}.device-inbox-more{align-self:center;}@media (max-width:680px){.device-inbox{padding:var(--sp-4);}.device-inbox-head{grid-template-columns:minmax(0,1fr);}.device-inbox-head .btn{justify-self:stretch;}.device-inbox-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));overflow-x:visible;}.device-inbox-tabs button{min-width:0;overflow-wrap:anywhere;}.device-inbox-row{grid-template-columns:36px minmax(0,1fr);}.device-inbox-actions{grid-column:1 / -1;justify-content:flex-start;}}`];var sp={"editor.context_actions":"Actions: {object}","editor.tool_options":"Tool options: {tool}","editor.palette":"Palette: {tool}","editor.open_group":"Tool group: {group}","editor.group_active":"{group} — active: {item}","editor.disabled_action":"{action} is unavailable: {reason}","editor.loading":"Loading editor…","editor.loading_aria":"The plan editor is loading","editor.load_failed":"Could not load the editor.","editor.refresh_advice":"Refresh the page and try again.","editor.retry_advice":"Check your connection and press again.","version_mismatch.title":"House Plan versions do not match","version_mismatch.body":"If Home Assistant is still restarting, let it finish, then reload this page.","version_mismatch.frontend":"Card","version_mismatch.backend":"Integration","version_mismatch.reload":"Reload page","color_picker.title":"Color picker","color_picker.hue":"Hue","color_picker.saturation":"Saturation","color_picker.value":"Brightness","color_picker.hex":"Hex color","color_picker.invalid_hex":"Enter a 3- or 6-digit hex color","color_picker.confirm":"OK","btn.properties":"Properties","btn.keep_as_walls":"Keep as walls","btn.delete_room_keep_walls":"Delete room, keep walls","btn.delete_room_with_walls":"Delete room and walls","title.markup_select":"Select and edit walls and columns","title.markup_column":"Column: click a grid point to place a square column","markup.partition":"Partition","markup.column":"Column","markup.hint_column":"click a grid point to place a square column","history.wall_segment":"Add wall segment","history.column_add":"Add column","history.physical_edit":"Change physical object","history.physical_delete":"Delete physical object","history.physical_move":"Move physical object","history.wall_face_batch":"Create rooms from walls","toast.column_duplicate":"A column with the same centre and outer size already exists","physical.partition_properties":"Partition properties","physical.column_properties":"Column properties","physical.shape":"Shape","physical.square":"Square","physical.circle":"Circle","physical.diameter":"Diameter","physical.side":"Side","physical.rotation":"Rotation angle","physical.length":"Length","physical.allowed_range":"Allowed: {min}–{max} {unit}","physical.column_size_title":"Outer side of the square column placed by the click (1–150 cm).","card.title":"House plan","count.devices":"{n} dev.","empty.no_spaces":"No spaces yet.","nav.spaces":"House Plan spaces","empty.add_first":"Add the first space and upload a floor plan.","empty.read_only":"No spaces are configured. Ask an administrator to add one.","empty.install":'Install the House Plan integration and add it in "Devices & services".',"btn.add_space":"Add space","btn.cancel":"Cancel","btn.save":"Save","btn.close":"Close","btn.delete":"Delete","btn.copy":"Copy","btn.edit":"Edit","btn.open_in_ha":"Open in HA","btn.reset":"Reset","btn.attach":"Attach…","btn.upload":"Upload…","btn.replace":"Replace…","title.zoom_in":"Zoom in","title.zoom_out":"Zoom out","title.zoom_fit":"Fit all","title.configure_space":"Configure space","title.add_space":"Add space","title.markup_add":"Walls: draw a continuous chain; each accepted segment is saved independently. Shift locks to 45°","title.markup_merge":"Merge: click one room, then the neighbour it shares a wall with","title.markup_split":"Split a room: click the room, then two points on its walls","title.markup_delroom":"Delete room: click inside a room and confirm","title.need_plan":"Upload a floor-plan image","markup.add":"Walls","markup.merge":"Merge","markup.split":"Split","markup.resize":"Resize","title.markup_resize":"Resize rooms: drag an available horizontal or vertical wall handle","markup.hint_resize":"drag an available wall handle · the wall stops at the first unsafe position · Esc cancels · Ctrl+Z — undo","resize.disabled.diagonal":"This wall is angled; Resize supports only horizontal and vertical walls","resize.disabled.side-angle":"An adjoining wall is angled; Resize requires both adjoining walls to meet this wall at right angles","resize.disabled.duplicate-physical-wall":"A separate partition or column overlaps this wall; remove or move it before resizing","resize.disabled.partial-shared":"A neighbouring room uses only part of this wall, so it cannot be moved safely as one shared wall","resize.disabled.unequal-shared":"The neighbouring room uses different endpoints or wall length, so the walls cannot move together safely","resize.disabled.multiple-rooms":"Moving this wall would affect more than two rooms","resize.disabled.thickness-conflict":"The wall thickness cannot be preserved safely","resize.disabled.opening-conflict":"An opening on this wall cannot be moved safely","resize.disabled.invalid-geometry":"This wall cannot be resized without changing the plan structure","resize.limit_stopped":"Wall stopped: the next step would break a junction limit","resize.commit_failed":"Resize was cancelled because the final plan did not pass the geometry check","resize.preview_failed":"Resize stopped at the last safe position because the plan geometry could not be preserved","markup.opening":"Opening","markup.delete_room":"Delete room","history.undo":"Undo","history.redo":"Redo","history.undo_named":"Undo: {name} (Ctrl+Z)","history.redo_named":"Redo: {name} (Ctrl+Shift+Z / Ctrl+Y)","history.undo_empty":"Nothing to undo","history.redo_empty":"Nothing to redo","history.undone":"Undone: {name}","history.redone":"Redone: {name}","history.add_room":"Create room","history.split_room":"Split room","history.merge_rooms":"Merge rooms","history.resize_room":"Resize room","history.wall_thickness":"Change wall thickness","history.add_opening":"Add door or window opening","history.edit_opening":"Edit opening","history.move_opening":"Move opening","history.delete_opening":"Delete opening","history.delete_room_keep_walls":"Delete room, keep walls","history.delete_room_with_walls":"Delete room and walls","history.decor_add":"Add decor object","history.decor_edit":"Edit decor object","history.decor_move":"Move decor object","history.decor_transform":"Transform decor object","history.decor_delete":"Delete decor object","history.backdrop_transform":"Transform plan backdrop","history.device_move":"Move {name}","history.device_stale":"Device position history is no longer applicable and was cleared","opening.new":"New opening","opening.edit":"Opening","opening.door":"Door","opening.window":"Window","opening.gate":"Gate","opening.passage":"Open passage","opening.passage_binding_warning":"Saving will remove the open/close sensor and lock.","opening.invalid_passage_fields":"The open passage on plan “{room}” has unsupported settings: {fields}.","opening.type_label":"Type","opening.length_label":"Length, cm","opening.contact_label":"Open/close sensor","opening.lock_label":"Lock","opening.none":"— none —","opening.search_ph":"Search: name or entity id…","opening.invert":"Invert open/closed","opening.flip_h":"Hinge on the other jamb","opening.flip_v":"Opens to the other side","opening.open":"Open","opening.closed":"Closed","opening.locked":"Locked","opening.unlocked":"Unlocked","opening.state_unknown":"unavailable","opening.no_entities":"No sensors bound — a static symbol on the plan.","toast.opening_no_wall":"Click next to a room wall or independent wall","opening.host_partition":"Independent wall","opening.partition_orphan":"The independent wall for this opening no longer exists","opening.partition_jamb_margin":"Leave at least {distance} between the opening and the end of the wall","opening.rebind_partition":"Attach to another independent wall","confirm.delete_partition_openings_title":"Delete wall and openings?","confirm.delete_partition_openings_body":"This wall contains {count} opening(s). They will be deleted together.","confirm.delete_partition_openings_item":"• {type}, {length}","markup.hint_points":"points: {n} · Shift — 45° steps · Esc — finish chain · Ctrl+Z — undo a point · closing an area offers a room","markup.hint_start":"click a grid dot to start a wall chain","tip.lqi":"average zigbee signal:","tip.area":"area: {value}","info.device_header":"Device on the plan","info.model":"Model","info.state":"State","info.link":"Link","info.manuals":"Manuals","info.none":"No additional information","marker.new_device":"New device","marker.name_label":"Name (shown on the plan)","marker.name_ph":"Name","marker.binding_label":"Bind to an HA device","marker.binding_disabled":"disabled in Home Assistant","marker.virtual_option":"Virtual device (no binding)","marker.search_ph":"Search device / group…","marker.nothing_found":"nothing found","marker.room_label":"Room","marker.room_override":" (override placement)","marker.room_choose":"— select a room —","marker.room_auto":"— by device area (auto) —","marker.icon_label":"Icon","marker.icon_ph":"mdi:… (empty = auto)","marker.display_label":"Display","display.badge":"Icon + state","display.icon_ripple":"Icon + state and activity","display.static_icon":"Always static icon","marker.display_hint_badge":"The icon and dynamic plate show device state without the ordinary activity pulse. Red alarms remain visible.","marker.display_hint_icon_ripple":"The icon, dynamic plate and pulse show a short pulse for events and a continuous pulse for work, motion or presence. Red alarms have separate priority.","marker.display_hint_value":"A selected or automatically resolved Home Assistant value replaces the icon while the plate continues to show state. Red alarms remain visible.","marker.display_hint_static_icon":"The theme-aware shell and icon always stay the same. State, activity, unavailability and alarms do not change the face.","marker.static_alarm_warning":"This device can report alarms. Static display hides the marker's visual alarm indication.","marker.preview.title":"Display preview","marker.preview.actual":"Now","marker.preview.example":"Example","marker.preview.integration":"Provided by","marker.preview.source":"Display source","marker.preview.current_state":"Current state","marker.preview.result":"On the plan","marker.preview.details":"Source details","marker.preview.select_source":"Choose a Home Assistant device or entity to see its actual display.","marker.preview.unknown_provider":"Unknown integration","marker.preview.virtual_provider":"House Plan · virtual device","marker.preview.no_source":"No active source","marker.preview.no_state":"No current state","marker.preview.mixed_states":"Several different states","marker.preview.multiple_sources":"{n} sources","marker.preview.more_sources":"+{n} more","marker.preview.scaled":"The preview is scaled to {n}% to fit. The saved size is unchanged.","marker.preview.demo_short":"Show short activity","marker.preview.demo_continuous":"Show continuous activity","marker.preview.stop_continuous":"Stop continuous activity","marker.preview.demo_short_notice":"Short activity example; the actual device state is unchanged.","marker.preview.demo_continuous_notice":"Continuous activity example; the actual device state is unchanged.","marker.preview.demo_already_visible":"The current state already shows a real activity or alarm effect.","marker.preview.reduced_motion":"System reduced-motion is enabled, so ordinary activity is shown as a dot.","marker.preview.reason.neutral":"Neutral dark plate","marker.preview.reason.working":"Yellow plate: the device is working now","marker.preview.reason.working_activity":"Yellow plate and activity effect: the device is working now","marker.preview.reason.open":"Orange plate: physically open or unlocked","marker.preview.reason.cover_icon_state":"Neutral plate; the cover entity controls the displayed state and icon","marker.preview.reason.presence":"Activity effect while presence is detected","marker.preview.reason.event":"Short activity effect after a detected event","marker.preview.reason.transition":"Activity effect while the device is moving or changing state","marker.preview.reason.media_neutral":"Media devices stay on a neutral dark plate while available","marker.preview.reason.unavailable":"Subdued neutral plate: unavailable or off","marker.preview.reason.alarm":"Red alarm plate; alarm indication is always shown","marker.preview.reason.live_states_disabled":"Live-state styling is disabled for this card","marker.preview.reason.value_no_state":"No usable state value; the icon is shown instead","marker.preview.reason.value_ambiguous_sources":"Several possible value sources; the icon is shown instead","marker.preview.reason.value_non_scalar":"The source did not return a simple value; the icon is shown instead","marker.preview.reason.value_virtual":"A virtual device has no Home Assistant value; the icon is shown instead","marker.preview.reason.vacuum_live_plan_only":"Live vacuum position and trail are available only on the full plan","marker.preview.reason.hidden_design_preview":"The device is hidden on the plan; this design preview remains visible","marker.preview.reason.composite_power_source":"State comes from the device Power entity; auxiliary switches are ignored","marker.preview.reason.activity_display_disabled":"The selected display mode does not show ordinary activity effects","marker.preview.reason.ha_disabled":"The Home Assistant binding is disabled and will be hidden on the plan","marker.preview.reason.orphaned":"The saved Home Assistant binding can no longer be found","marker.preview.reason.static_icon":"Static mode: device state does not change the icon","marker.activity_color":"Activity pulse color","marker.ripple_size":"Activity pulse size","marker.activity_alarm_note":"Color and size affect ordinary activity only and do not change red alarms.","marker.pulse_a11y_alarm":"Alarm","marker.pulse_a11y_event":"Recent event","marker.pulse_a11y_presence":"Presence detected","marker.pulse_a11y_transition":"Changing state","marker.pulse_a11y_running":"Working","marker.state_a11y_neutral":"Default state","marker.state_a11y_working":"Working","marker.state_a11y_open":"Open","marker.state_a11y_locked":"Locked","marker.state_a11y_unlocked":"Unlocked","marker.state_a11y_alarm":"Alarm","marker.state_a11y_unavailable":"Unavailable","marker.lqi_a11y_low":"LQI {value}, low signal","marker.lqi_a11y_mid":"LQI {value}, medium signal","marker.lqi_a11y_high":"LQI {value}, high signal","marker.size_label":"Icon size / rotation","marker.angle_label":"Rotate","marker.model_label":"Model","marker.model_ph":"e.g. Aqara T&H","marker.link_label":"Link","marker.desc_label":"Description","marker.desc_ph":"Notes, specs…","marker.manuals_label":"Manuals (PDF etc.)","marker.sub_device":"device","marker.sub_z2m_group":" · Z2M group","marker.sub_group":"group","marker.sub_helper":"helper","space.new":"New space","space.copy_title":"Copy space","space.copy_name":"New space name","space.copy_fallback":"Space","space.copy_create":"Create copy","space.copy_optimize_title":"Optimize before copying?","space.copy_optimize_body":"Before creating “{name}”, House Plan must optimize the entire plan, including other spaces. Continue?","space.copy_optimize_confirm":"Optimize and copy","space.copy_error_changed":"The plan changed while confirmation was open. Review it and try again.","space.copy_error_source_missing":"The source space no longer exists. Reopen its settings and try again.","space.copy_error_source_invalid":"House Plan could not validate every wall in this space. Fix the source space and try again.","space.copy_error_spaces_limit":"House Plan already has the maximum number of spaces.","space.copy_error_partitions_limit":"This space has too many walls to copy.","space.copy_error_openings_limit":"This space has too many openings to copy.","space.copy_error_decor_limit":"This space has too many background objects to copy.","space.copy_error_columns_limit":"This space has too many columns to copy.","space.copy_error_opening_host":"One of the openings is no longer attached to a wall. Fix or delete it before copying.","space.copy_error_geometry":"The copy would create unsafe wall geometry. Fix the source space and try again.","space.copy_error_optimize_geometry":"Copy stopped because optimizing the entire plan is unsafe for one of the spaces.","space.header":"Space","space.title_label":"Title","space.title_ph":"e.g. Garage","space.plan_label":"Floor plan (background)","space.no_plan":"no plan image","space.plan_alt":"plan","room.new":"New room","room.name_label":"Display name","room.name_ph":"e.g. Terrace","room.area_label":"Home Assistant area (unassigned)","room.no_area_option":"— no area —","room.default_name":"Room","device.unnamed":"unnamed","device.light_group":"light group","device.fallback":"device","device.virtual":"virtual device","confirm.delete_room_title":'Delete room "{name}"?',"confirm.delete_room_body":"Choose whether the room's exclusive physical walls should remain. Walls shared with another room are always kept.","confirm.remove_marker_title":"Delete device from the plan?","confirm.remove_marker_body":"The device will disappear completely and stop contributing to plan data. You can add it again later.","confirm.erase_decor":"Erase the {kind} object? You can undo this action from the editor history.","confirm.delete_space_title":"Delete space?","confirm.delete_space_body":"The space, all its rooms and all its plan markup will be deleted.","confirm.delete_space_vac_routes":"Robot map assignments will also be removed: {count}.","space.delete_blocked":"This space is still used by {n} device(s). Move them to another space or delete them first.","toast.pos_save_failed":"Failed to save position: {err}","toast.no_entity":"The device has no suitable entity","toast.ha_disabled_action":"A Home Assistant object that is disabled cannot be used on the plan.","toast.ha_disabled_show_device":"A device disabled in Home Assistant cannot be shown on the plan. Enable it in Home Assistant first.","toast.ha_disabled_show_entity":"An entity disabled in Home Assistant cannot be shown on the plan. Enable it in Home Assistant first.","toast.ha_disabled_add":"A disabled Home Assistant object cannot be added to the plan. Enable it in Home Assistant first.","toast.ha_binding_unverified":"The object status could not be verified through the Home Assistant registry. Display and actions are temporarily unavailable.","toast.markup_needs_server":"Markup is available after the config is moved to the server","toast.space_order_changed":"Order changed. If any card pins its floor by number, check those panels.","toast.conflict":"Config was changed in another window — data refreshed, repeat your last action","toast.cfg_save_failed":"Failed to save config: {err}","toast.room_overlap":"The outline overlaps room “{name}” — rooms must not overlap","toast.contour_cannot_close":"The outline cannot close because it is degenerate or intersects itself","toast.merge_not_adjacent":"Only rooms that share a wall can be merged","toast.rooms_merged":"Rooms merged into “{name}”","toast.split_pick_wall":"Start the cut on the room’s wall","toast.split_bad_cut":"The cut must run wall to wall inside the room, without crossing walls or itself","merge.header":"Merge rooms","merge.hint":"The merged room keeps one name and one area. The other area is released — its devices leave the plan until another room claims it.","merge.keep":"Keep","merge.no_area":"no area","toast.room_saved":"Room saved ({n}). Devices added: {added}. Outline the next one or exit markup.","toast.room_saved_no_area":"Room saved ({n}, no area). Outline the next one or exit markup.","toast.marker_needs_server":"Device editing is available after the config is moved to the server","toast.virtual_name_required":"Enter a name for the virtual device","toast.marker_saved":"Device saved","toast.marker_removed":"Device deleted from the plan","toast.integration_missing":"The House Plan integration is not installed — management unavailable","toast.plan_formats":"Supported formats: SVG, PNG, JPG, WebP","toast.plan_required":"Upload a floor plan — it is required","toast.space_added_onboard":"Space added. Outline the rooms: click grid dots and close the contour.","toast.space_added":"Space added","toast.space_copied":"Space “{name}” created","toast.space_saved":"Space saved","toast.space_deleted":"Space deleted","toast.delete_failed":"Delete failed: {err}","toast.error":"Error: {err}","toast.toggle_target_unavailable":"Target “{name}” is unavailable — no action was performed","toast.toggle_targets_unavailable":"Targets are unavailable: {names}. No action was performed","toast.file_failed":'File "{name}" was not uploaded: {err}',"toast.files_attached":"Files attached: {n}","err.unknown":"unknown error","err.code":"code {code}","err.too_large":"file larger than {mb} MB","err.bad_ext":"unsupported type (PDF/image expected)","err.unauthorized":"administrator rights required","editor.title":"Title","editor.default_floor":"Initial space","editor.default_floor_missing":"Initial space “{id}” no longer exists. Choose another space.","editor.floor":"Fixed space","editor.floor_none":"— not fixed —","editor.floor_index":"YAML index {index} (preserved)","fixed_floor.loading":"Loading the fixed space…","fixed_floor.invalid_title":"The fixed space is unavailable","fixed_floor.invalid_body":"Check floor in the card configuration. The configured value is: {value}","editor.icon_size":"Icon size, % of plan width","editor.show_temperature":"Show temperature","editor.live_states":"Live states (on/off, open…)","editor.light_pools":"Light pools and wall shadows","editor.show_signal":"Show zigbee signal (LQI)","editor.language":"Interface language","editor.lang_auto":"Auto (HA profile)","title.icon_rules":"Icon rules: which MDI icon devices get by name","rules.title":"Icon rules","rules.hint":"Rules are checked top-down against “device name + model” (case-insensitive regex); the first match wins. When nothing matches, the entity device class decides, then the generic chip icon.","rules.pattern_ph":"regex, e.g. plug|socket","rules.icon_ph":"mdi:power-socket-de","rules.add":"Add rule","rules.reset":"Reset to defaults","rules.test_ph":"Try a device name…","rules.invalid":"invalid regex","rules.saved":"Icon rules saved","btn.up":"Up","btn.down":"Down","tap.info":"Device card","tap.more_info":"HA more-info dialog","tap.toggle":"Toggle state","marker.tap_label":"Tap action for this device","tap.toggle_note":"The resolved state is shown below. Secure devices are never toggled from the plan.","import.title":"Create spaces from HA floors","import.hint":"Your Home Assistant already knows these floors. Pick the ones to turn into plan spaces — you will upload a floor-plan image for each one next. Rooms are then outlined by hand on the plan.","import.start":"Create {n} space(s)","import.manual":"Start from scratch","import.progress":"Floor {i} of {n}","import.done":"Spaces created. Outline the rooms: click grid dots and close the contour.","btn.skip":"Skip","space.scale_label":"Scale (grid cell size)","space.cell_cm.help":"Links the grid to real dimensions: lengths, areas, wall thickness, opening sizes and glow radius depend on it. Changing it after drawing changes the calculated dimensions of the whole space without moving its points on the plan.","space.cell_cm.help.aria":"Help: space scale","space.scale_unit":"cm per cell","space.scale_unit_imperial":"in per cell","space.display_section":"Display","space.show_borders":"Always show room borders","space.zero_wall_style":"Zero-thickness walls","space.zero_wall_style.help":"Dashed zero-thickness walls pass Glow and sun rays, while solid ones block them as zero-area barriers. The choice affects every such wall in the space even when its line is hidden in View.","space.zero_wall_style.help.aria":"Help: zero-thickness wall style","space.zero_wall_dashed":"Dashed","space.zero_wall_solid":"Solid","space.show_names":"Show room names (drag to move)","space.room_color":"Border & name color","space.opacity":"Opacity","space.fill_label":"Room fill","space.fill_mode.help":"“Custom colour” is styling, while “Light”, “Temperature” and “LQI” use current Home Assistant data; Glow is enabled separately.","space.fill_mode.help.aria":"Help: room fill mode","fill.none":"None","fill.lqi":"Zigbee signal","fill.light":"Lights","fill.custom":"Custom color","space.custom_fill":"Fill color","space.source_file":"I have a floor-plan image","space.source_draw":"No image — I'll outline rooms by hand","fill.temp":"Temperature","tip.temp_avg":"average temperature:","tip.hum_avg":"average humidity:","space_card.button":"Open the space plan","space_card.not_found":"Space “{id}” not found","space_card.loading":"Loading…","continuity.restore_plan":"Restoring floor plan…","continuity.restore_connection":"Restoring device connection…","continuity.retry":"Try again","editor.space":"Space","editor.framing":"Framing","editor.fit_content":"All visible content","editor.fit_house":"Tight to house geometry","editor.show_button":"Show button","editor.button_label":"Button label","editor.button_target":"Target dashboard path","marker.sub_entity":"entity","title.general_settings":"General settings","title.export_pdf":"Save as PDF","pdf.title":"Save as PDF","pdf.dimensions":"Show dimensions and areas","pdf.decor":"Show furniture and other decor","pdf.room_names":"Show room names","pdf.backdrop":"Show backdrop","pdf.save":"Save","pdf.saving":"Creating…","pdf.failed":"Could not create the PDF.","pdf.too_large":"The images exceed the 25 MB PDF limit.","pdf.asset_failed":"A backdrop or decor image could not be loaded.","pdf.scale":"Scale 1:{n}","pdf.north":"North","gs.title":"General settings","gs.light_group":"Fill: lights","gs.light_on":"Lights on","gs.light_off":"All lights off","gs.temp_group":"Fill: temperature","gs.temp_cold":"Cold","gs.temp_ok":"Comfortable","gs.temp_hot":"Hot","gs.lqi_group":"Fill: zigbee signal","gs.lqi_low":"Weak signal","gs.lqi_high":"Strong signal","gs.reset":"Reset to defaults","gs.saved":"General settings saved","gs.radar_show_live":"Show live presence on the plan","gs.radar_show_live_hint":"Hides or shows all live radar targets. This does not start or stop observation recording.","radar.title":"Presence on the plan","radar.help":"Connect this marker to exact Home Assistant radar entities, place the sensor and choose its coordinate profile. Live positions are clipped to the selected room.","radar.help.aria":"Help: presence radar settings","radar.enabled":"Use this presence radar","radar.show_live":"Show live targets","radar.configure":"Configure radar","radar.configure_on_plan":"Configure on plan","radar.change_installation":"Change installation","radar.no_contour":"This room has no boundary. Radar points will not be clipped.","radar.discard_setup_title":"Discard radar setup?","radar.discard_setup":"The unsaved radar setup will be lost.","radar.step_place_mount":"Mark the physical sensor position","radar.step_place_heading":"Mark a point straight ahead of the sensor","radar.step_reference":"Mark reference position {n}, then start measurement","radar.step_check_reference":"Mark an independent check position","radar.start_measure":"Start measurement","radar.countdown":"Stand at the mark in {seconds} s","radar.capturing":"Stand still and alone while measuring…","radar.fit_ready":"Calibration is ready","radar.check_third":"Check at another position","radar.check_complete":"Independent check completed","radar.error_distance":"Position difference: {distance}","radar.ambiguous_target":"More than one target was reported. Repeat the measurement alone.","radar.insufficient_samples":"Not enough current coordinates. Retry or use manual setup.","radar.bad_references":"Choose separated references in different directions from the sensor.","radar.ambiguous_sources":"The measurements allow two equally plausible directions. Choose reference points that distinguish left from right.","radar.bad_fit":"Measurements do not match. Check units, mounting point and references.","radar.desktop_hint":"Use a computer for precise setup. Editing on touch devices is best effort.","radar.detected":"House Plan recognized radar metadata for this device. Review the exact sources before saving.","radar.detected_ld2450":"House Plan found an ESPHome LD2450 coordinate set. Review the exact X/Y sources before saving.","radar.additional_actions":"Additional actions","radar.declare":"This is a presence radar","radar.profile":"Data profile","radar.profile_esphome_ld2450_v1":"ESPHome LD2450 (X/Y targets)","radar.profile_cartesian_v1":"Cartesian targets (X/Y)","radar.profile_polar_v1":"Polar target (distance/angle)","radar.profile_range_v1":"Distance only","radar.profile_zones_v1":"Zone states","radar.profile_presence_v1":"Presence only","radar.room":"Radar room","radar.room_choose":"Choose a room","radar.target":"Target {n}","radar.axis_x":"X coordinate entity","radar.axis_y":"Y coordinate entity","radar.add_target":"Add target slot","radar.range_channel":"Range channel {n}","radar.add_range":"Add range channel","radar.presence_gate":"Presence gate entity","radar.swap_axes":"Swap X and Y axes","radar.axis_x_sign":"X direction","radar.axis_y_sign":"Y direction","radar.distance_source":"Distance entity","radar.angle_source":"Angle entity","radar.angle_unit":"Angle unit","radar.degrees":"Degrees","radar.radians":"Radians","radar.angle_zero":"Zero-angle direction","radar.angle_forward":"Forward","radar.angle_right":"Right","radar.angle_clockwise":"Angles increase clockwise","radar.zone_source":"Zone entity","radar.occupancy_source":"Presence entity","radar.count_source":"Target count entity","radar.availability_source":"Availability entity","radar.source_choose":"Choose an entity","radar.source_optional":"Optional","radar.source_missing":"currently unavailable","radar.saved_unsupported":"This saved radar setup is unsupported or incomplete. It remains inactive; remove it or update House Plan before configuring it again.","radar.occupancy":"Presence (on/off)","radar.count":"Count","radar.mount":"Position and direction","radar.mount_hint":"This is the physical sensor position. Moving its decorative marker does not change it.","radar.heading":"Direction, °","radar.range_cm":"Range, cm","radar.fov_deg":"Field of view, °","radar.unit":"Source unit","radar.mirror":"Mirror the left/right axis","radar.remove":"Remove radar settings","radar.invalid":"Complete the radar room, sources and position before saving.","radar.check_sources":"Check live data","radar.checking":"Checking…","radar.health":"Connection status","radar.live_summary":"Current targets: {targets}; range arcs: {ranges}","radar.health_ok":"Current data received","radar.health_off":"No targets detected","radar.health_stale":"Some coordinate data is out of date","radar.health_partial":"Some sources are current; others are out of date","radar.health_restricted":"Access to one or more sources is restricted","radar.health_incomplete":"The current radar report is incomplete","radar.health_position_unavailable":"Presence reported; current position unavailable","radar.health_unavailable":"Sensor data unavailable","radar.health_needs_setup":"Installation needs setup","radar.health_inconsistent":"The sources report conflicting values","radar.health_unknown":"Current state is unknown","radar.health_disabled":"Radar is disabled","radar.error_invalid_radar":"Check the radar settings.","radar.error_invalid_selection":"Select an existing room and valid sources.","radar.error_source_restricted":"You do not have access to all selected sources.","radar.error_rate_limited":"Too many requests. Try again shortly.","radar.error_not_ready":"Radar processing is not ready.","radar.error_conflict":"The plan changed. Reopen the radar setup and try again.","radar.error_source_unavailable":"One or more selected radar sources are unavailable.","radar.error_unsupported_capability":"This radar capability is not supported by the installed integration.","radar.report_age":"{seconds} s ago","space.show_lqi":"Show zigbee signal (LQI) next to devices","space.hide_decor":"Hide the decorative layer","space.hide_decor_tip":"Lines, shapes, labels and furniture stay where they are — visible in the backdrop editor, not on the plan.","space.hide_openings":"Hide openings","space.hide_openings_tip":"Door, window and gate symbols are not drawn, but the openings keep working: light passes through, the sun comes in at a window, contact sensors still open them. The plan editor always shows them.","gs.light_none":"No light sources","mode.plan":"Plan editor","mode.devices":"Device editor","display.value":"Value + state","marker.subarea":"no area, manual","device.new":"New device — open its editor to dismiss","opening.unlock_action":"Unlock","opening.lock_action":"Lock","opening.lock_pending":"Working…","title.close_editor":"Close editor (back to view)","title.add_device":"Add a device to the plan","devbar.add":"Add","devbar.rules":"Icon rules","device_inbox.button":"Devices","device_inbox.title":"Devices on the plan","device_inbox.search":"Search devices, entities and integrations…","device_inbox.add_virtual":"Add virtual device","device_inbox.tab_on_plan":"On plan","device_inbox.tab_available":"Available","device_inbox.tab_hidden":"Hidden","device_inbox.tab_readd":"Available again","device_inbox.only_new":"New only","device_inbox.show_entities":"Show entities","device_inbox.show_hidden":"Show hidden on plan","device_inbox.show_hidden.help":"Temporarily shows hidden and disabled markers as editor-only ghosts on the plan. Saved device visibility does not change.","device_inbox.show_hidden.help.aria":"Help: show hidden devices on the plan","device_inbox.new":"New","device_inbox.find":"Find on plan","device_inbox.edit":"Edit","device_inbox.hide":"Hide","device_inbox.show":"Show","device_inbox.add":"Add","device_inbox.readd":"Add again","device_inbox.hide_available":"Hide from list","device_inbox.show_more":"Show more","device_inbox.more_actions":"More actions","device_inbox.find_hidden_hint":"Enable “Show hidden on plan” first","device_inbox.show_disabled":"Activate this binding in Home Assistant before showing it","device_inbox.empty_on_plan":"No matching devices are on the plan yet.","device_inbox.empty_available":"No devices are available to add.","device_inbox.empty_hidden":"There are no hidden devices.","device_inbox.empty_readd":"No removed devices are available to add again.","device_inbox.reason_visible_auto":"Discovered automatically","device_inbox.reason_visible_explicit":"Added explicitly","device_inbox.reason_manual_hidden":"Hidden by user","device_inbox.reason_automatic_hidden":"Hidden automatically","device_inbox.reason_service_entry":"Service-only registry entry","device_inbox.reason_excluded_integration":"Integration “{integration}” excluded by discovery filters","device_inbox.reason_excluded_domain":"Non-spatial entity type","device_inbox.reason_grouped_light":"Represented by a room light group","device_inbox.reason_represented_by_parent":"Represented by its parent device","device_inbox.reason_removed":"Previously removed from the plan","device_inbox.reason_available":"Available to add to the plan","device_inbox.reason_no_bound_room":"HA area is not linked to a plan room","device_inbox.status_ha_disabled":"Disabled in Home Assistant","device_inbox.status_orphaned":"Binding is no longer present in Home Assistant","device_inbox.status_unverified":"Home Assistant registry is temporarily unavailable","device_inbox.saved":"Device list updated","device_inbox.filters_excluded":"Excluded integrations","device_inbox.filters_group_lights":"Group room lights into one marker","device_inbox.filters_preview_appear":"will appear: {count}","device_inbox.filters_preview_hide":"will disappear: {count}","device_inbox.filters_preview_lights":"lights affected: {count}","device_inbox.filters_reset":"Restore recommended","device_inbox.filters_save":"Save filters","device_inbox.filters_search_ph":"Add an integration…","device_inbox.filters_title":"Discovery filters","space.roomcard_section":"Room card shows:","space.label_temp":"Temperature","space.label_hum":"Humidity","space.label_lqi":"Average Zigbee signal","space.label_light":"Lights on/off","roomcard.light_on":"On","roomcard.light_off":"Off","roomcard.light_partial":"{on} of {total}","toast.split_pick_inside":"Intermediate cut points must be inside the room","mode.decor":"Background editor","decor.select":"Select","decor.line":"Line","decor.rect":"Rectangle","decor.ellipse":"Oval","decor.text":"Text","decor.erase":"Erase","decor.erase_confirm_title":"Erase object?","decor.color":"Color","decor.width":"Line width","decor.line_style":"Line style","decor.line_style_solid":"Solid","decor.line_style_dashed":"Dashed","decor.fill":"Fill","decor.fill_color":"Fill color","decor.length":"Length","decor.size":"Size","decor.flip_h":"Flip horizontally","decor.flip_v":"Flip vertically","decor.angle":"Rotation angle, °","decor.text_size":"Text size","decor.backdrop_properties":"Plan backdrop properties","decor.text_title":"Text label","decor.object_title":"Edit {kind}","decor.text_label":"Text","decor.live_group":"Insert HA variable","decor.live_entity":"Entity","decor.live_entity_ph":"choose an entity","decor.live_attr":"Value","decor.live_attr_ph":"choose state or attribute","decor.live_state":"State","decor.backdrop":"Backdrop image","decor.backdrop_hint":"Drag to move; pull a corner to resize; use the top handle to rotate. Shift changes proportions or frees the angle.","decor.backdrop_reset":"Reset the picture","decor.backdrop_reset_done":"The picture is back at its original place and size","marker.icon_auto":"Auto: {icon} (by icon rules; pick one to override)","marker.icon_pin_auto":"Pin","mode.plan_tip":"Plan editor — the geometry of the home: draw and split/merge rooms, bind them to HA areas, place doors, windows and gates, move room cards, set the scale","mode.devices_tip":"Device editor — everything about icons: drag to position, click to edit binding/icon/display, add virtual devices, icon rules","mode.decor_tip":"Background editor — purely visual decor under the plan: lines, rectangles, ovals and text labels that never react to clicks","space.glow_enabled":"Light-source glow","gs.glow_group":"Light-source glow","gs.glow_base":"House darkness","gs.glow_light":"Default light color / intensity","gs.wall_group":"Walls","gs.wall_fill":"Wall fill","gs.glow_radius":"Glow radius","gs.glow_radius.help":"Sets the default glow radius in metres or feet; a device-specific radius overrides it.","gs.glow_radius.help.aria":"Help: default glow radius","gs.unit_m":"m","gs.unit_ft":"ft","marker.controls_label":"Controls other light sources","marker.controls.help":"With the “Toggle state” action, the listed sources toggle together with this marker. Their glow stays at their own markers, and the link alone does not turn the controlling marker into a light source.","marker.controls.help.aria":"Help: controlling other light sources","marker.controls_filter":"Search lights and switches…","info.controls":"Controls","marker.glow_radius_label":"Glow radius","marker.glow_radius.help":"Sets the glow radius in metres or feet; an empty value uses the radius from general settings.","marker.glow_radius.help.aria":"Help: glow radius","markup.wallthick":"Thickness","markup.select":"Select","title.markup_wallthick":"Thickness — click a wall to set its thickness from 0 to 100 cm.","markup.hint_wallthick":"click a wall · Esc closes without applying","wallthick.field":"Thickness","wallthick.unit_cm":"cm","wallthick.unit_in":"in","wallthick.apply_room":"Apply to all walls of this room","markup.draw_wall_title":"Thickness of each new wall segment (0–100 cm). Shared walls keep the existing value.","room.queue_progress":"Room {current} of {total}","toast.wall_rooms_saved":"Created rooms: {n}","toast.wall_chain_saved":"Wall chain saved","toast.wallthick_pick":"Click a wall","toast.wallthick_set":"Wall thickness set","toast.wallthick_cleared":"Wall thickness removed","toast.physical_range":"Enter a value from {min} to {max} {unit}","toast.zero_wall_opening_conflict":"Remove the opening on this wall segment first.","toast.zero_wall_ambiguous":"The wall segment is ambiguous. Simplify or adjust the junction.","toast.zero_wall_migration_blocked":"The space was not converted: {reason}. No data was changed.","toast.physical_angle":"Enter a rotation angle from 0° up to, but not including, 90°","toast.physical_limit":"The space has reached the limit for this type of geometry","toast.geometry_unsafe":"Change canceled: wall geometry could not be built safely.","junction.limit_angle":"The angle between walls is too sharp: {actual}°, minimum {limit}°.","junction.limit_valence":"Too many walls meet in one node: {actual}, maximum {limit}.","junction.limit_length":"The wall segment is too short: {actual} cm, minimum {limit} cm.","junction.limit_distance":"Walls and nodes are too close: {actual} cm, minimum {limit} cm.","junction.limit_clearance":"No room interior is left: {actual} cm², minimum {limit} cm².","junction.limit_check_failed":"The junction check could not run — the change was not saved","toast.wall_model_migration_blocked":"The wall model could not be updated: {reason}. The plan was not changed. Run “Optimize plans”; if the error repeats, fix the conflicting wall geometry.","toast.wall_model_client_outdated":"Update the card and reload the page before editing the plan.","wall_model.reason.invalid-room":"invalid room contour","wall_model.reason.zero-length":"zero-length wall segment","wall_model.reason.third-owner":"wall shared by more than two rooms","wall_model.reason.duplicate-id":"conflicting wall identifiers","wall_model.reason.thickness-conflict":"conflicting wall thickness values","wall_model.reason.opening-host":"opening cannot be assigned to one wall","toast.delete_room_pick":"Click inside the room you want to delete","toast.plan_snap_ambiguous":"Zoom in to choose the wall node","toast.wall_repair_ambiguous":"The room outline has more than one possible connection. Zoom in and connect it explicitly.","toast.wall_repair_too_large":"The gap is larger than 2 cm. Connect the walls before creating the room.","toast.wall_repair_changed":"The wall geometry changed. Try creating the room again.","toast.opening_on_zero_wall":"Openings cannot sit on a zero-thickness wall","marker.from_ha_option":"Pick from the HA list","marker.show_entities":"Show entities","marker.show_entities_tip":"Adds not only devices to the list, but all their entities too","marker.pick_ph":"Choose a device…","room.open_area":"Open the HA area","room.fit_action":"Fit room {name}","view.volumetric":"Volumetric view","view.flat":"Flat view","kiosk.title":"This screen's sizes","kiosk.hint":"Stored on this device only — every wall tablet or TV can have its own comfortable sizes.","kiosk.icon_scale":"Device icon size","kiosk.font_scale":"Room card text size","editor.kiosk":"Wall device (kiosk) mode","editor.cycle":"Auto-switch spaces every N seconds (kiosk, 0 = off)","room.settings_title":"Room settings","room.settings_section":"Room settings (override the space)","room.fill_label":"Fill in THIS room","fill.inherit":"As the space","room.custom_fill_space":"Space color","room.custom_fill_own":"Room color","room.temp_range_label":"Comfort range","room.temp_range_min":"Lower comfort-temperature bound","room.temp_range_max":"Upper comfort-temperature bound","room.temp_range_reset":"As the space","room.temp_range.help":"This range applies only to this room. Empty fields inherit the corresponding space bounds; if the bounds are reversed, House Plan uses the smaller value as the lower bound and the larger value as the upper bound.","room.temp_range.help.aria":"About the room comfort range","room.temp_src_label":"Temperature source","room.hum_src_label":"Humidity source","room.src_average":"Average over the room's sensors (default)","room.src_pick":"A specific HA device or entity","room.src_ph":"Choose a source…","toast.room_updated":"Room updated","space.card_font":"Room-card font size (whole space)","room.sizes_section":"Font sizes","room.name_scale":"Room name size","room.label_scale":"Metrics size","preview.room_name":"Living room","toast.cfg_reload_failed":"Could not reload the plan from the server: {err}","toast.locale_load_failed":"Could not load the language pack. English is used until the page reloads.","toast.furniture_art_load_failed":"Could not load the furniture drawings. Reload the page to show them.","room.settings_short":"Room settings","room.unnamed":"Unnamed room","marker.use_climate_temp":"Include the device temperature in the room","marker.use_climate_temp_tip":"Adds an air conditioner or thermostat current_temperature to the room average. Configure the external value badge separately below.","marker.value_badge_title":"Value badge","marker.value_badge.help":"Shows one selected value next to the icon. It does not affect room metrics, light, Glow or the tap action.","marker.value_badge.help.aria":"Help: device value badge","marker.value_badge_enabled":"Show a value badge","marker.value_badge_source":"Value","marker.value_badge_source.help":"Choose a specific state, supported attribute, or derived value of this device.","marker.value_badge_source.help.aria":"Help: value badge source","marker.value_badge_position":"Position","marker.value_badge_position.help":"The chosen side stays fixed and does not flip automatically at a plan edge.","marker.value_badge_position.help.aria":"Help: value badge position","marker.value_badge_right":"Right","marker.value_badge_bottom":"Below","marker.value_badge_left":"Left","marker.value_badge_top":"Above","marker.value_badge_empty":"This device has no available values","marker.value_badge_static":"A static icon does not show live values. The setting is preserved.","marker.value_badge_missing":"Source unavailable","marker.value_badge_missing_hint":"The saved source is currently unavailable. Keep it, disable the badge, or choose another value.","marker.value_badge_duplicate":"The same value is already shown inside the icon.","marker.value_badge_state":"State · {name}","marker.value_badge_marker_state":"Light-source state · {name}","marker.value_badge_lqi":"Average Zigbee signal quality","marker.value_badge_attr_current_temperature":"Current temperature · {name}","marker.value_badge_attr_temperature":"Target temperature · {name}","marker.value_badge_attr_current_humidity":"Current humidity · {name}","marker.value_badge_attr_humidity":"Humidity · {name}","marker.value_badge_attr_current_position":"Position · {name}","marker.value_badge_attr_percentage":"Speed · {name}","marker.value_badge_attr_brightness":"Brightness · {name}","marker.value_badge_attr_volume_level":"Volume · {name}","marker.value_badge_attr_battery_level":"Battery · {name}","marker.value_badge_attr_fan_speed":"Fan speed · {name}","marker.value_source":"Value source","marker.value_source.help":"Choose the value that replaces the icon. The tap action does not change.","marker.value_source.help.aria":"Help: value face source","marker.value_source_auto":"Automatic (as before)","marker.value_source_missing_hint":"The saved source is currently unavailable. The face shows — until it recovers or you choose another value.","marker.light_role_label":"Is this device a light source?","marker.light_role.help":"“Auto” uses the bound device's resolved role, “Always” forces its own source and “Never” excludes it; linked lights above remain independent.","marker.light_role.help.aria":"Help: whether this device is a light source","marker.light_role_auto_yes":"Auto (light source)","marker.light_role_auto_no":"Auto (not a light source)","marker.light_role_always":"Always a light source","marker.light_role_never":"Never a light source","marker.light_entity_label":"Leading light entity","marker.light_entity.help":"For a composite device, choose the entity whose state, colour and brightness represent this plan source. The automatic fallback remains compatible with older plans.","marker.light_entity.help.aria":"Help: leading light entity","marker.light_entity_auto":"Automatic ({entity})","marker.light_entity_none":"no controllable entity","marker.light_entity_missing":"The saved entity {entity} is unavailable. House Plan temporarily uses {fallback}; the saved choice will be restored if it returns.","marker.toggle_entity_label":"Entity to toggle","marker.toggle_entity.help":"For a composite device, choose the exact own light or switch operated by a tap. Automatic keeps the previous target rules and is independent from the leading light entity.","marker.toggle_entity.help.aria":"Help: entity to toggle","marker.toggle_entity_auto":"Automatic ({entity})","marker.toggle_entity_none":"no own controllable entity","marker.toggle_entity_missing":"The saved entity {entity} is no longer among this marker’s selectable channels. House Plan temporarily uses {fallback}; the saved choice will be restored if it returns.","marker.glow_color_label":"Glow colour and brightness","marker.glow_mode.help":"Use live source values, override only its colour, or fix both colour and brightness. The minimum is 1%; to disable the source, choose “Never”.","marker.glow_mode.help.aria":"Help: glow colour and brightness","marker.glow_mode_auto":"From source","marker.glow_mode_color":"Set colour","marker.glow_mode_fixed":"Set colour and brightness","marker.glow_color":"Glow colour","marker.glow_brightness":"Brightness","marker.glow_disabled_never":"Glow settings are unavailable because this marker is explicitly not a light source.","marker.glow_disabled_auto":"Auto mode found no spatial light source for this marker.","marker.glow_disabled_no_entity":"No active controllable Home Assistant entity is available for this spatial source.","marker.glow_passive_hint":"This source has no own Home Assistant data. Set its colour and brightness manually; its radius remains available.","marker.control_broken":"Saved source is missing or no longer marked as a light","marker.control_missing_label":"Missing plan light","marker.control_passive":"passive source","toast.marker_control_cycle":"This link would create a circular chain of light controls.","toast.marker_binding_required":"Choose a Home Assistant device before linking another light source.","confirm.unlock_title":"Unlock?","confirm.unlock_body":"House Plan will send an unlock command to this lock.","toast.files_migrate_failed":"Attachments could not be moved to the new binding, links keep pointing at the old files: {err}","space.pick_saved":"Already uploaded","space.pick_saved_hint":"Plans stored on the server, including ones you detached earlier","space.no_saved":"No plans stored on the server yet.","space.loading":"Loading…","space.used_by":"in use: {list}","space.in_use":"A space still uses this plan — detach it first","btn.use":"Use","confirm.delete_plan_title":"Delete plan file?","confirm.delete_plan_body":"The file will be deleted from the server. This action cannot be undone.","toast.plans_list_failed":"Could not list the stored plans: {err}","toast.plan_delete_failed":"Could not delete the plan: {err}","marker.hide":"Hide","marker.hide_tip":'The device will disappear from the plan after saving but will still count toward the room signal. Restore it through the "Devices" catalog in the device editor.',"marker.show":"Show","marker.show_tip":"The device will appear on the plan again after saving.","marker.hidden_ghost":"Device hidden by the user","marker.ha_disabled_device":"The device is disabled in Home Assistant and hidden from the plan.","marker.ha_disabled_entity":"The entity is disabled in Home Assistant and hidden from the plan.","marker.ha_disabled_all_entities":"The device has no active Home Assistant entities, so it is hidden from the plan.","marker.ha_registry_limited":"The full Home Assistant registry is unavailable to this user. The unverified object cannot be shown or used for now.","marker.delete_tip":"Completely delete the device from the plan and every aggregate. You can add it again later.","tap.run":"Run automation/script/scene","tap.none":"Do nothing","marker.run_target_label":"What to run","marker.run_search_ph":"Search: automation, script or scene…","marker.run_target_gone":"Target {id} not found — pick again","marker.tap_confirm":"Ask for confirmation","marker.tap_confirm_tip":"Show a confirmation dialog before acting — a guard against accidental taps.","marker.toggle_hint_single":"Target: {name} ({id}).","marker.virtual_light_target":"Virtual light: {name}.","marker.virtual_light_current":"Manual state: {state} → {effect}.","marker.virtual_light_state_on":"on","marker.virtual_light_state_off":"off","marker.toggle_hint_group":"Will toggle {count} source(s): {names}.","marker.toggle_hint_current":"Now: {state} → {effect}.","marker.toggle_hint_group_current":"Currently on: {on} of {count} → {effect}.","marker.toggle_hint_skipped":"Will be skipped ({count}): {targets}.","marker.toggle_effect_turn_on":"will turn on","marker.toggle_effect_turn_off":"will turn off","marker.toggle_effect_open":"will open","marker.toggle_effect_close":"will close","marker.toggle_effect_stop":"will stop","marker.toggle_effect_toggle":"state will toggle","marker.toggle_skip_missing":"not found","marker.toggle_skip_ha_disabled":"disabled in HA","marker.toggle_skip_unavailable":"unavailable","marker.toggle_skip_unsupported":"toggle is unsupported","marker.toggle_skip_secure":"blocked for security","marker.toggle_none_no_binding":"This device has no binding, so there is no state to toggle. Tapping will do nothing.","marker.toggle_none_no_actionable_entity":"This device has no state that can be toggled. Tapping will do nothing.","marker.toggle_none_configured_targets_missing":"The configured targets are unavailable. The device's own entity will not be substituted for them.","marker.toggle_none_ha_disabled":"The target is disabled in Home Assistant and cannot be used on the plan.","marker.toggle_none_unavailable":"The target is currently unavailable. Tapping will do nothing.","marker.toggle_none_unsupported":"Home Assistant exposes no safe toggle operation for this entity. Tapping will do nothing.","marker.toggle_none_secure":"Toggling locks, alarms and secure gates from the plan is blocked for security.","run.automation":"automation","run.script":"script","run.scene":"scene","confirm.tap_run":'Run "{name}"?',"confirm.tap_toggle":'Toggle "{name}"?',"confirm.current_state":"Current state: {state}","confirm.expected_state":"After switching: {state}","confirm.group_current":"on {on} of {total}","confirm.group_all_on":"all are on","confirm.group_all_off":"all are off","confirm.unavailable_targets":"Unavailable: {count}","confirm.expected_by_ha":"Home Assistant will determine the state","confirm.state_on":"On","confirm.state_off":"Off","confirm.state_open":"Open","confirm.state_closed":"Closed","confirm.state_opening":"Opening","confirm.state_closing":"Closing","confirm.state_stopped":"Stopped","confirm.state_unknown":"Unknown","toast.run_started":"Started: {name}","toast.run_target_missing":"Run target not found — check the device settings","toast.run_target_required":"Pick an automation, script or scene","toast.tap_target_changed":"The action target changed. Try again.","toast.virtual_light_toggle_failed":"Could not toggle the virtual light: {err}","toast.value_badge_source_required":"Choose a value for the badge","btn.run":"Run","vac.section":"Robot vacuum: live position","vac.autocal":"Set up automatically","vac.live":"Live position on the plan","vac.trail":"Show the robot's path","vac.autocal_no_rooms":"The integration reports no room list — open “Fit manually”","vac.route_warn_unmapped":"The robot is cleaning a map that is not assigned to any floor","vac.route_warn_needs_calibration":"The map is assigned to a floor but not calibrated","vac.route_warn_ambiguous":"Two maps are indistinguishable — no floor was chosen","vac.route_warn_missing_space":"The space of this map was deleted","vac.autocal_no_match":"Room names did not match (need ≥3 in common) — open “Fit manually”","vac.autocal_done":"Done: bound via {rooms} rooms. Start a cleanup and check","vac.cal_need_pos":"The robot is not reporting coordinates — start a cleanup and pause it","vac.cal_done":"Calibration saved. Start a cleanup and check","vac.cal_cancelled":"Calibration cancelled","vac.fit":"Fit manually","vac.fit_hint":"Drag the robot map into place, stretch by the corners","vac.fit_rotate":"Rotate 90°","vac.fit_mirror":"Mirror","vac.trail_never":"Never","vac.trail_cleaning":"While cleaning","vac.trail_always":"Always","gs.bg_group":"Stage background","gs.bg_color":"Background around the plan","gs.bg_default":"Theme default","gs.bg_theme":"theme default","gs.bg_mode":"Plan background","gs.bg_mode.help":"“Follows the Sun” uses sun.sun, falling back to the browser's local clock; Static always shows the selected colour.","gs.bg_mode.help.aria":"Help: general plan background","gs.bg_static":"Static color","gs.bg_daynight":"Follows the Sun","gs.sun_group":"Sun","gs.sun_missing":"The sun.sun entity was not found — the background follows your local clock; window rays are unavailable.","gs.north":"North on the plan","gs.north.help":"The angle is measured clockwise from the plan's upward vertical; north is required for window rays, not for the “Follows the Sun” background.","gs.north.help.aria":"Help: general north direction","gs.north_ph":"not set","gs.north_clear":"Clear","gs.north_letter":"N","gs.sun_rays":"Sunlight through windows","gs.about_version":"Houseplan Card v{v}","gs.about_github":"GitHub · docs & issues","gs.about_telegram":"Telegram chat","support.title":"Help & feedback","space.bg_color":"Background around the plan","space.bg_inherit":"Inherit general","space.bg_inherited":"inherits general settings","space.bg_mode":"Plan background","space.bg_mode.help":"Inherit the general background or override this space with a static colour or “Follows the Sun”.","space.bg_mode.help.aria":"Help: space background","space.north":"North on the plan (override)","space.north.help":"Overrides general north for this space; the angle is measured clockwise from the plan's upward vertical and is used by window rays.","space.north.help.aria":"Help: north for this space","space.north_inherited":"inherited: {v}","space.sun_rays":"Sunlight through windows","space.sun_inherit":"Inherit general","space.sun_on":"On","space.sun_off":"Off","canvas.far_objects":"{n} object(s) far from the plan","canvas.show_far":"Show","canvas.home_tip":"The plan is over there — click to fit it","gs.grid_group":"Plan maintenance","gs.grid_hint":"Updates data models, aligns plan elements to the grid and merges redundant wall fragments. An exact report is shown before anything is stored.","gs.align_all":"Optimize plans","gs.align_title":"Optimize plans","gs.align_none":"All plans already use the current optimized data model.","gs.optimize_no_automatic_changes":"There are no automatic changes to apply. Review the items below.","gs.align_count":"{n} of {total} elements will move, by at most {cm} cm.","gs.align_where":"The largest shift is in “{s}”.","gs.align_turned":"Openings whose angle is corrected: {n}.","gs.align_preflight_failed":"Could not safely verify the geometry of the following spaces: {spaces}{more}.","gs.align_preflight_hint":"Plans were not changed. Copy the diagnostics with the button below and attach them to the bug report together with a space export.","gs.preflight_reason_prepare-exception":"Could not prepare the space geometry (exception while building the model)","gs.preflight_reason_wall-null":"The wall body did not build (the union came back empty)","gs.preflight_reason_wall-degraded-extra":"The wall body degraded with extra geometry","gs.preflight_reason_wall-failed-core":"The wall body core failed to assemble","gs.preflight_reason_wall-exception":"Wall construction threw an exception","gs.preflight_reason_floor-null":"The floor outline did not build","gs.preflight_reason_floor-exception":"Floor construction threw an exception","gs.preflight_copy":"Copy diagnostics","gs.preflight_copied":"Diagnostics copied","gs.preflight_update_hint":"The card and integration versions differ — update House Plan and retry.","gs.align_preflight_space":"Space {n}","gs.align_preflight_more":", and {n} more","gs.optimize_changes":"Model migrations: {m}; spaces updated: {c}; noisy coordinate values removed: {p}; merged real-wall fragments: {w}; merged zero-thickness wall fragments: {s}; independent walls: {i}.","gs.zero_walls_migrated":"Virtual wall spans converted: {n}.","gs.wall_segments_migrated":"Wall segments stabilised: {n}.","gs.room_drafts_migrated":"Unfinished contours converted to ordinary walls: {drafts}; wall segments: {segments}.","gs.optimize_lattice_summary":"Noisy coordinate values canonicalized: {n}; maximum movement: {cm} cm.","gs.optimize_lattice_space":"{space}: coordinate values canonicalized: {n}; off-grid values left unchanged: {far}.","gs.optimize_coincident_partitions":"Hidden independent wall sections absorbed into room walls: {n}.","gs.optimize_openings_rehosted":"Openings reattached to room walls: {n}.","gs.optimize_walls_straightened":"Walls straightened: {n}; maximum movement: {cm} cm.","gs.optimize_walls_straightened_where":"Largest wall correction: {s}.","gs.optimize_walls_straighten_skipped":"Near-axis walls left unchanged because they could not be repaired safely: {n}.","gs.optimize_glow_migration":"Legacy Glow: {spaces} spaces → no data fill + independent Glow; {rooms} rooms → inherited data fill + independent Glow.","gs.optimize_references":"References repaired: spaces — {spaces}; rooms — {rooms}; positions — {positions}; devices detached from missing spaces — {detached}.","gs.optimize_reference_more":", and {n} more","gs.optimize_orphans_removed":"Forgotten records removed: {total} — room labels: {rooms}; devices: {devices}; group markers: {groups}. They belonged to spaces deleted earlier.","gs.optimize_live_positions":"Old positions in deleted spaces belong to existing objects: {n}{names}. They will be kept.","gs.optimize_live_positions_remove":"Old positions in deleted spaces belong to existing objects: {n}{names}. They are selected for removal.","gs.optimize_live_names":": {names}{more}","gs.optimize_live_remove":"Remove old positions","gs.optimize_live_keep":"Keep old positions","gs.optimize_live_selected":"Old positions will be removed after Optimize is applied.","gs.optimize_unverified":"Could not safely verify positions: {n}. They were left unchanged.","gs.optimize_registry_limited":"Full administrator access to the Home Assistant registries is required for a safe check.","gs.optimize_vacuum_warning":"Vacuum room mappings that still need review: {n}.","gs.optimize_details":"Details","gs.optimize_details_more":"And {n} more records.","gs.optimize_detail_removed":"will be removed","gs.optimize_detail_live":"will be kept","gs.optimize_detail_unverified":"not verified","gs.optimize_detail_room_label":"room label","gs.optimize_detail_device":"device","gs.optimize_detail_group":"group marker","gs.optimize_detail_unknown":"unknown owner","gs.optimize_detail_item":"{status}: {kind} {id}; old space {space}","gs.align_warn":"Elements deliberately placed between grid nodes will move. One undo is available after the operation, only until the next plan edit.","gs.align_run":"Optimize","gs.align_done":"Plans optimized: {n} elements moved, {m} records maintained, {r} references repaired","gs.optimize_undo":"Undo last optimization","gs.optimize_undone":"The last optimization was undone","decor.furniture":"Furniture","decor.image":"Image","decor.image_title":"Custom images","decor.image_upload":"Upload image","decor.image_replace":"Replace image","decor.image_uploading":"Uploading…","decor.image_asset":"Image file","decor.image_pick_hint":"Upload an image or choose one already used in House Plan.","decor.image_place_hint":"Click on the plan to place the image.","decor.image_none":"No uploaded images yet.","decor.image_unavailable":"Image unavailable","decor.image_used":"Used in {n} objects","decor.image_upload_failed":"Could not upload the image: {err}","decor.image_error_capacity":"The custom image storage limit has been reached.","decor.image_in_use":"Remove every placed copy before deleting this image.","decor.image_delete_title":"Delete image file?","decor.image_delete_message":"Delete “{name}” from House Plan? This cannot be undone.","furn.title":"Furniture library","furn.symbol":"Symbol","furn.group_furniture":"Furniture","furn.group_appliance":"Appliances","furn.group_sanitary":"Plumbing","furn.group_other":"Other","furn.width":"Width","furn.depth":"Depth","furn.back_to_categories":"All categories","furn.pick_hint":"Choose a category, then a symbol.","furn.place_hint":"Click on the plan — the piece lands against the nearest wall. Shift places it free.","furn.cat_air_conditioner":"Air conditioners","furn.cat_armchair":"Armchairs","furn.cat_bathtub":"Bathtubs","furn.cat_bed":"Beds","furn.cat_bidet":"Bidets","furn.cat_boiler":"Water heaters","furn.cat_chair":"Chairs","furn.cat_coffee_table":"Coffee tables","furn.cat_cooktop":"Cooktops","furn.cat_dining_table":"Dining tables","furn.cat_dishwasher":"Dishwashers","furn.cat_dryer":"Dryers","furn.cat_fireplace":"Fireplaces","furn.cat_fridge":"Refrigerators","furn.cat_kitchen_cabinet":"Kitchen cabinets","furn.cat_kitchen_sink":"Kitchen sinks","furn.cat_nightstand":"Cabinets","furn.cat_plant":"Plants","furn.cat_rug":"Rugs","furn.cat_shelving":"Shelving","furn.cat_shower":"Showers","furn.cat_sink":"Sinks","furn.cat_sofa":"Sofas","furn.cat_stairs":"Stairs","furn.cat_toilet":"Toilets","furn.cat_tv":"Televisions","furn.cat_wardrobe":"Wardrobes","furn.cat_washer":"Washing machines","furn.cat_work_table":"Desks","furn.sym_sofa":"Two-seat sofa","furn.sym_sofa_three_seat":"Three-seat sofa","furn.sym_sofa_corner_right":"Right sectional sofa","furn.sym_armchair":"Soft armchair","furn.sym_armchair_office":"Office chair","furn.sym_coffee_table":"Rectangular coffee table","furn.sym_coffee_table_round":"Round coffee table","furn.sym_coffee_table_oval":"Oval coffee table","furn.sym_coffee_table_rounded":"Rounded coffee table","furn.sym_table_dining":"Rectangular dining table","furn.sym_table_round":"Round table","furn.sym_table_dining_oval":"Oval dining table","furn.sym_table_dining_rounded":"Rounded dining table","furn.sym_chair":"Chair","furn.sym_chair_bar":"Bar stool","furn.sym_desk":"Rectangular desk","furn.sym_desk_corner":"Corner desk","furn.sym_bed_double":"Double bed","furn.sym_bed_single":"Single bed","furn.sym_nightstand":"Bedside table","furn.sym_cabinet_tv":"TV cabinet","furn.sym_cabinet_shoe":"Shoe cabinet","furn.sym_cabinet_sink":"Sink cabinet","furn.sym_wardrobe":"Wardrobe","furn.sym_bookshelf":"Bookcase","furn.sym_wall_unit":"Wall unit","furn.sym_kitchen_floor":"Kitchen floor module","furn.sym_kitchen_floor_corner":"Kitchen floor corner module","furn.sym_kitchen_wall":"Kitchen wall module","furn.sym_kitchen_wall_corner":"Kitchen wall corner module","furn.sym_shelf_floor":"Floor shelving unit","furn.sym_shelf_wall":"Wall shelf","furn.sym_fridge":"Fridge","furn.sym_stove":"Four-burner cooktop","furn.sym_cooktop_two":"Two-burner cooktop","furn.sym_dishwasher":"Dishwasher","furn.sym_washer":"Washing machine","furn.sym_dryer":"Tumble dryer","furn.sym_tv":"TV on stand","furn.sym_tv_wall":"Wall-mounted TV","furn.sym_ac":"Air conditioner","furn.sym_water_heater":"Water heater","furn.sym_toilet":"Floor-standing toilet","furn.sym_toilet_built_in":"Built-in toilet","furn.sym_bathtub":"Rectangular bathtub","furn.sym_bathtub_corner":"Corner bathtub","furn.sym_shower":"Shower","furn.sym_sink":"Washbasin","furn.sym_kitchen_sink":"Single kitchen sink","furn.sym_kitchen_sink_double":"Double kitchen sink","furn.sym_bidet":"Floor-standing bidet","furn.sym_bidet_built_in":"Built-in bidet","furn.sym_stairs":"Stairs","furn.sym_fireplace":"Fireplace","furn.sym_plant":"Plant","furn.sym_rug":"Rug","common.yes":"Yes","common.no":"No","vac.diag_source":"Source","vac.diag_platform":"Integration","vac.diag_status":"Status","vac.diag_position":"Position","vac.diag_rooms":"Rooms","vac.diag_rooms_value":"{total} · {matched} names match · {readiness}","vac.autocal_ready":"auto-calibration available","vac.autocal_not_ready":"need 3 matching names","vac.diag_path":"Integration path","vac.diag_map":"Map ID","vac.source_none":"not selected","vac.source_status_ok":"Ready","vac.source_status_missing":"Missing","vac.source_status_disabled":"Disabled in Home Assistant","vac.source_status_unavailable":"Unavailable","vac.source_status_unverified":"Cannot verify with current permissions","vac.source_status_unsupported":"No position data","vac.source_status_none":"No source","vac.source_banner_missing":"The saved source no longer exists. It was not replaced automatically; choose another source or restore it in Home Assistant.","vac.source_banner_disabled":"The saved source is disabled in Home Assistant. Enable it there or choose another source.","vac.source_banner_unverified":"Current Home Assistant permissions cannot verify this saved source. It remains pinned and will not be replaced automatically.","vac.choose_source":"Choose source","vac.source_auto":"Automatic","vac.source_auto_hint":"Use a compatible entity from this device","vac.all_cameras":"All cameras","vac.all_cameras_warn":"A camera may not provide robot data. Choose one only if it is your vacuum map.","vac.all_cameras_empty":"No other camera entities found.","vac.platform_unknown":"unknown integration","vac.cap_position":"position","vac.cap_rooms_short":"rooms","vac.cap_path":"path","vac.cap_map":"map ID","vac.cap_none":"no robot data detected","vac.xcme_hint":"Enable these Xiaomi Cloud Map Extractor attributes:","vac.documentation":"Documentation","vac.residual_title":"Check automatic calibration","vac.residual_message":"The matched rooms disagree by up to {error}. Apply this approximate calibration, refine it manually, or cancel without changing the saved setup.","vac.apply_proposal":"Apply","gs.backup_group":"Backup and transfer","gs.backup_hint":"Download a portable JSON backup or preview and import a backup made by House Plan.","backup.export_open":"Export","backup.import_open":"Import","backup.export_title":"Export House Plan","backup.import_title":"Import House Plan","backup.export_hint":"Choose whether the backup should contain the whole House Plan configuration or only the current space.","backup.full":"Full backup","backup.current_space":"Current space","backup.current_space_title":"Current space: {title}","backup.no_current_space":"No current space","backup.plan_only":"Plan only","backup.plan_only_hint":"Keep rooms, walls, openings, decor and room-label positions without devices or Home Assistant bindings.","backup.plan_only_preview":"This file contains the plan only","backup.privacy_warning":"The archive keeps names, Home Assistant identifiers and exact coordinates. Internal plans and attachments are referenced, not embedded; runtime states and vacuum trails are not included.","backup.download":"Download JSON","backup.export_done":"Backup downloaded","backup.reading":"Checking the backup…","backup.revalidated":"The plan changed after this preview. The summary was refreshed; review it and confirm again.","backup.error.support_invalid_message":"Check the support message and try again.","backup.error.support_package_too_large":"The anonymized support package exceeds the 8 MiB limit.","backup.error.support_preview_expired":"The support attachment preview expired or is no longer available.","backup.error.support_rate_limited":"Too many support reports or previews were requested. Try again later.","backup.error.support_rejected":"The report did not pass support service validation.","backup.error.support_unavailable":"The private support service is temporarily unavailable.","backup.error.unauthorized":"You do not have permission to export or import this plan.","backup.error.not_ready":"House Plan is not ready yet. Try again in a moment.","backup.error.too_large":"The backup exceeds the 8 MiB limit.","backup.error.invalid_json":"The selected file is not valid JSON.","backup.error.invalid_format":"The selected file is not a House Plan backup.","backup.error.invalid_image":"The image is damaged or does not match its format.","backup.error.unsupported_export_version":"This backup format is not supported by the installed version.","backup.error.unsupported_image":"Use a supported PNG, JPEG, WebP or SVG image.","backup.error.future_model":"The backup was created by a newer House Plan data model.","backup.error.invalid_config":"The backup contains an invalid House Plan configuration.","backup.error.wall_model_migration_blocked":"The backup wall model could not be upgraded safely. Optimize the source plan first, then export it again.","backup.error.invalid_layout":"The backup contains invalid object positions.","backup.error.invalid_content":"The backup contains invalid or inconsistent content references.","backup.error.space_not_found":"The selected space no longer exists.","backup.error.capacity_exceeded":"Adding this backup would exceed the plan limits.","backup.error.preview_expired":"The preview expired. Select the backup file again.","backup.error.preview_owner_mismatch":"This preview belongs to another Home Assistant user.","backup.error.conflict":"The plan changed after the preview. Review the refreshed summary.","backup.error.content_confirmation_required":"Confirm that unavailable local content may be detached.","backup.error.commit_failed":"The backup could not be applied safely. The previous plan was restored or is pending recovery.","backup.error.missing_plan":"A referenced plan file disappeared after the preview. Review the backup again.","backup.error.missing_content":"A referenced local attachment disappeared after the preview. Review the backup again.","backup.error.marker_control_missing":"A linked plan light is missing from the backup.","backup.error.marker_control_not_light":"A linked plan target is no longer marked as a light source.","backup.error.marker_control_self":"A light source cannot control itself.","backup.error.marker_control_cycle":"The backup contains a circular chain of light controls.","backup.error.duplicate_marker_control":"The backup contains a duplicate plan-light link.","backup.error.no_backup":"There is no import or optimization snapshot to restore.","backup.error.in_use":"The item is still in use","backup.error.invalid_data":"The request carries invalid data","backup.error.invalid_light_entity":"The leading light must be a light.* or switch.* entity","backup.error.invalid_marker_control":"Invalid marker control reference","backup.error.invalid_name":"The name is invalid","backup.error.invalid_partition_opening_host":"The opening must keep its partition host","backup.error.invalid_partition_opening_jamb_margin":"The opening leaves no physical jamb at the wall end","backup.error.invalid_passage_fields":"An open passage cannot carry door-only settings","backup.error.invalid_space_id":"Unknown space","backup.error.invalid_toggle_entity":"The toggle entity must be light.* or switch.*","backup.error.invalid_value_badge":"Invalid value badge settings","backup.error.invalid_value_badge_attribute":"Invalid value badge attribute","backup.error.invalid_value_badge_position":"Invalid value badge position","backup.error.invalid_value_badge_source":"Invalid value badge source","backup.error.invalid_vacuum_map_route":"Check how the robot's maps are assigned to spaces.","backup.error.invalid_value_source":"Invalid value source","backup.error.invalid_value_source_attribute":"Invalid value source attribute","backup.error.io_error":"A file operation failed on the server","backup.error.not_toggleable":"This device cannot be toggled","backup.error.nothing_to_repair":"Nothing to repair","backup.error.space_in_use":"The space is still referenced","backup.error.value_badge_source_required":"The value badge needs a source","backup.error.wall_model_client_outdated":"The plan was updated elsewhere — reload the page","backup.same_source":"Created on this Home Assistant instance","backup.foreign_source":"Created on another Home Assistant instance","backup.created":"Created: {value}","backup.versions":"Card {card}; integration {integration}; data model {model}","backup.count_spaces":"Spaces: {n}","backup.count_rooms":"Rooms: {n}","backup.count_walls":"Walls: {n}","backup.count_openings":"Openings: {n}","backup.count_decor":"Decor objects: {n}","backup.count_markers":"Devices: {n}","backup.count_layout":"Positions: {n}","backup.bindings":"Bindings — devices: {device}, entities: {entity}, virtual: {virtual}; positions without a space: {legacy}","backup.binding_status":"Target status — active: {active}, disabled: {disabled}, missing: {missing}","backup.missing_areas":"Areas missing on the target: {areas}","backup.dropped_marker_links":"Plan-light links outside this transferred space were omitted: {n}.","backup.room_drafts_migrated":"Legacy unfinished contours converted to ordinary walls: {drafts}; wall segments: {segments}.","backup.repaired_target_refs":"Existing references restored by this space import: {n}.","backup.preserved_unresolved_refs":"References that could not be restored unambiguously were preserved: {n}.","backup.preserved_unresolved_hint":"No data was guessed or deleted. After the import, run Optimize plans to inspect the remaining references.","backup.import_details":"Import reference details","backup.import_detail.incoming_remapped":"References updated inside the imported copy: {n}","backup.import_detail.target_repaired":"Existing references restored: {n}","backup.import_detail.preserved_unresolved":"Unresolved references preserved: {n}","backup.import_detail.collisions":"Destination conflicts preserved safely: {n}","backup.import_detail.dropped_links":"Incoming links omitted by transfer rules: {n}","backup.import_detail.bounded_lineages":"Overly nested identifiers left bounded: {n}","backup.replace_warning":"This replaces the current configuration and layout. Uploaded files are never deleted. One undo remains available until the next plan edit.","backup.foreign_bookkeeping":"Instance-specific known/new-device bookkeeping will not be imported.","backup.final_name":"New space name","backup.target_settings":"The target instance's global settings remain unchanged.","backup.duplicates":"Bindings already present: {n}","backup.skip":"Skip duplicate devices","backup.virtual_copy":"Add safe static virtual copies","backup.content":"Referenced content","backup.decor_images_summary":"Custom images: {objects} objects, {assets} files; missing files: {missing}.","backup.content_available":"available locally","backup.content_external":"external link","backup.content_detach_required":"will be detached","backup.confirm_detach":"I understand that unavailable internal plans and attachments will be detached from the imported configuration.","backup.confirm_missing_images":"I understand that missing custom images will remain as repair placeholders and other unavailable local files will be detached.","backup.replace":"Replace","backup.add":"Add space","backup.space_done":"Space imported: {rooms} rooms, {markers} devices, {refs} existing references restored","backup.full_done":"Backup restored: {spaces} spaces, {rooms} rooms, {markers} devices","backup.undo_import":"Undo last full import","backup.import_undone":"Full import undone","backdrop.large_title":"Large image","backdrop.large_body":"This image is {w}×{h} ({fileMb} MB file) and needs about {decodedMb} MB of memory to display. On tablets this can crash the page.","backdrop.unknown_body":"The image dimensions could not be read — the file may be damaged. Continuing may crash the page on tablets.","backdrop.reduced_dimensions":"Reduced copy: {w}×{h} px.","backdrop.use_downscaled":"Upload a reduced copy","backdrop.reducing":"Reducing…","backdrop.keep_original":"Keep the original","backdrop.too_large_title":"Image is too large","backdrop.too_large_body":"This image exceeds what browsers can display ({w}×{h}, limit {limit} px per side). Please reduce it in a desktop editor and upload again.","backdrop.downscale_failed":"Could not create the reduced copy. The original plan was not changed."};const ap=new WeakSet,lp=new WeakSet;function cp(e,t,i){const n=i?t.state(i):"ready";return i&&"pending"===n?(lp.has(e)||(e.inert=!0,e.setAttribute("aria-busy","true"),lp.add(e)),t.ensure(i).then(()=>{e.isConnected&&e.requestUpdate()}),ap.has(e)?"warm":"cold"):(lp.delete(e)&&(e.inert=!1,e.removeAttribute("aria-busy")),i&&(e.setAttribute("lang","fallback"===n?"en":i),ap.add(e)),"ready")}function hp(){return j``}const dp=[{code:"en",nativeLabel:"English",dictionary:sp},{code:"ru",nativeLabel:"Русский",dictionary:{"editor.context_actions":"Действия: {object}","editor.tool_options":"Параметры инструмента: {tool}","editor.palette":"Палитра: {tool}","editor.open_group":"Группа инструментов: {group}","editor.group_active":"{group} — активно: {item}","editor.disabled_action":"{action} недоступно: {reason}","editor.loading":"Загружаем редактор…","editor.loading_aria":"Редактор плана загружается","editor.load_failed":"Не удалось загрузить редактор.","editor.refresh_advice":"Обновите страницу и повторите попытку.","editor.retry_advice":"Проверьте сеть и нажмите ещё раз.","version_mismatch.title":"Версии House Plan не совпадают","version_mismatch.body":"Если Home Assistant ещё перезапускается, дождитесь завершения, затем перезагрузите эту страницу.","version_mismatch.frontend":"Карточка","version_mismatch.backend":"Интеграция","version_mismatch.reload":"Перезагрузить страницу","color_picker.title":"Выбор цвета","color_picker.hue":"Оттенок","color_picker.saturation":"Насыщенность","color_picker.value":"Яркость","color_picker.hex":"Цвет HEX","color_picker.invalid_hex":"Введите цвет HEX из 3 или 6 цифр","color_picker.confirm":"ОК","btn.properties":"Свойства","btn.keep_as_walls":"Оставить стенами","btn.delete_room_keep_walls":"Удалить комнату, оставить стены","btn.delete_room_with_walls":"Удалить комнату и стены","title.markup_select":"Выбор и редактирование стен и колонн","title.markup_column":"Колонна: кликните точку сетки для квадратной колонны","markup.partition":"Перегородка","markup.column":"Колонна","markup.hint_column":"кликните точку сетки, чтобы поставить квадратную колонну","history.wall_segment":"Добавление отрезка стены","history.column_add":"Добавление колонны","history.physical_edit":"Изменение физического объекта","history.physical_delete":"Удаление физического объекта","history.physical_move":"Перемещение физического объекта","history.wall_face_batch":"Создание комнат из стен","toast.column_duplicate":"Колонна с тем же центром и внешним размером уже существует","physical.partition_properties":"Свойства перегородки","physical.column_properties":"Свойства колонны","physical.shape":"Форма","physical.square":"Квадрат","physical.circle":"Круг","physical.diameter":"Диаметр","physical.side":"Сторона","physical.rotation":"Угол поворота","physical.length":"Длина","physical.allowed_range":"Допустимо: {min}–{max} {unit}","physical.column_size_title":"Внешняя сторона квадратной колонны, создаваемой кликом (1–150 см).","card.title":"План дома","count.devices":"{n} устр.","empty.no_spaces":"Пространств пока нет.","nav.spaces":"Пространства House Plan","empty.add_first":"Добавьте первое пространство и загрузите план этажа.","empty.read_only":"Пространства не настроены. Попросите администратора добавить первое.","empty.install":"Установите интеграцию House Plan и добавьте запись в «Устройства и службы».","btn.add_space":"Добавить пространство","btn.cancel":"Отмена","btn.save":"Сохранить","btn.close":"Закрыть","btn.delete":"Удалить","btn.copy":"Копировать","btn.edit":"Редактировать","btn.open_in_ha":"Открыть в HA","btn.reset":"Сброс","btn.attach":"Прикрепить…","btn.upload":"Загрузить…","btn.replace":"Заменить…","title.zoom_in":"Приблизить","title.zoom_out":"Отдалить","title.zoom_fit":"Вписать всё","title.configure_space":"Настроить пространство","title.add_space":"Добавить пространство","title.markup_add":"Стены: рисуйте непрерывную цепочку; каждый принятый отрезок сохраняется отдельно. Shift фиксирует 45°","title.markup_merge":"Объединить: клик по одной комнате, затем по соседней с общей стеной","title.markup_split":"Разделить комнату: клик по комнате, затем две точки на её стенах","title.markup_delroom":"Удалить комнату: кликните внутри комнаты и подтвердите удаление","title.need_plan":"Загрузите подложку (план этажа)","markup.add":"Стены","markup.merge":"Объединить","markup.split":"Разделить","markup.resize":"Размер","title.markup_resize":"Изменение размера комнат: тяните доступную ручку горизонтальной или вертикальной стены","markup.hint_resize":"тяните доступную ручку стены · стена упирается в первую небезопасную позицию · Esc — отмена · Ctrl+Z — отмена шага","resize.disabled.diagonal":"Стена расположена под углом: Resize поддерживает только горизонтальные и вертикальные стены","resize.disabled.side-angle":"Примыкающая стена расположена под углом: для Resize обе примыкающие стены должны образовывать прямой угол","resize.disabled.duplicate-physical-wall":"Стену перекрывает отдельная перегородка или колонна; удалите или переместите её перед изменением размера","resize.disabled.partial-shared":"Соседняя комната использует только часть этой стены, поэтому её нельзя безопасно двигать как одну общую стену","resize.disabled.unequal-shared":"У соседней комнаты другие конечные точки или длина стены, поэтому стены нельзя безопасно двигать вместе","resize.disabled.multiple-rooms":"Перемещение затронуло бы больше двух комнат","resize.disabled.thickness-conflict":"Толщину стены нельзя безопасно сохранить","resize.disabled.opening-conflict":"Проём на этой стене нельзя безопасно переместить","resize.disabled.invalid-geometry":"Эту стену нельзя переместить без изменения структуры плана","resize.limit_stopped":"Стена остановлена: дальше нарушается ограничение стыков","resize.commit_failed":"Изменение размера отменено: итоговый план не прошёл проверку геометрии","resize.preview_failed":"Стена остановлена в последней безопасной позиции: геометрию плана нельзя сохранить без потерь","markup.opening":"Проём","markup.delete_room":"Удалить комнату","history.undo":"Отменить","history.redo":"Повторить","history.undo_named":"Отменить: {name} (Ctrl+Z)","history.redo_named":"Повторить: {name} (Ctrl+Shift+Z / Ctrl+Y)","history.undo_empty":"Нет операций для отмены","history.redo_empty":"Нет операций для повтора","history.undone":"Отменено: {name}","history.redone":"Повторено: {name}","history.add_room":"Создание комнаты","history.split_room":"Разделение комнаты","history.merge_rooms":"Объединение комнат","history.resize_room":"Изменение размера комнаты","history.wall_thickness":"Изменение толщины стены","history.add_opening":"Добавление дверного или оконного проёма","history.edit_opening":"Изменение проёма","history.move_opening":"Перемещение проёма","history.delete_opening":"Удаление проёма","history.delete_room_keep_walls":"Удаление комнаты с сохранением стен","history.delete_room_with_walls":"Удаление комнаты и её стен","history.decor_add":"Добавление объекта декора","history.decor_edit":"Изменение объекта декора","history.decor_move":"Перемещение объекта декора","history.decor_transform":"Трансформация объекта декора","history.decor_delete":"Удаление объекта декора","history.backdrop_transform":"Трансформация подложки плана","history.device_move":"Перемещение: {name}","history.device_stale":"История позиций больше неприменима и была очищена","opening.new":"Новый проём","opening.edit":"Проём","opening.door":"Дверь","opening.window":"Окно","opening.gate":"Ворота","opening.passage":"Открытый проём","opening.passage_binding_warning":"При сохранении датчик открытия и замок будут удалены.","opening.invalid_passage_fields":"У открытого проёма на плане «{room}» есть недопустимые параметры: {fields}.","opening.type_label":"Тип","opening.length_label":"Длина, см","opening.contact_label":"Датчик открытия","opening.lock_label":"Замок","opening.none":"— нет —","opening.search_ph":"Поиск: имя или entity_id…","opening.invert":"Инвертировать открыто/закрыто","opening.flip_h":"Петли с другой стороны","opening.flip_v":"Открывается в другую сторону","opening.open":"Открыто","opening.closed":"Закрыто","opening.locked":"Заперто","opening.unlocked":"Не заперто","opening.state_unknown":"недоступно","opening.no_entities":"Датчики не привязаны — статичный символ на плане.","toast.opening_no_wall":"Кликните рядом со стеной комнаты или независимой стеной","opening.host_partition":"Независимая стена","opening.partition_orphan":"Независимая стена этого проёма больше не существует","opening.partition_jamb_margin":"Оставьте от края проёма до торца стены минимум {distance}","opening.rebind_partition":"Привязать к другой независимой стене","confirm.delete_partition_openings_title":"Удалить стену и проёмы?","confirm.delete_partition_openings_body":"В стене есть проёмы: {count}. Они будут удалены вместе со стеной.","confirm.delete_partition_openings_item":"• {type}, {length}","markup.hint_points":"точек: {n} · Shift — шаг 45° · Esc — завершить цепочку · Ctrl+Z — убрать точку · при замыкании будет предложена комната","markup.hint_start":"кликните точку сетки, чтобы начать цепочку стен","tip.lqi":"средний сигнал zigbee:","tip.area":"площадь: {value}","info.device_header":"Устройство на плане","info.model":"Модель","info.state":"Состояние","info.link":"Ссылка","info.manuals":"Инструкции","info.none":"Нет дополнительной информации","marker.new_device":"Новое устройство","marker.name_label":"Имя (отображается на плане)","marker.name_ph":"Название","marker.binding_label":"Привязка к устройству HA","marker.binding_disabled":"деактивировано в Home Assistant","marker.virtual_option":"Виртуальное устройство (без привязки)","marker.search_ph":"Поиск устройства / группы…","marker.nothing_found":"ничего не найдено","marker.room_label":"Комната","marker.room_override":" (переопределить размещение)","marker.room_choose":"— выберите комнату —","marker.room_auto":"— по зоне устройства (авто) —","marker.icon_label":"Иконка","marker.icon_ph":"mdi:… (пусто = авто)","marker.display_label":"Отображение","display.badge":"Значок + состояние","display.icon_ripple":"Значок + состояние и активность","display.static_icon":"Всегда статичный значок","marker.display_hint_badge":"Значок и динамическая подложка показывают состояние устройства без обычной пульсации активности. Красная тревога сохраняется.","marker.display_hint_icon_ripple":"Значок, динамическая подложка и пульсация: короткая — для событий, постоянная — для работы, движения или присутствия. Красная тревога имеет отдельный приоритет.","marker.display_hint_value":"Значок заменяется выбранным или автоматически найденным значением Home Assistant; подложка продолжает показывать состояние. Красная тревога сохраняется.","marker.display_hint_static_icon":"Подложка в цветах темы и значок всегда остаются одинаковыми. Состояния, активность, недоступность и тревоги не меняют отображение.","marker.static_alarm_warning":"Это устройство может сообщать о тревогах. Статичный режим скрывает визуальную тревогу маркера.","marker.preview.title":"Предпросмотр отображения","marker.preview.actual":"Сейчас","marker.preview.example":"Пример","marker.preview.integration":"Интеграция","marker.preview.source":"Источник отображения","marker.preview.current_state":"Текущее состояние","marker.preview.result":"На плане","marker.preview.details":"Подробнее об источниках","marker.preview.select_source":"Выберите устройство или сущность Home Assistant, чтобы увидеть фактическое отображение.","marker.preview.unknown_provider":"Интеграция неизвестна","marker.preview.virtual_provider":"House Plan · виртуальное устройство","marker.preview.no_source":"Нет активного источника","marker.preview.no_state":"Нет текущего состояния","marker.preview.mixed_states":"Несколько разных состояний","marker.preview.multiple_sources":"Источников: {n}","marker.preview.more_sources":"ещё {n}","marker.preview.scaled":"Предпросмотр уменьшен до {n}%, чтобы поместиться. Сохранённый размер не изменится.","marker.preview.demo_short":"Показать краткую активность","marker.preview.demo_continuous":"Показать постоянную активность","marker.preview.stop_continuous":"Остановить постоянную активность","marker.preview.demo_short_notice":"Пример краткой активности; фактическое состояние устройства не меняется.","marker.preview.demo_continuous_notice":"Пример постоянной активности; фактическое состояние устройства не меняется.","marker.preview.demo_already_visible":"Текущее состояние уже показывает реальную активность или тревогу.","marker.preview.reduced_motion":"В системе включено уменьшение движения, поэтому обычная активность показана точкой.","marker.preview.reason.neutral":"Нейтральная тёмная подложка","marker.preview.reason.working":"Жёлтая подложка: устройство сейчас работает","marker.preview.reason.working_activity":"Жёлтая подложка и эффект активности: устройство сейчас работает","marker.preview.reason.open":"Оранжевая подложка: физически открыто или разблокировано","marker.preview.reason.cover_icon_state":"Нейтральная подложка; состояние и значок определяет сущность шторы или заслонки","marker.preview.reason.presence":"Эффект активности, пока обнаружено присутствие","marker.preview.reason.event":"Короткий эффект активности после события","marker.preview.reason.transition":"Эффект активности во время движения или смены состояния","marker.preview.reason.media_neutral":"Медиаустройство остаётся на нейтральной тёмной подложке, пока доступно","marker.preview.reason.unavailable":"Приглушённая нейтральная подложка: отключено или недоступно","marker.preview.reason.alarm":"Красная тревожная подложка; тревога отображается всегда","marker.preview.reason.live_states_disabled":"Оформление по живым состояниям отключено в настройках карточки","marker.preview.reason.value_no_state":"Нет подходящего значения состояния — вместо него показан значок","marker.preview.reason.value_ambiguous_sources":"Подходит несколько источников значения — вместо него показан значок","marker.preview.reason.value_non_scalar":"Источник вернул не простое значение — вместо него показан значок","marker.preview.reason.value_virtual":"У виртуального устройства нет значения HA — вместо него показан значок","marker.preview.reason.vacuum_live_plan_only":"Живая позиция и след пылесоса доступны только на полном плане","marker.preview.reason.hidden_design_preview":"Устройство скрыто на плане, но его оформление видно в предпросмотре","marker.preview.reason.composite_power_source":"Состояние берётся из сущности питания устройства; вспомогательные переключатели не учитываются","marker.preview.reason.activity_display_disabled":"Выбранный режим отображения не показывает обычные эффекты активности","marker.preview.reason.ha_disabled":"Привязка отключена в Home Assistant, поэтому устройство будет скрыто на плане","marker.preview.reason.orphaned":"Сохранённая привязка Home Assistant больше не найдена","marker.preview.reason.static_icon":"Статичный режим: состояние устройства не меняет значок","marker.activity_color":"Цвет пульсации активности","marker.ripple_size":"Размер пульсации активности","marker.activity_alarm_note":"Цвет и размер относятся только к обычной активности и не влияют на красную тревогу.","marker.pulse_a11y_alarm":"Тревога","marker.pulse_a11y_event":"Недавнее событие","marker.pulse_a11y_presence":"Обнаружено присутствие","marker.pulse_a11y_transition":"Изменение состояния","marker.pulse_a11y_running":"Работает","marker.state_a11y_neutral":"Обычное состояние","marker.state_a11y_working":"Работает","marker.state_a11y_open":"Открыто","marker.state_a11y_locked":"Заблокировано","marker.state_a11y_unlocked":"Разблокировано","marker.state_a11y_alarm":"Тревога","marker.state_a11y_unavailable":"Недоступно","marker.lqi_a11y_low":"LQI {value}, слабый сигнал","marker.lqi_a11y_mid":"LQI {value}, средний сигнал","marker.lqi_a11y_high":"LQI {value}, сильный сигнал","marker.size_label":"Размер / поворот значка","marker.angle_label":"Поворот","marker.model_label":"Модель","marker.model_ph":"напр. Aqara T&H","marker.link_label":"Ссылка","marker.desc_label":"Описание","marker.desc_ph":"Заметки, характеристики…","marker.manuals_label":"Инструкции (PDF и т.п.)","marker.sub_device":"устройство","marker.sub_z2m_group":" · Z2M-группа","marker.sub_group":"группа","marker.sub_helper":"хелпер","space.new":"Новое пространство","space.copy_title":"Копирование пространства","space.copy_name":"Название нового пространства","space.copy_fallback":"Пространство","space.copy_create":"Создать копию","space.copy_optimize_title":"Оптимизировать перед копированием?","space.copy_optimize_body":"Перед созданием «{name}» House Plan должен оптимизировать весь план, включая другие пространства. Продолжить?","space.copy_optimize_confirm":"Оптимизировать и скопировать","space.copy_error_changed":"План изменился, пока было открыто подтверждение. Проверьте его и повторите попытку.","space.copy_error_source_missing":"Исходного пространства больше нет. Снова откройте его настройки и повторите попытку.","space.copy_error_source_invalid":"House Plan не смог проверить все стены этого пространства. Исправьте исходное пространство и повторите попытку.","space.copy_error_spaces_limit":"В House Plan уже создано максимальное число пространств.","space.copy_error_partitions_limit":"В этом пространстве слишком много стен для копирования.","space.copy_error_openings_limit":"В этом пространстве слишком много проёмов для копирования.","space.copy_error_decor_limit":"В этом пространстве слишком много элементов подложки для копирования.","space.copy_error_columns_limit":"В этом пространстве слишком много колонн для копирования.","space.copy_error_opening_host":"Один из проёмов больше не привязан к стене. Исправьте или удалите его перед копированием.","space.copy_error_geometry":"Копия создаст небезопасную геометрию стен. Исправьте исходное пространство и повторите попытку.","space.copy_error_optimize_geometry":"Копирование остановлено: оптимизация всего плана небезопасна для одного из пространств.","space.header":"Пространство","space.title_label":"Название","space.title_ph":"Например: Гараж","space.plan_label":"Подложка (план)","space.no_plan":"нет подложки","space.plan_alt":"план","room.new":"Новая комната","room.name_label":"Отображаемое имя","room.name_ph":"Например: Терраса","room.area_label":"Зона Home Assistant (свободные)","room.no_area_option":"— без зоны —","room.default_name":"Комната","device.unnamed":"без имени","device.light_group":"группа света","device.fallback":"устройство","device.virtual":"виртуальное устройство","confirm.delete_room_title":"Удалить комнату «{name}»?","confirm.delete_room_body":"Выберите, нужно ли оставить физические стены, принадлежащие только этой комнате. Общие с другой комнатой стены сохраняются всегда.","confirm.remove_marker_title":"Удалить устройство с плана?","confirm.remove_marker_body":"Устройство исчезнет полностью и перестанет участвовать в данных плана. Позже его можно будет добавить заново.","confirm.erase_decor":"Стереть объект «{kind}»? Действие можно отменить из истории редактора.","confirm.delete_space_title":"Удалить пространство?","confirm.delete_space_body":"Пространство, все его комнаты и вся разметка плана будут удалены.","confirm.delete_space_vac_routes":"Также будет снято сопоставление карт роботов: {count}.","space.delete_blocked":"Это пространство всё ещё используется устройствами: {n}. Сначала перенесите их в другое пространство или удалите.","toast.pos_save_failed":"Не удалось сохранить позицию: {err}","toast.no_entity":"У устройства нет подходящей сущности","toast.ha_disabled_action":"Деактивированный объект Home Assistant нельзя использовать на плане.","toast.ha_disabled_show_device":"Деактивированное в Home Assistant устройство нельзя показать на плане. Сначала активируйте его в Home Assistant.","toast.ha_disabled_show_entity":"Деактивированную в Home Assistant сущность нельзя показать на плане. Сначала активируйте её в Home Assistant.","toast.ha_disabled_add":"Деактивированный объект Home Assistant нельзя добавить на план. Сначала активируйте его в Home Assistant.","toast.ha_binding_unverified":"Статус объекта не удалось подтвердить по реестру Home Assistant. Отображение и действия временно недоступны.","toast.markup_needs_server":"Разметка доступна после переноса конфига на сервер","toast.space_order_changed":"Порядок изменён. Если где-то этаж карточки задан номером, проверьте такие панели.","toast.conflict":"Конфиг изменён в другом окне — данные обновлены, повторите последнее действие","toast.cfg_save_failed":"Не удалось сохранить конфиг: {err}","toast.room_overlap":"Контур накладывается на комнату «{name}» — комнаты не должны накладываться","toast.contour_cannot_close":"Контур нельзя замкнуть: он вырожден или пересекает сам себя","toast.merge_not_adjacent":"Объединять можно только комнаты с общей стеной","toast.rooms_merged":"Комнаты объединены в «{name}»","toast.split_pick_wall":"Начните разрез на стене комнаты","toast.split_bad_cut":"Разрез — от стены до стены внутри комнаты, без пересечения стен и самого себя","merge.header":"Объединение комнат","merge.hint":"У объединённой комнаты одно имя и одна зона. Вторая зона освобождается — её устройства уйдут с плана, пока их не заберёт другая комната.","merge.keep":"Оставить","merge.no_area":"без зоны","toast.room_saved":"Комната сохранена ({n}). Устройств добавлено: {added}. Обведите следующую или выйдите из разметки.","toast.room_saved_no_area":"Комната сохранена ({n}, без зоны). Обведите следующую или выйдите из разметки.","toast.marker_needs_server":"Редактирование устройств доступно после переноса конфига на сервер","toast.virtual_name_required":"Укажите имя виртуального устройства","toast.marker_saved":"Устройство сохранено","toast.marker_removed":"Устройство удалено с плана","toast.integration_missing":"Интеграция House Plan не установлена — управление недоступно","toast.plan_formats":"Поддерживаются SVG, PNG, JPG, WebP","toast.plan_required":"Загрузите подложку — план этажа обязателен","toast.space_added_onboard":"Пространство добавлено. Обведите комнаты: кликайте по точкам сетки и замкните контур.","toast.space_added":"Пространство добавлено","toast.space_copied":"Пространство «{name}» создано","toast.space_saved":"Пространство сохранено","toast.space_deleted":"Пространство удалено","toast.delete_failed":"Ошибка удаления: {err}","toast.error":"Ошибка: {err}","toast.toggle_target_unavailable":"Цель «{name}» недоступна — действие не выполнено","toast.toggle_targets_unavailable":"Цели недоступны: {names}. Действие не выполнено","toast.file_failed":"Файл «{name}» не загружен: {err}","toast.files_attached":"Прикреплено файлов: {n}","err.unknown":"неизвестная ошибка","err.code":"код {code}","err.too_large":"файл больше {mb} МБ","err.bad_ext":"недопустимый тип (нужен PDF/изображение)","err.unauthorized":"нужны права администратора","editor.title":"Заголовок","editor.default_floor":"Стартовое пространство","editor.default_floor_missing":"Стартовое пространство «{id}» больше не существует. Выберите другое.","editor.floor":"Закреплённое пространство","editor.floor_none":"— не закреплять —","editor.floor_index":"YAML-индекс {index} (сохранён)","fixed_floor.loading":"Загружаем закреплённое пространство…","fixed_floor.invalid_title":"Закреплённое пространство недоступно","fixed_floor.invalid_body":"Проверьте floor в конфигурации карточки. Настроенное значение: {value}","editor.icon_size":"Размер иконок, % ширины плана","editor.show_temperature":"Показывать температуру","editor.live_states":"Живые состояния (вкл/выкл, открыто…)","editor.light_pools":"Световые пулы и тени от стен","editor.show_signal":"Показывать сигнал zigbee (LQI)","editor.language":"Язык интерфейса","editor.lang_auto":"Авто (профиль HA)","title.icon_rules":"Правила иконок: какая MDI-иконка достаётся устройству по имени","rules.title":"Правила иконок","rules.hint":"Правила проверяются сверху вниз по строке «имя устройства + модель» (regex без учёта регистра); срабатывает первое совпадение. Если ничего не подошло — решает device class сущности, затем — иконка-заглушка.","rules.pattern_ph":"regex, напр. розетк|plug","rules.icon_ph":"mdi:power-socket-de","rules.add":"Добавить правило","rules.reset":"Сбросить к умолчаниям","rules.test_ph":"Проверьте имя устройства…","rules.invalid":"некорректный regex","rules.saved":"Правила иконок сохранены","btn.up":"Вверх","btn.down":"Вниз","tap.info":"Карточка устройства","tap.more_info":"Диалог HA (more-info)","tap.toggle":"Переключить состояние","marker.tap_label":"Действие по нажатию для этого устройства","tap.toggle_note":"Под селектором показано, какое состояние изменится. Защищённые устройства не переключаются с плана.","import.title":"Создать пространства из этажей HA","import.hint":"Home Assistant уже знает эти этажи. Отметьте, какие превратить в пространства плана — далее для каждого попросим картинку плана. Комнаты затем обводятся вручную по плану.","import.start":"Создать: {n}","import.manual":"Начать с нуля","import.progress":"Этаж {i} из {n}","import.done":"Пространства созданы. Обведите комнаты: кликайте по точкам сетки и замкните контур.","btn.skip":"Пропустить","space.scale_label":"Масштаб (размер клетки сетки)","space.cell_cm.help":"Связывает сетку с реальными размерами: от значения зависят длины и площади, толщина стен, размеры проёмов и радиус свечения. Изменение после разметки меняет расчётные размеры всего пространства, но не двигает его точки на плане.","space.cell_cm.help.aria":"Подсказка: масштаб пространства","space.scale_unit":"см на клетку","space.scale_unit_imperial":"дюйм на клетку","space.display_section":"Отображение","space.show_borders":"Всегда отображать границы комнат","space.zero_wall_style":"Стены нулевой толщины","space.zero_wall_style.help":"Пунктирные стены нулевой толщины пропускают Glow и солнечные лучи, сплошные блокируют их как барьер нулевой площади. Выбор меняет все такие стены пространства, даже когда их линии скрыты в просмотре.","space.zero_wall_style.help.aria":"Подсказка: вид стен нулевой толщины","space.zero_wall_dashed":"Пунктирные","space.zero_wall_solid":"Сплошные","space.show_names":"Отображать названия комнат (перетаскиваются)","space.room_color":"Цвет границ и названий","space.opacity":"Прозрачность","space.fill_label":"Заливка комнат","space.fill_mode.help":"«Свой цвет» задаёт оформление, а «Свет», «Температура» и «LQI» используют текущие данные Home Assistant; Glow включается отдельно.","space.fill_mode.help.aria":"Подсказка: режим заливки комнат","fill.none":"Нет","fill.lqi":"По силе зигби-сигнала","fill.light":"По освещению","fill.custom":"Свой цвет","space.custom_fill":"Цвет заливки","space.source_file":"У меня есть картинка плана","space.source_draw":"Нет подложки — нарисую комнаты вручную","fill.temp":"По температуре","tip.temp_avg":"средняя температура:","tip.hum_avg":"средняя влажность:","space_card.button":"Перейти к пространству","space_card.not_found":"Пространство «{id}» не найдено","space_card.loading":"Загрузка…","continuity.restore_plan":"Восстанавливаем план…","continuity.restore_connection":"Восстанавливаем подключение к устройствам…","continuity.retry":"Повторить","editor.space":"Пространство","editor.framing":"Кадрирование","editor.fit_content":"Всё видимое содержимое","editor.fit_house":"Плотно по геометрии дома","editor.show_button":"Показывать кнопку","editor.button_label":"Текст кнопки","editor.button_target":"Путь дашборда (куда вести)","marker.sub_entity":"сущность","title.general_settings":"Общие настройки","title.export_pdf":"Сохранить в PDF","pdf.title":"Сохранение в PDF","pdf.dimensions":"Отображать размеры и площади","pdf.decor":"Отображать мебель и другой декор","pdf.room_names":"Отображать названия комнат","pdf.backdrop":"Отображать подложку","pdf.save":"Сохранить","pdf.saving":"Формируем…","pdf.failed":"Не удалось создать PDF.","pdf.too_large":"Размер изображений превышает лимит PDF 25 МБ.","pdf.asset_failed":"Не удалось загрузить подложку или изображение декора.","pdf.scale":"Масштаб 1:{n}","pdf.north":"Север","gs.title":"Общие настройки","gs.light_group":"Заливка: освещение","gs.light_on":"Свет включён","gs.light_off":"Весь свет выключен","gs.temp_group":"Заливка: температура","gs.temp_cold":"Холодно","gs.temp_ok":"Комфорт","gs.temp_hot":"Жарко","gs.lqi_group":"Заливка: зигби-сигнал","gs.lqi_low":"Слабый сигнал","gs.lqi_high":"Сильный сигнал","gs.reset":"Сбросить к умолчаниям","gs.saved":"Общие настройки сохранены","gs.radar_show_live":"Показывать текущее присутствие на плане","gs.radar_show_live_hint":"Скрывает или показывает все живые цели радаров. Это не запускает и не останавливает запись наблюдений.","radar.title":"Присутствие на плане","radar.help":"Свяжите маркер с точными сущностями радара Home Assistant, укажите положение датчика и профиль координат. Живые позиции обрезаются по выбранной комнате.","radar.help.aria":"Подсказка: настройки радара присутствия","radar.enabled":"Использовать этот радар присутствия","radar.show_live":"Показывать живые цели","radar.configure":"Настроить радар","radar.configure_on_plan":"Настроить на плане","radar.change_installation":"Сменить установку","radar.no_contour":"У комнаты нет контура. Точки радара не будут обрезаться по комнате.","radar.discard_setup_title":"Отменить настройку радара?","radar.discard_setup":"Несохранённая настройка радара будет потеряна.","radar.step_place_mount":"Укажите физическое положение датчика","radar.step_place_heading":"Укажите точку прямо перед датчиком","radar.step_reference":"Укажите контрольное положение {n}, затем начните измерение","radar.step_check_reference":"Укажите независимое проверочное положение","radar.start_measure":"Начать измерение","radar.countdown":"Встаньте в отмеченное место через {seconds} с","radar.capturing":"Стойте неподвижно и в одиночестве…","radar.fit_ready":"Калибровка готова","radar.check_third":"Проверить в другом положении","radar.check_complete":"Независимая проверка завершена","radar.error_distance":"Расхождение положения: {distance}","radar.ambiguous_target":"Обнаружено несколько целей. Повторите измерение в одиночестве.","radar.insufficient_samples":"Недостаточно актуальных координат. Повторите или настройте вручную.","radar.bad_references":"Выберите разнесённые положения в разных направлениях от датчика.","radar.ambiguous_sources":"Измерения допускают два одинаково вероятных направления. Выберите точки, по которым можно различить левую и правую стороны.","radar.bad_fit":"Измерения не совпадают. Проверьте единицы, положение датчика и контрольные точки.","radar.desktop_hint":"Для точной настройки используйте компьютер. Редактирование на тач-устройствах поддерживается по остаточному принципу.","radar.detected":"House Plan распознал признаки радара у этого устройства. Перед сохранением проверьте точные источники.","radar.detected_ld2450":"House Plan нашёл набор координат ESPHome LD2450. Перед сохранением проверьте точные источники X/Y.","radar.additional_actions":"Дополнительные действия","radar.declare":"Это радар присутствия","radar.profile":"Профиль данных","radar.profile_esphome_ld2450_v1":"ESPHome LD2450 (цели X/Y)","radar.profile_cartesian_v1":"Декартовы цели (X/Y)","radar.profile_polar_v1":"Полярная цель (дальность/угол)","radar.profile_range_v1":"Только дальность","radar.profile_zones_v1":"Состояния зон","radar.profile_presence_v1":"Только присутствие","radar.room":"Комната радара","radar.room_choose":"Выберите комнату","radar.target":"Цель {n}","radar.axis_x":"Сущность координаты X","radar.axis_y":"Сущность координаты Y","radar.add_target":"Добавить слот цели","radar.range_channel":"Канал дальности {n}","radar.add_range":"Добавить канал дальности","radar.presence_gate":"Сущность присутствия для слота","radar.swap_axes":"Поменять оси X и Y местами","radar.axis_x_sign":"Направление X","radar.axis_y_sign":"Направление Y","radar.distance_source":"Сущность дальности","radar.angle_source":"Сущность угла","radar.angle_unit":"Единица угла","radar.degrees":"Градусы","radar.radians":"Радианы","radar.angle_zero":"Направление нулевого угла","radar.angle_forward":"Вперёд","radar.angle_right":"Вправо","radar.angle_clockwise":"Угол растёт по часовой стрелке","radar.zone_source":"Сущность зоны","radar.occupancy_source":"Сущность присутствия","radar.count_source":"Сущность количества целей","radar.availability_source":"Сущность доступности","radar.source_choose":"Выберите сущность","radar.source_optional":"Необязательно","radar.source_missing":"сейчас недоступна","radar.saved_unsupported":"Сохранённая настройка радара не поддерживается или неполна. Она неактивна; удалите её либо обновите House Plan перед повторной настройкой.","radar.occupancy":"Присутствие (вкл/выкл)","radar.count":"Количество","radar.mount":"Положение и направление","radar.mount_hint":"Это физическое положение датчика. Перемещение его декоративного маркера не меняет установку.","radar.heading":"Направление, °","radar.range_cm":"Дальность, см","radar.fov_deg":"Угол обзора, °","radar.unit":"Единица источника","radar.mirror":"Отразить ось влево/вправо","radar.remove":"Удалить настройки радара","radar.invalid":"Перед сохранением заполните комнату, источники и положение радара.","radar.check_sources":"Проверить живые данные","radar.checking":"Проверяем…","radar.health":"Состояние подключения","radar.live_summary":"Текущих целей: {targets}; дуг дальности: {ranges}","radar.health_ok":"Актуальные данные получены","radar.health_off":"Цели не обнаружены","radar.health_stale":"Часть координат устарела","radar.health_partial":"Часть источников актуальна, часть устарела","radar.health_restricted":"Нет доступа к одному или нескольким источникам","radar.health_incomplete":"Текущий отчёт радара неполон","radar.health_position_unavailable":"Есть присутствие, но актуальное положение недоступно","radar.health_unavailable":"Данные датчика недоступны","radar.health_needs_setup":"Требуется настроить установку","radar.health_inconsistent":"Источники передают противоречивые данные","radar.health_unknown":"Текущее состояние неизвестно","radar.health_disabled":"Радар отключён","radar.error_invalid_radar":"Проверьте настройки радара.","radar.error_invalid_selection":"Выберите существующую комнату и допустимые источники.","radar.error_source_restricted":"Нет доступа ко всем выбранным источникам.","radar.error_rate_limited":"Слишком много запросов. Повторите чуть позже.","radar.error_not_ready":"Обработка данных радара ещё не готова.","radar.error_conflict":"План изменился. Откройте настройку радара заново и повторите попытку.","radar.error_source_unavailable":"Один или несколько выбранных источников радара недоступны.","radar.error_unsupported_capability":"Установленная интеграция не поддерживает эту возможность радара.","radar.report_age":"{seconds} с назад","space.show_lqi":"Показывать зигби-сигнал (LQI) у устройств","space.hide_decor":"Скрыть декоративный слой","space.hide_decor_tip":"Линии, фигуры, надписи и мебель остаются на месте — их видно в редакторе подложки, но не на плане.","space.hide_openings":"Скрыть проёмы","space.hide_openings_tip":"Двери, окна и ворота не рисуются, но продолжают работать: свет проходит, солнце светит в окна, датчики открытия срабатывают. В редакторе плана проёмы видно всегда.","gs.light_none":"Нет источников света","mode.plan":"Редактор плана","mode.devices":"Редактор устройств","display.value":"Значение + состояние","marker.subarea":"без зоны, вручную","device.new":"Новое устройство — откройте его редактор, чтобы снять отметку","opening.unlock_action":"Открыть замок","opening.lock_action":"Закрыть замок","opening.lock_pending":"Выполняется…","title.close_editor":"Закрыть редактор (вернуться к просмотру)","title.add_device":"Добавить устройство на план","devbar.add":"Добавить","devbar.rules":"Правила иконок","device_inbox.button":"Устройства","device_inbox.title":"Устройства на плане","device_inbox.search":"Поиск по устройствам, сущностям и интеграциям…","device_inbox.add_virtual":"Добавить виртуальное устройство","device_inbox.tab_on_plan":"На плане","device_inbox.tab_available":"Доступны","device_inbox.tab_hidden":"Скрытые","device_inbox.tab_readd":"Доступны снова","device_inbox.only_new":"Только новые","device_inbox.show_entities":"Показывать сущности","device_inbox.show_hidden":"Показывать скрытые на плане","device_inbox.show_hidden.help":"Временно показывает на плане скрытые и деактивированные маркеры служебными призраками только в редакторе устройств. Сохранённая видимость устройств не меняется.","device_inbox.show_hidden.help.aria":"Подсказка: показывать скрытые устройства на плане","device_inbox.new":"Новое","device_inbox.find":"Найти на плане","device_inbox.edit":"Настроить","device_inbox.hide":"Скрыть","device_inbox.show":"Показать","device_inbox.add":"Добавить","device_inbox.readd":"Добавить заново","device_inbox.hide_available":"Скрыть из списка","device_inbox.show_more":"Показать ещё","device_inbox.more_actions":"Другие действия","device_inbox.find_hidden_hint":"Сначала включите «Показывать скрытые на плане»","device_inbox.show_disabled":"Перед показом активируйте эту привязку в Home Assistant","device_inbox.empty_on_plan":"На плане пока нет подходящих устройств.","device_inbox.empty_available":"Нет доступных устройств для добавления.","device_inbox.empty_hidden":"Скрытых устройств нет.","device_inbox.empty_readd":"Нет удалённых устройств, доступных для повторного добавления.","device_inbox.reason_visible_auto":"Найдено автоматически","device_inbox.reason_visible_explicit":"Добавлено явно","device_inbox.reason_manual_hidden":"Скрыто пользователем","device_inbox.reason_automatic_hidden":"Скрыто автоматически","device_inbox.reason_service_entry":"Служебная запись реестра","device_inbox.reason_excluded_integration":"Исключена интеграция «{integration}»","device_inbox.reason_excluded_domain":"Непространственный тип сущности","device_inbox.reason_grouped_light":"Представлено группой света комнаты","device_inbox.reason_represented_by_parent":"Представлено родительским устройством","device_inbox.reason_removed":"Ранее удалено с плана","device_inbox.reason_available":"Можно добавить на план","device_inbox.reason_no_bound_room":"Зона HA не связана с комнатой плана","device_inbox.status_ha_disabled":"Отключено в Home Assistant","device_inbox.status_orphaned":"Привязка больше не найдена в Home Assistant","device_inbox.status_unverified":"Реестр Home Assistant временно недоступен","device_inbox.saved":"Список устройств обновлён","device_inbox.filters_excluded":"Исключённые интеграции","device_inbox.filters_group_lights":"Объединять светильники комнаты в один маркер","device_inbox.filters_preview_appear":"появится: {count}","device_inbox.filters_preview_hide":"скроется: {count}","device_inbox.filters_preview_lights":"затронет светильников: {count}","device_inbox.filters_reset":"Вернуть рекомендуемые","device_inbox.filters_save":"Сохранить фильтры","device_inbox.filters_search_ph":"Добавить интеграцию…","device_inbox.filters_title":"Фильтры обнаружения","space.roomcard_section":"В карточке комнаты:","space.label_temp":"Температура","space.label_hum":"Влажность","space.label_lqi":"Средний Zigbee-сигнал","space.label_light":"Свет вкл/выкл","roomcard.light_on":"Вкл","roomcard.light_off":"Выкл","roomcard.light_partial":"{on} из {total}","toast.split_pick_inside":"Промежуточные точки разреза — внутри комнаты","mode.decor":"Редактор подложки","decor.select":"Выбрать","decor.line":"Линия","decor.rect":"Прямоугольник","decor.ellipse":"Овал","decor.text":"Надпись","decor.erase":"Стереть","decor.erase_confirm_title":"Стереть объект?","decor.color":"Цвет","decor.width":"Толщина линии","decor.line_style":"Стиль линии","decor.line_style_solid":"Сплошная","decor.line_style_dashed":"Пунктирная","decor.fill":"Заливка","decor.fill_color":"Цвет заливки","decor.length":"Длина","decor.size":"Размер","decor.flip_h":"Отзеркалить по горизонтали","decor.flip_v":"Отзеркалить по вертикали","decor.angle":"Угол поворота, °","decor.text_size":"Размер текста","decor.backdrop_properties":"Свойства картинки-подложки","decor.text_title":"Надпись","decor.object_title":"Редактирование: {kind}","decor.text_label":"Текст","decor.live_group":"Вставить переменную HA","decor.live_entity":"Сущность","decor.live_entity_ph":"выберите сущность","decor.live_attr":"Значение","decor.live_attr_ph":"выберите состояние или атрибут","decor.live_state":"Состояние","decor.backdrop":"Картинка-подложка","decor.backdrop_hint":"Тяните картинку — перемещение; угол — размер; верхнюю ручку — поворот. Shift меняет пропорции или снимает шаг угла.","decor.backdrop_reset":"Вернуть картинку","decor.backdrop_reset_done":"Картинка вернулась на своё место и в свой размер","marker.icon_auto":"Авто: {icon} (по правилам иконок; выберите свою, чтобы заменить)","marker.icon_pin_auto":"Закрепить","mode.plan_tip":"Редактор плана — геометрия дома: рисование и объединение/разделение комнат, привязка к зонам HA, двери, окна и ворота, карточки комнат, масштаб","mode.devices_tip":"Редактор устройств — всё про значки: перетаскивание, клик — настройка привязки/иконки/отображения, виртуальные устройства, правила иконок","mode.decor_tip":"Редактор подложки — чисто визуальный декор под планом: линии, прямоугольники, овалы и надписи, не реагирующие на клики","space.glow_enabled":"Свечение источников света","gs.glow_group":"Свечение источников света","gs.glow_base":"Темнота дома","gs.glow_light":"Цвет света по умолчанию / интенсивность","gs.wall_group":"Стены","gs.wall_fill":"Цвет заливки стен","gs.glow_radius":"Радиус свечения","gs.glow_radius.help":"Задаёт общий радиус светового пятна в метрах или футах; персональный радиус устройства заменяет это значение.","gs.glow_radius.help.aria":"Подсказка: общий радиус свечения","gs.unit_m":"м","gs.unit_ft":"фут","marker.controls_label":"Управляет другими источниками света","marker.controls.help":"При действии «Переключить состояние» перечисленные источники переключаются вместе с этим маркером. Их световые пятна остаются у собственных маркеров, а эта связь сама по себе не делает управляющий маркер источником света.","marker.controls.help.aria":"Подсказка: управление другими источниками света","marker.controls_filter":"Поиск ламп и выключателей…","info.controls":"Управляет","marker.glow_radius_label":"Радиус свечения","marker.glow_radius.help":"Задаёт радиус свечения в метрах или футах; пустое значение использует радиус из общих настроек.","marker.glow_radius.help.aria":"Подсказка: радиус свечения","markup.wallthick":"Толщина","markup.select":"Выбрать","title.markup_wallthick":"Толщина — клик по стене задаёт толщину от 0 до 100 см.","markup.hint_wallthick":"клик по стене · Esc закрывает без применения","wallthick.field":"Толщина","wallthick.unit_cm":"см","wallthick.unit_in":"дюйм","wallthick.apply_room":"Применить ко всем стенам комнаты","markup.draw_wall_title":"Толщина каждого нового сегмента стены (0–100 см). Общие стены сохраняют существующее значение.","room.queue_progress":"Комната {current} из {total}","toast.wall_rooms_saved":"Создано комнат: {n}","toast.wall_chain_saved":"Цепочка стен сохранена","toast.wallthick_pick":"Кликните по стене","toast.wallthick_set":"Толщина стены задана","toast.wallthick_cleared":"Толщина стены убрана","toast.physical_range":"Введите значение от {min} до {max} {unit}","toast.zero_wall_opening_conflict":"Сначала удалите проём на этом участке стены.","toast.zero_wall_ambiguous":"Не удалось однозначно выбрать участок стены. Уточните геометрию узла.","toast.zero_wall_migration_blocked":"Пространство не преобразовано: {reason}. Данные не изменены.","toast.physical_angle":"Введите угол поворота от 0° до 90°, не включая 90°","toast.physical_limit":"В пространстве достигнут лимит объектов этого типа","toast.geometry_unsafe":"Изменение отменено: геометрию стен нельзя безопасно построить.","junction.limit_angle":"Слишком острый угол между стенами: {actual}°, минимум {limit}°.","junction.limit_valence":"Слишком много стен в одном узле: {actual}, максимум {limit}.","junction.limit_length":"Слишком короткий участок стены: {actual} см, минимум {limit} см.","junction.limit_distance":"Стены и узлы слишком близко: {actual} см, минимум {limit} см.","junction.limit_clearance":"Внутри комнаты не остаётся места: {actual} см², минимум {limit} см².","junction.limit_check_failed":"Проверку стыков выполнить не удалось — изменение не сохранено","toast.wall_model_migration_blocked":"Не удалось обновить модель стен: {reason}. План не изменён. Запустите «Оптимизировать планы»; если ошибка повторится, исправьте конфликтующую геометрию стен.","toast.wall_model_client_outdated":"Обновите карточку и перезагрузите страницу перед редактированием плана.","wall_model.reason.invalid-room":"некорректный контур комнаты","wall_model.reason.zero-length":"отрезок стены нулевой длины","wall_model.reason.third-owner":"стена принадлежит более чем двум комнатам","wall_model.reason.duplicate-id":"конфликт идентификаторов стен","wall_model.reason.thickness-conflict":"конфликт значений толщины стены","wall_model.reason.opening-host":"проём нельзя однозначно привязать к стене","toast.delete_room_pick":"Кликните внутри комнаты, которую нужно удалить","toast.plan_snap_ambiguous":"Увеличьте масштаб, чтобы выбрать узел стены","toast.wall_repair_ambiguous":"У контура несколько возможных соединений. Увеличьте масштаб и соедините стены явно.","toast.wall_repair_too_large":"Разрыв больше 2 см. Соедините стены перед созданием комнаты.","toast.wall_repair_changed":"Геометрия стен изменилась. Попробуйте создать комнату ещё раз.","toast.opening_on_zero_wall":"Проёмы на стене нулевой толщины запрещены","marker.from_ha_option":"Выбрать из списка HA","marker.show_entities":"Показывать сущности","marker.show_entities_tip":"Добавляет в список не только устройства, но и все их сущности","marker.pick_ph":"Выберите устройство…","room.open_area":"Открыть зону в HA","room.fit_action":"Вписать комнату {name}","view.volumetric":"Объёмный вид","view.flat":"Плоский вид","kiosk.title":"Размеры на этом экране","kiosk.hint":"Хранится только на этом устройстве — у каждого настенного планшета или ТВ свои удобные размеры.","kiosk.icon_scale":"Размер значков устройств","kiosk.font_scale":"Размер текста карточек комнат","editor.kiosk":"Режим настенного устройства (киоск)","editor.cycle":"Автосмена пространств каждые N секунд (киоск, 0 = выкл)","room.settings_title":"Настройки комнаты","room.settings_section":"Настройки комнаты (переопределяют пространство)","room.fill_label":"Заливка в ЭТОЙ комнате","fill.inherit":"Как у пространства","room.custom_fill_space":"Цвет пространства","room.custom_fill_own":"Цвет комнаты","room.temp_range_label":"Диапазон комфорта","room.temp_range_min":"Нижняя граница комфортной температуры","room.temp_range_max":"Верхняя граница комфортной температуры","room.temp_range_reset":"Как у пространства","room.temp_range.help":"Диапазон применяется только к этой комнате. Пустое поле наследует соответствующую границу пространства; если границы поменялись местами, House Plan использует меньшую как нижнюю, а большую как верхнюю.","room.temp_range.help.aria":"О диапазоне комфорта комнаты","room.temp_src_label":"Источник температуры","room.hum_src_label":"Источник влажности","room.src_average":"Средняя по датчикам комнаты (по умолчанию)","room.src_pick":"Конкретное устройство или сущность HA","room.src_ph":"Выберите источник…","toast.room_updated":"Комната обновлена","space.card_font":"Размер шрифта карточек комнат (всё пространство)","room.sizes_section":"Размеры шрифтов","room.name_scale":"Размер названия","room.label_scale":"Размер подписей","preview.room_name":"Гостиная","toast.cfg_reload_failed":"Не удалось перечитать план с сервера: {err}","toast.locale_load_failed":"Не удалось загрузить языковой пакет. До перезагрузки страницы используется английский.","toast.furniture_art_load_failed":"Не удалось загрузить изображения мебели. Обновите страницу, чтобы их показать.","room.settings_short":"Настройки комнаты","room.unnamed":"Комната без имени","marker.use_climate_temp":"Учитывать температуру устройства в комнате","marker.use_climate_temp_tip":"Добавляет current_temperature кондиционера или термостата в среднюю температуру комнаты. Внешний бейдж со значением настраивается отдельно ниже.","marker.value_badge_title":"Бейдж со значением","marker.value_badge.help":"Показывает одно выбранное значение рядом со значком. Не влияет на комнатные показатели, свет, Glow и действие по нажатию.","marker.value_badge.help.aria":"Подсказка: бейдж со значением устройства","marker.value_badge_enabled":"Отображать бейдж со значением","marker.value_badge_source":"Значение","marker.value_badge_source.help":"Выберите конкретное состояние, поддерживаемый атрибут или производное значение этого устройства.","marker.value_badge_source.help.aria":"Подсказка: источник значения бейджа","marker.value_badge_position":"Расположение","marker.value_badge_position.help":"Выбранная сторона сохраняется постоянно и не переворачивается автоматически у края плана.","marker.value_badge_position.help.aria":"Подсказка: расположение бейджа","marker.value_badge_right":"Справа","marker.value_badge_bottom":"Снизу","marker.value_badge_left":"Слева","marker.value_badge_top":"Сверху","marker.value_badge_empty":"У этого устройства нет доступных значений","marker.value_badge_static":"Статичный значок не показывает живые значения. Настройка сохранится.","marker.value_badge_missing":"Источник недоступен","marker.value_badge_missing_hint":"Сохранённый источник сейчас недоступен. Можно сохранить его, отключить бейдж или выбрать другой.","marker.value_badge_duplicate":"То же значение уже показано внутри значка.","marker.value_badge_state":"Состояние · {name}","marker.value_badge_marker_state":"Состояние источника света · {name}","marker.value_badge_lqi":"Качество Zigbee-сигнала (среднее)","marker.value_badge_attr_current_temperature":"Текущая температура · {name}","marker.value_badge_attr_temperature":"Целевая температура · {name}","marker.value_badge_attr_current_humidity":"Текущая влажность · {name}","marker.value_badge_attr_humidity":"Влажность · {name}","marker.value_badge_attr_current_position":"Положение · {name}","marker.value_badge_attr_percentage":"Скорость · {name}","marker.value_badge_attr_brightness":"Яркость · {name}","marker.value_badge_attr_volume_level":"Громкость · {name}","marker.value_badge_attr_battery_level":"Заряд батареи · {name}","marker.value_badge_attr_fan_speed":"Скорость вентилятора · {name}","marker.value_source":"Источник значения","marker.value_source.help":"Выберите, что заменит значок. Действие по нажатию не изменится.","marker.value_source.help.aria":"Подсказка: источник значения внутри значка","marker.value_source_auto":"Автоматически (как раньше)","marker.value_source_missing_hint":"Сохранённый источник сейчас недоступен. До его восстановления или выбора другого значения внутри будет показано —.","marker.light_role_label":"Является источником света","marker.light_role.help":"«Авто» использует фактическую роль привязанного устройства, «Всегда» принудительно создаёт собственный источник, а «Никогда» исключает его; связанные лампы выше остаются независимыми.","marker.light_role.help.aria":"Подсказка: является ли устройство источником света","marker.light_role_auto_yes":"Автоматически (источник света)","marker.light_role_auto_no":"Автоматически (не источник света)","marker.light_role_always":"Всегда источник света","marker.light_role_never":"Никогда не источник света","marker.light_entity_label":"Ведущая сущность света","marker.light_entity.help":"Для составного устройства выберите сущность, состояние, цвет и яркость которой представляют этот источник на плане. Автоматический вариант сохраняет совместимость со старыми планами.","marker.light_entity.help.aria":"Подсказка: ведущая сущность света","marker.light_entity_auto":"Автоматически ({entity})","marker.light_entity_none":"нет управляемой сущности","marker.light_entity_missing":"Сохранённая сущность {entity} недоступна. Временно используется {fallback}; выбор восстановится, если сущность вернётся.","marker.toggle_entity_label":"Переключаемая сущность","marker.toggle_entity.help":"Для составного устройства выберите собственную лампу или переключатель, которой управляет нажатие. Автоматический вариант сохраняет прежние правила цели и не зависит от ведущей сущности света.","marker.toggle_entity.help.aria":"Подсказка: переключаемая сущность","marker.toggle_entity_auto":"Автоматически ({entity})","marker.toggle_entity_none":"нет собственной управляемой сущности","marker.toggle_entity_missing":"Сохранённой сущности {entity} больше нет среди выбираемых каналов этого маркера. Временно используется {fallback}; выбор восстановится, если сущность вернётся.","marker.glow_color_label":"Цвет и яркость свечения","marker.glow_mode.help":"Используйте данные источника, задайте только цвет или зафиксируйте цвет и яркость. Минимум — 1%; чтобы отключить источник, выберите «Никогда».","marker.glow_mode.help.aria":"Подсказка: цвет и яркость свечения","marker.glow_mode_auto":"Из источника","marker.glow_mode_color":"Задать цвет","marker.glow_mode_fixed":"Задать цвет и яркость","marker.glow_color":"Цвет свечения","marker.glow_brightness":"Яркость","marker.glow_disabled_never":"Настройки свечения недоступны: маркер явно исключён из источников света.","marker.glow_disabled_auto":"В автоматическом режиме у этого маркера не найден пространственный источник света.","marker.glow_disabled_no_entity":"Для пространственного источника нет активной управляемой сущности Home Assistant.","marker.glow_passive_hint":"У источника нет собственных данных Home Assistant. Задайте цвет и яркость вручную; радиус остаётся доступным.","marker.control_broken":"Сохранённый источник отсутствует или больше не отмечен как источник света","marker.control_missing_label":"Отсутствующий источник на плане","marker.control_passive":"пассивный источник","toast.marker_control_cycle":"Такая связь создаст циклическую цепочку управления светом.","toast.marker_binding_required":"Сначала выберите устройство Home Assistant, затем добавьте управляемый источник света.","confirm.unlock_title":"Открыть замок?","confirm.unlock_body":"House Plan отправит этому замку команду открытия.","toast.files_migrate_failed":"Не удалось перенести вложения к новой привязке, ссылки остались на старые файлы: {err}","space.pick_saved":"Уже загруженные","space.pick_saved_hint":"Планы, сохранённые на сервере, включая отцеплённые ранее","space.no_saved":"На сервере пока нет сохранённых планов.","space.loading":"Загрузка…","space.used_by":"используется: {list}","space.in_use":"План используется пространством — сначала отцепите его","btn.use":"Выбрать","confirm.delete_plan_title":"Удалить файл плана?","confirm.delete_plan_body":"Файл будет удалён с сервера. Это действие нельзя отменить.","toast.plans_list_failed":"Не удалось получить список планов: {err}","toast.plan_delete_failed":"Не удалось удалить план: {err}","marker.hide":"Скрыть","marker.hide_tip":"Устройство исчезнет с плана после сохранения, но продолжит участвовать в расчёте сигнала комнаты. Вернуть его можно через каталог «Устройства» в редакторе устройств.","marker.show":"Показать","marker.show_tip":"Устройство снова появится на плане после сохранения.","marker.hidden_ghost":"Устройство скрыто пользователем","marker.ha_disabled_device":"Устройство деактивировано в Home Assistant и скрыто с плана.","marker.ha_disabled_entity":"Сущность деактивирована в Home Assistant и скрыта с плана.","marker.ha_disabled_all_entities":"У устройства нет активных сущностей Home Assistant, поэтому оно скрыто с плана.","marker.ha_registry_limited":"Полный реестр Home Assistant недоступен этому пользователю. Неподтверждённый объект временно нельзя показывать или использовать.","marker.delete_tip":"Полностью удалить устройство с плана и из всех расчётов. Позже его можно добавить заново.","tap.run":"Запустить автоматизацию/скрипт/сцену","tap.none":"Ничего не делать","marker.run_target_label":"Что запускать","marker.run_search_ph":"Поиск: автоматизация, скрипт или сцена…","marker.run_target_gone":"Цель {id} не найдена — выберите заново","marker.tap_confirm":"Спрашивать подтверждение","marker.tap_confirm_tip":"Перед выполнением показать диалог подтверждения — защита от случайных нажатий.","marker.toggle_hint_single":"Цель: {name} ({id}).","marker.virtual_light_target":"Виртуальный свет: {name}.","marker.virtual_light_current":"Ручное состояние: {state} → {effect}.","marker.virtual_light_state_on":"включён","marker.virtual_light_state_off":"выключен","marker.toggle_hint_group":"Переключатся источники ({count}): {names}.","marker.toggle_hint_current":"Сейчас: {state} → {effect}.","marker.toggle_hint_group_current":"Сейчас включено {on} из {count} → {effect}.","marker.toggle_hint_skipped":"Не будут затронуты ({count}): {targets}.","marker.toggle_effect_turn_on":"включится","marker.toggle_effect_turn_off":"выключится","marker.toggle_effect_open":"откроется","marker.toggle_effect_close":"закроется","marker.toggle_effect_stop":"остановится","marker.toggle_effect_toggle":"состояние переключится","marker.toggle_skip_missing":"не найдено","marker.toggle_skip_ha_disabled":"деактивировано в HA","marker.toggle_skip_unavailable":"недоступно","marker.toggle_skip_unsupported":"переключение не поддерживается","marker.toggle_skip_secure":"заблокировано из соображений безопасности","marker.toggle_none_no_binding":"У устройства нет привязки, состояние переключать нечем. По нажатию ничего не произойдёт.","marker.toggle_none_no_actionable_entity":"У устройства нет состояния, которое можно переключить. По нажатию ничего не произойдёт.","marker.toggle_none_configured_targets_missing":"Настроенные цели сейчас недоступны. Собственная сущность устройства не будет подставлена вместо них.","marker.toggle_none_ha_disabled":"Цель деактивирована в Home Assistant и не может использоваться на плане.","marker.toggle_none_unavailable":"Цель сейчас недоступна. По нажатию ничего не произойдёт.","marker.toggle_none_unsupported":"Для этой сущности Home Assistant не предоставляет безопасного переключения. По нажатию ничего не произойдёт.","marker.toggle_none_secure":"Переключение замков, сигнализации и защитных ворот с плана заблокировано из соображений безопасности.","run.automation":"автоматизация","run.script":"скрипт","run.scene":"сцена","confirm.tap_run":"Запустить «{name}»?","confirm.tap_toggle":"Переключить «{name}»?","confirm.current_state":"Текущее состояние: {state}","confirm.expected_state":"После переключения: {state}","confirm.group_current":"включено {on} из {total}","confirm.group_all_on":"все включены","confirm.group_all_off":"все выключены","confirm.unavailable_targets":"Недоступно: {count}","confirm.expected_by_ha":"Состояние определит Home Assistant","confirm.state_on":"Включено","confirm.state_off":"Выключено","confirm.state_open":"Открыто","confirm.state_closed":"Закрыто","confirm.state_opening":"Открывается","confirm.state_closing":"Закрывается","confirm.state_stopped":"Остановлено","confirm.state_unknown":"Неизвестно","toast.run_started":"Запущено: {name}","toast.run_target_missing":"Цель запуска не найдена — проверьте настройки устройства","toast.run_target_required":"Выберите автоматизацию, скрипт или сцену","toast.tap_target_changed":"Цель действия изменилась. Повторите попытку.","toast.virtual_light_toggle_failed":"Не удалось переключить виртуальный свет: {err}","toast.value_badge_source_required":"Выберите значение для бейджа","btn.run":"Выполнить","vac.section":"Робот-пылесос: живая позиция","vac.autocal":"Настроить автоматически","vac.live":"Живая позиция на плане","vac.trail":"Показывать путь робота","vac.autocal_no_rooms":"Интеграция не отдаёт список комнат — откройте «Подогнать вручную»","vac.route_warn_unmapped":"Робот убирает на карте, которая не сопоставлена ни одному этажу","vac.route_warn_needs_calibration":"Карта сопоставлена этажу, но не откалибрована","vac.route_warn_ambiguous":"Две карты неразличимы — этаж не выбран","vac.route_warn_missing_space":"Пространство этой карты удалено","vac.autocal_no_match":"Не совпали имена комнат (нужно ≥3 общих) — откройте «Подогнать вручную»","vac.autocal_done":"Готово: привязка по {rooms} комнатам. Запустите уборку и проверьте","vac.cal_need_pos":"Робот сейчас не отдаёт координаты — запустите уборку и поставьте на паузу","vac.cal_done":"Калибровка сохранена. Запустите уборку и проверьте","vac.cal_cancelled":"Калибровка отменена","vac.fit":"Подогнать вручную","vac.fit_hint":"Перетащите карту робота на место, растяните за уголки","vac.fit_rotate":"Повернуть 90°","vac.fit_mirror":"Отразить","vac.trail_never":"Не показывать никогда","vac.trail_cleaning":"Во время уборки","vac.trail_always":"Показывать всегда","gs.bg_group":"Фон сцены","gs.bg_color":"Цвет фона вокруг плана","gs.bg_default":"Как в теме","gs.bg_theme":"по умолчанию — из темы","gs.bg_mode":"Фон плана","gs.bg_mode.help":"«Следует за Солнцем» использует sun.sun, а при недоступности — локальные часы браузера; статичный режим всегда показывает выбранный цвет.","gs.bg_mode.help.aria":"Подсказка: общий фон плана","gs.bg_static":"Статичный цвет","gs.bg_daynight":"Следует за Солнцем","gs.sun_group":"Солнце","gs.sun_missing":"Сущность sun.sun не найдена — фон следует локальным часам, а оконные лучи недоступны.","gs.north":"Север на плане","gs.north.help":"Угол отсчитывается по часовой стрелке от верхней вертикали плана; север нужен для оконных лучей, а не для фона «Следует за Солнцем».","gs.north.help.aria":"Подсказка: общее направление севера","gs.north_ph":"не задан","gs.north_clear":"Сбросить","gs.north_letter":"С","gs.sun_rays":"Солнце в окнах","gs.about_version":"Houseplan Card v{v}","gs.about_github":"GitHub · документация и issues","gs.about_telegram":"Чат в Telegram","support.title":"Помощь и обратная связь","space.bg_color":"Цвет фона вокруг плана","space.bg_inherit":"Наследовать общий","space.bg_inherited":"наследуется из общих настроек","space.bg_mode":"Фон плана","space.bg_mode.help":"Выберите наследование общего фона либо переопределите это пространство статичным цветом или режимом «Следует за Солнцем».","space.bg_mode.help.aria":"Подсказка: фон пространства","space.north":"Север на плане (переопределение)","space.north.help":"Переопределяет общий север для этого пространства; угол отсчитывается по часовой стрелке от верхней вертикали плана и используется оконными лучами.","space.north.help.aria":"Подсказка: север для пространства","space.north_inherited":"наследуется: {v}","space.sun_rays":"Солнце в окнах","space.sun_inherit":"Наследовать общий","space.sun_on":"Вкл","space.sun_off":"Выкл","canvas.far_objects":"Объектов далеко от плана: {n}","canvas.show_far":"Показать","canvas.home_tip":"План там — нажмите, чтобы вписать","gs.grid_group":"Обслуживание планов","gs.grid_hint":"Обновляет модели данных, выравнивает элементы по сетке и объединяет лишние фрагменты стен. Перед записью будет показан точный отчёт.","gs.align_all":"Оптимизировать планы","gs.align_title":"Оптимизировать планы","gs.align_none":"Все планы уже используют актуальную и оптимальную модель данных.","gs.optimize_no_automatic_changes":"Автоматических изменений нет. Проверьте пункты ниже.","gs.align_count":"Сдвинется элементов: {n} из {total}, максимум на {cm} см.","gs.align_where":"Наибольший сдвиг — в пространстве «{s}».","gs.align_turned":"Проёмов с исправлением угла: {n}.","gs.align_preflight_failed":"Не удалось безопасно проверить геометрию следующих пространств: {spaces}{more}.","gs.align_preflight_hint":"Планы не изменены. Скопируйте диагностику кнопкой ниже и приложите её к отчёту об ошибке вместе с экспортом пространства.","gs.preflight_reason_prepare-exception":"Не удалось подготовить геометрию пространства (исключение при сборке модели)","gs.preflight_reason_wall-null":"Тело стен не построилось (объединение вернуло пустоту)","gs.preflight_reason_wall-degraded-extra":"Тело стен деградировало с лишней геометрией","gs.preflight_reason_wall-failed-core":"Ядро тела стен не собралось","gs.preflight_reason_wall-exception":"Построение стен упало с исключением","gs.preflight_reason_floor-null":"Контур пола не построился","gs.preflight_reason_floor-exception":"Построение пола упало с исключением","gs.preflight_copy":"Скопировать диагностику","gs.preflight_copied":"Диагностика скопирована","gs.preflight_update_hint":"Версии карточки и интеграции различаются — обновите House Plan и повторите.","gs.align_preflight_space":"Пространство {n}","gs.align_preflight_more":" и ещё {n}","gs.optimize_changes":"Миграций модели: {m}; обновлено пространств: {c}; устранён шум координат: {p}; объединено отрезков реальных стен: {w}; объединено отрезков стен нулевой толщины: {s}; независимых: {i}.","gs.zero_walls_migrated":"Преобразовано виртуальных участков: {n}.","gs.wall_segments_migrated":"Стабилизировано сегментов стен: {n}.","gs.room_drafts_migrated":"Незавершённые контуры преобразованы в обычные стены: {drafts}; отрезков: {segments}.","gs.optimize_lattice_summary":"Канонизировано шумовых значений координат: {n}; максимальный сдвиг: {cm} см.","gs.optimize_lattice_space":"{space}: канонизировано значений координат: {n}; оставлено значений вне сетки: {far}.","gs.optimize_coincident_partitions":"Скрытые участки независимых стен поглощены стенами комнат: {n}.","gs.optimize_openings_rehosted":"Проёмы перепривязаны к стенам комнат: {n}.","gs.optimize_walls_straightened":"Выпрямлено стен: {n}; максимальное перемещение: {cm} см.","gs.optimize_walls_straightened_where":"Максимальная правка стены: {s}.","gs.optimize_walls_straighten_skipped":"Оставлено почти осевых стен, которые нельзя безопасно выпрямить: {n}.","gs.optimize_glow_migration":"Старый Glow: пространств — {spaces} → без заливки данных + независимый Glow; комнат — {rooms} → наследуемая заливка + независимый Glow.","gs.optimize_references":"Исправлено ссылок: пространства — {spaces}; комнаты — {rooms}; позиции — {positions}; устройств отвязано от отсутствующих пространств — {detached}.","gs.optimize_reference_more":", и ещё {n}","gs.optimize_orphans_removed":"Убрано забытых записей: {total} — подписи комнат: {rooms}; устройства: {devices}; групповые метки: {groups}. Все они принадлежали пространствам, удалённым ранее.","gs.optimize_live_positions":"Старые позиции в удалённых пространствах принадлежат существующим объектам: {n}{names}. Они будут сохранены.","gs.optimize_live_positions_remove":"Старые позиции в удалённых пространствах принадлежат существующим объектам: {n}{names}. Они выбраны для удаления.","gs.optimize_live_names":": {names}{more}","gs.optimize_live_remove":"Убрать старые позиции","gs.optimize_live_keep":"Сохранить старые позиции","gs.optimize_live_selected":"Старые позиции будут убраны после применения оптимизации.","gs.optimize_unverified":"Не удалось безопасно проверить позиций: {n}. Они оставлены без изменений.","gs.optimize_registry_limited":"Для безопасной проверки нужен полный доступ администратора к реестрам Home Assistant.","gs.optimize_vacuum_warning":"Сопоставления комнат пылесоса требуют проверки: {n}.","gs.optimize_details":"Подробности","gs.optimize_details_more":"И ещё записей: {n}.","gs.optimize_detail_removed":"будет удалено","gs.optimize_detail_live":"будет сохранено","gs.optimize_detail_unverified":"не проверено","gs.optimize_detail_room_label":"подпись комнаты","gs.optimize_detail_device":"устройство","gs.optimize_detail_group":"групповая метка","gs.optimize_detail_unknown":"неизвестный владелец","gs.optimize_detail_item":"{status}: {kind} {id}; прежнее пространство {space}","gs.align_warn":"Элементы, намеренно поставленные между узлами, будут сдвинуты. После операции доступна одна отмена — только до следующего изменения плана.","gs.align_run":"Оптимизировать","gs.align_done":"Планы оптимизированы: сдвинуто элементов — {n}, обслужено записей — {m}, исправлено ссылок — {r}","gs.optimize_undo":"Отменить последнюю оптимизацию","gs.optimize_undone":"Последняя оптимизация отменена","decor.furniture":"Мебель","decor.image":"Изображение","decor.image_title":"Свои изображения","decor.image_upload":"Загрузить изображение","decor.image_replace":"Заменить изображение","decor.image_uploading":"Загрузка…","decor.image_asset":"Файл изображения","decor.image_pick_hint":"Загрузите изображение или выберите уже используемое в House Plan.","decor.image_place_hint":"Кликните по плану, чтобы разместить изображение.","decor.image_none":"Загруженных изображений пока нет.","decor.image_unavailable":"Изображение недоступно","decor.image_used":"Используется в объектах: {n}","decor.image_upload_failed":"Не удалось загрузить изображение: {err}","decor.image_error_capacity":"Хранилище пользовательских изображений заполнено.","decor.image_in_use":"Перед удалением файла удалите все размещённые копии.","decor.image_delete_title":"Удалить файл изображения?","decor.image_delete_message":"Удалить «{name}» из House Plan? Это действие нельзя отменить.","furn.title":"Библиотека мебели","furn.symbol":"Символ","furn.group_furniture":"Мебель","furn.group_appliance":"Техника","furn.group_sanitary":"Сантехника","furn.group_other":"Прочее","furn.width":"Ширина","furn.depth":"Глубина","furn.back_to_categories":"Все категории","furn.pick_hint":"Выберите категорию, затем символ.","furn.place_hint":"Кликните по плану — предмет встанет к ближайшей стене. Shift — свободно.","furn.cat_air_conditioner":"Кондиционеры","furn.cat_armchair":"Кресла","furn.cat_bathtub":"Ванны","furn.cat_bed":"Кровати","furn.cat_bidet":"Биде","furn.cat_boiler":"Бойлеры","furn.cat_chair":"Стулья","furn.cat_coffee_table":"Журнальные столы","furn.cat_cooktop":"Варочные панели","furn.cat_dining_table":"Обеденные столы","furn.cat_dishwasher":"Посудомоечные машины","furn.cat_dryer":"Сушильные машины","furn.cat_fireplace":"Камины","furn.cat_fridge":"Холодильники","furn.cat_kitchen_cabinet":"Кухонные шкафы","furn.cat_kitchen_sink":"Кухонные мойки","furn.cat_nightstand":"Тумбы","furn.cat_plant":"Растения","furn.cat_rug":"Ковры","furn.cat_shelving":"Стеллажи","furn.cat_shower":"Душевые","furn.cat_sink":"Раковины","furn.cat_sofa":"Диваны","furn.cat_stairs":"Лестницы","furn.cat_toilet":"Унитазы","furn.cat_tv":"Телевизоры","furn.cat_wardrobe":"Шкафы","furn.cat_washer":"Стиральные машины","furn.cat_work_table":"Рабочие столы","furn.sym_sofa":"Диван двухместный","furn.sym_sofa_three_seat":"Диван трёхместный","furn.sym_sofa_corner_right":"Угловой диван, правый","furn.sym_armchair":"Кресло мягкое","furn.sym_armchair_office":"Кресло офисное","furn.sym_coffee_table":"Журнальный стол, прямоугольный","furn.sym_coffee_table_round":"Журнальный стол, круглый","furn.sym_coffee_table_oval":"Журнальный стол, овальный","furn.sym_coffee_table_rounded":"Журнальный стол, скруглённый","furn.sym_table_dining":"Обеденный стол, прямоугольный","furn.sym_table_round":"Круглый стол","furn.sym_table_dining_oval":"Обеденный стол, овальный","furn.sym_table_dining_rounded":"Обеденный стол, скруглённый","furn.sym_chair":"Стул","furn.sym_chair_bar":"Барный стул","furn.sym_desk":"Рабочий стол, прямоугольный","furn.sym_desk_corner":"Рабочий стол, угловой","furn.sym_bed_double":"Двуспальная кровать","furn.sym_bed_single":"Односпальная кровать","furn.sym_nightstand":"Тумба прикроватная","furn.sym_cabinet_tv":"Тумба под телевизор","furn.sym_cabinet_shoe":"Тумба для обуви","furn.sym_cabinet_sink":"Тумба под раковину","furn.sym_wardrobe":"Шкаф гардеробный","furn.sym_bookshelf":"Шкаф книжный","furn.sym_wall_unit":"Шкаф-стенка","furn.sym_kitchen_floor":"Кухонный напольный модуль","furn.sym_kitchen_floor_corner":"Кухонный напольный угловой модуль","furn.sym_kitchen_wall":"Кухонный навесной модуль","furn.sym_kitchen_wall_corner":"Кухонный навесной угловой модуль","furn.sym_shelf_floor":"Стеллаж напольный","furn.sym_shelf_wall":"Полка настенная","furn.sym_fridge":"Холодильник","furn.sym_stove":"Варочная панель, 4 конфорки","furn.sym_cooktop_two":"Варочная панель, 2 конфорки","furn.sym_dishwasher":"Посудомоечная машина","furn.sym_washer":"Стиральная машина","furn.sym_dryer":"Сушильная машина","furn.sym_tv":"Телевизор на подставке","furn.sym_tv_wall":"Телевизор на кронштейне","furn.sym_ac":"Кондиционер","furn.sym_water_heater":"Бойлер","furn.sym_toilet":"Унитаз напольный","furn.sym_toilet_built_in":"Унитаз встроенный","furn.sym_bathtub":"Ванна прямоугольная","furn.sym_bathtub_corner":"Ванна угловая","furn.sym_shower":"Душ","furn.sym_sink":"Раковина","furn.sym_kitchen_sink":"Кухонная мойка одинарная","furn.sym_kitchen_sink_double":"Кухонная мойка двойная","furn.sym_bidet":"Биде напольное","furn.sym_bidet_built_in":"Биде встроенное","furn.sym_stairs":"Лестница","furn.sym_fireplace":"Камин","furn.sym_plant":"Растение","furn.sym_rug":"Ковёр","common.yes":"Да","common.no":"Нет","vac.diag_source":"Источник","vac.diag_platform":"Интеграция","vac.diag_status":"Статус","vac.diag_position":"Позиция","vac.diag_rooms":"Комнаты","vac.diag_rooms_value":"{total} · совпало имён: {matched} · {readiness}","vac.autocal_ready":"автокалибровка доступна","vac.autocal_not_ready":"нужно 3 совпавших имени","vac.diag_path":"Путь интеграции","vac.diag_map":"ID карты","vac.source_none":"не выбран","vac.source_status_ok":"Готов","vac.source_status_missing":"Не найден","vac.source_status_disabled":"Деактивирован в Home Assistant","vac.source_status_unavailable":"Недоступен","vac.source_status_unverified":"Нельзя проверить с текущими правами","vac.source_status_unsupported":"Нет данных позиции","vac.source_status_none":"Нет источника","vac.source_banner_missing":"Сохранённый источник больше не существует. Он не заменён автоматически: выберите другой или восстановите его в Home Assistant.","vac.source_banner_disabled":"Сохранённый источник деактивирован в Home Assistant. Активируйте его там или выберите другой.","vac.source_banner_unverified":"Текущих прав Home Assistant недостаточно для проверки источника. Привязка сохранена и не будет заменена автоматически.","vac.choose_source":"Выбрать источник","vac.source_auto":"Автоматически","vac.source_auto_hint":"Использовать совместимую сущность этого устройства","vac.all_cameras":"Все камеры","vac.all_cameras_warn":"Камера может не отдавать данные робота. Выбирайте её только если это карта вашего пылесоса.","vac.all_cameras_empty":"Других сущностей камеры не найдено.","vac.platform_unknown":"интеграция неизвестна","vac.cap_position":"позиция","vac.cap_rooms_short":"комнаты","vac.cap_path":"путь","vac.cap_map":"ID карты","vac.cap_none":"данные робота не обнаружены","vac.xcme_hint":"Включите атрибуты Xiaomi Cloud Map Extractor:","vac.documentation":"Документация","vac.residual_title":"Проверьте автокалибровку","vac.residual_message":"Совпавшие комнаты расходятся максимум на {error}. Примените приблизительную калибровку, подгоните её вручную либо отмените без изменения сохранённых настроек.","vac.apply_proposal":"Применить","gs.backup_group":"Резервная копия и перенос","gs.backup_hint":"Скачайте переносимую JSON-копию или проверьте и импортируйте копию, созданную House Plan.","backup.export_open":"Экспорт","backup.import_open":"Импорт","backup.export_title":"Экспорт House Plan","backup.import_title":"Импорт House Plan","backup.export_hint":"Выберите, должна ли копия содержать всю конфигурацию House Plan или только текущее пространство.","backup.full":"Полная копия","backup.current_space":"Текущее пространство","backup.current_space_title":"Текущее пространство: {title}","backup.no_current_space":"Нет текущего пространства","backup.plan_only":"Только планировка","backup.plan_only_hint":"Сохранить комнаты, стены, проёмы, декор и позиции подписей комнат без устройств и привязок Home Assistant.","backup.plan_only_preview":"Файл содержит только планировку","backup.privacy_warning":"Архив сохраняет названия, идентификаторы Home Assistant и точные координаты. Внутренние планы и вложения указываются ссылками, но не вкладываются; текущие состояния и маршруты пылесосов не включаются.","backup.download":"Скачать JSON","backup.export_done":"Резервная копия скачана","backup.reading":"Проверяем резервную копию…","backup.revalidated":"После предпросмотра план изменился. Сводка обновлена — проверьте её и подтвердите ещё раз.","backup.error.support_invalid_message":"Проверьте сообщение для поддержки и повторите попытку.","backup.error.support_package_too_large":"Обезличенный пакет для поддержки превышает лимит 8 МиБ.","backup.error.support_preview_expired":"Предпросмотр вложения для поддержки истёк или больше недоступен.","backup.error.support_rate_limited":"Запрошено слишком много репортов или предпросмотров. Повторите позже.","backup.error.support_rejected":"Репорт не прошёл проверку службы поддержки.","backup.error.support_unavailable":"Закрытая служба поддержки временно недоступна.","backup.error.unauthorized":"У вас нет прав на экспорт или импорт этого плана.","backup.error.not_ready":"House Plan ещё не готов. Повторите попытку через несколько секунд.","backup.error.too_large":"Размер резервной копии превышает 8 МиБ.","backup.error.invalid_json":"Выбранный файл не является корректным JSON.","backup.error.invalid_format":"Выбранный файл не является резервной копией House Plan.","backup.error.invalid_image":"Изображение повреждено или не соответствует своему формату.","backup.error.unsupported_export_version":"Эта версия формата резервной копии не поддерживается установленной версией.","backup.error.unsupported_image":"Используйте поддерживаемое изображение PNG, JPEG, WebP или SVG.","backup.error.future_model":"Резервная копия создана в более новой версии модели данных House Plan.","backup.error.invalid_config":"Резервная копия содержит некорректную конфигурацию House Plan.","backup.error.wall_model_migration_blocked":"Не удалось безопасно обновить модель стен из резервной копии. Сначала оптимизируйте исходный план и повторите экспорт.","backup.error.invalid_layout":"Резервная копия содержит некорректные позиции объектов.","backup.error.invalid_content":"Резервная копия содержит некорректные или несогласованные ссылки на файлы.","backup.error.space_not_found":"Выбранное пространство больше не существует.","backup.error.capacity_exceeded":"Добавление этой копии превысит ограничения размера плана.","backup.error.preview_expired":"Время предпросмотра истекло. Выберите файл резервной копии заново.","backup.error.preview_owner_mismatch":"Этот предпросмотр принадлежит другому пользователю Home Assistant.","backup.error.conflict":"После предпросмотра план изменился. Проверьте обновлённую сводку.","backup.error.content_confirmation_required":"Подтвердите отсоединение недоступных локальных файлов.","backup.error.commit_failed":"Не удалось безопасно применить копию. Предыдущий план восстановлен или ожидает восстановления.","backup.error.missing_plan":"После предпросмотра исчез связанный файл плана. Проверьте копию ещё раз.","backup.error.missing_content":"После предпросмотра исчез связанный локальный файл. Проверьте копию ещё раз.","backup.error.marker_control_missing":"В резервной копии отсутствует связанный источник света на плане.","backup.error.marker_control_not_light":"Связанная цель больше не отмечена как источник света.","backup.error.marker_control_self":"Источник света не может управлять самим собой.","backup.error.marker_control_cycle":"Резервная копия содержит циклическую цепочку управления светом.","backup.error.duplicate_marker_control":"Резервная копия содержит повторяющуюся связь с источником света.","backup.error.no_backup":"Нет снимка импорта или оптимизации, который можно восстановить.","backup.error.in_use":"Элемент ещё используется","backup.error.invalid_data":"Запрос содержит некорректные данные","backup.error.invalid_light_entity":"Ведущий свет должен быть сущностью light.* или switch.*","backup.error.invalid_marker_control":"Некорректная ссылка управления маркером","backup.error.invalid_name":"Некорректное имя","backup.error.invalid_partition_opening_host":"Проём должен сохранить свою перегородку-носитель","backup.error.invalid_partition_opening_jamb_margin":"Проём не оставляет физического простенка у края стены","backup.error.invalid_passage_fields":"Открытый проход не может нести настройки двери","backup.error.invalid_space_id":"Неизвестное пространство","backup.error.invalid_toggle_entity":"Сущность переключения должна быть light.* или switch.*","backup.error.invalid_value_badge":"Некорректные настройки бейджа значения","backup.error.invalid_value_badge_attribute":"Некорректный атрибут бейджа значения","backup.error.invalid_value_badge_position":"Некорректная позиция бейджа значения","backup.error.invalid_value_badge_source":"Некорректный источник бейджа значения","backup.error.invalid_vacuum_map_route":"Проверьте сопоставление карт робота пространствам.","backup.error.invalid_value_source":"Некорректный источник значения","backup.error.invalid_value_source_attribute":"Некорректный атрибут источника значения","backup.error.io_error":"Файловая операция на сервере не удалась","backup.error.not_toggleable":"Это устройство нельзя переключить","backup.error.nothing_to_repair":"Нечего чинить","backup.error.space_in_use":"На пространство ещё есть ссылки","backup.error.value_badge_source_required":"Бейджу значения нужен источник","backup.error.wall_model_client_outdated":"План обновлён в другом месте — перезагрузите страницу","backup.same_source":"Создано на этом экземпляре Home Assistant","backup.foreign_source":"Создано на другом экземпляре Home Assistant","backup.created":"Создано: {value}","backup.versions":"Карточка {card}; интеграция {integration}; модель данных {model}","backup.count_spaces":"Пространств: {n}","backup.count_rooms":"Комнат: {n}","backup.count_walls":"Стен: {n}","backup.count_openings":"Проёмов: {n}","backup.count_decor":"Объектов декора: {n}","backup.count_markers":"Устройств: {n}","backup.count_layout":"Позиций: {n}","backup.bindings":"Привязки — устройства: {device}, сущности: {entity}, виртуальные: {virtual}; позиций без пространства: {legacy}","backup.binding_status":"Статус на целевом экземпляре — активных: {active}, деактивированных: {disabled}, отсутствующих: {missing}","backup.missing_areas":"На целевом экземпляре отсутствуют зоны: {areas}","backup.dropped_marker_links":"Связи с источниками света вне переносимого пространства пропущены: {n}.","backup.room_drafts_migrated":"Старые незавершённые контуры преобразованы в обычные стены: {drafts}; отрезков: {segments}.","backup.repaired_target_refs":"Существующих ссылок восстановлено этим импортом: {n}.","backup.preserved_unresolved_refs":"Неоднозначные ссылки сохранены без изменений: {n}.","backup.preserved_unresolved_hint":"House Plan ничего не угадывал и не удалял. После импорта запустите «Оптимизировать планы», чтобы проверить оставшиеся ссылки.","backup.import_details":"Подробности восстановления ссылок","backup.import_detail.incoming_remapped":"Ссылок обновлено внутри импортируемой копии: {n}","backup.import_detail.target_repaired":"Существующих ссылок восстановлено: {n}","backup.import_detail.preserved_unresolved":"Неразрешимых ссылок сохранено: {n}","backup.import_detail.collisions":"Конфликтов назначения безопасно сохранено: {n}","backup.import_detail.dropped_links":"Входящих связей пропущено по правилам переноса: {n}","backup.import_detail.bounded_lineages":"Чрезмерно вложенных идентификаторов ограничено: {n}","backup.replace_warning":"Текущая конфигурация и расположение будут заменены. Загруженные файлы не удаляются. Одну отмену можно выполнить до следующего изменения плана.","backup.foreign_bookkeeping":"Служебные списки известных и новых устройств другого экземпляра импортированы не будут.","backup.final_name":"Название нового пространства","backup.target_settings":"Глобальные настройки целевого экземпляра не изменятся.","backup.duplicates":"Уже существующих привязок: {n}","backup.skip":"Пропустить повторяющиеся устройства","backup.virtual_copy":"Добавить безопасные статичные виртуальные копии","backup.content":"Связанное содержимое","backup.decor_images_summary":"Свои изображения: объектов — {objects}, файлов — {assets}; отсутствует файлов — {missing}.","backup.content_available":"доступно локально","backup.content_external":"внешняя ссылка","backup.content_detach_required":"будет отвязано","backup.confirm_detach":"Я понимаю, что недоступные внутренние планы и вложения будут отвязаны от импортируемой конфигурации.","backup.confirm_missing_images":"Я понимаю, что отсутствующие свои изображения останутся восстанавливаемыми заглушками, а остальные недоступные локальные файлы будут отвязаны.","backup.replace":"Заменить","backup.add":"Добавить пространство","backup.space_done":"Пространство импортировано: комнат — {rooms}, устройств — {markers}, существующих ссылок восстановлено — {refs}","backup.full_done":"Копия восстановлена: пространств — {spaces}, комнат — {rooms}, устройств — {markers}","backup.undo_import":"Отменить последний полный импорт","backup.import_undone":"Полный импорт отменён","backdrop.large_title":"Большое изображение","backdrop.large_body":"Изображение {w}×{h} ({fileMb} МБ), для показа потребуется около {decodedMb} МБ памяти. На планшетах это может привести к падению страницы.","backdrop.unknown_body":"Не удалось прочитать размеры изображения — файл может быть повреждён. Продолжение может привести к падению страницы на планшете.","backdrop.reduced_dimensions":"Уменьшенная копия: {w}×{h} px.","backdrop.use_downscaled":"Загрузить уменьшенную копию","backdrop.reducing":"Уменьшаем…","backdrop.keep_original":"Оставить оригинал","backdrop.too_large_title":"Изображение слишком большое","backdrop.too_large_body":"Изображение превышает возможности браузера ({w}×{h}, предел {limit} px по стороне). Уменьшите его в редакторе на компьютере и загрузите снова.","backdrop.downscale_failed":"Не удалось создать уменьшенную копию. Текущий план не изменён."}},{code:"de",nativeLabel:"Deutsch",loadDictionary:async function(e){const t=0===e?await import("./de-CguB1iyB.js"):await import(new URL("./de-CguB1iyB.js?retry",import.meta.url).href);return{dictionary:t.dictionary,fingerprint:t.fingerprint}}},{code:"fr",nativeLabel:"Français",loadDictionary:async function(e){const t=0===e?await import("./fr-C84z_afh.js"):await import(new URL("./fr-C84z_afh.js?retry",import.meta.url).href);return{dictionary:t.dictionary,fingerprint:t.fingerprint}}}],up=sp,pp=new Set;const _p=new class{constructor(e,t,i=console.warn,n){this.entries=e,this.expectedFingerprint=t,this.warn=i,this.loadFailed=n,this.dictionaries=new Map,this.pending=new Map,this.failed=new Set;for(const t of e)t.dictionary&&this.dictionaries.set(t.code,t.dictionary)}state(e){return this.dictionaries.has(e)?"ready":this.failed.has(e)?"fallback":"pending"}dictionary(e){return this.dictionaries.get(e)}ensure(e){if("pending"!==this.state(e))return Promise.resolve();const t=this.pending.get(e);if(t)return t;const i=this.entries.find(t=>t.code===e),n=this.load(i).finally(()=>this.pending.delete(e));return this.pending.set(e,n),n}async load(e){if(!e?.loadDictionary)return void(e&&this.failed.add(e.code));let t;for(const i of[0,1])try{const t=await e.loadDictionary(i);if(t.fingerprint!==this.expectedFingerprint)throw new Error(`locale fingerprint mismatch for ${e.code}`);return this.dictionaries.set(e.code,t.dictionary),void this.failed.delete(e.code)}catch(e){t=e}this.failed.add(e.code),this.warn(`[houseplan] unable to load ${e.code} locale; using English`,t),this.loadFailed?.(e.code)}}(dp,"012abf4b3924ad03971870eb8085ab1ac1a66b0d9b6676fe095285a8b0f201ab",console.warn,function(e){for(const t of pp)t(e)});function mp(e){const t=vp(e)?.code??"en";return _p.dictionary(t)??up}function gp(e){return"string"==typeof e?e.trim().replaceAll("_","-").toLowerCase():""}const fp=new Map(dp.map(e=>[gp(e.code),e]));function vp(e){return fp.get(gp(e))}function yp(e,t){const i=[{value:"",label:e},...dp.map(({code:e,nativeLabel:t})=>({value:e,label:t}))],n="string"==typeof t?t:"";return n&&!i.some(e=>e.value===n)&&i.push({value:n,label:vp(n)?.nativeLabel??n}),i}function bp(e,t){return function(e,t,i,n){const r=new Map(i.map(e=>[gp(e),e])),o=r.get(gp(e));if(o)return o;const s=gp(t),a=r.get(s);return a||(r.get(s.split("-")[0]||"")??n)}(t,e?.locale?.language||e?.language,dp.map(({code:e})=>e),"en")}function wp(e,t,i){return nn(mp(e)[t]??up[t]??t,i)}function kp(e,t){const i=mp(e)[t]??up[t];return"string"==typeof i&&i.trim().length>0}function xp(e,t,i,n){return{ox:0,oy:0}}function Sp(e,t){const i=(e.angle+90)*Math.PI/180,n=Ha(16,t),r=e.gateFace?-n*e.gateFace.side:n*(e.flipV?-1:1);return[[e.x+Math.cos(i)*r,e.y+Math.sin(i)*r],r<0]}function $p(e){const t=e.length/2,i=e.face.cm>0?e.face.cm/e.cellCm*e.gridPitch/2:Ha(4,e.cellCm),n="gate"===e.type?Math.sin(10*Math.PI/180)*t:0;return{half:t,jambHalf:i,gateDepth:n,outlineHalf:Math.max(Ha(16,e.cellCm),i+Ha(8,e.cellCm),n+Ha(8,e.cellCm)),hitHalf:Math.max(Ha(20,e.cellCm),i+Ha(10,e.cellCm),n+Ha(12,e.cellCm))}}function Mp(e,t,i){e.minX=Math.min(e.minX,t),e.minY=Math.min(e.minY,i),e.maxX=Math.max(e.maxX,t),e.maxY=Math.max(e.maxY,i)}function Rp(e,t,i,n,r,o,s,a){const l=Math.min(s,a)*Math.PI/180,c=Math.max(s,a)*Math.PI/180,h=(e,t)=>{const i=Math.atan2(t,e),n=[l,c];for(let e=-3;e<=3;e++){const t=e*Math.PI-i,r=Math.PI/2+e*Math.PI-i;t>l&&tl&&r0&&[e.length,e.angle,t[0],t[1]].every(Number.isFinite)))return null;const{half:i,jambHalf:n}=$p(e),r=Na(e.cellCm),o=1.75*r,s=1.25*r,a=.75*r,l={minX:-i-s,minY:-n-s,maxX:i+s,maxY:n+s},c={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("window"===e.type)Rp(c,-i,0,i,-o,o,-90,0),Rp(c,i,-i,0,-o,o,0,90),Mp(c,-i-a,-i-a),Mp(c,i+a,a);else if("gate"===e.type){const t=10*e.face.side;Rp(c,-i,0,i,-o,o,0,t),Rp(c,i,-i,0,-o,o,-t,0)}else Rp(c,-i,0,e.length,-o,o,-90,0),Mp(c,-i-a,-e.length-a),Mp(c,i+a,a);const[h,d]=Cp(e),u={...l};Mp(u,c.minX+h,c.minY+d),Mp(u,c.maxX+h,c.maxY+d);const p=e.flipH?-1:1,_="gate"===e.type?1:e.flipV?-1:1,m=e.angle*Math.PI/180,g=Math.cos(m),f=Math.sin(m),v={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const e of[u.minX,u.maxX])for(const i of[u.minY,u.maxY]){const n=e*p,r=i*_;Mp(v,t[0]+n*g-r*f,t[1]+n*f+r*g)}return v}function Dp(e){if("passage"===e.type)return W``;const t=Math.max(0,Math.min(1,e.amount)),{half:i,jambHalf:n}=$p(e),r=Na(e.cellCm),o=1.75*r,s=e.flipH?-1:1,a=e.flipV?-1:1,l="gate"===e.type?1:a,[c,h]=Cp(e);let d;if("window"===e.type){const o=Math.PI/2*i,s=e.face.cm>0?W``:W``;d=W` ${l}
    `:G} - `}}ug.properties={hass:{attribute:!1},_config:{state:!0},_snap:{state:!0},_continuityEpoch:{state:!0}},ug.styles=[op,o`.hp-static-title{font-weight:700;padding:10px 14px 6px;font-size:16px;color:var(--primary-text-color);}.hp-static-body{position:relative;}.hp-static-stage{position:relative;width:100%;container-type:inline-size;overflow:hidden;pointer-events:none;background:var(--ha-card-background,var(--card-background-color,#111));}.hp-static-stage svg{position:absolute;inset:0;width:100%;height:100%;display:block;z-index:1;}.hp-paper{fill:var(--ha-card-background,var(--card-background-color,#111));stroke:none;}.wallbody-fill{fill:var(--wall-fill,#ffffff);fill-opacity:var(--wall-fill-op,1);fill-rule:evenodd;stroke:none;pointer-events:none;}.wallbody{fill:url(#hp-wall-hatch);fill-rule:evenodd;stroke:var(--room-stroke,var(--hp-muted,#607d8b));stroke-width:calc(0.6px * var(--hp-cell-visual-scale,1));pointer-events:none;}.wallbody.solid{fill:none;}.hp-static-stage .devlayer{position:absolute;inset:0;z-index:2;}.hp-static-foot{padding:8px 12px 12px;pointer-events:auto;}.hp-static-btn{width:100%;padding:9px 14px;border:none;border-radius:10px;background:var(--primary-color,#3ea6ff);color:var(--text-primary-color,#fff);font-size:14px;font-weight:600;cursor:pointer;}:host([data-pointer-hover]) .hp-static-btn:hover{filter:brightness(1.08);}.hp-static-error{padding:24px;text-align:center;color:var(--secondary-text-color,#9aa4ad);}`],customElements.get("houseplan-space-card")||customElements.define("houseplan-space-card",ug),window.customCards=window.customCards||[],window.customCards.find(e=>"houseplan-space-card"===e.type)||window.customCards.push({type:"houseplan-space-card",name:"House Plan — Space (static)",description:"Read-only live schematic of a single houseplan space, with a deep-link button.",preview:!1,documentation:"https://github.com/Matysh/houseplan-card"});const pg=o`:host{--hp-editor-tray-bg-fallback:color-mix(in srgb,var(--card-background-color,var(--hp-bg)) 94%,var(--hp-line));--hp-editor-tray-bg:color-mix(in srgb,var(--card-background-color,var(--hp-bg)) 86%,transparent);--hp-editor-tray-border:color-mix(in srgb,var(--hp-line) 82%,var(--hp-accent));--hp-editor-tray-blur:8px;--hp-editor-tray-shadow:var(--shadow-2);}.editor-secondary-host{position:absolute;inset:var(--sp-2) var(--sp-4) auto;z-index:70;display:flex;justify-content:flex-end;pointer-events:none;}.editor-secondary-host.kind-palette,.editor-secondary-host.kind-group{justify-content:flex-start;}.editor-secondary{pointer-events:none;max-width:100%;display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-3) var(--sp-4);color:var(--hp-txt);background:var(--card-background-color,var(--hp-bg));background:var(--hp-editor-tray-bg-fallback);border:1px solid var(--hp-line);border-color:var(--hp-editor-tray-border);border-radius:var(--rad-l);box-shadow:var(--hp-editor-tray-shadow);opacity:0;visibility:hidden;transform:translateY(-4px);transition:opacity 0.1s ease,transform 0.1s cubic-bezier(0.2,0.7,0.2,1),visibility 0s linear 0.1s;touch-action:auto;}.editor-secondary-host.open .editor-secondary{pointer-events:auto;opacity:1;visibility:visible;transform:translateY(0);transition-duration:0.14s,0.14s,0s;transition-delay:0s;}.editor-secondary-host.blocked .editor-secondary{pointer-events:none;}@supports ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){.editor-secondary{background:var(--hp-editor-tray-bg);-webkit-backdrop-filter:blur(var(--hp-editor-tray-blur));backdrop-filter:blur(var(--hp-editor-tray-blur));}}.editor-secondary-content,.editor-group-items{display:flex;align-items:center;gap:var(--sp-3);min-width:0;}.editor-context-label{max-width:14rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-inline-end:var(--sp-4);border-inline-end:1px solid var(--hp-line);color:var(--hp-muted);font-size:var(--fs-s);}.editor-secondary.kind-palette{width:min(760px,100%);align-items:stretch;padding:0;overflow:hidden;}.editor-secondary.kind-palette .editor-secondary-content,.editor-secondary.kind-palette .furnpalette{width:100%;}.editor-secondary.kind-palette .furnpalette{max-height:38vh;border:0;background:transparent;}.editor-group-launcher .group-chevron{--mdc-icon-size:16px;transition:transform 0.14s ease;}.editor-group-launcher[aria-expanded="true"] .group-chevron{transform:rotate(180deg);}.editor-secondary .bdhint{font-size:var(--fs-s);color:var(--hp-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.editor-secondary .dfill{display:inline-flex;align-items:center;gap:var(--sp-2);font-size:var(--fs-s);cursor:pointer;}.editor-secondary .dfill input[type="checkbox"]{width:16px;height:16px;flex:none;margin:0;padding:0;}.editor-secondary hp-color-opacity{flex:0 0 auto;}.editor-secondary input{width:74px;background:transparent;border:1px solid var(--hp-line);color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-m);}.editor-secondary label,.editor-secondary .hint{color:var(--hp-muted);font-size:var(--fs-s);}.editor-secondary .drawwall{display:inline-flex;align-items:center;gap:var(--sp-3);white-space:nowrap;}.editor-secondary .drawwall input{width:4.2em;}.editor-secondary .drawwall .opl{color:var(--hp-muted);font-size:var(--fs-s);}@container (min-width:560px) and (max-width:899px){.editor-secondary-content,.editor-group-items{flex-wrap:wrap;justify-content:flex-end;}}@container (max-width:559px){.editor-secondary-host{inset-inline:var(--sp-4);}.editor-secondary{max-width:100%;}.editor-secondary-content,.editor-group-items{overflow-x:auto;scrollbar-width:thin;}.editor-secondary-content>*,.editor-group-items>*{flex:none;}.editor-context-label{display:none;}}@media (prefers-reduced-motion:reduce){.editor-secondary{transition:none;}.editor-group-launcher .group-chevron{transition:none;}}`;class _g{constructor(e=50){this._undo=[],this._redo=[],this._limit=Math.max(30,Math.floor(e))}get canUndo(){return this._undo.length>0}get canRedo(){return this._redo.length>0}get undoName(){return this._undo[this._undo.length-1]?.name??null}get redoName(){return this._redo[this._redo.length-1]?.name??null}get size(){return this._undo.length}push(e){this._undo.push(e),this._undo.length>this._limit&&this._undo.splice(0,this._undo.length-this._limit),this._redo=[]}undo(){const e=this._undo.pop()??null;return e&&this._redo.push(e),e}redo(){const e=this._redo.pop()??null;return e&&this._undo.push(e),e}removeWhere(e){const t=this._undo.length,i=this._redo.length;return this._undo=this._undo.filter(t=>!e(t)),this._redo=this._redo.filter(t=>!e(t)),t+i-this._undo.length-this._redo.length}clear(){this._undo=[],this._redo=[]}}function mg(e,t){const i=e[t];return i&&Number.isFinite(i.x)&&Number.isFinite(i.y)?{x:i.x,y:i.y,..."string"==typeof i.s?{s:i.s}:{}}:null}function gg(e,t,i){if(null===i){if(!(t in e))return e;const i={...e};return delete i[t],i}const n={...e[t]||{}};delete n.x,delete n.y,delete n.s;const r={...n,x:i.x,y:i.y,...void 0!==i.s?{s:i.s}:{}};return{...e,[t]:r}}const fg="houseplan-card:version-reload-target:v1";function vg(e){if("string"!=typeof e)return null;return e.trim()||null}class yg{constructor(e){this.hooks=e,this._input={frontendVersion:null,backendVersion:null,kiosk:!1,reducedMotion:!1},this._relation={kind:"unknown"},this._banner=null,this._connected=!1,this._attemptTarget=null,this._attemptState=null,this._noticeToken=0}get relation(){return this._relation}get banner(){return this._banner}get hasCurrentMismatchNotice(){return"mismatch"===this._relation.kind&&"visible"===this._banner?.phase}connect(){this._connected||(this._connected=!0,this._attemptTarget=null,this._attemptState=null,this._reconcile())}disconnect(){(this._connected||this._banner)&&(this._connected=!1,this._cancelTimer(),this._banner&&(this._banner=null,this.hooks.changed()))}update(e){const t={frontendVersion:vg(e.frontendVersion),backendVersion:vg(e.backendVersion),kiosk:!0===e.kiosk,reducedMotion:!0===e.reducedMotion},i=function(e,t){const i=vg(e),n=vg(t);return i&&n?i===n?{kind:"equal",frontend:i,backend:n}:{kind:"mismatch",frontend:i,backend:n}:{kind:"unknown"}}(t.frontendVersion,t.backendVersion),n=!((e,t)=>e.frontendVersion===t.frontendVersion&&e.backendVersion===t.backendVersion&&e.kiosk===t.kiosk&&e.reducedMotion===t.reducedMotion)(this._input,t)||!((e,t)=>e.kind===t.kind&&("unknown"===e.kind||"unknown"!==t.kind&&e.frontend===t.frontend&&e.backend===t.backend))(this._relation,i);this._input=t,this._relation=i,n&&this._reconcile()}finishBannerExit(e){this._banner&&"leaving"===this._banner.phase&&this._banner.token===e&&(this._banner=null,this.hooks.changed())}_reconcile(){if(this._cancelTimer(),!this._connected||"mismatch"!==this._relation.kind)return this._attemptTarget=null,this._attemptState=null,void this._hideBanner();if(!this._input.kiosk)return this._attemptTarget=null,this._attemptState=null,void this._showBanner(this._relation.frontend,this._relation.backend);const e=this._relation.backend;if(this._attemptTarget===e&&null!==this._attemptState||(this._attemptTarget=e,this._attemptState=function(e,t){try{const i=e();return i?i.getItem(fg)===t?"attempted":"fresh":"unavailable"}catch{return"unavailable"}}(this.hooks.storage,e)),"fresh"===this._attemptState)return this._hideBanner(),void this._armTimer();this._showBanner(this._relation.frontend,e)}_armTimer(){this._connected&&void 0===this._timer&&"mismatch"===this._relation.kind&&this._input.kiosk&&"fresh"===this._attemptState&&(this._timer=this.hooks.clock.setTimeout(()=>{this._timer=void 0,this._tick()},250))}_cancelTimer(){void 0!==this._timer&&(this.hooks.clock.clearTimeout(this._timer),this._timer=void 0)}_tick(){if(!this._connected||"mismatch"!==this._relation.kind||!this._input.kiosk||"fresh"!==this._attemptState)return;if(!function(e){return e.connected&&e.initialFrameSettled&&e.viewOnly&&e.surfacesIdle&&e.configWritesIdle&&e.physicalWritesIdle&&e.layoutWritesIdle&&e.gesturesIdle&&e.interactionPauseElapsed&&e.baseZoom}(this.hooks.safety()))return void this._armTimer();const e=this._relation.backend,t=function(e,t){try{const i=e();return i?i.getItem(fg)===t?"attempted":(i.setItem(fg,t),"claimed"):"unavailable"}catch{return"unavailable"}}(this.hooks.storage,e);if(this._attemptTarget=e,this._attemptState="claimed"===t?"attempted":t,"claimed"===t){this._showBanner(this._relation.frontend,e);try{this.hooks.reload()}catch{}}else this._showBanner(this._relation.frontend,e)}_showBanner(e,t){"visible"===this._banner?.phase&&this._banner.frontend===e&&this._banner.backend===t||(this._banner={frontend:e,backend:t,phase:"visible",token:++this._noticeToken},this.hooks.changed())}_hideBanner(){if(this._banner)return this._input.reducedMotion?(this._banner=null,void this.hooks.changed()):void("leaving"!==this._banner.phase&&(this._banner={...this._banner,phase:"leaving",token:++this._noticeToken},this.hooks.changed()))}}const bg=1;function wg(e,t){const i=t&&"object"==typeof t?t:{};e._haIntegrationVersion=vg(i.integration_version);const n=i.support_api;e._haSupportApi="number"==typeof n&&Number.isSafeInteger(n)?n:null,e._haDecorAssetsApi=1===i.decor_assets_api?1:null,e._haSummaryPanelApi=1===i.summary_panel_api?1:null,e._haRadarStage1Api=1===i.radar_stage1_api?1:null,e._syncVersionRecovery()}function kg(e){const t=e._stageEl,i=e._loadOk&&!e._loading&&e._continuityDataReady&&!e._resumeSettling&&!e._connectionWasLost&&!e._booting&&!e._bootFading&&!e._bootSettling&&!e._bootSoft&&e._continuity.hasCompleteFrame&&"steady"===e._continuity.state&&!e._continuity.overlayBlocksInteraction&&!!t&&t.clientWidth>0&&t.clientHeight>0,n=!(0!==e._pointers.size||0!==e._touchContacts.size||e._touchSequenceMultitouch||e._roomPointer||e._panStart||e._panLock||e._pinchStart||e._swipeStart||e._tabDrag||e._tabDragRelease||e._drag||e._deviceDrag||e._rlResize||e._resize?.dragging||e._physicalDrag||e._physicalRotate||e._opDrag||e._decorDraft||e._decorMove||e._dtDrag||e._bdDrag||e._furnTouchPending||e._compassDrag||e._viewportGestureDirty||e._devicePositionBusy||e._modeTransitionBusy||e._cameraTransition.active||e._slide||0!==e._warmModeRequest),r=!(e._editorSecondaryDialogBlocked||e._partitionDeleteDialog||e._roomDeleteDialog||e._backdropGuard||e._vacFit||e._editorSecondary?.hasOpenGroup||e._furnPalette||e._decorImagePalette);return{connected:e.isConnected,initialFrameSettled:i,viewOnly:!0===e._config?.kiosk&&"view"===e._mode&&!e._editing,surfacesIdle:r,configWritesIdle:0===e._writesPending&&!e._saveConfigDebounced.pending(),physicalWritesIdle:0===e._pendingPhysicalWrites.size,layoutWritesIdle:!e._persistLayout.pending()&&0===e._dirtyPos.size&&0===e._sentPos.size&&!e._devicePositionBusy,gesturesIdle:n,interactionPauseElapsed:Date.now()>=e._cyclePausedUntil,baseZoom:e._zoom<=1.001}}class xg{constructor(){this.seen=null,this.diagnosticsCache=null}observe(e,t,i,n){this.invalidateDiagnosticsForHass(e,t,i),this.intake(t,n)}intake(e,t){e&&this.seen!==e&&(this.seen=e,t())}invalidate(){this.diagnosticsCache=null}invalidateDiagnosticsForHass(e,t,i){this.diagnosticsCache&&(e?.entities!==t?.entities||e?.devices!==t?.devices||[...i?.entityIds||[]].some(i=>!!e?.states?.[i]!=!!t?.states?.[i]))&&this.invalidate()}diagnostics(e,t,i){if(this.diagnosticsCache)return this.diagnosticsCache;const n={active:0,ha_disabled:0,orphaned:0,unverified:0};for(const e of t)e.removed||"virtual"===e.binding||n[i(e.binding).kind]++;return this.diagnosticsCache={registry:hd(e),bindings:n},this.diagnosticsCache}}function Sg(e){const t=e;t._hassSequence++,t._renderSnapshotAt=Date.now(),t._continuity.note("hass-snapshot"),t._ensureHaRegistryAuthority(),t._planHassMemo=null,t._hookConnection(),!t._loadOk&&!t._loading&&t._loadTries<8&&t._loadFromServer(),t._maybeRebuildDevices(),t._vacTick(),t._activityTick()}function $g(e){return!!e&&"object"==typeof e&&1===e.version}function Mg(e,t){const i=e.radar;return e.space===t&&!0!==e.hidden&&!0!==e.removed&&$g(i)&&!0===i.enabled&&!1!==i.show_live}const Rg={ok:"radar.health_ok",off:"radar.health_off",stale:"radar.health_stale",partial:"radar.health_partial",restricted:"radar.health_restricted",incomplete:"radar.health_incomplete",position_unavailable:"radar.health_position_unavailable",unavailable:"radar.health_unavailable",needs_setup:"radar.health_needs_setup",inconsistent:"radar.health_inconsistent",unknown:"radar.health_unknown"};const Cg=e=>"number"==typeof e&&Number.isFinite(e);class Tg{constructor(e){this.host=e,this.frames=new Map,this.connection=null,this.space="",this.generation=0,this.expiryTimer=0,this.deadlines=new Map}sync(e,t){const i=this.host.hass?.connection;if(!t||!i||!this.host.isConnected)return void this.stop();if(this.unsubscribe&&this.connection===i&&this.space===e)return;this.stop(),this.connection=i,this.space=e;const n=++this.generation,r=i.subscribeMessage?.bind(i);"function"==typeof r&&Promise.resolve(r(e=>{if(n!==this.generation||!this.host.isConnected)return;const t=function(e){if(!e||"object"!=typeof e)return null;const t=e;if("string"!=typeof t.marker_id||"string"!=typeof t.server_session_id||!Number.isSafeInteger(t.seq)||"string"!=typeof t.health)return null;const i=Array.isArray(t.targets)?t.targets.slice(0,256).flatMap(e=>{if(!e||"object"!=typeof e)return[];const t=e;return"string"==typeof t.slot&&Cg(t.x)&&Cg(t.y)&&Cg(t.expires_at)&&Cg(t.reported_at)&&("bounded_latest"===t.pair_quality||"coherent"===t.pair_quality)?[{...t,included:!0===t.included,smooth:!0===t.smooth}]:[]}):[],n=Array.isArray(t.ranges)?t.ranges.slice(0,64).flatMap(e=>{if(!e||"object"!=typeof e)return[];const t=e;if(!("string"==typeof t.id&&Cg(t.x)&&Cg(t.y)&&Cg(t.radius)&&Cg(t.expires_at)&&Cg(t.reported_at)))return[];const i=Array.isArray(t.segments)?t.segments.slice(0,64).flatMap(e=>{if(!Array.isArray(e))return[];const t=e.slice(0,181).flatMap(e=>Array.isArray(e)&&2===e.length&&Cg(e[0])&&Cg(e[1])?[[e[0],e[1]]]:[]);return t.length>=2?[t]:[]}):void 0;return[{...t,...i?{segments:i}:{}}]}):[],r=Array.isArray(t.zones)?t.zones.slice(0,64).flatMap(e=>{if(!e||"object"!=typeof e)return[];const t=e;if("string"!=typeof t.id)return[];const i=t.state;if(null!==i&&"boolean"!=typeof i&&!Cg(i))return[];const n=Array.isArray(t.polygon)?t.polygon.slice(0,64).flatMap(e=>Array.isArray(e)&&2===e.length&&Cg(e[0])&&Cg(e[1])?[[e[0],e[1]]]:[]):[];return[{id:t.id,state:i,...n.length>=3?{polygon:n}:{}}]}):[];return{server_session_id:t.server_session_id,marker_id:t.marker_id,source_generation:"string"==typeof t.source_generation?t.source_generation:void 0,calibration_revision:"string"==typeof t.calibration_revision?t.calibration_revision:void 0,seq:t.seq,reported_at:Cg(t.reported_at)?t.reported_at:void 0,expires_at:Cg(t.expires_at)?t.expires_at:void 0,health:t.health,reported_presence:"boolean"==typeof t.reported_presence?t.reported_presence:null,complete:!0===t.complete,targets:i,ranges:n,zones:r}}(e);if(!t)return;if(!function(e,t){return!e||t.server_session_id!==e.server_session_id||t.source_generation!==e.source_generation||t.calibration_revision!==e.calibration_revision||t.seq>e.seq}(this.frames.get(t.marker_id),t))return;const i=function(e,t=Date.now()){if(!Cg(e.expires_at))return null;if(!Cg(e.reported_at))return Math.max(0,1e3*e.expires_at-t);const i=Math.max(0,1e3*(e.expires_at-e.reported_at)),n=Math.max(0,t-1e3*e.reported_at);return Math.max(0,i-n)}(t);"restricted"===t.health||"disabled"===t.health||0===i?(this.frames.delete(t.marker_id),this.deadlines.delete(t.marker_id)):(this.frames.set(t.marker_id,t),null==i?this.deadlines.delete(t.marker_id):this.deadlines.set(t.marker_id,this.monotonicNow()+i)),this.armExpiry(),this.host.requestUpdate()},{type:"houseplan/radar/subscribe",space_id:e})).then(e=>{n===this.generation&&this.host.isConnected?"function"==typeof e&&(this.unsubscribe=e):"function"==typeof e&&e()}).catch(()=>{n===this.generation&&this.stop()})}stop(){this.generation++,this.unsubscribe?.(),this.unsubscribe=void 0,this.connection=null,this.space="",clearTimeout(this.expiryTimer),this.expiryTimer=0,this.frames.size&&(this.frames.clear(),this.host.isConnected&&this.host.requestUpdate()),this.deadlines.clear()}armExpiry(){clearTimeout(this.expiryTimer);const e=this.monotonicNow(),t=[...this.deadlines.values()].filter(t=>t>e);if(!t.length)return;const i=Math.max(20,Math.min(...t)-e+10);this.expiryTimer=window.setTimeout(()=>{this.expiryTimer=0;let e=!1;const t=this.monotonicNow();for(const[i,n]of this.deadlines)n>t||(this.deadlines.delete(i),this.frames.delete(i),e=!0);this.armExpiry(),e&&this.host.isConnected&&this.host.requestUpdate()},i)}monotonicNow(){return globalThis.performance?.now?.()??Date.now()}}const Dg=Object.freeze({enabled:!1,z2mBaseTopics:Object.freeze([])});function Ag(e){if("string"!=typeof e)return null;const t=e.trim().replace(/^\/+|\/+$/g,"").replace(/\/{2,}/g,"/");return!t||t.length>180||/[#+\u0000-\u001f\u007f]/.test(t)?null:t}function Pg(e){const t=e?.zigbee_topology;if(!t||"object"!=typeof t)return Dg;const i=t,n=Array.isArray(i.z2m_base_topics)?i.z2m_base_topics:Array.isArray(i.z2mBaseTopics)?i.z2mBaseTopics:[],r=new Set,o=[];for(const e of n){const t=Ag(e);if(t&&!r.has(t)&&(r.add(t),o.push(t),8===o.length))break}return{enabled:!0===i.enabled,z2mBaseTopics:o}}function Fg(e,t){const i={...e},n=t.z2mBaseTopics.map(Ag).filter(Boolean);return t.enabled||n.length?i.zigbee_topology={enabled:!0===t.enabled,z2m_base_topics:[...new Set(n)].slice(0,8)}:delete i.zigbee_topology,i}const zg={now:()=>performance.now(),requestFrame:e=>requestAnimationFrame(e),cancelFrame:e=>cancelAnimationFrame(e)},Ig=e=>Math.max(0,Math.min(1,e)),Og=(e,t,i)=>e+(t-e)*i,Eg=(e,t,i)=>{const n=1-e;return 3*n*n*e*t+3*n*e*e*i+e*e*e},Ng=e=>{const t=Ig(e);if(0===t||1===t)return t;let i=0,n=1,r=t;for(let e=0;e<12;e++)r=(i+n)/2,Eg(r,.2,.2)0&&e.w>0?t/e.w:1,viewBox:{...e}}}function Lg(e,t,i){const n=Math.max(1e-9,e.pixelsPerUnit),r=Math.max(1e-9,t/n),o=Math.max(1e-9,i/n);return{x:e.centerX-r/2,y:e.centerY-o/2,w:r,h:o}}function Bg(e){const t=e.trim(),i=/^rgba?\(\s*([\d.]+)[, ]+([\d.]+)[, ]+([\d.]+)(?:\s*[,/]\s*([\d.]+))?\s*\)$/i.exec(t);if(i)return[Number(i[1]),Number(i[2]),Number(i[3]),null==i[4]?1:Number(i[4])];const n=/^#([0-9a-f]{6}|[0-9a-f]{8})$/i.exec(t)?.[1];return n?[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16),8===n.length?parseInt(n.slice(6,8),16)/255:1]:null}function qg(e,t,i){const n=Bg(e),r=Bg(t);if(!n||!r)return i<.5?e:t;const o=Ig(i);return`rgba(${Math.round(Og(n[0],r[0],o))}, ${Math.round(Og(n[1],r[1],o))}, ${Math.round(Og(n[2],r[2],o))}, ${Og(n[3],r[3],o).toFixed(3)})`}class jg{constructor(e,t=zg){this._hooks=e,this._clock=t,this._token=0,this._raf=0,this._state=null}get state(){return this._state}get active(){return"running"===this._state?.phase||"preparing"===this._state?.phase}get presented(){return this._state?.presented||null}start(e,t,i,n=220){this.cancel(!1);const r=++this._token,o=this._clock.now();if(this._state={token:r,phase:n<=0?"settling":"running",from:e,to:t,presented:n<=0?t:e,startedAt:o,duration:Math.max(0,n),targetMode:i},n<=0)return this._hooks.frame(this._state),this._hooks.settled(this._state),this._state=null,r;this._hooks.frame(this._state);const s=e=>{const t=this._state;if(!t||t.token!==r)return;const i=Ig((e-t.startedAt)/t.duration);t.presented=i>=1?t.to:function(e,t,i){const n=Ng(i),r=Og(e.stageWidth,t.stageWidth,n),o=Og(e.stageHeight,t.stageHeight,n),s=Math.max(1e-9,e.viewport.pixelsPerUnit),a=Math.max(1e-9,t.viewport.pixelsPerUnit),l={centerX:Og(e.viewport.centerX,t.viewport.centerX,n),centerY:Og(e.viewport.centerY,t.viewport.centerY,n),pixelsPerUnit:Math.exp(Og(Math.log(s),Math.log(a),n))};return{presentedMode:n<.5?e.presentedMode:t.presentedMode,editorChromeHeight:Og(e.editorChromeHeight,t.editorChromeHeight,n),stageWidth:r,stageHeight:o,viewport:{...l,viewBox:Lg(l,r,o)},stageColor:qg(e.stageColor,t.stageColor,n),paperColor:qg(e.paperColor,t.paperColor,n),sceneBrightness:Og(e.sceneBrightness,t.sceneBrightness,n),architectureOpacity:Og(e.architectureOpacity,t.architectureOpacity,n),backdropOpacity:Og(e.backdropOpacity,t.backdropOpacity,n),viewWeight:Og(e.viewWeight,t.viewWeight,n),editorWeight:Og(e.editorWeight,t.editorWeight,n),toolbarContentOpacity:Og(e.toolbarContentOpacity,t.toolbarContentOpacity,n)}}(t.from,t.to,i),t.phase=i>=1?"settling":"running",this._hooks.frame(t),i<1?this._raf=this._clock.requestFrame(s):(this._raf=0,this._hooks.settled(t),this._state?.token===r&&(this._state=null))};return this._raf=this._clock.requestFrame(s),r}cancel(e=!0){this._raf&&this._clock.cancelFrame(this._raf),this._raf=0;const t=this._state;this._state=null,this._token++,t&&e&&(t.phase="settling",t.presented=t.to,this._hooks.frame(t),this._hooks.settled(t))}dispose(){this.cancel(!1)}}const Wg={now:()=>"undefined"!=typeof performance?performance.now():Date.now(),requestFrame:e=>"function"==typeof requestAnimationFrame?requestAnimationFrame(e):null,cancelFrame:e=>{"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(e)}},Ug=e=>Number.isFinite(e);function Gg(e){return!!e&&Ug(e.zoom)&&e.zoom>0&&Ug(e.viewBox.x)&&Ug(e.viewBox.y)&&Ug(e.viewBox.w)&&e.viewBox.w>0&&Ug(e.viewBox.h)&&e.viewBox.h>0}function Vg(e){return{zoom:e.zoom,viewBox:{...e.viewBox}}}function Kg(e,t){return Math.abs(e.zoom-t.zoom)<1e-9&&Math.abs(e.viewBox.x-t.viewBox.x)<1e-6&&Math.abs(e.viewBox.y-t.viewBox.y)<1e-6&&Math.abs(e.viewBox.w-t.viewBox.w)<1e-6&&Math.abs(e.viewBox.h-t.viewBox.h)<1e-6}const Yg=(e,t,i)=>e+(t-e)*i,Xg=(e,t,i)=>Math.exp(Yg(Math.log(e),Math.log(t),i));class Zg{constructor(e,t=Wg){this._hooks=e,this._clock=t,this._token=0,this._raf=null,this._state=null}get state(){return this._state}get active(){return"running"===this._state?.phase}get presented(){return this._state?.presented||null}get target(){return this._state?.to||null}start(e,t,i,n){this.cancel(!1);const r=++this._token,o=Vg(e),s=Vg(t),a=n>0&&Gg(o)&&Gg(s),l=this._clock.now(),c={token:r,phase:a?"running":"settling",from:o,to:s,presented:Vg(a?o:s),startedAt:l,duration:a?n:0,reason:i};if(this._state=c,this._hooks.frame(c),!a)return this._settle(r),r;const h=e=>{const t=this._state;if(!t||t.token!==r)return;const i=Math.max(0,Math.min(1,(e-t.startedAt)/t.duration));if(t.presented=i>=1?Vg(t.to):function(e,t,i){if(!Gg(e))return Vg(t);if(!Gg(t))return Vg(e);const n=Ng(i);if(n<=0)return Vg(e);if(n>=1)return Vg(t);const r=e.viewBox.x+e.viewBox.w/2,o=e.viewBox.y+e.viewBox.h/2,s=t.viewBox.x+t.viewBox.w/2,a=t.viewBox.y+t.viewBox.h/2,l=Xg(e.viewBox.w,t.viewBox.w,n),c=Xg(e.viewBox.h,t.viewBox.h,n),h=Yg(r,s,n),d=Yg(o,a,n);return{zoom:Xg(e.zoom,t.zoom,n),viewBox:{x:h-l/2,y:d-c/2,w:l,h:c}}}(t.from,t.to,i),t.phase=i>=1?"settling":"running",this._hooks.frame(t),i>=1)return this._raf=null,void this._settle(r);this._raf=this._clock.requestFrame(h),null===this._raf&&this._settle(r)};return this._raf=this._clock.requestFrame(h),null===this._raf&&(c.phase="settling",c.presented=Vg(s),this._hooks.frame(c),this._settle(r)),r}cancel(e=!0){null!==this._raf&&this._clock.cancelFrame(this._raf),this._raf=null;const t=this._state;this._state=null,this._token++,t&&e&&(t.phase="settling",t.presented=Vg(t.to),this._hooks.frame(t),this._hooks.settled(t))}dispose(){this.cancel(!1)}_settle(e){const t=this._state;t&&t.token===e&&(t.phase="settling",t.presented=Vg(t.to),this._hooks.settled(t),this._state?.token===e&&(this._state=null))}}function Jg(e,t,i){const n=e.querySelector("ha-card");if(!n)return null;const r=n.getBoundingClientRect(),o=t.getBoundingClientRect().top-r.top,s=i?0:Math.min(Math.max(r.top,0),120),a=Math.round(o+s);return a>=0?a:null}const Qg=Object.freeze({rotDeg:4,tiltDeg:20,xyScale:1,zScale:1,origin:Object.freeze([500,500])}),ef=64,tf=10,nf=4,rf=68;function of(e){return[e.rotDeg,e.tiltDeg,e.xyScale,e.zScale,e.origin[0],e.origin[1]].every(Number.isFinite)&&Math.abs(e.xyScale)>1e-12&&Math.abs(Math.cos(e.tiltDeg*Math.PI/180))>1e-12}function sf(e,t,i=Qg){if(!Number.isFinite(e[0])||!Number.isFinite(e[1]))throw new Error("invalid isometric projection input");return function(e,t){if(!Number.isFinite(e[0])||!Number.isFinite(e[1])||!t.every(Number.isFinite))throw new Error("invalid isometric affine input");const[i,n,r,o,s,a]=t;return[i*e[0]+r*e[1]+s,n*e[0]+o*e[1]+a]}(e,lf(t,i))}function af(e,t=Qg){if(!of(t)||!Number.isFinite(e[0])||!Number.isFinite(e[1]))throw new Error("invalid isometric projection input");const i=t.rotDeg*Math.PI/180,n=t.tiltDeg*Math.PI/180,r=(e[0]-t.origin[0])/t.xyScale,o=(e[1]-t.origin[1])/(t.xyScale*Math.cos(n));return[t.origin[0]+r*Math.cos(i)+o*Math.sin(i),t.origin[1]-r*Math.sin(i)+o*Math.cos(i)]}function lf(e=0,t=Qg){if(!of(t)||!Number.isFinite(e))throw new Error("invalid isometric camera");const i=t.rotDeg*Math.PI/180,n=t.tiltDeg*Math.PI/180,r=t.xyScale*Math.cos(i),o=-t.xyScale*Math.sin(i),s=t.xyScale*Math.sin(i)*Math.cos(n),a=t.xyScale*Math.cos(i)*Math.cos(n);return[r,s,o,a,t.origin[0]-r*t.origin[0]-o*t.origin[1],t.origin[1]-s*t.origin[0]-a*t.origin[1]-e*t.zScale*Math.sin(n)]}function cf(e=Qg){return function(e=0,t=Qg){return`matrix(${lf(e,t).map(e=>Number(e.toFixed(12))).join(" ")})`}(0,e)}function hf(e,t=Qg){const{rect:i,wallHeight:n}=e,r=e.openingHeight??n,o=e.floorDepth??0,s=e.raisedHeight??n;if(!(i.w>=0)||!(i.h>=0)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(s)||n<0||r<0||o<0||s<0)throw new Error("invalid isometric frame");const a=[[i.x,i.y],[i.x+i.w,i.y],[i.x+i.w,i.y+i.h],[i.x,i.y+i.h]],l=Math.max(n,r,s),c=a.flatMap(e=>[sf(e,-o,t),sf(e,l,t)]),h=c.map(e=>e[0]),d=c.map(e=>e[1]),u=Math.min(...h),p=Math.min(...d);return{x:u,y:p,w:Math.max(...h)-u,h:Math.max(...d)-p}}const df=[".dev",".vacpuck",".oplock",".op-hit",".opening",".rlgo","a","button","input","select","textarea",'[contenteditable]:not([contenteditable="false"])',"[data-room-fit-block]",'[role="link"]','[role="button"]'].join(","),uf=(e,t)=>{try{return"function"==typeof e?.matches&&e.matches(t)}catch{return!1}};function pf(e){for(const t of e){const e=t;if(uf(e,".roomlabel[data-id]")){const t=e.getAttribute?.("data-id");return t?{kind:"room",roomId:t}:{kind:"interactive"}}if(uf(e,df))return{kind:"interactive"};if(uf(e,'[data-hp="room"][data-id]')){const t=e.getAttribute?.("data-id");return t?{kind:"room",roomId:t}:{kind:"interactive"}}if(uf(e,".stage"))return{kind:"background"}}return{kind:"outside"}}function _f(e){const t=pf(e);return"room"===t.kind?t.roomId:null}class mf{constructor(){this.pointer=null,this.sequence=null}clear(){this.pointer=null,this.sequence=null}clearOutside(e){let t={kind:"outside"};try{t=pf(e.composedPath())}catch{}"outside"===t.kind&&this.clear()}pointerDown(e,t,i){let n={kind:"outside"};try{n=pf(e.composedPath())}catch{}this.pointer=function(e){const t="mouse"===(i=e.pointerType)||"touch"===i||"pen"===i?i:null;var i;return t&&"view"===e.mode&&"background"===e.owner.kind&&!e.blocked&&e.isPrimary&&0===e.button&&Number.isFinite(e.x)&&Number.isFinite(e.y)?{pointerId:e.pointerId,spaceId:e.spaceId,modality:t,x:e.x,y:e.y}:null}({pointerId:e.pointerId,pointerType:e.pointerType,isPrimary:e.isPrimary,button:e.button,spaceId:t,mode:i?"view":"blocked",owner:n,blocked:!i,x:e.clientX,y:e.clientY}),this.pointer||(this.sequence=null)}pointerUp(e,t,i,n,r=Date.now()){let o={kind:"outside"};try{o=pf(e.composedPath())}catch{}const s=function(e,t,i){if(!t||"view"!==i.mode||"background"!==i.owner.kind||i.blocked||t.pointerId!==i.pointerId||t.spaceId!==i.spaceId||!Number.isFinite(i.x)||!Number.isFinite(i.y)||!Number.isFinite(i.now)||Math.abs(i.x-t.x)+Math.abs(i.y-t.y)>=8)return{sequence:null,trigger:!1};const n=e?i.now-e.at:Number.POSITIVE_INFINITY;return e&&e.spaceId===i.spaceId&&e.modality===t.modality&&n>=0&&n<=350?{sequence:null,trigger:!0}:{sequence:{at:i.now,spaceId:i.spaceId,modality:t.modality},trigger:!1}}(this.sequence,this.pointer,{pointerId:e.pointerId,spaceId:t,mode:i?"view":"blocked",owner:o,blocked:n||!i,x:e.clientX,y:e.clientY,now:r});return this.pointer=null,this.sequence=s.sequence,s.trigger}}const gf=e=>e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1]);function ff(e){return!!e&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.w)&&e.w>0&&Number.isFinite(e.h)&&e.h>0}function vf(e,t=0){if(!e.length||!Number.isFinite(t)||t<0||!e.every(gf))return null;let i=1/0,n=1/0,r=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t[0]),n=Math.min(n,t[1]),r=Math.max(r,t[0]),o=Math.max(o,t[1]);const s=r-i,a=o-n;return s>0&&a>0?{x:i-t,y:n-t,w:s+2*t,h:a+2*t}:null}function yf(e,t,i){const n="string"!=typeof t||"invalid"!==t&&"no-borders"!==t&&"unverified"!==t&&!/^[a-z0-9]{1,8}$/i.test(t)?"redacted":t;return Object.freeze({kind:e,fingerprint:n,terminal:!!i})}function bf(e,t){return`${e("editor.load_failed")} ${e(t.terminal?"editor.refresh_advice":"editor.retry_advice")}`}class wf extends Error{}class kf{constructor(e){this.options=e,this._state="idle",this._inFlight=null}get state(){return this._state}ensure(){return"ready"===this._state?Promise.resolve(!0):"failed"===this._state?Promise.resolve(!1):(this._inFlight||(this._setState("loading"),this._inFlight=this._loadWithRetry().finally(()=>{this._inFlight=null})),this._inFlight)}async _loadWithRetry(){let e=new Error("Editor runtime did not load"),t=!1;for(const i of[0,1])try{const e=await this.options.load(i);if(e.fingerprint!==this.options.expectedFingerprint)throw new wf(`Editor runtime fingerprint mismatch: expected ${this.options.expectedFingerprint}, got ${e.fingerprint}`);const t=e.create();return this.options.install(t),this._setState("ready"),!0}catch(i){e=i,i instanceof wf&&(t=!0)}return this._setState(t?"failed":"idle"),this.options.failed?.(e,{terminal:t}),!1}_setState(e){e!==this._state&&(this._state=e,this.options.stateChanged?.(e))}}const xf=(e,t)=>{if(!e.has(t))return{hit:!1};const i=e.get(t);return e.delete(t),e.set(t,i),{hit:!0,value:i}},Sf=(e,t,i,n)=>{for(e.delete(t),e.set(t,i);e.size>n;){const t=e.keys().next().value;if(void 0===t)break;e.delete(t)}},$f=new Set(["select","draw","column","merge","split","resize","opening","wallthick","delroom"]),Mf=e=>`${window.innerWidth}x${window.innerHeight}|${location.pathname}|${JSON.stringify(e??{})}`,Rf="houseplan_card_alpha_v1",Cf=Object.freeze([Object.freeze({id:"iso",issue:89,summary:"Volumetric plan renderer"})]);function Tf(e){return/^[a-z][a-z0-9-]*$/.test(e.id)&&Number.isInteger(e.issue)&&e.issue>0&&!!e.summary.trim()}function Df(e){const t=String(e||"").replace(/^#/,"");return new URLSearchParams(t)}function Af(e){return Df(e).get("space")||""}function Pf(e,t,i=Cf){const n=function(e){const t=new Set;for(const i of e){if(!Tf(i)||t.has(i.id))return!1;t.add(i.id)}return!0}(i),r=function(e){let t,i=!1;const n=e=>{for(const n of e.getAll("hp_alpha"))i=!0,"1"===n?t=!0:"0"===n&&(t=!1)};return n(new URLSearchParams(String(e.search||"").replace(/^\?/,""))),n(Df(e.hash)),{present:i,value:t}}(e),o=void 0!==r.value,s="1"===t,a=o?!0===r.value:!r.present&&s,l=n&&a;return{alpha:l,active:Object.freeze(l?i.map(e=>e.id).sort():[]),space:Af(e.hash),persist:n&&o?l?"1":"0":void 0,knownUrlOperation:o}}let Ff={alpha:!1,active:Object.freeze([]),space:""},zf=!1,If="";const Of=new Set;function Ef(){if("undefined"==typeof window)return Ff;const e=Pf(window.location,function(){try{return window.localStorage.getItem(Rf)}catch{return null}}());void 0!==e.persist&&function(e){try{window.localStorage.setItem(Rf,e)}catch{}}(e.persist),Ff={alpha:e.alpha,active:e.active,space:e.space},window.__hpAlpha=e.alpha,window.__hpLabs=e.active;for(const e of Of)e(Ff);return Ff}function Nf(){Ef()}function Hf(){if("undefined"==typeof window)return Ff;if(!zf){zf=!0,window.__hpLabsListenerCleanup?.(),window.addEventListener("hashchange",Nf),window.addEventListener("popstate",Nf);const e=()=>{window.removeEventListener("hashchange",Nf),window.removeEventListener("popstate",Nf),window.__hpLabsListenerCleanup===e&&delete window.__hpLabsListenerCleanup};window.__hpLabsListenerCleanup=e}return Ef()}const Lf={window:120,door:90,passage:90,gate:300};function Bf(e){return Lf[e]}function qf(e,t){return{type:e,lengthCm:Bf(e),flipH:!1,flipV:!1,revision:t}}function jf(e,t){const i=Math.max(0,e.renderedLength)/2,n=Math.max(0,e.target.physicalHalfWidth),r=n+.18*Math.max(0,t),o=e=>({x1:e,y1:-r,x2:e,y2:r});return{rect:{x:-i,y:n?-n:0,width:2*i,height:2*n},boundaries:[o(-i),o(i)]}}function Wf(e,t){const i=[e[0],e[1]],n=[t[0],t[1]];return function(e,t){return e[0]-t[0]||e[1]-t[1]}(i,n)<=0?{a:i,b:n}:{a:n,b:i}}function Uf(e){const t=new Map;return e.forEach((e,i)=>{if(!e.kind||e.open)return;const n=Wf(e.a,e.b);if(Math.hypot(n.b[0]-n.a[0],n.b[1]-n.a[1])<=1e-9)return;const r=function(e,t){const i=e=>(Math.abs(e)<=5e-10?0:Math.round(1e6*e)/1e6).toFixed(6);return`${i(e[0])},${i(e[1])}>${i(t[0])},${i(t[1])}`}(n.a,n.b),o=t.get(r);if(o)return o.physicalHalfWidth=Math.max(o.physicalHalfWidth,e.half||0),o.sourceOrder=Math.min(o.sourceOrder,i),void(e.partitionHost&&(o.partitionHost&&o.partitionHost.id!==e.partitionHost.id?o.ambiguousPartitionHost=!0:o.partitionHost=e.partitionHost));t.set(r,{segmentKey:r,a:n.a,b:n.b,physicalHalfWidth:Math.max(0,e.half||0),sourceOrder:i,...e.partitionHost?{partitionHost:e.partitionHost}:{}})}),[...t.values()]}function Gf(e,t){if(Math.abs(e.distance-t.distance)>1e-9)return e.distance-t.distance;if(Math.abs(e.perpendicular-t.perpendicular)>1e-9)return e.perpendicular-t.perpendicular;return(e.target.segmentKeyt.target.segmentKey?1:0)||e.target.sourceOrder-t.target.sourceOrder}function Vf(e){const t=Uf(e.intervals).map(t=>{const i=function(e,t){const i=t.b[0]-t.a[0],n=t.b[1]-t.a[1],r=Math.hypot(i,n),o=i/r,s=n/r,a=(e[0]-t.a[0])*o+(e[1]-t.a[1])*s,l=Math.max(0,Math.min(r,a)),c=t.a[0]+l*o,h=t.a[1]+l*s;return{along:l,length:r,x:c,y:h,distance:Math.hypot(e[0]-c,e[1]-h),perpendicular:Math.abs((e[0]-t.a[0])*s-(e[1]-t.a[1])*o)}}(e.pointer,t);return{target:t,...i,envelope:Math.max(e.baseTolerance,t.physicalHalfWidth+e.bodyPointerPadding)}}).filter(e=>e.distance<=e.envelope+1e-9).filter(t=>!function(e,t,i,n,r){const o=t.b[0]-t.a[0],s=t.b[1]-t.a[1],a=Math.hypot(o,s);if(!(a>1e-9))return!1;const l=o/a,c=s/a;for(const o of i){if(!o.open&&o.kind)continue;const i=Wf(o.a,o.b),s=i.b[0]-i.a[0],a=i.b[1]-i.a[1],h=Math.hypot(s,a);if(!(h>1e-9))continue;const d=s/h,u=a/h;if(Math.abs(l*u-c*d)>1e-6)continue;if(Math.abs((i.a[0]-t.a[0])*c-(i.a[1]-t.a[1])*l)>r)continue;const p=(e[0]-i.a[0])*d+(e[1]-i.a[1])*u,_=1e-9;if(!(p<=_||p>=h-_)&&Math.abs((e[0]-i.a[0])*u-(e[1]-i.a[1])*d)<=n+1e-9)return!0}return!1}(e.pointer,t.target,e.intervals,t.envelope,Math.max(1e-9,Math.min(e.baseTolerance,.04*e.gridStep)))),i=t.filter(t=>!!t.target.partitionHost&&e.renderedLength+2*t.target.physicalHalfWidth>t.length+1e-9).sort(Gf),n=t.filter(t=>!t.target.partitionHost||e.renderedLength+2*t.target.physicalHalfWidth<=t.length+1e-9).sort(Gf);let r=n[0];if(!r)return{candidate:null,jambBlockedTarget:i[0]?.target||null};const o=n.filter(e=>Math.abs(e.distance-r.distance)<=1e-9&&Math.abs(e.perpendicular-r.perpendicular)<=1e-9),s=o.filter(e=>e.target.partitionHost);if(s.length){if(1!==new Set(s.map(e=>e.target.partitionHost.id)).size||s.some(e=>e.target.ambiguousPartitionHost))return{candidate:null,jambBlockedTarget:null};const e=s[0],t=e.target.b[0]-e.target.a[0],i=e.target.b[1]-e.target.a[1],n=Math.hypot(t,i),a=t/n,l=i/n;if(!o.every(t=>{const i=t.target.b[0]-t.target.a[0],n=t.target.b[1]-t.target.a[1],r=Math.hypot(i,n),o=i/r,s=n/r,c=Math.abs(a*s-l*o)<=1e-6,h=Math.abs((t.target.a[0]-e.target.a[0])*l-(t.target.a[1]-e.target.a[1])*a);return c&&h<=1e-9}))return{candidate:null,jambBlockedTarget:null};r=e}if(r.target.ambiguousPartitionHost)return{candidate:null,jambBlockedTarget:null};const{target:a,length:l}=r,c=a.b[0]-a.a[0],h=a.b[1]-a.a[1],d=c/l,u=h/l,p=a.partitionHost?a.physicalHalfWidth:0,_=Math.min(Math.max(0,e.renderedLength)/2+p,l/2);let m=r.along;const g=Math.max(e.gridStep,1e-9),f=l/2;m=Math.abs(m-f)<=g/2?f:Math.round(m/g)*g,m=Math.max(_,Math.min(l-_,m));const v=a.a[0]+d*m,y=a.a[1]+u*m,b=Math.max(0,e.renderedLength)/2,w=m-b,k=m+b,x=Math.max(0,w),S=Math.max(0,l-k),$=[a.a[0]+d*(w-x/2),a.a[1]+u*(w-x/2)],M=[a.a[0]+d*(k+S/2),a.a[1]+u*(k+S/2)];let R=180*Math.atan2(h,c)/Math.PI;R>=90?R-=180:R<-90&&(R+=180);const C=Math.abs(m-f)<=1e-9;return{candidate:{presetRevision:e.preset.revision,geometryRevision:e.geometryRevision,pointer:[e.pointer[0],e.pointer[1]],type:e.preset.type,lengthCm:e.preset.lengthCm,flipH:e.preset.flipH,flipV:e.preset.flipV,x:v,y:y,angle:R,renderedLength:e.renderedLength,target:a,...a.partitionHost?{host:{...a.partitionHost,t:l>0?m/l:0}}:{},measure:{labels:[{distance:x,midpoint:$},{distance:S,midpoint:M}],guide:C?{x:v,y:y,angle:R}:null}},jambBlockedTarget:null}}function Kf(e,t,i,n,r=1e-6){return e.presetRevision===i&&e.geometryRevision===n&&Math.hypot(e.pointer[0]-t[0],e.pointer[1]-t[1])<=r}function Yf(e){return!(!e.canEdit||e.kiosk||e.fixedFloor)&&("view"!==e.mode&&("mouse"===e.pointerType&&e.spaceCount>1))}class Xf{constructor(e,t,i){this.loader=e,this.host=t,this.adopted=i,this.attachment=null}connect(){if(this.runtime)return void this.runtime.connect();this.attachment?.cancel();const e=this.loader.attach(this.host,e=>this.adopt(e));this.runtime||(this.attachment=e)}disconnect(){this.attachment?.cancel(),this.attachment=null,this.runtime?.disconnect()}adopt(e){this.attachment=null,this.runtime||(this.runtime=e,this.adopted(e))}}const Zf=new class{constructor(e){this.load=e,this.factory=null,this.pending=null}get warm(){return null!==this.factory}create(e){return this.factory?this.factory(e):null}attach(e,t){let i=!0;const n={cancel:()=>{i=!1}},r=this.create(e);return r?(t(r),n):(this.ensure().then(n=>{i&&t(n(e))},()=>{}),n)}ensure(){return this.factory?Promise.resolve(this.factory):(this.pending||(this.pending=this.load().then(e=>(this.factory=e,this.pending=null,e),e=>{throw this.pending=null,e})),this.pending)}reset(){this.factory=null,this.pending=null}}(()=>import("./summary-panel-runtime-loaded-ospbRm0g.js").then(function(e){return e.e}).then(({LoadedSummaryPanelRuntime:e})=>t=>new e(t)));function Jf(e){const t=globalThis.__HP_VERSION_OVERRIDE__;return"string"==typeof t&&t.length>0?t:e}let Qf=0;const ev="1.76.0-beta.2",tv="74cbeb9792716ab64cfbcf339d3044c6e8ae33533bdef7216a6d7d513ae04091",iv=1500,nv=new Map;let rv=0,ov=1e4;const sv="houseplan_card_layout_v1",av="houseplan_card_cfg_v1",lv="houseplan_card_zoom_v1",cv="houseplan_card_nav_v1",hv="houseplan_card_view_v1",dv="hp-dialog, hp-help, hp-color-opacity, hp-device-preview",uv=1e3,pv=(e,t)=>{const i=Math.min(e.x,t.x),n=Math.min(e.y,t.y);return{x:i,y:n,w:Math.max(e.x+e.w,t.x+t.w)-i,h:Math.max(e.y+e.h,t.y+t.h)-n}},_v=(e,t,i)=>{const n=new Event(t,{bubbles:!0,composed:!0});n.detail=i??{},e.dispatchEvent(n)},mv=e=>{history.pushState(null,"",e),_v(window,"location-changed",{replace:!1})},gv=(e,t)=>{let i,n=null;const r=(...r)=>{clearTimeout(i),n=r,i=window.setTimeout(()=>{i=void 0;const t=n;n=null,t&&e(...t)},t)};return r.flush=()=>{if(void 0===i)return;clearTimeout(i),i=void 0;const t=n;n=null,t&&e(...t)},r.cancel=()=>{clearTimeout(i),i=void 0,n=null},r.pending=()=>void 0!==i,r},fv=e=>{try{e.target?.setPointerCapture?.(e.pointerId)}catch{}},vv=["edges","corners"];class yv extends he{constructor(){var e;super(...arguments),this._editorRuntime=null,this._liveRt=null,this._onboardingRuntime=null,this._editorRuntimeLoadingVisible=!1,this._backdropGuard=null,this._editorModeRequest=0,this._warmModeRequest=0,this._editorRuntimeLoader=new kf({expectedFingerprint:tv,load:async e=>{const t=0===e?await import("./houseplan-editor-runtime-BjAw4ds1.js"):await import((()=>{const e=new URL("./houseplan-editor-runtime-BjAw4ds1.js",import.meta.url);return e.searchParams.set("hp_retry",`${ev}-${++Qf}`),e.href})());return{fingerprint:t.EDITOR_RUNTIME_FINGERPRINT,create:()=>new t.HouseplanEditorRuntime(this)}},install:e=>{this._editorRuntime=e},stateChanged:e=>this._editorRuntimeStateChanged(e),failed:(e,t)=>{console.error("[houseplan] unable to load editor runtime",e),t.terminal&&this._versionRecovery.hasCurrentMismatchNotice||this._showToast(bf(e=>this._t(e),t))}}),this._onboardingRuntimeLoader=new kf({expectedFingerprint:tv,load:async e=>{const t=0===e?await import("./houseplan-onboarding-runtime-BtzaN0OP.js"):await import((()=>{const e=new URL("./houseplan-onboarding-runtime-BtzaN0OP.js",import.meta.url);return e.searchParams.set("hp_retry",`${ev}-${++Qf}`),e.href})());return{fingerprint:t.ONBOARDING_RUNTIME_FINGERPRINT,create:()=>new t.HouseplanOnboardingRuntime(this)}},install:e=>{this._onboardingRuntime=e},failed:(e,t)=>{console.error("[houseplan] unable to load onboarding runtime",e),t.terminal&&this._versionRecovery.hasCurrentMismatchNotice||this._showToast(bf(e=>this._t(e),t))}}),this._isoSceneRuntime=null,this._isoSceneRuntimeLoader=new kf({expectedFingerprint:tv,load:async e=>{const t=0===e?await import("./iso-scene-render-ByC7EDVa.js"):await import((()=>{const e=new URL("./iso-scene-render-ByC7EDVa.js",import.meta.url);return e.searchParams.set("hp_retry",`${ev}-${++Qf}`),e.href})());return{fingerprint:t.ISO_SCENE_RUNTIME_FINGERPRINT,create:()=>t}},install:e=>{const t=this._effectiveProjection();this._isoSceneRuntime=e,this._isoProjectionSnapshot=null;const i=this._effectiveProjection();this._convertProjectionView(t,i),this.isConnected&&this.requestUpdate()},failed:(e,t)=>{console.warn("[houseplan] hidden isometric runtime diagnostic",yf("runtime-load","unverified",t.terminal)),this.isConnected&&this.requestUpdate()}}),this._pdfRuntime=null,this._pdfRuntimeLoader=new kf({expectedFingerprint:tv,load:async e=>{const t=0===e?await import("./pdf-export-DtC_EPb5.js"):await import((()=>{const e=new URL("./pdf-export-DtC_EPb5.js",import.meta.url);return e.searchParams.set("hp_retry",`${ev}-${++Qf}`),e.href})());return{fingerprint:t.PDF_EXPORT_FINGERPRINT,create:()=>new t.PdfExportRuntime}},install:e=>{this._pdfRuntime=e,this.isConnected&&this.requestUpdate()},failed:(e,t)=>{if(console.error("[houseplan] unable to load PDF export runtime",e),!t.terminal||!this._versionRecovery.hasCurrentMismatchNotice){const e=bf(e=>this._t(e),t),i=this._t("editor.load_failed"),n=e.startsWith(i)?e.slice(i.length).trim():e;this._showToast(`${this._t("pdf.failed")} ${n}`.trim())}}}),this.panelHost=!1,this.narrow=null,this._space="f1",this._adoption=new Lu((e,t)=>this.requestUpdate(e,t)),this._serverStorage=!1,this._loadOk=!1,this._serverCanWrite=null,this._loading=!1,this._loadTries=0,this._unsubCfg=null,this._unsubLayout=null,this._unsubVirtual=null,this._liveSyncAttempt=null,this._liveSyncGeneration=0,this._liveSyncConnection=null,this._configReloadAuthority=new Wu,this._virtualLights=Eh(null),this._canOptimizeUndo=!1,this._undoKind=null,this._devices=[],this._regSignature="",this._defPos={},this._newSyncKey="",this._areaRelocationIds=new Set,this._areaSnapshotCleanupCandidates=new Map,this._areaRelocationSyncKey="",this._areaRelocationWrite=Promise.resolve(),this._tip=null,this._hoverRoom=null,this._pointerModality=new rg(this,()=>this._syncPointerHoverTargets()),this._devicePressAnimations=new Map,this._selId=null,this._toast="",this._mode="view",this._pendingNavMode=null,this._decorTool="select",this._decorStyle={...xr},this._decorStyleSeeded=!1,this._decorDraft=null,this._decorMove=null,this._decorSel=null,this._decorEraseConfirm=null,this._decorTextDialog=null,this._decorShapeDialog=null,this._backdropDialog=null,this._decorTextSelection={start:0,end:0},this._furnPalette=null,this._decorImagePalette=null,this._decorAssetCatalog=[],this._decorAssets=new Map,this._decorAssetBusy=!1,this._furnCategory=null,this._furnPreviewInput=null,this._furnTouchPending=null,this._dtBox=null,this._dtDrag=null,this._bdDrag=null,this._slide="",this._reducedMotion=!1,this._onMotionChange=e=>{this._reducedMotion=e.matches,this._cancelDevicePressFeedback(),e.matches&&this._cancelCameraTransition(!0),e.matches&&this._modeTransitionPreparing?this._modeTransitionForceAtomic=!0:e.matches&&this._modeTransition.active&&this._cancelModeTransition(!0),this._syncVersionRecovery(),this.requestUpdate()},this._editorChromeMode="plan",this._modeTransitionVisual=null,this._modeTransitionPreparing=!1,this._modeTransitionForceAtomic=!1,this._modeTransitionRequest=0,this._modeTransitionTargetZoom=1,this._modeTransitionEditorCamera=null,this._modeTransition=new jg({frame:e=>this._applyModeTransitionFrame(e),settled:e=>this._settleModeTransition(e)}),this._cameraTransitionFit=null,this._cameraTransition=new Zg({frame:e=>this._applyCameraTransitionFrame(e),settled:e=>this._settleCameraTransition(e)}),this._editorSecondaryCopy={groupActive:(e,t)=>this._t("editor.group_active",{group:e,item:t}),openGroup:e=>this._t("editor.open_group",{group:e}),disabledAction:(e,t)=>this._t("editor.disabled_action",{action:e,reason:t})},this._tool="draw",this._geometryHistory=new _g(50),this._devicePositionHistory=new _g(50),this._devicePositionBusy=!1,this._wallDialog=null,this._drawWallField=null,this._activeWallChainId=null,this._activeWallChainPartitionIds=[],this._wallChainRedo=[],this._physicalSel=null,this._physicalDialog=null,this._partitionDeleteDialog=null,this._roomDeleteDialog=null,this._physicalDrag=null,this._physicalRotate=null,this._physicalLastTap=null,this._physicalPickCycle=null,this._wallUnionCacheValue=null,this._wallUnionPool=new Map,this._isoGeometryCache=new Map,this._renderIsoScene=null,this._isoProjectionSnapshot=null,this._isoStructuralBuildCount=0,this._isoFallback=new Set,this._openingTunnelCache=null,this._openingWallIndexCache=new Map,this._openingPlacementIntervalsCache=null,this._openingDimensionContextCache=null,this._planSnapGeometryCache=null,this._planStructuralGeometryCache=null,this._hiddenWallDiagnosticCache=null,this._physicalBodiesCache=null,this._lightPhysicalBodiesCache=null,this._cleanFloorCache=new Map,this._innerContourCache=new Map,this._glowRuntimeState=vm(),this._glowRuntimeHost={window:()=>this.ownerDocument.defaultView||window,isConnected:()=>this.isConnected,requestUpdate:()=>this.requestUpdate(),reducedMotion:()=>this._reducedMotion},this._lightBarrierCache=null,this._lightBarrierPool=new Map,this._glowScreenBlend=!1,this._duplicateColumnId=null,this._duplicateColumnTimer=0,this._rszLimitViolation=null,this._path=[],this._cursorPt=null,this._planSnapHover=null,this._mergeSel=null,this._openingPreset=null,this._openingRebindId=null,this._openingPresetRevision=0,this._openingHoverCandidate=null,this._openingJambBlockCm=null,this._openingDialog=null,this._openingInfo=null,this._opDrag=null,this._opMeasure=null,this._mergeDialog=null,this._splitSel=null,this._pendingSplit=null,this._wallFaceBatch=null,this._wallRepairDiagnostic=null,this._wallFaceGraphCache=[],this._areaSel="",this._nameSel="",this._roomDialog=!1,this._roomEditId=null,this._roomFill="",this._roomCustomFill=null,this._roomTempMin="",this._roomTempMax="",this._roomTempSrc="",this._roomHumSrc="",this._roomSrcOpen=null,this._roomSrcFilter="",this._roomNameScale=1,this._roomLabelScale=1,this._zoom=1,this._view=null,this._zoomBySpace={},this._viewModeSnap=null,this._roomFocus=null,this._roomPointer=null,this._doubleFit=new mf,this._deviceHits=new yc,this._pointers=new Map,this._panStart=null,this._panLock=null,this._pinchStart=null,this._suppressClick=!1,this._viewportGestureDirty=!1,this._touchContacts=new Map,this._touchClickGuard=new dc,this._connectedPath="",this._routeDepartureHandled=!1,this._onLocationChanged=()=>{this._connectedPath&&location.pathname!==this._connectedPath?this._leaveCardRoute():location.pathname===this._connectedPath&&(this._routeDepartureHandled=!1)},this._touchGestureGuard={capture:!0,handleEvent:e=>this._guardTouchGesture(e)},this._hdrH=118,this._booting=!0,this._bootFading=!1,this._bootSettling=!1,this._bootSettleRaf=0,this._bootLastH=-1,this._bootStart=0,this._bootLastChange=0,this._bootSoft=!1,this._tapConfirm=null,this._dangerConfirm=null,this._dangerConfirmController=new ze(e=>{this._dangerConfirm=e}),this._confirmDanger=e=>this._config&&this.hass?"warm"===this._syncDangerConfirmLocaleGate()||this._dangerConfirmMissingSpace()?Promise.resolve(!1):this._dangerConfirmController.confirm(e):Promise.resolve(!1),this._cancelDangerConfirm=()=>{this._dangerConfirmController.cancel()},this._onDangerConfirmDecision=e=>{this._dangerConfirmController.resolve(e.detail.token,e.detail.accepted)},this._onboardingShown=!1,this._rulesDialog=null,this._preflightClipboardFallback=null,this._haIntegrationVersion=null,this._versionRecovery=(e=this,new yg({clock:{setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)},storage:()=>e.ownerDocument.defaultView?.sessionStorage??null,safety:()=>kg(e),reload:()=>e._reloadDocument(),changed:()=>{e.requestUpdate()}})),this._haSupportApi=null,this._haDecorAssetsApi=null,this._haSummaryPanelApi=null,this._haRadarStage1Api=null,this._radarLive=new Tg(this),this._decorAssetSyncToken=0,this._alignDialog=null,this._settingsDialog=null,this._pdfDialog=!1,this._supportDialog=null,this._backupExportDialog=null,this._backupImportDialog=null,this._sunRaysCache=null,this._dayCycleTimer=0,this._dayCycleClockKey="",this._compassDrag=!1,this._importDialog=null,this._importQueue=[],this._importTotal=0,this._rulesCompiledSrc="",this._infoCard=null,this._nativeMoreInfoEntity=null,this._deviceInbox=null,this._deviceInboxReturn=null,this._deviceInboxMemo=null,this._markerDialog=null,this._spaceDialog=null,this._keyHandler=e=>this._onKey(e),this._warmVp=null,this._warmVpArmed=!1,this._warmLongReturn=!1,this._warmRevivePending=!1,this._warmGen=++rv,this._warmKey=null,this._warmSlot=null,this._hashApplied=!1,this._navApplied=!1,this._labs={alpha:!1,active:Object.freeze([]),space:""},this._viewPreference={},this._renderProjection="flat",this._kioskScale={icon:1,font:1},this._kioskDialog=!1,this._summarySlot=new Xf(Zf,this,e=>{this._summary=e,this._capturedSnapshotSequence=-1,this.isConnected&&(e.connect(),this.hasUpdated&&this.requestUpdate())}),this._activityRt=new Map,this._vacRt=new Map,this._vacViewKey="",this._vacLastView=null,this._vacRaf=0,this._vacSrvTrails={},this._vacJumpOnce=!1,this._continuity=this._newContinuityController(),this._continuityHistory=[],this._continuityEpoch=0,this._continuityDataReady=!0,this._continuityPaintToken=-1,this._continuityDisposed=!1,this._renderSnapshotAt=Date.now(),this._hassSequence=0,this._visibleDeviceSnapshot=null,this._candidateDeviceSnapshot=null,this._stagedDeviceSnapshotToken=-1,this._capturedSnapshotSequence=-1,this._capturedSnapshotDevices=null,this._capturedSnapshotLayout=null,this._capturedSnapshotActivity="",this._capturedSnapshotConfigEpoch=-1,this._capturedSnapshotVirtual="",this._lastValidStageSize=null,this._pendingRefitSize=null,this._refitRaf=0,this._pageVisibility=e=>{if(this._continuity.visibility(e),this._dayCycleVisibility(e),this._summary?.visibility(e.kind),"hidden"===e.kind)return this._radarLive.stop(),this._editorRuntime?._cancelRadarSetup(),this._clearRoomFocus(!0),this._clearTransientHover(!0),this._cancelDevicePressFeedback(),this._cancelCameraTransition(!0),void(this._modeTransitionPreparing?this._modeTransitionForceAtomic=!0:this._cancelModeTransition(!0));if(this._vacJumpOnce=!0,this._syncRadarLive(),!e.long){const e=Date.now();let t=!1;for(const i of this._activityRt.values())!i.flashKind||(i.expiresAt||i.flashTs+Qm)>e||(i.flashTs=0,i.flashKind=null,i.expiresAt=0,t=!0);return void(t&&this.requestUpdate())}Date.now()-this._renderSnapshotAt>1e3&&this._continuity.note("device-snapshot-stale"),this._continuityDataReady=!1,this._continuityPaintToken=-1,this._resumeSettling=!0,this._loading?this.requestUpdate():this._loadFromServer()},this._resumeSettling=!1,this._viewportInvalidAt=0,this._vacFit=null,this._vacAllCamerasFor=null,this._vacAllCameraCache=null,this._vacCalConfirm=null,this._kioskDots=!1,this._cyclePausedUntil=0,this._swipeStart=null,this._tabDrag=null,this._tabDragRelease=null,this._tabSuppressClick=!1,this._tabOrderWarned=!1,this._onLabsSnapshot=e=>{const t=this._effectiveProjection();this._labs=e,this._isoProjectionSnapshot=null,this._labsIso&&this._ensureIsoSceneRuntime();const i=this._effectiveProjection();this._convertProjectionView(t,i),this.requestUpdate()},this._onHashChange=()=>{if(this._hasFixedFloor)return;const e=this._hashSpace();if(e&&this._model.find(t=>t.id===e)&&e!==this._space){if(this._wallFaceBatch&&this._roomDialogCancel(),"plan"===this._mode&&"draw"===this._tool&&!this._finishWallChain())return;this._commitSpace(e),this._selId=null,this._path=[],this._clearPlanSnapHover(),this._clearOpeningPlacement(!0),this._tool="draw",this._activeWallChainId=null,this._activeWallChainPartitionIds=[],this._wallChainSegmentCms=[],this._closingWallCm=null,this._restoreZoom(),this.requestUpdate()}},this._drag=null,this._deviceDrag=null,this._rlResize=null,this._holdFired=!1,this._retryContinuity=()=>{this._continuityDataReady=!1,this._continuityPaintToken=-1,this._continuity.retry(this._continuity.recoveryReason||"plan"),this._loading||this._loadFromServer()},this._cfgEpoch=0,this._cfgEpochPreservedConfig=null,this._terminalFrame=0,this._modelCache=null,this._emptySpaceStateActive=!1,this._decorSnapCache=null,this._markerPreviewMemo=null,this._markerPreviewDevicesMemo=null,this._showHidden=!1,this._connHooked=null,this._connectionWasLost=!1,this._haRegistryConnection=null,this._haRegistryRev=-1,this._haBindingCacheKey="",this._planHassMemo=null,this._renderLife=new xg,this._liveEditorPaintCount=0,this._onHaRegistryUpdate=()=>{const e=td(this.hass);e.revision===this._haRegistryRev&&this._devices.length||(this._haRegistryRev=e.revision,this._renderLife.invalidate(),this._planHassMemo=null,this._regSignature="",this._maybeRebuildDevices(),this.requestUpdate())},this._onConnReady=()=>{if(this._loadTries=0,clearTimeout(this._loadRetryTimer),this._loadRetryTimer=void 0,ed(this.hass),this._saveConfigDebounced.pending()&&this._saveConfigDebounced.flush(),this._cfgWriting)return clearTimeout(this._reloadRetry),void(this._reloadRetry=window.setTimeout(this._onConnReady,400));!this._connectionWasLost&&this._continuity.hasCompleteFrame?this._beginContinuityCandidate("connection-ready",!1,"plan"):(this._continuityDataReady=!1,this._continuityPaintToken=-1),this._loading||this._loadFromServer()},this._onConnLost=()=>{this._booting&&!this._continuity.hasCompleteFrame||(this._connectionWasLost=!0,this._continuityDataReady=!1,this._continuityPaintToken=-1,this._continuity.connectionLost())},this._signer=new hc(()=>this.requestUpdate()),this._dirtyPos=new Set,this._sentPos=new Map,this._persistLayout=gv(()=>{if(this._serverStorage){const e=[...this._dirtyPos];this._dirtyPos.clear();for(const t of e){const e=vo(this._layout[t]);e&&(this._layout={...this._layout,[t]:e},this._sentPos.set(t,e),this.hass.callWS({type:"houseplan/layout/update",device_id:t,pos:e}).then(e=>this._noteLayoutRev(e)).catch(e=>this._showToast(this._t("toast.pos_save_failed",{err:this._errText(e)}))).finally(()=>{this._sentPos.get(t)===e&&this._sentPos.delete(t)}))}this._cacheSnapshot()}else this._persistLocalLayout()},600),this._frame=null,this._showFar=!1,this._writesPending=0,this._writeChain=Promise.resolve(),this._pendingPhysicalWrites=new Map,this._undoGeometry=()=>this._editorRuntimeOrThrow()._undoGeometry(),this._redoGeometry=()=>this._editorRuntimeOrThrow()._redoGeometry(),this._saveConfigDebounced=gv(()=>{this._serverCfg&&this._writeConfig().catch(e=>{const t=!0===e?.physicalGeometryRolledBack;"geometry-unsafe"!==e?.code&&("wall_model_client_outdated"===e?.code?this._showToast(this._t("toast.wall_model_client_outdated")):"conflict"===e?.code?(this._showToast(this._t("toast.conflict")),t||(this._cancelPath(),this._reloadConfigOnly(!0))):this._showToast(this._t("toast.cfg_save_failed",{err:this._errText(e)})),t&&this._reloadRejectedPhysicalWrite())})},500),this._wallChainSegmentCms=[],this._closingWallCm=null,this._savePhysicalDialog=()=>this._editorRuntimeOrThrow()._savePhysicalDialog(),this._deletePhysicalSelection=()=>this._editorRuntimeOrThrow()._deletePhysicalSelection(),this._confirmPartitionDelete=()=>this._editorRuntimeOrThrow()._confirmPartitionDelete(),this._confirmRoomDelete=e=>this._editorRuntimeOrThrow()._confirmRoomDelete(e),this._rebindPartitionOpening=()=>this._editorRuntimeOrThrow()._rebindPartitionOpening(),this._keepClosedAsPartitions=()=>this._editorRuntimeOrThrow()._keepClosedAsPartitions(),this._toggleServerPlans=async()=>this._onboardingRuntime&&this._spaceDialogUsesOnboardingRuntime("create")?this._onboardingRuntime._toggleServerPlans():this._editorRuntimeOrThrow()._toggleServerPlans(),this._aspectJob=null,this._dayCycleTick=()=>{if(!this.isConnected||"hidden"===this.ownerDocument.visibilityState)return;const e=this._dayCycleState();if(!e)return this._dayCycleTimer&&(clearInterval(this._dayCycleTimer),this._dayCycleTimer=0),void(this._dayCycleClockKey="");const t=ar(e);t!==this._dayCycleClockKey&&(this._dayCycleClockKey=t,this.requestUpdate())},this._sunShown=!1,this._sunOut=!1,this._sunOutTimer=0,this._openSettingsDialog=()=>{if(this._editorRuntime)return this._editorRuntime._openSettingsDialog();this._ensureEditorRuntime().then(e=>{e&&this._openSettingsDialog()})},this._openSupportDialog=()=>{this._editorRuntime?this._editorRuntime._openSupportDialog():this._ensureEditorRuntime().then(e=>{e&&this._openSupportDialog()})},this._openPdfDialog=()=>{this._pdfRuntimeLoader.ensure().then(e=>{e&&(this._pdfDialog=!0,this.requestUpdate())})},this._reportedPreflightFingerprint=null,this._openAlignDialog=()=>this._editorRuntimeOrThrow()._openAlignDialog(),this._toggleOptimizeLivePositions=()=>this._editorRuntimeOrThrow()._toggleOptimizeLivePositions(),this._optimizeUndoBusy=!1,this._openBackupExport=()=>this._editorRuntimeOrThrow()._openBackupExport(),this._openRulesDialog=()=>this._editorRuntimeOrThrow()._openRulesDialog(),this._climateCache=null,this._gearPtCache=new WeakMap}requestUpdate(e,t,i){if("hass"===e&&this.hass&&this._liveRt){const e=this._visibleDeviceSnapshot||this._candidateDeviceSnapshot;if(!this._liveRt.hass(t,this.hass,e?{entityIds:e.entityIds}:null,()=>Sg(this))&&!this._summary?.observeHassComposition())return}void 0!==e&&(this._terminalFrame=0),this._editorRuntime?._routeLiveEditorUpdate(e,t)||(this._liveRt?.clear(),super.requestUpdate(e,t,i))}_editorRuntimeOrThrow(){if(!this._editorRuntime)throw new Error("Houseplan editor runtime is not loaded");return this._editorRuntime}async _ensureEditorRuntime(){return this._editorRuntimeLoader.ensure()}async _ensureOnboardingRuntime(){return this._onboardingRuntimeLoader.ensure()}async _ensureIsoSceneRuntime(){return this._isoSceneRuntimeLoader.ensure()}_editorRuntimeStateChanged(e){clearTimeout(this._editorRuntimeLoadingTimer),this._editorRuntimeLoadingTimer=void 0,"loading"!==e?(this._editorRuntimeLoadingVisible=!1,this.requestUpdate()):this._editorRuntimeLoadingTimer=window.setTimeout(()=>{this._editorRuntimeLoadingVisible=!0,this.requestUpdate()},150)}async _requestMode(e,t=!0,i=!1){const n=++this._editorModeRequest;if(i&&(this._warmModeRequest=n,this._refitRaf&&(cancelAnimationFrame(this._refitRaf),this._refitRaf=0),this._pendingRefitSize=null),"view"===e||await this._ensureEditorRuntime()){if(n===this._editorModeRequest&&this.isConnected)return i?(this._adoptMode(e),this._warmRevivePending&&(clearTimeout(this._warmReviveTimer),this._warmReviveTimer=void 0,this._warmReviveDialog()),this.requestUpdate(),void this.updateComplete.then(()=>requestAnimationFrame(()=>requestAnimationFrame(()=>{if(this._warmModeRequest!==n||n!==this._editorModeRequest)return;const e=this._stageEl;this._lastValidStageSize=e&&e.clientWidth>0&&e.clientHeight>0?[e.clientWidth,e.clientHeight]:null,this._pendingRefitSize=null,this._warmModeRequest=0})))):void this._setMode(e,t);this._warmModeRequest===n&&(this._warmModeRequest=0)}else this._warmModeRequest===n&&(this._warmModeRequest=0)}get _layout(){return this._adoption.layout}set _layout(e){this._adoption.stageLocalLayout(e)}get _layoutRev(){return this._adoption.layoutRev}set _layoutRev(e){this._adoption.seedIdentity({layoutRev:e})}get _layoutContentFingerprint(){return this._adoption.layoutFingerprint}set _layoutContentFingerprint(e){this._adoption.seedIdentity({layoutFingerprint:e})}get _serverCfg(){return this._adoption.config}set _serverCfg(e){this._adoption.stageLocalConfig(e)}get _cfgRev(){return this._adoption.configRev}set _cfgRev(e){this._adoption.seedIdentity({configRev:e})}get _cfgContentFingerprint(){return this._adoption.configFingerprint}set _cfgContentFingerprint(e){this._adoption.seedIdentity({configFingerprint:e})}_seedDecorStyle(e){var t,i;if(t=Al,i=this,Cl(e,Nl)&&"pending"===t.state()&&(t.art("",i),t.ensure()),this._decorStyleSeeded||!e)return;this._decorStyleSeeded=!0;const n=e.settings?.decor_default_style;n&&(this._decorStyle=function(e,t){if(!e||"object"!=typeof e)return{...t};const i=e,n="string"==typeof i.color&&i.color?i.color:t.color,r="string"==typeof i.fill_color&&i.fill_color?i.fill_color:t.fillColor,o=Number(i.width_cm);return{color:n,opacity:Sr(i.opacity,t.opacity),widthCm:Number.isFinite(o)&&o>0?Math.max(.1,Math.min(100,o)):t.widthCm,fill:"boolean"==typeof i.fill?i.fill:t.fill,fillColor:r,fillOpacity:Sr(i.fill_opacity,t.fillOpacity)}}(n,xr))}get _canManageConfiguration(){return null!==this._serverCanWrite?this._serverCanWrite:!0===this.hass?.user?.is_admin}get _canEdit(){return this._norm&&this._canManageConfiguration}get _kiosk(){return!!this._config?.kiosk}_showKioskDots(){this._kioskDots=!0,clearTimeout(this._kioskDotsTimer),this._kioskDotsTimer=window.setTimeout(()=>this._kioskDots=!1,2500)}get _modeTransitionBusy(){return this._modeTransitionPreparing||this._modeTransition.active}get _doubleFitEnabled(){return!("view"!==this._mode||this._vacFit||this._modeTransitionBusy||this._touchSequenceMultitouch||"steady"!==this._continuity.state||this._continuity.overlayBlocksInteraction)}_cameraState(){const e=this._viewOr(this._baseVb());return{zoom:this._zoom,viewBox:{...e}}}_normalizeCameraState(e){const t=this._cameraTransitionFit||Oi(this._baseVb(),this._stageAspect());return{zoom:Math.min(yv.ZOOM_MAX,Math.max(yv.ZOOM_MIN,e.zoom)),viewBox:this._clampView({...e.viewBox},t)}}_applyCameraTransitionFrame(e){const t=this._normalizeCameraState(e.presented);e.presented=t,this._zoom=t.zoom,this._view={...t.viewBox},this._liveVp(!0)}_settleCameraTransition(e){const t=this._normalizeCameraState(e.to);this._zoom=t.zoom,this._view={...t.viewBox},this._cameraTransitionFit=null,"room"!==e.reason&&this._saveZoom(),this.requestUpdate()}_cancelCameraTransition(e=!1,t=!1){const i=this._cameraTransition.state?.reason,n=t&&this._cameraTransition.active?this._cameraTransition.presented?.zoom:void 0;this._cameraTransition.cancel(e),this._cameraTransitionFit=null,void 0!==n&&"room"!==i&&this._saveZoom()}_prepareCameraCommand(){this._bootSoftCancel(),this._modeTransitionBusy&&this._cancelModeTransition(!0),"opening"===this._tool&&(this._cursorPt=null,this._clearOpeningPlacement(!1))}_startCameraTransition(e,t,i,n){const r=this._cameraState(),o=this._cameraTransition.target;return(!o||!Kg(o,e))&&(Kg(r,e)?(this._cancelCameraTransition(!1),!1):(this._cameraTransitionFit={...t},this._cameraTransition.start(r,e,i,this._reducedMotion?0:n),!0))}_cssColor(e,t){const i=String(e||"").trim();if(!i)return t;const n=document.createElement("span");n.style.cssText=`position:absolute;visibility:hidden;color:${i}`,this.renderRoot.append(n);const r=getComputedStyle(n).color||t;return n.remove(),r}_currentModeVisual(e=this._mode){const t=this._modeTransition.presented||this._modeTransitionVisual;if(t)return{...t,viewport:{...t.viewport,viewBox:{...t.viewport.viewBox}}};const i=this._stageEl;if(!i||i.clientWidth<=0||i.clientHeight<=0)return null;const n=this.renderRoot.querySelector(".editorchrome"),r=this._viewOr(this._baseVb()),o=this.renderRoot.querySelector(".hp-paper"),s=this.renderRoot.querySelector(".hp-backdrop"),a=this.renderRoot.querySelector(".zoomwrap"),l=a?getComputedStyle(a).filter:"",c=Number(/brightness\(([^)]+)\)/.exec(l)?.[1]);return{presentedMode:e,editorChromeHeight:"view"===e?0:n?.getBoundingClientRect().height||0,stageWidth:i.clientWidth,stageHeight:i.clientHeight,viewport:Hg(r,i.clientWidth),stageColor:getComputedStyle(i).backgroundColor||"rgb(255, 255, 255)",paperColor:o?getComputedStyle(o).fill:"rgb(255, 255, 255)",sceneBrightness:Number.isFinite(c)?c:1,architectureOpacity:"decor"===e?.35:1,backdropOpacity:s&&Number(getComputedStyle(s).opacity)||1,viewWeight:"view"===e?1:0,editorWeight:"view"===e?0:1,toolbarContentOpacity:"view"===e?0:1}}_viewForModeTarget(e,t,i,n,r){const o=Oi(this._baseVb(),n/r),s=Math.min(yv.ZOOM_MAX,Math.max(yv.ZOOM_MIN,e)),a=o.w/s,l=o.h/s,c=t??o.x+o.w/2,h=i??o.y+o.h/2;return this._clampView({x:c-a/2,y:h-l/2,w:a,h:l},o)}_targetStageColor(e){return"view"!==e?"rgb(255, 255, 255)":this._cssColor(this._stageBg(this._spaceDisplayForRender()),this._cssColor("var(--ha-card-background, var(--card-background-color, #111))","rgb(17, 17, 17)"))}_targetPaperColor(e){return"view"===e&&this._spaceModel()?.bg?this._cssColor("var(--ha-card-background, var(--card-background-color, #111))","rgb(17, 17, 17)"):"rgb(255, 255, 255)"}_targetBrightness(e){return 1}_applyModeTransitionFrame(e){e.targetMode===this._mode&&(this._modeTransitionVisual=e.presented,this._view={...e.presented.viewport.viewBox},this.requestUpdate())}_settleModeTransition(e){if(e.targetMode!==this._mode)return;const t=this._modeTransitionRequest;this._view={...e.to.viewport.viewBox},this._zoom=this._modeTransitionTargetZoom,this._modeTransitionVisual=null,this._modeTransitionPreparing=!1,this._lastValidStageSize=[e.to.stageWidth,e.to.stageHeight],"view"===this._mode&&(this._saveZoom(),this._viewModeSnap=null,this._modeTransitionEditorCamera=null),this.requestUpdate(),this.updateComplete.then(()=>{if(!this.isConnected||t!==this._modeTransitionRequest||this._modeTransitionBusy||e.targetMode!==this._mode)return;const i=this._stageEl;if(i&&i.clientWidth>0&&i.clientHeight>0&&(Math.abs(i.clientWidth-e.to.stageWidth)>.5||Math.abs(i.clientHeight-e.to.stageHeight)>.5)){const e=this._view;this._lastValidStageSize=[i.clientWidth,i.clientHeight],this._applyView(this._zoom,e?e.x+e.w/2:void 0,e?e.y+e.h/2:void 0),this.requestUpdate()}const n=this.renderRoot.activeElement;(!n||!n.isConnected||!!n.closest?.(".editorchrome, .stage"))&&this.renderRoot.querySelector(".modetab.active")?.focus?.({preventScroll:!0})})}_cancelModeTransition(e=!0){this._cancelCameraTransition(!1);const t=!!this._modeTransition.state;this._modeTransitionRequest++,this._modeTransitionPreparing=!1,this._modeTransitionForceAtomic=!1,this._modeTransition.cancel(e),e&&t||(this._modeTransitionVisual=null)}_adoptMode(e){e!==this._mode&&(this._clearRoomFocus(!0),this._resetDeviceHitState()),this._cancelModeTransition(!1),this._mode=e,this._isoProjectionSnapshot=null,"view"!==e&&(this._editorChromeMode=e)}_commitViewModeAtomic(e,t,i,n){if(this._modeTransitionPreparing=!1,this._modeTransitionVisual=null,this._modeTransitionForceAtomic=!1,this._zoom=t,e){const r=this._stageEl?.clientWidth||e.stageWidth,o=Math.max(1,e.stageHeight+e.editorChromeHeight);this._view=this._viewForModeTarget(t,i,n,r,o),this._lastValidStageSize=[r,o]}else this._view=null;this._viewModeSnap=null,this._modeTransitionEditorCamera=null,this._saveZoom(),this.requestUpdate()}_prepareModeTransition(e,t,i,n,r,o){this.updateComplete.then(()=>{if(!this.isConnected||e!==this._modeTransitionRequest||this._mode!==i)return void(e===this._modeTransitionRequest&&(this._modeTransitionPreparing=!1,this._modeTransitionVisual=null,this._modeTransitionForceAtomic=!1,this.requestUpdate()));const s=this.renderRoot.querySelector(".editorchrome-inner"),a="view"===i?0:s?.scrollHeight||0,l=Math.max(1,(this.panelHost?this.clientHeight:innerHeight)-Jg(this.renderRoot,this._stageEl,this.panelHost)),c=this._stageEl?.clientWidth||t.stageWidth,h=this._viewForModeTarget(n,r,o,c,l),d={presentedMode:i,editorChromeHeight:a,stageWidth:c,stageHeight:l,viewport:Hg(h,c),stageColor:this._targetStageColor(i),paperColor:this._targetPaperColor(i),sceneBrightness:this._targetBrightness(i),architectureOpacity:"decor"===i?.35:1,backdropOpacity:"decor"===i&&"backdrop"!==this._decorTool?.5:1,viewWeight:"view"===i?1:0,editorWeight:"view"===i?0:1,toolbarContentOpacity:"view"===i?0:1};this._modeTransitionPreparing=!1;const u=this._modeTransitionForceAtomic;this._modeTransitionForceAtomic=!1,this._modeTransition.start(t,d,i,this._reducedMotion||u?0:220)})}get _hasFixedFloor(){return!!this._config&&Object.prototype.hasOwnProperty.call(this._config,"floor")}_fixedFloorState(e=this._model,t=this._loadOk){const i=this._config?.floor,n=function(e){if(!e.hasFloor)return{kind:"absent"};const t=e.floor;if("string"==typeof t)return t.length?e.spaceIds.includes(t)?{kind:"valid",id:t,source:"id"}:{kind:"invalid",reason:"unknown-id",value:t}:{kind:"invalid",reason:"empty-id",value:t};if("number"==typeof t){if(!Number.isFinite(t))return{kind:"invalid",reason:"non-finite-index",value:t};if(!Number.isInteger(t))return{kind:"invalid",reason:"fractional-index",value:t};if(t<0)return{kind:"invalid",reason:"negative-index",value:t};const i=e.spaceIds[t];return void 0===i?{kind:"invalid",reason:"out-of-range-index",value:t}:{kind:"valid",id:i,source:"index"}}return{kind:"invalid",reason:"invalid-type",value:t}}({spaceIds:e.map(e=>e.id),hasFloor:this._hasFixedFloor,floor:i});return!this._hasFixedFloor||t?n:"number"==typeof i?"valid"===n.kind||"invalid"===n.kind&&"out-of-range-index"===n.reason?{kind:"pending",value:i}:n:"valid"===n.kind||"invalid"===n.kind&&"unknown-id"!==n.reason?n:{kind:"pending",value:i}}_canCommitSpace(e,t=!1){if(t||!this._hasFixedFloor)return!0;const i=this._fixedFloorState();return"valid"===i.kind&&i.id===e}_commitSpace(e,t=!1){return!!this._canCommitSpace(e,t)&&(e!==this._space&&(this._clearRoomFocus(!0),this._resetDeviceHitState(),this._cancelDangerConfirm(),this._cancelCameraTransition(!1),this._clearTransientHover(!0),this._cancelDevicePressFeedback(),this._editorRuntime?._clearFurniturePreview()),this._space=e,this._isoProjectionSnapshot=null,!0)}_slideTo(e,t){if(e===this._space)return!0;if(!this._canCommitSpace(e))return!1;if(this._wallFaceBatch&&this._roomDialogCancel(),"plan"===this._mode&&"draw"===this._tool&&!this._finishWallChain())return!1;this._cancelModeTransition(!0);const i=window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches;return this._commitSpace(e),this._path=[],this._clearPlanSnapHover(),this._clearOpeningPlacement(!0),this._tool="draw",this._activeWallChainId=null,this._activeWallChainPartitionIds=[],this._wallChainSegmentCms=[],this._closingWallCm=null,this._selId=null,this._physicalSel=null,this._editorSecondary?.closeForNavigation(),this._physicalDialog=null,this._physicalDrag=null,this._restoreZoom(),i||(this._slide=t,clearTimeout(this._slideTimer),this._slideTimer=window.setTimeout(()=>{this._slideTimer=void 0,this._slide="",this.requestUpdate()},190),this.requestUpdate()),!0}get _canReorderTabs(){return Yf({canEdit:this._canEdit,kiosk:this._kiosk,mode:this._mode,pointerType:"mouse",spaceCount:this._model.length,fixedFloor:this._hasFixedFloor})}_tabPointerDown(e,t){Yf({canEdit:this._canEdit,kiosk:this._kiosk,mode:this._mode,pointerType:e.pointerType,spaceCount:this._model.length,fixedFloor:this._hasFixedFloor})&&(fv(e),this._tabDragRelease=e=>this._tabPointerUp(e),window.addEventListener("pointerup",this._tabDragRelease),window.addEventListener("pointercancel",this._tabDragRelease),this._tabDrag={id:t,pointerId:e.pointerId,x:e.clientX,y:e.clientY,moved:!1,targetId:null,placement:null})}_tabDropTargetAt(e,t,i){const n=this._model.map(e=>e.id),r=n.indexOf(i);if(r<0)return null;const o=this.renderRoot.querySelectorAll('[data-hp="space-tab"]');for(const s of o){const o=s.dataset.id||"";if(!o||o===i)continue;const a=s.getBoundingClientRect();if(ea.right||ta.bottom)continue;const l=n.indexOf(o);return l<0?null:{targetId:o,placement:l=4)))return;var i,n;const r=this._tabDropTargetAt(e.clientX,e.clientY,t.id);t.moved&&t.targetId===r?.targetId&&t.placement===r?.placement||(this._tabDrag={...t,moved:!0,targetId:r?.targetId||null,placement:r?.placement||null})}_tabPointerUp(e){const t=this._tabDrag;if(t&&t.pointerId!==e.pointerId)return;const i="pointerup"===e.type&&t?.moved?this._tabDropTargetAt(e.clientX,e.clientY,t.id):null;"pointerup"===e.type&&t?.moved&&this._suppressNextTabClick(),this._endTabDrag(),t?.moved&&i&&this._commitTabOrder(t.id,i.targetId)}_endTabDrag(){this._tabDrag=null,this._tabDragRelease&&(window.removeEventListener("pointerup",this._tabDragRelease),window.removeEventListener("pointercancel",this._tabDragRelease),this._tabDragRelease=null)}_tabClick(e){if(this._tabSuppressClick)return this._tabSuppressClick=!1,clearTimeout(this._tabSuppressClickTimer),void(this._tabSuppressClickTimer=void 0);this._pickSpace(e)}_suppressNextTabClick(){this._tabSuppressClick=!0,clearTimeout(this._tabSuppressClickTimer),this._tabSuppressClickTimer=window.setTimeout(()=>{this._tabSuppressClick=!1,this._tabSuppressClickTimer=void 0},0)}_commitTabOrder(e,t){const i=this._serverCfg;if(!i||!this._canReorderTabs)return;const n=this._model.map(e=>e.id),r=function(e,t,i){const n=e.indexOf(t),r=e.indexOf(i);if(n<0||r<0||n===r)return e;const o=e.slice();return o.splice(n,1),o.splice(r,0,t),o}(n,e,t);if(r===n)return;const o=new Map(this._devices.map(e=>[String(e.id),String(e.area||"")])),s=function(e,t,i,n=()=>""){if(!i)return[];const r=[];for(const o of e){if(!o||!0===o.removed)continue;const e="string"==typeof o.id?o.id:"";if(!e)continue;if("string"==typeof o.space&&o.space)continue;const s=("string"==typeof o.area?o.area:"")||n(e)||"";s&&t[s]||r.push({id:e,space:i})}return r}(i.markers||[],Object.fromEntries(Object.entries(this._areaToSpace).map(([e,t])=>[e,t.space])),n[0]||"",e=>o.get(e)||"");if(s.length){const e=new Map(s.map(e=>[e.id,e.space]));for(const t of i.markers||[]){const i=e.get(String(t.id));i&&(t.space=i)}}i.spaces=function(e,t){const i=new Map(t.map((e,t)=>[e,t]));return e.map((e,t)=>({space:e,index:t})).sort((e,t)=>(i.get(String(e.space?.id))??Number.MAX_SAFE_INTEGER)-(i.get(String(t.space?.id))??Number.MAX_SAFE_INTEGER)||e.index-t.index).map(e=>e.space)}(i.spaces||[],r),this._saveConfig(),this._tabOrderWarned||(this._tabOrderWarned=!0,this._showToast(this._t("toast.space_order_changed")))}_pickSpace(e){if(this._endTabDrag(),e===this._space)return;const t=this._model.map(e=>e.id),i=t.indexOf(this._space),n=t.indexOf(e);this._navApplied=!0,this._showFar=!1,this._frame=null,this._slideTo(e,i>=0&&n0&&Date.now()>=this._cyclePausedUntil&&this._model.length>1&&this._zoom<=1.001){const e=this._model.map(e=>e.id),t=e.indexOf(this._space);this._slideTo(e[(t+1)%e.length],"left"),this._showKioskDots()}}_syncCycleTimer(){clearInterval(this._cycleTimer),this._cycleTimer=void 0,this.isConnected&&!this._hasFixedFloor&&this._config?.kiosk&&Number(this._config.cycle)>0&&(this._cycleTimer=window.setInterval(()=>this._cycleTick(),1e3*Number(this._config.cycle)))}get _editing(){return"plan"===this._mode||"devices"===this._mode||"decor"===this._mode}get _markup(){return"plan"===this._mode}get _wallUnionCache(){return this._wallUnionCacheValue}set _wallUnionCache(e){this._wallUnionCacheValue=e,null===e&&this._wallUnionPool.clear()}get _glowClipCache(){return this._glowRuntimeState.clipCache}get _glowGeometryWarnings(){return this._glowRuntimeState.geometryWarnings}get _glowFeatherUnits(){return this._glowRuntimeState.featherUnits}set _glowFeatherUnits(e){this._glowRuntimeState.featherUnits=e}get _glowRenderedSources(){return this._glowRuntimeState.renderedSources}get _glowLastAppearance(){return this._glowRuntimeState.lastAppearance}get _glowFeatherSuspendUntil(){return this._glowRuntimeState.featherSuspendUntil}set _glowFeatherSuspendUntil(e){this._glowRuntimeState.featherSuspendUntil=e}get _glowFeatherResumeTimer(){return this._glowRuntimeState.featherResumeTimer}set _glowFeatherResumeTimer(e){this._glowRuntimeState.featherResumeTimer=e}get _glowSourceSeq(){return this._glowRuntimeState.sourceSeq}set _glowSourceSeq(e){this._glowRuntimeState.sourceSeq=e}get _touchSequenceMultitouch(){return this._touchClickGuard.sequenceMultitouch}_syncDangerConfirmLocaleGate(){return this._config&&this.hass?cp(this,_p,bp(this.hass,this._config.language)):"ready"}_dangerConfirmMissingSpace(){const e=this._model;if(!e.length)return!1;const t=this._fixedFloorState(e);return"pending"!==t.kind&&"invalid"!==t.kind&&!this._spaceModel()}_syncVersionRecovery(){this._versionRecovery.update({frontendVersion:Jf(ev),backendVersion:this._haIntegrationVersion,kiosk:!0===this._config?.kiosk,reducedMotion:this._reducedMotion})}_newContinuityController(){return new sc(()=>{this._resumeSettling="steady"!==this._continuity.state,this._continuityEpoch++,this.isConnected&&this.requestUpdate()})}get _labsIso(){return this._labs.active.includes("iso")}get _desiredProjection(){return"view"===this._mode&&this._labsIso&&"iso"===this._viewPreference[this._space]?"iso":"flat"}_saveViewPreference(){try{localStorage.setItem(hv,JSON.stringify(this._viewPreference))}catch{}}_logicalViewCenter(e){const t=this._view;if(!t)return null;const i=[t.x+t.w/2,t.y+t.h/2],n="iso"===e?af(i):i;return{x:n[0],y:n[1]}}_convertProjectionView(e,t){if(e===t)return;this._clearRoomFocus(!0);const i=this._logicalViewCenter(e);this._view=null;const n=i?"iso"===t?sf([i.x,i.y],0):[i.x,i.y]:null;this._applyView(this._zoom,n?.[0],n?.[1]),this._warmPatch({vp:this._warmViewportState()}),this.requestUpdate()}_setProjection(e){if(!this._labsIso||"view"!==this._mode)return;const t=this._effectiveProjection();if(this._viewPreference={...this._viewPreference,[this._space]:e},"iso"===e){this._ensureIsoSceneRuntime();const e=this._isoSceneKey();e&&this._isoFallback.delete(e),this._isoFallback.delete(`${this._space}|no-borders`),this._clearIsoInvalidFallback()}this._saveViewPreference(),this._isoProjectionSnapshot=null;const i=this._effectiveProjection();this._convertProjectionView(t,i)}_hashSpace(){return Af(window.location.hash||"")}connectedCallback(){this._connectedPath=location.pathname,this._routeDepartureHandled=!1,this._configReloadAuthority.observeContext(Uu(this)),window.addEventListener("location-changed",this._onLocationChanged),window.addEventListener("popstate",this._onLocationChanged),this._continuityDisposed&&(this._continuity=this._newContinuityController(),this._continuityDisposed=!1,this._continuityPaintToken=-1);const e=cg(this.ownerDocument);var t;void 0!==e&&(this._glowScreenBlend=e),this._continuityUnsub?.(),this._continuityUnsub=rc(this.ownerDocument,this._pageVisibility),this._languageFailureUnsub?.(),this._languageFailureUnsub=function(...e){return()=>{for(const t of e)t()}}((t=()=>{this._showToast(this._t("toast.locale_load_failed"))},pp.add(t),()=>pp.delete(t)),function(e){return Dl.add(e),()=>{Dl.delete(e)}}(()=>this._showToast(this._t("toast.furniture_art_load_failed")))),super.connectedCallback(),this._summarySlot.connect(),this._ensureLiveRuntime().catch(()=>this.requestUpdate()),this._pointerModality.connect(this.ownerDocument.defaultView);const i=this.ownerDocument.defaultView?.MutationObserver;i&&(this._pointerHoverObserver=new i(e=>{let t=!1;for(const i of e){for(const e of i.addedNodes)this._syncPointerHoverSubtree(e);const e=e=>{if(e.nodeType!==Node.ELEMENT_NODE)return!1;const t=e;return t.matches(".devlayer, .devlayer *")||!!t.querySelector?.(".devlayer")};(e(i.target)||[...i.addedNodes,...i.removedNodes].some(e))&&(t=!0)}t&&this._invalidateDeviceHitGeometry()}),this._pointerHoverObserver.observe(this.renderRoot,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","data-id"]})),this._motionMedia=window.matchMedia?.("(prefers-reduced-motion: reduce)"),this._reducedMotion=!!this._motionMedia?.matches,this._motionMedia?.addEventListener?.("change",this._onMotionChange),this._syncVersionRecovery(),this._versionRecovery.connect(),lg(this.ownerDocument).then(e=>{e!==this._glowScreenBlend&&(this._glowScreenBlend=e,this.isConnected&&this.requestUpdate())}),this.hass&&this._ensureHaRegistryAuthority(),window.addEventListener("keydown",this._keyHandler),this._signer.start(()=>this.hass,()=>this._referencedContentUrls()),this._syncCycleTimer(),window.addEventListener("hashchange",this._onHashChange),this._labsUnsub?.(),this._labsUnsub=function(e){Of.add(e);const t=Hf();return"undefined"==typeof window&&e(t),()=>{Of.delete(e)}}(this._onLabsSnapshot),this._labsIso&&this._ensureIsoSceneRuntime(),this._booting?this._bootWatch():this._bootFading&&(clearTimeout(this._bootTimer),this._bootTimer=window.setTimeout(()=>{this._bootFading=!1},220)),this._bootSoft&&(clearTimeout(this._bootSoftTimer),this._bootSoftTimer=window.setTimeout(()=>{this._bootSoft=!1},iv)),!this._loadOk&&this._serverCfg&&this.hass&&this._scheduleLoadRetry(),!this._warmSlot&&this._config&&this._warmAdopt(),this._loadOk&&this._ensureLiveSyncSubscriptions(),this._warmVp&&!this._warmRevivePending&&void 0===this._warmReviveTimer&&(this._warmRevivePending=!0,this._warmReviveTimer=window.setTimeout(()=>this._warmReviveDialog(),0)),this._warmLongReturn&&this._beginResumeSettle(),this._warmLongReturn=!1,this.requestUpdate()}disconnectedCallback(){this._versionRecovery.disconnect(),this._configReloadAuthority.invalidateLifecycle(),this._liveRt?.dispose(),this._radarLive.stop(),this._editorRuntime?._disposeLiveEditor(),this._clearRoomFocus(!0),this._cancelDangerConfirm(),this._connectedPath&&location.pathname!==this._connectedPath&&this._leaveCardRoute(),window.removeEventListener("location-changed",this._onLocationChanged),window.removeEventListener("popstate",this._onLocationChanged),this._continuityUnsub?.(),this._continuityUnsub=void 0,this._languageFailureUnsub?.(),this._languageFailureUnsub=void 0,this._motionMedia?.removeEventListener?.("change",this._onMotionChange),this._motionMedia=void 0,this._vacRaf&&(cancelAnimationFrame(this._vacRaf),this._vacRaf=0),this._refitRaf&&(cancelAnimationFrame(this._refitRaf),this._refitRaf=0),this._warmModeRequest=0,this._dayCycleTimer&&(clearInterval(this._dayCycleTimer),this._dayCycleTimer=0),this._summarySlot.disconnect(),this._dayCycleClockKey="",this._bootSettleRaf&&(cancelAnimationFrame(this._bootSettleRaf),this._bootSettleRaf=0),this._bootSettling=!1;for(const e of this._activityRt.values())clearTimeout(e.timer);window.removeEventListener("keydown",this._keyHandler),this._endTabDrag(),clearTimeout(this._tabSuppressClickTimer),this._tabSuppressClickTimer=void 0,this._tabSuppressClick=!1,clearInterval(this._cycleTimer),clearTimeout(this._kioskDotsTimer),clearTimeout(this._kioskHoldTimer),clearTimeout(this._reloadRetry),clearTimeout(this._loadRetryTimer),this._loadRetryTimer=void 0,this._connHooked?.removeEventListener?.("ready",this._onConnReady),this._connHooked?.removeEventListener?.("disconnected",this._onConnLost),this._connHooked?.removeEventListener?.("reconnect-error",this._onConnLost),this._connHooked=null,this._haRegistryRelease?.(),this._haRegistryRelease=void 0,this._haRegistryConnection=null,this._signer.dispose(),clearTimeout(this._toastTimer),clearTimeout(this._slideTimer),clearTimeout(this._editorRuntimeLoadingTimer),this._editorRuntimeLoadingTimer=void 0,this._editorRuntimeLoadingVisible=!1,this._modeTransition.dispose(),this._cameraTransition.dispose(),this._cameraTransitionFit=null,this._modeTransitionVisual=null,this._modeTransitionPreparing=!1,this._modeTransitionForceAtomic=!1,this._modeTransitionRequest++,this._slideTimer=void 0,this._slide="",clearTimeout(this._bootTimer),this._bootTimer=void 0,clearTimeout(this._bootSoftTimer),this._saveConfigDebounced.flush(),this._cancelDeviceDrag(),window.removeEventListener("hashchange",this._onHashChange),this._labsUnsub?.(),this._labsUnsub=void 0,clearTimeout(this._holdTimer),this._roViewport?.disconnect(),this._roViewport=void 0,this._roHdr?.disconnect(),this._roHdr=void 0,this._onWinResize&&(window.removeEventListener("resize",this._onWinResize),this._onWinResize=void 0),this._unsubCfg&&(this._unsubCfg(),this._unsubCfg=null),this._unsubLayout&&(this._unsubLayout(),this._unsubLayout=null),this._unsubVirtual&&(this._unsubVirtual(),this._unsubVirtual=null),this._unsubTrail&&(this._unsubTrail(),this._unsubTrail=void 0),this._liveSyncGeneration++,this._liveSyncAttempt=null,this._liveSyncConnection=null,clearTimeout(this._layoutSyncTimer),clearTimeout(this._duplicateColumnTimer),Am(this._glowRuntimeState,this._glowRuntimeHost),this._warmSnapshot(),this._warmRevivePending=!1,clearTimeout(this._warmReviveTimer),this._warmReviveTimer=void 0,this._warmRelease(),this._clearPlanSnapHover(),this._clearOpeningPlacement(!0),this._editorRuntime?._clearFurniturePreview(),this._editorRuntime?._furnShiftDetach(),this._touchContacts.clear(),this._touchClickGuard.reset(),this._resetDeviceHitState(),this._clearTransientHover(!0),this._cancelDevicePressFeedback(),this._pointerHoverObserver?.disconnect(),this._pointerHoverObserver=void 0,this._pointerModality.disconnect(),this._editorSecondary?.reset(),this._resumeSettling=!1,this._continuityHistory=[...this._continuityHistory,...this._continuity.trace].slice(-80),this._continuity.dispose(),this._continuityDisposed=!0,super.disconnectedCallback()}_onKey(e){if("Escape"===e.key&&this._vacFit){if(this._vacFit.busy)return;return this._vacFit=null,this._showToast(this._t("vac.cal_cancelled")),void e.stopPropagation()}if("Escape"===e.key){if(this._tapConfirm)return void(this._tapConfirm=null);if(this._vacCalConfirm)return void(this._vacCalConfirm.busy||(this._vacCalConfirm=null));if(this._decorEraseConfirm)return void(this._decorEraseConfirm=null);if(this._openingInfo)return void(this._openingInfo=null);if(this._infoCard)return void this._closeInfoCard();if(this._rulesDialog)return void(this._rulesDialog=null);if(this._alignDialog)return this._alignDialog=null,void(this._preflightClipboardFallback=null);if(this._backupImportDialog)return void(this._backupImportDialog=null);if(this._backupExportDialog)return void(this._backupExportDialog=null);if(this._pdfDialog)return void(this._pdfDialog=!1);if(this._supportDialog)return void this._editorRuntime?._closeSupportDialog();if(this._settingsDialog)return void(this._settingsDialog=null);if(this._summary?.closeDialogIfIdle())return;if(this._markerDialog)return void this._closeMarkerDialog();if(this._deviceInbox)return void(this._deviceInbox=null);if(this._openingDialog)return void(this._openingDialog=null);if(this._physicalDialog)return void(this._physicalDialog=null);if(this._backdropDialog)return void(this._backdropDialog=null);if(this._decorShapeDialog)return void(this._decorShapeDialog=null);if(this._decorTextDialog)return void(this._decorTextDialog=null);if(this._spaceDialog&&!this._roomDialog)return this._spaceDialog=null,this._importQueue=[],void(this._importTotal=0);if(this._editorSecondary?.hasOpenGroup)return e.preventDefault(),void this._editorSecondary?.closeGroup(!0)}const t=e.composedPath?.()||[e.target],i=t.some(e=>e?.matches?.('input, textarea, select, [contenteditable="true"]')),n=t.some(e=>e?.classList?.contains?.("editor-secondary")),r=e.ctrlKey||e.metaKey,o=e.key.toLowerCase(),s=/^[a-z]$/.test(o),a="z"===o||!s&&"KeyZ"===e.code,l="y"===o||!s&&"KeyY"===e.code,c=r&&(a&&e.shiftKey||l),h=r&&a&&!e.shiftKey;if("decor"===this._mode){if((h||c)&&i)return;if(c)return e.preventDefault(),void this._redoGeometry();if(h)return e.preventDefault(),this._decorDraft?void(this._decorDraft=null):this._decorMove||this._dtDrag||this._bdDrag?void this._cancelDecorGesture():void this._undoGeometry();if(("Delete"===e.key||"Backspace"===e.key)&&this._decorSel&&!i&&!n)return e.preventDefault(),void this._decorDeleteSel();const t="ArrowLeft"===e.key?[-this._gridPitch,0]:"ArrowRight"===e.key?[this._gridPitch,0]:"ArrowUp"===e.key?[0,-this._gridPitch]:"ArrowDown"===e.key?[0,this._gridPitch]:null;return!t||r||e.altKey||"select"!==this._decorTool||!this._decorSel||!this._decorList.some(e=>e.id===this._decorSel)||this._decorDraft||this._decorMove||this._dtDrag||this._bdDrag||i||n||this._editorSecondaryDialogBlocked?void("Escape"===e.key&&(e.preventDefault(),this._decorDraft?this._decorDraft=null:this._decorMove||this._dtDrag||this._bdDrag?this._cancelDecorGesture():"furniture"===this._decorTool?(this._editorRuntime?._clearFurniturePreview(),this._editorRuntime?._furnShiftDetach(),this._furnPalette=null,this._furnCategory=null,this._decorTool="select"):this._decorSel?this._decorSel=null:"select"!==this._decorTool?this._decorTool="select":this._setMode("view"))):(e.preventDefault(),void this._decorNudge(t[0],t[1]))}if("devices"===this._mode){if((h||c)&&i)return;return c?(e.preventDefault(),void this._redoDevicePosition()):h?(e.preventDefault(),void this._undoDevicePosition()):void("Escape"===e.key&&this._deviceDrag&&(e.preventDefault(),this._cancelDeviceDrag()))}if(this._markup&&(!h&&!c||!i)){if(("Delete"===e.key||"Backspace"===e.key)&&this._physicalSel&&!i&&!n)return e.preventDefault(),void this._deletePhysicalSelection();if(c)return e.preventDefault(),void this._redoGeometry();if(h)return e.preventDefault(),this._resize?.dragging?void this._rszCancelDrag():this._wallFaceBatch?(this._roomDialogCancel(),void(this._activeWallChainId&&this._path.length>1?this._undoActiveWallPoint():this._undoPoint())):"draw"===this._tool&&this._path.length?void(this._activeWallChainId&&this._path.length>1?this._undoActiveWallPoint():this._undoPoint()):"split"===this._tool&&this._splitSel?.pts?.length?(this._splitSel={...this._splitSel,pts:this._splitSel.pts.slice(0,-1)},void(this._splitSel.pts.length||(this._cursorPt=null))):void this._undoGeometry();if("Escape"===e.key)return this._physicalDrag||this._physicalRotate?(e.preventDefault(),void this._cancelPhysicalGesture()):this._roomDialog?(e.preventDefault(),void this._roomDialogCancel()):"draw"===this._tool&&this._path.length?(e.preventDefault(),void this._finishWallChain()):this._physicalSel?(e.preventDefault(),void(this._physicalSel=null)):"resize"===this._tool?(e.preventDefault(),this._resize?.dragging?void this._rszCancelDrag():("exit-tool"===this._resize?.escapeIdle()&&(this._tool="draw"),void this.requestUpdate())):"split"===this._tool?(e.preventDefault(),void(this._splitSel?.pts?.length?(this._splitSel={...this._splitSel,pts:this._splitSel.pts.slice(0,-1)},this._splitSel.pts.length||(this._cursorPt=null)):this._splitSel?this._splitSel=null:this._tool="draw")):"merge"===this._tool?(e.preventDefault(),void(this._mergeSel?this._mergeSel=null:this._tool="draw")):this._wallDialog?(e.preventDefault(),void(this._wallDialog=null)):void("opening"!==this._tool&&"wallthick"!==this._tool&&"delroom"!==this._tool&&"column"!==this._tool||(e.preventDefault(),"opening"===this._tool&&this._clearOpeningPlacement(!0),this._tool="draw"))}}_undoPoint(){if(this._path.length)return this._contourClosed?(this._path=this._path.slice(0,-1),void(this._closingWallCm=null)):void(this._activeWallChainPartitionIds.length&&this._path.length>1?this._undoActiveWallPoint():this._path=this._path.slice(0,-1))}_undoActiveWallPoint(){const e=[...this._activeWallChainPartitionIds],t=e[e.length-1],i=this._spaceModel()?.partitions.find(e=>e.id===t),n=this._path[0]?[...this._path[0]]:null,r=this._path.slice(0,-1).map(e=>[...e]),o=this._wallChainSegmentCms.slice(0,-1),s=this._geometryHistory.undo();if(!s)return this._activeWallChainPartitionIds=[],this._wallChainSegmentCms=[],this._wallChainRedo=[],void(this._path=n?[n]:[]);this._applyGeometryState(s.before,!0)?(this._activeWallChainId||=`chain-${Date.now().toString(36)}`,this._activeWallChainPartitionIds=e.slice(0,-1),this._path=r.length?r:n?[n]:[],this._wallChainSegmentCms=o,i&&this._wallChainRedo.push({id:i.id,point:[...i.b],cm:i.cm}),this._clearPlanSnapHover(),this._showToast(this._t("history.undone",{name:s.name}))):this._geometryHistory.clear()}static async getConfigElement(){return await import("./editor-Bj456-QF.js"),document.createElement("houseplan-card-editor")}static getStubConfig(){return{type:"custom:houseplan-card"}}static _warmBootReset(e){for(const e of nv.values())for(const t of e)clearTimeout(t.evict);nv.clear(),ov=e&&e>0?e:1e4}static _warmBootStats(){let e=0,t=0;const i=[];for(const n of nv.values())for(const r of n)e++,r.dlg&&(t++,i.push(r.dlg.kind));return{keys:nv.size,slots:e,dlgs:t,drafts:i}}setConfig(e){const t=this._config,i=!!t&&Object.prototype.hasOwnProperty.call(t,"floor");this._config={icon_size:2.5,show_temperature:!0,live_states:!0,show_signal:!0,...e};(i!==this._hasFixedFloor||t?.floor!==this._config.floor)&&(this._hashApplied=!1,this._navApplied=!1,this._warmVpArmed=!1),this._config.kiosk&&(this._booting=!1,this._bootFading=!1),!this._hasFixedFloor&&e.default_floor&&this._commitSpace(e.default_floor,!0);try{this._zoomBySpace=JSON.parse(localStorage.getItem(lv)||"{}")||{}}catch{this._zoomBySpace={}}try{const e=JSON.parse(localStorage.getItem(hv)||"{}")||{};this._viewPreference=Object.fromEntries(Object.entries(e).filter(e=>"flat"===e[1]||"iso"===e[1]))}catch{this._viewPreference={}}if(this._labs=Hf(),this.isConnected&&this._labsIso&&this._ensureIsoSceneRuntime(),!this._summary?.applyLocalScaleForCurrentIdentity())try{const e=JSON.parse(localStorage.getItem("houseplan_card_kiosk_v1")||"null");this._kioskScale={icon:Bn(e?.icon),font:Bn(e?.font)}}catch{}try{const e=JSON.parse(localStorage.getItem(av)||"null");this._adoption.restoreCached(e)&&(this._seedDecorStyle(this._serverCfg),this._cfgEpoch++,this._virtualLights=Eh(e.virtual_lights,this._cfgRev),this._serverStorage=!0)}catch{}this._adoptInitialSpace(this._model,this._loadOk),"view"!==this._mode||this._view||(this._zoom=this._zoomBySpace[this._space]||1),this.isConnected&&(this._syncCycleTimer(),this._warmAdopt(),this._warmLongReturn&&this._beginResumeSettle(),this._warmLongReturn=!1),this._syncVersionRecovery()}_warmAdopt(){if(this._config?.kiosk)return;const e=Mf(this._config);if(this._warmKey===e&&this._warmSlot)return;this._warmSlot&&this._warmRelease();const t=this.parentNode,i=this._warmIdx(t),n=nv.get(e);if(!n||!n.length)return;const r=n.find(e=>e.owner===this._warmGen);if(r)return this._warmLongReturn=!!r.freed&&Date.now()-r.freed>=tc,clearTimeout(r.evict),r.evict=0,r.freed=0,r.live=!0,this._warmSlot=r,this._warmKey=e,r.frameFingerprint&&this._continuity.adoptCompleteFrame(r.frameFingerprint),void(!this._devices.length&&r.devices?.length&&(this._devices=[...r.devices]));const{slot:o,sure:s}=((e,t,i,n)=>{const r=e=>{const t=!!i&&e.place?.deref()===i;return t&&e.idx===n?4:e.live?0:t?3:2};let o=null,s=0,a=0,l=null;for(const i of e){if(i.owner===t)continue;l=i;const e=r(i);e<=0||(e>s?(o=i,s=e,a=1):e===s&&a++)}return!o||a>1?{slot:o||l,sure:!1}:{slot:o,sure:!0}})(n,this._warmGen,t,i);o&&(this._warmLongReturn=!!o.freed&&Date.now()-o.freed>=tc,this._booting=!1,this._bootFading=!1,this._hdrH=o.hdrH,this._bootSoft=!0,this.isConnected&&(clearTimeout(this._bootSoftTimer),this._bootSoftTimer=window.setTimeout(()=>{this._bootSoft=!1},iv)),this._warmKey=e,s?(clearTimeout(o.evict),o.evict=0,o.owner=this._warmGen,o.place=t?new WeakRef(t):null,o.idx=i,o.live=!0,this._warmSlot=o,this._warmVp=o.vp,o.frameFingerprint&&this._continuity.adoptCompleteFrame(o.frameFingerprint),!this._devices.length&&o.devices?.length&&(this._devices=[...o.devices]),this._warmAdoptViewport(this._config)):(this._warmSlot={owner:this._warmGen,path:location.pathname,place:t?new WeakRef(t):null,idx:i,live:!0,hdrH:o.hdrH,stageH:o.stageH,vp:null,frameFingerprint:"",devices:null,dlg:null,freed:0,evict:0},n.push(this._warmSlot),this._warmTrim(n)))}_warmIdx(e){const t=e?.children;if(!t)return-1;for(let e=0;e4;){const t=e.findIndex(e=>!e.live);if(t<0)break;clearTimeout(e[t].evict),e.splice(t,1)}}_warmScheduleEvict(e,t){if(clearTimeout(e.evict),!(e.dlg||e.vp&&"view"!==e.vp.mode))return;const i=e.freed,n=e.owner;e.evict=window.setTimeout(()=>{if(e.evict=0,e.freed!==i||e.owner!==n)return;var r;e.dlg=null,e.vp=(r=e.vp)&&"view"!==r.mode?{...r,mode:"view",zoom:r.snap?.space===r.space?r.snap.zoom:r.zoom,view:null,snap:null,tool:"draw",decorTool:"select",showHidden:!1,selId:null,rszSel:null,decorSel:null}:r,e.frameFingerprint="";const o=nv.get(t);if(!e.live&&o&&o.length>1){const t=o.indexOf(e);t>=0&&o.splice(t,1)}},ov+250)}_warmAdoptViewport(e){const t=this._warmVp;if(!t||this._warmSlot?.path!==location.pathname)return void(this._warmVp=null);const i=this._fixedFloorState();if(this._hashApplied||!this._model.find(e=>e.id===t.space)||"valid"===i.kind&&i.id!==t.space||this._hasFixedFloor&&"valid"!==i.kind)return void(this._warmVp=null);this._commitSpace(t.space,!0),this._navApplied=!0;const n="view"!==t.mode&&this._canEdit&&!e.kiosk?t.mode:"view";this._adoptMode("view"),this._pendingNavMode="view"===t.mode||this._canEdit||e.kiosk?null:t.mode,this._zoom=t.zoom;const r=this._effectiveProjection(),o=r===t.projection&&this._labsIso===t.activeLabsIso;if(this._view=o&&t.view?{...t.view}:null,this._viewModeSnap=o&&t.snap?{...t.snap}:null,!o&&t.logicalCenter){const e="iso"===r?sf([t.logicalCenter.x,t.logicalCenter.y],0):[t.logicalCenter.x,t.logicalCenter.y];this._applyView(t.zoom,e[0],e[1])}var s;this._tool="opening"===(s=function(e){return"partition"===e?"draw":e}(s=t.tool))?"draw":"string"==typeof s&&$f.has(s)?s:"draw",this._decorTool=t.decorTool,this._showHidden=t.showHidden,this._showFar!==t.showFar&&(this._showFar=t.showFar,this._frame=null),this._selId=t.selId,this._resize?.restoreSelection(t.rszSel),this._decorSel=t.decorSel,this._warmVpArmed=!0,"view"!==n&&this._requestMode(n,!1,!0)}_warmPatch(e,t=!1){if(this._config?.kiosk)return;const i=Mf(this._config);if(!this._warmSlot||this._warmKey===i){if(!this._warmSlot){if(!t)return;const e=this.parentNode;this._warmKey=i,this._warmSlot={owner:this._warmGen,path:location.pathname,place:e?new WeakRef(e):null,idx:this._warmIdx(e),live:!0,hdrH:this._hdrH,stageH:0,vp:null,frameFingerprint:"",devices:null,dlg:null,freed:0,evict:0};const n=nv.get(i)||[];for(n.push(this._warmSlot),nv.set(i,n),this._warmTrim(n);nv.size>8;){const e=nv.keys().next().value;if(void 0===e||e===i)break;for(const t of nv.get(e)||[])clearTimeout(t.evict);nv.delete(e)}}Object.assign(this._warmSlot,e)}}_warmViewportState(){const e=this._effectiveProjection();return{space:this._space,mode:this._mode,projection:e,activeLabsIso:this._labsIso,logicalCenter:this._logicalViewCenter(e),zoom:this._zoom,view:this._view?{...this._view}:null,snap:this._viewModeSnap?{...this._viewModeSnap}:null,tool:this._tool,decorTool:this._decorTool,showHidden:this._showHidden,showFar:this._showFar,selId:this._selId,rszSel:this._resize?.selectedRoomId,decorSel:this._decorSel}}_warmDialogState(){const e=(e,t)=>({kind:e,space:this._space,mode:this._mode,data:t});return this._tapConfirm||this._alignDialog||this._mergeDialog||this._importDialog||this._backupExportDialog||this._backupImportDialog?null:this._openingInfo?e("openingInfo",this._openingInfo.id):this._infoCard?e("info",this._infoCard.id):this._rulesDialog?this._rulesDialog.busy?null:e("rules",this._rulesDialog):this._settingsDialog?this._settingsDialog.busy?null:e("settings",this._settingsDialog):this._markerDialog?this._markerDialog.busy?null:e("marker",this._markerDialog):this._openingDialog?e("opening",this._openingDialog):this._backdropDialog?e("backdrop",this._backdropDialog):this._decorShapeDialog?e("decorShape",this._decorShapeDialog):this._decorTextDialog?e("decorText",this._decorTextDialog):this._roomDialog?e("room",{editId:this._roomEditId,fill:this._roomFill,customFill:this._roomCustomFill,tempMin:this._roomTempMin,tempMax:this._roomTempMax,tempSrc:this._roomTempSrc,humSrc:this._roomHumSrc,srcOpen:this._roomSrcOpen,srcFilter:this._roomSrcFilter,nameScale:this._roomNameScale,labelScale:this._roomLabelScale,areaSel:this._areaSel,nameSel:this._nameSel,pendingSplit:this._pendingSplit,wallFaceBatch:this._wallFaceBatch,path:this._path}):this._spaceDialog?this._spaceDialog.busy?null:e("space",this._spaceDialog):null}_warmSnapshot(){if(this._booting||this._config?.kiosk||"steady"!==this._continuity.state)return;const e={vp:this._warmViewportState(),frameFingerprint:this._continuity.frameFingerprint,devices:this._devices,hdrH:this._hdrH};if(this._warmRevivePending||(e.dlg=this._warmDialogState()),this.isConnected&&this._warmSlot?.owner===this._warmGen){const t=this.parentNode;e.place=t?new WeakRef(t):null,e.idx=this._warmIdx(t)}this._warmPatch(e)}_warmReviveDialog(){const e=this._warmSlot;if(this._warmReviveTimer=void 0,!e||!e.dlg)return void(this._warmRevivePending=!1);const t=e.dlg,i=e.freed;if(t.mode===this._mode||"view"===t.mode||this._warmVp?.mode!==t.mode||this._editorRuntime){if(this._warmRevivePending=!1,e.dlg=null,e.freed=0,clearTimeout(e.evict),e.evict=0,i&&!(Date.now()-i>ov)&&t.space===this._space&&t.mode===this._mode){switch(t.kind){case"space":this._spaceDialog={...t.data,busy:!1,savedBusy:!1};break;case"marker":this._markerDialog={...t.data,busy:!1};break;case"settings":this._settingsDialog={...t.data,busy:!1};break;case"rules":this._rulesDialog={...t.data,busy:!1};break;case"opening":this._openingDialog={...t.data};break;case"backdrop":this._backdropDialog={...t.data};break;case"decorShape":this._decorShapeDialog={...t.data};break;case"decorText":{this._decorTextDialog={...t.data};const e=String(this._decorTextDialog?.text??"").length;this._decorTextSelection={start:e,end:e};break}case"room":{const e=t.data;this._roomEditId=e.editId,this._roomFill=e.fill,this._roomCustomFill=e.customFill||null,this._roomTempMin=e.tempMin||"",this._roomTempMax=e.tempMax||"",this._roomTempSrc=e.tempSrc,this._roomHumSrc=e.humSrc,this._roomSrcOpen=e.srcOpen,this._roomSrcFilter=e.srcFilter,this._roomNameScale=e.nameScale,this._roomLabelScale=e.labelScale,this._areaSel=e.areaSel,this._nameSel=e.nameSel,this._pendingSplit=e.pendingSplit,this._wallFaceBatch=e.wallFaceBatch||null,this._path=e.path,this._wallFaceBatch&&(this._activeWallChainId=`chain-${Date.now().toString(36)}`,this._activeWallChainPartitionIds=[...this._wallFaceBatch.activePartitionIds],this._wallChainSegmentCms=[...this._wallFaceBatch.activeCms]),this._roomDialog=!0;break}case"info":{const e=this._devices.find(e=>e.id===t.data);e&&(this._infoCard=e);break}case"openingInfo":{const e=(this._curSpaceCfg?.openings||[]).find(e=>e.id===t.data);e&&(this._openingInfo=e);break}}this.requestUpdate()}}else this._warmRevivePending=!0}_cacheSnapshot(){if(this._serverCfg)try{this._virtualLights=function(e,t,i){if(e.configRev===i)return e;const n=new Set((Array.isArray(t?.markers)?t.markers:[]).filter(Lh).map(e=>e.id));return{...e,configRev:i,off:new Set([...e.off].filter(e=>n.has(e)))}}(this._virtualLights,this._serverCfg,this._cfgRev);const e=this._adoption.snapshot(function(e){return{rev:e.rev,config_rev:e.configRev,off:[...e.off].sort()}}(this._virtualLights));e&&localStorage.setItem(av,JSON.stringify(e))}catch{}}_beginContinuityCandidate(e,t,i="plan"){return this._booting&&!this._continuity.hasCompleteFrame?this._continuity.token:(this._continuityDataReady=t,this._continuityPaintToken=-1,this._stagedDeviceSnapshotToken=-1,this._resumeSettling=!0,this._continuity.beginCandidate(e,i))}_continuityStageValid(){const e=this._stageEl;return!!e&&e.clientWidth>0&&e.clientHeight>0}_versionReloadSafetySnapshot(){return kg(this)}_continuityAssetsReady(){if(!this._model.length)return!1;const e=this._model.length?this._spaceModel():null;return!e?.bg?.href||this._signer.isReady(this.hass,e.bg.href)}_initialSpaceSelection(e,t=this._loadOk){const i=this._fixedFloorState(e,t);return"valid"===i.kind?{id:i.id,source:"fixed"}:this._hasFixedFloor?{id:null,source:"none"}:function(e){const t=new Set(e.spaceIds.filter(e=>!!e));if(!t.size)return{id:null,source:"none"};const i=[["hash",!1===e.acceptHash?null:e.hashSpace],["current",e.preserveCurrent?e.currentSpace:null],["saved",e.savedSpace],["default",e.defaultSpace],["first",e.spaceIds[0]]];for(const[e,n]of i)if(n&&t.has(n))return{id:n,source:e};return{id:null,source:"none"}}({spaceIds:e.map(e=>e.id),hashSpace:this._hashSpace(),acceptHash:!this._hashApplied,currentSpace:this._space,preserveCurrent:this._hashApplied||this._navApplied||this._warmVpArmed,savedSpace:this._savedNav()?.space,defaultSpace:this._config?.default_floor})}_adoptInitialSpace(e,t=this._loadOk){const i=this._initialSpaceSelection(e,t);return i.id?(this._commitSpace(i.id,!0),"hash"===i.source&&(this._hashApplied=!0),"saved"===i.source&&(this._navApplied=!0),i):i}_candidateBackdrop(e,t=this._space){const i=Ya(e),n=this._fixedFloorState(i,!0);if(this._hasFixedFloor&&"valid"!==n.kind)return"";const r=this._initialSpaceSelection(i,!0).id||(i.some(e=>e.id===t)?t:i[0]?.id);return i.find(e=>e.id===r)?.bg?.href||""}_visualFrameFingerprint(){const e=this._stageEl,t=e?[e.clientWidth,e.clientHeight]:[0,0];return lc([this._cfgRev,this._adoption.currentConfigFingerprint(),this._layoutRev,this._adoption.currentLayoutFingerprint(),this._space,this._mode,this._view,t,this._glowScreenBlend?"screen":"normal",this.hass?.themes?.darkMode??this.hass?.themes?.default_theme??""])}_settleContinuityFrame(){if(this._booting||!this._continuityStageValid())return;if(!this._continuity.hasCompleteFrame&&"steady"===this._continuity.state)return void(this._continuityAssetsReady()&&(this._renderSnapshotAt=Date.now(),this._continuity.markCompleteFrame(this._visualFrameFingerprint())));if(!this._continuityDataReady)return;if(!["holding","offline-stale","overlay-pending","overlay-visible","candidate-ready"].includes(this._continuity.state))return;const e=this._continuity.token;if(this._candidateDeviceSnapshot&&this._candidateDeviceSnapshot!==this._visibleDeviceSnapshot&&this._stagedDeviceSnapshotToken!==e)return this._stagedDeviceSnapshotToken=e,void this.requestUpdate();this._continuityPaintToken!==e&&(this._continuityPaintToken=e,this._continuity.candidateReady(e)&&this._continuity.commitAfterPaint(e,{updateComplete:()=>this.updateComplete,stageValid:()=>this.isConnected&&this._continuityStageValid(),assetsReady:()=>this._continuityAssetsReady(),frameFingerprint:()=>this._visualFrameFingerprint()}).then(t=>{t&&e===this._continuity.token?(this._resumeSettling=!1,this._renderSnapshotAt=Date.now(),this._candidateDeviceSnapshot&&(this._visibleDeviceSnapshot=this._candidateDeviceSnapshot),this._candidateDeviceSnapshot=null,this._stagedDeviceSnapshotToken=-1,this._warmSnapshot()):e===this._continuity.token&&(this._continuityPaintToken=-1,this._stagedDeviceSnapshotToken=-1,this._candidateDeviceSnapshot=null,this.requestUpdate())}))}_onBackdropLoaded(e,t){this._signer.markLoaded(this.hass,e,t),this._continuity.note("asset-ready"),this._continuityPaintToken=-1,"steady"!==this._continuity.state&&this.requestUpdate()}_renderRecoveryOverlay(){if(!this._continuity.overlayVisible&&"recovery-error"!==this._continuity.state)return G;const e="connection"===this._continuity.recoveryReason;return j`
    "houseplan-space-card"===e.type)||window.customCards.push({type:"houseplan-space-card",name:"House Plan — Space (static)",description:"Read-only live schematic of a single houseplan space, with a deep-link button.",preview:!1,documentation:"https://github.com/Matysh/houseplan-card"});const pg=o`:host{--hp-editor-tray-bg-fallback:color-mix(in srgb,var(--card-background-color,var(--hp-bg)) 94%,var(--hp-line));--hp-editor-tray-bg:color-mix(in srgb,var(--card-background-color,var(--hp-bg)) 86%,transparent);--hp-editor-tray-border:color-mix(in srgb,var(--hp-line) 82%,var(--hp-accent));--hp-editor-tray-blur:8px;--hp-editor-tray-shadow:var(--shadow-2);}.editor-secondary-host{position:absolute;inset:var(--sp-2) var(--sp-4) auto;z-index:70;display:flex;justify-content:flex-end;pointer-events:none;}.editor-secondary-host.kind-palette,.editor-secondary-host.kind-group{justify-content:flex-start;}.editor-secondary{pointer-events:none;max-width:100%;display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-3) var(--sp-4);color:var(--hp-txt);background:var(--card-background-color,var(--hp-bg));background:var(--hp-editor-tray-bg-fallback);border:1px solid var(--hp-line);border-color:var(--hp-editor-tray-border);border-radius:var(--rad-l);box-shadow:var(--hp-editor-tray-shadow);opacity:0;visibility:hidden;transform:translateY(-4px);transition:opacity 0.1s ease,transform 0.1s cubic-bezier(0.2,0.7,0.2,1),visibility 0s linear 0.1s;touch-action:auto;}.editor-secondary-host.open .editor-secondary{pointer-events:auto;opacity:1;visibility:visible;transform:translateY(0);transition-duration:0.14s,0.14s,0s;transition-delay:0s;}.editor-secondary-host.blocked .editor-secondary{pointer-events:none;}@supports ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){.editor-secondary{background:var(--hp-editor-tray-bg);-webkit-backdrop-filter:blur(var(--hp-editor-tray-blur));backdrop-filter:blur(var(--hp-editor-tray-blur));}}.editor-secondary-content,.editor-group-items{display:flex;align-items:center;gap:var(--sp-3);min-width:0;}.editor-context-label{max-width:14rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-inline-end:var(--sp-4);border-inline-end:1px solid var(--hp-line);color:var(--hp-muted);font-size:var(--fs-s);}.editor-secondary.kind-palette{width:min(760px,100%);align-items:stretch;padding:0;overflow:hidden;}.editor-secondary.kind-palette .editor-secondary-content,.editor-secondary.kind-palette .furnpalette{width:100%;}.editor-secondary.kind-palette .furnpalette{max-height:38vh;border:0;background:transparent;}.editor-group-launcher .group-chevron{--mdc-icon-size:16px;transition:transform 0.14s ease;}.editor-group-launcher[aria-expanded="true"] .group-chevron{transform:rotate(180deg);}.editor-secondary .bdhint{font-size:var(--fs-s);color:var(--hp-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.editor-secondary .dfill{display:inline-flex;align-items:center;gap:var(--sp-2);font-size:var(--fs-s);cursor:pointer;}.editor-secondary .dfill input[type="checkbox"]{width:16px;height:16px;flex:none;margin:0;padding:0;}.editor-secondary hp-color-opacity{flex:0 0 auto;}.editor-secondary input{width:74px;background:transparent;border:1px solid var(--hp-line);color:var(--hp-txt);border-radius:var(--rad-s);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-m);}.editor-secondary label,.editor-secondary .hint{color:var(--hp-muted);font-size:var(--fs-s);}.editor-secondary .drawwall{display:inline-flex;align-items:center;gap:var(--sp-3);white-space:nowrap;}.editor-secondary .drawwall input{width:4.2em;}.editor-secondary .drawwall .opl{color:var(--hp-muted);font-size:var(--fs-s);}@container (min-width:560px) and (max-width:899px){.editor-secondary-content,.editor-group-items{flex-wrap:wrap;justify-content:flex-end;}}@container (max-width:559px){.editor-secondary-host{inset-inline:var(--sp-4);}.editor-secondary{max-width:100%;}.editor-secondary-content,.editor-group-items{overflow-x:auto;scrollbar-width:thin;}.editor-secondary-content>*,.editor-group-items>*{flex:none;}.editor-context-label{display:none;}}@media (prefers-reduced-motion:reduce){.editor-secondary{transition:none;}.editor-group-launcher .group-chevron{transition:none;}}`;class _g{constructor(e=50){this._undo=[],this._redo=[],this._limit=Math.max(30,Math.floor(e))}get canUndo(){return this._undo.length>0}get canRedo(){return this._redo.length>0}get undoName(){return this._undo[this._undo.length-1]?.name??null}get redoName(){return this._redo[this._redo.length-1]?.name??null}get size(){return this._undo.length}push(e){this._undo.push(e),this._undo.length>this._limit&&this._undo.splice(0,this._undo.length-this._limit),this._redo=[]}undo(){const e=this._undo.pop()??null;return e&&this._redo.push(e),e}redo(){const e=this._redo.pop()??null;return e&&this._undo.push(e),e}removeWhere(e){const t=this._undo.length,i=this._redo.length;return this._undo=this._undo.filter(t=>!e(t)),this._redo=this._redo.filter(t=>!e(t)),t+i-this._undo.length-this._redo.length}clear(){this._undo=[],this._redo=[]}}function mg(e,t){const i=e[t];return i&&Number.isFinite(i.x)&&Number.isFinite(i.y)?{x:i.x,y:i.y,..."string"==typeof i.s?{s:i.s}:{}}:null}function gg(e,t,i){if(null===i){if(!(t in e))return e;const i={...e};return delete i[t],i}const n={...e[t]||{}};delete n.x,delete n.y,delete n.s;const r={...n,x:i.x,y:i.y,...void 0!==i.s?{s:i.s}:{}};return{...e,[t]:r}}const fg="houseplan-card:version-reload-target:v1";function vg(e){if("string"!=typeof e)return null;return e.trim()||null}class yg{constructor(e){this.hooks=e,this._input={frontendVersion:null,backendVersion:null,kiosk:!1,reducedMotion:!1},this._relation={kind:"unknown"},this._banner=null,this._connected=!1,this._attemptTarget=null,this._attemptState=null,this._noticeToken=0}get relation(){return this._relation}get banner(){return this._banner}get hasCurrentMismatchNotice(){return"mismatch"===this._relation.kind&&"visible"===this._banner?.phase}connect(){this._connected||(this._connected=!0,this._attemptTarget=null,this._attemptState=null,this._reconcile())}disconnect(){(this._connected||this._banner)&&(this._connected=!1,this._cancelTimer(),this._banner&&(this._banner=null,this.hooks.changed()))}update(e){const t={frontendVersion:vg(e.frontendVersion),backendVersion:vg(e.backendVersion),kiosk:!0===e.kiosk,reducedMotion:!0===e.reducedMotion},i=function(e,t){const i=vg(e),n=vg(t);return i&&n?i===n?{kind:"equal",frontend:i,backend:n}:{kind:"mismatch",frontend:i,backend:n}:{kind:"unknown"}}(t.frontendVersion,t.backendVersion),n=!((e,t)=>e.frontendVersion===t.frontendVersion&&e.backendVersion===t.backendVersion&&e.kiosk===t.kiosk&&e.reducedMotion===t.reducedMotion)(this._input,t)||!((e,t)=>e.kind===t.kind&&("unknown"===e.kind||"unknown"!==t.kind&&e.frontend===t.frontend&&e.backend===t.backend))(this._relation,i);this._input=t,this._relation=i,n&&this._reconcile()}finishBannerExit(e){this._banner&&"leaving"===this._banner.phase&&this._banner.token===e&&(this._banner=null,this.hooks.changed())}_reconcile(){if(this._cancelTimer(),!this._connected||"mismatch"!==this._relation.kind)return this._attemptTarget=null,this._attemptState=null,void this._hideBanner();if(!this._input.kiosk)return this._attemptTarget=null,this._attemptState=null,void this._showBanner(this._relation.frontend,this._relation.backend);const e=this._relation.backend;if(this._attemptTarget===e&&null!==this._attemptState||(this._attemptTarget=e,this._attemptState=function(e,t){try{const i=e();return i?i.getItem(fg)===t?"attempted":"fresh":"unavailable"}catch{return"unavailable"}}(this.hooks.storage,e)),"fresh"===this._attemptState)return this._hideBanner(),void this._armTimer();this._showBanner(this._relation.frontend,e)}_armTimer(){this._connected&&void 0===this._timer&&"mismatch"===this._relation.kind&&this._input.kiosk&&"fresh"===this._attemptState&&(this._timer=this.hooks.clock.setTimeout(()=>{this._timer=void 0,this._tick()},250))}_cancelTimer(){void 0!==this._timer&&(this.hooks.clock.clearTimeout(this._timer),this._timer=void 0)}_tick(){if(!this._connected||"mismatch"!==this._relation.kind||!this._input.kiosk||"fresh"!==this._attemptState)return;if(!function(e){return e.connected&&e.initialFrameSettled&&e.viewOnly&&e.surfacesIdle&&e.configWritesIdle&&e.physicalWritesIdle&&e.layoutWritesIdle&&e.gesturesIdle&&e.interactionPauseElapsed&&e.baseZoom}(this.hooks.safety()))return void this._armTimer();const e=this._relation.backend,t=function(e,t){try{const i=e();return i?i.getItem(fg)===t?"attempted":(i.setItem(fg,t),"claimed"):"unavailable"}catch{return"unavailable"}}(this.hooks.storage,e);if(this._attemptTarget=e,this._attemptState="claimed"===t?"attempted":t,"claimed"===t){this._showBanner(this._relation.frontend,e);try{this.hooks.reload()}catch{}}else this._showBanner(this._relation.frontend,e)}_showBanner(e,t){"visible"===this._banner?.phase&&this._banner.frontend===e&&this._banner.backend===t||(this._banner={frontend:e,backend:t,phase:"visible",token:++this._noticeToken},this.hooks.changed())}_hideBanner(){if(this._banner)return this._input.reducedMotion?(this._banner=null,void this.hooks.changed()):void("leaving"!==this._banner.phase&&(this._banner={...this._banner,phase:"leaving",token:++this._noticeToken},this.hooks.changed()))}}const bg=1;function wg(e,t){const i=t&&"object"==typeof t?t:{};e._haIntegrationVersion=vg(i.integration_version);const n=i.support_api;e._haSupportApi="number"==typeof n&&Number.isSafeInteger(n)?n:null,e._haDecorAssetsApi=1===i.decor_assets_api?1:null,e._haSummaryPanelApi=1===i.summary_panel_api?1:null,e._haRadarStage1Api=1===i.radar_stage1_api?1:null,e._syncVersionRecovery()}function kg(e){const t=e._stageEl,i=e._loadOk&&!e._loading&&e._continuityDataReady&&!e._resumeSettling&&!e._connectionWasLost&&!e._booting&&!e._bootFading&&!e._bootSettling&&!e._bootSoft&&e._continuity.hasCompleteFrame&&"steady"===e._continuity.state&&!e._continuity.overlayBlocksInteraction&&!!t&&t.clientWidth>0&&t.clientHeight>0,n=!(0!==e._pointers.size||0!==e._touchContacts.size||e._touchSequenceMultitouch||e._roomPointer||e._panStart||e._panLock||e._pinchStart||e._swipeStart||e._tabDrag||e._tabDragRelease||e._drag||e._deviceDrag||e._rlResize||e._resize?.dragging||e._physicalDrag||e._physicalRotate||e._opDrag||e._decorDraft||e._decorMove||e._dtDrag||e._bdDrag||e._furnTouchPending||e._compassDrag||e._viewportGestureDirty||e._devicePositionBusy||e._modeTransitionBusy||e._cameraTransition.active||e._slide||0!==e._warmModeRequest),r=!(e._editorSecondaryDialogBlocked||e._partitionDeleteDialog||e._roomDeleteDialog||e._backdropGuard||e._vacFit||e._editorSecondary?.hasOpenGroup||e._furnPalette||e._decorImagePalette);return{connected:e.isConnected,initialFrameSettled:i,viewOnly:!0===e._config?.kiosk&&"view"===e._mode&&!e._editing,surfacesIdle:r,configWritesIdle:0===e._writesPending&&!e._saveConfigDebounced.pending(),physicalWritesIdle:0===e._pendingPhysicalWrites.size,layoutWritesIdle:!e._persistLayout.pending()&&0===e._dirtyPos.size&&0===e._sentPos.size&&!e._devicePositionBusy,gesturesIdle:n,interactionPauseElapsed:Date.now()>=e._cyclePausedUntil,baseZoom:e._zoom<=1.001}}class xg{constructor(){this.seen=null,this.diagnosticsCache=null}observe(e,t,i,n){this.invalidateDiagnosticsForHass(e,t,i),this.intake(t,n)}intake(e,t){e&&this.seen!==e&&(this.seen=e,t())}invalidate(){this.diagnosticsCache=null}invalidateDiagnosticsForHass(e,t,i){this.diagnosticsCache&&(e?.entities!==t?.entities||e?.devices!==t?.devices||[...i?.entityIds||[]].some(i=>!!e?.states?.[i]!=!!t?.states?.[i]))&&this.invalidate()}diagnostics(e,t,i){if(this.diagnosticsCache)return this.diagnosticsCache;const n={active:0,ha_disabled:0,orphaned:0,unverified:0};for(const e of t)e.removed||"virtual"===e.binding||n[i(e.binding).kind]++;return this.diagnosticsCache={registry:hd(e),bindings:n},this.diagnosticsCache}}function Sg(e){const t=e;t._hassSequence++,t._renderSnapshotAt=Date.now(),t._continuity.note("hass-snapshot"),t._ensureHaRegistryAuthority(),t._planHassMemo=null,t._hookConnection(),!t._loadOk&&!t._loading&&t._loadTries<8&&t._loadFromServer(),t._maybeRebuildDevices(),t._vacTick(),t._activityTick()}function $g(e){return!!e&&"object"==typeof e&&1===e.version}function Mg(e,t){const i=e.radar;return e.space===t&&!0!==e.hidden&&!0!==e.removed&&$g(i)&&!0===i.enabled&&!1!==i.show_live}const Rg={ok:"radar.health_ok",off:"radar.health_off",stale:"radar.health_stale",partial:"radar.health_partial",restricted:"radar.health_restricted",incomplete:"radar.health_incomplete",position_unavailable:"radar.health_position_unavailable",unavailable:"radar.health_unavailable",needs_setup:"radar.health_needs_setup",inconsistent:"radar.health_inconsistent",unknown:"radar.health_unknown"};const Cg=e=>"number"==typeof e&&Number.isFinite(e);class Tg{constructor(e){this.host=e,this.frames=new Map,this.connection=null,this.space="",this.generation=0,this.expiryTimer=0,this.deadlines=new Map}sync(e,t){const i=this.host.hass?.connection;if(!t||!i||!this.host.isConnected)return void this.stop();if(this.unsubscribe&&this.connection===i&&this.space===e)return;this.stop(),this.connection=i,this.space=e;const n=++this.generation,r=i.subscribeMessage?.bind(i);"function"==typeof r&&Promise.resolve(r(e=>{if(n!==this.generation||!this.host.isConnected)return;const t=function(e){if(!e||"object"!=typeof e)return null;const t=e;if("string"!=typeof t.marker_id||"string"!=typeof t.server_session_id||!Number.isSafeInteger(t.seq)||"string"!=typeof t.health)return null;const i=Array.isArray(t.targets)?t.targets.slice(0,256).flatMap(e=>{if(!e||"object"!=typeof e)return[];const t=e;return"string"==typeof t.slot&&Cg(t.x)&&Cg(t.y)&&Cg(t.expires_at)&&Cg(t.reported_at)&&("bounded_latest"===t.pair_quality||"coherent"===t.pair_quality)?[{...t,included:!0===t.included,smooth:!0===t.smooth}]:[]}):[],n=Array.isArray(t.ranges)?t.ranges.slice(0,64).flatMap(e=>{if(!e||"object"!=typeof e)return[];const t=e;if(!("string"==typeof t.id&&Cg(t.x)&&Cg(t.y)&&Cg(t.radius)&&Cg(t.expires_at)&&Cg(t.reported_at)))return[];const i=Array.isArray(t.segments)?t.segments.slice(0,64).flatMap(e=>{if(!Array.isArray(e))return[];const t=e.slice(0,181).flatMap(e=>Array.isArray(e)&&2===e.length&&Cg(e[0])&&Cg(e[1])?[[e[0],e[1]]]:[]);return t.length>=2?[t]:[]}):void 0;return[{...t,...i?{segments:i}:{}}]}):[],r=Array.isArray(t.zones)?t.zones.slice(0,64).flatMap(e=>{if(!e||"object"!=typeof e)return[];const t=e;if("string"!=typeof t.id)return[];const i=t.state;if(null!==i&&"boolean"!=typeof i&&!Cg(i))return[];const n=Array.isArray(t.polygon)?t.polygon.slice(0,64).flatMap(e=>Array.isArray(e)&&2===e.length&&Cg(e[0])&&Cg(e[1])?[[e[0],e[1]]]:[]):[];return[{id:t.id,state:i,...n.length>=3?{polygon:n}:{}}]}):[];return{server_session_id:t.server_session_id,marker_id:t.marker_id,source_generation:"string"==typeof t.source_generation?t.source_generation:void 0,calibration_revision:"string"==typeof t.calibration_revision?t.calibration_revision:void 0,seq:t.seq,reported_at:Cg(t.reported_at)?t.reported_at:void 0,expires_at:Cg(t.expires_at)?t.expires_at:void 0,health:t.health,reported_presence:"boolean"==typeof t.reported_presence?t.reported_presence:null,complete:!0===t.complete,targets:i,ranges:n,zones:r}}(e);if(!t)return;if(!function(e,t){return!e||t.server_session_id!==e.server_session_id||t.source_generation!==e.source_generation||t.calibration_revision!==e.calibration_revision||t.seq>e.seq}(this.frames.get(t.marker_id),t))return;const i=function(e,t=Date.now()){if(!Cg(e.expires_at))return null;if(!Cg(e.reported_at))return Math.max(0,1e3*e.expires_at-t);const i=Math.max(0,1e3*(e.expires_at-e.reported_at)),n=Math.max(0,t-1e3*e.reported_at);return Math.max(0,i-n)}(t);"restricted"===t.health||"disabled"===t.health||0===i?(this.frames.delete(t.marker_id),this.deadlines.delete(t.marker_id)):(this.frames.set(t.marker_id,t),null==i?this.deadlines.delete(t.marker_id):this.deadlines.set(t.marker_id,this.monotonicNow()+i)),this.armExpiry(),this.host.requestUpdate()},{type:"houseplan/radar/subscribe",space_id:e})).then(e=>{n===this.generation&&this.host.isConnected?"function"==typeof e&&(this.unsubscribe=e):"function"==typeof e&&e()}).catch(()=>{n===this.generation&&this.stop()})}stop(){this.generation++,this.unsubscribe?.(),this.unsubscribe=void 0,this.connection=null,this.space="",clearTimeout(this.expiryTimer),this.expiryTimer=0,this.frames.size&&(this.frames.clear(),this.host.isConnected&&this.host.requestUpdate()),this.deadlines.clear()}armExpiry(){clearTimeout(this.expiryTimer);const e=this.monotonicNow(),t=[...this.deadlines.values()].filter(t=>t>e);if(!t.length)return;const i=Math.max(20,Math.min(...t)-e+10);this.expiryTimer=window.setTimeout(()=>{this.expiryTimer=0;let e=!1;const t=this.monotonicNow();for(const[i,n]of this.deadlines)n>t||(this.deadlines.delete(i),this.frames.delete(i),e=!0);this.armExpiry(),e&&this.host.isConnected&&this.host.requestUpdate()},i)}monotonicNow(){return globalThis.performance?.now?.()??Date.now()}}const Dg=Object.freeze({enabled:!1,z2mBaseTopics:Object.freeze([])});function Ag(e){if("string"!=typeof e)return null;const t=e.trim().replace(/^\/+|\/+$/g,"").replace(/\/{2,}/g,"/");return!t||t.length>180||/[#+\u0000-\u001f\u007f]/.test(t)?null:t}function Pg(e){const t=e?.zigbee_topology;if(!t||"object"!=typeof t)return Dg;const i=t,n=Array.isArray(i.z2m_base_topics)?i.z2m_base_topics:Array.isArray(i.z2mBaseTopics)?i.z2mBaseTopics:[],r=new Set,o=[];for(const e of n){const t=Ag(e);if(t&&!r.has(t)&&(r.add(t),o.push(t),8===o.length))break}return{enabled:!0===i.enabled,z2mBaseTopics:o}}function Fg(e,t){const i={...e},n=t.z2mBaseTopics.map(Ag).filter(Boolean);return t.enabled||n.length?i.zigbee_topology={enabled:!0===t.enabled,z2m_base_topics:[...new Set(n)].slice(0,8)}:delete i.zigbee_topology,i}const zg={now:()=>performance.now(),requestFrame:e=>requestAnimationFrame(e),cancelFrame:e=>cancelAnimationFrame(e)},Ig=e=>Math.max(0,Math.min(1,e)),Og=(e,t,i)=>e+(t-e)*i,Eg=(e,t,i)=>{const n=1-e;return 3*n*n*e*t+3*n*e*e*i+e*e*e},Ng=e=>{const t=Ig(e);if(0===t||1===t)return t;let i=0,n=1,r=t;for(let e=0;e<12;e++)r=(i+n)/2,Eg(r,.2,.2)0&&e.w>0?t/e.w:1,viewBox:{...e}}}function Lg(e,t,i){const n=Math.max(1e-9,e.pixelsPerUnit),r=Math.max(1e-9,t/n),o=Math.max(1e-9,i/n);return{x:e.centerX-r/2,y:e.centerY-o/2,w:r,h:o}}function Bg(e){const t=e.trim(),i=/^rgba?\(\s*([\d.]+)[, ]+([\d.]+)[, ]+([\d.]+)(?:\s*[,/]\s*([\d.]+))?\s*\)$/i.exec(t);if(i)return[Number(i[1]),Number(i[2]),Number(i[3]),null==i[4]?1:Number(i[4])];const n=/^#([0-9a-f]{6}|[0-9a-f]{8})$/i.exec(t)?.[1];return n?[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16),8===n.length?parseInt(n.slice(6,8),16)/255:1]:null}function qg(e,t,i){const n=Bg(e),r=Bg(t);if(!n||!r)return i<.5?e:t;const o=Ig(i);return`rgba(${Math.round(Og(n[0],r[0],o))}, ${Math.round(Og(n[1],r[1],o))}, ${Math.round(Og(n[2],r[2],o))}, ${Og(n[3],r[3],o).toFixed(3)})`}class jg{constructor(e,t=zg){this._hooks=e,this._clock=t,this._token=0,this._raf=0,this._state=null}get state(){return this._state}get active(){return"running"===this._state?.phase||"preparing"===this._state?.phase}get presented(){return this._state?.presented||null}start(e,t,i,n=220){this.cancel(!1);const r=++this._token,o=this._clock.now();if(this._state={token:r,phase:n<=0?"settling":"running",from:e,to:t,presented:n<=0?t:e,startedAt:o,duration:Math.max(0,n),targetMode:i},n<=0)return this._hooks.frame(this._state),this._hooks.settled(this._state),this._state=null,r;this._hooks.frame(this._state);const s=e=>{const t=this._state;if(!t||t.token!==r)return;const i=Ig((e-t.startedAt)/t.duration);t.presented=i>=1?t.to:function(e,t,i){const n=Ng(i),r=Og(e.stageWidth,t.stageWidth,n),o=Og(e.stageHeight,t.stageHeight,n),s=Math.max(1e-9,e.viewport.pixelsPerUnit),a=Math.max(1e-9,t.viewport.pixelsPerUnit),l={centerX:Og(e.viewport.centerX,t.viewport.centerX,n),centerY:Og(e.viewport.centerY,t.viewport.centerY,n),pixelsPerUnit:Math.exp(Og(Math.log(s),Math.log(a),n))};return{presentedMode:n<.5?e.presentedMode:t.presentedMode,editorChromeHeight:Og(e.editorChromeHeight,t.editorChromeHeight,n),stageWidth:r,stageHeight:o,viewport:{...l,viewBox:Lg(l,r,o)},stageColor:qg(e.stageColor,t.stageColor,n),paperColor:qg(e.paperColor,t.paperColor,n),sceneBrightness:Og(e.sceneBrightness,t.sceneBrightness,n),architectureOpacity:Og(e.architectureOpacity,t.architectureOpacity,n),backdropOpacity:Og(e.backdropOpacity,t.backdropOpacity,n),viewWeight:Og(e.viewWeight,t.viewWeight,n),editorWeight:Og(e.editorWeight,t.editorWeight,n),toolbarContentOpacity:Og(e.toolbarContentOpacity,t.toolbarContentOpacity,n)}}(t.from,t.to,i),t.phase=i>=1?"settling":"running",this._hooks.frame(t),i<1?this._raf=this._clock.requestFrame(s):(this._raf=0,this._hooks.settled(t),this._state?.token===r&&(this._state=null))};return this._raf=this._clock.requestFrame(s),r}cancel(e=!0){this._raf&&this._clock.cancelFrame(this._raf),this._raf=0;const t=this._state;this._state=null,this._token++,t&&e&&(t.phase="settling",t.presented=t.to,this._hooks.frame(t),this._hooks.settled(t))}dispose(){this.cancel(!1)}}const Wg={now:()=>"undefined"!=typeof performance?performance.now():Date.now(),requestFrame:e=>"function"==typeof requestAnimationFrame?requestAnimationFrame(e):null,cancelFrame:e=>{"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(e)}},Ug=e=>Number.isFinite(e);function Gg(e){return!!e&&Ug(e.zoom)&&e.zoom>0&&Ug(e.viewBox.x)&&Ug(e.viewBox.y)&&Ug(e.viewBox.w)&&e.viewBox.w>0&&Ug(e.viewBox.h)&&e.viewBox.h>0}function Vg(e){return{zoom:e.zoom,viewBox:{...e.viewBox}}}function Kg(e,t){return Math.abs(e.zoom-t.zoom)<1e-9&&Math.abs(e.viewBox.x-t.viewBox.x)<1e-6&&Math.abs(e.viewBox.y-t.viewBox.y)<1e-6&&Math.abs(e.viewBox.w-t.viewBox.w)<1e-6&&Math.abs(e.viewBox.h-t.viewBox.h)<1e-6}const Yg=(e,t,i)=>e+(t-e)*i,Xg=(e,t,i)=>Math.exp(Yg(Math.log(e),Math.log(t),i));class Zg{constructor(e,t=Wg){this._hooks=e,this._clock=t,this._token=0,this._raf=null,this._state=null}get state(){return this._state}get active(){return"running"===this._state?.phase}get presented(){return this._state?.presented||null}get target(){return this._state?.to||null}start(e,t,i,n){this.cancel(!1);const r=++this._token,o=Vg(e),s=Vg(t),a=n>0&&Gg(o)&&Gg(s),l=this._clock.now(),c={token:r,phase:a?"running":"settling",from:o,to:s,presented:Vg(a?o:s),startedAt:l,duration:a?n:0,reason:i};if(this._state=c,this._hooks.frame(c),!a)return this._settle(r),r;const h=e=>{const t=this._state;if(!t||t.token!==r)return;const i=Math.max(0,Math.min(1,(e-t.startedAt)/t.duration));if(t.presented=i>=1?Vg(t.to):function(e,t,i){if(!Gg(e))return Vg(t);if(!Gg(t))return Vg(e);const n=Ng(i);if(n<=0)return Vg(e);if(n>=1)return Vg(t);const r=e.viewBox.x+e.viewBox.w/2,o=e.viewBox.y+e.viewBox.h/2,s=t.viewBox.x+t.viewBox.w/2,a=t.viewBox.y+t.viewBox.h/2,l=Xg(e.viewBox.w,t.viewBox.w,n),c=Xg(e.viewBox.h,t.viewBox.h,n),h=Yg(r,s,n),d=Yg(o,a,n);return{zoom:Xg(e.zoom,t.zoom,n),viewBox:{x:h-l/2,y:d-c/2,w:l,h:c}}}(t.from,t.to,i),t.phase=i>=1?"settling":"running",this._hooks.frame(t),i>=1)return this._raf=null,void this._settle(r);this._raf=this._clock.requestFrame(h),null===this._raf&&this._settle(r)};return this._raf=this._clock.requestFrame(h),null===this._raf&&(c.phase="settling",c.presented=Vg(s),this._hooks.frame(c),this._settle(r)),r}cancel(e=!0){null!==this._raf&&this._clock.cancelFrame(this._raf),this._raf=null;const t=this._state;this._state=null,this._token++,t&&e&&(t.phase="settling",t.presented=Vg(t.to),this._hooks.frame(t),this._hooks.settled(t))}dispose(){this.cancel(!1)}_settle(e){const t=this._state;t&&t.token===e&&(t.phase="settling",t.presented=Vg(t.to),this._hooks.settled(t),this._state?.token===e&&(this._state=null))}}function Jg(e,t,i){const n=e.querySelector("ha-card");if(!n)return null;const r=n.getBoundingClientRect(),o=t.getBoundingClientRect().top-r.top,s=i?0:Math.min(Math.max(r.top,0),120),a=Math.round(o+s);return a>=0?a:null}const Qg=Object.freeze({rotDeg:0,tiltDeg:20,xyScale:1,zScale:1,origin:Object.freeze([500,500])}),ef=84,tf=10,nf=4,rf=4;function of(e){return[e.rotDeg,e.tiltDeg,e.xyScale,e.zScale,e.origin[0],e.origin[1]].every(Number.isFinite)&&Math.abs(e.xyScale)>1e-12&&Math.abs(Math.cos(e.tiltDeg*Math.PI/180))>1e-12}function sf(e,t,i=Qg){if(!Number.isFinite(e[0])||!Number.isFinite(e[1]))throw new Error("invalid isometric projection input");return function(e,t){if(!Number.isFinite(e[0])||!Number.isFinite(e[1])||!t.every(Number.isFinite))throw new Error("invalid isometric affine input");const[i,n,r,o,s,a]=t;return[i*e[0]+r*e[1]+s,n*e[0]+o*e[1]+a]}(e,lf(t,i))}function af(e,t=Qg){if(!of(t)||!Number.isFinite(e[0])||!Number.isFinite(e[1]))throw new Error("invalid isometric projection input");const i=t.rotDeg*Math.PI/180,n=t.tiltDeg*Math.PI/180,r=(e[0]-t.origin[0])/t.xyScale,o=(e[1]-t.origin[1])/(t.xyScale*Math.cos(n));return[t.origin[0]+r*Math.cos(i)+o*Math.sin(i),t.origin[1]-r*Math.sin(i)+o*Math.cos(i)]}function lf(e=0,t=Qg){if(!of(t)||!Number.isFinite(e))throw new Error("invalid isometric camera");const i=t.rotDeg*Math.PI/180,n=t.tiltDeg*Math.PI/180,r=t.xyScale*Math.cos(i),o=-t.xyScale*Math.sin(i),s=t.xyScale*Math.sin(i)*Math.cos(n),a=t.xyScale*Math.cos(i)*Math.cos(n);return[r,s,o,a,t.origin[0]-r*t.origin[0]-o*t.origin[1],t.origin[1]-s*t.origin[0]-a*t.origin[1]-e*t.zScale*Math.sin(n)]}function cf(e=Qg){return function(e=0,t=Qg){return`matrix(${lf(e,t).map(e=>Number(e.toFixed(12))).join(" ")})`}(0,e)}function hf(e,t=Qg){const{rect:i,wallHeight:n}=e,r=e.openingHeight??n,o=e.floorDepth??0,s=e.raisedHeight??n;if(!(i.w>=0)||!(i.h>=0)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(s)||n<0||r<0||o<0||s<0)throw new Error("invalid isometric frame");const a=[[i.x,i.y],[i.x+i.w,i.y],[i.x+i.w,i.y+i.h],[i.x,i.y+i.h]],l=Math.max(n,r,s),c=a.flatMap(e=>[sf(e,-o,t),sf(e,l,t)]),h=c.map(e=>e[0]),d=c.map(e=>e[1]),u=Math.min(...h),p=Math.min(...d);return{x:u,y:p,w:Math.max(...h)-u,h:Math.max(...d)-p}}const df=[".dev",".vacpuck",".oplock",".op-hit",".opening",".rlgo","a","button","input","select","textarea",'[contenteditable]:not([contenteditable="false"])',"[data-room-fit-block]",'[role="link"]','[role="button"]'].join(","),uf=(e,t)=>{try{return"function"==typeof e?.matches&&e.matches(t)}catch{return!1}};function pf(e){for(const t of e){const e=t;if(uf(e,".roomlabel[data-id]")){const t=e.getAttribute?.("data-id");return t?{kind:"room",roomId:t}:{kind:"interactive"}}if(uf(e,df))return{kind:"interactive"};if(uf(e,'[data-hp="room"][data-id]')){const t=e.getAttribute?.("data-id");return t?{kind:"room",roomId:t}:{kind:"interactive"}}if(uf(e,".stage"))return{kind:"background"}}return{kind:"outside"}}function _f(e){const t=pf(e);return"room"===t.kind?t.roomId:null}class mf{constructor(){this.pointer=null,this.sequence=null}clear(){this.pointer=null,this.sequence=null}clearOutside(e){let t={kind:"outside"};try{t=pf(e.composedPath())}catch{}"outside"===t.kind&&this.clear()}pointerDown(e,t,i){let n={kind:"outside"};try{n=pf(e.composedPath())}catch{}this.pointer=function(e){const t="mouse"===(i=e.pointerType)||"touch"===i||"pen"===i?i:null;var i;return t&&"view"===e.mode&&"background"===e.owner.kind&&!e.blocked&&e.isPrimary&&0===e.button&&Number.isFinite(e.x)&&Number.isFinite(e.y)?{pointerId:e.pointerId,spaceId:e.spaceId,modality:t,x:e.x,y:e.y}:null}({pointerId:e.pointerId,pointerType:e.pointerType,isPrimary:e.isPrimary,button:e.button,spaceId:t,mode:i?"view":"blocked",owner:n,blocked:!i,x:e.clientX,y:e.clientY}),this.pointer||(this.sequence=null)}pointerUp(e,t,i,n,r=Date.now()){let o={kind:"outside"};try{o=pf(e.composedPath())}catch{}const s=function(e,t,i){if(!t||"view"!==i.mode||"background"!==i.owner.kind||i.blocked||t.pointerId!==i.pointerId||t.spaceId!==i.spaceId||!Number.isFinite(i.x)||!Number.isFinite(i.y)||!Number.isFinite(i.now)||Math.abs(i.x-t.x)+Math.abs(i.y-t.y)>=8)return{sequence:null,trigger:!1};const n=e?i.now-e.at:Number.POSITIVE_INFINITY;return e&&e.spaceId===i.spaceId&&e.modality===t.modality&&n>=0&&n<=350?{sequence:null,trigger:!0}:{sequence:{at:i.now,spaceId:i.spaceId,modality:t.modality},trigger:!1}}(this.sequence,this.pointer,{pointerId:e.pointerId,spaceId:t,mode:i?"view":"blocked",owner:o,blocked:n||!i,x:e.clientX,y:e.clientY,now:r});return this.pointer=null,this.sequence=s.sequence,s.trigger}}const gf=e=>e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1]);function ff(e){return!!e&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.w)&&e.w>0&&Number.isFinite(e.h)&&e.h>0}function vf(e,t=0){if(!e.length||!Number.isFinite(t)||t<0||!e.every(gf))return null;let i=1/0,n=1/0,r=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t[0]),n=Math.min(n,t[1]),r=Math.max(r,t[0]),o=Math.max(o,t[1]);const s=r-i,a=o-n;return s>0&&a>0?{x:i-t,y:n-t,w:s+2*t,h:a+2*t}:null}function yf(e,t,i){const n="string"!=typeof t||"invalid"!==t&&"no-borders"!==t&&"unverified"!==t&&!/^[a-z0-9]{1,8}$/i.test(t)?"redacted":t;return Object.freeze({kind:e,fingerprint:n,terminal:!!i})}function bf(e,t){return`${e("editor.load_failed")} ${e(t.terminal?"editor.refresh_advice":"editor.retry_advice")}`}class wf extends Error{}class kf{constructor(e){this.options=e,this._state="idle",this._inFlight=null}get state(){return this._state}ensure(){return"ready"===this._state?Promise.resolve(!0):"failed"===this._state?Promise.resolve(!1):(this._inFlight||(this._setState("loading"),this._inFlight=this._loadWithRetry().finally(()=>{this._inFlight=null})),this._inFlight)}async _loadWithRetry(){let e=new Error("Editor runtime did not load"),t=!1;for(const i of[0,1])try{const e=await this.options.load(i);if(e.fingerprint!==this.options.expectedFingerprint)throw new wf(`Editor runtime fingerprint mismatch: expected ${this.options.expectedFingerprint}, got ${e.fingerprint}`);const t=e.create();return this.options.install(t),this._setState("ready"),!0}catch(i){e=i,i instanceof wf&&(t=!0)}return this._setState(t?"failed":"idle"),this.options.failed?.(e,{terminal:t}),!1}_setState(e){e!==this._state&&(this._state=e,this.options.stateChanged?.(e))}}const xf=(e,t)=>{if(!e.has(t))return{hit:!1};const i=e.get(t);return e.delete(t),e.set(t,i),{hit:!0,value:i}},Sf=(e,t,i,n)=>{for(e.delete(t),e.set(t,i);e.size>n;){const t=e.keys().next().value;if(void 0===t)break;e.delete(t)}},$f=new Set(["select","draw","column","merge","split","resize","opening","wallthick","delroom"]),Mf=e=>`${window.innerWidth}x${window.innerHeight}|${location.pathname}|${JSON.stringify(e??{})}`,Rf="houseplan_card_alpha_v1",Cf=Object.freeze([Object.freeze({id:"iso",issue:89,summary:"Volumetric plan renderer"})]);function Tf(e){return/^[a-z][a-z0-9-]*$/.test(e.id)&&Number.isInteger(e.issue)&&e.issue>0&&!!e.summary.trim()}function Df(e){const t=String(e||"").replace(/^#/,"");return new URLSearchParams(t)}function Af(e){return Df(e).get("space")||""}function Pf(e,t,i=Cf){const n=function(e){const t=new Set;for(const i of e){if(!Tf(i)||t.has(i.id))return!1;t.add(i.id)}return!0}(i),r=function(e){let t,i=!1;const n=e=>{for(const n of e.getAll("hp_alpha"))i=!0,"1"===n?t=!0:"0"===n&&(t=!1)};return n(new URLSearchParams(String(e.search||"").replace(/^\?/,""))),n(Df(e.hash)),{present:i,value:t}}(e),o=void 0!==r.value,s="1"===t,a=o?!0===r.value:!r.present&&s,l=n&&a;return{alpha:l,active:Object.freeze(l?i.map(e=>e.id).sort():[]),space:Af(e.hash),persist:n&&o?l?"1":"0":void 0,knownUrlOperation:o}}let Ff={alpha:!1,active:Object.freeze([]),space:""},zf=!1,If="";const Of=new Set;function Ef(){if("undefined"==typeof window)return Ff;const e=Pf(window.location,function(){try{return window.localStorage.getItem(Rf)}catch{return null}}());void 0!==e.persist&&function(e){try{window.localStorage.setItem(Rf,e)}catch{}}(e.persist),Ff={alpha:e.alpha,active:e.active,space:e.space},window.__hpAlpha=e.alpha,window.__hpLabs=e.active;for(const e of Of)e(Ff);return Ff}function Nf(){Ef()}function Hf(){if("undefined"==typeof window)return Ff;if(!zf){zf=!0,window.__hpLabsListenerCleanup?.(),window.addEventListener("hashchange",Nf),window.addEventListener("popstate",Nf);const e=()=>{window.removeEventListener("hashchange",Nf),window.removeEventListener("popstate",Nf),window.__hpLabsListenerCleanup===e&&delete window.__hpLabsListenerCleanup};window.__hpLabsListenerCleanup=e}return Ef()}const Lf={window:120,door:90,passage:90,gate:300};function Bf(e){return Lf[e]}function qf(e,t){return{type:e,lengthCm:Bf(e),flipH:!1,flipV:!1,revision:t}}function jf(e,t){const i=Math.max(0,e.renderedLength)/2,n=Math.max(0,e.target.physicalHalfWidth),r=n+.18*Math.max(0,t),o=e=>({x1:e,y1:-r,x2:e,y2:r});return{rect:{x:-i,y:n?-n:0,width:2*i,height:2*n},boundaries:[o(-i),o(i)]}}function Wf(e,t){const i=[e[0],e[1]],n=[t[0],t[1]];return function(e,t){return e[0]-t[0]||e[1]-t[1]}(i,n)<=0?{a:i,b:n}:{a:n,b:i}}function Uf(e){const t=new Map;return e.forEach((e,i)=>{if(!e.kind||e.open)return;const n=Wf(e.a,e.b);if(Math.hypot(n.b[0]-n.a[0],n.b[1]-n.a[1])<=1e-9)return;const r=function(e,t){const i=e=>(Math.abs(e)<=5e-10?0:Math.round(1e6*e)/1e6).toFixed(6);return`${i(e[0])},${i(e[1])}>${i(t[0])},${i(t[1])}`}(n.a,n.b),o=t.get(r);if(o)return o.physicalHalfWidth=Math.max(o.physicalHalfWidth,e.half||0),o.sourceOrder=Math.min(o.sourceOrder,i),void(e.partitionHost&&(o.partitionHost&&o.partitionHost.id!==e.partitionHost.id?o.ambiguousPartitionHost=!0:o.partitionHost=e.partitionHost));t.set(r,{segmentKey:r,a:n.a,b:n.b,physicalHalfWidth:Math.max(0,e.half||0),sourceOrder:i,...e.partitionHost?{partitionHost:e.partitionHost}:{}})}),[...t.values()]}function Gf(e,t){if(Math.abs(e.distance-t.distance)>1e-9)return e.distance-t.distance;if(Math.abs(e.perpendicular-t.perpendicular)>1e-9)return e.perpendicular-t.perpendicular;return(e.target.segmentKeyt.target.segmentKey?1:0)||e.target.sourceOrder-t.target.sourceOrder}function Vf(e){const t=Uf(e.intervals).map(t=>{const i=function(e,t){const i=t.b[0]-t.a[0],n=t.b[1]-t.a[1],r=Math.hypot(i,n),o=i/r,s=n/r,a=(e[0]-t.a[0])*o+(e[1]-t.a[1])*s,l=Math.max(0,Math.min(r,a)),c=t.a[0]+l*o,h=t.a[1]+l*s;return{along:l,length:r,x:c,y:h,distance:Math.hypot(e[0]-c,e[1]-h),perpendicular:Math.abs((e[0]-t.a[0])*s-(e[1]-t.a[1])*o)}}(e.pointer,t);return{target:t,...i,envelope:Math.max(e.baseTolerance,t.physicalHalfWidth+e.bodyPointerPadding)}}).filter(e=>e.distance<=e.envelope+1e-9).filter(t=>!function(e,t,i,n,r){const o=t.b[0]-t.a[0],s=t.b[1]-t.a[1],a=Math.hypot(o,s);if(!(a>1e-9))return!1;const l=o/a,c=s/a;for(const o of i){if(!o.open&&o.kind)continue;const i=Wf(o.a,o.b),s=i.b[0]-i.a[0],a=i.b[1]-i.a[1],h=Math.hypot(s,a);if(!(h>1e-9))continue;const d=s/h,u=a/h;if(Math.abs(l*u-c*d)>1e-6)continue;if(Math.abs((i.a[0]-t.a[0])*c-(i.a[1]-t.a[1])*l)>r)continue;const p=(e[0]-i.a[0])*d+(e[1]-i.a[1])*u,_=1e-9;if(!(p<=_||p>=h-_)&&Math.abs((e[0]-i.a[0])*u-(e[1]-i.a[1])*d)<=n+1e-9)return!0}return!1}(e.pointer,t.target,e.intervals,t.envelope,Math.max(1e-9,Math.min(e.baseTolerance,.04*e.gridStep)))),i=t.filter(t=>!!t.target.partitionHost&&e.renderedLength+2*t.target.physicalHalfWidth>t.length+1e-9).sort(Gf),n=t.filter(t=>!t.target.partitionHost||e.renderedLength+2*t.target.physicalHalfWidth<=t.length+1e-9).sort(Gf);let r=n[0];if(!r)return{candidate:null,jambBlockedTarget:i[0]?.target||null};const o=n.filter(e=>Math.abs(e.distance-r.distance)<=1e-9&&Math.abs(e.perpendicular-r.perpendicular)<=1e-9),s=o.filter(e=>e.target.partitionHost);if(s.length){if(1!==new Set(s.map(e=>e.target.partitionHost.id)).size||s.some(e=>e.target.ambiguousPartitionHost))return{candidate:null,jambBlockedTarget:null};const e=s[0],t=e.target.b[0]-e.target.a[0],i=e.target.b[1]-e.target.a[1],n=Math.hypot(t,i),a=t/n,l=i/n;if(!o.every(t=>{const i=t.target.b[0]-t.target.a[0],n=t.target.b[1]-t.target.a[1],r=Math.hypot(i,n),o=i/r,s=n/r,c=Math.abs(a*s-l*o)<=1e-6,h=Math.abs((t.target.a[0]-e.target.a[0])*l-(t.target.a[1]-e.target.a[1])*a);return c&&h<=1e-9}))return{candidate:null,jambBlockedTarget:null};r=e}if(r.target.ambiguousPartitionHost)return{candidate:null,jambBlockedTarget:null};const{target:a,length:l}=r,c=a.b[0]-a.a[0],h=a.b[1]-a.a[1],d=c/l,u=h/l,p=a.partitionHost?a.physicalHalfWidth:0,_=Math.min(Math.max(0,e.renderedLength)/2+p,l/2);let m=r.along;const g=Math.max(e.gridStep,1e-9),f=l/2;m=Math.abs(m-f)<=g/2?f:Math.round(m/g)*g,m=Math.max(_,Math.min(l-_,m));const v=a.a[0]+d*m,y=a.a[1]+u*m,b=Math.max(0,e.renderedLength)/2,w=m-b,k=m+b,x=Math.max(0,w),S=Math.max(0,l-k),$=[a.a[0]+d*(w-x/2),a.a[1]+u*(w-x/2)],M=[a.a[0]+d*(k+S/2),a.a[1]+u*(k+S/2)];let R=180*Math.atan2(h,c)/Math.PI;R>=90?R-=180:R<-90&&(R+=180);const C=Math.abs(m-f)<=1e-9;return{candidate:{presetRevision:e.preset.revision,geometryRevision:e.geometryRevision,pointer:[e.pointer[0],e.pointer[1]],type:e.preset.type,lengthCm:e.preset.lengthCm,flipH:e.preset.flipH,flipV:e.preset.flipV,x:v,y:y,angle:R,renderedLength:e.renderedLength,target:a,...a.partitionHost?{host:{...a.partitionHost,t:l>0?m/l:0}}:{},measure:{labels:[{distance:x,midpoint:$},{distance:S,midpoint:M}],guide:C?{x:v,y:y,angle:R}:null}},jambBlockedTarget:null}}function Kf(e,t,i,n,r=1e-6){return e.presetRevision===i&&e.geometryRevision===n&&Math.hypot(e.pointer[0]-t[0],e.pointer[1]-t[1])<=r}function Yf(e){return!(!e.canEdit||e.kiosk||e.fixedFloor)&&("view"!==e.mode&&("mouse"===e.pointerType&&e.spaceCount>1))}class Xf{constructor(e,t,i){this.loader=e,this.host=t,this.adopted=i,this.attachment=null}connect(){if(this.runtime)return void this.runtime.connect();this.attachment?.cancel();const e=this.loader.attach(this.host,e=>this.adopt(e));this.runtime||(this.attachment=e)}disconnect(){this.attachment?.cancel(),this.attachment=null,this.runtime?.disconnect()}adopt(e){this.attachment=null,this.runtime||(this.runtime=e,this.adopted(e))}}const Zf=new class{constructor(e){this.load=e,this.factory=null,this.pending=null}get warm(){return null!==this.factory}create(e){return this.factory?this.factory(e):null}attach(e,t){let i=!0;const n={cancel:()=>{i=!1}},r=this.create(e);return r?(t(r),n):(this.ensure().then(n=>{i&&t(n(e))},()=>{}),n)}ensure(){return this.factory?Promise.resolve(this.factory):(this.pending||(this.pending=this.load().then(e=>(this.factory=e,this.pending=null,e),e=>{throw this.pending=null,e})),this.pending)}reset(){this.factory=null,this.pending=null}}(()=>import("./summary-panel-runtime-loaded-DQykYOsg.js").then(function(e){return e.e}).then(({LoadedSummaryPanelRuntime:e})=>t=>new e(t)));function Jf(e){const t=globalThis.__HP_VERSION_OVERRIDE__;return"string"==typeof t&&t.length>0?t:e}let Qf=0;const ev="1.76.0-beta.2",tv="012abf4b3924ad03971870eb8085ab1ac1a66b0d9b6676fe095285a8b0f201ab",iv=1500,nv=new Map;let rv=0,ov=1e4;const sv="houseplan_card_layout_v1",av="houseplan_card_cfg_v1",lv="houseplan_card_zoom_v1",cv="houseplan_card_nav_v1",hv="houseplan_card_view_v1",dv="hp-dialog, hp-help, hp-color-opacity, hp-device-preview",uv=1e3,pv=(e,t)=>{const i=Math.min(e.x,t.x),n=Math.min(e.y,t.y);return{x:i,y:n,w:Math.max(e.x+e.w,t.x+t.w)-i,h:Math.max(e.y+e.h,t.y+t.h)-n}},_v=(e,t,i)=>{const n=new Event(t,{bubbles:!0,composed:!0});n.detail=i??{},e.dispatchEvent(n)},mv=e=>{history.pushState(null,"",e),_v(window,"location-changed",{replace:!1})},gv=(e,t)=>{let i,n=null;const r=(...r)=>{clearTimeout(i),n=r,i=window.setTimeout(()=>{i=void 0;const t=n;n=null,t&&e(...t)},t)};return r.flush=()=>{if(void 0===i)return;clearTimeout(i),i=void 0;const t=n;n=null,t&&e(...t)},r.cancel=()=>{clearTimeout(i),i=void 0,n=null},r.pending=()=>void 0!==i,r},fv=e=>{try{e.target?.setPointerCapture?.(e.pointerId)}catch{}},vv=["edges","corners"];class yv extends he{constructor(){var e;super(...arguments),this._editorRuntime=null,this._liveRt=null,this._onboardingRuntime=null,this._editorRuntimeLoadingVisible=!1,this._backdropGuard=null,this._editorModeRequest=0,this._warmModeRequest=0,this._editorRuntimeLoader=new kf({expectedFingerprint:tv,load:async e=>{const t=0===e?await import("./houseplan-editor-runtime-CJrrYe2p.js"):await import((()=>{const e=new URL("./houseplan-editor-runtime-CJrrYe2p.js",import.meta.url);return e.searchParams.set("hp_retry",`${ev}-${++Qf}`),e.href})());return{fingerprint:t.EDITOR_RUNTIME_FINGERPRINT,create:()=>new t.HouseplanEditorRuntime(this)}},install:e=>{this._editorRuntime=e},stateChanged:e=>this._editorRuntimeStateChanged(e),failed:(e,t)=>{console.error("[houseplan] unable to load editor runtime",e),t.terminal&&this._versionRecovery.hasCurrentMismatchNotice||this._showToast(bf(e=>this._t(e),t))}}),this._onboardingRuntimeLoader=new kf({expectedFingerprint:tv,load:async e=>{const t=0===e?await import("./houseplan-onboarding-runtime-B9DTOO67.js"):await import((()=>{const e=new URL("./houseplan-onboarding-runtime-B9DTOO67.js",import.meta.url);return e.searchParams.set("hp_retry",`${ev}-${++Qf}`),e.href})());return{fingerprint:t.ONBOARDING_RUNTIME_FINGERPRINT,create:()=>new t.HouseplanOnboardingRuntime(this)}},install:e=>{this._onboardingRuntime=e},failed:(e,t)=>{console.error("[houseplan] unable to load onboarding runtime",e),t.terminal&&this._versionRecovery.hasCurrentMismatchNotice||this._showToast(bf(e=>this._t(e),t))}}),this._isoSceneRuntime=null,this._isoSceneRuntimeLoader=new kf({expectedFingerprint:tv,load:async e=>{const t=0===e?await import("./iso-scene-render-Bgw9qRET.js"):await import((()=>{const e=new URL("./iso-scene-render-Bgw9qRET.js",import.meta.url);return e.searchParams.set("hp_retry",`${ev}-${++Qf}`),e.href})());return{fingerprint:t.ISO_SCENE_RUNTIME_FINGERPRINT,create:()=>t}},install:e=>{const t=this._effectiveProjection();this._isoSceneRuntime=e,this._isoProjectionSnapshot=null;const i=this._effectiveProjection();this._convertProjectionView(t,i),this.isConnected&&this.requestUpdate()},failed:(e,t)=>{console.warn("[houseplan] hidden isometric runtime diagnostic",yf("runtime-load","unverified",t.terminal)),this.isConnected&&this.requestUpdate()}}),this._pdfRuntime=null,this._pdfRuntimeLoader=new kf({expectedFingerprint:tv,load:async e=>{const t=0===e?await import("./pdf-export-BYCIg7JD.js"):await import((()=>{const e=new URL("./pdf-export-BYCIg7JD.js",import.meta.url);return e.searchParams.set("hp_retry",`${ev}-${++Qf}`),e.href})());return{fingerprint:t.PDF_EXPORT_FINGERPRINT,create:()=>new t.PdfExportRuntime}},install:e=>{this._pdfRuntime=e,this.isConnected&&this.requestUpdate()},failed:(e,t)=>{if(console.error("[houseplan] unable to load PDF export runtime",e),!t.terminal||!this._versionRecovery.hasCurrentMismatchNotice){const e=bf(e=>this._t(e),t),i=this._t("editor.load_failed"),n=e.startsWith(i)?e.slice(i.length).trim():e;this._showToast(`${this._t("pdf.failed")} ${n}`.trim())}}}),this.panelHost=!1,this.narrow=null,this._space="f1",this._adoption=new Lu((e,t)=>this.requestUpdate(e,t)),this._serverStorage=!1,this._loadOk=!1,this._serverCanWrite=null,this._loading=!1,this._loadTries=0,this._unsubCfg=null,this._unsubLayout=null,this._unsubVirtual=null,this._liveSyncAttempt=null,this._liveSyncGeneration=0,this._liveSyncConnection=null,this._configReloadAuthority=new Wu,this._virtualLights=Eh(null),this._canOptimizeUndo=!1,this._undoKind=null,this._devices=[],this._regSignature="",this._defPos={},this._newSyncKey="",this._areaRelocationIds=new Set,this._areaSnapshotCleanupCandidates=new Map,this._areaRelocationSyncKey="",this._areaRelocationWrite=Promise.resolve(),this._tip=null,this._hoverRoom=null,this._pointerModality=new rg(this,()=>this._syncPointerHoverTargets()),this._devicePressAnimations=new Map,this._selId=null,this._toast="",this._mode="view",this._pendingNavMode=null,this._decorTool="select",this._decorStyle={...xr},this._decorStyleSeeded=!1,this._decorDraft=null,this._decorMove=null,this._decorSel=null,this._decorEraseConfirm=null,this._decorTextDialog=null,this._decorShapeDialog=null,this._backdropDialog=null,this._decorTextSelection={start:0,end:0},this._furnPalette=null,this._decorImagePalette=null,this._decorAssetCatalog=[],this._decorAssets=new Map,this._decorAssetBusy=!1,this._furnCategory=null,this._furnPreviewInput=null,this._furnTouchPending=null,this._dtBox=null,this._dtDrag=null,this._bdDrag=null,this._slide="",this._reducedMotion=!1,this._onMotionChange=e=>{this._reducedMotion=e.matches,this._cancelDevicePressFeedback(),e.matches&&this._cancelCameraTransition(!0),e.matches&&this._modeTransitionPreparing?this._modeTransitionForceAtomic=!0:e.matches&&this._modeTransition.active&&this._cancelModeTransition(!0),this._syncVersionRecovery(),this.requestUpdate()},this._editorChromeMode="plan",this._modeTransitionVisual=null,this._modeTransitionPreparing=!1,this._modeTransitionForceAtomic=!1,this._modeTransitionRequest=0,this._modeTransitionTargetZoom=1,this._modeTransitionEditorCamera=null,this._modeTransition=new jg({frame:e=>this._applyModeTransitionFrame(e),settled:e=>this._settleModeTransition(e)}),this._cameraTransitionFit=null,this._cameraTransition=new Zg({frame:e=>this._applyCameraTransitionFrame(e),settled:e=>this._settleCameraTransition(e)}),this._editorSecondaryCopy={groupActive:(e,t)=>this._t("editor.group_active",{group:e,item:t}),openGroup:e=>this._t("editor.open_group",{group:e}),disabledAction:(e,t)=>this._t("editor.disabled_action",{action:e,reason:t})},this._tool="draw",this._geometryHistory=new _g(50),this._devicePositionHistory=new _g(50),this._devicePositionBusy=!1,this._wallDialog=null,this._drawWallField=null,this._activeWallChainId=null,this._activeWallChainPartitionIds=[],this._wallChainRedo=[],this._physicalSel=null,this._physicalDialog=null,this._partitionDeleteDialog=null,this._roomDeleteDialog=null,this._physicalDrag=null,this._physicalRotate=null,this._physicalLastTap=null,this._physicalPickCycle=null,this._wallUnionCacheValue=null,this._wallUnionPool=new Map,this._isoGeometryCache=new Map,this._renderIsoScene=null,this._isoProjectionSnapshot=null,this._isoStructuralBuildCount=0,this._isoFallback=new Set,this._openingTunnelCache=null,this._openingWallIndexCache=new Map,this._openingPlacementIntervalsCache=null,this._openingDimensionContextCache=null,this._planSnapGeometryCache=null,this._planStructuralGeometryCache=null,this._hiddenWallDiagnosticCache=null,this._physicalBodiesCache=null,this._lightPhysicalBodiesCache=null,this._cleanFloorCache=new Map,this._innerContourCache=new Map,this._glowRuntimeState=vm(),this._glowRuntimeHost={window:()=>this.ownerDocument.defaultView||window,isConnected:()=>this.isConnected,requestUpdate:()=>this.requestUpdate(),reducedMotion:()=>this._reducedMotion},this._lightBarrierCache=null,this._lightBarrierPool=new Map,this._glowScreenBlend=!1,this._duplicateColumnId=null,this._duplicateColumnTimer=0,this._rszLimitViolation=null,this._path=[],this._cursorPt=null,this._planSnapHover=null,this._mergeSel=null,this._openingPreset=null,this._openingRebindId=null,this._openingPresetRevision=0,this._openingHoverCandidate=null,this._openingJambBlockCm=null,this._openingDialog=null,this._openingInfo=null,this._opDrag=null,this._opMeasure=null,this._mergeDialog=null,this._splitSel=null,this._pendingSplit=null,this._wallFaceBatch=null,this._wallRepairDiagnostic=null,this._wallFaceGraphCache=[],this._areaSel="",this._nameSel="",this._roomDialog=!1,this._roomEditId=null,this._roomFill="",this._roomCustomFill=null,this._roomTempMin="",this._roomTempMax="",this._roomTempSrc="",this._roomHumSrc="",this._roomSrcOpen=null,this._roomSrcFilter="",this._roomNameScale=1,this._roomLabelScale=1,this._zoom=1,this._view=null,this._zoomBySpace={},this._viewModeSnap=null,this._roomFocus=null,this._roomPointer=null,this._doubleFit=new mf,this._deviceHits=new yc,this._pointers=new Map,this._panStart=null,this._panLock=null,this._pinchStart=null,this._suppressClick=!1,this._viewportGestureDirty=!1,this._touchContacts=new Map,this._touchClickGuard=new dc,this._connectedPath="",this._routeDepartureHandled=!1,this._onLocationChanged=()=>{this._connectedPath&&location.pathname!==this._connectedPath?this._leaveCardRoute():location.pathname===this._connectedPath&&(this._routeDepartureHandled=!1)},this._touchGestureGuard={capture:!0,handleEvent:e=>this._guardTouchGesture(e)},this._hdrH=118,this._booting=!0,this._bootFading=!1,this._bootSettling=!1,this._bootSettleRaf=0,this._bootLastH=-1,this._bootStart=0,this._bootLastChange=0,this._bootSoft=!1,this._tapConfirm=null,this._dangerConfirm=null,this._dangerConfirmController=new ze(e=>{this._dangerConfirm=e}),this._confirmDanger=e=>this._config&&this.hass?"warm"===this._syncDangerConfirmLocaleGate()||this._dangerConfirmMissingSpace()?Promise.resolve(!1):this._dangerConfirmController.confirm(e):Promise.resolve(!1),this._cancelDangerConfirm=()=>{this._dangerConfirmController.cancel()},this._onDangerConfirmDecision=e=>{this._dangerConfirmController.resolve(e.detail.token,e.detail.accepted)},this._onboardingShown=!1,this._rulesDialog=null,this._preflightClipboardFallback=null,this._haIntegrationVersion=null,this._versionRecovery=(e=this,new yg({clock:{setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)},storage:()=>e.ownerDocument.defaultView?.sessionStorage??null,safety:()=>kg(e),reload:()=>e._reloadDocument(),changed:()=>{e.requestUpdate()}})),this._haSupportApi=null,this._haDecorAssetsApi=null,this._haSummaryPanelApi=null,this._haRadarStage1Api=null,this._radarLive=new Tg(this),this._decorAssetSyncToken=0,this._alignDialog=null,this._settingsDialog=null,this._pdfDialog=!1,this._supportDialog=null,this._backupExportDialog=null,this._backupImportDialog=null,this._sunRaysCache=null,this._dayCycleTimer=0,this._dayCycleClockKey="",this._compassDrag=!1,this._importDialog=null,this._importQueue=[],this._importTotal=0,this._rulesCompiledSrc="",this._infoCard=null,this._nativeMoreInfoEntity=null,this._deviceInbox=null,this._deviceInboxReturn=null,this._deviceInboxMemo=null,this._markerDialog=null,this._spaceDialog=null,this._keyHandler=e=>this._onKey(e),this._warmVp=null,this._warmVpArmed=!1,this._warmLongReturn=!1,this._warmRevivePending=!1,this._warmGen=++rv,this._warmKey=null,this._warmSlot=null,this._hashApplied=!1,this._navApplied=!1,this._labs={alpha:!1,active:Object.freeze([]),space:""},this._viewPreference={},this._renderProjection="flat",this._kioskScale={icon:1,font:1},this._kioskDialog=!1,this._summarySlot=new Xf(Zf,this,e=>{this._summary=e,this._capturedSnapshotSequence=-1,this.isConnected&&(e.connect(),this.hasUpdated&&this.requestUpdate())}),this._activityRt=new Map,this._vacRt=new Map,this._vacViewKey="",this._vacLastView=null,this._vacRaf=0,this._vacSrvTrails={},this._vacJumpOnce=!1,this._continuity=this._newContinuityController(),this._continuityHistory=[],this._continuityEpoch=0,this._continuityDataReady=!0,this._continuityPaintToken=-1,this._continuityDisposed=!1,this._renderSnapshotAt=Date.now(),this._hassSequence=0,this._visibleDeviceSnapshot=null,this._candidateDeviceSnapshot=null,this._stagedDeviceSnapshotToken=-1,this._capturedSnapshotSequence=-1,this._capturedSnapshotDevices=null,this._capturedSnapshotLayout=null,this._capturedSnapshotActivity="",this._capturedSnapshotConfigEpoch=-1,this._capturedSnapshotVirtual="",this._lastValidStageSize=null,this._pendingRefitSize=null,this._refitRaf=0,this._pageVisibility=e=>{if(this._continuity.visibility(e),this._dayCycleVisibility(e),this._summary?.visibility(e.kind),"hidden"===e.kind)return this._radarLive.stop(),this._editorRuntime?._cancelRadarSetup(),this._clearRoomFocus(!0),this._clearTransientHover(!0),this._cancelDevicePressFeedback(),this._cancelCameraTransition(!0),void(this._modeTransitionPreparing?this._modeTransitionForceAtomic=!0:this._cancelModeTransition(!0));if(this._vacJumpOnce=!0,this._syncRadarLive(),!e.long){const e=Date.now();let t=!1;for(const i of this._activityRt.values())!i.flashKind||(i.expiresAt||i.flashTs+Qm)>e||(i.flashTs=0,i.flashKind=null,i.expiresAt=0,t=!0);return void(t&&this.requestUpdate())}Date.now()-this._renderSnapshotAt>1e3&&this._continuity.note("device-snapshot-stale"),this._continuityDataReady=!1,this._continuityPaintToken=-1,this._resumeSettling=!0,this._loading?this.requestUpdate():this._loadFromServer()},this._resumeSettling=!1,this._viewportInvalidAt=0,this._vacFit=null,this._vacAllCamerasFor=null,this._vacAllCameraCache=null,this._vacCalConfirm=null,this._kioskDots=!1,this._cyclePausedUntil=0,this._swipeStart=null,this._tabDrag=null,this._tabDragRelease=null,this._tabSuppressClick=!1,this._tabOrderWarned=!1,this._onLabsSnapshot=e=>{const t=this._effectiveProjection();this._labs=e,this._isoProjectionSnapshot=null,this._labsIso&&this._ensureIsoSceneRuntime();const i=this._effectiveProjection();this._convertProjectionView(t,i),this.requestUpdate()},this._onHashChange=()=>{if(this._hasFixedFloor)return;const e=this._hashSpace();if(e&&this._model.find(t=>t.id===e)&&e!==this._space){if(this._wallFaceBatch&&this._roomDialogCancel(),"plan"===this._mode&&"draw"===this._tool&&!this._finishWallChain())return;this._commitSpace(e),this._selId=null,this._path=[],this._clearPlanSnapHover(),this._clearOpeningPlacement(!0),this._tool="draw",this._activeWallChainId=null,this._activeWallChainPartitionIds=[],this._wallChainSegmentCms=[],this._closingWallCm=null,this._restoreZoom(),this.requestUpdate()}},this._drag=null,this._deviceDrag=null,this._rlResize=null,this._holdFired=!1,this._retryContinuity=()=>{this._continuityDataReady=!1,this._continuityPaintToken=-1,this._continuity.retry(this._continuity.recoveryReason||"plan"),this._loading||this._loadFromServer()},this._cfgEpoch=0,this._cfgEpochPreservedConfig=null,this._terminalFrame=0,this._modelCache=null,this._emptySpaceStateActive=!1,this._decorSnapCache=null,this._markerPreviewMemo=null,this._markerPreviewDevicesMemo=null,this._showHidden=!1,this._connHooked=null,this._connectionWasLost=!1,this._haRegistryConnection=null,this._haRegistryRev=-1,this._haBindingCacheKey="",this._planHassMemo=null,this._renderLife=new xg,this._liveEditorPaintCount=0,this._onHaRegistryUpdate=()=>{const e=td(this.hass);e.revision===this._haRegistryRev&&this._devices.length||(this._haRegistryRev=e.revision,this._renderLife.invalidate(),this._planHassMemo=null,this._regSignature="",this._maybeRebuildDevices(),this.requestUpdate())},this._onConnReady=()=>{if(this._loadTries=0,clearTimeout(this._loadRetryTimer),this._loadRetryTimer=void 0,ed(this.hass),this._saveConfigDebounced.pending()&&this._saveConfigDebounced.flush(),this._cfgWriting)return clearTimeout(this._reloadRetry),void(this._reloadRetry=window.setTimeout(this._onConnReady,400));!this._connectionWasLost&&this._continuity.hasCompleteFrame?this._beginContinuityCandidate("connection-ready",!1,"plan"):(this._continuityDataReady=!1,this._continuityPaintToken=-1),this._loading||this._loadFromServer()},this._onConnLost=()=>{this._booting&&!this._continuity.hasCompleteFrame||(this._connectionWasLost=!0,this._continuityDataReady=!1,this._continuityPaintToken=-1,this._continuity.connectionLost())},this._signer=new hc(()=>this.requestUpdate()),this._dirtyPos=new Set,this._sentPos=new Map,this._persistLayout=gv(()=>{if(this._serverStorage){const e=[...this._dirtyPos];this._dirtyPos.clear();for(const t of e){const e=vo(this._layout[t]);e&&(this._layout={...this._layout,[t]:e},this._sentPos.set(t,e),this.hass.callWS({type:"houseplan/layout/update",device_id:t,pos:e}).then(e=>this._noteLayoutRev(e)).catch(e=>this._showToast(this._t("toast.pos_save_failed",{err:this._errText(e)}))).finally(()=>{this._sentPos.get(t)===e&&this._sentPos.delete(t)}))}this._cacheSnapshot()}else this._persistLocalLayout()},600),this._frame=null,this._showFar=!1,this._writesPending=0,this._writeChain=Promise.resolve(),this._pendingPhysicalWrites=new Map,this._undoGeometry=()=>this._editorRuntimeOrThrow()._undoGeometry(),this._redoGeometry=()=>this._editorRuntimeOrThrow()._redoGeometry(),this._saveConfigDebounced=gv(()=>{this._serverCfg&&this._writeConfig().catch(e=>{const t=!0===e?.physicalGeometryRolledBack;"geometry-unsafe"!==e?.code&&("wall_model_client_outdated"===e?.code?this._showToast(this._t("toast.wall_model_client_outdated")):"conflict"===e?.code?(this._showToast(this._t("toast.conflict")),t||(this._cancelPath(),this._reloadConfigOnly(!0))):this._showToast(this._t("toast.cfg_save_failed",{err:this._errText(e)})),t&&this._reloadRejectedPhysicalWrite())})},500),this._wallChainSegmentCms=[],this._closingWallCm=null,this._savePhysicalDialog=()=>this._editorRuntimeOrThrow()._savePhysicalDialog(),this._deletePhysicalSelection=()=>this._editorRuntimeOrThrow()._deletePhysicalSelection(),this._confirmPartitionDelete=()=>this._editorRuntimeOrThrow()._confirmPartitionDelete(),this._confirmRoomDelete=e=>this._editorRuntimeOrThrow()._confirmRoomDelete(e),this._rebindPartitionOpening=()=>this._editorRuntimeOrThrow()._rebindPartitionOpening(),this._keepClosedAsPartitions=()=>this._editorRuntimeOrThrow()._keepClosedAsPartitions(),this._toggleServerPlans=async()=>this._onboardingRuntime&&this._spaceDialogUsesOnboardingRuntime("create")?this._onboardingRuntime._toggleServerPlans():this._editorRuntimeOrThrow()._toggleServerPlans(),this._aspectJob=null,this._dayCycleTick=()=>{if(!this.isConnected||"hidden"===this.ownerDocument.visibilityState)return;const e=this._dayCycleState();if(!e)return this._dayCycleTimer&&(clearInterval(this._dayCycleTimer),this._dayCycleTimer=0),void(this._dayCycleClockKey="");const t=ar(e);t!==this._dayCycleClockKey&&(this._dayCycleClockKey=t,this.requestUpdate())},this._sunShown=!1,this._sunOut=!1,this._sunOutTimer=0,this._openSettingsDialog=()=>{if(this._editorRuntime)return this._editorRuntime._openSettingsDialog();this._ensureEditorRuntime().then(e=>{e&&this._openSettingsDialog()})},this._openSupportDialog=()=>{this._editorRuntime?this._editorRuntime._openSupportDialog():this._ensureEditorRuntime().then(e=>{e&&this._openSupportDialog()})},this._openPdfDialog=()=>{this._pdfRuntimeLoader.ensure().then(e=>{e&&(this._pdfDialog=!0,this.requestUpdate())})},this._reportedPreflightFingerprint=null,this._openAlignDialog=()=>this._editorRuntimeOrThrow()._openAlignDialog(),this._toggleOptimizeLivePositions=()=>this._editorRuntimeOrThrow()._toggleOptimizeLivePositions(),this._optimizeUndoBusy=!1,this._openBackupExport=()=>this._editorRuntimeOrThrow()._openBackupExport(),this._openRulesDialog=()=>this._editorRuntimeOrThrow()._openRulesDialog(),this._climateCache=null,this._gearPtCache=new WeakMap}requestUpdate(e,t,i){if("hass"===e&&this.hass&&this._liveRt){const e=this._visibleDeviceSnapshot||this._candidateDeviceSnapshot;if(!this._liveRt.hass(t,this.hass,e?{entityIds:e.entityIds}:null,()=>Sg(this))&&!this._summary?.observeHassComposition())return}void 0!==e&&(this._terminalFrame=0),this._editorRuntime?._routeLiveEditorUpdate(e,t)||(this._liveRt?.clear(),super.requestUpdate(e,t,i))}_editorRuntimeOrThrow(){if(!this._editorRuntime)throw new Error("Houseplan editor runtime is not loaded");return this._editorRuntime}async _ensureEditorRuntime(){return this._editorRuntimeLoader.ensure()}async _ensureOnboardingRuntime(){return this._onboardingRuntimeLoader.ensure()}async _ensureIsoSceneRuntime(){return this._isoSceneRuntimeLoader.ensure()}_editorRuntimeStateChanged(e){clearTimeout(this._editorRuntimeLoadingTimer),this._editorRuntimeLoadingTimer=void 0,"loading"!==e?(this._editorRuntimeLoadingVisible=!1,this.requestUpdate()):this._editorRuntimeLoadingTimer=window.setTimeout(()=>{this._editorRuntimeLoadingVisible=!0,this.requestUpdate()},150)}async _requestMode(e,t=!0,i=!1){const n=++this._editorModeRequest;if(i&&(this._warmModeRequest=n,this._refitRaf&&(cancelAnimationFrame(this._refitRaf),this._refitRaf=0),this._pendingRefitSize=null),"view"===e||await this._ensureEditorRuntime()){if(n===this._editorModeRequest&&this.isConnected)return i?(this._adoptMode(e),this._warmRevivePending&&(clearTimeout(this._warmReviveTimer),this._warmReviveTimer=void 0,this._warmReviveDialog()),this.requestUpdate(),void this.updateComplete.then(()=>requestAnimationFrame(()=>requestAnimationFrame(()=>{if(this._warmModeRequest!==n||n!==this._editorModeRequest)return;const e=this._stageEl;this._lastValidStageSize=e&&e.clientWidth>0&&e.clientHeight>0?[e.clientWidth,e.clientHeight]:null,this._pendingRefitSize=null,this._warmModeRequest=0})))):void this._setMode(e,t);this._warmModeRequest===n&&(this._warmModeRequest=0)}else this._warmModeRequest===n&&(this._warmModeRequest=0)}get _layout(){return this._adoption.layout}set _layout(e){this._adoption.stageLocalLayout(e)}get _layoutRev(){return this._adoption.layoutRev}set _layoutRev(e){this._adoption.seedIdentity({layoutRev:e})}get _layoutContentFingerprint(){return this._adoption.layoutFingerprint}set _layoutContentFingerprint(e){this._adoption.seedIdentity({layoutFingerprint:e})}get _serverCfg(){return this._adoption.config}set _serverCfg(e){this._adoption.stageLocalConfig(e)}get _cfgRev(){return this._adoption.configRev}set _cfgRev(e){this._adoption.seedIdentity({configRev:e})}get _cfgContentFingerprint(){return this._adoption.configFingerprint}set _cfgContentFingerprint(e){this._adoption.seedIdentity({configFingerprint:e})}_seedDecorStyle(e){var t,i;if(t=Al,i=this,Cl(e,Nl)&&"pending"===t.state()&&(t.art("",i),t.ensure()),this._decorStyleSeeded||!e)return;this._decorStyleSeeded=!0;const n=e.settings?.decor_default_style;n&&(this._decorStyle=function(e,t){if(!e||"object"!=typeof e)return{...t};const i=e,n="string"==typeof i.color&&i.color?i.color:t.color,r="string"==typeof i.fill_color&&i.fill_color?i.fill_color:t.fillColor,o=Number(i.width_cm);return{color:n,opacity:Sr(i.opacity,t.opacity),widthCm:Number.isFinite(o)&&o>0?Math.max(.1,Math.min(100,o)):t.widthCm,fill:"boolean"==typeof i.fill?i.fill:t.fill,fillColor:r,fillOpacity:Sr(i.fill_opacity,t.fillOpacity)}}(n,xr))}get _canManageConfiguration(){return null!==this._serverCanWrite?this._serverCanWrite:!0===this.hass?.user?.is_admin}get _canEdit(){return this._norm&&this._canManageConfiguration}get _kiosk(){return!!this._config?.kiosk}_showKioskDots(){this._kioskDots=!0,clearTimeout(this._kioskDotsTimer),this._kioskDotsTimer=window.setTimeout(()=>this._kioskDots=!1,2500)}get _modeTransitionBusy(){return this._modeTransitionPreparing||this._modeTransition.active}get _doubleFitEnabled(){return!("view"!==this._mode||this._vacFit||this._modeTransitionBusy||this._touchSequenceMultitouch||"steady"!==this._continuity.state||this._continuity.overlayBlocksInteraction)}_cameraState(){const e=this._viewOr(this._baseVb());return{zoom:this._zoom,viewBox:{...e}}}_normalizeCameraState(e){const t=this._cameraTransitionFit||Oi(this._baseVb(),this._stageAspect());return{zoom:Math.min(yv.ZOOM_MAX,Math.max(yv.ZOOM_MIN,e.zoom)),viewBox:this._clampView({...e.viewBox},t)}}_applyCameraTransitionFrame(e){const t=this._normalizeCameraState(e.presented);e.presented=t,this._zoom=t.zoom,this._view={...t.viewBox},this._liveVp(!0)}_settleCameraTransition(e){const t=this._normalizeCameraState(e.to);this._zoom=t.zoom,this._view={...t.viewBox},this._cameraTransitionFit=null,"room"!==e.reason&&this._saveZoom(),this.requestUpdate()}_cancelCameraTransition(e=!1,t=!1){const i=this._cameraTransition.state?.reason,n=t&&this._cameraTransition.active?this._cameraTransition.presented?.zoom:void 0;this._cameraTransition.cancel(e),this._cameraTransitionFit=null,void 0!==n&&"room"!==i&&this._saveZoom()}_prepareCameraCommand(){this._bootSoftCancel(),this._modeTransitionBusy&&this._cancelModeTransition(!0),"opening"===this._tool&&(this._cursorPt=null,this._clearOpeningPlacement(!1))}_startCameraTransition(e,t,i,n){const r=this._cameraState(),o=this._cameraTransition.target;return(!o||!Kg(o,e))&&(Kg(r,e)?(this._cancelCameraTransition(!1),!1):(this._cameraTransitionFit={...t},this._cameraTransition.start(r,e,i,this._reducedMotion?0:n),!0))}_cssColor(e,t){const i=String(e||"").trim();if(!i)return t;const n=document.createElement("span");n.style.cssText=`position:absolute;visibility:hidden;color:${i}`,this.renderRoot.append(n);const r=getComputedStyle(n).color||t;return n.remove(),r}_currentModeVisual(e=this._mode){const t=this._modeTransition.presented||this._modeTransitionVisual;if(t)return{...t,viewport:{...t.viewport,viewBox:{...t.viewport.viewBox}}};const i=this._stageEl;if(!i||i.clientWidth<=0||i.clientHeight<=0)return null;const n=this.renderRoot.querySelector(".editorchrome"),r=this._viewOr(this._baseVb()),o=this.renderRoot.querySelector(".hp-paper"),s=this.renderRoot.querySelector(".hp-backdrop"),a=this.renderRoot.querySelector(".zoomwrap"),l=a?getComputedStyle(a).filter:"",c=Number(/brightness\(([^)]+)\)/.exec(l)?.[1]);return{presentedMode:e,editorChromeHeight:"view"===e?0:n?.getBoundingClientRect().height||0,stageWidth:i.clientWidth,stageHeight:i.clientHeight,viewport:Hg(r,i.clientWidth),stageColor:getComputedStyle(i).backgroundColor||"rgb(255, 255, 255)",paperColor:o?getComputedStyle(o).fill:"rgb(255, 255, 255)",sceneBrightness:Number.isFinite(c)?c:1,architectureOpacity:"decor"===e?.35:1,backdropOpacity:s&&Number(getComputedStyle(s).opacity)||1,viewWeight:"view"===e?1:0,editorWeight:"view"===e?0:1,toolbarContentOpacity:"view"===e?0:1}}_viewForModeTarget(e,t,i,n,r){const o=Oi(this._baseVb(),n/r),s=Math.min(yv.ZOOM_MAX,Math.max(yv.ZOOM_MIN,e)),a=o.w/s,l=o.h/s,c=t??o.x+o.w/2,h=i??o.y+o.h/2;return this._clampView({x:c-a/2,y:h-l/2,w:a,h:l},o)}_targetStageColor(e){return"view"!==e?"rgb(255, 255, 255)":this._cssColor(this._stageBg(this._spaceDisplayForRender()),this._cssColor("var(--ha-card-background, var(--card-background-color, #111))","rgb(17, 17, 17)"))}_targetPaperColor(e){return"view"===e&&this._spaceModel()?.bg?this._cssColor("var(--ha-card-background, var(--card-background-color, #111))","rgb(17, 17, 17)"):"rgb(255, 255, 255)"}_targetBrightness(e){return 1}_applyModeTransitionFrame(e){e.targetMode===this._mode&&(this._modeTransitionVisual=e.presented,this._view={...e.presented.viewport.viewBox},this.requestUpdate())}_settleModeTransition(e){if(e.targetMode!==this._mode)return;const t=this._modeTransitionRequest;this._view={...e.to.viewport.viewBox},this._zoom=this._modeTransitionTargetZoom,this._modeTransitionVisual=null,this._modeTransitionPreparing=!1,this._lastValidStageSize=[e.to.stageWidth,e.to.stageHeight],"view"===this._mode&&(this._saveZoom(),this._viewModeSnap=null,this._modeTransitionEditorCamera=null),this.requestUpdate(),this.updateComplete.then(()=>{if(!this.isConnected||t!==this._modeTransitionRequest||this._modeTransitionBusy||e.targetMode!==this._mode)return;const i=this._stageEl;if(i&&i.clientWidth>0&&i.clientHeight>0&&(Math.abs(i.clientWidth-e.to.stageWidth)>.5||Math.abs(i.clientHeight-e.to.stageHeight)>.5)){const e=this._view;this._lastValidStageSize=[i.clientWidth,i.clientHeight],this._applyView(this._zoom,e?e.x+e.w/2:void 0,e?e.y+e.h/2:void 0),this.requestUpdate()}const n=this.renderRoot.activeElement;(!n||!n.isConnected||!!n.closest?.(".editorchrome, .stage"))&&this.renderRoot.querySelector(".modetab.active")?.focus?.({preventScroll:!0})})}_cancelModeTransition(e=!0){this._cancelCameraTransition(!1);const t=!!this._modeTransition.state;this._modeTransitionRequest++,this._modeTransitionPreparing=!1,this._modeTransitionForceAtomic=!1,this._modeTransition.cancel(e),e&&t||(this._modeTransitionVisual=null)}_adoptMode(e){e!==this._mode&&(this._clearRoomFocus(!0),this._resetDeviceHitState()),this._cancelModeTransition(!1),this._mode=e,this._isoProjectionSnapshot=null,"view"!==e&&(this._editorChromeMode=e)}_commitViewModeAtomic(e,t,i,n){if(this._modeTransitionPreparing=!1,this._modeTransitionVisual=null,this._modeTransitionForceAtomic=!1,this._zoom=t,e){const r=this._stageEl?.clientWidth||e.stageWidth,o=Math.max(1,e.stageHeight+e.editorChromeHeight);this._view=this._viewForModeTarget(t,i,n,r,o),this._lastValidStageSize=[r,o]}else this._view=null;this._viewModeSnap=null,this._modeTransitionEditorCamera=null,this._saveZoom(),this.requestUpdate()}_prepareModeTransition(e,t,i,n,r,o){this.updateComplete.then(()=>{if(!this.isConnected||e!==this._modeTransitionRequest||this._mode!==i)return void(e===this._modeTransitionRequest&&(this._modeTransitionPreparing=!1,this._modeTransitionVisual=null,this._modeTransitionForceAtomic=!1,this.requestUpdate()));const s=this.renderRoot.querySelector(".editorchrome-inner"),a="view"===i?0:s?.scrollHeight||0,l=Math.max(1,(this.panelHost?this.clientHeight:innerHeight)-Jg(this.renderRoot,this._stageEl,this.panelHost)),c=this._stageEl?.clientWidth||t.stageWidth,h=this._viewForModeTarget(n,r,o,c,l),d={presentedMode:i,editorChromeHeight:a,stageWidth:c,stageHeight:l,viewport:Hg(h,c),stageColor:this._targetStageColor(i),paperColor:this._targetPaperColor(i),sceneBrightness:this._targetBrightness(i),architectureOpacity:"decor"===i?.35:1,backdropOpacity:"decor"===i&&"backdrop"!==this._decorTool?.5:1,viewWeight:"view"===i?1:0,editorWeight:"view"===i?0:1,toolbarContentOpacity:"view"===i?0:1};this._modeTransitionPreparing=!1;const u=this._modeTransitionForceAtomic;this._modeTransitionForceAtomic=!1,this._modeTransition.start(t,d,i,this._reducedMotion||u?0:220)})}get _hasFixedFloor(){return!!this._config&&Object.prototype.hasOwnProperty.call(this._config,"floor")}_fixedFloorState(e=this._model,t=this._loadOk){const i=this._config?.floor,n=function(e){if(!e.hasFloor)return{kind:"absent"};const t=e.floor;if("string"==typeof t)return t.length?e.spaceIds.includes(t)?{kind:"valid",id:t,source:"id"}:{kind:"invalid",reason:"unknown-id",value:t}:{kind:"invalid",reason:"empty-id",value:t};if("number"==typeof t){if(!Number.isFinite(t))return{kind:"invalid",reason:"non-finite-index",value:t};if(!Number.isInteger(t))return{kind:"invalid",reason:"fractional-index",value:t};if(t<0)return{kind:"invalid",reason:"negative-index",value:t};const i=e.spaceIds[t];return void 0===i?{kind:"invalid",reason:"out-of-range-index",value:t}:{kind:"valid",id:i,source:"index"}}return{kind:"invalid",reason:"invalid-type",value:t}}({spaceIds:e.map(e=>e.id),hasFloor:this._hasFixedFloor,floor:i});return!this._hasFixedFloor||t?n:"number"==typeof i?"valid"===n.kind||"invalid"===n.kind&&"out-of-range-index"===n.reason?{kind:"pending",value:i}:n:"valid"===n.kind||"invalid"===n.kind&&"unknown-id"!==n.reason?n:{kind:"pending",value:i}}_canCommitSpace(e,t=!1){if(t||!this._hasFixedFloor)return!0;const i=this._fixedFloorState();return"valid"===i.kind&&i.id===e}_commitSpace(e,t=!1){return!!this._canCommitSpace(e,t)&&(e!==this._space&&(this._clearRoomFocus(!0),this._resetDeviceHitState(),this._cancelDangerConfirm(),this._cancelCameraTransition(!1),this._clearTransientHover(!0),this._cancelDevicePressFeedback(),this._editorRuntime?._clearFurniturePreview()),this._space=e,this._isoProjectionSnapshot=null,!0)}_slideTo(e,t){if(e===this._space)return!0;if(!this._canCommitSpace(e))return!1;if(this._wallFaceBatch&&this._roomDialogCancel(),"plan"===this._mode&&"draw"===this._tool&&!this._finishWallChain())return!1;this._cancelModeTransition(!0);const i=window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches;return this._commitSpace(e),this._path=[],this._clearPlanSnapHover(),this._clearOpeningPlacement(!0),this._tool="draw",this._activeWallChainId=null,this._activeWallChainPartitionIds=[],this._wallChainSegmentCms=[],this._closingWallCm=null,this._selId=null,this._physicalSel=null,this._editorSecondary?.closeForNavigation(),this._physicalDialog=null,this._physicalDrag=null,this._restoreZoom(),i||(this._slide=t,clearTimeout(this._slideTimer),this._slideTimer=window.setTimeout(()=>{this._slideTimer=void 0,this._slide="",this.requestUpdate()},190),this.requestUpdate()),!0}get _canReorderTabs(){return Yf({canEdit:this._canEdit,kiosk:this._kiosk,mode:this._mode,pointerType:"mouse",spaceCount:this._model.length,fixedFloor:this._hasFixedFloor})}_tabPointerDown(e,t){Yf({canEdit:this._canEdit,kiosk:this._kiosk,mode:this._mode,pointerType:e.pointerType,spaceCount:this._model.length,fixedFloor:this._hasFixedFloor})&&(fv(e),this._tabDragRelease=e=>this._tabPointerUp(e),window.addEventListener("pointerup",this._tabDragRelease),window.addEventListener("pointercancel",this._tabDragRelease),this._tabDrag={id:t,pointerId:e.pointerId,x:e.clientX,y:e.clientY,moved:!1,targetId:null,placement:null})}_tabDropTargetAt(e,t,i){const n=this._model.map(e=>e.id),r=n.indexOf(i);if(r<0)return null;const o=this.renderRoot.querySelectorAll('[data-hp="space-tab"]');for(const s of o){const o=s.dataset.id||"";if(!o||o===i)continue;const a=s.getBoundingClientRect();if(ea.right||ta.bottom)continue;const l=n.indexOf(o);return l<0?null:{targetId:o,placement:l=4)))return;var i,n;const r=this._tabDropTargetAt(e.clientX,e.clientY,t.id);t.moved&&t.targetId===r?.targetId&&t.placement===r?.placement||(this._tabDrag={...t,moved:!0,targetId:r?.targetId||null,placement:r?.placement||null})}_tabPointerUp(e){const t=this._tabDrag;if(t&&t.pointerId!==e.pointerId)return;const i="pointerup"===e.type&&t?.moved?this._tabDropTargetAt(e.clientX,e.clientY,t.id):null;"pointerup"===e.type&&t?.moved&&this._suppressNextTabClick(),this._endTabDrag(),t?.moved&&i&&this._commitTabOrder(t.id,i.targetId)}_endTabDrag(){this._tabDrag=null,this._tabDragRelease&&(window.removeEventListener("pointerup",this._tabDragRelease),window.removeEventListener("pointercancel",this._tabDragRelease),this._tabDragRelease=null)}_tabClick(e){if(this._tabSuppressClick)return this._tabSuppressClick=!1,clearTimeout(this._tabSuppressClickTimer),void(this._tabSuppressClickTimer=void 0);this._pickSpace(e)}_suppressNextTabClick(){this._tabSuppressClick=!0,clearTimeout(this._tabSuppressClickTimer),this._tabSuppressClickTimer=window.setTimeout(()=>{this._tabSuppressClick=!1,this._tabSuppressClickTimer=void 0},0)}_commitTabOrder(e,t){const i=this._serverCfg;if(!i||!this._canReorderTabs)return;const n=this._model.map(e=>e.id),r=function(e,t,i){const n=e.indexOf(t),r=e.indexOf(i);if(n<0||r<0||n===r)return e;const o=e.slice();return o.splice(n,1),o.splice(r,0,t),o}(n,e,t);if(r===n)return;const o=new Map(this._devices.map(e=>[String(e.id),String(e.area||"")])),s=function(e,t,i,n=()=>""){if(!i)return[];const r=[];for(const o of e){if(!o||!0===o.removed)continue;const e="string"==typeof o.id?o.id:"";if(!e)continue;if("string"==typeof o.space&&o.space)continue;const s=("string"==typeof o.area?o.area:"")||n(e)||"";s&&t[s]||r.push({id:e,space:i})}return r}(i.markers||[],Object.fromEntries(Object.entries(this._areaToSpace).map(([e,t])=>[e,t.space])),n[0]||"",e=>o.get(e)||"");if(s.length){const e=new Map(s.map(e=>[e.id,e.space]));for(const t of i.markers||[]){const i=e.get(String(t.id));i&&(t.space=i)}}i.spaces=function(e,t){const i=new Map(t.map((e,t)=>[e,t]));return e.map((e,t)=>({space:e,index:t})).sort((e,t)=>(i.get(String(e.space?.id))??Number.MAX_SAFE_INTEGER)-(i.get(String(t.space?.id))??Number.MAX_SAFE_INTEGER)||e.index-t.index).map(e=>e.space)}(i.spaces||[],r),this._saveConfig(),this._tabOrderWarned||(this._tabOrderWarned=!0,this._showToast(this._t("toast.space_order_changed")))}_pickSpace(e){if(this._endTabDrag(),e===this._space)return;const t=this._model.map(e=>e.id),i=t.indexOf(this._space),n=t.indexOf(e);this._navApplied=!0,this._showFar=!1,this._frame=null,this._slideTo(e,i>=0&&n0&&Date.now()>=this._cyclePausedUntil&&this._model.length>1&&this._zoom<=1.001){const e=this._model.map(e=>e.id),t=e.indexOf(this._space);this._slideTo(e[(t+1)%e.length],"left"),this._showKioskDots()}}_syncCycleTimer(){clearInterval(this._cycleTimer),this._cycleTimer=void 0,this.isConnected&&!this._hasFixedFloor&&this._config?.kiosk&&Number(this._config.cycle)>0&&(this._cycleTimer=window.setInterval(()=>this._cycleTick(),1e3*Number(this._config.cycle)))}get _editing(){return"plan"===this._mode||"devices"===this._mode||"decor"===this._mode}get _markup(){return"plan"===this._mode}get _wallUnionCache(){return this._wallUnionCacheValue}set _wallUnionCache(e){this._wallUnionCacheValue=e,null===e&&this._wallUnionPool.clear()}get _glowClipCache(){return this._glowRuntimeState.clipCache}get _glowGeometryWarnings(){return this._glowRuntimeState.geometryWarnings}get _glowFeatherUnits(){return this._glowRuntimeState.featherUnits}set _glowFeatherUnits(e){this._glowRuntimeState.featherUnits=e}get _glowRenderedSources(){return this._glowRuntimeState.renderedSources}get _glowLastAppearance(){return this._glowRuntimeState.lastAppearance}get _glowFeatherSuspendUntil(){return this._glowRuntimeState.featherSuspendUntil}set _glowFeatherSuspendUntil(e){this._glowRuntimeState.featherSuspendUntil=e}get _glowFeatherResumeTimer(){return this._glowRuntimeState.featherResumeTimer}set _glowFeatherResumeTimer(e){this._glowRuntimeState.featherResumeTimer=e}get _glowSourceSeq(){return this._glowRuntimeState.sourceSeq}set _glowSourceSeq(e){this._glowRuntimeState.sourceSeq=e}get _touchSequenceMultitouch(){return this._touchClickGuard.sequenceMultitouch}_syncDangerConfirmLocaleGate(){return this._config&&this.hass?cp(this,_p,bp(this.hass,this._config.language)):"ready"}_dangerConfirmMissingSpace(){const e=this._model;if(!e.length)return!1;const t=this._fixedFloorState(e);return"pending"!==t.kind&&"invalid"!==t.kind&&!this._spaceModel()}_syncVersionRecovery(){this._versionRecovery.update({frontendVersion:Jf(ev),backendVersion:this._haIntegrationVersion,kiosk:!0===this._config?.kiosk,reducedMotion:this._reducedMotion})}_newContinuityController(){return new sc(()=>{this._resumeSettling="steady"!==this._continuity.state,this._continuityEpoch++,this.isConnected&&this.requestUpdate()})}get _labsIso(){return this._labs.active.includes("iso")}get _desiredProjection(){return"view"===this._mode&&this._labsIso&&"iso"===this._viewPreference[this._space]?"iso":"flat"}_saveViewPreference(){try{localStorage.setItem(hv,JSON.stringify(this._viewPreference))}catch{}}_logicalViewCenter(e){const t=this._view;if(!t)return null;const i=[t.x+t.w/2,t.y+t.h/2],n="iso"===e?af(i):i;return{x:n[0],y:n[1]}}_convertProjectionView(e,t){if(e===t)return;this._clearRoomFocus(!0);const i=this._logicalViewCenter(e);this._view=null;const n=i?"iso"===t?sf([i.x,i.y],0):[i.x,i.y]:null;this._applyView(this._zoom,n?.[0],n?.[1]),this._warmPatch({vp:this._warmViewportState()}),this.requestUpdate()}_setProjection(e){if(!this._labsIso||"view"!==this._mode)return;const t=this._effectiveProjection();if(this._viewPreference={...this._viewPreference,[this._space]:e},"iso"===e){this._ensureIsoSceneRuntime();const e=this._isoSceneKey();e&&this._isoFallback.delete(e),this._isoFallback.delete(`${this._space}|no-borders`),this._clearIsoInvalidFallback()}this._saveViewPreference(),this._isoProjectionSnapshot=null;const i=this._effectiveProjection();this._convertProjectionView(t,i)}_hashSpace(){return Af(window.location.hash||"")}connectedCallback(){this._connectedPath=location.pathname,this._routeDepartureHandled=!1,this._configReloadAuthority.observeContext(Uu(this)),window.addEventListener("location-changed",this._onLocationChanged),window.addEventListener("popstate",this._onLocationChanged),this._continuityDisposed&&(this._continuity=this._newContinuityController(),this._continuityDisposed=!1,this._continuityPaintToken=-1);const e=cg(this.ownerDocument);var t;void 0!==e&&(this._glowScreenBlend=e),this._continuityUnsub?.(),this._continuityUnsub=rc(this.ownerDocument,this._pageVisibility),this._languageFailureUnsub?.(),this._languageFailureUnsub=function(...e){return()=>{for(const t of e)t()}}((t=()=>{this._showToast(this._t("toast.locale_load_failed"))},pp.add(t),()=>pp.delete(t)),function(e){return Dl.add(e),()=>{Dl.delete(e)}}(()=>this._showToast(this._t("toast.furniture_art_load_failed")))),super.connectedCallback(),this._summarySlot.connect(),this._ensureLiveRuntime().catch(()=>this.requestUpdate()),this._pointerModality.connect(this.ownerDocument.defaultView);const i=this.ownerDocument.defaultView?.MutationObserver;i&&(this._pointerHoverObserver=new i(e=>{let t=!1;for(const i of e){for(const e of i.addedNodes)this._syncPointerHoverSubtree(e);const e=e=>{if(e.nodeType!==Node.ELEMENT_NODE)return!1;const t=e;return t.matches(".devlayer, .devlayer *")||!!t.querySelector?.(".devlayer")};(e(i.target)||[...i.addedNodes,...i.removedNodes].some(e))&&(t=!0)}t&&this._invalidateDeviceHitGeometry()}),this._pointerHoverObserver.observe(this.renderRoot,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","data-id"]})),this._motionMedia=window.matchMedia?.("(prefers-reduced-motion: reduce)"),this._reducedMotion=!!this._motionMedia?.matches,this._motionMedia?.addEventListener?.("change",this._onMotionChange),this._syncVersionRecovery(),this._versionRecovery.connect(),lg(this.ownerDocument).then(e=>{e!==this._glowScreenBlend&&(this._glowScreenBlend=e,this.isConnected&&this.requestUpdate())}),this.hass&&this._ensureHaRegistryAuthority(),window.addEventListener("keydown",this._keyHandler),this._signer.start(()=>this.hass,()=>this._referencedContentUrls()),this._syncCycleTimer(),window.addEventListener("hashchange",this._onHashChange),this._labsUnsub?.(),this._labsUnsub=function(e){Of.add(e);const t=Hf();return"undefined"==typeof window&&e(t),()=>{Of.delete(e)}}(this._onLabsSnapshot),this._labsIso&&this._ensureIsoSceneRuntime(),this._booting?this._bootWatch():this._bootFading&&(clearTimeout(this._bootTimer),this._bootTimer=window.setTimeout(()=>{this._bootFading=!1},220)),this._bootSoft&&(clearTimeout(this._bootSoftTimer),this._bootSoftTimer=window.setTimeout(()=>{this._bootSoft=!1},iv)),!this._loadOk&&this._serverCfg&&this.hass&&this._scheduleLoadRetry(),!this._warmSlot&&this._config&&this._warmAdopt(),this._loadOk&&this._ensureLiveSyncSubscriptions(),this._warmVp&&!this._warmRevivePending&&void 0===this._warmReviveTimer&&(this._warmRevivePending=!0,this._warmReviveTimer=window.setTimeout(()=>this._warmReviveDialog(),0)),this._warmLongReturn&&this._beginResumeSettle(),this._warmLongReturn=!1,this.requestUpdate()}disconnectedCallback(){this._versionRecovery.disconnect(),this._configReloadAuthority.invalidateLifecycle(),this._liveRt?.dispose(),this._radarLive.stop(),this._editorRuntime?._disposeLiveEditor(),this._clearRoomFocus(!0),this._cancelDangerConfirm(),this._connectedPath&&location.pathname!==this._connectedPath&&this._leaveCardRoute(),window.removeEventListener("location-changed",this._onLocationChanged),window.removeEventListener("popstate",this._onLocationChanged),this._continuityUnsub?.(),this._continuityUnsub=void 0,this._languageFailureUnsub?.(),this._languageFailureUnsub=void 0,this._motionMedia?.removeEventListener?.("change",this._onMotionChange),this._motionMedia=void 0,this._vacRaf&&(cancelAnimationFrame(this._vacRaf),this._vacRaf=0),this._refitRaf&&(cancelAnimationFrame(this._refitRaf),this._refitRaf=0),this._warmModeRequest=0,this._dayCycleTimer&&(clearInterval(this._dayCycleTimer),this._dayCycleTimer=0),this._summarySlot.disconnect(),this._dayCycleClockKey="",this._bootSettleRaf&&(cancelAnimationFrame(this._bootSettleRaf),this._bootSettleRaf=0),this._bootSettling=!1;for(const e of this._activityRt.values())clearTimeout(e.timer);window.removeEventListener("keydown",this._keyHandler),this._endTabDrag(),clearTimeout(this._tabSuppressClickTimer),this._tabSuppressClickTimer=void 0,this._tabSuppressClick=!1,clearInterval(this._cycleTimer),clearTimeout(this._kioskDotsTimer),clearTimeout(this._kioskHoldTimer),clearTimeout(this._reloadRetry),clearTimeout(this._loadRetryTimer),this._loadRetryTimer=void 0,this._connHooked?.removeEventListener?.("ready",this._onConnReady),this._connHooked?.removeEventListener?.("disconnected",this._onConnLost),this._connHooked?.removeEventListener?.("reconnect-error",this._onConnLost),this._connHooked=null,this._haRegistryRelease?.(),this._haRegistryRelease=void 0,this._haRegistryConnection=null,this._signer.dispose(),clearTimeout(this._toastTimer),clearTimeout(this._slideTimer),clearTimeout(this._editorRuntimeLoadingTimer),this._editorRuntimeLoadingTimer=void 0,this._editorRuntimeLoadingVisible=!1,this._modeTransition.dispose(),this._cameraTransition.dispose(),this._cameraTransitionFit=null,this._modeTransitionVisual=null,this._modeTransitionPreparing=!1,this._modeTransitionForceAtomic=!1,this._modeTransitionRequest++,this._slideTimer=void 0,this._slide="",clearTimeout(this._bootTimer),this._bootTimer=void 0,clearTimeout(this._bootSoftTimer),this._saveConfigDebounced.flush(),this._cancelDeviceDrag(),window.removeEventListener("hashchange",this._onHashChange),this._labsUnsub?.(),this._labsUnsub=void 0,clearTimeout(this._holdTimer),this._roViewport?.disconnect(),this._roViewport=void 0,this._roHdr?.disconnect(),this._roHdr=void 0,this._onWinResize&&(window.removeEventListener("resize",this._onWinResize),this._onWinResize=void 0),this._unsubCfg&&(this._unsubCfg(),this._unsubCfg=null),this._unsubLayout&&(this._unsubLayout(),this._unsubLayout=null),this._unsubVirtual&&(this._unsubVirtual(),this._unsubVirtual=null),this._unsubTrail&&(this._unsubTrail(),this._unsubTrail=void 0),this._liveSyncGeneration++,this._liveSyncAttempt=null,this._liveSyncConnection=null,clearTimeout(this._layoutSyncTimer),clearTimeout(this._duplicateColumnTimer),Am(this._glowRuntimeState,this._glowRuntimeHost),this._warmSnapshot(),this._warmRevivePending=!1,clearTimeout(this._warmReviveTimer),this._warmReviveTimer=void 0,this._warmRelease(),this._clearPlanSnapHover(),this._clearOpeningPlacement(!0),this._editorRuntime?._clearFurniturePreview(),this._editorRuntime?._furnShiftDetach(),this._touchContacts.clear(),this._touchClickGuard.reset(),this._resetDeviceHitState(),this._clearTransientHover(!0),this._cancelDevicePressFeedback(),this._pointerHoverObserver?.disconnect(),this._pointerHoverObserver=void 0,this._pointerModality.disconnect(),this._editorSecondary?.reset(),this._resumeSettling=!1,this._continuityHistory=[...this._continuityHistory,...this._continuity.trace].slice(-80),this._continuity.dispose(),this._continuityDisposed=!0,super.disconnectedCallback()}_onKey(e){if("Escape"===e.key&&this._vacFit){if(this._vacFit.busy)return;return this._vacFit=null,this._showToast(this._t("vac.cal_cancelled")),void e.stopPropagation()}if("Escape"===e.key){if(this._tapConfirm)return void(this._tapConfirm=null);if(this._vacCalConfirm)return void(this._vacCalConfirm.busy||(this._vacCalConfirm=null));if(this._decorEraseConfirm)return void(this._decorEraseConfirm=null);if(this._openingInfo)return void(this._openingInfo=null);if(this._infoCard)return void this._closeInfoCard();if(this._rulesDialog)return void(this._rulesDialog=null);if(this._alignDialog)return this._alignDialog=null,void(this._preflightClipboardFallback=null);if(this._backupImportDialog)return void(this._backupImportDialog=null);if(this._backupExportDialog)return void(this._backupExportDialog=null);if(this._pdfDialog)return void(this._pdfDialog=!1);if(this._supportDialog)return void this._editorRuntime?._closeSupportDialog();if(this._settingsDialog)return void(this._settingsDialog=null);if(this._summary?.closeDialogIfIdle())return;if(this._markerDialog)return void this._closeMarkerDialog();if(this._deviceInbox)return void(this._deviceInbox=null);if(this._openingDialog)return void(this._openingDialog=null);if(this._physicalDialog)return void(this._physicalDialog=null);if(this._backdropDialog)return void(this._backdropDialog=null);if(this._decorShapeDialog)return void(this._decorShapeDialog=null);if(this._decorTextDialog)return void(this._decorTextDialog=null);if(this._spaceDialog&&!this._roomDialog)return this._spaceDialog=null,this._importQueue=[],void(this._importTotal=0);if(this._editorSecondary?.hasOpenGroup)return e.preventDefault(),void this._editorSecondary?.closeGroup(!0)}const t=e.composedPath?.()||[e.target],i=t.some(e=>e?.matches?.('input, textarea, select, [contenteditable="true"]')),n=t.some(e=>e?.classList?.contains?.("editor-secondary")),r=e.ctrlKey||e.metaKey,o=e.key.toLowerCase(),s=/^[a-z]$/.test(o),a="z"===o||!s&&"KeyZ"===e.code,l="y"===o||!s&&"KeyY"===e.code,c=r&&(a&&e.shiftKey||l),h=r&&a&&!e.shiftKey;if("decor"===this._mode){if((h||c)&&i)return;if(c)return e.preventDefault(),void this._redoGeometry();if(h)return e.preventDefault(),this._decorDraft?void(this._decorDraft=null):this._decorMove||this._dtDrag||this._bdDrag?void this._cancelDecorGesture():void this._undoGeometry();if(("Delete"===e.key||"Backspace"===e.key)&&this._decorSel&&!i&&!n)return e.preventDefault(),void this._decorDeleteSel();const t="ArrowLeft"===e.key?[-this._gridPitch,0]:"ArrowRight"===e.key?[this._gridPitch,0]:"ArrowUp"===e.key?[0,-this._gridPitch]:"ArrowDown"===e.key?[0,this._gridPitch]:null;return!t||r||e.altKey||"select"!==this._decorTool||!this._decorSel||!this._decorList.some(e=>e.id===this._decorSel)||this._decorDraft||this._decorMove||this._dtDrag||this._bdDrag||i||n||this._editorSecondaryDialogBlocked?void("Escape"===e.key&&(e.preventDefault(),this._decorDraft?this._decorDraft=null:this._decorMove||this._dtDrag||this._bdDrag?this._cancelDecorGesture():"furniture"===this._decorTool?(this._editorRuntime?._clearFurniturePreview(),this._editorRuntime?._furnShiftDetach(),this._furnPalette=null,this._furnCategory=null,this._decorTool="select"):this._decorSel?this._decorSel=null:"select"!==this._decorTool?this._decorTool="select":this._setMode("view"))):(e.preventDefault(),void this._decorNudge(t[0],t[1]))}if("devices"===this._mode){if((h||c)&&i)return;return c?(e.preventDefault(),void this._redoDevicePosition()):h?(e.preventDefault(),void this._undoDevicePosition()):void("Escape"===e.key&&this._deviceDrag&&(e.preventDefault(),this._cancelDeviceDrag()))}if(this._markup&&(!h&&!c||!i)){if(("Delete"===e.key||"Backspace"===e.key)&&this._physicalSel&&!i&&!n)return e.preventDefault(),void this._deletePhysicalSelection();if(c)return e.preventDefault(),void this._redoGeometry();if(h)return e.preventDefault(),this._resize?.dragging?void this._rszCancelDrag():this._wallFaceBatch?(this._roomDialogCancel(),void(this._activeWallChainId&&this._path.length>1?this._undoActiveWallPoint():this._undoPoint())):"draw"===this._tool&&this._path.length?void(this._activeWallChainId&&this._path.length>1?this._undoActiveWallPoint():this._undoPoint()):"split"===this._tool&&this._splitSel?.pts?.length?(this._splitSel={...this._splitSel,pts:this._splitSel.pts.slice(0,-1)},void(this._splitSel.pts.length||(this._cursorPt=null))):void this._undoGeometry();if("Escape"===e.key)return this._physicalDrag||this._physicalRotate?(e.preventDefault(),void this._cancelPhysicalGesture()):this._roomDialog?(e.preventDefault(),void this._roomDialogCancel()):"draw"===this._tool&&this._path.length?(e.preventDefault(),void this._finishWallChain()):this._physicalSel?(e.preventDefault(),void(this._physicalSel=null)):"resize"===this._tool?(e.preventDefault(),this._resize?.dragging?void this._rszCancelDrag():("exit-tool"===this._resize?.escapeIdle()&&(this._tool="draw"),void this.requestUpdate())):"split"===this._tool?(e.preventDefault(),void(this._splitSel?.pts?.length?(this._splitSel={...this._splitSel,pts:this._splitSel.pts.slice(0,-1)},this._splitSel.pts.length||(this._cursorPt=null)):this._splitSel?this._splitSel=null:this._tool="draw")):"merge"===this._tool?(e.preventDefault(),void(this._mergeSel?this._mergeSel=null:this._tool="draw")):this._wallDialog?(e.preventDefault(),void(this._wallDialog=null)):void("opening"!==this._tool&&"wallthick"!==this._tool&&"delroom"!==this._tool&&"column"!==this._tool||(e.preventDefault(),"opening"===this._tool&&this._clearOpeningPlacement(!0),this._tool="draw"))}}_undoPoint(){if(this._path.length)return this._contourClosed?(this._path=this._path.slice(0,-1),void(this._closingWallCm=null)):void(this._activeWallChainPartitionIds.length&&this._path.length>1?this._undoActiveWallPoint():this._path=this._path.slice(0,-1))}_undoActiveWallPoint(){const e=[...this._activeWallChainPartitionIds],t=e[e.length-1],i=this._spaceModel()?.partitions.find(e=>e.id===t),n=this._path[0]?[...this._path[0]]:null,r=this._path.slice(0,-1).map(e=>[...e]),o=this._wallChainSegmentCms.slice(0,-1),s=this._geometryHistory.undo();if(!s)return this._activeWallChainPartitionIds=[],this._wallChainSegmentCms=[],this._wallChainRedo=[],void(this._path=n?[n]:[]);this._applyGeometryState(s.before,!0)?(this._activeWallChainId||=`chain-${Date.now().toString(36)}`,this._activeWallChainPartitionIds=e.slice(0,-1),this._path=r.length?r:n?[n]:[],this._wallChainSegmentCms=o,i&&this._wallChainRedo.push({id:i.id,point:[...i.b],cm:i.cm}),this._clearPlanSnapHover(),this._showToast(this._t("history.undone",{name:s.name}))):this._geometryHistory.clear()}static async getConfigElement(){return await import("./editor-CrFGSaM9.js"),document.createElement("houseplan-card-editor")}static getStubConfig(){return{type:"custom:houseplan-card"}}static _warmBootReset(e){for(const e of nv.values())for(const t of e)clearTimeout(t.evict);nv.clear(),ov=e&&e>0?e:1e4}static _warmBootStats(){let e=0,t=0;const i=[];for(const n of nv.values())for(const r of n)e++,r.dlg&&(t++,i.push(r.dlg.kind));return{keys:nv.size,slots:e,dlgs:t,drafts:i}}setConfig(e){const t=this._config,i=!!t&&Object.prototype.hasOwnProperty.call(t,"floor");this._config={icon_size:2.5,show_temperature:!0,live_states:!0,show_signal:!0,...e};(i!==this._hasFixedFloor||t?.floor!==this._config.floor)&&(this._hashApplied=!1,this._navApplied=!1,this._warmVpArmed=!1),this._config.kiosk&&(this._booting=!1,this._bootFading=!1),!this._hasFixedFloor&&e.default_floor&&this._commitSpace(e.default_floor,!0);try{this._zoomBySpace=JSON.parse(localStorage.getItem(lv)||"{}")||{}}catch{this._zoomBySpace={}}try{const e=JSON.parse(localStorage.getItem(hv)||"{}")||{};this._viewPreference=Object.fromEntries(Object.entries(e).filter(e=>"flat"===e[1]||"iso"===e[1]))}catch{this._viewPreference={}}if(this._labs=Hf(),this.isConnected&&this._labsIso&&this._ensureIsoSceneRuntime(),!this._summary?.applyLocalScaleForCurrentIdentity())try{const e=JSON.parse(localStorage.getItem("houseplan_card_kiosk_v1")||"null");this._kioskScale={icon:Bn(e?.icon),font:Bn(e?.font)}}catch{}try{const e=JSON.parse(localStorage.getItem(av)||"null");this._adoption.restoreCached(e)&&(this._seedDecorStyle(this._serverCfg),this._cfgEpoch++,this._virtualLights=Eh(e.virtual_lights,this._cfgRev),this._serverStorage=!0)}catch{}this._adoptInitialSpace(this._model,this._loadOk),"view"!==this._mode||this._view||(this._zoom=this._zoomBySpace[this._space]||1),this.isConnected&&(this._syncCycleTimer(),this._warmAdopt(),this._warmLongReturn&&this._beginResumeSettle(),this._warmLongReturn=!1),this._syncVersionRecovery()}_warmAdopt(){if(this._config?.kiosk)return;const e=Mf(this._config);if(this._warmKey===e&&this._warmSlot)return;this._warmSlot&&this._warmRelease();const t=this.parentNode,i=this._warmIdx(t),n=nv.get(e);if(!n||!n.length)return;const r=n.find(e=>e.owner===this._warmGen);if(r)return this._warmLongReturn=!!r.freed&&Date.now()-r.freed>=tc,clearTimeout(r.evict),r.evict=0,r.freed=0,r.live=!0,this._warmSlot=r,this._warmKey=e,r.frameFingerprint&&this._continuity.adoptCompleteFrame(r.frameFingerprint),void(!this._devices.length&&r.devices?.length&&(this._devices=[...r.devices]));const{slot:o,sure:s}=((e,t,i,n)=>{const r=e=>{const t=!!i&&e.place?.deref()===i;return t&&e.idx===n?4:e.live?0:t?3:2};let o=null,s=0,a=0,l=null;for(const i of e){if(i.owner===t)continue;l=i;const e=r(i);e<=0||(e>s?(o=i,s=e,a=1):e===s&&a++)}return!o||a>1?{slot:o||l,sure:!1}:{slot:o,sure:!0}})(n,this._warmGen,t,i);o&&(this._warmLongReturn=!!o.freed&&Date.now()-o.freed>=tc,this._booting=!1,this._bootFading=!1,this._hdrH=o.hdrH,this._bootSoft=!0,this.isConnected&&(clearTimeout(this._bootSoftTimer),this._bootSoftTimer=window.setTimeout(()=>{this._bootSoft=!1},iv)),this._warmKey=e,s?(clearTimeout(o.evict),o.evict=0,o.owner=this._warmGen,o.place=t?new WeakRef(t):null,o.idx=i,o.live=!0,this._warmSlot=o,this._warmVp=o.vp,o.frameFingerprint&&this._continuity.adoptCompleteFrame(o.frameFingerprint),!this._devices.length&&o.devices?.length&&(this._devices=[...o.devices]),this._warmAdoptViewport(this._config)):(this._warmSlot={owner:this._warmGen,path:location.pathname,place:t?new WeakRef(t):null,idx:i,live:!0,hdrH:o.hdrH,stageH:o.stageH,vp:null,frameFingerprint:"",devices:null,dlg:null,freed:0,evict:0},n.push(this._warmSlot),this._warmTrim(n)))}_warmIdx(e){const t=e?.children;if(!t)return-1;for(let e=0;e4;){const t=e.findIndex(e=>!e.live);if(t<0)break;clearTimeout(e[t].evict),e.splice(t,1)}}_warmScheduleEvict(e,t){if(clearTimeout(e.evict),!(e.dlg||e.vp&&"view"!==e.vp.mode))return;const i=e.freed,n=e.owner;e.evict=window.setTimeout(()=>{if(e.evict=0,e.freed!==i||e.owner!==n)return;var r;e.dlg=null,e.vp=(r=e.vp)&&"view"!==r.mode?{...r,mode:"view",zoom:r.snap?.space===r.space?r.snap.zoom:r.zoom,view:null,snap:null,tool:"draw",decorTool:"select",showHidden:!1,selId:null,rszSel:null,decorSel:null}:r,e.frameFingerprint="";const o=nv.get(t);if(!e.live&&o&&o.length>1){const t=o.indexOf(e);t>=0&&o.splice(t,1)}},ov+250)}_warmAdoptViewport(e){const t=this._warmVp;if(!t||this._warmSlot?.path!==location.pathname)return void(this._warmVp=null);const i=this._fixedFloorState();if(this._hashApplied||!this._model.find(e=>e.id===t.space)||"valid"===i.kind&&i.id!==t.space||this._hasFixedFloor&&"valid"!==i.kind)return void(this._warmVp=null);this._commitSpace(t.space,!0),this._navApplied=!0;const n="view"!==t.mode&&this._canEdit&&!e.kiosk?t.mode:"view";this._adoptMode("view"),this._pendingNavMode="view"===t.mode||this._canEdit||e.kiosk?null:t.mode,this._zoom=t.zoom;const r=this._effectiveProjection(),o=r===t.projection&&this._labsIso===t.activeLabsIso;if(this._view=o&&t.view?{...t.view}:null,this._viewModeSnap=o&&t.snap?{...t.snap}:null,!o&&t.logicalCenter){const e="iso"===r?sf([t.logicalCenter.x,t.logicalCenter.y],0):[t.logicalCenter.x,t.logicalCenter.y];this._applyView(t.zoom,e[0],e[1])}var s;this._tool="opening"===(s=function(e){return"partition"===e?"draw":e}(s=t.tool))?"draw":"string"==typeof s&&$f.has(s)?s:"draw",this._decorTool=t.decorTool,this._showHidden=t.showHidden,this._showFar!==t.showFar&&(this._showFar=t.showFar,this._frame=null),this._selId=t.selId,this._resize?.restoreSelection(t.rszSel),this._decorSel=t.decorSel,this._warmVpArmed=!0,"view"!==n&&this._requestMode(n,!1,!0)}_warmPatch(e,t=!1){if(this._config?.kiosk)return;const i=Mf(this._config);if(!this._warmSlot||this._warmKey===i){if(!this._warmSlot){if(!t)return;const e=this.parentNode;this._warmKey=i,this._warmSlot={owner:this._warmGen,path:location.pathname,place:e?new WeakRef(e):null,idx:this._warmIdx(e),live:!0,hdrH:this._hdrH,stageH:0,vp:null,frameFingerprint:"",devices:null,dlg:null,freed:0,evict:0};const n=nv.get(i)||[];for(n.push(this._warmSlot),nv.set(i,n),this._warmTrim(n);nv.size>8;){const e=nv.keys().next().value;if(void 0===e||e===i)break;for(const t of nv.get(e)||[])clearTimeout(t.evict);nv.delete(e)}}Object.assign(this._warmSlot,e)}}_warmViewportState(){const e=this._effectiveProjection();return{space:this._space,mode:this._mode,projection:e,activeLabsIso:this._labsIso,logicalCenter:this._logicalViewCenter(e),zoom:this._zoom,view:this._view?{...this._view}:null,snap:this._viewModeSnap?{...this._viewModeSnap}:null,tool:this._tool,decorTool:this._decorTool,showHidden:this._showHidden,showFar:this._showFar,selId:this._selId,rszSel:this._resize?.selectedRoomId,decorSel:this._decorSel}}_warmDialogState(){const e=(e,t)=>({kind:e,space:this._space,mode:this._mode,data:t});return this._tapConfirm||this._alignDialog||this._mergeDialog||this._importDialog||this._backupExportDialog||this._backupImportDialog?null:this._openingInfo?e("openingInfo",this._openingInfo.id):this._infoCard?e("info",this._infoCard.id):this._rulesDialog?this._rulesDialog.busy?null:e("rules",this._rulesDialog):this._settingsDialog?this._settingsDialog.busy?null:e("settings",this._settingsDialog):this._markerDialog?this._markerDialog.busy?null:e("marker",this._markerDialog):this._openingDialog?e("opening",this._openingDialog):this._backdropDialog?e("backdrop",this._backdropDialog):this._decorShapeDialog?e("decorShape",this._decorShapeDialog):this._decorTextDialog?e("decorText",this._decorTextDialog):this._roomDialog?e("room",{editId:this._roomEditId,fill:this._roomFill,customFill:this._roomCustomFill,tempMin:this._roomTempMin,tempMax:this._roomTempMax,tempSrc:this._roomTempSrc,humSrc:this._roomHumSrc,srcOpen:this._roomSrcOpen,srcFilter:this._roomSrcFilter,nameScale:this._roomNameScale,labelScale:this._roomLabelScale,areaSel:this._areaSel,nameSel:this._nameSel,pendingSplit:this._pendingSplit,wallFaceBatch:this._wallFaceBatch,path:this._path}):this._spaceDialog?this._spaceDialog.busy?null:e("space",this._spaceDialog):null}_warmSnapshot(){if(this._booting||this._config?.kiosk||"steady"!==this._continuity.state)return;const e={vp:this._warmViewportState(),frameFingerprint:this._continuity.frameFingerprint,devices:this._devices,hdrH:this._hdrH};if(this._warmRevivePending||(e.dlg=this._warmDialogState()),this.isConnected&&this._warmSlot?.owner===this._warmGen){const t=this.parentNode;e.place=t?new WeakRef(t):null,e.idx=this._warmIdx(t)}this._warmPatch(e)}_warmReviveDialog(){const e=this._warmSlot;if(this._warmReviveTimer=void 0,!e||!e.dlg)return void(this._warmRevivePending=!1);const t=e.dlg,i=e.freed;if(t.mode===this._mode||"view"===t.mode||this._warmVp?.mode!==t.mode||this._editorRuntime){if(this._warmRevivePending=!1,e.dlg=null,e.freed=0,clearTimeout(e.evict),e.evict=0,i&&!(Date.now()-i>ov)&&t.space===this._space&&t.mode===this._mode){switch(t.kind){case"space":this._spaceDialog={...t.data,busy:!1,savedBusy:!1};break;case"marker":this._markerDialog={...t.data,busy:!1};break;case"settings":this._settingsDialog={...t.data,busy:!1};break;case"rules":this._rulesDialog={...t.data,busy:!1};break;case"opening":this._openingDialog={...t.data};break;case"backdrop":this._backdropDialog={...t.data};break;case"decorShape":this._decorShapeDialog={...t.data};break;case"decorText":{this._decorTextDialog={...t.data};const e=String(this._decorTextDialog?.text??"").length;this._decorTextSelection={start:e,end:e};break}case"room":{const e=t.data;this._roomEditId=e.editId,this._roomFill=e.fill,this._roomCustomFill=e.customFill||null,this._roomTempMin=e.tempMin||"",this._roomTempMax=e.tempMax||"",this._roomTempSrc=e.tempSrc,this._roomHumSrc=e.humSrc,this._roomSrcOpen=e.srcOpen,this._roomSrcFilter=e.srcFilter,this._roomNameScale=e.nameScale,this._roomLabelScale=e.labelScale,this._areaSel=e.areaSel,this._nameSel=e.nameSel,this._pendingSplit=e.pendingSplit,this._wallFaceBatch=e.wallFaceBatch||null,this._path=e.path,this._wallFaceBatch&&(this._activeWallChainId=`chain-${Date.now().toString(36)}`,this._activeWallChainPartitionIds=[...this._wallFaceBatch.activePartitionIds],this._wallChainSegmentCms=[...this._wallFaceBatch.activeCms]),this._roomDialog=!0;break}case"info":{const e=this._devices.find(e=>e.id===t.data);e&&(this._infoCard=e);break}case"openingInfo":{const e=(this._curSpaceCfg?.openings||[]).find(e=>e.id===t.data);e&&(this._openingInfo=e);break}}this.requestUpdate()}}else this._warmRevivePending=!0}_cacheSnapshot(){if(this._serverCfg)try{this._virtualLights=function(e,t,i){if(e.configRev===i)return e;const n=new Set((Array.isArray(t?.markers)?t.markers:[]).filter(Lh).map(e=>e.id));return{...e,configRev:i,off:new Set([...e.off].filter(e=>n.has(e)))}}(this._virtualLights,this._serverCfg,this._cfgRev);const e=this._adoption.snapshot(function(e){return{rev:e.rev,config_rev:e.configRev,off:[...e.off].sort()}}(this._virtualLights));e&&localStorage.setItem(av,JSON.stringify(e))}catch{}}_beginContinuityCandidate(e,t,i="plan"){return this._booting&&!this._continuity.hasCompleteFrame?this._continuity.token:(this._continuityDataReady=t,this._continuityPaintToken=-1,this._stagedDeviceSnapshotToken=-1,this._resumeSettling=!0,this._continuity.beginCandidate(e,i))}_continuityStageValid(){const e=this._stageEl;return!!e&&e.clientWidth>0&&e.clientHeight>0}_versionReloadSafetySnapshot(){return kg(this)}_continuityAssetsReady(){if(!this._model.length)return!1;const e=this._model.length?this._spaceModel():null;return!e?.bg?.href||this._signer.isReady(this.hass,e.bg.href)}_initialSpaceSelection(e,t=this._loadOk){const i=this._fixedFloorState(e,t);return"valid"===i.kind?{id:i.id,source:"fixed"}:this._hasFixedFloor?{id:null,source:"none"}:function(e){const t=new Set(e.spaceIds.filter(e=>!!e));if(!t.size)return{id:null,source:"none"};const i=[["hash",!1===e.acceptHash?null:e.hashSpace],["current",e.preserveCurrent?e.currentSpace:null],["saved",e.savedSpace],["default",e.defaultSpace],["first",e.spaceIds[0]]];for(const[e,n]of i)if(n&&t.has(n))return{id:n,source:e};return{id:null,source:"none"}}({spaceIds:e.map(e=>e.id),hashSpace:this._hashSpace(),acceptHash:!this._hashApplied,currentSpace:this._space,preserveCurrent:this._hashApplied||this._navApplied||this._warmVpArmed,savedSpace:this._savedNav()?.space,defaultSpace:this._config?.default_floor})}_adoptInitialSpace(e,t=this._loadOk){const i=this._initialSpaceSelection(e,t);return i.id?(this._commitSpace(i.id,!0),"hash"===i.source&&(this._hashApplied=!0),"saved"===i.source&&(this._navApplied=!0),i):i}_candidateBackdrop(e,t=this._space){const i=Ya(e),n=this._fixedFloorState(i,!0);if(this._hasFixedFloor&&"valid"!==n.kind)return"";const r=this._initialSpaceSelection(i,!0).id||(i.some(e=>e.id===t)?t:i[0]?.id);return i.find(e=>e.id===r)?.bg?.href||""}_visualFrameFingerprint(){const e=this._stageEl,t=e?[e.clientWidth,e.clientHeight]:[0,0];return lc([this._cfgRev,this._adoption.currentConfigFingerprint(),this._layoutRev,this._adoption.currentLayoutFingerprint(),this._space,this._mode,this._view,t,this._glowScreenBlend?"screen":"normal",this.hass?.themes?.darkMode??this.hass?.themes?.default_theme??""])}_settleContinuityFrame(){if(this._booting||!this._continuityStageValid())return;if(!this._continuity.hasCompleteFrame&&"steady"===this._continuity.state)return void(this._continuityAssetsReady()&&(this._renderSnapshotAt=Date.now(),this._continuity.markCompleteFrame(this._visualFrameFingerprint())));if(!this._continuityDataReady)return;if(!["holding","offline-stale","overlay-pending","overlay-visible","candidate-ready"].includes(this._continuity.state))return;const e=this._continuity.token;if(this._candidateDeviceSnapshot&&this._candidateDeviceSnapshot!==this._visibleDeviceSnapshot&&this._stagedDeviceSnapshotToken!==e)return this._stagedDeviceSnapshotToken=e,void this.requestUpdate();this._continuityPaintToken!==e&&(this._continuityPaintToken=e,this._continuity.candidateReady(e)&&this._continuity.commitAfterPaint(e,{updateComplete:()=>this.updateComplete,stageValid:()=>this.isConnected&&this._continuityStageValid(),assetsReady:()=>this._continuityAssetsReady(),frameFingerprint:()=>this._visualFrameFingerprint()}).then(t=>{t&&e===this._continuity.token?(this._resumeSettling=!1,this._renderSnapshotAt=Date.now(),this._candidateDeviceSnapshot&&(this._visibleDeviceSnapshot=this._candidateDeviceSnapshot),this._candidateDeviceSnapshot=null,this._stagedDeviceSnapshotToken=-1,this._warmSnapshot()):e===this._continuity.token&&(this._continuityPaintToken=-1,this._stagedDeviceSnapshotToken=-1,this._candidateDeviceSnapshot=null,this.requestUpdate())}))}_onBackdropLoaded(e,t){this._signer.markLoaded(this.hass,e,t),this._continuity.note("asset-ready"),this._continuityPaintToken=-1,"steady"!==this._continuity.state&&this.requestUpdate()}_renderRecoveryOverlay(){if(!this._continuity.overlayVisible&&"recovery-error"!==this._continuity.state)return G;const e="connection"===this._continuity.recoveryReason;return j`
    e.stopPropagation()} @click=${e=>e.stopPropagation()} @@ -356,7 +356,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae aria-label=${this._t("editor.loading_aria")}> ${this._t("editor.loading")} -
    `:G}houseplanContinuityTrace(){return[...this._continuityHistory,...this._continuity.trace].slice(-80).map(e=>({...e,...e.stage?{stage:[...e.stage]}:{}}))}getCardSize(){return 12}getGridOptions(){return{columns:"full"}}get _norm(){return!(!this._serverCfg||!this._serverCfg.spaces.length)}_cfgFingerprint(){const e=this._serverCfg?.spaces||[];let t=e.length+":";for(const i of e){t+=(i.id||"")+","+(i.plan_aspect||"")+","+(i.plan_url||"").length+","+(i.plan_x??"")+","+(i.plan_y??"")+","+(i.plan_scale??"")+","+(i.plan_scale_x??"")+","+(i.plan_scale_y??"")+","+(i.plan_angle??"")+","+(i.rooms?.length||0)+","+(i.openings?.length||0)+","+(i.decor?.length||0)+";";for(const e of i.rooms||[]){const i=e.poly?.[0],n=e.poly?.[e.poly.length-1];t+=(e.poly?.length||0)+"."+(e.id||"")+"."+(e.open_to||[]).join("+")+"."+(e.area||"")+"."+JSON.stringify(e.settings||0)+"."+(e.x??"")+","+(e.y??"")+","+(e.w??"")+","+(e.h??"")+","+(i?i[0]+"/"+i[1]:"")+","+(n?n[0]+"/"+n[1]:"")+";"}}return t}get _model(){if(!this._serverCfg)return[];const e=this._cfgEpoch+"|"+this._cfgFingerprint();if(this._modelCache&&this._modelCache.key===e)return this._modelCache.model;const t=this._buildModel();return this._modelCache={key:e,model:t},t}_buildModel(){if(!this._serverCfg)return[];const e=this._renderCfg;return Ya(e).map((t,i)=>{const n=e.spaces[i]?.plan_url;return t.bg&&n?{...t,bg:{...t.bg,href:n}}:t})}_spaceModel(){return this._hasFixedFloor?bc(this._model,this._space):(e=this._model,t=this._space,e.find(e=>e.id===t)??e[0]);var e,t}_spaceModelById(e){return bc(this._model,e)}_syncEmptySpaceState(){if(!!this._serverCfg&&0===this._serverCfg.spaces.length){if(!this._emptySpaceStateActive){this._emptySpaceStateActive=!0,this._clearRoomFocus(!0);for(const e of this._pointers.keys())for(const t of this.renderRoot.querySelectorAll("*"))try{t.hasPointerCapture?.(e)&&t.releasePointerCapture(e)}catch{}this._pointers.clear(),this._panStart=null,this._panLock=null,this._pinchStart=null,this._swipeStart=null,this._drag=null,this._deviceDrag=null,this._resetDeviceHitState(),this._rlResize=null,this._vacFit=null,this._compassDrag=!1,this._cancelModeTransition(!1),this._mode="view",this._clearGeometryGesture(),this._geometryHistory.clear(),this._devicePositionHistory.clear(),this._tip=null,this._hoverRoom=null,this._openingInfo=null,this._closeInfoCard(),this._deviceInbox=null,this._deviceInboxReturn=null,this._markerDialog=null,this._physicalDialog=null,this._backdropDialog=null,this._decorShapeDialog=null,this._decorTextDialog=null,this._roomDialog=!1,"edit"===this._spaceDialog?.mode&&(this._spaceDialog=null),this._editorSecondary?.closeForNavigation(),this._saveConfigDebounced.cancel(),this._frame=null,this._planSnapGeometryCache=null,this._hiddenWallDiagnosticCache=null,this._decorSnapCache=null,this._commitSpace("",!0)}}else this._emptySpaceStateActive=!1}get _areaToSpace(){const e={};for(const t of this._model)for(const i of t.rooms)i.area&&(e[i.area]={space:t.id,room:i});return e}get _settings(){return this._serverCfg?.settings||{}}get _showAll(){return this._showHidden||!this._settings.filter_seeded&&!!this._settings.show_all}_seedHiddenDevices(){if(!(this._loadOk&&this._serverCfg&&this._norm&&this._canEdit))return;const e=this._serverCfg,t=Jd({hass:this.hass,registry:this._haRegistry,areaToSpace:Object.fromEntries(Object.entries(this._areaToSpace).map(([e,t])=>[e,t.space])),markers:this._markers,settings:this._settings,excluded:this._excluded,firstSpaceId:this._model[0]?.id||"",iconRules:this._iconRules});if(!t.length&&e.settings?.filter_seeded)return;e.markers=e.markers||[];const i=[];for(const n of t){const t="h"+n.slice(n.indexOf(":")+1);e.markers.push({id:t,binding:n,hidden:!0}),i.push(n.slice(n.indexOf(":")+1))}const n={...e.settings||{},filter_seeded:!0};delete n.show_all,i.length&&Array.isArray(n.new_device_ids)&&(n.new_device_ids=n.new_device_ids.filter(e=>!i.includes(e))),e.settings=n,this._regSignature="",this._maybeRebuildDevices(),this._saveConfig(),this.requestUpdate()}get _iconRules(){const e=this._settings.icon_rules;if(!e||!Array.isArray(e)||!e.length)return;const t=JSON.stringify(e);return t!==this._rulesCompiledSrc&&(this._rulesCompiledSrc=t,this._rulesCompiled=Ee(e)),this._rulesCompiled}get _fillColors(){return gn(this._settings)}get _excluded(){return su(this._settings)}_setAreaLifecycleConfig(e){this._cfgEpochPreservedConfig=e,this._serverCfg=e}willUpdate(e){if(this._isoProjectionSnapshot=null,this._summary?.willUpdate(),e.has("hass")&&this._configReloadAuthority.observeContext(Uu(this)),e.has("_serverCfg")){const e=this._cfgEpochPreservedConfig===this._serverCfg;this._cfgEpochPreservedConfig=null,e||this._cfgEpoch++,this._renderLife.invalidate()}if(this._syncEmptySpaceState(),this._dangerConfirm&&(this._dangerConfirmMissingSpace()||"warm"===this._syncDangerConfirmLocaleGate())&&this._cancelDangerConfirm(),e.has("hass")&&this.hass){const t=this._visibleDeviceSnapshot||this._candidateDeviceSnapshot;this._renderLife.observe(e.get("hass"),this.hass,t?{entityIds:t.entityIds}:null,()=>Sg(this))}this._continuity.hasCompleteFrame&&"steady"===this._continuity.state&&this._continuity.refreshCompleteFrame(this._visualFrameFingerprint()),this._captureRenderDeviceSnapshot()}updated(){this._summary?.updated(),this._liveRt?.commit(),this._editorRuntime?._commitLiveEditor(),this._pruneDevicePressFeedback(),this._syncDayCycleClock(),this._syncRadarLive(),this._warmSnapshot(),this._editorRuntime&&this._dtMeasure();const e=this._stageEl;e&&!this._roViewport&&(this._roViewport=new ResizeObserver(()=>{this._invalidateDeviceHitGeometry(),this._refitView(),requestAnimationFrame(()=>this._summary?.resized())}),this._roViewport.observe(e)),e&&this._booting&&!this._bootTimer&&this._bootWatch();const t=this.renderRoot.querySelector(".hdr");if(t&&e&&!this._roHdr){const i=()=>{const t=Jg(this.renderRoot,e,this.panelHost);null!==t&&(t>=0&&t!==this._hdrH&&(this._hdrH=t),t>=0&&!this._booting&&!this._config?.kiosk&&e.clientHeight>0&&this._warmPatch({hdrH:t,stageH:e.clientHeight}))};this._roHdr=new ResizeObserver(()=>requestAnimationFrame(i)),this._roHdr.observe(t),this._onWinResize=()=>requestAnimationFrame(i),window.addEventListener("resize",this._onWinResize),i()}if(e&&!this._view&&this._refitView(),this._editorSecondary?.afterRender(),this._settleContinuityFrame(),this._serverStorage&&this._loadOk&&this._canManageConfiguration&&0===this._model.length&&!this._spaceDialog&&!this._importDialog&&!this._onboardingShown){this._onboardingShown=!0;const e=function(e){const t=e?.floors;if(!t||"object"!=typeof t)return[];const i=[];for(const e of Object.values(t))e&&e.floor_id&&i.push({id:e.floor_id,name:e.name||e.floor_id,level:e.level??null});return i.sort((e,t)=>{const i=e.level??1e9,n=t.level??1e9;return i!==n?i-n:e.name.localeCompare(t.name)}),i}(this.hass);e.length?this._importDialog={floors:e.map(e=>({...e,checked:!0}))}:this._openSpaceDialog("create")}}_adoptConfigCapabilities(e){wg(this,e)}_syncRadarLive(){const e=this._serverCfg?.settings?.radar,t=(this._serverCfg?.markers||[]).some(e=>Mg(e,this._space));this._radarLive.sync(this._space,1===this._haRadarStage1Api&&"view"===this._mode&&!1!==e?.show_live&&t&&"hidden"!==this.ownerDocument.visibilityState)}async _syncDecorAssets(e){const t=++this._decorAssetSyncToken;if(1!==this._haDecorAssetsApi||!this.hass)return void(this._decorAssets=new Map);const i=await hm(this.hass,am(e),this._cfgRev);t===this._decorAssetSyncToken&&(this._decorAssets=i,this._resign(),this.requestUpdate())}_adoptAuthoritative(e){return Bu(this,e)}_rollbackOptimistic(e){const t=this._adoption.rollbackOptimistic(e);return t&&this.requestUpdate(),t}_resumePendingNavMode(){if(!this._pendingNavMode||!this._canEdit||this._config?.kiosk)return!1;const e=this._pendingNavMode;return this._pendingNavMode=null,this._setMode(e,!1),!0}_getAuthoritativeConfig(){return e=this,async function(e,t){const i=await e();return t(i),i}(()=>e.hass.callWS({type:"houseplan/config/get"}),t=>wg(e,t));var e}async _loadFromServer(){this._loading=!0,this._loadTries++;const e=this._space,t=!!this._view;let i=!1;const n=()=>{i=!0,this._regSignature="",this._maybeRebuildDevices()};try{const[i,r]=await Promise.all([this._getAuthoritativeConfig(),this.hass.callWS({type:"houseplan/layout/get"})]);if("adopted"!==(await this._adoptAuthoritative({cfgResp:i,layResp:r,reason:"structural-response",profile:"reload",beforeAdopt:()=>{this._connectionWasLost=!1,this._serverStorage=!0},afterAdopt:()=>{this._warmVpArmed&&this._space===this._warmVp?.space?this._warmVpArmed=!1:t&&this._space===e||this._restoreZoom(),this._loadOk=!0,n()}})).status)return;this.hass.callWS({type:"houseplan/trail/get"}).then(e=>{this._vacSrvTrails=e?.trails||{},this.requestUpdate()}).catch(()=>{}),this._ensureLiveSyncSubscriptions()}catch(e){if(this._serverCfg)this._scheduleLoadRetry(!0);else if(this._loadTries>=8){this._serverStorage=!1;try{this._layout=JSON.parse(localStorage.getItem(sv)||"{}")||{}}catch{this._layout={}}}}finally{this._loading=!1,this._continuityDataReady=!0,i||n(),this.requestUpdate()}}_ensureLiveSyncSubscriptions(){const e=this.hass?.connection;if(!e)return;if(e!==this._liveSyncConnection&&(this._unsubCfg?.(),this._unsubCfg=null,this._unsubLayout?.(),this._unsubLayout=null,this._unsubTrail?.(),this._unsubTrail=void 0,this._unsubVirtual?.(),this._unsubVirtual=null,this._liveSyncGeneration++,this._liveSyncAttempt=null,this._liveSyncConnection=e),this._liveSyncAttempt)return;const t=this._liveSyncGeneration,i=[],n=(n,r,o,s)=>{n()||i.push(async()=>{const i=await e.subscribeEvents(s,o);t===this._liveSyncGeneration&&this.isConnected&&this.hass?.connection===e&&!n()?r(i):i?.()})};if(n(()=>this._unsubCfg,e=>{this._unsubCfg=e},"houseplan_config_updated",e=>{const t=Number(e?.data?.rev??-1);t!==this._cfgRev&&this._reloadConfigOnly(!1,t)}),n(()=>this._unsubTrail,e=>{this._unsubTrail=e},"houseplan_trail_updated",async()=>{try{const e=await this.hass.callWS({type:"houseplan/trail/get"});this._vacSrvTrails=e?.trails||{},this.requestUpdate()}catch{}}),n(()=>this._unsubLayout,e=>{this._unsubLayout=e},"houseplan_layout_updated",e=>this._onLayoutEvent(Number(e?.data?.rev??-1))),n(()=>this._unsubVirtual,e=>{this._unsubVirtual=e},"houseplan_virtual_light_updated",e=>{const t=qh(this._virtualLights,e?.data);t!==this._virtualLights&&(this._virtualLights=t,this._capturedSnapshotVirtual="",this._cacheSnapshot(),this.requestUpdate())}),!i.length)return;const r=function(e){return Promise.allSettled(e.map(e=>Promise.resolve().then(e)))}(i).then(()=>{});this._liveSyncAttempt=r,r.finally(()=>{this._liveSyncAttempt===r&&(this._liveSyncAttempt=null)})}async _reloadConfigOnly(e=!1,t){return Gu(this,e,t)}_scheduleLoadRetry(e=!1){if(void 0!==this._loadRetryTimer)return;const t=Math.min(8e3,500*2**Math.min(4,Math.max(1,this._loadTries-7)));this._loadRetryTimer=window.setTimeout(()=>{this._loadRetryTimer=void 0,!e&&this._loadOk||this._loading||!this.hass||this._loadFromServer()},t)}async _ensureLiveRuntime(){if(this._liveRt)return;const e=await import("./live-interaction-runtime-CO9GuTnQ.js");this._liveRt=new e.LiveRuntime(this),this.isConnected&&this.requestUpdate()}_liveVp(e=!1){this._liveRt?this._liveRt.viewport(e):this.requestUpdate()}_syncLiveHover(){this._liveRt?this._liveRt.hover():this.requestUpdate()}_flushHa(){this._liveRt?.take()&&(this._terminalFrame=2,super.requestUpdate())}_ensureHaRegistryAuthority(){const e=this.hass?.connection||null;e&&e!==this._haRegistryConnection&&(this._haRegistryRelease?.(),this._haRegistryConnection=e,this._haRegistryRev=-1,this._haBindingCacheKey="",this._renderLife.invalidate(),this._areaSnapshotCleanupCandidates.clear(),this._planHassMemo=null,this._haRegistryRelease=Qh(this.hass,this._onHaRegistryUpdate),this._onHaRegistryUpdate())}get _haRegistry(){return td(this.hass)}get _planHass(){const e=this._haRegistry,t=nd(this.hass,e),i=this._planHassMemo;if(i&&i.hass===this.hass&&i.sig===t)return i.active;const n=od(this.hass,e),r=sd(this.hass,e);return this._planHassMemo={hass:this.hass,sig:t,active:n,full:r},n}_captureRenderDeviceSnapshot(){if(!this.hass)return;const e=Date.now(),t=[...this._activityRt.entries()].map(([t,i])=>`${t}:${i.gen}:${i.flashTs}:`+(i.flashKind&&(i.expiresAt||i.flashTs+Qm)>e?1:0)).join("|"),i=Hh(this._virtualLights);if(this._capturedSnapshotSequence===this._hassSequence&&this._capturedSnapshotDevices===this._devices&&this._capturedSnapshotLayout===this._layout&&this._capturedSnapshotConfigEpoch===this._cfgEpoch&&this._capturedSnapshotVirtual===i&&this._capturedSnapshotActivity===t)return;const n=this._planHass,r=new Map,o=new Map,s=new Set(["sun.sun"]);for(const e of this._summary?.entityIds()||[])s.add(e);this._vacFit?.source&&s.add(this._vacFit.source);const a=new Set,l=new Set,c=e=>{if(!e)return;const t=e.indexOf(":");if(t<0)return void s.add(e);const i=e.slice(0,t),n=e.slice(t+1);"device"===i?a.add(n):"entity"===i&&s.add(n)};for(const e of this._model)for(const t of e.rooms)t.area&&l.add(t.area),c(t.settings?.temp_source),c(t.settings?.hum_source);for(const e of this._serverCfg?.spaces||[])for(const t of e.openings||[])for(const e of ui(t))s.add(e);for(const e of this._serverCfg?.spaces||[])for(const t of e.decor||[])if("text"===t.kind){for(const e of String(t.text||"").matchAll(/\{([^{}\r\n]+)\}/g)){const t=Ki(e[1]);t?.entity&&s.add(t.entity)}t.entity&&s.add(t.entity),o.set(`decor:${e.id}:${t.id}`,Qi(t.text,t,n,e=>!!n.entities?.[e]&&!!n.states?.[e]&&!Xd(n,e,Yd(this._markers))))}const h=Id(n,this._devices,null,this._virtualLights);for(const e of this._devices){for(const t of[!1,!0])r.set(m_(e.id,t),d_(n,e,{liveStates:!1!==this._config?.live_states,showTemperature:!1!==this._config?.show_temperature,showSignal:t,activityRuntime:this._activityRt.get(e.id),sourceDetails:!1,lightDevices:this._devices,lightSources:h,registryHass:this._fullRegistryHass,reducedMotion:this._reducedMotion}));if(this._isVacDev(e)){const t=this._vacSource(e,n),i=t?qc(n?.states?.[t]?.attributes):null,r=this._vacRt.get(e.id),s=sh(e.id,e.marker?.vacuum??null,e.space,t),a=lh({routes:s,observed:ch(s,[t],t=>this._vacObservedMapId(e,t,n)),spaceIds:new Set(this._model.map(e=>e.id))});o.set(`vacuum:${e.id}`,{source:t,telemetry:i,routes:s,resolution:a,mapId:i?this._vacMapId(e,i,n):null,runtime:r?{trail:r.trail,lastTs:r.lastTs,moving:r.moving,jump:r.jump}:null,server:this._vacSrvTrails[e.id]||null})}}const d=__({sourceSequence:this._hassSequence,hass:n,devices:this._devices,presentations:r,positions:(u=this._model.length>0,p=this._devices,_=e=>this._livePos(e),u?new Map(p.map(e=>[e.id,_(e)])):new Map),facts:o,entityIds:s,deviceIds:a,areaIds:l});var u,p,_;this._capturedSnapshotSequence=this._hassSequence,this._capturedSnapshotDevices=this._devices,this._capturedSnapshotLayout=this._layout,this._capturedSnapshotActivity=t,this._capturedSnapshotConfigEpoch=this._cfgEpoch,this._capturedSnapshotVirtual=i,this._visibleDeviceSnapshot&&"steady"!==this._continuity.state?this._candidateDeviceSnapshot=d:(this._visibleDeviceSnapshot=d,this._candidateDeviceSnapshot=null)}get _renderDeviceSnapshot(){return this._stagedDeviceSnapshotToken===this._continuity.token?this._candidateDeviceSnapshot||this._visibleDeviceSnapshot:this._visibleDeviceSnapshot||this._candidateDeviceSnapshot}get _renderPlanHass(){return this._renderDeviceSnapshot?.hass||this._planHass}get _renderDevices(){return this._renderDeviceSnapshot?.devices||this._devices}get _renderVacuumDevices(){return this._renderDeviceSnapshot?.vacuumDevices||this._devices}get _fullRegistryHass(){return this._planHass,this._planHassMemo?.full||this.hass}_bindingStatus(e){return cd(this.hass,e,this._haRegistry)}houseplanDiagnostics(){const{registry:e,bindings:t}=this._renderLife.diagnostics(this.hass,this._markers,e=>this._bindingStatus(e));return{registry:{...e,lastSuccessAgeMs:e.lastSuccess?Math.max(0,Date.now()-e.lastSuccess):null},bindings:t}}_openBindingInHa(e){const[t,i]=e.split(":");if(i)if("device"!==t){if("entity"===t){const e=this._fullRegistryHass.entities?.[i];e?.device_id&&mv("/config/devices/device/"+encodeURIComponent(e.device_id))}}else mv("/config/devices/device/"+encodeURIComponent(i))}_bindingHasHaPage(e){const[t,i]=e.split(":");return!!i&&("device"===t||"entity"===t&&!!this._fullRegistryHass.entities?.[i]?.device_id)}_toggleMarkerDialogVisibility(){const e=this._markerDialog;if(!e)return;const t="ha"===e.bindingMode?this._bindingStatus(e.binding):null,i=e.hideFromPlan||"ha_disabled"===t?.kind;i&&"ha_disabled"===t?.kind?this._showToast(this._t("entity"===t.reason?"toast.ha_disabled_show_entity":"toast.ha_disabled_show_device")):i&&"unverified"===t?.kind?this._showToast(this._t("toast.ha_binding_unverified")):this._markerDialog={...e,hideFromPlan:!i}}_hookConnection(){const e=this.hass?.connection;e&&e!==this._connHooked&&(this._connHooked?.removeEventListener?.("ready",this._onConnReady),this._connHooked?.removeEventListener?.("disconnected",this._onConnLost),this._connHooked?.removeEventListener?.("reconnect-error",this._onConnLost),e.addEventListener?.("ready",this._onConnReady),e.addEventListener?.("disconnected",this._onConnLost),e.addEventListener?.("reconnect-error",this._onConnLost),this._connHooked=e)}_display(e){return this._signer.display(this.hass,e)}_referencedContentUrls(){const e=On(this._serverCfg);for(const t of this._decorAssets.values())e.add(t.url);return e}_resign(){this._signer.resign(this.hass,this._referencedContentUrls())}_onLayoutEvent(e){e<=this._layoutRev||(clearTimeout(this._layoutSyncTimer),this._layoutSyncTimer=window.setTimeout(()=>{e<=this._layoutRev||this._reloadLayoutOnly()},200))}_noteLayoutRev(e){this._adoption.noteLayoutRevision(e?.rev)}async _reloadLayoutOnly(){if(!this._serverStorage||!this.hass?.callWS)return;this._beginContinuityCandidate("layout-reload",!1);const e=new Map;for(const t of this._dirtyPos)this._layout[t]&&e.set(t,this._layout[t]);this._persistLayout.pending()&&this._persistLayout.flush();for(const[t,i]of this._sentPos)e.set(t,i);try{const t=await this.hass.callWS({type:"houseplan/layout/get"}),i={...t?.layout||{}};for(const[t,n]of e)null===n?delete i[t]:i[t]=n;this._adoption.adoptMergedLayout(i,t,()=>{this._cancelDeviceDrag(),this._devicePositionHistory.clear()}),this._canOptimizeUndo=!!t?.can_optimize_undo,this._undoKind=t?.undo_kind||null,this._cacheSnapshot(),this.requestUpdate()}catch{}finally{this._continuityDataReady=!0,this.requestUpdate()}}_persistLocalLayout(){this._layout=yo(no(this._layout)),localStorage.setItem(sv,JSON.stringify(this._layout))}_maybeRebuildDevices(){const e=this.hass;if(!e?.devices||!e?.entities||!e?.areas)return;const t=this._haRegistry,i=nd(e,t)+":"+Object.keys(e.areas).length+":"+(this._norm?"n":"l")+":"+bp(e,this._config?.language);if(i===this._regSignature&&this._devices.length)return;this._regSignature=i;const n=new Map(this._devices.map(e=>[e.id,e.bindingStatus?.kind||"active"]));this._devices=eu({hass:e,registry:t,areaToSpace:Object.fromEntries(Object.entries(this._areaToSpace).map(([e,t])=>[e,t.space])),markers:this._markers,settings:this._settings,excluded:this._excluded,showAll:this._showAll,firstSpaceId:this._model[0]?.id||"",loc:e=>this._t(e),iconRules:this._iconRules});const r=this._markers.filter(e=>!e.removed&&"virtual"!==e.binding).map(e=>e.binding).sort(),o=t.revision+":"+r.join("|");if(t.authoritative&&o!==this._haBindingCacheKey){const i=new Map;for(const n of r)i.set(n,cd(e,n,t));!function(e){if("undefined"==typeof localStorage||!e.size)return;const t=ld(),i=Date.now();for(const[n,r]of e)"active"===r.kind?t[n]={kind:"active",ts:i}:"ha_disabled"===r.kind&&(t[n]={kind:"ha_disabled",reason:r.reason,ts:i});const n=Object.fromEntries(Object.entries(t).sort((e,t)=>t[1].ts-e[1].ts).slice(0,1500));Vh=n;try{localStorage.setItem(Gh,JSON.stringify(n))}catch{}}(i),this._haBindingCacheKey=o}let s=null;if(t.authoritative&&(s=this._resolveAreaRelocations(t),this._areaRelocationIds=new Set(s.relocateIds),this._areaRelocationIds.size)){this._cancelDeviceDrag();const e=this._areaRelocationIds;this._devicePositionHistory.removeWhere(({before:t,after:i})=>e.has(t.deviceId)||e.has(i.deviceId));const t=this._markerDialog;if(t?.devId&&!t.roomTouched&&this._areaRelocationIds.has(t.devId)){const e=this._devices.find(e=>e.id===t.devId);e&&(this._markerDialog={...t,room:e.marker?.room_id?`${e.space}#@${e.marker.room_id}`:e.space&&e.area?`${e.space}#${e.area}`:""})}}this._defPos=this._defaultPositions(),this._syncNewDevices(),this._seedHiddenDevices(),s&&this._syncAreaRelocations(s),this._syncActivityRuntime();const a=new Set(this._devices.filter(e=>!e.hidden).map(e=>e.id));for(const e of this._vacRt.keys())a.has(e)||this._vacRt.delete(e);if(this._infoCard){const e=this._devices.find(e=>e.id===this._infoCard.id);this._infoCard=e&&"ha_disabled"!==e.bindingStatus?.kind?e:null}const l=this._devices.some(e=>"ha_disabled"===e.bindingStatus?.kind&&"ha_disabled"!==n.get(e.id));l&&("ha_disabled"!==this._infoCard?.bindingStatus?.kind&&"ha_disabled"!==this._devices.find(e=>e.id===this._infoCard?.id)?.bindingStatus?.kind||this._closeInfoCard(),this._deviceDrag&&"ha_disabled"===this._devices.find(e=>e.id===this._deviceDrag.id)?.bindingStatus?.kind&&(this._cancelDeviceDrag(),this._devicePositionHistory.clear()),clearTimeout(this._holdTimer),this._holdFired=!1,this._tip=null,this._tapConfirm=null),this._nativeMoreInfoEntity&&!this._planEntityAvailable(this._nativeMoreInfoEntity)&&(_v(this,"hass-more-info",{entityId:null}),this._nativeMoreInfoEntity=null)}_resolveAreaRelocations(e=this._haRegistry){const t=function(e){const t=Z_(e.snapshot),i=new Set(Object.values(t).map(e=>e.binding)),n=new Map;for(const[t,r]of e.previousCandidates||[])X_(t)&&Number.isFinite(r)&&i.has(t)&&n.set(t,r);const r=new Set,o=new Set;for(const t of e.markers||[])t.removed||(Y_(t.id)&&r.add(t.id),X_(t.binding)&&o.add(t.binding));const s=new Set(Object.keys(e.registryDevices||{})),a=new Set(Object.keys(e.registryEntities||{})),l=new Set(Object.keys(e.liveStates||{})),c=new Map;for(const[e,i]of Object.entries(t)){const t=c.get(i.binding)||[];t.push(e),c.set(i.binding,t)}const h=new Set;let d=!1;for(const[t,i]of c){const[c,u]=im(t);if(o.has(t)||i.some(e=>r.has(e))||("device"===c?s.has(u):a.has(u)||l.has(u))){n.delete(t);continue}const p="device"===c?s.size>0:a.size>0;if(!e.authoritative||!p)continue;const _=n.get(t);if(void 0!==_){if(_!==e.revision)for(const e of i)h.add(e)}else n.set(t,e.revision),d=!0}return{removeIds:h,candidates:n,needsConfirmationRefresh:d}}({snapshot:this._settings.marker_area_snapshot,authoritative:e.authoritative,revision:e.revision,registryDevices:e.devices,registryEntities:e.entities,liveStates:this.hass?.states,markers:this._markers,previousCandidates:this._areaSnapshotCleanupCandidates});return this._areaSnapshotCleanupCandidates=t.candidates,t.needsConfirmationRefresh&&this._canEdit&&ed(this.hass),nm({devices:this._devices,model:this._model,layout:this._layout,snapshot:this._settings.marker_area_snapshot,authoritative:e.authoritative,cleanupSnapshotIds:t.removeIds,coordinateScale:uv})}_syncNewDevices(){if(!this._norm||!this._loadOk||!this._serverCfg)return;const e=this._devices.filter(e=>!e.marker&&!e.virtual).map(e=>e.id).sort(),t=e.join(",");if(t===this._newSyncKey)return;this._newSyncKey=t;const i=this._settings,{fresh:n,known:r}=function(e,t){if(!Array.isArray(t))return{fresh:[],known:[...e]};const i=new Set(t),n=e.filter(e=>!i.has(e));return{fresh:n,known:n.length?[...t,...n]:t}}(e,i.known_devices);if(!Array.isArray(i.known_devices)||n.length){const e=[...new Set([...i.new_device_ids||[],...n])];this._serverCfg={...this._serverCfg,settings:{...i,known_devices:r,new_device_ids:e}},this._saveConfig()}}_syncAreaRelocations(e){if(!(this._loadOk&&this._serverCfg&&this._norm&&this._canEdit&&this._haRegistry.authoritative))return;const t=e.decisions.filter(e=>e.updateSnapshot||e.removeSnapshot);if(!t.length)return;const i=ac({snapshot:Z_(this._settings.marker_area_snapshot),decisions:t});i!==this._areaRelocationSyncKey&&(this._areaRelocationSyncKey=i,this._areaRelocationWrite=this._areaRelocationWrite.catch(()=>{}).then(async()=>{if(!this._serverCfg||!this._haRegistry.authoritative)return;const e=this._resolveAreaRelocations();this._areaRelocationIds=new Set(e.relocateIds);const t=new Set,i=new Map;let n=!1;for(const r of e.decisions){if(!r.relocate)continue;const e=mg(this._layout,r.id);try{await this._persistDevicePlacement(r.id,null),t.add(r.id),e&&i.set(r.id,e),this._areaRelocationIds.delete(r.id)}catch(t){n=!0,this._layout=gg(this._layout,r.id,e),this._showToast(this._t("toast.pos_save_failed",{err:this._errText(t)}))}}const r=this._settings,o=function(e,t,i=new Set){const n=Z_(e);for(const e of t.decisions)e.removeSnapshot?delete n[e.id]:e.updateSnapshot&&e.binding&&e.area&&(e.relocate&&!i.has(e.id)||(n[e.id]={binding:e.binding,area:e.area}));return n}(r.marker_area_snapshot,e,t),s=[...new Set([...Array.isArray(r.new_device_ids)?r.new_device_ids:[],...t])],a=ac(o)!==ac(Z_(r.marker_area_snapshot)),l=ac(s)!==ac(Array.isArray(r.new_device_ids)?r.new_device_ids:[]);if(a||l){const e=r.marker_area_snapshot,n=r.new_device_ids,a={...this._serverCfg,settings:{...r,marker_area_snapshot:o,...l?{new_device_ids:s}:{}}};this._setAreaLifecycleConfig(a);try{this._saveConfigDebounced.pending()&&this._saveConfigDebounced.cancel(),await this._writeConfig()}catch(r){const a=this._settings;if(ac(a.marker_area_snapshot)===ac(o)&&ac(a.new_device_ids)===ac(l?s:n)){const t={...a};void 0===e?delete t.marker_area_snapshot:t.marker_area_snapshot=e,void 0===n?delete t.new_device_ids:t.new_device_ids=n;const i={...this._serverCfg,settings:t};this._setAreaLifecycleConfig(i),this._adoption.refreshConfigFingerprint()}for(const e of t)this._areaRelocationIds.add(e);const c=new Set;for(const[e,t]of i)try{await this._persistDevicePlacement(e,t)}catch(t){c.add(e),this._showToast(this._t("toast.pos_save_failed",{err:this._errText(t)}))}this._areaRelocationSyncKey="",this._regSignature="";if("conflict"===(r&&"object"==typeof r&&"code"in r?r.code:void 0)?(this._showToast(this._t("toast.conflict")),await this._reloadConfigOnly(!0)):this._showToast(this._t("toast.cfg_save_failed",{err:this._errText(r)})),c.size&&this._serverCfg){const e=this._settings,t=[...new Set([...Array.isArray(e.new_device_ids)?e.new_device_ids:[],...c])],i={...this._serverCfg,settings:{...e,new_device_ids:t}};this._setAreaLifecycleConfig(i);try{await this._writeConfig()}catch(e){this._showToast(this._t("toast.cfg_save_failed",{err:this._errText(e)}))}}}}n&&(this._areaRelocationSyncKey=""),this.requestUpdate()}))}get _newIds(){const e=this._settings.new_device_ids;return new Set([...Array.isArray(e)?e:[],...this._areaRelocationIds])}_ackNewDevice(e){if(!this._newIds.has(e)||!this._serverCfg)return;const t=this._settings;this._serverCfg={...this._serverCfg,settings:{...t,new_device_ids:(t.new_device_ids||[]).filter(t=>t!==e)}},this._saveConfig(),this.requestUpdate()}get _markers(){return this._serverCfg?.markers||[]}_roomLqi(e){if(!e)return null;const t=[];for(const i of this._renderDevices){if(i.area!==e||i.virtual)continue;const n=Nd(this._renderPlanHass,i.entities);null!=n&&t.push(n)}return Ii(t)}_roomBounds(e){if(e.poly&&e.poly.length){const t=e.poly.map(e=>e[0]),i=e.poly.map(e=>e[1]),n=Math.min(...t),r=Math.min(...i);return{x:n,y:r,w:Math.max(...t)-n,h:Math.max(...i)-r}}return{x:e.x??0,y:e.y??0,w:e.w??0,h:e.h??0}}_defaultPositions(){const e={},t=this._config?.icon_size??2.5;for(const i of this._model){const n=t/100*wl(i)*1.3;for(const t of i.rooms){if(!t.area)continue;const r=this._devices.filter(e=>e.area===t.area&&e.space===i.id);if(!r.length)continue;const o=this._roomBounds(t),s=.1*Math.min(o.w,o.h),a=o.w-2*s,l=o.h-2*s,c=Math.max(1,Math.round(Math.sqrt(r.length*a/Math.max(l,1)))),h=Math.ceil(r.length/c),d=a/c,u=l/Math.max(h,1),p=r.map((e,t)=>({x:o.x+s+d*(t%c+.5),y:o.y+s+u*(Math.floor(t/c)+.5)}));Ei(p,o,n,.5*s),r.forEach((t,i)=>e[t.id]=il(p[i]))}}return e}_pos(e){const t=this._renderDeviceSnapshot?.positions.get(e.id);return t?{x:t.x,y:t.y}:this._livePos(e)}_livePos(e){const t=this._spaceModelById(e.space),i=this._areaRelocationIds.has(e.id)?void 0:this._layout[e.id];if(i)if(this._norm){if(i.s===e.space)return{x:i.x*uv,y:i.y*uv}}else if(void 0===i.s)return{x:i.x,y:i.y};return this._defPos[e.id]?this._defPos[e.id]:t?il(bl(t)):{x:500,y:500}}_devicePlacementForCanvas(e,t,i){if(!this._norm)return{x:Math.round(t),y:Math.round(i)};const n=this._gridPitch,r=Math.round(t/n)*n,o=Math.round(i/n)*n;return{s:e.space,x:rl(r/uv),y:rl(o/uv)}}_previewDevicePlacement(e,t){this._layout=gg(this._layout,e,t),this.requestUpdate()}_cancelDeviceDrag(){const e=this._deviceDrag;if(!e)return!1;this._editorRuntime?._cancelPointerMove("device"),this._deviceDrag=null,this._deviceHits.cancel(e.pointerId);try{e.source?.hasPointerCapture?.(e.pointerId)&&e.source.releasePointerCapture(e.pointerId)}catch{}return this._previewDevicePlacement(e.id,e.before),!0}async _persistDevicePlacement(e,t){if(this._layout=gg(this._layout,e,t),this._serverStorage){let i=null,n=!1;try{let r;if(null===t)i=null,this._sentPos.set(e,i),n=!0,r=await this.hass.callWS({type:"houseplan/layout/delete",device_id:e});else{const t=vo(this._layout[e]);ac(t)!==ac(this._layout[e])&&(this._layout={...this._layout,[e]:t}),i=t,this._sentPos.set(e,i),n=!0,r=await this.hass.callWS({type:"houseplan/layout/update",device_id:e,pos:t})}this._noteLayoutRev(r),this._adoption.refreshLayoutFingerprint(),this._cacheSnapshot()}finally{n&&this._sentPos.get(e)===i&&this._sentPos.delete(e)}return}this._persistLocalLayout()}_devicePositionStateValid(e){const t=this._devices.find(t=>t.id===e.deviceId);return!!t&&t.space===e.spaceId&&"ha_disabled"!==t.bindingStatus?.kind&&!!this._spaceModelById(e.spaceId)}async _runDevicePositionHistory(e){if(this._cancelDeviceDrag()||this._devicePositionBusy)return;const t="undo"===e?this._devicePositionHistory.undo():this._devicePositionHistory.redo();if(!t)return;const i="undo"===e?t.before:t.after;if(!this._devicePositionStateValid(i))return this._devicePositionHistory.clear(),this._showToast(this._t("history.device_stale")),void this.requestUpdate();const n=mg(this._layout,i.deviceId);i.spaceId!==this._space&&(this._commitSpace(i.spaceId),this._restoreZoom()),this._devicePositionBusy=!0,this._previewDevicePlacement(i.deviceId,i.placement);try{await this._persistDevicePlacement(i.deviceId,i.placement),this._showToast(this._t("undo"===e?"history.undone":"history.redone",{name:t.name}))}catch(t){this._previewDevicePlacement(i.deviceId,n),"undo"===e?this._devicePositionHistory.redo():this._devicePositionHistory.undo(),this._showToast(this._t("toast.pos_save_failed",{err:this._errText(t)}))}finally{this._devicePositionBusy=!1,this.requestUpdate()}}_undoDevicePosition(){this._runDevicePositionHistory("undo")}_redoDevicePosition(){this._runDevicePositionHistory("redo")}_savePos(e,t,i){this._spaceModelById(e.space)&&(this._layout=gg(this._layout,e.id,this._devicePlacementForCanvas(e,t,i)),this._dirtyPos.add(e.id),this._persistLayout())}_devicePresentation(e,t=!1!==this._config?.show_signal,i=!1){const n=i?null:this._renderDeviceSnapshot?.presentations.get(m_(e.id,t));return n||d_(this._renderPlanHass,e,{liveStates:!1!==this._config?.live_states,showTemperature:!1!==this._config?.show_temperature,showSignal:t,designPreview:i,activityRuntime:this._activityRt.get(e.id),sourceDetails:!1,lightDevices:this._renderDevices,registryHass:this._fullRegistryHass,reducedMotion:this._reducedMotion})}_deviceVisual(e){return this._devicePresentation(e).visual}_stateClass(e,t=this._deviceVisual(e)){const i=this._devicePresentation(e);return i.effectiveHidden?"":("icon_ripple"!==i.display||!1===this._config?.live_states||"alarm"===t.status||t.activity,h_({...i,visual:t}).join(" "))}_liveTemp(e){if(!this._config?.show_temperature)return null;if(!0===e.marker?.use_climate_temp){const t=Ld(this._renderPlanHass,e.entities);if(null!=t)return t}return"mdi:thermometer"!==e.icon&&"mdi:air-filter"!==e.icon?null:Hd(this._renderPlanHass,e.entities)}_bindingEntities(e){if("virtual"===e||!e)return[];const t=this._bindingStatus(e);return"active"===t.kind?t.enabledEntityIds:t.allEntityIds}_bindingHasClimate(e){return this._bindingEntities(e).some(e=>e.startsWith("climate."))}_bindingHasAlarm(e){return this._bindingEntities(e).some(e=>{const t=this._planHass?.states?.[e]||this.hass?.states?.[e],i=this._fullRegistryHass.entities[e]||this.hass?.entities?.[e];return Vn(e.split(".")[0],t?.attributes?.device_class||i?.device_class||i?.original_device_class)})}_deviceBindingActive(e,t=!0){if(e.virtual||"virtual"===e.bindingKind)return!0;if(!e.bindingKind||!e.bindingRef)return!1;const i=this._bindingStatus(`${e.bindingKind}:${e.bindingRef}`);return"active"===i.kind||(t&&this._showToast(this._t("ha_disabled"===i.kind?"toast.ha_disabled_action":"toast.ha_binding_unverified")),!1)}_openMoreInfo(e){e?this._planEntityAvailable(e)?(this._kiosk&&(this._cyclePausedUntil=Math.max(this._cyclePausedUntil,Date.now()+6e4)),this._nativeMoreInfoEntity=e,_v(this,"hass-more-info",{entityId:e})):this._showToast(this._t("toast.ha_disabled_action")):this._showToast(this._t("toast.no_entity"))}_interruptViewGesture(e,t){if(clearTimeout(this._holdTimer),clearTimeout(this._kioskHoldTimer),void 0!==e)for(const i of[t,this._stageEl])try{i?.hasPointerCapture?.(e)&&i.releasePointerCapture(e)}catch{}this._pointers.clear(),this._panStart=null,this._panLock=null,this._pinchStart=null,this._swipeStart=null,this._roomPointer=null,this._doubleFit.clear(),this._deviceHits.clearPointers()}_closeInfoCard(){this._interruptViewGesture(),this._holdFired=!1,this._infoCard=null}_invalidateDeviceHitGeometry(){this._deviceHits.invalidate()}_resetDeviceHitState(){this._deviceHits.reset(this.renderRoot)}_deviceHitOwnerAt(e,t){return"view"!==this._mode&&"devices"!==this._mode?null:this._deviceHits.at(this.renderRoot,this._renderDevices,this._space,e,t)}_deviceForPointerEvent(e,t){return this._deviceHits.pointer(this.renderRoot,this._renderDevices,this._space,e,t)}_deviceForClickEvent(e,t){return this._deviceHits.click(this.renderRoot,this._renderDevices,this._space,e,t)}_showDeviceTip(e,t){this._liveRt?this._liveRt.devicePointerTip(e,t):this._ensureLiveRuntime().then(()=>this._liveRt?.devicePointerTip(e,t))}_showDeviceFocusTip(e,t){const i=e.currentTarget;this._liveRt?this._liveRt.deviceFocusTip(i,t):this._ensureLiveRuntime().then(()=>this._liveRt?.deviceFocusTip(i,t))}_hideDeviceFocusTip(e){this._liveRt?.deviceBlur(e)}_clearPointerHover(){this._liveRt?this._liveRt.pointerLeave():this._clearTransientHover()}_ctxDevice(e,t){"view"===this._mode&&(t=this._deviceForPointerEvent(e,t),e.preventDefault(),e.stopPropagation(),this._deviceBindingActive(t)&&(t.primary?this._openMoreInfo(t.primary):this._infoCard=t))}_clickDevice(e,t){if("view"!==this._mode&&"devices"!==this._mode)return;if(e.stopPropagation(),t=this._deviceForClickEvent(e,t),this._deviceDrag?.moved||this._suppressClick||this._holdFired)return;if("devices"===this._mode)return void this._openMarkerDialog(t);const i=this._devices.find(e=>e.id===t.id);if(!i)return;const n=Ru(i.tapAction,i.primary?.split(".")[0]);if("none"===n)return;const r=(e,t)=>{i.marker?.tap_confirm?this._tapConfirm={kind:"run",text:e,exec:t}:t()};if("toggle"===n){const e=this._toggleIntent(i);if(!e)return;if(!Fu(e))return void this._showUnavailableToggleTargets(e);const t=e=>{const t=Fu(e);if(!t)return;if("virtual-light"===t.kind)return this._startDevicePressFeedback(i.id),void this.hass.callWS({type:"houseplan/virtual_light/toggle",marker_id:t.markerId}).then(e=>{const t=qh(this._virtualLights,e);t!==this._virtualLights&&(this._virtualLights=t,this._capturedSnapshotVirtual="",this._cacheSnapshot(),this.requestUpdate())}).catch(e=>this._showToast(this._t("toast.virtual_light_toggle_failed",{err:this._errText(e)})));const{command:n}=t;this._startDevicePressFeedback(i.id),this.hass.callService(n.domain,n.service,n.data).catch(e=>this._showToast(this._t("toast.error",{err:this._errText(e)})))},n=((o=e).targets.length?o.targets:o.skippedTargets).map(e=>e.name||e.entityId||e.ref).join(", ")||i.name;if(i.marker?.tap_confirm){const r=this._toggleConfirmationLines(e);if(!r.length)return;this._tapConfirm={kind:"toggle",text:this._t("confirm.tap_toggle",{name:n}),lines:r,initialIntent:e,deviceId:i.id,exec:()=>{const n=this._devices.find(e=>e.id===i.id),r=n?this._toggleIntent(n):null;r&&!Fu(r)&&this._showUnavailableToggleTargets(r)||(r&&Iu(e,r)?t(r):this._showToast(this._t("toast.tap_target_changed")))}}}else t(e);return}var o;if("info"===n)return this._interruptViewGesture(),void(this._infoCard=i);if(this._deviceBindingActive(i)){if("run"===n){const e=i.marker?.tap_target||"",t=function(e){const t=String(e||"").split(".")[0];return"automation"===t?{domain:"automation",service:"trigger"}:"script"===t?{domain:"script",service:"turn_on"}:"scene"===t?{domain:"scene",service:"turn_on"}:null}(e),n=this.hass.states[e];if(!t||!n)return void this._showToast(this._t("toast.run_target_missing"));const o=n.attributes?.friendly_name||e;return void r(this._t("confirm.tap_run",{name:o}),()=>{this._deviceBindingActive(i)&&this._planEntityAvailable(e)&&(this._startDevicePressFeedback(i.id),this.hass.callService(t.domain,t.service,{entity_id:e}).then(()=>{this._stampActivity(i.id,"event",this._activitySourceKey(i)),this.requestUpdate(),this._showToast(this._t("toast.run_started",{name:o}))}).catch(e=>this._showToast(this._t("toast.error",{err:this._errText(e)}))))})}"more-info"===n&&i.primary?this._openMoreInfo(i.primary):this._infoCard=i}}_showUnavailableToggleTargets(e){const t=function(e){if(!e||"group"!==e.kind||Fu(e)||"configured-targets-missing"!==e.noneReason)return[];if(!e.skippedTargets.length||e.skippedTargets.some(e=>!zu.has(e.reason)&&"secure"!==e.reason))return[];const t=[],i=new Set;for(const n of e.skippedTargets){if(!zu.has(n.reason))continue;const e=String(n.name||n.entityId||n.ref||"").trim();e&&!i.has(e)&&(i.add(e),t.push(e))}return t}(e);return!!t.length&&(this._showToast(1===t.length?this._t("toast.toggle_target_unavailable",{name:t[0]}):this._t("toast.toggle_targets_unavailable",{names:t.join(", ")})),!0)}_keyDevice(e,t){"Enter"!==e.key&&" "!==e.key||"view"!==this._mode&&"devices"!==this._mode||(e.preventDefault(),this._clickDevice(e,t))}_startDevicePressFeedback(e){const t=[...this.renderRoot.querySelectorAll(".dev[data-id]")].find(t=>t.dataset.id===e),i=t?.querySelector(".device-shell");if(!i||"function"!=typeof i.animate)return;const n=Number.parseFloat(this.ownerDocument.defaultView?.getComputedStyle(i).scale||""),r=Number.isFinite(n)?Math.max(.95,Math.min(1,n)):1;this._devicePressAnimations.get(e)?.cancel();const o=this._reducedMotion?[{outlineColor:"transparent",outlineStyle:"solid",outlineWidth:"0px"},{outlineColor:"var(--hp-accent, #3ea6ff)",outlineStyle:"solid",outlineWidth:"2px",outlineOffset:"2px",offset:.5},{outlineColor:"transparent",outlineStyle:"solid",outlineWidth:"0px"}]:[{scale:String(r)},{scale:"0.95",offset:.5},{scale:"1"}],s=i.animate(o,{duration:200,easing:"cubic-bezier(.22,.61,.36,1)"});this._devicePressAnimations.set(e,s);const a=()=>{this._devicePressAnimations.get(e)===s&&this._devicePressAnimations.delete(e)};s.addEventListener("finish",a,{once:!0}),s.addEventListener("cancel",a,{once:!0})}_cancelDevicePressFeedback(){for(const e of this._devicePressAnimations.values())e.cancel();this._devicePressAnimations.clear()}_pruneDevicePressFeedback(){if(!this._devicePressAnimations.size)return;const e=new Set([...this.renderRoot.querySelectorAll(".dev[data-id]")].map(e=>e.dataset.id||""));for(const[t,i]of this._devicePressAnimations)e.has(t)||(i.cancel(),this._devicePressAnimations.delete(t))}_t(e,t){return wp(bp(this.hass,this._config?.language),e,t)}get _colorPickerLabels(){return{title:this._t("color_picker.title"),hue:this._t("color_picker.hue"),saturation:this._t("color_picker.saturation"),value:this._t("color_picker.value"),hex:this._t("color_picker.hex"),invalidHex:this._t("color_picker.invalid_hex"),confirm:this._t("color_picker.confirm")}}_help(e){return this._editorRuntimeOrThrow()._help(e)}get _stageEl(){return this.renderRoot.querySelector(".stage")}_contentItems(e){const t=[];for(const i of this._devices){if(i.space!==e.id||i.hidden)continue;const n=this._pos(i);t.push({minX:n.x,minY:n.y,maxX:n.x,maxY:n.y})}if(e.id===this._space){for(const e of this._openingsR){const i=Number(e.angle)*Math.PI/180,n=Math.cos(i)*e.rlen/2,r=Math.sin(i)*e.rlen/2,o=ll([[e.rx-n,e.ry-r],[e.rx+n,e.ry+r]]);o&&t.push(o)}const i=this._decorH;for(const e of this._decorList){if("image"===e.kind&&!this._decorAssets.has(e.asset_id)&&"decor"!==this._mode)continue;const n=ll("line"===e.kind?[[e.x1*uv,e.y1*i],[e.x2*uv,e.y2*i]]:"text"===e.kind?[[e.x*uv,e.y*i]]:Fr({x:e.x*uv,y:e.y*i,w:e.w*uv,h:e.h*i,angle:e.angle}));n&&t.push(n)}for(const i of this._physicalBodiesR(e)){const e=ll(i);e&&t.push(e)}}return pl(e,t)}_frameOf(){const e=this._spaceModel();if(!e){this._frame=null;const e={x:0,y:0,w:uv,h:uv};return{rect:e,all:e,outliers:0}}const t=this._frame,i="view"!==this._mode;if(t&&t.id===e.id&&this._bdDrag)return t;if(t&&t.id===e.id&&t.model===e&&t.layout===this._layout&&t.devs===this._devices&&t.far===this._showFar&&t.grow===i)return t;const n=fl(this._contentItems(e));let r=n.all||yl(e),o=this._showFar?r:n.core||yl(e);return t&&t.id===e.id&&i&&t.grow&&(o=pv(t.rect,o),r=pv(t.all,r)),this._frame={id:e.id,model:e,layout:this._layout,devs:this._devices,far:this._showFar,grow:i,rect:o,all:r,outliers:n.outliers},this._frame}_isoSource(){const e=this._isoSceneRuntime;if(!e)return null;const t=this._spaceModel();if(!t)return null;const i=this._spaceWalls,n=this._openCuts(),r=this._openingsR;return e.createIsoStructuralSource({space:t,walls:i,openCuts:n,openings:r,partitionCuts:()=>this._partitionOpeningCuts(t),roomOpenings:()=>this._roomWallOpeningInputs(r,t),cellCm:this._cellCm,gridPitch:this._gridPitch,wallKeyPitch:this._wallKeyPitch,coordinateScale:uv,onBuild:()=>{this._isoStructuralBuildCount+=1}})}_isoSceneKey(){if(!this._labsIso||"view"!==this._mode)return null;try{return this._isoSource()?.key??null}catch{return this._isoInvalidKey()}}_isoInvalidKey(){return`${this._space}|invalid|${this._cfgEpoch}`}_clearIsoInvalidFallback(e){const t=`${this._space}|invalid|`;for(const i of this._isoFallback)i.startsWith(t)&&i!==e&&this._isoFallback.delete(i)}_isoScene(e=this._isoSource()){const t=this._isoSceneRuntime;if(!t||!e)return null;let i=this._frameOf().rect;const n=this._spaceDisplayForRender(),r=this._spaceModel();if(r&&n.showNames)for(const e of r.rooms)if(e.name){const t=this._labelPos(e,r.id);i=pv(i,{x:t.x,y:t.y,w:0,h:0})}const o=t.resolveIsoScene({source:e,cache:this._isoGeometryCache,cellCm:this._cellCm,liveFrame:i});if(!r||!n.showBorders)return o;const s=this._config?.icon_size??2.5,a=s>8?2.5:s,l=this._stageEl?.getBoundingClientRect?.()??null,c=l?.height?l.width/l.height:o.frame.w/o.frame.h,h=Oi([o.frame.x,o.frame.y,o.frame.w,o.frame.h],c),d=this._isoOverlayScene(r,this._renderDevices.filter(e=>e.space===r.id&&!e.hidden),h,n,t.resolveIsoDecorationLayers(n),o,a,w_(a),n.showLqi??this._config?.show_signal??!0,!1),u=d&&t.resolveIsoOverlayFitEnvelope({baseBounds:o.frame,entries:d.entries,stageSize:l,targetView:e=>Oi([e.x,e.y,e.w,e.h],c)});return u?{...o,frame:u.bounds,overlayFitEntries:d.entries}:o}_latchIsoFallback(e,t){if(this._isoFallback.has(e))return;this._isoFallback.add(e);const i=e.includes("|invalid|")?"invalid":e.split("|").pop()||"invalid";console.warn("HOUSEPLAN ISO FALLBACK: #89/#160",yf("structural",i,!0))}_effectiveProjection(){if(this._isoProjectionSnapshot)return this._isoProjectionSnapshot;const e=e=>this._isoProjectionSnapshot=e,t=()=>("iso"===this._renderProjection&&(this._cancelCameraTransition(!1),this._view=null,this._viewModeSnap=null),e("flat"));if(this._renderIsoScene=null,"iso"!==this._desiredProjection||!this._model.length||!this._isoSceneRuntime)return e("flat");if(!this._spaceDisplayForRender().showBorders)return this._isoFallback.has(`${this._space}|no-borders`)?t():e("iso");let i=this._isoInvalidKey();if(this._clearIsoInvalidFallback(i),this._isoFallback.has(i))return t();try{const n=this._isoSource();if(!n)return e("flat");if(i=n.key,this._isoFallback.has(i))return t();const r=this._isoScene(n);return r?this._isoFallback.has(r.key)?t():(this._renderIsoScene=r,e("iso")):e("flat")}catch(e){return this._latchIsoFallback(i,e),t()}}_scenePoint(e){return"iso"===this._renderProjection?sf(e,0):e}_floorView(e){if("iso"!==this._renderProjection)return e;const t=af([e.x,e.y]),i=af([e.x+e.w,e.y+e.h]);return{x:t[0],y:t[1],w:i[0]-t[0],h:i[1]-t[1]}}_isoOverlayScene(e,t,i,n,r,o,s,a,l,c=!0){const h=this._isoSceneRuntime;return h&&r?.structural&&o?h.buildIsoOverlayRenderScene({space:e,devices:t,openings:this._openingsR,view:i,display:n,layers:r,wallSilhouettes:o.wallSilhouettes,resolveCollisions:c,iconPct:s,deviceBasePct:a,showLqi:l,cellCm:this._cellCm,kioskIconScale:"view"===this._mode?this._kioskScale.icon:1,kioskFontScale:"view"===this._mode?this._kioskScale.font:1,stageSize:this._stageEl?.getBoundingClientRect?.(),selectedDeviceId:this._selId,focusedRoomId:this._roomFocus?.roomId,selectedOpeningId:this._openingInfo?.id,positionOf:e=>this._pos(e),presentationOf:(e,t)=>this._devicePresentation(e,t),labelPositionOf:(e,t)=>this._labelPos(e,t),labelScaleOf:e=>this._labelScale(e),openingEntityAvailable:e=>this._renderOpeningEntityAvailable(e),openingWallIndex:()=>this._openingWallIndexFor(e,this._openCuts()).value}):null}_baseVb(e=this._effectiveProjection(),t=this._renderIsoScene){if("iso"===e){if(!this._spaceDisplayForRender().showBorders){const e=hf({rect:this._frameOf().rect,wallHeight:0});return[e.x,e.y,e.w,e.h]}const e=t?.frame??this._frameOf().rect;return[e.x,e.y,e.w,e.h]}const i=this._frameOf().rect;return[i.x,i.y,i.w,i.h]}get _outliers(){return this._showFar?0:this._frameOf().outliers}_fitFar(){this._clearRoomFocus(),this._showFar=!0,this._frame=null,this.requestUpdate(),this._resetZoom()}_clearRoomFocus(e=!1){this._doubleFit.clear(),this._roomFocus=null,e&&(this._roomPointer=null)}_roomFitBounds(e,t){const i=ni(e);if(!i||!e.id)return null;const n=this._spaceWalls,r=this._openCuts(),o=this._wallUnionGeometry(),s=n.length&&this._innerRoomContour(t,e.id,r,o?.roomGeom,o?.multiWallNodes)||i,a=this._spaceDisplayForRender();let l=[];if(a.showBorders&&n.length){const i=Cs(t.rooms,e.id,n,r,this._wallKeyPitch,this._cellCm,this._gridPitch,uv);i&&(l=ia(i.poly,i.offsets,o?.multiWallNodes)||i.poly)}const c=this._effectiveProjection();return function(e){const t=e.floor,i=e.wall||[],n=e.padding??0;if(!t.length||!t.every(gf)||!i.every(gf)||!Number.isFinite(n)||n<0)return null;if("flat"===e.projection)return vf([...t,...i],n);const r=e.wallHeight??0,o=e.floorDepth??0;if(!Number.isFinite(r)||r<0||!Number.isFinite(o)||o<0)return null;try{const e=[];for(const i of t){const t=[i[0],i[1]];e.push(sf(t,0)),o>0&&e.push(sf(t,-o))}for(const t of i){const i=[t[0],t[1]];e.push(sf(i,0)),r>0&&e.push(sf(i,r))}return vf(e,n)}catch{return null}}({floor:s,wall:l,projection:c,wallHeight:"iso"===c&&a.showBorders?Ha(64,this._cellCm):0,floorDepth:"iso"===c&&a.showBorders?Ha(10,this._cellCm):0,padding:a.showBorders?Ha(1.25,this._cellCm):0})}_fitRoom(e,t=!0){if("view"!==this._mode)return!1;this._doubleFit.clear();const i=this._spaceModel(),n=i?.rooms.find(t=>t.id===e);if(!i||!n)return this._clearRoomFocus(),!1;let r=this._roomFitBounds(n,i);if(!r)return this._clearRoomFocus(),!1;this._roomFocus={spaceId:i.id,roomId:e};const o=this._stageEl;if(!o||o.clientWidth<=0||o.clientHeight<=0)return!0;const s=Oi(this._baseVb(),o.clientWidth/o.clientHeight),a=e=>function(e){const t=e.safeFraction??.8,{bounds:i,baseFit:n,stageWidth:r,stageHeight:o,minZoom:s,maxZoom:a}=e;if(!ff(i)||!ff(n)||!Number.isFinite(r)||r<=0||!Number.isFinite(o)||o<=0||!Number.isFinite(s)||s<=0||!Number.isFinite(a)||a1)return null;const l=r/o,c=Math.max(i.w/t,i.h/t*l);if(!Number.isFinite(c)||c<=0)return null;const h=Math.min(a,Math.max(s,n.w/c)),d=n.w/h,u=d/l;return{zoom:h,viewBox:{x:i.x+i.w/2-d/2,y:i.y+i.h/2-u/2,w:d,h:u}}}({bounds:e,baseFit:s,stageWidth:o.clientWidth,stageHeight:o.clientHeight,minZoom:yv.ZOOM_MIN,maxZoom:yv.ZOOM_MAX});let l=a(r);const c=this._isoSceneRuntime,h=this._renderIsoScene?.overlayFitEntries;if(l&&"iso"===this._effectiveProjection()&&c&&h?.length){const e=c.resolveIsoOverlayFitEnvelope({baseBounds:r,entries:h,ownerId:n.id,stageSize:{width:o.clientWidth,height:o.clientHeight},targetView:e=>a(e)?.viewBox??null});e&&(r=e.bounds,l=a(r))}if(!l)return this._clearRoomFocus(),!1;const d=this._cameraState(),u=function(e,t,i,n){const r=[e,t,i,n],o=Math.min(...r.map(e=>e.x)),s=Math.min(...r.map(e=>e.y));return{x:o,y:s,w:Math.max(...r.map(e=>e.x+e.w))-o,h:Math.max(...r.map(e=>e.y+e.h))-s}}(s,d.viewBox,l.viewBox,r);return l.viewBox=this._clampView(l.viewBox,u),t?(this._prepareCameraCommand(),this._startCameraTransition(l,u,"room",220),!0):(this._cancelCameraTransition(!1),Kg(d,l)||(this._zoom=l.zoom,this._view={...l.viewBox},this.requestUpdate()),!0)}_fitAll(e="fit"){this._clearRoomFocus(),this._showFar=!0,this._frame=null,this.requestUpdate(),this._resetZoom(e)}_renderFarHint(){return this._kiosk||"view"!==this._mode||this._booting||!this._outliers?G:j`
    +
    `:G}houseplanContinuityTrace(){return[...this._continuityHistory,...this._continuity.trace].slice(-80).map(e=>({...e,...e.stage?{stage:[...e.stage]}:{}}))}getCardSize(){return 12}getGridOptions(){return{columns:"full"}}get _norm(){return!(!this._serverCfg||!this._serverCfg.spaces.length)}_cfgFingerprint(){const e=this._serverCfg?.spaces||[];let t=e.length+":";for(const i of e){t+=(i.id||"")+","+(i.plan_aspect||"")+","+(i.plan_url||"").length+","+(i.plan_x??"")+","+(i.plan_y??"")+","+(i.plan_scale??"")+","+(i.plan_scale_x??"")+","+(i.plan_scale_y??"")+","+(i.plan_angle??"")+","+(i.rooms?.length||0)+","+(i.openings?.length||0)+","+(i.decor?.length||0)+";";for(const e of i.rooms||[]){const i=e.poly?.[0],n=e.poly?.[e.poly.length-1];t+=(e.poly?.length||0)+"."+(e.id||"")+"."+(e.open_to||[]).join("+")+"."+(e.area||"")+"."+JSON.stringify(e.settings||0)+"."+(e.x??"")+","+(e.y??"")+","+(e.w??"")+","+(e.h??"")+","+(i?i[0]+"/"+i[1]:"")+","+(n?n[0]+"/"+n[1]:"")+";"}}return t}get _model(){if(!this._serverCfg)return[];const e=this._cfgEpoch+"|"+this._cfgFingerprint();if(this._modelCache&&this._modelCache.key===e)return this._modelCache.model;const t=this._buildModel();return this._modelCache={key:e,model:t},t}_buildModel(){if(!this._serverCfg)return[];const e=this._renderCfg;return Ya(e).map((t,i)=>{const n=e.spaces[i]?.plan_url;return t.bg&&n?{...t,bg:{...t.bg,href:n}}:t})}_spaceModel(){return this._hasFixedFloor?bc(this._model,this._space):(e=this._model,t=this._space,e.find(e=>e.id===t)??e[0]);var e,t}_spaceModelById(e){return bc(this._model,e)}_syncEmptySpaceState(){if(!!this._serverCfg&&0===this._serverCfg.spaces.length){if(!this._emptySpaceStateActive){this._emptySpaceStateActive=!0,this._clearRoomFocus(!0);for(const e of this._pointers.keys())for(const t of this.renderRoot.querySelectorAll("*"))try{t.hasPointerCapture?.(e)&&t.releasePointerCapture(e)}catch{}this._pointers.clear(),this._panStart=null,this._panLock=null,this._pinchStart=null,this._swipeStart=null,this._drag=null,this._deviceDrag=null,this._resetDeviceHitState(),this._rlResize=null,this._vacFit=null,this._compassDrag=!1,this._cancelModeTransition(!1),this._mode="view",this._clearGeometryGesture(),this._geometryHistory.clear(),this._devicePositionHistory.clear(),this._tip=null,this._hoverRoom=null,this._openingInfo=null,this._closeInfoCard(),this._deviceInbox=null,this._deviceInboxReturn=null,this._markerDialog=null,this._physicalDialog=null,this._backdropDialog=null,this._decorShapeDialog=null,this._decorTextDialog=null,this._roomDialog=!1,"edit"===this._spaceDialog?.mode&&(this._spaceDialog=null),this._editorSecondary?.closeForNavigation(),this._saveConfigDebounced.cancel(),this._frame=null,this._planSnapGeometryCache=null,this._hiddenWallDiagnosticCache=null,this._decorSnapCache=null,this._commitSpace("",!0)}}else this._emptySpaceStateActive=!1}get _areaToSpace(){const e={};for(const t of this._model)for(const i of t.rooms)i.area&&(e[i.area]={space:t.id,room:i});return e}get _settings(){return this._serverCfg?.settings||{}}get _showAll(){return this._showHidden||!this._settings.filter_seeded&&!!this._settings.show_all}_seedHiddenDevices(){if(!(this._loadOk&&this._serverCfg&&this._norm&&this._canEdit))return;const e=this._serverCfg,t=Jd({hass:this.hass,registry:this._haRegistry,areaToSpace:Object.fromEntries(Object.entries(this._areaToSpace).map(([e,t])=>[e,t.space])),markers:this._markers,settings:this._settings,excluded:this._excluded,firstSpaceId:this._model[0]?.id||"",iconRules:this._iconRules});if(!t.length&&e.settings?.filter_seeded)return;e.markers=e.markers||[];const i=[];for(const n of t){const t="h"+n.slice(n.indexOf(":")+1);e.markers.push({id:t,binding:n,hidden:!0}),i.push(n.slice(n.indexOf(":")+1))}const n={...e.settings||{},filter_seeded:!0};delete n.show_all,i.length&&Array.isArray(n.new_device_ids)&&(n.new_device_ids=n.new_device_ids.filter(e=>!i.includes(e))),e.settings=n,this._regSignature="",this._maybeRebuildDevices(),this._saveConfig(),this.requestUpdate()}get _iconRules(){const e=this._settings.icon_rules;if(!e||!Array.isArray(e)||!e.length)return;const t=JSON.stringify(e);return t!==this._rulesCompiledSrc&&(this._rulesCompiledSrc=t,this._rulesCompiled=Ee(e)),this._rulesCompiled}get _fillColors(){return gn(this._settings)}get _excluded(){return su(this._settings)}_setAreaLifecycleConfig(e){this._cfgEpochPreservedConfig=e,this._serverCfg=e}willUpdate(e){if(this._isoProjectionSnapshot=null,this._summary?.willUpdate(),e.has("hass")&&this._configReloadAuthority.observeContext(Uu(this)),e.has("_serverCfg")){const e=this._cfgEpochPreservedConfig===this._serverCfg;this._cfgEpochPreservedConfig=null,e||this._cfgEpoch++,this._renderLife.invalidate()}if(this._syncEmptySpaceState(),this._dangerConfirm&&(this._dangerConfirmMissingSpace()||"warm"===this._syncDangerConfirmLocaleGate())&&this._cancelDangerConfirm(),e.has("hass")&&this.hass){const t=this._visibleDeviceSnapshot||this._candidateDeviceSnapshot;this._renderLife.observe(e.get("hass"),this.hass,t?{entityIds:t.entityIds}:null,()=>Sg(this))}this._continuity.hasCompleteFrame&&"steady"===this._continuity.state&&this._continuity.refreshCompleteFrame(this._visualFrameFingerprint()),this._captureRenderDeviceSnapshot()}updated(){this._summary?.updated(),this._liveRt?.commit(),this._editorRuntime?._commitLiveEditor(),this._pruneDevicePressFeedback(),this._syncDayCycleClock(),this._syncRadarLive(),this._warmSnapshot(),this._editorRuntime&&this._dtMeasure();const e=this._stageEl;e&&!this._roViewport&&(this._roViewport=new ResizeObserver(()=>{this._invalidateDeviceHitGeometry(),this._refitView(),requestAnimationFrame(()=>this._summary?.resized())}),this._roViewport.observe(e)),e&&this._booting&&!this._bootTimer&&this._bootWatch();const t=this.renderRoot.querySelector(".hdr");if(t&&e&&!this._roHdr){const i=()=>{const t=Jg(this.renderRoot,e,this.panelHost);null!==t&&(t>=0&&t!==this._hdrH&&(this._hdrH=t),t>=0&&!this._booting&&!this._config?.kiosk&&e.clientHeight>0&&this._warmPatch({hdrH:t,stageH:e.clientHeight}))};this._roHdr=new ResizeObserver(()=>requestAnimationFrame(i)),this._roHdr.observe(t),this._onWinResize=()=>requestAnimationFrame(i),window.addEventListener("resize",this._onWinResize),i()}if(e&&!this._view&&this._refitView(),this._editorSecondary?.afterRender(),this._settleContinuityFrame(),this._serverStorage&&this._loadOk&&this._canManageConfiguration&&0===this._model.length&&!this._spaceDialog&&!this._importDialog&&!this._onboardingShown){this._onboardingShown=!0;const e=function(e){const t=e?.floors;if(!t||"object"!=typeof t)return[];const i=[];for(const e of Object.values(t))e&&e.floor_id&&i.push({id:e.floor_id,name:e.name||e.floor_id,level:e.level??null});return i.sort((e,t)=>{const i=e.level??1e9,n=t.level??1e9;return i!==n?i-n:e.name.localeCompare(t.name)}),i}(this.hass);e.length?this._importDialog={floors:e.map(e=>({...e,checked:!0}))}:this._openSpaceDialog("create")}}_adoptConfigCapabilities(e){wg(this,e)}_syncRadarLive(){const e=this._serverCfg?.settings?.radar,t=(this._serverCfg?.markers||[]).some(e=>Mg(e,this._space));this._radarLive.sync(this._space,1===this._haRadarStage1Api&&"view"===this._mode&&!1!==e?.show_live&&t&&"hidden"!==this.ownerDocument.visibilityState)}async _syncDecorAssets(e){const t=++this._decorAssetSyncToken;if(1!==this._haDecorAssetsApi||!this.hass)return void(this._decorAssets=new Map);const i=await hm(this.hass,am(e),this._cfgRev);t===this._decorAssetSyncToken&&(this._decorAssets=i,this._resign(),this.requestUpdate())}_adoptAuthoritative(e){return Bu(this,e)}_rollbackOptimistic(e){const t=this._adoption.rollbackOptimistic(e);return t&&this.requestUpdate(),t}_resumePendingNavMode(){if(!this._pendingNavMode||!this._canEdit||this._config?.kiosk)return!1;const e=this._pendingNavMode;return this._pendingNavMode=null,this._setMode(e,!1),!0}_getAuthoritativeConfig(){return e=this,async function(e,t){const i=await e();return t(i),i}(()=>e.hass.callWS({type:"houseplan/config/get"}),t=>wg(e,t));var e}async _loadFromServer(){this._loading=!0,this._loadTries++;const e=this._space,t=!!this._view;let i=!1;const n=()=>{i=!0,this._regSignature="",this._maybeRebuildDevices()};try{const[i,r]=await Promise.all([this._getAuthoritativeConfig(),this.hass.callWS({type:"houseplan/layout/get"})]);if("adopted"!==(await this._adoptAuthoritative({cfgResp:i,layResp:r,reason:"structural-response",profile:"reload",beforeAdopt:()=>{this._connectionWasLost=!1,this._serverStorage=!0},afterAdopt:()=>{this._warmVpArmed&&this._space===this._warmVp?.space?this._warmVpArmed=!1:t&&this._space===e||this._restoreZoom(),this._loadOk=!0,n()}})).status)return;this.hass.callWS({type:"houseplan/trail/get"}).then(e=>{this._vacSrvTrails=e?.trails||{},this.requestUpdate()}).catch(()=>{}),this._ensureLiveSyncSubscriptions()}catch(e){if(this._serverCfg)this._scheduleLoadRetry(!0);else if(this._loadTries>=8){this._serverStorage=!1;try{this._layout=JSON.parse(localStorage.getItem(sv)||"{}")||{}}catch{this._layout={}}}}finally{this._loading=!1,this._continuityDataReady=!0,i||n(),this.requestUpdate()}}_ensureLiveSyncSubscriptions(){const e=this.hass?.connection;if(!e)return;if(e!==this._liveSyncConnection&&(this._unsubCfg?.(),this._unsubCfg=null,this._unsubLayout?.(),this._unsubLayout=null,this._unsubTrail?.(),this._unsubTrail=void 0,this._unsubVirtual?.(),this._unsubVirtual=null,this._liveSyncGeneration++,this._liveSyncAttempt=null,this._liveSyncConnection=e),this._liveSyncAttempt)return;const t=this._liveSyncGeneration,i=[],n=(n,r,o,s)=>{n()||i.push(async()=>{const i=await e.subscribeEvents(s,o);t===this._liveSyncGeneration&&this.isConnected&&this.hass?.connection===e&&!n()?r(i):i?.()})};if(n(()=>this._unsubCfg,e=>{this._unsubCfg=e},"houseplan_config_updated",e=>{const t=Number(e?.data?.rev??-1);t!==this._cfgRev&&this._reloadConfigOnly(!1,t)}),n(()=>this._unsubTrail,e=>{this._unsubTrail=e},"houseplan_trail_updated",async()=>{try{const e=await this.hass.callWS({type:"houseplan/trail/get"});this._vacSrvTrails=e?.trails||{},this.requestUpdate()}catch{}}),n(()=>this._unsubLayout,e=>{this._unsubLayout=e},"houseplan_layout_updated",e=>this._onLayoutEvent(Number(e?.data?.rev??-1))),n(()=>this._unsubVirtual,e=>{this._unsubVirtual=e},"houseplan_virtual_light_updated",e=>{const t=qh(this._virtualLights,e?.data);t!==this._virtualLights&&(this._virtualLights=t,this._capturedSnapshotVirtual="",this._cacheSnapshot(),this.requestUpdate())}),!i.length)return;const r=function(e){return Promise.allSettled(e.map(e=>Promise.resolve().then(e)))}(i).then(()=>{});this._liveSyncAttempt=r,r.finally(()=>{this._liveSyncAttempt===r&&(this._liveSyncAttempt=null)})}async _reloadConfigOnly(e=!1,t){return Gu(this,e,t)}_scheduleLoadRetry(e=!1){if(void 0!==this._loadRetryTimer)return;const t=Math.min(8e3,500*2**Math.min(4,Math.max(1,this._loadTries-7)));this._loadRetryTimer=window.setTimeout(()=>{this._loadRetryTimer=void 0,!e&&this._loadOk||this._loading||!this.hass||this._loadFromServer()},t)}async _ensureLiveRuntime(){if(this._liveRt)return;const e=await import("./live-interaction-runtime-rsvGGxyc.js");this._liveRt=new e.LiveRuntime(this),this.isConnected&&this.requestUpdate()}_liveVp(e=!1){this._liveRt?this._liveRt.viewport(e):this.requestUpdate()}_syncLiveHover(){this._liveRt?this._liveRt.hover():this.requestUpdate()}_flushHa(){this._liveRt?.take()&&(this._terminalFrame=2,super.requestUpdate())}_ensureHaRegistryAuthority(){const e=this.hass?.connection||null;e&&e!==this._haRegistryConnection&&(this._haRegistryRelease?.(),this._haRegistryConnection=e,this._haRegistryRev=-1,this._haBindingCacheKey="",this._renderLife.invalidate(),this._areaSnapshotCleanupCandidates.clear(),this._planHassMemo=null,this._haRegistryRelease=Qh(this.hass,this._onHaRegistryUpdate),this._onHaRegistryUpdate())}get _haRegistry(){return td(this.hass)}get _planHass(){const e=this._haRegistry,t=nd(this.hass,e),i=this._planHassMemo;if(i&&i.hass===this.hass&&i.sig===t)return i.active;const n=od(this.hass,e),r=sd(this.hass,e);return this._planHassMemo={hass:this.hass,sig:t,active:n,full:r},n}_captureRenderDeviceSnapshot(){if(!this.hass)return;const e=Date.now(),t=[...this._activityRt.entries()].map(([t,i])=>`${t}:${i.gen}:${i.flashTs}:`+(i.flashKind&&(i.expiresAt||i.flashTs+Qm)>e?1:0)).join("|"),i=Hh(this._virtualLights);if(this._capturedSnapshotSequence===this._hassSequence&&this._capturedSnapshotDevices===this._devices&&this._capturedSnapshotLayout===this._layout&&this._capturedSnapshotConfigEpoch===this._cfgEpoch&&this._capturedSnapshotVirtual===i&&this._capturedSnapshotActivity===t)return;const n=this._planHass,r=new Map,o=new Map,s=new Set(["sun.sun"]);for(const e of this._summary?.entityIds()||[])s.add(e);this._vacFit?.source&&s.add(this._vacFit.source);const a=new Set,l=new Set,c=e=>{if(!e)return;const t=e.indexOf(":");if(t<0)return void s.add(e);const i=e.slice(0,t),n=e.slice(t+1);"device"===i?a.add(n):"entity"===i&&s.add(n)};for(const e of this._model)for(const t of e.rooms)t.area&&l.add(t.area),c(t.settings?.temp_source),c(t.settings?.hum_source);for(const e of this._serverCfg?.spaces||[])for(const t of e.openings||[])for(const e of ui(t))s.add(e);for(const e of this._serverCfg?.spaces||[])for(const t of e.decor||[])if("text"===t.kind){for(const e of String(t.text||"").matchAll(/\{([^{}\r\n]+)\}/g)){const t=Ki(e[1]);t?.entity&&s.add(t.entity)}t.entity&&s.add(t.entity),o.set(`decor:${e.id}:${t.id}`,Qi(t.text,t,n,e=>!!n.entities?.[e]&&!!n.states?.[e]&&!Xd(n,e,Yd(this._markers))))}const h=Id(n,this._devices,null,this._virtualLights);for(const e of this._devices){for(const t of[!1,!0])r.set(m_(e.id,t),d_(n,e,{liveStates:!1!==this._config?.live_states,showTemperature:!1!==this._config?.show_temperature,showSignal:t,activityRuntime:this._activityRt.get(e.id),sourceDetails:!1,lightDevices:this._devices,lightSources:h,registryHass:this._fullRegistryHass,reducedMotion:this._reducedMotion}));if(this._isVacDev(e)){const t=this._vacSource(e,n),i=t?qc(n?.states?.[t]?.attributes):null,r=this._vacRt.get(e.id),s=sh(e.id,e.marker?.vacuum??null,e.space,t),a=lh({routes:s,observed:ch(s,[t],t=>this._vacObservedMapId(e,t,n)),spaceIds:new Set(this._model.map(e=>e.id))});o.set(`vacuum:${e.id}`,{source:t,telemetry:i,routes:s,resolution:a,mapId:i?this._vacMapId(e,i,n):null,runtime:r?{trail:r.trail,lastTs:r.lastTs,moving:r.moving,jump:r.jump}:null,server:this._vacSrvTrails[e.id]||null})}}const d=__({sourceSequence:this._hassSequence,hass:n,devices:this._devices,presentations:r,positions:(u=this._model.length>0,p=this._devices,_=e=>this._livePos(e),u?new Map(p.map(e=>[e.id,_(e)])):new Map),facts:o,entityIds:s,deviceIds:a,areaIds:l});var u,p,_;this._capturedSnapshotSequence=this._hassSequence,this._capturedSnapshotDevices=this._devices,this._capturedSnapshotLayout=this._layout,this._capturedSnapshotActivity=t,this._capturedSnapshotConfigEpoch=this._cfgEpoch,this._capturedSnapshotVirtual=i,this._visibleDeviceSnapshot&&"steady"!==this._continuity.state?this._candidateDeviceSnapshot=d:(this._visibleDeviceSnapshot=d,this._candidateDeviceSnapshot=null)}get _renderDeviceSnapshot(){return this._stagedDeviceSnapshotToken===this._continuity.token?this._candidateDeviceSnapshot||this._visibleDeviceSnapshot:this._visibleDeviceSnapshot||this._candidateDeviceSnapshot}get _renderPlanHass(){return this._renderDeviceSnapshot?.hass||this._planHass}get _renderDevices(){return this._renderDeviceSnapshot?.devices||this._devices}get _renderVacuumDevices(){return this._renderDeviceSnapshot?.vacuumDevices||this._devices}get _fullRegistryHass(){return this._planHass,this._planHassMemo?.full||this.hass}_bindingStatus(e){return cd(this.hass,e,this._haRegistry)}houseplanDiagnostics(){const{registry:e,bindings:t}=this._renderLife.diagnostics(this.hass,this._markers,e=>this._bindingStatus(e));return{registry:{...e,lastSuccessAgeMs:e.lastSuccess?Math.max(0,Date.now()-e.lastSuccess):null},bindings:t}}_openBindingInHa(e){const[t,i]=e.split(":");if(i)if("device"!==t){if("entity"===t){const e=this._fullRegistryHass.entities?.[i];e?.device_id&&mv("/config/devices/device/"+encodeURIComponent(e.device_id))}}else mv("/config/devices/device/"+encodeURIComponent(i))}_bindingHasHaPage(e){const[t,i]=e.split(":");return!!i&&("device"===t||"entity"===t&&!!this._fullRegistryHass.entities?.[i]?.device_id)}_toggleMarkerDialogVisibility(){const e=this._markerDialog;if(!e)return;const t="ha"===e.bindingMode?this._bindingStatus(e.binding):null,i=e.hideFromPlan||"ha_disabled"===t?.kind;i&&"ha_disabled"===t?.kind?this._showToast(this._t("entity"===t.reason?"toast.ha_disabled_show_entity":"toast.ha_disabled_show_device")):i&&"unverified"===t?.kind?this._showToast(this._t("toast.ha_binding_unverified")):this._markerDialog={...e,hideFromPlan:!i}}_hookConnection(){const e=this.hass?.connection;e&&e!==this._connHooked&&(this._connHooked?.removeEventListener?.("ready",this._onConnReady),this._connHooked?.removeEventListener?.("disconnected",this._onConnLost),this._connHooked?.removeEventListener?.("reconnect-error",this._onConnLost),e.addEventListener?.("ready",this._onConnReady),e.addEventListener?.("disconnected",this._onConnLost),e.addEventListener?.("reconnect-error",this._onConnLost),this._connHooked=e)}_display(e){return this._signer.display(this.hass,e)}_referencedContentUrls(){const e=On(this._serverCfg);for(const t of this._decorAssets.values())e.add(t.url);return e}_resign(){this._signer.resign(this.hass,this._referencedContentUrls())}_onLayoutEvent(e){e<=this._layoutRev||(clearTimeout(this._layoutSyncTimer),this._layoutSyncTimer=window.setTimeout(()=>{e<=this._layoutRev||this._reloadLayoutOnly()},200))}_noteLayoutRev(e){this._adoption.noteLayoutRevision(e?.rev)}async _reloadLayoutOnly(){if(!this._serverStorage||!this.hass?.callWS)return;this._beginContinuityCandidate("layout-reload",!1);const e=new Map;for(const t of this._dirtyPos)this._layout[t]&&e.set(t,this._layout[t]);this._persistLayout.pending()&&this._persistLayout.flush();for(const[t,i]of this._sentPos)e.set(t,i);try{const t=await this.hass.callWS({type:"houseplan/layout/get"}),i={...t?.layout||{}};for(const[t,n]of e)null===n?delete i[t]:i[t]=n;this._adoption.adoptMergedLayout(i,t,()=>{this._cancelDeviceDrag(),this._devicePositionHistory.clear()}),this._canOptimizeUndo=!!t?.can_optimize_undo,this._undoKind=t?.undo_kind||null,this._cacheSnapshot(),this.requestUpdate()}catch{}finally{this._continuityDataReady=!0,this.requestUpdate()}}_persistLocalLayout(){this._layout=yo(no(this._layout)),localStorage.setItem(sv,JSON.stringify(this._layout))}_maybeRebuildDevices(){const e=this.hass;if(!e?.devices||!e?.entities||!e?.areas)return;const t=this._haRegistry,i=nd(e,t)+":"+Object.keys(e.areas).length+":"+(this._norm?"n":"l")+":"+bp(e,this._config?.language);if(i===this._regSignature&&this._devices.length)return;this._regSignature=i;const n=new Map(this._devices.map(e=>[e.id,e.bindingStatus?.kind||"active"]));this._devices=eu({hass:e,registry:t,areaToSpace:Object.fromEntries(Object.entries(this._areaToSpace).map(([e,t])=>[e,t.space])),markers:this._markers,settings:this._settings,excluded:this._excluded,showAll:this._showAll,firstSpaceId:this._model[0]?.id||"",loc:e=>this._t(e),iconRules:this._iconRules});const r=this._markers.filter(e=>!e.removed&&"virtual"!==e.binding).map(e=>e.binding).sort(),o=t.revision+":"+r.join("|");if(t.authoritative&&o!==this._haBindingCacheKey){const i=new Map;for(const n of r)i.set(n,cd(e,n,t));!function(e){if("undefined"==typeof localStorage||!e.size)return;const t=ld(),i=Date.now();for(const[n,r]of e)"active"===r.kind?t[n]={kind:"active",ts:i}:"ha_disabled"===r.kind&&(t[n]={kind:"ha_disabled",reason:r.reason,ts:i});const n=Object.fromEntries(Object.entries(t).sort((e,t)=>t[1].ts-e[1].ts).slice(0,1500));Vh=n;try{localStorage.setItem(Gh,JSON.stringify(n))}catch{}}(i),this._haBindingCacheKey=o}let s=null;if(t.authoritative&&(s=this._resolveAreaRelocations(t),this._areaRelocationIds=new Set(s.relocateIds),this._areaRelocationIds.size)){this._cancelDeviceDrag();const e=this._areaRelocationIds;this._devicePositionHistory.removeWhere(({before:t,after:i})=>e.has(t.deviceId)||e.has(i.deviceId));const t=this._markerDialog;if(t?.devId&&!t.roomTouched&&this._areaRelocationIds.has(t.devId)){const e=this._devices.find(e=>e.id===t.devId);e&&(this._markerDialog={...t,room:e.marker?.room_id?`${e.space}#@${e.marker.room_id}`:e.space&&e.area?`${e.space}#${e.area}`:""})}}this._defPos=this._defaultPositions(),this._syncNewDevices(),this._seedHiddenDevices(),s&&this._syncAreaRelocations(s),this._syncActivityRuntime();const a=new Set(this._devices.filter(e=>!e.hidden).map(e=>e.id));for(const e of this._vacRt.keys())a.has(e)||this._vacRt.delete(e);if(this._infoCard){const e=this._devices.find(e=>e.id===this._infoCard.id);this._infoCard=e&&"ha_disabled"!==e.bindingStatus?.kind?e:null}const l=this._devices.some(e=>"ha_disabled"===e.bindingStatus?.kind&&"ha_disabled"!==n.get(e.id));l&&("ha_disabled"!==this._infoCard?.bindingStatus?.kind&&"ha_disabled"!==this._devices.find(e=>e.id===this._infoCard?.id)?.bindingStatus?.kind||this._closeInfoCard(),this._deviceDrag&&"ha_disabled"===this._devices.find(e=>e.id===this._deviceDrag.id)?.bindingStatus?.kind&&(this._cancelDeviceDrag(),this._devicePositionHistory.clear()),clearTimeout(this._holdTimer),this._holdFired=!1,this._tip=null,this._tapConfirm=null),this._nativeMoreInfoEntity&&!this._planEntityAvailable(this._nativeMoreInfoEntity)&&(_v(this,"hass-more-info",{entityId:null}),this._nativeMoreInfoEntity=null)}_resolveAreaRelocations(e=this._haRegistry){const t=function(e){const t=Z_(e.snapshot),i=new Set(Object.values(t).map(e=>e.binding)),n=new Map;for(const[t,r]of e.previousCandidates||[])X_(t)&&Number.isFinite(r)&&i.has(t)&&n.set(t,r);const r=new Set,o=new Set;for(const t of e.markers||[])t.removed||(Y_(t.id)&&r.add(t.id),X_(t.binding)&&o.add(t.binding));const s=new Set(Object.keys(e.registryDevices||{})),a=new Set(Object.keys(e.registryEntities||{})),l=new Set(Object.keys(e.liveStates||{})),c=new Map;for(const[e,i]of Object.entries(t)){const t=c.get(i.binding)||[];t.push(e),c.set(i.binding,t)}const h=new Set;let d=!1;for(const[t,i]of c){const[c,u]=im(t);if(o.has(t)||i.some(e=>r.has(e))||("device"===c?s.has(u):a.has(u)||l.has(u))){n.delete(t);continue}const p="device"===c?s.size>0:a.size>0;if(!e.authoritative||!p)continue;const _=n.get(t);if(void 0!==_){if(_!==e.revision)for(const e of i)h.add(e)}else n.set(t,e.revision),d=!0}return{removeIds:h,candidates:n,needsConfirmationRefresh:d}}({snapshot:this._settings.marker_area_snapshot,authoritative:e.authoritative,revision:e.revision,registryDevices:e.devices,registryEntities:e.entities,liveStates:this.hass?.states,markers:this._markers,previousCandidates:this._areaSnapshotCleanupCandidates});return this._areaSnapshotCleanupCandidates=t.candidates,t.needsConfirmationRefresh&&this._canEdit&&ed(this.hass),nm({devices:this._devices,model:this._model,layout:this._layout,snapshot:this._settings.marker_area_snapshot,authoritative:e.authoritative,cleanupSnapshotIds:t.removeIds,coordinateScale:uv})}_syncNewDevices(){if(!this._norm||!this._loadOk||!this._serverCfg)return;const e=this._devices.filter(e=>!e.marker&&!e.virtual).map(e=>e.id).sort(),t=e.join(",");if(t===this._newSyncKey)return;this._newSyncKey=t;const i=this._settings,{fresh:n,known:r}=function(e,t){if(!Array.isArray(t))return{fresh:[],known:[...e]};const i=new Set(t),n=e.filter(e=>!i.has(e));return{fresh:n,known:n.length?[...t,...n]:t}}(e,i.known_devices);if(!Array.isArray(i.known_devices)||n.length){const e=[...new Set([...i.new_device_ids||[],...n])];this._serverCfg={...this._serverCfg,settings:{...i,known_devices:r,new_device_ids:e}},this._saveConfig()}}_syncAreaRelocations(e){if(!(this._loadOk&&this._serverCfg&&this._norm&&this._canEdit&&this._haRegistry.authoritative))return;const t=e.decisions.filter(e=>e.updateSnapshot||e.removeSnapshot);if(!t.length)return;const i=ac({snapshot:Z_(this._settings.marker_area_snapshot),decisions:t});i!==this._areaRelocationSyncKey&&(this._areaRelocationSyncKey=i,this._areaRelocationWrite=this._areaRelocationWrite.catch(()=>{}).then(async()=>{if(!this._serverCfg||!this._haRegistry.authoritative)return;const e=this._resolveAreaRelocations();this._areaRelocationIds=new Set(e.relocateIds);const t=new Set,i=new Map;let n=!1;for(const r of e.decisions){if(!r.relocate)continue;const e=mg(this._layout,r.id);try{await this._persistDevicePlacement(r.id,null),t.add(r.id),e&&i.set(r.id,e),this._areaRelocationIds.delete(r.id)}catch(t){n=!0,this._layout=gg(this._layout,r.id,e),this._showToast(this._t("toast.pos_save_failed",{err:this._errText(t)}))}}const r=this._settings,o=function(e,t,i=new Set){const n=Z_(e);for(const e of t.decisions)e.removeSnapshot?delete n[e.id]:e.updateSnapshot&&e.binding&&e.area&&(e.relocate&&!i.has(e.id)||(n[e.id]={binding:e.binding,area:e.area}));return n}(r.marker_area_snapshot,e,t),s=[...new Set([...Array.isArray(r.new_device_ids)?r.new_device_ids:[],...t])],a=ac(o)!==ac(Z_(r.marker_area_snapshot)),l=ac(s)!==ac(Array.isArray(r.new_device_ids)?r.new_device_ids:[]);if(a||l){const e=r.marker_area_snapshot,n=r.new_device_ids,a={...this._serverCfg,settings:{...r,marker_area_snapshot:o,...l?{new_device_ids:s}:{}}};this._setAreaLifecycleConfig(a);try{this._saveConfigDebounced.pending()&&this._saveConfigDebounced.cancel(),await this._writeConfig()}catch(r){const a=this._settings;if(ac(a.marker_area_snapshot)===ac(o)&&ac(a.new_device_ids)===ac(l?s:n)){const t={...a};void 0===e?delete t.marker_area_snapshot:t.marker_area_snapshot=e,void 0===n?delete t.new_device_ids:t.new_device_ids=n;const i={...this._serverCfg,settings:t};this._setAreaLifecycleConfig(i),this._adoption.refreshConfigFingerprint()}for(const e of t)this._areaRelocationIds.add(e);const c=new Set;for(const[e,t]of i)try{await this._persistDevicePlacement(e,t)}catch(t){c.add(e),this._showToast(this._t("toast.pos_save_failed",{err:this._errText(t)}))}this._areaRelocationSyncKey="",this._regSignature="";if("conflict"===(r&&"object"==typeof r&&"code"in r?r.code:void 0)?(this._showToast(this._t("toast.conflict")),await this._reloadConfigOnly(!0)):this._showToast(this._t("toast.cfg_save_failed",{err:this._errText(r)})),c.size&&this._serverCfg){const e=this._settings,t=[...new Set([...Array.isArray(e.new_device_ids)?e.new_device_ids:[],...c])],i={...this._serverCfg,settings:{...e,new_device_ids:t}};this._setAreaLifecycleConfig(i);try{await this._writeConfig()}catch(e){this._showToast(this._t("toast.cfg_save_failed",{err:this._errText(e)}))}}}}n&&(this._areaRelocationSyncKey=""),this.requestUpdate()}))}get _newIds(){const e=this._settings.new_device_ids;return new Set([...Array.isArray(e)?e:[],...this._areaRelocationIds])}_ackNewDevice(e){if(!this._newIds.has(e)||!this._serverCfg)return;const t=this._settings;this._serverCfg={...this._serverCfg,settings:{...t,new_device_ids:(t.new_device_ids||[]).filter(t=>t!==e)}},this._saveConfig(),this.requestUpdate()}get _markers(){return this._serverCfg?.markers||[]}_roomLqi(e){if(!e)return null;const t=[];for(const i of this._renderDevices){if(i.area!==e||i.virtual)continue;const n=Nd(this._renderPlanHass,i.entities);null!=n&&t.push(n)}return Ii(t)}_roomBounds(e){if(e.poly&&e.poly.length){const t=e.poly.map(e=>e[0]),i=e.poly.map(e=>e[1]),n=Math.min(...t),r=Math.min(...i);return{x:n,y:r,w:Math.max(...t)-n,h:Math.max(...i)-r}}return{x:e.x??0,y:e.y??0,w:e.w??0,h:e.h??0}}_defaultPositions(){const e={},t=this._config?.icon_size??2.5;for(const i of this._model){const n=t/100*wl(i)*1.3;for(const t of i.rooms){if(!t.area)continue;const r=this._devices.filter(e=>e.area===t.area&&e.space===i.id);if(!r.length)continue;const o=this._roomBounds(t),s=.1*Math.min(o.w,o.h),a=o.w-2*s,l=o.h-2*s,c=Math.max(1,Math.round(Math.sqrt(r.length*a/Math.max(l,1)))),h=Math.ceil(r.length/c),d=a/c,u=l/Math.max(h,1),p=r.map((e,t)=>({x:o.x+s+d*(t%c+.5),y:o.y+s+u*(Math.floor(t/c)+.5)}));Ei(p,o,n,.5*s),r.forEach((t,i)=>e[t.id]=il(p[i]))}}return e}_pos(e){const t=this._renderDeviceSnapshot?.positions.get(e.id);return t?{x:t.x,y:t.y}:this._livePos(e)}_livePos(e){const t=this._spaceModelById(e.space),i=this._areaRelocationIds.has(e.id)?void 0:this._layout[e.id];if(i)if(this._norm){if(i.s===e.space)return{x:i.x*uv,y:i.y*uv}}else if(void 0===i.s)return{x:i.x,y:i.y};return this._defPos[e.id]?this._defPos[e.id]:t?il(bl(t)):{x:500,y:500}}_devicePlacementForCanvas(e,t,i){if(!this._norm)return{x:Math.round(t),y:Math.round(i)};const n=this._gridPitch,r=Math.round(t/n)*n,o=Math.round(i/n)*n;return{s:e.space,x:rl(r/uv),y:rl(o/uv)}}_previewDevicePlacement(e,t){this._layout=gg(this._layout,e,t),this.requestUpdate()}_cancelDeviceDrag(){const e=this._deviceDrag;if(!e)return!1;this._editorRuntime?._cancelPointerMove("device"),this._deviceDrag=null,this._deviceHits.cancel(e.pointerId);try{e.source?.hasPointerCapture?.(e.pointerId)&&e.source.releasePointerCapture(e.pointerId)}catch{}return this._previewDevicePlacement(e.id,e.before),!0}async _persistDevicePlacement(e,t){if(this._layout=gg(this._layout,e,t),this._serverStorage){let i=null,n=!1;try{let r;if(null===t)i=null,this._sentPos.set(e,i),n=!0,r=await this.hass.callWS({type:"houseplan/layout/delete",device_id:e});else{const t=vo(this._layout[e]);ac(t)!==ac(this._layout[e])&&(this._layout={...this._layout,[e]:t}),i=t,this._sentPos.set(e,i),n=!0,r=await this.hass.callWS({type:"houseplan/layout/update",device_id:e,pos:t})}this._noteLayoutRev(r),this._adoption.refreshLayoutFingerprint(),this._cacheSnapshot()}finally{n&&this._sentPos.get(e)===i&&this._sentPos.delete(e)}return}this._persistLocalLayout()}_devicePositionStateValid(e){const t=this._devices.find(t=>t.id===e.deviceId);return!!t&&t.space===e.spaceId&&"ha_disabled"!==t.bindingStatus?.kind&&!!this._spaceModelById(e.spaceId)}async _runDevicePositionHistory(e){if(this._cancelDeviceDrag()||this._devicePositionBusy)return;const t="undo"===e?this._devicePositionHistory.undo():this._devicePositionHistory.redo();if(!t)return;const i="undo"===e?t.before:t.after;if(!this._devicePositionStateValid(i))return this._devicePositionHistory.clear(),this._showToast(this._t("history.device_stale")),void this.requestUpdate();const n=mg(this._layout,i.deviceId);i.spaceId!==this._space&&(this._commitSpace(i.spaceId),this._restoreZoom()),this._devicePositionBusy=!0,this._previewDevicePlacement(i.deviceId,i.placement);try{await this._persistDevicePlacement(i.deviceId,i.placement),this._showToast(this._t("undo"===e?"history.undone":"history.redone",{name:t.name}))}catch(t){this._previewDevicePlacement(i.deviceId,n),"undo"===e?this._devicePositionHistory.redo():this._devicePositionHistory.undo(),this._showToast(this._t("toast.pos_save_failed",{err:this._errText(t)}))}finally{this._devicePositionBusy=!1,this.requestUpdate()}}_undoDevicePosition(){this._runDevicePositionHistory("undo")}_redoDevicePosition(){this._runDevicePositionHistory("redo")}_savePos(e,t,i){this._spaceModelById(e.space)&&(this._layout=gg(this._layout,e.id,this._devicePlacementForCanvas(e,t,i)),this._dirtyPos.add(e.id),this._persistLayout())}_devicePresentation(e,t=!1!==this._config?.show_signal,i=!1){const n=i?null:this._renderDeviceSnapshot?.presentations.get(m_(e.id,t));return n||d_(this._renderPlanHass,e,{liveStates:!1!==this._config?.live_states,showTemperature:!1!==this._config?.show_temperature,showSignal:t,designPreview:i,activityRuntime:this._activityRt.get(e.id),sourceDetails:!1,lightDevices:this._renderDevices,registryHass:this._fullRegistryHass,reducedMotion:this._reducedMotion})}_deviceVisual(e){return this._devicePresentation(e).visual}_stateClass(e,t=this._deviceVisual(e)){const i=this._devicePresentation(e);return i.effectiveHidden?"":("icon_ripple"!==i.display||!1===this._config?.live_states||"alarm"===t.status||t.activity,h_({...i,visual:t}).join(" "))}_liveTemp(e){if(!this._config?.show_temperature)return null;if(!0===e.marker?.use_climate_temp){const t=Ld(this._renderPlanHass,e.entities);if(null!=t)return t}return"mdi:thermometer"!==e.icon&&"mdi:air-filter"!==e.icon?null:Hd(this._renderPlanHass,e.entities)}_bindingEntities(e){if("virtual"===e||!e)return[];const t=this._bindingStatus(e);return"active"===t.kind?t.enabledEntityIds:t.allEntityIds}_bindingHasClimate(e){return this._bindingEntities(e).some(e=>e.startsWith("climate."))}_bindingHasAlarm(e){return this._bindingEntities(e).some(e=>{const t=this._planHass?.states?.[e]||this.hass?.states?.[e],i=this._fullRegistryHass.entities[e]||this.hass?.entities?.[e];return Vn(e.split(".")[0],t?.attributes?.device_class||i?.device_class||i?.original_device_class)})}_deviceBindingActive(e,t=!0){if(e.virtual||"virtual"===e.bindingKind)return!0;if(!e.bindingKind||!e.bindingRef)return!1;const i=this._bindingStatus(`${e.bindingKind}:${e.bindingRef}`);return"active"===i.kind||(t&&this._showToast(this._t("ha_disabled"===i.kind?"toast.ha_disabled_action":"toast.ha_binding_unverified")),!1)}_openMoreInfo(e){e?this._planEntityAvailable(e)?(this._kiosk&&(this._cyclePausedUntil=Math.max(this._cyclePausedUntil,Date.now()+6e4)),this._nativeMoreInfoEntity=e,_v(this,"hass-more-info",{entityId:e})):this._showToast(this._t("toast.ha_disabled_action")):this._showToast(this._t("toast.no_entity"))}_interruptViewGesture(e,t){if(clearTimeout(this._holdTimer),clearTimeout(this._kioskHoldTimer),void 0!==e)for(const i of[t,this._stageEl])try{i?.hasPointerCapture?.(e)&&i.releasePointerCapture(e)}catch{}this._pointers.clear(),this._panStart=null,this._panLock=null,this._pinchStart=null,this._swipeStart=null,this._roomPointer=null,this._doubleFit.clear(),this._deviceHits.clearPointers()}_closeInfoCard(){this._interruptViewGesture(),this._holdFired=!1,this._infoCard=null}_invalidateDeviceHitGeometry(){this._deviceHits.invalidate()}_resetDeviceHitState(){this._deviceHits.reset(this.renderRoot)}_deviceHitOwnerAt(e,t){return"view"!==this._mode&&"devices"!==this._mode?null:this._deviceHits.at(this.renderRoot,this._renderDevices,this._space,e,t)}_deviceForPointerEvent(e,t){return this._deviceHits.pointer(this.renderRoot,this._renderDevices,this._space,e,t)}_deviceForClickEvent(e,t){return this._deviceHits.click(this.renderRoot,this._renderDevices,this._space,e,t)}_showDeviceTip(e,t){this._liveRt?this._liveRt.devicePointerTip(e,t):this._ensureLiveRuntime().then(()=>this._liveRt?.devicePointerTip(e,t))}_showDeviceFocusTip(e,t){const i=e.currentTarget;this._liveRt?this._liveRt.deviceFocusTip(i,t):this._ensureLiveRuntime().then(()=>this._liveRt?.deviceFocusTip(i,t))}_hideDeviceFocusTip(e){this._liveRt?.deviceBlur(e)}_clearPointerHover(){this._liveRt?this._liveRt.pointerLeave():this._clearTransientHover()}_ctxDevice(e,t){"view"===this._mode&&(t=this._deviceForPointerEvent(e,t),e.preventDefault(),e.stopPropagation(),this._deviceBindingActive(t)&&(t.primary?this._openMoreInfo(t.primary):this._infoCard=t))}_clickDevice(e,t){if("view"!==this._mode&&"devices"!==this._mode)return;if(e.stopPropagation(),t=this._deviceForClickEvent(e,t),this._deviceDrag?.moved||this._suppressClick||this._holdFired)return;if("devices"===this._mode)return void this._openMarkerDialog(t);const i=this._devices.find(e=>e.id===t.id);if(!i)return;const n=Ru(i.tapAction,i.primary?.split(".")[0]);if("none"===n)return;const r=(e,t)=>{i.marker?.tap_confirm?this._tapConfirm={kind:"run",text:e,exec:t}:t()};if("toggle"===n){const e=this._toggleIntent(i);if(!e)return;if(!Fu(e))return void this._showUnavailableToggleTargets(e);const t=e=>{const t=Fu(e);if(!t)return;if("virtual-light"===t.kind)return this._startDevicePressFeedback(i.id),void this.hass.callWS({type:"houseplan/virtual_light/toggle",marker_id:t.markerId}).then(e=>{const t=qh(this._virtualLights,e);t!==this._virtualLights&&(this._virtualLights=t,this._capturedSnapshotVirtual="",this._cacheSnapshot(),this.requestUpdate())}).catch(e=>this._showToast(this._t("toast.virtual_light_toggle_failed",{err:this._errText(e)})));const{command:n}=t;this._startDevicePressFeedback(i.id),this.hass.callService(n.domain,n.service,n.data).catch(e=>this._showToast(this._t("toast.error",{err:this._errText(e)})))},n=((o=e).targets.length?o.targets:o.skippedTargets).map(e=>e.name||e.entityId||e.ref).join(", ")||i.name;if(i.marker?.tap_confirm){const r=this._toggleConfirmationLines(e);if(!r.length)return;this._tapConfirm={kind:"toggle",text:this._t("confirm.tap_toggle",{name:n}),lines:r,initialIntent:e,deviceId:i.id,exec:()=>{const n=this._devices.find(e=>e.id===i.id),r=n?this._toggleIntent(n):null;r&&!Fu(r)&&this._showUnavailableToggleTargets(r)||(r&&Iu(e,r)?t(r):this._showToast(this._t("toast.tap_target_changed")))}}}else t(e);return}var o;if("info"===n)return this._interruptViewGesture(),void(this._infoCard=i);if(this._deviceBindingActive(i)){if("run"===n){const e=i.marker?.tap_target||"",t=function(e){const t=String(e||"").split(".")[0];return"automation"===t?{domain:"automation",service:"trigger"}:"script"===t?{domain:"script",service:"turn_on"}:"scene"===t?{domain:"scene",service:"turn_on"}:null}(e),n=this.hass.states[e];if(!t||!n)return void this._showToast(this._t("toast.run_target_missing"));const o=n.attributes?.friendly_name||e;return void r(this._t("confirm.tap_run",{name:o}),()=>{this._deviceBindingActive(i)&&this._planEntityAvailable(e)&&(this._startDevicePressFeedback(i.id),this.hass.callService(t.domain,t.service,{entity_id:e}).then(()=>{this._stampActivity(i.id,"event",this._activitySourceKey(i)),this.requestUpdate(),this._showToast(this._t("toast.run_started",{name:o}))}).catch(e=>this._showToast(this._t("toast.error",{err:this._errText(e)}))))})}"more-info"===n&&i.primary?this._openMoreInfo(i.primary):this._infoCard=i}}_showUnavailableToggleTargets(e){const t=function(e){if(!e||"group"!==e.kind||Fu(e)||"configured-targets-missing"!==e.noneReason)return[];if(!e.skippedTargets.length||e.skippedTargets.some(e=>!zu.has(e.reason)&&"secure"!==e.reason))return[];const t=[],i=new Set;for(const n of e.skippedTargets){if(!zu.has(n.reason))continue;const e=String(n.name||n.entityId||n.ref||"").trim();e&&!i.has(e)&&(i.add(e),t.push(e))}return t}(e);return!!t.length&&(this._showToast(1===t.length?this._t("toast.toggle_target_unavailable",{name:t[0]}):this._t("toast.toggle_targets_unavailable",{names:t.join(", ")})),!0)}_keyDevice(e,t){"Enter"!==e.key&&" "!==e.key||"view"!==this._mode&&"devices"!==this._mode||(e.preventDefault(),this._clickDevice(e,t))}_startDevicePressFeedback(e){const t=[...this.renderRoot.querySelectorAll(".dev[data-id]")].find(t=>t.dataset.id===e),i=t?.querySelector(".device-shell");if(!i||"function"!=typeof i.animate)return;const n=Number.parseFloat(this.ownerDocument.defaultView?.getComputedStyle(i).scale||""),r=Number.isFinite(n)?Math.max(.95,Math.min(1,n)):1;this._devicePressAnimations.get(e)?.cancel();const o=this._reducedMotion?[{outlineColor:"transparent",outlineStyle:"solid",outlineWidth:"0px"},{outlineColor:"var(--hp-accent, #3ea6ff)",outlineStyle:"solid",outlineWidth:"2px",outlineOffset:"2px",offset:.5},{outlineColor:"transparent",outlineStyle:"solid",outlineWidth:"0px"}]:[{scale:String(r)},{scale:"0.95",offset:.5},{scale:"1"}],s=i.animate(o,{duration:200,easing:"cubic-bezier(.22,.61,.36,1)"});this._devicePressAnimations.set(e,s);const a=()=>{this._devicePressAnimations.get(e)===s&&this._devicePressAnimations.delete(e)};s.addEventListener("finish",a,{once:!0}),s.addEventListener("cancel",a,{once:!0})}_cancelDevicePressFeedback(){for(const e of this._devicePressAnimations.values())e.cancel();this._devicePressAnimations.clear()}_pruneDevicePressFeedback(){if(!this._devicePressAnimations.size)return;const e=new Set([...this.renderRoot.querySelectorAll(".dev[data-id]")].map(e=>e.dataset.id||""));for(const[t,i]of this._devicePressAnimations)e.has(t)||(i.cancel(),this._devicePressAnimations.delete(t))}_t(e,t){return wp(bp(this.hass,this._config?.language),e,t)}get _colorPickerLabels(){return{title:this._t("color_picker.title"),hue:this._t("color_picker.hue"),saturation:this._t("color_picker.saturation"),value:this._t("color_picker.value"),hex:this._t("color_picker.hex"),invalidHex:this._t("color_picker.invalid_hex"),confirm:this._t("color_picker.confirm")}}_help(e){return this._editorRuntimeOrThrow()._help(e)}get _stageEl(){return this.renderRoot.querySelector(".stage")}_contentItems(e){const t=[];for(const i of this._devices){if(i.space!==e.id||i.hidden)continue;const n=this._pos(i);t.push({minX:n.x,minY:n.y,maxX:n.x,maxY:n.y})}if(e.id===this._space){for(const e of this._openingsR){const i=Number(e.angle)*Math.PI/180,n=Math.cos(i)*e.rlen/2,r=Math.sin(i)*e.rlen/2,o=ll([[e.rx-n,e.ry-r],[e.rx+n,e.ry+r]]);o&&t.push(o)}const i=this._decorH;for(const e of this._decorList){if("image"===e.kind&&!this._decorAssets.has(e.asset_id)&&"decor"!==this._mode)continue;const n=ll("line"===e.kind?[[e.x1*uv,e.y1*i],[e.x2*uv,e.y2*i]]:"text"===e.kind?[[e.x*uv,e.y*i]]:Fr({x:e.x*uv,y:e.y*i,w:e.w*uv,h:e.h*i,angle:e.angle}));n&&t.push(n)}for(const i of this._physicalBodiesR(e)){const e=ll(i);e&&t.push(e)}}return pl(e,t)}_frameOf(){const e=this._spaceModel();if(!e){this._frame=null;const e={x:0,y:0,w:uv,h:uv};return{rect:e,all:e,outliers:0}}const t=this._frame,i="view"!==this._mode;if(t&&t.id===e.id&&this._bdDrag)return t;if(t&&t.id===e.id&&t.model===e&&t.layout===this._layout&&t.devs===this._devices&&t.far===this._showFar&&t.grow===i)return t;const n=fl(this._contentItems(e));let r=n.all||yl(e),o=this._showFar?r:n.core||yl(e);return t&&t.id===e.id&&i&&t.grow&&(o=pv(t.rect,o),r=pv(t.all,r)),this._frame={id:e.id,model:e,layout:this._layout,devs:this._devices,far:this._showFar,grow:i,rect:o,all:r,outliers:n.outliers},this._frame}_isoSource(){const e=this._isoSceneRuntime;if(!e)return null;const t=this._spaceModel();if(!t)return null;const i=this._spaceWalls,n=this._openCuts(),r=this._openingsR;return e.createIsoStructuralSource({space:t,walls:i,openCuts:n,openings:r,partitionCuts:()=>this._partitionOpeningCuts(t),roomOpenings:()=>this._roomWallOpeningInputs(r,t),cellCm:this._cellCm,gridPitch:this._gridPitch,wallKeyPitch:this._wallKeyPitch,coordinateScale:uv,onBuild:()=>{this._isoStructuralBuildCount+=1}})}_isoSceneKey(){if(!this._labsIso||"view"!==this._mode)return null;try{return this._isoSource()?.key??null}catch{return this._isoInvalidKey()}}_isoInvalidKey(){return`${this._space}|invalid|${this._cfgEpoch}`}_clearIsoInvalidFallback(e){const t=`${this._space}|invalid|`;for(const i of this._isoFallback)i.startsWith(t)&&i!==e&&this._isoFallback.delete(i)}_isoScene(e=this._isoSource()){const t=this._isoSceneRuntime;if(!t||!e)return null;let i=this._frameOf().rect;const n=this._spaceDisplayForRender(),r=this._spaceModel();if(r&&n.showNames)for(const e of r.rooms)if(e.name){const t=this._labelPos(e,r.id);i=pv(i,{x:t.x,y:t.y,w:0,h:0})}const o=t.resolveIsoScene({source:e,cache:this._isoGeometryCache,cellCm:this._cellCm,liveFrame:i});if(!r||!n.showBorders)return o;const s=this._config?.icon_size??2.5,a=s>8?2.5:s,l=this._stageEl?.getBoundingClientRect?.()??null,c=l?.height?l.width/l.height:o.frame.w/o.frame.h,h=Oi([o.frame.x,o.frame.y,o.frame.w,o.frame.h],c),d=this._isoOverlayScene(r,this._renderDevices.filter(e=>e.space===r.id&&!e.hidden),h,n,t.resolveIsoDecorationLayers(n),o,a,w_(a),n.showLqi??this._config?.show_signal??!0,!1),u=d&&t.resolveIsoOverlayFitEnvelope({baseBounds:o.frame,entries:d.entries,stageSize:l,targetView:e=>Oi([e.x,e.y,e.w,e.h],c)});return u?{...o,frame:u.bounds,overlayFitEntries:d.entries}:o}_latchIsoFallback(e,t){if(this._isoFallback.has(e))return;this._isoFallback.add(e);const i=e.includes("|invalid|")?"invalid":e.split("|").pop()||"invalid";console.warn("HOUSEPLAN ISO FALLBACK: #89/#160",yf("structural",i,!0))}_effectiveProjection(){if(this._isoProjectionSnapshot)return this._isoProjectionSnapshot;const e=e=>this._isoProjectionSnapshot=e,t=()=>("iso"===this._renderProjection&&(this._cancelCameraTransition(!1),this._view=null,this._viewModeSnap=null),e("flat"));if(this._renderIsoScene=null,"iso"!==this._desiredProjection||!this._model.length||!this._isoSceneRuntime)return e("flat");if(!this._spaceDisplayForRender().showBorders)return this._isoFallback.has(`${this._space}|no-borders`)?t():e("iso");let i=this._isoInvalidKey();if(this._clearIsoInvalidFallback(i),this._isoFallback.has(i))return t();try{const n=this._isoSource();if(!n)return e("flat");if(i=n.key,this._isoFallback.has(i))return t();const r=this._isoScene(n);return r?this._isoFallback.has(r.key)?t():(this._renderIsoScene=r,e("iso")):e("flat")}catch(e){return this._latchIsoFallback(i,e),t()}}_scenePoint(e){return"iso"===this._renderProjection?sf(e,0):e}_floorView(e){if("iso"!==this._renderProjection)return e;const t=af([e.x,e.y]),i=af([e.x+e.w,e.y+e.h]);return{x:t[0],y:t[1],w:i[0]-t[0],h:i[1]-t[1]}}_isoOverlayScene(e,t,i,n,r,o,s,a,l,c=!0){const h=this._isoSceneRuntime;return h&&r?.structural&&o?h.buildIsoOverlayRenderScene({space:e,devices:t,openings:this._openingsR,view:i,display:n,wallSilhouettes:o.wallSilhouettes,resolveCollisions:c,iconPct:s,deviceBasePct:a,showLqi:l,cellCm:this._cellCm,kioskIconScale:"view"===this._mode?this._kioskScale.icon:1,kioskFontScale:"view"===this._mode?this._kioskScale.font:1,stageSize:this._stageEl?.getBoundingClientRect?.(),positionOf:e=>this._pos(e),presentationOf:(e,t)=>this._devicePresentation(e,t),labelPositionOf:(e,t)=>this._labelPos(e,t),labelScaleOf:e=>this._labelScale(e),openingEntityAvailable:e=>this._renderOpeningEntityAvailable(e),openingWallIndex:()=>this._openingWallIndexFor(e,this._openCuts()).value}):null}_baseVb(e=this._effectiveProjection(),t=this._renderIsoScene){if("iso"===e){if(!this._spaceDisplayForRender().showBorders){const e=hf({rect:this._frameOf().rect,wallHeight:0});return[e.x,e.y,e.w,e.h]}const e=t?.frame??this._frameOf().rect;return[e.x,e.y,e.w,e.h]}const i=this._frameOf().rect;return[i.x,i.y,i.w,i.h]}get _outliers(){return this._showFar?0:this._frameOf().outliers}_fitFar(){this._clearRoomFocus(),this._showFar=!0,this._frame=null,this.requestUpdate(),this._resetZoom()}_clearRoomFocus(e=!1){this._doubleFit.clear(),this._roomFocus=null,e&&(this._roomPointer=null)}_roomFitBounds(e,t){const i=ni(e);if(!i||!e.id)return null;const n=this._spaceWalls,r=this._openCuts(),o=this._wallUnionGeometry(),s=n.length&&this._innerRoomContour(t,e.id,r,o?.roomGeom,o?.multiWallNodes)||i,a=this._spaceDisplayForRender();let l=[];if(a.showBorders&&n.length){const i=Cs(t.rooms,e.id,n,r,this._wallKeyPitch,this._cellCm,this._gridPitch,uv);i&&(l=ia(i.poly,i.offsets,o?.multiWallNodes)||i.poly)}const c=this._effectiveProjection();return function(e){const t=e.floor,i=e.wall||[],n=e.padding??0;if(!t.length||!t.every(gf)||!i.every(gf)||!Number.isFinite(n)||n<0)return null;if("flat"===e.projection)return vf([...t,...i],n);const r=e.wallHeight??0,o=e.floorDepth??0;if(!Number.isFinite(r)||r<0||!Number.isFinite(o)||o<0)return null;try{const e=[];for(const i of t){const t=[i[0],i[1]];e.push(sf(t,0)),o>0&&e.push(sf(t,-o))}for(const t of i){const i=[t[0],t[1]];e.push(sf(i,0)),r>0&&e.push(sf(i,r))}return vf(e,n)}catch{return null}}({floor:s,wall:l,projection:c,wallHeight:"iso"===c&&a.showBorders?Ha(84,this._cellCm):0,floorDepth:"iso"===c&&a.showBorders?Ha(10,this._cellCm):0,padding:a.showBorders?Ha(1.25,this._cellCm):0})}_fitRoom(e,t=!0){if("view"!==this._mode)return!1;this._doubleFit.clear();const i=this._spaceModel(),n=i?.rooms.find(t=>t.id===e);if(!i||!n)return this._clearRoomFocus(),!1;let r=this._roomFitBounds(n,i);if(!r)return this._clearRoomFocus(),!1;this._roomFocus={spaceId:i.id,roomId:e};const o=this._stageEl;if(!o||o.clientWidth<=0||o.clientHeight<=0)return!0;const s=Oi(this._baseVb(),o.clientWidth/o.clientHeight),a=e=>function(e){const t=e.safeFraction??.8,{bounds:i,baseFit:n,stageWidth:r,stageHeight:o,minZoom:s,maxZoom:a}=e;if(!ff(i)||!ff(n)||!Number.isFinite(r)||r<=0||!Number.isFinite(o)||o<=0||!Number.isFinite(s)||s<=0||!Number.isFinite(a)||a1)return null;const l=r/o,c=Math.max(i.w/t,i.h/t*l);if(!Number.isFinite(c)||c<=0)return null;const h=Math.min(a,Math.max(s,n.w/c)),d=n.w/h,u=d/l;return{zoom:h,viewBox:{x:i.x+i.w/2-d/2,y:i.y+i.h/2-u/2,w:d,h:u}}}({bounds:e,baseFit:s,stageWidth:o.clientWidth,stageHeight:o.clientHeight,minZoom:yv.ZOOM_MIN,maxZoom:yv.ZOOM_MAX});let l=a(r);const c=this._isoSceneRuntime,h=this._renderIsoScene?.overlayFitEntries;if(l&&"iso"===this._effectiveProjection()&&c&&h?.length){const e=c.resolveIsoOverlayFitEnvelope({baseBounds:r,entries:h,ownerId:n.id,stageSize:{width:o.clientWidth,height:o.clientHeight},targetView:e=>a(e)?.viewBox??null});e&&(r=e.bounds,l=a(r))}if(!l)return this._clearRoomFocus(),!1;const d=this._cameraState(),u=function(e,t,i,n){const r=[e,t,i,n],o=Math.min(...r.map(e=>e.x)),s=Math.min(...r.map(e=>e.y));return{x:o,y:s,w:Math.max(...r.map(e=>e.x+e.w))-o,h:Math.max(...r.map(e=>e.y+e.h))-s}}(s,d.viewBox,l.viewBox,r);return l.viewBox=this._clampView(l.viewBox,u),t?(this._prepareCameraCommand(),this._startCameraTransition(l,u,"room",220),!0):(this._cancelCameraTransition(!1),Kg(d,l)||(this._zoom=l.zoom,this._view={...l.viewBox},this.requestUpdate()),!0)}_fitAll(e="fit"){this._clearRoomFocus(),this._showFar=!0,this._frame=null,this.requestUpdate(),this._resetZoom(e)}_renderFarHint(){return this._kiosk||"view"!==this._mode||this._booting||!this._outliers?G:j`
    ${this._t("canvas.far_objects",{n:this._outliers})} @@ -671,7 +671,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    this._markupClick(e)} @@ -803,7 +803,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae ${this._renderOpeningLocks(S,R?.locks)} ${g.showNames||this._markup?a.rooms.map(e=>this._renderRoomLabel(e,a,S,g,R?.rooms.get(e))):G} ${this._markup?a.rooms.map(e=>this._renderRoomGear(e,a,S)):G} - ${B={hass:this.hass,settings:this._settings,devices:this._renderDevices,registry:this._haRegistry,currentSpace:a.id,spaces:this._serverCfg?.spaces,viewKey:S,view:"view"===this._mode,kiosk:this._kiosk},B.view&&!B.kiosk&&!0===B.hass?.user?.is_admin&&Pg(B.settings).enabled?(import("./hp-zigbee-topology-overlay-CX3rLqEO.js"),j``):G}
    @@ -1092,4 +1092,4 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae 45% · ${this._t("roomcard.light_partial",{on:1,total:3})} -
    `}_renderRoomSource(e){return this._editorRuntimeOrThrow()._renderRoomSource(e)}_renderRoomDialog(){return this._editorRuntimeOrThrow()._renderRoomDialog()}}yv.properties={_tabDrag:{state:!0},_hdrH:{state:!0},_booting:{state:!0},_bootFading:{state:!0},_bootSoft:{state:!0},_continuityEpoch:{state:!0},_editorRuntimeLoadingVisible:{state:!0},_backdropGuard:{state:!0},_tapConfirm:{state:!0},_dangerConfirm:{state:!0},hass:{attribute:!1},panelHost:{type:Boolean,attribute:"panel-host",reflect:!0},narrow:{attribute:!1},_config:{state:!0},_space:{state:!0},_devices:{state:!0},_selId:{state:!0},_toast:{state:!0},_mode:{state:!0},_tool:{state:!0},_wallDialog:{state:!0},_drawWallField:{state:!0},_activeWallChainId:{state:!0},_physicalSel:{state:!0},_physicalDialog:{state:!0},_partitionDeleteDialog:{state:!0},_roomDeleteDialog:{state:!0},_physicalDrag:{state:!0},_physicalRotate:{state:!0},_duplicateColumnId:{state:!0},_opMeasure:{state:!0},_path:{state:!0},_cursorPt:{state:!0},_mergeSel:{state:!0},_openingPreset:{state:!0},_openingDialog:{state:!0},_openingInfo:{state:!0},_mergeDialog:{state:!0},_splitSel:{state:!0},_decorTool:{state:!0},_decorStyle:{state:!0},_decorDraft:{state:!0},_decorSel:{state:!0},_decorEraseConfirm:{state:!0},_decorTextDialog:{state:!0},_decorShapeDialog:{state:!0},_backdropDialog:{state:!0},_furnPalette:{state:!0},_decorImagePalette:{state:!0},_decorAssetCatalog:{state:!0},_decorAssetBusy:{state:!0},_furnCategory:{state:!0},_furnPreviewInput:{state:!0},_bdDrag:{state:!0},_dtBox:{state:!0},_dtDrag:{state:!0},_kioskDialog:{state:!0},_vacFit:{state:!0},_vacAllCamerasFor:{state:!0},_vacCalConfirm:{state:!0},_kioskDots:{state:!0},_areaSel:{state:!0},_nameSel:{state:!0},_roomDialog:{state:!0},_roomEditId:{state:!0},_roomFill:{state:!0},_roomCustomFill:{state:!0},_roomTempMin:{state:!0},_roomTempMax:{state:!0},_roomTempSrc:{state:!0},_roomHumSrc:{state:!0},_roomSrcOpen:{state:!0},_roomSrcFilter:{state:!0},_roomNameScale:{state:!0},_roomLabelScale:{state:!0},_spaceDialog:{state:!0},_infoCard:{state:!0},_deviceInbox:{state:!0},_rulesDialog:{state:!0},_settingsDialog:{state:!0},_pdfDialog:{state:!0},_supportDialog:{state:!0},_alignDialog:{state:!0},_preflightClipboardFallback:{state:!0},_backupExportDialog:{state:!0},_backupImportDialog:{state:!0},_importDialog:{state:!0},_markerDialog:{state:!0}},yv.ZOOM_MAX=8,yv.ZOOM_MIN=1/3,yv.styles=[op,pg],customElements.get("houseplan-card")||customElements.define("houseplan-card",yv),window.customCards=window.customCards||[],window.customCards.find(e=>"houseplan-card"===e.type)||window.customCards.push({type:"houseplan-card",name:"House Plan Card",description:"Interactive house plan: spaces, rooms and devices with live states and drag layout."}),console.info(`%c HOUSEPLAN-CARD %c v${ev} `,"background:#3ea6ff;color:#04121f;font-weight:700","");export{ds as $,G as A,Ag as B,wi as C,le as D,Lr as E,$i as F,Mi as G,Ut as H,Ci as I,el as J,wo as K,ni as L,Oo as M,ja as N,M_ as O,R_ as P,ys as Q,io as R,Go as S,_i as T,Wo as U,L_ as V,El as W,rl as X,Wl as Y,Bl as Z,Cs as _,ta as a,Oe as a$,Rs as a0,Zs as a1,Is as a2,Mc as a3,$c as a4,si as a5,Ja as a6,Xu as a7,rp as a8,Ts as a9,ti as aA,oi as aB,Pn as aC,Un as aD,dm as aE,Cr as aF,cm as aG,Pl as aH,Hl as aI,Ql as aJ,Xa as aK,ec as aL,Vl as aM,gs as aN,ea as aO,es as aP,ua as aQ,Oa as aR,N_ as aS,_a as aT,Ds as aU,Pg as aV,_n as aW,vr as aX,fr as aY,gr as aZ,pn as a_,ko as aa,ip as ab,Ku as ac,Zo as ad,As as ae,Zu as af,na as ag,sa as ah,fo as ai,yo as aj,Jr as ak,O_ as al,Ko as am,Qa as an,Uo as ao,Ua as ap,Ga as aq,en as ar,tn as as,Ki as at,Yi as au,Ya as av,ac as aw,Yd as ax,Xd as ay,$g as az,j as b,Di as b$,kp as b0,sf as b1,Do as b2,nl as b3,Qt as b4,ei as b5,Br as b6,ma as b7,bc as b8,E_ as b9,$r as bA,Rr as bB,Pr as bC,jn as bD,Sr as bE,Mr as bF,Xl as bG,Ir as bH,Zl as bI,Ul as bJ,Ll as bK,Jl as bL,Kl as bM,Yl as bN,rm as bO,Jo as bP,$p as bQ,tp as bR,Vf as bS,ep as bT,la as bU,qf as bV,Kf as bW,C_ as bX,li as bY,Ju as bZ,np as b_,bo as ba,Eu as bb,q_ as bc,yi as bd,mi as be,Fi as bf,za as bg,wa as bh,ba as bi,Yo as bj,Xo as bk,Qs as bl,kl as bm,Aa as bn,Da as bo,Yn as bp,Xn as bq,ki as br,ms as bs,_s as bt,j_ as bu,W_ as bv,zr as bw,Nr as bx,Er as by,Tr as bz,Mo as c,as as c$,fi as c0,ai as c1,vi as c2,Qo as c3,zi as c4,Mn as c5,Wp as c6,Up as c7,wd as c8,Ru as c9,Fg as cA,so as cB,yr as cC,Ee as cD,qe as cE,Ne as cF,qc as cG,Vc as cH,ih as cI,Ic as cJ,Kc as cK,jc as cL,Wc as cM,th as cN,Jc as cO,Ac as cP,Cc as cQ,Bn as cR,Tc as cS,qn as cT,ci as cU,jf as cV,Dp as cW,Bf as cX,Sl as cY,Ps as cZ,ss as c_,Li as ca,Ui as cb,Kn as cc,Ln as cd,Gd as ce,J_ as cf,vo as cg,Kd as ch,Ud as ci,un as cj,cn as ck,ln as cl,Ba as cm,F_ as cn,an as co,sn as cp,on as cq,rn as cr,La as cs,kc as ct,wc as cu,Jf as cv,K_ as cw,B_ as cx,Ar as cy,mn as cz,Co as d,Rl as d$,Ie as d0,su as d1,Gp as d2,Vp as d3,tu as d4,Ou as d5,Od as d6,Id as d7,Ad as d8,xd as d9,Dc as dA,Qg as dB,ef as dC,xp as dD,nf as dE,wl as dF,tf as dG,rf as dH,$a as dI,Vs as dJ,Sp as dK,Ri as dL,f_ as dM,xf as dN,Sf as dO,hf as dP,y_ as dQ,Na as dR,pe as dS,_e as dT,U as dU,Hr as dV,Pa as dW,aa as dX,Dr as dY,Fr as dZ,Fa as d_,Dn as da,bd as db,Vd as dc,Rn as dd,d_ as de,zp as df,Pd as dg,Fd as dh,Sd as di,ku as dj,Bi as dk,Hi as dl,Ip as dm,Ni as dn,xc as dp,qa as dq,Sc as dr,qi as ds,ji as dt,xo as du,pi as dv,Jd as dw,eu as dx,Za as dy,Al as dz,sh as e,U_ as e0,Ia as e1,lm as e2,yp as e3,cp as e4,_p as e5,hp as e6,Jt as e7,bg as e8,G_ as e9,Xi as ea,Zi as eb,Wt as ec,yv as ed,Qc as f,Ro as g,Ha as h,eh as i,Ao as j,o as k,bp as l,he as m,rh as n,ch as o,Kt as p,op as q,lh as r,nn as s,wp as t,Yp as u,g_ as v,W as w,v_ as x,Pp as y,b_ as z}; +
    `}_renderRoomSource(e){return this._editorRuntimeOrThrow()._renderRoomSource(e)}_renderRoomDialog(){return this._editorRuntimeOrThrow()._renderRoomDialog()}}yv.properties={_tabDrag:{state:!0},_hdrH:{state:!0},_booting:{state:!0},_bootFading:{state:!0},_bootSoft:{state:!0},_continuityEpoch:{state:!0},_editorRuntimeLoadingVisible:{state:!0},_backdropGuard:{state:!0},_tapConfirm:{state:!0},_dangerConfirm:{state:!0},hass:{attribute:!1},panelHost:{type:Boolean,attribute:"panel-host",reflect:!0},narrow:{attribute:!1},_config:{state:!0},_space:{state:!0},_devices:{state:!0},_selId:{state:!0},_toast:{state:!0},_mode:{state:!0},_tool:{state:!0},_wallDialog:{state:!0},_drawWallField:{state:!0},_activeWallChainId:{state:!0},_physicalSel:{state:!0},_physicalDialog:{state:!0},_partitionDeleteDialog:{state:!0},_roomDeleteDialog:{state:!0},_physicalDrag:{state:!0},_physicalRotate:{state:!0},_duplicateColumnId:{state:!0},_opMeasure:{state:!0},_path:{state:!0},_cursorPt:{state:!0},_mergeSel:{state:!0},_openingPreset:{state:!0},_openingDialog:{state:!0},_openingInfo:{state:!0},_mergeDialog:{state:!0},_splitSel:{state:!0},_decorTool:{state:!0},_decorStyle:{state:!0},_decorDraft:{state:!0},_decorSel:{state:!0},_decorEraseConfirm:{state:!0},_decorTextDialog:{state:!0},_decorShapeDialog:{state:!0},_backdropDialog:{state:!0},_furnPalette:{state:!0},_decorImagePalette:{state:!0},_decorAssetCatalog:{state:!0},_decorAssetBusy:{state:!0},_furnCategory:{state:!0},_furnPreviewInput:{state:!0},_bdDrag:{state:!0},_dtBox:{state:!0},_dtDrag:{state:!0},_kioskDialog:{state:!0},_vacFit:{state:!0},_vacAllCamerasFor:{state:!0},_vacCalConfirm:{state:!0},_kioskDots:{state:!0},_areaSel:{state:!0},_nameSel:{state:!0},_roomDialog:{state:!0},_roomEditId:{state:!0},_roomFill:{state:!0},_roomCustomFill:{state:!0},_roomTempMin:{state:!0},_roomTempMax:{state:!0},_roomTempSrc:{state:!0},_roomHumSrc:{state:!0},_roomSrcOpen:{state:!0},_roomSrcFilter:{state:!0},_roomNameScale:{state:!0},_roomLabelScale:{state:!0},_spaceDialog:{state:!0},_infoCard:{state:!0},_deviceInbox:{state:!0},_rulesDialog:{state:!0},_settingsDialog:{state:!0},_pdfDialog:{state:!0},_supportDialog:{state:!0},_alignDialog:{state:!0},_preflightClipboardFallback:{state:!0},_backupExportDialog:{state:!0},_backupImportDialog:{state:!0},_importDialog:{state:!0},_markerDialog:{state:!0}},yv.ZOOM_MAX=8,yv.ZOOM_MIN=1/3,yv.styles=[op,pg],customElements.get("houseplan-card")||customElements.define("houseplan-card",yv),window.customCards=window.customCards||[],window.customCards.find(e=>"houseplan-card"===e.type)||window.customCards.push({type:"houseplan-card",name:"House Plan Card",description:"Interactive house plan: spaces, rooms and devices with live states and drag layout."}),console.info(`%c HOUSEPLAN-CARD %c v${ev} `,"background:#3ea6ff;color:#04121f;font-weight:700","");export{Wl as $,G as A,Pp as B,b_ as C,le as D,U as E,Ag as F,wi as G,Lr as H,$i as I,Mi as J,Ut as K,Ci as L,el as M,ja as N,wo as O,ni as P,Oo as Q,M_ as R,R_ as S,ys as T,io as U,Go as V,_i as W,Wo as X,L_ as Y,El as Z,rl as _,sh as a,fr as a$,Bl as a0,Cs as a1,ds as a2,Rs as a3,Zs as a4,Is as a5,Mc as a6,$c as a7,si as a8,Ja as a9,Yd as aA,Xd as aB,$g as aC,ti as aD,oi as aE,Pn as aF,Un as aG,dm as aH,Cr as aI,cm as aJ,Pl as aK,Hl as aL,Ql as aM,Xa as aN,ec as aO,Vl as aP,gs as aQ,ea as aR,es as aS,ua as aT,Oa as aU,N_ as aV,_a as aW,Ds as aX,Pg as aY,_n as aZ,vr as a_,Xu as aa,rp as ab,Ts as ac,ko as ad,ip as ae,Ku as af,Zo as ag,As as ah,Zu as ai,na as aj,sa as ak,fo as al,yo as am,Jr as an,O_ as ao,Ko as ap,Qa as aq,Uo as ar,Ua as as,Ga as at,en as au,tn as av,Ki as aw,Yi as ax,Ya as ay,ac as az,eh as b,li as b$,gr as b0,pn as b1,Oe as b2,kp as b3,sf as b4,Do as b5,nl as b6,Qt as b7,ei as b8,Br as b9,Nr as bA,Er as bB,Tr as bC,$r as bD,Rr as bE,Pr as bF,jn as bG,Sr as bH,Mr as bI,Xl as bJ,Ir as bK,Zl as bL,Ul as bM,Ll as bN,Jl as bO,Kl as bP,Yl as bQ,rm as bR,Jo as bS,$p as bT,tp as bU,Vf as bV,ep as bW,la as bX,qf as bY,Kf as bZ,C_ as b_,ma as ba,bc as bb,E_ as bc,bo as bd,Eu as be,q_ as bf,yi as bg,mi as bh,Fi as bi,za as bj,wa as bk,ba as bl,Yo as bm,Xo as bn,Qs as bo,kl as bp,Aa as bq,Da as br,Yn as bs,Xn as bt,ki as bu,ms as bv,_s as bw,j_ as bx,W_ as by,zr as bz,j as c,Sl as c$,Ju as c0,np as c1,Di as c2,fi as c3,ai as c4,vi as c5,Qo as c6,zi as c7,Mn as c8,Wp as c9,B_ as cA,Ar as cB,mn as cC,Fg as cD,so as cE,yr as cF,Ee as cG,qe as cH,Ne as cI,qc as cJ,Vc as cK,ih as cL,Ic as cM,Kc as cN,jc as cO,Wc as cP,th as cQ,Jc as cR,Ac as cS,Cc as cT,Bn as cU,Tc as cV,qn as cW,ci as cX,jf as cY,Dp as cZ,Bf as c_,Up as ca,wd as cb,Ru as cc,Li as cd,Ui as ce,Kn as cf,Ln as cg,Gd as ch,J_ as ci,vo as cj,Kd as ck,Ud as cl,un as cm,cn,ln as co,Ba as cp,F_ as cq,an as cr,sn as cs,on as ct,rn as cu,La as cv,kc as cw,wc as cx,Jf as cy,K_ as cz,ta as d,Rl as d$,Ps as d0,ss as d1,as as d2,Ie as d3,su as d4,Gp as d5,Vp as d6,tu as d7,Ou as d8,Od as d9,eu as dA,Za as dB,Al as dC,Dc as dD,Qg as dE,ef as dF,xp as dG,nf as dH,wl as dI,tf as dJ,rf as dK,$a as dL,Vs as dM,Sp as dN,Ri as dO,f_ as dP,xf as dQ,Sf as dR,hf as dS,y_ as dT,Na as dU,Hr as dV,Pa as dW,aa as dX,Dr as dY,Fr as dZ,Fa as d_,Id as da,Ad as db,xd as dc,Dn as dd,bd as de,Vd as df,Rn as dg,d_ as dh,zp as di,Pd as dj,Fd as dk,Sd as dl,ku as dm,Bi as dn,Hi as dp,Ip as dq,Ni as dr,xc as ds,qa as dt,Sc as du,qi as dv,ji as dw,xo as dx,pi as dy,Jd as dz,pe as e,U_ as e0,Ia as e1,lm as e2,yp as e3,cp as e4,_p as e5,hp as e6,Jt as e7,bg as e8,G_ as e9,Xi as ea,Zi as eb,Wt as ec,yv as ed,Qc as f,Mo as g,Co as h,_e as i,Ro as j,Ha as k,bp as l,Ao as m,rh as n,ch as o,o as p,he as q,lh as r,nn as s,Kt as t,op as u,wp as v,W as w,Yp as x,g_ as y,v_ as z}; diff --git a/dist/houseplan-assets/houseplan-editor-runtime-BjAw4ds1.js b/dist/houseplan-assets/houseplan-editor-runtime-CJrrYe2p.js similarity index 65% rename from dist/houseplan-assets/houseplan-editor-runtime-BjAw4ds1.js rename to dist/houseplan-assets/houseplan-editor-runtime-CJrrYe2p.js index 41caebf5..1ccba53e 100644 --- a/dist/houseplan-assets/houseplan-editor-runtime-BjAw4ds1.js +++ b/dist/houseplan-assets/houseplan-editor-runtime-CJrrYe2p.js @@ -1,121 +1,121 @@ -globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae33533bdef7216a6d7d513ae04091";import{s as t,e,n as s,f as i,i as o,l as a,o as n,r,A as l,b as h,D as c,w as d,N as p,a as u,c as _,d as m,g,h as f,j as b,k as v,m as y,p as $,q as w,t as k,u as x,v as S,x as M,y as C,z as P,B as D,C as I,E as T,F as z,G as R,H as A,I as F,J as N,K as E,L as H,M as O,O as L,P as B,Q as W,R as j,S as G,T as q,U,V as K,W as V,X as J,Y,Z as X,_ as Z,$ as Q,a0 as tt,a1 as et,a2 as st,a3 as it,a4 as ot,a5 as at,a6 as nt,a7 as rt,a8 as lt,a9 as ht,aa as ct,ab as dt,ac as pt,ad as ut,ae as _t,af as mt,ag as gt,ah as ft,ai as bt,aj as vt,ak as yt,al as $t,am as wt,an as kt,ao as xt,ap as St,aq as Mt,ar as Ct,as as Pt,at as Dt,au as It,av as Tt,aw as zt,ax as Rt,ay as At,az as Ft,aA as Nt,aB as Et,aC as Ht,aD as Ot,aE as Lt,aF as Bt,aG as Wt,aH as jt,aI as Gt,aJ as qt,aK as Ut,aL as Kt,aM as Vt,aN as Jt,aO as Yt,aP as Xt,aQ as Zt,aR as Qt,aS as te,aT as ee,aU as se,aV as ie,aW as oe,aX as ae,aY as ne,aZ as re,a_ as le,a$ as he,b0 as ce,b1 as de,b2 as pe,b3 as ue,b4 as _e,b5 as me,b6 as ge,b7 as fe,b8 as be,b9 as ve,ba as ye,bb as $e,bc as we,bd as ke,be as xe,bf as Se,bg as Me,bh as Ce,bi as Pe,bj as De,bk as Ie,bl as Te,bm as ze,bn as Re,bo as Ae,bp as Fe,bq as Ne,br as Ee,bs as He,bt as Oe,bu as Le,bv as Be,bw as We,bx as je,by as Ge,bz as qe,bA as Ue,bB as Ke,bC as Ve,bD as Je,bE as Ye,bF as Xe,bG as Ze,bH as Qe,bI as ts,bJ as es,bK as ss,bL as is,bM as os,bN as as,bO as ns,bP as rs,bQ as ls,bR as hs,bS as cs,bT as ds,bU as ps,bV as us,bW as _s,bX as ms,bY as gs,bZ as fs,b_ as bs,b$ as vs,c0 as ys,c1 as $s,c2 as ws,c3 as ks,c4 as xs,c5 as Ss,c6 as Ms,c7 as Cs,c8 as Ps,c9 as Ds,ca as Is,cb as Ts,cc as zs,cd as Rs,ce as As,cf as Fs,cg as Ns,ch as Es,ci as Hs,cj as Os,ck as Ls,cl as Bs,cm as Ws,cn as js,co as Gs,cp as qs,cq as Us,cr as Ks,cs as Vs,ct as Js,cu as Ys,cv as Xs,cw as Zs,cx as Qs,cy as ti,cz as ei,cA as si,cB as ii,cC as oi,cD as ai,cE as ni,cF as ri,cG as li,cH as hi,cI as ci,cJ as di,cK as pi,cL as ui,cM as _i,cN as mi,cO as gi,cP as fi,cQ as bi,cR as vi,cS as yi,cT as $i,cU as wi,cV as ki,cW as xi,cX as Si,cY as Mi,cZ as Ci,c_ as Pi,c$ as Di,d0 as Ii,d1 as Ti,d2 as zi,d3 as Ri,d4 as Ai,d5 as Fi,d6 as Ni,d7 as Ei,d8 as Hi,d9 as Oi,da as Li,db as Bi,dc as Wi,dd as ji,de as Gi,df as qi,dg as Ui,dh as Ki,di as Vi,dj as Ji,dk as Yi,dl as Xi,dm as Zi,dn as Qi,dp as to,dq as eo,dr as so,ds as io,dt as oo,du as ao,dv as no,dw as ro,dx as lo,dy as ho,dz as co}from"./houseplan-card-DqlR1H6U.js";import{i as po}from"./guard-DBKIUfbp.js";import{F as uo,f as _o,p as mo,c as go,e as fo,r as bo,a as vo,s as yo}from"./backdrop-pick-DCbvGxY2.js";import{t as $o,h as wo,m as ko,T as xo}from"./zigbee-topology-torI07nL.js";import{GENERATED_FURNITURE_ART as So,FURNITURE_ART_FINGERPRINT as Mo}from"./furniture-plan-art.generated-CrvWoAvu.js";var Co={"gs.hint":"Fill colors apply to every space; each color has its own opacity. Which fill mode a space uses is set in that space's dialog.","gs.show_room_tooltip":"Show the room information window on hover","support.about_group":"About the card","support.guide_group":"Documentation","support.guide":"User guide","support.form_group":"Send a report or suggestion","support.contact":"Contact details (email/tg/WhatsApp), optional.","support.message":"Message","support.attach":"Attach anonymized information from your plan","support.attach_hint":"Includes only allowed plan geometry, settings and bounded runtime facts. Excludes names, Home Assistant IDs, live states, URLs, files, and your message/contact.","support.geometry_warning":"The package contains no names or Home Assistant IDs, but it does contain the exact geometry and dimensions of your home.","support.close_busy_title":"Stop the current operation?","support.close_busy_body":"House Plan is preparing or sending the report. Closing now stops waiting for the result.","support.building":"Preparing anonymized data…","support.preview_summary":"Package v{version} · {spaces} spaces · {size} KiB","support.prepared":"Snapshot prepared {n} min ago","support.show_data":"Show data","support.download":"Download JSON","support.refresh":"Refresh snapshot","support.privacy":"When you send, your message, optional contact and, if selected, exact geometry leave your Home Assistant through the House Plan project relay and are visible to maintainers. The project node keeps the report for up to 30 days. Network infrastructure sees your HA server address, but House Plan does not retain it raw; rate-limit and idempotency metadata is kept for up to 24 hours.","support.error_title":"The report was not sent","support.manual_recovery":"You can keep the message and attachment and continue manually:","support.copy_message":"Copy message","support.success":"Report sent: {id}. Save this number when contacting support.","support.copy_id":"Copy ID","support.sending":"Sending…","support.retry":"Retry","support.send":"Send","support.update_required":"Update the House Plan card and integration to compatible versions to send reports.","support.message_copied":"Message copied","support.id_copied":"Report ID copied","support.copy_failed":"Could not access the clipboard. Select and copy the text manually.","support.validation.message_required":"Enter a message.","support.validation.message_too_long":"The message must contain no more than 10,000 characters.","support.validation.contact_too_long":"Contact details must contain no more than 320 characters.","support.validation.preview_missing":"Wait for the attachment preview or turn the attachment off.","support.validation.preview_expired":"The attachment preview expired. Refresh the snapshot.","support.error.support_invalid_message":"Check the message and try again.","support.error.support_preview_expired":"The attachment preview expired or is no longer available. Refresh the snapshot.","support.error.support_package_too_large":"The anonymized package exceeds the 8 MiB limit.","support.error.support_rate_limited":"Too many reports or previews were requested. Try again later.","support.error.support_unavailable":"The private support service is temporarily unavailable. Your draft remains here.","support.error.support_rejected":"The report did not pass the support service validation.","support.error.unauthorized":"You do not have permission to send this report.","vac.routes_section":"Maps and floors","vac.routes_current_map":"Current map","vac.routes_no_map":"no telemetry","vac.routes_status":"Routing","vac.routes_state_ready":"map assigned and calibrated","vac.routes_state_needs_calibration":"map assigned, calibration needed","vac.routes_state_unmapped":"current map is not assigned to a floor","vac.routes_state_ambiguous":"two maps are indistinguishable — no floor is chosen","vac.routes_state_missing_space":"the map's space was deleted","vac.routes_state_none":"no map data","vac.routes_empty":"No map is assigned to a floor yet.","vac.route_map_default":"no map id","vac.route_active":"Active","vac.route_space":"Space","vac.route_space_none":"not selected","vac.route_status_ready":"ready","vac.route_status_needs_calibration":"needs calibration","vac.route_status_ambiguous":"ambiguous","vac.route_status_missing_space":"space deleted","vac.route_missing_space_group":"Deleted space","vac.route_add_current":"Add current map","vac.route_delete":"Remove map","vac.route_delete_title":"Remove the map from its floor?","vac.route_delete_body":"Calibration and saved paths for this map will be removed. Continue?","vac.route_delete_confirm":"Remove","vac.route_space_title":"Move the map to another space?","vac.route_space_body":"Calibration and saved paths for this map will be removed. Continue?","vac.route_space_confirm":"Move","vac.route_missing_space_hint":"One of the maps points at a deleted space: pick a new one or remove the map. Until then the robot is not drawn for that map.","vac.route_default_hint":"The source reports no stable map id. Several floors cannot be told apart without another source or the robot's own selected map.","vac.route_target_hint":"The dock stays in the “{space}” space regardless of the current map.","vac.route_add_source":"Add a map source","vac.route_add_source_hint":"For integrations that give each map its own camera. The “All cameras” section above widens this list.","vac.route_source_no_map":"no map reported"};const Po={en:Co,ru:{"gs.hint":"Цвета заливок действуют на все пространства; у каждого цвета своя прозрачность. Какой режим заливки использует пространство — задаётся в его диалоге.","gs.show_room_tooltip":"Показывать окно с информацией при наведении на комнату","support.about_group":"О карточке","support.guide_group":"Документация","support.guide":"Руководство пользователя","support.form_group":"Отправить репорт или предложение","support.contact":"Контакт для связи (email/tg/WhatsApp), необязательно.","support.message":"Сообщение","support.attach":"Прикрепить обезличенную информацию из вашего плана","support.attach_hint":"В пакет входят только разрешённые геометрия, настройки и ограниченные сведения о среде. Не входят имена, HA id, текущие состояния, URL, файлы, сообщение и контакт.","support.geometry_warning":"Пакет не содержит имён и HA id, но содержит точную геометрию и размеры дома.","support.close_busy_title":"Прервать текущую операцию?","support.close_busy_body":"House Plan подготавливает или отправляет репорт. При закрытии ожидание результата прекратится.","support.building":"Подготавливаем обезличенные данные…","support.preview_summary":"Пакет v{version} · пространств: {spaces} · {size} КиБ","support.prepared":"Снимок подготовлен {n} мин назад","support.show_data":"Показать данные","support.download":"Скачать JSON","support.refresh":"Обновить снимок","support.privacy":"При отправке сообщение, необязательный контакт и, если выбран пакет, точная геометрия покидают ваш Home Assistant через relay проекта House Plan и доступны мейнтейнерам. Узел проекта хранит репорт до 30 дней. Сетевая инфраструктура видит адрес сервера HA, но House Plan не сохраняет его в исходном виде; метаданные лимитов и идемпотентности хранятся до 24 часов.","support.error_title":"Репорт не отправлен","support.manual_recovery":"Сообщение и вложение можно сохранить и продолжить вручную:","support.copy_message":"Копировать сообщение","support.success":"Репорт отправлен: {id}. Сохраните номер для связи с поддержкой.","support.copy_id":"Копировать ID","support.sending":"Отправляем…","support.retry":"Повторить","support.send":"Отправить","support.update_required":"Обновите карточку и интеграцию House Plan до совместимых версий, чтобы отправлять репорты.","support.message_copied":"Сообщение скопировано","support.id_copied":"ID репорта скопирован","support.copy_failed":"Не удалось получить доступ к буферу обмена. Выделите и скопируйте текст вручную.","support.validation.message_required":"Введите сообщение.","support.validation.message_too_long":"Сообщение должно содержать не более 10 000 символов.","support.validation.contact_too_long":"Контакт должен содержать не более 320 символов.","support.validation.preview_missing":"Дождитесь предпросмотра вложения или отключите его.","support.validation.preview_expired":"Предпросмотр вложения истёк. Обновите снимок.","support.error.support_invalid_message":"Проверьте сообщение и повторите попытку.","support.error.support_preview_expired":"Предпросмотр вложения истёк или больше недоступен. Обновите снимок.","support.error.support_package_too_large":"Обезличенный пакет превышает лимит 8 МиБ.","support.error.support_rate_limited":"Запрошено слишком много репортов или предпросмотров. Повторите позже.","support.error.support_unavailable":"Закрытая служба поддержки временно недоступна. Черновик сохранён в этом окне.","support.error.support_rejected":"Репорт не прошёл проверку службы поддержки.","support.error.unauthorized":"У вас нет прав на отправку этого репорта.","vac.routes_section":"Карты и этажи","vac.routes_current_map":"Текущая карта","vac.routes_no_map":"источник молчит","vac.routes_status":"Маршрутизация","vac.routes_state_ready":"карта сопоставлена и откалибрована","vac.routes_state_needs_calibration":"карта сопоставлена, нужна калибровка","vac.routes_state_unmapped":"текущая карта не сопоставлена этажу","vac.routes_state_ambiguous":"две карты неразличимы — этаж не выбирается","vac.routes_state_missing_space":"пространство карты удалено","vac.routes_state_none":"нет данных о карте","vac.routes_empty":"Ни одна карта ещё не сопоставлена этажу.","vac.route_map_default":"без идентификатора","vac.route_active":"Текущая","vac.route_space":"Пространство","vac.route_space_none":"не выбрано","vac.route_status_ready":"готова","vac.route_status_needs_calibration":"нужна калибровка","vac.route_status_ambiguous":"неоднозначна","vac.route_status_missing_space":"пространство удалено","vac.route_missing_space_group":"Пространство удалено","vac.route_add_current":"Добавить текущую карту","vac.route_delete":"Удалить карту","vac.route_delete_title":"Удалить карту с этажа?","vac.route_delete_body":"Калибровка и сохранённые пути этой карты будут удалены. Продолжить?","vac.route_delete_confirm":"Удалить","vac.route_space_title":"Перенести карту в другое пространство?","vac.route_space_body":"Калибровка и сохранённые пути этой карты будут удалены. Продолжить?","vac.route_space_confirm":"Перенести","vac.route_missing_space_hint":"Одна из карт ссылается на удалённое пространство: выберите новое или удалите карту. Пока ссылка не исправлена, робот на этой карте не рисуется.","vac.route_default_hint":"Источник не сообщает стабильный идентификатор карты. Несколько этажей нельзя различить без другого источника или собственной карты робота.","vac.route_target_hint":"Док остаётся в пространстве «{space}» независимо от текущей карты.","vac.route_add_source":"Добавить источник карты","vac.route_add_source_hint":"Для интеграций, где у каждой карты своя камера. Список расширяется разделом «Все камеры» выше.","vac.route_source_no_map":"карта не читается"},de:{"gs.hint":"Füllfarben gelten für jeden Bereich; jede Farbe hat ihre eigene Deckkraft. Der Füllmodus wird in den Einstellungen des jeweiligen Bereichs festgelegt.","gs.show_room_tooltip":"Rauminformationen beim Darüberfahren anzeigen","support.about_group":"Über die Karte","support.guide_group":"Dokumentation","support.guide":"Benutzerhandbuch","support.form_group":"Bericht oder Vorschlag senden","support.contact":"Kontakt (E-Mail/tg/WhatsApp), optional.","support.message":"Nachricht","support.attach":"Anonymisierte Informationen aus dem Plan anhängen","support.attach_hint":"Enthält nur erlaubte Plangeometrie, Einstellungen und begrenzte Laufzeitdaten. Namen, Home-Assistant-IDs, Live-Zustände, URLs, Dateien, Nachricht und Kontakt werden ausgeschlossen.","support.geometry_warning":"Das Paket enthält keine Namen oder Home-Assistant-IDs, aber die exakte Geometrie und die Maße Ihres Hauses.","support.close_busy_title":"Aktuellen Vorgang abbrechen?","support.close_busy_body":"House Plan bereitet den Bericht vor oder sendet ihn. Beim Schließen wird nicht weiter auf das Ergebnis gewartet.","support.building":"Anonymisierte Daten werden vorbereitet…","support.preview_summary":"Paket v{version} · {spaces} Bereiche · {size} KiB","support.prepared":"Schnappschuss vor {n} Min. erstellt","support.show_data":"Daten anzeigen","support.download":"JSON herunterladen","support.refresh":"Schnappschuss aktualisieren","support.privacy":"Beim Senden verlassen Ihre Nachricht, der optionale Kontakt und, falls ausgewählt, die exakte Geometrie Ihren Home Assistant über das House-Plan-Projektrelay und sind für die Maintainer sichtbar. Der Projektserver speichert den Bericht bis zu 30 Tage. Die Netzwerkinfrastruktur sieht die Adresse Ihres HA-Servers, House Plan speichert sie jedoch nicht im Rohformat; Limit- und Idempotenzdaten bleiben bis zu 24 Stunden erhalten.","support.error_title":"Der Bericht wurde nicht gesendet","support.manual_recovery":"Nachricht und Anhang können gespeichert und manuell weitergegeben werden:","support.copy_message":"Nachricht kopieren","support.success":"Bericht gesendet: {id}. Bewahren Sie diese Nummer für den Support auf.","support.copy_id":"ID kopieren","support.sending":"Wird gesendet…","support.retry":"Erneut versuchen","support.send":"Senden","support.update_required":"Aktualisieren Sie House-Plan-Karte und Integration auf kompatible Versionen, um Berichte zu senden.","support.message_copied":"Nachricht kopiert","support.id_copied":"Berichts-ID kopiert","support.copy_failed":"Kein Zugriff auf die Zwischenablage. Markieren und kopieren Sie den Text manuell.","support.validation.message_required":"Geben Sie eine Nachricht ein.","support.validation.message_too_long":"Die Nachricht darf höchstens 10.000 Zeichen enthalten.","support.validation.contact_too_long":"Der Kontakt darf höchstens 320 Zeichen enthalten.","support.validation.preview_missing":"Warten Sie auf die Vorschau oder deaktivieren Sie den Anhang.","support.validation.preview_expired":"Die Anhangsvorschau ist abgelaufen. Aktualisieren Sie den Schnappschuss.","support.error.support_invalid_message":"Prüfen Sie die Nachricht und versuchen Sie es erneut.","support.error.support_preview_expired":"Die Anhangsvorschau ist abgelaufen oder nicht mehr verfügbar. Aktualisieren Sie den Schnappschuss.","support.error.support_package_too_large":"Das anonymisierte Paket überschreitet das Limit von 8 MiB.","support.error.support_rate_limited":"Zu viele Berichte oder Vorschauen wurden angefordert. Versuchen Sie es später erneut.","support.error.support_unavailable":"Der private Supportdienst ist vorübergehend nicht verfügbar. Der Entwurf bleibt in diesem Fenster erhalten.","support.error.support_rejected":"Der Bericht hat die Prüfung des Supportdienstes nicht bestanden.","support.error.unauthorized":"Sie dürfen diesen Bericht nicht senden.","vac.routes_section":"Karten und Etagen","vac.routes_current_map":"Aktuelle Karte","vac.routes_no_map":"keine Telemetrie","vac.routes_status":"Zuordnung","vac.routes_state_ready":"Karte zugeordnet und kalibriert","vac.routes_state_needs_calibration":"Karte zugeordnet, Kalibrierung nötig","vac.routes_state_unmapped":"aktuelle Karte keiner Etage zugeordnet","vac.routes_state_ambiguous":"zwei Karten nicht unterscheidbar — keine Etage gewählt","vac.routes_state_missing_space":"der Raum der Karte wurde gelöscht","vac.routes_state_none":"keine Kartendaten","vac.routes_empty":"Noch keine Karte einer Etage zugeordnet.","vac.route_map_default":"ohne Karten-ID","vac.route_active":"Aktiv","vac.route_space":"Raum","vac.route_space_none":"nicht gewählt","vac.route_status_ready":"bereit","vac.route_status_needs_calibration":"Kalibrierung nötig","vac.route_status_ambiguous":"mehrdeutig","vac.route_status_missing_space":"Raum gelöscht","vac.route_missing_space_group":"Gelöschter Bereich","vac.route_add_current":"Aktuelle Karte hinzufügen","vac.route_delete":"Karte entfernen","vac.route_delete_title":"Karte von der Etage entfernen?","vac.route_delete_body":"Kalibrierung und gespeicherte Pfade dieser Karte werden entfernt. Fortfahren?","vac.route_delete_confirm":"Entfernen","vac.route_space_title":"Karte in einen anderen Raum verschieben?","vac.route_space_body":"Kalibrierung und gespeicherte Pfade dieser Karte werden entfernt. Fortfahren?","vac.route_space_confirm":"Verschieben","vac.route_missing_space_hint":"Eine Karte verweist auf einen gelöschten Raum: neuen wählen oder Karte entfernen. Bis dahin wird der Roboter für diese Karte nicht gezeichnet.","vac.route_default_hint":"Die Quelle meldet keine stabile Karten-ID. Mehrere Etagen lassen sich ohne andere Quelle oder die vom Roboter gewählte Karte nicht unterscheiden.","vac.route_target_hint":"Die Station bleibt unabhängig von der aktuellen Karte im Raum „{space}“.","vac.route_add_source":"Kartenquelle hinzufügen","vac.route_add_source_hint":"Für Integrationen, die jeder Karte eine eigene Kamera geben. Der Abschnitt „Alle Kameras“ oben erweitert diese Liste.","vac.route_source_no_map":"keine Karte gemeldet"},fr:{"gs.hint":"Les couleurs de remplissage s’appliquent à tous les espaces ; chaque couleur possède sa propre opacité. Le mode de remplissage utilisé par un espace se règle dans la boîte de dialogue de cet espace.","gs.show_room_tooltip":"Afficher les informations de la pièce au survol","support.about_group":"À propos de la carte","support.guide_group":"Documentation d’aide","support.guide":"Guide utilisateur","support.form_group":"Envoyer un rapport ou une suggestion","support.contact":"Contact (e-mail/tg/WhatsApp), facultatif.","support.message":"Votre message","support.attach":"Joindre des informations anonymisées de votre plan","support.attach_hint":"Inclut uniquement la géométrie, les réglages autorisés et des données d’exécution limitées. Exclut les noms, identifiants Home Assistant, états en direct, URL, fichiers, message et contact.","support.geometry_warning":"Le paquet ne contient ni noms ni identifiants Home Assistant, mais il contient la géométrie et les dimensions exactes de votre logement.","support.close_busy_title":"Interrompre l’opération en cours ?","support.close_busy_body":"House Plan prépare ou envoie le rapport. Fermer maintenant arrête l’attente du résultat.","support.building":"Préparation des données anonymisées…","support.preview_summary":"Paquet v{version} · {spaces} espaces · {size} Kio","support.prepared":"Instantané préparé il y a {n} min","support.show_data":"Afficher les données","support.download":"Télécharger le JSON","support.refresh":"Actualiser l’instantané","support.privacy":"Lors de l’envoi, votre message, le contact facultatif et, si elle est sélectionnée, la géométrie exacte quittent votre Home Assistant via le relais du projet House Plan et sont visibles par les mainteneurs. Le serveur du projet conserve le rapport jusqu’à 30 jours. L’infrastructure réseau voit l’adresse de votre serveur HA, mais House Plan ne la conserve pas en clair ; les métadonnées de limitation et d’idempotence sont gardées jusqu’à 24 heures.","support.error_title":"Le rapport n’a pas été envoyé","support.manual_recovery":"Vous pouvez conserver le message et la pièce jointe puis continuer manuellement :","support.copy_message":"Copier le message","support.success":"Rapport envoyé : {id}. Conservez ce numéro pour contacter l’assistance.","support.copy_id":"Copier l’ID","support.sending":"Envoi…","support.retry":"Réessayer","support.send":"Envoyer","support.update_required":"Mettez à jour la carte et l’intégration House Plan vers des versions compatibles pour envoyer des rapports.","support.message_copied":"Message copié","support.id_copied":"ID du rapport copié","support.copy_failed":"Impossible d’accéder au presse-papiers. Sélectionnez et copiez le texte manuellement.","support.validation.message_required":"Saisissez un message.","support.validation.message_too_long":"Le message ne doit pas dépasser 10 000 caractères.","support.validation.contact_too_long":"Le contact ne doit pas dépasser 320 caractères.","support.validation.preview_missing":"Attendez l’aperçu de la pièce jointe ou désactivez-la.","support.validation.preview_expired":"L’aperçu de la pièce jointe a expiré. Actualisez l’instantané.","support.error.support_invalid_message":"Vérifiez le message et réessayez.","support.error.support_preview_expired":"L’aperçu de la pièce jointe a expiré ou n’est plus disponible. Actualisez l’instantané.","support.error.support_package_too_large":"Le paquet anonymisé dépasse la limite de 8 Mio.","support.error.support_rate_limited":"Trop de rapports ou d’aperçus ont été demandés. Réessayez plus tard.","support.error.support_unavailable":"Le service d’assistance privé est temporairement indisponible. Le brouillon reste dans cette fenêtre.","support.error.support_rejected":"Le rapport n’a pas passé la validation du service d’assistance.","support.error.unauthorized":"Vous n’êtes pas autorisé à envoyer ce rapport.","vac.routes_section":"Cartes et étages","vac.routes_current_map":"Carte actuelle","vac.routes_no_map":"aucune télémétrie","vac.routes_status":"Routage","vac.routes_state_ready":"carte assignée et calibrée","vac.routes_state_needs_calibration":"carte assignée, calibrage requis","vac.routes_state_unmapped":"carte actuelle non assignée à un étage","vac.routes_state_ambiguous":"deux cartes indiscernables — aucun étage choisi","vac.routes_state_missing_space":"l'espace de la carte a été supprimé","vac.routes_state_none":"aucune donnée de carte","vac.routes_empty":"Aucune carte n'est encore assignée à un étage.","vac.route_map_default":"sans identifiant","vac.route_active":"Active","vac.route_space":"Espace","vac.route_space_none":"non sélectionné","vac.route_status_ready":"prête","vac.route_status_needs_calibration":"calibrage requis","vac.route_status_ambiguous":"ambiguë","vac.route_status_missing_space":"espace supprimé","vac.route_missing_space_group":"Espace supprimé","vac.route_add_current":"Ajouter la carte actuelle","vac.route_delete":"Supprimer la carte","vac.route_delete_title":"Retirer la carte de son étage ?","vac.route_delete_body":"Le calibrage et les trajets enregistrés de cette carte seront supprimés. Continuer ?","vac.route_delete_confirm":"Supprimer","vac.route_space_title":"Déplacer la carte vers un autre espace ?","vac.route_space_body":"Le calibrage et les trajets enregistrés de cette carte seront supprimés. Continuer ?","vac.route_space_confirm":"Déplacer","vac.route_missing_space_hint":"Une carte pointe vers un espace supprimé : choisissez-en un autre ou supprimez la carte. D'ici là, le robot n'est pas dessiné pour cette carte.","vac.route_default_hint":"La source ne fournit pas d'identifiant de carte stable. Plusieurs étages ne peuvent pas être distingués sans une autre source ou la carte sélectionnée du robot.","vac.route_target_hint":"La station reste dans l'espace « {space} » quelle que soit la carte actuelle.","vac.route_add_source":"Ajouter une source de carte","vac.route_add_source_hint":"Pour les intégrations qui donnent à chaque carte sa propre caméra. La section « Toutes les caméras » ci-dessus élargit cette liste.","vac.route_source_no_map":"aucune carte signalée"}};function Do(e,s,i){return t(Po[e]?.[s]??Co[s]??s,i)}function Io(t,e,s,i,o){return{markerId:t,source:i,mapId:o,space:e.length?"":s}}function To(t,e,s){return{...t,space:s.has(e)?e:""}}function zo(t,e=Math.random){const s=new Set(t);for(let t=0;t<64;t+=1){const t="vr_"+Math.floor(16777215*e()).toString(36).padStart(5,"0");if(!s.has(t))return t}return"vr_"+Date.now().toString(36)}function Ro(t,e,s){return t.map(t=>t.id===e?{...t,calibration:s}:t)}const Ao=new WeakMap,Fo=(t,e)=>{const s=(t._serverCfg?.spaces||[]).find(t=>t?.id===e);return String(s?.name||s?.id||e)};function No(t,i,o){const c=t.host,d=a(c.hass,c._config?.language),p=(t,e)=>Do(d,t,e),u=i.marker?.vacuum||{},_=Array.isArray(u.map_routes),m=c._vacSource(i)||"",g=e(i.id,u,i.space,m),f=(c._serverCfg?.spaces||[]).filter(t=>"string"==typeof t?.id&&!!t.id).map(t=>({id:t.id,name:String(t.name||t.id)})),b=new Set(f.map(t=>t.id)),v=n(g,[m],t=>c._vacObservedMapId(i,t)),y=r({routes:g,observed:v,spaceIds:b}),$="ready"===y.kind||"needs_calibration"===y.kind||"missing_space"===y.kind?y.route.id:"",w=m?v[m]:void 0,k=async e=>{let o=_?u.map_routes??null:null;if(!o&&(o=function(t,e,i,o){if(!i)return null;const a=t?.calibration;if(!a||"object"!=typeof a)return null;const n=new Set,r=[];for(const t of Object.keys(a)){const l=s(a[t]);if(!l)continue;const h=o(n);n.add(h),r.push({id:h,source:i,map_id:t,space:e,calibration:l})}return r.length?r:null}(u,i.space,m,t=>zo(t))??[],!m&&Object.keys(u.calibration||{}).length))return!1;const a=e(o);return!!a&&(async e=>{const s=c._serverCfg;if(!s)return!1;const o=JSON.parse(JSON.stringify(s));o.markers=o.markers||[];let a=o.markers.find(t=>t.id===i.id);if(!a){if("device"!==i.bindingKind&&"entity"!==i.bindingKind||!i.bindingRef)return!1;a={id:i.id,binding:`${i.bindingKind}:${i.bindingRef}`,space:i.space||null,area:i.area||null,hidden:!!i.hidden},o.markers.push(a)}a.vacuum={...a.vacuum||{},map_routes:e},delete a.vacuum.calibration;const n=c._adoption.beginOptimistic(s,o);c._adoption.stageLocalConfig(o),c._regSignature="",c._maybeRebuildDevices(),c.requestUpdate(),c._saveConfigDebounced.pending()&&c._saveConfigDebounced.cancel();try{return await t._saveConfigNow(),!0}catch(t){return c._rollbackOptimistic(n),c._regSignature="",c._maybeRebuildDevices(),c.requestUpdate(),c._showToast(c._t("toast.cfg_save_failed",{err:c._errText(t)})),!1}})(a)},x=o.candidates.filter(t=>t.entityId!==m&&!g.some(e=>e.source===t.entityId)),S=async(t,e)=>{if(!e||e===t.space)return;await c._confirmDanger({key:"vacuum_route_space",kind:"warning",title:p("vac.route_space_title"),message:p("vac.route_space_body"),objectName:t.map_id||p("vac.route_map_default"),confirmLabel:p("vac.route_space_confirm"),cancelLabel:c._t("btn.cancel")})&&await k(s=>function(t,e,s,i){return t.map(t=>t.id===e?{...t,id:i,space:s,calibration:null}:t)}(s,t.id,e,zo(new Set(g.map(t=>t.id)))))},M=new Map(f.map((t,e)=>[t.id,e])),C=(t,e)=>t.map_id.localeCompare(e.map_id)||t.source.localeCompare(e.source)||t.id.localeCompare(e.id),P=g.filter(t=>b.has(t.space)).sort((t,e)=>(M.get(t.space)??0)-(M.get(e.space)??0)||C(t,e)),D=g.filter(t=>!b.has(t.space)).sort(C),I=[...P,...D],T=!!m&&void 0!==w&&!g.some(t=>t.source===m&&t.map_id===w);let z=Ao.get(t);const R=z?.source||"",A=z?.mapId||"",F=!!z&&g.some(t=>t.source===R&&t.map_id===A);z&&(z.markerId!==i.id||c._vacObservedMapId(i,z.source)!==z.mapId||F&&!z.saving)&&(Ao.delete(t),z=void 0),z?.space&&!b.has(z.space)&&(z=To(z,"",b),Ao.set(t,z));const N=e=>h` -
  • +globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="012abf4b3924ad03971870eb8085ab1ac1a66b0d9b6676fe095285a8b0f201ab";import{e as t,i as e,E as s,s as i,a as o,n as a,f as n,b as r,l,o as h,r as c,A as d,c as p,D as u,w as _,N as m,d as g,g as f,h as b,j as v,k as y,m as $,p as w,q as k,t as x,u as S,v as M,x as C,y as P,z as D,B as I,C as T,F as z,G as R,H as A,I as F,J as N,K as E,L as H,M as O,O as L,P as B,Q as W,R as j,S as G,T as q,U,V as K,W as V,X as J,Y,Z as X,_ as Z,$ as Q,a0 as tt,a1 as et,a2 as st,a3 as it,a4 as ot,a5 as at,a6 as nt,a7 as rt,a8 as lt,a9 as ht,aa as ct,ab as dt,ac as pt,ad as ut,ae as _t,af as mt,ag as gt,ah as ft,ai as bt,aj as vt,ak as yt,al as $t,am as wt,an as kt,ao as xt,ap as St,aq as Mt,ar as Ct,as as Pt,at as Dt,au as It,av as Tt,aw as zt,ax as Rt,ay as At,az as Ft,aA as Nt,aB as Et,aC as Ht,aD as Ot,aE as Lt,aF as Bt,aG as Wt,aH as jt,aI as Gt,aJ as qt,aK as Ut,aL as Kt,aM as Vt,aN as Jt,aO as Yt,aP as Xt,aQ as Zt,aR as Qt,aS as te,aT as ee,aU as se,aV as ie,aW as oe,aX as ae,aY as ne,aZ as re,a_ as le,a$ as he,b0 as ce,b1 as de,b2 as pe,b3 as ue,b4 as _e,b5 as me,b6 as ge,b7 as fe,b8 as be,b9 as ve,ba as ye,bb as $e,bc as we,bd as ke,be as xe,bf as Se,bg as Me,bh as Ce,bi as Pe,bj as De,bk as Ie,bl as Te,bm as ze,bn as Re,bo as Ae,bp as Fe,bq as Ne,br as Ee,bs as He,bt as Oe,bu as Le,bv as Be,bw as We,bx as je,by as Ge,bz as qe,bA as Ue,bB as Ke,bC as Ve,bD as Je,bE as Ye,bF as Xe,bG as Ze,bH as Qe,bI as ts,bJ as es,bK as ss,bL as is,bM as os,bN as as,bO as ns,bP as rs,bQ as ls,bR as hs,bS as cs,bT as ds,bU as ps,bV as us,bW as _s,bX as ms,bY as gs,bZ as fs,b_ as bs,b$ as vs,c0 as ys,c1 as $s,c2 as ws,c3 as ks,c4 as xs,c5 as Ss,c6 as Ms,c7 as Cs,c8 as Ps,c9 as Ds,ca as Is,cb as Ts,cc as zs,cd as Rs,ce as As,cf as Fs,cg as Ns,ch as Es,ci as Hs,cj as Os,ck as Ls,cl as Bs,cm as Ws,cn as js,co as Gs,cp as qs,cq as Us,cr as Ks,cs as Vs,ct as Js,cu as Ys,cv as Xs,cw as Zs,cx as Qs,cy as ti,cz as ei,cA as si,cB as ii,cC as oi,cD as ai,cE as ni,cF as ri,cG as li,cH as hi,cI as ci,cJ as di,cK as pi,cL as ui,cM as _i,cN as mi,cO as gi,cP as fi,cQ as bi,cR as vi,cS as yi,cT as $i,cU as wi,cV as ki,cW as xi,cX as Si,cY as Mi,cZ as Ci,c_ as Pi,c$ as Di,d0 as Ii,d1 as Ti,d2 as zi,d3 as Ri,d4 as Ai,d5 as Fi,d6 as Ni,d7 as Ei,d8 as Hi,d9 as Oi,da as Li,db as Bi,dc as Wi,dd as ji,de as Gi,df as qi,dg as Ui,dh as Ki,di as Vi,dj as Ji,dk as Yi,dl as Xi,dm as Zi,dn as Qi,dp as to,dq as eo,dr as so,ds as io,dt as oo,du as ao,dv as no,dw as ro,dx as lo,dy as ho,dz as co,dA as po,dB as uo,dC as _o}from"./houseplan-card-CrTmJZ8b.js";import{F as mo,f as go,p as fo,c as bo,e as vo,r as yo,a as $o,s as wo}from"./backdrop-pick-CGON6yBi.js";import{t as ko,h as xo,m as So,T as Mo}from"./zigbee-topology-CQT90rCw.js";import{GENERATED_FURNITURE_ART as Co,FURNITURE_ART_FINGERPRINT as Po}from"./furniture-plan-art.generated-C_WDX48s.js";const Do={},Io=t(class extends e{constructor(){super(...arguments),this.ot=Do}render(t,e){return e()}update(t,[e,i]){if(Array.isArray(e)){if(Array.isArray(this.ot)&&this.ot.length===e.length&&e.every((t,e)=>t===this.ot[e]))return s}else if(this.ot===e)return s;return this.ot=Array.isArray(e)?Array.from(e):e,this.render(e,i)}});var To={"gs.hint":"Fill colors apply to every space; each color has its own opacity. Which fill mode a space uses is set in that space's dialog.","gs.show_room_tooltip":"Show the room information window on hover","support.about_group":"About the card","support.guide_group":"Documentation","support.guide":"User guide","support.form_group":"Send a report or suggestion","support.contact":"Contact details (email/tg/WhatsApp), optional.","support.message":"Message","support.attach":"Attach anonymized information from your plan","support.attach_hint":"Includes only allowed plan geometry, settings and bounded runtime facts. Excludes names, Home Assistant IDs, live states, URLs, files, and your message/contact.","support.geometry_warning":"The package contains no names or Home Assistant IDs, but it does contain the exact geometry and dimensions of your home.","support.close_busy_title":"Stop the current operation?","support.close_busy_body":"House Plan is preparing or sending the report. Closing now stops waiting for the result.","support.building":"Preparing anonymized data…","support.preview_summary":"Package v{version} · {spaces} spaces · {size} KiB","support.prepared":"Snapshot prepared {n} min ago","support.show_data":"Show data","support.download":"Download JSON","support.refresh":"Refresh snapshot","support.privacy":"When you send, your message, optional contact and, if selected, exact geometry leave your Home Assistant through the House Plan project relay and are visible to maintainers. The project node keeps the report for up to 30 days. Network infrastructure sees your HA server address, but House Plan does not retain it raw; rate-limit and idempotency metadata is kept for up to 24 hours.","support.error_title":"The report was not sent","support.manual_recovery":"You can keep the message and attachment and continue manually:","support.copy_message":"Copy message","support.success":"Report sent: {id}. Save this number when contacting support.","support.copy_id":"Copy ID","support.sending":"Sending…","support.retry":"Retry","support.send":"Send","support.update_required":"Update the House Plan card and integration to compatible versions to send reports.","support.message_copied":"Message copied","support.id_copied":"Report ID copied","support.copy_failed":"Could not access the clipboard. Select and copy the text manually.","support.validation.message_required":"Enter a message.","support.validation.message_too_long":"The message must contain no more than 10,000 characters.","support.validation.contact_too_long":"Contact details must contain no more than 320 characters.","support.validation.preview_missing":"Wait for the attachment preview or turn the attachment off.","support.validation.preview_expired":"The attachment preview expired. Refresh the snapshot.","support.error.support_invalid_message":"Check the message and try again.","support.error.support_preview_expired":"The attachment preview expired or is no longer available. Refresh the snapshot.","support.error.support_package_too_large":"The anonymized package exceeds the 8 MiB limit.","support.error.support_rate_limited":"Too many reports or previews were requested. Try again later.","support.error.support_unavailable":"The private support service is temporarily unavailable. Your draft remains here.","support.error.support_rejected":"The report did not pass the support service validation.","support.error.unauthorized":"You do not have permission to send this report.","vac.routes_section":"Maps and floors","vac.routes_current_map":"Current map","vac.routes_no_map":"no telemetry","vac.routes_status":"Routing","vac.routes_state_ready":"map assigned and calibrated","vac.routes_state_needs_calibration":"map assigned, calibration needed","vac.routes_state_unmapped":"current map is not assigned to a floor","vac.routes_state_ambiguous":"two maps are indistinguishable — no floor is chosen","vac.routes_state_missing_space":"the map's space was deleted","vac.routes_state_none":"no map data","vac.routes_empty":"No map is assigned to a floor yet.","vac.route_map_default":"no map id","vac.route_active":"Active","vac.route_space":"Space","vac.route_space_none":"not selected","vac.route_status_ready":"ready","vac.route_status_needs_calibration":"needs calibration","vac.route_status_ambiguous":"ambiguous","vac.route_status_missing_space":"space deleted","vac.route_missing_space_group":"Deleted space","vac.route_add_current":"Add current map","vac.route_delete":"Remove map","vac.route_delete_title":"Remove the map from its floor?","vac.route_delete_body":"Calibration and saved paths for this map will be removed. Continue?","vac.route_delete_confirm":"Remove","vac.route_space_title":"Move the map to another space?","vac.route_space_body":"Calibration and saved paths for this map will be removed. Continue?","vac.route_space_confirm":"Move","vac.route_missing_space_hint":"One of the maps points at a deleted space: pick a new one or remove the map. Until then the robot is not drawn for that map.","vac.route_default_hint":"The source reports no stable map id. Several floors cannot be told apart without another source or the robot's own selected map.","vac.route_target_hint":"The dock stays in the “{space}” space regardless of the current map.","vac.route_add_source":"Add a map source","vac.route_add_source_hint":"For integrations that give each map its own camera. The “All cameras” section above widens this list.","vac.route_source_no_map":"no map reported"};const zo={en:To,ru:{"gs.hint":"Цвета заливок действуют на все пространства; у каждого цвета своя прозрачность. Какой режим заливки использует пространство — задаётся в его диалоге.","gs.show_room_tooltip":"Показывать окно с информацией при наведении на комнату","support.about_group":"О карточке","support.guide_group":"Документация","support.guide":"Руководство пользователя","support.form_group":"Отправить репорт или предложение","support.contact":"Контакт для связи (email/tg/WhatsApp), необязательно.","support.message":"Сообщение","support.attach":"Прикрепить обезличенную информацию из вашего плана","support.attach_hint":"В пакет входят только разрешённые геометрия, настройки и ограниченные сведения о среде. Не входят имена, HA id, текущие состояния, URL, файлы, сообщение и контакт.","support.geometry_warning":"Пакет не содержит имён и HA id, но содержит точную геометрию и размеры дома.","support.close_busy_title":"Прервать текущую операцию?","support.close_busy_body":"House Plan подготавливает или отправляет репорт. При закрытии ожидание результата прекратится.","support.building":"Подготавливаем обезличенные данные…","support.preview_summary":"Пакет v{version} · пространств: {spaces} · {size} КиБ","support.prepared":"Снимок подготовлен {n} мин назад","support.show_data":"Показать данные","support.download":"Скачать JSON","support.refresh":"Обновить снимок","support.privacy":"При отправке сообщение, необязательный контакт и, если выбран пакет, точная геометрия покидают ваш Home Assistant через relay проекта House Plan и доступны мейнтейнерам. Узел проекта хранит репорт до 30 дней. Сетевая инфраструктура видит адрес сервера HA, но House Plan не сохраняет его в исходном виде; метаданные лимитов и идемпотентности хранятся до 24 часов.","support.error_title":"Репорт не отправлен","support.manual_recovery":"Сообщение и вложение можно сохранить и продолжить вручную:","support.copy_message":"Копировать сообщение","support.success":"Репорт отправлен: {id}. Сохраните номер для связи с поддержкой.","support.copy_id":"Копировать ID","support.sending":"Отправляем…","support.retry":"Повторить","support.send":"Отправить","support.update_required":"Обновите карточку и интеграцию House Plan до совместимых версий, чтобы отправлять репорты.","support.message_copied":"Сообщение скопировано","support.id_copied":"ID репорта скопирован","support.copy_failed":"Не удалось получить доступ к буферу обмена. Выделите и скопируйте текст вручную.","support.validation.message_required":"Введите сообщение.","support.validation.message_too_long":"Сообщение должно содержать не более 10 000 символов.","support.validation.contact_too_long":"Контакт должен содержать не более 320 символов.","support.validation.preview_missing":"Дождитесь предпросмотра вложения или отключите его.","support.validation.preview_expired":"Предпросмотр вложения истёк. Обновите снимок.","support.error.support_invalid_message":"Проверьте сообщение и повторите попытку.","support.error.support_preview_expired":"Предпросмотр вложения истёк или больше недоступен. Обновите снимок.","support.error.support_package_too_large":"Обезличенный пакет превышает лимит 8 МиБ.","support.error.support_rate_limited":"Запрошено слишком много репортов или предпросмотров. Повторите позже.","support.error.support_unavailable":"Закрытая служба поддержки временно недоступна. Черновик сохранён в этом окне.","support.error.support_rejected":"Репорт не прошёл проверку службы поддержки.","support.error.unauthorized":"У вас нет прав на отправку этого репорта.","vac.routes_section":"Карты и этажи","vac.routes_current_map":"Текущая карта","vac.routes_no_map":"источник молчит","vac.routes_status":"Маршрутизация","vac.routes_state_ready":"карта сопоставлена и откалибрована","vac.routes_state_needs_calibration":"карта сопоставлена, нужна калибровка","vac.routes_state_unmapped":"текущая карта не сопоставлена этажу","vac.routes_state_ambiguous":"две карты неразличимы — этаж не выбирается","vac.routes_state_missing_space":"пространство карты удалено","vac.routes_state_none":"нет данных о карте","vac.routes_empty":"Ни одна карта ещё не сопоставлена этажу.","vac.route_map_default":"без идентификатора","vac.route_active":"Текущая","vac.route_space":"Пространство","vac.route_space_none":"не выбрано","vac.route_status_ready":"готова","vac.route_status_needs_calibration":"нужна калибровка","vac.route_status_ambiguous":"неоднозначна","vac.route_status_missing_space":"пространство удалено","vac.route_missing_space_group":"Пространство удалено","vac.route_add_current":"Добавить текущую карту","vac.route_delete":"Удалить карту","vac.route_delete_title":"Удалить карту с этажа?","vac.route_delete_body":"Калибровка и сохранённые пути этой карты будут удалены. Продолжить?","vac.route_delete_confirm":"Удалить","vac.route_space_title":"Перенести карту в другое пространство?","vac.route_space_body":"Калибровка и сохранённые пути этой карты будут удалены. Продолжить?","vac.route_space_confirm":"Перенести","vac.route_missing_space_hint":"Одна из карт ссылается на удалённое пространство: выберите новое или удалите карту. Пока ссылка не исправлена, робот на этой карте не рисуется.","vac.route_default_hint":"Источник не сообщает стабильный идентификатор карты. Несколько этажей нельзя различить без другого источника или собственной карты робота.","vac.route_target_hint":"Док остаётся в пространстве «{space}» независимо от текущей карты.","vac.route_add_source":"Добавить источник карты","vac.route_add_source_hint":"Для интеграций, где у каждой карты своя камера. Список расширяется разделом «Все камеры» выше.","vac.route_source_no_map":"карта не читается"},de:{"gs.hint":"Füllfarben gelten für jeden Bereich; jede Farbe hat ihre eigene Deckkraft. Der Füllmodus wird in den Einstellungen des jeweiligen Bereichs festgelegt.","gs.show_room_tooltip":"Rauminformationen beim Darüberfahren anzeigen","support.about_group":"Über die Karte","support.guide_group":"Dokumentation","support.guide":"Benutzerhandbuch","support.form_group":"Bericht oder Vorschlag senden","support.contact":"Kontakt (E-Mail/tg/WhatsApp), optional.","support.message":"Nachricht","support.attach":"Anonymisierte Informationen aus dem Plan anhängen","support.attach_hint":"Enthält nur erlaubte Plangeometrie, Einstellungen und begrenzte Laufzeitdaten. Namen, Home-Assistant-IDs, Live-Zustände, URLs, Dateien, Nachricht und Kontakt werden ausgeschlossen.","support.geometry_warning":"Das Paket enthält keine Namen oder Home-Assistant-IDs, aber die exakte Geometrie und die Maße Ihres Hauses.","support.close_busy_title":"Aktuellen Vorgang abbrechen?","support.close_busy_body":"House Plan bereitet den Bericht vor oder sendet ihn. Beim Schließen wird nicht weiter auf das Ergebnis gewartet.","support.building":"Anonymisierte Daten werden vorbereitet…","support.preview_summary":"Paket v{version} · {spaces} Bereiche · {size} KiB","support.prepared":"Schnappschuss vor {n} Min. erstellt","support.show_data":"Daten anzeigen","support.download":"JSON herunterladen","support.refresh":"Schnappschuss aktualisieren","support.privacy":"Beim Senden verlassen Ihre Nachricht, der optionale Kontakt und, falls ausgewählt, die exakte Geometrie Ihren Home Assistant über das House-Plan-Projektrelay und sind für die Maintainer sichtbar. Der Projektserver speichert den Bericht bis zu 30 Tage. Die Netzwerkinfrastruktur sieht die Adresse Ihres HA-Servers, House Plan speichert sie jedoch nicht im Rohformat; Limit- und Idempotenzdaten bleiben bis zu 24 Stunden erhalten.","support.error_title":"Der Bericht wurde nicht gesendet","support.manual_recovery":"Nachricht und Anhang können gespeichert und manuell weitergegeben werden:","support.copy_message":"Nachricht kopieren","support.success":"Bericht gesendet: {id}. Bewahren Sie diese Nummer für den Support auf.","support.copy_id":"ID kopieren","support.sending":"Wird gesendet…","support.retry":"Erneut versuchen","support.send":"Senden","support.update_required":"Aktualisieren Sie House-Plan-Karte und Integration auf kompatible Versionen, um Berichte zu senden.","support.message_copied":"Nachricht kopiert","support.id_copied":"Berichts-ID kopiert","support.copy_failed":"Kein Zugriff auf die Zwischenablage. Markieren und kopieren Sie den Text manuell.","support.validation.message_required":"Geben Sie eine Nachricht ein.","support.validation.message_too_long":"Die Nachricht darf höchstens 10.000 Zeichen enthalten.","support.validation.contact_too_long":"Der Kontakt darf höchstens 320 Zeichen enthalten.","support.validation.preview_missing":"Warten Sie auf die Vorschau oder deaktivieren Sie den Anhang.","support.validation.preview_expired":"Die Anhangsvorschau ist abgelaufen. Aktualisieren Sie den Schnappschuss.","support.error.support_invalid_message":"Prüfen Sie die Nachricht und versuchen Sie es erneut.","support.error.support_preview_expired":"Die Anhangsvorschau ist abgelaufen oder nicht mehr verfügbar. Aktualisieren Sie den Schnappschuss.","support.error.support_package_too_large":"Das anonymisierte Paket überschreitet das Limit von 8 MiB.","support.error.support_rate_limited":"Zu viele Berichte oder Vorschauen wurden angefordert. Versuchen Sie es später erneut.","support.error.support_unavailable":"Der private Supportdienst ist vorübergehend nicht verfügbar. Der Entwurf bleibt in diesem Fenster erhalten.","support.error.support_rejected":"Der Bericht hat die Prüfung des Supportdienstes nicht bestanden.","support.error.unauthorized":"Sie dürfen diesen Bericht nicht senden.","vac.routes_section":"Karten und Etagen","vac.routes_current_map":"Aktuelle Karte","vac.routes_no_map":"keine Telemetrie","vac.routes_status":"Zuordnung","vac.routes_state_ready":"Karte zugeordnet und kalibriert","vac.routes_state_needs_calibration":"Karte zugeordnet, Kalibrierung nötig","vac.routes_state_unmapped":"aktuelle Karte keiner Etage zugeordnet","vac.routes_state_ambiguous":"zwei Karten nicht unterscheidbar — keine Etage gewählt","vac.routes_state_missing_space":"der Raum der Karte wurde gelöscht","vac.routes_state_none":"keine Kartendaten","vac.routes_empty":"Noch keine Karte einer Etage zugeordnet.","vac.route_map_default":"ohne Karten-ID","vac.route_active":"Aktiv","vac.route_space":"Raum","vac.route_space_none":"nicht gewählt","vac.route_status_ready":"bereit","vac.route_status_needs_calibration":"Kalibrierung nötig","vac.route_status_ambiguous":"mehrdeutig","vac.route_status_missing_space":"Raum gelöscht","vac.route_missing_space_group":"Gelöschter Bereich","vac.route_add_current":"Aktuelle Karte hinzufügen","vac.route_delete":"Karte entfernen","vac.route_delete_title":"Karte von der Etage entfernen?","vac.route_delete_body":"Kalibrierung und gespeicherte Pfade dieser Karte werden entfernt. Fortfahren?","vac.route_delete_confirm":"Entfernen","vac.route_space_title":"Karte in einen anderen Raum verschieben?","vac.route_space_body":"Kalibrierung und gespeicherte Pfade dieser Karte werden entfernt. Fortfahren?","vac.route_space_confirm":"Verschieben","vac.route_missing_space_hint":"Eine Karte verweist auf einen gelöschten Raum: neuen wählen oder Karte entfernen. Bis dahin wird der Roboter für diese Karte nicht gezeichnet.","vac.route_default_hint":"Die Quelle meldet keine stabile Karten-ID. Mehrere Etagen lassen sich ohne andere Quelle oder die vom Roboter gewählte Karte nicht unterscheiden.","vac.route_target_hint":"Die Station bleibt unabhängig von der aktuellen Karte im Raum „{space}“.","vac.route_add_source":"Kartenquelle hinzufügen","vac.route_add_source_hint":"Für Integrationen, die jeder Karte eine eigene Kamera geben. Der Abschnitt „Alle Kameras“ oben erweitert diese Liste.","vac.route_source_no_map":"keine Karte gemeldet"},fr:{"gs.hint":"Les couleurs de remplissage s’appliquent à tous les espaces ; chaque couleur possède sa propre opacité. Le mode de remplissage utilisé par un espace se règle dans la boîte de dialogue de cet espace.","gs.show_room_tooltip":"Afficher les informations de la pièce au survol","support.about_group":"À propos de la carte","support.guide_group":"Documentation d’aide","support.guide":"Guide utilisateur","support.form_group":"Envoyer un rapport ou une suggestion","support.contact":"Contact (e-mail/tg/WhatsApp), facultatif.","support.message":"Votre message","support.attach":"Joindre des informations anonymisées de votre plan","support.attach_hint":"Inclut uniquement la géométrie, les réglages autorisés et des données d’exécution limitées. Exclut les noms, identifiants Home Assistant, états en direct, URL, fichiers, message et contact.","support.geometry_warning":"Le paquet ne contient ni noms ni identifiants Home Assistant, mais il contient la géométrie et les dimensions exactes de votre logement.","support.close_busy_title":"Interrompre l’opération en cours ?","support.close_busy_body":"House Plan prépare ou envoie le rapport. Fermer maintenant arrête l’attente du résultat.","support.building":"Préparation des données anonymisées…","support.preview_summary":"Paquet v{version} · {spaces} espaces · {size} Kio","support.prepared":"Instantané préparé il y a {n} min","support.show_data":"Afficher les données","support.download":"Télécharger le JSON","support.refresh":"Actualiser l’instantané","support.privacy":"Lors de l’envoi, votre message, le contact facultatif et, si elle est sélectionnée, la géométrie exacte quittent votre Home Assistant via le relais du projet House Plan et sont visibles par les mainteneurs. Le serveur du projet conserve le rapport jusqu’à 30 jours. L’infrastructure réseau voit l’adresse de votre serveur HA, mais House Plan ne la conserve pas en clair ; les métadonnées de limitation et d’idempotence sont gardées jusqu’à 24 heures.","support.error_title":"Le rapport n’a pas été envoyé","support.manual_recovery":"Vous pouvez conserver le message et la pièce jointe puis continuer manuellement :","support.copy_message":"Copier le message","support.success":"Rapport envoyé : {id}. Conservez ce numéro pour contacter l’assistance.","support.copy_id":"Copier l’ID","support.sending":"Envoi…","support.retry":"Réessayer","support.send":"Envoyer","support.update_required":"Mettez à jour la carte et l’intégration House Plan vers des versions compatibles pour envoyer des rapports.","support.message_copied":"Message copié","support.id_copied":"ID du rapport copié","support.copy_failed":"Impossible d’accéder au presse-papiers. Sélectionnez et copiez le texte manuellement.","support.validation.message_required":"Saisissez un message.","support.validation.message_too_long":"Le message ne doit pas dépasser 10 000 caractères.","support.validation.contact_too_long":"Le contact ne doit pas dépasser 320 caractères.","support.validation.preview_missing":"Attendez l’aperçu de la pièce jointe ou désactivez-la.","support.validation.preview_expired":"L’aperçu de la pièce jointe a expiré. Actualisez l’instantané.","support.error.support_invalid_message":"Vérifiez le message et réessayez.","support.error.support_preview_expired":"L’aperçu de la pièce jointe a expiré ou n’est plus disponible. Actualisez l’instantané.","support.error.support_package_too_large":"Le paquet anonymisé dépasse la limite de 8 Mio.","support.error.support_rate_limited":"Trop de rapports ou d’aperçus ont été demandés. Réessayez plus tard.","support.error.support_unavailable":"Le service d’assistance privé est temporairement indisponible. Le brouillon reste dans cette fenêtre.","support.error.support_rejected":"Le rapport n’a pas passé la validation du service d’assistance.","support.error.unauthorized":"Vous n’êtes pas autorisé à envoyer ce rapport.","vac.routes_section":"Cartes et étages","vac.routes_current_map":"Carte actuelle","vac.routes_no_map":"aucune télémétrie","vac.routes_status":"Routage","vac.routes_state_ready":"carte assignée et calibrée","vac.routes_state_needs_calibration":"carte assignée, calibrage requis","vac.routes_state_unmapped":"carte actuelle non assignée à un étage","vac.routes_state_ambiguous":"deux cartes indiscernables — aucun étage choisi","vac.routes_state_missing_space":"l'espace de la carte a été supprimé","vac.routes_state_none":"aucune donnée de carte","vac.routes_empty":"Aucune carte n'est encore assignée à un étage.","vac.route_map_default":"sans identifiant","vac.route_active":"Active","vac.route_space":"Espace","vac.route_space_none":"non sélectionné","vac.route_status_ready":"prête","vac.route_status_needs_calibration":"calibrage requis","vac.route_status_ambiguous":"ambiguë","vac.route_status_missing_space":"espace supprimé","vac.route_missing_space_group":"Espace supprimé","vac.route_add_current":"Ajouter la carte actuelle","vac.route_delete":"Supprimer la carte","vac.route_delete_title":"Retirer la carte de son étage ?","vac.route_delete_body":"Le calibrage et les trajets enregistrés de cette carte seront supprimés. Continuer ?","vac.route_delete_confirm":"Supprimer","vac.route_space_title":"Déplacer la carte vers un autre espace ?","vac.route_space_body":"Le calibrage et les trajets enregistrés de cette carte seront supprimés. Continuer ?","vac.route_space_confirm":"Déplacer","vac.route_missing_space_hint":"Une carte pointe vers un espace supprimé : choisissez-en un autre ou supprimez la carte. D'ici là, le robot n'est pas dessiné pour cette carte.","vac.route_default_hint":"La source ne fournit pas d'identifiant de carte stable. Plusieurs étages ne peuvent pas être distingués sans une autre source ou la carte sélectionnée du robot.","vac.route_target_hint":"La station reste dans l'espace « {space} » quelle que soit la carte actuelle.","vac.route_add_source":"Ajouter une source de carte","vac.route_add_source_hint":"Pour les intégrations qui donnent à chaque carte sa propre caméra. La section « Toutes les caméras » ci-dessus élargit cette liste.","vac.route_source_no_map":"aucune carte signalée"}};function Ro(t,e,s){return i(zo[t]?.[e]??To[e]??e,s)}function Ao(t,e,s,i,o){return{markerId:t,source:i,mapId:o,space:e.length?"":s}}function Fo(t,e,s){return{...t,space:s.has(e)?e:""}}function No(t,e=Math.random){const s=new Set(t);for(let t=0;t<64;t+=1){const t="vr_"+Math.floor(16777215*e()).toString(36).padStart(5,"0");if(!s.has(t))return t}return"vr_"+Date.now().toString(36)}function Eo(t,e,s){return t.map(t=>t.id===e?{...t,calibration:s}:t)}const Ho=new WeakMap,Oo=(t,e)=>{const s=(t._serverCfg?.spaces||[]).find(t=>t?.id===e);return String(s?.name||s?.id||e)};function Lo(t,e,s){const i=t.host,n=l(i.hass,i._config?.language),r=(t,e)=>Ro(n,t,e),u=e.marker?.vacuum||{},_=Array.isArray(u.map_routes),m=i._vacSource(e)||"",g=o(e.id,u,e.space,m),f=(i._serverCfg?.spaces||[]).filter(t=>"string"==typeof t?.id&&!!t.id).map(t=>({id:t.id,name:String(t.name||t.id)})),b=new Set(f.map(t=>t.id)),v=h(g,[m],t=>i._vacObservedMapId(e,t)),y=c({routes:g,observed:v,spaceIds:b}),$="ready"===y.kind||"needs_calibration"===y.kind||"missing_space"===y.kind?y.route.id:"",w=m?v[m]:void 0,k=async s=>{let o=_?u.map_routes??null:null;if(!o&&(o=function(t,e,s,i){if(!s)return null;const o=t?.calibration;if(!o||"object"!=typeof o)return null;const n=new Set,r=[];for(const t of Object.keys(o)){const l=a(o[t]);if(!l)continue;const h=i(n);n.add(h),r.push({id:h,source:s,map_id:t,space:e,calibration:l})}return r.length?r:null}(u,e.space,m,t=>No(t))??[],!m&&Object.keys(u.calibration||{}).length))return!1;const n=s(o);return!!n&&(async s=>{const o=i._serverCfg;if(!o)return!1;const a=JSON.parse(JSON.stringify(o));a.markers=a.markers||[];let n=a.markers.find(t=>t.id===e.id);if(!n){if("device"!==e.bindingKind&&"entity"!==e.bindingKind||!e.bindingRef)return!1;n={id:e.id,binding:`${e.bindingKind}:${e.bindingRef}`,space:e.space||null,area:e.area||null,hidden:!!e.hidden},a.markers.push(n)}n.vacuum={...n.vacuum||{},map_routes:s},delete n.vacuum.calibration;const r=i._adoption.beginOptimistic(o,a);i._adoption.stageLocalConfig(a),i._regSignature="",i._maybeRebuildDevices(),i.requestUpdate(),i._saveConfigDebounced.pending()&&i._saveConfigDebounced.cancel();try{return await t._saveConfigNow(),!0}catch(t){return i._rollbackOptimistic(r),i._regSignature="",i._maybeRebuildDevices(),i.requestUpdate(),i._showToast(i._t("toast.cfg_save_failed",{err:i._errText(t)})),!1}})(n)},x=s.candidates.filter(t=>t.entityId!==m&&!g.some(e=>e.source===t.entityId)),S=async(t,e)=>{if(!e||e===t.space)return;await i._confirmDanger({key:"vacuum_route_space",kind:"warning",title:r("vac.route_space_title"),message:r("vac.route_space_body"),objectName:t.map_id||r("vac.route_map_default"),confirmLabel:r("vac.route_space_confirm"),cancelLabel:i._t("btn.cancel")})&&await k(s=>function(t,e,s,i){return t.map(t=>t.id===e?{...t,id:i,space:s,calibration:null}:t)}(s,t.id,e,No(new Set(g.map(t=>t.id)))))},M=new Map(f.map((t,e)=>[t.id,e])),C=(t,e)=>t.map_id.localeCompare(e.map_id)||t.source.localeCompare(e.source)||t.id.localeCompare(e.id),P=g.filter(t=>b.has(t.space)).sort((t,e)=>(M.get(t.space)??0)-(M.get(e.space)??0)||C(t,e)),D=g.filter(t=>!b.has(t.space)).sort(C),I=[...P,...D],T=!!m&&void 0!==w&&!g.some(t=>t.source===m&&t.map_id===w);let z=Ho.get(t);const R=z?.source||"",A=z?.mapId||"",F=!!z&&g.some(t=>t.source===R&&t.map_id===A);z&&(z.markerId!==e.id||i._vacObservedMapId(e,z.source)!==z.mapId||F&&!z.saving)&&(Ho.delete(t),z=void 0),z?.space&&!b.has(z.space)&&(z=Fo(z,"",b),Ho.set(t,z));const N=s=>p` +
  • - ${e.map_id||p("vac.route_map_default")} - ${e.id===$?h`${p("vac.route_active")}`:l} + ${s.map_id||r("vac.route_map_default")} + ${s.id===$?p`${r("vac.route_active")}`:d}
    - ${e.source} -
    ${(t=>b.has(t.space)?t.calibration?"ambiguous"===y.kind&&y.routeIds.includes(t.id)?p("vac.route_status_ambiguous"):p("vac.route_status_ready"):p("vac.route_status_needs_calibration"):p("vac.route_status_missing_space"))(e)}
    + ${s.source} +
    ${(t=>b.has(t.space)?t.calibration?"ambiguous"===y.kind&&y.routeIds.includes(t.id)?r("vac.route_status_ambiguous"):r("vac.route_status_ready"):r("vac.route_status_needs_calibration"):r("vac.route_status_missing_space"))(s)}
    + @click=${()=>t._vacStartFit(e,s.id)}>${i._t("vac.fit")} + @click=${()=>{(async t=>{await i._confirmDanger({key:"vacuum_route_delete",kind:"destructive",title:r("vac.route_delete_title"),message:r("vac.route_delete_body"),objectName:t.map_id||r("vac.route_map_default"),confirmLabel:r("vac.route_delete_confirm"),cancelLabel:i._t("btn.cancel")})&&await k(e=>function(t,e){return t.filter(t=>t.id!==e)}(e,t.id))})(s)}}>${r("vac.route_delete")}
    -
  • `,E=`vacroute-missing-${i.id.replace(/[^a-zA-Z0-9_-]/g,"-")}`;return h` - + `,E=`vacroute-missing-${e.id.replace(/[^a-zA-Z0-9_-]/g,"-")}`;return p` +
    -
    ${p("vac.routes_current_map")}${void 0===w?p("vac.routes_no_map"):w||p("vac.route_map_default")}
    -
    ${p("vac.routes_status")}${p(`vac.routes_state_${y.kind}`)}
    +
    ${r("vac.routes_current_map")}${void 0===w?r("vac.routes_no_map"):w||r("vac.route_map_default")}
    +
    ${r("vac.routes_status")}${r(`vac.routes_state_${y.kind}`)}
    - ${P.length||z?h`
      - ${z?h` + ${P.length||z?p`
        + ${z?p`
      • -
        ${z.mapId||p("vac.route_map_default")}
        +
        ${z.mapId||r("vac.route_map_default")}
        ${z.source}
        + @click=${()=>{Ho.get(t)?.saving||(Ho.delete(t),i.requestUpdate())}}>${i._t("btn.cancel")} + @click=${()=>{(async()=>{const e=Ho.get(t);if(!e||e.saving||!b.has(e.space))return;Ho.set(t,{...e,saving:!0}),i.requestUpdate();const s=await k(t=>function(t,e,s,i){return e.source&&s.has(e.space)&&!t.some(t=>t.source===e.source&&t.map_id===e.mapId)?function(t,e,s){return[...t,{...e,id:s,calibration:e.calibration??null}]}(t,{source:e.source,map_id:e.mapId,space:e.space},i):null}(t,e,b,No(new Set(t.map(t=>t.id))))),o=Ho.get(t);o?.markerId===e.markerId&&o.source===e.source&&o.mapId===e.mapId&&(s?Ho.delete(t):Ho.set(t,e)),i.requestUpdate()})()}}>${i._t("btn.save")}
        -
      • `:l} + `:d} ${P.map(N)} -
      `:l} - ${D.length?h` +
    `:d} + ${D.length?p`

    - ${p("vac.route_missing_space_group")} + ${r("vac.route_missing_space_group")}

      ${D.map(N)}
    -
    `:l} - ${I.length||z?l:h`
    ${p("vac.routes_empty")}
    `} + `:d} + ${I.length||z?d:p`
    ${r("vac.routes_empty")}
    `}
    + @click=${()=>{m&&void 0!==w&&(Ho.set(t,Ao(e.id,g,e.space,m,w)),i.requestUpdate())}}>${r("vac.route_add_current")}
    - ${x.length?h`
    - ${p("vac.route_add_source")} -
    ${p("vac.route_add_source_hint")}
    + ${x.length?p`
    + ${r("vac.route_add_source")} +
    ${r("vac.route_add_source_hint")}
    - ${x.map(e=>{const s=c._vacObservedMapId(i,e.entityId);return h``})}
    -
    `:l} - ${I.some(t=>!b.has(t.space))?h` -
    ${p("vac.route_missing_space_hint")}
    `:l} - ${g.some(t=>"default"===t.map_id)?h` -
    ${p("vac.route_default_hint")}
    `:l} - ${I.length?h`
    ${p("vac.route_target_hint",{space:Fo(c,i.space)})}
    `:l} -
    `}const Eo=new WeakMap;function Ho(t,e,s){let i=Eo.get(t);i||(i=new Map,Eo.set(t,i));const o=i.get(e);if(o)return void(o.run=s);const a={run:s};i.set(e,a),queueMicrotask(()=>{i.get(e)===a&&(i.delete(e),a.run())})}function Oo(t,e){const s=Eo.get(t),i=s?.get(e);i&&(s.delete(e),i.run())}function Lo(t,e){const s=Eo.get(t);if(!s)return;const i=e?[...s].filter(([t])=>t===e):[...s];for(const[t]of i)s.delete(t);s.size||Eo.delete(t)}const Bo=new WeakMap,Wo=new Set(["_cursorPt","_opMeasure","_physicalDrag","_physicalRotate","_decorDraft","_dtBox","_dtDrag","_bdDrag","_furnPreviewInput","_layout"]),jo=new Set(["_cursorPt","_opMeasure","_furnPreviewInput"]),Go=new Set(["_physicalDrag","_physicalRotate","_decorDraft","_dtDrag","_bdDrag"]),qo=t=>{let e=Bo.get(t);return e||(e={raf:0,requestedRevision:0,paintedRevision:0,waiters:[],hidden:[],transparent:[],dimmed:[]},Bo.set(t,e)),e},Uo=(t,e)=>{t.paintedRevision=Math.max(t.paintedRevision,e);const s=t.waiters.filter(e=>e.revision<=t.paintedRevision);t.waiters=t.waiters.filter(e=>e.revision>t.paintedRevision);for(const t of s)t.resolve()},Ko=t=>!!("view"!==t._mode&&(t._deviceDrag||t._physicalDrag||t._physicalRotate||t._decorDraft||t._decorMove||t._dtDrag||t._bdDrag||t._opDrag||t._resize?.dragging));function Vo(t,e,s){const i=t;if(!i?.isConnected||"view"===i._mode)return!1;const o=void 0!==e&&Wo.has(e);if("_layout"===e&&!i._deviceDrag)return!1;if("_dtBox"===e&&!i._dtDrag)return!1;if(void 0!==e&&Go.has(e)&&null==s&&null!=i[e]&&Ko(i))return!1;if(void 0!==e&&Go.has(e)&&null==i[e])return!1;if(void 0!==e&&jo.has(e)&&null==i[e])return!1;return!!(o&&(jo.has(e)||Ko(i))||void 0===e&&Ko(i))&&(function(t){const e=qo(t);if(e.requestedRevision++,e.raf||"function"!=typeof requestAnimationFrame)return;e.raf=requestAnimationFrame(()=>{e.raf=0;const s=e.requestedRevision;!function(t){const e=t,s=e.renderRoot;if(!s)return;const i=qo(e);Xo(i),ta(e,s);const o=s.querySelector("[data-hp-live-editor]");if(!o)return;if(Yo(i,s,".hp-editor-only-layer:not(.hp-plan-snap-layer)"),"plan"===e._mode)e._opDrag&&Jo(i,s,".wallbodies"),e._resize?.dragging&&(ia(i,s,".wallbodies"),Yo(i,s,".resize-layer"),sa(i,s,e._resize.plan?.movingOpeningIds||[])),e._opDrag&&Yo(i,s,".openinglayer");else if("decor"===e._mode){const t=e._dtDrag?.id||e._decorMove?.id;t&&ea(i,s,t),Yo(i,s,".dtframe, .backdropframe")}c(Qo(e),o);const a=s.querySelector("[data-hp-live-editor-html]");if(a){const t=e._viewOr(e._baseVb());c(e._renderLiveEditorMeasurements(t),a)}e._liveEditorPaintCount=(e._liveEditorPaintCount||0)+1}(t),Uo(e,s)})}(i),!0)}const Jo=(t,e,s)=>{for(const i of e.querySelectorAll(s))i.closest("[data-hp-live-editor]")||"hidden"!==i.style.visibility&&(i.style.visibility="hidden",t.hidden.push(i))},Yo=(t,e,s)=>{for(const i of e.querySelectorAll(s))i.closest("[data-hp-live-editor]")||"0"!==i.style.opacity&&(i.style.opacity="0",t.transparent.push(i))},Xo=t=>{for(const e of t.hidden)e.style.removeProperty("visibility");t.hidden.length=0;for(const e of t.transparent)e.style.removeProperty("opacity");t.transparent.length=0;for(const e of t.dimmed)e.style.removeProperty("opacity");t.dimmed.length=0},Zo=(t,e,s=[])=>{if("iso"===t._renderProjection)return d``;const i=t._spaceModel();if(!i)return d``;const o=new Set(s),a=(i.rooms||[]).filter(t=>!!t.id&&o.has(t.id)).flatMap(t=>{const e=t.poly||[];return e.map((t,s)=>[t,e[(s+1)%e.length]])}),n=(t,e)=>{const[s,i]=e,o=i[0]-s[0],a=i[1]-s[1],n=o*o+a*a;if(!(n>0))return!1;const r=((t[0]-s[0])*o+(t[1]-s[1])*a)/n,l=Math.max(0,Math.min(1,r));return Math.hypot(t[0]-s[0]-o*l,t[1]-s[1]-a*l)<1e-4},r=[...t._spaceWalls.filter(t=>{const e=(t.a||[]).map(t=>t*p),s=(t.b||[]).map(t=>t*p);return a.some(t=>n(e,t)&&n(s,t))}).map((e,s)=>((e,s,i,o)=>{const a=Math.hypot(s[0]-e[0],s[1]-e[1]);if(!(a>1e-9&&i>0))return null;const n=b(i,t._cellCm,t._gridPitch)/2,r=-(s[1]-e[1])/a*n,l=(s[0]-e[0])/a*n;return{key:o,kind:"outer",cm:i,a:e,b:s,depthUnits:2*n,quad:[[e[0]+r,e[1]+l],[s[0]+r,s[1]+l],[s[0]-r,s[1]-l],[e[0]-r,e[1]-l]]}})((e.a||[]).map(t=>t*p),(e.b||[]).map(t=>t*p),e.cm,e.key||`wall-${s}`))].filter(t=>!!t),l=t._openingsR.map(t=>({x:t.rx,y:t.ry,angle:t.angle,length:t.rlen})),h=r.map(t=>u(t,l)).filter(Boolean);if(!h.length)return d``;const c=Math.max(...r.map(t=>t.depthUnits),0),v=t._viewOr(t._baseVb()),y=t._stageEl?.clientWidth&&v.w?t._stageEl.clientWidth/v.w:1,$=_(c,y)||m(g(t._cellCm),y),w=e?.color||"#607d8b",k=t._fillColors.wall_fill,x=h.join(" ");return d``:d} + ${I.some(t=>!b.has(t.space))?p` +
    ${r("vac.route_missing_space_hint")}
    `:d} + ${g.some(t=>"default"===t.map_id)?p` +
    ${r("vac.route_default_hint")}
    `:d} + ${I.length?p`
    ${r("vac.route_target_hint",{space:Oo(i,e.space)})}
    `:d} +
    `}const Bo=new WeakMap;function Wo(t,e,s){let i=Bo.get(t);i||(i=new Map,Bo.set(t,i));const o=i.get(e);if(o)return void(o.run=s);const a={run:s};i.set(e,a),queueMicrotask(()=>{i.get(e)===a&&(i.delete(e),a.run())})}function jo(t,e){const s=Bo.get(t),i=s?.get(e);i&&(s.delete(e),i.run())}function Go(t,e){const s=Bo.get(t);if(!s)return;const i=e?[...s].filter(([t])=>t===e):[...s];for(const[t]of i)s.delete(t);s.size||Bo.delete(t)}const qo=new WeakMap,Uo=new Set(["_cursorPt","_opMeasure","_physicalDrag","_physicalRotate","_decorDraft","_dtBox","_dtDrag","_bdDrag","_furnPreviewInput","_layout"]),Ko=new Set(["_cursorPt","_opMeasure","_furnPreviewInput"]),Vo=new Set(["_physicalDrag","_physicalRotate","_decorDraft","_dtDrag","_bdDrag"]),Jo=t=>{let e=qo.get(t);return e||(e={raf:0,requestedRevision:0,paintedRevision:0,waiters:[],hidden:[],transparent:[],dimmed:[]},qo.set(t,e)),e},Yo=(t,e)=>{t.paintedRevision=Math.max(t.paintedRevision,e);const s=t.waiters.filter(e=>e.revision<=t.paintedRevision);t.waiters=t.waiters.filter(e=>e.revision>t.paintedRevision);for(const t of s)t.resolve()},Xo=t=>!!("view"!==t._mode&&(t._deviceDrag||t._physicalDrag||t._physicalRotate||t._decorDraft||t._decorMove||t._dtDrag||t._bdDrag||t._opDrag||t._resize?.dragging));function Zo(t,e,s){const i=t;if(!i?.isConnected||"view"===i._mode)return!1;const o=void 0!==e&&Uo.has(e);if("_layout"===e&&!i._deviceDrag)return!1;if("_dtBox"===e&&!i._dtDrag)return!1;if(void 0!==e&&Vo.has(e)&&null==s&&null!=i[e]&&Xo(i))return!1;if(void 0!==e&&Vo.has(e)&&null==i[e])return!1;if(void 0!==e&&Ko.has(e)&&null==i[e])return!1;return!!(o&&(Ko.has(e)||Xo(i))||void 0===e&&Xo(i))&&(function(t){const e=Jo(t);if(e.requestedRevision++,e.raf||"function"!=typeof requestAnimationFrame)return;e.raf=requestAnimationFrame(()=>{e.raf=0;const s=e.requestedRevision;!function(t){const e=t,s=e.renderRoot;if(!s)return;const i=Jo(e);ea(i),oa(e,s);const o=s.querySelector("[data-hp-live-editor]");if(!o)return;if(ta(i,s,".hp-editor-only-layer:not(.hp-plan-snap-layer)"),"plan"===e._mode)e._opDrag&&Qo(i,s,".wallbodies"),e._resize?.dragging&&(ra(i,s,".wallbodies"),ta(i,s,".resize-layer"),na(i,s,e._resize.plan?.movingOpeningIds||[])),e._opDrag&&ta(i,s,".openinglayer");else if("decor"===e._mode){const t=e._dtDrag?.id||e._decorMove?.id;t&&aa(i,s,t),ta(i,s,".dtframe, .backdropframe")}u(ia(e),o);const a=s.querySelector("[data-hp-live-editor-html]");if(a){const t=e._viewOr(e._baseVb());u(e._renderLiveEditorMeasurements(t),a)}e._liveEditorPaintCount=(e._liveEditorPaintCount||0)+1}(t),Yo(e,s)})}(i),!0)}const Qo=(t,e,s)=>{for(const i of e.querySelectorAll(s))i.closest("[data-hp-live-editor]")||"hidden"!==i.style.visibility&&(i.style.visibility="hidden",t.hidden.push(i))},ta=(t,e,s)=>{for(const i of e.querySelectorAll(s))i.closest("[data-hp-live-editor]")||"0"!==i.style.opacity&&(i.style.opacity="0",t.transparent.push(i))},ea=t=>{for(const e of t.hidden)e.style.removeProperty("visibility");t.hidden.length=0;for(const e of t.transparent)e.style.removeProperty("opacity");t.transparent.length=0;for(const e of t.dimmed)e.style.removeProperty("opacity");t.dimmed.length=0},sa=(t,e,s=[])=>{if("iso"===t._renderProjection)return _``;const i=t._spaceModel();if(!i)return _``;const o=new Set(s),a=(i.rooms||[]).filter(t=>!!t.id&&o.has(t.id)).flatMap(t=>{const e=t.poly||[];return e.map((t,s)=>[t,e[(s+1)%e.length]])}),n=(t,e)=>{const[s,i]=e,o=i[0]-s[0],a=i[1]-s[1],n=o*o+a*a;if(!(n>0))return!1;const r=((t[0]-s[0])*o+(t[1]-s[1])*a)/n,l=Math.max(0,Math.min(1,r));return Math.hypot(t[0]-s[0]-o*l,t[1]-s[1]-a*l)<1e-4},r=[...t._spaceWalls.filter(t=>{const e=(t.a||[]).map(t=>t*m),s=(t.b||[]).map(t=>t*m);return a.some(t=>n(e,t)&&n(s,t))}).map((e,s)=>((e,s,i,o)=>{const a=Math.hypot(s[0]-e[0],s[1]-e[1]);if(!(a>1e-9&&i>0))return null;const n=$(i,t._cellCm,t._gridPitch)/2,r=-(s[1]-e[1])/a*n,l=(s[0]-e[0])/a*n;return{key:o,kind:"outer",cm:i,a:e,b:s,depthUnits:2*n,quad:[[e[0]+r,e[1]+l],[s[0]+r,s[1]+l],[s[0]-r,s[1]-l],[e[0]-r,e[1]-l]]}})((e.a||[]).map(t=>t*m),(e.b||[]).map(t=>t*m),e.cm,e.key||`wall-${s}`))].filter(t=>!!t),l=t._openingsR.map(t=>({x:t.rx,y:t.ry,angle:t.angle,length:t.rlen})),h=r.map(t=>g(t,l)).filter(Boolean);if(!h.length)return _``;const c=Math.max(...r.map(t=>t.depthUnits),0),d=t._viewOr(t._baseVb()),p=t._stageEl?.clientWidth&&d.w?t._stageEl.clientWidth/d.w:1,u=f(c,p)||b(v(t._cellCm),p),w=e?.color||"#607d8b",k=t._fillColors.wall_fill,x=h.join(" ");return _` - - `},Qo=t=>{if("plan"===t._mode)return(t=>{const e=t._baseVb(),s=t._viewOr(e),i=t._opMeasureView;if(t._resize?.dragging){const e=t._spaceDisplayForRender(),i=t._resize.plan;return d``},ia=t=>{if("plan"===t._mode)return(t=>{const e=t._baseVb(),s=t._viewOr(e),i=t._opMeasureView;if(t._resize?.dragging){const e=t._spaceDisplayForRender(),i=t._resize.plan;return _``}const o=t._spaceDisplayForRender();return d``}const o=t._spaceDisplayForRender();return _``})(t);if("decor"===t._mode){const e=t._viewOr(t._baseVb()),s=t._dtDrag?.id||t._decorMove?.id||null;return d``})(t);if("decor"===t._mode){const e=t._viewOr(t._baseVb()),s=t._dtDrag?.id||t._decorMove?.id||null;return _``}return d``}return _``},ta=(t,e)=>{const s=t._deviceDrag;if(!s)return;const i=t._devices.find(t=>t.id===s.id),o=[...e.querySelectorAll('[data-hp="device"]')].find(t=>t.dataset.id===s.id);if(!i||!o)return;const a=t._livePos(i),n=t._scenePoint([a.x,a.y]),r=t._viewOr(t._baseVb());o.style.left=(n[0]-r.x)/r.w*100+"%",o.style.top=(n[1]-r.y)/r.h*100+"%"},ea=(t,e,s)=>{for(const i of e.querySelectorAll('.decorlayer [data-hp="decor"]'))i.closest("[data-hp-live-editor]")||i.dataset.id!==s||"0"!==i.style.opacity&&(i.style.opacity="0",t.transparent.push(i))},sa=(t,e,s)=>{const i=new Set(s);for(const s of e.querySelectorAll('.openinglayer [data-hp="opening"]'))!s.closest("[data-hp-live-editor]")&&i.has(s.dataset.id||"")&&(s.style.opacity="0",t.transparent.push(s))},ia=(t,e,s)=>{for(const i of e.querySelectorAll(s))i.closest("[data-hp-live-editor]")||(i.style.opacity="0.35",t.dimmed.push(i))};const oa=(t,e,s)=>Math.min(s,Math.max(e,Number.isFinite(t)?t:e));function aa(t){return Number.isFinite(t)?(t%360+360)%360:0}function na(t){if("string"!=typeof t)return null;const e=t.trim().replace(/^#/,""),s=/^[0-9a-fA-F]{3}$/.test(e)?e.split("").map(t=>`${t}${t}`).join(""):e;return/^[0-9a-fA-F]{6}$/.test(s)?`#${s.toLowerCase()}`:null}function ra(t){const e=na(t);return e?{r:Number.parseInt(e.slice(1,3),16),g:Number.parseInt(e.slice(3,5),16),b:Number.parseInt(e.slice(5,7),16)}:null}function la(t){const e=oa(t.r,0,255)/255,s=oa(t.g,0,255)/255,i=oa(t.b,0,255)/255,o=Math.max(e,s,i),a=o-Math.min(e,s,i);let n=0;return a>0&&(n=o===e?(s-i)/a%6*60:o===s?60*((i-e)/a+2):60*((e-s)/a+4)),{h:aa(n),s:0===o?0:a/o*100,v:100*o}}function ha(t){return function(t){const e=t=>Math.round(oa(t,0,255)).toString(16).padStart(2,"0");return`#${e(t.r)}${e(t.g)}${e(t.b)}`}(function(t){const e=aa(t.h),s=oa(t.s,0,100)/100,i=oa(t.v,0,100)/100,o=i*s,a=o*(1-Math.abs(e/60%2-1)),n=i-o;let r;return r=e<60?[o,a,0]:e<120?[a,o,0]:e<180?[0,o,a]:e<240?[0,a,o]:e<300?[a,0,o]:[o,0,a],{r:Math.round(255*(r[0]+n)),g:Math.round(255*(r[1]+n)),b:Math.round(255*(r[2]+n))}}(t))}const ca={title:"Color picker",hue:"Hue",saturation:"Saturation",value:"Brightness",hex:"Hex color",invalidHex:"Enter a 3- or 6-digit hex color",confirm:"OK"};class da extends y{constructor(){super(...arguments),this.label="",this.opacityLabel="Opacity",this.color="#607d8b",this.opacity=1,this.disabled=!1,this.showOpacity=!0,this.pickerLabels=ca,this._open=!1,this._pickerRaf=0,this._emitRaf=0,this._forceFallback=!1,this._overlayDispose=null,this._hue=0,this._saturation=0,this._value=0,this._hexDraft="#607d8b",this._hexInvalid=!1,this._hexNeedsValidInput=!1,this._lastValidColor="#607d8b",this._activePointerId=null,this._outsidePointerDown=t=>{if(!this._open)return;const e=t.composedPath();this._floating.containsPath(e)||this._closePicker(!1,"outside")},this._keyDown=t=>{this._open&&"Escape"===t.key&&(t.preventDefault(),t.stopImmediatePropagation(),this._closePicker(this._floating.ownsActiveElement(),"escape"))},this._floating=new uo(this,"color-opacity",this._keyDown),this._queuePickerPosition=()=>{if(!this._open)return;this._pickerRaf&&cancelAnimationFrame(this._pickerRaf);const t=this._window();t&&(this._pickerRaf=t.requestAnimationFrame(()=>{this._pickerRaf=0,this._positionPicker()||this._closePicker()}))}}connectedCallback(){super.connectedCallback(),this._syncFromColor(this.color,!1),this.ownerDocument.addEventListener("pointerdown",this._outsidePointerDown,!0),this.ownerDocument.addEventListener("scroll",this._queuePickerPosition,!0);const t=this.ownerDocument.defaultView;t?.addEventListener("resize",this._queuePickerPosition),t?.addEventListener("orientationchange",this._queuePickerPosition),t?.visualViewport?.addEventListener("resize",this._queuePickerPosition),t?.visualViewport?.addEventListener("scroll",this._queuePickerPosition),this.addEventListener("keydown",this._keyDown,!0)}disconnectedCallback(){this.ownerDocument.removeEventListener("pointerdown",this._outsidePointerDown,!0),this.ownerDocument.removeEventListener("scroll",this._queuePickerPosition,!0);const t=this.ownerDocument.defaultView;t?.removeEventListener("resize",this._queuePickerPosition),t?.removeEventListener("orientationchange",this._queuePickerPosition),t?.visualViewport?.removeEventListener("resize",this._queuePickerPosition),t?.visualViewport?.removeEventListener("scroll",this._queuePickerPosition),this.removeEventListener("keydown",this._keyDown,!0),this._pickerRaf&&cancelAnimationFrame(this._pickerRaf),this._emitRaf&&cancelAnimationFrame(this._emitRaf),this._pickerRaf=0,this._emitRaf=0,this._closePicker(!1,"disconnect"),super.disconnectedCallback()}updated(t){if(t.has("color")){const t=na(this.color);t&&t!==this._lastValidColor&&this._syncFromColor(t,this._open)}this.disabled&&this._open?this._closePicker():this._open&&(this._supportsPopover()||this._renderFallback(),(t.has("color")||t.has("opacity")||t.has("showOpacity")||t.has("label")||t.has("opacityLabel")||t.has("pickerLabels"))&&this._queuePickerPosition())}_window(){return this._floating.window()}_supportsPopover(){return this._floating.usesPopover(this._forceFallback)}_dialog(){return this._floating.dialog()}async _toggle(){this.disabled||(this._open?this._closePicker():(this._forceFallback=!1,this._syncFromColor(this.color,!1),this._hexInvalid=!1,this._hexNeedsValidInput=!1,this._activePointerId=null,this._open=!0,await this.updateComplete,this._open&&(this._supportsPopover()||this._renderFallback(),this._positionPicker()?this._overlayDispose=this._dialog()?.registerOverlay({owner:this,group:"transient",close:t=>this._closePicker("escape"===t&&this._floating.ownsActiveElement(),t)})||null:this._closePicker())))}_closePicker(t=!1,e="exclusive"){if(!this._open&&!this._floating.hasFallback)return;const s=this._overlayDispose;this._overlayDispose=null,s?.();const i=this.renderRoot.querySelector(".picker");if(i?.hidePopover)try{i.matches(":popover-open")&&i.hidePopover()}catch{}this._open=!1,this._cancelQueuedEmit(),this._activePointerId=null,this._floating.destroy(),t&&this.updateComplete.then(()=>this.renderRoot.querySelector(".trigger")?.focus())}_surface(){return this._floating.surface(".picker",this._supportsPopover())}_renderFallback(){const t=da.styles.cssText;this._floating.renderFallback(this._pickerTemplate(!1),t)}_positionPicker(){if(!this._open)return!1;const t=this._window(),e=this.renderRoot.querySelector(".trigger");let s=this._surface();if(!t||!e?.isConnected||!s?.isConnected)return!1;const i=_o(t);if(s.style.maxWidth=`${Math.max(0,i.width-16)}px`,s.style.maxHeight=`${Math.max(0,i.height-16)}px`,s.style.visibility="hidden",this._supportsPopover()&&s.showPopover)try{s.matches(":popover-open")||s.showPopover()}catch{if(this._forceFallback=!0,this._renderFallback(),s=this._surface(),!s?.isConnected)return!1;s.style.maxWidth=`${Math.max(0,i.width-16)}px`,s.style.maxHeight=`${Math.max(0,i.height-16)}px`,s.style.visibility="hidden"}const o=e.getBoundingClientRect(),a=s.getBoundingClientRect();if(!(o.width&&o.height&&a.width&&a.height))return!1;const n=mo(o,a,i);return s.style.left=`${n.left}px`,s.style.top=`${n.top}px`,s.dataset.side=n.side,s.style.visibility="",!0}_labels(){const t=this.pickerLabels||ca;return{title:t.title||ca.title,hue:t.hue||ca.hue,saturation:t.saturation||ca.saturation,value:t.value||ca.value,hex:t.hex||ca.hex,invalidHex:t.invalidHex||ca.invalidHex,confirm:t.confirm||ca.confirm}}_syncFromColor(t,e){const s=na($(t,"#607d8b"))||"#607d8b",i=ra(s);if(!i)return;const o=la(i);(!e||o.s>1e-4)&&(this._hue=o.h),this._saturation=o.s,this._value=o.v,this._hexDraft=s,this._hexInvalid=!1,this._hexNeedsValidInput=!1,this._lastValidColor=s}_cancelQueuedEmit(t=!1){this._emitRaf&&cancelAnimationFrame(this._emitRaf),this._emitRaf=0,t&&this._syncFromColor(this._lastValidColor,!0)}_queueHsvEmit(){if(this._emitRaf)return;const t=this._window();t?this._emitRaf=t.requestAnimationFrame(()=>{this._emitRaf=0,this._emitHsv()}):this._emitHsv()}_emitHsv(){this._emit(ha({h:this._hue,s:this._saturation,v:this._value}),this.opacity)}_setHue(t){this._hue=Math.min(359,Math.max(0,Number.isFinite(t)?t:0)),this._emitHsv()}_setSaturation(t){this._saturation=Math.min(100,Math.max(0,Number.isFinite(t)?t:0)),this._emitHsv()}_setValue(t){this._value=Math.min(100,Math.max(0,Number.isFinite(t)?t:0)),this._emitHsv()}_setOpacity(t){this._emit(this._lastValidColor,t)}_shiftRangeKey(t,e,s,i,o){if(!t.shiftKey)return;const a="ArrowRight"===t.key||"ArrowUp"===t.key?10:"ArrowLeft"===t.key||"ArrowDown"===t.key?-10:0;a&&(t.preventDefault(),t.stopPropagation(),o(Math.min(i,Math.max(s,e+a))))}_setSvFromPointer(t,e){const s=t.currentTarget.getBoundingClientRect();s.width&&s.height&&(this._saturation=Math.min(100,Math.max(0,(t.clientX-s.left)/s.width*100)),this._value=Math.min(100,Math.max(0,100*(1-(t.clientY-s.top)/s.height))),e?(this._cancelQueuedEmit(),this._emitHsv()):this._queueHsvEmit())}_svPointerDown(t){if(t.preventDefault(),t.stopPropagation(),null===this._activePointerId){this._activePointerId=t.pointerId;try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}this._setSvFromPointer(t,!0)}}_svPointerMove(t){t.pointerId===this._activePointerId&&(t.preventDefault(),t.stopPropagation(),this._setSvFromPointer(t,!1))}_svPointerUp(t){if(t.pointerId===this._activePointerId){t.preventDefault(),t.stopPropagation(),this._setSvFromPointer(t,!0),this._activePointerId=null;try{t.currentTarget.releasePointerCapture(t.pointerId)}catch{}}}_svPointerCancel(t){t.pointerId===this._activePointerId&&(t.preventDefault(),t.stopPropagation(),this._activePointerId=null,this._cancelQueuedEmit(!0))}_svLostPointerCapture(t){t.pointerId===this._activePointerId&&(this._activePointerId=null,this._cancelQueuedEmit(!0))}_hexInput(t){const e=t.target.value;this._hexDraft=e;const s=na(e),i=s?ra(s):null;if(!s||!i)return void(this._hexInvalid=this._hexNeedsValidInput);this._hexNeedsValidInput=!1,this._hexInvalid=!1;const o=la(i);o.s>1e-4&&(this._hue=o.h),this._saturation=o.s,this._value=o.v,this._emit(s,this.opacity,!0)}_commitHex(){const t=na(this._hexDraft);if(!t)return this._hexDraft=this._lastValidColor,this._hexInvalid=!0,void(this._hexNeedsValidInput=!0);this._hexDraft=t,this._hexNeedsValidInput?this._hexInvalid=!0:(this._hexInvalid=!1,t!==this._lastValidColor&&this._emit(t,this.opacity))}_confirm(t){t.preventDefault(),t.stopPropagation(),this._commitHex(),this._hexInvalid||this._hexNeedsValidInput?this.updateComplete.then(()=>{this._surface()?.querySelector('input[type="text"]')?.focus()}):this._closePicker(!0)}_hexKeyDown(t){"Enter"===t.key&&(t.preventDefault(),t.stopPropagation(),this._commitHex())}_emit(t,e,s=!1){const i=na(t)||this._lastValidColor,o=Number.isFinite(e)?e:Number(this.opacity)||0,a=Math.min(1,Math.max(0,o));this.color=i,this.opacity=a,this._lastValidColor=i,s||(this._hexDraft=i),this._hexInvalid=this._hexNeedsValidInput,this.dispatchEvent(new CustomEvent("hp-color-opacity-change",{detail:{color:i,opacity:a},bubbles:!0,composed:!0}))}_pickerTemplate(t){const e=Math.round(100*Math.min(1,Math.max(0,Number(this.opacity)||0))),s=ha({h:this._hue,s:this._saturation,v:this._value}),i=ha({h:this._hue,s:100,v:100}),o=this._labels(),a=Math.round(this._hue),n=Math.round(this._saturation),r=Math.round(this._value);return h` - - ${t.visualSources.length||t.criticalSources.length?h`
    + ${t.visualSources.length||t.criticalSources.length?p`
    ${this._t("marker.preview.details")}
    - ${[...t.visualSources,...t.criticalSources].map(t=>h` + ${[...t.visualSources,...t.criticalSources].map(t=>p`
    ${t.name}${t.eid} ${t.stateText||t.state} ${this._sourceProvider(t.eid)}
    `)}
    -
    `:l} - ${"icon_ripple"===t.display?h`
    +
    `:d} + ${"icon_ripple"===t.display?p`
    -
    `:l} - `}}$a.properties={hass:{attribute:!1},presentation:{attribute:!1},registry:{attribute:!1},deviceName:{attribute:!1}},$a.styles=[w,v`:host{display:block;min-width:0;}.devicepreview{margin:4px 0 14px;padding:14px;border:1px solid var(--divider-color,rgba(127,127,127,0.28));border-radius:14px;background:color-mix(in srgb,var(--card-background-color,#20232b) 92%,var(--primary-color,#03a9f4));color:var(--primary-text-color,#fff);overflow:hidden;}.previewhead{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;}.previewbadge{padding:3px 9px;border-radius:999px;color:var(--secondary-text-color,#9aa0aa);background:color-mix(in srgb,var(--secondary-text-color,#9aa0aa) 12%,transparent);font-size:12px;font-weight:700;}.previewbadge.example{color:var(--warning-color,#ffb300);}.previewgrid{display:grid;grid-template-columns:minmax(170px,0.8fr) minmax(240px,1.2fr);gap:16px;align-items:stretch;}.previewstage{position:relative;min-height:168px;border-radius:12px;background:var(--secondary-background-color,rgba(0,0,0,0.16));overflow:hidden;pointer-events:none;container-type:inline-size;--icon-size:54px;--device-base-size:48.6px;}.previewfit{position:absolute;left:50%;top:50%;transform-origin:center;}.previewstage .dev{left:0;top:0;cursor:default;}:host([data-pointer-hover]) .previewstage .dev:hover{z-index:2;}.previewfacts{min-width:0;display:grid;align-content:start;gap:8px;}.previewfacts>div{display:grid;grid-template-columns:minmax(115px,0.8fr) minmax(0,1.3fr);gap:8px;}.previewfacts span{color:var(--secondary-text-color,#9aa0aa);}.previewfacts b{min-width:0;overflow-wrap:anywhere;}.previewnotice{margin:2px 0 0;color:var(--secondary-text-color,#9aa0aa);font-size:13px;}.previewdetails{margin-top:12px;}.previewdetails summary{cursor:pointer;color:var(--secondary-text-color,#9aa0aa);}.previewtable{display:grid;gap:8px;margin-top:9px;}.previewsource{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:3px 10px;font-size:13px;}.previewsource>*{min-width:0;overflow-wrap:anywhere;}.previewsource code{color:var(--secondary-text-color,#9aa0aa);}.previewdemo{min-height:40px;display:inline-flex;align-items:center;gap:8px;padding:8px 12px;border:1px solid var(--divider-color,rgba(127,127,127,0.35));border-radius:10px;background:transparent;color:inherit;cursor:pointer;}.previewdemos{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px;}.previewdemo:focus-visible{outline:2px solid var(--primary-color,#03a9f4);outline-offset:2px;}.previewdemo:disabled{opacity:0.5;cursor:not-allowed;}@media (max-width:640px){.previewgrid{grid-template-columns:minmax(0,1fr);}.previewstage{min-height:142px;}.previewfacts>div{grid-template-columns:minmax(0,1fr);gap:2px;}}`],customElements.get("hp-device-preview")||customElements.define("hp-device-preview",$a);const wa={revision:0,topologies:[],states:{}};class ka extends y{constructor(){super(...arguments),this.value={enabled:!1,z2mBaseTopics:[]},this.savedEnabled=!1,this.devices=[],this._runtime=null,this._snapshot=wa,this._topicText="zigbee2mqtt",this._invalidTopic=!1}disconnectedCallback(){this._release?.(),this._release=void 0,super.disconnectedCallback()}updated(t){t.has("hass")&&(this._release?.(),this._release=void 0,this._runtime=null,this._snapshot=wa),this.savedEnabled&&this._admin&&this._ensureRuntime()}willUpdate(t){t.has("value")&&(this._topicText=(this.value.z2mBaseTopics.length?this.value.z2mBaseTopics:["zigbee2mqtt"]).join("\n"),this._invalidTopic=!1)}get _admin(){return!0===this.hass?.user?.is_admin}_t(t,e){return $o(a(this.hass),t,e)}_help(){const t=a(this.hass);return wo(t,"help")&&wo(t,"help_aria")?h``:l}async _ensureRuntime(){return this._runtime||(this._runtime=await import("./zigbee-topology-runtime-sByomcRQ.js"),this._snapshot=this._runtime.zigbeeTopologyRuntimeSnapshot(this.hass),this._release=this._runtime.subscribeZigbeeTopology(this.hass,()=>{this._snapshot=this._runtime.zigbeeTopologyRuntimeSnapshot(this.hass),this.requestUpdate()}),this.requestUpdate()),this._runtime}_emit(t){this._admin&&this.dispatchEvent(new CustomEvent("hp-topology-settings-change",{detail:t,bubbles:!0,composed:!0}))}_topics(){return this.value.z2mBaseTopics.length?this.value.z2mBaseTopics:["zigbee2mqtt"]}_editTopics(t){this._topicText=t;const e=t.split(/[\r\n,]+/).map(t=>t.trim()).filter(Boolean),s=e.map(D).filter(Boolean);this._invalidTopic=s.length!==e.length,this._invalidTopic?this.requestUpdate():this._emit({...this.value,z2mBaseTopics:[...new Set(s)].slice(0,8)})}_status(t){const e=this._snapshot.states[t];if(!e)return this._t("status_idle");if("loading"===e.phase)return this._t("status_loading");if("error"===e.phase)return this._t(`error_${e.error||"provider"}`);if("ready"!==e.phase||!e.obtainedAt)return this._t("status_idle");const s=new Date(e.obtainedAt).toLocaleTimeString(a(this.hass),{hour:"2-digit",minute:"2-digit"}),i=this._snapshot.topologies.find(e=>"zha"===t?"zha"===e.provider:`z2m:${e.instanceId}`===t),o=!!i&&!!this.registry&&ko(i,this.devices,this.registry).warnings.length>0;return e.partial||o?this._t("status_partial",{time:s}):i&&!i.links.length?this._t("status_no_links",{time:s}):this._t(Date.now()-e.obtainedAt>xo?"status_stale":"status_ready",{time:s})}_busy(t){return"loading"===this._snapshot.states[t]?.phase}async _readZha(){this.savedEnabled&&this._admin&&(await this._ensureRuntime()).readZhaTopology(this.hass)}async _refreshZ2m(t){this.savedEnabled&&this._admin&&(await this._ensureRuntime()).refreshZ2mTopology(this.hass,t)}render(){const t=this._admin,e=this.value.enabled,s=t&&this.savedEnabled,i=this._topics();return h` +
    `:d} + `}}Sa.properties={hass:{attribute:!1},presentation:{attribute:!1},registry:{attribute:!1},deviceName:{attribute:!1}},Sa.styles=[S,w`:host{display:block;min-width:0;}.devicepreview{margin:4px 0 14px;padding:14px;border:1px solid var(--divider-color,rgba(127,127,127,0.28));border-radius:14px;background:color-mix(in srgb,var(--card-background-color,#20232b) 92%,var(--primary-color,#03a9f4));color:var(--primary-text-color,#fff);overflow:hidden;}.previewhead{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;}.previewbadge{padding:3px 9px;border-radius:999px;color:var(--secondary-text-color,#9aa0aa);background:color-mix(in srgb,var(--secondary-text-color,#9aa0aa) 12%,transparent);font-size:12px;font-weight:700;}.previewbadge.example{color:var(--warning-color,#ffb300);}.previewgrid{display:grid;grid-template-columns:minmax(170px,0.8fr) minmax(240px,1.2fr);gap:16px;align-items:stretch;}.previewstage{position:relative;min-height:168px;border-radius:12px;background:var(--secondary-background-color,rgba(0,0,0,0.16));overflow:hidden;pointer-events:none;container-type:inline-size;--icon-size:54px;--device-base-size:48.6px;}.previewfit{position:absolute;left:50%;top:50%;transform-origin:center;}.previewstage .dev{left:0;top:0;cursor:default;}:host([data-pointer-hover]) .previewstage .dev:hover{z-index:2;}.previewfacts{min-width:0;display:grid;align-content:start;gap:8px;}.previewfacts>div{display:grid;grid-template-columns:minmax(115px,0.8fr) minmax(0,1.3fr);gap:8px;}.previewfacts span{color:var(--secondary-text-color,#9aa0aa);}.previewfacts b{min-width:0;overflow-wrap:anywhere;}.previewnotice{margin:2px 0 0;color:var(--secondary-text-color,#9aa0aa);font-size:13px;}.previewdetails{margin-top:12px;}.previewdetails summary{cursor:pointer;color:var(--secondary-text-color,#9aa0aa);}.previewtable{display:grid;gap:8px;margin-top:9px;}.previewsource{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:3px 10px;font-size:13px;}.previewsource>*{min-width:0;overflow-wrap:anywhere;}.previewsource code{color:var(--secondary-text-color,#9aa0aa);}.previewdemo{min-height:40px;display:inline-flex;align-items:center;gap:8px;padding:8px 12px;border:1px solid var(--divider-color,rgba(127,127,127,0.35));border-radius:10px;background:transparent;color:inherit;cursor:pointer;}.previewdemos{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px;}.previewdemo:focus-visible{outline:2px solid var(--primary-color,#03a9f4);outline-offset:2px;}.previewdemo:disabled{opacity:0.5;cursor:not-allowed;}@media (max-width:640px){.previewgrid{grid-template-columns:minmax(0,1fr);}.previewstage{min-height:142px;}.previewfacts>div{grid-template-columns:minmax(0,1fr);gap:2px;}}`],customElements.get("hp-device-preview")||customElements.define("hp-device-preview",Sa);const Ma={revision:0,topologies:[],states:{}};class Ca extends k{constructor(){super(...arguments),this.value={enabled:!1,z2mBaseTopics:[]},this.savedEnabled=!1,this.devices=[],this._runtime=null,this._snapshot=Ma,this._topicText="zigbee2mqtt",this._invalidTopic=!1}disconnectedCallback(){this._release?.(),this._release=void 0,super.disconnectedCallback()}updated(t){t.has("hass")&&(this._release?.(),this._release=void 0,this._runtime=null,this._snapshot=Ma),this.savedEnabled&&this._admin&&this._ensureRuntime()}willUpdate(t){t.has("value")&&(this._topicText=(this.value.z2mBaseTopics.length?this.value.z2mBaseTopics:["zigbee2mqtt"]).join("\n"),this._invalidTopic=!1)}get _admin(){return!0===this.hass?.user?.is_admin}_t(t,e){return ko(l(this.hass),t,e)}_help(){const t=l(this.hass);return xo(t,"help")&&xo(t,"help_aria")?p``:d}async _ensureRuntime(){return this._runtime||(this._runtime=await import("./zigbee-topology-runtime-Db3SaXOn.js"),this._snapshot=this._runtime.zigbeeTopologyRuntimeSnapshot(this.hass),this._release=this._runtime.subscribeZigbeeTopology(this.hass,()=>{this._snapshot=this._runtime.zigbeeTopologyRuntimeSnapshot(this.hass),this.requestUpdate()}),this.requestUpdate()),this._runtime}_emit(t){this._admin&&this.dispatchEvent(new CustomEvent("hp-topology-settings-change",{detail:t,bubbles:!0,composed:!0}))}_topics(){return this.value.z2mBaseTopics.length?this.value.z2mBaseTopics:["zigbee2mqtt"]}_editTopics(t){this._topicText=t;const e=t.split(/[\r\n,]+/).map(t=>t.trim()).filter(Boolean),s=e.map(z).filter(Boolean);this._invalidTopic=s.length!==e.length,this._invalidTopic?this.requestUpdate():this._emit({...this.value,z2mBaseTopics:[...new Set(s)].slice(0,8)})}_status(t){const e=this._snapshot.states[t];if(!e)return this._t("status_idle");if("loading"===e.phase)return this._t("status_loading");if("error"===e.phase)return this._t(`error_${e.error||"provider"}`);if("ready"!==e.phase||!e.obtainedAt)return this._t("status_idle");const s=new Date(e.obtainedAt).toLocaleTimeString(l(this.hass),{hour:"2-digit",minute:"2-digit"}),i=this._snapshot.topologies.find(e=>"zha"===t?"zha"===e.provider:`z2m:${e.instanceId}`===t),o=!!i&&!!this.registry&&So(i,this.devices,this.registry).warnings.length>0;return e.partial||o?this._t("status_partial",{time:s}):i&&!i.links.length?this._t("status_no_links",{time:s}):this._t(Date.now()-e.obtainedAt>Mo?"status_stale":"status_ready",{time:s})}_busy(t){return"loading"===this._snapshot.states[t]?.phase}async _readZha(){this.savedEnabled&&this._admin&&(await this._ensureRuntime()).readZhaTopology(this.hass)}async _refreshZ2m(t){this.savedEnabled&&this._admin&&(await this._ensureRuntime()).refreshZ2mTopology(this.hass,t)}render(){const t=this._admin,e=this.value.enabled,s=t&&this.savedEnabled,i=this._topics();return p`
    ${this._t("title")}${this._help()}
    ${this._t("hint")}
    - ${t?l:h`
    ${this._t("admin_only")}
    `} - ${e?h`
    - ${this.savedEnabled?l:h`
    ${this._t("save_first")}
    `} + ${t?d:p`
    ${this._t("admin_only")}
    `} + ${e?p`
    + ${this.savedEnabled?d:p`
    ${this._t("save_first")}
    `}
    ${this._t("zha")}
    ${this._t("zha_hint")}
    @@ -262,9 +262,9 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae - ${this._invalidTopic?h`
    ${this._t("error_invalid_topic")}
    `:l} + ${this._invalidTopic?p`
    ${this._t("error_invalid_topic")}
    `:d}
    ${this._t("z2m_warning")}
    - ${i.map(t=>h`
    + ${i.map(t=>p`
    `)}
    -
    `:l} - `}}ka.properties={hass:{attribute:!1},value:{attribute:!1},savedEnabled:{type:Boolean,attribute:"saved-enabled"},devices:{attribute:!1},registry:{attribute:!1}},ka.styles=v`:host{display:block;color:inherit;font:inherit;}.section{margin-top:18px;font-weight:700;display:flex;align-items:center;gap:2px;}.toggle{display:flex;align-items:center;gap:10px;margin-top:10px;}.hint,.status{color:var(--secondary-text-color,#9aa0aa);font-size:12px;line-height:1.45;}.hint{margin-top:6px;}.providers{display:grid;gap:14px;margin-top:12px;padding-left:34px;}.provider{display:grid;gap:7px;}.provider-title{font-weight:650;}.actions{display:flex;align-items:center;flex-wrap:wrap;gap:8px;}textarea{box-sizing:border-box;width:100%;min-height:58px;resize:vertical;border:1px solid var(--divider-color,#666);border-radius:8px;padding:8px;color:var(--primary-text-color,inherit);background:var(--card-background-color,#202126);font:inherit;}button{display:inline-flex;align-items:center;gap:6px;min-height:36px;border:1px solid var(--divider-color,#666);border-radius:9px;padding:7px 11px;color:inherit;background:transparent;cursor:pointer;font:inherit;font-weight:600;}button:disabled,textarea:disabled{opacity:.5;cursor:default;}.warning{color:var(--warning-color,#d89300);font-size:12px;line-height:1.45;}`,customElements.get("hp-zigbee-topology-settings")||customElements.define("hp-zigbee-topology-settings",ka);const xa=(t,e)=>[t[0]-e[0],t[1]-e[1]],Sa=(t,e)=>[t[0]+e[0],t[1]+e[1]],Ma=(t,e)=>t[0]*e[0]+t[1]*e[1],Ca=t=>Math.hypot(t[0],t[1]);function Pa(t){let e=0;for(let s=0;st[1]!=l>t[1]&&t[0]<(r-a)*(t[1]-n)/(l-n)+a&&(s=!s)}return s}([r[0]+n[0]*l,r[1]+n[1]*l],t)&&(n=[-n[0],-n[1]]),n}function Ta(t){const e=t.length;if(e<3)return!1;for(let s=0;s(t[0]-o[0])*r[1]-(t[1]-o[1])*r[0],h=t=>(t[0]-o[0])*r[0]+(t[1]-o[1])*r[1],c=s,d=n-s;for(const e of t){const t=Math.abs(l(e));if(t<=s)continue;const o=h(e);o<=c||o>=d||tMath.abs(n+(t-p)/g*(r-n));i=Math.min(i,f(_),f(m))}}return i}function Ra(t,e,s){if(R(t,e,s))return!0;if(z(t,e,s)||z(e,t,s))return!1;let i=0;try{const s=A([[...t.map(t=>[t[0],t[1]]),[t[0][0],t[0][1]]]],[[...e.map(t=>[t[0],t[1]]),[e[0][0],e[0][1]]]]);for(const t of s)t?.[0]&&(i+=F(t[0]))}catch{return!1}return i>Math.max(1e-7,s*s)}function Aa(t,e,s){for(const i of e)for(let e=0;es)continue;const h=(t.x-o[0])*l[0]+(t.y-o[1])*l[1];if(h-t.length/2>=-s&&h+t.length/2<=r+s)return!0}return!1}function Fa(t,e,s){const i=Math.abs(e[0]-t[0]),o=Math.abs(e[1]-t[1]);return i<=s&&o>s?"v":o<=s&&i>s?"h":null}function Na(t,e,s){return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s}function Ea(t,e,s,i,o){return Na(t,s,o)&&Na(e,i,o)||Na(t,i,o)&&Na(e,s,o)}function Ha(t,e,s,i,o){const a=Fa(t,e,o);return a&&Fa(s,i,o)===a?"h"===a?Math.abs(t[1]-s[1])>o||Math.abs(t[1]-i[1])>o?0:Math.max(0,Math.min(Math.max(t[0],e[0]),Math.max(s[0],i[0]))-Math.max(Math.min(t[0],e[0]),Math.min(s[0],i[0]))):Math.abs(t[0]-s[0])>o||Math.abs(t[0]-i[0])>o?0:Math.max(0,Math.min(Math.max(t[1],e[1]),Math.max(s[1],i[1]))-Math.max(Math.min(t[1],e[1]),Math.min(s[1],i[1]))):0}function Oa(t,e,s,i){const o=t.length,a=Fa(t[(e-1+o)%o],t[e],i),n=Fa(t[(e+1)%o],t[(e+2)%o],i),r="h"===s?"v":"h";return a===r&&n===r}function La(t){let e=1/0,s=1/0,i=-1/0,o=-1/0;for(const a of t)e=Math.min(e,a[0]),s=Math.min(s,a[1]),i=Math.max(i,a[0]),o=Math.max(o,a[1]);return[e,s,i,o]}function Ba(t,e,s){const i=La(t),o=La(e);return i[2]o}const ja=(t,e)=>"h"===e?t[0]:t[1],Ga=(t,e)=>"h"===e?t[1]:t[0];function qa(t,e,s,i,o){const a=t.find(t=>t.id===e);if(!a)return null;const n=a.poly[s],r=a.poly[(s+1)%a.poly.length],l=Fa(n,r,o);if(!l)return null;const h=0===i?r:n,c=0===i?n:r,d=ja(h,l),p=ja(c,l),u=Ga(h,l),_=function(t,e,s,i){const o=[];for(const a of t)for(let t=0;ti||Math.abs(Ga(r,e)-s)>i)continue;const l=ja(n,e),h=ja(r,e),c=Math.min(l,h),d=Math.max(l,h);d-c>i&&o.push({roomId:a.id,edge:t,lo:c,hi:d})}return o.sort((t,e)=>t.lo-e.lo||t.hi-e.hi||t.roomId.localeCompare(e.roomId)||t.edge-e.edge)}(t,l,u,o),m=function(t,e,s,i){const o=[e,s];for(const a of t){const t=Math.max(e,a.lo),n=Math.min(s,a.hi);n-t>i&&o.push(t,n)}const a=[...new Set(o)].sort((t,e)=>t-e),n=[];for(let e=0;e+1r>t.lo-i&&rt.roomId))].sort();n.push({lo:s,hi:o,owners:l})}return n}(_,Math.min(d,p),Math.max(d,p),o);return!m.length||m.some(t=>t.owners.length<1||t.owners.length>2)?null:{roomId:e,edge:s,movedEndpoint:i,axis:l,line:u,fixed:d,moving:p,intervals:_,baseline:m}}function Ua(t,e,s){const i=[];for(const o of t.intervals){const a=e.polys[o.roomId];if(!a){i.push(o);continue}if(o.edge<0||o.edge>=a.length)continue;const n=a[o.edge],r=a[(o.edge+1)%a.length];if(Fa(n,r,s)!==t.axis||Math.abs(Ga(n,t.axis)-t.line)>s||Math.abs(Ga(r,t.axis)-t.line)>s)continue;const l=ja(n,t.axis),h=ja(r,t.axis),c=Math.min(l,h),d=Math.max(l,h);d-c>s&&i.push({...o,lo:c,hi:d})}return i}function Ka(t,e,s){return new Set(t.filter(t=>e>t.lo-s&&et.roomId)).size}function Va(t,e,s){for(const i of e.sideOwnership){const e=t.polys[i.roomId];if(!e)return!1;const o=e[i.edge],a=e[(i.edge+1)%e.length];if(Fa(o,a,s)!==i.axis)return!1;const n=ja(0===i.movedEndpoint?o:a,i.axis),r=Ua(i,t,s),l=(i.moving>=i.fixed?i.baseline[i.baseline.length-1]:i.baseline[0]).owners.length;if(l<1||l>2)return!1;const h=Math.min(i.fixed,i.moving,n),c=Math.max(i.fixed,i.moving,n),d=[h,c,i.fixed,i.moving,n];for(const t of i.intervals)d.push(t.lo,t.hi);for(const t of r)d.push(t.lo,t.hi);const p=[...new Set(d.filter(t=>t>=h&&t<=c))].sort((t,e)=>t-e),u=Math.min(i.fixed,i.moving),_=Math.max(i.fixed,i.moving),m=Math.min(i.fixed,n),g=Math.max(i.fixed,n);for(let t=0;t+1u-s&&a<_+s,h=a>m-s&&a2||d>2)return!1;if(n&&h){if(c!==d)return!1}else if(!n&&h){if(d!==l||c>0&&c!==d)return!1}else if(2===c?2!==d:d>1)return!1}}return!0}function Ja(t,e,s,i){const o=[s.n[0]*i,s.n[1]*i],a={polys:{},openings:{},movedSpans:{}};for(const e of s.roomIds){const i=t.find(t=>t.id===e),n=s.edgeByRoom[e];if(!i||null==n)continue;const r=(n+1)%i.poly.length;a.polys[e]=i.poly.map((t,e)=>e===n||e===r?Sa(t,o):[...t]),a.movedSpans[e]=[[Sa(i.poly[n],o),Sa(i.poly[r],o)]]}for(const t of e)s.movingOpeningIds.includes(t.id)&&(a.openings[t.id]=[t.x+o[0],t.y+o[1]]);return a}function Ya(t,e,s,i,o,a,n,r){if(!function(t,e,s,i){if(Da([t.x,t.y],e,s)>2*i)return!1;const o=Ca(xa(s,e));if(o<=i)return!1;const a=[(s[0]-e[0])/o,(s[1]-e[1])/o],n=(t.x-e[0])*a[0]+(t.y-e[1])*a[1];return n>=-i&&n<=o+i}(t,e,s,r))return!0;if(Da([t.x,t.y],i,o)>2*r)return!1;const l=0===a?i:o;return Ca(xa([t.x,t.y],l))>=t.length/2+n-r}function Xa(t,e,s,i){const o=i.movingHalf||0;return"circle"===t.kind?Da(t.center,e,s)2)return!1;const r=Ja(t,e,s,i);if(Object.keys(r.polys).length!==s.roomIds.length)return!1;if(!Va(r,s,a))return!1;const l=new Set(s.roomIds),h=t=>r.polys[t.id]||t.poly;for(const i of s.roomIds){const l=t.find(t=>t.id===i),h=r.polys[i],c=s.edgeByRoom[i];if(!l||!h||h.length!==s.topology[i]||h.length!==l.poly.length||!Ta(h))return!1;const d=l.poly.length,p=(c-1+d)%d,u=[p,c,(c+1)%d];for(const t of u)if(T(h[t],h[(t+1)%d]))return!1;const _=Pa(l.poly),m=Pa(h);if(Math.abs(m)t.id===e),i=r.polys[e];for(const o of t){if(o.id===e||l.has(o.id))continue;const t=h(o);if(!Ba(s.poly,o.poly,a)||!Ba(i,t,a))if(z(s.poly,o.poly,a)){if(!z(i,t,a))return!1}else if(z(o.poly,s.poly,a)){if(!z(t,i,a))return!1}else if(z(i,t,a)||z(t,i,a)||Ra(i,t,a))return!1}}t.find(t=>t.id===s.roomId);const c=r.polys[s.roomId],d=s.edgeByRoom[s.roomId],p=c[d],u=c[(d+1)%c.length];if(Math.abs(i)>a)for(const t of o.obstacles||[])if(Xa(t,p,u,o))return!1;for(const t of e){if(!s.movingOpeningIds.includes(t.id))continue;const e=r.openings[t.id];if(!e||t.hosted)return!1;if(!Aa({...t,x:e[0],y:e[1]},[c],2*a))return!1}return!0}const Qa=new WeakMap,tn=t=>"number"==typeof t&&Number.isFinite(t),en=(t,e)=>{const s=new Map;for(const i of t||[])!tn(i?.cm)||!e&&i.cm<=0||s.set(i.cm,(s.get(i.cm)||0)+1);return s},sn=t=>[String(t),"см"].join(" ");function on(t,e,s={}){if(s.allowClear)return[];const i=!0===s.exactMultiplicity,o=en(t,i),a=en(e,i),n=[];for(const[t,e]of o){const s=a.get(t)||0;0===s?n.push({invariant:"wall_records",kind:"lost",owner:sn(t),reference:`было ${e}`,detail:"записи этой толщины исчезли целиком"}):i&&s!==e&&n.push({invariant:"wall_records",kind:"count",owner:sn(t),reference:`было ${e}, стало ${s}`,detail:"изменилось число записей этой толщины"})}if(i)for(const[t,e]of a)o.has(t)||n.push({invariant:"wall_records",kind:"count",owner:sn(t),reference:`было 0, стало ${e}`,detail:"появились записи новой толщины"});return n}class an{constructor(){this._selectedRoomId=null,this._session=null,this._eligibility=null}get dragging(){return null!==this._session}ownsPointer(t){return this._session?.pointerId===t}get selectedRoomId(){return this._selectedRoomId}get snapshotIdentity(){return this._session?.snapshotIdentity||null}get activePointerId(){return this._session?.pointerId??null}get moved(){return!0===this._session?.moved}get delta(){return this._session?.delta||0}get rooms(){return this._session?.rooms||null}get openings(){return this._session?.openings||null}get plan(){return this._session?.plan||null}get preview(){return this._session?.accepted?.preview||null}get liveLabels(){return this._session?.accepted?.labels||null}selectRoom(t){this._selectedRoomId=t}restoreSelection(t){this._selectedRoomId=t}escapeIdle(){return this._selectedRoomId?(this._selectedRoomId=null,"selection-cleared"):"exit-tool"}resolve(t,e,s){this._eligibility&&this._eligibility.context===t||(this._eligibility={context:t,values:new Map});const i=this._eligibility.values.get(e);if(i)return i;const o=s();return this._eligibility.values.set(e,o),o}begin(t){return!this._session&&(this._session={pointerId:t.pointerId,start:[...t.start],roomId:t.roomId,plan:t.plan,options:t.options,rooms:t.rooms,openings:t.openings,snapshotIdentity:t.snapshotIdentity,before:t.before,moved:!1,delta:0,changedRoomIds:[...t.plan.roomIds],rejectionNotified:!1,wallUnionBefore:t.wallUnionBefore,epochBefore:t.epochBefore,accepted:null},!0)}move(t){const e=this._session;if(!e||e.pointerId!==t.pointerId)return{kind:"no-op"};const s=(i=e.start,o=t.point,a=e.plan.n,[i?.[0],i?.[1],o?.[0],o?.[1],a?.[0],a?.[1]].every(Number.isFinite)?(o[0]-i[0])*a[0]+(o[1]-i[1])*a[1]:0);var i,o,a;const n=t.snap([e.plan.a[0]+e.plan.n[0]*s,e.plan.a[1]+e.plan.n[1]*s]),r=(n[0]-e.plan.a[0])*e.plan.n[0]+(n[1]-e.plan.a[1])*e.plan.n[1],l=function(t,e,s,i,o,a){if(!Number.isFinite(i)||Math.abs(i)<1e-9)return 0;const n=Math.sign(i),r=Math.abs(i),l=Math.max(Math.abs(o),1e-6);let h=Qa.get(s);h&&h.opts===a||(h={opts:a,values:new Map},Qa.set(s,h));const c=h.values;let d=0;for(let i=Math.min(l,r),o=0;o<4096&&i<=r+1e-9;o++,i=Math.min(r,i+l)){const o=n*i,h=`${o.toFixed(9)}|${l.toFixed(9)}`;let p=c.get(h);if(void 0===p&&(p=Za(t,e,s,o,a),c.size<4096&&c.set(h,p)),!p)break;if(d=o,Math.abs(i-r)<=1e-9)break}return d}(e.rooms,e.openings,e.plan,r,t.step,e.options);if(e.moved&&l===e.delta)return{kind:"no-op"};const h=Ja(e.rooms,e.openings,e.plan,l);let c;try{if(c=t.project(e.snapshotIdentity,h.polys,h.openings,e.changedRoomIds,e.rooms),!c.ok)return this._projectionRejected(e);if(on(c.value.beforeWalls,c.value.afterWalls,{exactMultiplicity:!0}).length)return this._projectionRejected(e)}catch{return this._projectionRejected(e)}const d=e.accepted,p={preview:c.value.preview,labels:null,artifact:c.value.artifact,beforeWalls:c.value.beforeWalls,afterWalls:c.value.afterWalls};e.accepted=p;try{t.publish(p.preview,p.artifact),p.labels=t.measure(h,e.plan)}catch{e.accepted=d;try{t.publish(d?.preview||null,d?.artifact||null)}catch{}return this._projectionRejected(e)}return e.moved=!0,e.delta=l,{kind:"accepted",preview:c.value.preview,labels:p.labels,artifact:c.value.artifact}}finish(t){const e=this._session;if(!e||e.pointerId!==t.pointerId)return{kind:"no-op"};const s=e.accepted;let i;if(e.moved&&Math.abs(e.delta)>1e-9&&s)if(t.currentSnapshotIdentity!==e.snapshotIdentity)i={kind:"rejected",reason:"stale-snapshot"};else if(Za(e.rooms,e.openings,e.plan,e.delta,e.options))if(on(s.beforeWalls,s.afterWalls,{exactMultiplicity:!0}).length)i={kind:"rejected",reason:"wall-records"};else{let o=!1;try{o=t.validatePreview(s.preview)}catch{o=!1}i=o?{kind:"commit",preview:s.preview,before:e.before}:{kind:"rejected",reason:"invalid-candidate"}}else i={kind:"rejected",reason:"invalid-topology"};else i={kind:"no-op"};return this._session=null,"commit"===i.kind&&(this._eligibility=null),i}cancel(t,e){const s=this._session;if(!s||void 0!==e&&s.pointerId!==e)return{kind:"no-op"};this._session=null,this._eligibility=null;const i=t===s.snapshotIdentity;return{kind:"cancelled",restoreWallUnion:i?s.wallUnionBefore:null,restoreEpoch:i?s.epochBefore:null}}reset(){this._selectedRoomId=null,this._session=null,this._eligibility=null}_projectionRejected(t){const e=!t.rejectionNotified;return t.rejectionNotified=!0,{kind:"rejected",notify:e}}}const nn=t=>"object"==typeof t&&null!==t?t:null,rn=t=>Array.isArray(t)?t.flatMap(t=>{const e=nn(t);return e?[e]:[]}):[],ln=t=>{if(!Array.isArray(t))return null;const e=Number(t[0]),s=Number(t[1]);return Number.isFinite(e)&&Number.isFinite(s)?[e,s]:null};function hn(t){const e=(s=t.poly,Array.isArray(s)?s.flatMap(t=>{const e=ln(t);return e?[e]:[]}):[]);var s;if(e.length>=3)return e;const i=Number(t.x),o=Number(t.y),a=Number(t.w),n=Number(t.h);return[i,o,a,n].every(Number.isFinite)?[[i,o],[i+a,o],[i+a,o+n],[i,o+n]]:[]}function cn(t){if(!t.length)return null;const e=t.map(t=>t[0]),s=t.map(t=>t[1]);return{minX:Math.min(...e),minY:Math.min(...s),maxX:Math.max(...e),maxY:Math.max(...s)}}function dn(t,e){const s=nn(t);if(!s)return null;const i=rn(s.rooms),o=new Set(function(t,e){const s=rn(t),i=new Set(e);return s.flatMap(t=>{const e=String(t.id||"");return e&&i.has(e)?[e]:[]})}(i,e)),a=i.filter(t=>o.has(String(t.id||"")));if(!cn(a.flatMap(hn))||!a.length)return null;const n=Number(s.cell_cm),r=Number.isFinite(n)&&n>0?n:5,l=a.flatMap(t=>{const e=hn(t);return e.map((t,s)=>[t,e[(s+1)%e.length]])}),h=.02*N,c=(t,e,s)=>{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o,n=a>0?Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a)):0;return Math.hypot(t[0]-e[0]-n*i,t[1]-e[1]-n*o)},d=(t,e)=>Math.min(...l.map(([s,i])=>((t,e,s,i)=>{const o=(t,e,s)=>(e[0]-t[0])*(s[1]-t[1])-(e[1]-t[1])*(s[0]-t[0]),a=o(t,e,s),n=o(t,e,i),r=o(s,i,t),l=o(s,i,e);return a*n<=h*h&&r*l<=h*h&&Math.min(t[0],e[0])<=Math.max(s[0],i[0])+h&&Math.min(s[0],i[0])<=Math.max(t[0],e[0])+h&&Math.min(t[1],e[1])<=Math.max(s[1],i[1])+h&&Math.min(s[1],i[1])<=Math.max(t[1],e[1])+h?0:Math.min(c(t,s,i),c(e,s,i),c(s,t,e),c(i,t,e))})(t,e,s,i))),p=t=>{const e=ln(t.a),s=ln(t.b);if(e&&s)return((t,e)=>l.some(([s,i])=>{const o=i[0]-s[0],a=i[1]-s[1],n=Math.hypot(o,a);if(!(n>h))return!1;const r=t=>Math.abs((t[0]-s[0])*a-(t[1]-s[1])*o)/n;if(r(t)>h||r(e)>h)return!1;const l=t=>((t[0]-s[0])*o+(t[1]-s[1])*a)/(n*n),c=l(t),d=l(e);return Math.min(1,Math.max(c,d))-Math.max(0,Math.min(c,d))>h}))(e,s);const[i]=String(t.key||"").split("@"),o=i?.split(",").map(Number)||[];return 2!==o.length||!o.every(Number.isFinite)||l.some(([t,e])=>c(o,t,e)<=h)},u=rn(s.walls).filter(p),_=rn(s.wall_segments).filter(p),m=Math.max(0,...[...u,..._].map(t=>Number(t.cm)).filter(Number.isFinite))/r*N/2,g=rn(s.partitions).filter(t=>{const e=ln(t.a),s=ln(t.b);if(!e||!s)return!0;const i=Math.max(0,Number(t.cm)||0)/r*N/2;return d(e,s)<=m+i+h}),f=rn(s.wall_columns).filter(t=>{const e=ln(t.center);if(!e)return!0;const s=Math.max(0,Number(t.cm)||0)/r*N;return l.some(([t,i])=>c(e,t,i)<=m+s+h)}),b=new Set(g.map(t=>String(t.id||"")).filter(Boolean)),v=rn(s.openings).filter(t=>{const e=nn(t.host);if("partition"===e?.kind)return b.has(String(e.id||""));const s=ln([t.x,t.y]);return!s||l.some(([t,e])=>c(s,t,e)<=h)});return{...s,rooms:a,walls:u,wall_segments:_,open_spans:rn(s.open_spans).filter(p),partitions:g,wall_columns:f,openings:v}}const pn=1e-9;class un extends Error{constructor(t,e=""){super(e?`${t}: ${e}`:t),this.reason=t,this.name="WallSegmentModelError"}}const _n=t=>JSON.parse(JSON.stringify(t)),mn=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(Number(t[0]))&&Number.isFinite(Number(t[1])),gn=t=>[Number(t[0]),Number(t[1])],fn=t=>`${Number(t[0]).toFixed(12)},${Number(t[1]).toFixed(12)}`,bn=(t,e)=>{const s=fn(t),i=fn(e);return sfn(t)<=fn(e)?[gn(t),gn(e)]:[gn(e),gn(t)],yn=(t,e)=>Math.hypot(e[0]-t[0],e[1]-t[1]),$n=(t,e=[])=>{const s=new Set,i=t=>{const e=Number(t);if(!Number.isFinite(e))return;const i=e/N;Math.abs(i-Math.round(i))>=j&&s.add(e.toFixed(12))};for(const e of Array.isArray(t?.rooms)?t.rooms:[])for(const t of H(e)||[])i(t[0]),i(t[1]);for(const e of[t?.wall_segments,t?.walls])for(const t of Array.isArray(e)?e:[])i(t?.a?.[0]),i(t?.a?.[1]),i(t?.b?.[0]),i(t?.b?.[1]);for(const t of e)i(t?.[0]),i(t?.[1]);return s.size},wn=(t,e,s)=>{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o;return a>1e-18?((t[0]-e[0])*i+(t[1]-e[1])*o)/a:0},kn=(t,e,s)=>{const i=Math.max(0,Math.min(1,wn(t,e,s)));return Math.hypot(t[0]-(e[0]+(s[0]-e[0])*i),t[1]-(e[1]+(s[1]-e[1])*i))},xn=(t,e,s,i,o=1e-9)=>{const a=e[0]-t[0],n=e[1]-t[1],r=Math.hypot(a,n);if(r<=o)return 0;const l=e=>Math.abs((e[0]-t[0])*n-(e[1]-t[1])*a)/r;if(l(s)>o||l(i)>o)return 0;const h=wn(s,t,e),c=wn(i,t,e);return Math.max(0,Math.min(1,Math.max(h,c))-Math.max(0,Math.min(h,c)))*r},Sn=t=>{const e=(new TextEncoder).encode(t),s=8*e.length,i=64*Math.ceil((e.length+9)/64),o=new Uint8Array(i);o.set(e),o[e.length]=128;const a=new DataView(o.buffer);a.setUint32(i-8,Math.floor(s/4294967296),!1),a.setUint32(i-4,s>>>0,!1);const n=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),r=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),l=new Uint32Array(64),h=(t,e)=>t>>>e|t<<32-e;for(let t=0;t>>3,o=h(s,17)^h(s,19)^s>>>10;l[t]=l[t-16]+i+l[t-7]+o>>>0}let[e,s,i,o,c,d,p,u]=r;for(let t=0;t<64;t++){const a=u+(h(c,6)^h(c,11)^h(c,25))+(c&d^~c&p)+n[t]+l[t]>>>0,r=e&s^e&i^s&i;u=p,p=d,d=c,c=o+a>>>0,o=i,i=s,s=e,e=a+((h(e,2)^h(e,13)^h(e,22))+r>>>0)>>>0}r[0]=r[0]+e>>>0,r[1]=r[1]+s>>>0,r[2]=r[2]+i>>>0,r[3]=r[3]+o>>>0,r[4]=r[4]+c>>>0,r[5]=r[5]+d>>>0,r[6]=r[6]+p>>>0,r[7]=r[7]+u>>>0}const c=new Uint8Array(32),d=new DataView(c.buffer);for(let t=0;t{const e="abcdefghijklmnopqrstuvwxyz234567";let s=0,i=0,o="";for(const a of t)for(i=i<<8|a,s+=8;s>=5;)o+=e[i>>>s-5&31],s-=5;return s&&(o+=e[i<<5-s&31]),o},Cn=(t,e,s,i,o="")=>{const[a,n]=vn(e,s),r=`${t}|${fn(a)}|${fn(n)}|${[...i].sort().join(",")}${o}`;return`wall-${Mn(Sn(r)).slice(0,20)}`};let Pn=0;const Dn=t=>{for(let e=0;e<1e3;e++){const e=globalThis.crypto?.randomUUID?.(),s=`wall-${e||Mn(Sn(`${Date.now()}|${Pn++}|${Math.random()}`)).slice(0,26)}`;if(!t.has(s))return s}throw new un("duplicate-id","id factory exhausted")},In=t=>{const e=new Map;for(const s of Array.isArray(t?.wall_segments)?t.wall_segments:[])if(s&&"string"==typeof s.id&&mn(s.a)&&mn(s.b)){if(e.has(s.id))throw new un("duplicate-id",s.id);e.set(s.id,s)}return e},Tn=(t,e,s)=>{const i=(s,i)=>{const o=t[0]-s[0],a=t[1]-s[1];return Math.abs(e[0]-i[0]-o)<=pn&&Math.abs(e[1]-i[1]-a)<=pn?[o,a]:null};return i(s.a,s.b)||i(s.b,s.a)},zn=(t,e)=>{const s=Array.isArray(t.rooms)?t.rooms:[],i=L(t.open_spans).map(t=>[t.a[0],t.a[1],t.b[0],t.b[1]]),o=i.length?i:B(s,null,1,.04*N,!0),a=[];for(const t of s){const s=H(t),i=Array.isArray(t?.wall_ids)?t.wall_ids:[];if(s&&i.length===s.length)for(let t=0;t"partition"!==t.host?.kind&&[Number(t.x),Number(t.y)].every(Number.isFinite)&&Number.isFinite(Number(t.angle))&&Number(t.length)>0&&o.some(e=>kn([Number(t.x),Number(t.y)],[e[0],e[1]],[e[2],e[3]])<=.04*N)):[],l=r.map(t=>{const e=Number(t.angle)*Math.PI/180,s=[Math.cos(e),Math.sin(e)],i=Number(t.length)/2,o=[Number(t.x),Number(t.y)];return{a:[o[0]-s[0]*i,o[1]-s[1]*i],b:[o[0]+s[0]*i,o[1]+s[1]*i]}}),h=(t,e)=>r.some(s=>{const i=[Number(s.x),Number(s.y)];if(!G(t,e,Number(s.angle)))return!1;if(kn(i,t,e)>.02*N)return!1;const o=yn(t,e),a=wn(i,t,e)*o,n=Number(s.length)/2;return a+n>=-1e-9&&a-n<=o+pn}),c=new Map,d=[];for(const i of s){const r=String(i?.id||""),p=H(i);if(!r||!p||p.length<3)throw new un("invalid-room",r);const u=W(s,r,n,N,1,[...t.walls||[],...l]);if(!u||u.poly.length<3)throw new un("invalid-room",r);const _=Array.isArray(i.wall_ids)?i.wall_ids:[],m=_.length===p.length;let g=null,f=m;if(f)for(let t=0;tpn||Math.abs(i[1]-g[1])>pn)){f=!1;break}g=i}const b=[];for(let t=0;t2)throw new un("third-owner",n);const d=m?_[u.parent[t]]:void 0;if("string"==typeof d&&d){const o=e.get(d);f||!o||xn(s,i,o.a,o.b)>pn?l.preferredIds.add(d):l.positionalIds.add(d),l.preferredCarriers.set(d,{a:gn(p[u.parent[t]]),b:gn(p[(u.parent[t]+1)%p.length])})}const g=u.parent[t];l.parentKeys.add(O(p[g],p[(g+1)%p.length],N));const v=[(s[0]+i[0])/2,(s[1]+i[1])/2],y=t=>t.some(t=>kn(v,[t[0],t[1]],[t[2],t[3]])<=.04*N);l.zeroWall||=y(a)||y(o)&&!h(s,i),b.push(n)}const v={...i};delete v.wall_ids,d.push({...v,poly:u.poly.map(t=>[t[0],t[1]]),wall_ids:b})}return{atoms:[...c.values()].sort((t,e)=>t.key.localeCompare(e.key)),rooms:d}},Rn=(t,e,s,i,o)=>{const a=new Map([...s.values()].map(t=>[bn(t.a,t.b),t])),n=(t=>{const e=new Map;for(const s of t)"wall"===s.host?.kind&&e.set(s.host.id,(e.get(s.host.id)||0)+1);return e})(t.openings||[]),r=new Map;for(const t of e){const e=o?.get(t.key);if(e){const i=s.get(e);if(!i)throw new un("duplicate-id",e);r.set(t,i);continue}if(t.preferredIds.size>1)throw new un("duplicate-id",[...t.preferredIds].sort().join(","));const i=[...t.preferredIds][0],l=i?s.get(i):void 0;if(l){r.set(t,l);continue}const h=i?t.preferredCarriers.get(i):void 0;if(i&&h){r.set(t,{id:i,a:h.a,b:h.b,cm:0});continue}const c=a.get(t.key);if(c){r.set(t,c);continue}const d=[...s.values()].filter(e=>xn(t.a,t.b,e.a,e.b)>pn),p=[...new Map(d.map(t=>[t.id,t])).values()];if(p.sort((t,e)=>(n.get(e.id)||0)-(n.get(t.id)||0)||yn(e.a,e.b)-yn(t.a,t.b)||t.id.localeCompare(e.id)),p[0])r.set(t,p[0]);else if(1===t.positionalIds.size){const e=s.get([...t.positionalIds][0]);e&&r.set(t,e)}}const l=new Map;for(const[t,e]of r){const s=l.get(e.id)||[];s.push(t),l.set(e.id,s)}for(const[t,e]of l){const i=s.get(t)||r.get(e[0]);if(!i)throw new un("duplicate-id",t);const o=[(i.a[0]+i.b[0])/2,(i.a[1]+i.b[1])/2];e.sort((t,e)=>{const s=kn(o,t.a,t.b)<=pn?0:1,a=kn(o,e.a,e.b)<=pn?0:1;if(s!==a)return s-a;return(kn(i.a,t.a,t.b)<=pn?0:1)-(kn(i.a,e.a,e.b)<=pn?0:1)||t.key.localeCompare(e.key)}),e[0].id=t}const h=(t=>{const e=new Set;for(const s of[t.rooms,t.openings,t.decor,t.room_drafts,t.partitions,t.wall_columns])for(const t of Array.isArray(s)?s:[])"string"==typeof t?.id&&t.id&&e.add(t.id);for(const s of Array.isArray(t.room_drafts)?t.room_drafts:[])for(const t of Array.isArray(s?.segments)?s.segments:[])"string"==typeof t?.id&&t.id&&e.add(t.id);return e})(t);for(const t of e)if(t.id){if(h.has(t.id))throw new un("duplicate-id",t.id);h.add(t.id)}const c=e.filter(t=>!t.id);if(i){const e=c.map(e=>{const[s,i]=vn(e.a,e.b),o=`${String(t.id||"")}|${fn(s)}|${fn(i)}|${[...e.owners].sort().join(",")}`,a=Mn(Sn(o));return{atom:e,seed:o,digest:a,base:`wall-${a.slice(0,20)}`}}).sort((t,e)=>t.digest.localeCompare(e.digest)||t.atom.key.localeCompare(e.atom.key)),s=new Map;for(const t of e){const e=s.get(t.digest);if(e&&e!==t.seed)throw new un("duplicate-id",t.digest);s.set(t.digest,t.seed);let i=1,o=t.base;for(;h.has(o);)o=`${t.base}-${++i}`;t.atom.id=o,h.add(o)}}else for(const t of c)t.id=Dn(h),h.add(t.id)},An=(t,e)=>{if("partition"===t.host?.kind)return null;const s=[Number(t.x),Number(t.y)];if(!s.every(Number.isFinite))return null;const i=e=>{if(!(Number(e.cm)>0))return!1;const i=wn(s,e.a,e.b),o=yn(e.a,e.b),a=Number(t.length)/2;return i>=-1e-9&&i<=1+pn&&kn(s,e.a,e.b)<=.02*N&&G(e.a,e.b,Number(t.angle))&&Number.isFinite(a)&&a>=0&&i*o-a>=-1e-9&&i*o+a<=o+pn},o="wall"===t.host?.kind?e.find(e=>e.id===t.host.id):null,a=o&&i(o)?[o]:e.filter(i);if(1!==a.length)return null;const n=a[0];return{kind:"wall",id:n.id,t:Math.max(0,Math.min(1,wn(s,n.a,n.b)))}},Fn=(t,e)=>{const s=[Number(t.x),Number(t.y)];if(!s.every(Number.isFinite))return null;const i=Number(t.length)/2,o=e.filter(e=>{if(!(Number(e.cm)>0))return!1;const o=wn(s,e.a,e.b),a=yn(e.a,e.b);return o>=-1e-9&&o<=1+pn&&kn(s,e.a,e.b)<=.02*N&&G(e.a,e.b,Number(t.angle))&&Number.isFinite(i)&&i>=0&&o*a-i>=-1e-9&&o*a+i<=a+pn}),a=(e=>{if(!e.length)return null;const i="wall"===t.host?.kind?e.find(e=>e.id===t.host.id):null;return i||[...e].sort((t,e)=>kn(s,t.a,t.b)-kn(s,e.a,e.b)||Number(e.cm)-Number(t.cm)||(t.ide.id?1:0))[0]})(o);return a?{kind:"wall",id:a.id,t:Math.max(0,Math.min(1,wn(s,a.a,a.b)))}:null},Nn=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/,En=t=>{if("number"!=typeof t&&"string"!=typeof t)return null;if("string"==typeof t&&!Nn.test(t.trim()))return null;const e=Number(t);return Number.isFinite(e)?e:null},Hn=t=>{if(!Array.isArray(t)||t.length<2)return null;const e=En(t[0]),s=En(t[1]);return null==e||null==s?null:[e,s]},On=t=>"string"==typeof t?t:"",Ln=t=>{if(!Object.prototype.hasOwnProperty.call(t,"room_drafts"))return{drafts:0,segments:0};const e=Array.isArray(t.room_drafts)?t.room_drafts:[];if(!e.length)return delete t.room_drafts,{drafts:0,segments:0};const s=new Set;for(const e of[t.rooms,t.openings,t.decor,t.partitions,t.wall_columns,t.wall_segments])for(const t of Array.isArray(e)?e:[])"string"==typeof t?.id&&t.id&&s.add(t.id);for(const t of e)"string"==typeof t?.id&&t.id&&s.add(t.id);const i=Array.isArray(t.partitions)?[...t.partitions]:[];let o=0;for(const a of e){const e=On(a?.id),n=Array.isArray(a?.points)?a.points:[],r=Array.isArray(a?.segments)?a.segments:[];if(n.length<2||r.length!==n.length-1)throw new un("zero-length",e);for(let a=0;a+1100)throw new un("thickness-conflict",e);let p="string"==typeof c?.id&&c.id?c.id:"";if(!p||s.has(p)){const i=Cn(On(t.id),l,h,[`draft:${e}:${a}`]);p=i;for(let t=2;s.has(p);t++)p=`${i}-${t}`}s.add(p),i.push({id:p,a:gn(l),b:gn(h),cm:d}),o++}}return i.length?t.partitions=i:delete t.partitions,delete t.room_drafts,{drafts:e.length,segments:o}},Bn=t=>Ln(t),Wn=(t,e,s)=>{const i=Ln(t),o=In(t),{atoms:a,rooms:n}=zn(t,o);Rn(t,a,o,e,s);const r=a.map(e=>{const s=e.id?o.get(e.id):void 0,i=((t,e,s)=>{if(e.zeroWall)return 0;const i=Array.isArray(t.walls)?t.walls:[],o=O(e.a,e.b,N),a=i.filter(t=>Number(t.cm)>0&&(!(t.key!==o&&!e.parentKeys.has(t.key))||!(!mn(t.a)||!mn(t.b))&&xn(e.a,e.b,t.a,t.b)>=yn(e.a,e.b)-pn)).map(t=>Math.max(1,Math.min(100,Number(t.cm))));if(new Set(a.map(t=>t.toFixed(9))).size>1)throw new un("thickness-conflict",e.key);if(a.length)return a[0];const n=U(i,e.a,e.b,N,1);return n>0?n:Number(s?.cm)>0?Number(s.cm):0})(t,e,s);return{...s||{},id:e.id,a:[...e.a],b:[...e.b],cm:i}}),l=new Map(a.map(t=>[t.key,t.id]));for(const t of n)t.wall_ids=t.wall_ids.map(t=>l.get(t));t.rooms=n,t.wall_segments=r,t.walls=r.filter(t=>t.cm>0).map(t=>({key:O(t.a,t.b,N),cm:t.cm,a:[...t.a],b:[...t.b]})),t.walls.length||delete t.walls,delete t.open_spans;for(const e of t.rooms)delete e.open_to;return((t,e,s)=>{const i=Array.isArray(t.openings)?t.openings:[];for(const t of i){if("partition"===t.host?.kind)continue;if(!t.host&&!s){const s=An(t,e);s&&(t.host=s);continue}const i=An(t,e)??(s?Fn(t,e):null);if(i)t.host=i;else{if(!s)throw new un("opening-host",t.id);delete t.host}}})(t,r,e),{wallSegments:r.reduce((t,e)=>t+(o.has(e.id)?0:1),0),drafts:i.drafts,draftSegments:i.segments}};function jn(t,e={}){const s=JSON.stringify(t),i=_n(t);E(i);let o=0,a=0,n=0;const r=Number(i?.model_version||0)<10;for(const t of Array.isArray(i?.spaces)?i.spaces:[]){const s=e.lineageSpaceId===String(t?.id||"")?e.lineageHints:void 0,i=Wn(t,r,s);o+=i.wallSegments,a+=i.drafts,n+=i.draftSegments}return i.model_version=10,E(i),{config:i,changed:s!==JSON.stringify(i),migratedSegments:o,migratedDrafts:a,migratedDraftSegments:n}}const Gn=t=>!!t&&"object"==typeof t&&!Array.isArray(t);function qn(t,e){const s=(t,e)=>{if(Array.isArray(t)&&Array.isArray(e)){const i=new Map;for(const e of t)Gn(e)&&"string"==typeof e.id&&e.id&&i.set(e.id,e);const o=e.map((e,o)=>{if(Gn(e)&&"string"==typeof e.id&&e.id){const t=i.get(e.id);return t?s(t,e):_n(e)}return o[e,e in t?s(t[e],i):_n(i)]);for(const e of Object.keys(t))delete t[e];for(const[e,s]of i)t[e]=s;return t}return _n(e)};return s(t,e)}const Un=t=>"object"==typeof t&&null!==t?t:null,Kn=t=>Array.isArray(t)?t.flatMap(t=>{const e=Un(t);return e?[e]:[]}):[],Vn=t=>{if(!Array.isArray(t))return null;const e=Number(t[0]),s=Number(t[1]);return Number.isFinite(e)&&Number.isFinite(s)?[e,s]:null},Jn=t=>JSON.stringify(t??null),Yn=(t,e=1e8)=>`${Math.round(t[0]*e)},${Math.round(t[1]*e)}`,Xn=(t,e,s=1e-8)=>Math.hypot(t[0]-e[0],t[1]-e[1])<=s,Zn=(t,e,s)=>{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o,n=a>0?Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a)):0;return Math.hypot(t[0]-e[0]-n*i,t[1]-e[1]-n*o)},Qn=(t,e,s)=>(e[0]-t[0])*(s[1]-t[1])-(e[1]-t[1])*(s[0]-t[0]),tr=(t,e,s,i)=>{const o=2e-4*N,a=Qn(t,e,s),n=Qn(t,e,i),r=Qn(s,i,t),l=Qn(s,i,e);return a*n<=o*o&&r*l<=o*o&&Math.min(t[0],e[0])<=Math.max(s[0],i[0])+o&&Math.min(s[0],i[0])<=Math.max(t[0],e[0])+o&&Math.min(t[1],e[1])<=Math.max(s[1],i[1])+o&&Math.min(s[1],i[1])<=Math.max(t[1],e[1])+o?0:Math.min(Zn(t,s,i),Zn(e,s,i),Zn(s,t,e),Zn(i,t,e))},er=t=>{const e=(s=t.poly,Array.isArray(s)?s.flatMap(t=>{const e=Vn(t);return e?[e]:[]}):[]);var s;if(e.length>=3)return e;const i=Number(t.x),o=Number(t.y),a=Number(t.w),n=Number(t.h);return[i,o,a,n].every(Number.isFinite)?[[i,o],[i+a,o],[i+a,o+n],[i,o+n]]:[]},sr=t=>{const e=er(t);return e.map((t,s)=>[t,e[(s+1)%e.length]])},ir=(t,e)=>Math.max(0,Number(t)||0)/e*N,or=(t,e=15)=>{const s=Number(t.cm);return Number.isFinite(s)?Math.max(0,s):e},ar=t=>Math.atan2(t.b[1]-t.a[1],t.b[0]-t.a[0]),nr=(t,e)=>{let s=Math.abs(ar(t)-ar(e));return s%=Math.PI,s=Math.min(s,Math.PI-s),s<=Math.PI/180&&Math.abs(t.cm-e.cm)<=1e-6};function rr(t,e){const s=Un(t),i=Kn(s?.partitions).find(t=>t.id===e);if(!i)return null;const o=Vn(i.a),a=Vn(i.b),n=Number(i.cm);return!o||!a||!Number.isFinite(n)||n<0||Xn(o,a)?null:{partitionId:e,a:o,b:a,cm:n}}function lr(t,e){const s=Un(t);if(!s)return null;const i=Number(s.cell_cm),o=Number.isFinite(i)&&i>0?i:5,a=ir(5,o),n=ir(e.cm,o)/2,r=Kn(s.rooms),l=Kn(s.wall_segments),h=new Map(l.map(t=>[String(t.id||""),t])),c=Kn(s.walls),d=t=>{const e=Array.isArray(t.wall_ids)?t.wall_ids.map(String):[];return sr(t).map(([t,s],i)=>{const a=[h.get(e[i]),...c.filter(e=>{const i=Vn(e.a),o=Vn(e.b);if(i&&o)return tr(t,s,i,o)<=.02*N;const[a]=String(e.key||"").split("@"),n=Vn(a?.split(",").map(Number));return!!n&&Zn(n,t,s)<=.02*N})].filter(t=>!!t),n=Math.max(15,...a.map(t=>or(t,15)));return{a:t,b:s,half:ir(n,o)/2}})},p=r.flatMap(t=>{const s=String(t.id||""),i=d(t).some(({a:t,b:s,half:i})=>tr(e.a,e.b,t,s)<=n+i+a);return s&&i?[s]:[]}),u=new Set(p);if(p.length){const t=r.filter(t=>u.has(String(t.id||""))).flatMap(d);for(const e of r){const s=String(e.id||"");s&&!u.has(s)&&(d(e).some(({a:e,b:s,half:i})=>t.some(t=>tr(e,s,t.a,t.b)<=i+t.half+.02*N))&&u.add(s))}}const _=[...u],m=r.filter(t=>u.has(String(t.id||""))),g=new Set(m.flatMap(t=>Array.isArray(t.wall_ids)?t.wall_ids.map(String):[])),f=Kn(s.wall_segments).filter(t=>g.has(String(t.id||""))),b=m.flatMap(sr),v=Kn(s.walls).filter(t=>{const e=Vn(t.a),s=Vn(t.b);if(e&&s)return b.some(([t,i])=>tr(e,s,t,i)<=.02*N);const[i]=String(t.key||"").split("@"),o=Vn(i?.split(",").map(Number));return!o||b.some(([t,e])=>Zn(o,t,e)<=.02*N)}),{segments:y,malformedPartitions:$}=function(t){const e=[],s=[];for(const i of Kn(t.partitions)){const t=Vn(i.a),o=Vn(i.b);t&&o?e.push({key:`partition:${String(i.id||Jn(i))}`,source:i,a:t,b:o,cm:or(i,0)}):s.push(i)}return{segments:e,malformedPartitions:s}}(s),w=new Set(y.flatMap(t=>tr(e.a,e.b,t.a,t.b)<=n+ir(t.cm,o)/2+a?[t.key]:[]));let k=!0;for(;k;){k=!1;const t=y.filter(t=>w.has(t.key));for(const e of y)w.has(e.key)||t.some(t=>nr(t,e)&&(Xn(t.a,e.a)||Xn(t.a,e.b)||Xn(t.b,e.a)||Xn(t.b,e.b)))&&(w.add(e.key),k=!0)}const x=new Set(y.filter(t=>w.has(t.key)).flatMap(t=>[Yn(t.a),Yn(t.b)]));for(const t of y)(x.has(Yn(t.a))||x.has(Yn(t.b)))&&w.add(t.key);const S=y.filter(t=>w.has(t.key)),M=S.map(t=>t.source).concat($),C=Kn(s.wall_columns).filter(t=>{const s=Vn(t.center);if(!s)return!0;const i=ir(Number(t.cm),o)/2,r="circle"===t.shape?i:i*Math.SQRT2;return Zn(s,e.a,e.b)<=n+r+a}),P=new Set(M.map(t=>String(t.id||""))),D=new Set(f.map(t=>String(t.id||""))),I=Kn(s.openings).filter(t=>{const s=Un(t.host);if("partition"===s?.kind)return P.has(String(s.id||""));if("wall"===s?.kind&&D.has(String(s.id||"")))return!0;const i=Vn([t.x,t.y]);return!i||Zn(i,e.a,e.b)<=n+a}),T=Kn(s.open_spans).filter(t=>{const s=Vn(t.a),i=Vn(t.b);return!s||!i||tr(e.a,e.b,s,i)<=n+a});return{space:{...s,rooms:m,walls:v,wall_segments:f,open_spans:T,openings:I,partitions:M,wall_columns:C},roomIds:_,segmentCount:f.length+S.length}}const hr=1e3;const cr=(t,e)=>(t._clearGeometryGesture(),t._restoreGeometryStateLocal(e),t.host._showToast(t.host._t("toast.geometry_unsafe")),!1);function dr(t,e,s){const{host:i}=t,o=i._serverCfg,a=i._activeWallChainPartitionIds[i._activeWallChainPartitionIds.length-1]||null,n=()=>t._commitPhysicalGeometry(e,s);if(!s||!o||!a||10!==Number(o.model_version||0))return n();const r=o.spaces.find(t=>t.id===s.spaceId);if(!r||!function(t,e,s){const i=Un(t),o=Un(e);if(!i||!o||String(i.spaceId||"")!==String(o.id||""))return!1;if(["rooms","openings","walls","wall_segments","open_spans","wall_columns","decor"].some(t=>Jn(i[t]??[])!==Jn(o[t]??[])))return!1;const a=Un(i.plan_transform)||{},n={};for(const t of["plan_x","plan_y","plan_scale","plan_scale_x","plan_scale_y","plan_angle"])void 0!==o[t]&&(n[t]=o[t]);if(Jn(a)!==Jn(n))return!1;const r=Kn(i.partitions),l=Kn(o.partitions);if(l.length!==r.length+1||Jn(l.slice(0,-1))!==Jn(r))return!1;const h=l[l.length-1],c=Vn(h.a),d=Vn(h.b);return h.id===s&&!!c&&!!d&&!Xn(c,d)&&Number.isFinite(Number(h.cm))&&Number(h.cm)>=0}(s,r,a))return n();let l;try{l=jn(o).config}catch(e){return t._clearGeometryGesture(),t._restoreGeometryStateLocal(s),t._showWallModelMigrationBlocked(e),!1}const h=l.spaces.find(t=>t.id===s.spaceId),c=rr(h,a);if(!h||!c)return n();const d=JSON.parse(JSON.stringify(o));if(!t._restoreGeometryStateInConfig(d,s))return n();const p=d.spaces.find(t=>t.id===s.spaceId),u=lr(h,c),_=lr(p,c);if(!u||!_)return n();const m={...l,spaces:[u.space]},g={...d,spaces:[_.space]};let f=null,b=!1;try{const t=i._path.length>=2?i._path.map(t=>[t[0]/hr,t[1]/hr]):[];b=$n(h)<=$n(s,t)&&i._checkSpacePhysicalGeometry(m,s.spaceId,t=>{f=t}).ok}catch{b=!1}if(!b)return cr(t,s);const v=t._junctionLimitsIntroduced(m,g,s.spaceId,f,u.roomIds);if(v.length)return t._clearGeometryGesture(),t._restoreGeometryStateLocal(s),i._showToast(t._junctionLimitLabel(v[0])),!1;qn(o,l);const y=o.spaces.find(t=>t.id===s.spaceId),$=y?.partitions?.find(t=>t.id===a),w=i._activeWallChainPartitionIds.length-1;$&&w>=0&&i._path.length===i._wallChainSegmentCms.length+1&&(i._path[w]=[$.a[0]*hr,$.a[1]*hr],i._path[w+1]=[$.b[0]*hr,$.b[1]*hr],i._wallChainSegmentCms[w]=Number($.cm)),t._recordGeometry(e,s);const k=i._pendingPhysicalWrites.get(s.spaceId);return i._pendingPhysicalWrites.set(s.spaceId,{before:k?.before||s,fingerprint:K(y)}),t._saveConfig(),!0}const pr=(t,e)=>[(t[0]-e.x)/Math.max(1e-9,e.w)*e.stageWidth,(t[1]-e.y)/Math.max(1e-9,e.h)*e.stageHeight];function ur(t){const{poly:e,edge:s,text:i,view:o}=t,a=e[s],n=e[(s+1)%e.length],r=[(a[0]+n[0])/2,(a[1]+n[1])/2],l=function(t,e){const s=t[e],i=t[(e+1)%t.length],o=i[0]-s[0],a=i[1]-s[1],n=Math.hypot(o,a)||1;return(t=>{let e=0;for(let s=0;s=0?[-a/n,o/n]:[a/n,-o/n]}(e,s),h=Math.hypot(n[0]-a[0],n[1]-a[1])||1,c=[(n[0]-a[0])/h,(n[1]-a[1])/h],d=pr(r,o),p=pr(t.gearCenter,o),u=Math.max(34,7.2*i.length+12),_=Math.abs(l[0])>=Math.abs(l[1])?Math.max(28,u/2+4):Math.max(28,13),m=d[0]+l[0]*_,g=d[1]+l[1]*_,f=e=>{return s=m+c[0]*e,i=g+c[1]*e,o=u,a=18,n=p[0],r=p[1],l=t.gearWidthPx,h=t.gearHeightPx,2*Math.abs(s-n)=Math.abs(c[1])?c[0]:c[1])>0?-1:1,e=Math.max(o.stageWidth,o.stageHeight,64);for(let s=4;s<=e;s+=4){const e=s*t;if(!f(e)){b=e;break}const i=-e;if(!f(i)){b=i;break}}}const v=l[0]*_+c[0]*b,y=l[1]*_+c[1]*b,$=Math.hypot(v,y)||1,w=y/$*12,k=[r[0]+v/$*12*o.w/Math.max(1,o.stageWidth),r[1]+w*o.h/Math.max(1,o.stageHeight)];return{anchor:r,offsetXPx:v,offsetYPx:y,tangentOffsetPx:b,side:Math.abs(l[0])>=Math.abs(l[1])?l[0]<0?"left":"right":l[1]<0?"above":"below",leader:{a:r,b:k}}}const _r=t=>{let e=(t%360+360)%360;return e>180&&(e-=360),e};function mr(t,e,s,i,o,a=0,n=[t,e],r){const l=1e-7,h=(t,e,s,i,o)=>{const a=Math.max(0,Math.min(1,((t[0]-e[0])*s+(t[1]-e[1])*i)/o));return{t:a,x:e[0]+a*s,y:e[1]+a*i}},c=t=>{if(!t||!Number.isFinite(t[0])||!Number.isFinite(t[1]))return null;const e=Math.hypot(t[0],t[1]);return e>1e-9?[t[0]/e,t[1]/e]:null},d=c(r);let p=null;for(const r of i){const i=Number(r?.a?.[0]),u=Number(r?.a?.[1]),_=Number(r?.b?.[0]),m=Number(r?.b?.[1]);if(![i,u,_,m].every(Number.isFinite))continue;const g=_-i,f=m-u,b=g*g+f*f;if(!(b>1e-18))continue;const v=Math.sqrt(b),y=h(n,[i,u],g,f,b),$=Math.hypot(n[0]-y.x,n[1]-y.y);if(!($=2?r.axisA:r.a,e=r.axisB?.length>=2?r.axisB:r.b,s=Number(e[0])-Number(t[0]),i=Number(e[1])-Number(t[1]),o=s*s+i*i;if(o>1e-18&&[t[0],t[1],e[0],e[1]].every(Number.isFinite)){const e=h(n,t,s,i,o),a=(n[0]-e.x)*w[0]+(n[1]-e.y)*w[1];if(a>l)k=2;else if(a<-1e-7){if(r.roomSide)continue;k=-2}else d&&(k=w[0]*d[0]+w[1]*d[1])}}else{let t=n[0]-y.x,e=n[1]-y.y;const s=Math.hypot(t,e);if(s>l)t/=s,e/=s,k=2;else if(d)[t,e]=d,k=1;else{const s=i<_||i===_&&u<=m;t=-(s?f:-f)/v,e=(s?g:-g)/v}w=[t,e]}const x=h([t,e],[i,u],g,f,b);let S=x.t,M=x.x,C=x.y;if(Number.isFinite(a)&&a>0){const t=Math.round(S*v/a)*a;S=Math.max(0,Math.min(1,t/v)),M=i+S*g,C=u+S*f}const P=_r(180*Math.atan2(-w[0],w[1])/Math.PI),D={cx:M+w[0]*(s/2),cy:C+w[1]*(s/2),angle:P,dist:$,sideScore:k,stableId:"string"==typeof r.stableId?r.stableId:""};(!p||D.distp.sideScore+l||Math.abs(D.sideScore-p.sideScore)<=l&&D.stableId.localeCompare(p.stableId)<0))&&(p=D)}return p&&{cx:p.cx,cy:p.cy,angle:p.angle,dist:p.dist}}const gr=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1]),fr=(t,e)=>{const s=t=>`${t[0].toFixed(9)},${t[1].toFixed(9)}`,i=s(t),o=s(e);return i<=o?`${i}|${o}`:`${o}|${i}`};function br(t,e,s,i,o,a,n=1){const r=[],l=new Map;for(const h of t||[]){const c="string"==typeof h?.id?h.id:"";if(!c)continue;const d=Z(t,c,e,s,i,o,a,n);if(d)for(let t=0;t1e-9))continue;const a=Q(d.poly,t),n=Number(d.offsets[t]),h=Number.isFinite(n)&&n>0?n:0,p=[e[0],e[1]],u=[s[0],s[1]],_=fr(p,u),m=l.get(_)||new Set;m.add(c),l.set(_,m),r.push({a:[p[0]+a[0]*h,p[1]+a[1]*h],b:[u[0]+a[0]*h,u[1]+a[1]*h],axisA:p,axisB:u,normal:a,owner:"room",stableId:`room:${c}:${_}`,roomId:c,atomId:_,half:h})}}const h=[];for(const t of r){const{atomId:e,half:s,...i}=t;if(!(1===l.get(e)?.size&&s>1e-9)){h.push(i);continue}const o=i.normal;h.push({...i,roomSide:"inside",stableId:`${i.stableId}:inside`}),h.push({...i,a:[i.axisA[0]-o[0]*s,i.axisA[1]-o[1]*s],b:[i.axisB[0]-o[0]*s,i.axisB[1]-o[1]*s],normal:[-o[0],-o[1]],roomSide:"outside",stableId:`${i.stableId}:outside`})}return h}function vr(t){const e=[],s=new Set;for(const i of t||[])if(Array.isArray(i)&&!(i.length<2))for(let t=0;t1e-9))continue;const n=[o[0],o[1]],r=[a[0],a[1]],l=`physical:${fr(n,r)}`;s.has(l)||(s.add(l),e.push({a:n,b:r,axisA:[...n],axisB:[...r],normal:null,owner:"physical",stableId:l}))}return e}const yr=new WeakMap;const $r=1e-9,wr=2e-7,kr=1e7,xr=t=>{const e=Math.sign(t)*Math.floor(Math.abs(t)*kr+.5)/kr;return Object.is(e,-0)?0:e},Sr=t=>`${xr(t[0])},${xr(t[1])}`,Mr=(t,e)=>Math.hypot(e[0]-t[0],e[1]-t[1]),Cr=(t,e,s)=>t/(e||1)*s,Pr=(t,e)=>Math.atan2(e[1]-t[1],e[0]-t[0]),Dr=t=>Array.isArray(t)&&t.length>=2&&t.every(t=>Number.isFinite(t)),Ir=t=>(t||[]).filter(t=>Dr(t?.a)&&Dr(t?.b)&&Mr(t.a,t.b)>$r);function Tr(t,{minAngleDeg:e=15,maxValence:s=6}={}){const i=new Map;for(const e of Ir(t))for(const[t,s]of[[e.a,e.b],[e.b,e.a]]){const e=i.get(Sr(t))||[];e.push(Pr(t,s)),i.set(Sr(t),e)}const o=[];for(const[t,a]of i){if(a.length>s&&o.push({rule:"valence",subject:t,actual:a.length,limit:s}),a.length<2)continue;const i=[...a].sort((t,e)=>t-e);let n=1/0;for(let t=0;t$r&&s(180*Math.atan2(t.b[1]-t.a[1],t.b[0]-t.a[0])/Math.PI%180+180)%180,Rr=(t,e,s=1)=>{const i=Math.abs(zr(t)-zr(e));return Math.min(i,180-i)<=s},Ar=t=>{const e=new Map;for(const s of t)for(const t of[s.a,s.b]){const i=e.get(Sr(t));i?i.push(s):e.set(Sr(t),[s])}return e};function Fr(t,e,s){const i=Ir(e),o=s??Ar(i),a=new Set([t]);let n=Mr(t.a,t.b);const r=[t.a,t.b];for(;r.length;){const e=r.pop();for(const s of o.get(Sr(e))||[])a.has(s)||Rr(s,t)&&Number(s.cm||0)===Number(t.cm||0)&&(a.add(s),n+=Mr(s.a,s.b),r.push(s.a,s.b))}return n}function Nr(t,e,s,{minLengthCm:i=20}={}){const o=[],a=Ir(t),n=Ar(a);for(const t of a){const r=Fr(t,a,n)/s*(e||1),l=Math.max(i,Number(t.cm)>0?Number(t.cm):0);r{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o,n=a<=$r?0:Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a));return Math.hypot(t[0]-(e[0]+i*n),t[1]-(e[1]+o*n))};function Hr(t,e,s,{minDistanceCm:i=5}={}){const o=Ir(t),a=new Map;for(const t of o)a.set(Sr(t.a),t.a),a.set(Sr(t.b),t.b);const n=Cr(i,e,s),r=n>$r?n:1,l=(t,e)=>`${Math.floor(t/r)},${Math.floor(e/r)}`,h=new Map;for(const[t,e]of a){const s=l(e[0],e[1]),i=h.get(s);i?i.push([t,e]):h.set(s,[[t,e]])}const c=new Map;for(const t of o){const e=Math.min(t.a[0],t.b[0])-n,s=Math.max(t.a[0],t.b[0])+n,i=Math.min(t.a[1],t.b[1])-n,o=Math.max(t.a[1],t.b[1])+n;for(let a=Math.floor(e/r);a<=Math.floor(s/r);a++)for(let e=Math.floor(i/r);e<=Math.floor(o/r);e++){const s=`${a},${e}`,i=c.get(s);i?i.push(t):c.set(s,[t])}}const d=[];for(const[t,o]of a){const a=Math.floor(o[0]/r),l=Math.floor(o[1]/r);for(let r=-1;r<=1;r++)for(let c=-1;c<=1;c++)for(const[p,u]of h.get(`${a+r},${l+c}`)||[]){if(t>=p)continue;const a=Mr(o,u);a<=wr||a{const i=a[(s+1)%a.length];return t+(e[0]*i[1]-i[0]*e[1])},0))/2,r=(s||1)/i,l=n*r*r;return l0&&o.push(...e.slice(0,i))}return o}async function Br(t,e,s){t._saveConfigDebounced.pending()&&t._saveConfigDebounced.flush(),await t._writeChain;const i=await t.hass.callWS({type:"houseplan/plan/optimize",config:e,layout:s,expected_config_rev:t._cfgRev,expected_layout_rev:t._layoutRev});t._adoption.acceptPairWrite(e,s,i),t._geometryHistory.clear(),t._cancelDeviceDrag(),t._devicePositionHistory.clear(),t._canOptimizeUndo=!0===i.can_undo,t._undoKind=!0===i.can_undo?"optimize":null,t._dirtyPos.clear(),t._sentPos.clear(),t._cfgEpoch++,t._modelCache=null,t._frame=null,t._regSignature="",t._maybeRebuildDevices(),t._cacheSnapshot(),t.requestUpdate()}const Wr=1e-6*N,jr=6*N;function Gr(t){return Number.isFinite(t)?Math.round(t/N)*N:t}const qr=(t,e,s,i)=>Math.hypot(s-t,i-e),Ur=(t,e,s,i,o,a,n,r)=>Math.hypot(Math.max(Math.abs(o-t),Math.abs(o+n-(t+s))),Math.max(Math.abs(a-e),Math.abs(a+r-(e+i)))),Kr=(t,e,s,i,o,a,n)=>{const r=Math.max(Number(i)||0,0)/2,l=Math.PI/180,h=Math.cos(s*l)*r,c=Math.sin(s*l)*r,d=Math.cos(n*l)*r,p=Math.sin(n*l)*r,u=Math.max(qr(t+h,e+c,o+d,a+p),qr(t-h,e-c,o-d,a-p)),_=Math.max(qr(t+h,e+c,o-d,a-p),qr(t-h,e-c,o+d,a+p));return Math.min(u,_)},Vr=t=>{const e=Number(t?.cell_cm);return e>0?e:5};function Jr(t,e){const s=JSON.parse(JSON.stringify(t||[])),i=JSON.parse(JSON.stringify(e||{}));let o=0,a=0,n=0,r=0,l="",h=0,c=0;const d=(t,e)=>{Number.isFinite(t)&&Number.isFinite(e)&&t!==e&&Math.abs(e-t)<=Wr&&c++},p=(t,e)=>{d(t[0],e[0]),d(t[1],e[1])},u={};let _=5;for(const t of s){const e=Vr(t);null!=t?.id&&(u[String(t.id)]=e),e>_&&(_=e)}const m=(t,e,s,i=!1)=>{if(!(t>Wr||i))return;o++,t>n&&(n=t);const a=t*nt*e;a>r&&(r=a,l=s)};for(const t of s){const e=Vr(t),s=null!=t?.id?String(t.id):"";for(const i of t.rooms||[]){a++;let t=0;if(i.poly?.length)i.poly=i.poly.map(e=>{const s=[Gr(e[0]),Gr(e[1])];return t=Math.max(t,qr(e[0],e[1],s[0],s[1])),p(e,s),s});else if(null!=i.x&&null!=i.y){const e=i.x,s=i.y,o=i.w||0,a=i.h||0,n=Gr(e+o),r=Gr(s+a),l=Gr(e),h=Gr(s),c=Math.max(N,n-l),p=Math.max(N,r-h);t=Ur(e,s,o,a,l,h,c,p),i.x=l,i.y=h,i.w=c,i.h=p,d(e,l),d(s,h),d(e+o,l+c),d(s+a,h+p)}m(t,e,s)}for(const i of t.partitions||[]){a++;const o=[i.a[0],i.a[1]],n=[i.b[0],i.b[1]],r=[Gr(o[0]),Gr(o[1])],l=[Gr(n[0]),Gr(n[1])];let h=Math.max(qr(o[0],o[1],r[0],r[1]),qr(n[0],n[1],l[0],l[1]));const c=qr(r[0],r[1],l[0],l[1]),d=(t.openings||[]).filter(t=>"partition"===t.host?.kind&&t.host.id===i.id).every(t=>{const e=Number(t.length),s=Number(t.host.t),i=s*c;return Number.isFinite(e)&&e>0&&Number.isFinite(s)&&s>=0&&s<=1&&i-e/2>=-Wr&&i+e/2<=c+Wr});c>Wr&&d?(i.a=r,i.b=l,p(o,r),p(n,l)):h=0,m(h,e,s)}for(const i of t.wall_columns||[]){a++;const t=[i.center[0],i.center[1]],o=[Gr(t[0]),Gr(t[1])],n=qr(t[0],t[1],o[0],o[1]);i.center=o,p(t,o),m(n,e,s)}for(const i of t.decor||[]){if("furniture"===i.kind||"image"===i.kind)continue;a++;let t=0;if("line"===i.kind){const e=[i.x1,i.y1],s=[i.x2,i.y2],o=[Gr(e[0]),Gr(e[1])],a=[Gr(s[0]),Gr(s[1])];t=Math.max(qr(e[0],e[1],o[0],o[1]),qr(s[0],s[1],a[0],a[1])),i.x1=o[0],i.y1=o[1],i.x2=a[0],i.y2=a[1],p(e,o),p(s,a)}else{const e=i.x,s=i.y,o=i.w,a=i.h,n=Gr(e),r=Gr(s);if(null!=i.w&&null!=i.h){const l=Gr(e+o),h=Gr(s+a),c=Math.max(N,l-n),p=Math.max(N,h-r);t=Ur(e,s,o,a,n,r,c,p),i.w=c,i.h=p,d(e+o,n+c),d(s+a,r+p)}else t=qr(e,s,n,r);i.x=n,i.y=r,d(e,n),d(s,r)}m(t,e,s)}for(const i of t.openings||[]){if(a++,"partition"===i.host?.kind){const o=(t.partitions||[]).find(t=>t.id===i.host.id),a=Number(i.host.t);if(!o||!Number.isFinite(a)||a<0||a>1)continue;const n=o.b[0]-o.a[0],r=o.b[1]-o.a[1];if(Math.hypot(n,r)<=Wr)continue;const l=o.a[0]+n*a,c=o.a[1]+r*a;let d=180*Math.atan2(r,n)/Math.PI;d>=90?d-=180:d<-90&&(d+=180);const p=Number(i.angle),u=!(Number.isFinite(p)&&p===d),_=Kr(i.x,i.y,Number.isFinite(p)?p:d,Number(i.length)||0,l,c,d);i.x=l,i.y=c,i.angle=d,u&&h++,m(_,e,s,u);continue}const o=at([i.x,i.y],t.rooms||[],jr,{step:N,length:Number(i.length)||0});if(!o)continue;const n=Number(i.angle),r=!(Number.isFinite(n)&&n===o.angle),l=Kr(i.x,i.y,Number.isFinite(n)?n:o.angle,Number(i.length)||0,o.x,o.y,o.angle);i.x=o.x,i.y=o.y,i.angle=o.angle,r&&h++,m(l,e,s,r)}}for(const[t,e]of Object.entries(i)){if(!e||"object"!=typeof e)continue;const s=e;if("number"!=typeof s.x||"number"!=typeof s.y)continue;a++;const o=Gr(s.x),n=Gr(s.y),r=qr(s.x,s.y,o,n);i[t]={...s,x:o,y:n},d(s.x,o),d(s.y,n);const l="string"==typeof s.s?s.s:"";m(r,u[l]??_,l)}return{spaces:s,layout:i,report:{moved:o,coordsCanonicalized:c,total:a,maxShift:n,maxShiftCm:r,maxSpace:l,rotated:h},changed:o>0||c>0}}function Yr(t,e){const s=e.base+t*e.span;return Math.min(1,Math.max(0,s))}const Xr=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1]),Zr=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1]);function Qr(t,e,s){const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o;if(a<=0)return Zr(t,e);let n=((t[0]-e[0])*i+(t[1]-e[1])*o)/a;return n=Math.max(0,Math.min(1,n)),Math.hypot(t[0]-(e[0]+i*n),t[1]-(e[1]+o*n))}function tl(t,e,s,i,o){for(const i of e)if(i&&!s.has(i.id)&&Xr(i.a)&&Xr(i.b)&&(Zr(t,i.a)<=o||Zr(t,i.b)<=o))return!0;for(const e of i?.roomPolygons||[])for(let s=0;s0&&r>0))return null;if(Math.abs(o[0]/n*(a[1]/r)-o[1]/n*(a[0]/r))>s)return null;for(const[s,o]of[[t.a,e.a],[t.a,e.b],[t.b,e.a],[t.b,e.b]])if(Zr(s,o)<=i)return[(s[0]+o[0])/2,(s[1]+o[1])/2];return null}function sl(t,e){const s=.05*(Number(e.pitch)>0?Number(e.pitch):1),i=new Map;let o=(t||[]).filter(t=>!!t&&"string"==typeof t.id&&Xr(t.a)&&Xr(t.b));if(o.length<2)return{partitions:[...t||[]],merged:0,openingMoves:[]};const a=e.seedIds&&e.seedIds.length?new Set(e.seedIds):null;let n=0;for(let t=0;tZr(e,t.at)>s);let c=h[0]??r.a,d=h[h.length-1]??l.b;if(h.length<2&&(c=r.a,d=l.b),d[0]0?(d[0]-c[0])/u:0,m=u>0?(d[1]-c[1])/u:0,g=t=>u>0?((t[0]-c[0])*_+(t[1]-c[1])*m)/u:0;for(const t of[r,l]){const e=g(t.a),s=g(t.b)-e;for(const[o,a]of i)a.toId===t.id&&i.set(o,{fromId:a.fromId,toId:p.id,base:e+a.base*s,span:a.span*s});i.set(t.id,{fromId:t.id,toId:p.id,base:e,span:s})}a&&a.add(p.id),o=o.filter((e,s)=>s!==t.i&&s!==t.j),o.splice(t.i,0,p),n++}return{partitions:o,merged:n,openingMoves:[...i.values()]}}function il(t,e,s,i){if(!t?.length||!s.length)return 0;const o=new Map(s.map(t=>[t.fromId,t]));let a=0;for(const s of t){const t=s?.host;if(!t||"partition"!==t.kind)continue;const n=o.get(t.id);if(!n)continue;s.host={...t,id:n.toId,t:Yr(t.t,n)},a++;const r=rt(s,e,i.coordScale,i.cellCm,i.gridPitch).resolved;r&&Object.assign(s,lt(s,r,i.coordScale))}return a}function ol(t){return{roomPolygons:(t?.rooms||[]).map(t=>H(t)).filter(t=>!!t),columns:t?.wall_columns||[]}}const al=t=>!!t&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1]),nl=(t,e)=>t[0]-e[0]||t[1]-e[1],rl=(t,e,s,i)=>[t[0]+e*i,t[1]+s*i],ll=(t,e,s,i)=>(t[0]-e[0])*s+(t[1]-e[1])*i,hl=(t,e,s,i,o)=>{const a=e[0]-t[0],n=e[1]-t[1],r=Math.hypot(a,n);if(!(r>o))return null;const l=a/r,h=n/r,c=e=>Math.abs((e[0]-t[0])*h-(e[1]-t[1])*l);if(c(s)>o||c(i)>o)return null;const d=ll(s,t,l,h),p=ll(i,t,l,h),u=Math.max(0,Math.min(d,p)),_=Math.min(r,Math.max(d,p));return _-u>o?{lo:u,hi:_}:null},cl=(t,e,s)=>Math.min(t.hi,e.hi)-Math.max(t.lo,e.lo)>s,dl=t=>{const e=new Set(["id","a","b","cm"]);return Object.keys(t||{}).every(t=>e.has(t))},pl=(t,e,s,i)=>{const o=t.b[0]-t.a[0],a=t.b[1]-t.a[1],n=Math.hypot(o,a);if(!(n>i))return!0;const r=o/n,l=a/n,h=b(t.cm,s.cellCm,s.gridPitch)/2;return e.some(e=>{const o=e?.center;if(!al(o))return!0;const a=ll(o,t.a,r,l),c=Math.abs((o[0]-t.a[0])*l-(o[1]-t.a[1])*r),d=b(Number(e.cm),s.cellCm,s.gridPitch)*("square"===e.shape?Math.SQRT1_2:.5);return!(Number.isFinite(d)&&d>0)||a>=-d-i&&a<=n+d+i&&c<=h+d+i})},ul=(t,e,s)=>{if(t.host){const i=rt(t,e,s.coordScale,s.cellCm,s.gridPitch).resolved;return i?{center:i.center,angle:i.angle,length:i.length}:null}const i=Number(t.x)*s.coordScale,o=Number(t.y)*s.coordScale,a=Number(t.angle),n=Number(t.length)*s.coordScale;return[i,o,a,n].every(Number.isFinite)&&n>0?{center:[i,o],angle:a,length:n}:null},_l=(t,e,s)=>{const i=t.angle*Math.PI/180,o=Math.cos(i),a=Math.sin(i),n=e.angle*Math.PI/180,r=Math.cos(n),l=Math.sin(n);if(Math.abs(o*l-a*r)>1e-6)return!1;const h=e.center[0]-t.center[0],c=e.center[1]-t.center[1];if(Math.abs(h*a-c*o)>s)return!1;const d=h*o+c*a;return Math.max(-t.length/2,d-e.length/2)({...t,a:[t.a[0]*e,t.a[1]*e],b:[t.b[0]*e,t.b[1]*e]}),gl=(t,e,s,i)=>{const o=`~r-${(t=>{let e=2166136261;for(let s=0;s>>0;return e.toString(36)})(`${t}|${e[0].toFixed(9)},${e[1].toFixed(9)}|${s[0].toFixed(9)},${s[1].toFixed(9)}`)}`,a=`${t.slice(0,Math.max(1,64-o.length))}${o}`;let n=a;for(let t=2;i.has(n);t++){const e=`-${t}`;n=`${a.slice(0,64-e.length)}${e}`}return i.add(n),n},fl=(t,e)=>{const s=[];for(const i of t){const t=s[s.length-1];!(t&&Math.abs(t.hi-i.lo)<=e&&t.safe===i.safe)||i.safe&&t.signature!==i.signature?s.push({lo:i.lo,hi:i.hi,a:i.a,b:i.b,safe:i.safe,signature:i.signature,roomIds:i.roomIds,finalCm:i.finalCm}):(t.hi=i.hi,t.b=i.b)}return s};function bl(t,e,s,i,o){const a=s||[],n=Array.isArray(t?.partitions)?t.partitions:[],r=Array.isArray(t?.openings)?t.openings:[],l={walls:a,partitions:n,openings:r,partitionsReconciled:0,openingsRehosted:0};if(!n.length)return l;const h=Math.max(2e-4*o.gridPitch,1e-9);let c=a,d=n,p=r,u=0,_=0;const m=o.partitionIds?new Set(o.partitionIds):null,g=new Map(e.partitions.map(t=>[t.id,t]));for(const t of[...n].sort((t,e)=>t.id.localeCompare(e.id))){if(m&&!m.has(t.id))continue;if(!d.some(e=>e.id===t.id))continue;if(!dl(t))continue;const s=g.get(t.id);if(!(s&&al(s.a)&&al(s.b)&&Number.isFinite(s.cm)&&(o.allowCoincidentPartitions?!(s.cm<0):s.cm>0)))continue;const[a,n]=nl(s.a,s.b)<=0?[[s.a[0],s.a[1]],[s.b[0],s.b[1]]]:[[s.b[0],s.b[1]],[s.a[0],s.a[1]]],r=n[0]-a[0],l=n[1]-a[1],f=Math.hypot(r,l);if(!(f>h))continue;const b=r/f,v=l/f,y=ht(e.rooms,c,i,o.pitch,o.cellCm,o.gridPitch,o.coordScale),$=y.flatMap(t=>{if(t.open||"outer"!==t.kind&&"shared"!==t.kind)return[];const e=hl(a,n,t.a,t.b,h);return e?[{interval:t,range:e}]:[]});if(!$.length)continue;const w=p.filter(t=>"partition"===t.host?.kind&&t.host.id===s.id).map(t=>({opening:t,resolved:rt(t,e.partitions,o.coordScale,o.cellCm,o.gridPitch).resolved}));if(w.some(t=>!t.resolved))continue;const k=[0,f];for(const{range:t}of $)k.push(t.lo,t.hi);const x=k.slice(),S=new Map;for(const{opening:t,resolved:e}of w){const s=ll(e.center,a,b,v),i={lo:s-e.length/2,hi:s+e.length/2};S.set(t.id,i),x.push(Math.max(0,i.lo),Math.min(f,i.hi))}const M=[...new Set(x.filter(t=>Number.isFinite(t)&&t>=-h&&t<=f+h).map(t=>Math.max(0,Math.min(f,t)).toFixed(9)))].map(Number).sort((t,e)=>t-e),C=d.map(t=>ml(t,o.coordScale)).filter(t=>t.id!==s.id),P=[];for(let t=0;t+1h))continue;const r=rl(a,b,v,i),l=rl(a,b,v,n),c=$.filter(({range:t})=>t.lo<=i+h&&t.hi>=n-h).map(({interval:t})=>t),d=new Map;for(const t of c)d.set(t.roomId,t);const p=[...d.values()],u=new Set(p.map(t=>t.kind)),_=new Set(p.map(t=>o.allowCoincidentPartitions||t.cm>0?t.cm:ct)),m=p[0]?.kind,g=[...d.keys()].sort(),f=1===u.size&&1===_.size&&("outer"===m&&1===g.length||"shared"===m&&2===g.length),y={id:s.id,a:r,b:l,cm:s.cm},w=C.some(t=>!!hl(r,l,t.a,t.b,h)),k=f&&(o.allowCoincidentPartitions||!w)&&!pl(y,e.wall_columns,o,h),x=f?o.allowCoincidentPartitions||p[0].cm>0?p[0].cm:ct:0,S=f?Math.max(x,s.cm):s.cm;P.push({lo:i,hi:n,a:r,b:l,safe:k,signature:k?`${m}|${g.join(",")}|${S}`:"",roomIds:g,roomCm:x,finalCm:S})}if(!P.some(t=>t.safe))continue;const D=new Map;for(const{opening:t,resolved:e}of w){const i=S.get(t.id),a=k.some(t=>t>i.lo+h&&tcl(t,i,h)),r=new Set(n.filter(t=>t.safe).map(t=>t.signature));if(!a&&n.length>0&&n.every(t=>t.safe)&&1===r.size&&dt(e,y,h)){D.set(t.id,{resolved:e,signature:[...r][0]});continue}const l=pt(s,o.cellCm,o.gridPitch),c={lo:i.lo-l,hi:i.hi+l};for(const t of P)cl(t,c,h)&&(t.safe=!1,t.signature="")}let I=!0;for(;I;){I=!1;for(const[t,e]of[...D.entries()]){const i=S.get(t),a=P.filter(t=>cl(t,i,h));if(a.length>0&&a.every(t=>t.safe)&&a.every(t=>t.signature===e.signature))continue;D.delete(t);const n=pt(s,o.cellCm,o.gridPitch),r={lo:i.lo-n,hi:i.hi+n};for(const t of P)cl(t,r,h)&&(t.safe=!1,t.signature="");I=!0}}const T=fl(P,h),z=T.filter(t=>t.safe),R=T.filter(t=>!t.safe);if(!z.length)continue;if(d.length-1+R.length>2e3)continue;let A=c;for(const t of z){const[e,i]=nl(s.a,s.b)<=0?[t.a,t.b]:[t.b,t.a];A=ut(A,e,i,t.finalCm,o.pitch,o.coordScale)}if(A=_t(e.rooms,A,i,o.pitch,o.cellCm,o.gridPitch,o.coordScale),A.length>500)continue;const F=new Set(d.map(t=>t.id));F.delete(s.id);const N=R.map((t,e)=>{const i=[t.a[0]/o.coordScale,t.a[1]/o.coordScale],a=[t.b[0]/o.coordScale,t.b[1]/o.coordScale],n=0===e?s.id:gl(s.id,i,a,F);return F.add(n),{id:n,a:i,b:a,cm:s.cm}}),E=d.findIndex(t=>t.id===s.id),H=d.slice();H.splice(E,1,...N);const O=H.map(t=>ml(t,o.coordScale)),L=new Map;let B=!0;for(const{opening:t,resolved:e}of w){const s=D.get(t.id);if(s){const e=lt(t,s.resolved,o.coordScale),{host:i,...a}=e;L.set(t.id,a);continue}const i=S.get(t.id),a=N[R.findIndex(t=>t.lo<=i.lo+h&&t.hi>=i.hi-h)],n=a&&O.find(t=>t.id===a.id);if(!a||!n){B=!1;break}const r=n.b[0]-n.a[0],l=n.b[1]-n.a[1],c=Math.hypot(r,l),d=ll(e.center,n.a,r/c,l/c),p={...lt(t,e,o.coordScale),host:{kind:"partition",id:a.id,t:d/c}};if(!mt(p,O,o.coordScale,o.cellCm,o.gridPitch).resolved){B=!1;break}L.set(t.id,p)}if(!B)continue;const W=p.map(t=>L.get(t.id)||t),j=[...D.keys()].map(t=>L.get(t)),G=j.map(t=>ul(t,O,o));if(G.some(t=>!t))continue;let q=!1;for(let t=0;tt.id));for(const t of W){if(U.has(t.id))continue;const e=ul(t,O,o);e&&G.some(t=>_l(t,e,h))&&(q=!0)}if(q)continue;const K=gt(e.rooms,A,i,o.pitch,o.cellCm,o.gridPitch,o.coordScale);[...D.entries()].every(([t,e])=>{const s=L.get(t),i=ft(K,{x:s.x*o.coordScale,y:s.y*o.coordScale,angle:s.angle,length:s.length*o.coordScale},!0),a=[i.negative,i.positive].filter(t=>!!t?.full),n=e.signature.split("|")[1].split(","),r=new Set(a.map(t=>t.roomId));return a.length===n.length&&r.size===n.length&&n.every(t=>r.has(t))})&&(c=A,d=H,p=W,u+=z.length,_+=D.size)}return{walls:c,partitions:d,openings:p,partitionsReconciled:u,openingsRehosted:_}}const vl=t=>JSON.parse(JSON.stringify(t)),yl=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),$l=(t,e)=>e.length>0&&e.length<=35&&("space"===t?/^[a-z0-9_-]+$/.test(e):/^[A-Za-z0-9_-]+$/.test(e));function wl(t,e){let s=String(e??"");const i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`^${i}_(.+)_([0-9a-f]{8})$`);let a=0;for(;a<16;a++){const t=o.exec(s);if(!t)return{root:s,layers:a,bounded:!1};s=t[1]}return{root:s,layers:a,bounded:o.test(s)}}const kl=(t,e,s)=>{const i=t.get(e)||[];i.push(s),t.set(e,i)};const xl=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Sl=(t,e,s)=>Math.min(s,Math.max(e,t)),Ml=t=>Tt({spaces:[t]})[0],Cl=(t,e,s)=>{const i=s>0?s:1,o=t=>`${(t[0]/i).toFixed(12)},${(t[1]/i).toFixed(12)}`,a=o(t),n=o(e);return a0?n:1,l=Math.max(i*r*.02,1e-9),h=[];for(const e of t||[])for(const t of H(e)||[])h.push([t[0],t[1]]);const c=[];for(const t of s||[])Array.isArray(t)&&t.length>=4&&t.slice(0,4).every(Number.isFinite)&&c.push([t[0],t[1]],[t[2],t[3]]);const d=(t,e)=>e.some(e=>Math.hypot(t[0]-e[0],t[1]-e[1])<=2*l),p=new Map;for(const n of t||[]){if(!n?.id)continue;const u=Z(t,n.id,e,s,i,o,a,r);if(u)for(let t=0;t0&&_>0&&n===m&&_!==n))continue;const g=u.poly[i],f=u.poly[(i+1)%u.poly.length],b=Math.hypot(f[0]-g[0],f[1]-g[1]);if(!(b>l&&b<.5*a-1e-9*a))continue;if(d(g,c)||d(f,c))continue;if(d(g,h)&&d(f,h))continue;const v=Cl(g,f,r),y=p.get(v);y?y.targets.add(n):p.set(v,{a:[g[0],g[1]],b:[f[0],f[1]],targets:new Set([n])})}}}let u=e.slice();const _=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1])<=2*l,m=(t,e)=>{if(!Array.isArray(t.a)||!Array.isArray(t.b)||t.a.length<2||t.b.length<2)return!1;const s=[Number(t.a[0])*r,Number(t.a[1])*r],i=[Number(t.b[0])*r,Number(t.b[1])*r];return!![...s,...i].every(Number.isFinite)&&(_(s,e.a)&&_(i,e.b)||_(s,e.b)&&_(i,e.a))};for(const t of[...p.values()].filter(t=>1===t.targets.size).sort((t,e)=>Cl(t.a,t.b,r).localeCompare(Cl(e.a,e.b,r)))){const e=[...t.targets][0],s=u.filter(e=>m(e,t));if(new Set(s.map(t=>t.cm)).size>1)continue;let o=!1;u=u.map(s=>m(s,t)?(o=!0,s.cm===e?s:{...s,cm:e}):s),o||(u=ut(u,t.a,t.b,e,i,r))}return u}const Dl=t=>{const e=[];for(const s of t||[]){const t=H(s);if(t?.length)for(let s=0;s"string"==typeof t?.id?t.id:"").filter(Boolean),c=new Set(h),d=new Map;for(const t of h){const e=wl("space",t);e.layers>0&&$l("space",e.root)&&kl(d,e.root,t)}const p=new Map,u=new Map,_=new Map,m=new Map;for(const t of r){const e="string"==typeof t?.id?t.id:"";if(!e)continue;const s=new Map;for(const i of Array.isArray(t.rooms)?t.rooms:[]){const t="string"==typeof i?.id?i.id:"";if(!t)continue;const o=wl("room",t);o.layers>0&&$l("room",o.root)&&kl(s,o.root,t),u.has(t)||u.set(t,e),_.has(t)||_.set(t,String(i.name||""));const a="string"==typeof i.area?i.area:"";if(a){const s=m.get(a)||[];s.push({spaceId:e,roomId:t}),m.set(a,s)}}p.set(e,s)}const g=new Set(u.keys()),f=new Map,b=new Map;for(const t of l)"string"==typeof t?.id&&t.id&&(!0===t.removed?b.set(t.id,t):f.set(t.id,t));const v={spaceRefsRemapped:0,roomRefsRemapped:0,positionsRemapped:0,markersDetached:0,positionsUnresolved:0,nestedRefsUnresolved:0,deadSpaceIds:[],orphanRoomLabelsRemoved:0,orphanDevicePositionsRemoved:0,orphanGroupPositionsRemoved:0,liveMissingPositionsRemoved:0,removedPositions:[],liveMissingPositions:[],unverifiedPositions:[]},y=new Set,$=t=>c.has(t)?null:(()=>{const e=wl("space",t).root;if(!$l("space",e))return null;const s=d.get(e)||[];return 1===s.length?s[0]:null})(),w=(t,e)=>{const s=wl("room",t).root;if(!$l("room",s))return null;const i=p.get(e)?.get(s)||[];return 1===i.length?i[0]:null},k=t=>{const e=s.effectiveAreaByMarker?.[t]||"",i=e&&m.get(e)||[];return 1===i.length?i[0]:null},x=(t,e,s)=>{if("string"==typeof t.room_id&&t.room_id&&!g.has(t.room_id)){const i=e?w(t.room_id,e):null;i?(t.room_id=i,v.roomRefsRemapped++):s?(t.room_id=s.roomId,v.roomRefsRemapped++):!0!==t.removed&&delete t.room_id}const i=t.vacuum?.segment_map;if(i&&"object"==typeof i&&!Array.isArray(i))for(const t of Object.keys(i)){const s=i[t];if("string"!=typeof s||!s||g.has(s))continue;const o=e?w(s,e):null;o?(i[t]=o,v.roomRefsRemapped++):v.nestedRefsUnresolved++}};for(const t of l){const e="string"==typeof t?.id?t.id:"";if(!e)continue;const s="string"==typeof t.space?t.space:"",i=s&&!c.has(s),a=o[e],n="string"==typeof a?.s?a.s:"",r=n&&!c.has(n),l=!0===t.removed;let h=s&&c.has(s)?s:null,d=null,p=!1;if(i){const i=$(s);i?(t.space=i,h=i,p=!0,v.spaceRefsRemapped++):l||"virtual"===t.binding?l||(delete t.space,h=null,v.markersDetached++):(d=k(e),d?(t.space=d.spaceId,h=d.spaceId,v.spaceRefsRemapped++):(delete t.space,h=null,v.markersDetached++))}l&&!p||x(t,h,d),r&&p&&n===s&&h&&(o[e]={...a,s:h},v.positionsRemapped++,y.add(e))}for(const t of Object.keys(o)){if(y.has(t))continue;const e=o[t],s="string"==typeof e?.s?e.s:"";if(!s||c.has(s))continue;const i=$(s);if(i){if(t.startsWith("rl_")){const s=t.slice(3),a=w(s,i);if(a){const s=`rl_${a}`;yl(o,s)||(o[s]={...e,s:i}),delete o[t],v.roomRefsRemapped++,v.positionsRemapped++;continue}}o[t]={...e,s:i},v.positionsRemapped++}}const S=s.ownerRoster,M=!0===S?.authoritative,C=new Set(S?.deviceIds||[]),P=new Set(S?.entityIds||[]),D=new Set(Array.isArray(i.settings?.known_devices)?i.settings.known_devices.filter(t=>"string"==typeof t):[]),I=(t,e="")=>{const s=String(S?.names?.[t]||e||"").trim();return s&&s!==t?s:""},T=(t,e,s,i="",o)=>({id:t,spaceId:e,kind:s,name:I(t,i),...o?{reason:o}:{}}),z=t=>{"room_label"===t?v.orphanRoomLabelsRemoved++:"group"===t?v.orphanGroupPositionsRemoved++:v.orphanDevicePositionsRemoved++},R=new Set;for(const[t,e]of Object.entries(o)){const i="string"==typeof e?.s?e.s:"";if(!i||c.has(i))continue;let a,n;const r=f.get(t),l=b.get(t);if(r)a=T(t,i,"device",String(r.name||"")),n="live";else if(l)a=T(t,i,"device",String(l.name||"")),n="absent";else if(t.startsWith("rl_")){const e=t.slice(3);a=T(t,i,"room_label",_.get(e)||""),n=g.has(e)?"live":"absent"}else if(t.startsWith("lg_")){const e=t.slice(3);a=T(t,i,"group"),n=P.has(e)?"live":M?"absent":"unverified","unverified"===n&&(a.reason="registry_unavailable")}else C.has(t)?(a=T(t,i,"device"),n="live"):D.has(t)?(a=T(t,i,"device"),n=M?"absent":"unverified","unverified"===n&&(a.reason="registry_unavailable")):(a=T(t,i,"unknown","","unknown_owner"),n="unverified");if("absent"!==n){if("live"===n){if(v.liveMissingPositions.push(a),!0===s.removeLiveMissingPositions){delete o[t],v.liveMissingPositionsRemoved++,z(a.kind),v.removedPositions.push(a);continue}}else v.unverifiedPositions.push(a);v.positionsUnresolved++,R.add(i)}else delete o[t],z(a.kind),v.removedPositions.push(a)}return v.deadSpaceIds=[...R].sort((t,e)=>t.localeCompare(e)),{config:i,layout:o,report:v,changed:JSON.stringify(i)!==a||JSON.stringify(o)!==n}}(t,e,s),n=a.config,r=bt(n,a.layout);E(n),vt(a.layout);const l=JSON.stringify(t||{}),h=JSON.stringify(e||{}),c=Number.isInteger(Number(n.model_version))?Number(n.model_version):0,d=(t=>{let e=0,s=0,i=0;for(const s of t.markers||[]){if("ripple"===s.display&&(s.display="icon_ripple",e++),Array.isArray(s.controls)){const t="string"==typeof s.binding&&s.binding.startsWith("entity:")?s.binding.slice(7):"",i=t?s.controls.filter(e=>e!==t):s.controls;JSON.stringify(i)!==JSON.stringify(s.controls)&&(s.controls=i.length?i:null,e++)}const t=s.vacuum;t&&xl(t,"trail")&&(["never","cleaning","always"].includes(t.trail_mode)||(t.trail_mode=!1===t.trail?"never":"cleaning"),delete t.trail,e++)}for(const o of t.spaces||[]){const t=o.settings;"glow"===t?.fill_mode&&("boolean"!=typeof t.glow_enabled&&(t.glow_enabled=!0),t.fill_mode="none",e++,s++);for(const t of o.rooms||[]){const s=t.settings;"glow"===s?.fill_mode&&("boolean"!=typeof s.glow&&(s.glow=!0),delete s.fill_mode,e++,i++)}if(xl(o,"segments")&&(delete o.segments,e++),xl(o,"plan_scale")){const t=Number(o.plan_scale);Number.isFinite(t)&&t>=St&&t<=Mt&&(xl(o,"plan_scale_x")||(o.plan_scale_x=t),xl(o,"plan_scale_y")||(o.plan_scale_y=t),delete o.plan_scale,e++)}const a=Number(o.cell_cm);xl(o,"cell_cm")&&(!Number.isFinite(a)||a<.1||a>1e3)&&(o.cell_cm=Number.isFinite(a)&&a>0?Sl(a,.1,1e3):5,e++);const n=Number(o.cell_cm),r=Number.isFinite(n)&&n>0?n:5;for(const t of o.wall_columns||[])if("circle"===t.shape)xl(t,"angle")&&(delete t.angle,e++);else if("square"===t.shape&&xl(t,"angle")){const s=((Number(t.angle)||0)%90+90)%90;t.angle!==s&&(t.angle=s,e++)}for(const t of o.decor||[]){if(xl(t,"width")){const s=Number(t.width);(xl(t,"width_cm")||Number.isFinite(s))&&(xl(t,"width_cm")||(t.width_cm=Number(Sl(s/kt*r,.1,100).toFixed(6))),delete t.width,e++)}if("rect"!==t?.kind&&"ellipse"!==t?.kind||!0!==t.fill||(xl(t,"fill_color")||(t.fill_color=t.color||"#607d8b",e++),xl(t,"fill_opacity")||(t.fill_opacity=.25,e++)),"text"!==t?.kind)continue;void 0===t.size_cm?(t.size_cm=Number(Sl(Ct*Pt(t)/kt*r,.1,2e3).toFixed(6)),delete t.scale,delete t.size,e++):(xl(t,"scale")||xl(t,"size"))&&(delete t.scale,delete t.size,e++);let s=String(t.text??"");const i=[...s.matchAll(/\{([^{}\r\n]+)\}/g)].some(t=>!!Dt(t[1]));if(!(xl(t,"entity")||xl(t,"attr")||xl(t,"unit")))continue;const o=String(t.unit??"").trim(),a="state"===String(t.attr??"").trim().toLowerCase()?null:t.attr,n=i||o?"":It(t.entity,a);if(i||n){if(n){const e=s.indexOf("{}");s=e>=0?s.slice(0,e)+n+s.slice(e+2):`${s}${s?" ":""}${n}`,t.text=s}delete t.entity,delete t.attr,delete t.unit,e++}}}return{total:e,glowSpaces:s,glowRooms:i}})(n);let u=d.total,_=0,m=0,g=0;if(c<10)for(const t of Array.isArray(n.spaces)?n.spaces:[]){const e=Bn(t);m+=e.drafts,g+=e.segments}const f=(b=n.spaces||[],JSON.parse(JSON.stringify(b)));var b;const v=Jr(n.spaces||[],a.layout);let y=0,$=0,w=0,k="";const x=v.spaces.map(t=>{const e=yt(t);y+=e.report.wallsStraightened,$+=e.report.wallsStraightenSkipped;const s=Number(t?.cell_cm)>0?Number(t.cell_cm):5,i=e.report.maxStraightenShift/N*s;return i>w&&(w=i,k=String(t?.id||"")),e.space}),S=y?Jr(x,v.layout):{...v,spaces:x};n.spaces=S.spaces;const M=y?{...v.report,moved:v.report.moved+S.report.moved,coordsCanonicalized:v.report.coordsCanonicalized+S.report.coordsCanonicalized,maxShift:Math.max(v.report.maxShift,S.report.maxShift),maxShiftCm:Math.max(v.report.maxShiftCm,S.report.maxShiftCm),maxSpace:S.report.maxShiftCm>v.report.maxShiftCm?S.report.maxSpace:v.report.maxSpace,rotated:v.report.rotated+S.report.rotated}:{...v.report};let C=0,P=0,D=0,I=0,T=0,z=0,R=0;for(let t=0;t0===Number(t.cm)),walls:e.walls||[]}),a=Ml(e),r=Ml(s);if(!a||!r)continue;const l=Dl(a.rooms),h=Dl(r.rooms),c=.02*kt,d=(e.wall_segments||[]).filter(t=>0===Number(t.cm)).map(t=>({...t,key:O(t.a,t.b,N),cm:0})),u=new Set(d.map(t=>t.key)),_=$t(e,a.rooms,p,c);P+=_.length;for(const t of _){const e=[t[0]/p,t[1]/p],s=[t[2]/p,t[3]/p],i=O(e,s,N);u.has(i)||(u.add(i),d.push({key:i,a:e,b:s,cm:0}))}const m=d.length,g=wt(d,l,h,N,p),b=(t,e,s)=>{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o;if(!(a>0))return Math.hypot(t[0]-e[0],t[1]-e[1]);const n=Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a));return Math.hypot(t[0]-(e[0]+i*n),t[1]-(e[1]+o*n))},v=g.filter(t=>{if(!Array.isArray(t.a)||!Array.isArray(t.b))return!1;const e=t.a.map(t=>t*p),s=t.b.map(t=>t*p);return h.some(([t,i])=>b(e,t,i)<=4*c&&b(s,t,i)<=4*c)});D+=Math.max(0,m-v.length);const y=(s.wall_segments||[]).filter(t=>Number(t.cm)>0);s.wall_segments=[...y,...v.map(({key:t,...e})=>e)];const $=v.map(t=>[t.a[0]*p,t.a[1]*p,t.b[0]*p,t.b[1]*p]),w=Array.isArray(e.walls)?e.walls.length:0;let k=wt(e.walls,l,h,N,p);k=Pl(r.rooms,k,$,N,Number(s.cell_cm)>0?Number(s.cell_cm):5,kt,p),k=_t(r.rooms,k,$,N,Number(s.cell_cm)>0?Number(s.cell_cm):5,kt,p),k=xt(k,s.rooms||[],N,1,$.map(t=>[t[0]/p,t[1]/p,t[2]/p,t[3]/p])),C+=Math.max(0,w-k.length),k.length?s.walls=k:delete s.walls;const x=sl(s.partitions||[],{pitch:N,geometry:ol(s)});x.merged&&(I+=x.merged,s.partitions=x.partitions,il(s.openings,s.partitions,x.openingMoves,{coordScale:p,cellCm:Number(s.cell_cm)>0?Number(s.cell_cm):5,gridPitch:kt}));const S=Ml(s);if(S){const t=o(s,S,s.walls||[],$,{pitch:N,cellCm:Number(s.cell_cm)>0?Number(s.cell_cm):5,gridPitch:kt,coordScale:p});t.partitionsReconciled&&(T+=t.partitionsReconciled,z+=t.openingsRehosted,t.partitions.length?s.partitions=t.partitions:delete s.partitions,t.openings.length?s.openings=t.openings:delete s.openings,t.walls.length?s.walls=t.walls:delete s.walls)}JSON.stringify({zero:(s.wall_segments||[]).filter(t=>0===Number(t.cm)),walls:s.walls||[]})!==i&&R++}if(c<=10){const t=function(t){const e=jn(t);return qn(t,e.config),{...e,config:t}}(n);_+=t.migratedSegments,m+=t.migratedDrafts,g+=t.migratedDraftSegments}const A=E(n),F=vt(S.layout),H=JSON.stringify(A)!==l||JSON.stringify(F)!==h;c<10&&H&&(A.model_version=10);const L=JSON.stringify(A)!==l||JSON.stringify(F)!==h,B=Number.isInteger(Number(A.model_version))?Number(A.model_version):c,W=L?M:{...M,moved:0,coordsCanonicalized:0,maxShift:0,maxShiftCm:0,maxSpace:"",rotated:0},j=L?a.report:{...a.report,spaceRefsRemapped:0,roomRefsRemapped:0,positionsRemapped:0,markersDetached:0,orphanRoomLabelsRemoved:0,orphanDevicePositionsRemoved:0,orphanGroupPositionsRemoved:0,liveMissingPositionsRemoved:0};return{config:A,layout:F,report:{...W,modelFrom:c,modelTo:B,migrated:L?u:0,glowSpacesMigrated:L?d.glowSpaces:0,glowRoomsMigrated:L?d.glowRooms:0,canonicalized:L?R:0,wallSegmentsMigrated:L?_:0,roomDraftsMigrated:L?m:0,roomDraftSegmentsMigrated:L?g:0,legacyZeroWallsMigrated:L?P:0,wallsMerged:L?C:0,spansMerged:L?D:0,partitionsMerged:L?I:0,partitionsReconciled:L?T:0,openingsRehosted:L?z:0,wallsStraightened:L?y:0,wallsStraightenSkipped:$,maxStraightenShiftCm:L?w:0,maxStraightenSpace:L?k:"",latticeCoordinatesCanonicalized:L?r.canonicalized:0,latticeCoordinatesFar:L?r.far:0,latticeMaxShift:L?r.maxShift:0,latticeMaxShiftCm:L?r.maxShiftCm:0,latticeSpaces:L?r.spaces:[],...j},changed:L}}const Tl=Object.freeze({spaces:50,partitions:2e3,openings:500,decor:1e3,columns:500});class zl extends Error{constructor(t){super(t),this.code=t,this.name="SpaceCopyError"}}const Rl=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Al=t=>void 0===t?t:JSON.parse(JSON.stringify(t)),Fl=t=>null===t||"object"!=typeof t||Array.isArray(t)?null:t;function Nl(t,e=!1){if(void 0===t&&!e)return[];if(!Array.isArray(t))throw new zl("source_invalid");return t.map(t=>{const e=Fl(t);if(!e||"string"!=typeof e.id||!e.id)throw new zl("source_invalid");return e})}const El=t=>Array.isArray(t)&&2===t.length&&t.every(t=>Number.isFinite(t));function Hl(t,e,s){const i=String(t??"").trim()||s,o=new Set(e.map(t=>{const e=Fl(t);return String(e?.title??"").trim()}));let a=2;for(;o.has(`${i} (${a})`);)a++;return`${i} (${a})`}const Ol=["settings","zero_wall_style","cell_cm","view_box","plan_url","plan_aspect","plan_x","plan_y","plan_scale","plan_scale_x","plan_scale_y","plan_angle"];const Ll={source_missing:"space.copy_error_source_missing",source_invalid:"space.copy_error_source_invalid",spaces_limit:"space.copy_error_spaces_limit",partitions_limit:"space.copy_error_partitions_limit",openings_limit:"space.copy_error_openings_limit",decor_limit:"space.copy_error_decor_limit",columns_limit:"space.copy_error_columns_limit",opening_host_missing:"space.copy_error_opening_host",opening_host_unknown:"space.copy_error_opening_host",geometry_unsafe:"space.copy_error_geometry"};let Bl=0;function Wl(t,e,s){const i=t._spaceDialog;return!(!i?.copy||i.copy.token!==e)&&(t._spaceDialog={...i,busy:s,copy:{...i.copy,busy:s}},!0)}function jl(t){t._cfgEpoch++,t._modelCache=null,t._frame=null,t._regSignature="",t._maybeRebuildDevices(),t.requestUpdate()}async function Gl(t,e){const s=t._spaceDialog;if(!s?.copy||"edit"!==s.mode||s.busy||s.copy.busy||!s.copy.title.trim()||!s.spaceId||!t._serverCfg)return;const i=++Bl,o=s.spaceId,a=s.copy.title.trim();t._spaceDialog={...s,busy:!0,copy:{...s.copy,title:a,busy:!0,token:i}};let n=!1;try{if(t._saveConfigDebounced.pending()&&t._saveConfigDebounced.flush(),await t._writeChain,!Wl(t,i,!0)||!t._serverCfg)return;const s=t._cfgRev,r=t._layoutRev,l=zt(t._serverCfg),h=zt(t._layout);let c;try{c=(e.optimize??Il)(t._serverCfg,t._layout,e.optimizeReferenceContext())}catch(s){return Wl(t,i,!1),void e.showWallModelMigrationBlocked(s)}if(c.changed){const d=t._checkOptimizeGeometry(c.config);if(e.reportPreflightFailure(d,c.config),!d.ok)return Wl(t,i,!1),void t._showToast(t._t("space.copy_error_optimize_geometry"));const p=await t._confirmDanger({key:`copy-space:${o}`,kind:"warning",title:t._t("space.copy_optimize_title"),message:t._t("space.copy_optimize_body",{name:a}),objectName:a,confirmLabel:t._t("space.copy_optimize_confirm"),cancelLabel:t._t("btn.cancel"),icon:"mdi:broom"});if(!Wl(t,i,p))return;if(!p)return;if(t._cfgRev!==s||t._layoutRev!==r||!t._serverCfg||zt(t._serverCfg)!==l||zt(t._layout)!==h)return Wl(t,i,!1),void t._showToast(t._t("space.copy_error_changed"));e.clearGeometryGesture(),await Br(t,c.config,c.layout),n=!0}if(!Wl(t,i,!0)||!t._serverCfg)return;const d=t._serverCfg,p=function(t,e,s,i){const o=t.spaces;if(!s.trim())throw new zl("source_invalid");if(o.length>=Tl.spaces)throw new zl("spaces_limit");const a=o.findIndex(t=>t.id===e);if(a<0)throw new zl("source_missing");const n=o[a];if(!Array.isArray(n.view_box))throw new zl("source_invalid");const r=Nl(n.wall_segments,!0),l=Nl(n.partitions),h=Nl(n.openings),c=Nl(n.decor),d=Nl(n.wall_columns);if(r.length+l.length>Tl.partitions)throw new zl("partitions_limit");if(h.length>Tl.openings)throw new zl("openings_limit");if(c.length>Tl.decor)throw new zl("decor_limit");if(d.length>Tl.columns)throw new zl("columns_limit");let p=0;const u=t=>`${t}${i}${(p++).toString(36)}`,_=new Map,m=new Map,g=[];for(const t of r){if(_.has(t.id)||!El(t.a)||!El(t.b)||"number"!=typeof t.cm||!Number.isFinite(t.cm))throw new zl("source_invalid");const e=u("cw");_.set(t.id,e),g.push({id:e,a:Al(t.a),b:Al(t.b),cm:t.cm})}for(const t of l){if(m.has(t.id)||!El(t.a)||!El(t.b)||"number"!=typeof t.cm||!Number.isFinite(t.cm))throw new zl("source_invalid");const e=u("cp");m.set(t.id,e),g.push({id:e,a:Al(t.a),b:Al(t.b),cm:t.cm})}const f=h.map(t=>{const e=Fl(t.host);if(!e||"string"!=typeof e.id||"string"!=typeof e.kind)throw new zl("opening_host_missing");const s="wall"===e.kind?_.get(e.id):"partition"===e.kind?m.get(e.id):void 0;if(!s)throw new zl("opening_host_unknown");const i={...Al(t),id:u("co"),host:{...Al(e),kind:"partition",id:s}};return delete i.contact,delete i.lock,i}),b=c.map(t=>({...Al(t),id:u("cd")})),v=d.map(t=>({...Al(t),id:u("cc")})),y=`s${i}`;if(o.some(t=>t.id===y))throw new zl("source_invalid");const $={id:y,title:s.trim(),rooms:[],wall_segments:[],view_box:Al(n.view_box)};for(const t of Ol)"view_box"!==t&&Rl(n,t)&&($[t]=Al(n[t]));g.length&&($.partitions=g),f.length&&($.openings=f),b.length&&($.decor=b),v.length&&($.wall_columns=v);const w=Al(t);return w.spaces.splice(a+1,0,$),{config:w,space:$,sourceIndex:a}}(d,o,a,e.newSeed?.()??function(t=Date.now(),e=Math.random()){const s=Math.floor(16777216*Math.max(0,Math.min(.999999999,e))).toString(36).padStart(5,"0");return`${Math.max(0,Math.floor(t)).toString(36)}${s}`}());let u=!1;try{u=t._checkSpacePhysicalGeometry(p.config,p.space.id).ok}catch{u=!1}if(!u||t._junctionLimitViolations(p.config,p.space.id).length)throw new zl("geometry_unsafe");const _=t._adoption.beginOptimistic(d,p.config);t._adoption.stageLocalConfig(p.config),jl(t);try{await e.saveConfigNow(_)}catch(e){throw t._rollbackOptimistic(_)&&jl(t),"conflict"!==e?.code&&await t._reloadConfigOnly(!0),e}t._canOptimizeUndo=!1,t._undoKind=null,e.clearGeometryGesture(),t._selId=null,t._physicalSel=null,t._spaceDialog=null,t._commitSpace(p.space.id,!0),e.setMode("plan"),t._tool="draw",t._path=[],t._cursorPt=null,t._activeWallChainId=null,t._activeWallChainPartitionIds=[],t._primeDrawWallField(),t._saveNav(),t.requestUpdate(),t._showToast(t._t("toast.space_copied",{name:a}))}catch(e){"conflict"===e?.code&&await Promise.all([t._reloadConfigOnly(!0),t._reloadLayoutOnly()]),Wl(t,i,!1),function(t,e){if(e instanceof zl)return void t._showToast(t._t(Ll[e.code]));const s=e?.code;"wall_model_client_outdated"!==s?t._showToast(t._t("toast.error",{err:t._errText(e)})):t._showToast(t._t("toast.wall_model_client_outdated"))}(t,e),n&&t.requestUpdate()}}const ql=new Set(["group","template","derivative","min_max","threshold","integration","statistics","trend","utility_meter","tod","switch_as_x","schedule"]);function Ul(t){const{hass:e,devices:s,markers:i,showEntities:o,currentBinding:a,currentDeviceId:n,labels:r}=t,l=Rt(i),h=new Set(i.filter(t=>t.removed).map(t=>t.binding)),c=new Set;for(const t of s)t.id!==n&&("device"===t.bindingKind&&t.bindingRef&&c.add(`device:${t.bindingRef}`),"entity"===t.bindingKind&&t.bindingRef&&c.add(`entity:${t.bindingRef}`));const d=new Set;for(const t of s)"device"===t.bindingKind&&t.name&&d.add(`${t.name.trim()}|${t.area||""}`);const p=[];for(const t of Object.values(e?.devices||{})){if(!t||"service"===t.entry_type)continue;const e=`device:${t.id}`;if(c.has(e))continue;const s=String(t.name_by_user||t.name||t.id).trim();e!==a&&!h.has(e)&&d.has(`${s}|${t.area_id||""}`)||p.push({value:e,label:s,sub:(t.model||r.device)+("Group"===t.model?r.z2mGroup:""),kind:"device",ref:t.id,areaId:t.area_id||"",model:t.model||""})}for(const[t,s]of Object.entries(e?.entities||{})){const i=`entity:${t}`;if(c.has(i))continue;if(At(e,t,l)&&!h.has(i))continue;const o=ql.has(s?.platform),a="group"===s?.platform;if(!o&&!a)continue;if(s?.hidden&&!h.has(i))continue;const n=e?.states?.[t];p.push({value:i,label:s?.name||n?.attributes?.friendly_name||t,sub:`${t.split(".")[0]} · ${a?r.group:r.helper}`,kind:"entity",ref:t,areaId:s?.area_id||s?.device_id&&e?.devices?.[s.device_id]?.area_id||"",model:"",parentDeviceId:s?.device_id||void 0})}if(o){const t=new Set(p.map(t=>t.value));for(const[s,i]of Object.entries(e?.entities||{})){const o=`entity:${s}`;if(c.has(o)||t.has(o)||i?.hidden&&!h.has(o))continue;const a=!!i?.device_id&&l.devices.has(i.device_id);if(At(e,s,l)&&!h.has(o)&&!a)continue;const n=e?.states?.[s],d=i?.device_id?e?.devices?.[i.device_id]:null,u=d?String(d.name_by_user||d.name||""):"";p.push({value:o,label:i?.name||n?.attributes?.friendly_name||s,sub:`${s.split(".")[0]} · ${r.entity}${u?` · ${u}`:""}`,kind:"entity",ref:s,areaId:i?.area_id||d?.area_id||"",model:"",parentDeviceId:i?.device_id||void 0})}}return p.sort((t,e)=>t.label.localeCompare(e.label)||t.value.localeCompare(e.value))}const Kl={kind:"active",enabledEntityIds:[],allEntityIds:[]};function Vl(t){return t.startsWith("entity:")?"entity":"device"}function Jl(t){const e=t.binding.indexOf(":"),s=e>=0?t.binding.slice(e+1):"",i=Object.keys(t).filter(t=>!["id","binding","hidden"].includes(t));return t.id===`h${s}`&&0===i.length}const Yl=new Set(["ld2450","hlkld2450","hilinkld2450"]),Xl=()=>globalThis.crypto?.randomUUID?.()||`radar_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`,Zl=(t,e,s)=>{const i=!!t?.original;return{radar:i?t:null,radarEligible:i,radarTouched:i?e:e||!!t,radarRemove:i?s:s||!!t}},Ql=(t,e="")=>"number"==typeof t&&Number.isFinite(t)?String(t):e,th=t=>Array.from(new Set([...t.allEntities||t.entities||[],..."entity"===t.bindingKind&&t.bindingRef?[t.bindingRef]:[]])).filter(t=>/^[a-z0-9_]+\.[a-z0-9_]+$/.test(t)),eh=(t,e,s)=>{const i=t.split(".",2)[1]||"";return new RegExp(`(?:^|_)target_?${s}_${e}(?:_|$)`).test(i)||new RegExp(`(?:^|_)target_${e}_${s}(?:_|$)`).test(i)};function sh(t,e){if(t.marker?.radar&&"object"==typeof t.marker.radar)return Ft(t.marker.radar)?{eligible:!0,profile:t.marker.radar.profile,reason:"saved"}:{eligible:!0,profile:"presence_v1",reason:"saved_unsupported"};const s="entity"===t.bindingKind?e?.entities?.[t.bindingRef||""]:null,i="device"===t.bindingKind?t.bindingRef:s?.device_id,o=i?e?.devices?.[i]:null,a=th(t);return Yl.has((n=o?.model||t.model,String(n||"").toLowerCase().replace(/[^a-z0-9]/g,"")))&&a.some(t=>eh(t,"x",1))&&a.some(t=>eh(t,"y",1))?{eligible:!0,profile:"esphome_ld2450_v1",reason:"ld2450"}:{eligible:!1,profile:"presence_v1",reason:"none"};var n}function ih(t,e){return t.find(t=>e.some(e=>e.test(t)))||""}function oh(t,e,s,i,o=!1){const a=sh(t,i),n=Ft(t.marker?.radar)?t.marker.radar:null;if(!n&&!a.eligible&&!o)return null;const r=n?.profile||a.profile,l=o&&!a.eligible||"ld2450"!==a.reason?{xEntities:["","",""],yEntities:["","",""],distanceEntity:"",angleEntity:"",occupancyEntity:"",countEntity:"",zoneEntity:""}:function(t,e,s){const i=th(t).filter(t=>!!s?.states?.[t]),o=[],a=[];for(let t=1;t<=3;t++)o.push(i.find(e=>eh(e,"x",t))||""),a.push(i.find(e=>eh(e,"y",t))||"");const n=i.filter(t=>t.startsWith("binary_sensor.")),r=i.filter(t=>t.startsWith("sensor.")),l=ih(n,[/(?:occupancy|presence|target)(?:_|$)/]);return{xEntities:o,yEntities:a,distanceEntity:ih(r,[/(?:target_)?distance(?:_|$)/,/distance/]),angleEntity:ih(r,[/(?:target_)?angle(?:_|$)/,/angle/]),occupancyEntity:l,countEntity:ih(r,[/(?:target|people|presence)_count(?:_|$)/,/target_count/]),zoneEntity:"zones_v1"===e?ih(n,[/(?:zone|region).*(?:occupancy|presence)/,/zone/]):""}}(t,r,i),h=n?.sources||{},c=h.slots||[],d=c.filter(t=>"x_entity"in t),p=c.filter(t=>"distance_entity"in t),u=h.ranges||[],_=h.zones?.[0],m="esphome_ld2450_v1"===r?3:"cartesian_v1"===r?Math.max(1,d.length):"polar_v1"===r?Math.max(1,p.length):1,g=n?.room_id||t.marker?.room_id||e.rooms.find(e=>e.area&&e.area===t.area)?.id||"";return{original:n,enabled:!0===n?.enabled,showLive:!1!==n?.show_live,profile:r,roomId:g,installationId:n?.mount?.installation_id||Xl(),mountX:Ql(null==n?.mount?.x?void 0:1e3*n.mount.x,Ql(s[0],"0")),mountY:Ql(null==n?.mount?.y?void 0:1e3*n.mount.y,Ql(s[1],"0")),heading:Ql(n?.mount?.heading_deg,"0"),rangeCm:Ql(n?.mount?.range_cm,"esphome_ld2450_v1"===r?"600":""),fovDeg:Ql(n?.mount?.fov_deg,"esphome_ld2450_v1"===r?"120":""),mirror:!0===n?.calibration?.mirror,unit:d[0]?.unit||p[0]?.unit||u[0]?.unit||("esphome_ld2450_v1"===r?"mm":"cm"),xEntities:Array.from({length:m},(t,e)=>d[e]?.x_entity||l.xEntities[e]||""),yEntities:Array.from({length:m},(t,e)=>d[e]?.y_entity||l.yEntities[e]||""),distanceEntities:Array.from({length:m},(t,e)=>p[e]?.distance_entity||(0===e?l.distanceEntity:"")),angleEntities:Array.from({length:m},(t,e)=>p[e]?.angle_entity||(0===e?l.angleEntity:"")),rangeEntities:u.length?u.map(t=>t.entity_id):[l.distanceEntity],slotPresenceEntities:Array.from({length:m},(t,e)=>(d[e]||p[e])?.presence_entity||""),rangePresenceEntities:(u.length?u:[{}]).map(t=>"presence_entity"in t&&t.presence_entity||""),swapXY:Array.from({length:m},(t,e)=>!0===d[e]?.swap_xy),xSigns:Array.from({length:m},(t,e)=>-1===d[e]?.x_sign?-1:1),ySigns:Array.from({length:m},(t,e)=>-1===d[e]?.y_sign?-1:1),angleUnit:p[0]?.angle_unit||"degrees",angleZero:p[0]?.angle_zero||"forward",angleClockwise:!1!==p[0]?.angle_clockwise,occupancyEntity:h.occupancy_entity||l.occupancyEntity,countEntity:h.count_entity||l.countEntity,availabilityEntity:h.availability_entity||"",zoneEntity:_?.entity_id||l.zoneEntity,zoneKind:_?.kind||"occupancy"}}const ah=t=>JSON.stringify(t,(t,e)=>e&&"object"==typeof e&&!Array.isArray(e)?Object.fromEntries(Object.entries(e).sort(([t],[e])=>te?1:0)):e),nh=t=>{if(!t.trim())return null;const e=Number(t.replace(",","."));return Number.isFinite(e)?e:null};function rh(t,e){const s=nh(t.mountX),i=nh(t.mountY),o=nh(t.heading);if(!t.roomId||null==s||null==i||null==o)return null;const a={...t.original?.sources||{}};if(delete a.slots,delete a.ranges,delete a.zones,delete a.occupancy_entity,delete a.count_entity,"esphome_ld2450_v1"===t.profile||"cartesian_v1"===t.profile){if(a.slots=t.xEntities.flatMap((e,s)=>{const i=t.yEntities[s]||"";return e&&i?[{id:`target_${s+1}`,x_entity:e,y_entity:i,unit:"esphome_ld2450_v1"===t.profile?"mm":t.unit,..."cartesian_v1"===t.profile&&t.swapXY[s]?{swap_xy:!0}:{},..."cartesian_v1"===t.profile&&-1===t.xSigns[s]?{x_sign:-1}:{},..."cartesian_v1"===t.profile&&-1===t.ySigns[s]?{y_sign:-1}:{},...t.slotPresenceEntities[s]?{presence_entity:t.slotPresenceEntities[s]}:{}}]:[]}),!a.slots.length)return null}else if("polar_v1"===t.profile){if(a.slots=t.distanceEntities.flatMap((e,s)=>{const i=t.angleEntities[s]||"";return e&&i?[{id:`target_${s+1}`,distance_entity:e,angle_entity:i,unit:t.unit,angle_unit:t.angleUnit,angle_zero:t.angleZero,angle_clockwise:t.angleClockwise,...t.slotPresenceEntities[s]?{presence_entity:t.slotPresenceEntities[s]}:{}}]:[]}),!a.slots.length)return null}else if("range_v1"===t.profile){if(a.ranges=t.rangeEntities.flatMap((e,s)=>e?[{id:`range_${s+1}`,entity_id:e,unit:t.unit,...t.rangePresenceEntities[s]?{presence_entity:t.rangePresenceEntities[s]}:{}}]:[]),!a.ranges.length)return null}else if("zones_v1"===t.profile){if(!t.zoneEntity)return null;a.zones=[{id:"zone_1",kind:t.zoneKind,entity_id:t.zoneEntity}]}else if("presence_v1"===t.profile&&!t.occupancyEntity)return null;t.occupancyEntity&&(a.occupancy_entity=t.occupancyEntity),t.countEntity&&(a.count_entity=t.countEntity),t.availabilityEntity&&(a.availability_entity=t.availabilityEntity);const n=nh(t.rangeCm),r=nh(t.fovDeg),l=(o%360+360)%360,h={...t.original?.mount||{},installation_id:t.installationId,x:s/1e3,y:i/1e3,heading_deg:l};null!=n&&n>0?h.range_cm=n:delete h.range_cm,null!=r&&r>0?h.fov_deg=r:delete h.fov_deg;const c=t.original,d="two_point"===c?.calibration?.method&&c.profile===t.profile&&ah(c.sources)===ah(a)&&c.mount.installation_id===t.installationId&&Math.abs(c.mount.x-h.x)<1e-12&&Math.abs(c.mount.y-h.y)<1e-12&&Math.abs(c.mount.heading_deg-l)<1e-9&&c.calibration.mirror===t.mirror&&Math.abs(c.calibration.cell_cm-e)<1e-9,p=t.calibrationOverride?{...t.calibrationOverride}:d?{...c.calibration}:{...c?.calibration||{},method:"zones_v1"===t.profile||"presence_v1"===t.profile?"not_required":"manual",mirror:t.mirror,cell_cm:e};t.calibrationOverride||d||(delete p.refs,delete p.rms_cm);const u={...t.original||{},version:1,enabled:t.enabled,profile:t.profile,sources:a,mount:h,room_id:t.roomId,calibration:p};return t.showLive?delete u.show_live:u.show_live=!1,u}function lh(t,e="main"){const{dialog:s,device:i}=t;if(!i)return h``;t.setup.syncMarker(i.marker?.id||i.id);const o=sh(i,t.registryHass),a="saved_unsupported"===o.reason,n=()=>t.updateDialog({radar:null,radarTouched:!0,radarRemove:!0}),r=()=>{const e=t.spaceModelById(i.space)||t.currentSpace();if(!e)return;const s=t.position(i),o=oh(i,e,[s.x,s.y],t.registryHass,!0);o&&t.updateDialog({radar:o,radarEligible:!0,radarTouched:!0,radarRemove:!1})},c=!a&&"virtual"!==s.bindingMode&&(!s.radar||s.radarRemove)&&!o.eligible;if("additional"===e)return c?h`
    +
    `:d} + `}}Ca.properties={hass:{attribute:!1},value:{attribute:!1},savedEnabled:{type:Boolean,attribute:"saved-enabled"},devices:{attribute:!1},registry:{attribute:!1}},Ca.styles=w`:host{display:block;color:inherit;font:inherit;}.section{margin-top:18px;font-weight:700;display:flex;align-items:center;gap:2px;}.toggle{display:flex;align-items:center;gap:10px;margin-top:10px;}.hint,.status{color:var(--secondary-text-color,#9aa0aa);font-size:12px;line-height:1.45;}.hint{margin-top:6px;}.providers{display:grid;gap:14px;margin-top:12px;padding-left:34px;}.provider{display:grid;gap:7px;}.provider-title{font-weight:650;}.actions{display:flex;align-items:center;flex-wrap:wrap;gap:8px;}textarea{box-sizing:border-box;width:100%;min-height:58px;resize:vertical;border:1px solid var(--divider-color,#666);border-radius:8px;padding:8px;color:var(--primary-text-color,inherit);background:var(--card-background-color,#202126);font:inherit;}button{display:inline-flex;align-items:center;gap:6px;min-height:36px;border:1px solid var(--divider-color,#666);border-radius:9px;padding:7px 11px;color:inherit;background:transparent;cursor:pointer;font:inherit;font-weight:600;}button:disabled,textarea:disabled{opacity:.5;cursor:default;}.warning{color:var(--warning-color,#d89300);font-size:12px;line-height:1.45;}`,customElements.get("hp-zigbee-topology-settings")||customElements.define("hp-zigbee-topology-settings",Ca);const Pa=(t,e)=>[t[0]-e[0],t[1]-e[1]],Da=(t,e)=>[t[0]+e[0],t[1]+e[1]],Ia=(t,e)=>t[0]*e[0]+t[1]*e[1],Ta=t=>Math.hypot(t[0],t[1]);function za(t){let e=0;for(let s=0;st[1]!=l>t[1]&&t[0]<(r-a)*(t[1]-n)/(l-n)+a&&(s=!s)}return s}([r[0]+n[0]*l,r[1]+n[1]*l],t)&&(n=[-n[0],-n[1]]),n}function Fa(t){const e=t.length;if(e<3)return!1;for(let s=0;s(t[0]-o[0])*r[1]-(t[1]-o[1])*r[0],h=t=>(t[0]-o[0])*r[0]+(t[1]-o[1])*r[1],c=s,d=n-s;for(const e of t){const t=Math.abs(l(e));if(t<=s)continue;const o=h(e);o<=c||o>=d||tMath.abs(n+(t-p)/g*(r-n));i=Math.min(i,f(_),f(m))}}return i}function Ea(t,e,s){if(N(t,e,s))return!0;if(F(t,e,s)||F(e,t,s))return!1;let i=0;try{const s=E([[...t.map(t=>[t[0],t[1]]),[t[0][0],t[0][1]]]],[[...e.map(t=>[t[0],t[1]]),[e[0][0],e[0][1]]]]);for(const t of s)t?.[0]&&(i+=H(t[0]))}catch{return!1}return i>Math.max(1e-7,s*s)}function Ha(t,e,s){for(const i of e)for(let e=0;es)continue;const h=(t.x-o[0])*l[0]+(t.y-o[1])*l[1];if(h-t.length/2>=-s&&h+t.length/2<=r+s)return!0}return!1}function Oa(t,e,s){const i=Math.abs(e[0]-t[0]),o=Math.abs(e[1]-t[1]);return i<=s&&o>s?"v":o<=s&&i>s?"h":null}function La(t,e,s){return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s}function Ba(t,e,s,i,o){return La(t,s,o)&&La(e,i,o)||La(t,i,o)&&La(e,s,o)}function Wa(t,e,s,i,o){const a=Oa(t,e,o);return a&&Oa(s,i,o)===a?"h"===a?Math.abs(t[1]-s[1])>o||Math.abs(t[1]-i[1])>o?0:Math.max(0,Math.min(Math.max(t[0],e[0]),Math.max(s[0],i[0]))-Math.max(Math.min(t[0],e[0]),Math.min(s[0],i[0]))):Math.abs(t[0]-s[0])>o||Math.abs(t[0]-i[0])>o?0:Math.max(0,Math.min(Math.max(t[1],e[1]),Math.max(s[1],i[1]))-Math.max(Math.min(t[1],e[1]),Math.min(s[1],i[1]))):0}function ja(t,e,s,i){const o=t.length,a=Oa(t[(e-1+o)%o],t[e],i),n=Oa(t[(e+1)%o],t[(e+2)%o],i),r="h"===s?"v":"h";return a===r&&n===r}function Ga(t){let e=1/0,s=1/0,i=-1/0,o=-1/0;for(const a of t)e=Math.min(e,a[0]),s=Math.min(s,a[1]),i=Math.max(i,a[0]),o=Math.max(o,a[1]);return[e,s,i,o]}function qa(t,e,s){const i=Ga(t),o=Ga(e);return i[2]o}const Ka=(t,e)=>"h"===e?t[0]:t[1],Va=(t,e)=>"h"===e?t[1]:t[0];function Ja(t,e,s,i,o){const a=t.find(t=>t.id===e);if(!a)return null;const n=a.poly[s],r=a.poly[(s+1)%a.poly.length],l=Oa(n,r,o);if(!l)return null;const h=0===i?r:n,c=0===i?n:r,d=Ka(h,l),p=Ka(c,l),u=Va(h,l),_=function(t,e,s,i){const o=[];for(const a of t)for(let t=0;ti||Math.abs(Va(r,e)-s)>i)continue;const l=Ka(n,e),h=Ka(r,e),c=Math.min(l,h),d=Math.max(l,h);d-c>i&&o.push({roomId:a.id,edge:t,lo:c,hi:d})}return o.sort((t,e)=>t.lo-e.lo||t.hi-e.hi||t.roomId.localeCompare(e.roomId)||t.edge-e.edge)}(t,l,u,o),m=function(t,e,s,i){const o=[e,s];for(const a of t){const t=Math.max(e,a.lo),n=Math.min(s,a.hi);n-t>i&&o.push(t,n)}const a=[...new Set(o)].sort((t,e)=>t-e),n=[];for(let e=0;e+1r>t.lo-i&&rt.roomId))].sort();n.push({lo:s,hi:o,owners:l})}return n}(_,Math.min(d,p),Math.max(d,p),o);return!m.length||m.some(t=>t.owners.length<1||t.owners.length>2)?null:{roomId:e,edge:s,movedEndpoint:i,axis:l,line:u,fixed:d,moving:p,intervals:_,baseline:m}}function Ya(t,e,s){const i=[];for(const o of t.intervals){const a=e.polys[o.roomId];if(!a){i.push(o);continue}if(o.edge<0||o.edge>=a.length)continue;const n=a[o.edge],r=a[(o.edge+1)%a.length];if(Oa(n,r,s)!==t.axis||Math.abs(Va(n,t.axis)-t.line)>s||Math.abs(Va(r,t.axis)-t.line)>s)continue;const l=Ka(n,t.axis),h=Ka(r,t.axis),c=Math.min(l,h),d=Math.max(l,h);d-c>s&&i.push({...o,lo:c,hi:d})}return i}function Xa(t,e,s){return new Set(t.filter(t=>e>t.lo-s&&et.roomId)).size}function Za(t,e,s){for(const i of e.sideOwnership){const e=t.polys[i.roomId];if(!e)return!1;const o=e[i.edge],a=e[(i.edge+1)%e.length];if(Oa(o,a,s)!==i.axis)return!1;const n=Ka(0===i.movedEndpoint?o:a,i.axis),r=Ya(i,t,s),l=(i.moving>=i.fixed?i.baseline[i.baseline.length-1]:i.baseline[0]).owners.length;if(l<1||l>2)return!1;const h=Math.min(i.fixed,i.moving,n),c=Math.max(i.fixed,i.moving,n),d=[h,c,i.fixed,i.moving,n];for(const t of i.intervals)d.push(t.lo,t.hi);for(const t of r)d.push(t.lo,t.hi);const p=[...new Set(d.filter(t=>t>=h&&t<=c))].sort((t,e)=>t-e),u=Math.min(i.fixed,i.moving),_=Math.max(i.fixed,i.moving),m=Math.min(i.fixed,n),g=Math.max(i.fixed,n);for(let t=0;t+1u-s&&a<_+s,h=a>m-s&&a2||d>2)return!1;if(n&&h){if(c!==d)return!1}else if(!n&&h){if(d!==l||c>0&&c!==d)return!1}else if(2===c?2!==d:d>1)return!1}}return!0}function Qa(t,e,s,i){const o=[s.n[0]*i,s.n[1]*i],a={polys:{},openings:{},movedSpans:{}};for(const e of s.roomIds){const i=t.find(t=>t.id===e),n=s.edgeByRoom[e];if(!i||null==n)continue;const r=(n+1)%i.poly.length;a.polys[e]=i.poly.map((t,e)=>e===n||e===r?Da(t,o):[...t]),a.movedSpans[e]=[[Da(i.poly[n],o),Da(i.poly[r],o)]]}for(const t of e)s.movingOpeningIds.includes(t.id)&&(a.openings[t.id]=[t.x+o[0],t.y+o[1]]);return a}function tn(t,e,s,i,o,a,n,r){if(!function(t,e,s,i){if(Ra([t.x,t.y],e,s)>2*i)return!1;const o=Ta(Pa(s,e));if(o<=i)return!1;const a=[(s[0]-e[0])/o,(s[1]-e[1])/o],n=(t.x-e[0])*a[0]+(t.y-e[1])*a[1];return n>=-i&&n<=o+i}(t,e,s,r))return!0;if(Ra([t.x,t.y],i,o)>2*r)return!1;const l=0===a?i:o;return Ta(Pa([t.x,t.y],l))>=t.length/2+n-r}function en(t,e,s,i){const o=i.movingHalf||0;return"circle"===t.kind?Ra(t.center,e,s)2)return!1;const r=Qa(t,e,s,i);if(Object.keys(r.polys).length!==s.roomIds.length)return!1;if(!Za(r,s,a))return!1;const l=new Set(s.roomIds),h=t=>r.polys[t.id]||t.poly;for(const i of s.roomIds){const l=t.find(t=>t.id===i),h=r.polys[i],c=s.edgeByRoom[i];if(!l||!h||h.length!==s.topology[i]||h.length!==l.poly.length||!Fa(h))return!1;const d=l.poly.length,p=(c-1+d)%d,u=[p,c,(c+1)%d];for(const t of u)if(A(h[t],h[(t+1)%d]))return!1;const _=za(l.poly),m=za(h);if(Math.abs(m)t.id===e),i=r.polys[e];for(const o of t){if(o.id===e||l.has(o.id))continue;const t=h(o);if(!qa(s.poly,o.poly,a)||!qa(i,t,a))if(F(s.poly,o.poly,a)){if(!F(i,t,a))return!1}else if(F(o.poly,s.poly,a)){if(!F(t,i,a))return!1}else if(F(i,t,a)||F(t,i,a)||Ea(i,t,a))return!1}}t.find(t=>t.id===s.roomId);const c=r.polys[s.roomId],d=s.edgeByRoom[s.roomId],p=c[d],u=c[(d+1)%c.length];if(Math.abs(i)>a)for(const t of o.obstacles||[])if(en(t,p,u,o))return!1;for(const t of e){if(!s.movingOpeningIds.includes(t.id))continue;const e=r.openings[t.id];if(!e||t.hosted)return!1;if(!Ha({...t,x:e[0],y:e[1]},[c],2*a))return!1}return!0}const on=new WeakMap,an=t=>"number"==typeof t&&Number.isFinite(t),nn=(t,e)=>{const s=new Map;for(const i of t||[])!an(i?.cm)||!e&&i.cm<=0||s.set(i.cm,(s.get(i.cm)||0)+1);return s},rn=t=>[String(t),"см"].join(" ");function ln(t,e,s={}){if(s.allowClear)return[];const i=!0===s.exactMultiplicity,o=nn(t,i),a=nn(e,i),n=[];for(const[t,e]of o){const s=a.get(t)||0;0===s?n.push({invariant:"wall_records",kind:"lost",owner:rn(t),reference:`было ${e}`,detail:"записи этой толщины исчезли целиком"}):i&&s!==e&&n.push({invariant:"wall_records",kind:"count",owner:rn(t),reference:`было ${e}, стало ${s}`,detail:"изменилось число записей этой толщины"})}if(i)for(const[t,e]of a)o.has(t)||n.push({invariant:"wall_records",kind:"count",owner:rn(t),reference:`было 0, стало ${e}`,detail:"появились записи новой толщины"});return n}class hn{constructor(){this._selectedRoomId=null,this._session=null,this._eligibility=null}get dragging(){return null!==this._session}ownsPointer(t){return this._session?.pointerId===t}get selectedRoomId(){return this._selectedRoomId}get snapshotIdentity(){return this._session?.snapshotIdentity||null}get activePointerId(){return this._session?.pointerId??null}get moved(){return!0===this._session?.moved}get delta(){return this._session?.delta||0}get rooms(){return this._session?.rooms||null}get openings(){return this._session?.openings||null}get plan(){return this._session?.plan||null}get preview(){return this._session?.accepted?.preview||null}get liveLabels(){return this._session?.accepted?.labels||null}selectRoom(t){this._selectedRoomId=t}restoreSelection(t){this._selectedRoomId=t}escapeIdle(){return this._selectedRoomId?(this._selectedRoomId=null,"selection-cleared"):"exit-tool"}resolve(t,e,s){this._eligibility&&this._eligibility.context===t||(this._eligibility={context:t,values:new Map});const i=this._eligibility.values.get(e);if(i)return i;const o=s();return this._eligibility.values.set(e,o),o}begin(t){return!this._session&&(this._session={pointerId:t.pointerId,start:[...t.start],roomId:t.roomId,plan:t.plan,options:t.options,rooms:t.rooms,openings:t.openings,snapshotIdentity:t.snapshotIdentity,before:t.before,moved:!1,delta:0,changedRoomIds:[...t.plan.roomIds],rejectionNotified:!1,wallUnionBefore:t.wallUnionBefore,epochBefore:t.epochBefore,accepted:null},!0)}move(t){const e=this._session;if(!e||e.pointerId!==t.pointerId)return{kind:"no-op"};const s=(i=e.start,o=t.point,a=e.plan.n,[i?.[0],i?.[1],o?.[0],o?.[1],a?.[0],a?.[1]].every(Number.isFinite)?(o[0]-i[0])*a[0]+(o[1]-i[1])*a[1]:0);var i,o,a;const n=t.snap([e.plan.a[0]+e.plan.n[0]*s,e.plan.a[1]+e.plan.n[1]*s]),r=(n[0]-e.plan.a[0])*e.plan.n[0]+(n[1]-e.plan.a[1])*e.plan.n[1],l=function(t,e,s,i,o,a){if(!Number.isFinite(i)||Math.abs(i)<1e-9)return 0;const n=Math.sign(i),r=Math.abs(i),l=Math.max(Math.abs(o),1e-6);let h=on.get(s);h&&h.opts===a||(h={opts:a,values:new Map},on.set(s,h));const c=h.values;let d=0;for(let i=Math.min(l,r),o=0;o<4096&&i<=r+1e-9;o++,i=Math.min(r,i+l)){const o=n*i,h=`${o.toFixed(9)}|${l.toFixed(9)}`;let p=c.get(h);if(void 0===p&&(p=sn(t,e,s,o,a),c.size<4096&&c.set(h,p)),!p)break;if(d=o,Math.abs(i-r)<=1e-9)break}return d}(e.rooms,e.openings,e.plan,r,t.step,e.options);if(e.moved&&l===e.delta)return{kind:"no-op"};const h=Qa(e.rooms,e.openings,e.plan,l);let c;try{if(c=t.project(e.snapshotIdentity,h.polys,h.openings,e.changedRoomIds,e.rooms),!c.ok)return this._projectionRejected(e);if(ln(c.value.beforeWalls,c.value.afterWalls,{exactMultiplicity:!0}).length)return this._projectionRejected(e)}catch{return this._projectionRejected(e)}const d=e.accepted,p={preview:c.value.preview,labels:null,artifact:c.value.artifact,beforeWalls:c.value.beforeWalls,afterWalls:c.value.afterWalls};e.accepted=p;try{t.publish(p.preview,p.artifact),p.labels=t.measure(h,e.plan)}catch{e.accepted=d;try{t.publish(d?.preview||null,d?.artifact||null)}catch{}return this._projectionRejected(e)}return e.moved=!0,e.delta=l,{kind:"accepted",preview:c.value.preview,labels:p.labels,artifact:c.value.artifact}}finish(t){const e=this._session;if(!e||e.pointerId!==t.pointerId)return{kind:"no-op"};const s=e.accepted;let i;if(e.moved&&Math.abs(e.delta)>1e-9&&s)if(t.currentSnapshotIdentity!==e.snapshotIdentity)i={kind:"rejected",reason:"stale-snapshot"};else if(sn(e.rooms,e.openings,e.plan,e.delta,e.options))if(ln(s.beforeWalls,s.afterWalls,{exactMultiplicity:!0}).length)i={kind:"rejected",reason:"wall-records"};else{let o=!1;try{o=t.validatePreview(s.preview)}catch{o=!1}i=o?{kind:"commit",preview:s.preview,before:e.before}:{kind:"rejected",reason:"invalid-candidate"}}else i={kind:"rejected",reason:"invalid-topology"};else i={kind:"no-op"};return this._session=null,"commit"===i.kind&&(this._eligibility=null),i}cancel(t,e){const s=this._session;if(!s||void 0!==e&&s.pointerId!==e)return{kind:"no-op"};this._session=null,this._eligibility=null;const i=t===s.snapshotIdentity;return{kind:"cancelled",restoreWallUnion:i?s.wallUnionBefore:null,restoreEpoch:i?s.epochBefore:null}}reset(){this._selectedRoomId=null,this._session=null,this._eligibility=null}_projectionRejected(t){const e=!t.rejectionNotified;return t.rejectionNotified=!0,{kind:"rejected",notify:e}}}const cn=t=>"object"==typeof t&&null!==t?t:null,dn=t=>Array.isArray(t)?t.flatMap(t=>{const e=cn(t);return e?[e]:[]}):[],pn=t=>{if(!Array.isArray(t))return null;const e=Number(t[0]),s=Number(t[1]);return Number.isFinite(e)&&Number.isFinite(s)?[e,s]:null};function un(t){const e=(s=t.poly,Array.isArray(s)?s.flatMap(t=>{const e=pn(t);return e?[e]:[]}):[]);var s;if(e.length>=3)return e;const i=Number(t.x),o=Number(t.y),a=Number(t.w),n=Number(t.h);return[i,o,a,n].every(Number.isFinite)?[[i,o],[i+a,o],[i+a,o+n],[i,o+n]]:[]}function _n(t){if(!t.length)return null;const e=t.map(t=>t[0]),s=t.map(t=>t[1]);return{minX:Math.min(...e),minY:Math.min(...s),maxX:Math.max(...e),maxY:Math.max(...s)}}function mn(t,e){const s=cn(t);if(!s)return null;const i=dn(s.rooms),o=new Set(function(t,e){const s=dn(t),i=new Set(e);return s.flatMap(t=>{const e=String(t.id||"");return e&&i.has(e)?[e]:[]})}(i,e)),a=i.filter(t=>o.has(String(t.id||"")));if(!_n(a.flatMap(un))||!a.length)return null;const n=Number(s.cell_cm),r=Number.isFinite(n)&&n>0?n:5,l=a.flatMap(t=>{const e=un(t);return e.map((t,s)=>[t,e[(s+1)%e.length]])}),h=.02*O,c=(t,e,s)=>{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o,n=a>0?Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a)):0;return Math.hypot(t[0]-e[0]-n*i,t[1]-e[1]-n*o)},d=(t,e)=>Math.min(...l.map(([s,i])=>((t,e,s,i)=>{const o=(t,e,s)=>(e[0]-t[0])*(s[1]-t[1])-(e[1]-t[1])*(s[0]-t[0]),a=o(t,e,s),n=o(t,e,i),r=o(s,i,t),l=o(s,i,e);return a*n<=h*h&&r*l<=h*h&&Math.min(t[0],e[0])<=Math.max(s[0],i[0])+h&&Math.min(s[0],i[0])<=Math.max(t[0],e[0])+h&&Math.min(t[1],e[1])<=Math.max(s[1],i[1])+h&&Math.min(s[1],i[1])<=Math.max(t[1],e[1])+h?0:Math.min(c(t,s,i),c(e,s,i),c(s,t,e),c(i,t,e))})(t,e,s,i))),p=t=>{const e=pn(t.a),s=pn(t.b);if(e&&s)return((t,e)=>l.some(([s,i])=>{const o=i[0]-s[0],a=i[1]-s[1],n=Math.hypot(o,a);if(!(n>h))return!1;const r=t=>Math.abs((t[0]-s[0])*a-(t[1]-s[1])*o)/n;if(r(t)>h||r(e)>h)return!1;const l=t=>((t[0]-s[0])*o+(t[1]-s[1])*a)/(n*n),c=l(t),d=l(e);return Math.min(1,Math.max(c,d))-Math.max(0,Math.min(c,d))>h}))(e,s);const[i]=String(t.key||"").split("@"),o=i?.split(",").map(Number)||[];return 2!==o.length||!o.every(Number.isFinite)||l.some(([t,e])=>c(o,t,e)<=h)},u=dn(s.walls).filter(p),_=dn(s.wall_segments).filter(p),m=Math.max(0,...[...u,..._].map(t=>Number(t.cm)).filter(Number.isFinite))/r*O/2,g=dn(s.partitions).filter(t=>{const e=pn(t.a),s=pn(t.b);if(!e||!s)return!0;const i=Math.max(0,Number(t.cm)||0)/r*O/2;return d(e,s)<=m+i+h}),f=dn(s.wall_columns).filter(t=>{const e=pn(t.center);if(!e)return!0;const s=Math.max(0,Number(t.cm)||0)/r*O;return l.some(([t,i])=>c(e,t,i)<=m+s+h)}),b=new Set(g.map(t=>String(t.id||"")).filter(Boolean)),v=dn(s.openings).filter(t=>{const e=cn(t.host);if("partition"===e?.kind)return b.has(String(e.id||""));const s=pn([t.x,t.y]);return!s||l.some(([t,e])=>c(s,t,e)<=h)});return{...s,rooms:a,walls:u,wall_segments:_,open_spans:dn(s.open_spans).filter(p),partitions:g,wall_columns:f,openings:v}}const gn=1e-9;class fn extends Error{constructor(t,e=""){super(e?`${t}: ${e}`:t),this.reason=t,this.name="WallSegmentModelError"}}const bn=t=>JSON.parse(JSON.stringify(t)),vn=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(Number(t[0]))&&Number.isFinite(Number(t[1])),yn=t=>[Number(t[0]),Number(t[1])],$n=t=>`${Number(t[0]).toFixed(12)},${Number(t[1]).toFixed(12)}`,wn=(t,e)=>{const s=$n(t),i=$n(e);return s$n(t)<=$n(e)?[yn(t),yn(e)]:[yn(e),yn(t)],xn=(t,e)=>Math.hypot(e[0]-t[0],e[1]-t[1]),Sn=(t,e=[])=>{const s=new Set,i=t=>{const e=Number(t);if(!Number.isFinite(e))return;const i=e/O;Math.abs(i-Math.round(i))>=U&&s.add(e.toFixed(12))};for(const e of Array.isArray(t?.rooms)?t.rooms:[])for(const t of B(e)||[])i(t[0]),i(t[1]);for(const e of[t?.wall_segments,t?.walls])for(const t of Array.isArray(e)?e:[])i(t?.a?.[0]),i(t?.a?.[1]),i(t?.b?.[0]),i(t?.b?.[1]);for(const t of e)i(t?.[0]),i(t?.[1]);return s.size},Mn=(t,e,s)=>{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o;return a>1e-18?((t[0]-e[0])*i+(t[1]-e[1])*o)/a:0},Cn=(t,e,s)=>{const i=Math.max(0,Math.min(1,Mn(t,e,s)));return Math.hypot(t[0]-(e[0]+(s[0]-e[0])*i),t[1]-(e[1]+(s[1]-e[1])*i))},Pn=(t,e,s,i,o=1e-9)=>{const a=e[0]-t[0],n=e[1]-t[1],r=Math.hypot(a,n);if(r<=o)return 0;const l=e=>Math.abs((e[0]-t[0])*n-(e[1]-t[1])*a)/r;if(l(s)>o||l(i)>o)return 0;const h=Mn(s,t,e),c=Mn(i,t,e);return Math.max(0,Math.min(1,Math.max(h,c))-Math.max(0,Math.min(h,c)))*r},Dn=t=>{const e=(new TextEncoder).encode(t),s=8*e.length,i=64*Math.ceil((e.length+9)/64),o=new Uint8Array(i);o.set(e),o[e.length]=128;const a=new DataView(o.buffer);a.setUint32(i-8,Math.floor(s/4294967296),!1),a.setUint32(i-4,s>>>0,!1);const n=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),r=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),l=new Uint32Array(64),h=(t,e)=>t>>>e|t<<32-e;for(let t=0;t>>3,o=h(s,17)^h(s,19)^s>>>10;l[t]=l[t-16]+i+l[t-7]+o>>>0}let[e,s,i,o,c,d,p,u]=r;for(let t=0;t<64;t++){const a=u+(h(c,6)^h(c,11)^h(c,25))+(c&d^~c&p)+n[t]+l[t]>>>0,r=e&s^e&i^s&i;u=p,p=d,d=c,c=o+a>>>0,o=i,i=s,s=e,e=a+((h(e,2)^h(e,13)^h(e,22))+r>>>0)>>>0}r[0]=r[0]+e>>>0,r[1]=r[1]+s>>>0,r[2]=r[2]+i>>>0,r[3]=r[3]+o>>>0,r[4]=r[4]+c>>>0,r[5]=r[5]+d>>>0,r[6]=r[6]+p>>>0,r[7]=r[7]+u>>>0}const c=new Uint8Array(32),d=new DataView(c.buffer);for(let t=0;t{const e="abcdefghijklmnopqrstuvwxyz234567";let s=0,i=0,o="";for(const a of t)for(i=i<<8|a,s+=8;s>=5;)o+=e[i>>>s-5&31],s-=5;return s&&(o+=e[i<<5-s&31]),o},Tn=(t,e,s,i,o="")=>{const[a,n]=kn(e,s),r=`${t}|${$n(a)}|${$n(n)}|${[...i].sort().join(",")}${o}`;return`wall-${In(Dn(r)).slice(0,20)}`};let zn=0;const Rn=t=>{for(let e=0;e<1e3;e++){const e=globalThis.crypto?.randomUUID?.(),s=`wall-${e||In(Dn(`${Date.now()}|${zn++}|${Math.random()}`)).slice(0,26)}`;if(!t.has(s))return s}throw new fn("duplicate-id","id factory exhausted")},An=t=>{const e=new Map;for(const s of Array.isArray(t?.wall_segments)?t.wall_segments:[])if(s&&"string"==typeof s.id&&vn(s.a)&&vn(s.b)){if(e.has(s.id))throw new fn("duplicate-id",s.id);e.set(s.id,s)}return e},Fn=(t,e,s)=>{const i=(s,i)=>{const o=t[0]-s[0],a=t[1]-s[1];return Math.abs(e[0]-i[0]-o)<=gn&&Math.abs(e[1]-i[1]-a)<=gn?[o,a]:null};return i(s.a,s.b)||i(s.b,s.a)},Nn=(t,e)=>{const s=Array.isArray(t.rooms)?t.rooms:[],i=j(t.open_spans).map(t=>[t.a[0],t.a[1],t.b[0],t.b[1]]),o=i.length?i:G(s,null,1,.04*O,!0),a=[];for(const t of s){const s=B(t),i=Array.isArray(t?.wall_ids)?t.wall_ids:[];if(s&&i.length===s.length)for(let t=0;t"partition"!==t.host?.kind&&[Number(t.x),Number(t.y)].every(Number.isFinite)&&Number.isFinite(Number(t.angle))&&Number(t.length)>0&&o.some(e=>Cn([Number(t.x),Number(t.y)],[e[0],e[1]],[e[2],e[3]])<=.04*O)):[],l=r.map(t=>{const e=Number(t.angle)*Math.PI/180,s=[Math.cos(e),Math.sin(e)],i=Number(t.length)/2,o=[Number(t.x),Number(t.y)];return{a:[o[0]-s[0]*i,o[1]-s[1]*i],b:[o[0]+s[0]*i,o[1]+s[1]*i]}}),h=(t,e)=>r.some(s=>{const i=[Number(s.x),Number(s.y)];if(!K(t,e,Number(s.angle)))return!1;if(Cn(i,t,e)>.02*O)return!1;const o=xn(t,e),a=Mn(i,t,e)*o,n=Number(s.length)/2;return a+n>=-1e-9&&a-n<=o+gn}),c=new Map,d=[];for(const i of s){const r=String(i?.id||""),p=B(i);if(!r||!p||p.length<3)throw new fn("invalid-room",r);const u=q(s,r,n,O,1,[...t.walls||[],...l]);if(!u||u.poly.length<3)throw new fn("invalid-room",r);const _=Array.isArray(i.wall_ids)?i.wall_ids:[],m=_.length===p.length;let g=null,f=m;if(f)for(let t=0;tgn||Math.abs(i[1]-g[1])>gn)){f=!1;break}g=i}const b=[];for(let t=0;t2)throw new fn("third-owner",n);const d=m?_[u.parent[t]]:void 0;if("string"==typeof d&&d){const o=e.get(d);f||!o||Pn(s,i,o.a,o.b)>gn?l.preferredIds.add(d):l.positionalIds.add(d),l.preferredCarriers.set(d,{a:yn(p[u.parent[t]]),b:yn(p[(u.parent[t]+1)%p.length])})}const g=u.parent[t];l.parentKeys.add(W(p[g],p[(g+1)%p.length],O));const v=[(s[0]+i[0])/2,(s[1]+i[1])/2],y=t=>t.some(t=>Cn(v,[t[0],t[1]],[t[2],t[3]])<=.04*O);l.zeroWall||=y(a)||y(o)&&!h(s,i),b.push(n)}const v={...i};delete v.wall_ids,d.push({...v,poly:u.poly.map(t=>[t[0],t[1]]),wall_ids:b})}return{atoms:[...c.values()].sort((t,e)=>t.key.localeCompare(e.key)),rooms:d}},En=(t,e,s,i,o)=>{const a=new Map([...s.values()].map(t=>[wn(t.a,t.b),t])),n=(t=>{const e=new Map;for(const s of t)"wall"===s.host?.kind&&e.set(s.host.id,(e.get(s.host.id)||0)+1);return e})(t.openings||[]),r=new Map;for(const t of e){const e=o?.get(t.key);if(e){const i=s.get(e);if(!i)throw new fn("duplicate-id",e);r.set(t,i);continue}if(t.preferredIds.size>1)throw new fn("duplicate-id",[...t.preferredIds].sort().join(","));const i=[...t.preferredIds][0],l=i?s.get(i):void 0;if(l){r.set(t,l);continue}const h=i?t.preferredCarriers.get(i):void 0;if(i&&h){r.set(t,{id:i,a:h.a,b:h.b,cm:0});continue}const c=a.get(t.key);if(c){r.set(t,c);continue}const d=[...s.values()].filter(e=>Pn(t.a,t.b,e.a,e.b)>gn),p=[...new Map(d.map(t=>[t.id,t])).values()];if(p.sort((t,e)=>(n.get(e.id)||0)-(n.get(t.id)||0)||xn(e.a,e.b)-xn(t.a,t.b)||t.id.localeCompare(e.id)),p[0])r.set(t,p[0]);else if(1===t.positionalIds.size){const e=s.get([...t.positionalIds][0]);e&&r.set(t,e)}}const l=new Map;for(const[t,e]of r){const s=l.get(e.id)||[];s.push(t),l.set(e.id,s)}for(const[t,e]of l){const i=s.get(t)||r.get(e[0]);if(!i)throw new fn("duplicate-id",t);const o=[(i.a[0]+i.b[0])/2,(i.a[1]+i.b[1])/2];e.sort((t,e)=>{const s=Cn(o,t.a,t.b)<=gn?0:1,a=Cn(o,e.a,e.b)<=gn?0:1;if(s!==a)return s-a;return(Cn(i.a,t.a,t.b)<=gn?0:1)-(Cn(i.a,e.a,e.b)<=gn?0:1)||t.key.localeCompare(e.key)}),e[0].id=t}const h=(t=>{const e=new Set;for(const s of[t.rooms,t.openings,t.decor,t.room_drafts,t.partitions,t.wall_columns])for(const t of Array.isArray(s)?s:[])"string"==typeof t?.id&&t.id&&e.add(t.id);for(const s of Array.isArray(t.room_drafts)?t.room_drafts:[])for(const t of Array.isArray(s?.segments)?s.segments:[])"string"==typeof t?.id&&t.id&&e.add(t.id);return e})(t);for(const t of e)if(t.id){if(h.has(t.id))throw new fn("duplicate-id",t.id);h.add(t.id)}const c=e.filter(t=>!t.id);if(i){const e=c.map(e=>{const[s,i]=kn(e.a,e.b),o=`${String(t.id||"")}|${$n(s)}|${$n(i)}|${[...e.owners].sort().join(",")}`,a=In(Dn(o));return{atom:e,seed:o,digest:a,base:`wall-${a.slice(0,20)}`}}).sort((t,e)=>t.digest.localeCompare(e.digest)||t.atom.key.localeCompare(e.atom.key)),s=new Map;for(const t of e){const e=s.get(t.digest);if(e&&e!==t.seed)throw new fn("duplicate-id",t.digest);s.set(t.digest,t.seed);let i=1,o=t.base;for(;h.has(o);)o=`${t.base}-${++i}`;t.atom.id=o,h.add(o)}}else for(const t of c)t.id=Rn(h),h.add(t.id)},Hn=(t,e)=>{if("partition"===t.host?.kind)return null;const s=[Number(t.x),Number(t.y)];if(!s.every(Number.isFinite))return null;const i=e=>{if(!(Number(e.cm)>0))return!1;const i=Mn(s,e.a,e.b),o=xn(e.a,e.b),a=Number(t.length)/2;return i>=-1e-9&&i<=1+gn&&Cn(s,e.a,e.b)<=.02*O&&K(e.a,e.b,Number(t.angle))&&Number.isFinite(a)&&a>=0&&i*o-a>=-1e-9&&i*o+a<=o+gn},o="wall"===t.host?.kind?e.find(e=>e.id===t.host.id):null,a=o&&i(o)?[o]:e.filter(i);if(1!==a.length)return null;const n=a[0];return{kind:"wall",id:n.id,t:Math.max(0,Math.min(1,Mn(s,n.a,n.b)))}},On=(t,e)=>{const s=[Number(t.x),Number(t.y)];if(!s.every(Number.isFinite))return null;const i=Number(t.length)/2,o=e.filter(e=>{if(!(Number(e.cm)>0))return!1;const o=Mn(s,e.a,e.b),a=xn(e.a,e.b);return o>=-1e-9&&o<=1+gn&&Cn(s,e.a,e.b)<=.02*O&&K(e.a,e.b,Number(t.angle))&&Number.isFinite(i)&&i>=0&&o*a-i>=-1e-9&&o*a+i<=a+gn}),a=(e=>{if(!e.length)return null;const i="wall"===t.host?.kind?e.find(e=>e.id===t.host.id):null;return i||[...e].sort((t,e)=>Cn(s,t.a,t.b)-Cn(s,e.a,e.b)||Number(e.cm)-Number(t.cm)||(t.ide.id?1:0))[0]})(o);return a?{kind:"wall",id:a.id,t:Math.max(0,Math.min(1,Mn(s,a.a,a.b)))}:null},Ln=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/,Bn=t=>{if("number"!=typeof t&&"string"!=typeof t)return null;if("string"==typeof t&&!Ln.test(t.trim()))return null;const e=Number(t);return Number.isFinite(e)?e:null},Wn=t=>{if(!Array.isArray(t)||t.length<2)return null;const e=Bn(t[0]),s=Bn(t[1]);return null==e||null==s?null:[e,s]},jn=t=>"string"==typeof t?t:"",Gn=t=>{if(!Object.prototype.hasOwnProperty.call(t,"room_drafts"))return{drafts:0,segments:0};const e=Array.isArray(t.room_drafts)?t.room_drafts:[];if(!e.length)return delete t.room_drafts,{drafts:0,segments:0};const s=new Set;for(const e of[t.rooms,t.openings,t.decor,t.partitions,t.wall_columns,t.wall_segments])for(const t of Array.isArray(e)?e:[])"string"==typeof t?.id&&t.id&&s.add(t.id);for(const t of e)"string"==typeof t?.id&&t.id&&s.add(t.id);const i=Array.isArray(t.partitions)?[...t.partitions]:[];let o=0;for(const a of e){const e=jn(a?.id),n=Array.isArray(a?.points)?a.points:[],r=Array.isArray(a?.segments)?a.segments:[];if(n.length<2||r.length!==n.length-1)throw new fn("zero-length",e);for(let a=0;a+1100)throw new fn("thickness-conflict",e);let p="string"==typeof c?.id&&c.id?c.id:"";if(!p||s.has(p)){const i=Tn(jn(t.id),l,h,[`draft:${e}:${a}`]);p=i;for(let t=2;s.has(p);t++)p=`${i}-${t}`}s.add(p),i.push({id:p,a:yn(l),b:yn(h),cm:d}),o++}}return i.length?t.partitions=i:delete t.partitions,delete t.room_drafts,{drafts:e.length,segments:o}},qn=t=>Gn(t),Un=(t,e,s)=>{const i=Gn(t),o=An(t),{atoms:a,rooms:n}=Nn(t,o);En(t,a,o,e,s);const r=a.map(e=>{const s=e.id?o.get(e.id):void 0,i=((t,e,s)=>{if(e.zeroWall)return 0;const i=Array.isArray(t.walls)?t.walls:[],o=W(e.a,e.b,O),a=i.filter(t=>Number(t.cm)>0&&(!(t.key!==o&&!e.parentKeys.has(t.key))||!(!vn(t.a)||!vn(t.b))&&Pn(e.a,e.b,t.a,t.b)>=xn(e.a,e.b)-gn)).map(t=>Math.max(1,Math.min(100,Number(t.cm))));if(new Set(a.map(t=>t.toFixed(9))).size>1)throw new fn("thickness-conflict",e.key);if(a.length)return a[0];const n=J(i,e.a,e.b,O,1);return n>0?n:Number(s?.cm)>0?Number(s.cm):0})(t,e,s);return{...s||{},id:e.id,a:[...e.a],b:[...e.b],cm:i}}),l=new Map(a.map(t=>[t.key,t.id]));for(const t of n)t.wall_ids=t.wall_ids.map(t=>l.get(t));t.rooms=n,t.wall_segments=r,t.walls=r.filter(t=>t.cm>0).map(t=>({key:W(t.a,t.b,O),cm:t.cm,a:[...t.a],b:[...t.b]})),t.walls.length||delete t.walls,delete t.open_spans;for(const e of t.rooms)delete e.open_to;return((t,e,s)=>{const i=Array.isArray(t.openings)?t.openings:[];for(const t of i){if("partition"===t.host?.kind)continue;if(!t.host&&!s){const s=Hn(t,e);s&&(t.host=s);continue}const i=Hn(t,e)??(s?On(t,e):null);if(i)t.host=i;else{if(!s)throw new fn("opening-host",t.id);delete t.host}}})(t,r,e),{wallSegments:r.reduce((t,e)=>t+(o.has(e.id)?0:1),0),drafts:i.drafts,draftSegments:i.segments}};function Kn(t,e={}){const s=JSON.stringify(t),i=bn(t);L(i);let o=0,a=0,n=0;const r=Number(i?.model_version||0)<10;for(const t of Array.isArray(i?.spaces)?i.spaces:[]){const s=e.lineageSpaceId===String(t?.id||"")?e.lineageHints:void 0,i=Un(t,r,s);o+=i.wallSegments,a+=i.drafts,n+=i.draftSegments}return i.model_version=10,L(i),{config:i,changed:s!==JSON.stringify(i),migratedSegments:o,migratedDrafts:a,migratedDraftSegments:n}}const Vn=t=>!!t&&"object"==typeof t&&!Array.isArray(t);function Jn(t,e){const s=(t,e)=>{if(Array.isArray(t)&&Array.isArray(e)){const i=new Map;for(const e of t)Vn(e)&&"string"==typeof e.id&&e.id&&i.set(e.id,e);const o=e.map((e,o)=>{if(Vn(e)&&"string"==typeof e.id&&e.id){const t=i.get(e.id);return t?s(t,e):bn(e)}return o[e,e in t?s(t[e],i):bn(i)]);for(const e of Object.keys(t))delete t[e];for(const[e,s]of i)t[e]=s;return t}return bn(e)};return s(t,e)}const Yn=t=>"object"==typeof t&&null!==t?t:null,Xn=t=>Array.isArray(t)?t.flatMap(t=>{const e=Yn(t);return e?[e]:[]}):[],Zn=t=>{if(!Array.isArray(t))return null;const e=Number(t[0]),s=Number(t[1]);return Number.isFinite(e)&&Number.isFinite(s)?[e,s]:null},Qn=t=>JSON.stringify(t??null),tr=(t,e=1e8)=>`${Math.round(t[0]*e)},${Math.round(t[1]*e)}`,er=(t,e,s=1e-8)=>Math.hypot(t[0]-e[0],t[1]-e[1])<=s,sr=(t,e,s)=>{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o,n=a>0?Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a)):0;return Math.hypot(t[0]-e[0]-n*i,t[1]-e[1]-n*o)},ir=(t,e,s)=>(e[0]-t[0])*(s[1]-t[1])-(e[1]-t[1])*(s[0]-t[0]),or=(t,e,s,i)=>{const o=2e-4*O,a=ir(t,e,s),n=ir(t,e,i),r=ir(s,i,t),l=ir(s,i,e);return a*n<=o*o&&r*l<=o*o&&Math.min(t[0],e[0])<=Math.max(s[0],i[0])+o&&Math.min(s[0],i[0])<=Math.max(t[0],e[0])+o&&Math.min(t[1],e[1])<=Math.max(s[1],i[1])+o&&Math.min(s[1],i[1])<=Math.max(t[1],e[1])+o?0:Math.min(sr(t,s,i),sr(e,s,i),sr(s,t,e),sr(i,t,e))},ar=t=>{const e=(s=t.poly,Array.isArray(s)?s.flatMap(t=>{const e=Zn(t);return e?[e]:[]}):[]);var s;if(e.length>=3)return e;const i=Number(t.x),o=Number(t.y),a=Number(t.w),n=Number(t.h);return[i,o,a,n].every(Number.isFinite)?[[i,o],[i+a,o],[i+a,o+n],[i,o+n]]:[]},nr=t=>{const e=ar(t);return e.map((t,s)=>[t,e[(s+1)%e.length]])},rr=(t,e)=>Math.max(0,Number(t)||0)/e*O,lr=(t,e=15)=>{const s=Number(t.cm);return Number.isFinite(s)?Math.max(0,s):e},hr=t=>Math.atan2(t.b[1]-t.a[1],t.b[0]-t.a[0]),cr=(t,e)=>{let s=Math.abs(hr(t)-hr(e));return s%=Math.PI,s=Math.min(s,Math.PI-s),s<=Math.PI/180&&Math.abs(t.cm-e.cm)<=1e-6};function dr(t,e){const s=Yn(t),i=Xn(s?.partitions).find(t=>t.id===e);if(!i)return null;const o=Zn(i.a),a=Zn(i.b),n=Number(i.cm);return!o||!a||!Number.isFinite(n)||n<0||er(o,a)?null:{partitionId:e,a:o,b:a,cm:n}}function pr(t,e){const s=Yn(t);if(!s)return null;const i=Number(s.cell_cm),o=Number.isFinite(i)&&i>0?i:5,a=rr(5,o),n=rr(e.cm,o)/2,r=Xn(s.rooms),l=Xn(s.wall_segments),h=new Map(l.map(t=>[String(t.id||""),t])),c=Xn(s.walls),d=t=>{const e=Array.isArray(t.wall_ids)?t.wall_ids.map(String):[];return nr(t).map(([t,s],i)=>{const a=[h.get(e[i]),...c.filter(e=>{const i=Zn(e.a),o=Zn(e.b);if(i&&o)return or(t,s,i,o)<=.02*O;const[a]=String(e.key||"").split("@"),n=Zn(a?.split(",").map(Number));return!!n&&sr(n,t,s)<=.02*O})].filter(t=>!!t),n=Math.max(15,...a.map(t=>lr(t,15)));return{a:t,b:s,half:rr(n,o)/2}})},p=r.flatMap(t=>{const s=String(t.id||""),i=d(t).some(({a:t,b:s,half:i})=>or(e.a,e.b,t,s)<=n+i+a);return s&&i?[s]:[]}),u=new Set(p);if(p.length){const t=r.filter(t=>u.has(String(t.id||""))).flatMap(d);for(const e of r){const s=String(e.id||"");s&&!u.has(s)&&(d(e).some(({a:e,b:s,half:i})=>t.some(t=>or(e,s,t.a,t.b)<=i+t.half+.02*O))&&u.add(s))}}const _=[...u],m=r.filter(t=>u.has(String(t.id||""))),g=new Set(m.flatMap(t=>Array.isArray(t.wall_ids)?t.wall_ids.map(String):[])),f=Xn(s.wall_segments).filter(t=>g.has(String(t.id||""))),b=m.flatMap(nr),v=Xn(s.walls).filter(t=>{const e=Zn(t.a),s=Zn(t.b);if(e&&s)return b.some(([t,i])=>or(e,s,t,i)<=.02*O);const[i]=String(t.key||"").split("@"),o=Zn(i?.split(",").map(Number));return!o||b.some(([t,e])=>sr(o,t,e)<=.02*O)}),{segments:y,malformedPartitions:$}=function(t){const e=[],s=[];for(const i of Xn(t.partitions)){const t=Zn(i.a),o=Zn(i.b);t&&o?e.push({key:`partition:${String(i.id||Qn(i))}`,source:i,a:t,b:o,cm:lr(i,0)}):s.push(i)}return{segments:e,malformedPartitions:s}}(s),w=new Set(y.flatMap(t=>or(e.a,e.b,t.a,t.b)<=n+rr(t.cm,o)/2+a?[t.key]:[]));let k=!0;for(;k;){k=!1;const t=y.filter(t=>w.has(t.key));for(const e of y)w.has(e.key)||t.some(t=>cr(t,e)&&(er(t.a,e.a)||er(t.a,e.b)||er(t.b,e.a)||er(t.b,e.b)))&&(w.add(e.key),k=!0)}const x=new Set(y.filter(t=>w.has(t.key)).flatMap(t=>[tr(t.a),tr(t.b)]));for(const t of y)(x.has(tr(t.a))||x.has(tr(t.b)))&&w.add(t.key);const S=y.filter(t=>w.has(t.key)),M=S.map(t=>t.source).concat($),C=Xn(s.wall_columns).filter(t=>{const s=Zn(t.center);if(!s)return!0;const i=rr(Number(t.cm),o)/2,r="circle"===t.shape?i:i*Math.SQRT2;return sr(s,e.a,e.b)<=n+r+a}),P=new Set(M.map(t=>String(t.id||""))),D=new Set(f.map(t=>String(t.id||""))),I=Xn(s.openings).filter(t=>{const s=Yn(t.host);if("partition"===s?.kind)return P.has(String(s.id||""));if("wall"===s?.kind&&D.has(String(s.id||"")))return!0;const i=Zn([t.x,t.y]);return!i||sr(i,e.a,e.b)<=n+a}),T=Xn(s.open_spans).filter(t=>{const s=Zn(t.a),i=Zn(t.b);return!s||!i||or(e.a,e.b,s,i)<=n+a});return{space:{...s,rooms:m,walls:v,wall_segments:f,open_spans:T,openings:I,partitions:M,wall_columns:C},roomIds:_,segmentCount:f.length+S.length}}const ur=1e3;const _r=(t,e)=>(t._clearGeometryGesture(),t._restoreGeometryStateLocal(e),t.host._showToast(t.host._t("toast.geometry_unsafe")),!1);function mr(t,e,s){const{host:i}=t,o=i._serverCfg,a=i._activeWallChainPartitionIds[i._activeWallChainPartitionIds.length-1]||null,n=()=>t._commitPhysicalGeometry(e,s);if(!s||!o||!a||10!==Number(o.model_version||0))return n();const r=o.spaces.find(t=>t.id===s.spaceId);if(!r||!function(t,e,s){const i=Yn(t),o=Yn(e);if(!i||!o||String(i.spaceId||"")!==String(o.id||""))return!1;if(["rooms","openings","walls","wall_segments","open_spans","wall_columns","decor"].some(t=>Qn(i[t]??[])!==Qn(o[t]??[])))return!1;const a=Yn(i.plan_transform)||{},n={};for(const t of["plan_x","plan_y","plan_scale","plan_scale_x","plan_scale_y","plan_angle"])void 0!==o[t]&&(n[t]=o[t]);if(Qn(a)!==Qn(n))return!1;const r=Xn(i.partitions),l=Xn(o.partitions);if(l.length!==r.length+1||Qn(l.slice(0,-1))!==Qn(r))return!1;const h=l[l.length-1],c=Zn(h.a),d=Zn(h.b);return h.id===s&&!!c&&!!d&&!er(c,d)&&Number.isFinite(Number(h.cm))&&Number(h.cm)>=0}(s,r,a))return n();let l;try{l=Kn(o).config}catch(e){return t._clearGeometryGesture(),t._restoreGeometryStateLocal(s),t._showWallModelMigrationBlocked(e),!1}const h=l.spaces.find(t=>t.id===s.spaceId),c=dr(h,a);if(!h||!c)return n();const d=JSON.parse(JSON.stringify(o));if(!t._restoreGeometryStateInConfig(d,s))return n();const p=d.spaces.find(t=>t.id===s.spaceId),u=pr(h,c),_=pr(p,c);if(!u||!_)return n();const m={...l,spaces:[u.space]},g={...d,spaces:[_.space]};let f=null,b=!1;try{const t=i._path.length>=2?i._path.map(t=>[t[0]/ur,t[1]/ur]):[];b=Sn(h)<=Sn(s,t)&&i._checkSpacePhysicalGeometry(m,s.spaceId,t=>{f=t}).ok}catch{b=!1}if(!b)return _r(t,s);const v=t._junctionLimitsIntroduced(m,g,s.spaceId,f,u.roomIds);if(v.length)return t._clearGeometryGesture(),t._restoreGeometryStateLocal(s),i._showToast(t._junctionLimitLabel(v[0])),!1;Jn(o,l);const y=o.spaces.find(t=>t.id===s.spaceId),$=y?.partitions?.find(t=>t.id===a),w=i._activeWallChainPartitionIds.length-1;$&&w>=0&&i._path.length===i._wallChainSegmentCms.length+1&&(i._path[w]=[$.a[0]*ur,$.a[1]*ur],i._path[w+1]=[$.b[0]*ur,$.b[1]*ur],i._wallChainSegmentCms[w]=Number($.cm)),t._recordGeometry(e,s);const k=i._pendingPhysicalWrites.get(s.spaceId);return i._pendingPhysicalWrites.set(s.spaceId,{before:k?.before||s,fingerprint:Y(y)}),t._saveConfig(),!0}const gr=(t,e)=>[(t[0]-e.x)/Math.max(1e-9,e.w)*e.stageWidth,(t[1]-e.y)/Math.max(1e-9,e.h)*e.stageHeight];function fr(t){const{poly:e,edge:s,text:i,view:o}=t,a=e[s],n=e[(s+1)%e.length],r=[(a[0]+n[0])/2,(a[1]+n[1])/2],l=function(t,e){const s=t[e],i=t[(e+1)%t.length],o=i[0]-s[0],a=i[1]-s[1],n=Math.hypot(o,a)||1;return(t=>{let e=0;for(let s=0;s=0?[-a/n,o/n]:[a/n,-o/n]}(e,s),h=Math.hypot(n[0]-a[0],n[1]-a[1])||1,c=[(n[0]-a[0])/h,(n[1]-a[1])/h],d=gr(r,o),p=gr(t.gearCenter,o),u=Math.max(34,7.2*i.length+12),_=Math.abs(l[0])>=Math.abs(l[1])?Math.max(28,u/2+4):Math.max(28,13),m=d[0]+l[0]*_,g=d[1]+l[1]*_,f=e=>{return s=m+c[0]*e,i=g+c[1]*e,o=u,a=18,n=p[0],r=p[1],l=t.gearWidthPx,h=t.gearHeightPx,2*Math.abs(s-n)=Math.abs(c[1])?c[0]:c[1])>0?-1:1,e=Math.max(o.stageWidth,o.stageHeight,64);for(let s=4;s<=e;s+=4){const e=s*t;if(!f(e)){b=e;break}const i=-e;if(!f(i)){b=i;break}}}const v=l[0]*_+c[0]*b,y=l[1]*_+c[1]*b,$=Math.hypot(v,y)||1,w=y/$*12,k=[r[0]+v/$*12*o.w/Math.max(1,o.stageWidth),r[1]+w*o.h/Math.max(1,o.stageHeight)];return{anchor:r,offsetXPx:v,offsetYPx:y,tangentOffsetPx:b,side:Math.abs(l[0])>=Math.abs(l[1])?l[0]<0?"left":"right":l[1]<0?"above":"below",leader:{a:r,b:k}}}const br=t=>{let e=(t%360+360)%360;return e>180&&(e-=360),e};function vr(t,e,s,i,o,a=0,n=[t,e],r){const l=1e-7,h=(t,e,s,i,o)=>{const a=Math.max(0,Math.min(1,((t[0]-e[0])*s+(t[1]-e[1])*i)/o));return{t:a,x:e[0]+a*s,y:e[1]+a*i}},c=t=>{if(!t||!Number.isFinite(t[0])||!Number.isFinite(t[1]))return null;const e=Math.hypot(t[0],t[1]);return e>1e-9?[t[0]/e,t[1]/e]:null},d=c(r);let p=null;for(const r of i){const i=Number(r?.a?.[0]),u=Number(r?.a?.[1]),_=Number(r?.b?.[0]),m=Number(r?.b?.[1]);if(![i,u,_,m].every(Number.isFinite))continue;const g=_-i,f=m-u,b=g*g+f*f;if(!(b>1e-18))continue;const v=Math.sqrt(b),y=h(n,[i,u],g,f,b),$=Math.hypot(n[0]-y.x,n[1]-y.y);if(!($=2?r.axisA:r.a,e=r.axisB?.length>=2?r.axisB:r.b,s=Number(e[0])-Number(t[0]),i=Number(e[1])-Number(t[1]),o=s*s+i*i;if(o>1e-18&&[t[0],t[1],e[0],e[1]].every(Number.isFinite)){const e=h(n,t,s,i,o),a=(n[0]-e.x)*w[0]+(n[1]-e.y)*w[1];if(a>l)k=2;else if(a<-1e-7){if(r.roomSide)continue;k=-2}else d&&(k=w[0]*d[0]+w[1]*d[1])}}else{let t=n[0]-y.x,e=n[1]-y.y;const s=Math.hypot(t,e);if(s>l)t/=s,e/=s,k=2;else if(d)[t,e]=d,k=1;else{const s=i<_||i===_&&u<=m;t=-(s?f:-f)/v,e=(s?g:-g)/v}w=[t,e]}const x=h([t,e],[i,u],g,f,b);let S=x.t,M=x.x,C=x.y;if(Number.isFinite(a)&&a>0){const t=Math.round(S*v/a)*a;S=Math.max(0,Math.min(1,t/v)),M=i+S*g,C=u+S*f}const P=br(180*Math.atan2(-w[0],w[1])/Math.PI),D={cx:M+w[0]*(s/2),cy:C+w[1]*(s/2),angle:P,dist:$,sideScore:k,stableId:"string"==typeof r.stableId?r.stableId:""};(!p||D.distp.sideScore+l||Math.abs(D.sideScore-p.sideScore)<=l&&D.stableId.localeCompare(p.stableId)<0))&&(p=D)}return p&&{cx:p.cx,cy:p.cy,angle:p.angle,dist:p.dist}}const yr=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1]),$r=(t,e)=>{const s=t=>`${t[0].toFixed(9)},${t[1].toFixed(9)}`,i=s(t),o=s(e);return i<=o?`${i}|${o}`:`${o}|${i}`};function wr(t,e,s,i,o,a,n=1){const r=[],l=new Map;for(const h of t||[]){const c="string"==typeof h?.id?h.id:"";if(!c)continue;const d=et(t,c,e,s,i,o,a,n);if(d)for(let t=0;t1e-9))continue;const a=st(d.poly,t),n=Number(d.offsets[t]),h=Number.isFinite(n)&&n>0?n:0,p=[e[0],e[1]],u=[s[0],s[1]],_=$r(p,u),m=l.get(_)||new Set;m.add(c),l.set(_,m),r.push({a:[p[0]+a[0]*h,p[1]+a[1]*h],b:[u[0]+a[0]*h,u[1]+a[1]*h],axisA:p,axisB:u,normal:a,owner:"room",stableId:`room:${c}:${_}`,roomId:c,atomId:_,half:h})}}const h=[];for(const t of r){const{atomId:e,half:s,...i}=t;if(!(1===l.get(e)?.size&&s>1e-9)){h.push(i);continue}const o=i.normal;h.push({...i,roomSide:"inside",stableId:`${i.stableId}:inside`}),h.push({...i,a:[i.axisA[0]-o[0]*s,i.axisA[1]-o[1]*s],b:[i.axisB[0]-o[0]*s,i.axisB[1]-o[1]*s],normal:[-o[0],-o[1]],roomSide:"outside",stableId:`${i.stableId}:outside`})}return h}function kr(t){const e=[],s=new Set;for(const i of t||[])if(Array.isArray(i)&&!(i.length<2))for(let t=0;t1e-9))continue;const n=[o[0],o[1]],r=[a[0],a[1]],l=`physical:${$r(n,r)}`;s.has(l)||(s.add(l),e.push({a:n,b:r,axisA:[...n],axisB:[...r],normal:null,owner:"physical",stableId:l}))}return e}const xr=new WeakMap;const Sr=1e-9,Mr=2e-7,Cr=1e7,Pr=t=>{const e=Math.sign(t)*Math.floor(Math.abs(t)*Cr+.5)/Cr;return Object.is(e,-0)?0:e},Dr=t=>`${Pr(t[0])},${Pr(t[1])}`,Ir=(t,e)=>Math.hypot(e[0]-t[0],e[1]-t[1]),Tr=(t,e,s)=>t/(e||1)*s,zr=(t,e)=>Math.atan2(e[1]-t[1],e[0]-t[0]),Rr=t=>Array.isArray(t)&&t.length>=2&&t.every(t=>Number.isFinite(t)),Ar=t=>(t||[]).filter(t=>Rr(t?.a)&&Rr(t?.b)&&Ir(t.a,t.b)>Sr);function Fr(t,{minAngleDeg:e=15,maxValence:s=6}={}){const i=new Map;for(const e of Ar(t))for(const[t,s]of[[e.a,e.b],[e.b,e.a]]){const e=i.get(Dr(t))||[];e.push(zr(t,s)),i.set(Dr(t),e)}const o=[];for(const[t,a]of i){if(a.length>s&&o.push({rule:"valence",subject:t,actual:a.length,limit:s}),a.length<2)continue;const i=[...a].sort((t,e)=>t-e);let n=1/0;for(let t=0;tSr&&s(180*Math.atan2(t.b[1]-t.a[1],t.b[0]-t.a[0])/Math.PI%180+180)%180,Er=(t,e,s=1)=>{const i=Math.abs(Nr(t)-Nr(e));return Math.min(i,180-i)<=s},Hr=t=>{const e=new Map;for(const s of t)for(const t of[s.a,s.b]){const i=e.get(Dr(t));i?i.push(s):e.set(Dr(t),[s])}return e};function Or(t,e,s){const i=Ar(e),o=s??Hr(i),a=new Set([t]);let n=Ir(t.a,t.b);const r=[t.a,t.b];for(;r.length;){const e=r.pop();for(const s of o.get(Dr(e))||[])a.has(s)||Er(s,t)&&Number(s.cm||0)===Number(t.cm||0)&&(a.add(s),n+=Ir(s.a,s.b),r.push(s.a,s.b))}return n}function Lr(t,e,s,{minLengthCm:i=20}={}){const o=[],a=Ar(t),n=Hr(a);for(const t of a){const r=Or(t,a,n)/s*(e||1),l=Math.max(i,Number(t.cm)>0?Number(t.cm):0);r{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o,n=a<=Sr?0:Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a));return Math.hypot(t[0]-(e[0]+i*n),t[1]-(e[1]+o*n))};function Wr(t,e,s,{minDistanceCm:i=5}={}){const o=Ar(t),a=new Map;for(const t of o)a.set(Dr(t.a),t.a),a.set(Dr(t.b),t.b);const n=Tr(i,e,s),r=n>Sr?n:1,l=(t,e)=>`${Math.floor(t/r)},${Math.floor(e/r)}`,h=new Map;for(const[t,e]of a){const s=l(e[0],e[1]),i=h.get(s);i?i.push([t,e]):h.set(s,[[t,e]])}const c=new Map;for(const t of o){const e=Math.min(t.a[0],t.b[0])-n,s=Math.max(t.a[0],t.b[0])+n,i=Math.min(t.a[1],t.b[1])-n,o=Math.max(t.a[1],t.b[1])+n;for(let a=Math.floor(e/r);a<=Math.floor(s/r);a++)for(let e=Math.floor(i/r);e<=Math.floor(o/r);e++){const s=`${a},${e}`,i=c.get(s);i?i.push(t):c.set(s,[t])}}const d=[];for(const[t,o]of a){const a=Math.floor(o[0]/r),l=Math.floor(o[1]/r);for(let r=-1;r<=1;r++)for(let c=-1;c<=1;c++)for(const[p,u]of h.get(`${a+r},${l+c}`)||[]){if(t>=p)continue;const a=Ir(o,u);a<=Mr||a{const i=a[(s+1)%a.length];return t+(e[0]*i[1]-i[0]*e[1])},0))/2,r=(s||1)/i,l=n*r*r;return l0&&o.push(...e.slice(0,i))}return o}async function qr(t,e,s){t._saveConfigDebounced.pending()&&t._saveConfigDebounced.flush(),await t._writeChain;const i=await t.hass.callWS({type:"houseplan/plan/optimize",config:e,layout:s,expected_config_rev:t._cfgRev,expected_layout_rev:t._layoutRev});t._adoption.acceptPairWrite(e,s,i),t._geometryHistory.clear(),t._cancelDeviceDrag(),t._devicePositionHistory.clear(),t._canOptimizeUndo=!0===i.can_undo,t._undoKind=!0===i.can_undo?"optimize":null,t._dirtyPos.clear(),t._sentPos.clear(),t._cfgEpoch++,t._modelCache=null,t._frame=null,t._regSignature="",t._maybeRebuildDevices(),t._cacheSnapshot(),t.requestUpdate()}const Ur=1e-6*O,Kr=6*O;function Vr(t){return Number.isFinite(t)?Math.round(t/O)*O:t}const Jr=(t,e,s,i)=>Math.hypot(s-t,i-e),Yr=(t,e,s,i,o,a,n,r)=>Math.hypot(Math.max(Math.abs(o-t),Math.abs(o+n-(t+s))),Math.max(Math.abs(a-e),Math.abs(a+r-(e+i)))),Xr=(t,e,s,i,o,a,n)=>{const r=Math.max(Number(i)||0,0)/2,l=Math.PI/180,h=Math.cos(s*l)*r,c=Math.sin(s*l)*r,d=Math.cos(n*l)*r,p=Math.sin(n*l)*r,u=Math.max(Jr(t+h,e+c,o+d,a+p),Jr(t-h,e-c,o-d,a-p)),_=Math.max(Jr(t+h,e+c,o-d,a-p),Jr(t-h,e-c,o+d,a+p));return Math.min(u,_)},Zr=t=>{const e=Number(t?.cell_cm);return e>0?e:5};function Qr(t,e){const s=JSON.parse(JSON.stringify(t||[])),i=JSON.parse(JSON.stringify(e||{}));let o=0,a=0,n=0,r=0,l="",h=0,c=0;const d=(t,e)=>{Number.isFinite(t)&&Number.isFinite(e)&&t!==e&&Math.abs(e-t)<=Ur&&c++},p=(t,e)=>{d(t[0],e[0]),d(t[1],e[1])},u={};let _=5;for(const t of s){const e=Zr(t);null!=t?.id&&(u[String(t.id)]=e),e>_&&(_=e)}const m=(t,e,s,i=!1)=>{if(!(t>Ur||i))return;o++,t>n&&(n=t);const a=t*ht*e;a>r&&(r=a,l=s)};for(const t of s){const e=Zr(t),s=null!=t?.id?String(t.id):"";for(const i of t.rooms||[]){a++;let t=0;if(i.poly?.length)i.poly=i.poly.map(e=>{const s=[Vr(e[0]),Vr(e[1])];return t=Math.max(t,Jr(e[0],e[1],s[0],s[1])),p(e,s),s});else if(null!=i.x&&null!=i.y){const e=i.x,s=i.y,o=i.w||0,a=i.h||0,n=Vr(e+o),r=Vr(s+a),l=Vr(e),h=Vr(s),c=Math.max(O,n-l),p=Math.max(O,r-h);t=Yr(e,s,o,a,l,h,c,p),i.x=l,i.y=h,i.w=c,i.h=p,d(e,l),d(s,h),d(e+o,l+c),d(s+a,h+p)}m(t,e,s)}for(const i of t.partitions||[]){a++;const o=[i.a[0],i.a[1]],n=[i.b[0],i.b[1]],r=[Vr(o[0]),Vr(o[1])],l=[Vr(n[0]),Vr(n[1])];let h=Math.max(Jr(o[0],o[1],r[0],r[1]),Jr(n[0],n[1],l[0],l[1]));const c=Jr(r[0],r[1],l[0],l[1]),d=(t.openings||[]).filter(t=>"partition"===t.host?.kind&&t.host.id===i.id).every(t=>{const e=Number(t.length),s=Number(t.host.t),i=s*c;return Number.isFinite(e)&&e>0&&Number.isFinite(s)&&s>=0&&s<=1&&i-e/2>=-Ur&&i+e/2<=c+Ur});c>Ur&&d?(i.a=r,i.b=l,p(o,r),p(n,l)):h=0,m(h,e,s)}for(const i of t.wall_columns||[]){a++;const t=[i.center[0],i.center[1]],o=[Vr(t[0]),Vr(t[1])],n=Jr(t[0],t[1],o[0],o[1]);i.center=o,p(t,o),m(n,e,s)}for(const i of t.decor||[]){if("furniture"===i.kind||"image"===i.kind)continue;a++;let t=0;if("line"===i.kind){const e=[i.x1,i.y1],s=[i.x2,i.y2],o=[Vr(e[0]),Vr(e[1])],a=[Vr(s[0]),Vr(s[1])];t=Math.max(Jr(e[0],e[1],o[0],o[1]),Jr(s[0],s[1],a[0],a[1])),i.x1=o[0],i.y1=o[1],i.x2=a[0],i.y2=a[1],p(e,o),p(s,a)}else{const e=i.x,s=i.y,o=i.w,a=i.h,n=Vr(e),r=Vr(s);if(null!=i.w&&null!=i.h){const l=Vr(e+o),h=Vr(s+a),c=Math.max(O,l-n),p=Math.max(O,h-r);t=Yr(e,s,o,a,n,r,c,p),i.w=c,i.h=p,d(e+o,n+c),d(s+a,r+p)}else t=Jr(e,s,n,r);i.x=n,i.y=r,d(e,n),d(s,r)}m(t,e,s)}for(const i of t.openings||[]){if(a++,"partition"===i.host?.kind){const o=(t.partitions||[]).find(t=>t.id===i.host.id),a=Number(i.host.t);if(!o||!Number.isFinite(a)||a<0||a>1)continue;const n=o.b[0]-o.a[0],r=o.b[1]-o.a[1];if(Math.hypot(n,r)<=Ur)continue;const l=o.a[0]+n*a,c=o.a[1]+r*a;let d=180*Math.atan2(r,n)/Math.PI;d>=90?d-=180:d<-90&&(d+=180);const p=Number(i.angle),u=!(Number.isFinite(p)&&p===d),_=Xr(i.x,i.y,Number.isFinite(p)?p:d,Number(i.length)||0,l,c,d);i.x=l,i.y=c,i.angle=d,u&&h++,m(_,e,s,u);continue}const o=lt([i.x,i.y],t.rooms||[],Kr,{step:O,length:Number(i.length)||0});if(!o)continue;const n=Number(i.angle),r=!(Number.isFinite(n)&&n===o.angle),l=Xr(i.x,i.y,Number.isFinite(n)?n:o.angle,Number(i.length)||0,o.x,o.y,o.angle);i.x=o.x,i.y=o.y,i.angle=o.angle,r&&h++,m(l,e,s,r)}}for(const[t,e]of Object.entries(i)){if(!e||"object"!=typeof e)continue;const s=e;if("number"!=typeof s.x||"number"!=typeof s.y)continue;a++;const o=Vr(s.x),n=Vr(s.y),r=Jr(s.x,s.y,o,n);i[t]={...s,x:o,y:n},d(s.x,o),d(s.y,n);const l="string"==typeof s.s?s.s:"";m(r,u[l]??_,l)}return{spaces:s,layout:i,report:{moved:o,coordsCanonicalized:c,total:a,maxShift:n,maxShiftCm:r,maxSpace:l,rotated:h},changed:o>0||c>0}}function tl(t,e){const s=e.base+t*e.span;return Math.min(1,Math.max(0,s))}const el=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1]),sl=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1]);function il(t,e,s){const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o;if(a<=0)return sl(t,e);let n=((t[0]-e[0])*i+(t[1]-e[1])*o)/a;return n=Math.max(0,Math.min(1,n)),Math.hypot(t[0]-(e[0]+i*n),t[1]-(e[1]+o*n))}function ol(t,e,s,i,o){for(const i of e)if(i&&!s.has(i.id)&&el(i.a)&&el(i.b)&&(sl(t,i.a)<=o||sl(t,i.b)<=o))return!0;for(const e of i?.roomPolygons||[])for(let s=0;s0&&r>0))return null;if(Math.abs(o[0]/n*(a[1]/r)-o[1]/n*(a[0]/r))>s)return null;for(const[s,o]of[[t.a,e.a],[t.a,e.b],[t.b,e.a],[t.b,e.b]])if(sl(s,o)<=i)return[(s[0]+o[0])/2,(s[1]+o[1])/2];return null}function nl(t,e){const s=.05*(Number(e.pitch)>0?Number(e.pitch):1),i=new Map;let o=(t||[]).filter(t=>!!t&&"string"==typeof t.id&&el(t.a)&&el(t.b));if(o.length<2)return{partitions:[...t||[]],merged:0,openingMoves:[]};const a=e.seedIds&&e.seedIds.length?new Set(e.seedIds):null;let n=0;for(let t=0;tsl(e,t.at)>s);let c=h[0]??r.a,d=h[h.length-1]??l.b;if(h.length<2&&(c=r.a,d=l.b),d[0]0?(d[0]-c[0])/u:0,m=u>0?(d[1]-c[1])/u:0,g=t=>u>0?((t[0]-c[0])*_+(t[1]-c[1])*m)/u:0;for(const t of[r,l]){const e=g(t.a),s=g(t.b)-e;for(const[o,a]of i)a.toId===t.id&&i.set(o,{fromId:a.fromId,toId:p.id,base:e+a.base*s,span:a.span*s});i.set(t.id,{fromId:t.id,toId:p.id,base:e,span:s})}a&&a.add(p.id),o=o.filter((e,s)=>s!==t.i&&s!==t.j),o.splice(t.i,0,p),n++}return{partitions:o,merged:n,openingMoves:[...i.values()]}}function rl(t,e,s,i){if(!t?.length||!s.length)return 0;const o=new Map(s.map(t=>[t.fromId,t]));let a=0;for(const s of t){const t=s?.host;if(!t||"partition"!==t.kind)continue;const n=o.get(t.id);if(!n)continue;s.host={...t,id:n.toId,t:tl(t.t,n)},a++;const r=ct(s,e,i.coordScale,i.cellCm,i.gridPitch).resolved;r&&Object.assign(s,dt(s,r,i.coordScale))}return a}function ll(t){return{roomPolygons:(t?.rooms||[]).map(t=>B(t)).filter(t=>!!t),columns:t?.wall_columns||[]}}const hl=t=>!!t&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1]),cl=(t,e)=>t[0]-e[0]||t[1]-e[1],dl=(t,e,s,i)=>[t[0]+e*i,t[1]+s*i],pl=(t,e,s,i)=>(t[0]-e[0])*s+(t[1]-e[1])*i,ul=(t,e,s,i,o)=>{const a=e[0]-t[0],n=e[1]-t[1],r=Math.hypot(a,n);if(!(r>o))return null;const l=a/r,h=n/r,c=e=>Math.abs((e[0]-t[0])*h-(e[1]-t[1])*l);if(c(s)>o||c(i)>o)return null;const d=pl(s,t,l,h),p=pl(i,t,l,h),u=Math.max(0,Math.min(d,p)),_=Math.min(r,Math.max(d,p));return _-u>o?{lo:u,hi:_}:null},_l=(t,e,s)=>Math.min(t.hi,e.hi)-Math.max(t.lo,e.lo)>s,ml=t=>{const e=new Set(["id","a","b","cm"]);return Object.keys(t||{}).every(t=>e.has(t))},gl=(t,e,s,i)=>{const o=t.b[0]-t.a[0],a=t.b[1]-t.a[1],n=Math.hypot(o,a);if(!(n>i))return!0;const r=o/n,l=a/n,h=$(t.cm,s.cellCm,s.gridPitch)/2;return e.some(e=>{const o=e?.center;if(!hl(o))return!0;const a=pl(o,t.a,r,l),c=Math.abs((o[0]-t.a[0])*l-(o[1]-t.a[1])*r),d=$(Number(e.cm),s.cellCm,s.gridPitch)*("square"===e.shape?Math.SQRT1_2:.5);return!(Number.isFinite(d)&&d>0)||a>=-d-i&&a<=n+d+i&&c<=h+d+i})},fl=(t,e,s)=>{if(t.host){const i=ct(t,e,s.coordScale,s.cellCm,s.gridPitch).resolved;return i?{center:i.center,angle:i.angle,length:i.length}:null}const i=Number(t.x)*s.coordScale,o=Number(t.y)*s.coordScale,a=Number(t.angle),n=Number(t.length)*s.coordScale;return[i,o,a,n].every(Number.isFinite)&&n>0?{center:[i,o],angle:a,length:n}:null},bl=(t,e,s)=>{const i=t.angle*Math.PI/180,o=Math.cos(i),a=Math.sin(i),n=e.angle*Math.PI/180,r=Math.cos(n),l=Math.sin(n);if(Math.abs(o*l-a*r)>1e-6)return!1;const h=e.center[0]-t.center[0],c=e.center[1]-t.center[1];if(Math.abs(h*a-c*o)>s)return!1;const d=h*o+c*a;return Math.max(-t.length/2,d-e.length/2)({...t,a:[t.a[0]*e,t.a[1]*e],b:[t.b[0]*e,t.b[1]*e]}),yl=(t,e,s,i)=>{const o=`~r-${(t=>{let e=2166136261;for(let s=0;s>>0;return e.toString(36)})(`${t}|${e[0].toFixed(9)},${e[1].toFixed(9)}|${s[0].toFixed(9)},${s[1].toFixed(9)}`)}`,a=`${t.slice(0,Math.max(1,64-o.length))}${o}`;let n=a;for(let t=2;i.has(n);t++){const e=`-${t}`;n=`${a.slice(0,64-e.length)}${e}`}return i.add(n),n},$l=(t,e)=>{const s=[];for(const i of t){const t=s[s.length-1];!(t&&Math.abs(t.hi-i.lo)<=e&&t.safe===i.safe)||i.safe&&t.signature!==i.signature?s.push({lo:i.lo,hi:i.hi,a:i.a,b:i.b,safe:i.safe,signature:i.signature,roomIds:i.roomIds,finalCm:i.finalCm}):(t.hi=i.hi,t.b=i.b)}return s};function wl(t,e,s,i,o){const a=s||[],n=Array.isArray(t?.partitions)?t.partitions:[],r=Array.isArray(t?.openings)?t.openings:[],l={walls:a,partitions:n,openings:r,partitionsReconciled:0,openingsRehosted:0};if(!n.length)return l;const h=Math.max(2e-4*o.gridPitch,1e-9);let c=a,d=n,p=r,u=0,_=0;const m=o.partitionIds?new Set(o.partitionIds):null,g=new Map(e.partitions.map(t=>[t.id,t]));for(const t of[...n].sort((t,e)=>t.id.localeCompare(e.id))){if(m&&!m.has(t.id))continue;if(!d.some(e=>e.id===t.id))continue;if(!ml(t))continue;const s=g.get(t.id);if(!(s&&hl(s.a)&&hl(s.b)&&Number.isFinite(s.cm)&&(o.allowCoincidentPartitions?!(s.cm<0):s.cm>0)))continue;const[a,n]=cl(s.a,s.b)<=0?[[s.a[0],s.a[1]],[s.b[0],s.b[1]]]:[[s.b[0],s.b[1]],[s.a[0],s.a[1]]],r=n[0]-a[0],l=n[1]-a[1],f=Math.hypot(r,l);if(!(f>h))continue;const b=r/f,v=l/f,y=pt(e.rooms,c,i,o.pitch,o.cellCm,o.gridPitch,o.coordScale),$=y.flatMap(t=>{if(t.open||"outer"!==t.kind&&"shared"!==t.kind)return[];const e=ul(a,n,t.a,t.b,h);return e?[{interval:t,range:e}]:[]});if(!$.length)continue;const w=p.filter(t=>"partition"===t.host?.kind&&t.host.id===s.id).map(t=>({opening:t,resolved:ct(t,e.partitions,o.coordScale,o.cellCm,o.gridPitch).resolved}));if(w.some(t=>!t.resolved))continue;const k=[0,f];for(const{range:t}of $)k.push(t.lo,t.hi);const x=k.slice(),S=new Map;for(const{opening:t,resolved:e}of w){const s=pl(e.center,a,b,v),i={lo:s-e.length/2,hi:s+e.length/2};S.set(t.id,i),x.push(Math.max(0,i.lo),Math.min(f,i.hi))}const M=[...new Set(x.filter(t=>Number.isFinite(t)&&t>=-h&&t<=f+h).map(t=>Math.max(0,Math.min(f,t)).toFixed(9)))].map(Number).sort((t,e)=>t-e),C=d.map(t=>vl(t,o.coordScale)).filter(t=>t.id!==s.id),P=[];for(let t=0;t+1h))continue;const r=dl(a,b,v,i),l=dl(a,b,v,n),c=$.filter(({range:t})=>t.lo<=i+h&&t.hi>=n-h).map(({interval:t})=>t),d=new Map;for(const t of c)d.set(t.roomId,t);const p=[...d.values()],u=new Set(p.map(t=>t.kind)),_=new Set(p.map(t=>o.allowCoincidentPartitions||t.cm>0?t.cm:ut)),m=p[0]?.kind,g=[...d.keys()].sort(),f=1===u.size&&1===_.size&&("outer"===m&&1===g.length||"shared"===m&&2===g.length),y={id:s.id,a:r,b:l,cm:s.cm},w=C.some(t=>!!ul(r,l,t.a,t.b,h)),k=f&&(o.allowCoincidentPartitions||!w)&&!gl(y,e.wall_columns,o,h),x=f?o.allowCoincidentPartitions||p[0].cm>0?p[0].cm:ut:0,S=f?Math.max(x,s.cm):s.cm;P.push({lo:i,hi:n,a:r,b:l,safe:k,signature:k?`${m}|${g.join(",")}|${S}`:"",roomIds:g,roomCm:x,finalCm:S})}if(!P.some(t=>t.safe))continue;const D=new Map;for(const{opening:t,resolved:e}of w){const i=S.get(t.id),a=k.some(t=>t>i.lo+h&&t_l(t,i,h)),r=new Set(n.filter(t=>t.safe).map(t=>t.signature));if(!a&&n.length>0&&n.every(t=>t.safe)&&1===r.size&&_t(e,y,h)){D.set(t.id,{resolved:e,signature:[...r][0]});continue}const l=mt(s,o.cellCm,o.gridPitch),c={lo:i.lo-l,hi:i.hi+l};for(const t of P)_l(t,c,h)&&(t.safe=!1,t.signature="")}let I=!0;for(;I;){I=!1;for(const[t,e]of[...D.entries()]){const i=S.get(t),a=P.filter(t=>_l(t,i,h));if(a.length>0&&a.every(t=>t.safe)&&a.every(t=>t.signature===e.signature))continue;D.delete(t);const n=mt(s,o.cellCm,o.gridPitch),r={lo:i.lo-n,hi:i.hi+n};for(const t of P)_l(t,r,h)&&(t.safe=!1,t.signature="");I=!0}}const T=$l(P,h),z=T.filter(t=>t.safe),R=T.filter(t=>!t.safe);if(!z.length)continue;if(d.length-1+R.length>2e3)continue;let A=c;for(const t of z){const[e,i]=cl(s.a,s.b)<=0?[t.a,t.b]:[t.b,t.a];A=gt(A,e,i,t.finalCm,o.pitch,o.coordScale)}if(A=ft(e.rooms,A,i,o.pitch,o.cellCm,o.gridPitch,o.coordScale),A.length>500)continue;const F=new Set(d.map(t=>t.id));F.delete(s.id);const N=R.map((t,e)=>{const i=[t.a[0]/o.coordScale,t.a[1]/o.coordScale],a=[t.b[0]/o.coordScale,t.b[1]/o.coordScale],n=0===e?s.id:yl(s.id,i,a,F);return F.add(n),{id:n,a:i,b:a,cm:s.cm}}),E=d.findIndex(t=>t.id===s.id),H=d.slice();H.splice(E,1,...N);const O=H.map(t=>vl(t,o.coordScale)),L=new Map;let B=!0;for(const{opening:t,resolved:e}of w){const s=D.get(t.id);if(s){const e=dt(t,s.resolved,o.coordScale),{host:i,...a}=e;L.set(t.id,a);continue}const i=S.get(t.id),a=N[R.findIndex(t=>t.lo<=i.lo+h&&t.hi>=i.hi-h)],n=a&&O.find(t=>t.id===a.id);if(!a||!n){B=!1;break}const r=n.b[0]-n.a[0],l=n.b[1]-n.a[1],c=Math.hypot(r,l),d=pl(e.center,n.a,r/c,l/c),p={...dt(t,e,o.coordScale),host:{kind:"partition",id:a.id,t:d/c}};if(!bt(p,O,o.coordScale,o.cellCm,o.gridPitch).resolved){B=!1;break}L.set(t.id,p)}if(!B)continue;const W=p.map(t=>L.get(t.id)||t),j=[...D.keys()].map(t=>L.get(t)),G=j.map(t=>fl(t,O,o));if(G.some(t=>!t))continue;let q=!1;for(let t=0;tt.id));for(const t of W){if(U.has(t.id))continue;const e=fl(t,O,o);e&&G.some(t=>bl(t,e,h))&&(q=!0)}if(q)continue;const K=vt(e.rooms,A,i,o.pitch,o.cellCm,o.gridPitch,o.coordScale);[...D.entries()].every(([t,e])=>{const s=L.get(t),i=yt(K,{x:s.x*o.coordScale,y:s.y*o.coordScale,angle:s.angle,length:s.length*o.coordScale},!0),a=[i.negative,i.positive].filter(t=>!!t?.full),n=e.signature.split("|")[1].split(","),r=new Set(a.map(t=>t.roomId));return a.length===n.length&&r.size===n.length&&n.every(t=>r.has(t))})&&(c=A,d=H,p=W,u+=z.length,_+=D.size)}return{walls:c,partitions:d,openings:p,partitionsReconciled:u,openingsRehosted:_}}const kl=t=>JSON.parse(JSON.stringify(t)),xl=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Sl=(t,e)=>e.length>0&&e.length<=35&&("space"===t?/^[a-z0-9_-]+$/.test(e):/^[A-Za-z0-9_-]+$/.test(e));function Ml(t,e){let s=String(e??"");const i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`^${i}_(.+)_([0-9a-f]{8})$`);let a=0;for(;a<16;a++){const t=o.exec(s);if(!t)return{root:s,layers:a,bounded:!1};s=t[1]}return{root:s,layers:a,bounded:o.test(s)}}const Cl=(t,e,s)=>{const i=t.get(e)||[];i.push(s),t.set(e,i)};const Pl=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Dl=(t,e,s)=>Math.min(s,Math.max(e,t)),Il=t=>At({spaces:[t]})[0],Tl=(t,e,s)=>{const i=s>0?s:1,o=t=>`${(t[0]/i).toFixed(12)},${(t[1]/i).toFixed(12)}`,a=o(t),n=o(e);return a0?n:1,l=Math.max(i*r*.02,1e-9),h=[];for(const e of t||[])for(const t of B(e)||[])h.push([t[0],t[1]]);const c=[];for(const t of s||[])Array.isArray(t)&&t.length>=4&&t.slice(0,4).every(Number.isFinite)&&c.push([t[0],t[1]],[t[2],t[3]]);const d=(t,e)=>e.some(e=>Math.hypot(t[0]-e[0],t[1]-e[1])<=2*l),p=new Map;for(const n of t||[]){if(!n?.id)continue;const u=et(t,n.id,e,s,i,o,a,r);if(u)for(let t=0;t0&&_>0&&n===m&&_!==n))continue;const g=u.poly[i],f=u.poly[(i+1)%u.poly.length],b=Math.hypot(f[0]-g[0],f[1]-g[1]);if(!(b>l&&b<.5*a-1e-9*a))continue;if(d(g,c)||d(f,c))continue;if(d(g,h)&&d(f,h))continue;const v=Tl(g,f,r),y=p.get(v);y?y.targets.add(n):p.set(v,{a:[g[0],g[1]],b:[f[0],f[1]],targets:new Set([n])})}}}let u=e.slice();const _=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1])<=2*l,m=(t,e)=>{if(!Array.isArray(t.a)||!Array.isArray(t.b)||t.a.length<2||t.b.length<2)return!1;const s=[Number(t.a[0])*r,Number(t.a[1])*r],i=[Number(t.b[0])*r,Number(t.b[1])*r];return!![...s,...i].every(Number.isFinite)&&(_(s,e.a)&&_(i,e.b)||_(s,e.b)&&_(i,e.a))};for(const t of[...p.values()].filter(t=>1===t.targets.size).sort((t,e)=>Tl(t.a,t.b,r).localeCompare(Tl(e.a,e.b,r)))){const e=[...t.targets][0],s=u.filter(e=>m(e,t));if(new Set(s.map(t=>t.cm)).size>1)continue;let o=!1;u=u.map(s=>m(s,t)?(o=!0,s.cm===e?s:{...s,cm:e}):s),o||(u=gt(u,t.a,t.b,e,i,r))}return u}const Rl=t=>{const e=[];for(const s of t||[]){const t=B(s);if(t?.length)for(let s=0;s"string"==typeof t?.id?t.id:"").filter(Boolean),c=new Set(h),d=new Map;for(const t of h){const e=Ml("space",t);e.layers>0&&Sl("space",e.root)&&Cl(d,e.root,t)}const p=new Map,u=new Map,_=new Map,m=new Map;for(const t of r){const e="string"==typeof t?.id?t.id:"";if(!e)continue;const s=new Map;for(const i of Array.isArray(t.rooms)?t.rooms:[]){const t="string"==typeof i?.id?i.id:"";if(!t)continue;const o=Ml("room",t);o.layers>0&&Sl("room",o.root)&&Cl(s,o.root,t),u.has(t)||u.set(t,e),_.has(t)||_.set(t,String(i.name||""));const a="string"==typeof i.area?i.area:"";if(a){const s=m.get(a)||[];s.push({spaceId:e,roomId:t}),m.set(a,s)}}p.set(e,s)}const g=new Set(u.keys()),f=new Map,b=new Map;for(const t of l)"string"==typeof t?.id&&t.id&&(!0===t.removed?b.set(t.id,t):f.set(t.id,t));const v={spaceRefsRemapped:0,roomRefsRemapped:0,positionsRemapped:0,markersDetached:0,positionsUnresolved:0,nestedRefsUnresolved:0,deadSpaceIds:[],orphanRoomLabelsRemoved:0,orphanDevicePositionsRemoved:0,orphanGroupPositionsRemoved:0,liveMissingPositionsRemoved:0,removedPositions:[],liveMissingPositions:[],unverifiedPositions:[]},y=new Set,$=t=>c.has(t)?null:(()=>{const e=Ml("space",t).root;if(!Sl("space",e))return null;const s=d.get(e)||[];return 1===s.length?s[0]:null})(),w=(t,e)=>{const s=Ml("room",t).root;if(!Sl("room",s))return null;const i=p.get(e)?.get(s)||[];return 1===i.length?i[0]:null},k=t=>{const e=s.effectiveAreaByMarker?.[t]||"",i=e&&m.get(e)||[];return 1===i.length?i[0]:null},x=(t,e,s)=>{if("string"==typeof t.room_id&&t.room_id&&!g.has(t.room_id)){const i=e?w(t.room_id,e):null;i?(t.room_id=i,v.roomRefsRemapped++):s?(t.room_id=s.roomId,v.roomRefsRemapped++):!0!==t.removed&&delete t.room_id}const i=t.vacuum?.segment_map;if(i&&"object"==typeof i&&!Array.isArray(i))for(const t of Object.keys(i)){const s=i[t];if("string"!=typeof s||!s||g.has(s))continue;const o=e?w(s,e):null;o?(i[t]=o,v.roomRefsRemapped++):v.nestedRefsUnresolved++}};for(const t of l){const e="string"==typeof t?.id?t.id:"";if(!e)continue;const s="string"==typeof t.space?t.space:"",i=s&&!c.has(s),a=o[e],n="string"==typeof a?.s?a.s:"",r=n&&!c.has(n),l=!0===t.removed;let h=s&&c.has(s)?s:null,d=null,p=!1;if(i){const i=$(s);i?(t.space=i,h=i,p=!0,v.spaceRefsRemapped++):l||"virtual"===t.binding?l||(delete t.space,h=null,v.markersDetached++):(d=k(e),d?(t.space=d.spaceId,h=d.spaceId,v.spaceRefsRemapped++):(delete t.space,h=null,v.markersDetached++))}l&&!p||x(t,h,d),r&&p&&n===s&&h&&(o[e]={...a,s:h},v.positionsRemapped++,y.add(e))}for(const t of Object.keys(o)){if(y.has(t))continue;const e=o[t],s="string"==typeof e?.s?e.s:"";if(!s||c.has(s))continue;const i=$(s);if(i){if(t.startsWith("rl_")){const s=t.slice(3),a=w(s,i);if(a){const s=`rl_${a}`;xl(o,s)||(o[s]={...e,s:i}),delete o[t],v.roomRefsRemapped++,v.positionsRemapped++;continue}}o[t]={...e,s:i},v.positionsRemapped++}}const S=s.ownerRoster,M=!0===S?.authoritative,C=new Set(S?.deviceIds||[]),P=new Set(S?.entityIds||[]),D=new Set(Array.isArray(i.settings?.known_devices)?i.settings.known_devices.filter(t=>"string"==typeof t):[]),I=(t,e="")=>{const s=String(S?.names?.[t]||e||"").trim();return s&&s!==t?s:""},T=(t,e,s,i="",o)=>({id:t,spaceId:e,kind:s,name:I(t,i),...o?{reason:o}:{}}),z=t=>{"room_label"===t?v.orphanRoomLabelsRemoved++:"group"===t?v.orphanGroupPositionsRemoved++:v.orphanDevicePositionsRemoved++},R=new Set;for(const[t,e]of Object.entries(o)){const i="string"==typeof e?.s?e.s:"";if(!i||c.has(i))continue;let a,n;const r=f.get(t),l=b.get(t);if(r)a=T(t,i,"device",String(r.name||"")),n="live";else if(l)a=T(t,i,"device",String(l.name||"")),n="absent";else if(t.startsWith("rl_")){const e=t.slice(3);a=T(t,i,"room_label",_.get(e)||""),n=g.has(e)?"live":"absent"}else if(t.startsWith("lg_")){const e=t.slice(3);a=T(t,i,"group"),n=P.has(e)?"live":M?"absent":"unverified","unverified"===n&&(a.reason="registry_unavailable")}else C.has(t)?(a=T(t,i,"device"),n="live"):D.has(t)?(a=T(t,i,"device"),n=M?"absent":"unverified","unverified"===n&&(a.reason="registry_unavailable")):(a=T(t,i,"unknown","","unknown_owner"),n="unverified");if("absent"!==n){if("live"===n){if(v.liveMissingPositions.push(a),!0===s.removeLiveMissingPositions){delete o[t],v.liveMissingPositionsRemoved++,z(a.kind),v.removedPositions.push(a);continue}}else v.unverifiedPositions.push(a);v.positionsUnresolved++,R.add(i)}else delete o[t],z(a.kind),v.removedPositions.push(a)}return v.deadSpaceIds=[...R].sort((t,e)=>t.localeCompare(e)),{config:i,layout:o,report:v,changed:JSON.stringify(i)!==a||JSON.stringify(o)!==n}}(t,e,s),n=a.config,r=$t(n,a.layout);L(n),wt(a.layout);const l=JSON.stringify(t||{}),h=JSON.stringify(e||{}),c=Number.isInteger(Number(n.model_version))?Number(n.model_version):0,d=(t=>{let e=0,s=0,i=0;for(const s of t.markers||[]){if("ripple"===s.display&&(s.display="icon_ripple",e++),Array.isArray(s.controls)){const t="string"==typeof s.binding&&s.binding.startsWith("entity:")?s.binding.slice(7):"",i=t?s.controls.filter(e=>e!==t):s.controls;JSON.stringify(i)!==JSON.stringify(s.controls)&&(s.controls=i.length?i:null,e++)}const t=s.vacuum;t&&Pl(t,"trail")&&(["never","cleaning","always"].includes(t.trail_mode)||(t.trail_mode=!1===t.trail?"never":"cleaning"),delete t.trail,e++)}for(const o of t.spaces||[]){const t=o.settings;"glow"===t?.fill_mode&&("boolean"!=typeof t.glow_enabled&&(t.glow_enabled=!0),t.fill_mode="none",e++,s++);for(const t of o.rooms||[]){const s=t.settings;"glow"===s?.fill_mode&&("boolean"!=typeof s.glow&&(s.glow=!0),delete s.fill_mode,e++,i++)}if(Pl(o,"segments")&&(delete o.segments,e++),Pl(o,"plan_scale")){const t=Number(o.plan_scale);Number.isFinite(t)&&t>=Pt&&t<=Dt&&(Pl(o,"plan_scale_x")||(o.plan_scale_x=t),Pl(o,"plan_scale_y")||(o.plan_scale_y=t),delete o.plan_scale,e++)}const a=Number(o.cell_cm);Pl(o,"cell_cm")&&(!Number.isFinite(a)||a<.1||a>1e3)&&(o.cell_cm=Number.isFinite(a)&&a>0?Dl(a,.1,1e3):5,e++);const n=Number(o.cell_cm),r=Number.isFinite(n)&&n>0?n:5;for(const t of o.wall_columns||[])if("circle"===t.shape)Pl(t,"angle")&&(delete t.angle,e++);else if("square"===t.shape&&Pl(t,"angle")){const s=((Number(t.angle)||0)%90+90)%90;t.angle!==s&&(t.angle=s,e++)}for(const t of o.decor||[]){if(Pl(t,"width")){const s=Number(t.width);(Pl(t,"width_cm")||Number.isFinite(s))&&(Pl(t,"width_cm")||(t.width_cm=Number(Dl(s/Mt*r,.1,100).toFixed(6))),delete t.width,e++)}if("rect"!==t?.kind&&"ellipse"!==t?.kind||!0!==t.fill||(Pl(t,"fill_color")||(t.fill_color=t.color||"#607d8b",e++),Pl(t,"fill_opacity")||(t.fill_opacity=.25,e++)),"text"!==t?.kind)continue;void 0===t.size_cm?(t.size_cm=Number(Dl(It*Tt(t)/Mt*r,.1,2e3).toFixed(6)),delete t.scale,delete t.size,e++):(Pl(t,"scale")||Pl(t,"size"))&&(delete t.scale,delete t.size,e++);let s=String(t.text??"");const i=[...s.matchAll(/\{([^{}\r\n]+)\}/g)].some(t=>!!zt(t[1]));if(!(Pl(t,"entity")||Pl(t,"attr")||Pl(t,"unit")))continue;const o=String(t.unit??"").trim(),a="state"===String(t.attr??"").trim().toLowerCase()?null:t.attr,n=i||o?"":Rt(t.entity,a);if(i||n){if(n){const e=s.indexOf("{}");s=e>=0?s.slice(0,e)+n+s.slice(e+2):`${s}${s?" ":""}${n}`,t.text=s}delete t.entity,delete t.attr,delete t.unit,e++}}}return{total:e,glowSpaces:s,glowRooms:i}})(n);let p=d.total,u=0,_=0,g=0;if(c<10)for(const t of Array.isArray(n.spaces)?n.spaces:[]){const e=qn(t);_+=e.drafts,g+=e.segments}const f=(b=n.spaces||[],JSON.parse(JSON.stringify(b)));var b;const v=Qr(n.spaces||[],a.layout);let y=0,$=0,w=0,k="";const x=v.spaces.map(t=>{const e=kt(t);y+=e.report.wallsStraightened,$+=e.report.wallsStraightenSkipped;const s=Number(t?.cell_cm)>0?Number(t.cell_cm):5,i=e.report.maxStraightenShift/O*s;return i>w&&(w=i,k=String(t?.id||"")),e.space}),S=y?Qr(x,v.layout):{...v,spaces:x};n.spaces=S.spaces;const M=y?{...v.report,moved:v.report.moved+S.report.moved,coordsCanonicalized:v.report.coordsCanonicalized+S.report.coordsCanonicalized,maxShift:Math.max(v.report.maxShift,S.report.maxShift),maxShiftCm:Math.max(v.report.maxShiftCm,S.report.maxShiftCm),maxSpace:S.report.maxShiftCm>v.report.maxShiftCm?S.report.maxSpace:v.report.maxSpace,rotated:v.report.rotated+S.report.rotated}:{...v.report};let C=0,P=0,D=0,I=0,T=0,z=0,R=0;for(let t=0;t0===Number(t.cm)),walls:e.walls||[]}),a=Il(e),r=Il(s);if(!a||!r)continue;const l=Rl(a.rooms),h=Rl(r.rooms),c=.02*Mt,d=(e.wall_segments||[]).filter(t=>0===Number(t.cm)).map(t=>({...t,key:W(t.a,t.b,O),cm:0})),p=new Set(d.map(t=>t.key)),u=xt(e,a.rooms,m,c);P+=u.length;for(const t of u){const e=[t[0]/m,t[1]/m],s=[t[2]/m,t[3]/m],i=W(e,s,O);p.has(i)||(p.add(i),d.push({key:i,a:e,b:s,cm:0}))}const _=d.length,g=St(d,l,h,O,m),b=(t,e,s)=>{const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o;if(!(a>0))return Math.hypot(t[0]-e[0],t[1]-e[1]);const n=Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a));return Math.hypot(t[0]-(e[0]+i*n),t[1]-(e[1]+o*n))},v=g.filter(t=>{if(!Array.isArray(t.a)||!Array.isArray(t.b))return!1;const e=t.a.map(t=>t*m),s=t.b.map(t=>t*m);return h.some(([t,i])=>b(e,t,i)<=4*c&&b(s,t,i)<=4*c)});D+=Math.max(0,_-v.length);const y=(s.wall_segments||[]).filter(t=>Number(t.cm)>0);s.wall_segments=[...y,...v.map(({key:t,...e})=>e)];const $=v.map(t=>[t.a[0]*m,t.a[1]*m,t.b[0]*m,t.b[1]*m]),w=Array.isArray(e.walls)?e.walls.length:0;let k=St(e.walls,l,h,O,m);k=zl(r.rooms,k,$,O,Number(s.cell_cm)>0?Number(s.cell_cm):5,Mt,m),k=ft(r.rooms,k,$,O,Number(s.cell_cm)>0?Number(s.cell_cm):5,Mt,m),k=Ct(k,s.rooms||[],O,1,$.map(t=>[t[0]/m,t[1]/m,t[2]/m,t[3]/m])),C+=Math.max(0,w-k.length),k.length?s.walls=k:delete s.walls;const x=nl(s.partitions||[],{pitch:O,geometry:ll(s)});x.merged&&(I+=x.merged,s.partitions=x.partitions,rl(s.openings,s.partitions,x.openingMoves,{coordScale:m,cellCm:Number(s.cell_cm)>0?Number(s.cell_cm):5,gridPitch:Mt}));const S=Il(s);if(S){const t=o(s,S,s.walls||[],$,{pitch:O,cellCm:Number(s.cell_cm)>0?Number(s.cell_cm):5,gridPitch:Mt,coordScale:m});t.partitionsReconciled&&(T+=t.partitionsReconciled,z+=t.openingsRehosted,t.partitions.length?s.partitions=t.partitions:delete s.partitions,t.openings.length?s.openings=t.openings:delete s.openings,t.walls.length?s.walls=t.walls:delete s.walls)}JSON.stringify({zero:(s.wall_segments||[]).filter(t=>0===Number(t.cm)),walls:s.walls||[]})!==i&&R++}if(c<=10){const t=function(t){const e=Kn(t);return Jn(t,e.config),{...e,config:t}}(n);u+=t.migratedSegments,_+=t.migratedDrafts,g+=t.migratedDraftSegments}const A=L(n),F=wt(S.layout),N=JSON.stringify(A)!==l||JSON.stringify(F)!==h;c<10&&N&&(A.model_version=10);const E=JSON.stringify(A)!==l||JSON.stringify(F)!==h,H=Number.isInteger(Number(A.model_version))?Number(A.model_version):c,B=E?M:{...M,moved:0,coordsCanonicalized:0,maxShift:0,maxShiftCm:0,maxSpace:"",rotated:0},j=E?a.report:{...a.report,spaceRefsRemapped:0,roomRefsRemapped:0,positionsRemapped:0,markersDetached:0,orphanRoomLabelsRemoved:0,orphanDevicePositionsRemoved:0,orphanGroupPositionsRemoved:0,liveMissingPositionsRemoved:0};return{config:A,layout:F,report:{...B,modelFrom:c,modelTo:H,migrated:E?p:0,glowSpacesMigrated:E?d.glowSpaces:0,glowRoomsMigrated:E?d.glowRooms:0,canonicalized:E?R:0,wallSegmentsMigrated:E?u:0,roomDraftsMigrated:E?_:0,roomDraftSegmentsMigrated:E?g:0,legacyZeroWallsMigrated:E?P:0,wallsMerged:E?C:0,spansMerged:E?D:0,partitionsMerged:E?I:0,partitionsReconciled:E?T:0,openingsRehosted:E?z:0,wallsStraightened:E?y:0,wallsStraightenSkipped:$,maxStraightenShiftCm:E?w:0,maxStraightenSpace:E?k:"",latticeCoordinatesCanonicalized:E?r.canonicalized:0,latticeCoordinatesFar:E?r.far:0,latticeMaxShift:E?r.maxShift:0,latticeMaxShiftCm:E?r.maxShiftCm:0,latticeSpaces:E?r.spaces:[],...j},changed:E}}const Fl=Object.freeze({spaces:50,partitions:2e3,openings:500,decor:1e3,columns:500});class Nl extends Error{constructor(t){super(t),this.code=t,this.name="SpaceCopyError"}}const El=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Hl=t=>void 0===t?t:JSON.parse(JSON.stringify(t)),Ol=t=>null===t||"object"!=typeof t||Array.isArray(t)?null:t;function Ll(t,e=!1){if(void 0===t&&!e)return[];if(!Array.isArray(t))throw new Nl("source_invalid");return t.map(t=>{const e=Ol(t);if(!e||"string"!=typeof e.id||!e.id)throw new Nl("source_invalid");return e})}const Bl=t=>Array.isArray(t)&&2===t.length&&t.every(t=>Number.isFinite(t));function Wl(t,e,s){const i=String(t??"").trim()||s,o=new Set(e.map(t=>{const e=Ol(t);return String(e?.title??"").trim()}));let a=2;for(;o.has(`${i} (${a})`);)a++;return`${i} (${a})`}const jl=["settings","zero_wall_style","cell_cm","view_box","plan_url","plan_aspect","plan_x","plan_y","plan_scale","plan_scale_x","plan_scale_y","plan_angle"];const Gl={source_missing:"space.copy_error_source_missing",source_invalid:"space.copy_error_source_invalid",spaces_limit:"space.copy_error_spaces_limit",partitions_limit:"space.copy_error_partitions_limit",openings_limit:"space.copy_error_openings_limit",decor_limit:"space.copy_error_decor_limit",columns_limit:"space.copy_error_columns_limit",opening_host_missing:"space.copy_error_opening_host",opening_host_unknown:"space.copy_error_opening_host",geometry_unsafe:"space.copy_error_geometry"};let ql=0;function Ul(t,e,s){const i=t._spaceDialog;return!(!i?.copy||i.copy.token!==e)&&(t._spaceDialog={...i,busy:s,copy:{...i.copy,busy:s}},!0)}function Kl(t){t._cfgEpoch++,t._modelCache=null,t._frame=null,t._regSignature="",t._maybeRebuildDevices(),t.requestUpdate()}async function Vl(t,e){const s=t._spaceDialog;if(!s?.copy||"edit"!==s.mode||s.busy||s.copy.busy||!s.copy.title.trim()||!s.spaceId||!t._serverCfg)return;const i=++ql,o=s.spaceId,a=s.copy.title.trim();t._spaceDialog={...s,busy:!0,copy:{...s.copy,title:a,busy:!0,token:i}};let n=!1;try{if(t._saveConfigDebounced.pending()&&t._saveConfigDebounced.flush(),await t._writeChain,!Ul(t,i,!0)||!t._serverCfg)return;const s=t._cfgRev,r=t._layoutRev,l=Ft(t._serverCfg),h=Ft(t._layout);let c;try{c=(e.optimize??Al)(t._serverCfg,t._layout,e.optimizeReferenceContext())}catch(s){return Ul(t,i,!1),void e.showWallModelMigrationBlocked(s)}if(c.changed){const d=t._checkOptimizeGeometry(c.config);if(e.reportPreflightFailure(d,c.config),!d.ok)return Ul(t,i,!1),void t._showToast(t._t("space.copy_error_optimize_geometry"));const p=await t._confirmDanger({key:`copy-space:${o}`,kind:"warning",title:t._t("space.copy_optimize_title"),message:t._t("space.copy_optimize_body",{name:a}),objectName:a,confirmLabel:t._t("space.copy_optimize_confirm"),cancelLabel:t._t("btn.cancel"),icon:"mdi:broom"});if(!Ul(t,i,p))return;if(!p)return;if(t._cfgRev!==s||t._layoutRev!==r||!t._serverCfg||Ft(t._serverCfg)!==l||Ft(t._layout)!==h)return Ul(t,i,!1),void t._showToast(t._t("space.copy_error_changed"));e.clearGeometryGesture(),await qr(t,c.config,c.layout),n=!0}if(!Ul(t,i,!0)||!t._serverCfg)return;const d=t._serverCfg,p=function(t,e,s,i){const o=t.spaces;if(!s.trim())throw new Nl("source_invalid");if(o.length>=Fl.spaces)throw new Nl("spaces_limit");const a=o.findIndex(t=>t.id===e);if(a<0)throw new Nl("source_missing");const n=o[a];if(!Array.isArray(n.view_box))throw new Nl("source_invalid");const r=Ll(n.wall_segments,!0),l=Ll(n.partitions),h=Ll(n.openings),c=Ll(n.decor),d=Ll(n.wall_columns);if(r.length+l.length>Fl.partitions)throw new Nl("partitions_limit");if(h.length>Fl.openings)throw new Nl("openings_limit");if(c.length>Fl.decor)throw new Nl("decor_limit");if(d.length>Fl.columns)throw new Nl("columns_limit");let p=0;const u=t=>`${t}${i}${(p++).toString(36)}`,_=new Map,m=new Map,g=[];for(const t of r){if(_.has(t.id)||!Bl(t.a)||!Bl(t.b)||"number"!=typeof t.cm||!Number.isFinite(t.cm))throw new Nl("source_invalid");const e=u("cw");_.set(t.id,e),g.push({id:e,a:Hl(t.a),b:Hl(t.b),cm:t.cm})}for(const t of l){if(m.has(t.id)||!Bl(t.a)||!Bl(t.b)||"number"!=typeof t.cm||!Number.isFinite(t.cm))throw new Nl("source_invalid");const e=u("cp");m.set(t.id,e),g.push({id:e,a:Hl(t.a),b:Hl(t.b),cm:t.cm})}const f=h.map(t=>{const e=Ol(t.host);if(!e||"string"!=typeof e.id||"string"!=typeof e.kind)throw new Nl("opening_host_missing");const s="wall"===e.kind?_.get(e.id):"partition"===e.kind?m.get(e.id):void 0;if(!s)throw new Nl("opening_host_unknown");const i={...Hl(t),id:u("co"),host:{...Hl(e),kind:"partition",id:s}};return delete i.contact,delete i.lock,i}),b=c.map(t=>({...Hl(t),id:u("cd")})),v=d.map(t=>({...Hl(t),id:u("cc")})),y=`s${i}`;if(o.some(t=>t.id===y))throw new Nl("source_invalid");const $={id:y,title:s.trim(),rooms:[],wall_segments:[],view_box:Hl(n.view_box)};for(const t of jl)"view_box"!==t&&El(n,t)&&($[t]=Hl(n[t]));g.length&&($.partitions=g),f.length&&($.openings=f),b.length&&($.decor=b),v.length&&($.wall_columns=v);const w=Hl(t);return w.spaces.splice(a+1,0,$),{config:w,space:$,sourceIndex:a}}(d,o,a,e.newSeed?.()??function(t=Date.now(),e=Math.random()){const s=Math.floor(16777216*Math.max(0,Math.min(.999999999,e))).toString(36).padStart(5,"0");return`${Math.max(0,Math.floor(t)).toString(36)}${s}`}());let u=!1;try{u=t._checkSpacePhysicalGeometry(p.config,p.space.id).ok}catch{u=!1}if(!u||t._junctionLimitViolations(p.config,p.space.id).length)throw new Nl("geometry_unsafe");const _=t._adoption.beginOptimistic(d,p.config);t._adoption.stageLocalConfig(p.config),Kl(t);try{await e.saveConfigNow(_)}catch(e){throw t._rollbackOptimistic(_)&&Kl(t),"conflict"!==e?.code&&await t._reloadConfigOnly(!0),e}t._canOptimizeUndo=!1,t._undoKind=null,e.clearGeometryGesture(),t._selId=null,t._physicalSel=null,t._spaceDialog=null,t._commitSpace(p.space.id,!0),e.setMode("plan"),t._tool="draw",t._path=[],t._cursorPt=null,t._activeWallChainId=null,t._activeWallChainPartitionIds=[],t._primeDrawWallField(),t._saveNav(),t.requestUpdate(),t._showToast(t._t("toast.space_copied",{name:a}))}catch(e){"conflict"===e?.code&&await Promise.all([t._reloadConfigOnly(!0),t._reloadLayoutOnly()]),Ul(t,i,!1),function(t,e){if(e instanceof Nl)return void t._showToast(t._t(Gl[e.code]));const s=e?.code;"wall_model_client_outdated"!==s?t._showToast(t._t("toast.error",{err:t._errText(e)})):t._showToast(t._t("toast.wall_model_client_outdated"))}(t,e),n&&t.requestUpdate()}}const Jl=new Set(["group","template","derivative","min_max","threshold","integration","statistics","trend","utility_meter","tod","switch_as_x","schedule"]);function Yl(t){const{hass:e,devices:s,markers:i,showEntities:o,currentBinding:a,currentDeviceId:n,labels:r}=t,l=Nt(i),h=new Set(i.filter(t=>t.removed).map(t=>t.binding)),c=new Set;for(const t of s)t.id!==n&&("device"===t.bindingKind&&t.bindingRef&&c.add(`device:${t.bindingRef}`),"entity"===t.bindingKind&&t.bindingRef&&c.add(`entity:${t.bindingRef}`));const d=new Set;for(const t of s)"device"===t.bindingKind&&t.name&&d.add(`${t.name.trim()}|${t.area||""}`);const p=[];for(const t of Object.values(e?.devices||{})){if(!t||"service"===t.entry_type)continue;const e=`device:${t.id}`;if(c.has(e))continue;const s=String(t.name_by_user||t.name||t.id).trim();e!==a&&!h.has(e)&&d.has(`${s}|${t.area_id||""}`)||p.push({value:e,label:s,sub:(t.model||r.device)+("Group"===t.model?r.z2mGroup:""),kind:"device",ref:t.id,areaId:t.area_id||"",model:t.model||""})}for(const[t,s]of Object.entries(e?.entities||{})){const i=`entity:${t}`;if(c.has(i))continue;if(Et(e,t,l)&&!h.has(i))continue;const o=Jl.has(s?.platform),a="group"===s?.platform;if(!o&&!a)continue;if(s?.hidden&&!h.has(i))continue;const n=e?.states?.[t];p.push({value:i,label:s?.name||n?.attributes?.friendly_name||t,sub:`${t.split(".")[0]} · ${a?r.group:r.helper}`,kind:"entity",ref:t,areaId:s?.area_id||s?.device_id&&e?.devices?.[s.device_id]?.area_id||"",model:"",parentDeviceId:s?.device_id||void 0})}if(o){const t=new Set(p.map(t=>t.value));for(const[s,i]of Object.entries(e?.entities||{})){const o=`entity:${s}`;if(c.has(o)||t.has(o)||i?.hidden&&!h.has(o))continue;const a=!!i?.device_id&&l.devices.has(i.device_id);if(Et(e,s,l)&&!h.has(o)&&!a)continue;const n=e?.states?.[s],d=i?.device_id?e?.devices?.[i.device_id]:null,u=d?String(d.name_by_user||d.name||""):"";p.push({value:o,label:i?.name||n?.attributes?.friendly_name||s,sub:`${s.split(".")[0]} · ${r.entity}${u?` · ${u}`:""}`,kind:"entity",ref:s,areaId:i?.area_id||d?.area_id||"",model:"",parentDeviceId:i?.device_id||void 0})}}return p.sort((t,e)=>t.label.localeCompare(e.label)||t.value.localeCompare(e.value))}const Xl={kind:"active",enabledEntityIds:[],allEntityIds:[]};function Zl(t){return t.startsWith("entity:")?"entity":"device"}function Ql(t){const e=t.binding.indexOf(":"),s=e>=0?t.binding.slice(e+1):"",i=Object.keys(t).filter(t=>!["id","binding","hidden"].includes(t));return t.id===`h${s}`&&0===i.length}const th=new Set(["ld2450","hlkld2450","hilinkld2450"]),eh=()=>globalThis.crypto?.randomUUID?.()||`radar_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`,sh=(t,e,s)=>{const i=!!t?.original;return{radar:i?t:null,radarEligible:i,radarTouched:i?e:e||!!t,radarRemove:i?s:s||!!t}},ih=(t,e="")=>"number"==typeof t&&Number.isFinite(t)?String(t):e,oh=t=>Array.from(new Set([...t.allEntities||t.entities||[],..."entity"===t.bindingKind&&t.bindingRef?[t.bindingRef]:[]])).filter(t=>/^[a-z0-9_]+\.[a-z0-9_]+$/.test(t)),ah=(t,e,s)=>{const i=t.split(".",2)[1]||"";return new RegExp(`(?:^|_)target_?${s}_${e}(?:_|$)`).test(i)||new RegExp(`(?:^|_)target_${e}_${s}(?:_|$)`).test(i)};function nh(t,e){if(t.marker?.radar&&"object"==typeof t.marker.radar)return Ht(t.marker.radar)?{eligible:!0,profile:t.marker.radar.profile,reason:"saved"}:{eligible:!0,profile:"presence_v1",reason:"saved_unsupported"};const s="entity"===t.bindingKind?e?.entities?.[t.bindingRef||""]:null,i="device"===t.bindingKind?t.bindingRef:s?.device_id,o=i?e?.devices?.[i]:null,a=oh(t);return th.has((n=o?.model||t.model,String(n||"").toLowerCase().replace(/[^a-z0-9]/g,"")))&&a.some(t=>ah(t,"x",1))&&a.some(t=>ah(t,"y",1))?{eligible:!0,profile:"esphome_ld2450_v1",reason:"ld2450"}:{eligible:!1,profile:"presence_v1",reason:"none"};var n}function rh(t,e){return t.find(t=>e.some(e=>e.test(t)))||""}function lh(t,e,s,i,o=!1){const a=nh(t,i),n=Ht(t.marker?.radar)?t.marker.radar:null;if(!n&&!a.eligible&&!o)return null;const r=n?.profile||a.profile,l=o&&!a.eligible||"ld2450"!==a.reason?{xEntities:["","",""],yEntities:["","",""],distanceEntity:"",angleEntity:"",occupancyEntity:"",countEntity:"",zoneEntity:""}:function(t,e,s){const i=oh(t).filter(t=>!!s?.states?.[t]),o=[],a=[];for(let t=1;t<=3;t++)o.push(i.find(e=>ah(e,"x",t))||""),a.push(i.find(e=>ah(e,"y",t))||"");const n=i.filter(t=>t.startsWith("binary_sensor.")),r=i.filter(t=>t.startsWith("sensor.")),l=rh(n,[/(?:occupancy|presence|target)(?:_|$)/]);return{xEntities:o,yEntities:a,distanceEntity:rh(r,[/(?:target_)?distance(?:_|$)/,/distance/]),angleEntity:rh(r,[/(?:target_)?angle(?:_|$)/,/angle/]),occupancyEntity:l,countEntity:rh(r,[/(?:target|people|presence)_count(?:_|$)/,/target_count/]),zoneEntity:"zones_v1"===e?rh(n,[/(?:zone|region).*(?:occupancy|presence)/,/zone/]):""}}(t,r,i),h=n?.sources||{},c=h.slots||[],d=c.filter(t=>"x_entity"in t),p=c.filter(t=>"distance_entity"in t),u=h.ranges||[],_=h.zones?.[0],m="esphome_ld2450_v1"===r?3:"cartesian_v1"===r?Math.max(1,d.length):"polar_v1"===r?Math.max(1,p.length):1,g=n?.room_id||t.marker?.room_id||e.rooms.find(e=>e.area&&e.area===t.area)?.id||"";return{original:n,enabled:!0===n?.enabled,showLive:!1!==n?.show_live,profile:r,roomId:g,installationId:n?.mount?.installation_id||eh(),mountX:ih(null==n?.mount?.x?void 0:1e3*n.mount.x,ih(s[0],"0")),mountY:ih(null==n?.mount?.y?void 0:1e3*n.mount.y,ih(s[1],"0")),heading:ih(n?.mount?.heading_deg,"0"),rangeCm:ih(n?.mount?.range_cm,"esphome_ld2450_v1"===r?"600":""),fovDeg:ih(n?.mount?.fov_deg,"esphome_ld2450_v1"===r?"120":""),mirror:!0===n?.calibration?.mirror,unit:d[0]?.unit||p[0]?.unit||u[0]?.unit||("esphome_ld2450_v1"===r?"mm":"cm"),xEntities:Array.from({length:m},(t,e)=>d[e]?.x_entity||l.xEntities[e]||""),yEntities:Array.from({length:m},(t,e)=>d[e]?.y_entity||l.yEntities[e]||""),distanceEntities:Array.from({length:m},(t,e)=>p[e]?.distance_entity||(0===e?l.distanceEntity:"")),angleEntities:Array.from({length:m},(t,e)=>p[e]?.angle_entity||(0===e?l.angleEntity:"")),rangeEntities:u.length?u.map(t=>t.entity_id):[l.distanceEntity],slotPresenceEntities:Array.from({length:m},(t,e)=>(d[e]||p[e])?.presence_entity||""),rangePresenceEntities:(u.length?u:[{}]).map(t=>"presence_entity"in t&&t.presence_entity||""),swapXY:Array.from({length:m},(t,e)=>!0===d[e]?.swap_xy),xSigns:Array.from({length:m},(t,e)=>-1===d[e]?.x_sign?-1:1),ySigns:Array.from({length:m},(t,e)=>-1===d[e]?.y_sign?-1:1),angleUnit:p[0]?.angle_unit||"degrees",angleZero:p[0]?.angle_zero||"forward",angleClockwise:!1!==p[0]?.angle_clockwise,occupancyEntity:h.occupancy_entity||l.occupancyEntity,countEntity:h.count_entity||l.countEntity,availabilityEntity:h.availability_entity||"",zoneEntity:_?.entity_id||l.zoneEntity,zoneKind:_?.kind||"occupancy"}}const hh=t=>JSON.stringify(t,(t,e)=>e&&"object"==typeof e&&!Array.isArray(e)?Object.fromEntries(Object.entries(e).sort(([t],[e])=>te?1:0)):e),ch=t=>{if(!t.trim())return null;const e=Number(t.replace(",","."));return Number.isFinite(e)?e:null};function dh(t,e){const s=ch(t.mountX),i=ch(t.mountY),o=ch(t.heading);if(!t.roomId||null==s||null==i||null==o)return null;const a={...t.original?.sources||{}};if(delete a.slots,delete a.ranges,delete a.zones,delete a.occupancy_entity,delete a.count_entity,"esphome_ld2450_v1"===t.profile||"cartesian_v1"===t.profile){if(a.slots=t.xEntities.flatMap((e,s)=>{const i=t.yEntities[s]||"";return e&&i?[{id:`target_${s+1}`,x_entity:e,y_entity:i,unit:"esphome_ld2450_v1"===t.profile?"mm":t.unit,..."cartesian_v1"===t.profile&&t.swapXY[s]?{swap_xy:!0}:{},..."cartesian_v1"===t.profile&&-1===t.xSigns[s]?{x_sign:-1}:{},..."cartesian_v1"===t.profile&&-1===t.ySigns[s]?{y_sign:-1}:{},...t.slotPresenceEntities[s]?{presence_entity:t.slotPresenceEntities[s]}:{}}]:[]}),!a.slots.length)return null}else if("polar_v1"===t.profile){if(a.slots=t.distanceEntities.flatMap((e,s)=>{const i=t.angleEntities[s]||"";return e&&i?[{id:`target_${s+1}`,distance_entity:e,angle_entity:i,unit:t.unit,angle_unit:t.angleUnit,angle_zero:t.angleZero,angle_clockwise:t.angleClockwise,...t.slotPresenceEntities[s]?{presence_entity:t.slotPresenceEntities[s]}:{}}]:[]}),!a.slots.length)return null}else if("range_v1"===t.profile){if(a.ranges=t.rangeEntities.flatMap((e,s)=>e?[{id:`range_${s+1}`,entity_id:e,unit:t.unit,...t.rangePresenceEntities[s]?{presence_entity:t.rangePresenceEntities[s]}:{}}]:[]),!a.ranges.length)return null}else if("zones_v1"===t.profile){if(!t.zoneEntity)return null;a.zones=[{id:"zone_1",kind:t.zoneKind,entity_id:t.zoneEntity}]}else if("presence_v1"===t.profile&&!t.occupancyEntity)return null;t.occupancyEntity&&(a.occupancy_entity=t.occupancyEntity),t.countEntity&&(a.count_entity=t.countEntity),t.availabilityEntity&&(a.availability_entity=t.availabilityEntity);const n=ch(t.rangeCm),r=ch(t.fovDeg),l=(o%360+360)%360,h={...t.original?.mount||{},installation_id:t.installationId,x:s/1e3,y:i/1e3,heading_deg:l};null!=n&&n>0?h.range_cm=n:delete h.range_cm,null!=r&&r>0?h.fov_deg=r:delete h.fov_deg;const c=t.original,d="two_point"===c?.calibration?.method&&c.profile===t.profile&&hh(c.sources)===hh(a)&&c.mount.installation_id===t.installationId&&Math.abs(c.mount.x-h.x)<1e-12&&Math.abs(c.mount.y-h.y)<1e-12&&Math.abs(c.mount.heading_deg-l)<1e-9&&c.calibration.mirror===t.mirror&&Math.abs(c.calibration.cell_cm-e)<1e-9,p=t.calibrationOverride?{...t.calibrationOverride}:d?{...c.calibration}:{...c?.calibration||{},method:"zones_v1"===t.profile||"presence_v1"===t.profile?"not_required":"manual",mirror:t.mirror,cell_cm:e};t.calibrationOverride||d||(delete p.refs,delete p.rms_cm);const u={...t.original||{},version:1,enabled:t.enabled,profile:t.profile,sources:a,mount:h,room_id:t.roomId,calibration:p};return t.showLive?delete u.show_live:u.show_live=!1,u}function ph(t,e="main"){const{dialog:s,device:i}=t;if(!i)return p``;t.setup.syncMarker(i.marker?.id||i.id);const o=nh(i,t.registryHass),a="saved_unsupported"===o.reason,n=()=>t.updateDialog({radar:null,radarTouched:!0,radarRemove:!0}),r=()=>{const e=t.spaceModelById(i.space)||t.currentSpace();if(!e)return;const s=t.position(i),o=lh(i,e,[s.x,s.y],t.registryHass,!0);o&&t.updateDialog({radar:o,radarEligible:!0,radarTouched:!0,radarRemove:!1})},l=!a&&"virtual"!==s.bindingMode&&(!s.radar||s.radarRemove)&&!o.eligible;if("additional"===e)return l?p`
    ${t.t("radar.additional_actions")} -
    `:h``;if(s.radar&&!s.radarRemove||!t.setup.isActive()||t.setup.reset(),a||"virtual"===s.bindingMode&&i.marker?.radar)return h`
    + `:p``;if(s.radar&&!s.radarRemove||!t.setup.isActive()||t.setup.reset(),a||"virtual"===s.bindingMode&&i.marker?.radar)return p`
    ${t.t("radar.title")}

    ${t.t("radar.saved_unsupported")}

    @@ -286,189 +286,189 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae ${t.t("radar.remove")}
    -
    `;if("virtual"===s.bindingMode)return h``;if(!s.radar||s.radarRemove)return o.eligible?h`
    +
    `;if("virtual"===s.bindingMode)return p``;if(!s.radar||s.radarRemove)return o.eligible?p`
    ${t.t("radar.title")}

    ${t.t("ld2450"===o.reason?"radar.detected_ld2450":"radar.detected")}

    -
    `:h``;const d=s.radar,p=function(t,e){const s=Object.keys(e?.states||{});return{numeric:s.filter(t=>t.startsWith("sensor.")).sort(),binary:s.filter(t=>t.startsWith("binary_sensor.")).sort()}}(0,t.planHass),u=(e,s,i,o="radar.source_choose")=>h`i(t.target.value)}> - ${e&&!s.includes(e)?h``:l} - ${s.map(s=>{const i=t.registryHass.entities?.[s],o=i?.device_id?t.registryHass.devices?.[i.device_id]:void 0,a=o?.name_by_user||o?.name||"",n=t.planHass.states?.[s]?.attributes?.friendly_name||s;return h``:d} + ${s.map(s=>{const i=t.registryHass.entities?.[s],o=i?.device_id?t.registryHass.devices?.[i.device_id]:void 0,a=o?.name_by_user||o?.name||"",n=t.planHass.states?.[s]?.attributes?.friendly_name||s;return p``})} - `,_=(e,s=!0)=>{t.setup.reset(),t.updateDialog({radar:{...d,...e,calibrationOverride:s?void 0:d.calibrationOverride,inspection:void 0,inspectError:void 0},radarTouched:!0,radarRemove:!1})},m=t.spaceModelById(i.space)||t.currentSpace(),g=m?.rooms||[],f="esphome_ld2450_v1"===d.profile||"cartesian_v1"===d.profile,b=(e=d)=>{const s=g.find(t=>t.id===e.roomId);m&&s&&rh(e,m.cellCm||5)?((!Array.isArray(s.poly)||s.poly.length<3)&&t.toast(t.t("radar.no_contour")),t.setup.begin(i.marker?.id||i.id,e,s,m.cellCm||5,t.configRev)||t.toast(t.t("radar.invalid"))):t.toast(t.t("radar.invalid"))},v=(t,e,s)=>{const i=[...d[t]];i[e]=s,_({[t]:i})},y=(t,e,s)=>{const i=[...d[t]];i[e]=s,_({[t]:i})},$=(t,e,s)=>{const i=[...d[t]];i[e]=s,_({[t]:i})},w=()=>{d.xEntities.length>=8||_({xEntities:[...d.xEntities,""],yEntities:[...d.yEntities,""],distanceEntities:[...d.distanceEntities,""],angleEntities:[...d.angleEntities,""],slotPresenceEntities:[...d.slotPresenceEntities,""],swapXY:[...d.swapXY,!1],xSigns:[...d.xSigns,1],ySigns:[...d.ySigns,1]})},k=t=>_({xEntities:d.xEntities.filter((e,s)=>s!==t),yEntities:d.yEntities.filter((e,s)=>s!==t),distanceEntities:d.distanceEntities.filter((e,s)=>s!==t),angleEntities:d.angleEntities.filter((e,s)=>s!==t),slotPresenceEntities:d.slotPresenceEntities.filter((e,s)=>s!==t),swapXY:d.swapXY.filter((e,s)=>s!==t),xSigns:d.xSigns.filter((e,s)=>s!==t),ySigns:d.ySigns.filter((e,s)=>s!==t)});return h`
    + `,_=(e,s=!0)=>{t.setup.reset(),t.updateDialog({radar:{...h,...e,calibrationOverride:s?void 0:h.calibrationOverride,inspection:void 0,inspectError:void 0},radarTouched:!0,radarRemove:!1})},m=t.spaceModelById(i.space)||t.currentSpace(),g=m?.rooms||[],f="esphome_ld2450_v1"===h.profile||"cartesian_v1"===h.profile,b=(e=h)=>{const s=g.find(t=>t.id===e.roomId);m&&s&&dh(e,m.cellCm||5)?((!Array.isArray(s.poly)||s.poly.length<3)&&t.toast(t.t("radar.no_contour")),t.setup.begin(i.marker?.id||i.id,e,s,m.cellCm||5,t.configRev)||t.toast(t.t("radar.invalid"))):t.toast(t.t("radar.invalid"))},v=(t,e,s)=>{const i=[...h[t]];i[e]=s,_({[t]:i})},y=(t,e,s)=>{const i=[...h[t]];i[e]=s,_({[t]:i})},$=(t,e,s)=>{const i=[...h[t]];i[e]=s,_({[t]:i})},w=()=>{h.xEntities.length>=8||_({xEntities:[...h.xEntities,""],yEntities:[...h.yEntities,""],distanceEntities:[...h.distanceEntities,""],angleEntities:[...h.angleEntities,""],slotPresenceEntities:[...h.slotPresenceEntities,""],swapXY:[...h.swapXY,!1],xSigns:[...h.xSigns,1],ySigns:[...h.ySigns,1]})},k=t=>_({xEntities:h.xEntities.filter((e,s)=>s!==t),yEntities:h.yEntities.filter((e,s)=>s!==t),distanceEntities:h.distanceEntities.filter((e,s)=>s!==t),angleEntities:h.angleEntities.filter((e,s)=>s!==t),slotPresenceEntities:h.slotPresenceEntities.filter((e,s)=>s!==t),swapXY:h.swapXY.filter((e,s)=>s!==t),xSigns:h.xSigns.filter((e,s)=>s!==t),ySigns:h.ySigns.filter((e,s)=>s!==t)});return p`
    ${t.t("radar.title")}${t.help("radar.help")} - ${f?d.xEntities.map((e,s)=>h` + ${f?h.xEntities.map((e,s)=>p`
    ${t.t("radar.target",{n:s+1})} - ${"cartesian_v1"===d.profile&&d.xEntities.length>1?h``:l} + ${"cartesian_v1"===h.profile&&h.xEntities.length>1?p``:d}
    - ${u(e,p.numeric,t=>v("xEntities",s,t))} + ${u(e,c.numeric,t=>v("xEntities",s,t))} - ${u(d.yEntities[s]||"",p.numeric,t=>v("yEntities",s,t))} - ${"cartesian_v1"===d.profile?h` + ${u(h.yEntities[s]||"",c.numeric,t=>v("yEntities",s,t))} + ${"cartesian_v1"===h.profile?p`
    - `:l} + `:d} - ${u(d.slotPresenceEntities[s]||"",p.binary,t=>y("slotPresenceEntities",s,t),"radar.source_optional")} - `):l} - ${"cartesian_v1"===d.profile&&d.xEntities.length<8?h``:l} - ${"polar_v1"===d.profile?h` - ${d.distanceEntities.map((e,s)=>h` + `:d} + ${"polar_v1"===h.profile?p` + ${h.distanceEntities.map((e,s)=>p`
    ${t.t("radar.target",{n:s+1})} - ${d.distanceEntities.length>1?h``:l} + `:d}
    - ${u(e,p.numeric,t=>y("distanceEntities",s,t))} + ${u(e,c.numeric,t=>y("distanceEntities",s,t))} - ${u(d.angleEntities[s]||"",p.numeric,t=>y("angleEntities",s,t))} + ${u(h.angleEntities[s]||"",c.numeric,t=>y("angleEntities",s,t))} - ${u(d.slotPresenceEntities[s]||"",p.binary,t=>y("slotPresenceEntities",s,t),"radar.source_optional")} + ${u(h.slotPresenceEntities[s]||"",c.binary,t=>y("slotPresenceEntities",s,t),"radar.source_optional")} `)} - ${d.distanceEntities.length<8?h``:l} + ${h.distanceEntities.length<8?p``:d} - `:l} - ${"range_v1"===d.profile?h` - ${d.rangeEntities.map((e,s)=>h` + `:d} + ${"range_v1"===h.profile?p` + ${h.rangeEntities.map((e,s)=>p`
    ${t.t("radar.range_channel",{n:s+1})} - ${d.rangeEntities.length>1?h``:l} + ${h.rangeEntities.length>1?p``:d}
    - ${u(e,p.numeric,t=>y("rangeEntities",s,t))} + ${u(e,c.numeric,t=>y("rangeEntities",s,t))} - ${u(d.rangePresenceEntities[s]||"",p.binary,t=>y("rangePresenceEntities",s,t),"radar.source_optional")} + ${u(h.rangePresenceEntities[s]||"",c.binary,t=>y("rangePresenceEntities",s,t),"radar.source_optional")} `)} - ${d.rangeEntities.length<2?h``:l} - `:l} - ${"zones_v1"===d.profile?h` + ${h.rangeEntities.length<2?p``:d} + `:d} + ${"zones_v1"===h.profile?p` - ${u(d.zoneEntity,"occupancy"===d.zoneKind?p.binary:p.numeric,t=>_({zoneEntity:t}))} + ${u(h.zoneEntity,"occupancy"===h.zoneKind?c.binary:c.numeric,t=>_({zoneEntity:t}))} - `:l} + `:d} - ${u(d.occupancyEntity,p.binary,t=>_({occupancyEntity:t}),"radar.source_optional")} + ${u(h.occupancyEntity,c.binary,t=>_({occupancyEntity:t}),"radar.source_optional")} - ${u(d.countEntity,p.numeric,t=>_({countEntity:t}),"radar.source_optional")} + ${u(h.countEntity,c.numeric,t=>_({countEntity:t}),"radar.source_optional")} - ${u(d.availabilityEntity,p.binary,t=>_({availabilityEntity:t}),"radar.source_optional")} + ${u(h.availabilityEntity,c.binary,t=>_({availabilityEntity:t}),"radar.source_optional")}

    ${t.t("radar.mount_hint")}

    - - + .value=${h.heading} @input=${t=>_({heading:t.target.value})}>
    + .value=${h.rangeCm} @input=${t=>_({rangeCm:t.target.value})}> + .value=${h.fovDeg} @input=${t=>_({fovDeg:t.target.value})}>
    - ${"esphome_ld2450_v1"!==d.profile&&"zones_v1"!==d.profile&&"presence_v1"!==d.profile?h` + ${"esphome_ld2450_v1"!==h.profile&&"zones_v1"!==h.profile&&"presence_v1"!==h.profile?p` - - `:l} + + `:d}
    - ${d.original?h``:l} - `:d} +
    - ${d.inspectError?h``:l} - ${d.inspection?.frame?h`
    + ${h.inspectError?p``:d} + ${h.inspection?.frame?p`
    ${t.t("radar.health")} - ${t.t(`radar.health_${d.inspection.frame.health||"unknown"}`)} - ${t.t("radar.live_summary",{targets:d.inspection.frame.targets?.length||0,ranges:d.inspection.frame.ranges?.length||0})} - ${(d.inspection.sources||[]).map(e=>{const s="number"==typeof e.reported_at&&Number.isFinite(e.reported_at)?Math.max(0,Math.round(Date.now()/1e3-e.reported_at)):null;return h`${e.entity_id}: ${e.state??"—"}${null==s?"":` · ${t.t("radar.report_age",{seconds:s})}`}`})} -
    `:l} + ${t.t(`radar.health_${h.inspection.frame.health||"unknown"}`)} + ${t.t("radar.live_summary",{targets:h.inspection.frame.targets?.length||0,ranges:h.inspection.frame.ranges?.length||0})} + ${(h.inspection.sources||[]).map(e=>{const s="number"==typeof e.reported_at&&Number.isFinite(e.reported_at)?Math.max(0,Math.round(Date.now()/1e3-e.reported_at)):null;return p`${e.entity_id}: ${e.state??"—"}${null==s?"":` · ${t.t("radar.report_age",{seconds:s})}`}`})} +
    `:d} ${t.setup.render()}
    -
    `}function hh(t,e,s,i,o){if(![...t,e,i,...o].every(Number.isFinite)||i<=0||Math.hypot(...o)>1e4)throw new Error("invalid_radar");const a=e*Math.PI/180,n=s?-1:1,r=240*i;return[t[0]+(n*o[0]*Math.cos(a)+o[1]*Math.sin(a))/r,t[1]+(n*o[0]*Math.sin(a)-o[1]*Math.cos(a))/r]}class ch{constructor(t){this.host=t,this.active=null,this.generation=0,this.timer=0}begin(t,e,s,i,o){return!!this.host.configFromDraft(e,i)&&(this.reset(),this.active={markerId:t,draft:e,room:s,cellCm:i,configRev:o,phase:"mount",mount:null,headingPoint:null,pendingPlan:null,refs:[],samples:[],ambiguous:!1,trail:[]},this.host.requestUpdate(),!0)}reset(){this.generation++,this.unsubscribe?.(),this.unsubscribe=void 0,clearInterval(this.timer),this.timer=0,this.active=null}async discardIfAllowed(){if(!this.active)return!0;return!!(null===this.active.mount&&"mount"===this.active.phase||await this.host.confirmDiscard())&&(this.reset(),this.host.requestUpdate(),!0)}cancel(){return this.discardIfAllowed()}isActive(){return null!==this.active}isDirty(){return!!this.active&&(null!==this.active.mount||"mount"!==this.active.phase)}syncMarker(t){this.active&&this.active.markerId!==t&&this.reset()}coordinateProfile(){return!!this.active&&["esphome_ld2450_v1","cartesian_v1","polar_v1"].includes(this.active.draft.profile)}choosePoint(t){const e=this.active,s=function(t){const e=t.currentTarget.getBoundingClientRect();return e.width>0&&e.height>0?[Math.max(0,Math.min(1,(t.clientX-e.left)/e.width)),Math.max(0,Math.min(1,(t.clientY-e.top)/e.height))]:null}(t);var i,o;e&&s&&!1!==t.isPrimary&&"capture"!==e.phase&&"checking"!==e.phase&&(e.error=void 0,"mount"===e.phase?(e.mount=s,e.phase="heading"):"heading"===e.phase&&e.mount?(e.headingPoint=s,e.draft={...e.draft,mountX:String(Number((1e3*e.mount[0]).toFixed(3))),mountY:String(Number((1e3*e.mount[1]).toFixed(3))),heading:String(Number((i=e.mount,o=s,(180*Math.atan2(o[0]-i[0],i[1]-o[1])/Math.PI%360+360)%360).toFixed(3)))},e.phase=this.coordinateProfile()?"reference_1":"solved",this.coordinateProfile()&&this.subscribe()):"reference_1"!==e.phase&&"reference_2"!==e.phase&&"check_reference"!==e.phase||(e.pendingPlan=s),this.host.requestUpdate())}async subscribe(){const t=this.active,e=this.host.hass()?.connection;if(!t||this.unsubscribe||"function"!=typeof e?.subscribeMessage)return;const s=this.host.configFromDraft(t.draft,t.cellCm);if(!s)return;const i=++this.generation;try{const o=await e.subscribeMessage(t=>{i===this.generation&&this.active&&this.receive(t)},{type:"houseplan/radar/setup/subscribe",marker_id:t.markerId,expected_config_rev:t.configRev,draft_sources:{radar:s}});i===this.generation&&this.active?"function"==typeof o&&(this.unsubscribe=o):"function"==typeof o&&o()}catch(t){if(i!==this.generation||!this.active)return;const e=`radar.error_${String(t&&"object"==typeof t&&"code"in t&&t.code||"not_ready")}`;this.active.error=this.host.t(e)===e?"radar.error_not_ready":e,this.host.requestUpdate()}}receive(t){const e=this.active;if(!e)return;const s=Date.now(),i=Array.isArray(t.local_targets)?t.local_targets.filter(t=>{return e=[t.x_cm,t.y_cm],Array.isArray(e)&&2===e.length&&e.every(t=>"number"==typeof t&&Number.isFinite(t));var e}):[],o=new Set(i.map(t=>String(t.slot||"target")));e.trail=e.trail.filter(t=>t.at>=s-8e3&&o.has(t.slot));for(const t of i){const i=[t.x_cm,t.y_cm],o=String(t.slot||"target"),a=e.solved?.headingDeg??Number(e.draft.heading),n=e.solved?.mirror??e.draft.mirror;if(e.mount)try{const t=hh(e.mount,a,n,e.cellCm,i),r=[...e.trail].reverse().find(t=>t.slot===o);r&&240*Math.hypot(t[0]-r.point[0],t[1]-r.point[1])*e.cellCm>100&&(e.trail=e.trail.filter(t=>t.slot!==o)),e.trail.push({at:s,slot:o,point:t})}catch{}}const a=[];for(const t of o)a.push(...e.trail.filter(e=>e.slot===t).slice(-32));if(e.trail=a.sort((t,e)=>t.at-e.at),("capture"===e.phase||"checking"===e.phase)&&s>=(e.countdownUntil||0)&&s<(e.captureUntil||0))if(1===i.length){const t=Number(i[0].reported_at);e.samples.push({at:Number.isFinite(t)?1e3*t:s,point:[i[0].x_cm,i[0].y_cm]})}else i.length>1&&(e.ambiguous=!0);this.host.requestUpdate()}startCapture(){const t=this.active;t?.pendingPlan&&this.coordinateProfile()&&(t.samples=[],t.ambiguous=!1,t.error=void 0,t.captureFor="reference_1"===t.phase?0:"reference_2"===t.phase?1:2,t.phase=2===t.captureFor?"checking":"capture",t.countdownUntil=Date.now()+1e4,t.captureUntil=t.countdownUntil+5e3,clearInterval(this.timer),this.timer=window.setInterval(()=>this.tick(),200),this.subscribe(),this.host.requestUpdate())}tick(){const t=this.active;if(!t||!t.captureUntil||Date.now()t.at))-Math.min(...t.samples.map(t=>t.at))<2e3)throw new Error("insufficient_samples");e=function(t){if(t.length<3)throw new Error("insufficient_samples");const e=t=>{const e=[...t].sort((t,e)=>t-e),s=Math.floor(e.length/2);return e.length%2?e[s]:(e[s-1]+e[s])/2},s=[e(t.map(t=>t[0])),e(t.map(t=>t[1]))];if(t.some(t=>Math.hypot(t[0]-s[0],t[1]-s[1])>15))throw new Error("bad_fit");return s}(t.samples.map(t=>t.point))}catch(e){return t.error="ambiguous_target"===String(e?.message)?"radar.ambiguous_target":"radar.insufficient_samples",t.phase=0===t.captureFor?"reference_1":1===t.captureFor?"reference_2":"check_reference",void this.host.requestUpdate()}if(2===t.captureFor&&t.solved&&t.mount&&t.pendingPlan){const s=hh(t.mount,t.solved.headingDeg,t.solved.mirror,t.cellCm,e);t.checkErrorCm=240*Math.hypot(s[0]-t.pendingPlan[0],s[1]-t.pendingPlan[1])*t.cellCm,t.phase="checked"}else t.pendingPlan&&(t.refs[t.captureFor||0]={plan:t.pendingPlan,local:e},t.pendingPlan=null,t.refs.length<2?t.phase="reference_2":this.solve());this.host.requestUpdate()}solve(){const t=this.active;if(t?.mount&&2===t.refs.length)try{t.solved=function(t,e,s,i){if(![...t,i,...e.flat(),...s.flat()].every(Number.isFinite)||i<=0)throw new Error("invalid_selection");if(e.some(t=>Math.hypot(...t)<50))throw new Error("bad_references");const o=Math.hypot(...e[0])*Math.hypot(...e[1]),a=(e[0][0]*e[1][0]+e[0][1]*e[1][1])/o,n=180*Math.acos(Math.max(-1,Math.min(1,a)))/Math.PI;if(n<20||n>160)throw new Error("bad_references");const r=240*i,l=s.map(e=>[(e[0]-t[0])*r,-(e[1]-t[1])*r]),h=[];for(const t of[!1,!0]){const s=e.map(([e,s])=>[t?-e:e,s]),i=s.reduce((t,e,s)=>t+e[0]*l[s][0]+e[1]*l[s][1],0),o=s.reduce((t,e,s)=>t+e[0]*l[s][1]-e[1]*l[s][0],0),a=Math.atan2(o,i),n=s.map(([t,e],s)=>{const i=t*Math.cos(a)-e*Math.sin(a),o=t*Math.sin(a)+e*Math.cos(a);return Math.hypot(i-l[s][0],o-l[s][1])}),r=e.every((t,e)=>{const s=Math.hypot(...t),i=Math.hypot(...l[e]);return Math.abs(s-i)<=Math.max(20,.15*i)}),c=Math.sqrt((n[0]**2+n[1]**2)/2);r&&c<=20&&Math.max(...n)<=30&&h.push({headingDeg:(180*-a/Math.PI%360+360)%360,mirror:t,rmsCm:c,errorsCm:n})}if(h.sort((t,e)=>t.rmsCm-e.rmsCm),!h.length)throw new Error("invalid_selection");if(h.length>1&&Math.abs(h[0].rmsCm-h[1].rmsCm)<10)throw new Error("ambiguous_sources");return h[0]}(t.mount,[t.refs[0].local,t.refs[1].local],[t.refs[0].plan,t.refs[1].plan],t.cellCm),t.draft={...t.draft,heading:String(Number(t.solved.headingDeg.toFixed(3))),mirror:t.solved.mirror},t.phase="solved",t.error=void 0}catch(e){const s=String(e?.message);t.error="ambiguous_sources"===s?"radar.ambiguous_sources":"bad_references"===s?"radar.bad_references":"radar.bad_fit",t.refs=[],t.phase="reference_1"}}beginCheck(){this.active?.solved&&(this.active.pendingPlan=null,this.active.phase="check_reference",this.host.requestUpdate())}interrupt(){this.active&&(this.reset(),this.host.requestUpdate())}apply(){const t=this.active;if(!t?.mount||!t.headingPoint)return;const e=t.solved?{method:"two_point",mirror:t.solved.mirror,cell_cm:t.cellCm,refs:t.refs.map(t=>({plan:{x:t.plan[0],y:t.plan[1]},local_cm:{x:t.local[0],y:t.local[1]}})),rms_cm:t.solved.rmsCm}:{method:this.coordinateProfile()?"manual":"not_required",mirror:t.draft.mirror,cell_cm:t.cellCm},s={...t.draft,calibrationOverride:e};this.reset(),this.host.apply(s),this.host.requestUpdate()}instruction(t){if("mount"===t.phase)return this.host.t("radar.step_place_mount");if("heading"===t.phase)return this.host.t("radar.step_place_heading");if("reference_1"===t.phase)return this.host.t("radar.step_reference",{n:1});if("reference_2"===t.phase)return this.host.t("radar.step_reference",{n:2});if("check_reference"===t.phase)return this.host.t("radar.step_check_reference");if("capture"===t.phase||"checking"===t.phase){const e=Math.max(0,Math.ceil(((t.countdownUntil||0)-Date.now())/1e3));return e>0?this.host.t("radar.countdown",{seconds:e}):this.host.t("radar.capturing")}return this.host.t("checked"===t.phase?"radar.check_complete":"radar.fit_ready")}render(){const t=this.active;if(!t)return l;const e=(t.room.poly||[]).map(t=>`${1e3*t[0]},${1e3*t[1]}`).join(" "),s=[...t.mount?[{point:t.mount,cls:"mount",label:"R"}]:[],...t.refs.map((t,e)=>({point:t.plan,cls:"reference",label:String(e+1)})),...t.pendingPlan?[{point:t.pendingPlan,cls:"pending",label:"+"}]:[]],i=!!t.pendingPlan&&["reference_1","reference_2","check_reference"].includes(t.phase),o=[...new Set(t.trail.map(t=>t.slot))].map(e=>t.trail.filter(t=>t.slot===e));return h`
    +
    `}function uh(t,e,s,i,o){if(![...t,e,i,...o].every(Number.isFinite)||i<=0||Math.hypot(...o)>1e4)throw new Error("invalid_radar");const a=e*Math.PI/180,n=s?-1:1,r=240*i;return[t[0]+(n*o[0]*Math.cos(a)+o[1]*Math.sin(a))/r,t[1]+(n*o[0]*Math.sin(a)-o[1]*Math.cos(a))/r]}class _h{constructor(t){this.host=t,this.active=null,this.generation=0,this.timer=0}begin(t,e,s,i,o){return!!this.host.configFromDraft(e,i)&&(this.reset(),this.active={markerId:t,draft:e,room:s,cellCm:i,configRev:o,phase:"mount",mount:null,headingPoint:null,pendingPlan:null,refs:[],samples:[],ambiguous:!1,trail:[]},this.host.requestUpdate(),!0)}reset(){this.generation++,this.unsubscribe?.(),this.unsubscribe=void 0,clearInterval(this.timer),this.timer=0,this.active=null}async discardIfAllowed(){if(!this.active)return!0;return!!(null===this.active.mount&&"mount"===this.active.phase||await this.host.confirmDiscard())&&(this.reset(),this.host.requestUpdate(),!0)}cancel(){return this.discardIfAllowed()}isActive(){return null!==this.active}isDirty(){return!!this.active&&(null!==this.active.mount||"mount"!==this.active.phase)}syncMarker(t){this.active&&this.active.markerId!==t&&this.reset()}coordinateProfile(){return!!this.active&&["esphome_ld2450_v1","cartesian_v1","polar_v1"].includes(this.active.draft.profile)}choosePoint(t){const e=this.active,s=function(t){const e=t.currentTarget.getBoundingClientRect();return e.width>0&&e.height>0?[Math.max(0,Math.min(1,(t.clientX-e.left)/e.width)),Math.max(0,Math.min(1,(t.clientY-e.top)/e.height))]:null}(t);var i,o;e&&s&&!1!==t.isPrimary&&"capture"!==e.phase&&"checking"!==e.phase&&(e.error=void 0,"mount"===e.phase?(e.mount=s,e.phase="heading"):"heading"===e.phase&&e.mount?(e.headingPoint=s,e.draft={...e.draft,mountX:String(Number((1e3*e.mount[0]).toFixed(3))),mountY:String(Number((1e3*e.mount[1]).toFixed(3))),heading:String(Number((i=e.mount,o=s,(180*Math.atan2(o[0]-i[0],i[1]-o[1])/Math.PI%360+360)%360).toFixed(3)))},e.phase=this.coordinateProfile()?"reference_1":"solved",this.coordinateProfile()&&this.subscribe()):"reference_1"!==e.phase&&"reference_2"!==e.phase&&"check_reference"!==e.phase||(e.pendingPlan=s),this.host.requestUpdate())}async subscribe(){const t=this.active,e=this.host.hass()?.connection;if(!t||this.unsubscribe||"function"!=typeof e?.subscribeMessage)return;const s=this.host.configFromDraft(t.draft,t.cellCm);if(!s)return;const i=++this.generation;try{const o=await e.subscribeMessage(t=>{i===this.generation&&this.active&&this.receive(t)},{type:"houseplan/radar/setup/subscribe",marker_id:t.markerId,expected_config_rev:t.configRev,draft_sources:{radar:s}});i===this.generation&&this.active?"function"==typeof o&&(this.unsubscribe=o):"function"==typeof o&&o()}catch(t){if(i!==this.generation||!this.active)return;const e=`radar.error_${String(t&&"object"==typeof t&&"code"in t&&t.code||"not_ready")}`;this.active.error=this.host.t(e)===e?"radar.error_not_ready":e,this.host.requestUpdate()}}receive(t){const e=this.active;if(!e)return;const s=Date.now(),i=Array.isArray(t.local_targets)?t.local_targets.filter(t=>{return e=[t.x_cm,t.y_cm],Array.isArray(e)&&2===e.length&&e.every(t=>"number"==typeof t&&Number.isFinite(t));var e}):[],o=new Set(i.map(t=>String(t.slot||"target")));e.trail=e.trail.filter(t=>t.at>=s-8e3&&o.has(t.slot));for(const t of i){const i=[t.x_cm,t.y_cm],o=String(t.slot||"target"),a=e.solved?.headingDeg??Number(e.draft.heading),n=e.solved?.mirror??e.draft.mirror;if(e.mount)try{const t=uh(e.mount,a,n,e.cellCm,i),r=[...e.trail].reverse().find(t=>t.slot===o);r&&240*Math.hypot(t[0]-r.point[0],t[1]-r.point[1])*e.cellCm>100&&(e.trail=e.trail.filter(t=>t.slot!==o)),e.trail.push({at:s,slot:o,point:t})}catch{}}const a=[];for(const t of o)a.push(...e.trail.filter(e=>e.slot===t).slice(-32));if(e.trail=a.sort((t,e)=>t.at-e.at),("capture"===e.phase||"checking"===e.phase)&&s>=(e.countdownUntil||0)&&s<(e.captureUntil||0))if(1===i.length){const t=Number(i[0].reported_at);e.samples.push({at:Number.isFinite(t)?1e3*t:s,point:[i[0].x_cm,i[0].y_cm]})}else i.length>1&&(e.ambiguous=!0);this.host.requestUpdate()}startCapture(){const t=this.active;t?.pendingPlan&&this.coordinateProfile()&&(t.samples=[],t.ambiguous=!1,t.error=void 0,t.captureFor="reference_1"===t.phase?0:"reference_2"===t.phase?1:2,t.phase=2===t.captureFor?"checking":"capture",t.countdownUntil=Date.now()+1e4,t.captureUntil=t.countdownUntil+5e3,clearInterval(this.timer),this.timer=window.setInterval(()=>this.tick(),200),this.subscribe(),this.host.requestUpdate())}tick(){const t=this.active;if(!t||!t.captureUntil||Date.now()t.at))-Math.min(...t.samples.map(t=>t.at))<2e3)throw new Error("insufficient_samples");e=function(t){if(t.length<3)throw new Error("insufficient_samples");const e=t=>{const e=[...t].sort((t,e)=>t-e),s=Math.floor(e.length/2);return e.length%2?e[s]:(e[s-1]+e[s])/2},s=[e(t.map(t=>t[0])),e(t.map(t=>t[1]))];if(t.some(t=>Math.hypot(t[0]-s[0],t[1]-s[1])>15))throw new Error("bad_fit");return s}(t.samples.map(t=>t.point))}catch(e){return t.error="ambiguous_target"===String(e?.message)?"radar.ambiguous_target":"radar.insufficient_samples",t.phase=0===t.captureFor?"reference_1":1===t.captureFor?"reference_2":"check_reference",void this.host.requestUpdate()}if(2===t.captureFor&&t.solved&&t.mount&&t.pendingPlan){const s=uh(t.mount,t.solved.headingDeg,t.solved.mirror,t.cellCm,e);t.checkErrorCm=240*Math.hypot(s[0]-t.pendingPlan[0],s[1]-t.pendingPlan[1])*t.cellCm,t.phase="checked"}else t.pendingPlan&&(t.refs[t.captureFor||0]={plan:t.pendingPlan,local:e},t.pendingPlan=null,t.refs.length<2?t.phase="reference_2":this.solve());this.host.requestUpdate()}solve(){const t=this.active;if(t?.mount&&2===t.refs.length)try{t.solved=function(t,e,s,i){if(![...t,i,...e.flat(),...s.flat()].every(Number.isFinite)||i<=0)throw new Error("invalid_selection");if(e.some(t=>Math.hypot(...t)<50))throw new Error("bad_references");const o=Math.hypot(...e[0])*Math.hypot(...e[1]),a=(e[0][0]*e[1][0]+e[0][1]*e[1][1])/o,n=180*Math.acos(Math.max(-1,Math.min(1,a)))/Math.PI;if(n<20||n>160)throw new Error("bad_references");const r=240*i,l=s.map(e=>[(e[0]-t[0])*r,-(e[1]-t[1])*r]),h=[];for(const t of[!1,!0]){const s=e.map(([e,s])=>[t?-e:e,s]),i=s.reduce((t,e,s)=>t+e[0]*l[s][0]+e[1]*l[s][1],0),o=s.reduce((t,e,s)=>t+e[0]*l[s][1]-e[1]*l[s][0],0),a=Math.atan2(o,i),n=s.map(([t,e],s)=>{const i=t*Math.cos(a)-e*Math.sin(a),o=t*Math.sin(a)+e*Math.cos(a);return Math.hypot(i-l[s][0],o-l[s][1])}),r=e.every((t,e)=>{const s=Math.hypot(...t),i=Math.hypot(...l[e]);return Math.abs(s-i)<=Math.max(20,.15*i)}),c=Math.sqrt((n[0]**2+n[1]**2)/2);r&&c<=20&&Math.max(...n)<=30&&h.push({headingDeg:(180*-a/Math.PI%360+360)%360,mirror:t,rmsCm:c,errorsCm:n})}if(h.sort((t,e)=>t.rmsCm-e.rmsCm),!h.length)throw new Error("invalid_selection");if(h.length>1&&Math.abs(h[0].rmsCm-h[1].rmsCm)<10)throw new Error("ambiguous_sources");return h[0]}(t.mount,[t.refs[0].local,t.refs[1].local],[t.refs[0].plan,t.refs[1].plan],t.cellCm),t.draft={...t.draft,heading:String(Number(t.solved.headingDeg.toFixed(3))),mirror:t.solved.mirror},t.phase="solved",t.error=void 0}catch(e){const s=String(e?.message);t.error="ambiguous_sources"===s?"radar.ambiguous_sources":"bad_references"===s?"radar.bad_references":"radar.bad_fit",t.refs=[],t.phase="reference_1"}}beginCheck(){this.active?.solved&&(this.active.pendingPlan=null,this.active.phase="check_reference",this.host.requestUpdate())}interrupt(){this.active&&(this.reset(),this.host.requestUpdate())}apply(){const t=this.active;if(!t?.mount||!t.headingPoint)return;const e=t.solved?{method:"two_point",mirror:t.solved.mirror,cell_cm:t.cellCm,refs:t.refs.map(t=>({plan:{x:t.plan[0],y:t.plan[1]},local_cm:{x:t.local[0],y:t.local[1]}})),rms_cm:t.solved.rmsCm}:{method:this.coordinateProfile()?"manual":"not_required",mirror:t.draft.mirror,cell_cm:t.cellCm},s={...t.draft,calibrationOverride:e};this.reset(),this.host.apply(s),this.host.requestUpdate()}instruction(t){if("mount"===t.phase)return this.host.t("radar.step_place_mount");if("heading"===t.phase)return this.host.t("radar.step_place_heading");if("reference_1"===t.phase)return this.host.t("radar.step_reference",{n:1});if("reference_2"===t.phase)return this.host.t("radar.step_reference",{n:2});if("check_reference"===t.phase)return this.host.t("radar.step_check_reference");if("capture"===t.phase||"checking"===t.phase){const e=Math.max(0,Math.ceil(((t.countdownUntil||0)-Date.now())/1e3));return e>0?this.host.t("radar.countdown",{seconds:e}):this.host.t("radar.capturing")}return this.host.t("checked"===t.phase?"radar.check_complete":"radar.fit_ready")}render(){const t=this.active;if(!t)return d;const e=(t.room.poly||[]).map(t=>`${1e3*t[0]},${1e3*t[1]}`).join(" "),s=[...t.mount?[{point:t.mount,cls:"mount",label:"R"}]:[],...t.refs.map((t,e)=>({point:t.plan,cls:"reference",label:String(e+1)})),...t.pendingPlan?[{point:t.pendingPlan,cls:"pending",label:"+"}]:[]],i=!!t.pendingPlan&&["reference_1","reference_2","check_reference"].includes(t.phase),o=[...new Set(t.trail.map(t=>t.slot))].map(e=>t.trail.filter(t=>t.slot===e));return p`
    ${this.instruction(t)} `:l} - ${"solved"===t.phase?h``:l} - ${"solved"===t.phase||"checked"===t.phase?h``:l} + ${i?p``:d} + ${"solved"===t.phase?p``:d} + ${"solved"===t.phase||"checked"===t.phase?p``:d}
    -
    `}}const dh=.001;function ph(t){return!!t&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1])}function uh(t){return`${t[0].toFixed(6)},${t[1].toFixed(6)}`}function _h(t,e,s){return Math.abs(t[0]-e[0])"room"!==t.kind&&s.some(s=>s!==t&&function(t,e,s){const i=t.b[0]-t.a[0],o=t.b[1]-t.a[1],a=Math.hypot(i,o);if(!(a>s))return!1;const n=i/a,r=o/a,l=e=>Math.abs((e[0]-t.a[0])*r-(e[1]-t.a[1])*n);if(l(e.a)>s||l(e.b)>s)return!1;const h=(e.a[0]-t.a[0])*n+(e.a[1]-t.a[1])*r,c=(e.b[0]-t.a[0])*n+(e.b[1]-t.a[1])*r;return Math.min(a,Math.max(h,c))-Math.max(0,Math.min(h,c))>s}(t,s,e))),o=i.map(t=>{const[e,s]=mh(t.a,t.b);return{a:e,b:s,key:`hidden|${fh(t,e,s)}`,sourceKind:t.kind,sourceId:t.id}}).sort((t,e)=>t.key.localeCompare(e.key)),a=i.flatMap(t=>[t.a,t.b].map((e,s)=>({point:[e[0],e[1]],key:`hidden|${gh(t)}|endpoint-${s}`,sourceKind:"partition",sourceId:t.id}))).sort((t,e)=>t.key.localeCompare(e.key));return{segments:o,endpoints:a}}function $h(t){const e=t.epsilon??dh,s=t.roomCuts||[],i=new Map;for(const e of t.partitionCuts||[]){if("string"!=typeof e.hostId||!e.hostId||!ph(e.a)||!ph(e.b))continue;const t=i.get(e.hostId)||[];t.push([e.a[0],e.a[1],e.b[0],e.b[1]]),i.set(e.hostId,t)}const o=[];for(const[e,i]of Et(t.space.rooms).entries())i.length<4||o.push({a:[i[0],i[1]],b:[i[2],i[3]],kind:"room",id:`room-edge-${e}`,cuts:s});for(const e of t.space.partitions||[])ph(e.a)&&ph(e.b)&&o.push({a:[e.a[0],e.a[1]],b:[e.b[0],e.b[1]],kind:"partition",id:e.id,cuts:i.get(e.id)||[]});const a=new Map,n=new Map;for(const t of o){const s=[t.a[0],t.a[1],t.b[0],t.b[1]],i=Ht([s],t.cuts,e);if(i.length){for(const s of i){if(s.length<4)continue;const[i,o]=mh([s[0],s[1]],[s[2],s[3]]);if(_h(i,o,e))continue;const n=`${uh(i)}|${uh(o)}`,r={a:i,b:o,key:fh(t,i,o),sourceKind:t.kind,sourceId:t.id},l=a.get(n);(!l||bh(r.sourceKind)vh(s,t,e)))continue;const t=uh(s);n.has(t)||n.set(t,{point:[s[0],s[1]],key:t})}}}return{segments:[...a.values()].sort((t,e)=>t.key.localeCompare(e.key)),endpoints:[...n.values()].sort((t,e)=>t.key.localeCompare(e.key))}}function wh(t,e,s){return e.some(e=>ph(e)&&_h(t,e,s))}function kh(t,e,s){if(!s)return!0;const i=t-s.distance;return i<-1e-9||Math.abs(i)<=1e-9&&e.localeCompare(s.key)<0}function xh(t,e,s){const i=s.epsilon??dh,o=s.excludePoints||[],a=[...t.endpoints,...(s.extraEndpoints||[]).filter(t=>ph(t.point)).map(t=>({point:[t.point[0],t.point[1]],key:t.key}))],n=new Map;for(const t of a){if(wh(t.point,o,i))continue;const e=uh(t.point),s=n.get(e);(!s||t.key.localeCompare(s.key)<0)&&n.set(e,t)}return[...n.values()].map(t=>({kind:"endpoint",point:[...t.point],key:t.key,distance:Math.hypot(e[0]-t.point[0],e[1]-t.point[1])})).filter(t=>t.distance<=s.tolerance).sort((t,e)=>t.distance-e.distance||t.key.localeCompare(e.key))}function Sh(t,e){if(!t.length)return null;if(e>0){const s=new Set;for(let i=0;i1)return{kind:"ambiguous",candidate:null,conflicts:t.filter(t=>s.has(t.key)).map(t=>({point:[...t.point],key:t.key}))}}return{kind:"resolved",candidate:t[0],conflicts:[]}}function Mh(t,e,s){const i=t.b[0]-t.a[0],o=t.b[1]-t.a[1],a=Math.hypot(i,o);if(!(a>0))return[...t.a];const n=i/a,r=o/a,l=Math.max(0,Math.min(a,(e[0]-t.a[0])*n+(e[1]-t.a[1])*r)),h=s>0?Math.max(0,Math.min(a,Math.round(l/s)*s)):l;return[t.a[0]+n*h,t.a[1]+r*h]}function Ch(t,e,s){if(!(ph(e)&&ph(s.anchor)&&s.tolerance>=0))return{kind:"none",candidate:null,conflicts:[]};const i=s.epsilon??dh,o=function(t,e){const s=e[0]-t[0],i=e[1]-t[1];if(!(Math.hypot(s,i)>Number.EPSILON))return null;const o=Math.round(Math.atan2(i,s)/(Math.PI/4))*(Math.PI/4);return[Math.cos(o),Math.sin(o)]}(s.anchor,e);if(!o)return{kind:"none",candidate:null,conflicts:[]};const a=xh(t,e,s).filter(t=>function(t,e,s,i){const o=t[0]-e[0],a=t[1]-e[1];return o*s[0]+a*s[1]>i&&Math.abs(o*s[1]-a*s[0])<=i*Math.max(Math.hypot(o,a),1)}(t.point,s.anchor,o,i)),n=Sh(a,s.distinguishTolerance||0);if(n)return n;let r=null;for(const a of t.segments){const t=a.b[0]-a.a[0],n=a.b[1]-a.a[1],l=a.a[0]-s.anchor[0],h=a.a[1]-s.anchor[1],c=o[0]*n-o[1]*t;let d=null;if(Math.abs(c)<=i*Math.max(Math.hypot(t,n),1)){if(Math.abs(l*o[1]-h*o[0])>i*Math.max(Math.hypot(l,h),1))continue;const t=[a.a,a.b].map(t=>({point:t,along:(t[0]-s.anchor[0])*o[0]+(t[1]-s.anchor[1])*o[1]})).filter(t=>t.along>i).sort((t,e)=>t.along-e.along);t.length&&(d=[...t[0].point])}else{const e=(l*n-h*t)/c,a=(l*o[1]-h*o[0])/c;e>i&&a>=-i&&a<=1+i&&(d=[s.anchor[0]+o[0]*e,s.anchor[1]+o[1]*e])}if(!d)continue;const p=Math.hypot(e[0]-d[0],e[1]-d[1]);p>s.tolerance||wh(d,s.excludePoints||[],i)||!kh(p,a.key,r)||(r={kind:"line",point:d,key:a.key,distance:p,segment:a})}return r?{kind:"resolved",candidate:r,conflicts:[]}:{kind:"none",candidate:null,conflicts:[]}}const Ph=.001;function Dh(t,e,s,i){const o=Number.isFinite(t)&&t>0?Math.floor(t):0,a=t=>"number"==typeof t&&Number.isFinite(t)&&t>=0?t:null,n=a(s),r=a(i)??0,l=[];let h=null;for(let t=0;t=2&&Number.isFinite(t[0])&&Number.isFinite(t[1])}function Th(t,e,s,i){return t*i-e*s}function zh(t){let e=0;for(let s=0;st.localeCompare(e)),e[0]}function Eh(t,e,s){const i=[...t];for(let t=!0;t&&i.length>=3;){t=!1;for(let o=0;o=0){i.splice(o,1),t=!0;break}}}return i}function Hh(t,e){const s=t.map(t=>Math.max(0,Math.min(1,t))).sort((t,e)=>t-e),i=[];for(const t of s)(!i.length||Math.abs(t-i[i.length-1])>e)&&i.push(t);return i}function Oh(t,e){return[t.a[0]+(t.b[0]-t.a[0])*e,t.a[1]+(t.b[1]-t.a[1])*e]}function Lh(t,e,s){const i=function(t,e){const s=e.b[0]-e.a[0],i=e.b[1]-e.a[1],o=s*s+i*i;return o>0?((t[0]-e.a[0])*s+(t[1]-e.a[1])*i)/o:0}(t,e);if(i<-s||i>1+s)return null;const o=Oh(e,i);return Math.hypot(o[0]-t[0],o[1]-t[1])<=s?Math.max(0,Math.min(1,i)):null}function Bh(t,e,s,i,o){const a=t.b[0]-t.a[0],n=t.b[1]-t.a[1],r=e.b[0]-e.a[0],l=e.b[1]-e.a[1],h=e.a[0]-t.a[0],c=e.a[1]-t.a[1],d=Th(a,n,r,l),p=Math.max(Math.hypot(a,n),Math.hypot(r,l),1);if(Math.abs(d)>o*p){const t=Th(h,c,r,l)/d,e=Th(h,c,a,n)/d;return void(t>=-o&&t<=1+o&&e>=-o&&e<=1+o&&(s.push(Math.max(0,Math.min(1,t))),i.push(Math.max(0,Math.min(1,e)))))}if(!(Math.abs(Th(h,c,a,n))>o*p)){for(const i of[e.a,e.b]){const e=Lh(i,t,o);null!=e&&s.push(e)}for(const s of[t.a,t.b]){const t=Lh(s,e,o);null!=t&&i.push(t)}}}function Wh(t){let e=t+1|0;return e^=e<<13,e^=e>>>17,e^=e<<5,e>>>0}function jh(t,e){return t.minY-e.minY||t.index-e.index}function Gh(t){return t.subtreeMaxY=Math.max(t.item.maxY,t.left?.subtreeMaxY??-1/0,t.right?.subtreeMaxY??-1/0),t}function qh(t){const e=t.right;return t.right=e.left,e.left=Gh(t),Gh(e)}function Uh(t){const e=t.left;return t.left=e.right,e.right=Gh(t),Gh(e)}function Kh(t,e){return t?(jh(e,t.item)<0?(t.left=Kh(t.left,e),t.left.priority0)t.right=Vh(t.right,e);else{if(!t.left)return t.right;if(!t.right)return t.left;t.left.priority=e&&Jh(t.left,e,s,i),t.item.minY<=s&&t.item.maxY>=e&&i.push(t.item),t.item.minY<=s&&Jh(t.right,e,s,i))}function Yh(t,e=.001){const s=Number.isFinite(e)&&e>0?e:Ph,i=t.filter(t=>Ih(t.a)&&Ih(t.b)&&"string"==typeof t.key&&t.key.length>0&&Math.hypot(t.b[0]-t.a[0],t.b[1]-t.a[1])>s),o=i.map(()=>[0,1]);!function(t,e,s){const i=t.map((t,e)=>({index:e,minX:Math.min(t.a[0],t.b[0])-s,maxX:Math.max(t.a[0],t.b[0])+s,minY:Math.min(t.a[1],t.b[1])-s,maxY:Math.max(t.a[1],t.b[1])+s})),o=[...i].sort((t,e)=>t.minX-e.minX||t.minY-e.minY||t.index-e.index),a=[...i].sort((t,e)=>t.maxX-e.maxX||t.index-e.index),n=new Set;let r=null,l=0;for(const i of o){for(;lt.index-e.index);for(const a of o)Bh(t[a.index],t[i.index],e[a.index],e[i.index],s);n.add(i.index),r=Kh(r,i)}}(i,o,s);const a=new Map;for(let t=0;t({key:t,a:e.a,b:e.b,sourceKeys:[...e.sourceKeys].sort((t,e)=>t.localeCompare(e))})).sort((t,e)=>t.key.localeCompare(e.key))}function Xh(t,e=.001){const s=Number.isFinite(e)&&e>0?e:Ph,i=Yh(t,s),o=new Map,a=new Map,n=new Map(i.map(t=>[t.key,t]));for(const t of i){const e=Ah(t.a,s),i=Ah(t.b,s);o.set(e,t.a),o.set(i,t.b),a.has(e)||a.set(e,new Set),a.has(i)||a.set(i,new Set),a.get(e).add(i),a.get(i).add(e)}const r=new Map;for(const[t,e]of a){const s=o.get(t);r.set(t,[...e].sort((t,e)=>{const i=o.get(t),a=o.get(e);return Math.atan2(i[1]-s[1],i[0]-s[0])-Math.atan2(a[1]-s[1],a[0]-s[0])||t.localeCompare(e)}))}const l=new Set,h=new Map,c=(t,e)=>`${t}>${e}`;for(const t of i){const e=[Ah(t.a,s),Ah(t.b,s)];for(const[t,a]of[e,[e[1],e[0]]]){if(l.has(c(t,a)))continue;const e=[],d=[];let p=t,u=a,_=!1;for(let s=0;s<=2*i.length+2;s++){const s=c(p,u);if(l.has(s)){_=p===t&&u===a;break}l.add(s),e.push(p),d.push(Fh(p,u));const i=r.get(u)||[],o=i.indexOf(p);if(o<0||!i.length)break;if(p=u,u=i[(o-1+i.length)%i.length],p===t&&u===a){_=!0;break}}if(!_||new Set(e).size<3||new Set(e).size!==e.length)continue;const m=e.map(t=>o.get(t)),g=zh(m);if(!(g>s*s))continue;const f=Nh(Eh(e,o,s)),b=new Set;for(const t of d)for(const e of n.get(t)?.sourceKeys||[])b.add(e);const v={ring:m,key:f,area:g,atomKeys:[...d],sourceKeys:[...b].sort((t,e)=>t.localeCompare(e))};h.has(f)||h.set(f,v)}}return{atoms:i,faces:[...h.values()].sort((t,e)=>t.area-e.area||t.key.localeCompare(e.key))}}function Zh(t,e,s=.001){if(!Ih(e))return null;const i=t.faces.filter(t=>{if(t.ring.some((i,o)=>function(t,e,s,i){const o=s[0]-e[0],a=s[1]-e[1],n=o*o+a*a;if(!(n>0))return Math.hypot(t[0]-e[0],t[1]-e[1])<=i;const r=((t[0]-e[0])*o+(t[1]-e[1])*a)/n;return!(r<0||r>1)&&Math.hypot(e[0]+o*r-t[0],e[1]+a*r-t[1])<=i}(e,i,t.ring[(o+1)%t.ring.length],s)))return!1;let i=!1;for(let s=0,o=t.ring.length-1;se[1]!=n[1]>e[1]&&e[0]<(n[0]-a[0])*(e[1]-a[1])/(n[1]-a[1])+a[0]&&(i=!i)}return i});return[...i].sort((t,e)=>t.area-e.area||t.key.localeCompare(e.key))[0]||null}function Qh(t,e,s){const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o,n=a>0?Math.max(0,Math.min(1,((t[0]-e[0])*i+(t[1]-e[1])*o)/a)):0;return Math.hypot(e[0]+i*n-t[0],e[1]+o*n-t[1])}function tc(t,e,s=.5){let i=Math.abs(t-e)%180;return i>90&&(i=180-i),i<=s}function ec(t,e,s,i){const o=t.filter(t=>"outer"===t.kind&&!t.open&&t.cm>0).map(t=>({interval:t,reusePartitionId:e.find(e=>function(t,e,s){return!(Math.abs(t.cm-e.cm)>1e-6)&&(tc(180*Math.atan2(t.b[1]-t.a[1],t.b[0]-t.a[0])/Math.PI,180*Math.atan2(e.b[1]-e.a[1],e.b[0]-e.a[0])/Math.PI,.001)&&Qh(e.a,t.a,t.b)<=s&&Qh(e.b,t.a,t.b)<=s)}(e,t,i))?.id||null})),a=new Map;for(const e of s){if("partition"===e.host?.kind)continue;const s=t.map(t=>{const s=180*Math.atan2(t.b[1]-t.a[1],t.b[0]-t.a[0])/Math.PI;return{interval:t,distance:tc(e.angle,s)?Qh([e.x,e.y],t.a,t.b):1/0}}).filter(t=>t.distance<=i).sort((t,e)=>t.distance-e.distance||t.interval.key.localeCompare(e.interval.key)),o=s[0]?.interval;"outer"===o?.kind&&!o.open&&o.cm>0&&a.set(e.id,o.key)}return{materialize:o,openingIntervals:a,removeOpeningIds:[...a.keys()].sort((t,e)=>t.localeCompare(e))}}function sc(t,e){const s=e.b[0]-e.a[0],i=e.b[1]-e.a[1],o=s*s+i*i;return o>0?Math.max(0,Math.min(1,((t[0]-e.a[0])*s+(t[1]-e.a[1])*i)/o)):0}const ic=t=>!t.key.startsWith("static:room|");function oc(t,e){const s=e.b[0]-e.a[0],i=e.b[1]-e.a[1],o=s*s+i*i;if(!(o>0))return null;const a=((t[0]-e.a[0])*s+(t[1]-e.a[1])*i)/o,n=[e.a[0]+s*a,e.a[1]+i*a];return{point:n,t:a,distance:Math.hypot(n[0]-t[0],n[1]-t[1])}}function ac(t,e){return e>0?Math.hypot(t[0]-Math.round(t[0]/e)*e,t[1]-Math.round(t[1]/e)*e):0}function nc(t,e,s){if(ic(t.source)!==ic(e.source))return ic(t.source)?t:e;const i=ac(t.point,s),o=ac(e.point,s);return Math.abs(i-o)>1e-9?i>o?t:e:function(t,e){return t[0]-e[0]||t[1]-e[1]}(t.point,e.point)>0?t:e}function rc(t){return[t.from[0],t.from[1],t.to[0],t.to[1],t.targetKind].map(t=>"number"==typeof t?t.toFixed(6):t).join("|")}function lc(t,e){return t.map(t=>t.key!==e.sourceKey?t:{...t,[e.endpoint]:[...e.to]})}function hc(t,e){const s=e.epsilon??.001;if(!(e.maxDistance>=0)||!e.point&&!e.requiredSourceKey)return{kind:"none"};const i=new Map,o=t.flatMap(t=>[{source:t,endpoint:"a",point:t.a},{source:t,endpoint:"b",point:t.b}]);for(let t=0;ts)||l>e.maxDistance)continue;const h=nc(n,r,e.gridStep||0),c=h===n?r:n;if(!ic(h.source))continue;const d={sourceKey:h.source.key,endpoint:h.endpoint,from:[h.point[0],h.point[1]],to:[c.point[0],c.point[1]],targetSourceKey:c.source.key,targetKind:"endpoint",distance:l};i.set(rc(d),d)}for(const a of o)if(ic(a.source))for(const o of t){if(o===a.source)continue;const t=oc(a.point,o);if(!t||t.t<=s||t.t>=1-s||!(t.distance>s)||t.distance>e.maxDistance)continue;const n={sourceKey:a.source.key,endpoint:a.endpoint,from:[a.point[0],a.point[1]],to:t.point,targetSourceKey:o.key,targetKind:"line",distance:t.distance};i.set(rc(n),n)}const a=[];for(const o of i.values()){const i=Xh(lc(t,o),s),n=e.point?Zh(i,e.point,s):i.faces.find(t=>!e.requiredSourceKey||t.sourceKeys.includes(e.requiredSourceKey))||null;n&&a.push({proposal:o,face:n})}if(a.sort((t,e)=>t.proposal.distance-e.proposal.distance||rc(t.proposal).localeCompare(rc(e.proposal))),!a.length)return{kind:"none"};return new Set(a.map(t=>`${rc(t.proposal)}|${t.face.key}`)).size>1?{kind:"ambiguous",proposals:a.map(t=>t.proposal)}:{kind:"repair",...a[0]}}const cc=(t,e)=>(t.composedPath?.()||[t.target]).some(t=>(t=>!!t&&"function"==typeof t.matches)(t)&&e(t));class dc{constructor(t){this.host=t,this._openGroupId=null,this._groupGeneration=0,this._renderedContext="",this._focusOwned=!1,this._currentModel=null,this._blocked=!1,this._dismissPointerTarget=null,this._globalDismissListening=!1,this._globalDismissGuard=t=>{this.handleOutsideDismiss(t)}}get hasOpenGroup(){return null!==this._openGroupId}get groupGeneration(){return this._groupGeneration}activeGroup(t){return this._openGroupId&&t.find(t=>t.id===this._openGroupId)||null}reset(){this._openGroupId=null,this._contentAnimation?.cancel(),this._contentAnimation=void 0,this._renderedContext="",this._focusOwned=!1,this._currentModel=null,this._blocked=!1,this._dismissPointerTarget=null,clearTimeout(this._dismissTimer),this._dismissTimer=void 0,this._syncGlobalDismissListener()}closeForNavigation(){const t="palette"===this._currentModel?.kind?this._currentModel.dismiss:void 0,e=!!this._openGroupId||!!t;this._openGroupId=null,t?.(),t&&(this._currentModel=null),this._clearDismissClick(),e&&this.host.requestUpdate(),this._syncGlobalDismissListener()}openPalette(){this._openGroupId&&this.closeGroup(!1)}toggleGroup(t,e){this._openGroupId!==e?t.some(t=>t.id===e)&&("palette"===this._currentModel?.kind&&this._currentModel.dismiss?.(),this._groupGeneration+=1,this._openGroupId=e,this.host.clearTip(),this.host.requestUpdate(),this._syncGlobalDismissListener()):this.closeGroup(!1)}closeGroup(t){const e=this._openGroupId;this._openGroupId=null,this.host.requestUpdate(),this._syncGlobalDismissListener(),t&&e&&this.host.updateComplete().then(()=>{const t=this.host.root(),s=[...t.querySelectorAll("[data-editor-group]")].find(t=>t.dataset.editorGroup===e&&null!==t.offsetParent);(s||t.querySelector(".editbar-tools"))?.focus?.()})}renderGroupLauncher(t,e,s){const i=this._openGroupId===t.id,o=t.items.find(e=>e.id===t.activeItemId&&!e.disabled);return h``}renderGroupModel(t,e,s){const i=t.items.find(t=>!t.disabled)?.id,o=t.items.some(e=>e.id===t.activeItemId&&!e.disabled)?t.activeItemId:void 0;return{contextId:e,kind:"group",launcherId:t.id,ariaLabel:s.openGroup(t.label),visibleLabel:t.label,content:h`
    `}renderGroupModel(t,e,s){const i=t.items.find(t=>!t.disabled)?.id,o=t.items.some(e=>e.id===t.activeItemId&&!e.disabled)?t.activeItemId:void 0;return{contextId:e,kind:"group",launcherId:t.id,ariaLabel:s.openGroup(t.label),visibleLabel:t.label,content:p`
    this._groupKeydown(t)}> - ${t.items.map(e=>h``)} -
    `}}runContext(t,e,s){if(t===e)return s()}render(t,e){this._currentModel=t,this._blocked=e;const s=t?.kind||"hidden";return h`
    `}}runContext(t,e,s){if(t===e)return s()}render(t,e){this._currentModel=t,this._blocked=e;const s=t?.kind||"hidden";return p`
    -
    `}afterRender(){const t=this.host.root();this._blocked&&(this._openGroupId?this.closeGroup(!1):"palette"===this._currentModel?.kind&&this._currentModel.dismiss?.()),this._syncGlobalDismissListener();const e=t.querySelector(".editor-secondary"),s=this._renderedContext,i=e?.dataset.contextId||"";if(i&&s&&i!==s&&!window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches&&(this._contentAnimation?.cancel(),this._contentAnimation=e?.querySelector(".editor-secondary-content")?.animate([{opacity:.35,transform:"translateY(-4px)"},{opacity:1,transform:"translateY(0)"}],{duration:100,easing:"ease-out"})),this._renderedContext=i,s&&i!==s&&this._focusOwned){const s=i?e?.querySelector('[tabindex="0"], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'):t.querySelector(".editbar-tools");s?.focus?.(),this._focusOwned=!!i}if("palette"===this._currentModel?.kind&&this._currentModel.launcherId){const e=[...t.querySelectorAll("[data-editor-palette]")].find(t=>t.dataset.editorPalette===this._currentModel?.launcherId);e&&null!==e.offsetParent||this._currentModel.dismiss?.()}if(!this._openGroupId)return;const o=[...t.querySelectorAll("[data-editor-group]")].find(t=>t.dataset.editorGroup===this._openGroupId);o&&null!==o.offsetParent||this.closeGroup(!0)}handleOutsideDismiss(t){if(cc(t,t=>t.hasAttribute("data-editor-navigation")))return"pointerdown"===t.type?this.closeForNavigation():"click"===t.type&&this._dismissPointerTarget&&this._clearDismissClick(),!1;if("click"===t.type&&this._dismissPointerTarget){return!!(t.composedPath?.()||[t.target]).includes(this._dismissPointerTarget)&&(this._clearDismissClick(),t.preventDefault(),t.stopImmediatePropagation(),!0)}const e=this._openGroupId||this._blocked||"palette"!==this._currentModel?.kind?null:this._currentModel;if("pointerdown"===t.type&&(this._openGroupId||e)){const s=cc(t,t=>t.classList.contains("editor-secondary")),i=cc(t,t=>!!t.dataset.editorGroup),o=cc(t,t=>!!t.dataset.editorPalette),a=cc(t,t=>t.classList.contains("stage"));if(!(s||i||o||"stay-open-on-canvas"===e?.dismissPolicy&&a))return t.preventDefault(),t.stopImmediatePropagation(),this._dismissPointerTarget=t.target,clearTimeout(this._dismissTimer),this._dismissTimer=window.setTimeout(()=>{this._clearDismissClick()},800),this._openGroupId?this.closeGroup(!1):e?.dismiss?.(),this._syncGlobalDismissListener(),!0}return!1}_activateGroupItem(t,e,s){if(t.id!==this._openGroupId)return;const i=t.items.find(t=>t.id===e);if(!i||i.disabled)return;const o="toggle"===i.role&&"stay-open"===i.closePolicy,a=0===s.detail;o||(this._openGroupId=null,this.host.requestUpdate(),this._syncGlobalDismissListener()),i.invoke(),!o&&a&&this.host.updateComplete().then(()=>{const e=[...this.host.root().querySelectorAll("[data-editor-group]")].find(e=>e.dataset.editorGroup===t.id&&null!==e.offsetParent);e?.focus()})}_groupKeydown(t){if(!["ArrowLeft","ArrowRight","Home","End"].includes(t.key))return;const e=[...t.currentTarget.querySelectorAll(".editor-group-item:not([disabled])")];if(!e.length)return;t.preventDefault();const s=e.indexOf(this.host.root().activeElement),i="Home"===t.key?0:"End"===t.key?e.length-1:"ArrowLeft"===t.key?s<=0?e.length-1:s-1:(s+1)%e.length;e[i]?.focus()}_clearDismissClick(){this._dismissPointerTarget=null,clearTimeout(this._dismissTimer),this._dismissTimer=void 0,this._syncGlobalDismissListener()}_syncGlobalDismissListener(){const t=!this._blocked&&"palette"===this._currentModel?.kind,e=!!this._openGroupId||t||!!this._dismissPointerTarget;e!==this._globalDismissListening&&(this._globalDismissListening=e,e?(window.addEventListener("pointerdown",this._globalDismissGuard,!0),window.addEventListener("click",this._globalDismissGuard,!0)):(window.removeEventListener("pointerdown",this._globalDismissGuard,!0),window.removeEventListener("click",this._globalDismissGuard,!0)))}}const pc=t=>t.stopPropagation(),uc=new WeakSet,_c=t=>{t._regSignature="",t._maybeRebuildDevices(),t.requestUpdate()};async function mc(t,e,s,i,o,a=""){const n=t.host,r=n._serverCfg;if(!r)return!1;let l=JSON.parse(JSON.stringify(r));l.markers=l.markers||[];let h=l.markers.find(t=>t.id===e);if(!h){const t=n._devices.find(t=>t.id===e);if(!t||"device"!==t.bindingKind&&"entity"!==t.bindingKind||!t.bindingRef)return!1;h={id:t.id,binding:`${t.bindingKind}:${t.bindingRef}`,space:t.space||null,area:t.area||null,hidden:!!t.hidden},l.markers.push(h)}h.vacuum=function(t,e){const s=e.matrix.map(t=>Number(t.toFixed(6))),i=t?.map_routes;if(Array.isArray(i)&&i.length){const o=i.find(t=>t.id===e.routeId)||i.find(t=>t.source===e.source&&t.map_id===e.mapId);if(o)return{...t,map_routes:Ro(i,o.id,s)}}return{...t,source:e.source,calibration:{...t?.calibration||{},[e.mapId]:s}}}(h.vacuum||{},{source:s,mapId:i,routeId:a,matrix:o}),l=t._prepareConfigCandidate(l);const c=n._adoption.beginOptimistic(r,l);n._adoption.stageLocalConfig(l),_c(n),n._saveConfigDebounced.pending()&&n._saveConfigDebounced.cancel();try{return await t._saveConfigNow(c),!0}catch(t){return n._rollbackOptimistic(c),_c(n),n._showToast(n._t("toast.cfg_save_failed",{err:n._errText(t)})),!1}}function gc(t){return 1===t}function fc(t){return`${t}-${globalThis.crypto?.randomUUID?.()??`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function bc(t){const e=function(t){return JSON.stringify({message:t.message.trim(),contact:t.contact.trim(),previewToken:t.attach&&t.preview?t.preview.token:""})}(t);return{idempotencyKey:t.submissionFingerprint&&t.submissionFingerprint!==e?fc("report"):t.idempotencyKey,fingerprint:e}}function vc(t){return[...t].length}function yc(t,e=Date.now()){const s=t.message.trim();return s?vc(s)>1e4?"message_too_long":vc(t.contact.trim())>320?"contact_too_long":t.attach&&!t.preview?"preview_missing":t.attach&&t.preview.expiresAt<=e?"preview_expired":null:"message_required"}function $c(t,e=Date.now()){return"building"!==t.status&&"sending"!==t.status&&"success"!==t.status&&null===yc(t,e)}function wc(t){const e=function(t){const e=/Firefox\/(\d+)/i.exec(t);if(e)return{family:"firefox",major:Number(e[1])||0};const s=/(?:Chrome|Chromium|Edg)\/(\d+)/i.exec(t);if(s)return{family:"chromium",major:Number(s[1])||0};const i=/Version\/(\d+).+Safari\//i.exec(t);return i?{family:"webkit",major:Number(i[1])||0}:{family:"unknown",major:0}}(t.userAgent??globalThis.navigator?.userAgent??""),s=t.now??Date.now(),i=Number(t.registryLastSuccess||0),o=i<=0?"unknown":s-i<=6e5?"fresh":"stale",a=["en","ru","de","fr"].includes(t.language)?t.language:"en",n=globalThis.matchMedia?.bind(globalThis);return{browser_family:e.family,browser_major:Math.max(0,Math.min(999,e.major)),language:a,coarse_pointer:t.coarsePointer??!!n?.("(pointer: coarse)").matches,hover_capable:t.hoverCapable??!!n?.("(hover: hover)").matches,registry_access:"full"===t.registryAccess?"full":"limited"===t.registryAccess?"partial":"unavailable",registry_age_bucket:o}}function kc(t){const e=t&&"object"==typeof t&&"code"in t?String(t.code||""):"";return new Set(["support_invalid_message","support_preview_expired","support_package_too_large","support_rate_limited","support_unavailable","support_rejected","unauthorized"]).has(e)?e:"support_unavailable"}const xc=[{id:"air_conditioner",group:"appliance",art:{d:"M20.5 39h69a2.5 2.5 0 0 1 2.5 2.5V69a2.5 2.5 0 0 1-2.5 2.5h-69A2.5 2.5 0 0 1 18 69V41.5a2.5 2.5 0 0 1 2.5-2.5 M25 63a2.5 2.5 0 0 1 2.5-2.5h55A2.5 2.5 0 0 1 85 63v8.5H25z M25 63a2.5 2.5 0 0 1 2.5-2.5h55A2.5 2.5 0 0 1 85 63v3.5H25z",viewW:110,viewH:110}},{id:"armchair",group:"furniture",art:{d:"M42.5 29h25a10 10 0 0 1 10 10v26.5a10 10 0 0 1-10 10h-25a10 10 0 0 1-10-10V39a10 10 0 0 1 10-10 M77.5 48.5a6 6 0 0 1 2 11.657V71.5a4 4 0 0 1-4 4H34a4 4 0 0 1-4-4V60.157A6.001 6.001 0 0 1 32 48.5a6 6 0 0 1 5.419 3.424A4 4 0 0 1 38 54v7h33.5v-6.5q0-.107.005-.213A6 6 0 0 1 77.5 48.5 M42.75 57h24.5A4.75 4.75 0 0 1 72 61.75a4.75 4.75 0 0 1-4.75 4.75h-24.5A4.75 4.75 0 0 1 38 61.75 4.75 4.75 0 0 1 42.75 57M36.5 75.5h8l-1.674 5.441A1.5 1.5 0 0 1 41.392 82H38a1.5 1.5 0 0 1-1.5-1.5zm36 0h-8l1.674 5.441A1.5 1.5 0 0 0 67.608 82H71a1.5 1.5 0 0 0 1.5-1.5z",viewW:110,viewH:110}},{id:"bathtub",group:"sanitary",art:{d:"M28 75h8l-1.674 5.441a1.5 1.5 0 0 1-1.434 1.059H29.5A1.5 1.5 0 0 1 28 80zm53 0h-8l1.674 5.441a1.5 1.5 0 0 0 1.434 1.059H79.5A1.5 1.5 0 0 0 81 80zM19.5 46.5H90a2.5 2.5 0 0 1 2.5 2.5 2.5 2.5 0 0 1-2.5 2.5H19.5A2.5 2.5 0 0 1 17 49a2.5 2.5 0 0 1 2.5-2.5 M19.5 51.5H90L86.633 68a10 10 0 0 1-9.798 8h-44.17a10 10 0 0 1-9.798-8zM30 36v-2a5 5 0 1 0-10 0v12.5",viewW:110,viewH:110}},{id:"bed",group:"furniture",art:{d:"M16 75.5h8l-1.674 5.441A1.5 1.5 0 0 1 20.892 82H17.5a1.5 1.5 0 0 1-1.5-1.5zm78.5 0h-8l1.674 5.441A1.5 1.5 0 0 0 89.608 82H93a1.5 1.5 0 0 0 1.5-1.5zM25 29h60.5a2.5 2.5 0 0 1 2.5 2.5V68a2.5 2.5 0 0 1-2.5 2.5H25a2.5 2.5 0 0 1-2.5-2.5V31.5A2.5 2.5 0 0 1 25 29 M16 59.5c0-5.523 4.477-10 10-10h58.5c5.523 0 10 4.477 10 10v6H16zm-1 6h80.5a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1m15.5-20a5 5 0 0 1 5-5h11a5 5 0 0 1 5 5v4h-21zm28.5 0a5 5 0 0 1 5-5h11a5 5 0 0 1 5 5v4H59z",viewW:110,viewH:110}},{id:"bidet",group:"sanitary",art:{d:"M36 57.5c0 5.523 4.477 10 10 10h18.5c5.523 0 10-4.477 10-10V53H36zm8.5 22a1 1 0 0 0 1 1H65a1 1 0 0 0 1-1v-12H44.5zm-8.5-32a1 1 0 0 1 1-1h36.5a1 1 0 0 1 1 1V53H36zM50.5 41a1 1 0 0 1 1-1H59a1 1 0 0 1 1 1v5.5h-9.5zM53 30a1 1 0 0 1 1-1h2.5a1 1 0 0 1 1 1v10H53zm-4 6a1 1 0 0 1-1-1v-2.5a1 1 0 0 1 1-1h4V36z",viewW:110,viewH:110}},{id:"boiler",group:"appliance",art:{d:"M46.5 81.5h5V86a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1zm12.5 0h5V86a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1zM44 23h22.5a8 8 0 0 1 8 8v42.5a8 8 0 0 1-8 8H44a8 8 0 0 1-8-8V31a8 8 0 0 1 8-8 M36 31a8 8 0 0 1 8-8h22.5a8 8 0 0 1 8 8v42H36z M48.5 42.5a7 7 0 1 0 14 0 7 7 0 1 0-14 0m6.5 0 3.5-3.5",viewW:110,viewH:110}},{id:"chair",group:"furniture",art:{d:"M40.5 39.5C40.5 32.596 46.096 27 53 27h4c6.904 0 12.5 5.596 12.5 12.5v13a5 5 0 0 1-5 5h-19a5 5 0 0 1-5-5z M41.25 54h27.5A3.25 3.25 0 0 1 72 57.25a3.25 3.25 0 0 1-3.25 3.25h-27.5A3.25 3.25 0 0 1 38 57.25 3.25 3.25 0 0 1 41.25 54m28.25 6.5H64l1.88 21.63a1.5 1.5 0 0 0 1.495 1.37H68a1.5 1.5 0 0 0 1.5-1.5zm-29 0H46l-1.88 21.63a1.5 1.5 0 0 1-1.495 1.37H42a1.5 1.5 0 0 1-1.5-1.5z",viewW:110,viewH:110}},{id:"coffee_table",group:"furniture",art:{d:"M25 51h5.238l-1.534 15.646A1.5 1.5 0 0 1 27.211 68H26.5a1.5 1.5 0 0 1-1.5-1.5zm60.238 0H80l1.534 15.646A1.5 1.5 0 0 0 83.027 68h.711a1.5 1.5 0 0 0 1.5-1.5z M24.34 43.485A2.5 2.5 0 0 1 26.625 42h56.75a2.5 2.5 0 0 1 2.285 1.485l2.715 6.109A1 1 0 0 1 87.461 51H22.54a1 1 0 0 1-.914-1.406z M87.5 51h-66v3a1 1 0 0 0 1 1h64a1 1 0 0 0 1-1z",viewW:110,viewH:110}},{id:"computer",group:"appliance",art:{d:"M24.5 38h40a2.5 2.5 0 0 1 2.5 2.5v22a2.5 2.5 0 0 1-2.5 2.5h-40a2.5 2.5 0 0 1-2.5-2.5v-22a2.5 2.5 0 0 1 2.5-2.5m50 0h11a2.5 2.5 0 0 1 2.5 2.5v29a2.5 2.5 0 0 1-2.5 2.5h-11a2.5 2.5 0 0 1-2.5-2.5v-29a2.5 2.5 0 0 1 2.5-2.5M43 65h5v7h-5zm-6 7h16m23-12h8m-8-17h8 M35 56V46h5m-5 7h5 M39.5 53a3.5 3.5 0 1 0 0-7m15.036 8.536a5 5 0 1 1 0-7.071",viewW:110,viewH:110}},{id:"cooktop",group:"appliance",art:{d:"M27.5 29h55a2.5 2.5 0 0 1 2.5 2.5v47a2.5 2.5 0 0 1-2.5 2.5h-55a2.5 2.5 0 0 1-2.5-2.5v-47a2.5 2.5 0 0 1 2.5-2.5 M33.5 66.5a8 8 0 1 0 16 0 8 8 0 1 0-16 0m26.5-23a8 8 0 1 0 16 0 8 8 0 1 0-16 0m3 23a5 5 0 1 0 10 0 5 5 0 1 0-10 0m-29.5-23a8 8 0 1 0 16 0 8 8 0 1 0-16 0",viewW:110,viewH:110}},{id:"dining_table",group:"furniture",art:{d:"M83.5 43H78l6.742 30.82A1.5 1.5 0 0 0 86.207 75h.54a1.5 1.5 0 0 0 1.482-1.732zm-56 0H33l-6.742 30.82A1.5 1.5 0 0 1 24.793 75h-.54a1.5 1.5 0 0 1-1.482-1.732zm-2.62-7.406A2.5 2.5 0 0 1 27.21 34h56.58a2.5 2.5 0 0 1 2.33 1.594l2.35 6.044A1 1 0 0 1 87.538 43H23.462a1 1 0 0 1-.932-1.362z M88.5 43h-66v3a1 1 0 0 0 1 1h64a1 1 0 0 0 1-1z",viewW:110,viewH:110}},{id:"dishwasher",group:"appliance",art:{d:"M31.5 25h47a2.5 2.5 0 0 1 2.5 2.5v55a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5v-55a2.5 2.5 0 0 1 2.5-2.5 M31.5 37.5h47A2.5 2.5 0 0 1 81 40v36a2.5 2.5 0 0 1-2.5 2.5h-47A2.5 2.5 0 0 1 29 76V40a2.5 2.5 0 0 1 2.5-2.5M43 42h24m-1.5-11a2 2 0 1 0 4 0 2 2 0 1 0-4 0m7.5 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-37.25 0h9.5",viewW:110,viewH:110}},{id:"dryer",group:"appliance",art:{d:"M31.5 25h47a2.5 2.5 0 0 1 2.5 2.5v55a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5v-55a2.5 2.5 0 0 1 2.5-2.5 M31.5 37.5h47A2.5 2.5 0 0 1 81 40v42.5a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5V40a2.5 2.5 0 0 1 2.5-2.5 M38 60.5a17 17 0 1 0 34 0 17 17 0 1 0-34 0 M43.5 60.5a11.5 11.5 0 1 0 23 0 11.5 11.5 0 1 0-23 0m22-29.5a2 2 0 1 0 4 0 2 2 0 1 0-4 0m7.5 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-37.25 0h9.5 M55.994 55.5s-1.329 1.81-1.479 3.143c-.198 1.761 1.599 2.554 1.48 4.321-.1 1.479-1.48 3.536-1.48 3.536m5.979-11s-1.329 1.81-1.479 3.143c-.198 1.761 1.599 2.554 1.48 4.321-.1 1.479-1.48 3.536-1.48 3.536m-8.519-11s-.886 1.81-.986 3.143c-.132 1.761 1.066 2.554.986 4.321-.067 1.479-.986 3.536-.986 3.536",viewW:110,viewH:110}},{id:"exercise",group:"other",art:{d:"m60.752 62.03-5.379-2.312 11.066-25.75a1.5 1.5 0 0 1 1.97-.786l2.624 1.127a1.5 1.5 0 0 1 .786 1.97zm-18.648-4.512-4.353 1.189-4.474-16.382a1.5 1.5 0 0 1 1.052-1.842l1.459-.398a1.5 1.5 0 0 1 1.842 1.052z M41.297 38.173a2.215 2.215 0 0 1 0 4.43H29.781a2.215 2.215 0 0 1 0-4.43zm33.219 38.091a2.657 2.657 0 1 1 0 5.315H28.453a2.657 2.657 0 1 1 0-5.315zm8.641-51.366a1.795 1.795 0 0 1 .68 2.41l-3.03 5.59a5 5 0 0 1-4.396 2.618H65.657a1.772 1.772 0 1 1 0-3.544h9.61a3 3 0 0 0 2.598-1.5l2.84-4.917a1.795 1.795 0 0 1 2.452-.657M29.339 65.787c0-6.699 6.457-11.503 12.873-9.579l24.291 7.288a10 10 0 0 1 7.127 9.578v3.19H29.339zm0 15.852h7.086l-1.394 3.486a1.5 1.5 0 0 1-1.393.943h-2.8a1.5 1.5 0 0 1-1.5-1.5zm44.291 0h-7.087l1.395 3.486a1.5 1.5 0 0 0 1.392.943h2.8a1.5 1.5 0 0 0 1.5-1.5z M35.54 66.077a4.872 4.872 0 1 0 9.743 0 4.872 4.872 0 1 0-9.744 0",viewW:110,viewH:110}},{id:"fireplace",group:"other",art:{d:"M26.672 34.425h55.99v39.47h-55.99Z M23 74.894a1 1 0 0 1 1-1h61.334a1 1 0 0 1 1 1v5.802a1 1 0 0 1-1 1H24a1 1 0 0 1-1-1zM23 29a1 1 0 0 1 1-1h61.334a1 1 0 0 1 1 1v4.425a1 1 0 0 1-1 1H24a1 1 0 0 1-1-1zm15.145 21.44a5 5 0 0 1 5-5h23.043a5 5 0 0 1 5 5v23.454H38.145z M44.57 65.633a2.754 2.754 0 0 1 2.754-2.753H62.01v5.507H47.324a2.754 2.754 0 0 1-2.754-2.754m20.194 5.507a2.754 2.754 0 0 0-2.754-2.753H47.324v5.507H62.01a2.754 2.754 0 0 0 2.754-2.754 M44.57 71.14a2.754 2.754 0 1 0 5.508 0 2.754 2.754 0 1 0-5.508 0m14.688-5.507a2.754 2.754 0 1 0 5.507 0 2.754 2.754 0 1 0-5.507 0",viewW:110,viewH:110}},{id:"fridge",group:"appliance",art:{d:"M35.5 18H75a2.5 2.5 0 0 1 2.5 2.5v64A2.5 2.5 0 0 1 75 87H35.5a2.5 2.5 0 0 1-2.5-2.5v-64a2.5 2.5 0 0 1 2.5-2.5 M33 46.5h44.5v38A2.5 2.5 0 0 1 75 87H35.5a2.5 2.5 0 0 1-2.5-2.5zm2.5 44a1 1 0 0 0 1 1h37a1 1 0 0 0 1-1V87h-39zm3-49.5v-9.5m0 30.5v-9.5",viewW:110,viewH:110}},{id:"hood",group:"appliance",art:{d:"M44.308 57h21.384L83 69H27zM44 37.5a2.5 2.5 0 0 1 2.5-2.5h17a2.5 2.5 0 0 1 2.5 2.5V57H44zM80.5 74h-51a2.5 2.5 0 0 1-2.5-2.5V70a1 1 0 0 1 1-1h54a1 1 0 0 1 1 1v1.5a2.5 2.5 0 0 1-2.5 2.5",viewW:110,viewH:110}},{id:"kitchen_cabinet",group:"furniture",art:{d:"M38 88a1 1 0 0 0 1 1h32a1 1 0 0 0 1-1v-3H38zm17-68h16.5a2.5 2.5 0 0 1 2.5 2.5v17a2.5 2.5 0 0 1-2.5 2.5H55zm-19 2.5a2.5 2.5 0 0 1 2.5-2.5H55v22H38.5a2.5 2.5 0 0 1-2.5-2.5zM59 33v5m-8-5v5m4 47h16.5a2.5 2.5 0 0 0 2.5-2.5v-17a2.5 2.5 0 0 0-2.5-2.5H55zm-19-2.5a2.5 2.5 0 0 0 2.5 2.5H55V63H38.5a2.5 2.5 0 0 0-2.5 2.5zM67 67h-5m-14 0h-5",viewW:110,viewH:110}},{id:"kitchen_sink",group:"sanitary",art:{d:"M21.5 84h68a2.5 2.5 0 0 0 2.5-2.5v-35a2.5 2.5 0 0 0-2.5-2.5h-68a2.5 2.5 0 0 0-2.5 2.5v35a2.5 2.5 0 0 0 2.5 2.5 M26 78h26.5a1 1 0 0 0 1-1V51a1 1 0 0 0-1-1H26a1 1 0 0 0-1 1v26a1 1 0 0 0 1 1m23-24v5m9.5 19H85a1 1 0 0 0 1-1V51a1 1 0 0 0-1-1H58.5a1 1 0 0 0-1 1v26a1 1 0 0 0 1 1m-6-39.5a1 1 0 0 0-1-1H44a1 1 0 0 0-1 1V44h9.5zM58 33v-2a5 5 0 1 0-10 0v6.5M62 54v5",viewW:110,viewH:110}},{id:"nightstand",group:"furniture",art:{d:"M76.5 73.5h-8l1.674 5.441A1.5 1.5 0 0 0 71.608 80H75a1.5 1.5 0 0 0 1.5-1.5zm-42.5 0h8l-1.674 5.441A1.5 1.5 0 0 1 38.892 80H35.5a1.5 1.5 0 0 1-1.5-1.5z M34.5 30.5h41A2.5 2.5 0 0 1 78 33v40.5a2.5 2.5 0 0 1-2.5 2.5h-41a2.5 2.5 0 0 1-2.5-2.5V33a2.5 2.5 0 0 1 2.5-2.5 M32 39.5h46v18H32Zm18.5 9H60M50.5 66H60",viewW:110,viewH:110}},{id:"oven",group:"appliance",art:{d:"M31.5 25h47a2.5 2.5 0 0 1 2.5 2.5v55a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5v-55a2.5 2.5 0 0 1 2.5-2.5 M31.5 37.5h47A2.5 2.5 0 0 1 81 40v36a2.5 2.5 0 0 1-2.5 2.5h-47A2.5 2.5 0 0 1 29 76V40a2.5 2.5 0 0 1 2.5-2.5 M40.5 47h29a2.5 2.5 0 0 1 2.5 2.5v20a2.5 2.5 0 0 1-2.5 2.5h-29a2.5 2.5 0 0 1-2.5-2.5v-20a2.5 2.5 0 0 1 2.5-2.5m25-16a2 2 0 1 0 4 0 2 2 0 1 0-4 0m7.5 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-37.25 0h9.5M43 42h24",viewW:110,viewH:110}},{id:"plant",group:"other",art:{d:"M45.952 75.849a2.5 2.5 0 0 0 2.485 2.231H63.43a2.5 2.5 0 0 0 2.485-2.231l1.571-14.532H44.381zM60.236 44.78C58.423 36.174 66.805 29.605 77 31.87c0 8.155-8.609 16.763-16.763 12.912m-9.761 5.147c1.517-8.665-7.085-14.943-17.195-12.33.28 8.15 9.178 16.458 17.195 12.33 M55.706 55.88v-2.944m0 0c1.133-5.89 7.09-10.956 12.912-15.404M55.706 52.936c-4.938-4.146-7.982-6.16-14.044-9.061m1.453 12.005h25.636a1 1 0 0 1 1 1v3.437a1 1 0 0 1-1 1H43.115a1 1 0 0 1-1-1v-3.436a1 1 0 0 1 1-1",viewW:110,viewH:110}},{id:"rug",group:"other",art:{d:"M90.27 33.874h-5.622m-59.028 0H20m70.27 5.152h-5.622m-59.028 0H20m70.27 5.154h-5.622m-59.028 0H20m70.27 5.152h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20M28.12 32h54.025a2.5 2.5 0 0 1 2.5 2.5v40.439a2.5 2.5 0 0 1-2.5 2.5H28.12a2.5 2.5 0 0 1-2.5-2.5V34.5a2.5 2.5 0 0 1 2.5-2.5 M25.62 34.5a2.5 2.5 0 0 1 2.5-2.5h1.717v45.439H28.12a2.5 2.5 0 0 1-2.5-2.5zm59.026 0a2.5 2.5 0 0 0-2.5-2.5H80.43v45.439h1.716a2.5 2.5 0 0 0 2.5-2.5zM37.8 54.485l17.801-8.432 17.801 8.432-17.8 8.432z",viewW:110,viewH:110}},{id:"shelving",group:"furniture",art:{d:"M28 58.5h53V39H28Z M64 58.5h5V47a1 1 0 0 0-1-1h-3a1 1 0 0 0-1 1zM52.5 39h-5V27.5a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zm-12 0h-5V27.5a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zm-5 29.5V71a1 1 0 0 1 1 1H49a1 1 0 0 1 1-1v-2.5a1 1 0 0 1-1-1H36.5a1 1 0 0 1-1 1m33.5-10h7v-14a1 1 0 0 0-1-1h-5a1 1 0 0 0-1 1zM47.5 39h-7V25a1 1 0 0 1 1-1h5a1 1 0 0 1 1 1zm-12 34v4a1 1 0 0 1 1 1h14a1 1 0 0 1 1-1v-4a1 1 0 0 1-1-1h-14a1 1 0 0 1-1 1M28 78h53v7H28Z M28 89.5V23a2.5 2.5 0 0 1 2.5-2.5h48A2.5 2.5 0 0 1 81 23v66.5",viewW:110,viewH:110}},{id:"shower",group:"sanitary",art:{d:"M31 84h49a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H31a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1m31.5-47.6v-4.686a11.7 11.7 0 0 0-3.441-8.283A11.77 11.77 0 0 0 50.75 20a11.77 11.77 0 0 0-8.309 3.431A11.7 11.7 0 0 0 39 31.714V84 M72 39.25a10.25 10.25 0 1 0-20.5 0zm-17.25 5v2.5m7.25-2.5v2.5m7.25-2.5v2.5m-14.5 3.75V53M62 50.5V53m7.25-2.5V53m-14.5 3.75v2.5m7.25-2.5v2.5m7.25-2.5v2.5M54.75 63v2.5M62 63v2.5m7.25-2.5v2.5",viewW:110,viewH:110}},{id:"sink",group:"sanitary",art:{d:"M30 57c0 5.523 4.477 10 10 10h29.5c5.523 0 10-4.477 10-10v-6.5A2.5 2.5 0 0 0 77 48H32.5a2.5 2.5 0 0 0-2.5 2.5zm14 22a1 1 0 0 0 1 1h19.5a1 1 0 0 0 1-1V67H44zm6-36.5a1 1 0 0 1 1-1h7.5a1 1 0 0 1 1 1V48H50zM45 37v-2a5 5 0 1 1 10 0v6.5",viewW:110,viewH:110}},{id:"sofa",group:"furniture",art:{d:"M59.5 29h24a5 5 0 0 1 5 5v32a5 5 0 0 1-5 5h-24a5 5 0 0 1-5-5V34a5 5 0 0 1 5-5m-34 0h24a5 5 0 0 1 5 5v32a5 5 0 0 1-5 5h-24a5 5 0 0 1-5-5V34a5 5 0 0 1 5-5 M18.5 44a5 5 0 0 1 5 5v12H86V49a5 5 0 0 1 5-5h.5a5 5 0 0 1 5 5v21.5a5 5 0 0 1-5 5H18a5 5 0 0 1-5-5V49a5 5 0 0 1 5-5z M25.25 57h24.5a4.75 4.75 0 0 1 4.75 4.75 4.75 4.75 0 0 1-4.75 4.75h-24.5a4.75 4.75 0 0 1-4.75-4.75A4.75 4.75 0 0 1 25.25 57m34 0h24.5a4.75 4.75 0 0 1 4.75 4.75 4.75 4.75 0 0 1-4.75 4.75h-24.5a4.75 4.75 0 0 1-4.75-4.75A4.75 4.75 0 0 1 59.25 57M18.5 75.5h8l-1.674 5.441A1.5 1.5 0 0 1 23.392 82H20a1.5 1.5 0 0 1-1.5-1.5zm72 0h-8l1.674 5.441A1.5 1.5 0 0 0 85.608 82H89a1.5 1.5 0 0 0 1.5-1.5z",viewW:110,viewH:110}},{id:"stairs",group:"other",art:{d:"M73.47 46.365v-17.62m-10.571 25.55V36.674M52.326 61.783V45.484M42.193 69.273v-15.86M28.979 77.761a1 1 0 0 1 1-1h53.624v6.489a1 1 0 0 1-1 1H29.98a1 1 0 0 1-1-1z M26.777 57.497a1 1 0 0 1 1-1h2.846a1 1 0 0 1 1 1V83.25a1 1 0 0 1-1 1h-2.846a1 1 0 0 1-1-1z m73.113 28.633-41.492 32.93v-4.405l39.9-32.007a.7.7 0 0 1 .428-.151h3.724a1.762 1.762 0 1 1 0 3.524h-2.248a.5.5 0 0 0-.312.109M25.895 53.414a3.084 3.084 0 1 0 6.167 0 3.084 3.084 0 1 0-6.167 0m14.978 16.859a1 1 0 0 1 1-1h41.73v7.488h-42.73zm10.131-7.489a1 1 0 0 1 1-1h31.598v7.488H51.004z M61.576 55.294a1 1 0 0 1 1-1h21.026v7.49H61.576z M72.15 47.806a1 1 0 0 1 1-1h9.454a1 1 0 0 1 1 1v6.489H72.15z",viewW:110,viewH:110}},{id:"toilet",group:"sanitary",art:{d:"M32 26.5a2.5 2.5 0 0 1 2.5-2.5H45a2.5 2.5 0 0 1 2.5 2.5V57H32zM47.5 52h29a2.5 2.5 0 0 1 2.5 2.5V57H47.5zm17.037 20.102C73.95 70.288 79 62.01 79 57H32c.5 7.5 8.072 7 7 11l-2.342 16.862a1 1 0 0 0 .99 1.138H66.72a1 1 0 0 0 .97-1.243z",viewW:110,viewH:110}},{id:"tv",group:"appliance",art:{d:"M23.5 31H86a2.5 2.5 0 0 1 2.5 2.5v34A2.5 2.5 0 0 1 86 70H23.5a2.5 2.5 0 0 1-2.5-2.5v-34a2.5 2.5 0 0 1 2.5-2.5M50 70h9.5v8H50Zm-10 8h30M42.5 45.5h5m5 0h-5m0 0v9.75 m56.75 45.5 5 10 5-10",viewW:110,viewH:110}},{id:"wardrobe",group:"furniture",art:{d:"M28 23a2.5 2.5 0 0 1 2.5-2.5h24V85h-24a2.5 2.5 0 0 1-2.5-2.5zm2 65.5a1 1 0 0 0 1 1h47a1 1 0 0 0 1-1V85H30zM81 23a2.5 2.5 0 0 0-2.5-2.5h-24V85h24a2.5 2.5 0 0 0 2.5-2.5zM50.5 48v9.5m8-9.5v9.5",viewW:110,viewH:110}},{id:"washer",group:"appliance",art:{d:"M31.5 25h47a2.5 2.5 0 0 1 2.5 2.5v55a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5v-55a2.5 2.5 0 0 1 2.5-2.5 M31.5 37.5h47A2.5 2.5 0 0 1 81 40v42.5a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5V40a2.5 2.5 0 0 1 2.5-2.5 M38 60.5a17 17 0 1 0 34 0 17 17 0 1 0-34 0 M43.5 60.5a11.5 11.5 0 1 0 23 0 11.5 11.5 0 1 0-23 0m22-29.5a2 2 0 1 0 4 0 2 2 0 1 0-4 0m7.5 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-37.25 0h9.5",viewW:110,viewH:110}},{id:"work_table",group:"furniture",art:{d:"M88.5 47h-20v14h20zm-12 4h4m7.984-8h-66v4h66zm-66 4h4v26.5a1.5 1.5 0 0 1-1.5 1.5h-1a1.5 1.5 0 0 1-1.5-1.5z M24.866 35.597A2.5 2.5 0 0 1 27.197 34h56.577a2.5 2.5 0 0 1 2.33 1.594l2.35 6.044a1 1 0 0 1-.93 1.362H23.46a1 1 0 0 1-.933-1.361zM88.5 61h-20v12.5A1.5 1.5 0 0 0 70 75h17a1.5 1.5 0 0 0 1.5-1.5zm-12 4h4",viewW:110,viewH:110}}];class Sc{constructor(t,e){this.host=t,this.hooks=e}place(t,e="mouse"){const s=this.host._decorImagePalette,i=this.host._curSpaceCfg;if(!s||!i)return;const o=this.hooks.decorSnap(t,e),a=Lt(s.width,s.height),n=Bt(a.w,this.host._cellCm,this.host._gridPitch)/p,r=Bt(a.h,this.host._cellCm,this.host._gridPitch)/this.host._decorH,l="di"+Date.now().toString(36)+Math.random().toString(36).slice(2,5),h=this.hooks.geometrySnapshot();i.decor=[...this.host._decorList,{id:l,kind:"image",asset_id:s.asset_id,x:J(o[0]/p-n/2),y:J(o[1]/this.host._decorH-r/2),w:n,h:r,opacity:1}],this.host._decorSel=l,this.host._decorTool="select",this.host._decorImagePalette=null,this.hooks.clearFurniturePreview(),this.hooks.recordGeometry(this.host._t("history.decor_add"),h),this.hooks.saveConfig(),this.host.requestUpdate()}renderPlacementPreview(){const t=this.host._furnPreviewInput,e=this.host._decorImagePalette;if(!t||!e||"decor"!==this.host._mode||"image"!==this.host._decorTool||!this.host._pointerModality.hoverEnabled)return l;const s=this.hooks.decorSnap(t.raw,"mouse"),i=Lt(e.width,e.height),o=Bt(i.w,this.host._cellCm,this.host._gridPitch)/p,a=Bt(i.h,this.host._cellCm,this.host._gridPitch)/this.host._decorH,n=this.host._display(e.url);return n?d``:l}renderMissing(t,e,s,i,o,a,n,r,l){const h=i+a/2,c=o+n/2;return d``}afterRender(){const t=this.host.root();this._blocked&&(this._openGroupId?this.closeGroup(!1):"palette"===this._currentModel?.kind&&this._currentModel.dismiss?.()),this._syncGlobalDismissListener();const e=t.querySelector(".editor-secondary"),s=this._renderedContext,i=e?.dataset.contextId||"";if(i&&s&&i!==s&&!window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches&&(this._contentAnimation?.cancel(),this._contentAnimation=e?.querySelector(".editor-secondary-content")?.animate([{opacity:.35,transform:"translateY(-4px)"},{opacity:1,transform:"translateY(0)"}],{duration:100,easing:"ease-out"})),this._renderedContext=i,s&&i!==s&&this._focusOwned){const s=i?e?.querySelector('[tabindex="0"], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])'):t.querySelector(".editbar-tools");s?.focus?.(),this._focusOwned=!!i}if("palette"===this._currentModel?.kind&&this._currentModel.launcherId){const e=[...t.querySelectorAll("[data-editor-palette]")].find(t=>t.dataset.editorPalette===this._currentModel?.launcherId);e&&null!==e.offsetParent||this._currentModel.dismiss?.()}if(!this._openGroupId)return;const o=[...t.querySelectorAll("[data-editor-group]")].find(t=>t.dataset.editorGroup===this._openGroupId);o&&null!==o.offsetParent||this.closeGroup(!0)}handleOutsideDismiss(t){if(_c(t,t=>t.hasAttribute("data-editor-navigation")))return"pointerdown"===t.type?this.closeForNavigation():"click"===t.type&&this._dismissPointerTarget&&this._clearDismissClick(),!1;if("click"===t.type&&this._dismissPointerTarget){return!!(t.composedPath?.()||[t.target]).includes(this._dismissPointerTarget)&&(this._clearDismissClick(),t.preventDefault(),t.stopImmediatePropagation(),!0)}const e=this._openGroupId||this._blocked||"palette"!==this._currentModel?.kind?null:this._currentModel;if("pointerdown"===t.type&&(this._openGroupId||e)){const s=_c(t,t=>t.classList.contains("editor-secondary")),i=_c(t,t=>!!t.dataset.editorGroup),o=_c(t,t=>!!t.dataset.editorPalette),a=_c(t,t=>t.classList.contains("stage"));if(!(s||i||o||"stay-open-on-canvas"===e?.dismissPolicy&&a))return t.preventDefault(),t.stopImmediatePropagation(),this._dismissPointerTarget=t.target,clearTimeout(this._dismissTimer),this._dismissTimer=window.setTimeout(()=>{this._clearDismissClick()},800),this._openGroupId?this.closeGroup(!1):e?.dismiss?.(),this._syncGlobalDismissListener(),!0}return!1}_activateGroupItem(t,e,s){if(t.id!==this._openGroupId)return;const i=t.items.find(t=>t.id===e);if(!i||i.disabled)return;const o="toggle"===i.role&&"stay-open"===i.closePolicy,a=0===s.detail;o||(this._openGroupId=null,this.host.requestUpdate(),this._syncGlobalDismissListener()),i.invoke(),!o&&a&&this.host.updateComplete().then(()=>{const e=[...this.host.root().querySelectorAll("[data-editor-group]")].find(e=>e.dataset.editorGroup===t.id&&null!==e.offsetParent);e?.focus()})}_groupKeydown(t){if(!["ArrowLeft","ArrowRight","Home","End"].includes(t.key))return;const e=[...t.currentTarget.querySelectorAll(".editor-group-item:not([disabled])")];if(!e.length)return;t.preventDefault();const s=e.indexOf(this.host.root().activeElement),i="Home"===t.key?0:"End"===t.key?e.length-1:"ArrowLeft"===t.key?s<=0?e.length-1:s-1:(s+1)%e.length;e[i]?.focus()}_clearDismissClick(){this._dismissPointerTarget=null,clearTimeout(this._dismissTimer),this._dismissTimer=void 0,this._syncGlobalDismissListener()}_syncGlobalDismissListener(){const t=!this._blocked&&"palette"===this._currentModel?.kind,e=!!this._openGroupId||t||!!this._dismissPointerTarget;e!==this._globalDismissListening&&(this._globalDismissListening=e,e?(window.addEventListener("pointerdown",this._globalDismissGuard,!0),window.addEventListener("click",this._globalDismissGuard,!0)):(window.removeEventListener("pointerdown",this._globalDismissGuard,!0),window.removeEventListener("click",this._globalDismissGuard,!0)))}}const gc=t=>t.stopPropagation(),fc=new WeakSet,bc=t=>{t._regSignature="",t._maybeRebuildDevices(),t.requestUpdate()};async function vc(t,e,s,i,o,a=""){const n=t.host,r=n._serverCfg;if(!r)return!1;let l=JSON.parse(JSON.stringify(r));l.markers=l.markers||[];let h=l.markers.find(t=>t.id===e);if(!h){const t=n._devices.find(t=>t.id===e);if(!t||"device"!==t.bindingKind&&"entity"!==t.bindingKind||!t.bindingRef)return!1;h={id:t.id,binding:`${t.bindingKind}:${t.bindingRef}`,space:t.space||null,area:t.area||null,hidden:!!t.hidden},l.markers.push(h)}h.vacuum=function(t,e){const s=e.matrix.map(t=>Number(t.toFixed(6))),i=t?.map_routes;if(Array.isArray(i)&&i.length){const o=i.find(t=>t.id===e.routeId)||i.find(t=>t.source===e.source&&t.map_id===e.mapId);if(o)return{...t,map_routes:Eo(i,o.id,s)}}return{...t,source:e.source,calibration:{...t?.calibration||{},[e.mapId]:s}}}(h.vacuum||{},{source:s,mapId:i,routeId:a,matrix:o}),l=t._prepareConfigCandidate(l);const c=n._adoption.beginOptimistic(r,l);n._adoption.stageLocalConfig(l),bc(n),n._saveConfigDebounced.pending()&&n._saveConfigDebounced.cancel();try{return await t._saveConfigNow(c),!0}catch(t){return n._rollbackOptimistic(c),bc(n),n._showToast(n._t("toast.cfg_save_failed",{err:n._errText(t)})),!1}}function yc(t){return 1===t}function $c(t){return`${t}-${globalThis.crypto?.randomUUID?.()??`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function wc(t){const e=function(t){return JSON.stringify({message:t.message.trim(),contact:t.contact.trim(),previewToken:t.attach&&t.preview?t.preview.token:""})}(t);return{idempotencyKey:t.submissionFingerprint&&t.submissionFingerprint!==e?$c("report"):t.idempotencyKey,fingerprint:e}}function kc(t){return[...t].length}function xc(t,e=Date.now()){const s=t.message.trim();return s?kc(s)>1e4?"message_too_long":kc(t.contact.trim())>320?"contact_too_long":t.attach&&!t.preview?"preview_missing":t.attach&&t.preview.expiresAt<=e?"preview_expired":null:"message_required"}function Sc(t,e=Date.now()){return"building"!==t.status&&"sending"!==t.status&&"success"!==t.status&&null===xc(t,e)}function Mc(t){const e=function(t){const e=/Firefox\/(\d+)/i.exec(t);if(e)return{family:"firefox",major:Number(e[1])||0};const s=/(?:Chrome|Chromium|Edg)\/(\d+)/i.exec(t);if(s)return{family:"chromium",major:Number(s[1])||0};const i=/Version\/(\d+).+Safari\//i.exec(t);return i?{family:"webkit",major:Number(i[1])||0}:{family:"unknown",major:0}}(t.userAgent??globalThis.navigator?.userAgent??""),s=t.now??Date.now(),i=Number(t.registryLastSuccess||0),o=i<=0?"unknown":s-i<=6e5?"fresh":"stale",a=["en","ru","de","fr"].includes(t.language)?t.language:"en",n=globalThis.matchMedia?.bind(globalThis);return{browser_family:e.family,browser_major:Math.max(0,Math.min(999,e.major)),language:a,coarse_pointer:t.coarsePointer??!!n?.("(pointer: coarse)").matches,hover_capable:t.hoverCapable??!!n?.("(hover: hover)").matches,registry_access:"full"===t.registryAccess?"full":"limited"===t.registryAccess?"partial":"unavailable",registry_age_bucket:o}}function Cc(t){const e=t&&"object"==typeof t&&"code"in t?String(t.code||""):"";return new Set(["support_invalid_message","support_preview_expired","support_package_too_large","support_rate_limited","support_unavailable","support_rejected","unauthorized"]).has(e)?e:"support_unavailable"}const Pc=[{id:"air_conditioner",group:"appliance",art:{d:"M20.5 39h69a2.5 2.5 0 0 1 2.5 2.5V69a2.5 2.5 0 0 1-2.5 2.5h-69A2.5 2.5 0 0 1 18 69V41.5a2.5 2.5 0 0 1 2.5-2.5 M25 63a2.5 2.5 0 0 1 2.5-2.5h55A2.5 2.5 0 0 1 85 63v8.5H25z M25 63a2.5 2.5 0 0 1 2.5-2.5h55A2.5 2.5 0 0 1 85 63v3.5H25z",viewW:110,viewH:110}},{id:"armchair",group:"furniture",art:{d:"M42.5 29h25a10 10 0 0 1 10 10v26.5a10 10 0 0 1-10 10h-25a10 10 0 0 1-10-10V39a10 10 0 0 1 10-10 M77.5 48.5a6 6 0 0 1 2 11.657V71.5a4 4 0 0 1-4 4H34a4 4 0 0 1-4-4V60.157A6.001 6.001 0 0 1 32 48.5a6 6 0 0 1 5.419 3.424A4 4 0 0 1 38 54v7h33.5v-6.5q0-.107.005-.213A6 6 0 0 1 77.5 48.5 M42.75 57h24.5A4.75 4.75 0 0 1 72 61.75a4.75 4.75 0 0 1-4.75 4.75h-24.5A4.75 4.75 0 0 1 38 61.75 4.75 4.75 0 0 1 42.75 57M36.5 75.5h8l-1.674 5.441A1.5 1.5 0 0 1 41.392 82H38a1.5 1.5 0 0 1-1.5-1.5zm36 0h-8l1.674 5.441A1.5 1.5 0 0 0 67.608 82H71a1.5 1.5 0 0 0 1.5-1.5z",viewW:110,viewH:110}},{id:"bathtub",group:"sanitary",art:{d:"M28 75h8l-1.674 5.441a1.5 1.5 0 0 1-1.434 1.059H29.5A1.5 1.5 0 0 1 28 80zm53 0h-8l1.674 5.441a1.5 1.5 0 0 0 1.434 1.059H79.5A1.5 1.5 0 0 0 81 80zM19.5 46.5H90a2.5 2.5 0 0 1 2.5 2.5 2.5 2.5 0 0 1-2.5 2.5H19.5A2.5 2.5 0 0 1 17 49a2.5 2.5 0 0 1 2.5-2.5 M19.5 51.5H90L86.633 68a10 10 0 0 1-9.798 8h-44.17a10 10 0 0 1-9.798-8zM30 36v-2a5 5 0 1 0-10 0v12.5",viewW:110,viewH:110}},{id:"bed",group:"furniture",art:{d:"M16 75.5h8l-1.674 5.441A1.5 1.5 0 0 1 20.892 82H17.5a1.5 1.5 0 0 1-1.5-1.5zm78.5 0h-8l1.674 5.441A1.5 1.5 0 0 0 89.608 82H93a1.5 1.5 0 0 0 1.5-1.5zM25 29h60.5a2.5 2.5 0 0 1 2.5 2.5V68a2.5 2.5 0 0 1-2.5 2.5H25a2.5 2.5 0 0 1-2.5-2.5V31.5A2.5 2.5 0 0 1 25 29 M16 59.5c0-5.523 4.477-10 10-10h58.5c5.523 0 10 4.477 10 10v6H16zm-1 6h80.5a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1m15.5-20a5 5 0 0 1 5-5h11a5 5 0 0 1 5 5v4h-21zm28.5 0a5 5 0 0 1 5-5h11a5 5 0 0 1 5 5v4H59z",viewW:110,viewH:110}},{id:"bidet",group:"sanitary",art:{d:"M36 57.5c0 5.523 4.477 10 10 10h18.5c5.523 0 10-4.477 10-10V53H36zm8.5 22a1 1 0 0 0 1 1H65a1 1 0 0 0 1-1v-12H44.5zm-8.5-32a1 1 0 0 1 1-1h36.5a1 1 0 0 1 1 1V53H36zM50.5 41a1 1 0 0 1 1-1H59a1 1 0 0 1 1 1v5.5h-9.5zM53 30a1 1 0 0 1 1-1h2.5a1 1 0 0 1 1 1v10H53zm-4 6a1 1 0 0 1-1-1v-2.5a1 1 0 0 1 1-1h4V36z",viewW:110,viewH:110}},{id:"boiler",group:"appliance",art:{d:"M46.5 81.5h5V86a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1zm12.5 0h5V86a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1zM44 23h22.5a8 8 0 0 1 8 8v42.5a8 8 0 0 1-8 8H44a8 8 0 0 1-8-8V31a8 8 0 0 1 8-8 M36 31a8 8 0 0 1 8-8h22.5a8 8 0 0 1 8 8v42H36z M48.5 42.5a7 7 0 1 0 14 0 7 7 0 1 0-14 0m6.5 0 3.5-3.5",viewW:110,viewH:110}},{id:"chair",group:"furniture",art:{d:"M40.5 39.5C40.5 32.596 46.096 27 53 27h4c6.904 0 12.5 5.596 12.5 12.5v13a5 5 0 0 1-5 5h-19a5 5 0 0 1-5-5z M41.25 54h27.5A3.25 3.25 0 0 1 72 57.25a3.25 3.25 0 0 1-3.25 3.25h-27.5A3.25 3.25 0 0 1 38 57.25 3.25 3.25 0 0 1 41.25 54m28.25 6.5H64l1.88 21.63a1.5 1.5 0 0 0 1.495 1.37H68a1.5 1.5 0 0 0 1.5-1.5zm-29 0H46l-1.88 21.63a1.5 1.5 0 0 1-1.495 1.37H42a1.5 1.5 0 0 1-1.5-1.5z",viewW:110,viewH:110}},{id:"coffee_table",group:"furniture",art:{d:"M25 51h5.238l-1.534 15.646A1.5 1.5 0 0 1 27.211 68H26.5a1.5 1.5 0 0 1-1.5-1.5zm60.238 0H80l1.534 15.646A1.5 1.5 0 0 0 83.027 68h.711a1.5 1.5 0 0 0 1.5-1.5z M24.34 43.485A2.5 2.5 0 0 1 26.625 42h56.75a2.5 2.5 0 0 1 2.285 1.485l2.715 6.109A1 1 0 0 1 87.461 51H22.54a1 1 0 0 1-.914-1.406z M87.5 51h-66v3a1 1 0 0 0 1 1h64a1 1 0 0 0 1-1z",viewW:110,viewH:110}},{id:"computer",group:"appliance",art:{d:"M24.5 38h40a2.5 2.5 0 0 1 2.5 2.5v22a2.5 2.5 0 0 1-2.5 2.5h-40a2.5 2.5 0 0 1-2.5-2.5v-22a2.5 2.5 0 0 1 2.5-2.5m50 0h11a2.5 2.5 0 0 1 2.5 2.5v29a2.5 2.5 0 0 1-2.5 2.5h-11a2.5 2.5 0 0 1-2.5-2.5v-29a2.5 2.5 0 0 1 2.5-2.5M43 65h5v7h-5zm-6 7h16m23-12h8m-8-17h8 M35 56V46h5m-5 7h5 M39.5 53a3.5 3.5 0 1 0 0-7m15.036 8.536a5 5 0 1 1 0-7.071",viewW:110,viewH:110}},{id:"cooktop",group:"appliance",art:{d:"M27.5 29h55a2.5 2.5 0 0 1 2.5 2.5v47a2.5 2.5 0 0 1-2.5 2.5h-55a2.5 2.5 0 0 1-2.5-2.5v-47a2.5 2.5 0 0 1 2.5-2.5 M33.5 66.5a8 8 0 1 0 16 0 8 8 0 1 0-16 0m26.5-23a8 8 0 1 0 16 0 8 8 0 1 0-16 0m3 23a5 5 0 1 0 10 0 5 5 0 1 0-10 0m-29.5-23a8 8 0 1 0 16 0 8 8 0 1 0-16 0",viewW:110,viewH:110}},{id:"dining_table",group:"furniture",art:{d:"M83.5 43H78l6.742 30.82A1.5 1.5 0 0 0 86.207 75h.54a1.5 1.5 0 0 0 1.482-1.732zm-56 0H33l-6.742 30.82A1.5 1.5 0 0 1 24.793 75h-.54a1.5 1.5 0 0 1-1.482-1.732zm-2.62-7.406A2.5 2.5 0 0 1 27.21 34h56.58a2.5 2.5 0 0 1 2.33 1.594l2.35 6.044A1 1 0 0 1 87.538 43H23.462a1 1 0 0 1-.932-1.362z M88.5 43h-66v3a1 1 0 0 0 1 1h64a1 1 0 0 0 1-1z",viewW:110,viewH:110}},{id:"dishwasher",group:"appliance",art:{d:"M31.5 25h47a2.5 2.5 0 0 1 2.5 2.5v55a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5v-55a2.5 2.5 0 0 1 2.5-2.5 M31.5 37.5h47A2.5 2.5 0 0 1 81 40v36a2.5 2.5 0 0 1-2.5 2.5h-47A2.5 2.5 0 0 1 29 76V40a2.5 2.5 0 0 1 2.5-2.5M43 42h24m-1.5-11a2 2 0 1 0 4 0 2 2 0 1 0-4 0m7.5 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-37.25 0h9.5",viewW:110,viewH:110}},{id:"dryer",group:"appliance",art:{d:"M31.5 25h47a2.5 2.5 0 0 1 2.5 2.5v55a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5v-55a2.5 2.5 0 0 1 2.5-2.5 M31.5 37.5h47A2.5 2.5 0 0 1 81 40v42.5a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5V40a2.5 2.5 0 0 1 2.5-2.5 M38 60.5a17 17 0 1 0 34 0 17 17 0 1 0-34 0 M43.5 60.5a11.5 11.5 0 1 0 23 0 11.5 11.5 0 1 0-23 0m22-29.5a2 2 0 1 0 4 0 2 2 0 1 0-4 0m7.5 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-37.25 0h9.5 M55.994 55.5s-1.329 1.81-1.479 3.143c-.198 1.761 1.599 2.554 1.48 4.321-.1 1.479-1.48 3.536-1.48 3.536m5.979-11s-1.329 1.81-1.479 3.143c-.198 1.761 1.599 2.554 1.48 4.321-.1 1.479-1.48 3.536-1.48 3.536m-8.519-11s-.886 1.81-.986 3.143c-.132 1.761 1.066 2.554.986 4.321-.067 1.479-.986 3.536-.986 3.536",viewW:110,viewH:110}},{id:"exercise",group:"other",art:{d:"m60.752 62.03-5.379-2.312 11.066-25.75a1.5 1.5 0 0 1 1.97-.786l2.624 1.127a1.5 1.5 0 0 1 .786 1.97zm-18.648-4.512-4.353 1.189-4.474-16.382a1.5 1.5 0 0 1 1.052-1.842l1.459-.398a1.5 1.5 0 0 1 1.842 1.052z M41.297 38.173a2.215 2.215 0 0 1 0 4.43H29.781a2.215 2.215 0 0 1 0-4.43zm33.219 38.091a2.657 2.657 0 1 1 0 5.315H28.453a2.657 2.657 0 1 1 0-5.315zm8.641-51.366a1.795 1.795 0 0 1 .68 2.41l-3.03 5.59a5 5 0 0 1-4.396 2.618H65.657a1.772 1.772 0 1 1 0-3.544h9.61a3 3 0 0 0 2.598-1.5l2.84-4.917a1.795 1.795 0 0 1 2.452-.657M29.339 65.787c0-6.699 6.457-11.503 12.873-9.579l24.291 7.288a10 10 0 0 1 7.127 9.578v3.19H29.339zm0 15.852h7.086l-1.394 3.486a1.5 1.5 0 0 1-1.393.943h-2.8a1.5 1.5 0 0 1-1.5-1.5zm44.291 0h-7.087l1.395 3.486a1.5 1.5 0 0 0 1.392.943h2.8a1.5 1.5 0 0 0 1.5-1.5z M35.54 66.077a4.872 4.872 0 1 0 9.743 0 4.872 4.872 0 1 0-9.744 0",viewW:110,viewH:110}},{id:"fireplace",group:"other",art:{d:"M26.672 34.425h55.99v39.47h-55.99Z M23 74.894a1 1 0 0 1 1-1h61.334a1 1 0 0 1 1 1v5.802a1 1 0 0 1-1 1H24a1 1 0 0 1-1-1zM23 29a1 1 0 0 1 1-1h61.334a1 1 0 0 1 1 1v4.425a1 1 0 0 1-1 1H24a1 1 0 0 1-1-1zm15.145 21.44a5 5 0 0 1 5-5h23.043a5 5 0 0 1 5 5v23.454H38.145z M44.57 65.633a2.754 2.754 0 0 1 2.754-2.753H62.01v5.507H47.324a2.754 2.754 0 0 1-2.754-2.754m20.194 5.507a2.754 2.754 0 0 0-2.754-2.753H47.324v5.507H62.01a2.754 2.754 0 0 0 2.754-2.754 M44.57 71.14a2.754 2.754 0 1 0 5.508 0 2.754 2.754 0 1 0-5.508 0m14.688-5.507a2.754 2.754 0 1 0 5.507 0 2.754 2.754 0 1 0-5.507 0",viewW:110,viewH:110}},{id:"fridge",group:"appliance",art:{d:"M35.5 18H75a2.5 2.5 0 0 1 2.5 2.5v64A2.5 2.5 0 0 1 75 87H35.5a2.5 2.5 0 0 1-2.5-2.5v-64a2.5 2.5 0 0 1 2.5-2.5 M33 46.5h44.5v38A2.5 2.5 0 0 1 75 87H35.5a2.5 2.5 0 0 1-2.5-2.5zm2.5 44a1 1 0 0 0 1 1h37a1 1 0 0 0 1-1V87h-39zm3-49.5v-9.5m0 30.5v-9.5",viewW:110,viewH:110}},{id:"hood",group:"appliance",art:{d:"M44.308 57h21.384L83 69H27zM44 37.5a2.5 2.5 0 0 1 2.5-2.5h17a2.5 2.5 0 0 1 2.5 2.5V57H44zM80.5 74h-51a2.5 2.5 0 0 1-2.5-2.5V70a1 1 0 0 1 1-1h54a1 1 0 0 1 1 1v1.5a2.5 2.5 0 0 1-2.5 2.5",viewW:110,viewH:110}},{id:"kitchen_cabinet",group:"furniture",art:{d:"M38 88a1 1 0 0 0 1 1h32a1 1 0 0 0 1-1v-3H38zm17-68h16.5a2.5 2.5 0 0 1 2.5 2.5v17a2.5 2.5 0 0 1-2.5 2.5H55zm-19 2.5a2.5 2.5 0 0 1 2.5-2.5H55v22H38.5a2.5 2.5 0 0 1-2.5-2.5zM59 33v5m-8-5v5m4 47h16.5a2.5 2.5 0 0 0 2.5-2.5v-17a2.5 2.5 0 0 0-2.5-2.5H55zm-19-2.5a2.5 2.5 0 0 0 2.5 2.5H55V63H38.5a2.5 2.5 0 0 0-2.5 2.5zM67 67h-5m-14 0h-5",viewW:110,viewH:110}},{id:"kitchen_sink",group:"sanitary",art:{d:"M21.5 84h68a2.5 2.5 0 0 0 2.5-2.5v-35a2.5 2.5 0 0 0-2.5-2.5h-68a2.5 2.5 0 0 0-2.5 2.5v35a2.5 2.5 0 0 0 2.5 2.5 M26 78h26.5a1 1 0 0 0 1-1V51a1 1 0 0 0-1-1H26a1 1 0 0 0-1 1v26a1 1 0 0 0 1 1m23-24v5m9.5 19H85a1 1 0 0 0 1-1V51a1 1 0 0 0-1-1H58.5a1 1 0 0 0-1 1v26a1 1 0 0 0 1 1m-6-39.5a1 1 0 0 0-1-1H44a1 1 0 0 0-1 1V44h9.5zM58 33v-2a5 5 0 1 0-10 0v6.5M62 54v5",viewW:110,viewH:110}},{id:"nightstand",group:"furniture",art:{d:"M76.5 73.5h-8l1.674 5.441A1.5 1.5 0 0 0 71.608 80H75a1.5 1.5 0 0 0 1.5-1.5zm-42.5 0h8l-1.674 5.441A1.5 1.5 0 0 1 38.892 80H35.5a1.5 1.5 0 0 1-1.5-1.5z M34.5 30.5h41A2.5 2.5 0 0 1 78 33v40.5a2.5 2.5 0 0 1-2.5 2.5h-41a2.5 2.5 0 0 1-2.5-2.5V33a2.5 2.5 0 0 1 2.5-2.5 M32 39.5h46v18H32Zm18.5 9H60M50.5 66H60",viewW:110,viewH:110}},{id:"oven",group:"appliance",art:{d:"M31.5 25h47a2.5 2.5 0 0 1 2.5 2.5v55a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5v-55a2.5 2.5 0 0 1 2.5-2.5 M31.5 37.5h47A2.5 2.5 0 0 1 81 40v36a2.5 2.5 0 0 1-2.5 2.5h-47A2.5 2.5 0 0 1 29 76V40a2.5 2.5 0 0 1 2.5-2.5 M40.5 47h29a2.5 2.5 0 0 1 2.5 2.5v20a2.5 2.5 0 0 1-2.5 2.5h-29a2.5 2.5 0 0 1-2.5-2.5v-20a2.5 2.5 0 0 1 2.5-2.5m25-16a2 2 0 1 0 4 0 2 2 0 1 0-4 0m7.5 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-37.25 0h9.5M43 42h24",viewW:110,viewH:110}},{id:"plant",group:"other",art:{d:"M45.952 75.849a2.5 2.5 0 0 0 2.485 2.231H63.43a2.5 2.5 0 0 0 2.485-2.231l1.571-14.532H44.381zM60.236 44.78C58.423 36.174 66.805 29.605 77 31.87c0 8.155-8.609 16.763-16.763 12.912m-9.761 5.147c1.517-8.665-7.085-14.943-17.195-12.33.28 8.15 9.178 16.458 17.195 12.33 M55.706 55.88v-2.944m0 0c1.133-5.89 7.09-10.956 12.912-15.404M55.706 52.936c-4.938-4.146-7.982-6.16-14.044-9.061m1.453 12.005h25.636a1 1 0 0 1 1 1v3.437a1 1 0 0 1-1 1H43.115a1 1 0 0 1-1-1v-3.436a1 1 0 0 1 1-1",viewW:110,viewH:110}},{id:"rug",group:"other",art:{d:"M90.27 33.874h-5.622m-59.028 0H20m70.27 5.152h-5.622m-59.028 0H20m70.27 5.154h-5.622m-59.028 0H20m70.27 5.152h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20m70.27 5.153h-5.622m-59.028 0H20M28.12 32h54.025a2.5 2.5 0 0 1 2.5 2.5v40.439a2.5 2.5 0 0 1-2.5 2.5H28.12a2.5 2.5 0 0 1-2.5-2.5V34.5a2.5 2.5 0 0 1 2.5-2.5 M25.62 34.5a2.5 2.5 0 0 1 2.5-2.5h1.717v45.439H28.12a2.5 2.5 0 0 1-2.5-2.5zm59.026 0a2.5 2.5 0 0 0-2.5-2.5H80.43v45.439h1.716a2.5 2.5 0 0 0 2.5-2.5zM37.8 54.485l17.801-8.432 17.801 8.432-17.8 8.432z",viewW:110,viewH:110}},{id:"shelving",group:"furniture",art:{d:"M28 58.5h53V39H28Z M64 58.5h5V47a1 1 0 0 0-1-1h-3a1 1 0 0 0-1 1zM52.5 39h-5V27.5a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zm-12 0h-5V27.5a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zm-5 29.5V71a1 1 0 0 1 1 1H49a1 1 0 0 1 1-1v-2.5a1 1 0 0 1-1-1H36.5a1 1 0 0 1-1 1m33.5-10h7v-14a1 1 0 0 0-1-1h-5a1 1 0 0 0-1 1zM47.5 39h-7V25a1 1 0 0 1 1-1h5a1 1 0 0 1 1 1zm-12 34v4a1 1 0 0 1 1 1h14a1 1 0 0 1 1-1v-4a1 1 0 0 1-1-1h-14a1 1 0 0 1-1 1M28 78h53v7H28Z M28 89.5V23a2.5 2.5 0 0 1 2.5-2.5h48A2.5 2.5 0 0 1 81 23v66.5",viewW:110,viewH:110}},{id:"shower",group:"sanitary",art:{d:"M31 84h49a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H31a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1m31.5-47.6v-4.686a11.7 11.7 0 0 0-3.441-8.283A11.77 11.77 0 0 0 50.75 20a11.77 11.77 0 0 0-8.309 3.431A11.7 11.7 0 0 0 39 31.714V84 M72 39.25a10.25 10.25 0 1 0-20.5 0zm-17.25 5v2.5m7.25-2.5v2.5m7.25-2.5v2.5m-14.5 3.75V53M62 50.5V53m7.25-2.5V53m-14.5 3.75v2.5m7.25-2.5v2.5m7.25-2.5v2.5M54.75 63v2.5M62 63v2.5m7.25-2.5v2.5",viewW:110,viewH:110}},{id:"sink",group:"sanitary",art:{d:"M30 57c0 5.523 4.477 10 10 10h29.5c5.523 0 10-4.477 10-10v-6.5A2.5 2.5 0 0 0 77 48H32.5a2.5 2.5 0 0 0-2.5 2.5zm14 22a1 1 0 0 0 1 1h19.5a1 1 0 0 0 1-1V67H44zm6-36.5a1 1 0 0 1 1-1h7.5a1 1 0 0 1 1 1V48H50zM45 37v-2a5 5 0 1 1 10 0v6.5",viewW:110,viewH:110}},{id:"sofa",group:"furniture",art:{d:"M59.5 29h24a5 5 0 0 1 5 5v32a5 5 0 0 1-5 5h-24a5 5 0 0 1-5-5V34a5 5 0 0 1 5-5m-34 0h24a5 5 0 0 1 5 5v32a5 5 0 0 1-5 5h-24a5 5 0 0 1-5-5V34a5 5 0 0 1 5-5 M18.5 44a5 5 0 0 1 5 5v12H86V49a5 5 0 0 1 5-5h.5a5 5 0 0 1 5 5v21.5a5 5 0 0 1-5 5H18a5 5 0 0 1-5-5V49a5 5 0 0 1 5-5z M25.25 57h24.5a4.75 4.75 0 0 1 4.75 4.75 4.75 4.75 0 0 1-4.75 4.75h-24.5a4.75 4.75 0 0 1-4.75-4.75A4.75 4.75 0 0 1 25.25 57m34 0h24.5a4.75 4.75 0 0 1 4.75 4.75 4.75 4.75 0 0 1-4.75 4.75h-24.5a4.75 4.75 0 0 1-4.75-4.75A4.75 4.75 0 0 1 59.25 57M18.5 75.5h8l-1.674 5.441A1.5 1.5 0 0 1 23.392 82H20a1.5 1.5 0 0 1-1.5-1.5zm72 0h-8l1.674 5.441A1.5 1.5 0 0 0 85.608 82H89a1.5 1.5 0 0 0 1.5-1.5z",viewW:110,viewH:110}},{id:"stairs",group:"other",art:{d:"M73.47 46.365v-17.62m-10.571 25.55V36.674M52.326 61.783V45.484M42.193 69.273v-15.86M28.979 77.761a1 1 0 0 1 1-1h53.624v6.489a1 1 0 0 1-1 1H29.98a1 1 0 0 1-1-1z M26.777 57.497a1 1 0 0 1 1-1h2.846a1 1 0 0 1 1 1V83.25a1 1 0 0 1-1 1h-2.846a1 1 0 0 1-1-1z m73.113 28.633-41.492 32.93v-4.405l39.9-32.007a.7.7 0 0 1 .428-.151h3.724a1.762 1.762 0 1 1 0 3.524h-2.248a.5.5 0 0 0-.312.109M25.895 53.414a3.084 3.084 0 1 0 6.167 0 3.084 3.084 0 1 0-6.167 0m14.978 16.859a1 1 0 0 1 1-1h41.73v7.488h-42.73zm10.131-7.489a1 1 0 0 1 1-1h31.598v7.488H51.004z M61.576 55.294a1 1 0 0 1 1-1h21.026v7.49H61.576z M72.15 47.806a1 1 0 0 1 1-1h9.454a1 1 0 0 1 1 1v6.489H72.15z",viewW:110,viewH:110}},{id:"toilet",group:"sanitary",art:{d:"M32 26.5a2.5 2.5 0 0 1 2.5-2.5H45a2.5 2.5 0 0 1 2.5 2.5V57H32zM47.5 52h29a2.5 2.5 0 0 1 2.5 2.5V57H47.5zm17.037 20.102C73.95 70.288 79 62.01 79 57H32c.5 7.5 8.072 7 7 11l-2.342 16.862a1 1 0 0 0 .99 1.138H66.72a1 1 0 0 0 .97-1.243z",viewW:110,viewH:110}},{id:"tv",group:"appliance",art:{d:"M23.5 31H86a2.5 2.5 0 0 1 2.5 2.5v34A2.5 2.5 0 0 1 86 70H23.5a2.5 2.5 0 0 1-2.5-2.5v-34a2.5 2.5 0 0 1 2.5-2.5M50 70h9.5v8H50Zm-10 8h30M42.5 45.5h5m5 0h-5m0 0v9.75 m56.75 45.5 5 10 5-10",viewW:110,viewH:110}},{id:"wardrobe",group:"furniture",art:{d:"M28 23a2.5 2.5 0 0 1 2.5-2.5h24V85h-24a2.5 2.5 0 0 1-2.5-2.5zm2 65.5a1 1 0 0 0 1 1h47a1 1 0 0 0 1-1V85H30zM81 23a2.5 2.5 0 0 0-2.5-2.5h-24V85h24a2.5 2.5 0 0 0 2.5-2.5zM50.5 48v9.5m8-9.5v9.5",viewW:110,viewH:110}},{id:"washer",group:"appliance",art:{d:"M31.5 25h47a2.5 2.5 0 0 1 2.5 2.5v55a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5v-55a2.5 2.5 0 0 1 2.5-2.5 M31.5 37.5h47A2.5 2.5 0 0 1 81 40v42.5a2.5 2.5 0 0 1-2.5 2.5h-47a2.5 2.5 0 0 1-2.5-2.5V40a2.5 2.5 0 0 1 2.5-2.5 M38 60.5a17 17 0 1 0 34 0 17 17 0 1 0-34 0 M43.5 60.5a11.5 11.5 0 1 0 23 0 11.5 11.5 0 1 0-23 0m22-29.5a2 2 0 1 0 4 0 2 2 0 1 0-4 0m7.5 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-37.25 0h9.5",viewW:110,viewH:110}},{id:"work_table",group:"furniture",art:{d:"M88.5 47h-20v14h20zm-12 4h4m7.984-8h-66v4h66zm-66 4h4v26.5a1.5 1.5 0 0 1-1.5 1.5h-1a1.5 1.5 0 0 1-1.5-1.5z M24.866 35.597A2.5 2.5 0 0 1 27.197 34h56.577a2.5 2.5 0 0 1 2.33 1.594l2.35 6.044a1 1 0 0 1-.93 1.362H23.46a1 1 0 0 1-.933-1.361zM88.5 61h-20v12.5A1.5 1.5 0 0 0 70 75h17a1.5 1.5 0 0 0 1.5-1.5zm-12 4h4",viewW:110,viewH:110}}];class Dc{constructor(t,e){this.host=t,this.hooks=e}place(t,e="mouse"){const s=this.host._decorImagePalette,i=this.host._curSpaceCfg;if(!s||!i)return;const o=this.hooks.decorSnap(t,e),a=jt(s.width,s.height),n=Gt(a.w,this.host._cellCm,this.host._gridPitch)/m,r=Gt(a.h,this.host._cellCm,this.host._gridPitch)/this.host._decorH,l="di"+Date.now().toString(36)+Math.random().toString(36).slice(2,5),h=this.hooks.geometrySnapshot();i.decor=[...this.host._decorList,{id:l,kind:"image",asset_id:s.asset_id,x:Z(o[0]/m-n/2),y:Z(o[1]/this.host._decorH-r/2),w:n,h:r,opacity:1}],this.host._decorSel=l,this.host._decorTool="select",this.host._decorImagePalette=null,this.hooks.clearFurniturePreview(),this.hooks.recordGeometry(this.host._t("history.decor_add"),h),this.hooks.saveConfig(),this.host.requestUpdate()}renderPlacementPreview(){const t=this.host._furnPreviewInput,e=this.host._decorImagePalette;if(!t||!e||"decor"!==this.host._mode||"image"!==this.host._decorTool||!this.host._pointerModality.hoverEnabled)return d;const s=this.hooks.decorSnap(t.raw,"mouse"),i=jt(e.width,e.height),o=Gt(i.w,this.host._cellCm,this.host._gridPitch)/m,a=Gt(i.h,this.host._cellCm,this.host._gridPitch)/this.host._decorH,n=this.host._display(e.url);return n?_``:d}renderMissing(t,e,s,i,o,a,n,r,l){const h=i+a/2,c=o+n/2;return _` ${this.host._t("decor.image_unavailable")} @@ -554,7 +554,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae font-size=${Math.min(18,.25*n)} text-anchor="middle" dominant-baseline="middle" textLength=${Math.max(1,Math.min(.8*a,160))} lengthAdjust="spacingAndGlyphs">${this.host._t("decor.image_unavailable")} - `}async uploadFromInput(t,e=!1){const s=t.target,i=s.files?.[0];if(s.value="",!i||this.host._decorAssetBusy)return;let o;try{o=await go(i,2097152)}catch{return void this.host._showToast(this.host._t("backup.error.invalid_image"))}if("reject"!==o.kind)return"guard"===o.kind?(this.hooks.setGuardReplace(e),void(this.host._backdropGuard=o.state)):void await this.upload(i,i.name,e);this.host._showToast(this.host._t("toast.plan_formats"))}async upload(t,e,s){if(!this.host._decorAssetBusy){this.host._decorAssetBusy=!0;try{const i=new FormData;i.append("file",t,e);const o=this.host.hass?.fetchWithAuth?await this.host.hass.fetchWithAuth("/api/houseplan/assets/upload",{method:"POST",body:i}):await fetch("/api/houseplan/assets/upload",{method:"POST",body:i,headers:this.host.hass?.auth?.data?.access_token?{authorization:`Bearer ${this.host.hass.auth.data.access_token}`}:{}}),a=await o.json().catch(()=>({}));if(!o.ok||a.error||!a.asset){const t={invalid_format:"backup.error.invalid_image",invalid_image:"backup.error.invalid_image",unsupported_image:"backup.error.unsupported_image",too_large:"backdrop.too_large_title",capacity_exceeded:"decor.image_error_capacity"};throw new Error(this.host._t(t[String(a.error)]||"backup.error.io_error"))}const n=Wt({assets:[a.asset]}).values().next().value;if(!n)throw new Error(this.host._t("backup.error.io_error"));this.host._decorAssets=new Map(this.host._decorAssets).set(n.asset_id,n),this.host._decorAssetCatalog=[n,...this.host._decorAssetCatalog.filter(t=>t.asset_id!==n.asset_id)],s&&"image"===this.host._decorShapeDialog?.kind?this.host._decorShapeDialog={...this.host._decorShapeDialog,assetId:n.asset_id}:this.host._decorImagePalette=n,this.host.requestUpdate()}catch(t){this.host._showToast(this.host._t("decor.image_upload_failed",{err:this.host._errText(t)}))}finally{this.host._decorAssetBusy=!1}}}async delete(t){if(t.used_by?.length)return void this.host._showToast(this.host._t("decor.image_in_use"));if(await this.host._confirmDanger({key:`delete-decor-asset:${t.asset_id}`,kind:"destructive",title:this.host._t("decor.image_delete_title"),message:this.host._t("decor.image_delete_message",{name:t.name}),confirmLabel:this.host._t("btn.delete"),cancelLabel:this.host._t("btn.cancel")}))try{await this.host.hass.callWS({type:"houseplan/assets/delete",asset_id:t.asset_id}),this.host._decorAssetCatalog=this.host._decorAssetCatalog.filter(e=>e.asset_id!==t.asset_id),this.host._decorAssets.delete(t.asset_id),this.host._decorImagePalette?.asset_id===t.asset_id&&(this.host._decorImagePalette=null),this.host.requestUpdate()}catch(t){this.host._showToast("in_use"===t?.code?this.host._t("decor.image_in_use"):this.host._t("backup.error.io_error"))}}async loadCatalog(){try{const t=await this.host.hass.callWS({type:"houseplan/assets/list"}),e=Wt(t);this.host._decorAssetCatalog=[...e.values()],this.host._decorAssets=new Map([...this.host._decorAssets,...e]),this.host.requestUpdate()}catch{this.host._showToast(this.host._t("backup.error.io_error"))}}renderImagePalette(){const t=this.host._decorImagePalette;return h` @@ -1381,7 +1381,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae ${this._boolInput(this.host._settingsDialog.sunRays,t=>this.host._settingsDialog={...this.host._settingsDialog,sunRays:t})} ${this.host._t("gs.sun_rays")} - ${this.host._canEdit?h` + ${this.host._canEdit?p`
    ${this.host._t("gs.backup_hint")}
    @@ -1394,12 +1394,12 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae this._pickBackupImport(t)} /> - ${this.host._canOptimizeUndo&&"import"===this.host._undoKind?h` + ${this.host._canOptimizeUndo&&"import"===this.host._undoKind?p` `:l} -
    `:l} + `:d} +
    `:d}
    ${this.host._t("gs.grid_hint")}
    @@ -1407,15 +1407,15 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae ${this.host._t("gs.align_all")}
    - ${this.host._canOptimizeUndo&&"import"!==this.host._undoKind?h`
    + ${this.host._canOptimizeUndo&&"import"!==this.host._undoKind?p`
    -
    `:l} +
    `:d}
    - @@ -1424,7 +1424,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae ${this.host._settingsDialog.busy?"…":this.host._t("btn.save")}
    - `}_rulesSet(t){this.host._rulesDialog={...this.host._rulesDialog,rules:t}}async _saveRules(){const t=this.host._rulesDialog;if(!t||t.busy)return;const e=t.rules.filter(t=>t.pattern.trim()&&t.icon.trim());this.host._rulesDialog={...t,busy:!0};try{const t=this.host._serverCfg,s=JSON.stringify(e)===JSON.stringify(he),i={...t.settings};s?delete i.icon_rules:i.icon_rules=e,this.host._serverCfg={...t,settings:i},await this._saveConfigNow(),this.host._rulesDialog=null,this.host._regSignature="",this.host._maybeRebuildDevices(),this.host._showToast(this.host._t("rules.saved"))}catch(t){this.host._rulesDialog&&(this.host._rulesDialog={...this.host._rulesDialog,busy:!1}),this.host._showToast(this.host._t("toast.error",{err:this.host._errText(t)}))}}_renderRulesDialog(){const t=this.host._rulesDialog,e=ai(t.rules),s=t.test.trim()?ni(t.test,"",e):null,i=(e,s)=>{const i=[...t.rules],o=e+s;o<0||o>=i.length||([i[e],i[o]]=[i[o],i[e]],this._rulesSet(i))};return h``}_rulesSet(t){this.host._rulesDialog={...this.host._rulesDialog,rules:t}}async _saveRules(){const t=this.host._rulesDialog;if(!t||t.busy)return;const e=t.rules.filter(t=>t.pattern.trim()&&t.icon.trim());this.host._rulesDialog={...t,busy:!0};try{const t=this.host._serverCfg,s=JSON.stringify(e)===JSON.stringify(pe),i={...t.settings};s?delete i.icon_rules:i.icon_rules=e,this.host._serverCfg={...t,settings:i},await this._saveConfigNow(),this.host._rulesDialog=null,this.host._regSignature="",this.host._maybeRebuildDevices(),this.host._showToast(this.host._t("rules.saved"))}catch(t){this.host._rulesDialog&&(this.host._rulesDialog={...this.host._rulesDialog,busy:!1}),this.host._showToast(this.host._t("toast.error",{err:this.host._errText(t)}))}}_renderRulesDialog(){const t=this.host._rulesDialog,e=li(t.rules),s=t.test.trim()?hi(t.test,"",e):null,i=(e,s)=>{const i=[...t.rules],o=e+s;o<0||o>=i.length||([i[e],i[o]]=[i[o],i[e]],this._rulesSet(i))};return p`this.host._rulesDialog=null}>
    ${this.host._t("rules.hint")}
    @@ -1432,9 +1432,9 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae this.host._rulesDialog={...t,test:e.target.value}} /> - ${s?h`${s}`:l} + ${s?p`${s}`:d}
    - ${t.rules.map((e,s)=>{const o=""!==e.pattern.trim()&&!ri(e.pattern);return h`
    + ${t.rules.map((e,s)=>{const o=""!==e.pattern.trim()&&!ci(e.pattern);return p`
    - @@ -1465,11 +1465,11 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae ${t.busy?"…":this.host._t("btn.save")}
    - `}_saveKioskScale(t){this.host._kioskScale={...this.host._kioskScale,...t};try{localStorage.setItem("houseplan_card_kiosk_v1",JSON.stringify(this.host._kioskScale))}catch{}this.host.requestUpdate()}_renderKioskDialog(){const t=this.host._kioskScale,e=(e,s)=>h` + `}_saveKioskScale(t){this.host._kioskScale={...this.host._kioskScale,...t};try{localStorage.setItem("houseplan_card_kiosk_v1",JSON.stringify(this.host._kioskScale))}catch{}this.host.requestUpdate()}_renderKioskDialog(){const t=this.host._kioskScale,e=(e,s)=>p`
    ${this._rangeInput(50,300,5,Math.round(100*t[e]),t=>this._saveKioskScale({[e]:t/100}))} ${Math.round(100*t[e])}% -
    `;return h``;return p`this.host._kioskDialog=!1}>
    ${this.host._t("kiosk.hint")}
    @@ -1481,36 +1481,36 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    -
    `}_renderVacSection(e){const s=this.host._devices.find(t=>t.id===e.devId);if(!s||!this.host._isVacDev(s))return l;const i=s.marker?.vacuum||{},o=this.host._vacAllCamerasFor===s.id,a=this.host._vacSourceResolution(s,o),n=a.entityId,r=a.candidates.find(t=>t.entityId===n)||null,c=n?li(this.host.hass?.states[n]?.attributes):null,d=!1!==i.live&&("ok"===a.status||"unsupported"===a.status),p=this._vacPlanRoomAnchors(s.space),u=c?hi(c.rooms,p.map(t=>t.name)):0,_=!!(d&&c&&u>=3),m=t=>{const e=this.host._vacEnsureMarker(s);e&&(e.vacuum={...e.vacuum||{},...t},this.host._regSignature="",this.host._maybeRebuildDevices(),this._saveConfig(),this.host.requestUpdate())},g=new Set(s.entities||[]),f=a.candidates.filter(t=>g.has(t.entityId)||t.entityId===i.source),b=o?a.candidates.filter(t=>t.entityId.startsWith("camera.")&&!f.some(e=>e.entityId===t.entityId)):[],v=t=>[t.hasPosition?this.host._t("vac.cap_position"):"",t.hasRooms?this.host._t("vac.cap_rooms_short"):"",t.hasPath?this.host._t("vac.cap_path"):"",t.hasMapId?this.host._t("vac.cap_map"):""].filter(Boolean).join(" · ")||this.host._t("vac.cap_none"),y=t=>h` +
    `}_renderVacSection(t){const e=this.host._devices.find(e=>e.id===t.devId);if(!e||!this.host._isVacDev(e))return d;const s=e.marker?.vacuum||{},o=this.host._vacAllCamerasFor===e.id,a=this.host._vacSourceResolution(e,o),n=a.entityId,r=a.candidates.find(t=>t.entityId===n)||null,l=n?di(this.host.hass?.states[n]?.attributes):null,h=!1!==s.live&&("ok"===a.status||"unsupported"===a.status),c=this._vacPlanRoomAnchors(e.space),u=l?pi(l.rooms,c.map(t=>t.name)):0,_=!!(h&&l&&u>=3),m=t=>{const s=this.host._vacEnsureMarker(e);s&&(s.vacuum={...s.vacuum||{},...t},this.host._regSignature="",this.host._maybeRebuildDevices(),this._saveConfig(),this.host.requestUpdate())},g=new Set(e.entities||[]),f=a.candidates.filter(t=>g.has(t.entityId)||t.entityId===s.source),b=o?a.candidates.filter(t=>t.entityId.startsWith("camera.")&&!f.some(e=>e.entityId===t.entityId)):[],v=t=>[t.hasPosition?this.host._t("vac.cap_position"):"",t.hasRooms?this.host._t("vac.cap_rooms_short"):"",t.hasPath?this.host._t("vac.cap_path"):"",t.hasMapId?this.host._t("vac.cap_map"):""].filter(Boolean).join(" · ")||this.host._t("vac.cap_none"),y=t=>p` `,$=a.candidates.some(t=>g.has(t.entityId)&&"known_xcme_incomplete"===t.category)||!!a.pinned&&!!n?.startsWith("camera.")&&!r?.hasPosition;return h` + `,$=a.candidates.some(t=>g.has(t.entityId)&&"known_xcme_incomplete"===t.category)||!!a.pinned&&!!n?.startsWith("camera.")&&!r?.hasPosition;return p`
    ${this.host._t("vac.diag_source")}${n||this.host._t("vac.source_none")}
    - ${r?.platform?h`
    ${this.host._t("vac.diag_platform")}${r.platform}
    `:l} + ${r?.platform?p`
    ${this.host._t("vac.diag_platform")}${r.platform}
    `:d}
    ${this.host._t("vac.diag_status")}${this.host._t(`vac.source_status_${a.status}`)}
    -
    ${this.host._t("vac.diag_position")}${c?.pos?this.host._t("common.yes"):this.host._t("common.no")}
    -
    ${this.host._t("vac.diag_rooms")}${t(this.host._t("vac.diag_rooms_value"),{total:String(c?.rooms.length||0),matched:String(u),readiness:this.host._t(u>=3?"vac.autocal_ready":"vac.autocal_not_ready")})}
    -
    ${this.host._t("vac.diag_path")}${c?.path.length?this.host._t("common.yes"):this.host._t("common.no")}
    -
    ${this.host._t("vac.diag_map")}${c?.mapId??"default"}
    +
    ${this.host._t("vac.diag_position")}${l?.pos?this.host._t("common.yes"):this.host._t("common.no")}
    +
    ${this.host._t("vac.diag_rooms")}${i(this.host._t("vac.diag_rooms_value"),{total:String(l?.rooms.length||0),matched:String(u),readiness:this.host._t(u>=3?"vac.autocal_ready":"vac.autocal_not_ready")})}
    +
    ${this.host._t("vac.diag_path")}${l?.path.length?this.host._t("common.yes"):this.host._t("common.no")}
    +
    ${this.host._t("vac.diag_map")}${l?.mapId??"default"}
    - ${"missing"===a.status||"disabled"===a.status||"unverified"===a.status?h`
    + ${"missing"===a.status||"disabled"===a.status||"unverified"===a.status?p`
    ${this.host._t(`vac.source_banner_${a.status}`)} - -
    `:l} - ${$?h`
    + +
    `:d} + ${$?p`
    ${this.host._t("vac.xcme_hint")}
    attributes:
       - vacuum_position
       - rooms
       - path
       - map_name
    -
    `:l} -
    +
    `:d} +
    ${this.host._t("vac.choose_source")}
    - ${_?h``:l} - ${d?h``:l} + ${_?p``:d} + ${h?p``:d} ${this.host._t("vac.documentation")}
    - ${c?h` + ${l?p` - ${No(this,s,a)} - `:l} -
    `}_vacMapId(t,e,s=this.host._planHass){return this.host._vacMapId(t,e,s)}_vacSaveMatrix(t,e,s,i,o=""){return mc(this,t,e,s,i,o)}_vacPlanRoomAnchors(t){return(this.host._spaceModelById(t)?.rooms||[]).map(t=>({room:t,poly:H(t)})).filter(({room:t,poly:e})=>t.name&&e).map(({room:t,poly:e})=>{const s=di(e);return s?{name:String(t.name),cx:s[0],cy:s[1]}:null}).filter(Boolean)}async _vacAutoCalibrate(t){if(this.host._markerDialog?.busy)return;const s=this.host._vacSource(t),i=s?li(this.host.hass?.states[s]?.attributes):null;if(!s||!i||i.rooms.length<3)return void this.host._showToast(this.host._t("vac.autocal_no_rooms"));const o=this._vacMapId(t,i),a=function(t,s,i,o,a){const n=e(t,s,i,o).find(t=>t.source===o&&t.map_id===a);return{space:n?.space||i,routeId:n?.id||""}}(t.id,t.marker?.vacuum??null,t.space,s,o),n=pi(i.rooms,this._vacPlanRoomAnchors(a.space));if(!n)return void this.host._showToast(this.host._t("vac.autocal_no_match"));const r=this.host._serverCfg?.spaces?.find(t=>t.id===a.space),l=Number(r?.cell_cm),h=Number.isFinite(l)&&l>0?l:5,c=ui(n.residual,this.host._gridPitch,h);c>_i?this.host._vacCalConfirm={markerId:t.id,source:s,mapId:o,routeId:a.routeId,space:a.space,matrix:n.matrix,rooms:n.matched.length,error:Nt(c,"mi"===this.host.hass?.config?.unit_system?.length)}:await async function(t,e){if(uc.has(t))return;uc.add(t);const s=t.host,i=s._markerDialog,o=i?{...i,busy:!0}:null;o&&(s._markerDialog=o,s.requestUpdate());try{await mc(t,e.markerId,e.source,e.mapId,e.matrix,e.routeId)&&s._showToast(s._t("vac.autocal_done",{rooms:String(e.rooms)}))}finally{uc.delete(t),o&&s._markerDialog===o&&(s._markerDialog={...o,busy:!1},s.requestUpdate())}}(this,{markerId:t.id,source:s,mapId:o,routeId:a.routeId,space:a.space,matrix:n.matrix,rooms:n.matched.length})}_vacApplyCalibrationProposal(t){return async function(t,e){const s=t.host,o=s._vacCalConfirm;if(!o||o.busy)return;if(e){const t=s._devices.find(t=>t.id===o.markerId),e=i(o.matrix);if(!t||!e)return;const a=o.space||t.space;if(a!==s._space&&!s._commitSpace(a))return;return s._vacCalConfirm=null,s._markerDialog=null,void(s._vacFit={markerId:o.markerId,source:o.source,routeId:o.routeId,mapId:o.mapId,p:e,drag:null})}const a={...o,busy:!0};s._vacCalConfirm=a,s.requestUpdate();const n=await mc(t,o.markerId,o.source,o.mapId,o.matrix,o.routeId);s._vacCalConfirm===a&&(s._vacCalConfirm=n?null:{...o,busy:!1},s.requestUpdate()),n&&s._showToast(s._t("vac.autocal_done",{rooms:String(o.rooms)}))}(this,t)}_vacStartFit(t,a=""){if(this.host._markerDialog?.busy)return;const n=this.host._vacSource(t),r=n?li(this.host.hass?.states[n]?.attributes):null;if(!n||!r)return void this.host._showToast(this.host._t("vac.cal_need_pos"));const l=this._vacMapId(t,r),h=function(t,a,n){const r=e(t,a,n.dockSpace,n.source),l=r.find(t=>t.id===n.routeId)||r.find(t=>t.source===n.source&&t.map_id===n.mapId)||null,h=l?.space||n.dockSpace,c=n.viewBoxOf(h);if(!c)return null;const d=s(l?l.calibration:a?.calibration?.[n.mapId]),p=d&&i(d)||o(n.rooms,c);return{space:h,routeId:l?.id||"",params:p}}(t.id,t.marker?.vacuum??null,{routeId:a,source:n,mapId:l,dockSpace:t.space,rooms:r.rooms,viewBoxOf:t=>this.host._spaceModelById(t)?.vb??null});h&&(this.host._markerDialog=null,(h.space===this.host._space||this.host._commitSpace(h.space))&&(this.host._vacFit={markerId:t.id,source:n,mapId:l,routeId:h.routeId,p:h.params,drag:null}))}_vacFitSave(){return async function(t,e){const s=t.host,i=s._vacFit;if(!i||i.busy)return;const o={...i,busy:!0,drag:null};s._vacFit=o,s.requestUpdate();const a=await mc(t,i.markerId,i.source,i.mapId,e(i.p),i.routeId);s._vacFit===o&&(s._vacFit=a?null:{...i,busy:!1,drag:null},s.requestUpdate()),a&&s._showToast(s._t("vac.cal_done"))}(this,gi)}_vacFitTurn(t){const e=this.host._vacFit;if(!e||e.busy)return;const s=li(this.host.hass?.states[e.source]?.attributes),i=this._vacGhostCentre(s?.rooms||[]),o={...e.p,...t};this.host._vacFit={...e,p:mi(o,e.p,i[0],i[1])}}_vacGhostCentre(t){const e=[],s=[];for(const i of t)e.push(i.x0??i.cx,i.x1??i.cx),s.push(i.y0??i.cy,i.y1??i.cy);return e.length?[(Math.min(...e)+Math.max(...e))/2,(Math.min(...s)+Math.max(...s))/2]:[0,0]}_vacDelta(t,e,s){const i=this.host._stageEl,o=i?.clientWidth||1,a=i?.clientHeight||1;return[e/o*t.w,s/a*t.h]}_vacFitPointer(t,e){const s=this.host._vacFit;if(!s)return;if(t.stopPropagation(),s.busy)return;if("pointerdown"===t.type){const e=t.target,i=e.getAttribute?.("data-corner");try{t.currentTarget.setPointerCapture?.(t.pointerId)}catch{}return void(this.host._vacFit={...s,drag:i?{kind:"scale",sx:t.clientX,sy:t.clientY,p0:{...s.p},fx:Number(i.split(",")[0]),fy:Number(i.split(",")[1])}:{kind:"move",sx:t.clientX,sy:t.clientY,p0:{...s.p},fx:0,fy:0}})}const i=s.drag;if(i){if("pointermove"===t.type){const[o,a]=this._vacDelta(e,t.clientX-i.sx,t.clientY-i.sy);if("move"===i.kind)this.host._vacFit={...s,p:{...i.p0,ox:i.p0.ox+o,oy:i.p0.oy+a}};else{const t=li(this.host.hass?.states[s.source]?.attributes),e=this._vacGhostCentre(t?.rooms||[]),n=gi(i.p0),[r,l]=fi(n,e[0],e[1]),[h,c]=fi(n,i.fx,i.fy),d=Math.hypot(r-h,l-c)||1,[p,u]=[2*r-h,2*l-c],_=Math.hypot(p+2*o-h,u+2*a-c)/2,m=Math.max(.05,_/d),g={...i.p0,s:i.p0.s*m};this.host._vacFit={...s,p:mi(g,i.p0,i.fx,i.fy)}}return}"pointerup"!==t.type&&"pointercancel"!==t.type||(this.host._vacFit={...s,drag:null})}}_renderVacFit(t){const e=this.host._vacFit;if(!e)return l;const s=li(this.host._renderPlanHass?.states?.[e.source]?.attributes);if(!s)return l;const i=gi(e.p),o=[],a=[],n=[];for(const t of s.rooms){if(null==t.x0)continue;const e=[[t.x0,t.y0],[t.x1,t.y0],[t.x1,t.y1],[t.x0,t.y1]].map(([t,e])=>fi(i,t,e));e.forEach(([t,e])=>{a.push(t),n.push(e)});const[s,r]=fi(i,t.cx,t.cy);o.push(d` - ${t.name}`)}let r=l;if(s.pos){const[e,o]=fi(i,s.pos.x,s.pos.y);r=d``}const c=[];if(a.length){const e=(()=>{const t=i[0]*i[4]-i[1]*i[3];return(e,s)=>[(i[4]*(e-i[2])-i[1]*(s-i[5]))/t,(-i[3]*(e-i[2])+i[0]*(s-i[5]))/t]})(),s=Math.min(...a),o=Math.max(...a),r=Math.min(...n),l=Math.max(...n),h=.022*t.w,p=h/4;for(const[t,i,a,n]of[[s,r,o,l],[o,r,s,l],[o,l,s,r],[s,l,o,r]]){const s=e(a,n);c.push(d` - `)}}return h``}_vacMapId(t,e,s=this.host._planHass){return this.host._vacMapId(t,e,s)}_vacSaveMatrix(t,e,s,i,o=""){return vc(this,t,e,s,i,o)}_vacPlanRoomAnchors(t){return(this.host._spaceModelById(t)?.rooms||[]).map(t=>({room:t,poly:B(t)})).filter(({room:t,poly:e})=>t.name&&e).map(({room:t,poly:e})=>{const s=_i(e);return s?{name:String(t.name),cx:s[0],cy:s[1]}:null}).filter(Boolean)}async _vacAutoCalibrate(t){if(this.host._markerDialog?.busy)return;const e=this.host._vacSource(t),s=e?di(this.host.hass?.states[e]?.attributes):null;if(!e||!s||s.rooms.length<3)return void this.host._showToast(this.host._t("vac.autocal_no_rooms"));const i=this._vacMapId(t,s),a=function(t,e,s,i,a){const n=o(t,e,s,i).find(t=>t.source===i&&t.map_id===a);return{space:n?.space||s,routeId:n?.id||""}}(t.id,t.marker?.vacuum??null,t.space,e,i),n=mi(s.rooms,this._vacPlanRoomAnchors(a.space));if(!n)return void this.host._showToast(this.host._t("vac.autocal_no_match"));const r=this.host._serverCfg?.spaces?.find(t=>t.id===a.space),l=Number(r?.cell_cm),h=Number.isFinite(l)&&l>0?l:5,c=gi(n.residual,this.host._gridPitch,h);c>fi?this.host._vacCalConfirm={markerId:t.id,source:e,mapId:i,routeId:a.routeId,space:a.space,matrix:n.matrix,rooms:n.matched.length,error:Ot(c,"mi"===this.host.hass?.config?.unit_system?.length)}:await async function(t,e){if(fc.has(t))return;fc.add(t);const s=t.host,i=s._markerDialog,o=i?{...i,busy:!0}:null;o&&(s._markerDialog=o,s.requestUpdate());try{await vc(t,e.markerId,e.source,e.mapId,e.matrix,e.routeId)&&s._showToast(s._t("vac.autocal_done",{rooms:String(e.rooms)}))}finally{fc.delete(t),o&&s._markerDialog===o&&(s._markerDialog={...o,busy:!1},s.requestUpdate())}}(this,{markerId:t.id,source:e,mapId:i,routeId:a.routeId,space:a.space,matrix:n.matrix,rooms:n.matched.length})}_vacApplyCalibrationProposal(t){return async function(t,e){const s=t.host,i=s._vacCalConfirm;if(!i||i.busy)return;if(e){const t=s._devices.find(t=>t.id===i.markerId),e=n(i.matrix);if(!t||!e)return;const o=i.space||t.space;if(o!==s._space&&!s._commitSpace(o))return;return s._vacCalConfirm=null,s._markerDialog=null,void(s._vacFit={markerId:i.markerId,source:i.source,routeId:i.routeId,mapId:i.mapId,p:e,drag:null})}const o={...i,busy:!0};s._vacCalConfirm=o,s.requestUpdate();const a=await vc(t,i.markerId,i.source,i.mapId,i.matrix,i.routeId);s._vacCalConfirm===o&&(s._vacCalConfirm=a?null:{...i,busy:!1},s.requestUpdate()),a&&s._showToast(s._t("vac.autocal_done",{rooms:String(i.rooms)}))}(this,t)}_vacStartFit(t,e=""){if(this.host._markerDialog?.busy)return;const s=this.host._vacSource(t),i=s?di(this.host.hass?.states[s]?.attributes):null;if(!s||!i)return void this.host._showToast(this.host._t("vac.cal_need_pos"));const l=this._vacMapId(t,i),h=function(t,e,s){const i=o(t,e,s.dockSpace,s.source),l=i.find(t=>t.id===s.routeId)||i.find(t=>t.source===s.source&&t.map_id===s.mapId)||null,h=l?.space||s.dockSpace,c=s.viewBoxOf(h);if(!c)return null;const d=a(l?l.calibration:e?.calibration?.[s.mapId]),p=d&&n(d)||r(s.rooms,c);return{space:h,routeId:l?.id||"",params:p}}(t.id,t.marker?.vacuum??null,{routeId:e,source:s,mapId:l,dockSpace:t.space,rooms:i.rooms,viewBoxOf:t=>this.host._spaceModelById(t)?.vb??null});h&&(this.host._markerDialog=null,(h.space===this.host._space||this.host._commitSpace(h.space))&&(this.host._vacFit={markerId:t.id,source:s,mapId:l,routeId:h.routeId,p:h.params,drag:null}))}_vacFitSave(){return async function(t,e){const s=t.host,i=s._vacFit;if(!i||i.busy)return;const o={...i,busy:!0,drag:null};s._vacFit=o,s.requestUpdate();const a=await vc(t,i.markerId,i.source,i.mapId,e(i.p),i.routeId);s._vacFit===o&&(s._vacFit=a?null:{...i,busy:!1,drag:null},s.requestUpdate()),a&&s._showToast(s._t("vac.cal_done"))}(this,vi)}_vacFitTurn(t){const e=this.host._vacFit;if(!e||e.busy)return;const s=di(this.host.hass?.states[e.source]?.attributes),i=this._vacGhostCentre(s?.rooms||[]),o={...e.p,...t};this.host._vacFit={...e,p:bi(o,e.p,i[0],i[1])}}_vacGhostCentre(t){const e=[],s=[];for(const i of t)e.push(i.x0??i.cx,i.x1??i.cx),s.push(i.y0??i.cy,i.y1??i.cy);return e.length?[(Math.min(...e)+Math.max(...e))/2,(Math.min(...s)+Math.max(...s))/2]:[0,0]}_vacDelta(t,e,s){const i=this.host._stageEl,o=i?.clientWidth||1,a=i?.clientHeight||1;return[e/o*t.w,s/a*t.h]}_vacFitPointer(t,e){const s=this.host._vacFit;if(!s)return;if(t.stopPropagation(),s.busy)return;if("pointerdown"===t.type){const e=t.target,i=e.getAttribute?.("data-corner");try{t.currentTarget.setPointerCapture?.(t.pointerId)}catch{}return void(this.host._vacFit={...s,drag:i?{kind:"scale",sx:t.clientX,sy:t.clientY,p0:{...s.p},fx:Number(i.split(",")[0]),fy:Number(i.split(",")[1])}:{kind:"move",sx:t.clientX,sy:t.clientY,p0:{...s.p},fx:0,fy:0}})}const i=s.drag;if(i){if("pointermove"===t.type){const[o,a]=this._vacDelta(e,t.clientX-i.sx,t.clientY-i.sy);if("move"===i.kind)this.host._vacFit={...s,p:{...i.p0,ox:i.p0.ox+o,oy:i.p0.oy+a}};else{const t=di(this.host.hass?.states[s.source]?.attributes),e=this._vacGhostCentre(t?.rooms||[]),n=vi(i.p0),[r,l]=yi(n,e[0],e[1]),[h,c]=yi(n,i.fx,i.fy),d=Math.hypot(r-h,l-c)||1,[p,u]=[2*r-h,2*l-c],_=Math.hypot(p+2*o-h,u+2*a-c)/2,m=Math.max(.05,_/d),g={...i.p0,s:i.p0.s*m};this.host._vacFit={...s,p:bi(g,i.p0,i.fx,i.fy)}}return}"pointerup"!==t.type&&"pointercancel"!==t.type||(this.host._vacFit={...s,drag:null})}}_renderVacFit(t){const e=this.host._vacFit;if(!e)return d;const s=di(this.host._renderPlanHass?.states?.[e.source]?.attributes);if(!s)return d;const i=vi(e.p),o=[],a=[],n=[];for(const t of s.rooms){if(null==t.x0)continue;const e=[[t.x0,t.y0],[t.x1,t.y0],[t.x1,t.y1],[t.x0,t.y1]].map(([t,e])=>yi(i,t,e));e.forEach(([t,e])=>{a.push(t),n.push(e)});const[s,r]=yi(i,t.cx,t.cy);o.push(_` + ${t.name}`)}let r=d;if(s.pos){const[e,o]=yi(i,s.pos.x,s.pos.y);r=_``}const l=[];if(a.length){const e=(()=>{const t=i[0]*i[4]-i[1]*i[3];return(e,s)=>[(i[4]*(e-i[2])-i[1]*(s-i[5]))/t,(-i[3]*(e-i[2])+i[0]*(s-i[5]))/t]})(),s=Math.min(...a),o=Math.max(...a),r=Math.min(...n),h=Math.max(...n),c=.022*t.w,d=c/4;for(const[t,i,a,n]of[[s,r,o,h],[o,r,s,h],[o,h,s,r],[s,h,o,r]]){const s=e(a,n);l.push(_` + `)}}return p`this._vacFitPointer(e,t)} @pointermove=${e=>this._vacFitPointer(e,t)} @pointerup=${e=>this._vacFitPointer(e,t)} - @pointercancel=${e=>this._vacFitPointer(e,t)}>${o}${r}${c}`}_resetRoomDialogFields(){this.host._roomEditId=null,this.host._roomFill="",this.host._roomCustomFill=null,this.host._roomTempMin="",this.host._roomTempMax="",this.host._roomTempSrc="",this.host._roomHumSrc="",this.host._roomSrcOpen=null,this.host._roomSrcFilter="",this.host._roomNameScale=1,this.host._roomLabelScale=1}_openRoomEdit(t){if(!t.id)return;this.host._roomEditId=t.id,this.host._nameSel=t.name||"",this.host._areaSel=t.area||"",this.host._roomFill="glow"===t.settings?.fill_mode?"":t.settings?.fill_mode||"";const e=t.settings?.custom_fill;this.host._roomCustomFill=e&&"object"==typeof e?Ls(e,Os(this.host._curSpaceCfg).customFill):null,[this.host._roomTempMin,this.host._roomTempMax]=bi(t.settings),this.host._roomTempSrc=t.settings?.temp_source||"",this.host._roomHumSrc=t.settings?.hum_source||"",this.host._roomNameScale=vi(t.settings?.name_scale),this.host._roomLabelScale=vi(t.settings?.label_scale),this.host._roomSrcOpen=null,this.host._roomSrcFilter="",this.host._roomDialog=!0}_roomSettingsFromDialog(){const t={};return this.host._roomFill&&(t.fill_mode=this.host._roomFill),this.host._roomCustomFill&&(t.custom_fill=this.host._roomCustomFill),this.host._roomTempSrc&&(t.temp_source=this.host._roomTempSrc),this.host._roomHumSrc&&(t.hum_source=this.host._roomHumSrc),yi(t,this.host._roomTempMin,this.host._roomTempMax),1!==this.host._roomNameScale&&(t.name_scale=this.host._roomNameScale),1!==this.host._roomLabelScale&&(t.label_scale=this.host._roomLabelScale),Object.keys(t).length?t:null}_saveRoomEdit(){const t=this.host._curSpaceCfg,e=t?.rooms.find(t=>t.id===this.host._roomEditId);if(!e)return this.host._roomDialog=!1,void(this.host._roomEditId=null);e.name=this.host._nameSel.trim()||e.name,e.area=this.host._areaSel||null;const s=e.settings||{},i={...s};yi(i,this.host._roomTempMin,this.host._roomTempMax)&&(this.host._roomFill?i.fill_mode=this.host._roomFill:delete i.fill_mode,this.host._roomCustomFill?i.custom_fill=this.host._roomCustomFill:delete i.custom_fill,"glow"===s.fill_mode&&"boolean"!=typeof s.glow&&(i.glow=!0),this.host._roomTempSrc?i.temp_source=this.host._roomTempSrc:delete i.temp_source,this.host._roomHumSrc?i.hum_source=this.host._roomHumSrc:delete i.hum_source,1!==this.host._roomNameScale?i.name_scale=this.host._roomNameScale:delete i.name_scale,1!==this.host._roomLabelScale?i.label_scale=this.host._roomLabelScale:delete i.label_scale,Object.keys(i).length?e.settings=i:delete e.settings,this._saveConfig(),this.host._roomDialog=!1,this.host._roomEditId=null,this.host._nameSel="",this.host._areaSel="",this.host._regSignature="",this.host._maybeRebuildDevices(),this.host.requestUpdate(),this.host._showToast(this.host._t("toast.room_updated")))}_roomSrcCandidates(){const t=this.host._planHass,e=Rt(this.host._markers),s=this.host._roomSrcFilter.trim().toLowerCase(),i=[];for(const o of Object.values(t.devices)){if("service"===o.entry_type)continue;if(e.devices.has(o.id))continue;const t=(o.name_by_user||o.name||o.id).trim();s&&!t.toLowerCase().includes(s)||i.push({value:"device:"+o.id,label:t,sub:o.model||this.host._t("marker.sub_device")})}for(const[o,a]of Object.entries(t.entities)){if(!o.startsWith("sensor.")||a.hidden)continue;if(At(t,o,e))continue;const n=a.name||t.states[o]?.attributes?.friendly_name||o;s&&!(n+" "+o).toLowerCase().includes(s)||i.push({value:"entity:"+o,label:n,sub:o})}return i.sort((t,e)=>t.label.localeCompare(e.label)),i.slice(0,200)}_roomSrcLabel(t){const e=t.indexOf(":"),s=t.slice(0,e),i=t.slice(e+1);return"device"===s?this.host._fullRegistryHass.devices[i]?.name_by_user||this.host._fullRegistryHass.devices[i]?.name||i:this.host._fullRegistryHass.entities[i]?.name||this.host.hass.states[i]?.attributes?.friendly_name||i}_labelPos(t,e){const s=this.host._layout["rl_"+(t.id||"")];if(s&&s.s===e)return{x:s.x*Zc,y:s.y*Zc};const i=this._snap(this.host._roomCenter(t));return{x:i[0],y:i[1]}}_labelDown(t,e,s){if("plan"!==this.host._mode)return;t.preventDefault(),t.stopPropagation();const i=this._labelPos(e,s);this.host._drag={id:"rl_"+(e.id||""),sx:t.clientX,sy:t.clientY,ox:i.x,oy:i.y,moved:!1},td(t),this.host._tip=null}_labelMove(t,e,s){const i="rl_"+(e.id||"");if(!this.host._drag||this.host._drag.id!==i)return;const o=this.host._stageEl;if(!o)return;const a=this.host._spaceModelById(s);if(!a)return;const n=a.vb,r=o.getBoundingClientRect(),l=this.host._viewOr(n),h=(t.clientX-this.host._drag.sx)/r.width*l.w,c=(t.clientY-this.host._drag.sy)/r.height*l.h;Math.abs(t.clientX-this.host._drag.sx)+Math.abs(t.clientY-this.host._drag.sy)>3&&(this.host._drag.moved=!0);const d=ue(this.host._drag.ox+h),p=ue(this.host._drag.oy+c);this.host._savePos({id:i,space:s},d,p)}_labelUp(t){const e="rl_"+(t.id||"");if(!this.host._drag||this.host._drag.id!==e)return;const s=this.host._drag.moved;this.host._drag=s?this.host._drag:null,s&&window.setTimeout(()=>this.host._drag=null,0)}_labelScale(t){const e=this.host._layout["rl_"+(t.id||"")]?.k;return"number"==typeof e&&Number.isFinite(e)?Math.min(3,Math.max(.5,e)):1}_rlResizeDown(t,e,s){if("plan"!==this.host._mode)return;t.preventDefault(),t.stopPropagation();const i=t.target.closest(".roomlabel");if(!i)return;const o=i.getBoundingClientRect(),a=o.left+o.width/2,n=o.top+o.height/2,r=Math.max(8,Math.hypot(t.clientX-a,t.clientY-n));this.host._rlResize={id:"rl_"+(e.id||""),space:s,k0:this._labelScale(e),cx:a,cy:n,d0:r},td(t)}_rlResizeMove(t){const e=this.host._rlResize;if(!e)return;t.stopPropagation();const s=Math.max(8,Math.hypot(t.clientX-e.cx,t.clientY-e.cy)),i=Math.min(3,Math.max(.5,e.k0*(s/e.d0))),o=this.host._layout[e.id];if(o)this.host._layout={...this.host._layout,[e.id]:{...o,k:i}};else{const t=e.id.slice(3),s=this.host._spaceModelById(e.space);if(!s)return;const o=s.rooms.find(e=>e.id===t);if(!o)return;const a=this._labelPos(o,e.space);this.host._layout={...this.host._layout,[e.id]:{s:e.space,x:a.x/Zc,y:a.y/Zc,k:i}}}this.host._dirtyPos.add(e.id)}_rlResizeUp(){this.host._rlResize&&(this.host._rlResize=null,this.host._persistLayout())}_renderRoomGear(t,e,s){if(!t.id)return l;let i=null;if(t.poly?(i=this.host._gearPtCache.get(t.poly)||null,i||(i=Ee(t.poly),this.host._gearPtCache.set(t.poly,i))):null!=t.x&&null!=t.y&&(i=[t.x+(t.w||0)/2,t.y+(t.h||0)/2]),!i)return l;const o=(i[0]-s.x)/s.w*100,a=(i[1]-s.y)/s.h*100;return h``}_resetRoomDialogFields(){this.host._roomEditId=null,this.host._roomFill="",this.host._roomCustomFill=null,this.host._roomTempMin="",this.host._roomTempMax="",this.host._roomTempSrc="",this.host._roomHumSrc="",this.host._roomSrcOpen=null,this.host._roomSrcFilter="",this.host._roomNameScale=1,this.host._roomLabelScale=1}_openRoomEdit(t){if(!t.id)return;this.host._roomEditId=t.id,this.host._nameSel=t.name||"",this.host._areaSel=t.area||"",this.host._roomFill="glow"===t.settings?.fill_mode?"":t.settings?.fill_mode||"";const e=t.settings?.custom_fill;this.host._roomCustomFill=e&&"object"==typeof e?js(e,Ws(this.host._curSpaceCfg).customFill):null,[this.host._roomTempMin,this.host._roomTempMax]=$i(t.settings),this.host._roomTempSrc=t.settings?.temp_source||"",this.host._roomHumSrc=t.settings?.hum_source||"",this.host._roomNameScale=wi(t.settings?.name_scale),this.host._roomLabelScale=wi(t.settings?.label_scale),this.host._roomSrcOpen=null,this.host._roomSrcFilter="",this.host._roomDialog=!0}_roomSettingsFromDialog(){const t={};return this.host._roomFill&&(t.fill_mode=this.host._roomFill),this.host._roomCustomFill&&(t.custom_fill=this.host._roomCustomFill),this.host._roomTempSrc&&(t.temp_source=this.host._roomTempSrc),this.host._roomHumSrc&&(t.hum_source=this.host._roomHumSrc),ki(t,this.host._roomTempMin,this.host._roomTempMax),1!==this.host._roomNameScale&&(t.name_scale=this.host._roomNameScale),1!==this.host._roomLabelScale&&(t.label_scale=this.host._roomLabelScale),Object.keys(t).length?t:null}_saveRoomEdit(){const t=this.host._curSpaceCfg,e=t?.rooms.find(t=>t.id===this.host._roomEditId);if(!e)return this.host._roomDialog=!1,void(this.host._roomEditId=null);e.name=this.host._nameSel.trim()||e.name,e.area=this.host._areaSel||null;const s=e.settings||{},i={...s};ki(i,this.host._roomTempMin,this.host._roomTempMax)&&(this.host._roomFill?i.fill_mode=this.host._roomFill:delete i.fill_mode,this.host._roomCustomFill?i.custom_fill=this.host._roomCustomFill:delete i.custom_fill,"glow"===s.fill_mode&&"boolean"!=typeof s.glow&&(i.glow=!0),this.host._roomTempSrc?i.temp_source=this.host._roomTempSrc:delete i.temp_source,this.host._roomHumSrc?i.hum_source=this.host._roomHumSrc:delete i.hum_source,1!==this.host._roomNameScale?i.name_scale=this.host._roomNameScale:delete i.name_scale,1!==this.host._roomLabelScale?i.label_scale=this.host._roomLabelScale:delete i.label_scale,Object.keys(i).length?e.settings=i:delete e.settings,this._saveConfig(),this.host._roomDialog=!1,this.host._roomEditId=null,this.host._nameSel="",this.host._areaSel="",this.host._regSignature="",this.host._maybeRebuildDevices(),this.host.requestUpdate(),this.host._showToast(this.host._t("toast.room_updated")))}_roomSrcCandidates(){const t=this.host._planHass,e=Nt(this.host._markers),s=this.host._roomSrcFilter.trim().toLowerCase(),i=[];for(const o of Object.values(t.devices)){if("service"===o.entry_type)continue;if(e.devices.has(o.id))continue;const t=(o.name_by_user||o.name||o.id).trim();s&&!t.toLowerCase().includes(s)||i.push({value:"device:"+o.id,label:t,sub:o.model||this.host._t("marker.sub_device")})}for(const[o,a]of Object.entries(t.entities)){if(!o.startsWith("sensor.")||a.hidden)continue;if(Et(t,o,e))continue;const n=a.name||t.states[o]?.attributes?.friendly_name||o;s&&!(n+" "+o).toLowerCase().includes(s)||i.push({value:"entity:"+o,label:n,sub:o})}return i.sort((t,e)=>t.label.localeCompare(e.label)),i.slice(0,200)}_roomSrcLabel(t){const e=t.indexOf(":"),s=t.slice(0,e),i=t.slice(e+1);return"device"===s?this.host._fullRegistryHass.devices[i]?.name_by_user||this.host._fullRegistryHass.devices[i]?.name||i:this.host._fullRegistryHass.entities[i]?.name||this.host.hass.states[i]?.attributes?.friendly_name||i}_labelPos(t,e){const s=this.host._layout["rl_"+(t.id||"")];if(s&&s.s===e)return{x:s.x*sd,y:s.y*sd};const i=this._snap(this.host._roomCenter(t));return{x:i[0],y:i[1]}}_labelDown(t,e,s){if("plan"!==this.host._mode)return;t.preventDefault(),t.stopPropagation();const i=this._labelPos(e,s);this.host._drag={id:"rl_"+(e.id||""),sx:t.clientX,sy:t.clientY,ox:i.x,oy:i.y,moved:!1},od(t),this.host._tip=null}_labelMove(t,e,s){const i="rl_"+(e.id||"");if(!this.host._drag||this.host._drag.id!==i)return;const o=this.host._stageEl;if(!o)return;const a=this.host._spaceModelById(s);if(!a)return;const n=a.vb,r=o.getBoundingClientRect(),l=this.host._viewOr(n),h=(t.clientX-this.host._drag.sx)/r.width*l.w,c=(t.clientY-this.host._drag.sy)/r.height*l.h;Math.abs(t.clientX-this.host._drag.sx)+Math.abs(t.clientY-this.host._drag.sy)>3&&(this.host._drag.moved=!0);const d=ge(this.host._drag.ox+h),p=ge(this.host._drag.oy+c);this.host._savePos({id:i,space:s},d,p)}_labelUp(t){const e="rl_"+(t.id||"");if(!this.host._drag||this.host._drag.id!==e)return;const s=this.host._drag.moved;this.host._drag=s?this.host._drag:null,s&&window.setTimeout(()=>this.host._drag=null,0)}_labelScale(t){const e=this.host._layout["rl_"+(t.id||"")]?.k;return"number"==typeof e&&Number.isFinite(e)?Math.min(3,Math.max(.5,e)):1}_rlResizeDown(t,e,s){if("plan"!==this.host._mode)return;t.preventDefault(),t.stopPropagation();const i=t.target.closest(".roomlabel");if(!i)return;const o=i.getBoundingClientRect(),a=o.left+o.width/2,n=o.top+o.height/2,r=Math.max(8,Math.hypot(t.clientX-a,t.clientY-n));this.host._rlResize={id:"rl_"+(e.id||""),space:s,k0:this._labelScale(e),cx:a,cy:n,d0:r},od(t)}_rlResizeMove(t){const e=this.host._rlResize;if(!e)return;t.stopPropagation();const s=Math.max(8,Math.hypot(t.clientX-e.cx,t.clientY-e.cy)),i=Math.min(3,Math.max(.5,e.k0*(s/e.d0))),o=this.host._layout[e.id];if(o)this.host._layout={...this.host._layout,[e.id]:{...o,k:i}};else{const t=e.id.slice(3),s=this.host._spaceModelById(e.space);if(!s)return;const o=s.rooms.find(e=>e.id===t);if(!o)return;const a=this._labelPos(o,e.space);this.host._layout={...this.host._layout,[e.id]:{s:e.space,x:a.x/sd,y:a.y/sd,k:i}}}this.host._dirtyPos.add(e.id)}_rlResizeUp(){this.host._rlResize&&(this.host._rlResize=null,this.host._persistLayout())}_renderRoomGear(t,e,s){if(!t.id)return d;let i=null;if(t.poly?(i=this.host._gearPtCache.get(t.poly)||null,i||(i=Le(t.poly),this.host._gearPtCache.set(t.poly,i))):null!=t.x&&null!=t.y&&(i=[t.x+(t.w||0)/2,t.y+(t.h||0)/2]),!i)return d;const o=(i[0]-s.x)/s.w*100,a=(i[1]-s.y)/s.h*100;return p``}_alignCandidates(){const t=[],e=this.host._spaceModel();if(this.host._markup){if(!e)return t;if(this.host._drag?.id.startsWith("rl_")){const s=this.host._drag.id.slice(3);for(const i of e.rooms){if(!i.name||i.id===s)continue;const e=this._labelPos(i,this.host._space);t.push([e.x,e.y])}return t}for(const s of e.rooms){const e=H(s);if(e)for(const s of e)t.push(s)}if("draw"===this.host._tool)for(const e of this.host._path)t.push(e);if("split"===this.host._tool&&this.host._splitSel?.pts)for(const e of this.host._splitSel.pts)t.push(e);return t}if("devices"===this.host._mode){const e=this.host._deviceDrag?.id??this.host._drag?.id;for(const s of this.host._devices){if(s.space!==this.host._space||s.id===e||"ha_disabled"===s.bindingStatus?.kind)continue;const i=this.host._pos(s);t.push([i.x,i.y])}return t}if("decor"===this.host._mode){const e=this.host._decorMove?.id;return t.push(...this._decorSnapGeometry(e).points),this.host._decorDraft&&t.push(this.host._decorDraft.a),t}return t}_renderAlignGuides(){const t=this.host._alignPoint;if(!t)return d``;const e=this.host._drag?.id.startsWith("rl_")?.5*this.host._gridPitch:.05*this.host._gridPitch,s=$i(t,this._alignCandidates(),e);if(!s.length)return d``;const i=this.host._gridPitch,o=1.5*i;return d` - ${s.map(e=>{const[s,a,n,r]="x"===e.axis?[e.at,e.from[1],e.at,t[1]+Math.sign(t[1]-e.from[1])*o]:[e.from[0],e.at,t[0]+Math.sign(t[0]-e.from[0])*o,e.at];return d` + `}_alignCandidates(){const t=[],e=this.host._spaceModel();if(this.host._markup){if(!e)return t;if(this.host._drag?.id.startsWith("rl_")){const s=this.host._drag.id.slice(3);for(const i of e.rooms){if(!i.name||i.id===s)continue;const e=this._labelPos(i,this.host._space);t.push([e.x,e.y])}return t}for(const s of e.rooms){const e=B(s);if(e)for(const s of e)t.push(s)}if("draw"===this.host._tool)for(const e of this.host._path)t.push(e);if("split"===this.host._tool&&this.host._splitSel?.pts)for(const e of this.host._splitSel.pts)t.push(e);return t}if("devices"===this.host._mode){const e=this.host._deviceDrag?.id??this.host._drag?.id;for(const s of this.host._devices){if(s.space!==this.host._space||s.id===e||"ha_disabled"===s.bindingStatus?.kind)continue;const i=this.host._pos(s);t.push([i.x,i.y])}return t}if("decor"===this.host._mode){const e=this.host._decorMove?.id;return t.push(...this._decorSnapGeometry(e).points),this.host._decorDraft&&t.push(this.host._decorDraft.a),t}return t}_renderAlignGuides(){const t=this.host._alignPoint;if(!t)return _``;const e=this.host._drag?.id.startsWith("rl_")?.5*this.host._gridPitch:.05*this.host._gridPitch,s=xi(t,this._alignCandidates(),e);if(!s.length)return _``;const i=this.host._gridPitch,o=1.5*i;return _` + ${s.map(e=>{const[s,a,n,r]="x"===e.axis?[e.at,e.from[1],e.at,t[1]+Math.sign(t[1]-e.from[1])*o]:[e.from[0],e.at,t[0]+Math.sign(t[0]-e.from[0])*o,e.at];return _` `})} - `}_renderOpeningCenterTick(t){const e=(t.angle+90)*Math.PI/180,s=f(15,this.host._cellCm);return d``})} + `}_renderOpeningCenterTick(t){const e=(t.angle+90)*Math.PI/180,s=y(15,this.host._cellCm);return _``}_renderOpeningDimensionGuides(t){const e=t.labels.flatMap(t=>t.dimension?[t.dimension]:[]);if(!e.length)return d``;const s=this._cssPxToRender(4);return d`
    - `}_renderPhysicalDialog(){const t=this.host._physicalDialog,e="column"===t.kind;return h``}_renderPhysicalDialog(){const t=this.host._physicalDialog,e="column"===t.kind;return p`this.host._physicalDialog=null}>
    - ${e?h` + ${e?p` `:l} + `:d}
    this.host._physicalDialog={...t,cm:e.target.value}} /> ${this.host._t(this.host._imperial?"wallthick.unit_in":"wallthick.unit_cm")}
    - ${e&&"square"===t.shape?h` + ${e&&"square"===t.shape?p` this.host._physicalDialog={...t,angle:e.target.value}} />`:l} - ${t.length?h`
    ${this.host._t("physical.length")}: ${t.length}
    `:l} + @input=${e=>this.host._physicalDialog={...t,angle:e.target.value}} />`:d} + ${t.length?p`
    ${this.host._t("physical.length")}: ${t.length}
    `:d}
    -
    `}_renderMarkupBar(){const t=this.host._geometryHistory.undoName,e=this.host._geometryHistory.redoName,s=t?this.host._t("history.undo_named",{name:t}):this.host._t("history.undo_empty"),i=e?this.host._t("history.redo_named",{name:e}):this.host._t("history.redo_empty");return h`
    + `}_renderMarkupBar(){const t=this.host._geometryHistory.undoName,e=this.host._geometryHistory.redoName,s=t?this.host._t("history.undo_named",{name:t}):this.host._t("history.undo_empty"),i=e?this.host._t("history.redo_named",{name:e}):this.host._t("history.redo_empty");return p`
    @@ -1932,7 +1932,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    -
    `}_renderDevicesBar(){const t=this.host._devicePositionHistory.undoName,e=this.host._devicePositionHistory.redoName,s=t?this.host._t("history.undo_named",{name:t}):this.host._t("history.undo_empty"),i=e?this.host._t("history.redo_named",{name:e}):this.host._t("history.redo_empty");return h`
    +
    `}_renderDevicesBar(){const t=this.host._devicePositionHistory.undoName,e=this.host._devicePositionHistory.redoName,s=t?this.host._t("history.undo_named",{name:t}):this.host._t("history.undo_empty"),i=e?this.host._t("history.redo_named",{name:e}):this.host._t("history.redo_empty");return p`
    -
    `}_discoveryFilterState(t){const e=this.host._settings,s=void 0!==t.draftGroupLights?t.draftGroupLights:!1!==e.group_lights,i=e.exclude_integrations,o=void 0!==t.draftExcluded?null===t.draftExcluded?[...Ii]:t.draftExcluded:i?[...i]:[...Ii],a=void 0!==t.draftExcluded?null===t.draftExcluded:!i,n=void 0!==t.draftGroupLights||void 0!==t.draftExcluded;return{groupLights:s,excluded:o.sort(),usesProductList:a,dirty:n}}_registryIntegrations(){const t=new Set,e=this.host._fullRegistryHass;for(const s of Object.values(e?.entities||{}))s?.platform&&t.add(String(s.platform));for(const s of Object.values(e?.devices||{})){const e=s?.identifiers?.[0],i=Array.isArray(e)?e[0]:null;i&&t.add(String(i))}return[...t].sort()}_discoveryFilterPreview(t){const e=this._discoveryFilterState(t),s=[e.groupLights?1:0,e.usesProductList?"p":e.excluded.join(","),this.host._cfgEpoch,this.host._regSignature].join("|");if(this._discoveryPreviewMemo?.key===s)return this._discoveryPreviewMemo.value;const i={hass:this.host.hass,registry:this.host._haRegistry,areaToSpace:Object.fromEntries(Object.entries(this.host._areaToSpace).map(([t,e])=>[t,e.space])),markers:this.host._markers,showAll:this.host._showAll,firstSpaceId:this.host._model[0]?.id||"",loc:t=>this.host._t(t),iconRules:this.host._iconRules},o=(t,e)=>new Set(ro({...i,settings:t,excluded:e})),a=(t,e)=>new Set(lo({...i,settings:t,excluded:e}).map(t=>t.bindingRef||t.id)),n=Ti(this.host._settings),r={...this.host._settings,group_lights:e.groupLights},l=new Set(e.excluded),h=o(this.host._settings,n),c=o(r,l),d=a(this.host._settings,n),p=a(r,l);let u=0,_=0,m=0;const g=t=>t.includes("light.");for(const t of h)c.has(t)||(u++,g(t)&&m++);for(const t of c)h.has(t)||(_++,g(t)&&m++);for(const t of p)d.has(t)||(u++,g(t)&&m++);for(const t of d)p.has(t)||(_++,g(t)&&m++);const f={appear:u,hide:_,lights:m};return this._discoveryPreviewMemo={key:s,value:f},f}async _saveDiscoveryFilters(t){const e=this.host._serverCfg;if(!e)return;const s=this._discoveryFilterState(t),i={...e.settings};s.groupLights?delete i.group_lights:i.group_lights=!1,s.usesProductList?delete i.exclude_integrations:i.exclude_integrations=s.excluded,this.host._serverCfg={...e,settings:i},this.host._deviceInboxMemo=null,this._discoveryPreviewMemo=null,this.host._regSignature="",this.host._deviceInbox&&(this.host._deviceInbox={...t,draftGroupLights:void 0,draftExcluded:void 0}),this._saveConfig(),this.host._maybeRebuildDevices(),this.host.requestUpdate()}_renderDiscoveryFilters(t){const e=this._discoveryFilterState(t),s=e=>this.host._deviceInbox={...t,...e},i=t.filtersOpen&&e.dirty?this._discoveryFilterPreview(t):null,o=this._registryIntegrations().filter(t=>!e.excluded.includes(t));return h`
    `}_discoveryFilterState(t){const e=this.host._settings,s=void 0!==t.draftGroupLights?t.draftGroupLights:!1!==e.group_lights,i=e.exclude_integrations,o=void 0!==t.draftExcluded?null===t.draftExcluded?[...Ri]:t.draftExcluded:i?[...i]:[...Ri],a=void 0!==t.draftExcluded?null===t.draftExcluded:!i,n=void 0!==t.draftGroupLights||void 0!==t.draftExcluded;return{groupLights:s,excluded:o.sort(),usesProductList:a,dirty:n}}_registryIntegrations(){const t=new Set,e=this.host._fullRegistryHass;for(const s of Object.values(e?.entities||{}))s?.platform&&t.add(String(s.platform));for(const s of Object.values(e?.devices||{})){const e=s?.identifiers?.[0],i=Array.isArray(e)?e[0]:null;i&&t.add(String(i))}return[...t].sort()}_discoveryFilterPreview(t){const e=this._discoveryFilterState(t),s=[e.groupLights?1:0,e.usesProductList?"p":e.excluded.join(","),this.host._cfgEpoch,this.host._regSignature].join("|");if(this._discoveryPreviewMemo?.key===s)return this._discoveryPreviewMemo.value;const i={hass:this.host.hass,registry:this.host._haRegistry,areaToSpace:Object.fromEntries(Object.entries(this.host._areaToSpace).map(([t,e])=>[t,e.space])),markers:this.host._markers,showAll:this.host._showAll,firstSpaceId:this.host._model[0]?.id||"",loc:t=>this.host._t(t),iconRules:this.host._iconRules},o=(t,e)=>new Set(co({...i,settings:t,excluded:e})),a=(t,e)=>new Set(po({...i,settings:t,excluded:e}).map(t=>t.bindingRef||t.id)),n=Ai(this.host._settings),r={...this.host._settings,group_lights:e.groupLights},l=new Set(e.excluded),h=o(this.host._settings,n),c=o(r,l),d=a(this.host._settings,n),p=a(r,l);let u=0,_=0,m=0;const g=t=>t.includes("light.");for(const t of h)c.has(t)||(u++,g(t)&&m++);for(const t of c)h.has(t)||(_++,g(t)&&m++);for(const t of p)d.has(t)||(u++,g(t)&&m++);for(const t of d)p.has(t)||(_++,g(t)&&m++);const f={appear:u,hide:_,lights:m};return this._discoveryPreviewMemo={key:s,value:f},f}async _saveDiscoveryFilters(t){const e=this.host._serverCfg;if(!e)return;const s=this._discoveryFilterState(t),i={...e.settings};s.groupLights?delete i.group_lights:i.group_lights=!1,s.usesProductList?delete i.exclude_integrations:i.exclude_integrations=s.excluded,this.host._serverCfg={...e,settings:i},this.host._deviceInboxMemo=null,this._discoveryPreviewMemo=null,this.host._regSignature="",this.host._deviceInbox&&(this.host._deviceInbox={...t,draftGroupLights:void 0,draftExcluded:void 0}),this._saveConfig(),this.host._maybeRebuildDevices(),this.host.requestUpdate()}_renderDiscoveryFilters(t){const e=this._discoveryFilterState(t),s=e=>this.host._deviceInbox={...t,...e},i=t.filtersOpen&&e.dirty?this._discoveryFilterPreview(t):null,o=this._registryIntegrations().filter(t=>!e.excluded.includes(t));return p`
    s({filtersOpen:t.target.open})}> ${this.host._t("device_inbox.filters_title")}
    `}_renderDeviceInbox(){const t=this.host._deviceInbox,e=this._deviceInboxRows(),s=Object.fromEntries(["on_plan","available","hidden","readd"].map(t=>[t,e.filter(e=>e.category===t).length])),i=function(t,e,s,i=!1){const o=s.trim().toLocaleLowerCase();return t.filter(t=>t.category===e&&(!i||t.isNew)&&(!o||t.searchText.includes(o)))}(e,t.tab,t.search,"on_plan"===t.tab&&t.onlyNew),o=i.slice(0,t.limit),a=t=>this.host._t(`device_inbox.tab_${t}`),n=`device_inbox.empty_${t.tab}`;return h``}_renderDeviceInbox(){const t=this.host._deviceInbox,e=this._deviceInboxRows(),s=Object.fromEntries(["on_plan","available","hidden","readd"].map(t=>[t,e.filter(e=>e.category===t).length])),i=function(t,e,s,i=!1){const o=s.trim().toLocaleLowerCase();return t.filter(t=>t.category===e&&(!i||t.isNew)&&(!o||t.searchText.includes(o)))}(e,t.tab,t.search,"on_plan"===t.tab&&t.onlyNew),o=i.slice(0,t.limit),a=t=>this.host._t(`device_inbox.tab_${t}`),n=`device_inbox.empty_${t.tab}`;return p`this.host._deviceInbox=null}> @@ -2018,7 +2018,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    this._deviceInboxTabKey(t)}> - ${["on_plan","available","hidden","readd"].map(e=>h` + ${["on_plan","available","hidden","readd"].map(e=>p` `)}
    - ${"on_plan"===t.tab?h``:d}
    - ${"available"===t.tab?this._renderDiscoveryFilters(t):l} + ${"available"===t.tab?this._renderDiscoveryFilters(t):d}
    - ${o.length?o.map(t=>{const e="on_plan"===t.category?t.canFind?h``:h``:"hidden"===t.category?h``:p``:"hidden"===t.category?p``:h``,s="active"===t.status.kind?"":this.host._t(`device_inbox.status_${t.status.kind}`);return h`
    ${this.host._t("device_inbox.show")}`:p``,s="active"===t.status.kind?"":this.host._t(`device_inbox.status_${t.status.kind}`);return p`
    ${t.name} - ${t.isNew?h`${this.host._t("device_inbox.new")}`:l} + ${t.isNew?p`${this.host._t("device_inbox.new")}`:d}
    ${[t.model,t.integration,t.spaceName,t.areaName].filter(Boolean).join(" · ")}
    ${"excluded_integration"===t.reason&&t.integration?this.host._t("device_inbox.reason_excluded_integration",{integration:t.integration}):this.host._t(`device_inbox.reason_${t.reason}`)} - ${s?h`${s}`:l} + ${s?p`${s}`:d}
    ${t.binding}
    ${e} - ${t.canEdit||t.canHide||"available"===t.category||"hidden"===t.category||this.host._bindingHasHaPage(t.binding)?h` + ${t.canEdit||t.canHide||"available"===t.category||"hidden"===t.category||this.host._bindingHasHaPage(t.binding)?p`
    - ${t.canEdit&&("on_plan"!==t.category||t.canFind)?h``:l} - ${t.canHide?h``:l} - ${"available"===t.category?h``:l} - ${"hidden"===t.category?h``:d} + ${t.canHide?p``:d} + ${"available"===t.category?p``:d} + ${"hidden"===t.category?p``:l} - ${this.host._bindingHasHaPage(t.binding)?h``:l} + ${this.host._t("device_inbox.find")}`:d} + ${this.host._bindingHasHaPage(t.binding)?p``:d}
    -
    `:l} + `:d}
    -
    `}):h`
    ${this.host._t(n)}
    `} +
    `}):p`
    ${this.host._t(n)}
    `}
    - ${i.length>o.length?h``:l} + `:d}
    - `}_markerValueBadgeFields(t){return zi({touched:t.valueBadgeTouched,originalHas:t.originalHasValueBadge,original:t.originalValueBadge,enabled:t.valueBadgeEnabled,source:t.valueBadgeSource,position:t.valueBadgePosition})}_markerValueSourceFields(t){return Ri({touched:t.valueSourceTouched,originalHas:t.originalHasValueSource,original:t.originalValueSource,source:t.valueSource})}_markerDraft(t){if("ha"===t.bindingMode&&(!t.binding||"virtual"===t.binding))return null;const e=zs(t.room),s=xs(t.binding,t.devId,()=>"__hp_device_preview__"),i=this.host._markers.find(e=>e.id===s||e.id===t.devId),o=Ps(t.binding,t.controls,this.host._bindingEntities(t.binding)),a=this._effectiveStoredTapAction(t),n={id:s,binding:t.binding,name:t.name.trim()||null,icon:t.icon||null,display:"badge"!==t.display?t.display:null,ripple_color:"icon_ripple"===t.display&&t.rippleColor?t.rippleColor:null,ripple_size:"icon_ripple"===t.display&&1.5!==t.rippleSize?t.rippleSize:null,size:1!==t.size?t.size:null,angle:t.angle||null,...this._markerTapActionFields(t),...this._markerToggleEntityFields(t),tap_target:"run"===a&&t.tapTarget||null,tap_confirm:!!t.tapConfirm||null,controls:o.length?o:null,...this._markerLightFields(t),...this._markerValueBadgeFields(t),...this._markerValueSourceFields(t),use_climate_temp:!!t.useClimateTemp||null,glow_radius_cm:(()=>{const e=ot(t.glowRadius);return null==e||e<=0?null:Math.round(this.host._imperial?30.48*e:100*e)})(),model:t.model.trim()||null,link:t.link.trim()||null,description:t.description.trim()||null,pdfs:t.pdfs,hidden:t.hideFromPlan,vacuum:i?.vacuum||null},r=!!i&&("string"==typeof i.area&&i.area.length>0||null===i.area&&!!i.space&&!!i.room_id);return"virtual"===t.binding||t.roomTouched?(n.space=e?.space||("virtual"===t.binding?this.host._space:null),n.area=e?.area||null,n.room_id=e?.roomId||null):r&&(n.space=i.space,n.area=i.area,n.room_id=i.room_id),n}_markerPreviewDevice(t){const e=this._markerDraft(t);if(!e)return null;const s=`${this.host._haRegistry.revision}\n${zt(this.host._markers)}\n${JSON.stringify(e)}`;if(this.host._markerPreviewMemo?.key===s)return this.host._markerPreviewMemo.device;const i=Ai({hass:this.host.hass,registry:this.host._haRegistry,areaToSpace:Object.fromEntries(Object.entries(this.host._areaToSpace).map(([t,e])=>[t,e.space])),marker:e,siblingMarkers:this.host._markers,settings:this.host._settings,excluded:this.host._excluded,showAll:this.host._showAll,firstSpaceId:this.host._model[0]?.id||this.host._space,loc:t=>this.host._t(t),iconRules:this.host._iconRules});return this.host._markerPreviewMemo={key:s,device:i},i}_markerPreviewDevices(t){const e=this.host._markerPreviewDevicesMemo;if(e?.base===this.host._devices&&e.preview===t)return e.devices;const s=[...this.host._devices.filter(e=>e.id!==t.id),t];return this.host._markerPreviewDevicesMemo={base:this.host._devices,preview:t,devices:s},s}_toggleIntent(t,e=this.host._devices){return this.host._toggleIntent(t,e)}_toggleIntentForDialog(t){const e=this._markerPreviewDevice(t);if(!e)return null;const s=this._markerPreviewDevices(e);return this._toggleIntent(e,s)}_toggleStateText(t,e){return this.host._toggleStateText(t,e)}_toggleConfirmationStateText(t){return this.host._toggleConfirmationStateText(t)}_toggleConfirmationLines(t){return this.host._toggleConfirmationLines(t)}_toggleHintLines(t){if(!t)return[];const e=t=>this.host._t(`marker.toggle_effect_${t.replace("-","_")}`),s=t=>this.host._t(`marker.toggle_skip_${t.replace("-","_")}`);return Fi(t,{single:t=>{if("via"in t&&"virtual-light"===t.via)return this.host._t("marker.virtual_light_target",{name:t.name});const e=t.entityId||("ref"in t?t.ref:""),s=t.name||e;return this.host._t("marker.toggle_hint_single",{name:s,id:e})},group:t=>this.host._t("marker.toggle_hint_group",{count:t.length,names:t.map(t=>`${t.name} (${t.entityId})`).join(", ")}),currentNext:(t,s)=>"virtual-light"===t.via?this.host._t("marker.virtual_light_current",{state:this.host._t("on"===t.state?"marker.virtual_light_state_on":"marker.virtual_light_state_off"),effect:e(s)}):this.host._t("marker.toggle_hint_current",{state:this._toggleStateText(t.entityId,t.state),effect:e(s)}),groupCurrentNext:(t,s)=>this.host._t("marker.toggle_hint_group_current",{on:t.filter(t=>"on"===t.state).length,count:t.length,effect:e(s)}),skipped:t=>this.host._t("marker.toggle_hint_skipped",{count:t.length,targets:t.map(t=>{const e=t.entityId||t.ref;return`${t.name||e} (${e}: ${s(t.reason)})`}).join(", ")}),none:t=>this.host._t(`marker.toggle_none_${t.replaceAll("-","_")}`)})}_effectiveStoredTapAction(t,e){return t.tapActionTouched?t.tapAction:Ds(t.originalHasTapAction?t.originalTapAction:null,e)}_effectiveMarkerTapAction(t,e=this._markerPreviewDevice(t)){return this._effectiveStoredTapAction(t,e?.primary?.split(".")[0])}_announceToggleDraft(t){const e=this._markerPreviewDevice(t),s=t.tapActionTouched?t:{...t,tapAction:this._effectiveMarkerTapAction(t,e)},i="toggle"===s.tapAction?this._toggleHintLines(this._toggleIntentForDialog(s)).join(" "):"";return{...s,tapHintAnnouncement:i}}_valueBadgeForBinding(t,e){const s={...t,binding:e,valueBadgeEnabled:!1,valueBadgeSource:null,valueBadgeTouched:!0},i=this._markerPreviewDevice(s);if(!i)return{valueBadgeEnabled:!1,valueBadgeSource:null,valueBadgeTouched:!0};const o=[...this.host._devices.filter(t=>t.id!==i.id),i],a=Ms(this.host._planHass,i,o),n=Cs(this.host._planHass,i,a);return{valueBadgeEnabled:t.valueBadgeEnabled&&!!n,valueBadgeSource:n,valueBadgeTouched:!0}}_markerSpatialSource(t){const e=this._markerPreviewDevice(t);if(!e)return null;const s={...e,hidden:!1};return Ni(Ei(this.host._planHass,[...this.host._devices.filter(t=>t.id!==s.id),s],null,this.host._virtualLights).filter(t=>t.device.id===s.id))}_markerAutoHasSpatialSource(t){const e={...t,lightRole:"auto",lightRoleTouched:!0},s=this._markerPreviewDevice(e);return!!s&&Hi(this.host._planHass,{...s})}_setMarkerLightRole(t){const e=this.host._markerDialog;e&&(this.host._markerDialog={...e,lightRole:t,lightRoleTouched:!0})}_controlRefInfo(t){if(!t.startsWith("marker:"))return{label:this.host.hass.states[t]?.attributes?.friendly_name||t,sub:t,icon:t.startsWith("light.")?"mdi:lightbulb":"mdi:toggle-switch",warning:!this.host._planEntityAvailable(t)};const e=t.slice(7),s=this.host._markers.find(t=>t.id===e),i=this.host._devices.find(t=>t.id===e);if(!s||s.removed||!0!==s.is_light)return{label:this.host._t("marker.control_missing_label"),sub:`${this.host._t("marker.control_broken")} (${t})`,icon:"mdi:alert-outline",warning:!0};const o=this.host._serverCfg?.spaces.find(t=>t.id===(i?.space||s.space)),a=!!i&&Oi(i).length>0;return{label:s.name||i?.name||e,sub:[o?.title||i?.space||s.space,s.room_id||i?.area,a?"":this.host._t("marker.control_passive")].filter(Boolean).join(" · "),icon:s.icon||i?.icon||"mdi:lightbulb-outline",warning:!0===s.hidden||!0===i?.hidden}}_valueBadgeCandidateLabel(t){const e=t.source;if("derived_lqi"===e.kind)return this.host._t("marker.value_badge_lqi");if("derived_marker_state"===e.kind)return this.host._t("marker.value_badge_marker_state",{name:t.label});if("entity_state"===e.kind)return this.host._t("marker.value_badge_state",{name:t.label});const s=this.host.hass.states[e.entity_id]?.attributes?.friendly_name||this.host._fullRegistryHass.entities[e.entity_id]?.name||e.entity_id;return this.host._t(`marker.value_badge_attr_${e.attribute}`,{name:s})}_controlCandidates(t){const e=this._markerDraft(t)?.id||t.devId||"",s=[],i=new Set;for(const t of this.host._markers){if(t.id===e||t.removed||t.hidden||!0!==t.is_light)continue;if("virtual"!==t.binding&&"active"!==this.host._bindingStatus(t.binding).kind)continue;const o=this.host._devices.find(e=>e.id===t.id);if(!o||o.hidden)continue;const a=this._controlRefInfo(`marker:${t.id}`);for(const t of Oi(o))i.add(t);s.push({value:`marker:${t.id}`,label:a.label,sub:a.sub,icon:a.icon,search:`${a.label} ${a.sub} ${t.id} ${Oi(o).join(" ")}`.toLowerCase()})}const o=Object.keys(this.host.hass.states||{}).filter(e=>Li(e)&&!i.has(e)&&Bi(t.binding,[e],this.host._bindingEntities(t.binding)).length>0&&this.host._planEntityAvailable(e)).map(t=>{const e=this._controlRefInfo(t);return{value:t,label:e.label,sub:t,icon:e.icon,search:`${e.label} ${t}`.toLowerCase()}}),a=t.controlsFilter.trim().toLowerCase();return[...s,...o].filter(e=>!t.controls.includes(e.value)&&(!a||e.search.includes(a))).slice(0,12).map(({search:t,...e})=>e)}_addControlRef(t,e){if(e.startsWith("marker:")){const s=this._markerDraft(t)?.id||t.devId||"";if(!s)return void this.host._showToast(this.host._t("toast.marker_binding_required"));const i=e.slice(7),o=this._markerDraft(t),a=o?[...this.host._markers.filter(t=>t.id!==s),o]:this.host._markers;if(Wi(a,s,i))return void this.host._showToast(this.host._t("toast.marker_control_cycle"))}this.host._markerDialog=this._announceToggleDraft({...t,controls:[...t.controls,e],controlsFilter:""})}_setMarkerGlowMode(t){const e=this.host._markerDialog;if(!e)return;if("auto"===t)return void(this.host._markerDialog={...e,glowMode:t,glowTouched:!0});const s=this._markerSpatialSource(e),i=ji(s?this.host._planHass.states[s.eid]:void 0,null,this.host._fillColors.glow_light.c),o=!e.glowColorDrafted,a="fixed"===t&&!e.glowBrightnessDrafted;this.host._markerDialog={...e,glowMode:t,glowColor:o?i.c:e.glowColor,glowBrightness:a?Math.max(1,Math.round(100*i.bri)):e.glowBrightness,glowColorDrafted:!0,glowBrightnessDrafted:e.glowBrightnessDrafted||"fixed"===t,glowTouched:!0}}_renderRadarSection(t,e,s="main"){return lh({dialog:t,device:e,registryHass:this.host._fullRegistryHass,planHass:this.host._planHass,hass:this.host.hass,spaceModelById:t=>this.host._spaceModelById(t),currentSpace:()=>this.host._spaceModel(),position:t=>this.host._pos(t),updateDialog:t=>{this.host._markerDialog&&(this.host._markerDialog={...this.host._markerDialog,...t})},dialogDeviceId:()=>this.host._markerDialog?.devId,t:(t,e)=>this.host._t(t,e),help:t=>this._help(t),boolInput:(t,e)=>this._boolInput(t,e),toast:t=>this.host._showToast(t),setup:this._radarSetup,configRev:this.host._cfgRev},s)}_renderMarkerDialog(){const t=this.host._markerDialog,e="virtual"===t.bindingMode,s=this._bindingCandidates();this.host._bindingEntities(t.binding);const i=e?null:this.host._bindingStatus(t.binding),o=!e&&this.host._bindingHasHaPage(t.binding),a=this._markerPreviewDevice(t),n=this._effectiveMarkerTapAction(t,a),r=a?Os(this.host._serverCfg?.spaces.find(t=>t.id===a.space)):null,c=a?this._markerPreviewDevices(a):this.host._devices,d="toggle"===n&&a?this._toggleIntent(a,c):null,p=this._toggleHintLines(d),u=a?Gi(this.host._planHass,a,{liveStates:!1!==this.host._config?.live_states,showTemperature:!1!==this.host._config?.show_temperature,showSignal:r?.showLqi??!1!==this.host._config?.show_signal,designPreview:!0,activityRuntime:this.host._activityRt.get(a.id),lightDevices:c,registryHass:this.host._fullRegistryHass,reducedMotion:this.host._reducedMotion}):null,_=a?Ms(this.host._planHass,a,c):[],m=a?Cs(this.host._planHass,a,_):null,g=t.valueBadgeTouched?t.valueBadgeEnabled:!!u?.valueBadge,f=t.valueBadgeTouched?t.valueBadgeSource:u?.valueBadge?.source||t.valueBadgeSource,b=t.valueBadgeTouched?t.valueBadgePosition:u?.valueBadge?.position||t.valueBadgePosition,v=qi(f),y=!!f&&!_.some(t=>t.key===v),$=_.find(t=>t.key===v),w=qi(t.valueSource),k=!(!t.valueSource||w&&_.some(t=>t.key===w)),x=_.find(t=>t.key===w),S=u?.valueSource?.sourceKey||"",M=this._markerAutoHasSpatialSource(t),C=!!a&&Ui(this.host._planHass,{...a}),P=Ki(t.lightRole,M,C,t.glowMode),D=!P.sourceExists,I=!P.fromSourceEnabled,T=P.passive,z=P.effectiveMode,R="never"===t.lightRole?this.host._t("marker.glow_disabled_never"):"auto"!==t.lightRole||M?T?this.host._t("marker.glow_passive_hint"):this.host._t("marker.glow_disabled_no_entity"):this.host._t("marker.glow_disabled_auto"),A=a?Oi(a):[],F=a&&Vi(a)||"",N=!!t.lightEntity&&!A.includes(t.lightEntity),E=a?Ji(a):[],H=!!t.toggleEntity&&!E.includes(t.toggleEntity),O="toggle"===n?this._toggleIntentForDialog({...t,toggleEntity:"",toggleEntityTouched:!0}):null,L=O?[...O.targets,...O.skippedTargets].map(t=>t.entityId||("ref"in t?t.ref:"")).filter(Boolean).join(", "):"",B=(()=>{if(e)return null;const i=s.find(e=>e.value===t.binding);if(i)return i.label;const[o,a]=t.binding.split(":");return"device"===o?this.host._fullRegistryHass.devices[a]?.name_by_user||this.host._fullRegistryHass.devices[a]?.name||a:this.host._fullRegistryHass.entities[a]?.name||this.host.hass.states[a]?.attributes?.friendly_name||a})();return h``}_markerValueBadgeFields(t){return Fi({touched:t.valueBadgeTouched,originalHas:t.originalHasValueBadge,original:t.originalValueBadge,enabled:t.valueBadgeEnabled,source:t.valueBadgeSource,position:t.valueBadgePosition})}_markerValueSourceFields(t){return Ni({touched:t.valueSourceTouched,originalHas:t.originalHasValueSource,original:t.originalValueSource,source:t.valueSource})}_markerDraft(t){if("ha"===t.bindingMode&&(!t.binding||"virtual"===t.binding))return null;const e=Fs(t.room),s=Cs(t.binding,t.devId,()=>"__hp_device_preview__"),i=this.host._markers.find(e=>e.id===s||e.id===t.devId),o=Ts(t.binding,t.controls,this.host._bindingEntities(t.binding)),a=this._effectiveStoredTapAction(t),n={id:s,binding:t.binding,name:t.name.trim()||null,icon:t.icon||null,display:"badge"!==t.display?t.display:null,ripple_color:"icon_ripple"===t.display&&t.rippleColor?t.rippleColor:null,ripple_size:"icon_ripple"===t.display&&1.5!==t.rippleSize?t.rippleSize:null,size:1!==t.size?t.size:null,angle:t.angle||null,...this._markerTapActionFields(t),...this._markerToggleEntityFields(t),tap_target:"run"===a&&t.tapTarget||null,tap_confirm:!!t.tapConfirm||null,controls:o.length?o:null,...this._markerLightFields(t),...this._markerValueBadgeFields(t),...this._markerValueSourceFields(t),use_climate_temp:!!t.useClimateTemp||null,glow_radius_cm:(()=>{const e=rt(t.glowRadius);return null==e||e<=0?null:Math.round(this.host._imperial?30.48*e:100*e)})(),model:t.model.trim()||null,link:t.link.trim()||null,description:t.description.trim()||null,pdfs:t.pdfs,hidden:t.hideFromPlan,vacuum:i?.vacuum||null},r=!!i&&("string"==typeof i.area&&i.area.length>0||null===i.area&&!!i.space&&!!i.room_id);return"virtual"===t.binding||t.roomTouched?(n.space=e?.space||("virtual"===t.binding?this.host._space:null),n.area=e?.area||null,n.room_id=e?.roomId||null):r&&(n.space=i.space,n.area=i.area,n.room_id=i.room_id),n}_markerPreviewDevice(t){const e=this._markerDraft(t);if(!e)return null;const s=`${this.host._haRegistry.revision}\n${Ft(this.host._markers)}\n${JSON.stringify(e)}`;if(this.host._markerPreviewMemo?.key===s)return this.host._markerPreviewMemo.device;const i=Ei({hass:this.host.hass,registry:this.host._haRegistry,areaToSpace:Object.fromEntries(Object.entries(this.host._areaToSpace).map(([t,e])=>[t,e.space])),marker:e,siblingMarkers:this.host._markers,settings:this.host._settings,excluded:this.host._excluded,showAll:this.host._showAll,firstSpaceId:this.host._model[0]?.id||this.host._space,loc:t=>this.host._t(t),iconRules:this.host._iconRules});return this.host._markerPreviewMemo={key:s,device:i},i}_markerPreviewDevices(t){const e=this.host._markerPreviewDevicesMemo;if(e?.base===this.host._devices&&e.preview===t)return e.devices;const s=[...this.host._devices.filter(e=>e.id!==t.id),t];return this.host._markerPreviewDevicesMemo={base:this.host._devices,preview:t,devices:s},s}_toggleIntent(t,e=this.host._devices){return this.host._toggleIntent(t,e)}_toggleIntentForDialog(t){const e=this._markerPreviewDevice(t);if(!e)return null;const s=this._markerPreviewDevices(e);return this._toggleIntent(e,s)}_toggleStateText(t,e){return this.host._toggleStateText(t,e)}_toggleConfirmationStateText(t){return this.host._toggleConfirmationStateText(t)}_toggleConfirmationLines(t){return this.host._toggleConfirmationLines(t)}_toggleHintLines(t){if(!t)return[];const e=t=>this.host._t(`marker.toggle_effect_${t.replace("-","_")}`),s=t=>this.host._t(`marker.toggle_skip_${t.replace("-","_")}`);return Hi(t,{single:t=>{if("via"in t&&"virtual-light"===t.via)return this.host._t("marker.virtual_light_target",{name:t.name});const e=t.entityId||("ref"in t?t.ref:""),s=t.name||e;return this.host._t("marker.toggle_hint_single",{name:s,id:e})},group:t=>this.host._t("marker.toggle_hint_group",{count:t.length,names:t.map(t=>`${t.name} (${t.entityId})`).join(", ")}),currentNext:(t,s)=>"virtual-light"===t.via?this.host._t("marker.virtual_light_current",{state:this.host._t("on"===t.state?"marker.virtual_light_state_on":"marker.virtual_light_state_off"),effect:e(s)}):this.host._t("marker.toggle_hint_current",{state:this._toggleStateText(t.entityId,t.state),effect:e(s)}),groupCurrentNext:(t,s)=>this.host._t("marker.toggle_hint_group_current",{on:t.filter(t=>"on"===t.state).length,count:t.length,effect:e(s)}),skipped:t=>this.host._t("marker.toggle_hint_skipped",{count:t.length,targets:t.map(t=>{const e=t.entityId||t.ref;return`${t.name||e} (${e}: ${s(t.reason)})`}).join(", ")}),none:t=>this.host._t(`marker.toggle_none_${t.replaceAll("-","_")}`)})}_effectiveStoredTapAction(t,e){return t.tapActionTouched?t.tapAction:zs(t.originalHasTapAction?t.originalTapAction:null,e)}_effectiveMarkerTapAction(t,e=this._markerPreviewDevice(t)){return this._effectiveStoredTapAction(t,e?.primary?.split(".")[0])}_announceToggleDraft(t){const e=this._markerPreviewDevice(t),s=t.tapActionTouched?t:{...t,tapAction:this._effectiveMarkerTapAction(t,e)},i="toggle"===s.tapAction?this._toggleHintLines(this._toggleIntentForDialog(s)).join(" "):"";return{...s,tapHintAnnouncement:i}}_valueBadgeForBinding(t,e){const s={...t,binding:e,valueBadgeEnabled:!1,valueBadgeSource:null,valueBadgeTouched:!0},i=this._markerPreviewDevice(s);if(!i)return{valueBadgeEnabled:!1,valueBadgeSource:null,valueBadgeTouched:!0};const o=[...this.host._devices.filter(t=>t.id!==i.id),i],a=Ds(this.host._planHass,i,o),n=Is(this.host._planHass,i,a);return{valueBadgeEnabled:t.valueBadgeEnabled&&!!n,valueBadgeSource:n,valueBadgeTouched:!0}}_markerSpatialSource(t){const e=this._markerPreviewDevice(t);if(!e)return null;const s={...e,hidden:!1};return Oi(Li(this.host._planHass,[...this.host._devices.filter(t=>t.id!==s.id),s],null,this.host._virtualLights).filter(t=>t.device.id===s.id))}_markerAutoHasSpatialSource(t){const e={...t,lightRole:"auto",lightRoleTouched:!0},s=this._markerPreviewDevice(e);return!!s&&Bi(this.host._planHass,{...s})}_setMarkerLightRole(t){const e=this.host._markerDialog;e&&(this.host._markerDialog={...e,lightRole:t,lightRoleTouched:!0})}_controlRefInfo(t){if(!t.startsWith("marker:"))return{label:this.host.hass.states[t]?.attributes?.friendly_name||t,sub:t,icon:t.startsWith("light.")?"mdi:lightbulb":"mdi:toggle-switch",warning:!this.host._planEntityAvailable(t)};const e=t.slice(7),s=this.host._markers.find(t=>t.id===e),i=this.host._devices.find(t=>t.id===e);if(!s||s.removed||!0!==s.is_light)return{label:this.host._t("marker.control_missing_label"),sub:`${this.host._t("marker.control_broken")} (${t})`,icon:"mdi:alert-outline",warning:!0};const o=this.host._serverCfg?.spaces.find(t=>t.id===(i?.space||s.space)),a=!!i&&Wi(i).length>0;return{label:s.name||i?.name||e,sub:[o?.title||i?.space||s.space,s.room_id||i?.area,a?"":this.host._t("marker.control_passive")].filter(Boolean).join(" · "),icon:s.icon||i?.icon||"mdi:lightbulb-outline",warning:!0===s.hidden||!0===i?.hidden}}_valueBadgeCandidateLabel(t){const e=t.source;if("derived_lqi"===e.kind)return this.host._t("marker.value_badge_lqi");if("derived_marker_state"===e.kind)return this.host._t("marker.value_badge_marker_state",{name:t.label});if("entity_state"===e.kind)return this.host._t("marker.value_badge_state",{name:t.label});const s=this.host.hass.states[e.entity_id]?.attributes?.friendly_name||this.host._fullRegistryHass.entities[e.entity_id]?.name||e.entity_id;return this.host._t(`marker.value_badge_attr_${e.attribute}`,{name:s})}_controlCandidates(t){const e=this._markerDraft(t)?.id||t.devId||"",s=[],i=new Set;for(const t of this.host._markers){if(t.id===e||t.removed||t.hidden||!0!==t.is_light)continue;if("virtual"!==t.binding&&"active"!==this.host._bindingStatus(t.binding).kind)continue;const o=this.host._devices.find(e=>e.id===t.id);if(!o||o.hidden)continue;const a=this._controlRefInfo(`marker:${t.id}`);for(const t of Wi(o))i.add(t);s.push({value:`marker:${t.id}`,label:a.label,sub:a.sub,icon:a.icon,search:`${a.label} ${a.sub} ${t.id} ${Wi(o).join(" ")}`.toLowerCase()})}const o=Object.keys(this.host.hass.states||{}).filter(e=>ji(e)&&!i.has(e)&&Gi(t.binding,[e],this.host._bindingEntities(t.binding)).length>0&&this.host._planEntityAvailable(e)).map(t=>{const e=this._controlRefInfo(t);return{value:t,label:e.label,sub:t,icon:e.icon,search:`${e.label} ${t}`.toLowerCase()}}),a=t.controlsFilter.trim().toLowerCase();return[...s,...o].filter(e=>!t.controls.includes(e.value)&&(!a||e.search.includes(a))).slice(0,12).map(({search:t,...e})=>e)}_addControlRef(t,e){if(e.startsWith("marker:")){const s=this._markerDraft(t)?.id||t.devId||"";if(!s)return void this.host._showToast(this.host._t("toast.marker_binding_required"));const i=e.slice(7),o=this._markerDraft(t),a=o?[...this.host._markers.filter(t=>t.id!==s),o]:this.host._markers;if(qi(a,s,i))return void this.host._showToast(this.host._t("toast.marker_control_cycle"))}this.host._markerDialog=this._announceToggleDraft({...t,controls:[...t.controls,e],controlsFilter:""})}_setMarkerGlowMode(t){const e=this.host._markerDialog;if(!e)return;if("auto"===t)return void(this.host._markerDialog={...e,glowMode:t,glowTouched:!0});const s=this._markerSpatialSource(e),i=Ui(s?this.host._planHass.states[s.eid]:void 0,null,this.host._fillColors.glow_light.c),o=!e.glowColorDrafted,a="fixed"===t&&!e.glowBrightnessDrafted;this.host._markerDialog={...e,glowMode:t,glowColor:o?i.c:e.glowColor,glowBrightness:a?Math.max(1,Math.round(100*i.bri)):e.glowBrightness,glowColorDrafted:!0,glowBrightnessDrafted:e.glowBrightnessDrafted||"fixed"===t,glowTouched:!0}}_renderRadarSection(t,e,s="main"){return ph({dialog:t,device:e,registryHass:this.host._fullRegistryHass,planHass:this.host._planHass,hass:this.host.hass,spaceModelById:t=>this.host._spaceModelById(t),currentSpace:()=>this.host._spaceModel(),position:t=>this.host._pos(t),updateDialog:t=>{this.host._markerDialog&&(this.host._markerDialog={...this.host._markerDialog,...t})},dialogDeviceId:()=>this.host._markerDialog?.devId,t:(t,e)=>this.host._t(t,e),help:t=>this._help(t),boolInput:(t,e)=>this._boolInput(t,e),toast:t=>this.host._showToast(t),setup:this._radarSetup,configRev:this.host._cfgRev},s)}_renderMarkerDialog(){const t=this.host._markerDialog,e="virtual"===t.bindingMode,s=this._bindingCandidates();this.host._bindingEntities(t.binding);const i=e?null:this.host._bindingStatus(t.binding),o=!e&&this.host._bindingHasHaPage(t.binding),a=this._markerPreviewDevice(t),n=this._effectiveMarkerTapAction(t,a),r=a?Ws(this.host._serverCfg?.spaces.find(t=>t.id===a.space)):null,l=a?this._markerPreviewDevices(a):this.host._devices,h="toggle"===n&&a?this._toggleIntent(a,l):null,c=this._toggleHintLines(h),u=a?Ki(this.host._planHass,a,{liveStates:!1!==this.host._config?.live_states,showTemperature:!1!==this.host._config?.show_temperature,showSignal:r?.showLqi??!1!==this.host._config?.show_signal,designPreview:!0,activityRuntime:this.host._activityRt.get(a.id),lightDevices:l,registryHass:this.host._fullRegistryHass,reducedMotion:this.host._reducedMotion}):null,_=a?Ds(this.host._planHass,a,l):[],m=a?Is(this.host._planHass,a,_):null,g=t.valueBadgeTouched?t.valueBadgeEnabled:!!u?.valueBadge,f=t.valueBadgeTouched?t.valueBadgeSource:u?.valueBadge?.source||t.valueBadgeSource,b=t.valueBadgeTouched?t.valueBadgePosition:u?.valueBadge?.position||t.valueBadgePosition,v=Vi(f),y=!!f&&!_.some(t=>t.key===v),$=_.find(t=>t.key===v),w=Vi(t.valueSource),k=!(!t.valueSource||w&&_.some(t=>t.key===w)),x=_.find(t=>t.key===w),S=u?.valueSource?.sourceKey||"",M=this._markerAutoHasSpatialSource(t),C=!!a&&Ji(this.host._planHass,{...a}),P=Yi(t.lightRole,M,C,t.glowMode),D=!P.sourceExists,I=!P.fromSourceEnabled,T=P.passive,z=P.effectiveMode,R="never"===t.lightRole?this.host._t("marker.glow_disabled_never"):"auto"!==t.lightRole||M?T?this.host._t("marker.glow_passive_hint"):this.host._t("marker.glow_disabled_no_entity"):this.host._t("marker.glow_disabled_auto"),A=a?Wi(a):[],F=a&&Xi(a)||"",N=!!t.lightEntity&&!A.includes(t.lightEntity),E=a?Zi(a):[],H=!!t.toggleEntity&&!E.includes(t.toggleEntity),O="toggle"===n?this._toggleIntentForDialog({...t,toggleEntity:"",toggleEntityTouched:!0}):null,L=O?[...O.targets,...O.skippedTargets].map(t=>t.entityId||("ref"in t?t.ref:"")).filter(Boolean).join(", "):"",B=(()=>{if(e)return null;const i=s.find(e=>e.value===t.binding);if(i)return i.label;const[o,a]=t.binding.split(":");return"device"===o?this.host._fullRegistryHass.devices[a]?.name_by_user||this.host._fullRegistryHass.devices[a]?.name||a:this.host._fullRegistryHass.entities[a]?.name||this.host.hass.states[a]?.attributes?.friendly_name||a})();return p`this._closeMarkerDialog()}>
    - ${"ha_disabled"===i?.kind?h`
    + ${"ha_disabled"===i?.kind?p`
    ${this.host._t(`marker.ha_disabled_${i.reason}`)} - ${o?h``:l} -
    `:"unverified"===i?.kind&&t.binding?h`
    + `:d} +
    `:"unverified"===i?.kind&&t.binding?p`
    ${this.host._t("marker.ha_registry_limited")} -
    `:l} +
    `:d}
    @@ -2137,32 +2137,32 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae ${this.host._t("marker.show_entities")}
    - ${"ha"===t.bindingMode?h` - ${t.bindingOpen?h`
    + ${t.bindingOpen?p`
    this.host._markerDialog={...t,bindingFilter:e.target.value}} />
    - ${s.map(e=>h`
    {if(e.value===t.binding)return void(this.host._markerDialog={...t,bindingOpen:!1});const s={...t,binding:e.value,bindingOpen:!1,controls:Ps(e.value,t.controls,this.host._bindingEntities(e.value)),autoIcon:this.host._autoIconForBinding(e.value),...Zl(t.radar,t.radarTouched,t.radarRemove)};this.host._markerDialog=this._announceToggleDraft({...s,...this._valueBadgeForBinding(s,e.value),valueSource:null,valueSourceTouched:!0})}}> + ${s.map(e=>p`
    {if(e.value===t.binding)return void(this.host._markerDialog={...t,bindingOpen:!1});const s={...t,binding:e.value,bindingOpen:!1,controls:Ts(e.value,t.controls,this.host._bindingEntities(e.value)),autoIcon:this.host._autoIconForBinding(e.value),...sh(t.radar,t.radarTouched,t.radarRemove)};this.host._markerDialog=this._announceToggleDraft({...s,...this._valueBadgeForBinding(s,e.value),valueSource:null,valueSourceTouched:!0})}}> ${e.label}${e.sub}
    `)} - ${s.length?l:h`
    ${this.host._t("marker.nothing_found")}
    `} + ${s.length?d:p`
    ${this.host._t("marker.nothing_found")}
    `}
    -
    `:l}`:l} +
    `:d}`:d}
    ${this._renderRadarSection(t,a)} @@ -2170,13 +2170,13 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae - ${"toggle"===n&&(E.length>1||H)?h`
    + ${"toggle"===n&&(E.length>1||H)?p`
    ${this._help("marker.toggle_entity.help")} @@ -2186,65 +2186,65 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae - ${E.map(e=>h``)} - ${H?h`

    + ${H?p`

    ${this.host._t("marker.toggle_entity_missing",{entity:t.toggleEntity,fallback:L||this.host._t("marker.toggle_entity_none")})} -

    `:l} -
    `:l} - ${"toggle"===n?h`
    - ${p.map(t=>h`
    ${t}
    `)} +

    `:d} +
    `:d} + ${"toggle"===n?p`
    + ${c.map(t=>p`
    ${t}
    `)}
    -
    ${t.tapHintAnnouncement}
    `:l} - ${"run"===n?(()=>{const e=t.runFilter.trim().toLowerCase(),s=this._runCandidates().filter(t=>!e||t.label.toLowerCase().includes(e)||t.value.includes(e)),i=t.tapTarget?this._runCandidates().find(e=>e.value===t.tapTarget):null;return h` +
    ${t.tapHintAnnouncement}
    `:d} + ${"run"===n?(()=>{const e=t.runFilter.trim().toLowerCase(),s=this._runCandidates().filter(t=>!e||t.label.toLowerCase().includes(e)||t.value.includes(e)),i=t.tapTarget?this._runCandidates().find(e=>e.value===t.tapTarget):null;return p` - ${t.tapTarget&&!i?h`
    ${this.host._t("marker.run_target_gone",{id:t.tapTarget})}
    `:l} + ${t.tapTarget&&!i?p`
    ${this.host._t("marker.run_target_gone",{id:t.tapTarget})}
    `:d} {t.target.select()}} @input=${e=>this.host._markerDialog={...t,runFilter:e.target.value,tapTarget:""}} /> - ${i?l:h`
    - ${s.slice(0,40).map(e=>h`
    + ${s.slice(0,40).map(e=>p`
    this.host._markerDialog={...t,tapTarget:e.value,runFilter:""}}> ${e.label}${e.sub}
    `)} - ${s.length?l:h`
    ${this.host._t("marker.nothing_found")}
    `} -
    `}`})():l} - ${"run"===n||"toggle"===n?h`
    `}`})():d} + ${"run"===n||"toggle"===n?p``:l} + `:d}
    ${this._help("marker.controls.help")}
    - ${t.controls.length?h`
    - ${t.controls.map(e=>{const s=this._controlRefInfo(e);return h` + ${t.controls.length?p`
    + ${t.controls.map(e=>{const s=this._controlRefInfo(e);return p` ${s.label} this.host._markerDialog=this._announceToggleDraft({...t,controls:t.controls.filter(t=>t!==e)})}> `})} -
    `:l} +
    `:d} this.host._markerDialog={...t,controlsFilter:e.target.value}} /> - ${t.controlsFilter.trim()?h`
    - ${this._controlCandidates(t).map(e=>h``)} -
    `:l} +
    `:d} - ${this.host._bindingHasClimate(t.binding)?h``:d}
    ${this.host._t("marker.light_role_label")}${this._help("marker.light_role.help")}
    @@ -2260,7 +2260,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    - ${"always"===t.lightRole&&(A.length>1||N)?h`
    + ${"always"===t.lightRole&&(A.length>1||N)?p`
    ${this._help("marker.light_entity.help")} @@ -2270,47 +2270,47 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae - ${A.map(e=>h``)} - ${N?h`

    + ${N?p`

    ${this.host._t("marker.light_entity_missing",{entity:t.lightEntity,fallback:F||"—"})} -

    `:l} -
    `:l} +

    `:d} +
    `:d}
    ${this.host._t("marker.glow_color_label")}${this._help("marker.glow_mode.help")}
    - ${"auto"!==z?h`
    + ${"auto"!==z?p`
    {this.host._markerDialog={...t,glowMode:z,glowColor:e.detail.color,glowColorDrafted:!0,glowTouched:!0}}}> - ${"fixed"===z?h` + ${"fixed"===z?p` ${this.host._t("marker.glow_brightness")} ${this._rangeInput(1,100,1,t.glowBrightness,e=>{this.host._markerDialog={...t,glowMode:z,glowBrightness:e,glowBrightnessDrafted:!0,glowTouched:!0}},D,this.host._t("marker.glow_brightness"))} - ${Math.round(t.glowBrightness)}%`:l} -
    `:l} + ${Math.round(t.glowBrightness)}%`:d} +
    `:d}
    @@ -2320,127 +2320,127 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    this.host._markerDialog={...t,glowRadius:e.target.value}} /> ${this.host._imperial?this.host._t("gs.unit_ft"):this.host._t("gs.unit_m")}
    - ${D||T?h`

    + ${D||T?p`

    ${R} -

    `:l} +

    `:d} - ${customElements.get("ha-icon-picker")?h`{const s=e.detail.value||"";(t.icon||s!==t.autoIcon)&&(this.host._markerDialog={...t,icon:s})}}>`:h`{const s=e.detail.value||"";(t.icon||s!==t.autoIcon)&&(this.host._markerDialog={...t,icon:s})}}>`:p`this.host._markerDialog={...t,icon:e.target.value}} />`} - ${!t.icon&&t.autoIcon?h`

    + ${!t.icon&&t.autoIcon?p`

    ${this.host._t("marker.icon_auto",{icon:t.autoIcon})}

    `:l} +

    `:d} -

    ${this.host._t(Vc[t.display])}

    - ${"value"===t.display?h`
    +

    ${this.host._t(Zc[t.display])}

    + ${"value"===t.display?p`
    ${this._help("marker.value_source.help")}
    - ${x?h`

    ${x.technical}

    `:l} - ${e?h`

    + ${x?p`

    ${x.technical}

    `:d} + ${e?p`

    ${this.host._t("marker.preview.reason.value_virtual")} -

    `:k?h`

    +

    `:k?p`

    ${this.host._t("marker.value_source_missing_hint")} -

    `:l} -
    `:l} - ${"static_icon"===t.display&&this.host._bindingHasAlarm(t.binding)?h`
    +

    `:d} +
    `:d} + ${"static_icon"===t.display&&this.host._bindingHasAlarm(t.binding)?p`
    ${this.host._t("marker.static_alarm_warning")} -
    `:l} +
    `:d}
    ${this.host._t("marker.value_badge_title")}${this._help("marker.value_badge.help")} - ${"static_icon"===t.display?h`

    + ${"static_icon"===t.display?p`

    ${this.host._t("marker.value_badge_static")} -

    `:_.length||t.valueBadgeSource?l:h`

    +

    `:_.length||t.valueBadgeSource?d:p`

    ${this.host._t("marker.value_badge_empty")}

    `} - ${g?h` + ${g?p`
    ${this._help("marker.value_badge_source.help")}
    - ${$?h`

    ${$.technical}

    `:l} - ${y?h`

    + ${$?p`

    ${$.technical}

    `:d} + ${y?p`

    ${this.host._t("marker.value_badge_missing_hint")} -

    `:l} - ${"value"===t.display&&v===S?h`

    +

    `:d} + ${"value"===t.display&&v===S?p`

    ${this.host._t("marker.value_badge_duplicate")} -

    `:l} +

    `:d}
    ${this._help("marker.value_badge_position.help")}
    - `:l} + `:d}
    - ${u?h` - `:h`
    + `:p`
    ${this.host._t("marker.preview.select_source")}
    `} - ${"icon_ripple"===t.display?h`
    + ${"icon_ripple"===t.display?p`
    ×${t.rippleSize}
    -

    ${this.host._t("marker.activity_alarm_note")}

    `:l} +

    ${this.host._t("marker.activity_alarm_note")}

    `:d}
    @@ -2480,8 +2480,8 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    - ${t.pdfs.map(t=>h` - ${t.name} + ${t.pdfs.map(t=>p` + ${t.name} this._removeMarkerPdf(t.url)}>`)}
    - ${t.devId?h``:l} - ${t.devId?h``:l} + `:d}
    - `}(this.host,()=>{this._saveSpaceCopy()});const e=this.host._importTotal>0&&"create"===t.mode?this.host._t("import.progress",{i:this.host._importTotal-this.host._importQueue.length,n:this.host._importTotal}):"",s=()=>{this.host._spaceDialog=null,this.host._importQueue=[],this.host._importTotal=0};return h``}(this.host,()=>{this._saveSpaceCopy()});const e=this.host._importTotal>0&&"create"===t.mode?this.host._t("import.progress",{i:this.host._importTotal-this.host._importQueue.length,n:this.host._importTotal}):"",s=()=>{this.host._spaceDialog=null,this.host._importQueue=[],this.host._importTotal=0};return p`
    @@ -2551,11 +2551,11 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae - ${"file"===t.source?h`
    - ${t.planFile?h`${t.planFile.name}`:t.planUrl?h`${this.host._t("space.plan_alt")}`:h`${this.host._t("space.no_plan")}`} + ${"file"===t.source?p`
    + ${t.planFile?p`${t.planFile.name}`:t.planUrl?p`${this.host._t("space.plan_alt")}`:p`${this.host._t("space.no_plan")}`}
    - ${t.pickSaved?this._renderServerPlans(t):l}`:l} + ${t.pickSaved?this._renderServerPlans(t):d}`:d} @@ -2581,16 +2581,16 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    {const s=e.target.value,i=ot(s),o=null==i?null:eo(i,this.host._imperial);this.host._spaceDialog={...t,cellCmInput:s,cellCmTouched:!0,cellCm:null!=o&&o>0?Math.max(.1,Math.min(Yc,o)):t.cellCm}}} /> + min=${qs(.1,this.host._imperial)} + max=${qs(td,this.host._imperial)} + step="0.1" .value=${t.cellCmInput??qs(t.cellCm,this.host._imperial)} + @input=${e=>{const s=e.target.value,i=rt(s),o=null==i?null:oo(i,this.host._imperial);this.host._spaceDialog={...t,cellCmInput:s,cellCmTouched:!0,cellCm:null!=o&&o>0?Math.max(.1,Math.min(td,o)):t.cellCm}}} /> ${this.host._t(this.host._imperial?"space.scale_unit_imperial":"space.scale_unit")}
    @@ -2607,7 +2607,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae
    ${this.host._t("space.hide_openings_tip")}
    - ${[["labelTemp","space.label_temp"],["labelHum","space.label_hum"],["labelLqi","space.label_lqi"],["labelLight","space.label_light"]].map(([e,s])=>h` - ${"custom"===e&&"custom"===t.fillMode?h`
    + ${"custom"===e&&"custom"===t.fillMode?p`
    ${this.host._t("space.custom_fill")} {this.host._spaceDialog={...t,customFill:{c:e.detail.color,a:e.detail.opacity}}}}> - ${t.customFill?h``:l} -
    `:l}`)} + ${this.host._t("btn.reset")}`:d} +
    `:d}`)} - ${t.deleteBlockers?h``:l} + ${t.deleteBlockers?p``:d}
    `:d}
    - ${this.host._importTotal>0&&"create"===t.mode?h``:l} + ${this.host._importTotal>0&&"create"===t.mode?p``:d}
    -
    `}_renderMergeDialog(){const t=this.host._mergeDialog,e=this.host._spaceModel()?.rooms||[],s=(s,i)=>{const o=e.find(t=>t.id===s),a=o?.area?this.host.hass.areas[o.area]?.name:null;return h`
    `}_renderMergeDialog(){const t=this.host._mergeDialog,e=this.host._spaceModel()?.rooms||[],s=(s,i)=>{const o=e.find(t=>t.id===s),a=o?.area?this.host.hass.areas[o.area]?.name:null;return p``};return h``};return p`this.host._mergeDialog=null}>

    ${this.host._t("merge.hint")}

    @@ -2756,7 +2756,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="74cbeb9792716ab64cfbcf339d3044c6e8ae ${this.host._t("btn.save")}
    -
    `}_renderRoomSource(t){const e="temp"===t?this.host._roomTempSrc:this.host._roomHumSrc,s=e=>{"temp"===t?this.host._roomTempSrc=e:this.host._roomHumSrc=e,this.host.requestUpdate()},i=this.host._roomSrcOpen===t;return h` +
    `}_renderRoomSource(t){const e="temp"===t?this.host._roomTempSrc:this.host._roomHumSrc,s=e=>{"temp"===t?this.host._roomTempSrc=e:this.host._roomHumSrc=e,this.host.requestUpdate()},i=this.host._roomSrcOpen===t;return p` - ${e||i?h` - ${i?h`
    + ${i?p`
    {this.host._roomSrcFilter=t.target.value,this.host.requestUpdate()}} />
    - ${this._roomSrcCandidates().map(t=>h`
    p`
    {s(t.value),this.host._roomSrcOpen=null}}> ${t.label}${t.sub}
    `)}
    -
    `:l}`:l}`}_renderRoomDialog(){const t=!!this.host._roomEditId,e=t?null:this.host._wallFaceBatch,s=e&&e.candidates.length>1?this.host._t("room.queue_progress",{current:e.index+1,total:e.candidates.length}):"",i=Os(this.host._curSpaceCfg),o=this.host._roomFill||i.fill,a=this.host._roomCustomFill||i.customFill,n=it(this.host._roomTempMin,this.host._roomTempMax).valid,r=(!!this.host._areaSel||!!this.host._nameSel.trim())&&n,c=[...this.host._freeAreas];if(t&&this.host._areaSel&&!c.some(t=>t.area_id===this.host._areaSel)){const t=this.host.hass.areas[this.host._areaSel];t&&c.unshift(t)}return h``:d}`:d}`}_renderRoomDialog(){const t=!!this.host._roomEditId,e=t?null:this.host._wallFaceBatch,s=e&&e.candidates.length>1?this.host._t("room.queue_progress",{current:e.index+1,total:e.candidates.length}):"",i=Ws(this.host._curSpaceCfg),o=this.host._roomFill||i.fill,a=this.host._roomCustomFill||i.customFill,n=nt(this.host._roomTempMin,this.host._roomTempMax).valid,r=(!!this.host._areaSel||!!this.host._nameSel.trim())&&n,l=[...this.host._freeAreas];if(t&&this.host._areaSel&&!l.some(t=>t.area_id===this.host._areaSel)){const t=this.host.hass.areas[this.host._areaSel];t&&l.unshift(t)}return p`this._roomDialogCancel()}>
    - ${s?h`

    + ${s?p`

    ${s} -

    `:l} +

    `:d} {this.host._areaSel=t.target.value,!this.host._nameSel&&this.host._areaSel&&(this.host._nameSel=this.host.hass.areas[this.host._areaSel]?.name||""),this.host.requestUpdate()}}> - ${c.map(t=>h``)} + ${l.map(t=>p``)} - ${[["","fill.inherit"],...oo.map(t=>[t,"fill."+t])].map(([t,e])=>h`